This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
set FD_CLOEXEC atomically in easy cases
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically by the tool
15 # called "metaconfig". Rather than working with this copy of Configure,
16 # you should use metaconfig. Perl uses a modified version of this
17 # tool, and this, together with the metaconfig units, are available
18 # in the git repository:
19 #    $ git clone https://github.com/perl5-metaconfig/metaconfig metaconfig
20 # The original dist package (including metaconfig) is available on github:
21 #    $ git clone https://github.com/rmanfredi/dist.git dist-git
22 #
23 # Though this script was generated by metaconfig from metaunits, it is
24 # OK to send patches against Configure itself (but not to commit them
25 # to blead). It's up to
26 # the Configure maintainers to backport the patch to the metaunits if it
27 # is accepted. Exceptions to this rule, and more information, is in
28 # Porting/pumpkin.pod.
29
30 # Generated using [metaconfig 3.5 PL0]
31 # (with additional metaconfig patches by perlbug@perl.org)
32
33 cat >c1$$ <<EOF
34 ARGGGHHHH!!!!!
35
36 SCO csh still thinks true is false.  Write to SCO today and tell them that next
37 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
38
39 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
40 we'd have to do is go in and swap the && and || tokens, wherever they are.)
41
42 [End of diatribe. We now return you to your regularly scheduled programming...]
43 EOF
44 cat >c2$$ <<EOF
45
46 OOPS!  You naughty creature!  You didn't run Configure with sh!
47 I will attempt to remedy the situation by running sh for you...
48 EOF
49
50 true || cat c1$$ c2$$
51 true || exec sh $0 $argv:q
52
53 (exit $?0) || cat c2$$
54 (exit $?0) || exec sh $0 $argv:q
55 rm -f c1$$ c2$$
56
57 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
58         cat <<EOF
59 ***
60 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
61 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
62 *** Please read the README.plan9 for further instructions.
63 *** Cannot continue, aborting.
64 ***
65 EOF
66         exit 1
67 fi
68
69 if test -f /sys/utilities/MultiView ; then
70         # AmigaOS, test -c for /dev/null is not useful
71         :
72 elif test ! -c /dev/null ; then
73         cat <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin|*msys) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 hostgenerate=''
212 hostosname=''
213 hostperl=''
214 run=''
215 targetarch=''
216 targetdir=''
217 targetenv=''
218 targethost=''
219 targetmkdir=''
220 targetport=''
221 to=''
222 usecrosscompile=''
223 extern_C=''
224 mistrustnm=''
225 usedevel=''
226 perllibs=''
227 dynamic_ext=''
228 extensions=''
229 known_extensions=''
230 nonxs_ext=''
231 static_ext=''
232 useopcode=''
233 useposix=''
234 extras=''
235 d_bsd=''
236 d_eunice=''
237 d_xenix=''
238 eunicefix=''
239 ar=''
240 awk=''
241 bash=''
242 bison=''
243 byacc=''
244 cat=''
245 chgrp=''
246 chmod=''
247 chown=''
248 comm=''
249 compress=''
250 cp=''
251 cpio=''
252 cpp=''
253 csh=''
254 date=''
255 echo=''
256 egrep=''
257 emacs=''
258 expr=''
259 find=''
260 flex=''
261 gmake=''
262 grep=''
263 gzip=''
264 inews=''
265 ksh=''
266 less=''
267 line=''
268 lint=''
269 ln=''
270 lp=''
271 lpr=''
272 ls=''
273 mail=''
274 mailx=''
275 make=''
276 mkdir=''
277 more=''
278 mv=''
279 nm=''
280 nroff=''
281 perl=''
282 pg=''
283 pmake=''
284 pr=''
285 rm=''
286 rmail=''
287 sed=''
288 sendmail=''
289 shar=''
290 sleep=''
291 smail=''
292 sort=''
293 submit=''
294 tail=''
295 tar=''
296 tbl=''
297 tee=''
298 test=''
299 touch=''
300 tr=''
301 troff=''
302 uname=''
303 uniq=''
304 uuname=''
305 vi=''
306 zcat=''
307 zip=''
308 full_ar=''
309 full_sed=''
310 libswanted=''
311 hint=''
312 myuname=''
313 osname=''
314 osvers=''
315 Author=''
316 Date=''
317 Header=''
318 Id=''
319 Locker=''
320 Log=''
321 RCSfile=''
322 Revision=''
323 Source=''
324 State=''
325 sysroot=''
326 _a=''
327 _exe=''
328 _o=''
329 archobjs=''
330 exe_ext=''
331 firstmakefile=''
332 lib_ext=''
333 obj_ext=''
334 path_sep=''
335 rm_try=''
336 afs=''
337 afsroot=''
338 alignbytes=''
339 archlib=''
340 archlibexp=''
341 d_archlib=''
342 installarchlib=''
343 archname=''
344 myarchname=''
345 useversionedarchname=''
346 d_atolf=''
347 d_atoll=''
348 baserev=''
349 bin=''
350 binexp=''
351 initialinstalllocation=''
352 installbin=''
353 userelocatableinc=''
354 byteorder=''
355 cc=''
356 ccflags=''
357 cppflags=''
358 ldflags=''
359 lkflags=''
360 locincpth=''
361 optimize=''
362 cf_email=''
363 cf_by=''
364 cf_time=''
365 charbits=''
366 charsize=''
367 contains=''
368 cpp_stuff=''
369 cpplast=''
370 cppminus=''
371 cpprun=''
372 cppstdin=''
373 d__fwalk=''
374 d_accept4=''
375 d_access=''
376 d_accessx=''
377 d_acosh=''
378 d_aintl=''
379 d_alarm=''
380 asctime_r_proto=''
381 d_asctime_r=''
382 d_asinh=''
383 d_atanh=''
384 d_attribute_deprecated=''
385 d_attribute_format=''
386 d_attribute_malloc=''
387 d_attribute_nonnull=''
388 d_attribute_noreturn=''
389 d_attribute_pure=''
390 d_attribute_unused=''
391 d_attribute_warn_unused_result=''
392 d_printf_format_null=''
393 d_backtrace=''
394 d_builtin_choose_expr=''
395 d_builtin_expect=''
396 d_builtin_add_overflow=''
397 d_builtin_mul_overflow=''
398 d_builtin_sub_overflow=''
399 d_c99_variadic_macros=''
400 d_casti32=''
401 castflags=''
402 d_castneg=''
403 d_cbrt=''
404 d_chown=''
405 d_chroot=''
406 d_chsize=''
407 d_class=''
408 d_clearenv=''
409 d_closedir=''
410 d_void_closedir=''
411 d_cmsghdr_s=''
412 d_const=''
413 d_copysign=''
414 d_copysignl=''
415 d_cplusplus=''
416 cryptlib=''
417 d_crypt=''
418 crypt_r_proto=''
419 d_crypt_r=''
420 d_csh=''
421 full_csh=''
422 d_ctermid=''
423 ctermid_r_proto=''
424 d_ctermid_r=''
425 ctime_r_proto=''
426 d_ctime_r=''
427 d_cuserid=''
428 d_dbminitproto=''
429 d_difftime=''
430 d_dir_dd_fd=''
431 d_dirfd=''
432 d_dladdr=''
433 d_dlerror=''
434 d_dlopen=''
435 d_dlsymun=''
436 d_dosuid=''
437 d_suidsafe=''
438 d_drand48_r=''
439 drand48_r_proto=''
440 d_drand48proto=''
441 d_dup2=''
442 d_dup3=''
443 d_eaccess=''
444 d_endgrent=''
445 d_endgrent_r=''
446 endgrent_r_proto=''
447 d_endhent=''
448 d_endhostent_r=''
449 endhostent_r_proto=''
450 d_endnent=''
451 d_endnetent_r=''
452 endnetent_r_proto=''
453 d_endpent=''
454 d_endprotoent_r=''
455 endprotoent_r_proto=''
456 d_endpwent=''
457 d_endpwent_r=''
458 endpwent_r_proto=''
459 d_endsent=''
460 d_endservent_r=''
461 endservent_r_proto=''
462 d_erf=''
463 d_erfc=''
464 d_exp2=''
465 d_expm1=''
466 d_faststdio=''
467 d_fchdir=''
468 d_fchmod=''
469 d_fchown=''
470 d_fcntl=''
471 d_fcntl_can_lock=''
472 d_fd_macros=''
473 d_fd_set=''
474 d_fds_bits=''
475 d_fdclose=''
476 d_fdim=''
477 d_fegetround=''
478 d_fgetpos=''
479 d_finite=''
480 d_finitel=''
481 d_flexfnam=''
482 d_flock=''
483 d_flockproto=''
484 d_fma=''
485 d_fmax=''
486 d_fmin=''
487 d_fork=''
488 d_fp_class=''
489 d_fp_classl=''
490 d_fpclass=''
491 d_fp_classify=''
492 d_fpclassify=''
493 d_fpclassl=''
494 d_fpgetround=''
495 d_fpos64_t=''
496 d_frexpl=''
497 d_fs_data_s=''
498 d_fchmodat=''
499 d_linkat=''
500 d_openat=''
501 d_renameat=''
502 d_unlinkat=''
503 d_fseeko=''
504 d_fsetpos=''
505 d_fstatfs=''
506 d_fsync=''
507 d_ftello=''
508 d_ftime=''
509 d_gettimeod=''
510 d_futimes=''
511 d_gai_strerror=''
512 d_Gconvert=''
513 d_getaddrinfo=''
514 d_getcwd=''
515 d_getespwnam=''
516 d_getfsstat=''
517 d_getgrent=''
518 d_getgrent_r=''
519 getgrent_r_proto=''
520 d_getgrgid_r=''
521 getgrgid_r_proto=''
522 d_getgrnam_r=''
523 getgrnam_r_proto=''
524 d_getgrps=''
525 d_gethbyaddr=''
526 d_gethbyname=''
527 d_gethent=''
528 aphostname=''
529 d_gethname=''
530 d_phostname=''
531 d_uname=''
532 d_gethostbyaddr_r=''
533 gethostbyaddr_r_proto=''
534 d_gethostbyname_r=''
535 gethostbyname_r_proto=''
536 d_gethostent_r=''
537 gethostent_r_proto=''
538 d_gethostprotos=''
539 d_getitimer=''
540 d_getlogin=''
541 d_getlogin_r=''
542 getlogin_r_proto=''
543 d_getmnt=''
544 d_getmntent=''
545 d_getnameinfo=''
546 d_getnbyaddr=''
547 d_getnbyname=''
548 d_getnent=''
549 d_getnetbyaddr_r=''
550 getnetbyaddr_r_proto=''
551 d_getnetbyname_r=''
552 getnetbyname_r_proto=''
553 d_getnetent_r=''
554 getnetent_r_proto=''
555 d_getnetprotos=''
556 d_getpagsz=''
557 d_getpent=''
558 d_getpgid=''
559 d_getpgrp2=''
560 d_bsdgetpgrp=''
561 d_getpgrp=''
562 d_getppid=''
563 d_getprior=''
564 d_getpbyname=''
565 d_getpbynumber=''
566 d_getprotobyname_r=''
567 getprotobyname_r_proto=''
568 d_getprotobynumber_r=''
569 getprotobynumber_r_proto=''
570 d_getprotoent_r=''
571 getprotoent_r_proto=''
572 d_getprotoprotos=''
573 d_getprpwnam=''
574 d_getpwent=''
575 d_getpwent_r=''
576 getpwent_r_proto=''
577 d_getpwnam_r=''
578 getpwnam_r_proto=''
579 d_getpwuid_r=''
580 getpwuid_r_proto=''
581 d_getsent=''
582 d_getservbyname_r=''
583 getservbyname_r_proto=''
584 d_getservbyport_r=''
585 getservbyport_r_proto=''
586 d_getservent_r=''
587 getservent_r_proto=''
588 d_getservprotos=''
589 d_getspnam=''
590 d_getspnam_r=''
591 getspnam_r_proto=''
592 d_getsbyname=''
593 d_getsbyport=''
594 d_gmtime_r=''
595 gmtime_r_proto=''
596 d_gnulibc=''
597 gnulibc_version=''
598 d_hasmntopt=''
599 d_htonl=''
600 d_hypot=''
601 d_ilogb=''
602 d_ilogbl=''
603 d_inetaton=''
604 d_inetntop=''
605 d_inetpton=''
606 d_int64_t=''
607 d_isascii=''
608 d_isblank=''
609 d_isfinite=''
610 d_isfinitel=''
611 d_isinf=''
612 d_isinfl=''
613 d_isless=''
614 d_isnan=''
615 d_isnanl=''
616 d_isnormal=''
617 d_j0=''
618 d_j0l=''
619 d_killpg=''
620 d_lc_monetary_2008=''
621 d_lchown=''
622 d_ldbl_dig=''
623 d_lgamma=''
624 d_lgamma_r=''
625 d_libm_lib_version=''
626 d_link=''
627 d_llrint=''
628 d_llrintl=''
629 d_llround=''
630 d_llroundl=''
631 d_localeconv_l=''
632 d_localtime_r=''
633 d_localtime_r_needs_tzset=''
634 localtime_r_proto=''
635 d_locconv=''
636 d_lockf=''
637 d_log1p=''
638 d_log2=''
639 d_logb=''
640 d_ldexpl=''
641 d_long_double_style_ieee=''
642 d_long_double_style_ieee_doubledouble=''
643 d_long_double_style_ieee_extended=''
644 d_long_double_style_ieee_std=''
645 d_long_double_style_vax=''
646 d_longdbl=''
647 longdblkind=''
648 longdblsize=''
649 d_longlong=''
650 longlongsize=''
651 d_lrint=''
652 d_lrintl=''
653 d_lround=''
654 d_lroundl=''
655 d_lseekproto=''
656 d_lstat=''
657 d_madvise=''
658 d_malloc_good_size=''
659 d_malloc_size=''
660 d_mblen=''
661 d_mbrlen=''
662 d_mbrtowc=''
663 d_mbstowcs=''
664 d_mbtowc=''
665 d_memmem=''
666 d_memrchr=''
667 d_mkdir=''
668 d_mkdtemp=''
669 d_mkfifo=''
670 d_mkstemp=''
671 d_mkstemps=''
672 d_mktime=''
673 d_mmap=''
674 mmaptype=''
675 d_modfl=''
676 d_modflproto=''
677 d_mprotect=''
678 d_msg=''
679 d_msgctl=''
680 d_msgget=''
681 d_msghdr_s=''
682 d_msgrcv=''
683 d_msgsnd=''
684 d_msync=''
685 d_munmap=''
686 d_nan=''
687 d_nanosleep=''
688 d_nearbyint=''
689 d_duplocale=''
690 d_freelocale=''
691 d_newlocale=''
692 d_querylocale=''
693 d_uselocale=''
694 i_xlocale=''
695 d_nextafter=''
696 d_nexttoward=''
697 d_nice=''
698 d_nl_langinfo=''
699 d_thread_safe_nl_langinfo_l=''
700 d_off64_t=''
701 d_open3=''
702 d_fpathconf=''
703 d_pathconf=''
704 d_pause=''
705 d_pipe2=''
706 d_pipe=''
707 d_poll=''
708 d_portable=''
709 d_prctl=''
710 d_prctl_set_name=''
711 d_procselfexe=''
712 procselfexe=''
713 d_old_pthread_create_joinable=''
714 old_pthread_create_joinable=''
715 d_pthread_atfork=''
716 d_pthread_attr_setscope=''
717 d_pthread_yield=''
718 d_sched_yield=''
719 sched_yield=''
720 d_ptrdiff_t=''
721 d_qgcvt=''
722 d_random_r=''
723 random_r_proto=''
724 d_readdir64_r=''
725 readdir64_r_proto=''
726 d_readdir=''
727 d_rewinddir=''
728 d_seekdir=''
729 d_telldir=''
730 d_readdir_r=''
731 readdir_r_proto=''
732 d_readlink=''
733 d_readv=''
734 d_recvmsg=''
735 d_re_comp=''
736 d_regcmp=''
737 d_regcomp=''
738 d_remainder=''
739 d_remquo=''
740 d_rename=''
741 d_rint=''
742 d_rmdir=''
743 d_round=''
744 d_sbrkproto=''
745 d_scalbn=''
746 d_scalbnl=''
747 d_select=''
748 d_sem=''
749 d_semctl=''
750 d_semget=''
751 d_semop=''
752 d_sendmsg=''
753 d_setegid=''
754 d_seteuid=''
755 d_setgrent=''
756 d_setgrent_r=''
757 setgrent_r_proto=''
758 d_setgrps=''
759 d_sethent=''
760 d_sethostent_r=''
761 sethostent_r_proto=''
762 d_setitimer=''
763 d_setlinebuf=''
764 d_setlocale=''
765 d_setlocale_r=''
766 setlocale_r_proto=''
767 d_setnent=''
768 d_setnetent_r=''
769 setnetent_r_proto=''
770 d_setpent=''
771 d_setpgid=''
772 d_setpgrp2=''
773 d_bsdsetpgrp=''
774 d_setpgrp=''
775 d_setprior=''
776 d_setproctitle=''
777 d_setprotoent_r=''
778 setprotoent_r_proto=''
779 d_setpwent=''
780 d_setpwent_r=''
781 setpwent_r_proto=''
782 d_setregid=''
783 d_setresgid=''
784 d_setresuid=''
785 d_setreuid=''
786 d_setrgid=''
787 d_setruid=''
788 d_setsent=''
789 d_setservent_r=''
790 setservent_r_proto=''
791 d_setsid=''
792 d_setvbuf=''
793 d_shm=''
794 d_shmat=''
795 d_shmatprototype=''
796 shmattype=''
797 d_shmctl=''
798 d_shmdt=''
799 d_shmget=''
800 d_sigaction=''
801 d_siginfo_si_addr=''
802 d_siginfo_si_band=''
803 d_siginfo_si_errno=''
804 d_siginfo_si_fd=''
805 d_siginfo_si_pid=''
806 d_siginfo_si_status=''
807 d_siginfo_si_uid=''
808 d_siginfo_si_value=''
809 d_signbit=''
810 d_sigprocmask=''
811 d_sigsetjmp=''
812 usesitecustomize=''
813 d_snprintf=''
814 d_vsnprintf=''
815 d_sockatmark=''
816 d_sockatmarkproto=''
817 d_ip_mreq=''
818 d_ip_mreq_source=''
819 d_ipv6_mreq=''
820 d_ipv6_mreq_source=''
821 d_msg_ctrunc=''
822 d_msg_dontroute=''
823 d_msg_oob=''
824 d_msg_peek=''
825 d_msg_proxy=''
826 d_oldsock=''
827 d_scm_rights=''
828 d_sin6_scope_id=''
829 d_sockaddr_in6=''
830 d_sockaddr_sa_len=''
831 d_socket=''
832 d_sockpair=''
833 sockethdr=''
834 socketlib=''
835 d_socklen_t=''
836 d_socks5_init=''
837 d_sqrtl=''
838 d_srand48_r=''
839 srand48_r_proto=''
840 d_srandom_r=''
841 srandom_r_proto=''
842 d_sresgproto=''
843 d_sresuproto=''
844 d_stat=''
845 d_statblks=''
846 d_statfs_f_flags=''
847 d_statfs_s=''
848 d_static_inline=''
849 perl_static_inline=''
850 d_fstatvfs=''
851 d_statvfs=''
852 d_stdio_cnt_lval=''
853 d_stdio_ptr_lval=''
854 d_stdio_ptr_lval_nochange_cnt=''
855 d_stdio_ptr_lval_sets_cnt=''
856 d_stdiobase=''
857 d_stdstdio=''
858 stdio_base=''
859 stdio_bufsiz=''
860 stdio_cnt=''
861 stdio_filbuf=''
862 stdio_ptr=''
863 d_strcoll=''
864 d_sysernlst=''
865 d_syserrlst=''
866 d_strerror_l=''
867 d_strerror_r=''
868 strerror_r_proto=''
869 d_strftime=''
870 d_strlcat=''
871 d_strlcpy=''
872 d_strnlen=''
873 d_strtod=''
874 d_strtol=''
875 d_strtold=''
876 d_strtold_l=''
877 d_strtoll=''
878 d_strtoq=''
879 d_strtoul=''
880 d_strtoull=''
881 d_strtouq=''
882 d_strxfrm=''
883 d_symlink=''
884 d_syscall=''
885 d_syscallproto=''
886 d_sysconf=''
887 d_system=''
888 d_tcgetpgrp=''
889 d_tcsetpgrp=''
890 d_telldirproto=''
891 d_tgamma=''
892 d_time=''
893 timetype=''
894 d_asctime64=''
895 d_ctime64=''
896 d_difftime64=''
897 d_gmtime64=''
898 d_localtime64=''
899 d_mktime64=''
900 d_timegm=''
901 clocktype=''
902 d_times=''
903 d_tmpnam_r=''
904 tmpnam_r_proto=''
905 d_trunc=''
906 d_truncate=''
907 d_truncl=''
908 d_ttyname_r=''
909 ttyname_r_proto=''
910 d_tzname=''
911 d_u32align=''
912 d_ualarm=''
913 d_umask=''
914 d_semctl_semid_ds=''
915 d_semctl_semun=''
916 d_union_semun=''
917 d_unordered=''
918 d_unsetenv=''
919 d_usleep=''
920 d_usleepproto=''
921 d_ustat=''
922 d_pseudofork=''
923 d_vfork=''
924 usevfork=''
925 d_voidsig=''
926 signal_t=''
927 d_wait4=''
928 d_waitpid=''
929 d_wcscmp=''
930 d_wcstombs=''
931 d_wcsxfrm=''
932 d_wctomb=''
933 d_writev=''
934 default_inc_excludes_dot=''
935 dlext=''
936 bin_ELF=''
937 cccdlflags=''
938 ccdlflags=''
939 dlsrc=''
940 ld=''
941 ld_can_script=''
942 lddlflags=''
943 usedl=''
944 doublesize=''
945 dtraceobject=''
946 dtracexnolibs=''
947 ebcdic=''
948 fflushNULL=''
949 fflushall=''
950 fpossize=''
951 fpostype=''
952 gccansipedantic=''
953 gccosandvers=''
954 gccversion=''
955 gidformat=''
956 gidsign=''
957 gidsize=''
958 gidtype=''
959 groupstype=''
960 h_fcntl=''
961 h_sysfile=''
962 html1dir=''
963 html1direxp=''
964 installhtml1dir=''
965 html3dir=''
966 html3direxp=''
967 installhtml3dir=''
968 i_arpainet=''
969 i_bfd=''
970 i_crypt=''
971 db_hashtype=''
972 db_prefixtype=''
973 db_version_major=''
974 db_version_minor=''
975 db_version_patch=''
976 i_db=''
977 i_dbm=''
978 i_rpcsvcdbm=''
979 d_dirnamlen=''
980 direntrytype=''
981 i_dirent=''
982 i_dlfcn=''
983 i_execinfo=''
984 i_fcntl=''
985 i_fenv=''
986 i_fp=''
987 i_fp_class=''
988 i_gdbm=''
989 d_grpasswd=''
990 i_grp=''
991 i_ieeefp=''
992 i_inttypes=''
993 i_langinfo=''
994 i_libutil=''
995 i_locale=''
996 i_machcthr=''
997 i_malloc=''
998 i_mallocmalloc=''
999 i_mntent=''
1000 d_gdbm_ndbm_h_uses_prototypes=''
1001 d_gdbmndbm_h_uses_prototypes=''
1002 d_ndbm=''
1003 d_ndbm_h_uses_prototypes=''
1004 i_gdbm_ndbm=''
1005 i_gdbmndbm=''
1006 i_ndbm=''
1007 i_netdb=''
1008 i_neterrno=''
1009 i_netinettcp=''
1010 i_niin=''
1011 i_sysin=''
1012 i_poll=''
1013 i_prot=''
1014 i_pthread=''
1015 d_pwage=''
1016 d_pwchange=''
1017 d_pwclass=''
1018 d_pwcomment=''
1019 d_pwexpire=''
1020 d_pwgecos=''
1021 d_pwpasswd=''
1022 d_pwquota=''
1023 i_pwd=''
1024 i_quadmath=''
1025 i_shadow=''
1026 i_socks=''
1027 i_stdbool=''
1028 i_stdint=''
1029 i_stdlib=''
1030 i_sunmath=''
1031 i_sysaccess=''
1032 i_sysdir=''
1033 i_sysfile=''
1034 d_voidtty=''
1035 i_bsdioctl=''
1036 i_sysfilio=''
1037 i_sysioctl=''
1038 i_syssockio=''
1039 i_syslog=''
1040 i_sysmman=''
1041 i_sysmode=''
1042 i_sysmount=''
1043 i_sysndir=''
1044 i_sysparam=''
1045 i_syspoll=''
1046 i_sysresrc=''
1047 i_syssecrt=''
1048 i_sysselct=''
1049 i_sysstat=''
1050 i_sysstatfs=''
1051 i_sysstatvfs=''
1052 i_systimes=''
1053 i_systypes=''
1054 i_sysuio=''
1055 i_sysun=''
1056 i_sysutsname=''
1057 i_sysvfs=''
1058 i_syswait=''
1059 i_sgtty=''
1060 i_termio=''
1061 i_termios=''
1062 d_tm_tm_gmtoff=''
1063 d_tm_tm_zone=''
1064 i_systime=''
1065 i_systimek=''
1066 i_time=''
1067 timeincl=''
1068 i_unistd=''
1069 i_ustat=''
1070 i_utime=''
1071 i_vfork=''
1072 i_wchar=''
1073 d_inc_version_list=''
1074 inc_version_list=''
1075 inc_version_list_init=''
1076 doubleinfbytes=''
1077 doublenanbytes=''
1078 longdblinfbytes=''
1079 longdblnanbytes=''
1080 installprefix=''
1081 installprefixexp=''
1082 installstyle=''
1083 installusrbinperl=''
1084 intsize=''
1085 longsize=''
1086 shortsize=''
1087 issymlink=''
1088 libc=''
1089 ldlibpthname=''
1090 libperl=''
1091 shrpenv=''
1092 useshrplib=''
1093 glibpth=''
1094 incpth=''
1095 libpth=''
1096 loclibpth=''
1097 plibpth=''
1098 xlibpth=''
1099 ignore_versioned_solibs=''
1100 libs=''
1101 libsdirs=''
1102 libsfiles=''
1103 libsfound=''
1104 libspath=''
1105 lns=''
1106 d_PRIEUldbl=''
1107 d_PRIFUldbl=''
1108 d_PRIGUldbl=''
1109 d_PRIeldbl=''
1110 d_PRIfldbl=''
1111 d_PRIgldbl=''
1112 d_SCNfldbl=''
1113 d_double_has_inf=''
1114 d_double_has_nan=''
1115 d_double_has_negative_zero=''
1116 d_double_has_subnormals=''
1117 d_double_style_cray=''
1118 d_double_style_ibm=''
1119 d_double_style_ieee=''
1120 d_double_style_vax=''
1121 doublekind=''
1122 sPRIEUldbl=''
1123 sPRIFUldbl=''
1124 sPRIGUldbl=''
1125 sPRIeldbl=''
1126 sPRIfldbl=''
1127 sPRIgldbl=''
1128 sSCNfldbl=''
1129 lseeksize=''
1130 lseektype=''
1131 make_set_make=''
1132 d_mymalloc=''
1133 freetype=''
1134 mallocobj=''
1135 mallocsrc=''
1136 malloctype=''
1137 usemallocwrap=''
1138 usemymalloc=''
1139 installman1dir=''
1140 man1dir=''
1141 man1direxp=''
1142 man1ext=''
1143 installman3dir=''
1144 man3dir=''
1145 man3direxp=''
1146 man3ext=''
1147 doublemantbits=''
1148 longdblmantbits=''
1149 nvmantbits=''
1150 modetype=''
1151 multiarch=''
1152 mydomain=''
1153 myhostname=''
1154 phostname=''
1155 c=''
1156 n=''
1157 d_eofnblk=''
1158 eagain=''
1159 o_nonblock=''
1160 rd_nodata=''
1161 need_va_copy=''
1162 netdb_hlen_type=''
1163 netdb_host_type=''
1164 netdb_name_type=''
1165 netdb_net_type=''
1166 groupcat=''
1167 hostcat=''
1168 passcat=''
1169 orderlib=''
1170 ranlib=''
1171 d_perl_otherlibdirs=''
1172 otherlibdirs=''
1173 package=''
1174 spackage=''
1175 pager=''
1176 api_revision=''
1177 api_subversion=''
1178 api_version=''
1179 api_versionstring=''
1180 patchlevel=''
1181 perl_patchlevel=''
1182 revision=''
1183 subversion=''
1184 version=''
1185 version_patchlevel_string=''
1186 perl5=''
1187 perladmin=''
1188 perlpath=''
1189 d_nv_preserves_uv=''
1190 d_nv_zero_is_allbits_zero=''
1191 i16size=''
1192 i16type=''
1193 i32size=''
1194 i32type=''
1195 i64size=''
1196 i64type=''
1197 i8size=''
1198 i8type=''
1199 ivsize=''
1200 ivtype=''
1201 nv_overflows_integers_at=''
1202 nv_preserves_uv_bits=''
1203 nvsize=''
1204 nvtype=''
1205 u16size=''
1206 u16type=''
1207 u32size=''
1208 u32type=''
1209 u64size=''
1210 u64type=''
1211 u8size=''
1212 u8type=''
1213 uvsize=''
1214 uvtype=''
1215 ivdformat=''
1216 nvEUformat=''
1217 nvFUformat=''
1218 nvGUformat=''
1219 nveformat=''
1220 nvfformat=''
1221 nvgformat=''
1222 uvXUformat=''
1223 uvoformat=''
1224 uvuformat=''
1225 uvxformat=''
1226 pidtype=''
1227 prefix=''
1228 prefixexp=''
1229 installprivlib=''
1230 privlib=''
1231 privlibexp=''
1232 ptrsize=''
1233 d_PRIXU64=''
1234 d_PRId64=''
1235 d_PRIi64=''
1236 d_PRIo64=''
1237 d_PRIu64=''
1238 d_PRIx64=''
1239 sPRIXU64=''
1240 sPRId64=''
1241 sPRIi64=''
1242 sPRIo64=''
1243 sPRIu64=''
1244 sPRIx64=''
1245 d_quad=''
1246 quadkind=''
1247 quadtype=''
1248 uquadtype=''
1249 drand01=''
1250 randbits=''
1251 randfunc=''
1252 randseedtype=''
1253 seedfunc=''
1254 installscript=''
1255 scriptdir=''
1256 scriptdirexp=''
1257 selectminbits=''
1258 selecttype=''
1259 sh=''
1260 targetsh=''
1261 sig_count=''
1262 sig_name=''
1263 sig_name_init=''
1264 sig_num=''
1265 sig_num_init=''
1266 sig_size=''
1267 d_sitearch=''
1268 installsitearch=''
1269 sitearch=''
1270 sitearchexp=''
1271 installsitebin=''
1272 sitebin=''
1273 sitebinexp=''
1274 installsitehtml1dir=''
1275 sitehtml1dir=''
1276 sitehtml1direxp=''
1277 installsitehtml3dir=''
1278 sitehtml3dir=''
1279 sitehtml3direxp=''
1280 installsitelib=''
1281 sitelib=''
1282 sitelib_stem=''
1283 sitelibexp=''
1284 installsiteman1dir=''
1285 siteman1dir=''
1286 siteman1direxp=''
1287 installsiteman3dir=''
1288 siteman3dir=''
1289 siteman3direxp=''
1290 siteprefix=''
1291 siteprefixexp=''
1292 installsitescript=''
1293 sitescript=''
1294 sitescriptexp=''
1295 sizesize=''
1296 sizetype=''
1297 d_libname_unique=''
1298 so=''
1299 socksizetype=''
1300 sharpbang=''
1301 shsharp=''
1302 spitshell=''
1303 src=''
1304 ssizetype=''
1305 st_ino_sign=''
1306 st_ino_size=''
1307 startperl=''
1308 startsh=''
1309 stdchar=''
1310 d_stdio_stream_array=''
1311 stdio_stream_array=''
1312 sysman=''
1313 sGMTIME_max=''
1314 sGMTIME_min=''
1315 sLOCALTIME_max=''
1316 sLOCALTIME_min=''
1317 trnl=''
1318 uidformat=''
1319 uidsign=''
1320 uidsize=''
1321 uidtype=''
1322 archname64=''
1323 use64bitall=''
1324 use64bitint=''
1325 usecbacktrace=''
1326 dtrace=''
1327 usedtrace=''
1328 usefaststdio=''
1329 usekernprocpathname=''
1330 ccflags_uselargefiles=''
1331 ldflags_uselargefiles=''
1332 libswanted_uselargefiles=''
1333 uselargefiles=''
1334 uselongdouble=''
1335 usemorebits=''
1336 usemultiplicity=''
1337 nm_opt=''
1338 nm_so_opt=''
1339 runnm=''
1340 usenm=''
1341 usensgetexecutablepath=''
1342 useperlio=''
1343 usequadmath=''
1344 usesocks=''
1345 d_oldpthreads=''
1346 use5005threads=''
1347 useithreads=''
1348 usereentrant=''
1349 usethreads=''
1350 incpath=''
1351 mips_type=''
1352 usrinc=''
1353 d_vendorarch=''
1354 installvendorarch=''
1355 vendorarch=''
1356 vendorarchexp=''
1357 d_vendorbin=''
1358 installvendorbin=''
1359 vendorbin=''
1360 vendorbinexp=''
1361 installvendorhtml1dir=''
1362 vendorhtml1dir=''
1363 vendorhtml1direxp=''
1364 installvendorhtml3dir=''
1365 vendorhtml3dir=''
1366 vendorhtml3direxp=''
1367 d_vendorlib=''
1368 installvendorlib=''
1369 vendorlib=''
1370 vendorlib_stem=''
1371 vendorlibexp=''
1372 installvendorman1dir=''
1373 vendorman1dir=''
1374 vendorman1direxp=''
1375 installvendorman3dir=''
1376 vendorman3dir=''
1377 vendorman3direxp=''
1378 usevendorprefix=''
1379 vendorprefix=''
1380 vendorprefixexp=''
1381 d_vendorscript=''
1382 installvendorscript=''
1383 vendorscript=''
1384 vendorscriptexp=''
1385 versiononly=''
1386 yacc=''
1387 yaccflags=''
1388 CONFIG=''
1389
1390 : Detect odd OSs
1391 define='define'
1392 undef='undef'
1393 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1394 rmlist=''
1395
1396 : We must find out about Eunice early
1397 eunicefix=':'
1398 if test -f /etc/unixtovms; then
1399         eunicefix=/etc/unixtovms
1400 fi
1401 if test -f /etc/unixtovms.exe; then
1402         eunicefix=/etc/unixtovms.exe
1403 fi
1404
1405 : Set executable suffix now -- needed before hints available
1406 if test -f "/libs/version.library"; then
1407 : Amiga OS
1408     _exe=""
1409 elif test -f "/system/gnu_library/bin/ar.pm"; then
1410 : Stratus VOS
1411     _exe=".pm"
1412 elif test -n "$DJGPP"; then
1413 : DOS DJGPP
1414     _exe=".exe"
1415 elif test -f /kern/cookiejar; then
1416 : MiNT
1417     _exe=""
1418 elif test -d c:/. -o -n "$is_os2" ; then
1419 : OS/2 or cygwin
1420     _exe=".exe"
1421 fi
1422
1423 groupstype=''
1424 i_whoami=''
1425 : Possible local include directories to search.
1426 : Set locincpth to "" in a hint file to defeat local include searches.
1427 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1428 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1429 :
1430 : no include file wanted by default
1431 inclwanted=''
1432
1433 : Enable -DEBUGGING and -DDEBUGGING from the command line
1434 EBUGGING=''
1435 DEBUGGING=''
1436
1437 : Trailing extension.  Override this in a hint file, if needed.
1438 : Extra object files, if any, needed on this platform.
1439 archobjs=''
1440 libnames=''
1441 : change the next line if compiling for Xenix/286 on Xenix/386
1442 xlibpth='/usr/lib/386 /lib/386'
1443 : Possible local library directories to search.
1444 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1445 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1446
1447 : general looking path for locating libraries
1448 glibpth="/lib /usr/lib $xlibpth"
1449 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1450 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1451 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1452 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1453
1454 : Private path used by Configure to find libraries.  Its value
1455 : is prepended to libpth. This variable takes care of special
1456 : machines, like the mips.  Usually, it should be empty.
1457 plibpth=''
1458
1459 : default library list
1460 libswanted=''
1461 : some systems want to use only the non-versioned libso:s
1462 ignore_versioned_solibs=''
1463 ccname=''
1464 ccversion=''
1465 perllibs=''
1466 : set useposix=false in your hint file to disable the POSIX extension.
1467 useposix=true
1468 : set useopcode=false in your hint file to disable the Opcode extension.
1469 useopcode=true
1470 archname64=''
1471 ccflags_uselargefiles=''
1472 ldflags_uselargefiles=''
1473 libswanted_uselargefiles=''
1474 : set usemultiplicity on the Configure command line to enable multiplicity.
1475 : set usesocks on the Configure command line to enable socks.
1476 archname=''
1477 : set usethreads on the Configure command line to enable threads.
1478 usereentrant='undef'
1479 : List of libraries we want.
1480 : If anyone needs extra -lxxx, put those in a hint file.
1481 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1482 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1483 : We probably want to search /usr/shlib before most other libraries.
1484 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1485 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1486 glibpth="/usr/shlib $glibpth"
1487 : Do not use vfork unless overridden by a hint file.
1488 usevfork=false
1489
1490 : Find the basic shell for Bourne shell scripts
1491 case "$sh" in
1492 '')
1493         case "$SYSTYPE" in
1494         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1495         *) xxx='/bin/sh';;
1496         esac
1497         if test -f "$xxx"; then
1498                 sh="$xxx"
1499         else
1500                 : Build up a list and do a single loop so we can 'break' out.
1501                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1502                 for xxx in sh bash ksh pdksh ash; do
1503                         for p in $pth; do
1504                                 try="$try ${p}/${xxx}"
1505                         done
1506                 done
1507                 for xxx in $try; do
1508                         if test -f "$xxx"; then
1509                                 sh="$xxx";
1510                                 break
1511                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1512                                 sh="$xxx";
1513                                 break
1514                         elif test -f "$xxx.exe"; then
1515                                 sh="$xxx";
1516                                 break
1517                         fi
1518                 done
1519         fi
1520         ;;
1521 esac
1522
1523 case "$sh" in
1524 '')     cat >&2 <<EOM
1525 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1526
1527 Usually it's in /bin/sh.  How did you even get this far?
1528 Please contact me (Perl Maintainers) at perlbug@perl.org and
1529 we'll try to straighten this all out.
1530 EOM
1531         exit 1
1532         ;;
1533 esac
1534
1535 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1536 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1537 targetsh=$sh
1538
1539 : see if sh knows # comments
1540 if `$sh -c '#' >/dev/null 2>&1`; then
1541         shsharp=true
1542         spitshell=cat
1543         xcat=/bin/cat
1544         test -f $xcat$_exe || xcat=/usr/bin/cat
1545         if test ! -f $xcat$_exe; then
1546                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1547                         if test -f $p/cat$_exe; then
1548                                 xcat=$p/cat
1549                                 break
1550                         fi
1551                 done
1552                 if test ! -f $xcat$_exe; then
1553                         echo "Can't find cat anywhere!"
1554                         exit 1
1555                 fi
1556         fi
1557         echo "#!$xcat" >sharp
1558         $eunicefix sharp
1559         chmod +x sharp
1560         ./sharp > today 2>/dev/null
1561         if test -s today; then
1562                 sharpbang='#!'
1563         else
1564                 echo "#! $xcat" > sharp
1565                 $eunicefix sharp
1566                 chmod +x sharp
1567                 ./sharp > today 2>/dev/null
1568                 if test -s today; then
1569                         sharpbang='#! '
1570                 else
1571                         sharpbang=': use '
1572                 fi
1573         fi
1574 else
1575         echo " "
1576         echo "Your $sh doesn't grok # comments--I will strip them later on."
1577         shsharp=false
1578         cd ..
1579         echo "exec grep -v '^[  ]*#'" >spitshell
1580         chmod +x spitshell
1581         $eunicefix spitshell
1582         spitshell=`pwd`/spitshell
1583         cd UU
1584         echo "I presume that if # doesn't work, #! won't work either!"
1585         sharpbang=': use '
1586 fi
1587 rm -f sharp today
1588
1589 : figure out how to guarantee sh startup
1590 case "$startsh" in
1591 '') startsh=${sharpbang}${sh} ;;
1592 *)
1593 esac
1594 cat >sharp <<EOSS
1595 $startsh
1596 set abc
1597 test "$?abc" != 1
1598 EOSS
1599
1600 chmod +x sharp
1601 $eunicefix sharp
1602 if ./sharp; then
1603         : echo "Yup, it does."
1604 else
1605         echo "Hmm... '$startsh' does not guarantee sh startup..."
1606         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1607 fi
1608 rm -f sharp
1609
1610 : Save command line options in file UU/cmdline.opt for later use in
1611 : generating config.sh.
1612 cat > cmdline.opt <<EOSH
1613 : Configure command line arguments.
1614 config_arg0='$0'
1615 config_args='$*'
1616 config_argc=$#
1617 EOSH
1618 argn=1
1619 args_exp=''
1620 args_sep=''
1621 for arg in "$@"; do
1622         cat >>cmdline.opt <<EOSH
1623 config_arg$argn='$arg'
1624 EOSH
1625         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1626 $arg
1627 EOC
1628         arg_exp=`cat cmdl.opt`
1629         args_exp="$args_exp$args_sep'$arg_exp'"
1630         argn=`expr $argn + 1`
1631         args_sep=' '
1632 done
1633 rm -f cmdl.opt
1634
1635 : produce awk script to parse command line options
1636 cat >options.awk <<'EOF'
1637 BEGIN {
1638         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1639
1640         len = length(optstr);
1641         for (i = 1; i <= len; i++) {
1642                 c = substr(optstr, i, 1);
1643                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1644                 if (a == ":") {
1645                         arg[c] = 1;
1646                         i++;
1647                 }
1648                 opt[c] = 1;
1649         }
1650 }
1651 {
1652         expect = 0;
1653         str = $0;
1654         if (substr(str, 1, 1) != "-") {
1655                 printf("'%s'\n", str);
1656                 next;
1657         }
1658         len = length($0);
1659         for (i = 2; i <= len; i++) {
1660                 c = substr(str, i, 1);
1661                 if (!opt[c]) {
1662                         printf("-%s\n", substr(str, i));
1663                         next;
1664                 }
1665                 printf("-%s\n", c);
1666                 if (arg[c]) {
1667                         if (i < len)
1668                                 printf("'%s'\n", substr(str, i + 1));
1669                         else
1670                                 expect = 1;
1671                         next;
1672                 }
1673         }
1674 }
1675 END {
1676         if (expect)
1677                 print "?";
1678 }
1679 EOF
1680
1681 : process the command line options
1682 set X `for arg in "$@"; do echo "X$arg"; done |
1683         sed -e s/X// | awk -f options.awk`
1684 eval "set $*"
1685 shift
1686 rm -f options.awk
1687
1688 : set up default values
1689 fastread=''
1690 reuseval=false
1691 config_sh=''
1692 alldone=''
1693 error=''
1694 silent=''
1695 extractsh=''
1696 knowitall=''
1697 rm -f optdef.sh posthint.sh
1698 cat >optdef.sh <<EOS
1699 $startsh
1700 EOS
1701
1702
1703 : option parsing
1704 while test $# -gt 0; do
1705         case "$1" in
1706         -d) shift; fastread=yes;;
1707         -e) shift; alldone=cont;;
1708         -f)
1709                 shift
1710                 cd ..
1711                 if test -r "$1"; then
1712                         config_sh="$1"
1713                 else
1714                         echo "$me: cannot read config file $1." >&2
1715                         error=true
1716                 fi
1717                 cd UU
1718                 shift;;
1719         --help|\
1720         -h) shift; error=true;;
1721         -r) shift; reuseval=true;;
1722         -s) shift; silent=true; realsilent=true;;
1723         -E) shift; alldone=exit;;
1724         -K) shift; knowitall=true;;
1725         -O) shift;;
1726         -S) shift; silent=true; extractsh=true;;
1727         -D)
1728                 shift
1729                 case "$1" in
1730                 *=)
1731                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1732                         echo "$me: ignoring -D $1" >&2
1733                         ;;
1734                 *=*) echo "$1" | \
1735                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1736                 *) echo "$1='define'" >> optdef.sh;;
1737                 esac
1738                 shift
1739                 ;;
1740         -U)
1741                 shift
1742                 case "$1" in
1743                 *=) echo "$1" >> optdef.sh;;
1744                 *=*)
1745                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1746                         echo "$me: ignoring -U $1" >&2
1747                         ;;
1748                 *) echo "$1='undef'" >> optdef.sh;;
1749                 esac
1750                 shift
1751                 ;;
1752         -A)
1753             shift
1754             xxx=''
1755             yyy="$1"
1756             zzz=''
1757             uuu=undef
1758             case "$yyy" in
1759             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1760                  case "$zzz" in
1761                  *:*) zzz='' ;;
1762                  *)   xxx=append
1763                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1764                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1765                  esac
1766                  ;;
1767             esac
1768             case "$xxx" in
1769             '')  case "$yyy" in
1770                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1771                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1772                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1773                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1774                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1775                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1776                  esac
1777                  ;;
1778             esac
1779             case "$xxx" in
1780             append)
1781                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1782             clear)
1783                 echo "$yyy=''"                  >> posthint.sh ;;
1784             define)
1785                 case "$zzz" in
1786                 '') zzz=define ;;
1787                 esac
1788                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1789             eval)
1790                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1791             prepend)
1792                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1793             undef)
1794                 case "$zzz" in
1795                 '') zzz="$uuu" ;;
1796                 esac
1797                 echo "$yyy=$zzz"                >> posthint.sh ;;
1798             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1799             esac
1800             shift
1801             ;;
1802         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1803             exit 0;;
1804         --) break;;
1805         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1806         *) break;;
1807         esac
1808 done
1809
1810 case "$error" in
1811 true)
1812         cat >&2 <<EOM
1813 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1814                  [-U symbol] [-U symbol=] [-A command:symbol...]
1815   -d : use defaults for all answers.
1816   -e : go on without questioning past the production of config.sh.
1817   -f : specify an alternate default configuration file.
1818   -h : print this help message and exit (with an error status).
1819   -r : reuse C symbols value if possible (skips costly nm extraction).
1820   -s : silent mode, only echoes questions and essential information.
1821   -D : define symbol to have some value:
1822          -D symbol         symbol gets the value 'define'
1823          -D symbol=value   symbol gets the value 'value'
1824        common used examples (see INSTALL for more info):
1825          -Duse64bitint            use 64bit integers
1826          -Duse64bitall            use 64bit integers and pointers
1827          -Dusethreads             use thread support
1828          -Dinc_version_list=none  do not include older perl trees in @INC
1829          -DEBUGGING=none          DEBUGGING options
1830          -Dcc=gcc                 choose your compiler
1831          -Dprefix=/opt/perl5      choose your destination
1832   -E : stop at the end of questions, after having produced config.sh.
1833   -K : do not use unless you know what you are doing.
1834   -O : ignored for backward compatibility
1835   -S : perform variable substitutions on all .SH files (can mix with -f)
1836   -U : undefine symbol:
1837          -U symbol    symbol gets the value 'undef'
1838          -U symbol=   symbol gets completely empty
1839        e.g.:  -Uversiononly
1840   -A : manipulate symbol after the platform specific hints have been applied:
1841          -A append:symbol=value   append value to symbol
1842          -A symbol=value          like append:, but with a separating space
1843          -A define:symbol=value   define symbol to have value
1844          -A clear:symbol          define symbol to be ''
1845          -A define:symbol         define symbol to be 'define'
1846          -A eval:symbol=value     define symbol to be eval of value
1847          -A prepend:symbol=value  prepend value to symbol
1848          -A undef:symbol          define symbol to be 'undef'
1849          -A undef:symbol=         define symbol to be ''
1850        e.g.:  -A prepend:libswanted='cl pthread '
1851               -A ccflags=-DSOME_MACRO
1852   -V : print version number and exit (with a zero status).
1853 EOM
1854         exit 1
1855         ;;
1856 esac
1857
1858 : Sanity checks
1859 case "$fastread$alldone" in
1860 yescont|yesexit) ;;
1861 *)
1862         case "$extractsh" in
1863         true) ;;
1864         *)
1865                 if test ! -t 0; then
1866                         echo "Say 'sh Configure', not 'sh <Configure'"
1867                         exit 1
1868                 fi
1869                 ;;
1870         esac
1871         ;;
1872 esac
1873
1874 exec 4>&1
1875 case "$silent" in
1876 true) exec 1>/dev/null;;
1877 esac
1878
1879 : run the defines and the undefines, if any, but leave the file out there...
1880 touch optdef.sh
1881 grep '\\' optdef.sh >/dev/null 2>&1
1882 if test $? = 0; then
1883     echo "Configure does not support \\ in -D arguments"
1884     exit 1
1885 fi
1886 . ./optdef.sh
1887 : create the posthint manipulation script and leave the file out there...
1888 touch posthint.sh
1889
1890 : set package name
1891 package='perl5'
1892 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1893 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1894 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1895 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1896 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1897 esac
1898
1899 : Some greps do not return status, grrr.
1900 echo "grimblepritz" >grimble
1901 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1902         contains=contains
1903 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1904         contains=grep
1905 else
1906         contains=contains
1907 fi
1908 rm -f grimble
1909 : the following should work in any shell
1910 case "$contains" in
1911 contains*)
1912         echo " "
1913         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1914         cat >contains <<'EOSS'
1915 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1916 EOSS
1917 chmod +x contains
1918 esac
1919
1920 : Find the path to the source tree
1921 case "$src" in
1922 '') case "$0" in
1923     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1924          case "$src" in
1925          /*)    ;;
1926          .)     ;;
1927          *)     src=`cd ../$src && pwd` ;;
1928          esac
1929          ;;
1930     *)   src='.';;
1931     esac;;
1932 esac
1933 case "$src" in
1934 '')     src=/
1935         rsrc=/
1936         ;;
1937 /*)     rsrc="$src";;
1938 *)      rsrc="../$src";;
1939 esac
1940 if test -f $rsrc/Configure && \
1941         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1942 then
1943    : found it, so we are ok.
1944 else
1945         rsrc=''
1946         for src in . .. ../.. ../../.. ../../../..; do
1947                 if test -f ../$src/Configure && \
1948                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1949                 then
1950                         rsrc=../$src
1951                         break
1952                 fi
1953         done
1954 fi
1955 case "$rsrc" in
1956 '')
1957         cat <<EOM >&4
1958
1959 Sorry, I can't seem to locate the source dir for $package.  Please start
1960 Configure with an explicit path -- i.e. /some/path/Configure.
1961
1962 EOM
1963         exit 1
1964         ;;
1965 ../.)   rsrc='..';;
1966 *)
1967         echo " "
1968         echo "Sources for $package found in \"$src\"." >&4
1969         ;;
1970 esac
1971
1972 : script used to extract .SH files with variable substitutions
1973 cat >extract <<'EOS'
1974 PERL_CONFIG_SH=true
1975 echo "Doing variable substitutions on .SH files..."
1976 if test -f MANIFEST; then
1977         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1978 else
1979         echo "(Looking for .SH files under the source directory.)"
1980         set x `(cd "$src"; find . -name "*.SH" -print)`
1981 fi
1982 shift
1983 case $# in
1984 0) set x `(cd "$src"; echo *.SH)`; shift;;
1985 esac
1986 if test ! -f "$src/$1"; then
1987         shift
1988 fi
1989 mkdir_p='
1990 name=$1;
1991 create="";
1992 while test $name; do
1993         if test ! -d "$name"; then
1994                 create="$name $create";
1995                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1996                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1997         else
1998                 name="";
1999         fi;
2000 done;
2001 for file in $create; do
2002         mkdir $file;
2003 done
2004 '
2005 for file in $*; do
2006         case "$src" in
2007         ".")
2008                 case "$file" in
2009                 */*)
2010                         dir=`expr X$file : 'X\(.*\)/'`
2011                         file=`expr X$file : 'X.*/\(.*\)'`
2012                         (cd "$dir" && . ./$file)
2013                         ;;
2014                 *)
2015                         . ./$file
2016                         ;;
2017                 esac
2018                 ;;
2019         *)
2020                 case "$file" in
2021                 */*)
2022                         dir=`expr X$file : 'X\(.*\)/'`
2023                         file=`expr X$file : 'X.*/\(.*\)'`
2024                         (set x $dir; shift; eval $mkdir_p)
2025                         sh <"$src/$dir/$file"
2026                         ;;
2027                 *)
2028                         sh <"$src/$file"
2029                         ;;
2030                 esac
2031                 ;;
2032         esac
2033 done
2034 if test -f "$src/config_h.SH"; then
2035         if test ! -f config.h; then
2036         : oops, they left it out of MANIFEST, probably, so do it anyway.
2037         . "$src/config_h.SH"
2038         fi
2039 fi
2040 EOS
2041
2042 : extract files and exit if asked to do so
2043 case "$extractsh" in
2044 true)
2045         case "$realsilent" in
2046         true) ;;
2047         *) exec 1>&4;;
2048         esac
2049         case "$config_sh" in
2050         '') config_sh='config.sh';;
2051         esac
2052         echo " "
2053         echo "Fetching answers from $config_sh..."
2054         cd ..
2055         . $config_sh
2056         . UU/optdef.sh
2057         echo " "
2058         . UU/extract
2059         rm -rf UU
2060         echo "Extraction done."
2061         exit 0
2062         ;;
2063 esac
2064
2065 : Eunice requires " " instead of "", can you believe it
2066 echo " "
2067 : Here we go...
2068 echo "Beginning of configuration questions for $package."
2069
2070 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2071
2072 : first determine how to suppress newline on echo command
2073 echo " "
2074 echo "Checking echo to see how to suppress newlines..."
2075 (echo "hi there\c" ; echo " ") >.echotmp
2076 if $contains c .echotmp >/dev/null 2>&1 ; then
2077         echo "...using -n."
2078         n='-n'
2079         c=''
2080 else
2081         cat <<'EOM'
2082 ...using \c
2083 EOM
2084         n=''
2085         c='\c'
2086 fi
2087 echo $n "The star should be here-->$c"
2088 echo '*'
2089 rm -f .echotmp
2090
2091 : Now test for existence of everything in MANIFEST
2092 echo " "
2093 if test -f "$rsrc/MANIFEST"; then
2094         echo "First let's make sure your kit is complete.  Checking..." >&4
2095         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2096                 (split -l 50 2>/dev/null || split -50)
2097         rm -f missing
2098         tmppwd=`pwd`
2099         for filelist in x??; do
2100                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2101                         >/dev/null 2>>"$tmppwd/missing")
2102         done
2103         if test -s missing; then
2104                 cat missing >&4
2105                 cat >&4 <<'EOM'
2106
2107 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2108
2109 You have the option of continuing the configuration process, despite the
2110 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2111 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2112 and contact the author (perlbug@perl.org).
2113
2114 EOM
2115                 echo $n "Continue? [n] $c" >&4
2116                 read ans
2117                 case "$ans" in
2118                 y*)
2119                         echo "Continuing..." >&4
2120                         rm -f missing
2121                         ;;
2122                 *)
2123                         echo "ABORTING..." >&4
2124                         kill $$
2125                         ;;
2126                 esac
2127         else
2128                 echo "Looks good..."
2129         fi
2130 else
2131         echo "There is no MANIFEST file.  I hope your kit is complete !"
2132 fi
2133 rm -f missing x??
2134
2135 : Find the appropriate value for a newline for tr
2136 if test -n "$DJGPP"; then
2137        trnl='\012'
2138 fi
2139 if test X"$trnl" = X; then
2140         case "`echo foo | tr '\n' x 2>/dev/null`" in
2141         foox) trnl='\n' ;;
2142         esac
2143 fi
2144 if test X"$trnl" = X; then
2145         case "`echo foo | tr '\012' x 2>/dev/null`" in
2146         foox) trnl='\012' ;;
2147         esac
2148 fi
2149 if test X"$trnl" = X; then
2150        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2151        fooxy) trnl='\n\r' ;;
2152        esac
2153 fi
2154 if test X"$trnl" = X; then
2155         cat <<EOM >&2
2156
2157 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2158
2159 EOM
2160         exit 1
2161 fi
2162
2163 : compute the number of columns on the terminal for proper question formatting
2164 case "$COLUMNS" in
2165 '') COLUMNS='80';;
2166 esac
2167
2168 : set up the echo used in my read
2169 myecho="case \"\$xxxm\" in
2170 '') echo $n \"\$rp $c\" >&4;;
2171 *) case \"\$rp\" in
2172         '') echo $n \"[\$xxxm] $c\";;
2173         *)
2174                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2175                         echo \"\$rp\" >&4
2176                         echo $n \"[\$xxxm] $c\" >&4
2177                 else
2178                         echo $n \"\$rp [\$xxxm] $c\" >&4
2179                 fi
2180                 ;;
2181         esac;;
2182 esac"
2183
2184 : now set up to do reads with possible shell escape and default assignment
2185 cat <<EOSC >myread
2186 $startsh
2187 xxxm=\$dflt
2188 $myecho
2189 ans='!'
2190 case "\$fastread" in
2191 yes) case "\$dflt" in
2192         '') ;;
2193         *) ans='';
2194                 case "\$silent-\$rp" in
2195                 true-) ;;
2196                 *) echo " " >&4;;
2197                 esac;;
2198         esac;;
2199 *) case "\$silent" in
2200         true) case "\$rp" in
2201                 '') ans='';;
2202                 esac;;
2203         esac;;
2204 esac
2205 while expr "X\$ans" : "X!" >/dev/null; do
2206         read answ
2207         set x \$xxxm
2208         shift
2209         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2210         case  "\$answ" in
2211         "!")
2212                 sh 1>&4
2213                 echo " "
2214                 $myecho
2215                 ;;
2216         !*)
2217                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2218                 shift
2219                 sh 1>&4 -c "\$*"
2220                 echo " "
2221                 $myecho
2222                 ;;
2223         "\$ans")
2224                 case "\$ans" in
2225                 \\&*)
2226                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2227                         shift
2228                         case "\$1" in
2229                         -d)
2230                                 fastread=yes
2231                                 echo "(OK, I'll run with -d after this question.)" >&4
2232                                 ;;
2233                         -*)
2234                                 echo "*** Sorry, \$1 not supported yet." >&4
2235                                 ;;
2236                         esac
2237                         $myecho
2238                         ans=!
2239                         ;;
2240                 esac;;
2241         *)
2242                 case "\$aok" in
2243                 y)
2244                         echo "*** Substitution done -- please confirm."
2245                         xxxm="\$ans"
2246                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2247                         xxxm="\$ans"
2248                         ans=!
2249                         ;;
2250                 *)
2251                         echo "*** Error -- try again."
2252                         ans=!
2253                         ;;
2254                 esac
2255                 $myecho
2256                 ;;
2257         esac
2258         case "\$ans\$xxxm\$nostick" in
2259         '')
2260                 ans=!
2261                 $myecho
2262                 ;;
2263         esac
2264 done
2265 case "\$ans" in
2266 '') ans="\$xxxm";;
2267 esac
2268 EOSC
2269
2270 : create .config dir to save info across Configure sessions
2271 test -d ../.config || mkdir ../.config
2272 cat >../.config/README <<EOF
2273 This directory created by Configure to save information that should
2274 persist across sessions for $package.
2275
2276 You may safely delete it if you wish.
2277 EOF
2278
2279 : See if we are using a devel version and want that
2280 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2281 case "$usedevel" in
2282 $define|true|[yY]*)
2283     usedevel="$define" ;;
2284 *) case "$xversion" in
2285    *[13579])
2286         cat >&4 <<EOH
2287 *** WHOA THERE!!! ***
2288
2289     This is an UNSTABLE DEVELOPMENT release.
2290     The version of this $package distribution is $xversion, that is, odd,
2291     (as opposed to even) and that signifies a development release.
2292     If you want a maintenance release, you want an even-numbered version.
2293
2294     Do ***NOT*** install this into production use.
2295     Data corruption and crashes are possible.
2296
2297     It is most seriously suggested that you do not continue any further
2298     unless you want to help in developing and debugging Perl.
2299
2300     If you *still* want to build perl, you can answer 'y' now,
2301     or pass -Dusedevel to Configure.
2302
2303 EOH
2304         rp='Do you really want to continue?'
2305         dflt='n'
2306         . ./myread
2307         case "$ans" in
2308         [yY]) echo >&4 "Okay, continuing."
2309               usedevel="$define" ;;
2310         *) echo >&4 "Okay, bye."
2311            exit 1
2312            ;;
2313         esac
2314         ;;
2315     esac
2316     usedevel="$undef"
2317     ;;
2318 esac
2319 case "$usedevel" in
2320 $define|true|[yY]*)
2321         case "$versiononly" in
2322         '') versiononly="$define" ;;
2323         esac
2324         case "$installusrbinperl" in
2325         '') installusrbinperl="$undef" ;;
2326         esac
2327         ;;
2328 esac
2329
2330 : general instructions
2331 needman=true
2332 firsttime=true
2333 user=`(logname) 2>/dev/null`
2334 case "$user" in
2335 '') user=`whoami 2>&1`;;
2336 esac
2337 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2338         firsttime=false
2339         echo " "
2340         rp='Would you like to see the instructions?'
2341         dflt=n
2342         . ./myread
2343         case "$ans" in
2344         [yY]*) ;;
2345         *) needman=false;;
2346         esac
2347 fi
2348 if $needman; then
2349         cat <<EOH
2350
2351 This installation shell script will examine your system and ask you questions
2352 to determine how the perl5 package should be installed. If you get
2353 stuck on a question, you may use a ! shell escape to start a subshell or
2354 execute a command.  Many of the questions will have default answers in square
2355 brackets; typing carriage return will give you the default.
2356
2357 On some of the questions which ask for file or directory names you are allowed
2358 to use the ~name construct to specify the login directory belonging to "name",
2359 even if you don't have a shell which knows about that.  Questions where this is
2360 allowed will be marked "(~name ok)".
2361
2362 EOH
2363         rp=''
2364         dflt='Type carriage return to continue'
2365         . ./myread
2366         cat <<'EOH'
2367
2368 The prompter used in this script allows you to use shell variables and
2369 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2370 in the default answer, as if the default line was a set of arguments given to a
2371 script shell.  This means you may also use $* to repeat the whole default line,
2372 so you do not have to re-type everything to add something to the default.
2373
2374 Every time there is a substitution, you will have to confirm.  If there is an
2375 error (e.g. an unmatched backtick), the default answer will remain unchanged
2376 and you will be prompted again.
2377
2378 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2379 the questions and use the computed defaults (or the previous answers if there
2380 was already a config.sh file). Type 'Configure -h' for a list of options.
2381 You may also start interactively and then answer '& -d' at any prompt to turn
2382 on the non-interactive behaviour for the remainder of the execution.
2383
2384 EOH
2385         . ./myread
2386         cat <<EOH
2387
2388 Much effort has been expended to ensure that this shell script will run on any
2389 Unix system.  If despite that it blows up on yours, your best bet is to edit
2390 Configure and run it again.  If you can't run Configure for some reason,
2391 you'll have to generate a config.sh file by hand.  Whatever problems you
2392 have, let me (perlbug@perl.org) know how I blew it.
2393
2394 This installation script affects things in two ways:
2395
2396 1) it may do direct variable substitutions on some of the files included
2397    in this kit.
2398 2) it builds a config.h file for inclusion in C programs.  You may edit
2399    any of these files as the need arises after running this script.
2400
2401 If you make a mistake on a question, there is no easy way to back up to it
2402 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2403 files.  Configure will offer to let you do this before it runs the SH files.
2404
2405 EOH
2406         dflt='Type carriage return to continue'
2407         . ./myread
2408         case "$firsttime" in
2409         true) echo $user >>../.config/instruct;;
2410         esac
2411 fi
2412
2413 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2414 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2415 if test "X$sysroot" = X; then
2416     sysroot=""
2417 else
2418     case "$cc" in
2419         *gcc*|*g++*)
2420             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2421             # _sysroot is used in places where we need --sysroot=foo
2422             # but using the rest of the flags could cause issues.
2423             _sysroot="--sysroot=$sysroot";
2424             case "$ccflags" in
2425                 *sysroot*) ;;
2426                 'undef'|*)
2427                 ccflags="$ccflags $_sysroot"
2428             esac
2429             case "$ldflags" in
2430                 *sysroot*) ;;
2431                 'undef'|*)
2432                 ldflags="$ldflags $_sysroot"
2433             esac
2434             case "$cppflags" in
2435                 *sysroot*) ;;
2436                 'undef'|*)
2437                 cppflags="$cppflags $_sysroot"
2438             esac
2439             # lddlflags updated below in lddlflags section;
2440             # same with cccdlflags
2441             ;;
2442     esac
2443
2444     # Adjust some defaults to also use $sysroot
2445     for var in xlibpth loclibpth locincpth glibpth; do
2446         eval xxx=\$$var
2447         eval $var=''
2448         for path in $xxx; do
2449             eval $var=\"\$$var $sysroot$path\"
2450         done
2451     done
2452
2453 fi
2454
2455 : find out where common programs are
2456 echo " "
2457 echo "Locating common programs..." >&4
2458 cat <<EOSC >loc
2459 $startsh
2460 case \$# in
2461 0) exit 1;;
2462 esac
2463 thing=\$1
2464 shift
2465 dflt=\$1
2466 shift
2467 for dir in \$*; do
2468         case "\$thing" in
2469         .)
2470         if test -d \$dir/\$thing; then
2471                 echo \$dir
2472                 exit 0
2473         fi
2474         ;;
2475         *)
2476         for thisthing in \$dir/\$thing; do
2477                 : just loop through to pick last item
2478         done
2479         if test -f \$thisthing; then
2480                 echo \$thisthing
2481                 exit 0
2482         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2483                 echo \$thisthing
2484                 exit 0
2485         elif test -f \$dir/\$thing.exe; then
2486                 if test -n "$DJGPP"; then
2487                         echo \$dir/\$thing.exe
2488                 elif test "$eunicefix" != ":"; then
2489                         : on Eunice apparently
2490                         echo \$dir/\$thing
2491                 fi
2492                 exit 0
2493         fi
2494         ;;
2495         esac
2496 done
2497 echo \$dflt
2498 exit 1
2499 EOSC
2500 chmod +x loc
2501 $eunicefix loc
2502 loclist="
2503 awk
2504 cat
2505 chmod
2506 comm
2507 cp
2508 echo
2509 expr
2510 grep
2511 ls
2512 mkdir
2513 rm
2514 sed
2515 sort
2516 touch
2517 tr
2518 uniq
2519 "
2520 trylist="
2521 ar
2522 bison
2523 byacc
2524 cpp
2525 csh
2526 date
2527 egrep
2528 gmake
2529 gzip
2530 less
2531 ln
2532 make
2533 more
2534 nm
2535 nroff
2536 perl
2537 pg
2538 test
2539 uname
2540 zip
2541 "
2542 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2543 pth="$pth $sysroot/lib $sysroot/usr/lib"
2544 for file in $loclist; do
2545         eval xxx=\$$file
2546         case "$xxx" in
2547         /*|?:[\\/]*)
2548                 if test -f "$xxx"; then
2549                         : ok
2550                 else
2551                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2552                         xxx=`./loc $file $file $pth`
2553                 fi
2554                 ;;
2555         '') xxx=`./loc $file $file $pth`;;
2556         *) xxx=`./loc $xxx $xxx $pth`;;
2557         esac
2558         eval $file=$xxx$_exe
2559         eval _$file=$xxx
2560         case "$xxx" in
2561         /*)
2562                 echo $file is in $xxx.
2563                 ;;
2564         ?:[\\/]*)
2565                 echo $file is in $xxx.
2566                 ;;
2567         *)
2568                 echo "I don't know where '$file' is, and my life depends on it." >&4
2569                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2570                 exit 1
2571                 ;;
2572         esac
2573 done
2574 echo " "
2575 echo "Don't worry if any of the following aren't found..."
2576 say=offhand
2577 for file in $trylist; do
2578         eval xxx=\$$file
2579         case "$xxx" in
2580         /*|?:[\\/]*)
2581                 if test -f "$xxx"; then
2582                         : ok
2583                 else
2584                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2585                         xxx=`./loc $file $file $pth`
2586                 fi
2587                 ;;
2588         '') xxx=`./loc $file $file $pth`;;
2589         *) xxx=`./loc $xxx $xxx $pth`;;
2590         esac
2591         eval $file=$xxx$_exe
2592         eval _$file=$xxx
2593         case "$xxx" in
2594         /*)
2595                 echo $file is in $xxx.
2596                 ;;
2597         ?:[\\/]*)
2598                 echo $file is in $xxx.
2599                 ;;
2600         *)
2601                 echo "I don't see $file out there, $say."
2602                 say=either
2603                 ;;
2604         esac
2605 done
2606 case "$egrep" in
2607 egrep)
2608         echo "Substituting grep for egrep."
2609         egrep=$grep
2610         _egrep=$grep
2611         ;;
2612 esac
2613 case "$less" in
2614 '')     ;;
2615 *)      if $less -R </dev/null >/dev/null 2>&1; then
2616                echo "Substituting less -R for less."
2617                less="$less -R"
2618                _less=$less
2619         fi
2620         ;;
2621 esac
2622 case "$ln" in
2623 ln)
2624         echo "Substituting cp for ln."
2625         ln=$cp
2626         _ln=$cp
2627         ;;
2628 esac
2629 case "$make" in
2630 make)
2631         case "$gmake" in
2632         gmake)
2633         echo "I can't find make or gmake, and my life depends on it." >&4
2634         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2635         exit 1
2636         ;;
2637         esac
2638         ;;
2639 esac
2640 case "$gmake" in
2641 gmake)  ;;
2642 *)      # We can't have osname yet.
2643         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2644                 # Assume that gmake, if found, is definitely GNU make
2645                 # and prefer it over the system make.
2646                 echo "Substituting gmake for make."
2647                 make=$gmake
2648                 _make=$gmake
2649         fi
2650         ;;
2651 esac
2652 case "$test" in
2653 test)
2654         echo "Hopefully test is built into your sh."
2655         ;;
2656 *)
2657         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2658                 echo "Using the test built into your sh."
2659                 test=test
2660                 _test=test
2661         fi
2662         ;;
2663 esac
2664 case "$echo" in
2665 echo)
2666         echo "Hopefully echo is built into your sh."
2667         ;;
2668 '') ;;
2669 *)
2670         echo " "
2671 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2672         $echo $n "hi there$c" >foo1
2673         echo $n "hi there$c" >foo2
2674         if cmp foo1 foo2 >/dev/null 2>&1; then
2675                 echo "They are compatible.  In fact, they may be identical."
2676         else
2677                 case "$n" in
2678                 '-n') n='' c='\c';;
2679                 *) n='-n' c='';;
2680                 esac
2681                 cat <<FOO
2682 They are not compatible!  You are probably running ksh on a non-USG system.
2683 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2684 have echo built in and we may have to run some Bourne shell scripts.  That
2685 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2686
2687 FOO
2688                 $echo $n "The star should be here-->$c"
2689                 $echo "*"
2690         fi
2691         $rm -f foo1 foo2
2692         ;;
2693 esac
2694
2695 # This question was auctioned at YAPC::Europe-2007 in Vienna
2696 # I never promised you could answer it. I only auctioned the question.
2697 cat <<FOO
2698 The following message is sponsored by
2699
2700   Dresden.pm<--The stars should be here.
2701
2702 Dear Perl user, system administrator or package
2703 maintainer, the Perl community sends greetings to
2704 you. Do you (emblematical) greet back [Y/n]? n
2705
2706 FOO
2707
2708 : Check what type of C compiler we use
2709 cat <<EOS >trygcc
2710 $startsh
2711 EOS
2712 cat <<'EOSC' >>trygcc
2713 case "$cc" in
2714 '') ;;
2715 *)  $rm -f try try.*
2716     $cat >try.c <<EOM
2717 int main(int argc, char *argv[]) {
2718   return 0;
2719 }
2720 EOM
2721     if $cc -o try $ccflags $ldflags try.c; then
2722        :
2723     else
2724         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2725         despair=yes
2726         trygcc=yes
2727         case "$cc" in
2728         *gcc*) trygcc=no ;;
2729         esac
2730         # Skip this test because it gives a false match on output like:
2731         #    ./trygcc: line 23: cc: command not found
2732         # case "`$cc -v -c try.c 2>&1`" in
2733         # *gcc*) trygcc=no ;;
2734         # esac
2735         if $test X"$trygcc" = Xyes; then
2736             if gcc -o try -c try.c; then
2737                 echo " "
2738                 echo "You seem to have a working gcc, though." >&4
2739                 # Switching compilers may undo the work of hints files.
2740                 # The most common problem is -D_REENTRANT for threads.
2741                 # This heuristic catches that case, but gets false positives
2742                 # if -Dusethreads was not actually specified.  Better to
2743                 # bail out here with a useful message than fail
2744                 # mysteriously later. Should we perhaps just try to
2745                 # re-invoke Configure -Dcc=gcc config_args ?
2746                 if $test -f usethreads.cbu; then
2747                         $cat >&4 <<EOM
2748
2749 *** However, any setting of the C compiler flags (e.g. for thread support)
2750 *** will be lost.  It may be necessary for you to restart Configure and
2751 *** add -Dcc=gcc to your Configure command line.
2752
2753 EOM
2754                         rp="Would you like to go ahead and try gcc anyway?"
2755                         dflt=n
2756                 else
2757                         rp="Would you like to use it?"
2758                         dflt=y
2759                 fi
2760                 if $test -f myread; then
2761                     . ./myread
2762                 else
2763                     if $test -f UU/myread; then
2764                         . ./UU/myread
2765                     else
2766                         echo "Cannot find myread, sorry.  Aborting." >&2
2767                         exit 1
2768                     fi
2769                 fi
2770                 case "$ans" in
2771                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2772                 esac
2773             fi
2774         fi
2775     fi
2776     $rm -f try try.*
2777     ;;
2778 esac
2779 EOSC
2780
2781 cat <<EOS >checkcc
2782 $startsh
2783 EOS
2784 cat <<'EOSC' >>checkcc
2785 case "$cc" in
2786 '') ;;
2787 *)  $rm -f try try.*
2788     $cat >try.c <<EOM
2789 int main(int argc, char *argv[]) {
2790   return 0;
2791 }
2792 EOM
2793     if $cc -o try $ccflags $ldflags try.c; then
2794        :
2795     else
2796         if $test X"$despair" = Xyes; then
2797            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2798         fi
2799         $cat >&4 <<EOM
2800 You need to find a working C compiler.
2801 Either (purchase and) install the C compiler supplied by your OS vendor,
2802 or for a free C compiler try http://gcc.gnu.org/
2803 I cannot continue any further, aborting.
2804 EOM
2805         exit 1
2806     fi
2807     $rm -f try try.*
2808     ;;
2809 esac
2810 EOSC
2811
2812 : determine whether symbolic links are supported
2813 echo " "
2814 $touch blurfl
2815 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2816         echo "Symbolic links are supported." >&4
2817         lns="$ln -s"
2818 else
2819         echo "Symbolic links are NOT supported." >&4
2820         lns="$ln"
2821 fi
2822 $rm -f blurfl sym
2823
2824 : determine whether symbolic links are supported
2825 echo " "
2826 case "$lns" in
2827 *"ln"*" -s")
2828         echo "Checking how to test for symbolic links..." >&4
2829         $lns blurfl sym
2830         if $test "X$issymlink" = X; then
2831                 case "$newsh" in
2832                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2833                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2834                 esac
2835                 if test $? = 0; then
2836                         issymlink="test -h"
2837                 else
2838                         echo "Your builtin 'test -h' may be broken." >&4
2839                         case "$test" in
2840                         /*)     ;;
2841                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2842                                 for p in $pth
2843                                 do
2844                                         if test -f "$p/$test"; then
2845                                                 test="$p/$test"
2846                                                 break
2847                                         fi
2848                                 done
2849                                 ;;
2850                         esac
2851                         case "$test" in
2852                         /*)
2853                                 echo "Trying external '$test -h'." >&4
2854                                 issymlink="$test -h"
2855                                 if $test ! -h sym >/dev/null 2>&1; then
2856                                         echo "External '$test -h' is broken, too." >&4
2857                                         issymlink=''
2858                                 fi
2859                                 ;;
2860                         *)      issymlink='' ;;
2861                         esac
2862                 fi
2863         fi
2864         if $test "X$issymlink" = X; then
2865                 if $test -L sym 2>/dev/null; then
2866                         issymlink="$test -L"
2867                         echo "The builtin '$test -L' worked." >&4
2868                 fi
2869         fi
2870         if $test "X$issymlink" != X; then
2871                 echo "You can test for symbolic links with '$issymlink'." >&4
2872         else
2873                 echo "I do not know how you can test for symbolic links." >&4
2874         fi
2875         $rm -f blurfl sym
2876         ;;
2877 *)      echo "No symbolic links, so not testing for their testing..." >&4
2878         ;;
2879 esac
2880
2881 : Make symlinks util
2882 case "$mksymlinks" in
2883 $define|true|[yY]*)
2884         case "$src" in
2885         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2886                 exit 1
2887                 ;;
2888         *)      case "$lns:$issymlink" in
2889                 *"ln"*" -s:"*"test -"?)
2890                         echo "Creating the symbolic links..." >&4
2891                         cd ..
2892                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2893                         awk 'NF == 1 {
2894                                 dir=".";
2895                                 file=$1 "";
2896                              }
2897                              NF == 2 {
2898                                 dir=$1 "";
2899                                 file=$2 "";
2900                              }
2901                              {
2902                                  print "# dir = ", dir, "file = ", file
2903                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2904                              } END {
2905                                  for (d in mf) {
2906                                      if (d != ".") { print("mkdir -p "d) }
2907                                      print("ln -sf "mf[d]" "d);
2908                                  }
2909                              }' source="$src" > UU/mksymlinks.$$
2910                         sh UU/mksymlinks.$$
2911                         rm UU/mksymlinks.$$
2912                         # Sanity check 1.
2913                         if test ! -d t/base; then
2914                                 echo "Failed to create the subdirectories.  Aborting." >&4
2915                                 exit 1
2916                         fi
2917                         # Sanity check 2.
2918                         if test ! -f t/base/lex.t; then
2919                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2920                                 exit 1
2921                         fi
2922                         if test ! -f win32/win32.c; then
2923                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2924                                 exit 1
2925                         fi
2926                         cd UU
2927                         ;;
2928                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2929                         ;;
2930                 esac
2931                 ;;
2932         esac
2933         ;;
2934 esac
2935
2936 : Check for Cross-Compilation
2937 if $test "X$targethost" = "X"; then
2938     targethost=""
2939 fi
2940 if $test "X$targetenv" = "X"; then
2941     targetenv=""
2942 fi
2943 case "$usecrosscompile" in
2944 $define|true|[yY]*)
2945         $echo "Cross-compiling..."
2946         croak=''
2947         case "$cc" in
2948         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2949             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2950             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2951             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2952             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2953             # leave out ld, choosing it is more complex
2954             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2955             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2956             # We are in a weird spot. Just before us, some values
2957             # were 'saved', to be restored after the hints are
2958             # run.  This means that the changes we made to ar,
2959             # nm and ranlib will get reverted.
2960             # To avoid that, we hijack the saving mechanism and
2961             # have it save our new values.
2962             for file in ar nm ranlib; do
2963                 eval xxx=\$$file
2964                 eval $file=$xxx$_exe
2965                 eval _$file=$xxx
2966             done
2967         ;;
2968         esac
2969         case "$targetarch" in
2970         '') echo "Targetarch not defined." >&4; croak=y ;;
2971         *)  echo "Using targetarch $targetarch." >&4 ;;
2972         esac
2973         case "$targethost" in
2974         '') echo "Targethost not defined." >&4; croak=n ;;
2975         *)  echo "Using targethost $targethost." >&4
2976         esac
2977         locincpth=' '
2978         loclibpth=' '
2979         case "$croak" in
2980         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2981         esac
2982     : compile a host miniperl and generate_uudmap, unless we got passed them
2983     if $test "X$hostperl" = X; then
2984       echo "Building host miniperl and generate_uudmap binaries" >&4
2985       before_host=`pwd`
2986       cd ..
2987       cd $src
2988       src=`pwd`
2989       rm -rf $src/host
2990       mkdir $src/host
2991       cd $src/host
2992       $src/Configure -des -Dusedevel -Dmksymlinks
2993       $make miniperl
2994       case "$hostgenerate" in
2995       '') $make generate_uudmap
2996           hostgenerate=$src/host/generate_uudmap
2997           ;;
2998        "$undef") hostgenerate=''
2999           ;;
3000       esac
3001       hostperl=$src/host/miniperl
3002       cd $before_host
3003     fi
3004     hostosname=`$hostperl -le 'print $^O'`
3005     ;;
3006 *)
3007     usecrosscompile="$undef"
3008     ;;
3009 esac
3010
3011 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3012 case "$targethost" in
3013     '') echo "Checking for cross-compile" >&4
3014     case "$usecrosscompile$multiarch" in
3015        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3016          if [ -f Makefile ]; then
3017            echo " "
3018            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3019          else
3020            echo "Configure done."
3021          fi
3022        exit 0
3023        ;;
3024      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3025         run=''
3026         to=:
3027         from=:
3028         ;;
3029     esac
3030     ;;
3031     *) echo "Using targethost $targethost." >&4
3032         case "$src" in
3033         /*) run=$src/Cross/run
3034             targetmkdir=$src/Cross/mkdir
3035             to=$src/Cross/to
3036             from=$src/Cross/from
3037             ;;
3038         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3039             run=$pwd/Cross/run
3040             targetmkdir=$pwd/Cross/mkdir
3041             to=$pwd/Cross/to
3042             from=$pwd/Cross/from
3043             ;;
3044         esac
3045         case "$targetrun" in
3046         '') targetrun=ssh ;;
3047         esac
3048         case "$targetto" in
3049         '') targetto=scp ;;
3050         esac
3051         case "$targetfrom" in
3052         '') targetfrom=scp ;;
3053         esac
3054         run=$run-$targetrun
3055         to=$to-$targetto
3056         from=$from-$targetfrom
3057         case "$targetdir" in
3058         '')  targetdir=/tmp
3059              echo "Guessing targetdir $targetdir." >&4
3060              ;;
3061         esac
3062         case "$targetuser" in
3063         '')  targetuser=root
3064              echo "Guessing targetuser $targetuser." >&4
3065              ;;
3066         esac
3067         case "$targetport" in
3068         '')  targetport=22
3069              echo "Guessing targetport $targetport." >&4
3070              ;;
3071         esac
3072         case "$targetfrom" in
3073         scp)    q=-q ;;
3074         *)      q='' ;;
3075         esac
3076         case "$targetrun" in
3077         ssh|rsh)
3078             cat >$run <<EOF
3079 #!/bin/sh
3080 env=''
3081 case "\$1" in
3082 -cwd)
3083   shift
3084   cwd=\$1
3085   shift
3086   ;;
3087 esac
3088 case "\$1" in
3089 -env)
3090   shift
3091   env=\$1
3092   shift
3093   ;;
3094 esac
3095 case "\$cwd" in
3096 '') cwd=$targetdir ;;
3097 esac
3098 exe=\$1
3099 shift
3100 $to \$exe
3101 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3102 EOF
3103             ;;
3104         adb)
3105             $touch $run
3106             ;;
3107         *)  echo "Unknown targetrun '$targetrun'" >&4
3108             exit 1
3109             ;;
3110         esac
3111         case "$targetmkdir" in
3112         */Cross/mkdir)
3113             cat >$targetmkdir <<EOF
3114 #!/bin/sh
3115 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3116 EOF
3117             $chmod a+rx $targetmkdir
3118             ;;
3119         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3120             exit 1
3121             ;;
3122         esac
3123         case "$targetto" in
3124         scp|rcp)
3125             cat >$to <<EOF
3126 #!/bin/sh
3127 for f in \$@
3128 do
3129   case "\$f" in
3130   /*)
3131     $targetmkdir \`dirname \$f\`
3132     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3133     ;;
3134   *)
3135     $targetmkdir $targetdir/\`dirname \$f\`
3136     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3137     ;;
3138   esac
3139 done
3140 exit 0
3141 EOF
3142             ;;
3143         cp) cat >$to <<EOF
3144 #!/bin/sh
3145 for f in \$@
3146 do
3147   case "\$f" in
3148   /*)
3149     $mkdir -p $targetdir/\`dirname \$f\`
3150     $cp \$f $targetdir/\$f || exit 1
3151     ;;
3152   *)
3153     $targetmkdir $targetdir/\`dirname \$f\`
3154     $cp \$f $targetdir/\$f || exit 1
3155     ;;
3156   esac
3157 done
3158 exit 0
3159 EOF
3160             ;;
3161         *)  echo "Unknown targetto '$targetto'" >&4
3162             exit 1
3163             ;;
3164         esac
3165         case "$targetfrom" in
3166         scp|rcp)
3167           cat >$from <<EOF
3168 #!/bin/sh
3169 for f in \$@
3170 do
3171   $rm -f \$f
3172   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3173 done
3174 exit 0
3175 EOF
3176             ;;
3177         cp) cat >$from <<EOF
3178 #!/bin/sh
3179 for f in \$@
3180 do
3181   $rm -f \$f
3182   cp $targetdir/\$f . || exit 1
3183 done
3184 exit 0
3185 EOF
3186             ;;
3187         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3188             exit 1
3189             ;;
3190         esac
3191         if $test ! -f $run; then
3192             echo "Target 'run' script '$run' not found." >&4
3193         else
3194             $chmod a+rx $run
3195         fi
3196         if $test ! -f $to; then
3197             echo "Target 'to' script '$to' not found." >&4
3198         else
3199             $chmod a+rx $to
3200         fi
3201         if $test ! -f $from; then
3202             echo "Target 'from' script '$from' not found." >&4
3203         else
3204             $chmod a+rx $from
3205         fi
3206         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3207             exit 1
3208         fi
3209         cat >&4 <<EOF
3210 Using '$run' for remote execution,
3211 and '$from' and '$to'
3212 for remote file transfer.
3213 EOF
3214         ;;
3215 *)      run=''
3216         to=:
3217         from=:
3218         usecrosscompile="$undef"
3219         targetarch=''
3220         ;;
3221 esac
3222
3223 : see whether [:lower:] and [:upper:] are supported character classes
3224 echo " "
3225 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3226 ABYZ-abyz)
3227         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3228         up='[:upper:]'
3229         low='[:lower:]'
3230         ;;
3231 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3232         # (0xd9 and 0xe2), therefore that is a nice testing point.
3233         if test "X$up" = X -o "X$low" = X; then
3234             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3235             rs) up='[A-Z]'
3236                 low='[a-z]'
3237                 ;;
3238             esac
3239         fi
3240         if test "X$up" = X -o "X$low" = X; then
3241             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3242             rs) up='A-Z'
3243                 low='a-z'
3244                 ;;
3245             esac
3246         fi
3247         if test "X$up" = X -o "X$low" = X; then
3248             case "`echo RS | od -x 2>/dev/null`" in
3249             *D9E2*|*d9e2*)
3250                 echo "Hey, this might be EBCDIC." >&4
3251                 if test "X$up" = X -o "X$low" = X; then
3252                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3253                     rs) up='[A-IJ-RS-Z]'
3254                         low='[a-ij-rs-z]'
3255                         ;;
3256                     esac
3257                 fi
3258                 if test "X$up" = X -o "X$low" = X; then
3259                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3260                     rs) up='A-IJ-RS-Z'
3261                         low='a-ij-rs-z'
3262                         ;;
3263                     esac
3264                 fi
3265                 ;;
3266             esac
3267         fi
3268 esac
3269 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3270 rs)
3271     echo "Using $up and $low to convert case." >&4
3272     ;;
3273 *)
3274     echo "I don't know how to translate letters from upper to lower case." >&4
3275     echo "Your tr is not acting any way I know of." >&4
3276     exit 1
3277     ;;
3278 esac
3279 : set up the translation script tr, must be called with ./tr of course
3280 cat >tr <<EOSC
3281 $startsh
3282 case "\$1\$2" in
3283 '[A-Z][a-z]') exec $tr '$up' '$low';;
3284 '[a-z][A-Z]') exec $tr '$low' '$up';;
3285 esac
3286 exec $tr "\$@"
3287 EOSC
3288 chmod +x tr
3289 $eunicefix tr
3290
3291 : Try to determine whether config.sh was made on this system
3292 case "$config_sh" in
3293 '')
3294 myuname=`$uname -a 2>/dev/null`
3295 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3296 # Downcase everything to avoid ambiguity.
3297 # Remove slashes and single quotes so we can use parts of this in
3298 # directory and file names.
3299 # Remove newlines so myuname is sane to use elsewhere.
3300 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3301 # because the A-Z/a-z are not consecutive.
3302 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3303         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3304 newmyuname="$myuname"
3305 dflt=n
3306 case "$knowitall" in
3307 '')
3308         if test -f ../config.sh; then
3309                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3310                         eval "`grep myuname= ../config.sh`"
3311                 fi
3312                 if test "X$myuname" = "X$newmyuname"; then
3313                         dflt=y
3314                 fi
3315         fi
3316         ;;
3317 *) dflt=y;;
3318 esac
3319
3320 : Get old answers from old config file if Configure was run on the
3321 : same system, otherwise use the hints.
3322 hint=default
3323 cd ..
3324 if test -f config.sh; then
3325         echo " "
3326         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3327         . UU/myread
3328         case "$ans" in
3329         n*|N*) echo "OK, I'll ignore it."
3330                 mv config.sh config.sh.old
3331                 myuname="$newmyuname"
3332                 ;;
3333         *)  echo "Fetching default answers from your old config.sh file..." >&4
3334                 tmp_n="$n"
3335                 tmp_c="$c"
3336                 tmp_sh="$sh"
3337                 . ./config.sh
3338                 cp config.sh UU
3339                 n="$tmp_n"
3340                 c="$tmp_c"
3341                 : Older versions did not always set $sh.  Catch re-use of such
3342                 : an old config.sh.
3343                 case "$sh" in
3344                 '') sh="$tmp_sh" ;;
3345                 esac
3346                 hint=previous
3347                 ;;
3348         esac
3349 fi
3350 . ./UU/checkcc
3351 if test ! -f config.sh; then
3352         $cat <<EOM
3353
3354 First time through, eh?  I have some defaults handy for some systems
3355 that need some extra help getting the Configure answers right:
3356
3357 EOM
3358         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3359         dflt=''
3360         : Half the following guesses are probably wrong... If you have better
3361         : tests or hints, please send them to perlbug@perl.org
3362         : The metaconfig authors would also appreciate a copy...
3363         $test -f /irix && osname=irix
3364         $test -f /xenix && osname=sco_xenix
3365         $test -f /dynix && osname=dynix
3366         $test -f /dnix && osname=dnix
3367         $test -f /lynx.os && osname=lynxos
3368         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3369         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3370         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3371         $test -f /bin/mips && /bin/mips && osname=mips
3372         $test -d /usr/apollo/bin && osname=apollo
3373         $test -f /etc/saf/_sactab && osname=svr4
3374         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3375         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3376         $test -f /sys/utilities/MultiView && osname=amigaos
3377         if $test -d /MachTen -o -d /MachTen_Folder; then
3378                 osname=machten
3379                 if $test -x /sbin/version; then
3380                         osvers=`/sbin/version | $awk '{print $2}' |
3381                         $sed -e 's/[A-Za-z]$//'`
3382                 elif $test -x /usr/etc/version; then
3383                         osvers=`/usr/etc/version | $awk '{print $2}' |
3384                         $sed -e 's/[A-Za-z]$//'`
3385                 else
3386                         osvers="$2.$3"
3387                 fi
3388         fi
3389
3390         $test -f /sys/posix.dll &&
3391                 $test -f /usr/bin/what &&
3392                 set X `/usr/bin/what /sys/posix.dll` &&
3393                 $test "$3" = UWIN &&
3394                 osname=uwin &&
3395                 osvers="$5"
3396
3397         if $test -f $uname; then
3398                 set X $myuname
3399                 shift
3400
3401                 case "$5" in
3402                 fps*) osname=fps ;;
3403                 mips*)
3404                         case "$4" in
3405                         umips) osname=umips ;;
3406                         *) osname=mips ;;
3407                         esac;;
3408                 [23]100) osname=mips ;;
3409                 i386*)
3410                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3411                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3412                                 osname='sco'
3413                                 osvers=$tmp
3414                         elif $test -f /etc/kconfig; then
3415                                 osname=isc
3416                                 if test "$lns" = "$ln -s"; then
3417                                         osvers=4
3418                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3419                                         osvers=3
3420                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3421                                         osvers=2
3422                                 fi
3423                         fi
3424                         tmp=''
3425                         ;;
3426                 pc*)
3427                         if test -n "$DJGPP"; then
3428                                 osname=dos
3429                                 osvers=djgpp
3430                         fi
3431                         ;;
3432                 esac
3433
3434                 case "$1" in
3435                 aix) osname=aix
3436                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3437                         case "$tmp" in
3438                         # oslevel can fail with:
3439                         # oslevel: Unable to acquire lock.
3440                         *not\ found) osvers="$4"."$3" ;;
3441                         '<3240'|'<>3240') osvers=3.2.0 ;;
3442                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3443                         '=3250'|'>3250') osvers=3.2.5 ;;
3444                         *) osvers=$tmp;;
3445                         esac
3446                         ;;
3447                 bitrig) osname=bitrig
3448                         osvers="$3"
3449                         ;;
3450                 bsd386) osname=bsd386
3451                         osvers=`$uname -r`
3452                         ;;
3453                 cygwin*) osname=cygwin
3454                         osvers="$3"
3455                         ;;
3456                 *dc.osx) osname=dcosx
3457                         osvers="$3"
3458                         ;;
3459                 dnix) osname=dnix
3460                         osvers="$3"
3461                         ;;
3462                 domainos) osname=apollo
3463                         osvers="$3"
3464                         ;;
3465                 dgux)   osname=dgux
3466                         osvers="$3"
3467                         ;;
3468                 dragonfly) osname=dragonfly
3469                         osvers="$3"
3470                         ;;
3471                 dynixptx*) osname=dynixptx
3472                         osvers=`echo "$4"|sed 's/^v//'`
3473                         ;;
3474                 freebsd) osname=freebsd
3475                         osvers="$3" ;;
3476                 genix)  osname=genix ;;
3477                 gnu)    osname=gnu
3478                         osvers="$3" ;;
3479                 hp*)    osname=hpux
3480                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3481                         ;;
3482                 irix*)  osname=irix
3483                         case "$3" in
3484                         4*) osvers=4 ;;
3485                         5*) osvers=5 ;;
3486                         *)      osvers="$3" ;;
3487                         esac
3488                         ;;
3489                 linux)  osname=linux
3490                         case "$3" in
3491                         *)      osvers="$3" ;;
3492                         esac
3493                         $test -f /system/lib/libandroid.so && osname=linux-android
3494                         ;;
3495                 MiNT)   osname=mint
3496                         ;;
3497                 netbsd*) osname=netbsd
3498                         osvers="$3"
3499                         ;;
3500                 news-os) osvers="$3"
3501                         case "$3" in
3502                         4*) osname=newsos4 ;;
3503                         *) osname=newsos ;;
3504                         esac
3505                         ;;
3506                 nonstop-ux) osname=nonstopux ;;
3507                 openbsd) osname=openbsd
3508                         osvers="$3"
3509                         ;;
3510                 os2)    osname=os2
3511                         osvers="$4"
3512                         ;;
3513                 POSIX-BC | posix-bc ) osname=posix-bc
3514                         osvers="$3"
3515                         ;;
3516                 powerux | power_ux | powermax_os | powermaxos | \
3517                 powerunix | power_unix) osname=powerux
3518                         osvers="$3"
3519                         ;;
3520                 qnx) osname=qnx
3521                         osvers="$4"
3522                         ;;
3523                 solaris) osname=solaris
3524                         case "$3" in
3525                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3526                         *)      osvers="$3" ;;
3527                         esac
3528                         ;;
3529                 sunos) osname=sunos
3530                         case "$3" in
3531                         5*) osname=solaris
3532                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3533                         *)      osvers="$3" ;;
3534                         esac
3535                         ;;
3536                 titanos) osname=titanos
3537                         case "$3" in
3538                         1*) osvers=1 ;;
3539                         2*) osvers=2 ;;
3540                         3*) osvers=3 ;;
3541                         4*) osvers=4 ;;
3542                         *)      osvers="$3" ;;
3543                         esac
3544                         ;;
3545                 ultrix) osname=ultrix
3546                         osvers="$3"
3547                         ;;
3548                 osf1|mls+)      case "$5" in
3549                                 alpha)
3550                                         osname=dec_osf
3551                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3552                                         case "$osvers" in
3553                                         [1-9].[0-9]*) ;;
3554                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3555                                         esac
3556                                         ;;
3557                         hp*)    osname=hp_osf1  ;;
3558                         mips)   osname=mips_osf1 ;;
3559                         esac
3560                         ;;
3561                 # UnixWare 7.1.2 is known as Open UNIX 8
3562                 openunix|unixware) osname=svr5
3563                         osvers="$4"
3564                         ;;
3565                 uts)    osname=uts
3566                         osvers="$3"
3567                         ;;
3568                 vos) osvers="$3"
3569                         ;;
3570                 $2) case "$osname" in
3571                         *isc*) ;;
3572                         *freebsd*) ;;
3573                         svr*)
3574                                 : svr4.x or possibly later
3575                                 case "svr$3" in
3576                                 ${osname}*)
3577                                         osname=svr$3
3578                                         osvers=$4
3579                                         ;;
3580                                 esac
3581                                 case "$osname" in
3582                                 svr4.0)
3583                                         : Check for ESIX
3584                                         if test -f /stand/boot ; then
3585                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3586                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3587                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3588                                                         if test -n "$isesix"; then
3589                                                                 osname=esix4
3590                                                         fi
3591                                                 fi
3592                                         fi
3593                                         ;;
3594                                 esac
3595                                 ;;
3596                         *)      if test -f /etc/systemid; then
3597                                         osname=sco
3598                                         set `echo $3 | $sed 's/\./ /g'` $4
3599                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3600                                                 osvers=$1.$2.$3
3601                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3602                                                 osvers=$1.$2
3603                                         elif $test -f $src/hints/sco_$1.sh; then
3604                                                 osvers=$1
3605                                         fi
3606                                 else
3607                                         case "$osname" in
3608                                         '') : Still unknown.  Probably a generic Sys V.
3609                                                 osname="sysv"
3610                                                 osvers="$3"
3611                                                 ;;
3612                                         esac
3613                                 fi
3614                                 ;;
3615                         esac
3616                         ;;
3617                 *)      case "$osname" in
3618                         '') : Still unknown.  Probably a generic BSD.
3619                                 osname="$1"
3620                                 osvers="$3"
3621                                 ;;
3622                         esac
3623                         ;;
3624                 esac
3625         else
3626                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3627                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3628                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3629                                 osname=news_os
3630                         fi
3631                         $rm -f UU/kernel.what
3632                 elif test -d c:/. -o -n "$is_os2" ; then
3633                         set X $myuname
3634                         osname=os2
3635                         osvers="$5"
3636                 fi
3637         fi
3638
3639         case "$targetarch" in
3640         '') ;;
3641         *)  hostarch=$osname
3642             case "$targetarch" in
3643                 nto*|*-nto-*)
3644                     # Will load qnx.sh, which should change osname to nto
3645                     osname=qnx
3646                     osvers=''
3647                     ;;
3648                 *linux-android*)
3649                     # Catch arm-linux-androideabi, mipsel-linux-android,
3650                     # and i686-linux-android
3651                     osname=linux-android
3652                     osvers=''
3653                     ;;
3654                 *linux*)
3655                     # Something like arm-linux-gnueabihf is really just
3656                     # plain linux.
3657                     osname=linux
3658                     osvers=''
3659                     ;;
3660                 *solaris*|*sunos*)
3661                     osname=solaris
3662                     # XXX perhaps we should just assume
3663                     # osvers to be 2, or maybe take the value
3664                     # from targetarch. Using $run before the
3665                     # hints are run is somewhat icky.
3666                     set X `$run $uname -a 2>/dev/null`
3667                     shift
3668                     case "$3" in
3669                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3670                         *)  osvers="$3" ;;
3671                     esac
3672                     ;;
3673                 *)
3674                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3675                     osvers=''
3676                 ;;
3677             esac
3678             ;;
3679         esac
3680
3681         : Now look for a hint file osname_osvers, unless one has been
3682         : specified already.
3683         case "$hintfile" in
3684         ''|' ')
3685                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3686                 : Also try without trailing minor version numbers.
3687                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3688                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3689                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3690                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3691                 case "$file" in
3692                 '') dflt=none ;;
3693                 *)  case "$osvers" in
3694                         '') dflt=$file
3695                                 ;;
3696                         *)  if $test -f $src/hints/$file.sh ; then
3697                                         dflt=$file
3698                                 elif $test -f $src/hints/$xfile.sh ; then
3699                                         dflt=$xfile
3700                                 elif $test -f $src/hints/$xxfile.sh ; then
3701                                         dflt=$xxfile
3702                                 elif $test -f $src/hints/$xxxfile.sh ; then
3703                                         dflt=$xxxfile
3704                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3705                                         dflt=$xxxxfile
3706                                 elif $test -f "$src/hints/${osname}.sh" ; then
3707                                         dflt="${osname}"
3708                                 else
3709                                         dflt=none
3710                                 fi
3711                                 ;;
3712                         esac
3713                         ;;
3714                 esac
3715                 if $test -f Policy.sh ; then
3716                         case "$dflt" in
3717                         *Policy*) ;;
3718                         none) dflt="Policy" ;;
3719                         *) dflt="Policy $dflt" ;;
3720                         esac
3721                 fi
3722                 ;;
3723         *)
3724                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3725                 ;;
3726         esac
3727
3728         if $test -f Policy.sh ; then
3729                 $cat <<EOM
3730
3731 There's also a Policy hint file available, which should make the
3732 site-specific (policy) questions easier to answer.
3733 EOM
3734
3735         fi
3736
3737         $cat <<EOM
3738
3739 You may give one or more space-separated answers, or "none" if appropriate.
3740 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3741 previous run of Configure, you may specify it as well as or instead of
3742 OS-specific hints.  If hints are provided for your OS, you should use them:
3743 although Perl can probably be built without hints on many platforms, using
3744 hints often improve performance and may enable features that Configure can't
3745 set up on its own. If there are no hints that match your OS, specify "none";
3746 DO NOT give a wrong version or a wrong OS.
3747
3748 EOM
3749
3750         rp="Which of these apply, if any?"
3751         . UU/myread
3752         tans=$ans
3753         for file in $tans; do
3754                 if $test X$file = XPolicy -a -f Policy.sh; then
3755                         . Policy.sh
3756                         $cat Policy.sh >> UU/config.sh
3757                 elif $test -f $src/hints/$file.sh; then
3758                         . $src/hints/$file.sh
3759                         $cat $src/hints/$file.sh >> UU/config.sh
3760                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3761                         : nothing
3762                 else
3763                         : Give one chance to correct a possible typo.
3764                         echo "$file.sh does not exist"
3765                         dflt=$file
3766                         rp="hint to use instead?"
3767                         . UU/myread
3768                         for file in $ans; do
3769                                 if $test -f "$src/hints/$file.sh"; then
3770                                         . $src/hints/$file.sh
3771                                         $cat $src/hints/$file.sh >> UU/config.sh
3772                                 elif $test X$ans = X -o X$ans = Xnone ; then
3773                                         : nothing
3774                                 else
3775                                         echo "$file.sh does not exist -- ignored."
3776                                 fi
3777                         done
3778                 fi
3779         done
3780
3781         hint=recommended
3782         : Remember our hint file for later.
3783         if $test -f "$src/hints/$file.sh" ; then
3784                 hintfile="$file"
3785         else
3786                 hintfile=''
3787         fi
3788 fi
3789 cd UU
3790 ;;
3791 *)
3792         echo " "
3793         echo "Fetching default answers from $config_sh..." >&4
3794         tmp_n="$n"
3795         tmp_c="$c"
3796         cd ..
3797         cp $config_sh config.sh 2>/dev/null
3798         chmod +w config.sh
3799         . ./config.sh
3800         cd UU
3801         cp ../config.sh .
3802         n="$tmp_n"
3803         c="$tmp_c"
3804         hint=previous
3805         ;;
3806 esac
3807 . ./optdef.sh
3808
3809 : Restore computed paths
3810 for file in $loclist $trylist; do
3811         eval $file="\$_$file"
3812 done
3813
3814 cat << EOM
3815
3816 Configure uses the operating system name and version to set some defaults.
3817 The default value is probably right if the name rings a bell. Otherwise,
3818 since spelling matters for me, either accept the default or answer "none"
3819 to leave it blank.
3820
3821 EOM
3822 case "$osname" in
3823         ''|' ')
3824                 case "$hintfile" in
3825                 ''|' '|none) dflt=none ;;
3826                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3827                 esac
3828                 ;;
3829         *) dflt="$osname" ;;
3830 esac
3831 rp="Operating system name?"
3832 . ./myread
3833 case "$ans" in
3834 none)  osname='' ;;
3835 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3836 esac
3837 echo " "
3838 case "$osvers" in
3839         ''|' ')
3840                 case "$hintfile" in
3841                 ''|' '|none) dflt=none ;;
3842                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3843                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3844                         case "$dflt" in
3845                         ''|' ') dflt=none ;;
3846                         esac
3847                         ;;
3848                 esac
3849                 ;;
3850         *) dflt="$osvers" ;;
3851 esac
3852 rp="Operating system version?"
3853 . ./myread
3854 case "$ans" in
3855 none)  osvers='' ;;
3856 *) osvers="$ans" ;;
3857 esac
3858
3859
3860 . ./posthint.sh
3861
3862 : who configured the system
3863 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3864 case "$cf_by" in
3865 "")
3866         cf_by=`(logname) 2>/dev/null`
3867         case "$cf_by" in
3868         "")
3869                 cf_by=`(whoami) 2>/dev/null`
3870                 case "$cf_by" in
3871                 "") cf_by=unknown ;;
3872                 esac ;;
3873         esac ;;
3874 esac
3875
3876 : decide how portable to be.  Allow command line overrides.
3877 case "$d_portable" in
3878 "$undef") ;;
3879 *)      d_portable="$define" ;;
3880 esac
3881
3882 : set up shell script to do ~ expansion
3883 cat >filexp <<EOSS
3884 $startsh
3885 : expand filename
3886 case "\$1" in
3887  \~/*|\~)
3888         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3889         ;;
3890  \~*)
3891         if $test -f /bin/csh; then
3892                 /bin/csh -f -c "glob \$1"
3893                 failed=\$?
3894                 echo ""
3895                 exit \$failed
3896         else
3897                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3898                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3899                 if $test ! -d "\$dir"; then
3900                         me=\`basename \$0\`
3901                         echo "\$me: can't locate home directory for: \$name" >&2
3902                         exit 1
3903                 fi
3904                 case "\$1" in
3905                 */*)
3906                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3907                         ;;
3908                 *)
3909                         echo \$dir
3910                         ;;
3911                 esac
3912         fi
3913         ;;
3914 *)
3915         echo \$1
3916         ;;
3917 esac
3918 EOSS
3919 chmod +x filexp
3920 $eunicefix filexp
3921
3922 : now set up to get a file name
3923 cat <<EOS >getfile
3924 $startsh
3925 EOS
3926 cat <<'EOSC' >>getfile
3927 tilde=''
3928 fullpath=''
3929 already=''
3930 skip=''
3931 none_ok=''
3932 exp_file=''
3933 nopath_ok=''
3934 orig_rp="$rp"
3935 orig_dflt="$dflt"
3936 case "$gfpth" in
3937 '') gfpth='.' ;;
3938 esac
3939
3940 case "$fn" in
3941 *\(*)
3942         : getfile will accept an answer from the comma-separated list
3943         : enclosed in parentheses even if it does not meet other criteria.
3944         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3945         fn=`echo $fn | sed 's/(.*)//'`
3946         ;;
3947 esac
3948
3949 case "$fn" in
3950 *:*)
3951         loc_file=`expr $fn : '.*:\(.*\)'`
3952         fn=`expr $fn : '\(.*\):.*'`
3953         ;;
3954 esac
3955
3956 case "$fn" in
3957 *~*) tilde=true;;
3958 esac
3959 case "$fn" in
3960 */*) fullpath=true;;
3961 esac
3962 case "$fn" in
3963 *+*) skip=true;;
3964 esac
3965 case "$fn" in
3966 *n*) none_ok=true;;
3967 esac
3968 case "$fn" in
3969 *e*) exp_file=true;;
3970 esac
3971 case "$fn" in
3972 *p*) nopath_ok=true;;
3973 esac
3974
3975 case "$fn" in
3976 *f*) type='File';;
3977 *d*) type='Directory';;
3978 *l*) type='Locate';;
3979 esac
3980
3981 what="$type"
3982 case "$what" in
3983 Locate) what='File';;
3984 esac
3985
3986 case "$exp_file" in
3987 '')
3988         case "$d_portable" in
3989         "$define") ;;
3990         *) exp_file=true;;
3991         esac
3992         ;;
3993 esac
3994
3995 cd ..
3996 while test "$type"; do
3997         redo=''
3998         rp="$orig_rp"
3999         dflt="$orig_dflt"
4000         case "$tilde" in
4001         true) rp="$rp (~name ok)";;
4002         esac
4003         . UU/myread
4004         if test -f UU/getfile.ok && \
4005                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4006         then
4007                 value="$ans"
4008                 ansexp="$ans"
4009                 break
4010         fi
4011         case "$ans" in
4012         none)
4013                 value=''
4014                 ansexp=''
4015                 case "$none_ok" in
4016                 true) type='';;
4017                 esac
4018                 ;;
4019         *)
4020                 case "$tilde" in
4021                 '') value="$ans"
4022                         ansexp="$ans";;
4023                 *)
4024                         value=`UU/filexp $ans`
4025                         case $? in
4026                         0)
4027                                 if test "$ans" != "$value"; then
4028                                         echo "(That expands to $value on this system.)"
4029                                 fi
4030                                 ;;
4031                         *) value="$ans";;
4032                         esac
4033                         ansexp="$value"
4034                         case "$exp_file" in
4035                         '') value="$ans";;
4036                         esac
4037                         ;;
4038                 esac
4039                 case "$fullpath" in
4040                 true)
4041                         case "$ansexp" in
4042                         /*) value="$ansexp" ;;
4043                         [a-zA-Z]:/*) value="$ansexp" ;;
4044                         *)
4045                                 redo=true
4046                                 case "$already" in
4047                                 true)
4048                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4049                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4050                                         ;;
4051                                 *)
4052                                 echo "Please give a full path name, starting with slash." >&4
4053                                         case "$tilde" in
4054                                         true)
4055                                 echo "Note that using ~name is ok provided it expands well." >&4
4056                                                 already=true
4057                                                 ;;
4058                                         esac
4059                                 esac
4060                                 ;;
4061                         esac
4062                         ;;
4063                 esac
4064                 case "$redo" in
4065                 '')
4066                         case "$type" in
4067                         File)
4068                                 for fp in $gfpth; do
4069                                         if test "X$fp" = X.; then
4070                                             pf="$ansexp"
4071                                         else    
4072                                             pf="$fp/$ansexp"
4073                                         fi
4074                                         if test -f "$pf"; then
4075                                                 type=''
4076                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4077                                         then
4078                                                 echo "($value is not a plain file, but that's ok.)"
4079                                                 type=''
4080                                         fi
4081                                         if test X"$type" = X; then
4082                                             value="$pf"
4083                                             break
4084                                         fi
4085                                 done
4086                                 ;;
4087                         Directory)
4088                                 for fp in $gfpth; do
4089                                         if test "X$fp" = X.; then
4090                                             dir="$ans"
4091                                             direxp="$ansexp"
4092                                         else    
4093                                             dir="$fp/$ansexp"
4094                                             direxp="$fp/$ansexp"
4095                                         fi
4096                                         if test -d "$direxp"; then
4097                                                 type=''
4098                                                 value="$dir"
4099                                                 break
4100                                         fi
4101                                 done
4102                                 ;;
4103                         Locate)
4104                                 if test -d "$ansexp"; then
4105                                         echo "(Looking for $loc_file in directory $value.)"
4106                                         value="$value/$loc_file"
4107                                         ansexp="$ansexp/$loc_file"
4108                                 fi
4109                                 if test -f "$ansexp"; then
4110                                         type=''
4111                                 fi
4112                                 case "$nopath_ok" in
4113                                 true)   case "$value" in
4114                                         */*) ;;
4115                                         *)      echo "Assuming $value will be in people's path."
4116                                                 type=''
4117                                                 ;;
4118                                         esac
4119                                         ;;
4120                                 esac
4121                                 ;;
4122                         esac
4123
4124                         case "$skip" in
4125                         true) type='';
4126                         esac
4127
4128                         case "$type" in
4129                         '') ;;
4130                         *)
4131                                 if test "$fastread" = yes; then
4132                                         dflt=y
4133                                 else
4134                                         dflt=n
4135                                 fi
4136                                 rp="$what $value doesn't exist.  Use that name anyway?"
4137                                 . UU/myread
4138                                 dflt=''
4139                                 case "$ans" in
4140                                 y*) type='';;
4141                                 *) echo " ";;
4142                                 esac
4143                                 ;;
4144                         esac
4145                         ;;
4146                 esac
4147                 ;;
4148         esac
4149 done
4150 cd UU
4151 ans="$value"
4152 rp="$orig_rp"
4153 dflt="$orig_dflt"
4154 rm -f getfile.ok
4155 test "X$gfpthkeep" != Xy && gfpth=""
4156 EOSC
4157
4158 : determine root of directory hierarchy where package will be installed.
4159 case "$prefix" in
4160 '')
4161         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4162         ;;
4163 *?/)
4164         dflt=`echo "$prefix" | sed 's/.$//'`
4165         ;;
4166 *)
4167         dflt="$prefix"
4168         ;;
4169 esac
4170 $cat <<EOM
4171
4172 By default, $package will be installed in $dflt/bin, manual pages
4173 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4174 installation directories. Typically this is something like /usr/local.
4175 If you wish to have binaries under /usr/bin but other parts of the
4176 installation under /usr/local, that's ok: you will be prompted
4177 separately for each of the installation directories, the prefix being
4178 only used to set the defaults.
4179
4180 EOM
4181 fn=d~
4182 rp='Installation prefix to use?'
4183 . ./getfile
4184 oldprefix=''
4185 case "$prefix" in
4186 '') ;;
4187 *)
4188         case "$ans" in
4189         "$prefix") ;;
4190         *) oldprefix="$prefix";;
4191         esac
4192         ;;
4193 esac
4194 prefix="$ans"
4195 prefixexp="$ansexp"
4196
4197 : allow them to override the AFS root
4198 case "$afsroot" in
4199 '')     afsroot=/afs ;;
4200 *)      afsroot=$afsroot ;;
4201 esac
4202
4203 : is AFS running?
4204 echo " "
4205 case "$afs" in
4206 $define|true)   afs=true ;;
4207 $undef|false)   afs=false ;;
4208 *)      if $test -d $afsroot; then
4209                 afs=true
4210         else
4211                 afs=false
4212         fi
4213         ;;
4214 esac
4215 if $afs; then
4216         echo "AFS may be running... I'll be extra cautious then..." >&4
4217 else
4218         echo "AFS does not seem to be running..." >&4
4219 fi
4220
4221 : determine installation prefix for where package is to be installed.
4222 if $afs; then
4223 $cat <<EOM
4224
4225 Since you are running AFS, I need to distinguish the directory in which
4226 files will reside from the directory in which they are installed (and from
4227 which they are presumably copied to the former directory by occult means).
4228
4229 EOM
4230         case "$installprefix" in
4231         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4232         *) dflt="$installprefix";;
4233         esac
4234 else
4235 $cat <<EOM
4236
4237 In some special cases, particularly when building $package for distribution,
4238 it is convenient to distinguish the directory in which files should be
4239 installed from the directory ($prefix) in which they will
4240 eventually reside.  For most users, these two directories are the same.
4241
4242 EOM
4243         case "$installprefix" in
4244         '') dflt=$prefix ;;
4245         *) dflt=$installprefix;;
4246         esac
4247 fi
4248 fn=d~
4249 rp='What installation prefix should I use for installing files?'
4250 . ./getfile
4251 installprefix="$ans"
4252 installprefixexp="$ansexp"
4253
4254 : Perform the prefixexp/installprefixexp correction if necessary
4255 cat <<EOS >installprefix
4256 $startsh
4257 EOS
4258 cat <<'EOSC' >>installprefix
4259 : Change installation prefix, if necessary.
4260 if $test X"$prefix" != X"$installprefix"; then
4261     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4262 else
4263     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4264 fi
4265 EOSC
4266 chmod +x installprefix
4267 $eunicefix installprefix
4268
4269 : Set variables such as privlib and privlibexp from the output of ./getfile
4270 : performing the prefixexp/installprefixexp correction if necessary.
4271 cat <<EOS >setprefixvar
4272 $startsh
4273 EOS
4274 cat <<'EOSC' >>setprefixvar
4275 eval "${prefixvar}=\"\$ans\""
4276 eval "${prefixvar}exp=\"\$ansexp\""
4277 . ./installprefix
4278 EOSC
4279 chmod +x setprefixvar
4280 $eunicefix setprefixvar
4281
4282 : set up the script used to warn in case of inconsistency
4283 cat <<EOS >whoa
4284 $startsh
4285 EOS
4286 cat <<'EOSC' >>whoa
4287 dflt=y
4288 case "$hint" in
4289     recommended)
4290         case "$hintfile" in
4291         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4292                 ;;
4293         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4294                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4295                 ;;
4296         esac
4297         ;;
4298     *)  echo " "
4299         echo "*** WHOA THERE!!! ***" >&4
4300         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4301         ;;
4302 esac
4303 rp="    Keep the $hint value?"
4304 . ./myread
4305 case "$ans" in
4306 y) td=$was; tu=$was;;
4307 esac
4308 EOSC
4309
4310 : function used to set '$1' to '$val'
4311 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4312 case "$val$was" in
4313 $define$undef) . ./whoa; eval "$var=\$td";;
4314 $undef$define) . ./whoa; eval "$var=\$tu";;
4315 *) eval "$var=$val";;
4316 esac'
4317
4318 : get the patchlevel
4319 echo " "
4320 echo "Getting the current patchlevel..." >&4
4321 if $test -r $rsrc/patchlevel.h;then
4322         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4323         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4324         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4325         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4326         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4327         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4328         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4329 else
4330         revision=0
4331         patchlevel=0
4332         subversion=0
4333         api_revision=0
4334         api_version=0
4335         api_subversion=0
4336         perl_patchlevel=0
4337         $echo "(You do not have patchlevel.h.  Eek.)"
4338 fi
4339 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4340 version_patchlevel_string="version $patchlevel subversion $subversion"
4341 case "$perl_patchlevel" in
4342 0|'') ;;
4343 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4344     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4345     ;;
4346 esac
4347
4348 $echo "(You have $package $version_patchlevel_string.)"
4349
4350 case "$osname" in
4351 dos|vms)
4352         : XXX Should be a Configure test for double-dots in filenames.
4353         version=`echo $revision $patchlevel $subversion | \
4354                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4355         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4356                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4357         ;;
4358 *)
4359         version=`echo $revision $patchlevel $subversion | \
4360                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4361         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4362                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4363         ;;
4364 esac
4365 : Special case the 5.005_xx maintenance series, which used 5.005
4366 : without any subversion label as a subdirectory in $sitelib
4367 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4368         api_versionstring='5.005'
4369 fi
4370
4371 : Do we want threads support and if so, what type
4372 case "$usethreads" in
4373 $define|true|[yY]*)     dflt='y';;
4374 *)     # Catch case where user specified ithreads or 5005threads but
4375        # forgot -Dusethreads (A.D. 4/2002)
4376        case "$useithreads$use5005threads" in
4377        *$define*)       dflt='y';;
4378        *)               dflt='n';;
4379        esac
4380        ;;
4381 esac
4382 cat <<EOM
4383
4384 Perl can be built to offer a form of threading support on some systems
4385 To do so, Configure can be run with -Dusethreads.
4386
4387 Note that Perl built with threading support runs slightly slower
4388 and uses slightly more memory than plain Perl.
4389
4390 If this doesn't make any sense to you, just accept the default '$dflt'.
4391 EOM
4392 rp='Build a threading Perl?'
4393 . ./myread
4394 case "$ans" in
4395 y|Y)    val="$define" ;;
4396 *)      val="$undef" ;;
4397 esac
4398 set usethreads
4399 eval $setvar
4400
4401 if $test $patchlevel -lt 9; then
4402     case "$usethreads" in
4403     $define)
4404         : Default to ithreads unless overridden on command line or with
4405         : old config.sh
4406         dflt='y'
4407         case "$use5005threads" in
4408                 $define|true|[yY]*)
4409                         echo "5.005 threads are no longer supported"
4410                         exit 1
4411                 ;;
4412         esac
4413         case "$useithreads" in
4414                 $undef|false|[nN]*) dflt='n';;
4415         esac
4416         rp='Use the newer interpreter-based ithreads?'
4417         . ./myread
4418         case "$ans" in
4419         y|Y)    val="$define" ;;
4420         *)      val="$undef" ;;
4421         esac
4422         set useithreads
4423         eval $setvar
4424         : Now set use5005threads to the opposite value.
4425         case "$useithreads" in
4426         $define) val="$undef" ;;
4427         *) val="$define" ;;
4428         esac
4429         set use5005threads
4430         eval $setvar
4431         ;;
4432     *)
4433         useithreads="$undef"
4434         use5005threads="$undef"
4435         ;;
4436     esac
4437
4438     case "$useithreads$use5005threads" in
4439     "$define$define")
4440         $cat >&4 <<EOM
4441
4442 You cannot have both the ithreads and the 5.005 threads enabled
4443 at the same time.  Disabling the 5.005 threads since they are
4444 much less stable than the ithreads.
4445
4446 EOM
4447         use5005threads="$undef"
4448         ;;
4449     esac
4450
4451 else
4452 : perl-5.9.x and later
4453
4454     if test X"$usethreads" = "X$define"; then
4455         case "$use5005threads" in
4456             $define|true|[yY]*)
4457                 $cat >&4 <<EOM
4458
4459 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4460
4461 EOM
4462             ;;
4463         esac
4464     fi
4465
4466     use5005threads="$undef"
4467     useithreads="$usethreads"
4468 fi
4469
4470 case "$d_oldpthreads" in
4471 '')     : Configure tests would be welcome here.  For now, assume undef.
4472         val="$undef" ;;
4473 *)      val="$d_oldpthreads" ;;
4474 esac
4475 set d_oldpthreads
4476 eval $setvar
4477
4478
4479 : Look for a hint-file generated 'call-back-unit'.  If the
4480 : user has specified that a threading perl is to be built,
4481 : we may need to set or change some other defaults.
4482 if $test -f usethreads.cbu; then
4483     echo "Your platform has some specific hints regarding threaded builds, using them..."
4484     . ./usethreads.cbu
4485 else
4486     case "$usethreads" in
4487         "$define"|true|[yY]*)
4488                 $cat <<EOM
4489 (Your platform does not have any specific hints for threaded builds.
4490  Assuming POSIX threads, then.)
4491 EOM
4492         ;;
4493     esac
4494 fi
4495
4496 : Check if multiplicity is required
4497 cat <<EOM
4498
4499 Perl can be built so that multiple Perl interpreters can coexist
4500 within the same Perl executable.
4501 EOM
4502
4503 case "$useithreads" in
4504 $define)
4505         cat <<EOM
4506 This multiple interpreter support is required for interpreter-based threads.
4507 EOM
4508         val="$define"
4509         ;;
4510 *)      case "$usemultiplicity" in
4511         $define|true|[yY]*)     dflt='y';;
4512         *) dflt='n';;
4513         esac
4514         echo " "
4515         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4516         rp='Build Perl for multiplicity?'
4517         . ./myread
4518         case "$ans" in
4519         y|Y)    val="$define" ;;
4520         *)      val="$undef" ;;
4521         esac
4522         ;;
4523 esac
4524 set usemultiplicity
4525 eval $setvar
4526
4527 : Check if morebits is requested
4528 case "$usemorebits" in
4529 "$define"|true|[yY]*)
4530         use64bitint="$define"
4531         uselongdouble="$define"
4532         usemorebits="$define"
4533         ;;
4534 *)      usemorebits="$undef"
4535         ;;
4536 esac
4537
4538 : Determine the C compiler to be used
4539 echo " "
4540 case "$cc" in
4541 '') dflt=cc;;
4542 *) dflt="$cc";;
4543 esac
4544 rp="Use which C compiler?"
4545 . ./myread
4546 cc="$ans"
4547
4548 : See whether they have no cc but they do have gcc
4549 . ./trygcc
4550 if $test -f cc.cbu; then
4551     . ./cc.cbu
4552 fi
4553 . ./checkcc
4554
4555 : make some quick guesses about what we are up against
4556 echo " "
4557 $echo $n "Hmm...  $c"
4558 echo exit 1 >bsd
4559 echo exit 1 >usg
4560 echo exit 1 >v7
4561 echo exit 1 >osf1
4562 echo exit 1 >eunice
4563 echo exit 1 >xenix
4564 echo exit 1 >venix
4565 echo exit 1 >os2
4566 d_bsd="$undef"
4567 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4568 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4569 then
4570         echo "Looks kind of like an OSF/1 system, but we'll see..."
4571         echo exit 0 >osf1
4572 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4573         xxx=`./loc addbib blurfl $pth`
4574         if $test -f $xxx; then
4575         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4576                 echo exit 0 >bsd
4577                 echo exit 0 >usg
4578         else
4579                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4580                         echo "Looks kind of like an extended USG system, but we'll see..."
4581                 else
4582                         echo "Looks kind of like a USG system, but we'll see..."
4583                 fi
4584                 echo exit 0 >usg
4585         fi
4586 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4587         echo "Looks kind of like a BSD system, but we'll see..."
4588         d_bsd="$define"
4589         echo exit 0 >bsd
4590 else
4591         echo "Looks kind of like a Version 7 system, but we'll see..."
4592         echo exit 0 >v7
4593 fi
4594 case "$eunicefix" in
4595 *unixtovms*)
4596         $cat <<'EOI'
4597 There is, however, a strange, musty smell in the air that reminds me of
4598 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4599 EOI
4600         echo exit 0 >eunice
4601         d_eunice="$define"
4602 : it so happens the Eunice I know will not run shell scripts in Unix format
4603         ;;
4604 *)
4605         echo " "
4606         echo "Congratulations.  You aren't running Eunice."
4607         d_eunice="$undef"
4608         ;;
4609 esac
4610 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4611 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4612 : semicolon as a patch separator
4613 case "$p_" in
4614 :) ;;
4615 *)
4616         $cat <<'EOI'
4617 I have the feeling something is not exactly right, however...don't tell me...
4618 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4619 (Or you may be running DOS with DJGPP.)
4620 EOI
4621         echo exit 0 >os2
4622         ;;
4623 esac
4624 if test -f /xenix; then
4625         echo "Actually, this looks more like a XENIX system..."
4626         echo exit 0 >xenix
4627         d_xenix="$define"
4628 else
4629         echo " "
4630         echo "It's not Xenix..."
4631         d_xenix="$undef"
4632 fi
4633 chmod +x xenix
4634 $eunicefix xenix
4635 if test -f /venix; then
4636         echo "Actually, this looks more like a VENIX system..."
4637         echo exit 0 >venix
4638 else
4639         echo " "
4640         if ./xenix; then
4641                 : null
4642         else
4643                 echo "Nor is it Venix..."
4644         fi
4645 fi
4646 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4647 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4648 $rm -f foo
4649
4650 : Check if we are using GNU gcc and what its version is
4651 echo " "
4652 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4653 $cat >try.c <<EOM
4654 #include <stdio.h>
4655 int main() {
4656 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4657 #ifdef __VERSION__
4658         printf("%s\n", __VERSION__);
4659 #else
4660         printf("%s\n", "1");
4661 #endif
4662 #endif
4663         return(0);
4664 }
4665 EOM
4666 if $cc -o try $ccflags $ldflags try.c; then
4667         gccversion=`$run ./try`
4668         case "$gccversion" in
4669         '') echo "You are not using GNU cc." ;;
4670         *)  echo "You are using GNU cc $gccversion."
4671             ccname=gcc
4672             ;;
4673         esac
4674 else
4675         echo " "
4676         echo "*** WHOA THERE!!! ***" >&4
4677         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4678         case "$knowitall" in
4679         '')
4680         echo "    You'd better start hunting for one and let me know about it." >&4
4681                 exit 1
4682                 ;;
4683         esac
4684 fi
4685 $rm -f try try.*
4686 case "$gccversion" in
4687 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4688 esac
4689 case "$gccversion" in
4690 '') gccosandvers='' ;;
4691 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4692    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4693    gccshortvers=''
4694    case "$gccosandvers" in
4695    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4696    $osname$osvers) ;; # looking good
4697    $osname*) cat <<EOM >&4
4698
4699 *** WHOA THERE!!! ***
4700
4701     Your gcc has not been compiled for the exact release of
4702     your operating system ($gccosandvers versus $osname$osvers).
4703
4704     In general it is a good idea to keep gcc synchronized with
4705     the operating system because otherwise serious problems
4706     may ensue when trying to compile software, like Perl.
4707
4708     I'm trying to be optimistic here, though, and will continue.
4709     If later during the configuration and build icky compilation
4710     problems appear (headerfile conflicts being the most common
4711     manifestation), I suggest reinstalling the gcc to match
4712     your operating system release.
4713
4714 EOM
4715       ;;
4716    *) gccosandvers='' ;; # failed to parse, better be silent
4717    esac
4718    ;;
4719 esac
4720 case "$ccname" in
4721 '') ccname="$cc" ;;
4722 esac
4723
4724 # gcc 3.* complain about adding -Idirectories that they already know about,
4725 # so we will take those off from locincpth.
4726 case "$gccversion" in
4727 3*)
4728     echo "main(){}">try.c
4729     for incdir in $locincpth; do
4730        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4731              grep '^c[cp]p*[01]: warning: changing search order '`
4732        if test "X$warn" != X; then
4733            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4734        fi
4735     done
4736     $rm -f try try.*
4737 esac
4738
4739 # gcc 4.9 by default does some optimizations that break perl.
4740 # see ticket 121505.
4741 #
4742 # The -fwrapv disables those optimizations (and probably others,) so
4743 # for gcc 4.9 (and later, since the optimizations probably won't go
4744 # away), add -fwrapv unless the user requests -fno-wrapv, which
4745 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4746 # which turns the overflows -fwrapv ignores into runtime errors.
4747 case "$gccversion" in
4748 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4749     case "$ccflags" in
4750     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4751     *) ccflags="$ccflags -fwrapv" ;;
4752     esac
4753 esac
4754
4755 : What should the include directory be ?
4756 : Use sysroot if set, so findhdr looks in the right place.
4757 echo " "
4758 $echo $n "Hmm...  $c"
4759 dflt="$sysroot/usr/include"
4760 incpath=''
4761 mips_type=''
4762 if $test -f /bin/mips && /bin/mips; then
4763         echo "Looks like a MIPS system..."
4764         $cat >usr.c <<'EOCP'
4765 #ifdef SYSTYPE_BSD43
4766 /bsd43
4767 #endif
4768 EOCP
4769         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4770                 dflt='/bsd43/usr/include'
4771                 incpath='/bsd43'
4772                 mips_type='BSD 4.3'
4773         else
4774                 mips_type='System V'
4775         fi
4776         $rm -f usr.c usr.out
4777         echo "and you're compiling with the $mips_type compiler and libraries."
4778         xxx_prompt=y
4779         echo "exit 0" >mips
4780 else
4781         echo "Doesn't look like a MIPS system."
4782         xxx_prompt=n
4783         echo "exit 1" >mips
4784 fi
4785 chmod +x mips
4786 $eunicefix mips
4787 case "$usrinc" in
4788 '') ;;
4789 *) dflt="$usrinc";;
4790 esac
4791 case "$xxx_prompt" in
4792 y)      fn=d/
4793         echo " "
4794         rp='Where are the include files you want to use?'
4795         . ./getfile
4796         usrinc="$ans"
4797         ;;
4798 *)      usrinc="$dflt"
4799         ;;
4800 esac
4801
4802 : see how we invoke the C preprocessor
4803 echo " "
4804 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4805 cat <<'EOT' >testcpp.c
4806 #define ABC abc
4807 #define XYZ xyz
4808 ABC.XYZ
4809 EOT
4810 cd ..
4811 if test ! -f cppstdin; then
4812         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4813                 # AIX cc -E doesn't show the absolute headerfile
4814                 # locations but we'll cheat by using the -M flag.
4815                 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
4816         else
4817                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4818         fi
4819 else
4820         echo "Keeping your $hint cppstdin wrapper."
4821 fi
4822 chmod 755 cppstdin
4823 wrapper=`pwd`/cppstdin
4824 ok='false'
4825 cd UU
4826
4827 if $test "X$cppstdin" != "X" && \
4828         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4829         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4830 then
4831         echo "You used to use $cppstdin $cppminus so we'll use that again."
4832         case "$cpprun" in
4833         '') echo "But let's see if we can live without a wrapper..." ;;
4834         *)
4835                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4836                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4837                 then
4838                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4839                         ok='true'
4840                 else
4841                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4842                 fi
4843                 ;;
4844         esac
4845 else
4846         case "$cppstdin" in
4847         '') ;;
4848         *)
4849                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4850                 ;;
4851         esac
4852 fi
4853
4854 if $ok; then
4855         : nothing
4856 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4857         $cc -E <testcpp.c >testcpp.out 2>&1; \
4858         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4859         echo "Yup, it does."
4860         x_cpp="$cc $cppflags -E"
4861         x_minus='';
4862 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4863         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4864         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4865         echo "Yup, it does."
4866         x_cpp="$cc $cppflags -E"
4867         x_minus='-';
4868 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4869         $cc -P <testcpp.c >testcpp.out 2>&1; \
4870         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4871         echo "Yipee, that works!"
4872         x_cpp="$cc $cppflags -P"
4873         x_minus='';
4874 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4875         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4876         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4877         echo "At long last!"
4878         x_cpp="$cc $cppflags -P"
4879         x_minus='-';
4880 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4881         $cpp <testcpp.c >testcpp.out 2>&1; \
4882         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4883         echo "It works!"
4884         x_cpp="$cpp $cppflags"
4885         x_minus='';
4886 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4887         $cpp - <testcpp.c >testcpp.out 2>&1; \
4888         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4889         echo "Hooray, it works!  I was beginning to wonder."
4890         x_cpp="$cpp $cppflags"
4891         x_minus='-';
4892 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4893         $wrapper <testcpp.c >testcpp.out 2>&1; \
4894         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4895         x_cpp="$wrapper"
4896         x_minus=''
4897         echo "Eureka!"
4898 else
4899         dflt=''
4900         rp="No dice.  I can't find a C preprocessor.  Name one:"
4901         . ./myread
4902         x_cpp="$ans"
4903         x_minus=''
4904         $x_cpp <testcpp.c >testcpp.out 2>&1
4905         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4906                 echo "OK, that will do." >&4
4907         else
4908 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4909                 exit 1
4910         fi
4911 fi
4912
4913 case "$ok" in
4914 false)
4915         cppstdin="$x_cpp"
4916         cppminus="$x_minus"
4917         cpprun="$x_cpp"
4918         cpplast="$x_minus"
4919         set X $x_cpp
4920         shift
4921         case "$1" in
4922         "$cpp")
4923                 echo "Perhaps can we force $cc -E using a wrapper..."
4924                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4925                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4926                 then
4927                         echo "Yup, we can."
4928                         cppstdin="$wrapper"
4929                         cppminus='';
4930                 else
4931                         echo "Nope, we'll have to live without it..."
4932                 fi
4933                 ;;
4934         esac
4935         case "$cpprun" in
4936         "$wrapper")
4937                 cpprun=''
4938                 cpplast=''
4939                 ;;
4940         esac
4941         ;;
4942 esac
4943
4944 case "$cppstdin" in
4945 "$wrapper"|'cppstdin') ;;
4946 *) $rm -f $wrapper;;
4947 esac
4948 $rm -f testcpp.c testcpp.out
4949
4950 : Adjust cppfilter for path component separator
4951 case "$osname" in
4952 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4953 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4954 *)   cppfilter='' ;;
4955 esac
4956
4957 : Use gcc to determine libpth and incpth
4958 # If using gcc or clang, we can get better values for libpth, incpth
4959 # and usrinc directly from the compiler.
4960 # Note that ccname for clang is also gcc.
4961 case "$ccname" in
4962     gcc)
4963         $echo 'extern int foo;' > try.c
4964         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4965         shift
4966         if $test $# -gt 0; then
4967             incpth="$incpth $*"
4968             incpth="`$echo $incpth|$sed 's/^ //'`"
4969             for i in $*; do
4970                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4971                 if $test -d $j; then
4972                     libpth="$libpth $j"
4973                 fi
4974             done
4975             libpth="`$echo $libpth|$sed 's/^ //'`"
4976             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4977                 if $test -d $xxx; then
4978                     case " $libpth " in
4979                     *" $xxx "*) ;;
4980                     *) libpth="$libpth $xxx";;
4981                     esac
4982                 fi
4983             done
4984         fi
4985         $rm -f try.c
4986         case "$usrinc" in
4987         '') for i in $incpth; do
4988                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4989                     usrinc="$i"
4990                     break
4991                 fi
4992             done
4993             ;;
4994         esac
4995
4996         case "$usecrosscompile" in
4997         $define|true|[yY]*)
4998             case "$incpth" in
4999                 '') echo "Incpth not defined." >&4; croak=y ;;
5000                 *)  echo "Using incpth '$incpth'." >&4 ;;
5001             esac
5002             case "$libpth" in
5003                 '') echo "Libpth not defined." >&4; croak=y ;;
5004                 *)  echo "Using libpth '$libpth'." >&4 ;;
5005             esac
5006             case "$usrinc" in
5007                 '') echo "Usrinc not defined." >&4; croak=y ;;
5008                 *)  echo "Using usrinc $usrinc." >&4 ;;
5009             esac
5010             case "$croak" in
5011                 y)
5012                 if test "X$sysroot" = X; then
5013                     echo "Cannot continue, aborting." >&4; exit 1
5014                 else
5015                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5016                 fi
5017                 ;;
5018             esac
5019             ;;
5020         esac
5021     ;;
5022 esac
5023
5024 : Default value for incpth is just usrinc
5025 case "$incpth" in
5026 '') incpth="$usrinc";;
5027 esac
5028
5029 : Set private lib path
5030 case "$plibpth" in
5031 '') if ./mips; then
5032         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5033     fi;;
5034 esac
5035 case "$libpth" in
5036 ' ') dlist='';;
5037 '') dlist="$loclibpth $plibpth $glibpth";;
5038 *) dlist="$libpth";;
5039 esac
5040
5041 : Now check and see which directories actually exist, avoiding duplicates
5042 for xxx in $dlist
5043 do
5044     if $test -d $xxx; then
5045                 case " $libpth " in
5046                 *" $xxx "*) ;;
5047                 *) libpth="$libpth $xxx";;
5048                 esac
5049     fi
5050 done
5051 $cat <<'EOM'
5052
5053 Some systems have incompatible or broken versions of libraries.  Among
5054 the directories listed in the question below, please remove any you
5055 know not to be holding relevant libraries, and add any that are needed.
5056 Say "none" for none.
5057
5058 EOM
5059
5060 if test "X$sysroot" != X; then
5061     $cat <<EOM
5062 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5063
5064 EOM
5065 fi
5066
5067 case "$libpth" in
5068 '') dflt='none';;
5069 *)
5070         set X $libpth
5071         shift
5072         dflt=${1+"$@"}
5073         ;;
5074 esac
5075 rp="Directories to use for library searches?"
5076 . ./myread
5077 case "$ans" in
5078 none) libpth=' ';;
5079 *) libpth="$ans";;
5080 esac
5081
5082 : compute shared library extension
5083 case "$so" in
5084 '')
5085         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5086                 dflt='sl'
5087         else
5088                 dflt='so'
5089         fi
5090         ;;
5091 *) dflt="$so";;
5092 esac
5093 $cat <<EOM
5094
5095 On some systems, shared libraries may be available.  Answer 'none' if
5096 you want to suppress searching of shared libraries for the remainder
5097 of this configuration.
5098
5099 EOM
5100 rp='What is the file extension used for shared libraries?'
5101 . ./myread
5102 so="$ans"
5103
5104 : Does target system insist that shared library basenames are unique
5105 $cat << EOM
5106
5107 Some dynamic loaders assume that the *basename* of shared library filenames
5108 are globally unique.  We'll default this to undef as we assume your system
5109 is not this weird. Set to defined if you're on one of them.
5110
5111 EOM
5112
5113 dflt='n'
5114 rp='Make shared library basenames unique?'
5115 . ./myread
5116 case "$ans" in
5117 y|Y) val="$define" ;;
5118 *)   val="$undef"  ;;
5119 esac
5120 set d_libname_unique
5121 eval $setvar
5122
5123 : Define several unixisms.
5124 : Hints files or command line option can be used to override them.
5125 : The convoluted testing is in case hints files set either the old
5126 : or the new name.
5127 case "$_exe" in
5128 '')     case "$exe_ext" in
5129         '')     ;;
5130         *)      _exe="$exe_ext" ;;
5131         esac
5132         ;;
5133 esac
5134 case "$_a" in
5135 '')     case "$lib_ext" in
5136     '') _a='.a';;
5137         *)      _a="$lib_ext" ;;
5138         esac
5139         ;;
5140 esac
5141 case "$_o" in
5142 '') case "$obj_ext" in
5143         '')     _o='.o';;
5144         *)      _o="$obj_ext";;
5145         esac
5146         ;;
5147 esac
5148 case "$p_" in
5149 '') case "$path_sep" in
5150         '')     p_=':';;
5151         *)      p_="$path_sep";;
5152         esac
5153         ;;
5154 esac
5155 exe_ext=$_exe
5156 lib_ext=$_a
5157 obj_ext=$_o
5158 path_sep=$p_
5159
5160 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5161
5162 : Which makefile gets called first.  This is used by make depend.
5163 case "$firstmakefile" in
5164 '') firstmakefile='makefile';;
5165 esac
5166
5167 : Check is we will use socks
5168 case "$usesocks" in
5169 $define|true|[yY]*)     dflt='y';;
5170 *) dflt='n';;
5171 esac
5172 cat <<EOM
5173
5174 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5175 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5176 to use the PerlIO abstraction layer, this will be implicitly selected.
5177
5178 If this doesn't make any sense to you, just accept the default '$dflt'.
5179 EOM
5180 rp='Build Perl for SOCKS?'
5181 . ./myread
5182 case "$ans" in
5183 y|Y)    val="$define" ;;
5184 *)      val="$undef" ;;
5185 esac
5186 set usesocks
5187 eval $setvar
5188
5189 : Check for uselongdouble support
5190 case "$ccflags" in
5191 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5192 esac
5193
5194 case "$uselongdouble" in
5195 $define|true|[yY]*)     dflt='y';;
5196 *) dflt='n';;
5197 esac
5198 cat <<EOM
5199
5200 Perl can be built to take advantage of long doubles which
5201 (if available) may give more accuracy and range for floating point numbers.
5202
5203 If this doesn't make any sense to you, just accept the default '$dflt'.
5204 EOM
5205 rp='Try to use long doubles if available?'
5206 . ./myread
5207 case "$ans" in
5208 y|Y)    val="$define"   ;;
5209 *)      val="$undef"    ;;
5210 esac
5211 set uselongdouble
5212 eval $setvar
5213
5214 case "$uselongdouble" in
5215 true|[yY]*) uselongdouble="$define" ;;
5216 esac
5217
5218 : Look for a hint-file generated 'call-back-unit'.  If the
5219 : user has specified that long doubles should be used,
5220 : we may need to set or change some other defaults.
5221 if $test -f uselongdouble.cbu; then
5222     echo "Your platform has some specific hints regarding long doubles, using them..."
5223     . ./uselongdouble.cbu
5224 else
5225     case "$uselongdouble" in
5226         $define)
5227                 $cat <<EOM
5228 (Your platform does not have any specific hints for long doubles.)
5229 EOM
5230         ;;
5231     esac
5232 fi
5233
5234 : Check if quadmath is requested
5235 case "$usequadmath" in
5236 "$define"|true|[yY]*) usequadmath="$define" ;;
5237 *)                    usequadmath="$undef"  ;;
5238 esac
5239
5240 : Fail if both uselongdouble and usequadmath are requested
5241 case "$usequadmath:$uselongdouble" in
5242 define:define)
5243         $cat <<EOM >&4
5244
5245 *** You requested the use of the quadmath library and use
5246 *** of long doubles.
5247 ***
5248 *** Please select one or the other.
5249 EOM
5250         exit 1
5251         ;;
5252 esac
5253
5254 : Looking for optional libraries
5255 echo " "
5256 echo "Checking for optional libraries..." >&4
5257 case "$libs" in
5258 ' '|'') dflt='';;
5259 *) dflt="$libs";;
5260 esac
5261 case "$libswanted" in
5262 '') libswanted='c_s';;
5263 esac
5264 case "$usesocks" in
5265 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5266 esac
5267 case "$usecbacktrace" in
5268 "$define") libswanted="$libswanted bfd" ;;
5269 esac
5270 case "$usequadmath" in
5271 "$define") libswanted="$libswanted quadmath" ;;
5272 esac
5273 libsfound=''
5274 libsfiles=''
5275 libsdirs=''
5276 libspath=''
5277 for thisdir in $libpth $xlibpth; do
5278   test -d $thisdir && libspath="$libspath $thisdir"
5279 done
5280 for thislib in $libswanted; do
5281         for thisdir in $libspath; do
5282             xxx=''
5283             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5284                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5285                 $test -f "$xxx" && eval $libscheck
5286                 $test -f "$xxx" && libstyle=shared
5287                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5288                 $test -f "$xxx" && eval $libscheck
5289                 $test -f "$xxx" && libstyle=shared
5290             fi
5291             if test ! -f "$xxx"; then
5292                 xxx=$thisdir/lib$thislib.$so
5293                 $test -f "$xxx" && eval $libscheck
5294                 $test -f "$xxx" && libstyle=shared
5295             fi
5296             if test ! -f "$xxx"; then
5297                 xxx=$thisdir/lib$thislib$_a
5298                 $test -f "$xxx" && eval $libscheck
5299                 $test -f "$xxx" && libstyle=static
5300             fi
5301             if test ! -f "$xxx"; then
5302                 xxx=$thisdir/$thislib$_a
5303                 $test -f "$xxx" && eval $libscheck
5304                 $test -f "$xxx" && libstyle=static
5305             fi
5306             if test ! -f "$xxx"; then
5307                 xxx=$thisdir/lib${thislib}_s$_a
5308                 $test -f "$xxx" && eval $libscheck
5309                 $test -f "$xxx" && libstyle=static
5310                 $test -f "$xxx" && thislib=${thislib}_s
5311             fi
5312             if test ! -f "$xxx"; then
5313                 xxx=$thisdir/Slib$thislib$_a
5314                 $test -f "$xxx" && eval $libscheck
5315                 $test -f "$xxx" && libstyle=static
5316             fi
5317             if $test -f "$xxx"; then
5318                 case "$libstyle" in
5319                 shared) echo "Found -l$thislib (shared)." ;;
5320                 static) echo "Found -l$thislib." ;;
5321                 *)      echo "Found -l$thislib ($libstyle)." ;;
5322                 esac
5323                 case " $dflt " in
5324                 *"-l$thislib "*);;
5325                 *) dflt="$dflt -l$thislib"
5326                    libsfound="$libsfound $xxx"
5327                    yyy=`basename $xxx`
5328                    libsfiles="$libsfiles $yyy"
5329                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5330                    case " $libsdirs " in
5331                    *" $yyy "*) ;;
5332                    *) libsdirs="$libsdirs $yyy" ;;
5333                    esac
5334                    ;;
5335                 esac
5336                 break
5337             fi
5338         done
5339         if $test ! -f "$xxx"; then
5340             echo "No -l$thislib."
5341         fi
5342 done
5343 set X $dflt
5344 shift
5345 dflt="$*"
5346 case "$libs" in
5347 '') dflt="$dflt";;
5348 *) dflt="$libs";;
5349 esac
5350 case "$dflt" in
5351 ' '|'') dflt='none';;
5352 esac
5353
5354 $cat <<EOM
5355
5356 In order to compile $package on your machine, a number of libraries
5357 are usually needed.  Include any other special libraries here as well.
5358 Say "none" for none.  The default list is almost always right.
5359 EOM
5360
5361 echo " "
5362 rp="What libraries to use?"
5363 . ./myread
5364 case "$ans" in
5365 none) libs=' ';;
5366 *) libs="$ans";;
5367 esac
5368
5369 : determine optimization, if desired, or use for debug flag also
5370 case "$optimize" in
5371 ' '|$undef) dflt='none';;
5372 '') dflt='-O';;
5373 *) dflt="$optimize";;
5374 esac
5375 $cat <<EOH
5376
5377 By default, $package compiles with the -O flag to use the optimizer.
5378 Alternately, you might want to use the symbolic debugger, which uses
5379 the -g flag (on traditional Unix systems).  Either flag can be
5380 specified here.  To use neither flag, specify the word "none".
5381
5382 EOH
5383 rp="What optimizer/debugger flag should be used?"
5384 . ./myread
5385 optimize="$ans"
5386 case "$optimize" in
5387 'none') optimize=" ";;
5388 esac
5389
5390 : Check what DEBUGGING is required from the command line
5391 : -DEBUGGING      or -DDEBUGGING or
5392 : -DEBUGGING=both                       = -g + -DDEBUGGING
5393 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5394 : -DEBUGGING=none or -UDEBUGGING        =
5395 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5396 case "$EBUGGING" in
5397 '')     ;;
5398 *)      DEBUGGING=$EBUGGING ;;
5399 esac
5400
5401 case "$DEBUGGING" in
5402 -g|both|$define)
5403     case "$optimize" in
5404         *-g*) ;;
5405         *)    optimize="$optimize -g" ;;
5406     esac ;;
5407 none|$undef)
5408     case "$optimize" in
5409         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5410                 shift
5411                 optimize="$*"
5412                 ;;
5413     esac ;;
5414 esac
5415
5416 dflt=''
5417 case "$DEBUGGING" in
5418 both|$define) dflt='-DDEBUGGING'
5419 esac
5420
5421 : argument order is deliberate, as the flag will start with - which set could
5422 : think is an option
5423 checkccflag='check=$1; flag=$2; callback=$3;
5424 echo " ";
5425 echo "Checking if your compiler accepts $flag" 2>&1;
5426 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5427 echo "int main(void) { return 0; }" > gcctest.c;
5428 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5429     echo "Yes, it does." 2>&1;
5430     if $test -s gcctest.out ; then
5431         echo "But your platform does not like it:";
5432         cat gcctest.out;
5433     else
5434         case "$ccflags" in
5435         *$check*)
5436             echo "Leaving current flags $ccflags alone." 2>&1
5437             ;;
5438         *) dflt="$dflt $flag";
5439             eval $callback
5440             ;;
5441         esac
5442     fi
5443 else
5444     echo "Nope, it does not, but that is ok." 2>&1;
5445 fi
5446 '
5447
5448 : We will not override a previous value, but we might want to
5449 : augment a hint file
5450 case "$hint" in
5451 default|recommended)
5452         case "$gccversion" in
5453         1*) dflt="$dflt -fpcc-struct-return" ;;
5454         esac
5455         case "$optimize:$DEBUGGING" in
5456         *-g*:old) dflt="$dflt -DDEBUGGING";;
5457         esac
5458         case "$gccversion" in
5459         2*) if $test -d /etc/conf/kconfig.d &&
5460                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5461                 then
5462                         # Interactive Systems (ISC) POSIX mode.
5463                         dflt="$dflt -posix"
5464                 fi
5465                 ;;
5466         esac
5467         case "$gccversion" in
5468         1*) ;;
5469         2.[0-8]*) ;;
5470         ?*)     set strict-aliasing -fno-strict-aliasing
5471                 eval $checkccflag
5472                 ;;
5473         esac
5474         # For gcc, adding -pipe speeds up compilations for some, but apparently
5475         # some assemblers can't read from stdin.  (It also slows down compilations
5476         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5477         case "$gccversion" in
5478         ?*)     set pipe -pipe
5479                 eval $checkccflag
5480                 ;;
5481         esac
5482
5483         # on x86_64 (at least) we require an extra library (libssp) in the
5484         # link command line. This library is not named, so I infer that it is
5485         # an implementation detail that may change. Hence the safest approach
5486         # is to add the flag to the flags passed to the compiler at link time,
5487         # as that way the compiler can do the right implementation dependant
5488         # thing. (NWC)
5489         case "$osname" in
5490         amigaos) ;; # -fstack-protector builds but doesn't work
5491         *)      case "$gccversion" in
5492                 ?*)     set stack-protector-strong -fstack-protector-strong
5493                         eval $checkccflag
5494                         case "$dflt" in
5495                         *-fstack-protector-strong*) ;; # It got added.
5496                         *) # Try the plain/older -fstack-protector.
5497                            set stack-protector -fstack-protector
5498                            eval $checkccflag
5499                            ;;
5500                         esac
5501                         ;;
5502                 esac
5503                 ;;
5504         esac
5505         ;;
5506 esac
5507
5508 case "$mips_type" in
5509 *BSD*|'') inclwanted="$locincpth $usrinc";;
5510 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5511 esac
5512 for thisincl in $inclwanted; do
5513         if $test -d $thisincl; then
5514                 if $test x$thisincl != x$usrinc; then
5515                         case "$dflt" in
5516                         *" -I$thisincl "*);;
5517                         *) dflt="$dflt -I$thisincl ";;
5518                         esac
5519                 fi
5520         fi
5521 done
5522
5523 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5524         xxx=true;
5525 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5526         xxx=true;
5527 else
5528         xxx=false;
5529 fi;
5530 if $xxx; then
5531         case "$dflt" in
5532         *$2*);;
5533         *) dflt="$dflt -D$2";;
5534         esac;
5535 fi'
5536
5537 set signal.h LANGUAGE_C; eval $inctest
5538
5539 case "$usesocks" in
5540 $define)
5541         ccflags="$ccflags -DSOCKS"
5542         ;;
5543 esac
5544
5545 case "$hint" in
5546 default|recommended) dflt="$ccflags $dflt" ;;
5547 *) dflt="$ccflags";;
5548 esac
5549
5550 case "$dflt" in
5551 ''|' ') dflt=none;;
5552 esac
5553
5554 $cat <<EOH
5555
5556 Your C compiler may want other flags.  For this question you should include
5557 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5558 but you should NOT include libraries or ld flags like -lwhatever.  If you
5559 want $package to honor its debug switch, you should include -DDEBUGGING here.
5560 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5561
5562 To use no flags, specify the word "none".
5563
5564 EOH
5565 set X $dflt
5566 shift
5567 dflt=${1+"$@"}
5568 rp="Any additional cc flags?"
5569 . ./myread
5570 case "$ans" in
5571 none) ccflags='';;
5572 *) ccflags="$ans";;
5573 esac
5574
5575 : the following weeds options from ccflags that are of no interest to cpp
5576 case "$cppflags" in
5577 '') cppflags="$ccflags" ;;
5578 *)  set X $ccflags; shift
5579     case " $cppflags " in
5580     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5581     *) cppflags="$cppflags $ccflags" ;;
5582     esac
5583     ;;
5584 esac
5585 case "$gccversion" in
5586 1*) cppflags="$cppflags -D__GNUC__"
5587 esac
5588 case "$mips_type" in
5589 '');;
5590 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5591 esac
5592 case "$cppflags" in
5593 '');;
5594 *)
5595         echo " "
5596         echo "Let me guess what the preprocessor flags are..." >&4
5597         set X $cppflags
5598         shift
5599         cppflags=''
5600         $cat >cpp.c <<'EOM'
5601 #define BLURFL foo
5602
5603 BLURFL xx LFRULB
5604 EOM
5605         previous=''
5606         for flag in $*
5607         do
5608                 case "$flag" in
5609                 -*) ftry="$flag";;
5610                 *) ftry="$previous $flag";;
5611                 esac
5612                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5613                         >cpp1.out 2>/dev/null && \
5614                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5615                         >cpp2.out 2>/dev/null && \
5616                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5617                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5618                 then
5619                         cppflags="$cppflags $ftry"
5620                         previous=''
5621                 else
5622                         previous="$flag"
5623                 fi
5624         done
5625         set X $cppflags
5626         shift
5627         cppflags=${1+"$@"}
5628         case "$cppflags" in
5629         *-*)  echo "They appear to be: $cppflags";;
5630         esac
5631         $rm -f cpp.c cpp?.out
5632         ;;
5633 esac
5634
5635 : flags used in final linking phase
5636 case "$ldflags" in
5637 '') if ./venix; then
5638                 dflt='-i -z'
5639         else
5640                 dflt=''
5641         fi
5642         case "$ccflags" in
5643         *-posix*) dflt="$dflt -posix" ;;
5644         esac
5645         ;;
5646 *) dflt="$ldflags";;
5647 esac
5648 # See note above about -fstack-protector
5649 case "$ccflags" in
5650 *-fstack-protector-strong*)
5651         case "$dflt" in
5652         *-fstack-protector-strong*) ;; # Don't add it again
5653         *) dflt="$dflt -fstack-protector-strong" ;;
5654         esac
5655         ;;
5656 *-fstack-protector*)
5657         case "$dflt" in
5658         *-fstack-protector*) ;; # Don't add it again
5659         *) dflt="$dflt -fstack-protector" ;;
5660         esac
5661         ;;
5662 esac
5663
5664 : Try to guess additional flags to pick up local libraries.
5665 for thislibdir in $libpth; do
5666         case " $loclibpth " in
5667         *" $thislibdir "*)
5668                 case "$dflt " in
5669                 *"-L$thislibdir "*) ;;
5670                 *)  dflt="$dflt -L$thislibdir" ;;
5671                 esac
5672                 ;;
5673         esac
5674 done
5675
5676 case "$dflt" in
5677 '') dflt='none' ;;
5678 esac
5679
5680 $cat <<EOH
5681
5682 Your C linker may need flags.  For this question you should
5683 include -L/whatever and any other flags used by the C linker, but you
5684 should NOT include libraries like -lwhatever.
5685
5686 Make sure you include the appropriate -L/path flags if your C linker
5687 does not normally search all of the directories you specified above,
5688 namely
5689         $libpth
5690 To use no flags, specify the word "none".
5691
5692 EOH
5693
5694 rp="Any additional ld flags (NOT including libraries)?"
5695 . ./myread
5696 case "$ans" in
5697 none) ldflags='';;
5698 *) ldflags="$ans";;
5699 esac
5700 rmlist="$rmlist pdp11"
5701
5702 : coherency check
5703 echo " "
5704 echo "Checking your choice of C compiler and flags for coherency..." >&4
5705 $cat > try.c <<'EOF'
5706 #include <stdio.h>
5707 int main() { printf("Ok\n"); return(0); }
5708 EOF
5709 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5710 shift
5711 $cat >try.msg <<'EOM'
5712 I've tried to compile and run the following simple program:
5713
5714 EOM
5715 $cat try.c >> try.msg
5716
5717 $cat >> try.msg <<EOM
5718
5719 I used the command:
5720
5721         $*
5722         $run ./try
5723
5724 and I got the following output:
5725
5726 EOM
5727 dflt=y
5728 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5729         if $sh -c "$run ./try " >>try.msg 2>&1; then
5730                 xxx=`$run ./try`
5731                 case "$xxx" in
5732                 "Ok") dflt=n ;;
5733                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5734                 esac
5735         else
5736                 echo "The program compiled OK, but exited with status $?." >>try.msg
5737                 rp="You have a problem.  Shall I abort Configure"
5738                 dflt=y
5739         fi
5740 else
5741         echo "I can't compile the test program." >>try.msg
5742         rp="You have a BIG problem.  Shall I abort Configure"
5743         dflt=y
5744 fi
5745 case "$dflt" in
5746 y)
5747         $cat try.msg >&4
5748         case "$knowitall" in
5749         '')
5750                 echo "(The supplied flags or libraries might be incorrect.)"
5751                 ;;
5752         *) dflt=n;;
5753         esac
5754         echo " "
5755         . ./myread
5756         case "$ans" in
5757         n*|N*) ;;
5758         *)      echo "Ok.  Stopping Configure." >&4
5759                 exit 1
5760                 ;;
5761         esac
5762         ;;
5763 n) echo "OK, that should do.";;
5764 esac
5765 $rm_try gcctest gcctest.out
5766
5767 : define a shorthand compile call
5768 compile='
5769 mc_file=$1;
5770 shift;
5771 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5772 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5773 exit 1;
5774 fi;
5775 esac;
5776 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5777 : define a shorthand compile call for compilations that should be ok.
5778 compile_ok='
5779 mc_file=$1;
5780 shift;
5781 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5782
5783 : stub, used only to satisfy other units
5784 i_stdlib='define'
5785
5786 : check for lengths of integral types
5787 echo " "
5788 case "$intsize" in
5789 '')
5790         echo "Checking to see how big your integers are..." >&4
5791         $cat >try.c <<EOCP
5792 #include <stdio.h>
5793 #$i_stdlib I_STDLIB
5794 #ifdef I_STDLIB
5795 #include <stdlib.h>
5796 #endif
5797 int main()
5798 {
5799         printf("intsize=%d;\n", (int)sizeof(int));
5800         printf("longsize=%d;\n", (int)sizeof(long));
5801         printf("shortsize=%d;\n", (int)sizeof(short));
5802         exit(0);
5803 }
5804 EOCP
5805         set try
5806         if eval $compile_ok && $run ./try > /dev/null; then
5807                 eval `$run ./try`
5808                 echo "Your integers are $intsize bytes long."
5809                 echo "Your long integers are $longsize bytes long."
5810                 echo "Your short integers are $shortsize bytes long."
5811         else
5812                 $cat >&4 <<EOM
5813 !
5814 Help! I can't compile and run the intsize test program: please enlighten me!
5815 (This is probably a misconfiguration in your system or libraries, and
5816 you really ought to fix it.  Still, I'll try anyway.)
5817 !
5818 EOM
5819                 dflt=4
5820                 rp="What is the size of an integer (in bytes)?"
5821                 . ./myread
5822                 intsize="$ans"
5823                 dflt=$intsize
5824                 rp="What is the size of a long integer (in bytes)?"
5825                 . ./myread
5826                 longsize="$ans"
5827                 dflt=2
5828                 rp="What is the size of a short integer (in bytes)?"
5829                 . ./myread
5830                 shortsize="$ans"
5831         fi
5832         ;;
5833 esac
5834 $rm_try
5835
5836 : check for long long
5837 echo " "
5838 echo "Checking to see if you have long long..." >&4
5839 echo 'int main() { long long x = 7; return 0; }' > try.c
5840 set try
5841 if eval $compile; then
5842         val="$define"
5843         echo "You have long long."
5844 else
5845         val="$undef"
5846         echo "You do not have long long."
5847 fi
5848 $rm_try
5849 set d_longlong
5850 eval $setvar
5851
5852 : check for length of long long
5853 case "${d_longlong}${longlongsize}" in
5854 $define)
5855         echo " "
5856         echo "Checking to see how big your long longs are..." >&4
5857         $cat >try.c <<'EOCP'
5858 #include <stdio.h>
5859 int main()
5860 {
5861     printf("%d\n", (int)sizeof(long long));
5862     return(0);
5863 }
5864 EOCP
5865         set try
5866         if eval $compile_ok; then
5867                 longlongsize=`$run ./try`
5868                 echo "Your long longs are $longlongsize bytes long."
5869         else
5870                 dflt='8'
5871                 echo " "
5872                 echo "(I can't seem to compile the test program.  Guessing...)"
5873                 rp="What is the size of a long long (in bytes)?"
5874                 . ./myread
5875                 longlongsize="$ans"
5876         fi
5877         if $test "X$longsize" = "X$longlongsize"; then
5878                 echo "(That isn't any different from an ordinary long.)"
5879         fi
5880         ;;
5881 esac
5882 $rm_try
5883
5884 : determine filename position in cpp output
5885 echo " "
5886 echo "Computing filename position in cpp output for #include directives..." >&4
5887 case "$osname" in
5888 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5889 esac
5890 case "$fieldn" in
5891 '')
5892 case "$osname" in
5893 vos) testaccess=-e ;;
5894 *)   testaccess=-r ;;
5895 esac
5896 echo '#include <stdio.h>' > foo.c
5897 $cat >fieldn <<EOF
5898 $startsh
5899 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5900 $grep '^[       ]*#.*stdio\.h' | \
5901 while read cline; do
5902         pos=1
5903         set \$cline
5904         while $test \$# -gt 0; do
5905                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5906                         echo "\$pos"
5907                         exit 0
5908                 fi
5909                 shift
5910                 pos=\`expr \$pos + 1\`
5911         done
5912 done
5913 EOF
5914 chmod +x fieldn
5915 fieldn=`./fieldn`
5916 $rm -f foo.c fieldn
5917 ;;
5918 esac
5919 case $fieldn in
5920 '') pos='???';;
5921 1) pos=first;;
5922 2) pos=second;;
5923 3) pos=third;;
5924 *) pos="${fieldn}th";;
5925 esac
5926 echo "Your cpp writes the filename in the $pos field of the line."
5927
5928 : locate header file
5929 $cat >findhdr <<EOF
5930 $startsh
5931 wanted=\$1
5932 name=''
5933 for usrincdir in $incpth
5934 do
5935         if test -f \$usrincdir/\$wanted; then
5936                 echo "\$usrincdir/\$wanted"
5937                 exit 0
5938         fi
5939 done
5940 awkprg='{ print \$$fieldn }'
5941 echo "#include <\$wanted>" > foo\$\$.c
5942 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5943 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5944 while read cline; do
5945         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5946         case "\$name" in
5947         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5948         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5949         *) exit 2;;
5950         esac;
5951 done;
5952 #
5953 # status = 0: grep returned 0 lines, case statement not executed
5954 # status = 1: headerfile found
5955 # status = 2: while loop executed, no headerfile found
5956 #
5957 status=\$?
5958 $rm -f foo\$\$.c;
5959 if test \$status -eq 1; then
5960         exit 0;
5961 fi
5962 exit 1
5963 EOF
5964 chmod +x findhdr
5965
5966 : define an alternate in-header-list? function
5967 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5968 cont=true; xxf="echo \"<\$1> found.\" >&4";
5969 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5970 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5971 esac;
5972 case $# in 4) instead=instead;; *) instead="at last";; esac;
5973 while $test "$cont"; do
5974         xxx=`./findhdr $1`
5975         var=$2; eval "was=\$$2";
5976         if $test "$xxx" && $test -r "$xxx";
5977         then eval $xxf;
5978         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5979                 cont="";
5980         else eval $xxnf;
5981         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5982         set $yyy; shift; shift; yyy=$@;
5983         case $# in 0) cont="";;
5984         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5985                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5986         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5987                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5988         esac;
5989 done;
5990 while $test "$yyy";
5991 do set $yyy; var=$2; eval "was=\$$2";
5992         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5993         set $yyy; shift; shift; yyy=$@;
5994 done'
5995
5996 : see if inttypes.h is available
5997 : we want a real compile instead of Inhdr because some systems
5998 : have an inttypes.h which includes non-existent headers
5999 echo " "
6000 $cat >try.c <<EOCP
6001 #include <inttypes.h>
6002 int main() {
6003         static int32_t foo32 = 0x12345678;
6004 }
6005 EOCP
6006 set try
6007 if eval $compile; then
6008         echo "<inttypes.h> found." >&4
6009         val="$define"
6010 else
6011         echo "<inttypes.h> NOT found." >&4
6012         val="$undef"
6013 fi
6014 $rm_try
6015 set i_inttypes
6016 eval $setvar
6017
6018 : check for int64_t
6019 echo " "
6020 echo "Checking to see if you have int64_t..." >&4
6021 $cat >try.c <<EOCP
6022 #include <sys/types.h>
6023 #$i_inttypes I_INTTYPES
6024 #ifdef I_INTTYPES
6025 #include <inttypes.h>
6026 #endif
6027 int main() { int64_t x = 7; }
6028 EOCP
6029 set try
6030 if eval $compile; then
6031         val="$define"
6032         echo "You have int64_t."
6033 else
6034         val="$undef"
6035         echo "You do not have int64_t."
6036 fi
6037 $rm_try
6038 set d_int64_t
6039 eval $setvar
6040
6041 : Check if 64bit ints have a quad type
6042 echo " "
6043 echo "Checking which 64-bit integer type we could use..." >&4
6044
6045 case "$intsize" in
6046 8) val=int
6047    set quadtype
6048    eval $setvar
6049    val='"unsigned int"'
6050    set uquadtype
6051    eval $setvar
6052    quadkind=1
6053    ;;
6054 *) case "$longsize" in
6055    8) val=long
6056       set quadtype
6057       eval $setvar
6058       val='"unsigned long"'
6059       set uquadtype
6060       eval $setvar
6061       quadkind=2
6062       ;;
6063    *) case "$d_longlong:$longlongsize" in
6064       define:8)
6065         val='"long long"'
6066         set quadtype
6067         eval $setvar
6068         val='"unsigned long long"'
6069         set uquadtype
6070         eval $setvar
6071         quadkind=3
6072         ;;
6073       *) case "$d_int64_t" in
6074          define)
6075            val=int64_t
6076            set quadtype
6077            eval $setvar
6078            val=uint64_t
6079            set uquadtype
6080            eval $setvar
6081            quadkind=4
6082            ;;
6083          esac
6084          ;;
6085       esac
6086       ;;
6087    esac
6088    ;;
6089 esac
6090
6091 case "$quadtype" in
6092 '')     echo "Alas, no 64-bit integer types in sight." >&4
6093         d_quad="$undef"
6094         ;;
6095 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6096         d_quad="$define"
6097         ;;
6098 esac
6099
6100 : Do we want 64bit support
6101 case "$uselonglong" in
6102 "$define"|true|[yY]*)
6103         cat <<EOM >&4
6104
6105 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6106 EOM
6107         use64bitint="$define"
6108         ;;
6109 esac
6110 case "$use64bits" in
6111 "$define"|true|[yY]*)
6112         cat <<EOM >&4
6113
6114 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6115 EOM
6116         use64bitint="$define"
6117         ;;
6118 esac
6119 case "$use64bitints" in
6120 "$define"|true|[yY]*)
6121         cat <<EOM >&4
6122
6123 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6124 EOM
6125         use64bitint="$define"
6126         ;;
6127 esac
6128 case "$use64bitsint" in
6129 "$define"|true|[yY]*)
6130         cat <<EOM >&4
6131
6132 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6133 EOM
6134         use64bitint="$define"
6135         ;;
6136 esac
6137 case "$uselonglongs" in
6138 "$define"|true|[yY]*)
6139         cat <<EOM >&4
6140
6141 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6142 EOM
6143         use64bitint="$define"
6144         ;;
6145 esac
6146 case "$use64bitsall" in
6147 "$define"|true|[yY]*)
6148         cat <<EOM >&4
6149
6150 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6151 EOM
6152         use64bitall="$define"
6153         ;;
6154 esac
6155
6156 case "$ccflags" in
6157 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6158 esac
6159 case "$use64bitall" in
6160 "$define"|true|[yY]*) use64bitint="$define" ;;
6161 esac
6162
6163 case "$longsize" in
6164 8) cat <<EOM
6165
6166 You have natively 64-bit long integers.
6167 EOM
6168    val="$define"
6169    ;;
6170 *) case "$use64bitint" in
6171    "$define"|true|[yY]*) dflt='y';;
6172    *) dflt='n';;
6173    esac
6174    case "$d_quad" in
6175    "$define") ;;
6176    *) dflt='n' ;;
6177    esac
6178    cat <<EOM
6179
6180 Perl can be built to take advantage of 64-bit integer types
6181 on some systems.  To do so, Configure can be run with -Duse64bitint.
6182 Choosing this option will most probably introduce binary incompatibilities.
6183
6184 If this doesn't make any sense to you, just accept the default '$dflt'.
6185 (The default has been chosen based on your configuration.)
6186 EOM
6187    rp='Try to use 64-bit integers, if available?'
6188    . ./myread
6189    case "$ans" in
6190    [yY]*) val="$define" ;;
6191    *)     val="$undef"  ;;
6192    esac
6193    ;;
6194 esac
6195 set use64bitint
6196 eval $setvar
6197
6198 case "$use64bitall" in
6199 "$define"|true|[yY]*) dflt='y' ;;
6200 *) case "$longsize" in
6201    8) dflt='y' ;;
6202    *) dflt='n' ;;
6203    esac
6204    ;;
6205 esac
6206 cat <<EOM
6207
6208 You may also choose to try maximal 64-bitness.  It means using as much
6209 64-bitness as possible on the platform.  This in turn means even more
6210 binary incompatibilities.  On the other hand, your platform may not
6211 have any more 64-bitness available than what you already have chosen.
6212
6213 If this doesn't make any sense to you, just accept the default '$dflt'.
6214 (The default has been chosen based on your configuration.)
6215 EOM
6216 rp='Try to use maximal 64-bit support, if available?'
6217 . ./myread
6218 case "$ans" in
6219 [yY]*) val="$define" ;;
6220 *)     val="$undef"  ;;
6221 esac
6222 set use64bitall
6223 eval $setvar
6224 case "$use64bitall" in
6225 "$define")
6226         case "$use64bitint" in
6227         "$undef")
6228                 cat <<EOM
6229
6230 Since you have chosen a maximally 64-bit build, I'm also turning on
6231 the use of 64-bit integers.
6232 EOM
6233                 use64bitint="$define" ;;
6234         esac
6235         ;;
6236 esac
6237
6238 : Look for a hint-file generated 'call-back-unit'.  If the
6239 : user has specified that a 64-bit perl is to be built,
6240 : we may need to set or change some other defaults.
6241 if $test -f use64bitint.cbu; then
6242         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6243         . ./use64bitint.cbu
6244 fi
6245 case "$use64bitint" in
6246 "$define"|true|[yY]*)
6247         : This test was common to all the OpenBSD forks, and seems harmless for
6248         : other platforms:
6249         echo " "
6250         echo "Checking if your C library has broken 64-bit functions..." >&4
6251         cat >try.c <<EOCP
6252 #include <stdio.h>
6253 typedef $uquadtype myULL;
6254 int main (void)
6255 {
6256     struct {
6257         double d;
6258         myULL  u;
6259     } *p, test[] = {
6260         {4294967303.15, 4294967303ULL},
6261         {4294967294.2,  4294967294ULL},
6262         {4294967295.7,  4294967295ULL},
6263         {0.0, 0ULL}
6264     };
6265     for (p = test; p->u; p++) {
6266         myULL x = (myULL)p->d;
6267         if (x != p->u) {
6268             printf("buggy\n");
6269             return 0;
6270         }
6271     }
6272     printf("ok\n");
6273     return 0;
6274 }
6275 EOCP
6276         set try
6277         if eval $compile_ok; then
6278             libcquad=`$run ./try`
6279             echo "Your C library's 64-bit functions are $libcquad."
6280         else
6281             echo "(I can't seem to compile the test program.)"
6282             echo "Assuming that your C library's 64-bit functions are ok."
6283             libcquad="ok"
6284         fi
6285         $rm_try
6286
6287         case "$libcquad" in
6288             buggy*)
6289                 cat >&4 <<EOM
6290
6291 *** You have a C library with broken 64-bit functions.
6292 *** 64-bit support does not work reliably in this configuration.
6293 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6294 *** Cannot continue, aborting.
6295
6296 EOM
6297                 exit 1
6298                 ;;
6299         esac
6300         case "$longsize" in
6301         4) case "$archname64" in
6302            '') archname64=64int ;;
6303            esac
6304            ;;
6305         esac
6306         ;;
6307 esac
6308
6309 : Look for a hint-file generated 'call-back-unit'.  If the
6310 : user has specified that a maximally 64-bit perl is to be built,
6311 : we may need to set or change some other defaults.
6312 if $test -f use64bitall.cbu; then
6313         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6314         . ./use64bitall.cbu
6315 fi
6316 case "$use64bitall" in
6317 "$define"|true|[yY]*)
6318         case "$longsize" in
6319         4) case "$archname64" in
6320            ''|64int) archname64=64all ;;
6321            esac
6322            ;;
6323         esac
6324         ;;
6325 esac
6326
6327 case "$d_quad:$use64bitint" in
6328 $undef:$define)
6329         cat >&4 <<EOF
6330
6331 *** You have chosen to use 64-bit integers,
6332 *** but none can be found.
6333 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6334 *** Cannot continue, aborting.
6335
6336 EOF
6337         exit 1
6338         ;;
6339 esac
6340
6341 : Check if we are using the GNU C library
6342 echo " "
6343 echo "Checking for GNU C Library..." >&4
6344 cat >try.c <<'EOCP'
6345 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6346    alone are insufficient to distinguish different versions, such as
6347    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6348    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6349 */
6350 #include <stdio.h>
6351 int main(void)
6352 {
6353 #ifdef __GLIBC__
6354 #   ifdef __GLIBC_MINOR__
6355 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6356 #           include <gnu/libc-version.h>
6357             printf("%s\n",  gnu_get_libc_version());
6358 #       else
6359             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6360 #       endif
6361 #   else
6362         printf("%d\n",  __GLIBC__);
6363 #   endif
6364     return 0;
6365 #else
6366     return 1;
6367 #endif
6368 }
6369 EOCP
6370 set try
6371 if eval $compile_ok && $run ./try > glibc.ver; then
6372         val="$define"
6373         gnulibc_version=`$cat glibc.ver`
6374         echo "You are using the GNU C Library version $gnulibc_version"
6375 else
6376         val="$undef"
6377         gnulibc_version=''
6378         echo "You are not using the GNU C Library"
6379 fi
6380 $rm_try glibc.ver
6381 set d_gnulibc
6382 eval $setvar
6383
6384 : see if nm is to be used to determine whether a symbol is defined or not
6385 case "$usenm" in
6386 '')
6387         dflt=''
6388         case "$d_gnulibc" in
6389         "$define")
6390                 echo " "
6391                 echo "nm probably won't work on the GNU C Library." >&4
6392                 dflt=n
6393                 ;;
6394         esac
6395         case "$dflt" in
6396         '')
6397                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6398                         echo " "
6399                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6400                         echo "'nm' won't be sufficient on this system." >&4
6401                         dflt=n
6402                 fi
6403                 ;;
6404         esac
6405         case "$dflt" in
6406         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6407                 if $test $dflt -gt 20; then
6408                         dflt=y
6409                 else
6410                         dflt=n
6411                 fi
6412                 ;;
6413         esac
6414         ;;
6415 *)
6416         case "$usenm" in
6417         true|$define) dflt=y;;
6418         *) dflt=n;;
6419         esac
6420         ;;
6421 esac
6422 $cat <<EOM
6423
6424 I can use $nm to extract the symbols from your C libraries. This
6425 is a time consuming task which may generate huge output on the disk (up
6426 to 3 megabytes) but that should make the symbols extraction faster. The
6427 alternative is to skip the 'nm' extraction part and to compile a small
6428 test program instead to determine whether each symbol is present. If
6429 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6430 this may be the best solution.
6431
6432 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6433
6434 EOM
6435 rp="Shall I use $nm to extract C symbols from the libraries?"
6436 . ./myread
6437 case "$ans" in
6438 [Nn]*) usenm=false;;
6439 *) usenm=true;;
6440 esac
6441
6442 runnm=$usenm
6443 case "$reuseval" in
6444 true) runnm=false;;
6445 esac
6446
6447 : nm options which may be necessary
6448 case "$nm_opt" in
6449 '') if $test -f /mach_boot; then
6450                 nm_opt=''       # Mach
6451         elif $test -d /usr/ccs/lib; then
6452                 nm_opt='-p'     # Solaris (and SunOS?)
6453         elif $test -f /dgux; then
6454                 nm_opt='-p'     # DG-UX
6455         elif $test -f /lib64/rld; then
6456                 nm_opt='-p'     # 64-bit Irix
6457         else
6458                 nm_opt=''
6459         fi;;
6460 esac
6461
6462 : nm options which may be necessary for shared libraries but illegal
6463 : for archive libraries.  Thank you, Linux.
6464 case "$nm_so_opt" in
6465 '')     case "$myuname" in
6466         *linux*|gnu*)
6467                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6468                         nm_so_opt='--dynamic'
6469                 fi
6470                 ;;
6471         esac
6472         ;;
6473 esac
6474
6475 : Figure out where the libc is located
6476 case "$runnm" in
6477 true)
6478 : get list of predefined functions in a handy place
6479 echo " "
6480 case "$libc" in
6481 '') libc=unknown
6482         case "$libs" in
6483         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6484         esac
6485         ;;
6486 esac
6487 case "$libs" in
6488 '') ;;
6489 *)  for thislib in $libs; do
6490         case "$thislib" in
6491         -lc|-lc_s)
6492                 : Handle C library specially below.
6493                 ;;
6494         -l*)
6495                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6496                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6497                         :
6498                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6499                         :
6500                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6501                         :
6502                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6503                         :
6504                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6505                         :
6506                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6507                         :
6508                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6509                         :
6510                 else
6511                         try=''
6512                 fi
6513                 libnames="$libnames $try"
6514                 ;;
6515         *) libnames="$libnames $thislib" ;;
6516         esac
6517         done
6518         ;;
6519 esac
6520 xxx=normal
6521 case "$libc" in
6522 unknown)
6523         set /lib/libc.$so
6524         for xxx in $libpth; do
6525                 $test -r $1 || set $xxx/libc.$so
6526                 : The messy sed command sorts on library version numbers.
6527                 $test -r $1 || \
6528                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6529                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6530                                 h
6531                                 s/[0-9][0-9]*/0000&/g
6532                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6533                                 G
6534                                 s/\n/ /' | \
6535                          $sort | $sed -e 's/^.* //'`
6536                 eval set \$$#
6537         done
6538         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6539         $test -r $1 || set $sysroot/lib/libsys_s$_a
6540         ;;
6541 *)
6542         set blurfl
6543         ;;
6544 esac
6545 if $test -r "$1"; then
6546         echo "Your (shared) C library seems to be in $1."
6547         libc="$1"
6548 elif $test -r /lib/libc && $test -r /lib/clib; then
6549         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6550         xxx=apollo
6551         libc='/lib/clib /lib/libc'
6552         if $test -r /lib/syslib; then
6553                 echo "(Your math library is in /lib/syslib.)"
6554                 libc="$libc /lib/syslib"
6555         fi
6556 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6557         echo "Your C library seems to be in $libc, as you said before."
6558 elif $test -r $incpath/usr/lib/libc$_a; then
6559         libc=$incpath/usr/lib/libc$_a;
6560         echo "Your C library seems to be in $libc.  That's fine."
6561 elif $test -r /lib/libc$_a; then
6562         libc=/lib/libc$_a;
6563         echo "Your C library seems to be in $libc.  You're normal."
6564 else
6565         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6566                 :
6567         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6568                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6569         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6570                 :
6571         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6572                 :
6573         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6574                 :
6575         else
6576                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6577         fi
6578         if $test -r "$tans"; then
6579                 echo "Your C library seems to be in $tans, of all places."
6580                 libc=$tans
6581         else
6582                 libc='blurfl'
6583         fi
6584 fi
6585 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6586         dflt="$libc"
6587         cat <<EOM
6588
6589 If the guess above is wrong (which it might be if you're using a strange
6590 compiler, or your machine supports multiple models), you can override it here.
6591
6592 EOM
6593 else
6594         dflt=''
6595         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6596         cat >&4 <<EOM
6597 I can't seem to find your C library.  I've looked in the following places:
6598
6599 EOM
6600         $sed 's/^/      /' libpath
6601         cat <<EOM
6602
6603 None of these seems to contain your C library. I need to get its name...
6604
6605 EOM
6606 fi
6607 fn=f
6608 rp='Where is your C library?'
6609 . ./getfile
6610 libc="$ans"
6611
6612 echo " "
6613 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6614 set X `cat libnames`
6615 shift
6616 xxx=files
6617 case $# in 1) xxx=file; esac
6618 echo "Extracting names from the following $xxx for later perusal:" >&4
6619 echo " "
6620 $sed 's/^/      /' libnames >&4
6621 echo " "
6622 $echo $n "This may take a while...$c" >&4
6623
6624 for file in $*; do
6625         case $file in
6626         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6627         *) $nm $nm_opt $file 2>/dev/null;;
6628         esac
6629 done >libc.tmp
6630
6631 $echo $n ".$c"
6632 $grep fprintf libc.tmp > libc.ptf
6633 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6634 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6635 xxx='[ADTSIWi]'
6636 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6637         eval $xscan;\
6638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6639                 eval $xrun
6640 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6641         eval $xscan;\
6642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6643                 eval $xrun
6644 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6645         eval $xscan;\
6646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6647                 eval $xrun
6648 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6649         eval $xscan;\
6650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6651                 eval $xrun
6652 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6653         eval $xscan;\
6654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6655                 eval $xrun
6656 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6657         eval $xscan;\
6658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6659                 eval $xrun
6660 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6661                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6662         eval $xscan;\
6663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6664                 eval $xrun
6665 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6666         eval $xscan;\
6667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6668                 eval $xrun
6669 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6670         eval $xscan;\
6671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6672                 eval $xrun
6673 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6674         eval $xscan;\
6675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6676                 eval $xrun
6677 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6678         eval $xscan;\
6679         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6680                 eval $xrun
6681 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6682         eval $xscan;\
6683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6684                 eval $xrun
6685 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6686         eval $xscan;\
6687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6688                 eval $xrun
6689 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6690         eval $xscan;\
6691         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6692                 eval $xrun
6693 else
6694         $nm -p $* 2>/dev/null >libc.tmp
6695         $grep fprintf libc.tmp > libc.ptf
6696         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6697                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6698         then
6699                 nm_opt='-p'
6700                 eval $xrun
6701         else
6702                 echo " "
6703                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6704                 com=''
6705                 if $ar t $libc > libc.tmp && \
6706                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6707                 then
6708                         for thisname in $libnames $libc; do
6709                                 $ar t $thisname >>libc.tmp
6710                         done
6711                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6712                         echo "Ok." >&4
6713                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6714                         for thisname in $libnames $libc; do
6715                                 $ar tv $thisname >>libc.tmp
6716                                 emximp -o tmp.imp $thisname \
6717                                     2>/dev/null && \
6718                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6719                                     < tmp.imp >>libc.tmp
6720                                 $rm -f tmp.imp
6721                         done
6722                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6723                         echo "Ok." >&4
6724                 else
6725                         echo "$ar didn't seem to work right." >&4
6726                         echo "Maybe this is a Cray...trying bld instead..." >&4
6727                         if  bld t $libc | \
6728                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6729                                 $test -s libc.list
6730                         then
6731                                 for thisname in $libnames; do
6732                                         bld t $libnames | \
6733                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6734                                         $ar t $thisname >>libc.tmp
6735                                 done
6736                                 echo "Ok." >&4
6737                         else
6738                                 echo "That didn't work either.  Giving up." >&4
6739                                 exit 1
6740                         fi
6741                 fi
6742         fi
6743 fi
6744 nm_extract="$com"
6745 case "$PASE" in
6746 define)
6747     echo " "
6748     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6749     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6750     ;;
6751 *)  if $test -f /lib/syscalls.exp; then
6752         echo " "
6753         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6754         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6755                 /lib/syscalls.exp >>libc.list
6756     fi
6757     ;;
6758 esac
6759 ;;
6760 esac
6761 $rm -f libnames libpath
6762
6763 : Check if we are using C++
6764 echo " "
6765 echo "Checking for C++..." >&4
6766 $cat >try.c <<'EOCP'
6767 #include <stdio.h>
6768 int main(void)
6769 {
6770 #ifdef __cplusplus
6771     return 0;
6772 #else
6773     return 1;
6774 #endif
6775 }
6776 EOCP
6777 set try
6778 if eval $compile_ok && $run ./try; then
6779         val="$define"
6780         echo "You are using a C++ compiler."
6781 else
6782         val="$undef"
6783         echo "You are not using a C++ compiler."
6784 fi
6785 $rm_try cplusplus$$
6786 set d_cplusplus
6787 eval $setvar
6788
6789 : is a C symbol defined?
6790 csym='tlook=$1;
6791 case "$3" in
6792 -v) tf=libc.tmp; tdc="";;
6793 -a) tf=libc.tmp; tdc="[]";;
6794 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6795 esac;
6796 case "$d_cplusplus" in
6797     $define)    extern_C="extern \"C\"" ;;
6798     *)          extern_C="extern"       ;;
6799 esac;
6800 tx=yes;
6801 case "$reuseval-$4" in
6802 true-) ;;
6803 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6804 esac;
6805 case "$tx" in
6806 yes)
6807         tval=false;
6808         if $test "$runnm" = true; then
6809                 if $contains $tlook $tf >/dev/null 2>&1; then
6810                         tval=true;
6811                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6812                         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;
6813                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6814                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6815                         $rm_try;
6816                 fi;
6817         else
6818                 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;
6819                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6820                 $rm_try;
6821         fi;
6822         ;;
6823 *)
6824         case "$tval" in
6825         $define) tval=true;;
6826         *) tval=false;;
6827         esac;
6828         ;;
6829 esac;
6830 eval "$2=$tval"'
6831
6832 : define an is-in-libc? function
6833 inlibc='echo " "; td=$define; tu=$undef;
6834 sym=$1; var=$2; eval "was=\$$2";
6835 tx=yes;
6836 case "$reuseval$was" in
6837 true) ;;
6838 true*) tx=no;;
6839 esac;
6840 case "$tx" in
6841 yes)
6842         set $sym tres -f;
6843         eval $csym;
6844         case "$tres" in
6845         true)
6846                 echo "$sym() found." >&4;
6847                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6848         *)
6849                 echo "$sym() NOT found." >&4;
6850                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6851         esac;;
6852 *)
6853         case "$was" in
6854         $define) echo "$sym() found." >&4;;
6855         *) echo "$sym() NOT found." >&4;;
6856         esac;;
6857 esac'
6858
6859 : check for length of double
6860 echo " "
6861 case "$doublesize" in
6862 '')
6863         echo "Checking to see how big your double precision numbers are..." >&4
6864         $cat >try.c <<EOCP
6865 #include <stdio.h>
6866 #$i_stdlib I_STDLIB
6867 #ifdef I_STDLIB
6868 #include <stdlib.h>
6869 #endif
6870 int main()
6871 {
6872     printf("%d\n", (int)sizeof(double));
6873     exit(0);
6874 }
6875 EOCP
6876         set try
6877         if eval $compile_ok; then
6878                 doublesize=`$run ./try`
6879                 echo "Your double is $doublesize bytes long."
6880         else
6881                 dflt='8'
6882                 echo "(I can't seem to compile the test program.  Guessing...)"
6883                 rp="What is the size of a double precision number (in bytes)?"
6884                 . ./myread
6885                 doublesize="$ans"
6886         fi
6887         ;;
6888 esac
6889 $rm_try
6890
6891 : check for long doubles
6892 echo " "
6893 echo "Checking to see if you have long double..." >&4
6894 echo 'int main() { long double x = 7.0; }' > try.c
6895 set try
6896 if eval $compile; then
6897         val="$define"
6898         echo "You have long double."
6899 else
6900         val="$undef"
6901         echo "You do not have long double."
6902 fi
6903 $rm_try
6904 set d_longdbl
6905 eval $setvar
6906
6907 : see if ldexpl exists
6908 set ldexpl d_ldexpl
6909 eval $inlibc
6910
6911 : check for length of long double
6912 case "${d_longdbl}${longdblsize}" in
6913 $define)
6914         echo " "
6915         echo "Checking to see how big your long doubles are..." >&4
6916         $cat >try.c <<'EOCP'
6917 #include <stdio.h>
6918 int main()
6919 {
6920         printf("%d\n", sizeof(long double));
6921 }
6922 EOCP
6923         set try
6924         set try
6925         if eval $compile; then
6926                 longdblsize=`$run ./try`
6927                 echo "Your long doubles are $longdblsize bytes long."
6928         else
6929                 dflt='8'
6930                 echo " "
6931                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6932                 rp="What is the size of a long double (in bytes)?"
6933                 . ./myread
6934                 longdblsize="$ans"
6935         fi
6936         if $test "X$doublesize" = "X$longdblsize"; then
6937                 echo "That isn't any different from an ordinary double."
6938                 echo "I'll keep your setting anyway, but you may see some"
6939                 echo "harmless compilation warnings."
6940         fi
6941         ;;
6942 esac
6943 $rm_try
6944
6945 $echo "Checking the kind of long doubles you have..." >&4
6946 case "$d_longdbl" in
6947 define)
6948 $cat <<EOP >try.c
6949 #$i_stdlib I_STDLIB
6950 #define LONGDBLSIZE $longdblsize
6951 #define DOUBLESIZE $doublesize
6952 #include <float.h>
6953 #ifdef I_STDLIB
6954 #include <stdlib.h>
6955 #endif
6956 #include <stdio.h>
6957 static const long double d = -0.1L;
6958 int main() {
6959   unsigned const char* b = (unsigned const char*)(&d);
6960 #if DOUBLESIZE == LONGDBLSIZE
6961   printf("0\n"); /* if it floats like double */
6962   exit(0);
6963 #endif
6964 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6965   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6966     /* IEEE 754 128-bit little-endian */
6967     printf("1\n");
6968     exit(0);
6969   }
6970   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6971     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6972     printf("2\n");
6973     exit(0);
6974   }
6975 #endif
6976 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6977  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6978  * cannot be trusted. */
6979 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6980   if (b[0] == 0xCD && b[9] == 0xBF) {
6981     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6982      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6983      * Also known as "extended precision". */
6984     printf("3\n");
6985     exit(0);
6986   }
6987   if (b[0] == 0xBF && b[9] == 0xCD) {
6988     /* Is there ever big-endian 80-bit, really?
6989      *
6990      * The Motorola 68881 had another "extended precision" format:
6991      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6992      * for total of 96 bits of bytes.  The zero bits were unused.
6993      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
6994      * If it ever becomes relevant, this format should be allocated
6995      * a new doublekind code since it's quite different from the Intel x87.
6996      */
6997     printf("4\n");
6998     exit(0);
6999   }
7000 #endif
7001 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7002   /* software "double double", the 106 is 53+53.
7003    * but irix thinks it is 107. */
7004   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7005     /* double double 128-bit fully little-endian,
7006      * little-endian doubles in little-endian order,
7007      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7008     printf("5\n");
7009     exit(0);
7010   }
7011   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7012     /* double double 128-bit fully big-endian,
7013      * big-endian doubles in big-endian order,
7014      * e.g. PPC/Power and MIPS:
7015      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7016     printf("6\n");
7017     exit(0);
7018   }
7019   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7020     /* double double 128-bit mixed endian.
7021      * little-endian doubles in big-endian order,
7022      * e.g. ppc64el,
7023      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7024     printf("7\n");
7025     exit(0);
7026   }
7027   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7028     /* double double 128-bit mixed endian,
7029      * big-endian doubles in little-endian order,
7030      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7031     printf("8\n");
7032     exit(0);
7033   }
7034 #endif
7035 /* We are largely making this up because it may well be
7036  * that the VAX format H was never made available to C,
7037  * only to Fortran. */
7038 #if LONGDBLSIZE == 16 && defined(__vax__)
7039   if (b[0] == 0xFD && b[15] == 0x99) {
7040     /* VAX format H, PDP-11 mixed endian. */
7041     printf("9\n");
7042     exit(0);
7043   }
7044 #endif
7045   printf("-1\n"); /* unknown */
7046   exit(0);
7047 }
7048 EOP
7049 set try
7050 if eval $compile; then
7051     longdblkind=`$run ./try`
7052 else
7053     longdblkind=-1
7054 fi
7055 ;;
7056 *) longdblkind=0 ;;
7057 esac
7058 case "$longdblkind" in
7059 0) echo "Your long doubles are doubles." >&4 ;;
7060 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7061 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7062 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7063 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7064 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7065 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7066 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7067 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7068 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7069 *) echo "Cannot figure out your long double." >&4 ;;
7070 esac
7071 d_long_double_style_ieee=$undef
7072 d_long_double_style_ieee_std=$undef
7073 d_long_double_style_ieee_extended=$undef
7074 d_long_double_style_ieee_doubledouble=$undef
7075 d_long_double_style_vax=$undef
7076 case "$longdblkind" in
7077 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7078 esac
7079 case "$longdblkind" in
7080 1|2) d_long_double_style_ieee_std=$define ;;
7081 esac
7082 case "$longdblkind" in
7083 3|4) d_long_double_style_ieee_extended=$define ;;
7084 esac
7085 case "$longdblkind" in
7086 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7087 esac
7088 case "$longdblkind" in
7089 9) d_long_double_style_vax=$define ;;
7090 esac
7091 $rm_try
7092
7093 : determine the architecture name
7094 echo " "
7095 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7096         tarch=`arch`"-$osname"
7097 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7098         if uname -m > tmparch 2>&1 ; then
7099                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7100                         -e 's/$/'"-$osname/" tmparch`
7101         else
7102                 tarch="$osname"
7103         fi
7104         $rm -f tmparch
7105 else
7106         tarch="$osname"
7107 fi
7108 case "$myarchname" in
7109 ''|"$tarch") ;;
7110 *)
7111         echo "(Your architecture name used to be $myarchname.)"
7112         archname=''
7113         ;;
7114 esac
7115 case "$targetarch" in
7116 '') ;;
7117 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7118 esac
7119 myarchname="$tarch"
7120 case "$archname" in
7121 '') dflt="$tarch";;
7122 *) dflt="$archname";;
7123 esac
7124 rp='What is your architecture name'
7125 . ./myread
7126 archname="$ans"
7127
7128 : optionally add API version to the architecture for versioned archlibs
7129 case "$useversionedarchname" in
7130 $define|true|[yY]*) dflt='y';;
7131 *)                  dflt='n';;
7132 esac
7133 rp='Add the Perl API version to your archname?'
7134 . ./myread
7135 case "$ans" in
7136 y|Y)    useversionedarchname="$define" ;;
7137 *)      useversionedarchname="$undef" ;;
7138 esac
7139 case "$useversionedarchname" in
7140 $define)
7141         case "$archname" in
7142         *-$api_versionstring)
7143                 echo "...and architecture name already has -$api_versionstring" >&4
7144                 ;;
7145         *)
7146                 archname="$archname-$api_versionstring"
7147                 echo "...setting architecture name to $archname." >&4
7148                 ;;
7149         esac
7150         ;;
7151 esac
7152
7153 case "$usethreads" in
7154 $define)
7155         echo "Threads selected." >&4
7156         case "$archname" in
7157         *-thread*) echo "...and architecture name already has -thread." >&4
7158                 ;;
7159         *)      archname="$archname-thread"
7160                 echo "...setting architecture name to $archname." >&4
7161                 ;;
7162         esac
7163         ;;
7164 esac
7165 case "$usemultiplicity" in
7166 $define)
7167         echo "Multiplicity selected." >&4
7168         case "$archname" in
7169         *-multi*) echo "...and architecture name already has -multi." >&4
7170                 ;;
7171         *)      archname="$archname-multi"
7172                 echo "...setting architecture name to $archname." >&4
7173                 ;;
7174         esac
7175         ;;
7176 esac
7177 case "$use64bitint$use64bitall" in
7178 *"$define"*)
7179         case "$archname64" in
7180         '')
7181                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7182                 ;;
7183         *)
7184                 case "$use64bitint" in
7185                 "$define") echo "64 bit integers selected." >&4 ;;
7186                 esac
7187                 case "$use64bitall" in
7188                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7189                 esac
7190                 case "$archname" in
7191                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7192                         ;;
7193                 *)      archname="$archname-$archname64"
7194                         echo "...setting architecture name to $archname." >&4
7195                         ;;
7196                 esac
7197                 ;;
7198         esac
7199 esac
7200 case "$uselongdouble" in
7201 $define)
7202         echo "Long doubles selected." >&4
7203         case "$longdblsize" in
7204         $doublesize)
7205                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7206                 ;;
7207         *)
7208                 case "$archname" in
7209                 *-ld*) echo "...and architecture name already has -ld." >&4
7210                         ;;
7211                 *)      archname="$archname-ld"
7212                         echo "...setting architecture name to $archname." >&4
7213                         ;;
7214                 esac
7215                 ;;
7216         esac
7217         ;;
7218 esac
7219 case "$usequadmath" in
7220 $define)
7221         echo "quadmath selected." >&4
7222         case "$archname" in
7223         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7224                 ;;
7225         *)      archname="$archname-quadmath"
7226                 echo "...setting architecture name to $archname." >&4
7227                 ;;
7228         esac
7229         ;;
7230 esac
7231 if $test -f archname.cbu; then
7232         echo "Your platform has some specific hints for architecture name, using them..."
7233         . ./archname.cbu
7234 fi
7235
7236 : set the prefixit variable, to compute a suitable default value
7237 prefixit='case "$3" in
7238 ""|none)
7239         case "$oldprefix" in
7240         "") eval "$1=\"\$$2\"";;
7241         *)
7242                 case "$3" in
7243                 "") eval "$1=";;
7244                 none)
7245                         eval "tp=\"\$$2\"";
7246                         case "$tp" in
7247                         ""|" ") eval "$1=\"\$$2\"";;
7248                         *) eval "$1=";;
7249                         esac;;
7250                 esac;;
7251         esac;;
7252 *)
7253         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7254         case "$tp" in
7255         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7256         /*-$oldprefix/*|\~*-$oldprefix/*)
7257                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7258         *) eval "$1=\"\$$2\"";;
7259         esac;;
7260 esac'
7261
7262 : determine installation style
7263 : For now, try to deduce it from prefix unless it is already set.
7264 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7265 case "$installstyle" in
7266 '')     case "$prefix" in
7267                 *perl*) dflt='lib';;
7268                 *) dflt='lib/perl5' ;;
7269         esac
7270         ;;
7271 *)      dflt="$installstyle" ;;
7272 esac
7273 : Probably not worth prompting for this since we prompt for all
7274 : the directories individually, and the prompt would be too long and
7275 : confusing anyway.
7276 installstyle=$dflt
7277
7278 : determine where public executables go
7279 echo " "
7280 set dflt bin bin
7281 eval $prefixit
7282 fn=d~
7283 rp='Pathname where the public executables will reside?'
7284 . ./getfile
7285 if $test "X$ansexp" != "X$binexp"; then
7286         installbin=''
7287 fi
7288 prefixvar=bin
7289 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7290 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7291 :     this via initialinstalllocation
7292 . ./setprefixvar
7293
7294 case "$userelocatableinc" in
7295 $define|true|[yY]*)     dflt='y' ;;
7296 *)                      dflt='n' ;;
7297 esac
7298 cat <<EOM
7299
7300 Would you like to build Perl so that the installation is relocatable, so that
7301 library paths in @INC are determined relative to the path of the perl binary?
7302 This is not advised for system Perl installs, or if you need to run setid
7303 scripts or scripts under taint mode.
7304
7305 If this doesn't make any sense to you, just accept the default '$dflt'.
7306 EOM
7307 rp='Use relocatable @INC?'
7308 . ./myread
7309 case "$ans" in
7310 y|Y)    val="$define" ;;
7311 *)      val="$undef"  ;;
7312 esac
7313 set userelocatableinc
7314 eval $setvar
7315
7316 initialinstalllocation="$binexp"
7317 : Default prefix is now "up one level from where the binaries are"
7318 case "$userelocatableinc" in
7319 $define|true|[yY]*)
7320     bin=".../"
7321     binexp=".../"
7322     prefix=".../.."
7323     prefixexp=".../.."
7324     installprefixexp=".../.."
7325     ;;
7326 esac
7327
7328 : determine where private library files go
7329 : Usual default is /usr/local/lib/perl5/$version.
7330 : Also allow things like /opt/perl/lib/$version, since
7331 : /opt/perl/lib/perl5... would be redundant.
7332 : The default "style" setting is made in installstyle.U
7333 case "$installstyle" in
7334 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7335 *)       set dflt privlib lib/$version ;;
7336 esac
7337 eval $prefixit
7338 $cat <<EOM
7339
7340 There are some auxiliary files for $package that need to be put into a
7341 private library directory that is accessible by everyone.
7342
7343 EOM
7344 fn=$binexp
7345 fn=d~+
7346 rp='Pathname where the private library files will reside?'
7347 . ./getfile
7348 prefixvar=privlib
7349 . ./setprefixvar
7350
7351 : set the prefixup variable, to restore leading tilda escape
7352 prefixup='case "$prefixexp" in
7353 "$prefix") ;;
7354 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7355 esac'
7356
7357 : determine where public architecture dependent libraries go
7358 set archlib archlib
7359 eval $prefixit
7360 : privlib default is /usr/local/lib/$package/$version
7361 : archlib default is /usr/local/lib/$package/$version/$archname
7362 : privlib may have an optional trailing /share.
7363 tdflt=`echo $privlib | $sed 's,/share$,,'`
7364 tdflt=$tdflt/$archname
7365 case "$archlib" in
7366 '')     dflt=$tdflt
7367         ;;
7368 *)      dflt="$archlib"
7369     ;;
7370 esac
7371 $cat <<EOM
7372
7373 $spackage contains architecture-dependent library files.  If you are
7374 sharing libraries in a heterogeneous environment, you might store
7375 these files in a separate location.  Otherwise, you can just include
7376 them with the rest of the public library files.
7377
7378 EOM
7379 fn=$binexp
7380 fn=d+~
7381 rp='Where do you want to put the public architecture-dependent libraries?'
7382 . ./getfile
7383 prefixvar=archlib
7384 . ./setprefixvar
7385 if $test X"$archlib" = X"$privlib"; then
7386         d_archlib="$undef"
7387 else
7388         d_archlib="$define"
7389 fi
7390
7391 : see if setuid scripts can be secure
7392 $cat <<EOM
7393
7394 Some kernels have a bug that prevents setuid #! scripts from being
7395 secure.  Some sites have disabled setuid #! scripts because of this.
7396
7397 First let's decide if your kernel supports secure setuid #! scripts.
7398 (If setuid #! scripts would be secure but have been disabled anyway,
7399 don't say that they are secure if asked.)
7400
7401 EOM
7402
7403 val="$undef"
7404 if $test -d /dev/fd; then
7405         echo "#!$ls" >reflect
7406         chmod +x,u+s reflect
7407         ./reflect >flect 2>&1
7408         if $contains "/dev/fd" flect >/dev/null; then
7409                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7410                 val="$define"
7411         else
7412                 $cat <<EOM
7413 If you are not sure if they are secure, I can check but I'll need a
7414 username and password different from the one you are using right now.
7415 If you don't have such a username or don't want me to test, simply
7416 enter 'none'.
7417
7418 EOM
7419                 rp='Other username to test security of setuid scripts with?'
7420                 dflt='none'
7421                 . ./myread
7422                 case "$ans" in
7423                 n|none)
7424                         case "$d_suidsafe" in
7425                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7426                                 dflt=n;;
7427                         "$undef")
7428                                 echo "Well, the $hint value is *not* secure." >&4
7429                                 dflt=n;;
7430                         *)      echo "Well, the $hint value *is* secure." >&4
7431                                 dflt=y;;
7432                         esac
7433                         ;;
7434                 *)
7435                         $rm -f reflect flect
7436                         echo "#!$ls" >reflect
7437                         chmod +x,u+s reflect
7438                         echo >flect
7439                         chmod a+w flect
7440                         echo '"su" will (probably) prompt you for '"$ans's password."
7441                         su $ans -c './reflect >flect'
7442                         if $contains "/dev/fd" flect >/dev/null; then
7443                                 echo "Okay, it looks like setuid scripts are secure." >&4
7444                                 dflt=y
7445                         else
7446                                 echo "I don't think setuid scripts are secure." >&4
7447                                 dflt=n
7448                         fi
7449                         ;;
7450                 esac
7451                 rp='Does your kernel have *secure* setuid scripts?'
7452                 . ./myread
7453                 case "$ans" in
7454                 [yY]*)  val="$define";;
7455                 *)      val="$undef";;
7456                 esac
7457         fi
7458 else
7459         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7460         echo "(That's for file descriptors, not floppy disks.)"
7461         val="$undef"
7462 fi
7463 set d_suidsafe
7464 eval $setvar
7465
7466 $rm -f reflect flect
7467
7468 : now see if they want to do setuid emulation
7469 if $test $patchlevel -lt 11; then
7470 echo " "
7471 val="$undef"
7472 case "$d_suidsafe" in
7473 "$define")
7474         val="$undef"
7475         echo "No need to emulate SUID scripts since they are secure here." >&4
7476         ;;
7477 *)
7478         $cat <<EOM
7479 Some systems have disabled setuid scripts, especially systems where
7480 setuid scripts cannot be secure.  On systems where setuid scripts have
7481 been disabled, the setuid/setgid bits on scripts are currently
7482 useless.  It is possible for $package to detect those bits and emulate
7483 setuid/setgid in a secure fashion.  This emulation will only work if
7484 setuid scripts have been disabled in your kernel.
7485
7486 EOM
7487         case "$d_dosuid" in
7488         "$define") dflt=y ;;
7489         *) dflt=n ;;
7490         esac
7491         rp="Do you want to do setuid/setgid emulation?"
7492         . ./myread
7493         case "$ans" in
7494         [yY]*)  val="$define";;
7495         *)      val="$undef";;
7496         esac
7497         ;;
7498 esac
7499 set d_dosuid
7500 eval $setvar
7501 else
7502     case "$d_dosuid" in
7503         "$define")
7504         cat >&4 <<EOH
7505
7506 SUID emulation has been removed for 5.12
7507 Please re-run Configure without -Dd_dosuid
7508
7509 EOH
7510         exit 1;
7511         ;;
7512     esac
7513     d_dosuid=undef
7514 fi
7515
7516 : Find perl5.005 or later.
7517 echo "Looking for a previously installed perl5.005 or later... "
7518 case "$perl5" in
7519 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7520                 : Check if this perl is recent and can load a simple module
7521                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7522                         perl5=$tdir/perl
7523                         break;
7524                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7525                         perl5=$tdir/perl5
7526                         break;
7527                 fi
7528         done
7529         ;;
7530 *)      perl5="$perl5"
7531         ;;
7532 esac
7533 case "$perl5" in
7534 '')     echo "None found.  That's ok.";;
7535 *)      echo "Using $perl5." ;;
7536 esac
7537
7538 : Set the siteprefix variables
7539 $cat <<EOM
7540
7541 After $package is installed, you may wish to install various
7542 add-on modules and utilities.  Typically, these add-ons will
7543 be installed under $prefix with the rest
7544 of this package.  However, you may wish to install such add-ons
7545 elsewhere under a different prefix.
7546
7547 If you do not wish to put everything under a single prefix, that's
7548 ok.  You will be prompted for the individual locations; this siteprefix
7549 is only used to suggest the defaults.
7550
7551 The default should be fine for most people.
7552
7553 EOM
7554 fn=d~+
7555 rp='Installation prefix to use for add-on modules and utilities?'
7556 : XXX Here might be another good place for an installstyle setting.
7557 case "$siteprefix" in
7558 '') dflt=$prefix ;;
7559 *)  dflt=$siteprefix ;;
7560 esac
7561 . ./getfile
7562 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7563 oldsiteprefix=''
7564 case "$siteprefix" in
7565 '') ;;
7566 *)      case "$ans" in
7567         "$prefix") ;;
7568         *) oldsiteprefix="$prefix";;
7569         esac
7570         ;;
7571 esac
7572 siteprefix="$ans"
7573 siteprefixexp="$ansexp"
7574
7575 : determine where site specific libraries go.
7576 : Usual default is /usr/local/lib/perl5/site_perl/$version
7577 : The default "style" setting is made in installstyle.U
7578 : XXX No longer works with Prefixit stuff.
7579 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7580 case "$sitelib" in
7581 '') case "$installstyle" in
7582         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7583         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7584         esac
7585         ;;
7586 *)      dflt="$sitelib"
7587         ;;
7588 esac
7589 $cat <<EOM
7590
7591 The installation process will create a directory for
7592 site-specific extensions and modules.  Most users find it convenient
7593 to place all site-specific files in this directory rather than in the
7594 main distribution directory.
7595
7596 EOM
7597 fn=d~+
7598 rp='Pathname for the site-specific library files?'
7599 . ./getfile
7600 prefixvar=sitelib
7601 . ./setprefixvar
7602 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7603
7604 : Determine list of previous versions to include in @INC
7605 $cat > getverlist <<EOPL
7606 #!$perl5 -w
7607 use File::Basename;
7608 \$api_versionstring = "$api_versionstring";
7609 \$version = "$version";
7610 \$stem = "$sitelib_stem";
7611 \$archname = "$archname";
7612 EOPL
7613         $cat >> getverlist <<'EOPL'
7614 # The list found is store twice for each entry: the original name, and
7615 # the binary broken down version as pack "sss", so sorting is easy and
7616 # unambiguous. This will work for all versions that have a maximum of
7617 # three digit groups, separate by '.'s or '_'s. Names are extended with
7618 # ".0.0" to ensure at least three elements for the pack.
7619 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7620
7621 # Can't have leading @ because metaconfig interprets it as a command!
7622 ;@inc_version_list=();
7623 # XXX Redo to do opendir/readdir?
7624 if (-d $stem) {
7625     chdir($stem);
7626     ;@candidates = map {
7627         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7628     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7629 }
7630 else {
7631     ;@candidates = ();
7632 }
7633
7634 ($pversion, $aversion, $vsn5005) = map {
7635     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7636 foreach $d (@candidates) {
7637     if ($d->[1] lt $pversion) {
7638         if ($d->[1] ge $aversion) {
7639             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7640         }
7641         elsif ($d->[1] ge $vsn5005) {
7642             unshift(@inc_version_list, grep { -d } $d->[0]);
7643         }
7644     }
7645     else {
7646         # Skip newer version.  I.e. don't look in
7647         # 5.7.0 if we're installing 5.6.1.
7648     }
7649 }
7650
7651 if (@inc_version_list) {
7652     print join(' ', @inc_version_list);
7653 }
7654 else {
7655     # Blank space to preserve value for next Configure run.
7656     print " ";
7657 }
7658 EOPL
7659 chmod +x getverlist
7660 case "$inc_version_list" in
7661 '')     if test -x "$perl5$exe_ext"; then
7662                 dflt=`$perl5 getverlist`
7663         else
7664                 dflt='none'
7665         fi
7666         ;;
7667 $undef) dflt='none' ;;
7668 *)  eval dflt=\"$inc_version_list\" ;;
7669 esac
7670 case "$dflt" in
7671 ''|' ') dflt=none ;;
7672 esac
7673 case "$dflt" in
7674 5.005) dflt=none ;;
7675 esac
7676 $cat <<EOM
7677
7678 In order to ease the process of upgrading, this version of perl
7679 can be configured to use modules built and installed with earlier
7680 versions of perl that were installed under $prefix.  Specify here
7681 the list of earlier versions that this version of perl should check.
7682 If Configure detected no earlier versions of perl installed under
7683 $prefix, then the list will be empty.  Answer 'none' to tell perl
7684 to not search earlier versions.
7685
7686 The default should almost always be sensible, so if you're not sure,
7687 just accept the default.
7688 EOM
7689
7690 rp='List of earlier versions to include in @INC?'
7691 . ./myread
7692 case "$ans" in
7693 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7694 *) inc_version_list="$ans" ;;
7695 esac
7696 case "$inc_version_list" in
7697 ''|' ')
7698         inc_version_list_init='0'
7699         d_inc_version_list="$undef"
7700         ;;
7701 *)      inc_version_list_init=`echo $inc_version_list |
7702                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7703         d_inc_version_list="$define"
7704         ;;
7705 esac
7706 $rm -f getverlist
7707
7708 : see if malloc/malloc.h has to be included
7709 set malloc/malloc.h i_mallocmalloc
7710 eval $inhdr
7711
7712 : see if this is a malloc.h system
7713 : we want a real compile instead of Inhdr because some systems have a
7714 : malloc.h that just gives a compile error saying to use stdlib.h instead
7715 echo " "
7716 $cat >try.c <<EOCP
7717 #include <stdlib.h>
7718 #include <malloc.h>
7719 #$i_mallocmalloc I_MALLOCMALLOC
7720 #ifdef I_MALLOCMALLOC
7721 # include <malloc/malloc.h>
7722 #endif
7723
7724 int main () { return 0; }
7725 EOCP
7726 set try
7727 if eval $compile; then
7728     echo "<malloc.h> found." >&4
7729     val="$define"
7730 else
7731     echo "<malloc.h> NOT found." >&4
7732     val="$undef"
7733 fi
7734 $rm_try
7735 set i_malloc
7736 eval $setvar
7737
7738 : check for length of pointer
7739 echo " "
7740 case "$ptrsize" in
7741 '')
7742         echo "Checking to see how big your pointers are..." >&4
7743         $cat >try.c <<EOCP
7744 #include <stdio.h>
7745 #$i_stdlib I_STDLIB
7746 #ifdef I_STDLIB
7747 #include <stdlib.h>
7748 #endif
7749 int main()
7750 {
7751     printf("%d\n", (int)sizeof(void *));
7752     exit(0);
7753 }
7754 EOCP
7755         set try
7756         if eval $compile_ok; then
7757                 ptrsize=`$run ./try`
7758                 echo "Your pointers are $ptrsize bytes long."
7759         else
7760                 dflt='4'
7761                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7762                 rp="What is the size of a pointer (in bytes)?"
7763                 . ./myread
7764                 ptrsize="$ans"
7765         fi
7766         ;;
7767 esac
7768 $rm_try
7769 case "$use64bitall" in
7770 "$define"|true|[yY]*)
7771         case "$ptrsize" in
7772         4)      cat <<EOM >&4
7773
7774 *** You have chosen a maximally 64-bit build,
7775 *** but your pointers are only 4 bytes wide.
7776 *** Please rerun Configure without -Duse64bitall.
7777 EOM
7778                 case "$d_quad" in
7779                 define)
7780                         cat <<EOM >&4
7781 *** Since you have quads, you could possibly try with -Duse64bitint.
7782 EOM
7783                         ;;
7784                 esac
7785                 cat <<EOM >&4
7786 *** Cannot continue, aborting.
7787
7788 EOM
7789
7790                 exit 1
7791                 ;;
7792         esac
7793         ;;
7794 esac
7795
7796
7797 : determine whether to use malloc wrapping
7798 echo " "
7799 case "$usemallocwrap" in
7800 [yY]*|true|$define)     dflt='y' ;;
7801 [nN]*|false|$undef)     dflt='n' ;;
7802 *)      case "$usedevel" in
7803         [yY]*|true|$define)     dflt='y' ;;
7804         *) dflt='n' ;;
7805         esac
7806         ;;
7807 esac
7808 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7809 . ./myread
7810 usemallocwrap="$ans"
7811 case "$ans" in
7812 y*|true)
7813         usemallocwrap="$define" ;;
7814 *)
7815         usemallocwrap="$undef" ;;
7816 esac
7817
7818 : determine which malloc to compile in
7819 echo " "
7820 case "$usemymalloc" in
7821 [yY]*|true|$define)     dflt='y' ;;
7822 [nN]*|false|$undef)     dflt='n' ;;
7823 *)      case "$ptrsize" in
7824         4) dflt='y' ;;
7825         *) dflt='n' ;;
7826         esac
7827         if test "$useithreads" = "$define"; then dflt='n'; fi
7828         ;;
7829 esac
7830 rp="Do you wish to attempt to use the malloc that comes with $package?"
7831 . ./myread
7832 usemymalloc="$ans"
7833 case "$ans" in
7834 y*|true)
7835         usemymalloc='y'
7836         mallocsrc='malloc.c'
7837         mallocobj="malloc$_o"
7838         d_mymalloc="$define"
7839         case "$libs" in
7840         *-lmalloc*)
7841                 : Remove malloc from list of libraries to use
7842                 echo "Removing unneeded -lmalloc from library list" >&4
7843                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7844                 shift
7845                 libs="$*"
7846                 echo "libs = $libs" >&4
7847                 ;;
7848         esac
7849         ;;
7850 *)
7851         usemymalloc='n'
7852         mallocsrc=''
7853         mallocobj=''
7854         d_mymalloc="$undef"
7855         ;;
7856 esac
7857
7858 : compute the return types of malloc and free
7859 echo " "
7860 $cat >malloc.c <<END
7861 #$i_malloc I_MALLOC
7862 #$i_stdlib I_STDLIB
7863 #include <stdio.h>
7864 #include <sys/types.h>
7865 #ifdef I_MALLOC
7866 #include <malloc.h>
7867 #endif
7868 #ifdef I_STDLIB
7869 #include <stdlib.h>
7870 #endif
7871 #ifdef TRY_MALLOC
7872 void *malloc();
7873 #endif
7874 #ifdef TRY_FREE
7875 void free();
7876 #endif
7877 END
7878 case "$malloctype" in
7879 '')
7880         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7881                 malloctype='void *'
7882         else
7883                 malloctype='char *'
7884         fi
7885         ;;
7886 esac
7887 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7888
7889 case "$freetype" in
7890 '')
7891         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7892                 freetype='void'
7893         else
7894                 freetype='int'
7895         fi
7896         ;;
7897 esac
7898 echo "Your system uses $freetype free(), it would seem." >&4
7899 $rm -f malloc.[co]
7900 : determine where site specific architecture-dependent libraries go.
7901 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7902 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7903 : sitelib may have an optional trailing /share.
7904 case "$sitearch" in
7905 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7906         dflt="$dflt/$archname"
7907         ;;
7908 *)      dflt="$sitearch"
7909         ;;
7910 esac
7911 set sitearch sitearch none
7912 eval $prefixit
7913 $cat <<EOM
7914
7915 The installation process will also create a directory for
7916 architecture-dependent site-specific extensions and modules.
7917
7918 EOM
7919 fn=d~+
7920 rp='Pathname for the site-specific architecture-dependent library files?'
7921 . ./getfile
7922 prefixvar=sitearch
7923 . ./setprefixvar
7924 if $test X"$sitearch" = X"$sitelib"; then
7925         d_sitearch="$undef"
7926 else
7927         d_sitearch="$define"
7928 fi
7929
7930 : Set the vendorprefix variables
7931 $cat <<EOM
7932
7933 The installation process will also create a directory for
7934 vendor-supplied add-ons.  Vendors who supply perl with their system
7935 may find it convenient to place all vendor-supplied files in this
7936 directory rather than in the main distribution directory.  This will
7937 ease upgrades between binary-compatible maintenance versions of perl.
7938
7939 Of course you may also use these directories in whatever way you see
7940 fit.  For example, you might use them to access modules shared over a
7941 company-wide network.
7942
7943 The default answer should be fine for most people.
7944 This causes further questions about vendor add-ons to be skipped
7945 and no vendor-specific directories will be configured for perl.
7946
7947 EOM
7948 rp='Do you want to configure vendor-specific add-on directories?'
7949 case "$usevendorprefix" in
7950 define|true|[yY]*) dflt=y ;;
7951 *)      : User may have set vendorprefix directly on Configure command line.
7952         case "$vendorprefix" in
7953         ''|' ') dflt=n ;;
7954         *)      dflt=y ;;
7955         esac
7956         ;;
7957 esac
7958 . ./myread
7959 case "$ans" in
7960 [yY]*)  fn=d~+
7961         rp='Installation prefix to use for vendor-supplied add-ons?'
7962         case "$vendorprefix" in
7963         '') dflt="$prefix" ;;
7964         *)  dflt=$vendorprefix ;;
7965         esac
7966         . ./getfile
7967         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7968         oldvendorprefix=''
7969         case "$vendorprefix" in
7970         '') ;;
7971         *)      case "$ans" in
7972                 "$prefix") ;;
7973                 *) oldvendorprefix="$prefix";;
7974                 esac
7975                 ;;
7976         esac
7977         usevendorprefix="$define"
7978         vendorprefix="$ans"
7979         vendorprefixexp="$ansexp"
7980         ;;
7981 *)      usevendorprefix="$undef"
7982         vendorprefix=''
7983         vendorprefixexp=''
7984         ;;
7985 esac
7986
7987 : Set the vendorlib variables
7988 case "$vendorprefix" in
7989 '')     d_vendorlib="$undef"
7990         vendorlib=''
7991         vendorlibexp=''
7992         ;;
7993 *)      d_vendorlib="$define"
7994         : determine where vendor-supplied modules go.
7995         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7996         case "$vendorlib" in
7997         '')
7998                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7999                 case "$installstyle" in
8000                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8001                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8002                 esac
8003                 ;;
8004         *)      dflt="$vendorlib"
8005                 ;;
8006         esac
8007         fn=d~+
8008         rp='Pathname for the vendor-supplied library files?'
8009         . ./getfile
8010         vendorlib="$ans"
8011         vendorlibexp="$ansexp"
8012         ;;
8013 esac
8014 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8015 prefixvar=vendorlib
8016 . ./installprefix
8017
8018 : Set the vendorarch variables
8019 case "$vendorprefix" in
8020 '')     d_vendorarch="$undef"
8021         vendorarch=''
8022         vendorarchexp=''
8023         ;;
8024 *)      d_vendorarch="$define"
8025         : determine where vendor-supplied architecture-dependent libraries go.
8026         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8027         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8028         : vendorlib may have an optional trailing /share.
8029         case "$vendorarch" in
8030         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8031                 dflt="$dflt/$archname"
8032                 ;;
8033         *)      dflt="$vendorarch" ;;
8034         esac
8035         fn=d~+
8036         rp='Pathname for vendor-supplied architecture-dependent files?'
8037         . ./getfile
8038         vendorarch="$ans"
8039         vendorarchexp="$ansexp"
8040         ;;
8041 esac
8042 prefixvar=vendorarch
8043 . ./installprefix
8044 if $test X"$vendorarch" = X"$vendorlib"; then
8045         d_vendorarch="$undef"
8046 else
8047         d_vendorarch="$define"
8048 fi
8049
8050 : Final catch-all directories to search
8051 $cat <<EOM
8052
8053 Lastly, you can have perl look in other directories for extensions and
8054 modules in addition to those already specified.
8055 These directories will be searched after
8056         $sitearch
8057         $sitelib
8058 EOM
8059 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8060 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8061 echo ' '
8062 case "$otherlibdirs" in
8063 ''|' ') dflt='none' ;;
8064 *)      dflt="$otherlibdirs" ;;
8065 esac
8066 $cat <<EOM
8067 Enter a colon-separated set of extra paths to include in perl's @INC
8068 search path, or enter 'none' for no extra paths.
8069
8070 EOM
8071
8072 rp='Colon-separated list of additional directories for perl to search?'
8073 . ./myread
8074 case "$ans" in
8075 ' '|''|none)    otherlibdirs=' ' ;;
8076 *)      otherlibdirs="$ans" ;;
8077 esac
8078 case "$otherlibdirs" in
8079 ' ') val=$undef ;;
8080 *)      val=$define ;;
8081 esac
8082 set d_perl_otherlibdirs
8083 eval $setvar
8084
8085 : DTrace support
8086 dflt_dtrace='/usr/sbin/dtrace'
8087 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8088
8089 cat <<EOM
8090
8091 Perl can be built to support DTrace on platforms that support it.
8092 DTrace is a diagnosis and performance analysis tool from Sun.
8093
8094 If this doesn't make any sense to you, just accept the default.
8095 EOM
8096
8097 while $test 1 ; do
8098         case "$usedtrace" in
8099         $define|true|[yY]*)
8100                 dflt='y'
8101                 ;;
8102         ?*)
8103                 dflt='y'
8104                 dflt_dtrace=$usedtrace
8105                 ;;
8106         *)
8107                 dflt='n'
8108                 ;;
8109         esac
8110
8111         rp='Support DTrace if available?'
8112         . ./myread
8113         case "$ans" in
8114         y|Y)    val="$define" ;;
8115         *)      val="$undef" ;;
8116         esac
8117         set usedtrace
8118         eval $setvar
8119
8120         test "X$usedtrace" != "X$define" && break
8121
8122         echo " "
8123         rp='Where is the dtrace executable?'
8124         dflt=$dflt_dtrace
8125         . ./getfile
8126         val="$ans"
8127         set dtrace
8128         eval $setvar
8129
8130         if $test -f $dtrace
8131         then
8132                 if $dtrace -h -s ../perldtrace.d \
8133                         -o perldtrace.tmp >/dev/null 2>&1 \
8134                         && rm -f perldtrace.tmp
8135                 then
8136                         echo " "
8137                         echo "Good: your $dtrace knows about the -h flag."
8138                 else
8139                         cat >&2 <<EOM
8140
8141 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8142 ***
8143 *** Your installed dtrace doesn't support the -h switch to compile a D
8144 *** program into a C header. Can't continue.
8145
8146 EOM
8147                         exit 1
8148                 fi
8149                 break;
8150         fi
8151
8152         case "$fastread" in
8153         yes)
8154                 cat >&2 <<EOM
8155
8156 *** $me:  Fatal Error:  $dtrace not found.
8157 *** Can't continue.
8158
8159 EOM
8160                 exit 1
8161                 ;;
8162         *)
8163                 echo "*** $dtrace was not found."
8164                 echo " "
8165                 ;;
8166         esac
8167 done
8168
8169 : See if we want extra modules installed
8170 echo " "
8171 case "$extras" in
8172 '') dflt='n';;
8173 *) dflt='y';;
8174 esac
8175 cat <<EOM
8176 Perl can be built with extra modules or bundles of modules which
8177 will be fetched from the CPAN and installed alongside Perl.
8178
8179 Notice that you will need access to the CPAN; either via the Internet,
8180 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8181 be asked later to configure the CPAN.pm module which will in turn do
8182 the installation of the rest of the extra modules or bundles.)
8183
8184 Notice also that if the modules require any external software such as
8185 libraries and headers (the libz library and the zlib.h header for the
8186 Compress::Zlib module, for example) you MUST have any such software
8187 already installed, this configuration process will NOT install such
8188 things for you.
8189
8190 If this doesn't make any sense to you, just accept the default '$dflt'.
8191 EOM
8192 rp='Install any extra modules (y or n)?'
8193 . ./myread
8194 case "$ans" in
8195 y|Y)
8196         cat <<EOM
8197
8198 Please list any extra modules or bundles to be installed from CPAN,
8199 with spaces between the names.  The names can be in any format the
8200 'install' command of CPAN.pm will understand.  (Answer 'none',
8201 without the quotes, to install no extra modules or bundles.)
8202 EOM
8203         rp='Extras?'
8204         dflt="$extras"
8205         . ./myread
8206         extras="$ans"
8207 esac
8208 case "$extras" in
8209 ''|'none')
8210         val=''
8211         $rm -f ../extras.lst
8212         ;;
8213 *)      echo "(Saving the list of extras for later...)"
8214         echo "$extras" > ../extras.lst
8215         val="'$extras'"
8216         ;;
8217 esac
8218 set extras
8219 eval $setvar
8220 echo " "
8221
8222 : determine where html pages for programs go
8223 set html1dir html1dir none
8224 eval $prefixit
8225 $cat <<EOM
8226
8227 If you wish to install html files for programs in $spackage, indicate
8228 the appropriate directory here.  To skip installing html files,
8229 answer "none".
8230 EOM
8231 case "$html1dir" in
8232 ''|none|$undef|' ') dflt=none ;;
8233 *) dflt=$html1dir ;;
8234 esac
8235 fn=dn+~
8236 rp="Directory for the main $spackage html pages?"
8237 . ./getfile
8238 prefixvar=html1dir
8239 . ./setprefixvar
8240 : Use ' ' for none so value is preserved next time through Configure
8241 $test X"$html1dir" = "X" && html1dir=' '
8242
8243 : determine where html pages for libraries and modules go
8244 set html3dir html3dir none
8245 eval $prefixit
8246 $cat <<EOM
8247
8248 If you wish to install html files for modules associated with $spackage,
8249 indicate the appropriate directory here.  To skip installing html files,
8250 answer "none".
8251 EOM
8252 : There is no obvious default.  If they have specified html1dir, then
8253 : try to key off that, possibly changing .../html1 into .../html3.
8254 case "$html3dir" in
8255 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8256 *) dflt=$html3dir ;;
8257 esac
8258 fn=dn+~
8259 rp="Directory for the $spackage module html pages?"
8260 . ./getfile
8261 prefixvar=html3dir
8262 . ./setprefixvar
8263 : Use ' ' for none so value is preserved next time through Configure
8264 $test X"$html3dir" = "X" && html3dir=' '
8265
8266 : determine whether to install perl also as /usr/bin/perl
8267
8268 echo " "
8269 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8270         $cat <<EOM
8271 Many scripts expect perl to be installed as /usr/bin/perl.
8272
8273 If you want to, I can install the perl you are about to compile
8274 as /usr/bin/perl (in addition to $bin/perl).
8275 EOM
8276         if test -f /usr/bin/perl; then
8277             $cat <<EOM
8278
8279 However, please note that because you already have a /usr/bin/perl,
8280 overwriting that with a new Perl would very probably cause problems.
8281 Therefore I'm assuming you don't want to do that (unless you insist).
8282
8283 EOM
8284             case "$installusrbinperl" in
8285             "$define"|[yY]*)    dflt='y';;
8286             *)                  dflt='n';;
8287             esac
8288         else
8289             $cat <<EOM
8290
8291 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8292
8293 EOM
8294             case "$installusrbinperl" in
8295             "$undef"|[nN]*)     dflt='n';;
8296             *)                  dflt='y';;
8297             esac
8298         fi
8299         rp="Do you want to install perl as /usr/bin/perl?"
8300         . ./myread
8301         case "$ans" in
8302         [yY]*)  val="$define";;
8303         *)      val="$undef" ;;
8304         esac
8305 else
8306         val="$undef"
8307 fi
8308 set installusrbinperl
8309 eval $setvar
8310
8311 : see if dlopen exists
8312 xxx_runnm="$runnm"
8313 xxx_ccflags="$ccflags"
8314 runnm=false
8315 : with g++ one needs -shared to get is-in-libc to work for dlopen
8316 case "$gccversion" in
8317 '')     ;;
8318 *Clang*)        ;;
8319 *)      case "$d_cplusplus" in
8320         "$define") ccflags="$ccflags -shared" ;;
8321         esac
8322         ;;
8323 esac
8324 set dlopen d_dlopen
8325 eval $inlibc
8326 runnm="$xxx_runnm"
8327 ccflags="$xxx_ccflags"
8328
8329 : see if this is a unistd.h system
8330 set unistd.h i_unistd
8331 eval $inhdr
8332
8333 : determine which dynamic loading, if any, to compile in
8334 echo " "
8335 dldir="ext/DynaLoader"
8336 case "$usedl" in
8337     $define|y|true)
8338         dflt='y'
8339         usedl="$define"
8340         ;;
8341     $undef|n|false)
8342         dflt='n'
8343         usedl="$undef"
8344         ;;
8345     *)
8346         dflt='n'
8347         case "$d_dlopen" in
8348             $define) dflt='y' ;;
8349         esac
8350         : Does a dl_xxx.xs file exist for this operating system
8351         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8352         ;;
8353 esac
8354 rp="Do you wish to use dynamic loading?"
8355 . ./myread
8356 usedl="$ans"
8357 bin_ELF="$undef"
8358 case "$ans" in
8359     y*) usedl="$define"
8360         case "$dlsrc" in
8361             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8362                     dflt="$dldir/dl_${osname}.xs"
8363                 elif $test "$d_dlopen" = "$define" ; then
8364                     dflt="$dldir/dl_dlopen.xs"
8365                 else
8366                     dflt=''
8367                 fi
8368                 ;;
8369             *)  dflt="$dldir/$dlsrc"
8370                 ;;
8371         esac
8372         echo "The following dynamic loading files are available:"
8373         : Can not go over to $dldir because getfile has path hard-coded in.
8374         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8375         rp="Source file to use for dynamic loading"
8376         fn="fne"
8377         gfpth="$src"
8378         . ./getfile
8379         usedl="$define"
8380         : emulate basename
8381         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8382
8383         $cat << EOM
8384
8385 Some systems may require passing special flags to $cc -c to
8386 compile modules that will be used to create a shared library.
8387 To use no flags, say "none".
8388
8389 EOM
8390         case "$cccdlflags" in
8391             '') case "$gccversion" in
8392                 '') case "$osname" in
8393                         hpux)   dflt='+z' ;;
8394                         irix*)  dflt='-KPIC' ;;
8395                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8396                         sunos)  dflt='-pic' ;;
8397                         *)      dflt='none' ;;
8398                     esac
8399                     ;;
8400                 *)  case "$osname" in
8401                         darwin) dflt='none' ;;
8402                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8403                         *)      dflt='-fpic' ;;
8404                     esac ;;
8405                 esac ;;
8406             ' ') dflt='none' ;;
8407             *)   dflt="$cccdlflags" ;;
8408         esac
8409
8410         case "$dflt" in
8411             none) dflt='' ;;
8412         esac
8413
8414         # If -Dsysroot was specified, now's the time to add it
8415         # to cccdlflags
8416         if test "X$sysroot" != X; then
8417             case "$gccversion" in
8418                 '') ;;
8419                 *)  case "$dflt" in
8420                         *sysroot*) ;;
8421                         'undef'|*)
8422                             dflt="$dflt --sysroot=$sysroot" ;;
8423                     esac
8424                     ;;
8425             esac
8426         fi
8427
8428         case "$dflt" in
8429             '') dflt='none';;
8430         esac
8431
8432         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8433         . ./myread
8434         case "$ans" in
8435             none) cccdlflags=' ' ;;
8436             *)    cccdlflags="$ans" ;;
8437         esac
8438
8439         cat << EOM
8440
8441 Some systems use ld to create libraries that can be dynamically loaded,
8442 while other systems (such as those using ELF) use $cc.
8443
8444 EOM
8445
8446 : Determine if this is ELF
8447         $cat >try.c <<EOM
8448 /* Test for whether ELF binaries are produced */
8449 #include <fcntl.h>
8450 #$i_stdlib I_STDLIB
8451 #ifdef I_STDLIB
8452 #include <stdlib.h>
8453 #endif
8454 #$i_unistd I_UNISTD
8455 #ifdef I_UNISTD
8456 #include <unistd.h>
8457 #endif
8458 int main() {
8459     char b[4];
8460     int i = open("a.out",O_RDONLY);
8461     if(i == -1)
8462         exit(1); /* fail */
8463     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8464         exit(0); /* succeed (yes, it is ELF) */
8465     exit(1); /* fail */
8466 }
8467 EOM
8468         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8469             bin_ELF="$define"
8470         fi
8471         $rm_try
8472
8473         case "$ld" in
8474             '') if $test $bin_ELF = "$define"; then
8475                     cat <<EOM
8476 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8477 EOM
8478                     dflt="$cc"
8479                 else
8480                     echo "I'll use ld to build dynamic libraries."
8481                     dflt='ld'
8482                 fi
8483                 ;;
8484             *)  dflt="$ld"
8485                 ;;
8486         esac
8487
8488         rp="What command should be used to create dynamic libraries?"
8489         . ./myread
8490         ld="$ans"
8491
8492         cat << EOM
8493
8494 Some systems may require passing special flags to $ld to create a
8495 library that can be dynamically loaded.  If your ld flags include
8496 -L/other/path options to locate libraries outside your loader's normal
8497 search path, you may need to specify those -L options here as well.  To
8498 use no flags, say "none".
8499
8500 EOM
8501         case "$lddlflags" in
8502             '') case "$osname" in
8503                     haiku) dflt='-shared' ;;
8504                     hpux) dflt='-b';
8505                           case "$gccversion" in
8506                               '') dflt="$dflt +vnocompatwarnings" ;;
8507                           esac
8508                           ;;
8509                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8510                     solaris) # See [perl #66604].
8511                             # On Solaris 11, gcc -m64 on amd64
8512                             # appears not to understand -G.  gcc versions at
8513                             # least as old as 3.4.3 support -shared, so just
8514                             # use that with Solaris 11 and later, but keep
8515                             # the old behavior for older Solaris versions.
8516                             case "$gccversion" in
8517                                 '') dflt='-G' ;;
8518                                 *)  case "$osvers" in
8519                                         2.?|2.10) dflt='-G' ;;
8520                                         *) dflt='-shared' ;;
8521                                     esac
8522                                     ;;
8523                             esac
8524                             ;;
8525                     sunos) dflt='-assert nodefinitions' ;;
8526                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8527                     *)     dflt='none' ;;
8528                 esac
8529                 ;;
8530             *) dflt="$lddlflags" ;;
8531         esac
8532
8533         : Only do this for gcc, since, for example, qcc has no concept
8534         : of --sysroot.
8535         if $test "X$sysroot" != X; then
8536             case "$gccversion" in
8537                 '') ;;
8538                 *)  dflt="$dflt --sysroot $sysroot" ;;
8539             esac
8540         fi
8541
8542         : Try to guess additional flags to pick up local libraries.
8543         : Be careful not to append to a plain 'none'
8544         case "$dflt" in
8545             none) dflt='' ;;
8546         esac
8547         for thisflag in $ldflags; do
8548             case "$thisflag" in
8549                 -L*|-R*|-Wl,-R*)
8550                     case " $dflt " in
8551                         *" $thisflag "*) ;;
8552                         *) dflt="$dflt $thisflag" ;;
8553                     esac
8554                     ;;
8555             esac
8556         done
8557
8558         case "$dflt" in
8559             ''|' ') dflt='none' ;;
8560         esac
8561
8562         case "$ldflags" in
8563             *-fstack-protector-strong*)
8564                 case "$dflt" in
8565                     *-fstack-protector-strong*) ;; # Don't add it again
8566                     *) dflt="$dflt -fstack-protector-strong" ;;
8567                 esac
8568                 ;;
8569             *-fstack-protector*)
8570                 case "$dflt" in
8571                     *-fstack-protector*) ;; # Don't add it again
8572                     *) dflt="$dflt -fstack-protector" ;;
8573                 esac
8574                 ;;
8575         esac
8576
8577         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8578         . ./myread
8579         case "$ans" in
8580             none) lddlflags=' ' ;;
8581             *) lddlflags="$ans" ;;
8582         esac
8583
8584         cat <<EOM
8585
8586 Some systems may require passing special flags to $cc to indicate that
8587 the resulting executable will use dynamic linking.  To use no flags,
8588 say "none".
8589
8590 EOM
8591         case "$ccdlflags" in
8592             '') case "$osname" in
8593                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8594                     sunos)             dflt='none'   ;;
8595                     *)                 dflt='none'   ;;
8596                 esac ;;
8597             ' ') dflt='none' ;;
8598             *)   dflt="$ccdlflags" ;;
8599         esac
8600         rp="Any special flags to pass to $cc to use dynamic linking?"
8601         . ./myread
8602         case "$ans" in
8603             none) ccdlflags=' ' ;;
8604             *)    ccdlflags="$ans" ;;
8605         esac
8606         ;;
8607
8608     *)  usedl="$undef"
8609         ld='ld'
8610         dlsrc='dl_none.xs'
8611         lddlflags=''
8612         ccdlflags=''
8613         ;;
8614 esac
8615
8616 ld_can_script="$undef"
8617 case "$bin_ELF$usedl" in
8618     $define$define)
8619         # Abuse try.h and a.out names for neat cleanup
8620         $cat >try.c <<EOM
8621 void foo() {}
8622 void bar() {}
8623 EOM
8624         $cat >try.h <<EOM
8625 LIBTEST_42 {
8626  global:
8627   foo;
8628  local: *;
8629  };
8630 EOM
8631         if $cc $cccdlflags $ccdlflags $ccflags \
8632                $ldflags $lddlflags -o a.out try.c \
8633                -Wl,--version-script=try.h >/dev/null 2>&1 \
8634            &&  $test -s a.out ; then
8635             echo "ld supports scripting" >&4
8636             ld_can_script="$define"
8637         else
8638             echo "ld does not support scripting" >&4
8639         fi
8640         $rm_try
8641         ;;
8642 esac
8643
8644 : Do we want a shared libperl?
8645 also=''
8646 case "$usedl" in
8647 $undef)
8648         # No dynamic loading being used, so don't bother even to prompt.
8649         useshrplib='false'
8650         ;;
8651 *)      case "$useshrplib" in
8652         '')     case "$osname" in
8653                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8654                         dflt=y
8655                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8656                         ;;
8657                 *)      dflt=n
8658                         ;;
8659                 esac
8660                 ;;
8661         $define|true|[Yy]*)
8662                 dflt=y
8663                 ;;
8664         *)      dflt=n
8665                 ;;
8666         esac
8667         $cat << EOM
8668
8669 The perl executable is normally obtained by linking perlmain.c with
8670 libperl${_a}, any static extensions (usually just DynaLoader), and
8671 any other libraries needed on this system (such as -lm, etc.).  Since
8672 your system supports dynamic loading, it is probably possible to build
8673 a shared libperl.$so.  If you will have more than one executable linked
8674 to libperl.$so, this will significantly reduce the size of each
8675 executable, but it may have a noticeable effect on performance.  The
8676 default is probably sensible for your system.
8677 $also
8678
8679 EOM
8680         rp="Build a shared libperl.$so (y/n)"
8681         . ./myread
8682         case "$ans" in
8683         true|$define|[Yy]*)
8684                 useshrplib='true'  ;;
8685         *)      useshrplib='false' ;;
8686         esac
8687         ;;
8688 esac
8689
8690 case "$useshrplib" in
8691 true)
8692         case "$userelocatableinc" in
8693         true|define)
8694                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8695                 echo "See INSTALL for an explanation why that won't work." >&4
8696                 exit 4
8697                 ;;
8698         esac
8699         case "$libperl" in
8700         '')
8701                 # Figure out a good name for libperl.so.  Since it gets stored in
8702                 # a version-specific architecture-dependent library, the version
8703                 # number isn't really that important, except for making cc/ld happy.
8704                 #
8705                 # A name such as libperl.so.10.1
8706                 majmin="libperl.$so.$patchlevel.$subversion"
8707                 # A name such as libperl.so.100
8708                 majonly=`echo $patchlevel $subversion |
8709                         $awk '{printf "%d%02d", $1, $2}'`
8710                 majonly=libperl.$so.$majonly
8711                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8712                 # rely on figuring it out from the naming of libc.
8713                 case "${osname}${osvers}" in
8714                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8715                         dflt=libperl.$so
8716                         ;;
8717                 cygwin*) # ld links now against the dll directly
8718                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8719                         majonly=`echo $patchlevel $subversion |
8720                                 $awk '{printf "%03d%03d", $1, $2}'`
8721                         majonly=cygperl5.$majonly.$so
8722                         dflt=$majmin
8723                         ;;
8724                 *)      # Try to guess based on whether libc has major.minor.
8725                         case "$libc" in
8726                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8727                         *libc.$so.[0-9]*) dflt=$majonly ;;
8728                         *)      dflt=libperl.$so ;;
8729                         esac
8730                         ;;
8731                 esac
8732                 ;;
8733         *)      dflt=$libperl
8734                 ;;
8735         esac
8736         cat << EOM
8737
8738 I need to select a good name for the shared libperl.  If your system uses
8739 library names with major and minor numbers, then you might want something
8740 like $majmin.  Alternatively, if your system uses a single version
8741 number for shared libraries, then you might want to use $majonly.
8742 Or, your system might be quite happy with a simple libperl.$so.
8743
8744 Since the shared libperl will get installed into a version-specific
8745 architecture-dependent directory, the version number of the shared perl
8746 library probably isn't important, so the default should be o.k.
8747
8748 EOM
8749         rp='What name do you want to give to the shared libperl?'
8750         . ./myread
8751         libperl=$ans
8752         echo "Ok, I'll use $libperl"
8753         ;;
8754 *)
8755         libperl="libperl${_a}"
8756         ;;
8757 esac
8758
8759 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8760 case "$shrpdir" in
8761 '') ;;
8762 *)      $cat >&4 <<EOM
8763 WARNING:  Use of the shrpdir variable for the installation location of
8764 the shared $libperl is not supported.  It was never documented and
8765 will not work in this version.  Let me (perlbug@perl.org)
8766 know of any problems this may cause.
8767
8768 EOM
8769         case "$shrpdir" in
8770         "$archlibexp/CORE")
8771                 $cat >&4 <<EOM
8772 But your current setting of $shrpdir is
8773 the default anyway, so it's harmless.
8774 EOM
8775                 ;;
8776         *)
8777                 $cat >&4 <<EOM
8778 Further, your current attempted setting of $shrpdir
8779 conflicts with the value of $archlibexp/CORE
8780 that installperl will use.
8781 EOM
8782                 ;;
8783         esac
8784         ;;
8785 esac
8786
8787 # How will the perl executable find the installed shared $libperl?
8788 # Add $xxx to ccdlflags.
8789 # If we can't figure out a command-line option, use $shrpenv to
8790 # set env LD_RUN_PATH.  The main perl makefile uses this.
8791 shrpdir=$archlibexp/CORE
8792 xxx=''
8793 tmp_shrpenv=''
8794 if "$useshrplib"; then
8795     case "$osname" in
8796         aix)
8797                 # We'll set it in Makefile.SH...
8798                 ;;
8799         solaris)
8800                 xxx="-R $shrpdir"
8801                 ;;
8802         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8803                 xxx="-Wl,-R$shrpdir"
8804                 ;;
8805         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8806                 xxx="-Wl,-rpath,$shrpdir"
8807                 ;;
8808         hpux*)
8809                 # hpux doesn't like the default, either.
8810                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8811                 ;;
8812         cygwin)
8813                 # cygwin needs only ldlibpth
8814                 ;;
8815         *)
8816                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8817                 ;;
8818         esac
8819         case "$xxx" in
8820         '') ;;
8821         *)
8822                 # Only add $xxx if it isn't already in ccdlflags.
8823                 case " $ccdlflags " in
8824                 *" $xxx "*)     ;;
8825                 *)      ccdlflags="$ccdlflags $xxx"
8826                         cat <<EOM >&4
8827
8828 Adding $xxx to the flags
8829 passed to $ld so that the perl executable will find the
8830 installed shared $libperl.
8831
8832 EOM
8833                         ;;
8834                 esac
8835                 ;;
8836         esac
8837 fi
8838 # Fix ccdlflags in AIX for building external extensions.
8839 # (For building Perl itself bare -bE:perl.exp is needed,
8840 #  Makefile.SH takes care of this.)
8841 case "$osname" in
8842 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8843 esac
8844 # Respect a hint or command-line value.
8845 case "$shrpenv" in
8846 '') shrpenv="$tmp_shrpenv" ;;
8847 esac
8848 case "$ldlibpthname" in
8849 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8850 none)   ldlibpthname='' ;;
8851 esac
8852
8853 : determine where manual pages are on this system
8854 echo " "
8855 case "$sysman" in
8856 '')
8857         syspath='/usr/share/man/man1 /usr/man/man1'
8858         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8859         syspath="$syspath /usr/man/u_man/man1"
8860         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8861         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8862         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8863         sysman=`./loc . /usr/man/man1 $syspath`
8864         ;;
8865 esac
8866 if $test -d "$sysman"; then
8867         echo "System manual is in $sysman." >&4
8868 else
8869         echo "Could not find manual pages in source form." >&4
8870 fi
8871
8872 : determine where manual pages go
8873 set man1dir man1dir none
8874 eval $prefixit
8875 $cat <<EOM
8876
8877 $spackage has manual pages available in source form.
8878 EOM
8879 case "$nroff" in
8880 nroff)
8881         echo "However, you don't have nroff, so they're probably useless to you."
8882         case "$man1dir" in
8883         '') man1dir="none";;
8884         esac;;
8885 esac
8886 echo "If you don't want the manual sources installed, answer 'none'."
8887 case "$man1dir" in
8888 ' ') dflt=none
8889         ;;
8890 '')
8891         lookpath="$prefixexp/share/man/man1"
8892         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8893         lookpath="$lookpath $prefixexp/man/p_man/man1"
8894         lookpath="$lookpath $prefixexp/man/u_man/man1"
8895         lookpath="$lookpath $prefixexp/man/man.1"
8896         case "$sysman" in
8897         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8898         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8899         esac
8900         set dflt
8901         eval $prefixup
8902         ;;
8903 *)  dflt="$man1dir"
8904         ;;
8905 esac
8906 echo " "
8907 fn=dn+~
8908 rp="Where do the main $spackage manual pages (source) go?"
8909 . ./getfile
8910 if $test "X$man1direxp" != "X$ansexp"; then
8911         installman1dir=''
8912 fi
8913 prefixvar=man1dir
8914 . ./setprefixvar
8915
8916 case "$man1dir" in
8917 '')     man1dir=' '
8918         installman1dir='';;
8919 esac
8920
8921 : What suffix to use on installed man pages
8922
8923 case "$man1dir" in
8924 ' ')
8925         man1ext='0'
8926         ;;
8927 *)
8928         rp="What suffix should be used for the main $spackage man pages?"
8929         case "$man1ext" in
8930         '')     case "$man1dir" in
8931                 *1)  dflt=1 ;;
8932                 *1p) dflt=1p ;;
8933                 *1pm) dflt=1pm ;;
8934                 *l) dflt=l;;
8935                 *n) dflt=n;;
8936                 *o) dflt=o;;
8937                 *p) dflt=p;;
8938                 *C) dflt=C;;
8939                 *L) dflt=L;;
8940                 *L1) dflt=L1;;
8941                 *) dflt=1;;
8942                 esac
8943                 ;;
8944         *)      dflt="$man1ext";;
8945         esac
8946         . ./myread
8947         man1ext="$ans"
8948         ;;
8949 esac
8950
8951 : see if we can have long filenames
8952 echo " "
8953 first=123456789abcdef
8954 $rm -f $first
8955 if (echo hi >$first) 2>/dev/null; then
8956         if $test -f 123456789abcde; then
8957                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8958                 val="$undef"
8959         else
8960                 echo 'You can have filenames longer than 14 characters.'>&4
8961                 val="$define"
8962         fi
8963 else
8964         $cat <<'EOM'
8965 You can't have filenames longer than 14 chars.
8966 You can't even think about them!
8967 EOM
8968         val="$undef"
8969 fi
8970 set d_flexfnam
8971 eval $setvar
8972 $rm -rf 123456789abcde*
8973
8974 : determine where library module manual pages go
8975 set man3dir man3dir none
8976 eval $prefixit
8977 $cat <<EOM
8978
8979 $spackage has manual pages for many of the library modules.
8980 EOM
8981
8982 case "$nroff" in
8983 nroff)
8984         $cat <<'EOM'
8985 However, you don't have nroff, so they're probably useless to you.
8986 EOM
8987         case "$man3dir" in
8988         '') man3dir="none";;
8989         esac;;
8990 esac
8991
8992 case "$d_flexfnam" in
8993 undef)
8994         $cat <<'EOM'
8995 However, your system can't handle the long file names like File::Basename.3.
8996 EOM
8997         case "$man3dir" in
8998         '') man3dir="none";;
8999         esac;;
9000 esac
9001
9002 echo "If you don't want the manual sources installed, answer 'none'."
9003 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9004 case "$man3dir" in
9005 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9006         if $test -d "$privlib/man/man3"; then
9007                 cat <<EOM >&4
9008
9009 WARNING:  Previous versions of perl installed man3 pages into
9010 $privlib/man/man3.  This version will suggest a
9011 new default of $dflt.
9012 EOM
9013                 tdflt=$dflt
9014                 dflt='n'
9015                 rp='Do you wish to preserve the old behavior?(y/n)'
9016                 . ./myread
9017                 case "$ans" in
9018                 y*) dflt="$privlib/man/man3" ;;
9019                 *)  dflt=$tdflt ;;
9020                 esac
9021     fi
9022         ;;
9023 *)      dflt="$man3dir" ;;
9024 esac
9025 case "$dflt" in
9026 ' ') dflt=none ;;
9027 esac
9028 echo " "
9029 fn=dn+~
9030 rp="Where do the $package library man pages (source) go?"
9031 . ./getfile
9032 prefixvar=man3dir
9033 . ./setprefixvar
9034
9035 case "$man3dir" in
9036 '')     man3dir=' '
9037         installman3dir='';;
9038 esac
9039
9040 : What suffix to use on installed man pages
9041 case "$man3dir" in
9042 ' ')
9043         man3ext='0'
9044         ;;
9045 *)
9046         rp="What suffix should be used for the $package library man pages?"
9047         case "$man3ext" in
9048         '')     case "$man3dir" in
9049                 *3)  dflt=3 ;;
9050                 *3p) dflt=3p ;;
9051                 *3pm) dflt=3pm ;;
9052                 *l) dflt=l;;
9053                 *n) dflt=n;;
9054                 *o) dflt=o;;
9055                 *p) dflt=p;;
9056                 *C) dflt=C;;
9057                 *L) dflt=L;;
9058                 *L3) dflt=L3;;
9059                 *) dflt=3;;
9060                 esac
9061                 ;;
9062         *)      dflt="$man3ext";;
9063         esac
9064         . ./myread
9065         man3ext="$ans"
9066         ;;
9067 esac
9068
9069 : see if we have to deal with yellow pages, now NIS.
9070 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9071         case "$hostcat" in
9072         nidump*) ;;
9073         *)
9074                 case "$hostcat" in
9075                 *ypcat*) dflt=y;;
9076                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9077                                 dflt=y
9078                         else
9079                                 dflt=n
9080                         fi;;
9081                 *) dflt=n;;
9082                 esac
9083                 echo " "
9084                 rp='Are you getting the hosts file via yellow pages?'
9085                 . ./myread
9086                 case "$ans" in
9087                 y*) hostcat='ypcat hosts';;
9088                 *) hostcat='cat /etc/hosts';;
9089                 esac
9090                 ;;
9091         esac
9092 fi
9093 case "$hostcat" in
9094 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9095 esac
9096 case "$groupcat" in
9097 '') test -f /etc/group && groupcat='cat /etc/group';;
9098 esac
9099 case "$passcat" in
9100 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9101 esac
9102
9103 : now get the host name
9104 echo " "
9105 echo "Figuring out host name..." >&4
9106 case "$myhostname" in
9107 '') cont=true
9108         echo 'Maybe "hostname" will work...'
9109         if tans=`sh -c hostname 2>&1` ; then
9110                 myhostname=$tans
9111                 phostname=hostname
9112                 cont=''
9113         fi
9114         ;;
9115 *) cont='';;
9116 esac
9117 if $test "$cont"; then
9118         if ./xenix; then
9119                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9120                 if tans=`cat /etc/systemid 2>&1` ; then
9121                         myhostname=$tans
9122                         phostname='cat /etc/systemid'
9123                         echo "Whadyaknow.  Xenix always was a bit strange..."
9124                         cont=''
9125                 fi
9126         elif $test -r /etc/systemid; then
9127                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9128         fi
9129 fi
9130 if $test "$cont"; then
9131         echo 'No, maybe "uuname -l" will work...'
9132         if tans=`sh -c 'uuname -l' 2>&1` ; then
9133                 myhostname=$tans
9134                 phostname='uuname -l'
9135         else
9136                 echo 'Strange.  Maybe "uname -n" will work...'
9137                 if tans=`sh -c 'uname -n' 2>&1` ; then
9138                         myhostname=$tans
9139                         phostname='uname -n'
9140                 else
9141                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9142                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9143                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9144                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9145                         else
9146                                 case "$myhostname" in
9147                                 '') echo "Does this machine have an identity crisis or something?"
9148                                         phostname='';;
9149                                 *)
9150                                         echo "Well, you said $myhostname before..."
9151                                         phostname='echo $myhostname';;
9152                                 esac
9153                         fi
9154                 fi
9155         fi
9156 fi
9157 case "$myhostname" in
9158 '') myhostname=noname ;;
9159 esac
9160 : you do not want to know about this
9161 set $myhostname
9162 myhostname=$1
9163
9164 : verify guess
9165 if $test "$myhostname" ; then
9166         dflt=y
9167         rp='Your host name appears to be "'$myhostname'".'" Right?"
9168         . ./myread
9169         case "$ans" in
9170         y*) ;;
9171         *) myhostname='';;
9172         esac
9173 fi
9174
9175 : bad guess or no guess
9176 while $test "X$myhostname" = X ; do
9177         dflt=''
9178         rp="Please type the (one word) name of your host:"
9179         . ./myread
9180         myhostname="$ans"
9181 done
9182
9183 : translate upper to lower if necessary
9184 case "$myhostname" in
9185 *[A-Z]*)
9186         echo "(Normalizing case in your host name)"
9187         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9188         ;;
9189 esac
9190
9191 case "$myhostname" in
9192 *.*)
9193         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9194         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9195         echo "(Trimming domain name from host name--host name is now $myhostname)"
9196         ;;
9197 *) case "$mydomain" in
9198         '')
9199                 {
9200                         test "X$hostcat" = "Xypcat hosts" &&
9201                         ypmatch "$myhostname" hosts 2>/dev/null |\
9202                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9203                         $test -s hosts
9204                 } || {
9205                         test "X$hostcat" != "X" &&
9206                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9207                                         /[       ]$myhostname[  . ]/p" > hosts
9208                 }
9209                 tmp_re="[       . ]"
9210                 if $test -f hosts; then
9211                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9212                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9213                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9214                                 hosts | $sort | $uniq | \
9215                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9216                         case `$echo X$dflt` in
9217                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9218                                 dflt=.
9219                                 ;;
9220                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9221                                 ;;
9222                         esac
9223                 else
9224                         echo "(I cannot locate a hosts database anywhere)"
9225                         dflt=.
9226                 fi
9227                 case "$dflt" in
9228                 .)
9229                         tans=`./loc resolv.conf X /etc /usr/etc`
9230                         if $test -f "$tans"; then
9231                                 echo "(Attempting domain name extraction from $tans)"
9232                                 dflt=.`$sed -n -e 's/   / /g' \
9233                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9234                                   -e 1q 2>/dev/null`
9235                                 case "$dflt" in
9236                                 .) dflt=.`$sed -n -e 's/        / /g' \
9237                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9238                                      -e 1q 2>/dev/null`
9239                                         ;;
9240                                 esac
9241                         fi
9242                         ;;
9243                 esac
9244                 case "$dflt" in
9245                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9246                         dflt=.`sh -c domainname 2>/dev/null`
9247                         case "$dflt" in
9248                         '') dflt='.';;
9249                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9250                         esac
9251                         ;;
9252                 esac
9253                 case "$dflt$osname" in
9254                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9255                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9256                         ;;
9257                 esac
9258                 case "$dflt" in
9259                 .) echo "(Lost all hope -- silly guess then)"
9260                         dflt='.nonet'
9261                         ;;
9262                 esac
9263                 $rm -f hosts
9264                 ;;
9265         *) dflt="$mydomain";;
9266         esac;;
9267 esac
9268 echo " "
9269 rp="What is your domain name?"
9270 . ./myread
9271 tans="$ans"
9272 case "$ans" in
9273 '') ;;
9274 .*) ;;
9275 *) tans=".$tans";;
9276 esac
9277 mydomain="$tans"
9278
9279 : translate upper to lower if necessary
9280 case "$mydomain" in
9281 *[A-Z]*)
9282         echo "(Normalizing case in your domain name)"
9283         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9284         ;;
9285 esac
9286
9287 : a little sanity check here
9288 case "$phostname" in
9289 '') ;;
9290 *)
9291         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9292         $myhostname$mydomain|$myhostname) ;;
9293         *)
9294                 case "$phostname" in
9295                 sed*)
9296                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9297                         ;;
9298                 *)
9299                         echo "(That doesn't agree with your $phostname command, by the way.)"
9300                         ;;
9301                 esac
9302         ;;
9303         esac
9304         ;;
9305 esac
9306
9307 : determine the e-mail address of the user who is running us
9308 $cat <<EOM
9309
9310 I need to get your e-mail address in Internet format if possible, i.e.
9311 something like user@host.domain. Please answer accurately since I have
9312 no easy means to double check it. The default value provided below
9313 is most probably close to reality but may not be valid from outside
9314 your organization...
9315
9316 EOM
9317 cont=x
9318 while test "$cont"; do
9319         case "$MAILDOMAIN" in
9320         '')
9321                 if $test -s /etc/mailname; then
9322                         maildomain=`$cat /etc/mailname`
9323                 else
9324                         maildomain="$myhostname$mydomain"
9325                 fi
9326                 ;;
9327         *)  maildomain="$MAILDOMAIN";;
9328         esac
9329         case "$cf_email" in
9330         '') dflt="$cf_by@$maildomain";;
9331         *)  dflt="$cf_email";;
9332         esac
9333         rp='What is your e-mail address?'
9334         . ./myread
9335         cf_email="$ans"
9336         case "$cf_email" in
9337         *@*.*) cont='' ;;
9338         *)
9339                 rp='Address does not look like an Internet one.  Use it anyway?'
9340                 case "$fastread" in
9341                 yes) dflt=y ;;
9342                 *) dflt=n ;;
9343                 esac
9344                 . ./myread
9345                 case "$ans" in
9346                 y*) cont='' ;;
9347                 *) echo " " ;;
9348                 esac
9349                 ;;
9350         esac
9351 done
9352
9353 : Ask e-mail of administrator
9354 $cat <<EOM
9355
9356 If you or somebody else will be maintaining perl at your site, please
9357 fill in the correct e-mail address here so that they may be contacted
9358 if necessary. Currently, the "perlbug" program included with perl
9359 will send mail to this address in addition to perlbug@perl.org. You may
9360 enter "none" for no administrator.
9361
9362 EOM
9363 case "$perladmin" in
9364 '') dflt="$cf_email";;
9365 *) dflt="$perladmin";;
9366 esac
9367 rp='Perl administrator e-mail address'
9368 . ./myread
9369 perladmin="$ans"
9370
9371 : determine whether to use a version number suffix for installed binaries
9372 echo " "
9373 $cat <<EOM
9374 Do you want to use a version number suffix for installed binaries? This
9375 will install 'perl$version' instead of 'perl', and likewise for other
9376 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9377 to be installed side-by-side. Unless you are a developer, you probably
9378 do *not* want to do this.
9379 EOM
9380 case "$versiononly" in
9381 "$define"|[Yy]*|true) dflt='y' ;;
9382 *) dflt='n';
9383 esac
9384 rp="Do you want to use a version number suffix for installed binaries?"
9385 . ./myread
9386 case "$ans" in
9387 [yY]*)  val="$define";;
9388 *)      val="$undef" ;;
9389 esac
9390 set versiononly
9391 eval $setvar
9392
9393 case "$versiononly" in
9394 "$define") inc_version_list=''
9395            inc_version_list_init=0
9396            ;;
9397 esac
9398
9399 : figure out how to guarantee perl startup
9400 : XXX Note that this currently takes advantage of the bug that binexp ignores
9401 :     the Configure -Dinstallprefix setting, which in turn means that under
9402 :     relocatable @INC, initialinstalllocation is what binexp started as.
9403 case "$startperl" in
9404 '')
9405         case "$sharpbang" in
9406         *!)
9407                 $cat <<EOH
9408
9409 I can use the #! construct to start perl on your system. This will
9410 make startup of perl scripts faster, but may cause problems if you
9411 want to share those scripts and perl is not in a standard place
9412 ($initialinstalllocation/perl) on all your platforms. The alternative
9413 is to force a shell by starting the script with a single ':' character.
9414
9415 EOH
9416                 case "$versiononly" in
9417                 "$define")      dflt="$initialinstalllocation/perl$version";;
9418                 *)              dflt="$initialinstalllocation/perl";;
9419                 esac
9420                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9421                 . ./myread
9422                 case "$ans" in
9423                 none)   startperl=": # use perl";;
9424                 *)      startperl="#!$ans"
9425                         if $test 30 -lt `echo "$ans" | wc -c`; then
9426                                 $cat >&4 <<EOM
9427
9428 WARNING:  Some systems limit the #! command to 32 characters.
9429 If you experience difficulty running Perl scripts with #!, try
9430 installing Perl in a directory with a shorter pathname.
9431
9432 EOM
9433                         fi ;;
9434                 esac
9435                 ;;
9436         *) startperl=": # use perl"
9437                 ;;
9438         esac
9439         ;;
9440 esac
9441 echo "I'll use $startperl to start perl scripts."
9442
9443 : figure best path for perl in scripts
9444 case "$perlpath" in
9445 '')
9446         case "$versiononly" in
9447         "$define")      perlpath="$initialinstalllocation/perl$version";;
9448         *)              perlpath="$initialinstalllocation/perl";;
9449         esac
9450         case "$startperl" in
9451         *!*) ;;
9452         *)
9453                 $cat <<EOH
9454
9455 I will use the "eval 'exec'" idiom to start Perl on your system.
9456 I can use the full path of your Perl binary for this purpose, but
9457 doing so may cause problems if you want to share those scripts and
9458 Perl is not always in a standard place ($initialinstalllocation/perl).
9459
9460 EOH
9461                 dflt="$initialinstalllocation/perl"
9462                 rp="What path shall I use in \"eval 'exec'\"?"
9463                 . ./myread
9464                 perlpath="$ans"
9465                 ;;
9466         esac
9467         ;;
9468 esac
9469 case "$startperl" in
9470 *!*)    ;;
9471 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9472 esac
9473
9474 : determine where public executable scripts go
9475 set scriptdir scriptdir
9476 eval $prefixit
9477 case "$scriptdir" in
9478 '')
9479         dflt="$bin"
9480         : guess some guesses
9481         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9482         $test -d /usr/share/bin     && dflt=/usr/share/bin
9483         $test -d /usr/local/script  && dflt=/usr/local/script
9484         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9485         $test -d $prefixexp/script  && dflt=$prefixexp/script
9486         set dflt
9487         eval $prefixup
9488         ;;
9489 *)  dflt="$scriptdir"
9490         ;;
9491 esac
9492 $cat <<EOM
9493
9494 Some installations have a separate directory just for executable scripts so
9495 that they can mount it across multiple architectures but keep the scripts in
9496 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9497 Or you might just lump your scripts in with all your other executables.
9498
9499 EOM
9500 fn=d~
9501 rp='Where do you keep publicly executable scripts?'
9502 . ./getfile
9503 if $test "X$ansexp" != "X$scriptdirexp"; then
9504         installscript=''
9505 fi
9506 installscriptdir=''
9507 prefixvar=scriptdir
9508 . ./setprefixvar
9509 : A little fix up for an irregularly named variable.
9510 installscript="$installscriptdir"
9511
9512 : determine where add-on public executables go
9513 case "$sitebin" in
9514 '')     dflt=$siteprefix/bin ;;
9515 *)      dflt=$sitebin ;;
9516 esac
9517 fn=d~
9518 rp='Pathname where the add-on public executables should be installed?'
9519 . ./getfile
9520 prefixvar=sitebin
9521 . ./setprefixvar
9522
9523 : determine where add-on html pages go
9524 : There is no standard location, so try to copy the previously-selected
9525 : directory structure for the core html pages.
9526 case "$sitehtml1dir" in
9527 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9528 *)     dflt=$sitehtml1dir ;;
9529 esac
9530 case "$dflt" in
9531 ''|' ') dflt=none ;;
9532 esac
9533 fn=dn+~
9534 rp='Pathname where the site-specific html pages should be installed?'
9535 . ./getfile
9536 prefixvar=sitehtml1dir
9537 . ./setprefixvar
9538
9539 : determine where add-on library html pages go
9540 : There is no standard location, so try to copy the previously-selected
9541 : directory structure for the core html pages.
9542 case "$sitehtml3dir" in
9543 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9544 *)     dflt=$sitehtml3dir ;;
9545 esac
9546 case "$dflt" in
9547 ''|' ') dflt=none ;;
9548 esac
9549 fn=dn+~
9550 rp='Pathname where the site-specific library html pages should be installed?'
9551 . ./getfile
9552 prefixvar=sitehtml3dir
9553 . ./setprefixvar
9554
9555 : determine where add-on manual pages go
9556 case "$siteman1dir" in
9557 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9558 *)      dflt=$siteman1dir ;;
9559 esac
9560 case "$dflt" in
9561 ''|' ') dflt=none ;;
9562 esac
9563 fn=dn+~
9564 rp='Pathname where the site-specific manual pages should be installed?'
9565 . ./getfile
9566 prefixvar=siteman1dir
9567 . ./setprefixvar
9568
9569 : determine where add-on library man pages go
9570 case "$siteman3dir" in
9571 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9572 *)      dflt=$siteman3dir ;;
9573 esac
9574 case "$dflt" in
9575 ''|' ') dflt=none ;;
9576 esac
9577 fn=dn+~
9578 rp='Pathname where the site-specific library manual pages should be installed?'
9579 . ./getfile
9580 prefixvar=siteman3dir
9581 . ./setprefixvar
9582
9583 : determine where add-on public executable scripts go
9584 case "$sitescript" in
9585 '')     dflt=$siteprefix/script
9586         $test -d $dflt || dflt=$sitebin ;;
9587 *)  dflt="$sitescript" ;;
9588 esac
9589 fn=d~+
9590 rp='Pathname where add-on public executable scripts should be installed?'
9591 . ./getfile
9592 prefixvar=sitescript
9593 . ./setprefixvar
9594
9595 : see if backtrace exists
9596 set backtrace d_backtrace
9597 eval $inlibc
9598
9599 : add flags if using c backtrace
9600 case "$usecbacktrace" in
9601   "") usecbacktrace=$undef ;;
9602   [yY]*|true|$define)
9603     case "$d_backtrace" in
9604       [yY]*|true|$define)
9605         case " $ccflags " in
9606           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9607           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9608           esac
9609         ;;
9610       *)
9611         echo "This system does not support backtrace" >&4
9612         usecbacktrace=$undef
9613         ;;
9614       esac
9615     ;;
9616   esac
9617
9618 : Check if faststdio is requested and available
9619 case "$usefaststdio" in
9620 $define|true|[yY]*|'')
9621         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9622         case "$xversion" in
9623         [68])   dflt='y' ;;
9624         *)      dflt='n' ;;
9625         esac
9626         ;;
9627 *) dflt='n';;
9628 esac
9629 cat <<EOM
9630
9631 Perl can be built to use 'fast stdio', which means using the stdio
9632 library but also directly manipulating the stdio buffers to enable
9633 faster I/O.  Using stdio is better for backward compatibility (especially
9634 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9635 interface has been preferred instead of stdio.
9636
9637 If this doesn't make any sense to you, just accept the default '$dflt'.
9638 EOM
9639 rp='Use the "fast stdio" if available?'
9640 . ./myread
9641 case "$ans" in
9642 y|Y)    val="$define" ;;
9643 *)      val="$undef" ;;
9644 esac
9645 set usefaststdio
9646 eval $setvar
9647
9648
9649 : define an is-a-typedef? function
9650 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9651 case "$inclist" in
9652 "") inclist="sys/types.h";;
9653 esac;
9654 eval "varval=\$$var";
9655 case "$varval" in
9656 "")
9657         $rm -f temp.c;
9658         for inc in $inclist; do
9659                 echo "#include <$inc>" >>temp.c;
9660         done;
9661         echo "#ifdef $type" >> temp.c;
9662         echo "printf(\"We have $type\");" >> temp.c;
9663         echo "#endif" >> temp.c;
9664         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9665         if $contains $type temp.E >/dev/null 2>&1; then
9666                 eval "$var=\$type";
9667         else
9668                 eval "$var=\$def";
9669         fi;
9670         $rm -f temp.?;;
9671 *) eval "$var=\$varval";;
9672 esac'
9673
9674 : define an is-a-typedef? function that prompts if the type is not available.
9675 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9676 case "$inclist" in
9677 "") inclist="sys/types.h";;
9678 esac;
9679 eval "varval=\$$var";
9680 case "$varval" in
9681 "")
9682         $rm -f temp.c;
9683         for inc in $inclist; do
9684                 echo "#include <$inc>" >>temp.c;
9685         done;
9686         echo "#ifdef $type" >> temp.c;
9687         echo "printf(\"We have $type\");" >> temp.c;
9688         echo "#endif" >> temp.c;
9689         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9690         echo " " ;
9691         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9692         if $contains $type temp.E >/dev/null 2>&1; then
9693                 echo "$type found." >&4;
9694                 eval "$var=\$type";
9695         else
9696                 echo "$type NOT found." >&4;
9697                 dflt="$def";
9698                 . ./myread ;
9699                 eval "$var=\$ans";
9700         fi;
9701         $rm -f temp.?;;
9702 *) eval "$var=\$varval";;
9703 esac'
9704
9705 : see what type lseek is declared as in the kernel
9706 rp="What is the type used for lseek's offset on this system?"
9707 set off_t lseektype long stdio.h sys/types.h
9708 eval $typedef_ask
9709
9710 echo " "
9711 echo "Checking to see how big your file offsets are..." >&4
9712 $cat >try.c <<EOCP
9713 #include <sys/types.h>
9714 #include <stdio.h>
9715 int main()
9716 {
9717     printf("%d\n", (int)sizeof($lseektype));
9718     return(0);
9719 }
9720 EOCP
9721 set try
9722 if eval $compile_ok; then
9723         lseeksize=`$run ./try`
9724         echo "Your file offsets are $lseeksize bytes long."
9725 else
9726         dflt=$longsize
9727         echo " "
9728         echo "(I can't seem to compile the test program.  Guessing...)"
9729         rp="What is the size of your file offsets (in bytes)?"
9730         . ./myread
9731         lseeksize="$ans"
9732 fi
9733 $rm_try
9734
9735 : see what type file positions are declared as in the library
9736 rp="What is the type for file position used by fsetpos()?"
9737 set fpos_t fpostype long stdio.h sys/types.h
9738 eval $typedef_ask
9739
9740 : Check size for Fpos_t
9741 echo " "
9742 case "$fpostype" in
9743 *_t) zzz="$fpostype"    ;;
9744 *)   zzz="fpos_t"       ;;
9745 esac
9746 echo "Checking the size of $zzz..." >&4
9747 cat > try.c <<EOCP
9748 #include <sys/types.h>
9749 #include <stdio.h>
9750 #$i_stdlib I_STDLIB
9751 #ifdef I_STDLIB
9752 #include <stdlib.h>
9753 #endif
9754 int main() {
9755     printf("%d\n", (int)sizeof($fpostype));
9756     exit(0);
9757 }
9758 EOCP
9759 set try
9760 if eval $compile_ok; then
9761         yyy=`$run ./try`
9762         case "$yyy" in
9763         '')     fpossize=4
9764                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9765                 ;;
9766         *)      fpossize=$yyy
9767                 echo "Your $zzz is $fpossize bytes long."
9768                 ;;
9769         esac
9770 else
9771         dflt="$longsize"
9772         echo " " >&4
9773         echo "(I can't compile the test program.  Guessing...)" >&4
9774         rp="What is the size of your file positions (in bytes)?"
9775         . ./myread
9776         fpossize="$ans"
9777 fi
9778
9779 : Check for large file support
9780 # Backward compatibility (uselfs is deprecated).
9781 case "$uselfs" in
9782 "$define"|true|[yY]*)
9783         cat <<EOM >&4
9784
9785 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9786 EOM
9787         uselargefiles="$define"
9788         ;;
9789 esac
9790
9791 case "$lseeksize:$fpossize" in
9792 8:8) cat <<EOM
9793
9794 You can have files larger than 2 gigabytes.
9795 EOM
9796    val="$define" ;;
9797 *)    case "$uselargefiles" in
9798    "$undef"|false|[nN]*) dflt='n' ;;
9799    *)   dflt='y' ;;
9800    esac
9801    cat <<EOM
9802
9803 Perl can be built to understand large files (files larger than 2 gigabytes)
9804 on some systems.  To do so, Configure can be run with -Duselargefiles.
9805
9806 If this doesn't make any sense to you, just accept the default '$dflt'.
9807 EOM
9808    rp='Try to understand large files, if available?'
9809    . ./myread
9810    case "$ans" in
9811    y|Y)         val="$define" ;;
9812    *)           val="$undef"  ;;
9813    esac
9814    ;;
9815 esac
9816 set uselargefiles
9817 eval $setvar
9818 : Look for a hint-file generated 'call-back-unit'.  If the
9819 : user has specified that a large files perl is to be built,
9820 : we may need to set or change some other defaults.
9821 if $test -f uselargefiles.cbu; then
9822         echo "Your platform has some specific hints regarding large file builds, using them..."
9823         . ./uselargefiles.cbu
9824 fi
9825 case "$uselargefiles" in
9826 "$define")
9827         if $test -f uselargefiles.cbu; then
9828                 echo " "
9829                 echo "Rechecking to see how big your file offsets are..." >&4
9830                 $cat >try.c <<EOCP
9831 #include <sys/types.h>
9832 #include <stdio.h>
9833 int main()
9834 {
9835     printf("%d\n", (int)sizeof($lseektype));
9836     return(0);
9837 }
9838 EOCP
9839                 set try
9840                 if eval $compile_ok; then
9841                         lseeksize=`$run ./try`
9842                         $echo "Your file offsets are now $lseeksize bytes long."
9843                 else
9844                         dflt="$lseeksize"
9845                         echo " "
9846                         echo "(I can't seem to compile the test program.  Guessing...)"
9847                         rp="What is the size of your file offsets (in bytes)?"
9848                         . ./myread
9849                         lseeksize="$ans"
9850                 fi
9851                 case "$fpostype" in
9852                 *_t) zzz="$fpostype"    ;;
9853                 *)   zzz="fpos_t"       ;;
9854                 esac
9855                 $echo $n "Rechecking the size of $zzz...$c" >&4
9856                 $cat > try.c <<EOCP
9857 #include <sys/types.h>
9858 #include <stdio.h>
9859 #$i_stdlib I_STDLIB
9860 #ifdef I_STDLIB
9861 #include <stdlib.h>
9862 #endif
9863 int main() {
9864     printf("%d\n", (int)sizeof($fpostype));
9865     return(0);
9866 }
9867 EOCP
9868                 set try
9869                 if eval $compile_ok; then
9870                         yyy=`$run ./try`
9871                         dflt="$lseeksize"
9872                         case "$yyy" in
9873                         '')     echo " "
9874                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9875                                 ;;
9876                         *)      fpossize=$yyy
9877                                 echo " $fpossize bytes." >&4
9878                                 ;;
9879                         esac
9880                 else
9881                         dflt="$fpossize"
9882                         echo " "
9883                         echo "(I can't compile the test program.  Guessing...)" >&4
9884                         rp="What is the size of your file positions (in bytes)?"
9885                         . ./myread
9886                         fpossize="$ans"
9887                 fi
9888                 $rm_try
9889         fi
9890         ;;
9891 esac
9892
9893 : Check if we want perlio
9894 useperlio="$define"
9895
9896 : Set the vendorbin variables
9897 case "$vendorprefix" in
9898 '')     d_vendorbin="$undef"
9899         vendorbin=''
9900         vendorbinexp=''
9901         ;;
9902 *)      d_vendorbin="$define"
9903         : determine where vendor-supplied executables go.
9904         case "$vendorbin" in
9905         '') dflt=$vendorprefix/bin ;;
9906         *)      dflt="$vendorbin" ;;
9907         esac
9908         fn=d~+
9909         rp='Pathname for the vendor-supplied executables directory?'
9910         . ./getfile
9911         vendorbin="$ans"
9912         vendorbinexp="$ansexp"
9913         ;;
9914 esac
9915 prefixvar=vendorbin
9916 . ./installprefix
9917
9918 : Set the vendorhtml1dir variables
9919 case "$vendorprefix" in
9920 '')     vendorhtml1dir=''
9921         vendorhtml1direxp=''
9922         ;;
9923 *)      : determine where vendor-supplied html pages go.
9924         : There is no standard location, so try to copy the previously-selected
9925         : directory structure for the core html pages.
9926         : XXX Better default suggestions would be welcome.
9927         case "$vendorhtml1dir" in
9928         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9929         *)      dflt=$vendorhtml1dir ;;
9930         esac
9931         case "$dflt" in
9932         ''|' ') dflt=none ;;
9933         esac
9934         fn=dn+~
9935         rp='Pathname for the vendor-supplied html pages?'
9936         . ./getfile
9937         vendorhtml1dir="$ans"
9938         vendorhtml1direxp="$ansexp"
9939         ;;
9940 esac
9941 : Use ' ' for none so value is preserved next time through Configure
9942 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9943 prefixvar=vendorhtml1dir
9944 . ./installprefix
9945
9946 : Set the vendorhtml3dir variables
9947 case "$vendorprefix" in
9948 '')     vendorhtml3dir=''
9949         vendorhtml3direxp=''
9950         ;;
9951 *)      : determine where vendor-supplied module html pages go.
9952         : There is no standard location, so try to copy the previously-selected
9953         : directory structure for the core html pages.
9954         : XXX Better default suggestions would be welcome.
9955         case "$vendorhtml3dir" in
9956         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9957         *)      dflt=$vendorhtml3dir ;;
9958         esac
9959         case "$dflt" in
9960         ''|' ') dflt=none ;;
9961         esac
9962         fn=dn+~
9963         rp='Pathname for the vendor-supplied html pages?'
9964         . ./getfile
9965         vendorhtml3dir="$ans"
9966         vendorhtml3direxp="$ansexp"
9967         ;;
9968 esac
9969 : Use ' ' for none so value is preserved next time through Configure
9970 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9971 prefixvar=vendorhtml3dir
9972 . ./installprefix
9973
9974 : Set the vendorman1dir variables
9975 case "$vendorprefix" in
9976 '')     vendorman1dir=''
9977         vendorman1direxp=''
9978         ;;
9979 *)      : determine where vendor-supplied manual pages go.
9980         case "$vendorman1dir" in
9981         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9982         *)      dflt=$vendorman1dir ;;
9983         esac
9984         case "$dflt" in
9985         ''|' ') dflt=none ;;
9986         esac
9987         fn=nd~+
9988         rp='Pathname for the vendor-supplied manual section 1 pages?'
9989         . ./getfile
9990         vendorman1dir="$ans"
9991         vendorman1direxp="$ansexp"
9992         ;;
9993 esac
9994 : Use ' ' for none so value is preserved next time through Configure
9995 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9996 prefixvar=vendorman1dir
9997 . ./installprefix
9998
9999 : Set the vendorman3dir variables
10000 case "$vendorprefix" in
10001 '')     vendorman3dir=''
10002         vendorman3direxp=''
10003         ;;
10004 *)      : determine where vendor-supplied module manual pages go.
10005         case "$vendorman3dir" in
10006         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10007         *)      dflt=$vendorman3dir ;;
10008         esac
10009         case "$dflt" in
10010         ''|' ') dflt=none ;;
10011         esac
10012         fn=nd~+
10013         rp='Pathname for the vendor-supplied manual section 3 pages?'
10014         . ./getfile
10015         vendorman3dir="$ans"
10016         vendorman3direxp="$ansexp"
10017         ;;
10018 esac
10019 : Use ' ' for none so value is preserved next time through Configure
10020 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10021 prefixvar=vendorman3dir
10022 . ./installprefix
10023
10024 : Set the vendorscript variables
10025 case "$vendorprefix" in
10026 '')     d_vendorscript="$undef"
10027         vendorscript=''
10028         vendorscriptexp=''
10029         ;;
10030 *)      d_vendorscript="$define"
10031         : determine where vendor-supplied scripts go.
10032         case "$vendorscript" in
10033         '')     dflt=$vendorprefix/script
10034                 $test -d $dflt || dflt=$vendorbin ;;
10035         *)  dflt="$vendorscript" ;;
10036         esac
10037         $cat <<EOM
10038
10039 The installation process will create a directory for
10040 vendor-supplied scripts.
10041
10042 EOM
10043         fn=d~+
10044         rp='Pathname for the vendor-supplied scripts directory?'
10045         . ./getfile
10046         vendorscript="$ans"
10047         vendorscriptexp="$ansexp"
10048         ;;
10049 esac
10050 prefixvar=vendorscript
10051 . ./installprefix
10052
10053 : see if qgcvt exists
10054 set qgcvt d_qgcvt
10055 eval $inlibc
10056
10057 : Check what kind of doubles your system has
10058 $echo "Checking the kind of doubles you have..." >&4
10059 $cat >try.c <<EOP
10060 #$i_stdlib I_STDLIB
10061 #define DOUBLESIZE $doublesize
10062 #ifdef I_STDLIB
10063 #include <stdlib.h>
10064 #endif
10065 #include <stdio.h>
10066 static const double d = -0.1;
10067 int main() {
10068   unsigned const char* b = (unsigned const char*)(&d);
10069 #if DOUBLESIZE == 4
10070   if (b[0] == 0xCD && b[3] == 0xBD) {
10071     /* IEEE 754 32-bit little-endian */
10072     printf("1\n");
10073     exit(0);
10074   }
10075   if (b[0] == 0xBD && b[3] == 0xCD) {
10076     /* IEEE 754 32-bit big-endian */
10077     printf("2\n");
10078     exit(0);
10079   }
10080   if (b[0] == 0xCC && b[3] == 0xCC) {
10081     /* VAX format F, 32-bit PDP-style mixed endian. */
10082     printf("9\n");
10083     exit(0);
10084   }
10085   if (b[0] == 0xC0 && b[3] == 0x9A) {
10086     /* IBM single 32-bit */
10087     printf("12\n");
10088     exit(0);
10089   }
10090 #endif
10091 #if DOUBLESIZE == 8
10092   if (b[0] == 0x9A && b[7] == 0xBF) {
10093     /* IEEE 754 64-bit little-endian */
10094     printf("3\n");
10095     exit(0);
10096   }
10097   if (b[0] == 0xBF && b[7] == 0x9A) {
10098     /* IEEE 754 64-bit big-endian */
10099     printf("4\n");
10100     exit(0);
10101   }
10102   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10103    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10104     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10105     * 99 99 b9 bf 9a 99 99 99 */
10106     printf("7\n");
10107     exit(0);
10108   }
10109   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10110    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10111     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10112     * 99 99 99 9a bf b9 99 99 */
10113     printf("8\n");
10114     exit(0);
10115   }
10116   if (b[0] == 0xCC && b[7] == 0xCC) {
10117    /* VAX format D, 64-bit PDP-style mixed endian. */
10118     printf("10\n");
10119     exit(0);
10120   }
10121   if (b[0] == 0xD9 && b[7] == 0x99) {
10122    /* VAX format G, 64-bit PDP-style mixed endian. */
10123     printf("11\n");
10124     exit(0);
10125   }
10126   if (b[0] == 0xC0 && b[7] == 0x9A) {
10127     /* IBM double 64-bit */
10128     printf("13\n");
10129     exit(0);
10130   }
10131   if (b[0] == 0xBF && b[7] == 0xCD) {
10132     /* CRAY single 64-bit */
10133     printf("14\n");
10134     exit(0);
10135   }
10136 #endif
10137 #if DOUBLESIZE == 16
10138   if (b[0] == 0x9A && b[15] == 0xBF) {
10139     /* IEEE 754 128-bit little-endian */
10140     printf("5\n");
10141     exit(0);
10142   }
10143   if (b[0] == 0xBF && b[15] == 0x9A) {
10144     /* IEEE 754 128-bit big-endian */
10145     printf("6\n");
10146     exit(0);
10147   }
10148 #endif
10149   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10150    * Whether those environments can still build Perl is debatable. */
10151   printf("-1\n"); /* unknown */
10152   exit(0);
10153 }
10154 EOP
10155 set try
10156 if eval $compile; then
10157     doublekind=`$run ./try`
10158 else
10159     doublekind=-1
10160 fi
10161 case "$doublekind" in
10162 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10163 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10164 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10165 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10166 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10167 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10168 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10169 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10170 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10171 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10172 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10173 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10174 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10175 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10176 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10177 esac
10178 d_double_style_ieee=$undef
10179 d_double_style_vax=$undef
10180 d_double_style_ibm=$undef
10181 d_double_style_cray=$undef
10182 case "$doublekind" in
10183 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10184 9|10|11) d_double_style_vax=$define ;;
10185 12|13) d_double_style_ibm=$define ;;
10186 14) d_double_style_cray=$define ;;
10187 esac
10188 case "$d_double_style_ieee" in
10189 $define)
10190     d_double_has_inf=$define
10191     d_double_has_nan=$define
10192     d_double_has_negative_zero=$define
10193     d_double_has_subnormals=$define
10194     ;;
10195 *)
10196     d_double_has_inf=$undef
10197     d_double_has_nan=$undef
10198     d_double_has_negative_zero=$undef
10199     d_double_has_subnormals=$undef
10200     ;;
10201 esac
10202 $rm_try
10203
10204 : Check print/scan long double stuff
10205 echo " "
10206
10207 if $test X"$d_longdbl" = X"$define"; then
10208
10209 echo "Checking how to print long doubles..." >&4
10210
10211 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10212         $cat >try.c <<'EOCP'
10213 #include <sys/types.h>
10214 #include <stdio.h>
10215 int main() {
10216   double d = 123.456;
10217   printf("%.3f\n", d);
10218 }
10219 EOCP
10220         set try
10221         if eval $compile; then
10222                 yyy=`$run ./try`
10223                 case "$yyy" in
10224                 123.456)
10225                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10226                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10227                         echo "We will use %f."
10228                         ;;
10229                 esac
10230         fi
10231 fi
10232
10233 if $test X"$sPRIfldbl" = X; then
10234         $cat >try.c <<'EOCP'
10235 #include <sys/types.h>
10236 #include <stdio.h>
10237 int main() {
10238   long double d = 123.456;
10239   printf("%.3Lf\n", d);
10240 }
10241 EOCP
10242         set try
10243         if eval $compile; then
10244                 yyy=`$run ./try`
10245                 case "$yyy" in
10246                 123.456)
10247                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10248                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10249                         echo "We will use %Lf."
10250                         ;;
10251                 esac
10252         fi
10253 fi
10254
10255 if $test X"$sPRIfldbl" = X; then
10256         $cat >try.c <<'EOCP'
10257 #include <sys/types.h>
10258 #include <stdio.h>
10259 int main() {
10260   long double d = 123.456;
10261   printf("%.3llf\n", d);
10262 }
10263 EOCP
10264         set try
10265         if eval $compile; then
10266                 yyy=`$run ./try`
10267                 case "$yyy" in
10268                 123.456)
10269                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10270                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10271                         echo "We will use %llf."
10272                         ;;
10273                 esac
10274         fi
10275 fi
10276
10277 if $test X"$sPRIfldbl" = X; then
10278         $cat >try.c <<'EOCP'
10279 #include <sys/types.h>
10280 #include <stdio.h>
10281 int main() {
10282   long double d = 123.456;
10283   printf("%.3lf\n", d);
10284 }
10285 EOCP
10286         set try
10287         if eval $compile; then
10288                 yyy=`$run ./try`
10289                 case "$yyy" in
10290                 123.456)
10291                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10292                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10293                         echo "We will use %lf."
10294                         ;;
10295                 esac
10296         fi
10297 fi
10298
10299 if $test X"$sPRIfldbl" = X; then
10300         echo "Cannot figure out how to print long doubles." >&4
10301 else
10302         sSCNfldbl=$sPRIfldbl    # expect consistency
10303 fi
10304
10305 $rm_try
10306
10307 fi # d_longdbl
10308
10309 case "$sPRIfldbl" in
10310 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10311         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10312         d_SCNfldbl="$undef";
10313         ;;
10314 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10315         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10316         d_SCNfldbl="$define";
10317         ;;
10318 esac
10319
10320 : Before committing on uselongdouble, see whether that looks sane.
10321 if $test "$uselongdouble" = "$define"; then
10322     message=""
10323     echo " "
10324     echo "Checking if your long double math functions work right..." >&4
10325     $cat > try.c <<EOF
10326 #include <math.h>
10327 #include <stdio.h>
10328 int main() {
10329   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10330 }
10331 EOF
10332     case "$osname:$gccversion" in
10333     aix:)       saveccflags="$ccflags"
10334                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10335     esac
10336     set try
10337     if eval $compile_ok; then
10338       yyy=`$run ./try`
10339     fi
10340     case "$yyy" in
10341     3) echo "Your long double math functions are working correctly." >&4 ;;
10342     *) echo "Your long double math functions are broken, not using long doubles." >&4
10343        uselongdouble=$undef
10344        ;;
10345     esac
10346     $rm_try
10347     case "$osname:$gccversion" in
10348     aix:)       ccflags="$saveccflags" ;; # restore
10349     esac
10350 fi
10351
10352 : Check how to convert floats to strings.
10353
10354 if test "X$d_Gconvert" = X; then
10355
10356 echo " "
10357 echo "Checking for an efficient way to convert floats to strings."
10358 echo " " > try.c
10359 case "$uselongdouble" in
10360 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10361 esac
10362 case "$d_longdbl" in
10363 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10364 esac
10365 case "$d_PRIgldbl" in
10366 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10367 esac
10368 $cat >>try.c <<EOP
10369 #ifdef TRY_gconvert
10370 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10371 char *myname = "gconvert";
10372 #endif
10373 #ifdef TRY_gcvt
10374 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10375 char *myname = "gcvt";
10376 #endif
10377 #ifdef TRY_qgcvt
10378 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10379 char *myname = "qgcvt";
10380 #define DOUBLETYPE long double
10381 #endif
10382 #ifdef TRY_sprintf
10383 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10384 #ifdef HAS_PRIgldbl
10385 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10386 #else
10387 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10388 #endif
10389 #else
10390 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10391 #endif
10392 char *myname = "sprintf";
10393 #endif
10394
10395 #ifndef DOUBLETYPE
10396 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10397 #define DOUBLETYPE long double
10398 #else
10399 #define DOUBLETYPE double
10400 #endif
10401 #endif
10402
10403 #include <stdio.h>
10404
10405 #$i_stdlib I_STDLIB
10406 #ifdef I_STDLIB
10407 #include <stdlib.h>
10408 #endif
10409 #include <string.h>
10410
10411 int checkit(char *expect, char *got)
10412 {
10413     if (strcmp(expect, got)) {
10414                 printf("%s oddity:  Expected %s, got %s\n",
10415                         myname, expect, got);
10416                 exit(1);
10417         }
10418 }
10419
10420 int main()
10421 {
10422         char buf[64];
10423         buf[63] = '\0';
10424
10425         /* This must be 1st test on (which?) platform */
10426         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10427         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10428         checkit("0.1", buf);
10429
10430         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10431         checkit("0.01", buf);
10432
10433         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10434         checkit("0.001", buf);
10435
10436         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10437         checkit("0.0001", buf);
10438
10439         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10440         if (strlen(buf) > 5)
10441             checkit("9e-005", buf); /* for Microsoft ?? */
10442         else
10443             checkit("9e-05", buf);
10444
10445         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10446         checkit("1", buf);
10447
10448         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10449         checkit("1.1", buf);
10450
10451         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10452         checkit("1.01", buf);
10453
10454         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10455         checkit("1.001", buf);
10456
10457         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10458         checkit("1.0001", buf);
10459
10460         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10461         checkit("1.00001", buf);
10462
10463         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10464         checkit("1.000001", buf);
10465
10466         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10467         checkit("0", buf);
10468
10469         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10470         checkit("-1", buf);
10471
10472         /* Some Linux gcvt's give 1.e+5 here. */
10473         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10474         checkit("100000", buf);
10475
10476         /* Some Linux gcvt's give -1.e+5 here. */
10477         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10478         checkit("-100000", buf);
10479
10480         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10481         checkit("123.456", buf);
10482
10483         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10484         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10485         /* 34 should be enough to scare even long double
10486          * places into using the e notation. */
10487         if (strlen(buf) > 5)
10488             checkit("1e+034", buf); /* for Microsoft */
10489         else
10490             checkit("1e+34", buf);
10491
10492         /* For Perl, if you add additional tests here, also add them to
10493          * t/base/num.t for benefit of platforms not using Configure or
10494          * overriding d_Gconvert */
10495
10496         exit(0);
10497 }
10498 EOP
10499 : first add preferred functions to our list
10500 xxx_list=""
10501 for xxx_convert in $gconvert_preference; do
10502     case $xxx_convert in
10503     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10504     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10505     esac
10506 done
10507 : then add any others
10508 for xxx_convert in gconvert gcvt sprintf; do
10509     case "$xxx_list" in
10510     *$xxx_convert*) ;;
10511     *) xxx_list="$xxx_list $xxx_convert" ;;
10512     esac
10513 done
10514
10515 case "$d_longdbl$uselongdouble" in
10516 "$define$define")
10517     : again, add preferred functions to our list first
10518     xxx_ld_list=""
10519     for xxx_convert in $gconvert_ld_preference; do
10520         case $xxx_convert in
10521         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10522         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10523         esac
10524     done
10525     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10526     for xxx_convert in qgcvt sprintf $xxx_list; do
10527         case "$xxx_ld_list" in
10528         $xxx_convert*|*" $xxx_convert"*) ;;
10529         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10530         esac
10531     done
10532     : if sprintf cannot do long doubles, move it to the end
10533     if test "$d_PRIgldbl" != "$define"; then
10534         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10535     fi
10536     : if no qgcvt, remove it
10537     if test "$d_qgcvt" != "$define"; then
10538         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10539     fi
10540     : use the ld_list
10541     xxx_list="$xxx_ld_list"
10542     ;;
10543 esac
10544
10545 for xxx_convert in $xxx_list; do
10546         echo "Trying $xxx_convert..."
10547         $rm -f try try$_o core
10548         set try -DTRY_$xxx_convert
10549         if eval $compile; then
10550                 echo "$xxx_convert() found." >&4
10551                 if $run ./try; then
10552                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10553                         break;
10554                 else
10555                         echo "...But $xxx_convert didn't work as I expected."
10556                         xxx_convert=''
10557                 fi
10558         else
10559                 echo "$xxx_convert NOT found." >&4
10560         fi
10561 done
10562
10563 if test X$xxx_convert = X; then
10564     echo "*** WHOA THERE!!! ***" >&4
10565     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10566     xxx_convert=sprintf
10567 fi
10568
10569 case "$xxx_convert" in
10570 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10571 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10572 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10573 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10574    "$define$define$define")
10575       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10576    "$define$define$undef")
10577       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10578    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10579    esac
10580    ;;
10581 esac
10582
10583 fi
10584 $rm_try
10585
10586 : see if _fwalk exists
10587 set fwalk d__fwalk
10588 eval $inlibc
10589
10590 : see if accept4 exists
10591 set accept4 d_accept4
10592 eval $inlibc
10593
10594 : Initialize h_fcntl
10595 h_fcntl=false
10596
10597 : Initialize h_sysfile
10598 h_sysfile=false
10599
10600 : access call always available on UNIX
10601 set access d_access
10602 eval $inlibc
10603
10604 : locate the flags for 'access()'
10605 case "$d_access" in
10606 "$define")
10607         echo " "
10608         $cat >access.c <<EOCP
10609 #include <sys/types.h>
10610 #ifdef I_FCNTL
10611 #include <fcntl.h>
10612 #endif
10613 #ifdef I_SYS_FILE
10614 #include <sys/file.h>
10615 #endif
10616 #ifdef I_UNISTD
10617 #include <unistd.h>
10618 #endif
10619 #$i_stdlib I_STDLIB
10620 #ifdef I_STDLIB
10621 #include <stdlib.h>
10622 #endif
10623 int main() {
10624         exit(R_OK);
10625 }
10626 EOCP
10627         : check sys/file.h first, no particular reason here
10628         if $test `./findhdr sys/file.h` && \
10629                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10630                 h_sysfile=true;
10631                 echo "<sys/file.h> defines the *_OK access constants." >&4
10632         elif $test `./findhdr fcntl.h` && \
10633                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10634                 h_fcntl=true;
10635                 echo "<fcntl.h> defines the *_OK access constants." >&4
10636         elif $test `./findhdr unistd.h` && \
10637                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10638                 echo "<unistd.h> defines the *_OK access constants." >&4
10639         else
10640                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10641         fi
10642         ;;
10643 esac
10644 $rm -f access*
10645
10646 : see if accessx exists
10647 set accessx d_accessx
10648 eval $inlibc
10649
10650 : see if acosh exists
10651 set acosh d_acosh
10652 eval $inlibc
10653
10654 : see if aintl exists
10655 set aintl d_aintl
10656 eval $inlibc
10657
10658 : see if alarm exists
10659 set alarm d_alarm
10660 eval $inlibc
10661
10662 : see if 64bit time functions exists
10663
10664 set ctime64 d_ctime64
10665 eval $inlibc
10666
10667 set localtime64 d_localtime64
10668 eval $inlibc
10669
10670 set gmtime64 d_gmtime64
10671 eval $inlibc
10672
10673 set mktime64 d_mktime64
10674 eval $inlibc
10675
10676 set difftime64 d_difftime64
10677 eval $inlibc
10678
10679 set asctime64 d_asctime64
10680 eval $inlibc
10681
10682 : see if POSIX threads are available
10683 set pthread.h i_pthread
10684 eval $inhdr
10685
10686 : define a function to check prototypes
10687 $cat > protochk <<EOSH
10688 $startsh
10689 cc="$cc"
10690 optimize="$optimize"
10691 ccflags="$ccflags"
10692 define="$define"
10693 rm_try="$rm_try"
10694 usethreads=$usethreads
10695 i_pthread=$i_pthread
10696 pthread_h_first=$pthread_h_first
10697 EOSH
10698
10699 $cat >> protochk <<'EOSH'
10700
10701 $rm_try
10702 foo="$1"
10703 shift
10704 while test $# -ge 2; do
10705         case "$1" in
10706                 $define) echo "#include <$2>" >> try.c ;;
10707                 literal) echo "$2" >> try.c ;;
10708         esac
10709     # Extra magic for the benefit of systems that need pthread.h
10710     # to be included early to correctly detect threadsafe functions.
10711     # Such functions must guarantee themselves, though, that the usethreads
10712     # and i_pthread have been defined, before calling protochk.
10713     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10714         echo "#include <pthread.h>" >> try.c
10715         pthread_h_done=yes
10716     fi
10717     shift 2
10718 done
10719 cat >> try.c <<'EOCP'
10720 #define _(args) args
10721 EOCP
10722 echo "$foo" >> try.c
10723 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10724 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10725 status=$?
10726 $rm_try
10727 exit $status
10728 EOSH
10729 chmod +x protochk
10730 $eunicefix protochk
10731
10732 : Define hasproto macro for Configure internal use
10733 hasproto='varname=$1; func=$2; shift; shift;
10734 while $test $# -ge 2; do
10735         case "$1" in
10736         $define) echo "#include <$2>";;
10737         esac ;
10738     shift 2;
10739 done > try.c;
10740 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10741 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10742         echo "$func() prototype found.";
10743         val="$define";
10744 else
10745         echo "$func() prototype NOT found.";
10746         val="$undef";
10747 fi;
10748 set $varname;
10749 eval $setvar;
10750 $rm_try tryout.c'
10751
10752 : see if sys/types.h has to be included
10753 set sys/types.h i_systypes
10754 eval $inhdr
10755
10756 : see if sys/select.h has to be included
10757 set sys/select.h i_sysselct
10758 eval $inhdr
10759
10760 : Define hasfield macro for Configure internal use
10761 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10762 while $test $# -ge 2; do
10763         case "$1" in
10764         $define) echo "#include <$2>";;
10765         esac ;
10766     shift 2;
10767 done > try.c;
10768 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10769 set try;
10770 if eval $compile; then
10771         val="$define";
10772 else
10773         val="$undef";
10774 fi;
10775 set $varname;
10776 eval $setvar;
10777 $rm_try'
10778
10779 : see if we should include sys/time.h
10780 echo " "
10781 i_time='define'
10782 if test "X$timeincl" = X; then
10783         echo "Testing to see if we should include <sys/time.h>." >&4
10784         $echo $n "I'm now running the test program...$c"
10785         $cat >try.c <<EOCP
10786 #include <sys/types.h>
10787 #include <time.h>
10788 #ifdef I_SYSTIME
10789 #ifdef SYSTIMEKERNEL
10790 #define KERNEL
10791 #endif
10792 #include <sys/time.h>
10793 #endif
10794 #ifdef I_SYSSELECT
10795 #include <sys/select.h>
10796 #endif
10797 #$i_stdlib I_STDLIB
10798 #ifdef I_STDLIB
10799 #include <stdlib.h>
10800 #endif
10801 int main()
10802 {
10803         struct tm foo;
10804 #ifdef S_TIMEVAL
10805         struct timeval bar;
10806 #endif
10807 #ifdef S_TIMEZONE
10808         struct timezone tzp;
10809 #endif
10810         if (foo.tm_sec == foo.tm_sec)
10811                 exit(0);
10812 #ifdef S_TIMEVAL
10813         if (bar.tv_sec == bar.tv_sec)
10814                 exit(0);
10815 #endif
10816         exit(1);
10817 }
10818 EOCP
10819         flags=''
10820         for s_timezone in '-DS_TIMEZONE' ''; do
10821         sysselect=''
10822         for s_timeval in '-DS_TIMEVAL' ''; do
10823         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10824         for i_systime in '-DI_SYSTIME' ''; do
10825                 case "$flags" in
10826                 '') $echo $n ".$c"
10827                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10828                         if eval $compile; then
10829                                 set X $i_systime $i_systimek $sysselect $s_timeval
10830                                 shift
10831                                 flags="$*"
10832                                 echo " "
10833                                 $echo $n "Succeeded with $flags$c"
10834                         fi
10835                         ;;
10836                 esac
10837         done
10838         done
10839         done
10840         done
10841         timeincl=''
10842         echo " "
10843         case "$flags" in
10844         *SYSTIMEKERNEL*) i_systimek="$define"
10845                 timeincl=`./findhdr sys/time.h`
10846                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10847         *) i_systimek="$undef";;
10848         esac
10849         case "$flags" in
10850         *I_SYSTIME*) i_systime="$define"
10851                 timeincl=`./findhdr sys/time.h`" $timeincl"
10852                 echo "We'll include <sys/time.h>." >&4;;
10853         *) i_systime="$undef";;
10854         esac
10855         $rm_try
10856 fi
10857 : see if struct tm knows about tm_zone
10858 case "$i_systime$i_time" in
10859 *$define*)
10860         echo " "
10861         echo "Checking to see if your struct tm has tm_zone field..." >&4
10862         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10863         eval $hasfield
10864         ;;
10865 *)      val="$undef"
10866         set d_tm_tm_zone
10867         eval $setvar
10868         ;;
10869 esac
10870 case "$d_tm_tm_zone" in
10871 "$define")      echo "Yes, it does."   ;;
10872 *)              echo "No, it doesn't." ;;
10873 esac
10874 : see if struct tm knows about tm_gmtoff
10875 case "$i_systime$i_time" in
10876 *$define*)
10877         echo " "
10878         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10879         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10880         eval $hasfield
10881         ;;
10882 *)      val="$undef"
10883         set d_tm_tm_gmtoff
10884         eval $setvar
10885         ;;
10886 esac
10887 case "$d_tm_tm_gmtoff" in
10888 "$define")      echo "Yes, it does."   ;;
10889 *)              echo "No, it doesn't." ;;
10890 esac
10891
10892 : see if asctime_r exists
10893 set asctime_r d_asctime_r
10894 eval $inlibc
10895 case "$d_asctime_r" in
10896 "$define")
10897         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10898         case "$d_asctime_r_proto:$usethreads" in
10899         ":define")      d_asctime_r_proto=define
10900                 set d_asctime_r_proto asctime_r $hdrs
10901                 eval $hasproto ;;
10902         *)      ;;
10903         esac
10904         case "$d_asctime_r_proto" in
10905         define)
10906         case "$asctime_r_proto" in
10907         ''|0) try='char* asctime_r(const struct tm*, char*);'
10908         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10909         esac
10910         case "$asctime_r_proto" in
10911         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10912         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10913         esac
10914         case "$asctime_r_proto" in
10915         ''|0) try='int asctime_r(const struct tm*, char*);'
10916         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10917         esac
10918         case "$asctime_r_proto" in
10919         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10920         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10921         esac
10922         case "$asctime_r_proto" in
10923         ''|0)   d_asctime_r=undef
10924                 asctime_r_proto=0
10925                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10926         * )     case "$asctime_r_proto" in
10927                 REENTRANT_PROTO*) ;;
10928                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10929                 esac
10930                 echo "Prototype: $try" ;;
10931         esac
10932         ;;
10933         *)      case "$usethreads" in
10934                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10935                 esac
10936                 d_asctime_r=undef
10937                 asctime_r_proto=0
10938                 ;;
10939         esac
10940         ;;
10941 *)      asctime_r_proto=0
10942         ;;
10943 esac
10944
10945 : see if asinh exists
10946 set asinh d_asinh
10947 eval $inlibc
10948
10949 : see if atanh exists
10950 set atanh d_atanh
10951 eval $inlibc
10952
10953 : see if atolf exists
10954 set atolf d_atolf
10955 eval $inlibc
10956
10957 : see if atoll exists
10958 set atoll d_atoll
10959 eval $inlibc
10960
10961 : Look for GCC-style attribute format
10962 case "$d_attribute_format" in
10963 '')
10964 echo " "
10965 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10966 $cat >attrib.c <<'EOCP'
10967 #include <stdio.h>
10968 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10969 EOCP
10970 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10971         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10972                 echo "Your C compiler doesn't support __attribute__((format))."
10973                 val="$undef"
10974         else
10975                 echo "Your C compiler supports __attribute__((format))."
10976                 val="$define"
10977         fi
10978 else
10979         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10980         val="$undef"
10981 fi
10982 ;;
10983 *) val="$d_attribute_format" ;;
10984 esac
10985 set d_attribute_format
10986 eval $setvar
10987 $rm -f attrib*
10988
10989 : Look for GCC-style attribute format with null format allowed
10990 case "$d_printf_format_null" in
10991 '') case "$d_attribute_format" in
10992     $define)
10993         echo " "
10994         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10995 $cat >attrib.c <<EOCP
10996 #include <stdio.h>
10997 #$i_stdlib I_STDLIB
10998 #ifdef I_STDLIB
10999 #include <stdlib.h>
11000 #endif
11001 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11002 int null_printf (char* pat,...) { return (int)pat; }
11003 int main () { exit(null_printf(NULL)); }
11004 EOCP
11005         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11006             : run the executable in case it produces a run-time warning
11007             if $run ./attrib >>attrib.out 2>&1; then
11008                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11009                     echo "Your C compiler doesn't allow __printf__ format to be null."
11010                     val="$undef"
11011                 else
11012                     echo "Your C compiler allows __printf__ format to be null."
11013                     val="$define"
11014                 fi
11015             else
11016             echo "Your C compiler executable failed with __printf__ format null."
11017             val="$undef"
11018         fi
11019     else
11020         echo "Your C compiler fails with __printf__ format null."
11021         val="$undef"
11022     fi
11023     ;;
11024     *)  val="$undef" ;;
11025     esac
11026 ;;
11027 *)  val="$d_printf_format_null" ;;
11028 esac
11029 set d_printf_format_null
11030 eval $setvar
11031 $rm -f attrib*
11032
11033 : Look for GCC-style attribute malloc
11034 case "$d_attribute_malloc" in
11035 '')
11036 echo " "
11037 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11038 $cat >attrib.c <<'EOCP'
11039 #include <stdio.h>
11040 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11041 EOCP
11042 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11043         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11044                 echo "Your C compiler doesn't support __attribute__((malloc))."
11045                 val="$undef"
11046         else
11047                 echo "Your C compiler supports __attribute__((malloc))."
11048                 val="$define"
11049         fi
11050 else
11051         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11052         val="$undef"
11053 fi
11054 ;;
11055 *) val="$d_attribute_malloc" ;;
11056 esac
11057 set d_attribute_malloc
11058 eval $setvar
11059 $rm -f attrib*
11060
11061 : Look for GCC-style attribute nonnull
11062 case "$d_attribute_nonnull" in
11063 '')
11064 echo " "
11065 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11066 $cat >attrib.c <<'EOCP'
11067 #include <stdio.h>
11068 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11069 EOCP
11070 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11071         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11072                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11073                 val="$undef"
11074         else
11075                 echo "Your C compiler supports __attribute__((nonnull))."
11076                 val="$define"
11077         fi
11078 else
11079         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11080         val="$undef"
11081 fi
11082 ;;
11083 *) val="$d_attribute_nonnull" ;;
11084 esac
11085 set d_attribute_nonnull
11086 eval $setvar
11087 $rm -f attrib*
11088
11089 : Look for GCC-style attribute noreturn
11090 case "$d_attribute_noreturn" in
11091 '')
11092 echo " "
11093 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11094 $cat >attrib.c <<'EOCP'
11095 #include <stdio.h>
11096 void fall_over_dead( void ) __attribute__((noreturn));
11097 EOCP
11098 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11099         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11100                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11101                 val="$undef"
11102         else
11103                 echo "Your C compiler supports __attribute__((noreturn))."
11104                 val="$define"
11105         fi
11106 else
11107         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11108         val="$undef"
11109 fi
11110 ;;
11111 *) val="$d_attribute_noreturn" ;;
11112 esac
11113 set d_attribute_noreturn
11114 eval $setvar
11115 $rm -f attrib*
11116
11117 : Look for GCC-style attribute pure
11118 case "$d_attribute_pure" in
11119 '')
11120 echo " "
11121 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11122 $cat >attrib.c <<'EOCP'
11123 #include <stdio.h>
11124 int square( int n ) __attribute__((pure));
11125 EOCP
11126 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11127         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11128                 echo "Your C compiler doesn't support __attribute__((pure))."
11129                 val="$undef"
11130         else
11131                 echo "Your C compiler supports __attribute__((pure))."
11132                 val="$define"
11133         fi
11134 else
11135         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11136         val="$undef"
11137 fi
11138 ;;
11139 *) val="$d_attribute_pure" ;;
11140 esac
11141 set d_attribute_pure
11142 eval $setvar
11143 $rm -f attrib*
11144
11145 : Look for GCC-style attribute unused
11146 case "$d_attribute_unused" in
11147 '')
11148 echo " "
11149 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11150 $cat >attrib.c <<'EOCP'
11151 #include <stdio.h>
11152 int do_something( int dummy __attribute__((unused)), int n );
11153 EOCP
11154 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11155         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11156                 echo "Your C compiler doesn't support __attribute__((unused))."
11157                 val="$undef"
11158         else
11159                 echo "Your C compiler supports __attribute__((unused))."
11160                 val="$define"
11161         fi
11162 else
11163         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11164         val="$undef"
11165 fi
11166 ;;
11167 *) val="$d_attribute_unused" ;;
11168 esac
11169 set d_attribute_unused
11170 eval $setvar
11171 $rm -f attrib*
11172
11173 : Look for GCC-style attribute deprecated
11174 case "$d_attribute_deprecated" in
11175 '')
11176 echo " "
11177 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11178 $cat >attrib.c <<'EOCP'
11179 #include <stdio.h>
11180 int I_am_deprecated(void) __attribute__((deprecated));
11181 EOCP
11182 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11183         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11184                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11185                 val="$undef"
11186         else
11187                 echo "Your C compiler supports __attribute__((deprecated))."
11188                 val="$define"
11189         fi
11190 else
11191         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11192         val="$undef"
11193 fi
11194 ;;
11195 *) val="$d_attribute_deprecated" ;;
11196 esac
11197 set d_attribute_deprecated
11198 eval $setvar
11199 $rm -f attrib*
11200
11201 : Look for GCC-style attribute warn_unused_result
11202 case "$d_attribute_warn_unused_result" in
11203 '')
11204 echo " "
11205 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11206 $cat >attrib.c <<'EOCP'
11207 #include <stdio.h>
11208 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11209 EOCP
11210 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11211         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11212                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11213                 val="$undef"
11214         else
11215                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11216                 val="$define"
11217         fi
11218 else
11219         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11220         val="$undef"
11221 fi
11222 ;;
11223 *) val="$d_attribute_warn_unused_result" ;;
11224 esac
11225 set d_attribute_warn_unused_result
11226 eval $setvar
11227 $rm -f attrib*
11228
11229 : see if getpgrp exists
11230 set getpgrp d_getpgrp
11231 eval $inlibc
11232
11233 case "$d_getpgrp" in
11234 "$define")
11235         echo " "
11236         echo "Checking to see which flavor of getpgrp is in use..."
11237         $cat >try.c <<EOP
11238 #$i_unistd I_UNISTD
11239 #include <sys/types.h>
11240 #ifdef I_UNISTD
11241 #  include <unistd.h>
11242 #endif
11243 #$i_stdlib I_STDLIB
11244 #ifdef I_STDLIB
11245 #include <stdlib.h>
11246 #endif
11247 int main()
11248 {
11249         if (getuid() == 0) {
11250                 printf("(I see you are running Configure as super-user...)\n");
11251                 setuid(1);
11252         }
11253 #ifdef TRY_BSD_PGRP
11254         if (getpgrp(1) == 0)
11255                 exit(0);
11256 #else
11257         if (getpgrp() > 0)
11258                 exit(0);
11259 #endif
11260         exit(1);
11261 }
11262 EOP
11263         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11264                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11265                 val="$define"
11266         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11267                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11268                 val="$undef"
11269         else
11270                 echo "I can't seem to compile and run the test program."
11271                 if ./usg; then
11272                         xxx="a USG one, i.e. you use getpgrp()."
11273                 else
11274                         # SVR4 systems can appear rather BSD-ish.
11275                         case "$i_unistd" in
11276                         $undef)
11277                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11278                                 val="$define"
11279                                 ;;
11280                         $define)
11281                                 xxx="probably a USG one, i.e. you use getpgrp()."
11282                                 val="$undef"
11283                                 ;;
11284                         esac
11285                 fi
11286                 echo "Assuming your getpgrp is $xxx" >&4
11287         fi
11288         ;;
11289 *) val="$undef";;
11290 esac
11291 set d_bsdgetpgrp
11292 eval $setvar
11293 $rm_try
11294
11295 : see if setpgrp exists
11296 set setpgrp d_setpgrp
11297 eval $inlibc
11298
11299 case "$d_setpgrp" in
11300 "$define")
11301         echo " "
11302         echo "Checking to see which flavor of setpgrp is in use..."
11303         $cat >try.c <<EOP
11304 #$i_unistd I_UNISTD
11305 #include <sys/types.h>
11306 #ifdef I_UNISTD
11307 #  include <unistd.h>
11308 #endif
11309 #$i_stdlib I_STDLIB
11310 #ifdef I_STDLIB
11311 #include <stdlib.h>
11312 #endif
11313 int main()
11314 {
11315         if (getuid() == 0) {
11316                 printf("(I see you are running Configure as super-user...)\n");
11317                 setuid(1);
11318         }
11319 #ifdef TRY_BSD_PGRP
11320         if (-1 == setpgrp(1, 1))
11321                 exit(0);
11322 #else
11323         if (setpgrp() != -1)
11324                 exit(0);
11325 #endif
11326         exit(1);
11327 }
11328 EOP
11329         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11330                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11331                 val="$define"
11332         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11333                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11334                 val="$undef"
11335         else
11336                 echo "(I can't seem to compile and run the test program.)"
11337                 if ./usg; then
11338                         xxx="a USG one, i.e. you use setpgrp()."
11339                 else
11340                         # SVR4 systems can appear rather BSD-ish.
11341                         case "$i_unistd" in
11342                         $undef)
11343                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11344                                 val="$define"
11345                                 ;;
11346                         $define)
11347                                 xxx="probably a USG one, i.e. you use setpgrp()."
11348                                 val="$undef"
11349                                 ;;
11350                         esac
11351                 fi
11352                 echo "Assuming your setpgrp is $xxx" >&4
11353         fi
11354         ;;
11355 *) val="$undef";;
11356 esac
11357 set d_bsdsetpgrp
11358 eval $setvar
11359 $rm_try
11360
11361 : Look for GCC-style __builtin_add_overflow
11362 case "$d_builtin_add_overflow" in
11363 '')
11364     echo " "
11365     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11366     $cat >try.c <<'EOCP'
11367 int main(void) {
11368     const unsigned int uint_max = ~0u;
11369     int target_int = 0;
11370     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11371         return 1;
11372     }
11373     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11374         return 1;
11375     }
11376     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11377         return 1;
11378     }
11379     return 0;
11380 }
11381 EOCP
11382     set try
11383     if eval $compile && $run ./try; then
11384         echo "Your C compiler supports __builtin_add_overflow."
11385         val="$define"
11386     else
11387         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11388         val="$undef"
11389     fi
11390     ;;
11391 *) val="$d_builtin_add_overflow" ;;
11392 esac
11393
11394 set d_builtin_add_overflow
11395 eval $setvar
11396 $rm_try
11397
11398 : Look for GCC-style __builtin_sub_overflow
11399 case "$d_builtin_sub_overflow" in
11400 '')
11401     echo " "
11402     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11403     $cat >try.c <<'EOCP'
11404 int main(void) {
11405     const unsigned int uint_max = ~0u;
11406     int target_int = 0;
11407     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11408         return 1;
11409     }
11410     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11411         return 1;
11412     }
11413     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11414         return 1;
11415     }
11416     return 0;
11417 }
11418 EOCP
11419     set try
11420     if eval $compile && $run ./try; then
11421         echo "Your C compiler supports __builtin_sub_overflow."
11422         val="$define"
11423     else
11424         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11425         val="$undef"
11426     fi
11427     ;;
11428 *) val="$d_builtin_sub_overflow" ;;
11429 esac
11430
11431 set d_builtin_sub_overflow
11432 eval $setvar
11433 $rm_try
11434
11435 : Look for GCC-style __builtin_mul_overflow
11436 case "$d_builtin_mul_overflow" in
11437 '')
11438     echo " "
11439     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11440     $cat >try.c <<'EOCP'
11441 int main(void) {
11442     const unsigned int uint_max = ~0u;
11443     int target_int = 0;
11444     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11445         return 1;
11446     }
11447     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11448         return 1;
11449     }
11450     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11451         return 1;
11452     }
11453     return 0;
11454 }
11455 EOCP
11456     set try
11457     if eval $compile && $run ./try; then
11458         echo "Your C compiler supports __builtin_mul_overflow."
11459         val="$define"
11460     else
11461         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11462         val="$undef"
11463     fi
11464     ;;
11465 *) val="$d_builtin_mul_overflow" ;;
11466 esac
11467
11468 set d_builtin_mul_overflow
11469 eval $setvar
11470 $rm_try
11471
11472 : Look for GCC-style __builtin_choose_expr
11473 case "$d_builtin_choose_expr" in
11474 '')
11475     echo " "
11476     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11477     $cat >try.c <<'EOCP'
11478 #include <assert.h>
11479 #include <stdlib.h>
11480 #include <stdio.h>
11481
11482 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11483
11484 int main(void) {
11485     assert( SYRINX(1) == 2112 );
11486     assert( SYRINX(1) != 5150 );
11487     assert( SYRINX(0) == 5150 );
11488     assert( SYRINX(0) != 2112 );
11489     puts( "All good!" );
11490     exit(0);
11491 }
11492
11493 EOCP
11494     set try
11495     if eval $compile && $run ./try; then
11496         echo "Your C compiler supports __builtin_choose_expr."
11497         val="$define"
11498     else
11499         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11500         val="$undef"
11501     fi
11502 ;;
11503 *) val="$d_builtin_choose_expr" ;;
11504 esac
11505
11506 set d_builtin_choose_expr
11507 eval $setvar
11508 $rm_try
11509
11510 : Look for GCC-style __builtin_expect
11511 case "$d_builtin_expect" in
11512 '')
11513     echo " "
11514     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11515     $cat >try.c <<'EOCP'
11516 int main(void) {
11517     int n = 50;
11518     if ( __builtin_expect(n, 0) ) n = 1;
11519     /* Remember shell exit code truth is 0, C truth is non-zero */
11520     return !(n == 1);
11521 }
11522 EOCP
11523     set try
11524     if eval $compile && $run ./try; then
11525         echo "Your C compiler supports __builtin_expect."
11526         val="$define"
11527     else
11528         echo "Your C compiler doesn't seem to understand __builtin_expect."
11529         val="$undef"
11530     fi
11531     ;;
11532 *) val="$d_builtin_expect" ;;
11533 esac
11534
11535 set d_builtin_expect
11536 eval $setvar
11537 $rm_try
11538
11539 : see if the Compiler supports C99 variadic macros
11540 echo "Checking for C99 variadic macros." >&4
11541 $cat >try.c <<EOCP
11542 #include <stdio.h>
11543 #include <stdarg.h>
11544
11545 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11546
11547 int main() {
11548   char buf[20];
11549   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11550   puts(buf);
11551   return 0;
11552 }
11553 EOCP
11554 set try
11555 if eval $compile && $run ./try 2>&1 >/dev/null; then
11556     case "`$run ./try`" in
11557         "123 456 789")
11558         echo "You have C99 variadic macros." >&4
11559         d_c99_variadic_macros="$define"
11560         ;;
11561         *)
11562         echo "You don't have functional C99 variadic macros." >&4
11563         d_c99_variadic_macros="$undef"
11564         ;;
11565     esac
11566 else
11567     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11568     d_c99_variadic_macros="$undef"
11569 fi
11570 $rm_try
11571
11572 : see if signal is declared as pointer to function returning int or void
11573 echo " "
11574 xxx=`./findhdr signal.h`
11575 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11576 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11577         echo "You have int (*signal())() instead of void." >&4
11578         val="$undef"
11579 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11580         echo "You have void (*signal())()." >&4
11581         val="$define"
11582 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11583         echo "You have int (*signal())() instead of void." >&4
11584         val="$undef"
11585 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11586         echo "You have void (*signal())()." >&4
11587         val="$define"
11588 else
11589         case "$d_voidsig" in
11590         '')
11591         echo "I can't determine whether signal handler returns void or int..." >&4
11592                 dflt=void
11593                 rp="What type does your signal handler return?"
11594                 . ./myread
11595                 case "$ans" in
11596                 v*) val="$define";;
11597                 *) val="$undef";;
11598                 esac;;
11599         "$define")
11600                 echo "As you already told me, signal handler returns void." >&4
11601                 val="$define"
11602                 ;;
11603         *)      echo "As you already told me, signal handler returns int." >&4
11604                 val="$undef"
11605                 ;;
11606         esac
11607 fi
11608 set d_voidsig
11609 eval $setvar
11610 case "$d_voidsig" in
11611 "$define") signal_t="void";;
11612 *) signal_t="int";;
11613 esac
11614 $rm -f $$.tmp
11615
11616 : check for ability to cast large floats to 32-bit ints.
11617 echo " "
11618 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11619 if $test "$intsize" -ge 4; then
11620         xxx=int
11621 else
11622         xxx=long
11623 fi
11624 $cat >try.c <<EOCP
11625 #include <stdio.h>
11626 #$i_stdlib I_STDLIB
11627 #ifdef I_STDLIB
11628 #include <stdlib.h>
11629 #endif
11630 #include <sys/types.h>
11631 #include <signal.h>
11632 $signal_t blech(int s) { exit(3); }
11633 int main()
11634 {
11635         $xxx i32;
11636         double f, g;
11637         int result = 0;
11638         char str[16];
11639         signal(SIGFPE, blech);
11640
11641         /* Don't let compiler optimize the test away.  Store the number
11642            in a writable string for gcc to pass to sscanf under HP-UX.
11643         */
11644         sprintf(str, "2147483647");
11645         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11646         g = 10 * f;
11647         i32  = ($xxx) g;
11648
11649         /* x86 processors will probably give 0x8000 0000, which is a
11650            sign change.  We don't want that.  We want to mimic SPARC
11651            behavior here, which is to preserve the sign and give
11652            back 0x7fff ffff.
11653         */
11654         if (i32 != ($xxx) f)
11655                 result |= 1;
11656         exit(result);
11657 }
11658 EOCP
11659 set try
11660 if eval $compile_ok; then
11661         $run ./try 2>/dev/null
11662         yyy=$?
11663 else
11664         echo "(I can't seem to compile the test program--assuming it can't)"
11665         yyy=1
11666 fi
11667 case "$yyy" in
11668 0)      val="$define"
11669         echo "Yup, it can."
11670         ;;
11671 *)      val="$undef"
11672         echo "Nope, it can't."
11673         ;;
11674 esac
11675 set d_casti32
11676 eval $setvar
11677 $rm_try
11678
11679 : check for ability to cast negative floats to unsigned
11680 echo " "
11681 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11682 $cat >try.c <<EOCP
11683 #include <stdio.h>
11684 #$i_stdlib I_STDLIB
11685 #ifdef I_STDLIB
11686 #include <stdlib.h>
11687 #endif
11688 #include <sys/types.h>
11689 #include <signal.h>
11690 $signal_t blech(int s) { exit(7); }
11691 $signal_t blech_in_list(int s) { exit(4); }
11692 unsigned long dummy_long(unsigned long p) { return p; }
11693 unsigned int dummy_int(unsigned int p) { return p; }
11694 unsigned short dummy_short(unsigned short p) { return p; }
11695 int main()
11696 {
11697         double f;
11698         unsigned long along;
11699         unsigned int aint;
11700         unsigned short ashort;
11701         int result = 0;
11702         char str[16];
11703
11704         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11705            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11706            optimized the whole file away
11707         */
11708         /* Store the number in a writable string for gcc to pass to
11709            sscanf under HP-UX.
11710         */
11711         sprintf(str, "-123");
11712         sscanf(str, "%lf", &f);  /* f = -123.; */
11713
11714         signal(SIGFPE, blech);
11715         along = (unsigned long)f;
11716         aint = (unsigned int)f;
11717         ashort = (unsigned short)f;
11718         if (along != (unsigned long)-123)
11719                 result |= 1;
11720         if (aint != (unsigned int)-123)
11721                 result |= 1;
11722         if (ashort != (unsigned short)-123)
11723                 result |= 1;
11724         sprintf(str, "1073741824.");
11725         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11726         f = f + f;
11727         along = 0;
11728         along = (unsigned long)f;
11729         if (along != 0x80000000)
11730                 result |= 2;
11731         f -= 1.;
11732         along = 0;
11733         along = (unsigned long)f;
11734         if (along != 0x7fffffff)
11735                 result |= 1;
11736         f += 2.;
11737         along = 0;
11738         along = (unsigned long)f;
11739         if (along != 0x80000001)
11740                 result |= 2;
11741         if (result)
11742                 exit(result);
11743         signal(SIGFPE, blech_in_list);
11744         sprintf(str, "123.");
11745         sscanf(str, "%lf", &f);  /* f = 123.; */
11746         along = dummy_long((unsigned long)f);
11747         aint = dummy_int((unsigned int)f);
11748         ashort = dummy_short((unsigned short)f);
11749         if (along != (unsigned long)123)
11750                 result |= 4;
11751         if (aint != (unsigned int)123)
11752                 result |= 4;
11753         if (ashort != (unsigned short)123)
11754                 result |= 4;
11755         exit(result);
11756
11757 }
11758 EOCP
11759 set try
11760 if eval $compile_ok; then
11761         $run ./try 2>/dev/null
11762         castflags=$?
11763 else
11764         echo "(I can't seem to compile the test program--assuming it can't)"
11765         castflags=7
11766 fi
11767 case "$castflags" in
11768 0)      val="$define"
11769         echo "Yup, it can."
11770         ;;
11771 *)      val="$undef"
11772         echo "Nope, it can't."
11773         ;;
11774 esac
11775 set d_castneg
11776 eval $setvar
11777 $rm_try
11778
11779 : see if cbrt exists
11780 set cbrt d_cbrt
11781 eval $inlibc
11782
11783 : see if chown exists
11784 set chown d_chown
11785 eval $inlibc
11786
11787 : see if chroot exists
11788 set chroot d_chroot
11789 eval $inlibc
11790
11791 : see if chsize exists
11792 set chsize d_chsize
11793 eval $inlibc
11794
11795 : see if class exists
11796 set class d_class
11797 eval $inlibc
11798
11799 : see if clearenv exists
11800 set clearenv d_clearenv
11801 eval $inlibc
11802
11803 : Define hasstruct macro for Configure internal use
11804 hasstruct='varname=$1; struct=$2; shift; shift;
11805 while $test $# -ge 2; do
11806         case "$1" in
11807         $define) echo "#include <$2>";;
11808         esac ;
11809     shift 2;
11810 done > try.c;
11811 echo "int main () { struct $struct foo; }" >> try.c;
11812 set try;
11813 if eval $compile; then
11814         val="$define";
11815 else
11816         val="$undef";
11817 fi;
11818 set $varname;
11819 eval $setvar;
11820 $rm_try'
11821
11822 : see whether socket exists
11823 socketlib=''
11824 sockethdr=''
11825 echo " "
11826 $echo $n "Hmm... $c" >&4
11827 if set socket val -f d_socket; eval $csym; $val; then
11828     echo "Looks like you have Berkeley networking support." >&4
11829     d_socket="$define"
11830     if set setsockopt val -f; eval $csym; $val; then
11831         d_oldsock="$undef"
11832     else
11833         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11834         d_oldsock="$define"
11835     fi
11836 else
11837     if $contains socklib libc.list >/dev/null 2>&1; then
11838         echo "Looks like you have Berkeley networking support." >&4
11839         d_socket="$define"
11840         : we will have to assume that it supports the 4.2 BSD interface
11841         d_oldsock="$undef"
11842     else
11843         echo "You don't have Berkeley networking in libc$_a..." >&4
11844         if test "X$d_socket" = "X$define"; then
11845             echo "...but you seem to believe that you have sockets." >&4
11846         else
11847             for net in net socket
11848             do
11849                 if test -f $sysroot/usr/lib/lib$net$_a; then
11850                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11851                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11852                     if $contains socket libc.list >/dev/null 2>&1; then
11853                         d_socket="$define"
11854                         socketlib="-l$net"
11855                         case "$net" in
11856                         net)
11857                             echo "...but the Wollongong group seems to have hacked it in." >&4
11858                             sockethdr="-I$sysroot/usr/netinclude"
11859                             ;;
11860                         esac
11861                         echo "Found Berkeley sockets interface in lib$net." >&4
11862                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11863                             d_oldsock="$undef"
11864                         else
11865                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11866                             d_oldsock="$define"
11867                         fi
11868                         break
11869                     fi
11870                 fi
11871             done
11872             if test "X$d_socket" != "X$define"; then
11873                echo "or anywhere else I see." >&4
11874                d_socket="$undef"
11875                d_oldsock="$undef"
11876             fi
11877         fi
11878     fi
11879 fi
11880
11881 : see if socketpair exists
11882 set socketpair d_sockpair
11883 eval $inlibc
11884
11885
11886 echo " "
11887 echo "Checking the availability sa_len in the sock struct ..." >&4
11888 $cat >try.c <<EOF
11889 #include <sys/types.h>
11890 #include <sys/socket.h>
11891 int main() {
11892 struct sockaddr sa;
11893 return (sa.sa_len);
11894 }
11895 EOF
11896 val="$undef"
11897 set try; if eval $compile; then
11898     val="$define"
11899 fi
11900 set d_sockaddr_sa_len; eval $setvar
11901 $rm_try
11902
11903 echo " "
11904 echo "Checking the availability struct sockaddr_in6 ..." >&4
11905 $cat >try.c <<EOF
11906 #include <sys/types.h>
11907 #include <sys/socket.h>
11908 #include <netinet/in.h>
11909 int main() {
11910 struct sockaddr_in6 sin6;
11911 return (sin6.sin6_family);
11912 }
11913 EOF
11914 val="$undef"
11915 set try; if eval $compile; then
11916     val="$define"
11917 fi
11918 set d_sockaddr_in6; eval $setvar
11919 $rm_try
11920
11921 echo " "
11922 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11923 $cat >try.c <<EOF
11924 #include <sys/types.h>
11925 #include <sys/socket.h>
11926 #include <netinet/in.h>
11927 int main() {
11928 struct sockaddr_in6 sin6;
11929 return (sin6.sin6_scope_id);
11930 }
11931 EOF
11932 val="$undef"
11933 set try; if eval $compile; then
11934     val="$define"
11935 fi
11936 set d_sin6_scope_id; eval $setvar
11937 $rm_try
11938
11939 echo " "
11940 echo "Checking the availability struct ip_mreq ..." >&4
11941 $cat >try.c <<EOF
11942 #include <sys/types.h>
11943 #include <sys/socket.h>
11944 #include <netinet/in.h>
11945 int main() {
11946 struct ip_mreq mreq;
11947 return (mreq.imr_multiaddr.s_addr);
11948 }
11949 EOF
11950 val="$undef"
11951 set try; if eval $compile; then
11952        val="$define"
11953 fi
11954 set d_ip_mreq; eval $setvar
11955 $rm_try
11956
11957 echo " "
11958 echo "Checking the availability struct ip_mreq_source ..." >&4
11959 $cat >try.c <<EOF
11960 #include <sys/types.h>
11961 #include <sys/socket.h>
11962 #include <netinet/in.h>
11963 int main() {
11964 struct ip_mreq_source mreq;
11965 return (mreq.imr_multiaddr.s_addr);
11966 }
11967 EOF
11968 val="$undef"
11969 set try; if eval $compile; then
11970        val="$define"
11971 fi
11972 set d_ip_mreq_source; eval $setvar
11973 $rm_try
11974
11975 echo " "
11976 echo "Checking the availability struct ipv6_mreq ..." >&4
11977 $cat >try.c <<EOF
11978 #include <sys/types.h>
11979 #include <sys/socket.h>
11980 #include <netinet/in.h>
11981 int main() {
11982 struct ipv6_mreq mreq;
11983 return (mreq.ipv6mr_interface);
11984 }
11985 EOF
11986 val="$undef"
11987 set try; if eval $compile; then
11988     val="$define"
11989 fi
11990 set d_ipv6_mreq; eval $setvar
11991 $rm_try
11992
11993 echo " "
11994 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11995 $cat >try.c <<EOF
11996 #include <sys/types.h>
11997 #include <sys/socket.h>
11998 #include <netinet/in.h>
11999 int main() {
12000 struct ipv6_mreq_source mreq;
12001 return (mreq.imr_multiaddr.s_addr);
12002 }
12003 EOF
12004 val="$undef"
12005 set try; if eval $compile; then
12006        val="$define"
12007 fi
12008 set d_ipv6_mreq_source; eval $setvar
12009 $rm_try
12010
12011 echo " "
12012 echo "Checking the availability of certain socket constants..." >&4
12013 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12014     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12015     $cat >try.c <<EOF
12016 #include <sys/types.h>
12017 #include <sys/socket.h>
12018 int main() {
12019     int i = $ENUM;
12020 }
12021 EOF
12022     val="$undef"
12023     set try; if eval $compile; then
12024         val="$define"
12025     fi
12026     set d_${enum}; eval $setvar
12027     $rm_try
12028 done
12029
12030 : see if this is a sys/uio.h system
12031 set sys/uio.h i_sysuio
12032 eval $inhdr
12033
12034 : Check for cmsghdr support
12035 echo " "
12036 echo "Checking to see if your system supports struct cmsghdr..." >&4
12037 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12038 eval $hasstruct
12039 case "$d_cmsghdr_s" in
12040 "$define")      echo "Yes, it does."   ;;
12041 *)              echo "No, it doesn't." ;;
12042 esac
12043
12044
12045 : check for const keyword
12046 echo " "
12047 echo 'Checking to see if your C compiler knows about "const"...' >&4
12048 $cat >const.c <<'EOCP'
12049 typedef struct spug { int drokk; } spug;
12050 int main()
12051 {
12052         const char *foo;
12053         const spug y = { 0 };
12054 }
12055 EOCP
12056 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12057         val="$define"
12058         echo "Yup, it does."
12059 else
12060         val="$undef"
12061         echo "Nope, it doesn't."
12062 fi
12063 set d_const
12064 eval $setvar
12065
12066 : see if copysign exists
12067 set copysign d_copysign
12068 eval $inlibc
12069
12070 : see if copysignl exists
12071 set copysignl d_copysignl
12072 eval $inlibc
12073
12074 : see if crypt exists
12075 echo " "
12076 set crypt d_crypt
12077 eval $inlibc
12078 case "$d_crypt" in
12079 $define) cryptlib='' ;;
12080 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12081                 echo 'crypt() found.' >&4
12082                 val="$define"
12083                 cryptlib=''
12084         else
12085                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12086                 if $test -z "$cryptlib"; then
12087                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12088                 else
12089                         cryptlib=-lcrypt
12090                 fi
12091                 if $test -z "$cryptlib"; then
12092                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12093                 else
12094                         cryptlib=-lcrypt
12095                 fi
12096                 if $test -z "$cryptlib"; then
12097                         cryptlib=`./loc libcrypt$_a "" $libpth`
12098                 else
12099                         cryptlib=-lcrypt
12100                 fi
12101                 if $test -z "$cryptlib"; then
12102                         echo 'crypt() NOT found.' >&4
12103                         val="$undef"
12104                 else
12105                         val="$define"
12106                 fi
12107         fi
12108         set d_crypt
12109         eval $setvar
12110         ;;
12111 esac
12112
12113 : see if this is a crypt.h system
12114 set crypt.h i_crypt
12115 eval $inhdr
12116
12117 : see if crypt_r exists
12118 set crypt_r d_crypt_r
12119 eval $inlibc
12120 case "$d_crypt_r" in
12121 "$define")
12122         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12123         case "$d_crypt_r_proto:$usethreads" in
12124         ":define")      d_crypt_r_proto=define
12125                 set d_crypt_r_proto crypt_r $hdrs
12126                 eval $hasproto ;;
12127         *)      ;;
12128         esac
12129         case "$d_crypt_r_proto" in
12130         define)
12131         case "$crypt_r_proto" in
12132         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12133         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12134         esac
12135         case "$crypt_r_proto" in
12136         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12137         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12138         esac
12139         case "$crypt_r_proto" in
12140         ''|0)   d_crypt_r=undef
12141                 crypt_r_proto=0
12142                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12143         * )     case "$crypt_r_proto" in
12144                 REENTRANT_PROTO*) ;;
12145                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12146                 esac
12147                 echo "Prototype: $try" ;;
12148         esac
12149         ;;
12150         *)      case "$usethreads" in
12151                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12152                 esac
12153                 d_crypt_r=undef
12154                 crypt_r_proto=0
12155                 ;;
12156         esac
12157         ;;
12158 *)      crypt_r_proto=0
12159         ;;
12160 esac
12161
12162 : get csh whereabouts
12163 case "$csh" in
12164 'csh') val="$undef" ;;
12165 *) val="$define" ;;
12166 esac
12167 set d_csh
12168 eval $setvar
12169 : Respect a hint or command line value for full_csh.
12170 case "$full_csh" in
12171 '') full_csh=$csh ;;
12172 esac
12173
12174 : see if ctermid exists
12175 set ctermid d_ctermid
12176 eval $inlibc
12177
12178 : see if ctermid_r exists
12179 set ctermid_r d_ctermid_r
12180 eval $inlibc
12181 case "$d_ctermid_r" in
12182 "$define")
12183         hdrs="$i_systypes sys/types.h define stdio.h "
12184         case "$d_ctermid_r_proto:$usethreads" in
12185         ":define")      d_ctermid_r_proto=define
12186                 set d_ctermid_r_proto ctermid_r $hdrs
12187                 eval $hasproto ;;
12188         *)      ;;
12189         esac
12190         case "$d_ctermid_r_proto" in
12191         define)
12192         case "$ctermid_r_proto" in
12193         ''|0) try='char* ctermid_r(char*);'
12194         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12195         esac
12196         case "$ctermid_r_proto" in
12197         ''|0)   d_ctermid_r=undef
12198                 ctermid_r_proto=0
12199                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12200         * )     case "$ctermid_r_proto" in
12201                 REENTRANT_PROTO*) ;;
12202                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12203                 esac
12204                 echo "Prototype: $try" ;;
12205         esac
12206         ;;
12207         *)      case "$usethreads" in
12208                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12209                 esac
12210                 d_ctermid_r=undef
12211                 ctermid_r_proto=0
12212                 ;;
12213         esac
12214         ;;
12215 *)      ctermid_r_proto=0
12216         ;;
12217 esac
12218
12219 : see if ctime_r exists
12220 set ctime_r d_ctime_r
12221 eval $inlibc
12222 case "$d_ctime_r" in
12223 "$define")
12224         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12225         case "$d_ctime_r_proto:$usethreads" in
12226         ":define")      d_ctime_r_proto=define
12227                 set d_ctime_r_proto ctime_r $hdrs
12228                 eval $hasproto ;;
12229         *)      ;;
12230         esac
12231         case "$d_ctime_r_proto" in
12232         define)
12233         case "$ctime_r_proto" in
12234         ''|0) try='char* ctime_r(const time_t*, char*);'
12235         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12236         esac
12237         case "$ctime_r_proto" in
12238         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12239         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12240         esac
12241         case "$ctime_r_proto" in
12242         ''|0) try='int ctime_r(const time_t*, char*);'
12243         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12244         esac
12245         case "$ctime_r_proto" in
12246         ''|0) try='int ctime_r(const time_t*, char*, int);'
12247         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12248         esac
12249         case "$ctime_r_proto" in
12250         ''|0)   d_ctime_r=undef
12251                 ctime_r_proto=0
12252                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12253         * )     case "$ctime_r_proto" in
12254                 REENTRANT_PROTO*) ;;
12255                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12256                 esac
12257                 echo "Prototype: $try" ;;
12258         esac
12259         ;;
12260         *)      case "$usethreads" in
12261                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12262                 esac
12263                 d_ctime_r=undef
12264                 ctime_r_proto=0
12265                 ;;
12266         esac
12267         ;;
12268 *)      ctime_r_proto=0
12269         ;;
12270 esac
12271
12272 : see if cuserid exists
12273 set cuserid d_cuserid
12274 eval $inlibc
12275
12276 : see if dbm.h is available
12277 : see if dbmclose exists
12278 set dbmclose d_dbmclose
12279 eval $inlibc
12280
12281 case "$d_dbmclose" in
12282 $define)
12283         set dbm.h i_dbm
12284         eval $inhdr
12285         case "$i_dbm" in
12286         $define)
12287                 val="$undef"
12288                 set i_rpcsvcdbm
12289                 eval $setvar
12290                 ;;
12291         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12292                 eval $inhdr
12293                 ;;
12294         esac
12295         ;;
12296 *)      echo "We won't be including <dbm.h>"
12297         val="$undef"
12298         set i_dbm
12299         eval $setvar
12300         val="$undef"
12301         set i_rpcsvcdbm
12302         eval $setvar
12303         ;;
12304 esac
12305
12306 : see if prototype for dbminit is available
12307 echo " "
12308 set d_dbminitproto dbminit $i_dbm dbm.h
12309 eval $hasproto
12310
12311 : see if difftime exists
12312 set difftime d_difftime
12313 eval $inlibc
12314
12315 : see if this is a dirent system
12316 echo " "
12317 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12318         val="$define"
12319         echo "<dirent.h> found." >&4
12320 else
12321         val="$undef"
12322         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12323                 echo "<sys/dir.h> found." >&4
12324                 echo " "
12325         else
12326                 xinc=`./findhdr sys/ndir.h`
12327         fi
12328         echo "<dirent.h> NOT found." >&4
12329 fi
12330 set i_dirent
12331 eval $setvar
12332
12333 : Look for type of directory structure.
12334 echo " "
12335 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12336
12337 case "$direntrytype" in
12338 ''|' ')
12339         case "$i_dirent" in
12340         $define) guess1='struct dirent' ;;
12341         *) guess1='struct direct'  ;;
12342         esac
12343         ;;
12344 *)      guess1="$direntrytype"
12345         ;;
12346 esac
12347
12348 case "$guess1" in
12349 'struct dirent') guess2='struct direct' ;;
12350 *) guess2='struct dirent' ;;
12351 esac
12352
12353 if $contains "$guess1" try.c >/dev/null 2>&1; then
12354         direntrytype="$guess1"
12355         echo "Your directory entries are $direntrytype." >&4
12356 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12357         direntrytype="$guess2"
12358         echo "Your directory entries seem to be $direntrytype." >&4
12359 else
12360         echo "I don't recognize your system's directory entries." >&4
12361         rp="What type is used for directory entries on this system?"
12362         dflt="$guess1"
12363         . ./myread
12364         direntrytype="$ans"
12365 fi
12366 $rm_try
12367
12368 : see if the directory entry stores field length
12369 echo " "
12370 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12371 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12372         echo "Good, your directory entry keeps length information in d_namlen." >&4
12373         val="$define"
12374 else
12375         echo "Your directory entry does not know about the d_namlen field." >&4
12376         val="$undef"
12377 fi
12378 set d_dirnamlen
12379 eval $setvar
12380 $rm_try
12381
12382 : Look for DIR.dd_fd
12383 case "$i_dirent" in
12384 "$define")
12385     echo "Checking to see if DIR has a dd_fd member variable" >&4
12386     $cat >try.c <<EOCP
12387 #$i_stdlib I_STDLIB
12388 #ifdef I_STDLIB
12389 #include <stdlib.h>
12390 #endif
12391 #include <dirent.h>
12392
12393 int main() {
12394     DIR dir;
12395     dir.dd_fd = 1;
12396     return 0;
12397 }
12398 EOCP
12399     val=$undef
12400     set try
12401     if eval $compile; then
12402         echo "Yes, it does."
12403         val="$define"
12404     else
12405         echo "No, it does not."
12406         val="$undef"
12407     fi
12408     ;;
12409 *)
12410     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12411     val="$undef"
12412     ;;
12413 esac
12414 set d_dir_dd_fd
12415 eval $setvar
12416 $rm_try
12417
12418 : see if this is an sysdir system
12419 set sys/dir.h i_sysdir
12420 eval $inhdr
12421
12422 : see if this is an sysndir system
12423 set sys/ndir.h i_sysndir
12424 eval $inhdr
12425
12426 : Look for dirfd
12427 echo " "
12428 $cat >dirfd.c <<EOM
12429 #include <stdio.h>
12430 #$i_stdlib I_STDLIB
12431 #ifdef I_STDLIB
12432 #include <stdlib.h>
12433 #endif
12434 #$i_dirent I_DIRENT             /**/
12435 #$i_sysdir I_SYS_DIR            /**/
12436 #$i_sysndir I_SYS_NDIR          /**/
12437 #$i_systypes I_SYS_TYPES        /**/
12438 #if defined(I_SYS_TYPES)
12439 #include <sys/types.h>
12440 #endif
12441 #if defined(I_DIRENT)
12442 #include <dirent.h>
12443 #else
12444 #ifdef I_SYS_NDIR
12445 #include <sys/ndir.h>
12446 #else
12447 #ifdef I_SYS_DIR
12448 #include <sys/dir.h>
12449 #endif
12450 #endif
12451 #endif
12452 int main() {
12453         DIR *dirp = opendir(".");
12454         if (dirfd(dirp) >= 0)
12455                 exit(0);
12456         else
12457                 exit(1);
12458 }
12459 EOM
12460 val=$undef
12461 set dirfd
12462 if eval $compile; then
12463         val="$define"
12464 fi
12465 case "$val" in
12466 $define)        echo "dirfd() found." >&4       ;;
12467 *)              echo "dirfd() NOT found." >&4   ;;
12468 esac
12469 set d_dirfd
12470 eval $setvar
12471 $rm -f dirfd*
12472
12473 : see if dladdr exists
12474 set dladdr d_dladdr
12475 eval $inlibc
12476
12477 : see if dlerror exists
12478 xxx_runnm="$runnm"
12479 runnm=false
12480 set dlerror d_dlerror
12481 eval $inlibc
12482 runnm="$xxx_runnm"
12483
12484 : see if dlfcn is available
12485 set dlfcn.h i_dlfcn
12486 eval $inhdr
12487
12488 : Check what extension to use for shared libs
12489 case "$usedl" in
12490 $define|y|true)
12491         $cat << EOM
12492
12493 On a few systems, the dynamically loaded modules that perl generates and uses
12494 will need a different extension than shared libs. The default will probably
12495 be appropriate.
12496
12497 EOM
12498         case "$dlext" in
12499         '')     dflt="$so" ;;
12500         *)      dflt="$dlext" ;;
12501         esac
12502         rp='What is the extension of dynamically loaded modules'
12503         . ./myread
12504         dlext="$ans"
12505         ;;
12506 *)
12507         dlext="none"
12508         ;;
12509 esac
12510
12511 : Check if dlsym need a leading underscore
12512 echo " "
12513 val="$undef"
12514
12515 case "$dlsrc" in
12516 dl_dlopen.xs)
12517         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12518         $cat >dyna.c <<'EOM'
12519 fred () { }
12520 EOM
12521
12522 $cat >fred.c<<EOM
12523
12524 #include <stdio.h>
12525 #$i_stdlib I_STDLIB
12526 #ifdef I_STDLIB
12527 #include <stdlib.h>
12528 #endif
12529 #$i_dlfcn I_DLFCN
12530 #ifdef I_DLFCN
12531 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12532 #else
12533 #include <sys/types.h>
12534 #include <nlist.h>
12535 #include <link.h>
12536 #endif
12537
12538 extern int fred() ;
12539
12540 int main()
12541 {
12542     void * handle ;
12543     void * symbol ;
12544 #ifndef RTLD_LAZY
12545     int mode = 1 ;
12546 #else
12547     int mode = RTLD_LAZY ;
12548 #endif
12549     handle = dlopen("./dyna.$dlext", mode) ;
12550     if (handle == NULL) {
12551         printf ("1\n") ;
12552         fflush (stdout) ;
12553         exit(0);
12554     }
12555     symbol = dlsym(handle, "fred") ;
12556     if (symbol == NULL) {
12557         /* try putting a leading underscore */
12558         symbol = dlsym(handle, "_fred") ;
12559         if (symbol == NULL) {
12560             printf ("2\n") ;
12561             fflush (stdout) ;
12562             exit(0);
12563         }
12564         printf ("3\n") ;
12565     }
12566     else
12567         printf ("4\n") ;
12568     fflush (stdout) ;
12569     exit(0);
12570 }
12571 EOM
12572         : Call the object file tmp-dyna.o in case dlext=o.
12573         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12574                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12575                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12576                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12577                 xxx=`$run ./fred`
12578                 case $xxx in
12579                 1)      echo "Test program failed using dlopen." >&4
12580                         echo "Perhaps you should not use dynamic loading." >&4;;
12581                 2)      echo "Test program failed using dlsym." >&4
12582                         echo "Perhaps you should not use dynamic loading." >&4;;
12583                 3)      echo "dlsym needs a leading underscore" >&4
12584                         val="$define" ;;
12585                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12586                 esac
12587         else
12588                 echo "I can't compile and run the test program." >&4
12589                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12590         fi
12591         ;;
12592 esac
12593
12594 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12595
12596 set d_dlsymun
12597 eval $setvar
12598
12599 : see if drand48_r exists
12600 set drand48_r d_drand48_r
12601 eval $inlibc
12602 case "$d_drand48_r" in
12603 "$define")
12604         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12605         case "$d_drand48_r_proto:$usethreads" in
12606         ":define")      d_drand48_r_proto=define
12607                 set d_drand48_r_proto drand48_r $hdrs
12608                 eval $hasproto ;;
12609         *)      ;;
12610         esac
12611         case "$d_drand48_r_proto" in
12612         define)
12613         case "$drand48_r_proto" in
12614         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12615         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12616         esac
12617         case "$drand48_r_proto" in
12618         ''|0)   d_drand48_r=undef
12619                 drand48_r_proto=0
12620                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12621         * )     case "$drand48_r_proto" in
12622                 REENTRANT_PROTO*) ;;
12623                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12624                 esac
12625                 echo "Prototype: $try" ;;
12626         esac
12627         ;;
12628         *)      case "$usethreads" in
12629                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12630                 esac
12631                 d_drand48_r=undef
12632                 drand48_r_proto=0
12633                 ;;
12634         esac
12635         ;;
12636 *)      drand48_r_proto=0
12637         ;;
12638 esac
12639
12640 : see if prototype for drand48 is available
12641 echo " "
12642 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12643 eval $hasproto
12644
12645 : see if dup2 exists
12646 set dup2 d_dup2
12647 eval $inlibc
12648
12649 : see if dup3 exists
12650 set dup3 d_dup3
12651 eval $inlibc
12652
12653 : see if eaccess exists
12654 set eaccess d_eaccess
12655 eval $inlibc
12656
12657 : see if endgrent exists
12658 set endgrent d_endgrent
12659 eval $inlibc
12660
12661 : see if this is an grp system
12662 set grp.h i_grp
12663 eval $inhdr
12664
12665 case "$i_grp" in
12666 $define)
12667         xxx=`./findhdr grp.h`
12668         $cppstdin $cppflags $cppminus < $xxx >$$.h
12669
12670         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12671                 val="$define"
12672         else
12673                 val="$undef"
12674         fi
12675         set d_grpasswd
12676         eval $setvar
12677
12678         $rm -f $$.h
12679         ;;
12680 *)
12681         val="$undef";
12682         set d_grpasswd; eval $setvar
12683         ;;
12684 esac
12685
12686 : see if endgrent_r exists
12687 set endgrent_r d_endgrent_r
12688 eval $inlibc
12689 case "$d_endgrent_r" in
12690 "$define")
12691         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12692         case "$d_endgrent_r_proto:$usethreads" in
12693         ":define")      d_endgrent_r_proto=define
12694                 set d_endgrent_r_proto endgrent_r $hdrs
12695                 eval $hasproto ;;
12696         *)      ;;
12697         esac
12698         case "$d_endgrent_r_proto" in
12699         define)
12700         case "$endgrent_r_proto" in
12701         ''|0) try='int endgrent_r(FILE**);'
12702         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12703         esac
12704         case "$endgrent_r_proto" in
12705         ''|0) try='void endgrent_r(FILE**);'
12706         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12707         esac
12708         case "$endgrent_r_proto" in
12709         ''|0)   d_endgrent_r=undef
12710                 endgrent_r_proto=0
12711                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12712         * )     case "$endgrent_r_proto" in
12713                 REENTRANT_PROTO*) ;;
12714                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12715                 esac
12716                 echo "Prototype: $try" ;;
12717         esac
12718         ;;
12719         *)      case "$usethreads" in
12720                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12721                 esac
12722                 d_endgrent_r=undef
12723                 endgrent_r_proto=0
12724                 ;;
12725         esac
12726         ;;
12727 *)      endgrent_r_proto=0
12728         ;;
12729 esac
12730
12731 : see if endhostent exists
12732 set endhostent d_endhent
12733 eval $inlibc
12734
12735 : see if this is a netdb.h system
12736 set netdb.h i_netdb
12737 eval $inhdr
12738
12739 : see if endhostent_r exists
12740 set endhostent_r d_endhostent_r
12741 eval $inlibc
12742 case "$d_endhostent_r" in
12743 "$define")
12744         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12745         case "$d_endhostent_r_proto:$usethreads" in
12746         ":define")      d_endhostent_r_proto=define
12747                 set d_endhostent_r_proto endhostent_r $hdrs
12748                 eval $hasproto ;;
12749         *)      ;;
12750         esac
12751         case "$d_endhostent_r_proto" in
12752         define)
12753         case "$endhostent_r_proto" in
12754         ''|0) try='int endhostent_r(struct hostent_data*);'
12755         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12756         esac
12757         case "$endhostent_r_proto" in
12758         ''|0) try='void endhostent_r(struct hostent_data*);'
12759         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12760         esac
12761         case "$endhostent_r_proto" in
12762         ''|0)   d_endhostent_r=undef
12763                 endhostent_r_proto=0
12764                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12765         * )     case "$endhostent_r_proto" in
12766                 REENTRANT_PROTO*) ;;
12767                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12768                 esac
12769                 echo "Prototype: $try" ;;
12770         esac
12771         ;;
12772         *)      case "$usethreads" in
12773                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12774                 esac
12775                 d_endhostent_r=undef
12776                 endhostent_r_proto=0
12777                 ;;
12778         esac
12779         ;;
12780 *)      endhostent_r_proto=0
12781         ;;
12782 esac
12783
12784 : see if endnetent exists
12785 set endnetent d_endnent
12786 eval $inlibc
12787
12788 : see if endnetent_r exists
12789 set endnetent_r d_endnetent_r
12790 eval $inlibc
12791 case "$d_endnetent_r" in
12792 "$define")
12793         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12794         case "$d_endnetent_r_proto:$usethreads" in
12795         ":define")      d_endnetent_r_proto=define
12796                 set d_endnetent_r_proto endnetent_r $hdrs
12797                 eval $hasproto ;;
12798         *)      ;;
12799         esac
12800         case "$d_endnetent_r_proto" in
12801         define)
12802         case "$endnetent_r_proto" in
12803         ''|0) try='int endnetent_r(struct netent_data*);'
12804         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12805         esac
12806         case "$endnetent_r_proto" in
12807         ''|0) try='void endnetent_r(struct netent_data*);'
12808         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12809         esac
12810         case "$endnetent_r_proto" in
12811         ''|0)   d_endnetent_r=undef
12812                 endnetent_r_proto=0
12813                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12814         * )     case "$endnetent_r_proto" in
12815                 REENTRANT_PROTO*) ;;
12816                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12817                 esac
12818                 echo "Prototype: $try" ;;
12819         esac
12820         ;;
12821         *)      case "$usethreads" in
12822                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12823                 esac
12824                 d_endnetent_r=undef
12825                 endnetent_r_proto=0
12826                 ;;
12827         esac
12828         ;;
12829 *)      endnetent_r_proto=0
12830         ;;
12831 esac
12832
12833 : see if endprotoent exists
12834 set endprotoent d_endpent
12835 eval $inlibc
12836
12837 : see if endprotoent_r exists
12838 set endprotoent_r d_endprotoent_r
12839 eval $inlibc
12840 case "$d_endprotoent_r" in
12841 "$define")
12842         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12843         case "$d_endprotoent_r_proto:$usethreads" in
12844         ":define")      d_endprotoent_r_proto=define
12845                 set d_endprotoent_r_proto endprotoent_r $hdrs
12846                 eval $hasproto ;;
12847         *)      ;;
12848         esac
12849         case "$d_endprotoent_r_proto" in
12850         define)
12851         case "$endprotoent_r_proto" in
12852         ''|0) try='int endprotoent_r(struct protoent_data*);'
12853         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12854         esac
12855         case "$endprotoent_r_proto" in
12856         ''|0) try='void endprotoent_r(struct protoent_data*);'
12857         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12858         esac
12859         case "$endprotoent_r_proto" in
12860         ''|0)   d_endprotoent_r=undef
12861                 endprotoent_r_proto=0
12862                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12863         * )     case "$endprotoent_r_proto" in
12864                 REENTRANT_PROTO*) ;;
12865                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12866                 esac
12867                 echo "Prototype: $try" ;;
12868         esac
12869         ;;
12870         *)      case "$usethreads" in
12871                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12872                 esac
12873                 d_endprotoent_r=undef
12874                 endprotoent_r_proto=0
12875                 ;;
12876         esac
12877         ;;
12878 *)      endprotoent_r_proto=0
12879         ;;
12880 esac
12881
12882 : see if endpwent exists
12883 set endpwent d_endpwent
12884 eval $inlibc
12885
12886 : see if this is a pwd.h system
12887 set pwd.h i_pwd
12888 eval $inhdr
12889
12890 case "$i_pwd" in
12891 $define)
12892         xxx=`./findhdr pwd.h`
12893         $cppstdin $cppflags $cppminus < $xxx >$$.h
12894
12895         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12896                 val="$define"
12897         else
12898                 val="$undef"
12899         fi
12900         set d_pwquota
12901         eval $setvar
12902
12903         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12904                 val="$define"
12905         else
12906                 val="$undef"
12907         fi
12908         set d_pwage
12909         eval $setvar
12910
12911         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12912                 val="$define"
12913         else
12914                 val="$undef"
12915         fi
12916         set d_pwchange
12917         eval $setvar
12918
12919         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12920                 val="$define"
12921         else
12922                 val="$undef"
12923         fi
12924         set d_pwclass
12925         eval $setvar
12926
12927         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12928                 val="$define"
12929         else
12930                 val="$undef"
12931         fi
12932         set d_pwexpire
12933         eval $setvar
12934
12935         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12936                 val="$define"
12937         else
12938                 val="$undef"
12939         fi
12940         set d_pwcomment
12941         eval $setvar
12942
12943         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12944                 val="$define"
12945         else
12946                 val="$undef"
12947         fi
12948         set d_pwgecos
12949         eval $setvar
12950
12951         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12952                 val="$define"
12953         else
12954                 val="$undef"
12955         fi
12956         set d_pwpasswd
12957         eval $setvar
12958
12959         $rm -f $$.h
12960         ;;
12961 *)
12962         val="$undef";
12963         set d_pwquota; eval $setvar
12964         set d_pwage; eval $setvar
12965         set d_pwchange; eval $setvar
12966         set d_pwclass; eval $setvar
12967         set d_pwexpire; eval $setvar
12968         set d_pwcomment; eval $setvar
12969         set d_pwgecos; eval $setvar
12970         set d_pwpasswd; eval $setvar
12971         ;;
12972 esac
12973
12974 : see if endpwent_r exists
12975 set endpwent_r d_endpwent_r
12976 eval $inlibc
12977 case "$d_endpwent_r" in
12978 "$define")
12979         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12980         case "$d_endpwent_r_proto:$usethreads" in
12981         ":define")      d_endpwent_r_proto=define
12982                 set d_endpwent_r_proto endpwent_r $hdrs
12983                 eval $hasproto ;;
12984         *)      ;;
12985         esac
12986         case "$d_endpwent_r_proto" in
12987         define)
12988         case "$endpwent_r_proto" in
12989         ''|0) try='int endpwent_r(FILE**);'
12990         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12991         esac
12992         case "$endpwent_r_proto" in
12993         ''|0) try='void endpwent_r(FILE**);'
12994         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12995         esac
12996         case "$endpwent_r_proto" in
12997         ''|0)   d_endpwent_r=undef
12998                 endpwent_r_proto=0
12999                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13000         * )     case "$endpwent_r_proto" in
13001                 REENTRANT_PROTO*) ;;
13002                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13003                 esac
13004                 echo "Prototype: $try" ;;
13005         esac
13006         ;;
13007         *)      case "$usethreads" in
13008                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13009                 esac
13010                 d_endpwent_r=undef
13011                 endpwent_r_proto=0
13012                 ;;
13013         esac
13014         ;;
13015 *)      endpwent_r_proto=0
13016         ;;
13017 esac
13018
13019 : see if endservent exists
13020 set endservent d_endsent
13021 eval $inlibc
13022
13023 : see if endservent_r exists
13024 set endservent_r d_endservent_r
13025 eval $inlibc
13026 case "$d_endservent_r" in
13027 "$define")
13028         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13029         case "$d_endservent_r_proto:$usethreads" in
13030         ":define")      d_endservent_r_proto=define
13031                 set d_endservent_r_proto endservent_r $hdrs
13032                 eval $hasproto ;;
13033         *)      ;;
13034         esac
13035         case "$d_endservent_r_proto" in
13036         define)
13037         case "$endservent_r_proto" in
13038         ''|0) try='int endservent_r(struct servent_data*);'
13039         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13040         esac
13041         case "$endservent_r_proto" in
13042         ''|0) try='void endservent_r(struct servent_data*);'
13043         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13044         esac
13045         case "$endservent_r_proto" in
13046         ''|0)   d_endservent_r=undef
13047                 endservent_r_proto=0
13048                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13049         * )     case "$endservent_r_proto" in
13050                 REENTRANT_PROTO*) ;;
13051                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13052                 esac
13053                 echo "Prototype: $try" ;;
13054         esac
13055         ;;
13056         *)      case "$usethreads" in
13057                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13058                 esac
13059                 d_endservent_r=undef
13060                 endservent_r_proto=0
13061                 ;;
13062         esac
13063         ;;
13064 *)      endservent_r_proto=0
13065         ;;
13066 esac
13067
13068 : Locate the flags for 'open()'
13069 echo " "
13070 $cat >try.c <<EOCP
13071 #include <sys/types.h>
13072 #ifdef I_FCNTL
13073 #include <fcntl.h>
13074 #endif
13075 #ifdef I_SYS_FILE
13076 #include <sys/file.h>
13077 #endif
13078 #$i_stdlib I_STDLIB
13079 #ifdef I_STDLIB
13080 #include <stdlib.h>
13081 #endif
13082 int main() {
13083         if(O_RDONLY);
13084 #ifdef O_TRUNC
13085         exit(0);
13086 #else
13087         exit(1);
13088 #endif
13089 }
13090 EOCP
13091 : check sys/file.h first to get FREAD on Sun
13092 if $test `./findhdr sys/file.h` && \
13093                 set try -DI_SYS_FILE && eval $compile; then
13094         h_sysfile=true;
13095         echo "<sys/file.h> defines the O_* constants..." >&4
13096         if $run ./try; then
13097                 echo "and you have the 3 argument form of open()." >&4
13098                 val="$define"
13099         else
13100                 echo "but not the 3 argument form of open().  Oh, well." >&4
13101                 val="$undef"
13102         fi
13103 elif $test `./findhdr fcntl.h` && \
13104                 set try -DI_FCNTL && eval $compile; then
13105         h_fcntl=true;
13106         echo "<fcntl.h> defines the O_* constants..." >&4
13107         if $run ./try; then
13108                 echo "and you have the 3 argument form of open()." >&4
13109                 val="$define"
13110         else
13111                 echo "but not the 3 argument form of open().  Oh, well." >&4
13112                 val="$undef"
13113         fi
13114 else
13115         val="$undef"
13116         echo "I can't find the O_* constant definitions!  You got problems." >&4
13117 fi
13118 set d_open3
13119 eval $setvar
13120 $rm_try
13121
13122 : see if this is a sys/file.h system
13123 val=''
13124 set sys/file.h val
13125 eval $inhdr
13126
13127 : do we need to include sys/file.h ?
13128 case "$val" in
13129 "$define")
13130         echo " "
13131         if $h_sysfile; then
13132                 val="$define"
13133                 echo "We'll be including <sys/file.h>." >&4
13134         else
13135                 val="$undef"
13136                 echo "We won't be including <sys/file.h>." >&4
13137         fi
13138         ;;
13139 *)
13140         h_sysfile=false
13141         ;;
13142 esac
13143 set i_sysfile
13144 eval $setvar
13145
13146 : see if fcntl.h is there
13147 val=''
13148 set fcntl.h val
13149 eval $inhdr
13150
13151 : see if we can include fcntl.h
13152 case "$val" in
13153 "$define")
13154         echo " "
13155         if $h_fcntl; then
13156                 val="$define"
13157                 echo "We'll be including <fcntl.h>." >&4
13158         else
13159                 val="$undef"
13160                 if $h_sysfile; then
13161         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13162                 else
13163                         echo "We won't be including <fcntl.h>." >&4
13164                 fi
13165         fi
13166         ;;
13167 *)
13168         h_fcntl=false
13169         val="$undef"
13170         ;;
13171 esac
13172 set i_fcntl
13173 eval $setvar
13174
13175 : see if fork exists
13176 set fork d_fork
13177 eval $inlibc
13178
13179 : see if pipe exists
13180 set pipe d_pipe
13181 eval $inlibc
13182
13183 : check for non-blocking I/O stuff
13184 case "$h_sysfile" in
13185 true) echo "#include <sys/file.h>" > head.c;;
13186 *)
13187        case "$h_fcntl" in
13188        true) echo "#include <fcntl.h>" > head.c;;
13189        *) echo "#include <sys/fcntl.h>" > head.c;;
13190        esac
13191        ;;
13192 esac
13193 echo " "
13194 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13195 case "$o_nonblock" in
13196 '')
13197         $cat head.c > try.c
13198         $cat >>try.c <<EOCP
13199 #include <stdio.h>
13200 #$i_stdlib I_STDLIB
13201 #ifdef I_STDLIB
13202 #include <stdlib.h>
13203 #endif
13204 #$i_fcntl I_FCNTL
13205 #ifdef I_FCNTL
13206 #include <fcntl.h>
13207 #endif
13208 int main() {
13209 #ifdef O_NONBLOCK
13210         printf("O_NONBLOCK\n");
13211         exit(0);
13212 #endif
13213 #ifdef O_NDELAY
13214         printf("O_NDELAY\n");
13215         exit(0);
13216 #endif
13217 #ifdef FNDELAY
13218         printf("FNDELAY\n");
13219         exit(0);
13220 #endif
13221         exit(0);
13222 }
13223 EOCP
13224         set try
13225         if eval $compile_ok; then
13226                 o_nonblock=`$run ./try`
13227                 case "$o_nonblock" in
13228                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13229                 *) echo "Seems like we can use $o_nonblock.";;
13230                 esac
13231         else
13232                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13233         fi
13234         ;;
13235 *) echo "Using $hint value $o_nonblock.";;
13236 esac
13237 $rm_try
13238
13239 echo " "
13240 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13241 case "$eagain" in
13242 '')
13243         case "$d_fork:$d_pipe:$d_alarm" in
13244         define:define:define)
13245         $cat head.c > try.c
13246         $cat >>try.c <<EOCP
13247 #include <errno.h>
13248 #include <sys/types.h>
13249 #include <signal.h>
13250 #include <stdio.h>
13251 #$i_stdlib I_STDLIB
13252 #ifdef I_STDLIB
13253 #include <stdlib.h>
13254 #endif
13255 #$i_fcntl I_FCNTL
13256 #ifdef I_FCNTL
13257 #include <fcntl.h>
13258 #endif
13259 #define MY_O_NONBLOCK $o_nonblock
13260 #ifndef errno  /* XXX need better Configure test */
13261 extern int errno;
13262 #endif
13263 #$i_unistd I_UNISTD
13264 #ifdef I_UNISTD
13265 #include <unistd.h>
13266 #endif
13267 #include <string.h>
13268 $signal_t blech(int x) { exit(3); }
13269 EOCP
13270         $cat >> try.c <<'EOCP'
13271 int main()
13272 {
13273         int pd[2];
13274         int pu[2];
13275         char buf[1];
13276         char string[100];
13277         int ret;
13278
13279         ret = pipe(pd); /* Down: child -> parent */
13280         if (ret != 0)
13281                 exit(3);
13282         ret = pipe(pu); /* Up: parent -> child */
13283         if (ret != 0)
13284                 exit(3);
13285         if (0 != fork()) {
13286                 close(pd[1]);   /* Parent reads from pd[0] */
13287                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13288 #ifdef F_SETFL
13289                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13290                         exit(1);
13291 #else
13292                 exit(4);
13293 #endif
13294                 signal(SIGALRM, blech);
13295                 alarm(5);
13296                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13297                         exit(2);
13298                 sprintf(string, "%d\n", ret);
13299                 ret = write(2, string, strlen(string));
13300                 if (ret != strlen(string))
13301                         exit(3);
13302                 alarm(0);
13303 #ifdef EAGAIN
13304                 if (errno == EAGAIN) {
13305                         printf("EAGAIN\n");
13306                         goto ok;
13307                 }
13308 #endif
13309 #ifdef EWOULDBLOCK
13310                 if (errno == EWOULDBLOCK)
13311                         printf("EWOULDBLOCK\n");
13312 #endif
13313         ok:
13314                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13315                 if (ret != 1)
13316                         exit(3);
13317                 sleep(2);                               /* Give it time to close our pipe */
13318                 alarm(5);
13319                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13320                 alarm(0);
13321                 sprintf(string, "%d\n", ret);
13322                 ret = write(4, string, strlen(string));
13323                 if (ret != strlen(string))
13324                         exit(3);
13325                 exit(0);
13326         }
13327
13328         close(pd[0]);                   /* We write to pd[1] */
13329         close(pu[1]);                   /* We read from pu[0] */
13330         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13331         if (ret != 1)
13332                 exit(3);
13333         close(pd[1]);                   /* Pipe pd is now fully closed! */
13334         exit(0);                                /* Bye bye, thank you for playing! */
13335 }
13336 EOCP
13337         set try
13338         if eval $compile_ok; then
13339                 echo "$startsh" >mtry
13340                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13341                 chmod +x mtry
13342                 $run ./mtry >/dev/null 2>&1
13343                 case $? in
13344                 0) eagain=`$cat try.out`;;
13345                 1) echo "Could not perform non-blocking setting!";;
13346                 2) echo "I did a successful read() for something that was not there!";;
13347                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13348                 4) echo "Could not find F_SETFL!";;
13349                 *) echo "Something terribly wrong happened during testing.";;
13350                 esac
13351                 rd_nodata=`$cat try.ret`
13352                 echo "A read() system call with no data present returns $rd_nodata."
13353                 case "$rd_nodata" in
13354                 0|-1) ;;
13355                 *)
13356                         echo "(That's peculiar, fixing that to be -1.)"
13357                         rd_nodata=-1
13358                         ;;
13359                 esac
13360                 case "$eagain" in
13361                 '')
13362                         echo "Forcing errno EAGAIN on read() with no data available."
13363                         eagain=EAGAIN
13364                         ;;
13365                 *)
13366                         echo "Your read() sets errno to $eagain when no data is available."
13367                         ;;
13368                 esac
13369                 status=`$cat try.err`
13370                 case "$status" in
13371                 0) echo "And it correctly returns 0 to signal EOF.";;
13372                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13373                 *) echo "However, your read() returns '$status' on EOF??";;
13374                 esac
13375                 val="$define"
13376                 if test "$status" = "$rd_nodata"; then
13377                         echo "WARNING: you can't distinguish between EOF and no data!"
13378                         val="$undef"
13379                 fi
13380         else
13381                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13382                 eagain=EAGAIN
13383         fi
13384         ;;
13385         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13386                 eagain=EAGAIN
13387                 val="$define"
13388                 ;;
13389         esac
13390         set d_eofnblk
13391         eval $setvar
13392         ;;
13393 *)
13394         echo "Using $hint value $eagain."
13395         echo "Your read() returns $rd_nodata when no data is present."
13396         case "$d_eofnblk" in
13397         "$define") echo "And you can see EOF because read() returns 0.";;
13398         "$undef") echo "But you can't see EOF status from read() returned value.";;
13399         *)
13400                 echo "(Assuming you can't see EOF status from read anyway.)"
13401                 d_eofnblk=$undef
13402                 ;;
13403         esac
13404         ;;
13405 esac
13406 $rm_try head.c mtry
13407
13408 : see if erf exists
13409 set erf d_erf
13410 eval $inlibc
13411
13412 : see if erfc exists
13413 set erfc d_erfc
13414 eval $inlibc
13415
13416 : see if exp2 exists
13417 set exp2 d_exp2
13418 eval $inlibc
13419
13420 : see if expm1 exists
13421 set expm1 d_expm1
13422 eval $inlibc
13423
13424 : see if _ptr and _cnt from stdio act std
13425 echo " "
13426
13427 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13428         echo "(Looks like you have stdio.h from BSD.)"
13429         case "$stdio_ptr" in
13430         '') stdio_ptr='((fp)->_p)'
13431                 ptr_lval=$define
13432                 ;;
13433         *)      ptr_lval=$d_stdio_ptr_lval;;
13434         esac
13435         case "$stdio_cnt" in
13436         '') stdio_cnt='((fp)->_r)'
13437                 cnt_lval=$define
13438                 ;;
13439         *)      cnt_lval=$d_stdio_cnt_lval;;
13440         esac
13441         case "$stdio_base" in
13442         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13443         esac
13444         case "$stdio_bufsiz" in
13445         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13446         esac
13447 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13448         echo "(Looks like you have stdio.h from Linux.)"
13449         case "$stdio_ptr" in
13450         '') stdio_ptr='((fp)->_IO_read_ptr)'
13451                 ptr_lval=$define
13452                 ;;
13453         *)      ptr_lval=$d_stdio_ptr_lval;;
13454         esac
13455         case "$stdio_cnt" in
13456         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13457                 cnt_lval=$undef
13458                 ;;
13459         *)      cnt_lval=$d_stdio_cnt_lval;;
13460         esac
13461         case "$stdio_base" in
13462         '') stdio_base='((fp)->_IO_read_base)';;
13463         esac
13464         case "$stdio_bufsiz" in
13465         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13466         esac
13467 else
13468         case "$stdio_ptr" in
13469         '') stdio_ptr='((fp)->_ptr)'
13470                 ptr_lval=$define
13471                 ;;
13472         *)      ptr_lval=$d_stdio_ptr_lval;;
13473         esac
13474         case "$stdio_cnt" in
13475         '') stdio_cnt='((fp)->_cnt)'
13476                 cnt_lval=$define
13477                 ;;
13478         *)      cnt_lval=$d_stdio_cnt_lval;;
13479         esac
13480         case "$stdio_base" in
13481         '') stdio_base='((fp)->_base)';;
13482         esac
13483         case "$stdio_bufsiz" in
13484         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13485         esac
13486 fi
13487
13488 : test whether _ptr and _cnt really work
13489 echo "Checking how std your stdio is..." >&4
13490 $cat >try.c <<EOP
13491 #include <stdio.h>
13492 #$i_stdlib I_STDLIB
13493 #ifdef I_STDLIB
13494 #include <stdlib.h>
13495 #endif
13496 #define FILE_ptr(fp)    $stdio_ptr
13497 #define FILE_cnt(fp)    $stdio_cnt
13498 int main() {
13499         FILE *fp = fopen("try.c", "r");
13500         char c = getc(fp);
13501         if (
13502                 18 <= FILE_cnt(fp) &&
13503                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13504         )
13505                 exit(0);
13506         exit(1);
13507 }
13508 EOP
13509 val="$undef"
13510 set try
13511 if eval $compile && $to try.c; then
13512         if $run ./try; then
13513                 echo "Your stdio acts pretty std."
13514                 val="$define"
13515         else
13516                 echo "Your stdio isn't very std."
13517         fi
13518 else
13519         echo "Your stdio doesn't appear very std."
13520 fi
13521 $rm_try
13522
13523 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13524 # direct buffer manipulation no longer works.  The Configure tests
13525 # should be changed to correctly detect this, but until then,
13526 # the following check should at least let perl compile and run.
13527 # (This quick fix should be updated before 5.8.1.)
13528 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13529 # A. Dougherty, June 3, 2002.
13530 case "$d_gnulibc" in
13531 $define)
13532         case "$gnulibc_version" in
13533         2.[01]*)  ;;
13534         2.2) ;;
13535         2.2.[0-9]) ;;
13536         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13537                 val="$undef"
13538                 ;;
13539         esac
13540         ;;
13541 esac
13542 set d_stdstdio
13543 eval $setvar
13544
13545 : Can _ptr be used as an lvalue?
13546 case "$d_stdstdio$ptr_lval" in
13547 $define$define) val=$define ;;
13548 *) val=$undef ;;
13549 esac
13550 set d_stdio_ptr_lval
13551 eval $setvar
13552
13553 : Can _cnt be used as an lvalue?
13554 case "$d_stdstdio$cnt_lval" in
13555 $define$define) val=$define ;;
13556 *) val=$undef ;;
13557 esac
13558 set d_stdio_cnt_lval
13559 eval $setvar
13560
13561
13562 : test whether setting _ptr sets _cnt as a side effect
13563 d_stdio_ptr_lval_sets_cnt="$undef"
13564 d_stdio_ptr_lval_nochange_cnt="$undef"
13565 case "$d_stdio_ptr_lval$d_stdstdio" in
13566 $define$define)
13567         echo "Checking to see what happens if we set the stdio ptr..." >&4
13568 $cat >try.c <<EOP
13569 #include <stdio.h>
13570 /* Can we scream? */
13571 /* Eat dust sed :-) */
13572 /* In the buffer space, no one can hear you scream. */
13573 #$i_stdlib I_STDLIB
13574 #ifdef I_STDLIB
13575 #include <stdlib.h>
13576 #endif
13577 #define FILE_ptr(fp)    $stdio_ptr
13578 #define FILE_cnt(fp)    $stdio_cnt
13579 #include <sys/types.h>
13580 int main() {
13581         FILE *fp = fopen("try.c", "r");
13582         int c;
13583         char *ptr;
13584         size_t cnt;
13585         if (!fp) {
13586             puts("Fail even to read");
13587             exit(1);
13588         }
13589         c = getc(fp); /* Read away the first # */
13590         if (c == EOF) {
13591             puts("Fail even to read");
13592             exit(1);
13593         }
13594         if (!(
13595                 18 <= FILE_cnt(fp) &&
13596                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13597         )) {
13598                 puts("Fail even to read");
13599                 exit (1);
13600         }
13601         ptr = (char*) FILE_ptr(fp);
13602         cnt = (size_t)FILE_cnt(fp);
13603
13604         FILE_ptr(fp) += 42;
13605
13606         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13607                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13608                 exit (1);
13609         }
13610         if (FILE_cnt(fp) <= 20) {
13611                 printf ("Fail (<20 chars to test)");
13612                 exit (1);
13613         }
13614         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13615                 puts("Fail compare");
13616                 exit (1);
13617         }
13618         if (cnt == FILE_cnt(fp)) {
13619                 puts("Pass_unchanged");
13620                 exit (0);
13621         }
13622         if (FILE_cnt(fp) == (cnt - 42)) {
13623                 puts("Pass_changed");
13624                 exit (0);
13625         }
13626         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13627         return 1;
13628
13629 }
13630 EOP
13631         set try
13632         if eval $compile && $to try.c; then
13633                 case `$run ./try` in
13634                 Pass_changed)
13635                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13636                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13637                 Pass_unchanged)
13638                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13639                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13640                 Fail*)
13641                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13642                 *)
13643                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13644         esac
13645         else
13646                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13647         fi
13648         $rm_try
13649         ;;
13650 esac
13651
13652 : see if _base is also standard
13653 val="$undef"
13654 case "$d_stdstdio" in
13655 $define)
13656         $cat >try.c <<EOP
13657 #include <stdio.h>
13658 #$i_stdlib I_STDLIB
13659 #ifdef I_STDLIB
13660 #include <stdlib.h>
13661 #endif
13662 #define FILE_base(fp)   $stdio_base
13663 #define FILE_bufsiz(fp) $stdio_bufsiz
13664 int main() {
13665         FILE *fp = fopen("try.c", "r");
13666         char c = getc(fp);
13667         if (
13668                 19 <= FILE_bufsiz(fp) &&
13669                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13670         )
13671                 exit(0);
13672         exit(1);
13673 }
13674 EOP
13675         set try
13676         if eval $compile && $to try.c; then
13677                 if $run ./try; then
13678                         echo "And its _base field acts std."
13679                         val="$define"
13680                 else
13681                         echo "But its _base field isn't std."
13682                 fi
13683         else
13684                 echo "However, it seems to be lacking the _base field."
13685         fi
13686         $rm_try
13687         ;;
13688 esac
13689 set d_stdiobase
13690 eval $setvar
13691
13692 : see if fast_stdio exists
13693 val="$undef"
13694 case "$d_stdstdio:$d_stdio_ptr_lval" in
13695 "$define:$define")
13696         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13697         *$define*)
13698                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13699                 val="$define"
13700                 ;;
13701         esac
13702         ;;
13703 esac
13704 set d_faststdio
13705 eval $setvar
13706
13707
13708
13709 : see if fchdir exists
13710 set fchdir d_fchdir
13711 eval $inlibc
13712
13713 : see if fchmod exists
13714 set fchmod d_fchmod
13715 eval $inlibc
13716
13717 : check for openat, unlinkat, renameat, linkat, fchmodat
13718 set openat d_openat
13719 eval $inlibc
13720
13721 set unlinkat d_unlinkat
13722 eval $inlibc
13723
13724 set renameat d_renameat
13725 eval $inlibc
13726
13727 set linkat d_linkat
13728 eval $inlibc
13729
13730 set fchmodat d_fchmodat
13731 eval $inlibc
13732
13733 : see if fchown exists
13734 set fchown d_fchown
13735 eval $inlibc
13736
13737 : see if this is an fcntl system
13738 set fcntl d_fcntl
13739 eval $inlibc
13740
13741 : See if fcntl-based locking works.
13742 echo " "
13743 $cat >try.c <<EOCP
13744 #$i_stdlib I_STDLIB
13745 #ifdef I_STDLIB
13746 #include <stdlib.h>
13747 #endif
13748 #include <unistd.h>
13749 #include <fcntl.h>
13750 #include <signal.h>
13751 $signal_t blech(int x) { exit(3); }
13752 int main() {
13753 #if defined(F_SETLK) && defined(F_SETLKW)
13754      struct flock flock;
13755      int retval, fd;
13756      fd = open("try.c", O_RDONLY);
13757      flock.l_type = F_RDLCK;
13758      flock.l_whence = SEEK_SET;
13759      flock.l_start = flock.l_len = 0;
13760      signal(SIGALRM, blech);
13761      alarm(10);
13762      retval = fcntl(fd, F_SETLK, &flock);
13763      close(fd);
13764      (retval < 0 ? exit(2) : exit(0));
13765 #else
13766      exit(2);
13767 #endif
13768 }
13769 EOCP
13770 echo "Checking if fcntl-based file locking works... "
13771 case "$d_fcntl" in
13772 "$define")
13773         set try
13774         if eval $compile_ok; then
13775                 if $run ./try; then
13776                         echo "Yes, it seems to work."
13777                         val="$define"
13778                 else
13779                         echo "Nope, it didn't work."
13780                         val="$undef"
13781                         case "$?" in
13782                         3) $cat >&4 <<EOM
13783 ***
13784 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13785 *** This is (almost) impossible.
13786 *** If your NFS lock daemons are not feeling well, something like
13787 *** this may happen, please investigate.  Cannot continue, aborting.
13788 ***
13789 EOM
13790                                 exit 1
13791                                 ;;
13792                         esac
13793                 fi
13794         else
13795                 echo "I'm unable to compile the test program, so I'll assume not."
13796                 val="$undef"
13797         fi
13798         ;;
13799 *) val="$undef";
13800         echo "Nope, since you don't even have fcntl()."
13801         ;;
13802 esac
13803 set d_fcntl_can_lock
13804 eval $setvar
13805 $rm_try
13806
13807 : check for fd_set items
13808 $cat <<EOM
13809
13810 Checking to see how well your C compiler handles fd_set and friends ...
13811 EOM
13812 $cat >try.c <<EOCP
13813 #$i_stdlib I_STDLIB
13814 #ifdef I_STDLIB
13815 #include <stdlib.h>
13816 #endif
13817 #$i_systime I_SYS_TIME
13818 #$i_sysselct I_SYS_SELECT
13819 #$d_socket HAS_SOCKET
13820 #include <sys/types.h>
13821 #ifdef HAS_SOCKET
13822 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13823 #endif
13824 #ifdef I_SYS_TIME
13825 #include <sys/time.h>
13826 #endif
13827 #ifdef I_SYS_SELECT
13828 #include <sys/select.h>
13829 #endif
13830 int main() {
13831         fd_set fds;
13832
13833 #ifdef TRYBITS
13834         if(fds.fds_bits);
13835 #endif
13836
13837 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13838         exit(0);
13839 #else
13840         exit(1);
13841 #endif
13842 }
13843 EOCP
13844 set try -DTRYBITS
13845 if eval $compile; then
13846         d_fds_bits="$define"
13847         d_fd_set="$define"
13848         echo "Well, your system knows about the normal fd_set typedef..." >&4
13849         if $run ./try; then
13850                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13851                 d_fd_macros="$define"
13852         else
13853                 $cat >&4 <<'EOM'
13854 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13855 EOM
13856                 d_fd_macros="$undef"
13857         fi
13858 else
13859         $cat <<'EOM'
13860 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13861 EOM
13862         set try
13863         if eval $compile; then
13864                 d_fds_bits="$undef"
13865                 d_fd_set="$define"
13866                 echo "Well, your system has some sort of fd_set available..." >&4
13867                 if $run ./try; then
13868                         echo "and you have the normal fd_set macros." >&4
13869                         d_fd_macros="$define"
13870                 else
13871                         $cat <<'EOM'
13872 but not the normal fd_set macros!  Gross!  More work for me...
13873 EOM
13874                         d_fd_macros="$undef"
13875                 fi
13876         else
13877         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13878                 d_fd_set="$undef"
13879                 d_fds_bits="$undef"
13880                 d_fd_macros="$undef"
13881         fi
13882 fi
13883 $rm_try
13884
13885 : see if fdclose exists
13886 set fdclose d_fdclose
13887 eval $inlibc
13888
13889 : see if fdim exists
13890 set fdim d_fdim
13891 eval $inlibc
13892
13893 : see if fegetround exists
13894 set fegetround d_fegetround
13895 eval $inlibc
13896
13897 : see if fgetpos exists
13898 set fgetpos d_fgetpos
13899 eval $inlibc
13900
13901 : see if finite exists
13902 set finite d_finite
13903 eval $inlibc
13904
13905 : see if finitel exists
13906 set finitel d_finitel
13907 eval $inlibc
13908
13909 : see if flock exists
13910 set flock d_flock
13911 eval $inlibc
13912
13913 : see if prototype for flock is available
13914 echo " "
13915 set d_flockproto flock $i_sysfile sys/file.h
13916 eval $hasproto
13917
13918 : see if fma exists
13919 set fma d_fma
13920 eval $inlibc
13921
13922 : see if fmax exists
13923 set fmax d_fmax
13924 eval $inlibc
13925
13926 : see if fmin exists
13927 set fmin d_fmin
13928 eval $inlibc
13929
13930 : see if fp_class exists
13931 set fp_class d_fp_class
13932 eval $inlibc
13933
13934 : check for fpclassify
13935 echo "Checking to see if you have fpclassify..." >&4
13936 $cat >try.c <<EOCP
13937 #include <math.h>
13938 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13939 EOCP
13940 set try
13941 if eval $compile; then
13942         val="$define"
13943         echo "You have fpclassify."
13944 else
13945         val="$undef"
13946         echo "You do not have fpclassify."
13947 fi
13948 $rm_try
13949 set d_fpclassify
13950 eval $setvar
13951
13952 : see if fp_classify exists
13953 set fp_classify d_fp_classify
13954 eval $inlibc
13955
13956 : see if fp_classl exists
13957 set fp_classl d_fp_classl
13958 eval $inlibc
13959
13960 : see if pathconf exists
13961 set pathconf d_pathconf
13962 eval $inlibc
13963
13964 : see if fpathconf exists
13965 set fpathconf d_fpathconf
13966 eval $inlibc
13967
13968 : see if fpclass exists
13969 set fpclass d_fpclass
13970 eval $inlibc
13971
13972 : see if fpclassl exists
13973 set fpclassl d_fpclassl
13974 eval $inlibc
13975
13976 : see if fpgetround exists
13977 set fpgetround d_fpgetround
13978 eval $inlibc
13979
13980 : check for fpos64_t
13981 echo " "
13982 echo "Checking to see if you have fpos64_t..." >&4
13983 $cat >try.c <<EOCP
13984 #include <stdio.h>
13985 int main() { fpos64_t x = 7; }
13986 EOCP
13987 set try
13988 if eval $compile; then
13989         val="$define"
13990         echo "You have fpos64_t."
13991 else
13992         val="$undef"
13993         echo "You do not have fpos64_t."
13994         case "$fpossize" in
13995         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13996         esac
13997 fi
13998 $rm_try
13999 set d_fpos64_t
14000 eval $setvar
14001
14002 : see if this is an xlocale.h system
14003 set xlocale.h i_xlocale
14004 eval $inhdr
14005
14006 : see if newlocale exists
14007 set newlocale d_newlocale
14008 eval $inlibc
14009
14010 : see if freelocale exists
14011 set freelocale d_freelocale
14012 eval $inlibc
14013
14014 : see if uselocale exists
14015 set uselocale d_uselocale
14016 eval $inlibc
14017
14018 : see if duplocale exists
14019 set duplocale d_duplocale
14020 eval $inlibc
14021
14022 : see if querylocale exists
14023 set querylocale d_querylocale
14024 eval $inlibc
14025
14026 : see if frexpl exists
14027 set frexpl d_frexpl
14028 eval $inlibc
14029
14030 : see if this is a sys/param system
14031 set sys/param.h i_sysparam
14032 eval $inhdr
14033
14034 : see if this is a sys/mount.h system
14035 set sys/mount.h i_sysmount
14036 eval $inhdr
14037
14038 : Check for fs_data_s
14039 echo " "
14040 echo "Checking to see if your system supports struct fs_data..." >&4
14041 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14042 eval $hasstruct
14043 case "$d_fs_data_s" in
14044 "$define")      echo "Yes, it does."   ;;
14045 *)              echo "No, it doesn't." ;;
14046 esac
14047
14048 : see if fseeko exists
14049 set fseeko d_fseeko
14050 eval $inlibc
14051 case "$longsize" in
14052 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14053 esac
14054
14055 : see if fsetpos exists
14056 set fsetpos d_fsetpos
14057 eval $inlibc
14058
14059 : see if fstatfs exists
14060 set fstatfs d_fstatfs
14061 eval $inlibc
14062
14063 : see if statvfs exists
14064 set statvfs d_statvfs
14065 eval $inlibc
14066
14067 : see if fstatvfs exists
14068 set fstatvfs d_fstatvfs
14069 eval $inlibc
14070
14071
14072 : see if fsync exists
14073 set fsync d_fsync
14074 eval $inlibc
14075
14076 : see if ftello exists
14077 set ftello d_ftello
14078 eval $inlibc
14079 case "$longsize" in
14080 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14081 esac
14082
14083 : check for a working futimes
14084 d_futimes="$undef"
14085 echo " "
14086 echo "Checking if you have a working futimes()" >&4
14087 $cat >try.c <<EOCP
14088 #include <stdio.h>
14089 #include <sys/time.h>
14090 #include <errno.h>
14091 #include <fcntl.h>
14092
14093 int main ()
14094 {
14095     int fd, rv;
14096     fd = open ("try.c", O_RDWR);
14097     if (-1 == fd) exit (1);
14098     rv = futimes (fd, NULL);
14099     exit (rv == -1 ? errno : 0);
14100 }
14101 EOCP
14102 set try
14103 if eval $compile; then
14104     `$run ./try`
14105     rc=$?
14106     case "$rc" in
14107         0)  echo "Yes, you have" >&4
14108             d_futimes="$define"
14109             ;;
14110         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14111             ;;
14112     esac
14113 else
14114     echo "No, it does not (probably harmless)" >&4
14115 fi
14116 $rm_try
14117
14118 : look for gai_strerror
14119 echo " "
14120 $cat >try.c <<'EOCP'
14121 #include <sys/types.h>
14122 #include <sys/socket.h>
14123 #include <netdb.h>
14124 int main ()
14125 {
14126     return (gai_strerror (0) ? 0 : 1);
14127     }
14128 EOCP
14129 set try
14130 val="$undef"
14131 if eval $compile; then
14132     `$run ./try`
14133     case "$?" in
14134         0)  echo "A working gai_strerror() found." >&4
14135             val="$define" ;;
14136         *)  echo "gai_strerror() found, but it doesn't work" >&4
14137             ;;
14138         esac
14139 else
14140     echo "gai_strerror() NOT found." >&4
14141     fi
14142 set d_gai_strerror
14143 eval $setvar
14144 $rm_try
14145
14146 : see if ndbm.h is available
14147 set ndbm.h i_ndbm
14148 eval $inhdr
14149 : Compatibility location for RedHat 7.1
14150 set gdbm/ndbm.h i_gdbmndbm
14151 eval $inhdr
14152 : Compatibility location for Debian 4.0
14153 set gdbm-ndbm.h i_gdbm_ndbm
14154 eval $inhdr
14155
14156 val="$undef"
14157 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14158         : see if dbm_open exists
14159         set dbm_open d_dbm_open
14160         eval $inlibc
14161         case "$d_dbm_open" in
14162         $undef)
14163                 i_ndbm="$undef"
14164                 i_gdbmndbm="$undef"
14165                 i_gdbm_ndbm="$undef"
14166                 echo "We won't be including <ndbm.h>"
14167                 val="$undef"
14168                 ;;
14169         *) val="$define"
14170            ;;
14171         esac
14172 fi
14173 set d_ndbm
14174 eval $setvar
14175
14176 ndbm_hdr_protochk='name=$1; hdr=$2;
14177 eval "ihdr=\$""i_$name";
14178 val="$undef";
14179 if $test "$ihdr" = "$define"; then
14180         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14181         case "$d_cplusplus" in
14182         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14183         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14184         esac;
14185         case "$val" in
14186         $define) $echo "Your <$hdr> seems to have prototypes";;
14187         *) $echo "Your <$hdr> does not seem to have prototypes";;
14188         esac;
14189 fi;
14190 set "d_${name}_h_uses_prototypes";
14191 eval $setvar'
14192
14193 set ndbm ndbm.h
14194 eval $ndbm_hdr_protochk
14195 set gdbmndbm gdbm/ndbm.h
14196 eval $ndbm_hdr_protochk
14197 set gdbm_ndbm gdbm-ndbm.h
14198 eval $ndbm_hdr_protochk
14199
14200 : see if getaddrinfo exists
14201 set getaddrinfo d_getaddrinfo
14202 eval $inlibc
14203
14204 : see if getcwd exists
14205 set getcwd d_getcwd
14206 eval $inlibc
14207
14208 : see if getespwnam exists
14209 set getespwnam d_getespwnam
14210 eval $inlibc
14211
14212 : see if getfsstat exists
14213 set getfsstat d_getfsstat
14214 eval $inlibc
14215
14216 : see if getgrent exists
14217 set getgrent d_getgrent
14218 eval $inlibc
14219
14220 : see if getgrent_r exists
14221 set getgrent_r d_getgrent_r
14222 eval $inlibc
14223 case "$d_getgrent_r" in
14224 "$define")
14225         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14226         case "$d_getgrent_r_proto:$usethreads" in
14227         ":define")      d_getgrent_r_proto=define
14228                 set d_getgrent_r_proto getgrent_r $hdrs
14229                 eval $hasproto ;;
14230         *)      ;;
14231         esac
14232         case "$d_getgrent_r_proto" in
14233         define)
14234         case "$getgrent_r_proto" in
14235         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14236         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14237         esac
14238         case "$getgrent_r_proto" in
14239         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14240         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14241         esac
14242         case "$getgrent_r_proto" in
14243         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14244         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14245         esac
14246         case "$getgrent_r_proto" in
14247         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14248         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14249         esac
14250         case "$getgrent_r_proto" in
14251         ''|0) try='int getgrent_r(struct group*, char*, int);'
14252         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14253         esac
14254         case "$getgrent_r_proto" in
14255         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14256         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14257         esac
14258         case "$getgrent_r_proto" in
14259         ''|0)   d_getgrent_r=undef
14260                 getgrent_r_proto=0
14261                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14262         * )     case "$getgrent_r_proto" in
14263                 REENTRANT_PROTO*) ;;
14264                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14265                 esac
14266                 echo "Prototype: $try" ;;
14267         esac
14268         ;;
14269         *)      case "$usethreads" in
14270                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14271                 esac
14272                 d_getgrent_r=undef
14273                 getgrent_r_proto=0
14274                 ;;
14275         esac
14276         ;;
14277 *)      getgrent_r_proto=0
14278         ;;
14279 esac
14280
14281 : see if getgrgid_r exists
14282 set getgrgid_r d_getgrgid_r
14283 eval $inlibc
14284 case "$d_getgrgid_r" in
14285 "$define")
14286         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14287         case "$d_getgrgid_r_proto:$usethreads" in
14288         ":define")      d_getgrgid_r_proto=define
14289                 set d_getgrgid_r_proto getgrgid_r $hdrs
14290                 eval $hasproto ;;
14291         *)      ;;
14292         esac
14293         case "$d_getgrgid_r_proto" in
14294         define)
14295         case "$getgrgid_r_proto" in
14296         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14297         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14298         esac
14299         case "$getgrgid_r_proto" in
14300         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14301         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14302         esac
14303         case "$getgrgid_r_proto" in
14304         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14305         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14306         esac
14307         case "$getgrgid_r_proto" in
14308         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14309         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14310         esac
14311         case "$getgrgid_r_proto" in
14312         ''|0)   d_getgrgid_r=undef
14313                 getgrgid_r_proto=0
14314                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14315         * )     case "$getgrgid_r_proto" in
14316                 REENTRANT_PROTO*) ;;
14317                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14318                 esac
14319                 echo "Prototype: $try" ;;
14320         esac
14321         ;;
14322         *)      case "$usethreads" in
14323                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14324                 esac
14325                 d_getgrgid_r=undef
14326                 getgrgid_r_proto=0
14327                 ;;
14328         esac
14329         ;;
14330 *)      getgrgid_r_proto=0
14331         ;;
14332 esac
14333
14334 : see if getgrnam_r exists
14335 set getgrnam_r d_getgrnam_r
14336 eval $inlibc
14337 case "$d_getgrnam_r" in
14338 "$define")
14339         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14340         case "$d_getgrnam_r_proto:$usethreads" in
14341         ":define")      d_getgrnam_r_proto=define
14342                 set d_getgrnam_r_proto getgrnam_r $hdrs
14343                 eval $hasproto ;;
14344         *)      ;;
14345         esac
14346         case "$d_getgrnam_r_proto" in
14347         define)
14348         case "$getgrnam_r_proto" in
14349         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14350         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14351         esac
14352         case "$getgrnam_r_proto" in
14353         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14354         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14355         esac
14356         case "$getgrnam_r_proto" in
14357         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14358         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14359         esac
14360         case "$getgrnam_r_proto" in
14361         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14362         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14363         esac
14364         case "$getgrnam_r_proto" in
14365         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14366         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14367         esac
14368         case "$getgrnam_r_proto" in
14369         ''|0)   d_getgrnam_r=undef
14370                 getgrnam_r_proto=0
14371                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14372         * )     case "$getgrnam_r_proto" in
14373                 REENTRANT_PROTO*) ;;
14374                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14375                 esac
14376                 echo "Prototype: $try" ;;
14377         esac
14378         ;;
14379         *)      case "$usethreads" in
14380                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14381                 esac
14382                 d_getgrnam_r=undef
14383                 getgrnam_r_proto=0
14384                 ;;
14385         esac
14386         ;;
14387 *)      getgrnam_r_proto=0
14388         ;;
14389 esac
14390
14391 : see if gethostbyaddr exists
14392 set gethostbyaddr d_gethbyaddr
14393 eval $inlibc
14394
14395 : see if gethostbyname exists
14396 set gethostbyname d_gethbyname
14397 eval $inlibc
14398
14399 : see if gethostent exists
14400 set gethostent d_gethent
14401 eval $inlibc
14402
14403 : see how we will look up host name
14404 echo " "
14405 call=''
14406 if set gethostname val -f d_gethname; eval $csym; $val; then
14407         echo 'gethostname() found.' >&4
14408         d_gethname="$define"
14409         call=gethostname
14410 fi
14411 if set uname val -f d_uname; eval $csym; $val; then
14412         if ./xenix; then
14413                 $cat <<'EOM'
14414 uname() was found, but you're running xenix, and older versions of xenix
14415 have a broken uname(). If you don't really know whether your xenix is old
14416 enough to have a broken system call, use the default answer.
14417
14418 EOM
14419                 dflt=y
14420                 case "$d_uname" in
14421                 "$define") dflt=n;;
14422                 esac
14423                 rp='Is your uname() broken?'
14424                 . ./myread
14425                 case "$ans" in
14426                 n*) d_uname="$define"; call=uname;;
14427                 esac
14428         else
14429                 echo 'uname() found.' >&4
14430                 d_uname="$define"
14431                 case "$call" in
14432                 '') call=uname ;;
14433                 esac
14434         fi
14435 fi
14436 case "$d_gethname" in
14437 '') d_gethname="$undef";;
14438 esac
14439 case "$d_uname" in
14440 '') d_uname="$undef";;
14441 esac
14442 case "$d_uname$d_gethname" in
14443 *define*)
14444         dflt=n
14445         cat <<EOM
14446
14447 Every now and then someone has a $call() that lies about the hostname
14448 but can't be fixed for political or economic reasons.  If you wish, I can
14449 pretend $call() isn't there and maybe compute hostname at run-time
14450 thanks to the '$phostname' command.
14451
14452 EOM
14453         rp="Shall I ignore $call() from now on?"
14454         . ./myread
14455         case "$ans" in
14456         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14457         esac;;
14458 esac
14459 case "$phostname" in
14460 '') aphostname='';;
14461 *) case "$aphostname" in
14462         /*) ;;
14463         *) set X $phostname
14464                 shift
14465                 file=$1
14466                 shift
14467                 file=`./loc $file $file $pth`
14468                 aphostname=`echo $file $*`
14469                 ;;
14470         esac
14471         ;;
14472 esac
14473 case "$d_uname$d_gethname" in
14474 *define*) ;;
14475 *)
14476         case "$phostname" in
14477         '')
14478                 echo "There will be no way for $package to get your hostname." >&4;;
14479         *)
14480         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14481                 ;;
14482         esac;;
14483 esac
14484 case "$d_phostname" in
14485 '') d_phostname="$undef";;
14486 esac
14487
14488 : see if gethostbyaddr_r exists
14489 set gethostbyaddr_r d_gethostbyaddr_r
14490 eval $inlibc
14491 case "$d_gethostbyaddr_r" in
14492 "$define")
14493         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14494         case "$d_gethostbyaddr_r_proto:$usethreads" in
14495         ":define")      d_gethostbyaddr_r_proto=define
14496                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14497                 eval $hasproto ;;
14498         *)      ;;
14499         esac
14500         case "$d_gethostbyaddr_r_proto" in
14501         define)
14502         case "$gethostbyaddr_r_proto" in
14503         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14504         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14505         esac
14506         case "$gethostbyaddr_r_proto" in
14507         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14508         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14509         esac
14510         case "$gethostbyaddr_r_proto" in
14511         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14512         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14513         esac
14514         case "$gethostbyaddr_r_proto" in
14515         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14516         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14517         esac
14518         case "$gethostbyaddr_r_proto" in
14519         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14520         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14521         esac
14522         case "$gethostbyaddr_r_proto" in
14523         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14524         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14525         esac
14526         case "$gethostbyaddr_r_proto" in
14527         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14528         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14529         esac
14530         case "$gethostbyaddr_r_proto" in
14531         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14532         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14533         esac
14534         case "$gethostbyaddr_r_proto" in
14535         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14536         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14537         esac
14538         case "$gethostbyaddr_r_proto" in
14539         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14540         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14541         esac
14542         case "$gethostbyaddr_r_proto" in
14543         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14544         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14545         esac
14546         case "$gethostbyaddr_r_proto" in
14547         ''|0)   d_gethostbyaddr_r=undef
14548                 gethostbyaddr_r_proto=0
14549                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14550         * )     case "$gethostbyaddr_r_proto" in
14551                 REENTRANT_PROTO*) ;;
14552                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14553                 esac
14554                 echo "Prototype: $try" ;;
14555         esac
14556         ;;
14557         *)      case "$usethreads" in
14558                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14559                 esac
14560                 d_gethostbyaddr_r=undef
14561                 gethostbyaddr_r_proto=0
14562                 ;;
14563         esac
14564         ;;
14565 *)      gethostbyaddr_r_proto=0
14566         ;;
14567 esac
14568
14569 : see if gethostbyname_r exists
14570 set gethostbyname_r d_gethostbyname_r
14571 eval $inlibc
14572 case "$d_gethostbyname_r" in
14573 "$define")
14574         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14575         case "$d_gethostbyname_r_proto:$usethreads" in
14576         ":define")      d_gethostbyname_r_proto=define
14577                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14578                 eval $hasproto ;;
14579         *)      ;;
14580         esac
14581         case "$d_gethostbyname_r_proto" in
14582         define)
14583         case "$gethostbyname_r_proto" in
14584         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14585         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14586         esac
14587         case "$gethostbyname_r_proto" in
14588         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14589         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14590         esac
14591         case "$gethostbyname_r_proto" in
14592         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14593         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14594         esac
14595         case "$gethostbyname_r_proto" in
14596         ''|0)   d_gethostbyname_r=undef
14597                 gethostbyname_r_proto=0
14598                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14599         * )     case "$gethostbyname_r_proto" in
14600                 REENTRANT_PROTO*) ;;
14601                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14602                 esac
14603                 echo "Prototype: $try" ;;
14604         esac
14605         ;;
14606         *)      case "$usethreads" in
14607                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14608                 esac
14609                 d_gethostbyname_r=undef
14610                 gethostbyname_r_proto=0
14611                 ;;
14612         esac
14613         ;;
14614 *)      gethostbyname_r_proto=0
14615         ;;
14616 esac
14617
14618 : see if gethostent_r exists
14619 set gethostent_r d_gethostent_r
14620 eval $inlibc
14621 case "$d_gethostent_r" in
14622 "$define")
14623         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14624         case "$d_gethostent_r_proto:$usethreads" in
14625         ":define")      d_gethostent_r_proto=define
14626                 set d_gethostent_r_proto gethostent_r $hdrs
14627                 eval $hasproto ;;
14628         *)      ;;
14629         esac
14630         case "$d_gethostent_r_proto" in
14631         define)
14632         case "$gethostent_r_proto" in
14633         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14634         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14635         esac
14636         case "$gethostent_r_proto" in
14637         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14638         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14639         esac
14640         case "$gethostent_r_proto" in
14641         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14642         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14643         esac
14644         case "$gethostent_r_proto" in
14645         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14646         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14647         esac
14648         case "$gethostent_r_proto" in
14649         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14650         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14651         esac
14652         case "$gethostent_r_proto" in
14653         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14654         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14655         esac
14656         case "$gethostent_r_proto" in
14657         ''|0)   d_gethostent_r=undef
14658                 gethostent_r_proto=0
14659                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14660         * )     case "$gethostent_r_proto" in
14661                 REENTRANT_PROTO*) ;;
14662                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14663                 esac
14664                 echo "Prototype: $try" ;;
14665         esac
14666         ;;
14667         *)      case "$usethreads" in
14668                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14669                 esac
14670                 d_gethostent_r=undef
14671                 gethostent_r_proto=0
14672                 ;;
14673         esac
14674         ;;
14675 *)      gethostent_r_proto=0
14676         ;;
14677 esac
14678
14679 : see if prototypes for various gethostxxx netdb.h functions are available
14680 echo " "
14681 set d_gethostprotos gethostent $i_netdb netdb.h
14682 eval $hasproto
14683
14684 : see if getitimer exists
14685 set getitimer d_getitimer
14686 eval $inlibc
14687
14688 : see if getlogin exists
14689 set getlogin d_getlogin
14690 eval $inlibc
14691
14692 : see if getlogin_r exists
14693 set getlogin_r d_getlogin_r
14694 eval $inlibc
14695 case "$d_getlogin_r" in
14696 "$define")
14697         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14698         case "$d_getlogin_r_proto:$usethreads" in
14699         ":define")      d_getlogin_r_proto=define
14700                 set d_getlogin_r_proto getlogin_r $hdrs
14701                 eval $hasproto ;;
14702         *)      ;;
14703         esac
14704         case "$d_getlogin_r_proto" in
14705         define)
14706         case "$getlogin_r_proto" in
14707         ''|0) try='int getlogin_r(char*, size_t);'
14708         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14709         esac
14710         case "$getlogin_r_proto" in
14711         ''|0) try='int getlogin_r(char*, int);'
14712         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14713         esac
14714         case "$getlogin_r_proto" in
14715         ''|0) try='char* getlogin_r(char*, size_t);'
14716         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14717         esac
14718         case "$getlogin_r_proto" in
14719         ''|0) try='char* getlogin_r(char*, int);'
14720         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14721         esac
14722         case "$getlogin_r_proto" in
14723         ''|0)   d_getlogin_r=undef
14724                 getlogin_r_proto=0
14725                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14726         * )     case "$getlogin_r_proto" in
14727                 REENTRANT_PROTO*) ;;
14728                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14729                 esac
14730                 echo "Prototype: $try" ;;
14731         esac
14732         ;;
14733         *)      case "$usethreads" in
14734                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14735                 esac
14736                 d_getlogin_r=undef
14737                 getlogin_r_proto=0
14738                 ;;
14739         esac
14740         ;;
14741 *)      getlogin_r_proto=0
14742         ;;
14743 esac
14744
14745 : see if getmnt exists
14746 set getmnt d_getmnt
14747 eval $inlibc
14748
14749 : see if getmntent exists
14750 set getmntent d_getmntent
14751 eval $inlibc
14752
14753 : see if getnameinfo exists
14754 set getnameinfo d_getnameinfo
14755 eval $inlibc
14756
14757 : see if getnetbyaddr exists
14758 set getnetbyaddr d_getnbyaddr
14759 eval $inlibc
14760
14761 : see if getnetbyname exists
14762 set getnetbyname d_getnbyname
14763 eval $inlibc
14764
14765 : see if getnetent exists
14766 set getnetent d_getnent
14767 eval $inlibc
14768
14769 : see if getnetbyaddr_r exists
14770 set getnetbyaddr_r d_getnetbyaddr_r
14771 eval $inlibc
14772 case "$d_getnetbyaddr_r" in
14773 "$define")
14774         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14775         case "$d_getnetbyaddr_r_proto:$usethreads" in
14776         ":define")      d_getnetbyaddr_r_proto=define
14777                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14778                 eval $hasproto ;;
14779         *)      ;;
14780         esac
14781         case "$d_getnetbyaddr_r_proto" in
14782         define)
14783         case "$getnetbyaddr_r_proto" in
14784         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14785         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14786         esac
14787         case "$getnetbyaddr_r_proto" in
14788         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14789         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14790         esac
14791         case "$getnetbyaddr_r_proto" in
14792         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14793         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14794         esac
14795         case "$getnetbyaddr_r_proto" in
14796         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14797         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14798         esac
14799         case "$getnetbyaddr_r_proto" in
14800         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14801         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14802         esac
14803         case "$getnetbyaddr_r_proto" in
14804         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14805         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14806         esac
14807         case "$getnetbyaddr_r_proto" in
14808         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14809         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14810         esac
14811         case "$getnetbyaddr_r_proto" in
14812         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14813         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14814         esac
14815         case "$getnetbyaddr_r_proto" in
14816         ''|0)   d_getnetbyaddr_r=undef
14817                 getnetbyaddr_r_proto=0
14818                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14819         * )     case "$getnetbyaddr_r_proto" in
14820                 REENTRANT_PROTO*) ;;
14821                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14822                 esac
14823                 echo "Prototype: $try" ;;
14824         esac
14825         ;;
14826         *)      case "$usethreads" in
14827                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14828                 esac
14829                 d_getnetbyaddr_r=undef
14830                 getnetbyaddr_r_proto=0
14831                 ;;
14832         esac
14833         ;;
14834 *)      getnetbyaddr_r_proto=0
14835         ;;
14836 esac
14837
14838 : see if getnetbyname_r exists
14839 set getnetbyname_r d_getnetbyname_r
14840 eval $inlibc
14841 case "$d_getnetbyname_r" in
14842 "$define")
14843         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14844         case "$d_getnetbyname_r_proto:$usethreads" in
14845         ":define")      d_getnetbyname_r_proto=define
14846                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14847                 eval $hasproto ;;
14848         *)      ;;
14849         esac
14850         case "$d_getnetbyname_r_proto" in
14851         define)
14852         case "$getnetbyname_r_proto" in
14853         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14854         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14855         esac
14856         case "$getnetbyname_r_proto" in
14857         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14858         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14859         esac
14860         case "$getnetbyname_r_proto" in
14861         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14862         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14863         esac
14864         case "$getnetbyname_r_proto" in
14865         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14866         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14867         esac
14868         case "$getnetbyname_r_proto" in
14869         ''|0)   d_getnetbyname_r=undef
14870                 getnetbyname_r_proto=0
14871                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14872         * )     case "$getnetbyname_r_proto" in
14873                 REENTRANT_PROTO*) ;;
14874                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14875                 esac
14876                 echo "Prototype: $try" ;;
14877         esac
14878         ;;
14879         *)      case "$usethreads" in
14880                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14881                 esac
14882                 d_getnetbyname_r=undef
14883                 getnetbyname_r_proto=0
14884                 ;;
14885         esac
14886         ;;
14887 *)      getnetbyname_r_proto=0
14888         ;;
14889 esac
14890
14891 : see if getnetent_r exists
14892 set getnetent_r d_getnetent_r
14893 eval $inlibc
14894 case "$d_getnetent_r" in
14895 "$define")
14896         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14897         case "$d_getnetent_r_proto:$usethreads" in
14898         ":define")      d_getnetent_r_proto=define
14899                 set d_getnetent_r_proto getnetent_r $hdrs
14900                 eval $hasproto ;;
14901         *)      ;;
14902         esac
14903         case "$d_getnetent_r_proto" in
14904         define)
14905         case "$getnetent_r_proto" in
14906         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14907         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14908         esac
14909         case "$getnetent_r_proto" in
14910         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14911         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14912         esac
14913         case "$getnetent_r_proto" in
14914         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14915         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14916         esac
14917         case "$getnetent_r_proto" in
14918         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14919         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14920         esac
14921         case "$getnetent_r_proto" in
14922         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14923         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14924         esac
14925         case "$getnetent_r_proto" in
14926         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14927         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14928         esac
14929         case "$getnetent_r_proto" in
14930         ''|0)   d_getnetent_r=undef
14931                 getnetent_r_proto=0
14932                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14933         * )     case "$getnetent_r_proto" in
14934                 REENTRANT_PROTO*) ;;
14935                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14936                 esac
14937                 echo "Prototype: $try" ;;
14938         esac
14939         ;;
14940         *)      case "$usethreads" in
14941                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14942                 esac
14943                 d_getnetent_r=undef
14944                 getnetent_r_proto=0
14945                 ;;
14946         esac
14947         ;;
14948 *)      getnetent_r_proto=0
14949         ;;
14950 esac
14951
14952 : see if prototypes for various getnetxxx netdb.h functions are available
14953 echo " "
14954 set d_getnetprotos getnetent $i_netdb netdb.h
14955 eval $hasproto
14956
14957 : see if getpagesize exists
14958 set getpagesize d_getpagsz
14959 eval $inlibc
14960
14961 : Optional checks for getprotobyname and getprotobynumber
14962
14963 : see if getprotobyname exists
14964 set getprotobyname d_getpbyname
14965 eval $inlibc
14966
14967 : see if getprotobynumber exists
14968 set getprotobynumber d_getpbynumber
14969 eval $inlibc
14970
14971 : see if getprotoent exists
14972 set getprotoent d_getpent
14973 eval $inlibc
14974
14975 : see if getpgid exists
14976 set getpgid d_getpgid
14977 eval $inlibc
14978
14979 : see if getpgrp2 exists
14980 set getpgrp2 d_getpgrp2
14981 eval $inlibc
14982
14983 : see if getppid exists
14984 set getppid d_getppid
14985 eval $inlibc
14986
14987 : see if getpriority exists
14988 set getpriority d_getprior
14989 eval $inlibc
14990
14991 : see if getprotobyname_r exists
14992 set getprotobyname_r d_getprotobyname_r
14993 eval $inlibc
14994 case "$d_getprotobyname_r" in
14995 "$define")
14996         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14997         case "$d_getprotobyname_r_proto:$usethreads" in
14998         ":define")      d_getprotobyname_r_proto=define
14999                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15000                 eval $hasproto ;;
15001         *)      ;;
15002         esac
15003         case "$d_getprotobyname_r_proto" in
15004         define)
15005         case "$getprotobyname_r_proto" in
15006         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15007         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15008         esac
15009         case "$getprotobyname_r_proto" in
15010         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15011         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15012         esac
15013         case "$getprotobyname_r_proto" in
15014         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15015         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15016         esac
15017         case "$getprotobyname_r_proto" in
15018         ''|0)   d_getprotobyname_r=undef
15019                 getprotobyname_r_proto=0
15020                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15021         * )     case "$getprotobyname_r_proto" in
15022                 REENTRANT_PROTO*) ;;
15023                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15024                 esac
15025                 echo "Prototype: $try" ;;
15026         esac
15027         ;;
15028         *)      case "$usethreads" in
15029                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15030                 esac
15031                 d_getprotobyname_r=undef
15032                 getprotobyname_r_proto=0
15033                 ;;
15034         esac
15035         ;;
15036 *)      getprotobyname_r_proto=0
15037         ;;
15038 esac
15039
15040 : see if getprotobynumber_r exists
15041 set getprotobynumber_r d_getprotobynumber_r
15042 eval $inlibc
15043 case "$d_getprotobynumber_r" in
15044 "$define")
15045         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15046         case "$d_getprotobynumber_r_proto:$usethreads" in
15047         ":define")      d_getprotobynumber_r_proto=define
15048                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15049                 eval $hasproto ;;
15050         *)      ;;
15051         esac
15052         case "$d_getprotobynumber_r_proto" in
15053         define)
15054         case "$getprotobynumber_r_proto" in
15055         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15056         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15057         esac
15058         case "$getprotobynumber_r_proto" in
15059         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15060         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15061         esac
15062         case "$getprotobynumber_r_proto" in
15063         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15064         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15065         esac
15066         case "$getprotobynumber_r_proto" in
15067         ''|0)   d_getprotobynumber_r=undef
15068                 getprotobynumber_r_proto=0
15069                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15070         * )     case "$getprotobynumber_r_proto" in
15071                 REENTRANT_PROTO*) ;;
15072                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15073                 esac
15074                 echo "Prototype: $try" ;;
15075         esac
15076         ;;
15077         *)      case "$usethreads" in
15078                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15079                 esac
15080                 d_getprotobynumber_r=undef
15081                 getprotobynumber_r_proto=0
15082                 ;;
15083         esac
15084         ;;
15085 *)      getprotobynumber_r_proto=0
15086         ;;
15087 esac
15088
15089 : see if getprotoent_r exists
15090 set getprotoent_r d_getprotoent_r
15091 eval $inlibc
15092 case "$d_getprotoent_r" in
15093 "$define")
15094         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15095         case "$d_getprotoent_r_proto:$usethreads" in
15096         ":define")      d_getprotoent_r_proto=define
15097                 set d_getprotoent_r_proto getprotoent_r $hdrs
15098                 eval $hasproto ;;
15099         *)      ;;
15100         esac
15101         case "$d_getprotoent_r_proto" in
15102         define)
15103         case "$getprotoent_r_proto" in
15104         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15105         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15106         esac
15107         case "$getprotoent_r_proto" in
15108         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15109         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15110         esac
15111         case "$getprotoent_r_proto" in
15112         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15113         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15114         esac
15115         case "$getprotoent_r_proto" in
15116         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15117         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15118         esac
15119         case "$getprotoent_r_proto" in
15120         ''|0)   d_getprotoent_r=undef
15121                 getprotoent_r_proto=0
15122                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15123         * )     case "$getprotoent_r_proto" in
15124                 REENTRANT_PROTO*) ;;
15125                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15126                 esac
15127                 echo "Prototype: $try" ;;
15128         esac
15129         ;;
15130         *)      case "$usethreads" in
15131                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15132                 esac
15133                 d_getprotoent_r=undef
15134                 getprotoent_r_proto=0
15135                 ;;
15136         esac
15137         ;;
15138 *)      getprotoent_r_proto=0
15139         ;;
15140 esac
15141
15142 : see if prototypes for various getprotoxxx netdb.h functions are available
15143 echo " "
15144 set d_getprotoprotos getprotoent $i_netdb netdb.h
15145 eval $hasproto
15146
15147 : see if getprpwnam exists
15148 set getprpwnam d_getprpwnam
15149 eval $inlibc
15150
15151 : see if getpwent exists
15152 set getpwent d_getpwent
15153 eval $inlibc
15154
15155 : see if getpwent_r exists
15156 set getpwent_r d_getpwent_r
15157 eval $inlibc
15158 case "$d_getpwent_r" in
15159 "$define")
15160         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15161         case "$d_getpwent_r_proto:$usethreads" in
15162         ":define")      d_getpwent_r_proto=define
15163                 set d_getpwent_r_proto getpwent_r $hdrs
15164                 eval $hasproto ;;
15165         *)      ;;
15166         esac
15167         case "$d_getpwent_r_proto" in
15168         define)
15169         case "$getpwent_r_proto" in
15170         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15171         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15172         esac
15173         case "$getpwent_r_proto" in
15174         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15175         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15176         esac
15177         case "$getpwent_r_proto" in
15178         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15179         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15180         esac
15181         case "$getpwent_r_proto" in
15182         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15183         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15184         esac
15185         case "$getpwent_r_proto" in
15186         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15187         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15188         esac
15189         case "$getpwent_r_proto" in
15190         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15191         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15192         esac
15193         case "$getpwent_r_proto" in
15194         ''|0)   d_getpwent_r=undef
15195                 getpwent_r_proto=0
15196                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15197         * )     case "$getpwent_r_proto" in
15198                 REENTRANT_PROTO*) ;;
15199                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15200                 esac
15201                 echo "Prototype: $try" ;;
15202         esac
15203         ;;
15204         *)      case "$usethreads" in
15205                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15206                 esac
15207                 d_getpwent_r=undef
15208                 getpwent_r_proto=0
15209                 ;;
15210         esac
15211         ;;
15212 *)      getpwent_r_proto=0
15213         ;;
15214 esac
15215
15216 : see if getpwnam_r exists
15217 set getpwnam_r d_getpwnam_r
15218 eval $inlibc
15219 case "$d_getpwnam_r" in
15220 "$define")
15221         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15222         case "$d_getpwnam_r_proto:$usethreads" in
15223         ":define")      d_getpwnam_r_proto=define
15224                 set d_getpwnam_r_proto getpwnam_r $hdrs
15225                 eval $hasproto ;;
15226         *)      ;;
15227         esac
15228         case "$d_getpwnam_r_proto" in
15229         define)
15230         case "$getpwnam_r_proto" in
15231         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15232         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15233         esac
15234         case "$getpwnam_r_proto" in
15235         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15236         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15237         esac
15238         case "$getpwnam_r_proto" in
15239         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15240         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15241         esac
15242         case "$getpwnam_r_proto" in
15243         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15244         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15245         esac
15246         case "$getpwnam_r_proto" in
15247         ''|0)   d_getpwnam_r=undef
15248                 getpwnam_r_proto=0
15249                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15250         * )     case "$getpwnam_r_proto" in
15251                 REENTRANT_PROTO*) ;;
15252                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15253                 esac
15254                 echo "Prototype: $try" ;;
15255         esac
15256         ;;
15257         *)      case "$usethreads" in
15258                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15259                 esac
15260                 d_getpwnam_r=undef
15261                 getpwnam_r_proto=0
15262                 ;;
15263         esac
15264         ;;
15265 *)      getpwnam_r_proto=0
15266         ;;
15267 esac
15268
15269 : see if getpwuid_r exists
15270 set getpwuid_r d_getpwuid_r
15271 eval $inlibc
15272 case "$d_getpwuid_r" in
15273 "$define")
15274         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15275         case "$d_getpwuid_r_proto:$usethreads" in
15276         ":define")      d_getpwuid_r_proto=define
15277                 set d_getpwuid_r_proto getpwuid_r $hdrs
15278                 eval $hasproto ;;
15279         *)      ;;
15280         esac
15281         case "$d_getpwuid_r_proto" in
15282         define)
15283         case "$getpwuid_r_proto" in
15284         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15285         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15286         esac
15287         case "$getpwuid_r_proto" in
15288         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15289         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15290         esac
15291         case "$getpwuid_r_proto" in
15292         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15293         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15294         esac
15295         case "$getpwuid_r_proto" in
15296         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15297         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15298         esac
15299         case "$getpwuid_r_proto" in
15300         ''|0)   d_getpwuid_r=undef
15301                 getpwuid_r_proto=0
15302                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15303         * )     case "$getpwuid_r_proto" in
15304                 REENTRANT_PROTO*) ;;
15305                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15306                 esac
15307                 echo "Prototype: $try" ;;
15308         esac
15309         ;;
15310         *)      case "$usethreads" in
15311                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15312                 esac
15313                 d_getpwuid_r=undef
15314                 getpwuid_r_proto=0
15315                 ;;
15316         esac
15317         ;;
15318 *)      getpwuid_r_proto=0
15319         ;;
15320 esac
15321
15322 : Optional checks for getsbyname and getsbyport
15323
15324 : see if getservbyname exists
15325 set getservbyname d_getsbyname
15326 eval $inlibc
15327
15328 : see if getservbyport exists
15329 set getservbyport d_getsbyport
15330 eval $inlibc
15331
15332 : see if getservent exists
15333 set getservent d_getsent
15334 eval $inlibc
15335
15336 : see if getservbyname_r exists
15337 set getservbyname_r d_getservbyname_r
15338 eval $inlibc
15339 case "$d_getservbyname_r" in
15340 "$define")
15341         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15342         case "$d_getservbyname_r_proto:$usethreads" in
15343         ":define")      d_getservbyname_r_proto=define
15344                 set d_getservbyname_r_proto getservbyname_r $hdrs
15345                 eval $hasproto ;;
15346         *)      ;;
15347         esac
15348         case "$d_getservbyname_r_proto" in
15349         define)
15350         case "$getservbyname_r_proto" in
15351         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15352         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15353         esac
15354         case "$getservbyname_r_proto" in
15355         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15356         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15357         esac
15358         case "$getservbyname_r_proto" in
15359         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15360         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15361         esac
15362         case "$getservbyname_r_proto" in
15363         ''|0)   d_getservbyname_r=undef
15364                 getservbyname_r_proto=0
15365                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15366         * )     case "$getservbyname_r_proto" in
15367                 REENTRANT_PROTO*) ;;
15368                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15369                 esac
15370                 echo "Prototype: $try" ;;
15371         esac
15372         ;;
15373         *)      case "$usethreads" in
15374                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15375                 esac
15376                 d_getservbyname_r=undef
15377                 getservbyname_r_proto=0
15378                 ;;
15379         esac
15380         ;;
15381 *)      getservbyname_r_proto=0
15382         ;;
15383 esac
15384
15385 : see if getservbyport_r exists
15386 set getservbyport_r d_getservbyport_r
15387 eval $inlibc
15388 case "$d_getservbyport_r" in
15389 "$define")
15390         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15391         case "$d_getservbyport_r_proto:$usethreads" in
15392         ":define")      d_getservbyport_r_proto=define
15393                 set d_getservbyport_r_proto getservbyport_r $hdrs
15394                 eval $hasproto ;;
15395         *)      ;;
15396         esac
15397         case "$d_getservbyport_r_proto" in
15398         define)
15399         case "$getservbyport_r_proto" in
15400         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15401         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15402         esac
15403         case "$getservbyport_r_proto" in
15404         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15405         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15406         esac
15407         case "$getservbyport_r_proto" in
15408         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15409         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15410         esac
15411         case "$getservbyport_r_proto" in
15412         ''|0)   d_getservbyport_r=undef
15413                 getservbyport_r_proto=0
15414                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15415         * )     case "$getservbyport_r_proto" in
15416                 REENTRANT_PROTO*) ;;
15417                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15418                 esac
15419                 echo "Prototype: $try" ;;
15420         esac
15421         ;;
15422         *)      case "$usethreads" in
15423                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15424                 esac
15425                 d_getservbyport_r=undef
15426                 getservbyport_r_proto=0
15427                 ;;
15428         esac
15429         ;;
15430 *)      getservbyport_r_proto=0
15431         ;;
15432 esac
15433
15434 : see if getservent_r exists
15435 set getservent_r d_getservent_r
15436 eval $inlibc
15437 case "$d_getservent_r" in
15438 "$define")
15439         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15440         case "$d_getservent_r_proto:$usethreads" in
15441         ":define")      d_getservent_r_proto=define
15442                 set d_getservent_r_proto getservent_r $hdrs
15443                 eval $hasproto ;;
15444         *)      ;;
15445         esac
15446         case "$d_getservent_r_proto" in
15447         define)
15448         case "$getservent_r_proto" in
15449         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15450         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15451         esac
15452         case "$getservent_r_proto" in
15453         ''|0) try='int getservent_r(struct servent*, char*, int);'
15454         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15455         esac
15456         case "$getservent_r_proto" in
15457         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15458         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15459         esac
15460         case "$getservent_r_proto" in
15461         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15462         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15463         esac
15464         case "$getservent_r_proto" in
15465         ''|0)   d_getservent_r=undef
15466                 getservent_r_proto=0
15467                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15468         * )     case "$getservent_r_proto" in
15469                 REENTRANT_PROTO*) ;;
15470                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15471                 esac
15472                 echo "Prototype: $try" ;;
15473         esac
15474         ;;
15475         *)      case "$usethreads" in
15476                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15477                 esac
15478                 d_getservent_r=undef
15479                 getservent_r_proto=0
15480                 ;;
15481         esac
15482         ;;
15483 *)      getservent_r_proto=0
15484         ;;
15485 esac
15486
15487 : see if prototypes for various getservxxx netdb.h functions are available
15488 echo " "
15489 set d_getservprotos getservent $i_netdb netdb.h
15490 eval $hasproto
15491
15492 : see if getspnam exists
15493 set getspnam d_getspnam
15494 eval $inlibc
15495
15496 : see if this is a shadow.h system
15497 set shadow.h i_shadow
15498 eval $inhdr
15499
15500 : see if getspnam_r exists
15501 set getspnam_r d_getspnam_r
15502 eval $inlibc
15503 case "$d_getspnam_r" in
15504 "$define")
15505         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15506         case "$d_getspnam_r_proto:$usethreads" in
15507         ":define")      d_getspnam_r_proto=define
15508                 set d_getspnam_r_proto getspnam_r $hdrs
15509                 eval $hasproto ;;
15510         *)      ;;
15511         esac
15512         case "$d_getspnam_r_proto" in
15513         define)
15514         case "$getspnam_r_proto" in
15515         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15516         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15517         esac
15518         case "$getspnam_r_proto" in
15519         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15520         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15521         esac
15522         case "$getspnam_r_proto" in
15523         ''|0)   d_getspnam_r=undef
15524                 getspnam_r_proto=0
15525                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15526         * )     case "$getspnam_r_proto" in
15527                 REENTRANT_PROTO*) ;;
15528                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15529                 esac
15530                 echo "Prototype: $try" ;;
15531         esac
15532         ;;
15533         *)      case "$usethreads" in
15534                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15535                 esac
15536                 d_getspnam_r=undef
15537                 getspnam_r_proto=0
15538                 ;;
15539         esac
15540         ;;
15541 *)      getspnam_r_proto=0
15542         ;;
15543 esac
15544
15545 : see if gettimeofday or ftime exists
15546 set gettimeofday d_gettimeod
15547 eval $inlibc
15548 case "$d_gettimeod" in
15549 "$undef")
15550         set ftime d_ftime 
15551         eval $inlibc
15552         ;;
15553 *)
15554         val="$undef"; set d_ftime; eval $setvar
15555         ;;
15556 esac
15557 case "$d_gettimeod$d_ftime" in
15558 "$undef$undef")
15559         echo " "
15560         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15561         ;;
15562 esac
15563
15564 : see if gmtime_r exists
15565 set gmtime_r d_gmtime_r
15566 eval $inlibc
15567 case "$d_gmtime_r" in
15568 "$define")
15569         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15570         case "$d_gmtime_r_proto:$usethreads" in
15571         ":define")      d_gmtime_r_proto=define
15572                 set d_gmtime_r_proto gmtime_r $hdrs
15573                 eval $hasproto ;;
15574         *)      ;;
15575         esac
15576         case "$d_gmtime_r_proto" in
15577         define)
15578         case "$gmtime_r_proto" in
15579         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15580         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15581         esac
15582         case "$gmtime_r_proto" in
15583         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15584         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15585         esac
15586         case "$gmtime_r_proto" in
15587         ''|0)   d_gmtime_r=undef
15588                 gmtime_r_proto=0
15589                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15590         * )     case "$gmtime_r_proto" in
15591                 REENTRANT_PROTO*) ;;
15592                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15593                 esac
15594                 echo "Prototype: $try" ;;
15595         esac
15596         ;;
15597         *)      case "$usethreads" in
15598                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15599                 esac
15600                 d_gmtime_r=undef
15601                 gmtime_r_proto=0
15602                 ;;
15603         esac
15604         ;;
15605 *)      gmtime_r_proto=0
15606         ;;
15607 esac
15608
15609 : see if hasmntopt exists
15610 set hasmntopt d_hasmntopt
15611 eval $inlibc
15612
15613 : see if this is a netinet/in.h or sys/in.h system
15614 set netinet/in.h i_niin sys/in.h i_sysin
15615 eval $inhdr
15616
15617 : see if arpa/inet.h has to be included
15618 set arpa/inet.h i_arpainet
15619 eval $inhdr
15620
15621 : see if htonl --and friends-- exists
15622 val=''
15623 set htonl val
15624 eval $inlibc
15625
15626 : Maybe they are macros.
15627 case "$val" in
15628 $undef)
15629         $cat >htonl.c <<EOM
15630 #include <stdio.h>
15631 #include <sys/types.h>
15632 #$i_niin I_NETINET_IN
15633 #$i_sysin I_SYS_IN
15634 #$i_arpainet I_ARPA_INET
15635 #ifdef I_NETINET_IN
15636 #include <netinet/in.h>
15637 #endif
15638 #ifdef I_SYS_IN
15639 #include <sys/in.h>
15640 #endif
15641 #ifdef I_ARPA_INET
15642 #include <arpa/inet.h>
15643 #endif
15644 #ifdef htonl
15645 printf("Defined as a macro.");
15646 #endif
15647 EOM
15648         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15649         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15650                 val="$define"
15651                 echo "But it seems to be defined as a macro." >&4
15652         fi
15653         $rm -f htonl.?
15654         ;;
15655 esac
15656 set d_htonl
15657 eval $setvar
15658
15659 : see if hypot exists
15660 set hypot d_hypot
15661 eval $inlibc
15662
15663 : see if ilogb exists
15664 set ilogb d_ilogb
15665 eval $inlibc
15666
15667 : see if ilogbl exists
15668 set ilogbl d_ilogbl
15669 eval $inlibc
15670
15671 : check whether inet_aton exists
15672 set inet_aton d_inetaton
15673 eval $inlibc
15674
15675 : see if inet_ntop exists
15676 set inet_ntop d_inetntop
15677 eval $inlibc
15678
15679 : see if inet_pton exists
15680 set inet_pton d_inetpton
15681 eval $inlibc
15682
15683 : Look for isascii
15684 echo " "
15685 $cat >isascii.c <<EOCP
15686 #include <stdio.h>
15687 #include <ctype.h>
15688 #$i_stdlib I_STDLIB
15689 #ifdef I_STDLIB
15690 #include <stdlib.h>
15691 #endif
15692 int main() {
15693         int c = 'A';
15694         if (isascii(c))
15695                 exit(0);
15696         else
15697                 exit(1);
15698 }
15699 EOCP
15700 set isascii
15701 if eval $compile; then
15702         echo "isascii() found." >&4
15703         val="$define"
15704 else
15705         echo "isascii() NOT found." >&4
15706         val="$undef"
15707 fi
15708 set d_isascii
15709 eval $setvar
15710 $rm -f isascii*
15711
15712 : Look for isblank
15713 echo " "
15714 $cat >isblank.c <<'EOCP'
15715 #include <stdio.h>
15716 #include <ctype.h>
15717 int main() {
15718         int c = ' ';
15719         if (isblank(c))
15720                 return 0 ;
15721         else
15722                 return 1 ;
15723 }
15724 EOCP
15725 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15726         echo "isblank() found." >&4
15727         val="$define"
15728 else
15729         echo "isblank() NOT found." >&4
15730         val="$undef"
15731 fi
15732 set d_isblank
15733 eval $setvar
15734 $rm -f isblank*
15735
15736 : check for isfinite
15737 echo "Checking to see if you have isfinite..." >&4
15738 $cat >try.c <<EOCP
15739 #include <math.h>
15740 int main() { return isfinite(0.0); }
15741 EOCP
15742 set try
15743 if eval $compile; then
15744         val="$define"
15745         echo "You have isfinite."
15746 else
15747         val="$undef"
15748         echo "You do not have isfinite."
15749 fi
15750 $rm_try
15751 set d_isfinite
15752 eval $setvar
15753
15754 : see if isfinitel exists
15755 set isfinitel d_isfinitel
15756 eval $inlibc
15757
15758 : check for isinf
15759 echo "Checking to see if you have isinf..." >&4
15760 $cat >try.c <<EOCP
15761 #include <math.h>
15762 int main() { return isinf(0.0); }
15763 EOCP
15764 set try
15765 if eval $compile; then
15766         val="$define"
15767         echo "You have isinf."
15768 else
15769         val="$undef"
15770         echo "You do not have isinf."
15771 fi
15772 $rm_try
15773 set d_isinf
15774 eval $setvar
15775
15776 : see if isinfl exists
15777 set isinfl d_isinfl
15778 eval $inlibc
15779
15780 : check for isless
15781 echo "Checking to see if you have isless..." >&4
15782 $cat >try.c <<EOCP
15783 #include <math.h>
15784 int main() { return isless(0.0); }
15785 EOCP
15786 set try
15787 if eval $compile; then
15788         val="$define"
15789         echo "You have isless."
15790 else
15791         val="$undef"
15792         echo "You do not have isless."
15793 fi
15794 $rm_try
15795 set d_isless
15796 eval $setvar
15797
15798 : check for isnan
15799 echo "Checking to see if you have isnan..." >&4
15800 $cat >try.c <<EOCP
15801 #include <math.h>
15802 int main() { return isnan(0.0); }
15803 EOCP
15804 set try
15805 if eval $compile; then
15806         val="$define"
15807         echo "You have isnan."
15808 else
15809         val="$undef"
15810         echo "You do not have isnan."
15811 fi
15812 $rm_try
15813 set d_isnan
15814 eval $setvar
15815
15816 : see if isnanl exists
15817 set isnanl d_isnanl
15818 eval $inlibc
15819
15820 : check for isnormal
15821 echo "Checking to see if you have isnormal..." >&4
15822 $cat >try.c <<EOCP
15823 #include <math.h>
15824 int main() { return isnormal(0.0); }
15825 EOCP
15826 set try
15827 if eval $compile; then
15828         val="$define"
15829         echo "You have isnormal."
15830 else
15831         val="$undef"
15832         echo "You do not have isnormal."
15833 fi
15834 $rm_try
15835 set d_isnormal
15836 eval $setvar
15837
15838 : see if j0 exists
15839 set j0 d_j0
15840 eval $inlibc
15841
15842 : see if j0l exists
15843 set j0l d_j0l
15844 eval $inlibc
15845
15846 : see if killpg exists
15847 set killpg d_killpg
15848 eval $inlibc
15849
15850 : see if localeconv exists
15851 set localeconv d_locconv
15852 eval $inlibc
15853
15854 : see if libc has the POSIX.1-2008 currency locale rules
15855 case "$d_locconv:$d_lc_monetary_2008" in
15856 $define:)
15857         $cat >try.c <<EOCP
15858 #include <locale.h>
15859 int main() {
15860         struct lconv *lc = localeconv();
15861         char int_p_cs_precedes = lc->int_p_cs_precedes;
15862         return 0;
15863 }
15864 EOCP
15865         set try
15866         if eval $compile; then
15867                 d_lc_monetary_2008="$define"
15868         else
15869                 d_lc_monetary_2008="$undef"
15870         fi;
15871         $rm_try
15872         ;;
15873 esac
15874
15875 : see if lchown exists
15876 echo " "
15877 $cat > try.c <<'EOCP'
15878 /* System header to define __stub macros and hopefully few prototypes,
15879     which can conflict with char lchown(); below.  */
15880 #include <assert.h>
15881 /* Override any gcc2 internal prototype to avoid an error.  */
15882 /* We use char because int might match the return type of a gcc2
15883    builtin and then its argument prototype would still apply.  */
15884 char lchown();
15885 int main() {
15886     /*  The GNU C library defines this for functions which it implements
15887         to always fail with ENOSYS.  Some functions are actually named
15888         something starting with __ and the normal name is an alias.  */
15889 #if defined (__stub_lchown) || defined (__stub___lchown)
15890 choke me
15891 #else
15892 lchown();
15893 #endif
15894 ; return 0; }
15895 EOCP
15896 set try
15897 if eval $compile; then
15898     $echo "lchown() found." >&4
15899     val="$define"
15900 else
15901     $echo "lchown() NOT found." >&4
15902     val="$undef"
15903 fi
15904 set d_lchown
15905 eval $setvar
15906
15907 : See if number of significant digits in a double precision number is known
15908 echo " "
15909 $cat >ldbl_dig.c <<EOM
15910 #include <limits.h>
15911 #include <float.h>
15912 #ifdef LDBL_DIG
15913 printf("Contains LDBL_DIG");
15914 #endif
15915 EOM
15916 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15917 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15918         echo "LDBL_DIG found." >&4
15919         val="$define"
15920 else
15921         echo "LDBL_DIG NOT found." >&4
15922         val="$undef"
15923 fi
15924 $rm -f ldbl_dig.?
15925 set d_ldbl_dig
15926 eval $setvar
15927
15928 : see if lgamma exists
15929 set lgamma d_lgamma
15930 eval $inlibc
15931
15932 : see if lgamma_r exists
15933 set lgamma_r d_lgamma_r
15934 eval $inlibc
15935
15936 : check to see if math.h defines _LIB_VERSION
15937 d_libm_lib_version="$undef"
15938 echo " "
15939 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15940 $cat >try.c <<EOCP
15941 #include <unistd.h>
15942 #include <math.h>
15943 int main (int argc, char *argv[])
15944 {
15945     printf ("%d\n", _LIB_VERSION);
15946     return (0);
15947     } /* main */
15948 EOCP
15949 set try
15950 if eval $compile; then
15951     foo=`$run ./try`
15952     echo "Yes, it does ($foo)" >&4
15953     d_libm_lib_version="$define"
15954 else
15955     echo "No, it does not (probably harmless)" >&4
15956     fi
15957 $rm_try
15958
15959 : see if link exists
15960 set link d_link
15961 eval $inlibc
15962
15963 : see if llrint exists
15964 set llrint d_llrint
15965 eval $inlibc
15966
15967 : see if llrintl exists
15968 set llrintl d_llrintl
15969 eval $inlibc
15970
15971 : see if llround exists
15972 set llround d_llround
15973 eval $inlibc
15974
15975 : see if llroundl exists
15976 set llroundl d_llroundl
15977 eval $inlibc
15978
15979 : see if localeconv_l exists
15980 set localeconv_l d_localeconv_l
15981 eval $inlibc
15982
15983 : see if localtime_r exists
15984 set localtime_r d_localtime_r
15985 eval $inlibc
15986 case "$d_localtime_r" in
15987 "$define")
15988         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15989         case "$d_localtime_r_proto:$usethreads" in
15990         ":define")      d_localtime_r_proto=define
15991                 set d_localtime_r_proto localtime_r $hdrs
15992                 eval $hasproto ;;
15993         *)      ;;
15994         esac
15995         case "$d_localtime_r_proto" in
15996         define)
15997         case "$localtime_r_proto" in
15998         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15999         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16000         esac
16001         case "$localtime_r_proto" in
16002         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16003         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16004         esac
16005         case "$localtime_r_proto" in
16006         ''|0)   d_localtime_r=undef
16007                 localtime_r_proto=0
16008                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16009         * )     case "$localtime_r_proto" in
16010                 REENTRANT_PROTO*) ;;
16011                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16012                 esac
16013                 echo "Prototype: $try" ;;
16014         esac
16015         ;;
16016         *)      case "$usethreads" in
16017                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16018                 esac
16019                 d_localtime_r=undef
16020                 localtime_r_proto=0
16021                 ;;
16022         esac
16023         ;;
16024 *)      localtime_r_proto=0
16025         ;;
16026 esac
16027
16028 : see if localtime_r calls tzset
16029 case "$localtime_r_proto" in
16030 REENTRANT_PROTO*)
16031         $cat >try.c <<EOCP
16032 /*  Does our libc's localtime_r call tzset ?
16033  *  return 0 if so, 1 otherwise.
16034  */
16035 #$i_systypes    I_SYS_TYPES
16036 #$i_unistd      I_UNISTD
16037 #$i_time        I_TIME
16038 #$i_stdlib      I_STDLIB
16039 #$i_malloc      I_MALLOC
16040 #ifdef I_SYS_TYPES
16041 #  include <sys/types.h>
16042 #endif
16043 #ifdef I_UNISTD
16044 #  include <unistd.h>
16045 #endif
16046 #ifdef I_TIME
16047 #  include <time.h>
16048 #endif
16049 #ifdef I_STDLIB
16050 #include <stdlib.h>
16051 #endif
16052 #include <string.h>
16053 #ifdef I_MALLOC
16054 #  include <malloc.h>
16055 #endif
16056 int main()
16057 {
16058     time_t t = time(0L);
16059     char w_tz[]="TZ" "=GMT+5",
16060          e_tz[]="TZ" "=GMT-5",
16061         *tz_e = (char*)malloc(16),
16062         *tz_w = (char*)malloc(16);
16063     struct tm tm_e, tm_w;
16064     memset(&tm_e,'\0',sizeof(struct tm));
16065     memset(&tm_w,'\0',sizeof(struct tm));
16066     strcpy(tz_e,e_tz);
16067     strcpy(tz_w,w_tz);
16068
16069     putenv(tz_e);
16070     localtime_r(&t, &tm_e);
16071
16072     putenv(tz_w);
16073     localtime_r(&t, &tm_w);
16074
16075     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16076         return 1;
16077     return 0;
16078 }
16079 EOCP
16080         set try
16081         if eval $compile; then
16082             if $run ./try; then
16083                 d_localtime_r_needs_tzset=undef;
16084             else
16085                 d_localtime_r_needs_tzset=define;
16086             fi;
16087         else
16088             d_localtime_r_needs_tzset=undef;
16089         fi;
16090      ;;
16091   *)
16092      d_localtime_r_needs_tzset=undef;
16093      ;;
16094 esac
16095 $rm_try
16096
16097 : see if lockf exists
16098 set lockf d_lockf
16099 eval $inlibc
16100
16101 : see if log1p exists
16102 set log1p d_log1p
16103 eval $inlibc
16104
16105 : see if log2 exists
16106 set log2 d_log2
16107 eval $inlibc
16108
16109 : see if logb exists
16110 set logb d_logb
16111 eval $inlibc
16112
16113 : see if lrint exists
16114 set lrint d_lrint
16115 eval $inlibc
16116
16117 : see if lrintl exists
16118 set lrintl d_lrintl
16119 eval $inlibc
16120
16121 : see if lround exists
16122 set lround d_lround
16123 eval $inlibc
16124
16125 : see if lroundl exists
16126 set lroundl d_lroundl
16127 eval $inlibc
16128
16129 : see if prototype for lseek is available
16130 echo " "
16131 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16132 eval $hasproto
16133
16134 : see if lstat exists
16135 set lstat d_lstat
16136 eval $inlibc
16137
16138 : see if madvise exists
16139 set madvise d_madvise
16140 eval $inlibc
16141
16142 : see if malloc_size exists
16143 set malloc_size d_malloc_size
16144 eval $inlibc
16145
16146 : see if malloc_size_good exists
16147 set malloc_good_size d_malloc_good_size
16148 eval $inlibc
16149
16150 : see if mblen exists
16151 set mblen d_mblen
16152 eval $inlibc
16153
16154 : see if mbrlen exists
16155 set mbrlen d_mbrlen
16156 eval $inlibc
16157
16158 : see if mbrtowc exists
16159 set mbrtowc d_mbrtowc
16160 eval $inlibc
16161
16162 : see if mbstowcs exists
16163 set mbstowcs d_mbstowcs
16164 eval $inlibc
16165
16166 : see if mbtowc exists
16167 set mbtowc d_mbtowc
16168 eval $inlibc
16169
16170 : see if memmem exists
16171 set memmem d_memmem
16172 eval $inlibc
16173
16174 : see if memrchr exists
16175 set memrchr d_memrchr
16176 eval $inlibc
16177
16178 : see if mkdir exists
16179 set mkdir d_mkdir
16180 eval $inlibc
16181
16182 : see if mkdtemp exists
16183 set mkdtemp d_mkdtemp
16184 eval $inlibc
16185
16186 : see if mkfifo exists
16187 set mkfifo d_mkfifo
16188 eval $inlibc
16189
16190 : see if mkstemp exists
16191 set mkstemp d_mkstemp
16192 eval $inlibc
16193
16194 : see if mkstemps exists
16195 set mkstemps d_mkstemps
16196 eval $inlibc
16197
16198 : see if mktime exists
16199 set mktime d_mktime
16200 eval $inlibc
16201
16202 : see if sys/mman.h has to be included
16203 set sys/mman.h i_sysmman
16204 eval $inhdr
16205
16206 : see if mmap exists
16207 set mmap d_mmap
16208 eval $inlibc
16209 : see what shmat returns
16210 : default to something harmless
16211 mmaptype='void *'
16212 case "$i_sysmman$d_mmap" in
16213 "$define$define")
16214         $cat >mmap.c <<'END'
16215 #include <sys/mman.h>
16216 void *mmap();
16217 END
16218         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16219                 mmaptype='void *'
16220         else
16221                 mmaptype='caddr_t'
16222         fi
16223         echo "and it returns ($mmaptype)." >&4
16224         ;;
16225 esac
16226
16227
16228
16229 : see if sqrtl exists
16230 set sqrtl d_sqrtl
16231 eval $inlibc
16232
16233 : see if scalbnl exists
16234 set scalbnl d_scalbnl
16235 eval $inlibc
16236
16237 : see if truncl exists
16238 set truncl d_truncl
16239 eval $inlibc
16240
16241 : see if modfl exists
16242 set modfl d_modfl
16243 eval $inlibc
16244
16245 : see if prototype for modfl is available
16246 echo " "
16247 set d_modflproto modfl define math.h
16248 eval $hasproto
16249
16250 if $test "$uselongdouble" = "$define"; then
16251     message=""
16252     if $test "$d_sqrtl" != "$define"; then
16253         message="$message sqrtl"
16254     fi
16255     if $test "$d_modfl" != "$define"; then
16256         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16257             echo "You have both truncl and copysignl, so I can emulate modfl."
16258         else
16259             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16260                 echo "You have both aintl and copysignl, so I can emulate modfl."
16261             else
16262                 message="$message modfl"
16263             fi
16264         fi
16265     fi
16266     if $test "$d_frexpl" != "$define"; then
16267         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16268             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16269         else
16270             message="$message frexpl"
16271         fi
16272     fi
16273     if $test "$d_ldexpl" != "$define"; then
16274         message="$message ldexpl"
16275     fi
16276
16277     if $test "$message" != ""; then
16278         $cat <<EOM >&4
16279
16280 *** You requested the use of long doubles but you do not seem to have
16281 *** the following mathematical functions needed for long double support:
16282 ***    $message
16283 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16284 *** Cannot continue, aborting.
16285
16286 EOM
16287
16288         exit 1
16289     fi
16290 fi
16291
16292 : see if mprotect exists
16293 set mprotect d_mprotect
16294 eval $inlibc
16295
16296 : see if msgctl exists
16297 set msgctl d_msgctl
16298 eval $inlibc
16299
16300 : see if msgget exists
16301 set msgget d_msgget
16302 eval $inlibc
16303
16304 : see if msgsnd exists
16305 set msgsnd d_msgsnd
16306 eval $inlibc
16307
16308 : see if msgrcv exists
16309 set msgrcv d_msgrcv
16310 eval $inlibc
16311
16312 : see how much of the 'msg*(2)' library is present.
16313 h_msg=true
16314 echo " "
16315 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16316 *"$undef"*) h_msg=false;;
16317 esac
16318 case "$osname" in
16319 freebsd)
16320     case "`ipcs 2>&1`" in
16321     "SVID messages"*"not configured"*)
16322         echo "Your $osname does not have the msg*(2) configured." >&4
16323         h_msg=false
16324         val="$undef"
16325         set msgctl d_msgctl
16326         eval $setvar
16327         set msgget d_msgget
16328         eval $setvar
16329         set msgsnd d_msgsnd
16330         eval $setvar
16331         set msgrcv d_msgrcv
16332         eval $setvar
16333         ;;
16334     esac
16335     ;;
16336 esac
16337 : we could also check for sys/ipc.h ...
16338 if $h_msg && $test `./findhdr sys/msg.h`; then
16339         echo "You have the full msg*(2) library." >&4
16340         val="$define"
16341 else
16342         echo "You don't have the full msg*(2) library." >&4
16343         val="$undef"
16344 fi
16345 set d_msg
16346 eval $setvar
16347
16348 : Check for msghdr_s
16349 echo " "
16350 echo "Checking to see if your system supports struct msghdr..." >&4
16351 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16352 eval $hasstruct
16353 case "$d_msghdr_s" in
16354 "$define")      echo "Yes, it does."   ;;
16355 *)              echo "No, it doesn't." ;;
16356 esac
16357
16358
16359 : see if msync exists
16360 set msync d_msync
16361 eval $inlibc
16362
16363 : see if munmap exists
16364 set munmap d_munmap
16365 eval $inlibc
16366
16367 : see if nan exists
16368 set nan d_nan
16369 eval $inlibc
16370
16371 : see if nanosleep exists
16372 set nanosleep d_nanosleep
16373 eval $inlibc
16374
16375 : see if nearbyint exists
16376 set nearbyint d_nearbyint
16377 eval $inlibc
16378
16379 : see if nextafter exists
16380 set nextafter d_nextafter
16381 eval $inlibc
16382
16383 : see if nexttoward exists
16384 set nexttoward d_nexttoward
16385 eval $inlibc
16386
16387 : see if nice exists
16388 set nice d_nice
16389 eval $inlibc
16390
16391 : see if this is a langinfo.h system
16392 set langinfo.h i_langinfo
16393 eval $inhdr
16394
16395 : see if nl_langinfo exists
16396 set nl_langinfo d_nl_langinfo
16397 eval $inlibc
16398
16399 : see if this is a quadmath.h system
16400 set quadmath.h i_quadmath
16401 eval $inhdr
16402
16403 : Check basic sizes
16404 echo " "
16405 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16406
16407 case "$use64bitint:$d_quad:$quadtype" in
16408 define:define:?*)
16409         ivtype="$quadtype"
16410         uvtype="$uquadtype"
16411         ivsize=8
16412         uvsize=8
16413         ;;
16414 *)      ivtype="long"
16415         uvtype="unsigned long"
16416         ivsize=$longsize
16417         uvsize=$longsize
16418         ;;
16419 esac
16420
16421 case "$uselongdouble:$d_longdbl" in
16422 define:define)
16423         nvtype="long double"
16424         nvsize=$longdblsize
16425         ;;
16426 *)      nvtype=double
16427         nvsize=$doublesize
16428         ;;
16429 esac
16430
16431 case "$usequadmath:$i_quadmath" in
16432 define:define)
16433   nvtype="__float128"
16434   nvsize=16
16435   case "$libs" in
16436   *quadmath*) ;;
16437   *) $cat <<EOM >&4
16438
16439 *** You requested the use of the quadmath library, but you
16440 *** do not seem to have the quadmath library installed.
16441 *** Cannot continue, aborting.
16442 EOM
16443     exit 1
16444     ;;
16445   esac
16446   ;;
16447 define:*) $cat <<EOM >&4
16448
16449 *** You requested the use of the quadmath library, but you
16450 *** do not seem to have the required header, <quadmath.h>.
16451 EOM
16452   case "$gccversion" in
16453   [23].*|4.[0-5]*)
16454    $cat <<EOM >&4
16455 *** Your gcc looks a bit old:
16456 *** $gccversion
16457 EOM
16458     ;;
16459   '')
16460    $cat <<EOM >&4
16461 *** You are not running a gcc.
16462 EOM
16463     ;;
16464   esac
16465   $cat <<EOM >&4
16466 *** For the quadmath library you need at least gcc 4.6.
16467 *** Cannot continue, aborting.
16468 EOM
16469   exit 1
16470   ;;
16471 esac
16472
16473 $echo "(IV will be "$ivtype", $ivsize bytes)"
16474 $echo "(UV will be "$uvtype", $uvsize bytes)"
16475 $echo "(NV will be "$nvtype", $nvsize bytes)"
16476
16477 $cat >try.c <<EOCP
16478 #$i_inttypes I_INTTYPES
16479 #ifdef I_INTTYPES
16480 #include <inttypes.h>
16481 #endif
16482 #include <stdio.h>
16483 int main() {
16484 #ifdef INT8
16485    int8_t i =  INT8_MAX;
16486   uint8_t u = UINT8_MAX;
16487   printf("int8_t\n");
16488 #endif
16489 #ifdef INT16
16490    int16_t i =  INT16_MAX;
16491   uint16_t u = UINT16_MAX;
16492   printf("int16_t\n");
16493 #endif
16494 #ifdef INT32
16495    int32_t i =  INT32_MAX;
16496   uint32_t u = UINT32_MAX;
16497   printf("int32_t\n");
16498 #endif
16499 }
16500 EOCP
16501
16502 i8type="signed char"
16503 u8type="unsigned char"
16504 i8size=1
16505 u8size=1
16506
16507 case "$i16type" in
16508 '')     case "$shortsize" in
16509         2)      i16type=short
16510                 u16type="unsigned short"
16511                 i16size=$shortsize
16512                 u16size=$shortsize
16513                 ;;
16514         esac
16515         ;;
16516 esac
16517 case "$i16type" in
16518 '')     set try -DINT16
16519         if eval $compile; then
16520                 case "`$run ./try`" in
16521                 int16_t)
16522                         i16type=int16_t
16523                         u16type=uint16_t
16524                         i16size=2
16525                         u16size=2
16526                         ;;
16527                 esac
16528         fi
16529         ;;
16530 esac
16531 case "$i16type" in
16532 '')     if $test $shortsize -ge 2; then
16533                 i16type=short
16534                 u16type="unsigned short"
16535                 i16size=$shortsize
16536                 u16size=$shortsize
16537         fi
16538         ;;
16539 esac
16540
16541 case "$i32type" in
16542 '')     case "$longsize" in
16543         4)      i32type=long
16544                 u32type="unsigned long"
16545                 i32size=$longsize
16546                 u32size=$longsize
16547                 ;;
16548         *)      case "$intsize" in
16549                 4)      i32type=int
16550                         u32type="unsigned int"
16551                         i32size=$intsize
16552                         u32size=$intsize
16553                         ;;
16554                 esac
16555                 ;;
16556         esac
16557         ;;
16558 esac
16559 case "$i32type" in
16560 '')     set try -DINT32
16561         if eval $compile; then
16562                 case "`$run ./try`" in
16563                 int32_t)
16564                         i32type=int32_t
16565                         u32type=uint32_t
16566                         i32size=4
16567                         u32size=4
16568                         ;;
16569                 esac
16570         fi
16571         ;;
16572 esac
16573 case "$i32type" in
16574 '')     if $test $intsize -ge 4; then
16575                 i32type=int
16576                 u32type="unsigned int"
16577                 i32size=$intsize
16578                 u32size=$intsize
16579         fi
16580         ;;
16581 esac
16582
16583 case "$i64type" in
16584 '')     case "$d_quad:$quadtype" in
16585         define:?*)
16586                 i64type="$quadtype"
16587                 u64type="$uquadtype"
16588                 i64size=8
16589                 u64size=8
16590                 ;;
16591         esac
16592         ;;
16593 esac
16594
16595 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16596 $cat <<EOP >try.c
16597 #include <stdio.h>
16598 #$i_stdlib I_STDLIB
16599 #ifdef I_STDLIB
16600 #include <stdlib.h>
16601 #endif
16602 #include <sys/types.h>
16603 #include <signal.h>
16604 #ifdef SIGFPE
16605 /* volatile so that the compiler has to store it out to memory */
16606 volatile int bletched = 0;
16607 $signal_t blech(int s) { bletched = 1; }
16608 #endif
16609 int main() {
16610     $uvtype u = 0;
16611     $nvtype d;
16612     int     n = 8 * $uvsize;
16613     int     i;
16614 #ifdef SIGFPE
16615     signal(SIGFPE, blech);
16616 #endif
16617
16618     for (i = 0; i < n; i++) {
16619       u = u << 1 | ($uvtype)1;
16620       d = ($nvtype)u;
16621       if (($uvtype)d != u)
16622         break;
16623       if (d <= 0)
16624         break;
16625       d = ($nvtype)(u - 1);
16626       if (($uvtype)d != (u - 1))
16627         break;
16628 #ifdef SIGFPE
16629       if (bletched)
16630         break;
16631 #endif
16632     }
16633     printf("%d\n", ((i == n) ? -n : i));
16634     exit(0);
16635 }
16636 EOP
16637 set try
16638
16639 d_nv_preserves_uv="$undef"
16640 if eval $compile; then
16641         nv_preserves_uv_bits="`$run ./try`"
16642 fi
16643 case "$nv_preserves_uv_bits" in
16644 \-[1-9]*)
16645         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16646         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16647         d_nv_preserves_uv="$define"
16648         ;;
16649 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16650         d_nv_preserves_uv="$undef" ;;
16651 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16652         nv_preserves_uv_bits="0" ;;
16653 esac
16654 $rm_try
16655
16656 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16657 $cat <<EOP >try.c
16658 #include <stdio.h>
16659
16660 typedef $nvtype NV;
16661
16662 int
16663 main() {
16664   NV value = 2;
16665   int count = 1;
16666
16667   while(count < 256) {
16668     /* volatile so that the compiler has to store it out to memory */
16669     volatile NV up = value + 1.0;
16670     volatile NV negated = -value;
16671     volatile NV down = negated - 1.0;
16672     volatile NV got_up = up - value;
16673     int up_good = got_up == 1.0;
16674     int got_down = down - negated;
16675     int down_good = got_down == -1.0;
16676
16677     if (down_good != up_good) {
16678       fprintf(stderr,
16679               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16680               up_good, (double) got_up, down_good, (double) got_down,
16681               count, (double) value);
16682       return 1;
16683     }
16684     if (!up_good) {
16685       while (1) {
16686         if (count > 8) {
16687           count -= 8;
16688           fputs("256.0", stdout);
16689         } else {
16690           count--;
16691           fputs("2.0", stdout);
16692         }
16693         if (!count) {
16694           puts("");
16695           return 0;
16696         }
16697         fputs("*", stdout);
16698       }
16699     }
16700     value *= 2;
16701     ++count;
16702   }
16703   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16704           count, (double) value);
16705   return 1;
16706 }
16707 EOP
16708 set try
16709
16710 nv_overflows_integers_at='0'
16711 if eval $compile; then
16712     xxx="`$run ./try`"
16713     case "$?" in
16714         0)
16715             case "$xxx" in
16716                 2*)  cat >&4 <<EOM
16717 The largest integer your NVs can preserve is equal to $xxx
16718 EOM
16719                     nv_overflows_integers_at="$xxx"
16720                     ;;
16721                 *)  cat >&4 <<EOM
16722 Cannot determine the largest integer value your NVs can hold, unexpected output
16723 '$xxx'
16724 EOM
16725                     ;;
16726             esac
16727             ;;
16728         *)  cat >&4 <<EOM
16729 Cannot determine the largest integer value your NVs can hold
16730 EOM
16731             ;;
16732     esac
16733 fi
16734 $rm_try
16735
16736 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16737 $cat <<EOP >try.c
16738 #include <stdio.h>
16739 #$i_stdlib I_STDLIB
16740 #ifdef I_STDLIB
16741 #include <stdlib.h>
16742 #endif
16743 #include <string.h>
16744 #include <sys/types.h>
16745 #include <signal.h>
16746 #ifdef SIGFPE
16747 /* volatile so that the compiler has to store it out to memory */
16748 volatile int bletched = 0;
16749 $signal_t blech(int s) { bletched = 1; }
16750 #endif
16751
16752 int checkit($nvtype d, const char *where) {
16753     void *v = &d;
16754     unsigned char *p = (unsigned char *)v;
16755     unsigned char *end = p + sizeof(d);
16756     int fail = 0;
16757
16758     while (p < end)
16759         fail += *p++;
16760
16761     if (!fail)
16762         return 0;
16763
16764     p = (unsigned char *)v;
16765     printf("No - %s: 0x", where);
16766     while (p < end)
16767         printf ("%02X", *p++);
16768     printf("\n");
16769     return 1;
16770 }
16771
16772 int main(int argc, char **argv) {
16773     $nvtype d = 0.0;
16774     int fail = 0;
16775     fail += checkit(d, "0.0");
16776
16777     /* The compiler shouldn't be assuming that bletched is 0  */
16778     d = bletched;
16779
16780     fail += checkit(d, "bleched");
16781
16782 #ifdef SIGFPE
16783     signal(SIGFPE, blech);
16784 #endif
16785
16786     /* Paranoia - the compiler should have no way of knowing that ANSI says
16787        that argv[argc] will always be NULL.  Actually, if it did assume this it
16788        would be buggy, as this is C and main() can be called from elsewhere in
16789        the program.  */
16790     d = argv[argc] ? 1 : 0;
16791
16792     if (d) {
16793         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16794     }
16795
16796     fail += checkit(d, "ternary");
16797
16798     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16799
16800     if (d != 0.0) {
16801         printf("No - memset doesn't give 0.0\n");
16802         /* This might just blow up:  */
16803         printf("(gives %g)\n", d);
16804         return 1;
16805     }
16806
16807 #ifdef SIGFPE
16808     if (bletched) {
16809         printf("No - something bleched\n");
16810         return 1;
16811     }
16812 #endif
16813     if (fail) {
16814       printf("No - %d fail(s)\n", fail);
16815       return 1;
16816     }
16817     printf("Yes\n");
16818     return 0;
16819 }
16820 EOP
16821 set try
16822
16823 d_nv_zero_is_allbits_zero="$undef"
16824 if eval $compile; then
16825     xxx="`$run ./try`"
16826     case "$?" in
16827         0)
16828             case "$xxx" in
16829                 Yes)  cat >&4 <<EOM
16830 0.0 is represented as all bits zero in memory
16831 EOM
16832                     d_nv_zero_is_allbits_zero="$define"
16833                     ;;
16834                 *)  cat >&4 <<EOM
16835 0.0 is not represented as all bits zero in memory
16836 EOM
16837                     d_nv_zero_is_allbits_zero="$undef"
16838                     ;;
16839             esac
16840             ;;
16841         *)  cat >&4 <<EOM
16842 0.0 is not represented as all bits zero in memory
16843 EOM
16844             d_nv_zero_is_allbits_zero="$undef"
16845             ;;
16846     esac
16847 fi
16848 $rm_try
16849
16850 : check for off64_t
16851 echo " "
16852 echo "Checking to see if you have off64_t..." >&4
16853 $cat >try.c <<EOCP
16854 #include <sys/types.h>
16855 #include <unistd.h>
16856 int main() { off64_t x = 7; }
16857 EOCP
16858 set try
16859 if eval $compile; then
16860         val="$define"
16861         echo "You have off64_t."
16862 else
16863         val="$undef"
16864         echo "You do not have off64_t."
16865         case "$lseeksize" in
16866         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16867         esac
16868 fi
16869 $rm_try
16870 set d_off64_t
16871 eval $setvar
16872
16873 : how to create joinable pthreads
16874 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16875         echo " "
16876         echo "Checking what constant to use for creating joinable pthreads..." >&4
16877         $cat >try.c <<'EOCP'
16878 #include <pthread.h>
16879 int main() {
16880     int detachstate = JOINABLE;
16881 }
16882 EOCP
16883         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16884         if eval $compile; then
16885                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16886                 val="$undef" # Yes, undef.
16887                 set d_old_pthread_create_joinable
16888                 eval $setvar
16889                 val=""
16890                 set old_pthread_create_joinable
16891                 eval $setvar
16892         else
16893                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16894                 if eval $compile; then
16895                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16896                         val="$define"
16897                         set d_old_pthread_create_joinable
16898                         eval $setvar
16899                         val=PTHREAD_CREATE_UNDETACHED
16900                         set old_pthread_create_joinable
16901                         eval $setvar
16902                 else
16903                         set try -DJOINABLE=__UNDETACHED
16904                         if eval $compile; then
16905                                 echo "You seem to use __UNDETACHED." >&4
16906                                 val="$define"
16907                                 set d_old_pthread_create_joinable
16908                                 eval $setvar
16909                                 val=__UNDETACHED
16910                                 set old_pthread_create_joinable
16911                                 eval $setvar
16912                         else
16913                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16914                                 val="$define"
16915                                 set d_old_pthread_create_joinable
16916                                 eval $setvar
16917                                 val=0
16918                                 set old_pthread_create_joinable
16919                                 eval $setvar
16920                         fi
16921                 fi
16922         fi
16923         $rm_try
16924 else
16925     d_old_pthread_create_joinable="$undef"
16926     old_pthread_create_joinable=""
16927 fi
16928
16929 : see if pause exists
16930 set pause d_pause
16931 eval $inlibc
16932
16933 : see if pipe2 exists
16934 set pipe2 d_pipe2
16935 eval $inlibc
16936
16937 : see if poll exists
16938 set poll d_poll
16939 eval $inlibc
16940
16941 : see if prctl exists
16942 set prctl d_prctl
16943 eval $inlibc
16944
16945 : see if prctl supports PR_SET_NAME
16946 d_prctl_set_name=$undef
16947 case $d_prctl in
16948     $define)
16949         $cat >try.c <<EOM
16950 #ifdef __ANDROID__
16951 #include <unistd.h>
16952 #endif
16953 #include <sys/prctl.h>
16954
16955 int main (int argc, char *argv[])
16956 {
16957     return (prctl (PR_SET_NAME, "Test"));
16958     } /* main */
16959 EOM
16960         set try
16961         if eval $compile_ok && $run ./try; then
16962             echo "Your prctl (PR_SET_NAME, ...) works"
16963             d_prctl_set_name=$define
16964             fi
16965         $rm_try
16966         ;;
16967     esac
16968
16969 : see if readlink exists
16970 set readlink d_readlink
16971 eval $inlibc
16972
16973 : Check if there is a /proc symlink to the abs path of
16974 : the executing program.  We will honor hints of d_procselfexe=$undef
16975 : or procselfexe being non-empty, otherwise will try to determine both
16976 : if we have readlink.
16977 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
16978 : referenced, and AmigaOS does not have a proc filesystem anyway.
16979 echo " "
16980 val="$undef"
16981 if $test "X$d_procselfexe" = Xundef; then
16982         procselfexe=''
16983 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
16984         val="$define"
16985 elif $test "X$d_readlink" = Xdefine; then
16986         : NetBSD first as /proc/self is a symlink to /proc/curproc,
16987         : and it feels more tidy to avoid an extra level of symlink
16988         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16989         while test $# -gt 0; do
16990             type=$1; try=$2
16991             shift; shift
16992             if $issymlink $try; then
16993                 $ls -l $try > reflect
16994                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16995                     echo "You have $type-like $try."
16996                     procselfexe='"'$try'"'
16997                     val="$define"
16998                     : This will break out of the loop
16999                     set X; shift
17000                 fi
17001             fi
17002         done
17003 fi
17004 $rm -f reflect
17005 set d_procselfexe
17006 eval $setvar
17007
17008 : backward compatibility for d_hvfork
17009 if test X$d_hvfork != X; then
17010         d_vfork="$d_hvfork"
17011         d_hvfork=''
17012 fi
17013 : see if there is a vfork
17014 val=''
17015 set vfork val
17016 eval $inlibc
17017
17018 d_pseudofork=$undef
17019
17020 : Ok, but do we want to use it. vfork is reportedly unreliable in
17021 : perl on Solaris 2.x, and probably elsewhere.
17022 case "$val" in
17023 $define)
17024         echo " "
17025         case "$usevfork" in
17026         false) dflt='n';;
17027         *) dflt='y';;
17028         esac
17029         cat <<'EOM'
17030
17031 Perl can only use a vfork() that doesn't suffer from strict
17032 restrictions on calling functions or modifying global data in
17033 the child.  For example, glibc-2.1 contains such a vfork()
17034 that is unsuitable.  If your system provides a proper fork()
17035 call, chances are that you do NOT want perl to use vfork().
17036
17037 EOM
17038         rp="Do you still want to use vfork()?"
17039         . ./myread
17040         case "$ans" in
17041         y|Y) ;;
17042         *)
17043                 echo "Ok, we won't use vfork()."
17044                 val="$undef"
17045                 ;;
17046         esac
17047         ;;
17048 esac
17049 set d_vfork
17050 eval $setvar
17051 case "$d_vfork" in
17052 $define) usevfork='true';;
17053 *) usevfork='false';;
17054 esac
17055
17056 : see whether the pthread_atfork exists
17057 $cat >try.c <<EOP
17058 #include <pthread.h>
17059 #include <stdio.h>
17060 int main() {
17061 #ifdef  PTHREAD_ATFORK
17062         pthread_atfork(NULL,NULL,NULL);
17063 #endif
17064 }
17065 EOP
17066
17067 : see if pthread_atfork exists
17068 set try -DPTHREAD_ATFORK
17069 if eval $compile; then
17070     val="$define"
17071 else
17072     val="$undef"
17073 fi
17074 case "$usethreads" in
17075 $define)
17076         case "$val" in
17077         $define) echo 'pthread_atfork found.' >&4        ;;
17078         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17079         esac
17080 esac
17081 set d_pthread_atfork
17082 eval $setvar
17083
17084 : see if pthread_attr_setscope exists
17085 set pthread_attr_setscope d_pthread_attr_setscope
17086 eval $inlibc
17087
17088 : see whether the various POSIXish _yields exist
17089 $cat >try.c <<EOP
17090 #include <pthread.h>
17091 #include <stdio.h>
17092 int main() {
17093 #ifdef SCHED_YIELD
17094         sched_yield();
17095 #else
17096 #ifdef PTHREAD_YIELD
17097         pthread_yield();
17098 #else
17099 #ifdef PTHREAD_YIELD_NULL
17100         pthread_yield(NULL);
17101 #endif
17102 #endif
17103 #endif
17104 }
17105 EOP
17106 : see if sched_yield exists
17107 set try -DSCHED_YIELD
17108 if eval $compile; then
17109     val="$define"
17110     sched_yield='sched_yield()'
17111 else
17112     val="$undef"
17113 fi
17114 case "$usethreads" in
17115 $define)
17116         case "$val" in
17117         $define) echo 'sched_yield() found.' >&4        ;;
17118         *)       echo 'sched_yield() NOT found.' >&4    ;;
17119         esac
17120 esac
17121 set d_sched_yield
17122 eval $setvar
17123
17124 : see if pthread_yield exists
17125 set try -DPTHREAD_YIELD
17126 if eval $compile; then
17127     val="$define"
17128     case "$sched_yield" in
17129     '') sched_yield='pthread_yield()' ;;
17130     esac
17131 else
17132     set try -DPTHREAD_YIELD_NULL
17133     if eval $compile; then
17134         val="$define"
17135         case "$sched_yield" in
17136         '') sched_yield='pthread_yield(NULL)' ;;
17137         esac
17138     else
17139         val="$undef"
17140     fi
17141 fi
17142 case "$usethreads" in
17143 $define)
17144         case "$val" in
17145         $define) echo 'pthread_yield() found.' >&4      ;;
17146         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17147         esac
17148         ;;
17149 esac
17150 set d_pthread_yield
17151 eval $setvar
17152 case "$sched_yield" in
17153 '') sched_yield=undef ;;
17154 esac
17155 $rm_try
17156
17157 : check for ptrdiff_t
17158 echo " "
17159 echo "Checking to see if you have ptrdiff_t..." >&4
17160 $cat >try.c <<EOCP
17161 #include <stddef.h>
17162 int main() { ptrdiff_t x = 7; }
17163 EOCP
17164 set try
17165 if eval $compile; then
17166         val="$define"
17167         echo "You have ptrdiff_t."
17168 else
17169         val="$undef"
17170         echo "You do not have ptrdiff_t."
17171 fi
17172 $rm_try
17173 set d_ptrdiff_t
17174 eval $setvar
17175
17176 : see if random_r exists
17177 set random_r d_random_r
17178 eval $inlibc
17179 case "$d_random_r" in
17180 "$define")
17181         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17182         case "$d_random_r_proto:$usethreads" in
17183         ":define")      d_random_r_proto=define
17184                 set d_random_r_proto random_r $hdrs
17185                 eval $hasproto ;;
17186         *)      ;;
17187         esac
17188         case "$d_random_r_proto" in
17189         define)
17190         case "$random_r_proto" in
17191         ''|0) try='int random_r(int*, struct random_data*);'
17192         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17193         esac
17194         case "$random_r_proto" in
17195         ''|0) try='int random_r(long*, struct random_data*);'
17196         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17197         esac
17198         case "$random_r_proto" in
17199         ''|0) try='int random_r(struct random_data*, int32_t*);'
17200         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17201         esac
17202         case "$random_r_proto" in
17203         ''|0)   d_random_r=undef
17204                 random_r_proto=0
17205                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17206         * )     case "$random_r_proto" in
17207                 REENTRANT_PROTO*) ;;
17208                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17209                 esac
17210                 echo "Prototype: $try" ;;
17211         esac
17212         ;;
17213         *)      case "$usethreads" in
17214                 define) echo "random_r has no prototype, not using it." >&4 ;;
17215                 esac
17216                 d_random_r=undef
17217                 random_r_proto=0
17218                 ;;
17219         esac
17220         ;;
17221 *)      random_r_proto=0
17222         ;;
17223 esac
17224
17225 : see if readdir and friends exist
17226 set readdir d_readdir
17227 eval $inlibc
17228 set seekdir d_seekdir
17229 eval $inlibc
17230 set telldir d_telldir
17231 eval $inlibc
17232 set rewinddir d_rewinddir
17233 eval $inlibc
17234
17235 : see if readdir64_r exists
17236 set readdir64_r d_readdir64_r
17237 eval $inlibc
17238 case "$d_readdir64_r" in
17239 "$define")
17240         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17241         case "$d_readdir64_r_proto:$usethreads" in
17242         ":define")      d_readdir64_r_proto=define
17243                 set d_readdir64_r_proto readdir64_r $hdrs
17244                 eval $hasproto ;;
17245         *)      ;;
17246         esac
17247         case "$d_readdir64_r_proto" in
17248         define)
17249         case "$readdir64_r_proto" in
17250         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17251         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17252         esac
17253         case "$readdir64_r_proto" in
17254         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17255         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17256         esac
17257         case "$readdir64_r_proto" in
17258         ''|0)   d_readdir64_r=undef
17259                 readdir64_r_proto=0
17260                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17261         * )     case "$readdir64_r_proto" in
17262                 REENTRANT_PROTO*) ;;
17263                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17264                 esac
17265                 echo "Prototype: $try" ;;
17266         esac
17267         ;;
17268         *)      case "$usethreads" in
17269                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17270                 esac
17271                 d_readdir64_r=undef
17272                 readdir64_r_proto=0
17273                 ;;
17274         esac
17275         ;;
17276 *)      readdir64_r_proto=0
17277         ;;
17278 esac
17279
17280 : see if readdir_r exists
17281 set readdir_r d_readdir_r
17282 eval $inlibc
17283 case "$d_readdir_r" in
17284 "$define")
17285         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17286         case "$d_readdir_r_proto:$usethreads" in
17287         ":define")      d_readdir_r_proto=define
17288                 set d_readdir_r_proto readdir_r $hdrs
17289                 eval $hasproto ;;
17290         *)      ;;
17291         esac
17292         case "$d_readdir_r_proto" in
17293         define)
17294         case "$readdir_r_proto" in
17295         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17296         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17297         esac
17298         case "$readdir_r_proto" in
17299         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17300         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17301         esac
17302         case "$readdir_r_proto" in
17303         ''|0)   d_readdir_r=undef
17304                 readdir_r_proto=0
17305                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17306         * )     case "$readdir_r_proto" in
17307                 REENTRANT_PROTO*) ;;
17308                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17309                 esac
17310                 echo "Prototype: $try" ;;
17311         esac
17312         ;;
17313         *)      case "$usethreads" in
17314                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17315                 esac
17316                 d_readdir_r=undef
17317                 readdir_r_proto=0
17318                 ;;
17319         esac
17320         ;;
17321 *)      readdir_r_proto=0
17322         ;;
17323 esac
17324
17325 : see if readv exists
17326 set readv d_readv
17327 eval $inlibc
17328
17329 : see if recvmsg exists
17330 set recvmsg d_recvmsg
17331 eval $inlibc
17332
17333 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17334 echo " "
17335 if set regcomp val -f d_regcomp; eval $csym; $val; then
17336         echo 'regcomp() found.' >&4
17337         d_regcomp="$define"
17338         d_regcmp="$undef"
17339         d_re_comp="$undef"
17340 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17341         echo 'regcmp() found.' >&4
17342         d_regcmp="$define"
17343         d_regcomp="$undef"
17344         d_re_comp="$undef"
17345 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17346         echo 're_comp() found, assuming re_exec() also exists.' >&4
17347         d_re_comp="$define"
17348         d_regcomp="$undef"
17349         d_regcmp="$undef"
17350 else
17351         $cat >&4 <<EOM
17352 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17353 EOM
17354         d_regcmp="$undef"
17355         d_re_comp="$undef"
17356         d_regcomp="$undef"
17357 fi
17358
17359 : see if remainder exists
17360 set remainder d_remainder
17361 eval $inlibc
17362
17363 : see if remquo exists
17364 set remquo d_remquo
17365 eval $inlibc
17366
17367 : see if rename exists
17368 set rename d_rename
17369 eval $inlibc
17370
17371 : see if rint exists
17372 set rint d_rint
17373 eval $inlibc
17374
17375 : see if rmdir exists
17376 set rmdir d_rmdir
17377 eval $inlibc
17378
17379 : see if round exists
17380 set round d_round
17381 eval $inlibc
17382
17383 : see if prototype for sbrk is available
17384 echo " "
17385 set d_sbrkproto sbrk $i_unistd unistd.h
17386 eval $hasproto
17387
17388 : see if scalbn exists
17389 set scalbn d_scalbn
17390 eval $inlibc
17391
17392 : see if select exists
17393 set select d_select
17394 eval $inlibc
17395
17396 : see if semctl exists
17397 set semctl d_semctl
17398 eval $inlibc
17399
17400 : see if semget exists
17401 set semget d_semget
17402 eval $inlibc
17403
17404 : see if semop exists
17405 set semop d_semop
17406 eval $inlibc
17407
17408 : see how much of the 'sem*(2)' library is present.
17409 h_sem=true
17410 echo " "
17411 case "$d_semctl$d_semget$d_semop" in
17412 *"$undef"*) h_sem=false;;
17413 esac
17414 case "$osname" in
17415 freebsd)
17416     case "`ipcs 2>&1`" in
17417     "SVID messages"*"not configured"*)
17418         echo "Your $osname does not have the sem*(2) configured." >&4
17419         h_sem=false
17420         val="$undef"
17421         set semctl d_semctl
17422         eval $setvar
17423         set semget d_semget
17424         eval $setvar
17425         set semop d_semop
17426         eval $setvar
17427         ;;
17428     esac
17429     ;;
17430 esac
17431 : we could also check for sys/ipc.h ...
17432 if $h_sem && $test `./findhdr sys/sem.h`; then
17433         echo "You have the full sem*(2) library." >&4
17434         val="$define"
17435 else
17436         echo "You don't have the full sem*(2) library." >&4
17437         val="$undef"
17438 fi
17439 set d_sem
17440 eval $setvar
17441
17442 : see whether sys/sem.h defines union semun
17443 echo " "
17444 $cat > try.c <<'END'
17445 #include <sys/types.h>
17446 #include <sys/ipc.h>
17447 #include <sys/sem.h>
17448 int main () { union semun semun; semun.buf = 0; }
17449 END
17450 set try
17451 if eval $compile; then
17452     echo "You have union semun in <sys/sem.h>." >&4
17453     val="$define"
17454 else
17455     echo "You do not have union semun in <sys/sem.h>." >&4
17456     val="$undef"
17457 fi
17458 $rm_try
17459 set d_union_semun
17460 eval $setvar
17461
17462 : see how to do semctl IPC_STAT
17463 case "$d_sem" in
17464 $define)
17465     echo " "
17466     $cat > tryh.h <<END
17467 #ifndef S_IRUSR
17468 #   ifdef S_IREAD
17469 #       define S_IRUSR S_IREAD
17470 #       define S_IWUSR S_IWRITE
17471 #       define S_IXUSR S_IEXEC
17472 #   else
17473 #       define S_IRUSR 0400
17474 #       define S_IWUSR 0200
17475 #       define S_IXUSR 0100
17476 #   endif
17477 #   define S_IRGRP (S_IRUSR>>3)
17478 #   define S_IWGRP (S_IWUSR>>3)
17479 #   define S_IXGRP (S_IXUSR>>3)
17480 #   define S_IROTH (S_IRUSR>>6)
17481 #   define S_IWOTH (S_IWUSR>>6)
17482 #   define S_IXOTH (S_IXUSR>>6)
17483 #endif
17484 #ifndef S_IRWXU
17485 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17486 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17487 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17488 #endif
17489 END
17490     : see whether semctl IPC_STAT can use union semun
17491     case "$d_semctl_semun" in
17492     '')
17493       val="$undef"
17494       $cat > try.c <<END
17495 #include <sys/types.h>
17496 #include <sys/ipc.h>
17497 #include <sys/sem.h>
17498 #include <sys/stat.h>
17499 #include <stdio.h>
17500 #include <errno.h>
17501 #include "tryh.h"
17502 #ifndef errno
17503 extern int errno;
17504 #endif
17505 #$d_union_semun HAS_UNION_SEMUN
17506 int main() {
17507     union semun
17508 #ifndef HAS_UNION_SEMUN
17509     {
17510         int val;
17511         struct semid_ds *buf;
17512         unsigned short *array;
17513     }
17514 #endif
17515     arg;
17516     int sem, st;
17517
17518 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17519     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17520     if (sem > -1) {
17521         struct semid_ds argbuf;
17522         arg.buf = &argbuf;
17523 #       ifdef IPC_STAT
17524         st = semctl(sem, 0, IPC_STAT, arg);
17525         if (st == 0)
17526             printf("semun\n");
17527         else
17528 #       endif /* IPC_STAT */
17529             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17530 #       ifdef IPC_RMID
17531         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17532 #       endif /* IPC_RMID */
17533             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17534     } else
17535 #endif /* IPC_PRIVATE && ... */
17536         printf("semget failed: errno = %d\n", errno);
17537   return 0;
17538 }
17539 END
17540       set try
17541       if eval $compile; then
17542           xxx=`$run ./try`
17543           case "$xxx" in
17544           semun) val="$define" ;;
17545           esac
17546       fi
17547       $rm_try
17548       set d_semctl_semun
17549       eval $setvar
17550       ;;
17551     esac
17552     case "$d_semctl_semun" in
17553     $define)
17554         echo "You can use union semun for semctl IPC_STAT." >&4
17555         also='also'
17556         ;;
17557     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17558         also=''
17559         ;;
17560     esac
17561
17562     : see whether semctl IPC_STAT can use struct semid_ds pointer
17563     case "$d_semctl_semid_ds" in
17564     '')
17565       val="$undef"
17566       $cat > try.c <<'END'
17567 #include <sys/types.h>
17568 #include <sys/ipc.h>
17569 #include <sys/sem.h>
17570 #include <sys/stat.h>
17571 #include "tryh.h"
17572 #include <stdio.h>
17573 #include <errno.h>
17574 #ifndef errno
17575 extern int errno;
17576 #endif
17577 int main() {
17578     struct semid_ds arg;
17579     int sem, st;
17580
17581 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17582     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17583     if (sem > -1) {
17584 #       ifdef IPC_STAT
17585         st = semctl(sem, 0, IPC_STAT, &arg);
17586         if (st == 0)
17587             printf("semid_ds\n");
17588         else
17589 #       endif /* IPC_STAT */
17590             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17591 #       ifdef IPC_RMID
17592         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17593 #       endif /* IPC_RMID */
17594             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17595     } else
17596 #endif /* IPC_PRIVATE && ... */
17597         printf("semget failed: errno = %d\n", errno);
17598
17599     return 0;
17600 }
17601 END
17602       set try
17603       if eval $compile; then
17604           xxx=`$run ./try`
17605           case "$xxx" in
17606           semid_ds) val="$define" ;;
17607           esac
17608       fi
17609       $rm_try
17610       set d_semctl_semid_ds
17611       eval $setvar
17612       ;;
17613     esac
17614     case "$d_semctl_semid_ds" in
17615     $define)
17616         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17617         ;;
17618     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17619         ;;
17620     esac
17621     ;;
17622 *)  val="$undef"
17623
17624     # We do not have the full sem*(2) library, so assume we can not
17625     # use either.
17626
17627     set d_semctl_semun
17628     eval $setvar
17629
17630     set d_semctl_semid_ds
17631     eval $setvar
17632     ;;
17633 esac
17634 $rm_try tryh.h
17635
17636 : see if sendmsg exists
17637 set sendmsg d_sendmsg
17638 eval $inlibc
17639
17640 : see if setegid exists
17641 set setegid d_setegid
17642 eval $inlibc
17643
17644 : see if seteuid exists
17645 set seteuid d_seteuid
17646 eval $inlibc
17647
17648 : see if setgrent exists
17649 set setgrent d_setgrent
17650 eval $inlibc
17651
17652 : see if setgrent_r exists
17653 set setgrent_r d_setgrent_r
17654 eval $inlibc
17655 case "$d_setgrent_r" in
17656 "$define")
17657         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17658         case "$d_setgrent_r_proto:$usethreads" in
17659         ":define")      d_setgrent_r_proto=define
17660                 set d_setgrent_r_proto setgrent_r $hdrs
17661                 eval $hasproto ;;
17662         *)      ;;
17663         esac
17664         case "$d_setgrent_r_proto" in
17665         define)
17666         case "$setgrent_r_proto" in
17667         ''|0) try='int setgrent_r(FILE**);'
17668         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17669         esac
17670         case "$setgrent_r_proto" in
17671         ''|0) try='void setgrent_r(FILE**);'
17672         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17673         esac
17674         case "$setgrent_r_proto" in
17675         ''|0)   d_setgrent_r=undef
17676                 setgrent_r_proto=0
17677                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17678         * )     case "$setgrent_r_proto" in
17679                 REENTRANT_PROTO*) ;;
17680                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17681                 esac
17682                 echo "Prototype: $try" ;;
17683         esac
17684         ;;
17685         *)      case "$usethreads" in
17686                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17687                 esac
17688                 d_setgrent_r=undef
17689                 setgrent_r_proto=0
17690                 ;;
17691         esac
17692         ;;
17693 *)      setgrent_r_proto=0
17694         ;;
17695 esac
17696
17697 : see if sethostent exists
17698 set sethostent d_sethent
17699 eval $inlibc
17700
17701 : see if sethostent_r exists
17702 set sethostent_r d_sethostent_r
17703 eval $inlibc
17704 case "$d_sethostent_r" in
17705 "$define")
17706         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17707         case "$d_sethostent_r_proto:$usethreads" in
17708         ":define")      d_sethostent_r_proto=define
17709                 set d_sethostent_r_proto sethostent_r $hdrs
17710                 eval $hasproto ;;
17711         *)      ;;
17712         esac
17713         case "$d_sethostent_r_proto" in
17714         define)
17715         case "$sethostent_r_proto" in
17716         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17717         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17718         esac
17719         case "$sethostent_r_proto" in
17720         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17721         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17722         esac
17723         case "$sethostent_r_proto" in
17724         ''|0)   d_sethostent_r=undef
17725                 sethostent_r_proto=0
17726                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17727         * )     case "$sethostent_r_proto" in
17728                 REENTRANT_PROTO*) ;;
17729                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17730                 esac
17731                 echo "Prototype: $try" ;;
17732         esac
17733         ;;
17734         *)      case "$usethreads" in
17735                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17736                 esac
17737                 d_sethostent_r=undef
17738                 sethostent_r_proto=0
17739                 ;;
17740         esac
17741         ;;
17742 *)      sethostent_r_proto=0
17743         ;;
17744 esac
17745
17746 : see if setitimer exists
17747 set setitimer d_setitimer
17748 eval $inlibc
17749
17750 : see if setlinebuf exists
17751 set setlinebuf d_setlinebuf
17752 eval $inlibc
17753
17754 : see if setlocale exists
17755 set setlocale d_setlocale
17756 eval $inlibc
17757
17758 : see if locale.h is available
17759 set locale.h i_locale
17760 eval $inhdr
17761
17762 : see if setlocale_r exists
17763 set setlocale_r d_setlocale_r
17764 eval $inlibc
17765 case "$d_setlocale_r" in
17766 "$define")
17767         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17768         case "$d_setlocale_r_proto:$usethreads" in
17769         ":define")      d_setlocale_r_proto=define
17770                 set d_setlocale_r_proto setlocale_r $hdrs
17771                 eval $hasproto ;;
17772         *)      ;;
17773         esac
17774         case "$d_setlocale_r_proto" in
17775         define)
17776         case "$setlocale_r_proto" in
17777         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17778         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17779         esac
17780         case "$setlocale_r_proto" in
17781         ''|0)   d_setlocale_r=undef
17782                 setlocale_r_proto=0
17783                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17784         * )     case "$setlocale_r_proto" in
17785                 REENTRANT_PROTO*) ;;
17786                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17787                 esac
17788                 echo "Prototype: $try" ;;
17789         esac
17790         ;;
17791         *)      case "$usethreads" in
17792                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17793                 esac
17794                 d_setlocale_r=undef
17795                 setlocale_r_proto=0
17796                 ;;
17797         esac
17798         ;;
17799 *)      setlocale_r_proto=0
17800         ;;
17801 esac
17802
17803 : see if setnetent exists
17804 set setnetent d_setnent
17805 eval $inlibc
17806
17807 : see if setnetent_r exists
17808 set setnetent_r d_setnetent_r
17809 eval $inlibc
17810 case "$d_setnetent_r" in
17811 "$define")
17812         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17813         case "$d_setnetent_r_proto:$usethreads" in
17814         ":define")      d_setnetent_r_proto=define
17815                 set d_setnetent_r_proto setnetent_r $hdrs
17816                 eval $hasproto ;;
17817         *)      ;;
17818         esac
17819         case "$d_setnetent_r_proto" in
17820         define)
17821         case "$setnetent_r_proto" in
17822         ''|0) try='int setnetent_r(int, struct netent_data*);'
17823         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17824         esac
17825         case "$setnetent_r_proto" in
17826         ''|0) try='void setnetent_r(int, struct netent_data*);'
17827         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17828         esac
17829         case "$setnetent_r_proto" in
17830         ''|0)   d_setnetent_r=undef
17831                 setnetent_r_proto=0
17832                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17833         * )     case "$setnetent_r_proto" in
17834                 REENTRANT_PROTO*) ;;
17835                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17836                 esac
17837                 echo "Prototype: $try" ;;
17838         esac
17839         ;;
17840         *)      case "$usethreads" in
17841                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17842                 esac
17843                 d_setnetent_r=undef
17844                 setnetent_r_proto=0
17845                 ;;
17846         esac
17847         ;;
17848 *)      setnetent_r_proto=0
17849         ;;
17850 esac
17851
17852 : see if setprotoent exists
17853 set setprotoent d_setpent
17854 eval $inlibc
17855
17856 : see if setpgid exists
17857 set setpgid d_setpgid
17858 eval $inlibc
17859
17860 : see if setpgrp2 exists
17861 set setpgrp2 d_setpgrp2
17862 eval $inlibc
17863
17864 : see if setpriority exists
17865 set setpriority d_setprior
17866 eval $inlibc
17867
17868 : see if setproctitle exists
17869 set setproctitle d_setproctitle
17870 eval $inlibc
17871
17872 : see if setprotoent_r exists
17873 set setprotoent_r d_setprotoent_r
17874 eval $inlibc
17875 case "$d_setprotoent_r" in
17876 "$define")
17877         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17878         case "$d_setprotoent_r_proto:$usethreads" in
17879         ":define")      d_setprotoent_r_proto=define
17880                 set d_setprotoent_r_proto setprotoent_r $hdrs
17881                 eval $hasproto ;;
17882         *)      ;;
17883         esac
17884         case "$d_setprotoent_r_proto" in
17885         define)
17886         case "$setprotoent_r_proto" in
17887         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17888         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17889         esac
17890         case "$setprotoent_r_proto" in
17891         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17892         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17893         esac
17894         case "$setprotoent_r_proto" in
17895         ''|0)   d_setprotoent_r=undef
17896                 setprotoent_r_proto=0
17897                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17898         * )     case "$setprotoent_r_proto" in
17899                 REENTRANT_PROTO*) ;;
17900                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17901                 esac
17902                 echo "Prototype: $try" ;;
17903         esac
17904         ;;
17905         *)      case "$usethreads" in
17906                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17907                 esac
17908                 d_setprotoent_r=undef
17909                 setprotoent_r_proto=0
17910                 ;;
17911         esac
17912         ;;
17913 *)      setprotoent_r_proto=0
17914         ;;
17915 esac
17916
17917 : see if setpwent exists
17918 set setpwent d_setpwent
17919 eval $inlibc
17920
17921 : see if setpwent_r exists
17922 set setpwent_r d_setpwent_r
17923 eval $inlibc
17924 case "$d_setpwent_r" in
17925 "$define")
17926         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17927         case "$d_setpwent_r_proto:$usethreads" in
17928         ":define")      d_setpwent_r_proto=define
17929                 set d_setpwent_r_proto setpwent_r $hdrs
17930                 eval $hasproto ;;
17931         *)      ;;
17932         esac
17933         case "$d_setpwent_r_proto" in
17934         define)
17935         case "$setpwent_r_proto" in
17936         ''|0) try='int setpwent_r(FILE**);'
17937         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17938         esac
17939         case "$setpwent_r_proto" in
17940         ''|0) try='void setpwent_r(FILE**);'
17941         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17942         esac
17943         case "$setpwent_r_proto" in
17944         ''|0)   d_setpwent_r=undef
17945                 setpwent_r_proto=0
17946                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17947         * )     case "$setpwent_r_proto" in
17948                 REENTRANT_PROTO*) ;;
17949                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17950                 esac
17951                 echo "Prototype: $try" ;;
17952         esac
17953         ;;
17954         *)      case "$usethreads" in
17955                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17956                 esac
17957                 d_setpwent_r=undef
17958                 setpwent_r_proto=0
17959                 ;;
17960         esac
17961         ;;
17962 *)      setpwent_r_proto=0
17963         ;;
17964 esac
17965
17966 : see if setregid exists
17967 set setregid d_setregid
17968 eval $inlibc
17969 set setresgid d_setresgid
17970 eval $inlibc
17971
17972 : see if setreuid exists
17973 set setreuid d_setreuid
17974 eval $inlibc
17975 set setresuid d_setresuid
17976 eval $inlibc
17977
17978 : see if setrgid exists
17979 set setrgid d_setrgid
17980 eval $inlibc
17981
17982 : see if setruid exists
17983 set setruid d_setruid
17984 eval $inlibc
17985
17986 : see if setservent exists
17987 set setservent d_setsent
17988 eval $inlibc
17989
17990 : see if setservent_r exists
17991 set setservent_r d_setservent_r
17992 eval $inlibc
17993 case "$d_setservent_r" in
17994 "$define")
17995         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17996         case "$d_setservent_r_proto:$usethreads" in
17997         ":define")      d_setservent_r_proto=define
17998                 set d_setservent_r_proto setservent_r $hdrs
17999                 eval $hasproto ;;
18000         *)      ;;
18001         esac
18002         case "$d_setservent_r_proto" in
18003         define)
18004         case "$setservent_r_proto" in
18005         ''|0) try='int setservent_r(int, struct servent_data*);'
18006         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18007         esac
18008         case "$setservent_r_proto" in
18009         ''|0) try='void setservent_r(int, struct servent_data*);'
18010         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18011         esac
18012         case "$setservent_r_proto" in
18013         ''|0)   d_setservent_r=undef
18014                 setservent_r_proto=0
18015                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18016         * )     case "$setservent_r_proto" in
18017                 REENTRANT_PROTO*) ;;
18018                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18019                 esac
18020                 echo "Prototype: $try" ;;
18021         esac
18022         ;;
18023         *)      case "$usethreads" in
18024                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18025                 esac
18026                 d_setservent_r=undef
18027                 setservent_r_proto=0
18028                 ;;
18029         esac
18030         ;;
18031 *)      setservent_r_proto=0
18032         ;;
18033 esac
18034
18035 : see if setsid exists
18036 set setsid d_setsid
18037 eval $inlibc
18038
18039 : see if setvbuf exists
18040 set setvbuf d_setvbuf
18041 eval $inlibc
18042
18043 : see if shmctl exists
18044 set shmctl d_shmctl
18045 eval $inlibc
18046
18047 : see if shmget exists
18048 set shmget d_shmget
18049 eval $inlibc
18050
18051 : see if shmat exists
18052 set shmat d_shmat
18053 eval $inlibc
18054 : see what shmat returns
18055 case "$d_shmat" in
18056 "$define")
18057         $cat >shmat.c <<'END'
18058 #include <sys/shm.h>
18059 void *shmat();
18060 END
18061         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18062                 shmattype='void *'
18063         else
18064                 shmattype='char *'
18065         fi
18066         echo "and it returns ($shmattype)." >&4
18067         : see if a prototype for shmat is available
18068         xxx=`./findhdr sys/shm.h`
18069         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18070         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18071                 val="$define"
18072         else
18073                 val="$undef"
18074         fi
18075         $rm -f shmat.[co]
18076         ;;
18077 *)
18078         val="$undef"
18079         ;;
18080 esac
18081 set d_shmatprototype
18082 eval $setvar
18083
18084 : see if shmdt exists
18085 set shmdt d_shmdt
18086 eval $inlibc
18087
18088 : see how much of the 'shm*(2)' library is present.
18089 h_shm=true
18090 echo " "
18091 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18092 *"$undef"*) h_shm=false;;
18093 esac
18094 case "$osname" in
18095 freebsd)
18096     case "`ipcs 2>&1`" in
18097     "SVID shared memory"*"not configured"*)
18098         echo "Your $osname does not have the shm*(2) configured." >&4
18099         h_shm=false
18100         val="$undef"
18101         set shmctl d_shmctl
18102         eval $setvar
18103         set shmget d_shmget
18104         eval $setvar
18105         set shmat d_shmat
18106         eval $setvar
18107         set shmdt d_shmdt
18108         eval $setvar
18109         ;;
18110     esac
18111     ;;
18112 esac
18113 : we could also check for sys/ipc.h ...
18114 if $h_shm && $test `./findhdr sys/shm.h`; then
18115         echo "You have the full shm*(2) library." >&4
18116         val="$define"
18117 else
18118         echo "You don't have the full shm*(2) library." >&4
18119         val="$undef"
18120 fi
18121 set d_shm
18122 eval $setvar
18123
18124 : see if we have sigaction
18125 echo " "
18126 if set sigaction val -f d_sigaction; eval $csym; $val; then
18127         echo 'sigaction() found.' >&4
18128         $cat > try.c <<EOP
18129 #include <stdio.h>
18130 #include <sys/types.h>
18131 #include <signal.h>
18132 #$i_stdlib I_STDLIB
18133 #ifdef I_STDLIB
18134 #include <stdlib.h>
18135 #endif
18136 int main()
18137 {
18138     struct sigaction act, oact;
18139     act.sa_flags = 0;
18140     oact.sa_handler = 0;
18141     /* so that act and oact are used */
18142     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18143 }
18144 EOP
18145         set try
18146         if eval $compile_ok; then
18147                 val="$define"
18148         else
18149                 echo "But you don't seem to have a usable struct sigaction." >&4
18150                 val="$undef"
18151         fi
18152 else
18153         echo 'sigaction NOT found.' >&4
18154         val="$undef"
18155 fi
18156 set d_sigaction; eval $setvar
18157 $rm_try
18158
18159 : see what type pids are declared as in the kernel
18160 rp="What is the type of process ids on this system?"
18161 set pid_t pidtype int stdio.h sys/types.h
18162 eval $typedef_ask
18163
18164 : see what type uids are declared as in the kernel
18165 echo " "
18166 echo "Looking for the type for user ids returned by getuid()."
18167 set uid_t uidtype xxx stdio.h sys/types.h
18168 eval $typedef
18169 case "$uidtype" in
18170 xxx)
18171         xxx=`./findhdr sys/user.h`
18172         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18173         case $1 in
18174         unsigned) dflt="$1 $2" ;;
18175         *) dflt="$1" ;;
18176         esac
18177         ;;
18178 *) dflt="$uidtype";;
18179 esac
18180 case "$uidtype" in
18181 uid_t)  echo "uid_t found." ;;
18182 *)      rp="What is the type for user ids returned by getuid()?"
18183         . ./myread
18184         uidtype="$ans"
18185         ;;
18186 esac
18187
18188 : Define hasfield_t macro for Configure internal use
18189 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18190 while $test $# -ge 2; do
18191     case "$1" in
18192         $define) echo "#include <$2>";;
18193     esac ;
18194     shift 2;
18195 done > try.c;
18196 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18197 set try;
18198 if eval $compile; then
18199         val="$define";
18200 else
18201         val="$undef";
18202 fi;
18203 set $varname;
18204 eval $setvar;
18205 $rm_try'
18206
18207 : see what siginfo fields we have
18208 case "$d_sigaction" in
18209 "$define")
18210         echo "Checking if your siginfo_t has si_errno field...">&4
18211         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18212         eval $hasfield_t;
18213
18214         echo "Checking if your siginfo_t has si_pid field...">&4
18215         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18216         eval $hasfield_t;
18217
18218         echo "Checking if your siginfo_t has si_uid field...">&4
18219         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18220         eval $hasfield_t;
18221
18222         echo "Checking if your siginfo_t has si_addr field...">&4
18223         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18224         eval $hasfield_t;
18225
18226         echo "Checking if your siginfo_t has si_status field...">&4
18227         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18228         eval $hasfield_t;
18229
18230         echo "Checking if your siginfo_t has si_band field...">&4
18231         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18232         eval $hasfield_t;
18233
18234         echo "Checking if your siginfo_t has si_value field...">&4
18235         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18236         eval $hasfield_t;
18237
18238         echo "Checking if your siginfo_t has si_fd field...">&4
18239         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18240         eval $hasfield_t;
18241
18242         ;;
18243 *)
18244         d_siginfo_si_errno="$undef"
18245         d_siginfo_si_pid="$undef"
18246         d_siginfo_si_uid="$undef"
18247         d_siginfo_si_addr="$undef"
18248         d_siginfo_si_status="$undef"
18249         d_siginfo_si_band="$undef"
18250         d_siginfo_si_value="$undef"
18251         d_siginfo_si_fd="$undef"
18252         ;;
18253 esac
18254
18255 : see if this is a sunmath.h system
18256 set sunmath.h i_sunmath
18257 eval $inhdr
18258
18259 : see if signbit exists
18260 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18261 $cat >try.c <<EOCP
18262 #$i_sunmath I_SUNMATH
18263 #include <math.h>
18264 #ifdef I_SUNMATH  /* Solaris special math library */
18265 #  include <sunmath.h>
18266 #endif
18267 #define NV $nvtype
18268 int main(int argc, char **argv)
18269 {
18270     NV x = 0.0;
18271     NV y = -1.0;
18272     if ((signbit(x) == 0) && (signbit(y) != 0))
18273         return 0;
18274     else
18275         return 1;
18276 }
18277 EOCP
18278 val="$undef"
18279 set try
18280 if eval $compile; then
18281     if $run ./try; then
18282         $echo "Yes." >&4
18283         val="$define"
18284     else
18285         $echo "Signbit seems to be available, but doesn't work as I expected."
18286         $echo "I won't use it." >&4
18287         val="$undef"
18288     fi
18289 else
18290     $echo "Nope." >&4
18291     dflt="$undef"
18292 fi
18293 set d_signbit
18294 eval $setvar
18295 $rm_try
18296
18297 : see if sigprocmask exists
18298 set sigprocmask d_sigprocmask
18299 eval $inlibc
18300
18301 : see if sigsetjmp exists
18302 echo " "
18303 case "$d_sigsetjmp" in
18304 '')
18305         $cat >try.c <<EOP
18306 #include <setjmp.h>
18307 #$i_stdlib I_STDLIB
18308 #ifdef I_STDLIB
18309 #include <stdlib.h>
18310 #endif
18311 sigjmp_buf env;
18312 int set = 1;
18313 int main()
18314 {
18315         if (sigsetjmp(env,1))
18316                 exit(set);
18317         set = 0;
18318         siglongjmp(env, 1);
18319         exit(1);
18320 }
18321 EOP
18322         set try
18323         if eval $compile; then
18324                 if $run ./try >/dev/null 2>&1; then
18325                         echo "POSIX sigsetjmp found." >&4
18326                         val="$define"
18327                 else
18328                         $cat >&4 <<EOM
18329 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18330 I'll ignore them.
18331 EOM
18332                         val="$undef"
18333                 fi
18334         else
18335                 echo "sigsetjmp not found." >&4
18336                 val="$undef"
18337         fi
18338         ;;
18339 *) val="$d_sigsetjmp"
18340         case "$d_sigsetjmp" in
18341         $define) echo "POSIX sigsetjmp found." >&4;;
18342         $undef) echo "sigsetjmp not found." >&4;;
18343         esac
18344         ;;
18345 esac
18346 set d_sigsetjmp
18347 eval $setvar
18348 $rm_try
18349
18350 : see if snprintf exists
18351 set snprintf d_snprintf
18352 eval $inlibc
18353
18354 : see if vsnprintf exists
18355 set vsnprintf d_vsnprintf
18356 eval $inlibc
18357
18358 case "$d_snprintf-$d_vsnprintf" in
18359 "$define-$define")
18360     $cat <<EOM
18361 Checking whether your snprintf() and vsnprintf() work okay...
18362 EOM
18363     $cat >try.c <<'EOCP'
18364 /* v?snprintf testing logic courtesy of Russ Allbery.
18365  * According to C99:
18366  * - if the buffer is too short it still must be \0-terminated
18367  * - if the buffer is too short the potentially required length
18368  *   must be returned and not -1
18369  * - if the buffer is NULL the potentially required length
18370  *   must be returned and not -1 or core dump
18371  */
18372 #include <stdio.h>
18373 #include <stdarg.h>
18374
18375 char buf[2];
18376
18377 int test (char *format, ...)
18378 {
18379     va_list args;
18380     int count;
18381
18382     va_start (args, format);
18383     count = vsnprintf (buf, sizeof buf, format, args);
18384     va_end (args);
18385     return count;
18386 }
18387
18388 int main ()
18389 {
18390     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18391              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18392 }
18393 EOCP
18394     set try
18395     if eval $compile; then
18396         `$run ./try`
18397         case "$?" in
18398         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18399         *) cat <<EOM >&4
18400 Your snprintf() and snprintf() don't seem to be working okay.
18401 EOM
18402            d_snprintf="$undef"
18403            d_vsnprintf="$undef"
18404            ;;
18405         esac
18406     else
18407         echo "(I can't seem to compile the test program--assuming they don't)"
18408         d_snprintf="$undef"
18409         d_vsnprintf="$undef"
18410     fi
18411     $rm_try
18412     ;;
18413 esac
18414
18415 : see if sockatmark exists
18416 set sockatmark d_sockatmark
18417 eval $inlibc
18418
18419 : see if prototype for sockatmark is available
18420 echo " "
18421 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18422 eval $hasproto
18423
18424 : see if socks5_init exists
18425 set socks5_init d_socks5_init
18426 eval $inlibc
18427
18428 : see if srand48_r exists
18429 set srand48_r d_srand48_r
18430 eval $inlibc
18431 case "$d_srand48_r" in
18432 "$define")
18433         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18434         case "$d_srand48_r_proto:$usethreads" in
18435         ":define")      d_srand48_r_proto=define
18436                 set d_srand48_r_proto srand48_r $hdrs
18437                 eval $hasproto ;;
18438         *)      ;;
18439         esac
18440         case "$d_srand48_r_proto" in
18441         define)
18442         case "$srand48_r_proto" in
18443         ''|0) try='int srand48_r(long, struct drand48_data*);'
18444         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18445         esac
18446         case "$srand48_r_proto" in
18447         ''|0)   d_srand48_r=undef
18448                 srand48_r_proto=0
18449                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18450         * )     case "$srand48_r_proto" in
18451                 REENTRANT_PROTO*) ;;
18452                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18453                 esac
18454                 echo "Prototype: $try" ;;
18455         esac
18456         ;;
18457         *)      case "$usethreads" in
18458                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18459                 esac
18460                 d_srand48_r=undef
18461                 srand48_r_proto=0
18462                 ;;
18463         esac
18464         ;;
18465 *)      srand48_r_proto=0
18466         ;;
18467 esac
18468
18469 : see if srandom_r exists
18470 set srandom_r d_srandom_r
18471 eval $inlibc
18472 case "$d_srandom_r" in
18473 "$define")
18474         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18475         case "$d_srandom_r_proto:$usethreads" in
18476         ":define")      d_srandom_r_proto=define
18477                 set d_srandom_r_proto srandom_r $hdrs
18478                 eval $hasproto ;;
18479         *)      ;;
18480         esac
18481         case "$d_srandom_r_proto" in
18482         define)
18483         case "$srandom_r_proto" in
18484         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18485         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18486         esac
18487         case "$srandom_r_proto" in
18488         ''|0)   d_srandom_r=undef
18489                 srandom_r_proto=0
18490                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18491         * )     case "$srandom_r_proto" in
18492                 REENTRANT_PROTO*) ;;
18493                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18494                 esac
18495                 echo "Prototype: $try" ;;
18496         esac
18497         ;;
18498         *)      case "$usethreads" in
18499                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18500                 esac
18501                 d_srandom_r=undef
18502                 srandom_r_proto=0
18503                 ;;
18504         esac
18505         ;;
18506 *)      srandom_r_proto=0
18507         ;;
18508 esac
18509
18510 : see if prototype for setresgid is available
18511 echo " "
18512 set d_sresgproto setresgid $i_unistd unistd.h
18513 eval $hasproto
18514
18515 : see if prototype for setresuid is available
18516 echo " "
18517 set d_sresuproto setresuid $i_unistd unistd.h
18518 eval $hasproto
18519
18520 : see if stat exists
18521 set stat d_stat
18522 eval $inlibc
18523
18524 : see if sys/stat.h is available
18525 set sys/stat.h i_sysstat
18526 eval $inhdr
18527
18528 : see if stat knows about block sizes
18529 echo " "
18530 echo "Checking to see if your struct stat has st_blocks field..." >&4
18531 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18532 eval $hasfield
18533
18534 : see if this is a sys/vfs.h system
18535 set sys/vfs.h i_sysvfs
18536 eval $inhdr
18537
18538 : see if this is a sys/statfs.h system
18539 set sys/statfs.h i_sysstatfs
18540 eval $inhdr
18541
18542 : Check for statfs_s
18543 echo " "
18544 echo "Checking to see if your system supports struct statfs..." >&4
18545 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
18546 eval $hasstruct
18547 case "$d_statfs_s" in
18548 "$define")      echo "Yes, it does."   ;;
18549 *)              echo "No, it doesn't." ;;
18550 esac
18551
18552
18553 : see if struct statfs knows about f_flags
18554 case "$d_statfs_s" in
18555 define)
18556         echo " "
18557         echo "Checking to see if your struct statfs has f_flags field..." >&4
18558         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
18559         eval $hasfield
18560         ;;
18561 *)      val="$undef"
18562         set d_statfs_f_flags
18563         eval $setvar
18564         ;;
18565 esac
18566 case "$d_statfs_f_flags" in
18567 "$define")      echo "Yes, it does."   ;;
18568 *)              echo "No, it doesn't." ;;
18569 esac
18570
18571 : see what flavor, if any, of static inline is supported
18572 echo " "
18573 echo "Checking to see if your system supports static inline..."
18574 $cat > try.c <<'EOCP'
18575 #include <stdlib.h>
18576 extern int f_via_a(int x);
18577 extern int f_via_b(int x);
18578 int main(int argc, char **argv)
18579 {
18580     int y;
18581
18582     y = f_via_a(0);
18583 #ifdef USE_B
18584     y = f_via_b(0);
18585 #endif
18586     if (y == 42) {
18587         return EXIT_SUCCESS;
18588     }
18589     else {
18590         return EXIT_FAILURE;
18591     }
18592 }
18593 EOCP
18594 $cat > a.c <<'EOCP'
18595 static INLINE int f(int x) {
18596     int y;
18597     y = x + 42;
18598     return y;
18599 }
18600
18601 int f_via_a(int x)
18602 {
18603     return f(x);
18604 }
18605 EOCP
18606 $cat > b.c <<'EOCP'
18607 extern int f(int x);
18608
18609 int f_via_b(int x)
18610 {
18611     return f(x);
18612 }
18613 EOCP
18614
18615 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18616 case "$perl_static_inline" in
18617 '')     # Check the various possibilities, and break out on success.
18618         # For gcc, prefer __inline__, which will still permit
18619         # cflags.SH to add in -ansi.
18620         case "$gccversion" in
18621                 '') xxx="inline __inline__ __inline _inline";;
18622                 *)  xxx="__inline__ inline __inline _inline";;
18623         esac
18624         for inline in $xxx; do
18625                 set try -DINLINE=$inline a.c
18626                 if eval $compile && $run ./try; then
18627                         # Now make sure there is no external linkage of static
18628                         # functions
18629                         set try -DINLINE=$inline -DUSE_B a.c b.c
18630                         if eval $compile && $run ./try; then
18631                                 $echo "Your compiler supports static $inline, " >&4
18632                                 $echo "but it also creates an external definition," >&4
18633                                 $echo "so I won't use it." >&4
18634                                 val=$undef
18635                         else
18636                                 $echo "Your compiler supports static $inline." >&4
18637                                 val=$define
18638                                 perl_static_inline="static $inline";
18639                                 break;
18640                         fi
18641                 else
18642                         $echo "Your compiler does NOT support static $inline." >&4
18643                         val="$undef"
18644                 fi
18645         done
18646         ;;
18647 *inline*) # Some variant of inline exists.
18648         echo "Keeping your $hint value of $perl_static_inline."
18649         val=$define
18650         ;;
18651 static)  # No inline capabilities
18652         echo "Keeping your $hint value of $perl_static_inline."
18653         val=$undef
18654         ;;
18655 *)  # Unrecognized previous value -- blindly trust the supplied
18656         # value and hope it makes sense.  Use old value for
18657         # d_static_inline, if there is one.
18658         echo "Keeping your $hint value of $perl_static_inline."
18659         case "$d_static_inline" in
18660                 '') val=$define ;;
18661                 *)  val=$d_static_inline ;;
18662         esac
18663         ;;
18664 esac
18665 # Fallback to plain 'static' if nothing worked.
18666 case "$perl_static_inline" in
18667 '')
18668         perl_static_inline="static"
18669         val=$undef
18670         ;;
18671 esac
18672 set d_static_inline
18673 eval $setvar
18674 $rm -f a.[co] b.[co]
18675 $rm_try
18676
18677 : Check stream access
18678 $cat >&4 <<EOM
18679 Checking how to access stdio streams by file descriptor number...
18680 EOM
18681 case "$stdio_stream_array" in
18682 '')     $cat >try.c <<EOCP
18683 #include <stdio.h>
18684 int main() {
18685   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18686     printf("yes\n");
18687 }
18688 EOCP
18689         for s in _iob __iob __sF
18690         do
18691                 set try -DSTDIO_STREAM_ARRAY=$s
18692                 if eval $compile; then
18693                         case "`$run ./try`" in
18694                         yes)    stdio_stream_array=$s; break ;;
18695                         esac
18696                 fi
18697         done
18698         $rm_try
18699 esac
18700 case "$stdio_stream_array" in
18701 '')     $cat >&4 <<EOM
18702 I can't figure out how to access stdio streams by file descriptor number.
18703 EOM
18704         d_stdio_stream_array="$undef"
18705         ;;
18706 *)      $cat >&4 <<EOM
18707 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18708 EOM
18709         d_stdio_stream_array="$define"
18710         ;;
18711 esac
18712
18713 : see if strcoll exists
18714 set strcoll d_strcoll
18715 eval $inlibc
18716
18717 : see if strerror_l exists
18718 set strerror_l d_strerror_l
18719 eval $inlibc
18720
18721 : see if strerror_r exists
18722 set strerror_r d_strerror_r
18723 eval $inlibc
18724 case "$d_strerror_r" in
18725 "$define")
18726         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18727         case "$d_strerror_r_proto:$usethreads" in
18728         ":define")      d_strerror_r_proto=define
18729                 set d_strerror_r_proto strerror_r $hdrs
18730                 eval $hasproto ;;
18731         *)      ;;
18732         esac
18733         case "$d_strerror_r_proto" in
18734         define)
18735         case "$strerror_r_proto" in
18736         ''|0) try='int strerror_r(int, char*, size_t);'
18737         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18738         esac
18739         case "$strerror_r_proto" in
18740         ''|0) try='int strerror_r(int, char*, int);'
18741         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18742         esac
18743         case "$strerror_r_proto" in
18744         ''|0) try='char* strerror_r(int, char*, size_t);'
18745         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18746         esac
18747         case "$strerror_r_proto" in
18748         ''|0)   d_strerror_r=undef
18749                 strerror_r_proto=0
18750                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18751         * )     case "$strerror_r_proto" in
18752                 REENTRANT_PROTO*) ;;
18753                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18754                 esac
18755                 echo "Prototype: $try" ;;
18756         esac
18757         ;;
18758         *)      case "$usethreads" in
18759                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18760                 esac
18761                 d_strerror_r=undef
18762                 strerror_r_proto=0
18763                 ;;
18764         esac
18765         ;;
18766 *)      strerror_r_proto=0
18767         ;;
18768 esac
18769
18770 : see if strftime exists
18771 set strftime d_strftime
18772 eval $inlibc
18773
18774 : see if strlcat exists
18775 set strlcat d_strlcat
18776 eval $inlibc
18777
18778 : see if strlcpy exists
18779 set strlcpy d_strlcpy
18780 eval $inlibc
18781
18782 : see if strnlen exists
18783 set strnlen d_strnlen
18784 eval $inlibc
18785
18786 : see if strtod exists
18787 set strtod d_strtod
18788 eval $inlibc
18789
18790 : see if strtol exists
18791 set strtol d_strtol
18792 eval $inlibc
18793
18794 : see if strtold exists
18795 set strtold d_strtold
18796 eval $inlibc
18797
18798 : see if strtold_l exists
18799 set strtold_l d_strtold_l
18800 eval $inlibc
18801
18802 : see if strtoll exists
18803 set strtoll d_strtoll
18804 eval $inlibc
18805
18806 case "$d_longlong-$d_strtoll" in
18807 "$define-$define")
18808         $cat <<EOM
18809 Checking whether your strtoll() works okay...
18810 EOM
18811         $cat >try.c <<'EOCP'
18812 #include <errno.h>
18813 #ifdef __hpux
18814 #define strtoll __strtoll
18815 #endif
18816 #ifdef __EMX__
18817 #define strtoll _strtoll
18818 #endif
18819 #include <stdio.h>
18820 extern long long int strtoll(char *s, char **, int);
18821 static int bad = 0;
18822 int check(char *s, long long ell, int een) {
18823         long long gll;
18824         errno = 0;
18825         gll = strtoll(s, 0, 10);
18826         if (!((gll == ell) && (errno == een)))
18827                 bad++;
18828 }
18829 int main() {
18830         check(" 1",                                      1LL, 0);
18831         check(" 0",                                      0LL, 0);
18832         check("-1",                                     -1LL, 0);
18833         check("-9223372036854775808", -9223372036854775808LL, 0);
18834         check("-9223372036854775808", -9223372036854775808LL, 0);
18835         check(" 9223372036854775807",  9223372036854775807LL, 0);
18836         check("-9223372036854775808", -9223372036854775808LL, 0);
18837         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18838         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18839         if (!bad)
18840                 printf("ok\n");
18841 }
18842 EOCP
18843         set try
18844         if eval $compile; then
18845                 yyy=`$run ./try`
18846                 case "$yyy" in
18847                 ok) echo "Your strtoll() seems to be working okay." ;;
18848                 *) cat <<EOM >&4
18849 Your strtoll() doesn't seem to be working okay.
18850 EOM
18851                    d_strtoll="$undef"
18852                    ;;
18853                 esac
18854         else
18855                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18856                 d_strtoll="$undef"
18857         fi
18858         ;;
18859 esac
18860
18861 : see if strtoq exists
18862 set strtoq d_strtoq
18863 eval $inlibc
18864
18865 : see if strtoul exists
18866 set strtoul d_strtoul
18867 eval $inlibc
18868
18869 case "$d_strtoul" in
18870 "$define")
18871         $cat <<EOM
18872 Checking whether your strtoul() works okay...
18873 EOM
18874         $cat >try.c <<'EOCP'
18875 #include <errno.h>
18876 #include <stdio.h>
18877 extern unsigned long int strtoul(char *s, char **, int);
18878 static int bad = 0;
18879 void check(char *s, unsigned long eul, int een) {
18880         unsigned long gul;
18881         errno = 0;
18882         gul = strtoul(s, 0, 10);
18883         if (!((gul == eul) && (errno == een)))
18884                 bad++;
18885 }
18886 int main() {
18887         check(" 1", 1L, 0);
18888         check(" 0", 0L, 0);
18889 EOCP
18890         case "$longsize" in
18891         8)
18892             $cat >>try.c <<'EOCP'
18893         check("18446744073709551615", 18446744073709551615UL, 0);
18894         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18895 #if 0 /* strtoul() for /^-/ strings is undefined. */
18896         check("-1", 18446744073709551615UL, 0);
18897         check("-18446744073709551614", 2, 0);
18898         check("-18446744073709551615", 1, 0);
18899         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18900         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18901 #endif
18902 EOCP
18903                 ;;
18904         4)
18905                     $cat >>try.c <<'EOCP'
18906         check("4294967295", 4294967295UL, 0);
18907         check("4294967296", 4294967295UL, ERANGE);
18908 #if 0 /* strtoul() for /^-/ strings is undefined. */
18909         check("-1", 4294967295UL, 0);
18910         check("-4294967294", 2, 0);
18911         check("-4294967295", 1, 0);
18912         check("-4294967296", 4294967295UL, ERANGE);
18913         check("-4294967297", 4294967295UL, ERANGE);
18914 #endif
18915 EOCP
18916                 ;;
18917         *)
18918 : Should we write these tests to be more portable by sprintf-ing
18919 : ~0 and then manipulating that char string as input for strtol?
18920                 ;;
18921         esac
18922         $cat >>try.c <<'EOCP'
18923         if (!bad)
18924                 printf("ok\n");
18925         return 0;
18926 }
18927 EOCP
18928         set try
18929         if eval $compile; then
18930                 case "`$run ./try`" in
18931                 ok) echo "Your strtoul() seems to be working okay." ;;
18932                 *) cat <<EOM >&4
18933 Your strtoul() doesn't seem to be working okay.
18934 EOM
18935                    d_strtoul="$undef"
18936                    ;;
18937                 esac
18938         else
18939                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18940                 d_strtoul="$undef"
18941         fi
18942         ;;
18943 esac
18944
18945 : see if strtoull exists
18946 set strtoull d_strtoull
18947 eval $inlibc
18948
18949 case "$d_longlong-$d_strtoull" in
18950 "$define-$define")
18951         $cat <<EOM
18952 Checking whether your strtoull() works okay...
18953 EOM
18954         $cat >try.c <<'EOCP'
18955 #include <errno.h>
18956 #ifdef __hpux
18957 #define strtoull __strtoull
18958 #endif
18959 #include <stdio.h>
18960 extern unsigned long long int strtoull(char *s, char **, int);
18961 static int bad = 0;
18962 int check(char *s, long long eull, int een) {
18963         long long gull;
18964         errno = 0;
18965         gull = strtoull(s, 0, 10);
18966         if (!((gull == eull) && (errno == een)))
18967                 bad++;
18968 }
18969 int main() {
18970         check(" 1",                                        1LL, 0);
18971         check(" 0",                                        0LL, 0);
18972         check("18446744073709551615",  18446744073709551615ULL, 0);
18973         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18974 #if 0 /* strtoull() for /^-/ strings is undefined. */
18975         check("-1",                    18446744073709551615ULL, 0);
18976         check("-18446744073709551614",                     2LL, 0);
18977         check("-18446744073709551615",                     1LL, 0);
18978         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18979         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18980 #endif
18981         if (!bad)
18982                 printf("ok\n");
18983 }
18984 EOCP
18985         set try
18986         if eval $compile; then
18987                 case "`$run ./try`" in
18988                 ok) echo "Your strtoull() seems to be working okay." ;;
18989                 *) cat <<EOM >&4
18990 Your strtoull() doesn't seem to be working okay.
18991 EOM
18992                    d_strtoull="$undef"
18993                    ;;
18994                 esac
18995         else
18996                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18997                 d_strtoull="$undef"
18998         fi
18999         ;;
19000 esac
19001
19002 : see if strtouq exists
19003 set strtouq d_strtouq
19004 eval $inlibc
19005
19006 case "$d_strtouq" in
19007 "$define")
19008         $cat <<EOM
19009 Checking whether your strtouq() works okay...
19010 EOM
19011         $cat >try.c <<'EOCP'
19012 #include <errno.h>
19013 #include <stdio.h>
19014 extern unsigned long long int strtouq(char *s, char **, int);
19015 static int bad = 0;
19016 void check(char *s, unsigned long long eull, int een) {
19017         unsigned long long gull;
19018         errno = 0;
19019         gull = strtouq(s, 0, 10);
19020         if (!((gull == eull) && (errno == een)))
19021                 bad++;
19022 }
19023 int main() {
19024         check(" 1",                                        1LL, 0);
19025         check(" 0",                                        0LL, 0);
19026         check("18446744073709551615",  18446744073709551615ULL, 0);
19027         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19028 #if 0 /* strtouq() for /^-/ strings is undefined. */
19029         check("-1",                    18446744073709551615ULL, 0);
19030         check("-18446744073709551614",                     2LL, 0);
19031         check("-18446744073709551615",                     1LL, 0);
19032         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19033         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19034 #endif
19035         if (!bad)
19036                 printf("ok\n");
19037         return 0;
19038 }
19039 EOCP
19040         set try
19041         if eval $compile; then
19042                 case "`$run ./try`" in
19043                 ok) echo "Your strtouq() seems to be working okay." ;;
19044                 *) cat <<EOM >&4
19045 Your strtouq() doesn't seem to be working okay.
19046 EOM
19047                    d_strtouq="$undef"
19048                    ;;
19049                 esac
19050         else
19051                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19052                 d_strtouq="$undef"
19053         fi
19054         ;;
19055 esac
19056
19057 : see if strxfrm exists
19058 set strxfrm d_strxfrm
19059 eval $inlibc
19060
19061 : see if symlink exists
19062 set symlink d_symlink
19063 eval $inlibc
19064
19065 : see if syscall exists
19066 set syscall d_syscall
19067 eval $inlibc
19068
19069 : see if prototype for syscall is available
19070 echo " "
19071 set d_syscallproto syscall $i_unistd unistd.h
19072 eval $hasproto
19073
19074 : see if sysconf exists
19075 set sysconf d_sysconf
19076 eval $inlibc
19077
19078 : see if sys_errlist[] exists
19079 echo " "
19080 if test "X$d_syserrlst" = X; then
19081         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19082                 echo "You have sys_errlist[], so we could roll our own strerror."
19083                 d_syserrlst="$define"
19084         else
19085                 echo "You don't have sys_errlist[], so strerror() is welcome."
19086                 d_syserrlst="$undef"
19087         fi
19088 fi
19089
19090 : see if system exists
19091 set system d_system
19092 eval $inlibc
19093
19094 : see if tcgetpgrp exists
19095 set tcgetpgrp d_tcgetpgrp
19096 eval $inlibc
19097
19098 : see if tcsetpgrp exists
19099 set tcsetpgrp d_tcsetpgrp
19100 eval $inlibc
19101
19102 : see if prototype for telldir is available
19103 echo " "
19104 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19105 eval $hasproto
19106
19107 : see if tgamma exists
19108 set tgamma d_tgamma
19109 eval $inlibc
19110
19111 : check for thread_safe_nl_langinfo_l item
19112 $cat <<EOM
19113
19114 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19115 EOM
19116 $cat >try.c <<EOCP
19117 #$i_stdlib I_STDLIB
19118 #ifdef I_STDLIB
19119 #  include <stdlib.h>
19120 #endif
19121 #include <string.h>
19122 #$i_langinfo I_LANGINFO
19123 #ifdef I_LANGINFO
19124 #  include <langinfo.h>
19125 #endif
19126 #$i_pthread I_PTHREAD
19127 #ifdef I_PTHREAD
19128 #  include <pthread.h>
19129 #endif
19130 #$i_locale I_LOCALE
19131 #ifdef I_LOCALE
19132 #  include <locale.h>
19133 #endif
19134
19135 void *
19136 thread_start(void * arg)
19137 {
19138     nl_langinfo(RADIXCHAR);
19139 }
19140
19141 int main() {
19142     char * main_buffer;
19143     char save_main_buffer[1000];
19144     pthread_t subthread;
19145     pthread_attr_t attr;
19146
19147     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19148
19149     /* If too large for our generous allowance, just assume we don't have
19150      * it. */
19151     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19152         exit(1);
19153     }
19154
19155     strcpy(save_main_buffer, main_buffer);
19156
19157     if (pthread_attr_init(&attr) != 0) {
19158         exit(1);
19159     }
19160
19161     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19162         exit(1);
19163     }
19164
19165     if (pthread_join(subthread, NULL) != 0) {
19166         exit(1);
19167     }
19168
19169     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19170 }
19171 EOCP
19172 case "$usethreads" in
19173     define)
19174         set try
19175         if eval $compile; then
19176             echo "Your system has nl_langinfo_l()..." >&4
19177             if $run ./try; then
19178                 echo "and it is thread-safe (just as I'd hoped)." >&4
19179                 d_thread_safe_nl_langinfo_l="$define"
19180                 echo "$d_thread_safe_nl_langinfo_l" >&4
19181             else
19182                 echo "but it isn't thread-safe, so we won't use it." >&4
19183             fi
19184         else
19185             echo "your system does not have nl_langinfo_l()" >&4
19186         fi
19187         ;;
19188     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19189 esac
19190 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19191         d_thread_safe_nl_langinfo_l="$undef"
19192 fi
19193 $rm_try
19194
19195 : see if time exists
19196 echo " "
19197 if test "X$d_time" = X -o X"$timetype" = X; then
19198     if set time val -f d_time; eval $csym; $val; then
19199                 echo 'time() found.' >&4
19200                 val="$define"
19201                 rp="What is the type returned by time() on this system?"
19202                 set time_t timetype long stdio.h sys/types.h
19203                 eval $typedef_ask
19204     else
19205                 echo 'time() not found, hope that will do.' >&4
19206                 val="$undef"
19207                 timetype='int';
19208     fi
19209     set d_time
19210     eval $setvar
19211 fi
19212
19213 : see if timegm exists
19214 set timegm d_timegm
19215 eval $inlibc
19216
19217 : see if this is a sys/times.h system
19218 set sys/times.h i_systimes
19219 eval $inhdr
19220
19221 : see if times exists
19222 echo " "
19223 if set times val -f d_times; eval $csym; $val; then
19224         echo 'times() found.' >&4
19225         d_times="$define"
19226         inc=''
19227         case "$i_systimes" in
19228         "$define") inc='sys/times.h';;
19229         esac
19230         rp="What is the type returned by times() on this system?"
19231         set clock_t clocktype long stdio.h sys/types.h $inc
19232         eval $typedef_ask
19233 else
19234         echo 'times() NOT found, hope that will do.' >&4
19235         d_times="$undef"
19236         clocktype='int'
19237 fi
19238
19239 : see if tmpnam_r exists
19240 set tmpnam_r d_tmpnam_r
19241 eval $inlibc
19242 case "$d_tmpnam_r" in
19243 "$define")
19244         hdrs="$i_systypes sys/types.h define stdio.h "
19245         case "$d_tmpnam_r_proto:$usethreads" in
19246         ":define")      d_tmpnam_r_proto=define
19247                 set d_tmpnam_r_proto tmpnam_r $hdrs
19248                 eval $hasproto ;;
19249         *)      ;;
19250         esac
19251         case "$d_tmpnam_r_proto" in
19252         define)
19253         case "$tmpnam_r_proto" in
19254         ''|0) try='char* tmpnam_r(char*);'
19255         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19256         esac
19257         case "$tmpnam_r_proto" in
19258         ''|0)   d_tmpnam_r=undef
19259                 tmpnam_r_proto=0
19260                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19261         * )     case "$tmpnam_r_proto" in
19262                 REENTRANT_PROTO*) ;;
19263                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19264                 esac
19265                 echo "Prototype: $try" ;;
19266         esac
19267         ;;
19268         *)      case "$usethreads" in
19269                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19270                 esac
19271                 d_tmpnam_r=undef
19272                 tmpnam_r_proto=0
19273                 ;;
19274         esac
19275         ;;
19276 *)      tmpnam_r_proto=0
19277         ;;
19278 esac
19279
19280 : see if trunc exists
19281 set trunc d_trunc
19282 eval $inlibc
19283
19284 : see if truncate exists
19285 set truncate d_truncate
19286 eval $inlibc
19287
19288 : see if ttyname_r exists
19289 set ttyname_r d_ttyname_r
19290 eval $inlibc
19291 case "$d_ttyname_r" in
19292 "$define")
19293         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19294         case "$d_ttyname_r_proto:$usethreads" in
19295         ":define")      d_ttyname_r_proto=define
19296                 set d_ttyname_r_proto ttyname_r $hdrs
19297                 eval $hasproto ;;
19298         *)      ;;
19299         esac
19300         case "$d_ttyname_r_proto" in
19301         define)
19302         case "$ttyname_r_proto" in
19303         ''|0) try='int ttyname_r(int, char*, size_t);'
19304         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19305         esac
19306         case "$ttyname_r_proto" in
19307         ''|0) try='int ttyname_r(int, char*, int);'
19308         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19309         esac
19310         case "$ttyname_r_proto" in
19311         ''|0) try='char* ttyname_r(int, char*, int);'
19312         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19313         esac
19314         case "$ttyname_r_proto" in
19315         ''|0)   d_ttyname_r=undef
19316                 ttyname_r_proto=0
19317                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19318         * )     case "$ttyname_r_proto" in
19319                 REENTRANT_PROTO*) ;;
19320                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19321                 esac
19322                 echo "Prototype: $try" ;;
19323         esac
19324         ;;
19325         *)      case "$usethreads" in
19326                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19327                 esac
19328                 d_ttyname_r=undef
19329                 ttyname_r_proto=0
19330                 ;;
19331         esac
19332         ;;
19333 *)      ttyname_r_proto=0
19334         ;;
19335 esac
19336
19337 : see if tzname[] exists
19338 echo " "
19339 if set tzname val -a d_tzname; eval $csym; $val; then
19340         val="$define"
19341         echo 'tzname[] found.' >&4
19342 else
19343         val="$undef"
19344         echo 'tzname[] NOT found.' >&4
19345 fi
19346 set d_tzname
19347 eval $setvar
19348
19349 : Check if is a multiplatform env
19350 case "$osname" in
19351 darwin) multiarch="$define" ;;
19352 esac
19353 case "$multiarch" in
19354 ''|[nN]*) multiarch="$undef" ;;
19355 esac
19356
19357 : check for ordering of bytes in a UV
19358 echo " "
19359 case "$multiarch" in
19360 *$define*)
19361         $cat <<EOM
19362 You seem to be doing a multiarchitecture build,
19363 skipping the byteorder check.
19364
19365 EOM
19366         byteorder='ffff'
19367         ;;
19368 *)
19369         case "$byteorder" in
19370         '')
19371                 $cat <<'EOM'
19372 In the following, larger digits indicate more significance.  A big-endian
19373 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19374 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19375 machines may have weird orders like 3412.  A Cray will report 87654321,
19376 an Alpha will report 12345678. If the test program works the default is
19377 probably right.
19378 I'm now running the test program...
19379 EOM
19380                 $cat >try.c <<EOCP
19381 #include <stdio.h>
19382 #$i_stdlib I_STDLIB
19383 #ifdef I_STDLIB
19384 #include <stdlib.h>
19385 #endif
19386 #include <sys/types.h>
19387 typedef $uvtype UV;
19388 int main()
19389 {
19390         int i;
19391         union {
19392                 UV l;
19393                 char c[$uvsize];
19394         } u;
19395
19396         if ($uvsize > 4)
19397                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19398         else
19399                 u.l = (UV)0x04030201;
19400         for (i = 0; i < $uvsize; i++)
19401                 printf("%c", u.c[i]+'0');
19402         printf("\n");
19403         exit(0);
19404 }
19405 EOCP
19406                 xxx_prompt=y
19407                 set try
19408                 if eval $compile && $run ./try > /dev/null; then
19409                         dflt=`$run ./try`
19410                         case "$dflt" in
19411                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19412                                 echo "(The test program ran ok.)"
19413                                 echo "byteorder=$dflt"
19414                                 xxx_prompt=n
19415                         ;;
19416                         ????|????????) echo "(The test program ran ok.)" ;;
19417                         *) echo "(The test program didn't run right for some reason.)" ;;
19418                         esac
19419                 else
19420                         dflt='4321'
19421                         cat <<'EOM'
19422 (I can't seem to compile the test program.  Guessing big-endian...)
19423 EOM
19424                 fi
19425                 case "$xxx_prompt" in
19426                 y)
19427                         rp="What is the order of bytes in $uvtype?"
19428                         . ./myread
19429                         byteorder="$ans"
19430                         ;;
19431                 *)      byteorder=$dflt
19432                         ;;
19433                 esac
19434                 ;;
19435         esac
19436         $rm_try
19437         ;;
19438 esac
19439
19440 : Checking 32bit alignedness
19441 $cat <<EOM
19442
19443 Checking to see whether you can access character data unalignedly...
19444 EOM
19445 case "$d_u32align" in
19446 '')   $cat >try.c <<EOCP
19447 #include <stdio.h>
19448 #$i_stdlib I_STDLIB
19449 #ifdef I_STDLIB
19450 #include <stdlib.h>
19451 #endif
19452 #define U32 $u32type
19453 #define BYTEORDER 0x$byteorder
19454 #define U8 $u8type
19455 #include <signal.h>
19456 #ifdef SIGBUS
19457 $signal_t bletch(int s) { exit(4); }
19458 #endif
19459 int main() {
19460 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19461     volatile U8 buf[8];
19462     volatile U32 *up;
19463     int i;
19464
19465     if (sizeof(U32) != 4) {
19466         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19467         exit(1);
19468     }
19469
19470     fflush(stdout);
19471
19472 #ifdef SIGBUS
19473     signal(SIGBUS, bletch);
19474 #endif
19475
19476     buf[0] = 0;
19477     buf[1] = 0;
19478     buf[2] = 0;
19479     buf[3] = 1;
19480     buf[4] = 0;
19481     buf[5] = 0;
19482     buf[6] = 0;
19483     buf[7] = 1;
19484
19485     for (i = 0; i < 4; i++) {
19486         up = (U32*)(buf + i);
19487         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19488                (*up == 1 << (8*(3-i)))  /* little-endian */
19489               )
19490            )
19491         {
19492             printf("read failed (%x)\n", *up);
19493             exit(2);
19494         }
19495     }
19496
19497     /* write test */
19498     for (i = 0; i < 4; i++) {
19499         up = (U32*)(buf + i);
19500         *up = 0xBeef;
19501         if (*up != 0xBeef) {
19502             printf("write failed (%x)\n", *up);
19503             exit(3);
19504         }
19505     }
19506
19507     exit(0);
19508 #else
19509     printf("1\n");
19510     exit(1);
19511 #endif
19512     return 0;
19513 }
19514 EOCP
19515 set try
19516 if eval $compile_ok; then
19517         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19518         $run ./try 2>&1 >/dev/null
19519         case "$?" in
19520         0)      cat >&4 <<EOM
19521 You can access character data pretty unalignedly.
19522 EOM
19523                 d_u32align="$undef"
19524                 ;;
19525         *)      cat >&4 <<EOM
19526 It seems that you must access character data in an aligned manner.
19527 EOM
19528                 d_u32align="$define"
19529                 ;;
19530         esac
19531 else
19532         rp='Can you access character data at unaligned addresses?'
19533         dflt='n'
19534         . ./myread
19535         case "$ans" in
19536         [yY]*)  d_u32align="$undef"  ;;
19537         *)      d_u32align="$define" ;;
19538         esac
19539 fi
19540 $rm_try
19541 ;;
19542 esac
19543
19544 : see if ualarm exists
19545 set ualarm d_ualarm
19546 eval $inlibc
19547
19548 : see if umask exists
19549 set umask d_umask
19550 eval $inlibc
19551
19552 : see if unordered exists
19553 set unordered d_unordered
19554 eval $inlibc
19555
19556 : see if unsetenv exists
19557 set unsetenv d_unsetenv
19558 eval $inlibc
19559
19560 : see if usleep exists
19561 set usleep d_usleep
19562 eval $inlibc
19563
19564 : see if prototype for usleep is available
19565 echo " "
19566 set d_usleepproto usleep $i_unistd unistd.h
19567 eval $hasproto
19568
19569 : see if ustat exists
19570 set ustat d_ustat
19571 eval $inlibc
19572
19573 : see if closedir exists
19574 set closedir d_closedir
19575 eval $inlibc
19576
19577 case "$d_closedir" in
19578 "$define")
19579         echo " "
19580         echo "Checking whether closedir() returns a status..." >&4
19581         cat > try.c <<EOM
19582 #$i_dirent I_DIRENT             /**/
19583 #$i_sysdir I_SYS_DIR            /**/
19584 #$i_sysndir I_SYS_NDIR          /**/
19585 #$i_systypes I_SYS_TYPES        /**/
19586
19587 #if defined(I_SYS_TYPES)
19588 #include <sys/types.h>
19589 #endif
19590 #if defined(I_DIRENT)
19591 #include <dirent.h>
19592 #else
19593 #ifdef I_SYS_NDIR
19594 #include <sys/ndir.h>
19595 #else
19596 #ifdef I_SYS_DIR
19597 #include <sys/dir.h>
19598 #endif
19599 #endif
19600 #endif
19601 int main() { return closedir(opendir(".")); }
19602 EOM
19603         set try
19604         if eval $compile_ok; then
19605                 if $run ./try > /dev/null 2>&1 ; then
19606                         echo "Yes, it does."
19607                         val="$undef"
19608                 else
19609                         echo "No, it doesn't."
19610                         val="$define"
19611                 fi
19612         else
19613                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19614                 val="$define"
19615         fi
19616         ;;
19617 *)
19618         val="$undef";
19619         ;;
19620 esac
19621 set d_void_closedir
19622 eval $setvar
19623 $rm_try
19624
19625 : see if there is a wait4
19626 set wait4 d_wait4
19627 eval $inlibc
19628
19629 : see if waitpid exists
19630 set waitpid d_waitpid
19631 eval $inlibc
19632
19633 : look for wcscmp
19634 echo " "
19635 $cat >try.c <<'EOCP'
19636 #include <stdio.h>
19637 #include <wchar.h>
19638 int main ()
19639 {
19640     wchar_t *s = L" ";
19641     return (wcscmp (s, s) ? 1 : 0);
19642     }
19643 EOCP
19644 set try
19645 val="$undef"
19646 if eval $compile; then
19647     `$run ./try`
19648     case "$?" in
19649         0)  echo "A working wcscmp() found." >&4
19650             val="$define" ;;
19651         *)  echo "wcscmp() found, but it doesn't work" >&4
19652             ;;
19653         esac
19654 else
19655     echo "wcscmp() NOT found." >&4
19656     fi
19657 set d_wcscmp
19658 eval $setvar
19659 $rm_try
19660
19661 : see if wcstombs exists
19662 set wcstombs d_wcstombs
19663 eval $inlibc
19664
19665 : look for wcsxfrm
19666 echo " "
19667 $cat >try.c <<'EOCP'
19668 #include <errno.h>
19669 #include <wchar.h>
19670 int main ()
19671 {
19672     wchar_t dst[4], *src = L" ";
19673     errno = 0;
19674     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19675     }
19676 EOCP
19677 set try
19678 val="$undef"
19679 if eval $compile; then
19680     `$run ./try`
19681     case "$?" in
19682         0)  echo "A working wcsxfrm() found." >&4
19683             val="$define" ;;
19684         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19685             ;;
19686         esac
19687 else
19688     echo "wcsxfrm() NOT found." >&4
19689     fi
19690 set d_wcsxfrm
19691 eval $setvar
19692 $rm_try
19693
19694 : see if wctomb exists
19695 set wctomb d_wctomb
19696 eval $inlibc
19697
19698 : see if writev exists
19699 set writev d_writev
19700 eval $inlibc
19701
19702 : check for alignment requirements
19703 echo " "
19704 case "$alignbytes" in
19705     '') echo "Checking alignment constraints..." >&4
19706         $cat >try.c <<EOCP
19707 #include <stdio.h>
19708 struct foobar {
19709     char foo;
19710     $nvtype bar;
19711 } try_algn;
19712 int main()
19713 {
19714     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19715     return(0);
19716 }
19717 EOCP
19718         set try
19719         if eval $compile_ok; then
19720             dflt=`$run ./try`
19721         else
19722             dflt='8'
19723             echo "(I can't seem to compile the test program...)"
19724         fi
19725         case "$multiarch" in
19726             *$define*)
19727                 : The usual safe value is 8, but Darwin with -Duselongdouble
19728                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19729                 : Configure to pick a larger value if needed.
19730                 if $test "$dflt" -lt 8; then
19731                     dflt='8'
19732                     echo "Setting alignment to 8 for multiarch support.">&4
19733                 fi
19734                 ;;
19735         esac
19736         ;;
19737     *) dflt="$alignbytes"
19738         ;;
19739 esac
19740 rp="Doubles must be aligned on a how-many-byte boundary?"
19741 . ./myread
19742 alignbytes="$ans"
19743 $rm_try
19744
19745 : set the base revision
19746 baserev=5.0
19747
19748 : length of character in bytes. Is always 1, otherwise it is not C
19749 : This used to be a test using sizeof
19750 charsize=1
19751
19752 : Check for the number of bits in a character
19753 case "$charbits" in
19754 '')     echo "Checking how long a character is (in bits)..." >&4
19755         $cat >try.c <<EOCP
19756 #include <stdio.h>
19757 int main ()
19758 {
19759     int n;
19760     unsigned char c;
19761     for (c = 1, n = 0; c; c <<= 1, n++) ;
19762     printf ("%d\n", n);
19763     return (0);
19764     }
19765 EOCP
19766         set try
19767         if eval $compile_ok; then
19768                 dflt=`$run ./try`
19769         else
19770                 dflt='8'
19771                 echo "(I can't seem to compile the test program.  Guessing...)"
19772         fi
19773         ;;
19774 *)
19775         dflt="$charbits"
19776         ;;
19777 esac
19778 rp="What is the length of a character (in bits)?"
19779 . ./myread
19780 charbits="$ans"
19781 $rm_try
19782 case "$charbits" in
19783 8)      ;;
19784 *)      cat >&4 << EOM
19785 Your system has an unsigned character size of $charbits bits, which
19786 is rather unusual (normally it is 8 bits).  Perl likely will not work
19787 correctly on your system, with subtle bugs in various places.
19788 EOM
19789         rp='Do you really want to continue?'
19790         dflt='n'
19791         . ./myread
19792         case "$ans" in
19793                 [yY])   echo >&4 "Okay, continuing."    ;;
19794                 *)      exit 1                          ;;
19795         esac
19796 esac
19797
19798 : how do we concatenate cpp tokens here?
19799 echo " "
19800 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19801 $cat >cpp_stuff.c <<'EOCP'
19802 #define RCAT(a,b)a/**/b
19803 #define ACAT(a,b)a ## b
19804 RCAT(Rei,ser)
19805 ACAT(Cir,cus)
19806 EOCP
19807 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19808 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19809         echo "Oh!  Smells like ANSI's been here." >&4
19810         echo "We can catify or stringify, separately or together!"
19811         cpp_stuff=42
19812 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19813         echo "Ah, yes!  The good old days!" >&4
19814         echo "However, in the good old days we don't know how to stringify and"
19815         echo "catify at the same time."
19816         cpp_stuff=1
19817 else
19818         $cat >&4 <<EOM
19819 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19820 You're going to have to edit the values of CAT[2-5] in config.h...
19821 EOM
19822         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19823 fi
19824 $rm -f cpp_stuff.*
19825
19826 : see if this is a db.h system
19827 set db.h i_db
19828 eval $inhdr
19829
19830 case "$i_db" in
19831 $define)
19832         : Check db version.
19833         echo " "
19834         echo "Checking Berkeley DB version ..." >&4
19835         $cat >try.c <<EOCP
19836 #$d_const HASCONST
19837 #ifndef HASCONST
19838 #define const
19839 #endif
19840 #include <sys/types.h>
19841 #include <stdio.h>
19842 #$i_stdlib I_STDLIB
19843 #ifdef I_STDLIB
19844 #include <stdlib.h>
19845 #endif
19846 #include <db.h>
19847 int main(int argc, char *argv[])
19848 {
19849 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19850     int Major, Minor, Patch ;
19851     unsigned long Version ;
19852     (void)db_version(&Major, &Minor, &Patch) ;
19853     if (argc == 2) {
19854         printf("%d %d %d %d %d %d\n",
19855                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19856                Major, Minor, Patch);
19857         exit(0);
19858     }
19859     printf("You have Berkeley DB Version 2 or greater.\n");
19860
19861     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19862                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19863     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19864                 Major, Minor, Patch) ;
19865
19866     /* check that db.h & libdb are compatible */
19867     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19868         printf("db.h and libdb are incompatible.\n") ;
19869         exit(3);
19870     }
19871
19872     printf("db.h and libdb are compatible.\n") ;
19873
19874     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19875                 + DB_VERSION_PATCH ;
19876
19877     /* needs to be >= 2.3.4 */
19878     if (Version < 2003004) {
19879     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19880         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19881         exit(2);
19882     }
19883
19884     exit(0);
19885 #else
19886 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19887     if (argc == 2) {
19888         printf("1 0 0\n");
19889         exit(0);
19890     }
19891     printf("You have Berkeley DB Version 1.\n");
19892     exit(0);    /* DB version < 2: the coast is clear. */
19893 #else
19894     exit(1);    /* <db.h> not Berkeley DB? */
19895 #endif
19896 #endif
19897 }
19898 EOCP
19899         set try
19900         if eval $compile_ok && $run ./try; then
19901                 echo 'Looks OK.' >&4
19902                 set `$run ./try 1`
19903                 db_version_major=$1
19904                 db_version_minor=$2
19905                 db_version_patch=$3
19906         else
19907                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19908                 i_db=$undef
19909                 case " $libs " in
19910                 *"-ldb "*)
19911                         : Remove db from list of libraries to use
19912                         echo "Removing unusable -ldb from library list" >&4
19913                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19914                         shift
19915                         libs="$*"
19916                         echo "libs = $libs" >&4
19917                         ;;
19918                 esac
19919         fi
19920         $rm_try
19921         ;;
19922 esac
19923
19924 case "$i_db" in
19925 define)
19926         : Check the return type needed for hash
19927         echo " "
19928         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19929         $cat >try.c <<EOCP
19930 #$d_const HASCONST
19931 #ifndef HASCONST
19932 #define const
19933 #endif
19934 #include <sys/types.h>
19935 #include <db.h>
19936
19937 #ifndef DB_VERSION_MAJOR
19938 u_int32_t hash_cb (const void* ptr, size_t size)
19939 {
19940 }
19941 HASHINFO info;
19942 int main()
19943 {
19944         info.hash = hash_cb;
19945 }
19946 #endif
19947 EOCP
19948         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19949                 if $contains warning try.out >>/dev/null 2>&1 ; then
19950                         db_hashtype='int'
19951                 else
19952                         db_hashtype='u_int32_t'
19953                 fi
19954         else
19955                 : XXX Maybe we should just give up here.
19956                 db_hashtype=u_int32_t
19957                 $cat try.out >&4
19958                 echo "Help:  I can't seem to compile the db test program." >&4
19959                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19960         fi
19961         $rm_try
19962         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19963         ;;
19964 *)      db_hashtype=u_int32_t
19965         ;;
19966 esac
19967 case "$i_db" in
19968 define)
19969         : Check the return type needed for prefix
19970         echo " "
19971         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19972         cat >try.c <<EOCP
19973 #$d_const HASCONST
19974 #ifndef HASCONST
19975 #define const
19976 #endif
19977 #include <sys/types.h>
19978 #include <db.h>
19979
19980 #ifndef DB_VERSION_MAJOR
19981 size_t prefix_cb (const DBT *key1, const DBT *key2)
19982 {
19983 }
19984 BTREEINFO info;
19985 int main()
19986 {
19987         info.prefix = prefix_cb;
19988 }
19989 #endif
19990 EOCP
19991         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19992                 if $contains warning try.out >>/dev/null 2>&1 ; then
19993                         db_prefixtype='int'
19994                 else
19995                         db_prefixtype='size_t'
19996                 fi
19997         else
19998                 db_prefixtype='size_t'
19999                 : XXX Maybe we should just give up here.
20000                 $cat try.out >&4
20001                 echo "Help:  I can't seem to compile the db test program." >&4
20002                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20003         fi
20004         $rm_try
20005         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20006         ;;
20007 *)      db_prefixtype='size_t'
20008         ;;
20009 esac
20010
20011 : Include . in @INC
20012 $cat <<EOM
20013
20014 Historically Perl has provided a final fallback of the current working
20015 directory '.' when searching for a library. This, however, can lead to
20016 problems when a Perl program which loads optional modules is called from
20017 a shared directory. This can lead to executing unexpected code.
20018
20019 EOM
20020
20021 # When changing to exclude by default:
20022 case "$default_inc_excludes_dot" in
20023     $undef|false|[nN]*) dflt="n" ;;
20024     *)                  dflt="y" ;;
20025 esac
20026 # To turn exclude off by default:
20027 #case "$default_inc_excludes_dot" in
20028 #    $define|true|[yY]*) dflt="y" ;;
20029 #    *)                  dflt="n" ;;
20030 #esac
20031
20032 rp='Exclude '.' from @INC by default? '
20033 . ./myread
20034 case "$ans" in
20035     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20036     *)          default_inc_excludes_dot="$define" ;;
20037 esac
20038
20039 : Check what kind of inf/nan your system has
20040 $echo "Checking the kind of infinities and nans you have..." >&4
20041 $echo "(The following tests may crash.  That's okay.)" >&4
20042 $cat >try.c <<EOP
20043 #define DOUBLESIZE $doublesize
20044 #$d_longdbl HAS_LONG_DOUBLE
20045 #ifdef HAS_LONG_DOUBLE
20046 #define LONG_DOUBLESIZE $longdblsize
20047 #define LONG_DOUBLEKIND $longdblkind
20048 #endif
20049 #include <math.h>
20050 #include <string.h>
20051 #include <stdio.h>
20052 /* Note that whether the sign bit is on or off
20053  * for NaN depends on the CPU/FPU, and possibly
20054  * can be affected by the build toolchain.
20055  *
20056  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20057  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20058  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20059  * (respectively) as opposed to the more usual
20060  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20061  *
20062  * Pre-IEEE-754 floating point format do not even have inf/nan support
20063  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20064  * to even mention, causing immediate SIGFPE or equivalent: this is
20065  * the case with VAX floating point, for example.
20066  */
20067 static void bytes(void *v, unsigned int n) {
20068   unsigned char *p = (unsigned char *)v;
20069   int i;
20070   for (i = 0; i < n; i++) {
20071     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20072   }
20073 }
20074 int main(int argc, char *argv[]) {
20075    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20076     * because some compilers are 'smart' and not only warn but refuse to
20077     * compile such 'illegal' values. */
20078    double dinf = exp(1e9);
20079    double dnan = sqrt(-1.0);
20080 #ifdef HAS_LONG_DOUBLE
20081    long double ldinf = (long double)exp(1e9);
20082    long double ldnan = (long double)sqrt(-1.0);
20083 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20084 /* the 80-bit long doubles might have garbage in their excess bytes */
20085     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20086     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20087 # endif
20088   if (argc == 2) {
20089     switch (argv[1][0]) {
20090     case '1': bytes(&dinf, sizeof(dinf)); break;
20091     case '2': bytes(&dnan, sizeof(dnan)); break;
20092     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20093     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20094 #endif
20095     }
20096   }
20097   return 0;
20098 }
20099 EOP
20100 set try
20101 if eval $compile; then
20102     doubleinfbytes=`$run ./try 1`
20103     doublenanbytes=`$run ./try 2`
20104     case "$d_longdbl" in
20105     $define)
20106       longdblinfbytes=`$run ./try 3`
20107       longdblnanbytes=`$run ./try 4`
20108       ;;
20109     esac
20110 else
20111     # Defaults in case the above test program failed.
20112     case "$doublekind" in
20113     1) # IEEE 754 32-bit LE
20114        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20115        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20116        ;;
20117     2) # IEEE 754 32-bit BE
20118        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20119        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20120        ;;
20121     3) # IEEE 754 64-bit LE
20122        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20123        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20124        ;;
20125     4) # IEEE 754 64-bit BE
20126        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20127        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20128        ;;
20129     5) # IEEE 754 128-bit LE
20130        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20131        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20132        ;;
20133     6) # IEEE 754 128-bit BE
20134        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20135        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20136        ;;
20137     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20138        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20139        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20140        ;;
20141     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20142        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20143        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20144        ;;
20145     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20146        doubleinfbytes=$undef
20147        doublenanbytes=$undef
20148        ;;
20149     *) # No idea.
20150        doubleinfbytes=$undef
20151        doublenanbytes=$undef
20152        ;;
20153     esac
20154     case "$longdblkind" in
20155     1) # IEEE 754 128-bit LE
20156        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20157        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20158        ;;
20159     2) # IEEE 754 128-bit BE
20160        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20161        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20162        ;;
20163     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20164        case "$longdblsize" in
20165        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20166            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20167            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20168            ;;
20169        16) # x86_64
20170            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20171            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20172            ;;
20173        *)  # No idea.
20174            longdblinfbytes=$undef
20175            longdblnanbytes=$undef
20176        ;;
20177        esac
20178        ;;
20179     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20180        case "$longdblsize" in
20181        12) # 32-bit system
20182            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20183            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20184            ;;
20185        16) # 64-bit system
20186            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20187            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20188            ;;
20189        *)  # No idea.
20190            longdblinfbytes=$undef
20191            longdblnanbytes=$undef
20192        ;;
20193        esac
20194        ;;
20195     5) # 128-bit LE-LE "double double"
20196        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20197        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20198        ;;
20199     6) # 128-bit BE-BE "double double"
20200        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20201        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20202        ;;
20203     7) # 128-bit LE-BE "double double"
20204        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20205        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20206        ;;
20207     8) # 128-bit BE-LE "double double"
20208        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20209        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20210        ;;
20211     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20212        longdblinfbytes=$undef
20213        longdblnanbytes=$undef
20214        ;;
20215     *) # No idea.
20216        longdblinfbytes=$undef
20217        longdblnanbytes=$undef
20218        ;;
20219     esac
20220 fi
20221 # In case the program crashed the values are empty, turn them undef.
20222 case "$doubleinfbytes" in
20223 '') doubleinfbytes=$undef ;;
20224 esac
20225 case "$doublenanbytes" in
20226 '') doublenanbytes=$undef ;;
20227 esac
20228 case "$longdblinfbytes" in
20229 '') longdblinfbytes=$undef ;;
20230 esac
20231 case "$longdblnanbytes" in
20232 '') longdblnanbytes=$undef ;;
20233 esac
20234 $rm_try
20235
20236 : Check the length of the double mantissa
20237 $echo "Checking how many mantissa bits your doubles have..." >&4
20238 $cat >try.c <<EOP
20239 #$i_sunmath I_SUNMATH
20240 #include <float.h>
20241 #ifdef I_SUNMATH
20242 # include <sunmath.h>
20243 #endif
20244 #ifdef DBL_MANT_DIG
20245 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20246 #endif
20247 #include <stdio.h>
20248 int main(int argc, char *argv[]) {
20249 #ifdef BITS
20250   printf("%d\n", BITS);
20251 #endif
20252   return 0;
20253 }
20254 EOP
20255 set try
20256 if eval $compile; then
20257     doublemantbits=`$run ./try`
20258 else
20259     doublemantbits="$undef"
20260 fi
20261 $rm_try
20262
20263 : Check the length of the longdouble mantissa
20264 $echo "Checking how many mantissa bits your long doubles have..." >&4
20265 $cat >try.c <<EOP
20266 #$i_sunmath I_SUNMATH
20267 #include <float.h>
20268 #ifdef I_SUNMATH
20269 # include <sunmath.h>
20270 #endif
20271 #$d_longdbl HAS_LONG_DOUBLE
20272 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20273 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20274 /* This format has no implicit bit.  Beware, however, that for
20275  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20276  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20277  * and the top bit must have been one since 387, zero is plain invalid.
20278  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20279 #  define BITS LDBL_MANT_DIG
20280 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20281 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20282  * reason e.g. Irix thinks 107.  But in any case, we want only
20283  * the number of real bits, the implicit bits are of no interest.  */
20284 #  define BITS 2 * (DBL_MANT_DIG - 1)
20285 # else
20286 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20287 # endif
20288 #endif
20289 #include <stdio.h>
20290 int main(int argc, char *argv[]) {
20291 #ifdef BITS
20292   printf("%d\n", BITS);
20293 #endif
20294   return 0;
20295 }
20296 EOP
20297 set try
20298 if eval $compile; then
20299     longdblmantbits=`$run ./try`
20300 else
20301     longdblmantbits="$undef"
20302 fi
20303 $rm_try
20304
20305 : Check the length of the NV mantissa
20306 $echo "Checking how many mantissa bits your NVs have..." >&4
20307 if test "X$usequadmath" = "X$define"; then
20308   nvmantbits=112 # 128-1-15
20309 else
20310   if test "X$nvsize" = "X$doublesize"; then
20311     nvmantbits="$doublemantbits"
20312   else
20313      if test "X$nvsize" = "X$longdblsize"; then
20314        nvmantbits="$longdblmantbits"
20315      else
20316        nvmantbits="$undef"
20317      fi
20318   fi
20319 fi
20320
20321 : How can we generate normalized random numbers ?
20322 echo " "
20323 echo "Using our internal random number implementation..." >&4
20324
20325 case "$ccflags" in
20326 *-Dmy_rand=*|*-Dmy_srand=*)
20327         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20328         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20329         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20330         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20331         ;;
20332 esac
20333
20334 randfunc=Perl_drand48
20335 drand01="Perl_drand48()"
20336 seedfunc="Perl_drand48_init"
20337 randbits=48
20338 randseedtype=U32
20339
20340 : Probe whether dtrace builds an object, as newer Illumos requires an input
20341 : object file that uses at least one of the probes defined in the .d file
20342 case "$usedtrace" in
20343 $define)
20344     case "$dtracexnolibs" in
20345     $define|true|[yY]*)
20346         dtracexnolibs=$define
20347         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20348         ;;
20349     ' '|'')
20350         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20351              dtracexnolibs=$define
20352              echo "Your dtrace accepts -xnolibs"
20353         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20354              dtracexnolibs=$undef
20355              echo "Your dtrace doesn't accept -xnolibs"
20356         else
20357              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20358              exit 1
20359         fi
20360         ;;
20361     *)
20362         dtracexnolibs=$undef
20363         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20364         ;;
20365     esac
20366     case $dtracexnolibs in
20367     $define) xnolibs=-xnolibs ;;
20368     *) xnolibs= ;;
20369     esac
20370
20371     case "$dtraceobject" in
20372     $define|true|[yY]*)
20373         dtraceobject=$define
20374         ;;
20375     ' '|'')
20376         $cat >try.c <<EOM
20377 #include "perldtrace.h"
20378 int main(void) {
20379     PERL_LOADED_FILE("dummy");
20380     return 0;
20381 }
20382 EOM
20383         dtraceobject=$undef
20384         if $cc -c -o try.o $optimize $ccflags try.c \
20385                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20386                 dtraceobject=$define
20387             echo "Your dtrace builds an object file"
20388         fi
20389         ;;
20390     *) dtraceobject=$undef ;;
20391     esac
20392     $rm_try perldtrace.o perldtrace.h
20393 esac
20394
20395 : Determine if this is an EBCDIC system
20396 echo " "
20397 echo "Determining whether or not we are on an EBCDIC system..." >&4
20398 $cat >try.c <<'EOM'
20399 int main()
20400 {
20401   if ('M'==0xd4) return 0;
20402   return 1;
20403 }
20404 EOM
20405
20406 val=$undef
20407 set try
20408 if eval $compile_ok; then
20409         if $run ./try; then
20410                 echo "You seem to speak EBCDIC." >&4
20411                 val="$define"
20412         else
20413                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20414         fi
20415 else
20416         echo "I'm unable to compile the test program." >&4
20417         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20418 fi
20419 $rm_try
20420 set ebcdic
20421 eval $setvar
20422
20423 : Check how to flush
20424 echo " "
20425 $cat >&4 <<EOM
20426 Checking how to flush all pending stdio output...
20427 EOM
20428 # I only know how to find the first 32 possibly open files on SunOS.
20429 # See also hints/sunos_4_1.sh and util.c  --AD
20430 case "$osname" in
20431 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20432 esac
20433 $cat >>try.c <<EOCP
20434 #include <stdio.h>
20435 #$i_stdlib I_STDLIB
20436 #ifdef I_STDLIB
20437 #include <stdlib.h>
20438 #endif
20439 #$i_unistd I_UNISTD
20440 #ifdef I_UNISTD
20441 # include <unistd.h>
20442 #endif
20443 #$d_sysconf HAS_SYSCONF
20444 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20445 #ifdef HAS_STDIO_STREAM_ARRAY
20446 # define STDIO_STREAM_ARRAY $stdio_stream_array
20447 #endif
20448 int main() {
20449   FILE* p;
20450   unlink("try.out");
20451   p = fopen("try.out", "w");
20452 #ifdef TRY_FPUTC
20453   fputc('x', p);
20454 #else
20455 # ifdef TRY_FPRINTF
20456   fprintf(p, "x");
20457 # endif
20458 #endif
20459 #ifdef TRY_FFLUSH_NULL
20460   fflush(NULL);
20461 #endif
20462 #ifdef TRY_FFLUSH_ALL
20463   {
20464     long open_max = -1;
20465 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20466     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20467 # else
20468 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20469     open_max = sysconf(_SC_OPEN_MAX);
20470 #  else
20471 #   ifdef FOPEN_MAX
20472     open_max = FOPEN_MAX;
20473 #   else
20474 #    ifdef OPEN_MAX
20475     open_max = OPEN_MAX;
20476 #    else
20477 #     ifdef _NFILE
20478     open_max = _NFILE;
20479 #     endif
20480 #    endif
20481 #   endif
20482 #  endif
20483 # endif
20484 # ifdef HAS_STDIO_STREAM_ARRAY
20485     if (open_max > 0) {
20486       long i;
20487       for (i = 0; i < open_max; i++)
20488             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20489                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20490                 STDIO_STREAM_ARRAY[i]._flag)
20491                 fflush(&STDIO_STREAM_ARRAY[i]);
20492     }
20493   }
20494 # endif
20495 #endif
20496   _exit(42);
20497 }
20498 EOCP
20499 : first we have to find out how _not_ to flush
20500 $to try.c
20501 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20502     output=''
20503     set try -DTRY_FPUTC
20504     if eval $compile; then
20505             $run ./try 2>/dev/null
20506             code="$?"
20507             $from try.out
20508             if $test ! -s try.out -a "X$code" = X42; then
20509                 output=-DTRY_FPUTC
20510             fi
20511     fi
20512     case "$output" in
20513     '')
20514             set try -DTRY_FPRINTF
20515             if eval $compile; then
20516                     $run ./try 2>/dev/null
20517                     code="$?"
20518                     $from try.out
20519                     if $test ! -s try.out -a "X$code" = X42; then
20520                         output=-DTRY_FPRINTF
20521                     fi
20522             fi
20523         ;;
20524     esac
20525 fi
20526 : check for fflush NULL behavior
20527 case "$fflushNULL" in
20528 '')     set try -DTRY_FFLUSH_NULL $output
20529         if eval $compile; then
20530                 $run ./try 2>/dev/null
20531                 code="$?"
20532                 $from try.out
20533                 if $test -s try.out -a "X$code" = X42; then
20534                         fflushNULL="`$cat try.out`"
20535                 else
20536                         if $test "X$code" != X42; then
20537                                 $cat >&4 <<EOM
20538 (If this test failed, don't worry, we'll try another method shortly.)
20539 EOM
20540                         fi
20541                 fi
20542         fi
20543         $rm -f core try.core core.try.*
20544         case "$fflushNULL" in
20545         x)      $cat >&4 <<EOM
20546 Your fflush(NULL) works okay for output streams.
20547 Let's see if it clobbers input pipes...
20548 EOM
20549 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20550 # bug that improperly flushes the input end of pipes.  So we avoid the
20551 # autoflush on fork/system/exec support for now. :-(
20552 $cat >tryp.c <<EOCP
20553 #include <stdio.h>
20554 int
20555 main(int argc, char **argv)
20556 {
20557     char buf[1024];
20558     int i;
20559     char *bp = buf;
20560     while (1) {
20561         while ((i = getc(stdin)) != -1
20562                && (*bp++ = i) != '\n'
20563                && bp < &buf[1024])
20564         /* DO NOTHING */ ;
20565         *bp = '\0';
20566         fprintf(stdout, "%s", buf);
20567         fflush(NULL);
20568         if (i == -1)
20569             return 0;
20570         bp = buf;
20571     }
20572 }
20573 EOCP
20574                 fflushNULL="$define"
20575                 set tryp
20576                 if eval $compile; then
20577                     $rm -f tryp.out
20578                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20579                     if $test "X$targethost" != X; then
20580                         $to tryp.c
20581                         $to tryp
20582                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20583                     else
20584                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20585                     fi
20586                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20587                        $cat >&4 <<EOM
20588 fflush(NULL) seems to behave okay with input streams.
20589 EOM
20590                         fflushNULL="$define"
20591                     else
20592                         $cat >&4 <<EOM
20593 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20594 EOM
20595                         fflushNULL="$undef"
20596                     fi
20597                 fi
20598                 $rm -f core tryp.c tryp.core core.tryp.*
20599                 ;;
20600         '')     $cat >&4 <<EOM
20601 Your fflush(NULL) isn't working (contrary to ANSI C).
20602 EOM
20603                 fflushNULL="$undef"
20604                 ;;
20605         *)      $cat >&4 <<EOM
20606 Cannot figure out whether your fflush(NULL) works or not.
20607 I'm assuming it doesn't (contrary to ANSI C).
20608 EOM
20609                 fflushNULL="$undef"
20610                 ;;
20611         esac
20612         ;;
20613 $define|true|[yY]*)
20614         fflushNULL="$define"
20615         ;;
20616 *)
20617         fflushNULL="$undef"
20618         ;;
20619 esac
20620 : check explicit looping only if NULL did not work, and if the pipe
20621 : bug does not show up on an explicit flush too
20622 case "$fflushNULL" in
20623 "$undef")
20624         $cat >tryp.c <<EOCP
20625 #include <stdio.h>
20626 int
20627 main(int argc, char **argv)
20628 {
20629     char buf[1024];
20630     int i;
20631     char *bp = buf;
20632     while (1) {
20633         while ((i = getc(stdin)) != -1
20634                && (*bp++ = i) != '\n'
20635                && bp < &buf[1024])
20636         /* DO NOTHING */ ;
20637         *bp = '\0';
20638         fprintf(stdout, "%s", buf);
20639         fflush(stdin);
20640         if (i == -1)
20641             return 0;
20642         bp = buf;
20643     }
20644 }
20645 EOCP
20646         set tryp
20647         if eval $compile; then
20648             $rm -f tryp.out
20649             if $test "X$targethost" != X; then
20650                 $to tryp.c
20651                 $to tryp
20652                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20653             else
20654                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20655             fi
20656             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20657                $cat >&4 <<EOM
20658 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20659 EOM
20660                 : now check for fflushall behaviour
20661                 case "$fflushall" in
20662                 '')     set try -DTRY_FFLUSH_ALL $output
20663                         if eval $compile; then
20664                                 $cat >&4 <<EOM
20665 (Now testing the other method--but note that this also may fail.)
20666 EOM
20667                                 $run ./try 2>/dev/null
20668                                 code=$?
20669                                 $from try.out
20670                                 if $test -s try.out -a "X$code" = X42; then
20671                                         fflushall="`$cat try.out`"
20672                                 fi
20673                         fi
20674                         $rm_try
20675                         case "$fflushall" in
20676                         x)      $cat >&4 <<EOM
20677 Whew. Flushing explicitly all the stdio streams works.
20678 EOM
20679                                 fflushall="$define"
20680                                 ;;
20681                         '')     $cat >&4 <<EOM
20682 Sigh. Flushing explicitly all the stdio streams doesn't work.
20683 EOM
20684                                 fflushall="$undef"
20685                                 ;;
20686                         *)      $cat >&4 <<EOM
20687 Cannot figure out whether flushing stdio streams explicitly works or not.
20688 I'm assuming it doesn't.
20689 EOM
20690                                 fflushall="$undef"
20691                                 ;;
20692                         esac
20693                         ;;
20694                 "$define"|true|[yY]*)
20695                         fflushall="$define"
20696                         ;;
20697                 *)
20698                         fflushall="$undef"
20699                         ;;
20700                 esac
20701             else
20702                 $cat >&4 <<EOM
20703 All is futile.  Even fflush(stdin) clobbers input pipes!
20704 EOM
20705                 fflushall="$undef"
20706             fi
20707         else
20708             fflushall="$undef"
20709         fi
20710         $rm -f core tryp.c tryp.core core.tryp.*
20711         ;;
20712 *)      fflushall="$undef"
20713         ;;
20714 esac
20715
20716 case "$fflushNULL$fflushall" in
20717 undefundef)
20718         $cat <<EOM
20719 OK, I give up.  I cannot figure out how to flush pending stdio output.
20720 We won't be flushing handles at all before fork/exec/popen.
20721 EOM
20722         ;;
20723 esac
20724 $rm_try tryp
20725
20726 : Store the full pathname to the ar program for use in the C program
20727 : Respect a hint or command line value for full_ar.
20728 case "$full_ar" in
20729 '') full_ar=$ar ;;
20730 esac
20731
20732 : Store the full pathname to the sed program for use in the C program
20733 full_sed=$sed
20734
20735 : see what type gids are declared as in the kernel
20736 echo " "
20737 echo "Looking for the type for group ids returned by getgid()."
20738 set gid_t gidtype xxx stdio.h sys/types.h
20739 eval $typedef
20740 case "$gidtype" in
20741 xxx)
20742         xxx=`./findhdr sys/user.h`
20743         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20744         case $1 in
20745         unsigned) dflt="$1 $2" ;;
20746         *) dflt="$1" ;;
20747         esac
20748         ;;
20749 *) dflt="$gidtype";;
20750 esac
20751 case "$gidtype" in
20752 gid_t) echo "gid_t found." ;;
20753 *)      rp="What is the type for group ids returned by getgid()?"
20754         . ./myread
20755         gidtype="$ans"
20756         ;;
20757 esac
20758
20759 : Check the size of GID
20760 echo " "
20761 case "$gidtype" in
20762 *_t) zzz="$gidtype"     ;;
20763 *)   zzz="gid"          ;;
20764 esac
20765 echo "Checking the size of $zzz..." >&4
20766 cat > try.c <<EOCP
20767 #include <sys/types.h>
20768 #include <stdio.h>
20769 #$i_stdlib I_STDLIB
20770 #ifdef I_STDLIB
20771 #include <stdlib.h>
20772 #endif
20773 int main() {
20774     printf("%d\n", (int)sizeof($gidtype));
20775     exit(0);
20776 }
20777 EOCP
20778 set try
20779 if eval $compile_ok; then
20780         yyy=`$run ./try`
20781         case "$yyy" in
20782         '')     gidsize=4
20783                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20784                 ;;
20785         *)      gidsize=$yyy
20786                 echo "Your $zzz is $gidsize bytes long."
20787                 ;;
20788         esac
20789 else
20790         gidsize=4
20791         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20792 fi
20793
20794
20795 : Check if GID is signed
20796 echo " "
20797 case "$gidtype" in
20798 *_t) zzz="$gidtype"     ;;
20799 *)   zzz="gid"          ;;
20800 esac
20801 echo "Checking the sign of $zzz..." >&4
20802 cat > try.c <<EOCP
20803 #include <sys/types.h>
20804 #include <stdio.h>
20805 int main() {
20806         $gidtype foo = -1;
20807         if (foo < 0)
20808                 printf("-1\n");
20809         else
20810                 printf("1\n");
20811 }
20812 EOCP
20813 set try
20814 if eval $compile; then
20815         yyy=`$run ./try`
20816         case "$yyy" in
20817         '')     gidsign=1
20818                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20819                 ;;
20820         *)      gidsign=$yyy
20821                 case "$gidsign" in
20822                  1) echo "Your $zzz is unsigned." ;;
20823                 -1) echo "Your $zzz is signed."   ;;
20824                 esac
20825                 ;;
20826         esac
20827 else
20828         gidsign=1
20829         echo "(I can't compile the test program--guessing unsigned.)" >&4
20830 fi
20831
20832
20833 : Check 64bit sizes
20834 echo " "
20835
20836 if $test X"$quadtype" != X; then
20837
20838 echo "Checking how to print 64-bit integers..." >&4
20839
20840 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20841         $cat >try.c <<'EOCP'
20842 #include <sys/types.h>
20843 #include <stdio.h>
20844 int main() {
20845   int q = 12345678901;
20846   printf("%ld\n", q);
20847 }
20848 EOCP
20849         set try
20850         if eval $compile; then
20851                 yyy=`$run ./try`
20852                 case "$yyy" in
20853                 12345678901)
20854                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20855                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20856                         echo "We will use %d."
20857                         ;;
20858                 esac
20859         fi
20860 fi
20861
20862 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20863         $cat >try.c <<'EOCP'
20864 #include <sys/types.h>
20865 #include <stdio.h>
20866 int main() {
20867   long q = 12345678901;
20868   printf("%ld\n", q);
20869 }
20870 EOCP
20871         set try
20872         if eval $compile; then
20873                 yyy=`$run ./try`
20874                 case "$yyy" in
20875                 12345678901)
20876                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20877                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20878                         echo "We will use %ld."
20879                         ;;
20880                 esac
20881         fi
20882 fi
20883
20884 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20885         $cat >try.c <<'EOCP'
20886 #include <sys/types.h>
20887 #include <inttypes.h>
20888 #include <stdio.h>
20889 int main() {
20890   int64_t q = 12345678901;
20891   printf("%" PRId64 "\n", q);
20892 }
20893 EOCP
20894         set try
20895         if eval $compile; then
20896                 yyy=`$run ./try`
20897                 case "$yyy" in
20898                 12345678901)
20899                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20900                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20901                         echo "We will use the C9X style."
20902                         ;;
20903                 esac
20904         fi
20905 fi
20906
20907 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20908         $cat >try.c <<EOCP
20909 #include <sys/types.h>
20910 #include <stdio.h>
20911 int main() {
20912   $quadtype q = 12345678901;
20913   printf("%Ld\n", q);
20914 }
20915 EOCP
20916         set try
20917         if eval $compile; then
20918                 yyy=`$run ./try`
20919                 case "$yyy" in
20920                 12345678901)
20921                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20922                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20923                         echo "We will use %Ld."
20924                         ;;
20925                 esac
20926         fi
20927 fi
20928
20929 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20930         $cat >try.c <<'EOCP'
20931 #include <sys/types.h>
20932 #include <stdio.h>
20933 int main() {
20934   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20935   printf("%lld\n", q);
20936 }
20937 EOCP
20938         set try
20939         if eval $compile; then
20940                 yyy=`$run ./try`
20941                 case "$yyy" in
20942                 12345678901)
20943                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20944                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20945                         echo "We will use the %lld style."
20946                         ;;
20947                 esac
20948         fi
20949 fi
20950
20951 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20952         $cat >try.c <<EOCP
20953 #include <sys/types.h>
20954 #include <stdio.h>
20955 int main() {
20956   $quadtype q = 12345678901;
20957   printf("%qd\n", q);
20958 }
20959 EOCP
20960         set try
20961         if eval $compile; then
20962                 yyy=`$run ./try`
20963                 case "$yyy" in
20964                 12345678901)
20965                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20966                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20967                         echo "We will use %qd."
20968                         ;;
20969                 esac
20970         fi
20971 fi
20972
20973 if $test X"$sPRId64" = X; then
20974         echo "Cannot figure out how to print 64-bit integers." >&4
20975 fi
20976 $rm_try
20977
20978 fi
20979
20980 case "$sPRId64" in
20981 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20982         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20983         ;;
20984 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20985         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20986         ;;
20987 esac
20988
20989 : Check format strings for internal types
20990 echo " "
20991 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20992
20993 if $test X"$ivsize" = X8; then
20994         ivdformat="$sPRId64"
20995         uvuformat="$sPRIu64"
20996         uvoformat="$sPRIo64"
20997         uvxformat="$sPRIx64"
20998         uvXUformat="$sPRIXU64"
20999 else
21000         if $test X"$ivsize" = X"$longsize"; then
21001                 ivdformat='"ld"'
21002                 uvuformat='"lu"'
21003                 uvoformat='"lo"'
21004                 uvxformat='"lx"'
21005                 uvXUformat='"lX"'
21006         else
21007                 if $test X"$ivsize" = X"$intsize"; then
21008                         ivdformat='"d"'
21009                         uvuformat='"u"'
21010                         uvoformat='"o"'
21011                         uvxformat='"x"'
21012                         uvXUformat='"X"'
21013                 else
21014                         : far out
21015                         if $test X"$ivsize" = X"$shortsize"; then
21016                                 ivdformat='"hd"'
21017                                 uvuformat='"hu"'
21018                                 uvoformat='"ho"'
21019                                 uvxformat='"hx"'
21020                                 uvXUformat='"hX"'
21021                         fi
21022                 fi
21023         fi
21024 fi
21025
21026 if $test X"$usequadmath" = X"$define"; then
21027     nveformat='"Qe"'
21028     nvfformat='"Qf"'
21029     nvgformat='"Qg"'
21030     nvEUformat='"QE"'
21031     nvFUformat='"QF"'
21032     nvGUformat='"QG"'
21033 else
21034     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21035         nveformat="$sPRIeldbl"
21036         nvfformat="$sPRIfldbl"
21037         nvgformat="$sPRIgldbl"
21038         nvEUformat="$sPRIEUldbl"
21039         nvFUformat="$sPRIFUldbl"
21040         nvGUformat="$sPRIGUldbl"
21041     else
21042         nveformat='"e"'
21043         nvfformat='"f"'
21044         nvgformat='"g"'
21045         nvEUformat='"E"'
21046         nvFUformat='"F"'
21047         nvGUformat='"G"'
21048     fi
21049 fi
21050
21051 case "$ivdformat" in
21052 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21053     exit 1
21054     ;;
21055 esac
21056
21057 : Check format string for GID
21058
21059 echo " "
21060 $echo "Checking the format string to be used for gids..." >&4
21061
21062 case "$gidsign" in
21063 -1)     if $test X"$gidsize" = X"$ivsize"; then
21064                 gidformat="$ivdformat"
21065         else
21066                 if $test X"$gidsize" = X"$longsize"; then
21067                         gidformat='"ld"'
21068                 else
21069                         if $test X"$gidsize" = X"$intsize"; then
21070                                 gidformat='"d"'
21071                         else
21072                                 if $test X"$gidsize" = X"$shortsize"; then
21073                                         gidformat='"hd"'
21074                                 fi
21075                         fi
21076                 fi
21077         fi
21078         ;;
21079 *)      if $test X"$gidsize" = X"$uvsize"; then
21080                 gidformat="$uvuformat"
21081         else
21082                 if $test X"$gidsize" = X"$longsize"; then
21083                         gidformat='"lu"'
21084                 else
21085                         if $test X"$gidsize" = X"$intsize"; then
21086                                 gidformat='"u"'
21087                         else
21088                                 if $test X"$gidsize" = X"$shortsize"; then
21089                                         gidformat='"hu"'
21090                                 fi
21091                         fi
21092                 fi
21093         fi
21094         ;;
21095 esac
21096
21097 : see if getgroups exists
21098 set getgroups d_getgrps
21099 eval $inlibc
21100
21101 : see if setgroups exists
21102 set setgroups d_setgrps
21103 eval $inlibc
21104
21105 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21106 echo " "
21107 case "$d_getgrps$d_setgrps" in
21108 *define*)
21109         case "$groupstype" in
21110         '') dflt="$gidtype" ;;
21111         *)  dflt="$groupstype" ;;
21112         esac
21113         $cat <<EOM
21114 What type of pointer is the second argument to getgroups() and setgroups()?
21115 Usually this is the same as group ids, $gidtype, but not always.
21116
21117 EOM
21118         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21119         . ./myread
21120         groupstype="$ans"
21121         ;;
21122 *)  groupstype="$gidtype";;
21123 esac
21124
21125 : check whether make sets MAKE
21126 echo " "
21127 echo "Checking if your $make program sets \$(MAKE)..." >&4
21128 case "$make_set_make" in
21129 '')
21130         $sed 's/^X //' > testmake.mak << 'EOF'
21131 Xall:
21132 X       @echo 'maketemp="$(MAKE)"'
21133 EOF
21134         case "`$make -f testmake.mak 2>/dev/null`" in
21135         *maketemp=*) make_set_make='#' ;;
21136         *)      make_set_make="MAKE=$make" ;;
21137         esac
21138         $rm -f testmake.mak
21139         ;;
21140 esac
21141 case "$make_set_make" in
21142 '#') echo "Yup, it does.";;
21143 *) echo "Nope, it doesn't.";;
21144 esac
21145
21146 : see what type is used for mode_t
21147 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21148 set mode_t modetype int stdio.h sys/types.h
21149 eval $typedef_ask
21150
21151 : see if we need va_copy
21152 echo " "
21153 $cat >try.c <<EOCP
21154 #include <stdarg.h>
21155 #include <stdio.h>
21156 #include <stdlib.h>
21157 #include <signal.h>
21158
21159 int
21160 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21161 {
21162   return vfprintf(f, fmt, *valp);
21163 }
21164
21165 int
21166 myvfprintf(FILE *f, const  char *fmt, va_list val)
21167 {
21168   return ivfprintf(f, fmt, &val);
21169 }
21170
21171 int
21172 myprintf(char *fmt, ...)
21173 {
21174   va_list val;
21175   va_start(val, fmt);
21176   return myvfprintf(stdout, fmt, val);
21177 }
21178
21179 int
21180 main(int ac, char **av)
21181 {
21182   signal(SIGSEGV, exit);
21183
21184   myprintf("%s%cs all right, then\n", "that", '\'');
21185   exit(0);
21186 }
21187 EOCP
21188 set try
21189 if eval $compile && $run ./try 2>&1 >/dev/null; then
21190         case "`$run ./try`" in
21191         "that's all right, then")
21192                 okay=yes
21193                 ;;
21194         esac
21195 fi
21196 case "$okay" in
21197 yes)    echo "It seems that you don't need va_copy()." >&4
21198         need_va_copy="$undef"
21199         ;;
21200 *)      echo "It seems that va_copy() or similar will be needed." >&4
21201         need_va_copy="$define"
21202         ;;
21203 esac
21204 $rm_try
21205
21206 : see what type is used for size_t
21207 rp="What is the type used for the length parameter for string functions?"
21208 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21209 eval $typedef_ask
21210
21211 : check for type of arguments to gethostbyaddr.
21212 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21213         case "$d_gethbyaddr" in
21214         $define)
21215                 $cat <<EOM
21216
21217 Checking to see what type of arguments are accepted by gethostbyaddr().
21218 EOM
21219                 hdrs="$define sys/types.h
21220                         $d_socket sys/socket.h
21221                         $i_niin netinet/in.h
21222                         $i_netdb netdb.h
21223                         $i_unistd unistd.h"
21224                 : The first arg can 'char *' or 'void *'
21225                 : The second arg is some of integral type
21226                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21227                         for yyy in size_t long int; do
21228                                 case "$netdb_host_type" in
21229                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21230                                         if ./protochk "$try" $hdrs; then
21231                                                 echo "Your system accepts $xxx for the first arg."
21232                                                 echo "...and $yyy for the second arg."
21233                                                 netdb_host_type="$xxx"
21234                                                 netdb_hlen_type="$yyy"
21235                                         fi
21236                                         ;;
21237                                 esac
21238                         done
21239                 done
21240                 : In case none of those worked, prompt the user.
21241                 case "$netdb_host_type" in
21242                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21243                         dflt='char *'
21244                         . ./myread
21245                         netdb_host_type=$ans
21246                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21247                         dflt="$sizetype"
21248                         . ./myread
21249                         netdb_hlen_type=$ans
21250                         ;;
21251                 esac
21252                 ;;
21253         *)      : no gethostbyaddr, so pick harmless defaults
21254                 netdb_host_type='char *'
21255                 netdb_hlen_type="$sizetype"
21256                 ;;
21257         esac
21258         # Remove the "const" if needed. -- but then we'll have a
21259         # prototype clash!
21260         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21261 fi
21262
21263 : check for type of argument to gethostbyname.
21264 if test "X$netdb_name_type" = X ; then
21265         case "$d_gethbyname" in
21266         $define)
21267                 $cat <<EOM
21268
21269 Checking to see what type of argument is accepted by gethostbyname().
21270 EOM
21271                 hdrs="$define sys/types.h
21272                         $d_socket sys/socket.h
21273                         $i_niin netinet/in.h
21274                         $i_netdb netdb.h
21275                         $i_unistd unistd.h"
21276                 for xxx in "const char *" "char *"; do
21277                         case "$netdb_name_type" in
21278                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21279                                 if ./protochk "$try" $hdrs; then
21280                                         echo "Your system accepts $xxx."
21281                                         netdb_name_type="$xxx"
21282                                 fi
21283                                 ;;
21284                         esac
21285                 done
21286                 : In case none of those worked, prompt the user.
21287                 case "$netdb_name_type" in
21288                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21289                         dflt='char *'
21290                         . ./myread
21291                         netdb_name_type=$ans
21292                         ;;
21293                 esac
21294                 ;;
21295         *)      : no gethostbyname, so pick harmless default
21296                 netdb_name_type='char *'
21297                 ;;
21298         esac
21299 fi
21300
21301 : check for type of 1st argument to getnetbyaddr.
21302 if test "X$netdb_net_type" = X ; then
21303         case "$d_getnbyaddr" in
21304         $define)
21305                 $cat <<EOM
21306
21307 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21308 EOM
21309                 hdrs="$define sys/types.h
21310                         $d_socket sys/socket.h
21311                         $i_niin netinet/in.h
21312                         $i_netdb netdb.h
21313                         $i_unistd unistd.h"
21314                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21315                         case "$netdb_net_type" in
21316                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21317                                 if ./protochk "$try" $hdrs; then
21318                                         echo "Your system accepts $xxx."
21319                                         netdb_net_type="$xxx"
21320                                 fi
21321                                 ;;
21322                         esac
21323                 done
21324                 : In case none of those worked, prompt the user.
21325                 case "$netdb_net_type" in
21326                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21327                         dflt='long'
21328                         . ./myread
21329                         netdb_net_type=$ans
21330                         ;;
21331                 esac
21332                 ;;
21333         *)      : no getnetbyaddr, so pick harmless default
21334                 netdb_net_type='long'
21335                 ;;
21336         esac
21337 fi
21338 : locate the preferred pager for this system
21339 fn=f/
21340 case "$pager" in
21341 '')
21342         dflt=''
21343         case "$pg" in
21344         /*) dflt=$pg;;
21345         [a-zA-Z]:/*) dflt=$pg;;
21346         esac
21347         case "$more" in
21348         /*) dflt=$more;;
21349         [a-zA-Z]:/*) dflt=$more;;
21350         esac
21351         case "$less" in
21352         /*) dflt=$less;;
21353         [a-zA-Z]:/*) dflt=$less;;
21354         esac
21355         case "$dflt" in
21356         '') dflt=/usr/ucb/more;;
21357         esac
21358         ;;
21359 *)      dflt="$pager"
21360         ;;
21361 esac
21362 fn="f/($dflt)"
21363 echo " "
21364 rp='What pager is used on your system?'
21365 . ./getfile
21366 pager="$ans"
21367
21368 : see if ar generates random libraries by itself
21369 echo " "
21370 echo "Checking how to generate random libraries on your machine..." >&4
21371 echo 'int bar1() { return bar2(); }' > bar1.c
21372 echo 'int bar2() { return 2; }' > bar2.c
21373 $cat > foo.c <<EOP
21374 #$i_stdlib I_STDLIB
21375 #ifdef I_STDLIB
21376 #include <stdlib.h>
21377 #endif
21378 int main() { printf("%d\n", bar1()); exit(0); }
21379 EOP
21380 $cc $ccflags -c bar1.c >/dev/null 2>&1
21381 $cc $ccflags -c bar2.c >/dev/null 2>&1
21382 $cc $ccflags -c foo.c >/dev/null 2>&1
21383 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21384 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21385         $run ./foobar >/dev/null 2>&1; then
21386         echo "$ar appears to generate random libraries itself."
21387         orderlib=false
21388         if [ "X$ranlib" = "X" ]; then
21389             ranlib=":"
21390         fi
21391 elif $ar s bar$_a >/dev/null 2>&1 &&
21392         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21393         $run ./foobar >/dev/null 2>&1; then
21394                 echo "a table of contents needs to be added with '$ar s'."
21395                 orderlib=false
21396                 ranlib="$ar s"
21397 elif $ar ts bar$_a >/dev/null 2>&1 &&
21398         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21399         $run ./foobar >/dev/null 2>&1; then
21400                 echo "a table of contents needs to be added with '$ar ts'."
21401                 orderlib=false
21402                 ranlib="$ar ts"
21403 else
21404         case "$ranlib" in
21405         :) ranlib='';;
21406         '')
21407                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21408                 $test -f $ranlib || ranlib=''
21409                 ;;
21410         esac
21411         if $test -n "$ranlib"; then
21412                 echo "your system has '$ranlib'; we'll use that."
21413                 orderlib=false
21414         else
21415                 echo "your system doesn't seem to support random libraries"
21416                 echo "so we'll use lorder and tsort to order the libraries."
21417                 orderlib=true
21418                 ranlib=":"
21419         fi
21420 fi
21421 $rm -f foo* bar*
21422
21423 : Check the max offset that gmtime and localtime accept
21424 echo "Checking max offsets that gmtime () accepts"
21425
21426 case "$sGMTIME_min/$sGMTIME_max" in
21427     0/0|/)
21428         $cat >try.c <<EOCP
21429 #include <sys/types.h>
21430 #include <stdio.h>
21431 #include <time.h>
21432
21433 int i;
21434 struct tm *tmp;
21435 time_t pt;
21436
21437 void gm_check (time_t t, int min_year, int max_year)
21438 {
21439     tmp = gmtime (&t);
21440     if ( tmp == NULL ||
21441         /* Check tm_year overflow */
21442          tmp->tm_year < min_year || tmp->tm_year > max_year)
21443         tmp = NULL;
21444     else
21445         pt = t;
21446     } /* gm_check */
21447
21448 int check_max ()
21449 {
21450     tmp = NULL;
21451     pt  = 0;
21452 #ifdef MAXLONG
21453     gm_check (MAXLONG, 69, 0x7fffffff);
21454 #endif
21455     if (tmp == NULL || tmp->tm_year < 0) {
21456         for (i = 63; i >= 0; i--) {
21457             time_t x = pt | ((time_t)1 << i);
21458             if (x < 0 || x < pt) continue;
21459             gm_check (x, 69, 0x7fffffff);
21460             }
21461         }
21462     printf ("sGMTIME_max=%ld\n", pt);
21463     return (0);
21464     } /* check_max */
21465
21466 int check_min ()
21467 {
21468     tmp = NULL;
21469     pt  = 0;
21470 #ifdef MINLONG
21471     gm_check (MINLONG, -1900, 70);
21472 #endif
21473     if (tmp == NULL) {
21474         for (i = 36; i >= 0; i--) {
21475             time_t x = pt - ((time_t)1 << i);
21476             if (x > 0) continue;
21477             gm_check (x, -1900, 70);
21478             }
21479         }
21480     printf ("sGMTIME_min=%ld\n", pt);
21481     return (0);
21482     } /* check_min */
21483
21484 int main (int argc, char *argv[])
21485 {
21486     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21487     check_max ();
21488     check_min ();
21489     return (0);
21490     } /* main */
21491 EOCP
21492         set try
21493         if eval $compile; then
21494             eval `$run ./try 2>/dev/null`
21495         else
21496             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21497             fi
21498         $rm_try
21499         ;;
21500     esac
21501
21502 echo "Checking max offsets that localtime () accepts"
21503
21504 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21505     0/0|/)
21506         $cat >try.c <<EOCP
21507 #include <sys/types.h>
21508 #include <stdio.h>
21509 #include <time.h>
21510
21511 int i;
21512 struct tm *tmp;
21513 time_t pt;
21514
21515 void local_check (time_t t, int min_year, int max_year)
21516 {
21517     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21518         tmp = NULL;
21519     else
21520         tmp = localtime (&t);
21521     if ( tmp == NULL ||
21522         /* Check tm_year overflow */
21523          tmp->tm_year < min_year || tmp->tm_year > max_year)
21524         tmp = NULL;
21525     else
21526         pt = t;
21527     } /* local_check */
21528
21529 int check_max ()
21530 {
21531     tmp = NULL;
21532     pt  = 0;
21533 #ifdef MAXLONG
21534     local_check (MAXLONG, 69, 0x7fffffff);
21535 #endif
21536     if (tmp == NULL || tmp->tm_year < 0) {
21537         for (i = 63; i >= 0; i--) {
21538             time_t x = pt | ((time_t)1 << i);
21539             if (x < 0 || x < pt) continue;
21540             local_check (x, 69, 0x7fffffff);
21541             }
21542         }
21543     printf ("sLOCALTIME_max=%ld\n", pt);
21544     return (0);
21545    } /* check_max */
21546
21547 int check_min ()
21548 {
21549     tmp = NULL;
21550     pt  = 0;
21551 #ifdef MINLONG
21552     local_check (MINLONG, -1900, 70);
21553 #endif
21554     if (tmp == NULL) {
21555         for (i = 36; i >= 0; i--) {
21556             time_t x = pt - ((time_t)1 << i);
21557             if (x > 0) continue;
21558             local_check (x, -1900, 70);
21559             }
21560         }
21561     printf ("sLOCALTIME_min=%ld\n", pt);
21562     return (0);
21563     } /* check_min */
21564
21565 int main (int argc, char *argv[])
21566 {
21567     check_max ();
21568     check_min ();
21569     return (0);
21570     } /* main */
21571 EOCP
21572         set try
21573         if eval $compile; then
21574             eval `$run ./try 2>/dev/null`
21575         else
21576             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21577             fi
21578         $rm_try
21579         ;;
21580     esac
21581
21582 : check for type of arguments to select.
21583 case "$selecttype" in
21584 '') case "$d_select" in
21585         $define)
21586                 echo " "
21587                 $cat <<EOM
21588 Checking to see what type of arguments are accepted by select().
21589 EOM
21590                 hdrs="$define sys/types.h
21591                         $i_systime sys/time.h
21592                         $i_sysselct sys/select.h
21593                         $d_socket sys/socket.h"
21594                 : The first arg can be int, unsigned, or size_t
21595                 : The last arg may or may not be 'const'
21596                 val=''
21597                 : void pointer has been seen but using that
21598                 : breaks the selectminbits test
21599                 for xxx in 'fd_set *' 'int *'; do
21600                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21601                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21602                                         case "$val" in
21603                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21604                                                 if ./protochk "$try" $hdrs; then
21605                                                         echo "Your system accepts $xxx."
21606                                                         val="$xxx"
21607                                                 fi
21608                                                 ;;
21609                                         esac
21610                                 done
21611                         done
21612                 done
21613                 case "$val" in
21614                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21615                         case "$d_fd_set" in
21616                                 $define) dflt="fd_set *" ;;
21617                                 *)              dflt="int *" ;;
21618                         esac
21619                         . ./myread
21620                         val=$ans
21621                         ;;
21622                 esac
21623                 selecttype="$val"
21624                 ;;
21625         *)      : no select, so pick a harmless default
21626                 selecttype='int *'
21627                 ;;
21628         esac
21629         ;;
21630 esac
21631
21632 : check for the select 'width'
21633 case "$selectminbits" in
21634 '') safebits=`expr $ptrsize \* 8`
21635     case "$d_select" in
21636         $define)
21637                 $cat <<EOM
21638
21639 Checking to see on how many bits at a time your select() operates...
21640 EOM
21641                 $cat >try.c <<EOCP
21642 #include <sys/types.h>
21643 #$i_time I_TIME
21644 #$i_systime I_SYS_TIME
21645 #$i_systimek I_SYS_TIME_KERNEL
21646 #ifdef I_TIME
21647 #   include <time.h>
21648 #endif
21649 #ifdef I_SYS_TIME
21650 #   ifdef I_SYS_TIME_KERNEL
21651 #       define KERNEL
21652 #   endif
21653 #   include <sys/time.h>
21654 #   ifdef I_SYS_TIME_KERNEL
21655 #       undef KERNEL
21656 #   endif
21657 #endif
21658 #$i_sysselct I_SYS_SELECT
21659 #ifdef I_SYS_SELECT
21660 #include <sys/select.h>
21661 #endif
21662 #$d_socket HAS_SOCKET
21663 #ifdef HAS_SOCKET
21664 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21665 #endif
21666 #include <stdio.h>
21667 #$i_stdlib I_STDLIB
21668 #ifdef I_STDLIB
21669 #include <stdlib.h>
21670 #endif
21671 $selecttype b;
21672 #define S sizeof(*(b))
21673 #define MINBITS 64
21674 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21675 #define NBITS  (NBYTES * 8)
21676 int main() {
21677     char *s = (char *)malloc(NBYTES);
21678     struct timeval t;
21679     int i;
21680     FILE* fp;
21681     int fd;
21682
21683     if (!s)
21684         exit(1);
21685     fclose(stdin);
21686     fp = fopen("try.c", "r");
21687     if (fp == 0)
21688       exit(2);
21689     fd = fileno(fp);
21690     if (fd < 0)
21691       exit(3);
21692     b = ($selecttype)s;
21693     for (i = 0; i < NBITS; i++)
21694         FD_SET(i, b);
21695     t.tv_sec  = 0;
21696     t.tv_usec = 0;
21697     select(fd + 1, b, 0, 0, &t);
21698     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21699     free(s);
21700     printf("%d\n", i + 1);
21701     return 0;
21702 }
21703 EOCP
21704                 set try
21705                 if eval $compile_ok; then
21706                         selectminbits=`$run ./try 2>/dev/null`
21707                         case "$selectminbits" in
21708                         '')     cat >&4 <<EOM
21709 Cannot figure out on how many bits at a time your select() operates.
21710 I'll play safe and guess it is $safebits bits.
21711 EOM
21712                                 selectminbits=$safebits
21713                                 bits="$safebits bits"
21714                                 ;;
21715                         1)      bits="1 bit" ;;
21716                         *)      bits="$selectminbits bits" ;;
21717                         esac
21718                         echo "Your select() operates on $bits at a time." >&4
21719                 else
21720                         rp='What is the minimum number of bits your select() operates on?'
21721                         case "$byteorder" in
21722                         12345678)       dflt=64 ;;
21723                         1234)           dflt=32 ;;
21724                         *)              dflt=1  ;;
21725                         esac
21726                         . ./myread
21727                         val=$ans
21728                         selectminbits="$val"
21729                 fi
21730                 $rm_try
21731                 ;;
21732         *)      : no select, so pick a harmless default
21733                 selectminbits=$safebits
21734                 ;;
21735         esac
21736         ;;
21737 esac
21738
21739 : Trace out the files included by signal.h, then look for SIGxxx names.
21740 case "$sig_num_init" in
21741 '')
21742 if [ "X$fieldn" = X ]; then
21743         : Just make some guesses.  We check them later.
21744         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21745 else
21746         xxx=`echo '#include <signal.h>' |
21747         $cppstdin $cppminus $cppflags 2>/dev/null |
21748         $grep '^[       ]*#.*include' |
21749         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21750                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21751 fi
21752 xxxfiles=''
21753 for xx in $xxx /dev/null ; do
21754         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21755 done
21756 case "$xxxfiles" in
21757 '')     xxxfiles=`./findhdr signal.h` ;;
21758 esac
21759 xxx=`awk '
21760 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21761         print substr($2, 4, 20)
21762 }
21763 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21764         print substr($3, 4, 20)
21765 }' $xxxfiles`
21766 : Append some common names just in case the awk scan failed.
21767 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21768 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21769 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21770 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21771 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21772
21773 : generate a few handy files for later
21774 $cat > signal.c <<EOCP
21775 #include <sys/types.h>
21776 #include <signal.h>
21777 #$i_stdlib I_STDLIB
21778 #ifdef I_STDLIB
21779 #include <stdlib.h>
21780 #endif
21781 #include <stdio.h>
21782 int main() {
21783
21784 /* Strange style to avoid deeply-nested #if/#else/#endif */
21785 #ifndef NSIG
21786 #  ifdef _NSIG
21787 #    define NSIG (_NSIG)
21788 #  endif
21789 #endif
21790
21791 #ifndef NSIG
21792 #  ifdef SIGMAX
21793 #    define NSIG (SIGMAX+1)
21794 #  endif
21795 #endif
21796
21797 #ifndef NSIG
21798 #  ifdef SIG_MAX
21799 #    define NSIG (SIG_MAX+1)
21800 #  endif
21801 #endif
21802
21803 #ifndef NSIG
21804 #  ifdef _SIG_MAX
21805 #    define NSIG (_SIG_MAX+1)
21806 #  endif
21807 #endif
21808
21809 #ifndef NSIG
21810 #  ifdef MAXSIG
21811 #    define NSIG (MAXSIG+1)
21812 #  endif
21813 #endif
21814
21815 #ifndef NSIG
21816 #  ifdef MAX_SIG
21817 #    define NSIG (MAX_SIG+1)
21818 #  endif
21819 #endif
21820
21821 #ifndef NSIG
21822 #  ifdef SIGARRAYSIZE
21823 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21824 #  endif
21825 #endif
21826
21827 #ifndef NSIG
21828 #  ifdef _sys_nsig
21829 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21830 #  endif
21831 #endif
21832
21833 /* Default to some arbitrary number that's big enough to get most
21834    of the common signals.
21835 */
21836 #ifndef NSIG
21837 #    define NSIG 50
21838 #endif
21839
21840 printf("NSIG %d\n", NSIG);
21841
21842 #ifndef JUST_NSIG
21843
21844 EOCP
21845
21846 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21847 {
21848         printf "#ifdef SIG"; printf $1; printf "\n"
21849         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21850         printf $1; printf ");\n"
21851         printf "#endif\n"
21852 }
21853 END {
21854         printf "#endif /* JUST_NSIG */\n";
21855         printf "exit(0);\n}\n";
21856 }
21857 ' >>signal.c
21858 $cat >signal.awk <<'EOP'
21859 BEGIN { ndups = 0 }
21860 $1 ~ /^NSIG$/ { nsig = $2 }
21861 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21862     if ($2 > maxsig) { maxsig = $2 }
21863     if (sig_name[$2]) {
21864         dup_name[ndups] = $1
21865         dup_num[ndups] = $2
21866         ndups++
21867     }
21868     else {
21869         sig_name[$2] = $1
21870         sig_num[$2] = $2
21871     }
21872 }
21873 END {
21874     if (nsig == 0) {
21875         nsig = maxsig + 1
21876     }
21877     printf("NSIG %d\n", nsig);
21878     for (n = 1; n < nsig; n++) {
21879         if (sig_name[n]) {
21880             printf("%s %d\n", sig_name[n], sig_num[n])
21881         }
21882         else {
21883             printf("NUM%d %d\n", n, n)
21884         }
21885     }
21886     for (n = 0; n < ndups; n++) {
21887         printf("%s %d\n", dup_name[n], dup_num[n])
21888     }
21889 }
21890 EOP
21891 $cat >signal_cmd <<EOS
21892 $startsh
21893 if $test -s signal.lst; then
21894     echo "Using your existing signal.lst file"
21895         exit 0
21896 fi
21897 xxx="$xxx"
21898 EOS
21899 $cat >>signal_cmd <<'EOS'
21900
21901 set signal
21902 if eval $compile_ok; then
21903         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21904                 $uniq | $awk -f signal.awk >signal.lst
21905 else
21906         echo "(I can't seem be able to compile the whole test program)" >&4
21907         echo "(I'll try it in little pieces.)" >&4
21908         set signal -DJUST_NSIG
21909         if eval $compile_ok; then
21910                 $run ./signal$_exe > signal.nsg
21911                 $cat signal.nsg
21912         else
21913                 echo "I can't seem to figure out how many signals you have." >&4
21914                 echo "Guessing 50." >&4
21915                 echo 'NSIG 50' > signal.nsg
21916         fi
21917         : Now look at all the signal names, one at a time.
21918         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21919                 $cat > signal.c <<EOCP
21920 #include <sys/types.h>
21921 #include <signal.h>
21922 #include <stdio.h>
21923 int main() {
21924 printf("$xx %d\n", SIG${xx});
21925 return 0;
21926 }
21927 EOCP
21928                 set signal
21929                 if eval $compile; then
21930                         echo "SIG${xx} found."
21931                         $run ./signal$_exe  >> signal.ls1
21932                 else
21933                         echo "SIG${xx} NOT found."
21934                 fi
21935         done
21936         if $test -s signal.ls1; then
21937                 $cat signal.nsg signal.ls1 |
21938                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21939         fi
21940
21941 fi
21942 if $test -s signal.lst; then
21943         :
21944 else
21945         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21946         echo 'kill -l' >signal
21947         set X `csh -f <signal`
21948         $rm -f signal
21949         shift
21950         case $# in
21951         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21952         esac
21953         echo $@ | $tr ' ' $trnl | \
21954             $awk '{ printf "%s %d\n", $1, ++s; }
21955                   END { printf "NSIG %d\n", ++s }' >signal.lst
21956 fi
21957 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21958 EOS
21959 chmod a+x signal_cmd
21960 $eunicefix signal_cmd
21961 ;;
21962 esac
21963
21964 : generate list of signal names
21965 case "$sig_num_init" in
21966 '')
21967 echo " "
21968 case "$sig_name_init" in
21969 '') doinit=yes ;;
21970 *)  case "$sig_num_init" in
21971     ''|*,*) doinit=yes ;;
21972     esac ;;
21973 esac
21974 case "$doinit" in
21975 yes)
21976         echo "Generating a list of signal names and numbers..." >&4
21977         . ./signal_cmd
21978         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21979         sig_name=`$awk 'BEGIN { printf "ZERO " }
21980                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21981         sig_num=`$awk  'BEGIN { printf "0 " }
21982                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21983         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21984                              !/^NSIG/   { printf "\"%s\", ", $1 }
21985                              END        { printf "0\n" }' signal.lst`
21986         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21987                              !/^NSIG/   { printf "%d, ", $2}
21988                              END        { printf "0\n"}' signal.lst`
21989         ;;
21990 esac
21991 echo "The following $sig_count signals are available:"
21992 echo " "
21993 echo $sig_name | $awk \
21994 'BEGIN { linelen = 0 }
21995 {
21996         for (i = 1; i <= NF; i++) {
21997                 name = "SIG" $i " "
21998                 linelen = linelen + length(name)
21999                 if (linelen > 70) {
22000                         printf "\n"
22001                         linelen = length(name)
22002                 }
22003                 printf "%s", name
22004         }
22005         printf "\n"
22006 }'
22007 sig_size=`echo $sig_name | awk '{print NF}'`
22008 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22009 ;;
22010 esac
22011
22012 : Check size of size
22013 echo " "
22014 case "$sizetype" in
22015 *_t) zzz="$sizetype"    ;;
22016 *)   zzz="filesize"     ;;
22017 esac
22018 echo "Checking the size of $zzz..." >&4
22019 cat > try.c <<EOCP
22020 #include <sys/types.h>
22021 #include <stdio.h>
22022 #$i_stdlib I_STDLIB
22023 #ifdef I_STDLIB
22024 #include <stdlib.h>
22025 #endif
22026 int main() {
22027     printf("%d\n", (int)sizeof($sizetype));
22028     exit(0);
22029 }
22030 EOCP
22031 set try
22032 if eval $compile_ok; then
22033         yyy=`$run ./try`
22034         case "$yyy" in
22035         '')     sizesize=4
22036                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22037                 ;;
22038         *)      sizesize=$yyy
22039                 echo "Your $zzz size is $sizesize bytes."
22040                 ;;
22041         esac
22042 else
22043         sizesize=4
22044         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22045 fi
22046
22047
22048 : check for socklen_t
22049 echo " "
22050 echo "Checking to see if you have socklen_t..." >&4
22051 $cat >try.c <<EOCP
22052 #include <sys/types.h>
22053 #$d_socket HAS_SOCKET
22054 #ifdef HAS_SOCKET
22055 #include <sys/socket.h>
22056 #endif
22057 int main() { socklen_t x = 16; }
22058 EOCP
22059 set try
22060 if eval $compile; then
22061         val="$define"
22062         echo "You have socklen_t."
22063 else
22064         val="$undef"
22065         echo "You do not have socklen_t."
22066         case "$sizetype" in
22067         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22068         esac
22069 fi
22070 $rm_try
22071 set d_socklen_t
22072 eval $setvar
22073
22074 : see if this is a socks.h system
22075 set socks.h i_socks
22076 eval $inhdr
22077
22078 : check for type of the size argument to socket calls
22079 case "$d_socket" in
22080 "$define")
22081         $cat <<EOM
22082
22083 Checking to see what type is the last argument of accept().
22084 EOM
22085         yyy=''
22086         case "$d_socklen_t" in
22087         "$define") yyy="$yyy socklen_t"
22088         esac
22089         yyy="$yyy $sizetype int long unsigned"
22090         for xxx in $yyy; do
22091                 case "$socksizetype" in
22092                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22093                         case "$usesocks" in
22094                         "$define")
22095                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22096                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22097                                         socksizetype="$xxx"
22098                                 fi
22099                                 ;;
22100                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22101                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22102                                         socksizetype="$xxx"
22103                                 fi
22104                                 ;;
22105                         esac
22106                         ;;
22107                 esac
22108         done
22109 : In case none of those worked, prompt the user.
22110         case "$socksizetype" in
22111         '')     rp='What is the type for socket address structure sizes?'
22112                 dflt='int'
22113                 . ./myread
22114                 socksizetype=$ans
22115                 ;;
22116         esac
22117         ;;
22118 *)      : no sockets, so pick relatively harmless default
22119         socksizetype='int'
22120         ;;
22121 esac
22122
22123 : see what type is used for signed size_t
22124 set ssize_t ssizetype int stdio.h sys/types.h
22125 eval $typedef
22126 dflt="$ssizetype"
22127 $cat > try.c <<EOM
22128 #include <stdio.h>
22129 #$i_stdlib I_STDLIB
22130 #ifdef I_STDLIB
22131 #include <stdlib.h>
22132 #endif
22133 #include <sys/types.h>
22134 #define Size_t $sizetype
22135 #define SSize_t $dflt
22136 int main()
22137 {
22138         if (sizeof(Size_t) == sizeof(SSize_t))
22139                 printf("$dflt\n");
22140         else if (sizeof(Size_t) == sizeof(int))
22141                 printf("int\n");
22142         else
22143                 printf("long\n");
22144         exit(0);
22145 }
22146 EOM
22147 echo " "
22148 set try
22149 if eval $compile_ok && $run ./try > /dev/null; then
22150         ssizetype=`$run ./try`
22151         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22152 else
22153         $cat >&4 <<EOM
22154 Help! I can't compile and run the ssize_t test program: please enlighten me!
22155 (This is probably a misconfiguration in your system or libraries, and
22156 you really ought to fix it.  Still, I'll try anyway.)
22157
22158 I need a type that is the same size as $sizetype, but is guaranteed to
22159 be signed.  Common values are ssize_t, int and long.
22160
22161 EOM
22162         rp="What signed type is the same size as $sizetype?"
22163         . ./myread
22164         ssizetype="$ans"
22165 fi
22166 $rm_try
22167
22168 : Check the size of st_ino
22169 $echo " "
22170 $echo "Checking the size of st_ino..." >&4
22171 $cat > try.c <<EOCP
22172 #include <sys/stat.h>
22173 #include <stdio.h>
22174 #$i_stdlib I_STDLIB
22175 #ifdef I_STDLIB
22176 #include <stdlib.h>
22177 #endif
22178 int main() {
22179     struct stat st;
22180     printf("%d\n", (int)sizeof(st.st_ino));
22181     exit(0);
22182 }
22183 EOCP
22184 set try
22185 if eval $compile_ok; then
22186         val=`$run ./try`
22187         case "$val" in
22188         '')     st_ino_size=4
22189                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22190                 ;;
22191         *)      st_ino_size=$val
22192                 $echo "Your st_ino is $st_ino_size bytes long."
22193                 ;;
22194         esac
22195 else
22196         st_ino_size=4
22197         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22198 fi
22199 $rm_try
22200
22201 : Check if st_ino is signed
22202 $echo " "
22203 $echo "Checking the sign of st_ino..." >&4
22204 $cat > try.c <<EOCP
22205 #include <sys/stat.h>
22206 #include <stdio.h>
22207 int main() {
22208         struct stat foo;
22209         foo.st_ino = -1;
22210         if (foo.st_ino < 0)
22211                 printf("-1\n");
22212         else
22213                 printf("1\n");
22214 }
22215 EOCP
22216 set try
22217 if eval $compile; then
22218         val=`$run ./try`
22219         case "$val" in
22220         '')     st_ino_sign=1
22221                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22222                 ;;
22223         *)      st_ino_sign=$val
22224                 case "$st_ino_sign" in
22225                  1) $echo "Your st_ino is unsigned." ;;
22226                 -1) $echo "Your st_ino is signed."   ;;
22227                 esac
22228                 ;;
22229         esac
22230 else
22231         st_ino_sign=1
22232         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22233 fi
22234 $rm_try
22235
22236 : see what type of char stdio uses.
22237 echo " "
22238 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22239 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22240         echo "Your stdio uses unsigned chars." >&4
22241         stdchar="unsigned char"
22242 else
22243         echo "Your stdio uses signed chars." >&4
22244         stdchar="char"
22245 fi
22246 $rm -f stdioh
22247
22248 : Check size of UID
22249 echo " "
22250 case "$uidtype" in
22251 *_t) zzz="$uidtype"     ;;
22252 *)   zzz="uid"          ;;
22253 esac
22254 echo "Checking the size of $zzz..." >&4
22255 cat > try.c <<EOCP
22256 #include <sys/types.h>
22257 #include <stdio.h>
22258 #$i_stdlib I_STDLIB
22259 #ifdef I_STDLIB
22260 #include <stdlib.h>
22261 #endif
22262 int main() {
22263     printf("%d\n", (int)sizeof($uidtype));
22264     exit(0);
22265 }
22266 EOCP
22267 set try
22268 if eval $compile_ok; then
22269         yyy=`$run ./try`
22270         case "$yyy" in
22271         '')     uidsize=4
22272                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22273                 ;;
22274         *)      uidsize=$yyy
22275                 echo "Your $zzz is $uidsize bytes long."
22276                 ;;
22277         esac
22278 else
22279         uidsize=4
22280         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22281 fi
22282
22283 : Check if UID is signed
22284 echo " "
22285 case "$uidtype" in
22286 *_t) zzz="$uidtype"     ;;
22287 *)   zzz="uid"          ;;
22288 esac
22289 echo "Checking the sign of $zzz..." >&4
22290 cat > try.c <<EOCP
22291 #include <sys/types.h>
22292 #include <stdio.h>
22293 int main() {
22294         $uidtype foo = -1;
22295         if (foo < 0)
22296                 printf("-1\n");
22297         else
22298                 printf("1\n");
22299 }
22300 EOCP
22301 set try
22302 if eval $compile; then
22303         yyy=`$run ./try`
22304         case "$yyy" in
22305         '')     uidsign=1
22306                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22307                 ;;
22308         *)      uidsign=$yyy
22309                 case "$uidsign" in
22310                  1) echo "Your $zzz is unsigned." ;;
22311                 -1) echo "Your $zzz is signed."   ;;
22312                 esac
22313                 ;;
22314         esac
22315 else
22316         uidsign=1
22317         echo "(I can't compile the test program--guessing unsigned.)" >&4
22318 fi
22319
22320
22321 : Check format string for UID
22322 echo " "
22323 $echo "Checking the format string to be used for uids..." >&4
22324
22325 case "$uidsign" in
22326 -1)     if $test X"$uidsize" = X"$ivsize"; then
22327                 uidformat="$ivdformat"
22328         else
22329                 if $test X"$uidsize" = X"$longsize"; then
22330                         uidformat='"ld"'
22331                 else
22332                         if $test X"$uidsize" = X"$intsize"; then
22333                                 uidformat='"d"'
22334                         else
22335                                 if $test X"$uidsize" = X"$shortsize"; then
22336                                         uidformat='"hd"'
22337                                 fi
22338                         fi
22339                 fi
22340         fi
22341         ;;
22342 *)      if $test X"$uidsize" = X"$uvsize"; then
22343                 uidformat="$uvuformat"
22344         else
22345                 if $test X"$uidsize" = X"$longsize"; then
22346                         uidformat='"lu"'
22347                 else
22348                         if $test X"$uidsize" = X"$intsize"; then
22349                                 uidformat='"u"'
22350                         else
22351                                 if $test X"$uidsize" = X"$shortsize"; then
22352                                         uidformat='"hu"'
22353                                 fi
22354                         fi
22355                 fi
22356         fi
22357         ;;
22358 esac
22359
22360 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22361 echo " "
22362 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22363 $cat >try.c <<'EOM'
22364 /* Intentionally a long probe as I'd like to sanity check that the exact
22365    approach is going to work, as thinking it will work, but only having it
22366    part working at runtime is worse than not having it.  */
22367
22368 #include <sys/types.h>
22369 #include <sys/sysctl.h>
22370 #include <sys/param.h>
22371 #include <stdio.h>
22372 #include <string.h>
22373 #include <stdlib.h>
22374 #include <unistd.h>
22375
22376 int
22377 main(int argc, char **argv) {
22378     char *buffer;
22379     char *argv_leaf = strrchr(argv[0], '/');
22380     char *buffer_leaf;
22381     size_t size = 0;
22382     int mib[4];
22383
22384     mib[0] = CTL_KERN;
22385     mib[1] = KERN_PROC;
22386     mib[2] = KERN_PROC_PATHNAME;
22387     mib[3] = -1;
22388
22389     if (!argv_leaf) {
22390         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22391         return 1;
22392     }
22393
22394     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22395         perror("sysctl");
22396         return 2;
22397     }
22398
22399     if (size < strlen(argv_leaf) + 1) {
22400         fprintf(stderr, "size %lu is too short for a path\n",
22401                 (unsigned long) size);
22402         return 3;
22403     }
22404
22405     if (size > MAXPATHLEN * MAXPATHLEN) {
22406         fprintf(stderr, "size %lu is too long for a path\n",
22407                 (unsigned long) size);
22408         return 4;
22409     }
22410
22411     buffer = (char *)malloc(size);
22412     if (!buffer) {
22413         perror("malloc");
22414         return 5;
22415     }
22416
22417     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22418         perror("sysctl");
22419         return 6;
22420     }
22421
22422     if (strlen(buffer) + 1 != size) {
22423         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22424                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22425         return 7;
22426     }
22427
22428
22429     if (*buffer != '/') {
22430         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22431         return 8;
22432     }
22433
22434     if (strstr(buffer, "/./")) {
22435         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22436         return 9;
22437     }
22438
22439     if (strstr(buffer, "/../")) {
22440         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22441         return 10;
22442     }
22443
22444     buffer_leaf = strrchr(buffer, '/');
22445     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22446         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22447         return 11;
22448     }
22449
22450     free(buffer);
22451
22452     return 0;
22453 }
22454 EOM
22455
22456 val=$undef
22457 set try
22458 if eval $compile; then
22459         if $run ./try; then
22460                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22461                 val="$define"
22462         else
22463                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22464                 val="$undef"
22465         fi
22466 else
22467         echo "I'm unable to compile the test program." >&4
22468         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22469         val="$undef"
22470 fi
22471 $rm_try
22472 set usekernprocpathname
22473 eval $setvar
22474
22475 : Determine if we can use _NSGetExecutablePath to find executing program
22476 echo " "
22477 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22478 $cat >try.c <<'EOM'
22479 /* Intentionally a long probe as I'd like to sanity check that the exact
22480    approach is going to work, as thinking it will work, but only having it
22481    part working at runtime is worse than not having it.  */
22482 #include <mach-o/dyld.h>
22483 #include <stdio.h>
22484 #include <stdlib.h>
22485 #include <sys/param.h>
22486 #include <string.h>
22487
22488 int
22489 main(int argc, char **argv) {
22490     char buf[1];
22491     uint32_t size = sizeof(buf);
22492     int result;
22493     char *buffer;
22494     char *tidied;
22495     char *argv_leaf = strrchr(argv[0], '/');
22496     char *tidied_leaf;
22497
22498     if (!argv_leaf) {
22499         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22500         return 1;
22501     }
22502
22503     _NSGetExecutablePath(buf, &size);
22504     if (size > MAXPATHLEN * MAXPATHLEN) {
22505         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22506                 (unsigned int) size);
22507         return 2;
22508     }
22509
22510     buffer = (char *)malloc(size);
22511     if (!buffer) {
22512         perror("malloc");
22513         return 3;
22514     }
22515
22516     result = _NSGetExecutablePath(buffer, &size);
22517     if (result != 0) {
22518         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22519                 result, (unsigned int) size);
22520         return 4;
22521     }
22522
22523     tidied = realpath(buffer, NULL);
22524     if (!tidied) {
22525         perror("realpath");
22526         return 5;
22527     }
22528
22529     free(buffer);
22530
22531     if (*tidied != '/') {
22532         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22533         return 6;
22534     }
22535
22536     if (strstr(tidied, "/./")) {
22537         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22538         return 7;
22539     }
22540
22541     if (strstr(tidied, "/../")) {
22542         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22543         return 8;
22544     }
22545
22546     tidied_leaf = strrchr(tidied, '/');
22547     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22548         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22549         return 9;
22550     }
22551
22552     free(tidied);
22553
22554     return 0;
22555 }
22556 EOM
22557
22558 val=$undef
22559 set try
22560 if eval $compile; then
22561         if $run ./try; then
22562                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22563                 val="$define"
22564         else
22565                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22566         fi
22567 else
22568         echo "I'm unable to compile the test program." >&4
22569         echo "I'll assume no _NSGetExecutablePath here." >&4
22570 fi
22571 $rm_try
22572 set usensgetexecutablepath
22573 eval $setvar
22574
22575 : Check if site customization support was requested
22576 case "$usesitecustomize" in
22577     $define|true|[Yy]*)
22578         usesitecustomize="$define"
22579         ;;
22580     *)
22581         usesitecustomize="$undef"
22582         ;;
22583     esac
22584
22585 : determine compiler compiler
22586 case "$yacc" in
22587 '')
22588         dflt=yacc;;
22589 *)
22590         dflt="$yacc";;
22591 esac
22592 echo " "
22593 comp='yacc'
22594 if $test -f "$byacc$_exe"; then
22595         dflt="$byacc"
22596         comp="byacc or $comp"
22597 fi
22598 if $test -f "$bison$_exe"; then
22599         comp="$comp or bison -y"
22600 fi
22601 rp="Which compiler compiler ($comp) shall I use?"
22602 . ./myread
22603 yacc="$ans"
22604 case "$yacc" in
22605 *bis*)
22606         case "$yacc" in
22607         *-y*) ;;
22608         *)
22609                 yacc="$yacc -y"
22610                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22611                 ;;
22612         esac
22613         ;;
22614 esac
22615
22616 : see if this is a bfd.h system
22617 set bfd.h i_bfd
22618 eval $inhdr
22619
22620 : see if this is an execinfo.h system
22621 set execinfo.h i_execinfo
22622 eval $inhdr
22623
22624 : see if this is a fenv.h system
22625 set fenv.h i_fenv
22626 eval $inhdr
22627
22628 : see if this is a fp.h system
22629 set fp.h i_fp
22630 eval $inhdr
22631
22632 : see if this is a fp_class.h system
22633 set fp_class.h i_fp_class
22634 eval $inhdr
22635
22636 : see if gdbm.h is available
22637 set gdbm.h t_gdbm
22638 eval $inhdr
22639 case "$t_gdbm" in
22640 $define)
22641         : see if gdbm_open exists
22642         set gdbm_open d_gdbm_open
22643         eval $inlibc
22644         case "$d_gdbm_open" in
22645         $undef)
22646                 t_gdbm="$undef"
22647                 echo "We won't be including <gdbm.h>"
22648                 ;;
22649         esac
22650         ;;
22651 esac
22652 val="$t_gdbm"
22653 set i_gdbm
22654 eval $setvar
22655
22656 : see if this is a ieeefp.h system
22657 case "$i_ieeefp" in
22658 '' ) set ieeefp.h i_ieeefp
22659      eval $inhdr
22660      ;;
22661 esac
22662
22663 : see if this is a libutil.h system
22664 set libutil.h i_libutil
22665 eval $inhdr
22666
22667 : see if mach cthreads are available
22668 if test "X$usethreads" = "X$define"; then
22669         set mach/cthreads.h i_machcthr
22670         eval $inhdr
22671 else
22672         i_machcthr="$undef"
22673 fi
22674
22675 : see if this is a mntent.h system
22676 set mntent.h i_mntent
22677 eval $inhdr
22678
22679 : see if net/errno.h is available
22680 val=''
22681 set net/errno.h val
22682 eval $inhdr
22683
22684 : Unfortunately, it causes problems on some systems.  Arrgh.
22685 case "$val" in
22686 $define)
22687         cat > try.c <<'EOM'
22688 #include <stdio.h>
22689 #include <errno.h>
22690 #include <net/errno.h>
22691 int func()
22692 {
22693         return ENOTSOCK;
22694 }
22695 EOM
22696         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22697                 echo "We'll be including <net/errno.h>." >&4
22698         else
22699                 echo "We won't be including <net/errno.h>." >&4
22700                 val="$undef"
22701         fi
22702         $rm_try
22703         ;;
22704 esac
22705 set i_neterrno
22706 eval $setvar
22707
22708 : see if netinet/tcp.h is available
22709 set netinet/tcp.h i_netinettcp
22710 eval $inhdr
22711
22712 : see if this is a poll.h system
22713 set poll.h i_poll
22714 eval $inhdr
22715
22716 : see if this is a prot.h system
22717 set prot.h i_prot
22718 eval $inhdr
22719
22720 : Preprocessor symbols
22721 echo " "
22722 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22723 $cat <<'EOSH' > Cppsym.know
22724 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22725 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22726 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22727 arch_pwr ardent ARM ARM32 atarist att386 att3b
22728 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22729 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22730 byteorder byte_order
22731 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22732 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22733 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22734 ELF encore EPI EXTENSIONS
22735 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22736 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22737 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22738 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22739 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
22740 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22741 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22742 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22743 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22744 ksr1
22745 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22746 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22747 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22748 luna88k Lynx
22749 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22750 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22751 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22752 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22753 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22754 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22755 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22756 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22757 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22758 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22759 ns32000 ns32016 ns32332 ns32k nsc32000
22760 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22761 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22762 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22763 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22764 QK_USER QNX
22765 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22766 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22767 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22768 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22769 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22770 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22771 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22772 SYSV4 SYSV5 sysV68 sysV88
22773 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22774 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22775 tower32_800 tower32_850 tss
22776 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22777 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22778 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22779 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22780 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22781 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22782 uxpm uxps
22783 vax venix VMESA vms
22784 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22785 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22786 z8000 zarch
22787 EOSH
22788 # Maybe put other stuff here too.
22789 ./tr '-' '_' <<EOSH >>Cppsym.know
22790 $osname
22791 EOSH
22792 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22793 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22794 $cat Cppsym.know > Cppsym.c
22795 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22796 $rm -f Cppsym.a Cppsym.b Cppsym.c
22797 cat <<EOSH > Cppsym
22798 $startsh
22799 if $test \$# -gt 0; then
22800     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22801     if $test -s Cppsym.got; then
22802         $rm -f Cppsym.got
22803         exit 0
22804     fi
22805     $rm -f Cppsym.got
22806     exit 1
22807 else
22808     $tr " " "$trnl" | ./Cppsym.try
22809     exit 0
22810 fi
22811 EOSH
22812 chmod +x Cppsym
22813 $eunicefix Cppsym
22814 cat <<EOSH > Cppsym.try
22815 $startsh
22816 cat <<'EOCP' > try.c
22817 #include <stdio.h>
22818 #if cpp_stuff == 1
22819 #define STRINGIFY(a)    "a"
22820 #endif
22821 #if cpp_stuff == 42
22822 #define StGiFy(a)  #a
22823 #define STRINGIFY(a)    StGiFy(a)
22824 #endif
22825 #if $cpp_stuff != 1 && $cpp_stuff != 42
22826 #   include "Bletch: How does this C preprocessor stringify macros?"
22827 #endif
22828 int main() {
22829 EOCP
22830 $awk \\
22831 EOSH
22832 cat <<'EOSH' >> Cppsym.try
22833 'length($1) > 0 {
22834     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22835     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22836     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22837     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22838 }'       >> try.c
22839 echo 'return 0;}' >> try.c
22840 EOSH
22841 cat <<EOSH >> Cppsym.try
22842 ccflags="$ccflags"
22843 case "$osname-$gccversion" in
22844 irix-) ccflags="\$ccflags -woff 1178" ;;
22845 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22846 esac
22847 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
22848 EOSH
22849 chmod +x Cppsym.try
22850 $eunicefix Cppsym.try
22851 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22852 : Add in any Linux cpp "predefined macros":
22853 case "$osname::$gccversion" in
22854   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22855     tHdrH=_tmpHdr
22856     rm -f $tHdrH'.h' $tHdrH
22857     touch $tHdrH'.h'
22858     # Filter out macro arguments, such as Linux's __INT8_C(c)
22859     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22860        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22861        if [ -s $tHdrH'_cppsym.real' ]; then
22862           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22863        fi
22864     fi
22865     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22866   ;;
22867 esac
22868 : now check the C compiler for additional symbols
22869 postprocess_cc_v=''
22870 case "$osname" in
22871 aix) postprocess_cc_v="|$tr , ' '" ;;
22872 esac
22873 $cat >ccsym <<EOS
22874 $startsh
22875 $cat >tmp.c <<EOF
22876 extern int foo;
22877 EOF
22878 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22879 do
22880         case "\$i" in
22881         -D*) echo "\$i" | $sed 's/^-D//';;
22882         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22883         esac
22884 done
22885 $rm_try
22886 EOS
22887 postprocess_cc_v=''
22888 chmod +x ccsym
22889 $eunicefix ccsym
22890 ./ccsym > ccsym1.raw
22891 if $test -s ccsym1.raw; then
22892     $sort ccsym1.raw | $uniq >ccsym.raw
22893 else
22894     mv ccsym1.raw ccsym.raw
22895 fi
22896
22897 $awk '/\=/ { print $0; next }
22898         { print $0"=1" }' ccsym.raw >ccsym.list
22899 $comm -13 Cppsym.true ccsym.list >ccsym.own
22900 $comm -12 Cppsym.true ccsym.list >ccsym.com
22901 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22902 also=''
22903 if $test -z ccsym.raw; then
22904         echo "Your C compiler doesn't seem to define any symbols!" >&4
22905         echo " "
22906         echo "However, your C preprocessor defines the following symbols:"
22907         $cat Cppsym.true
22908         ccsymbols=''
22909         cppsymbols=`$cat Cppsym.true`
22910         cppsymbols=`echo $cppsymbols`
22911         cppccsymbols="$cppsymbols"
22912 else
22913         if $test -s ccsym.com; then
22914                 echo "Your C compiler and pre-processor define these symbols:"
22915                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22916                 also='also '
22917                 symbols='ones'
22918                 cppccsymbols=`$cat ccsym.com`
22919                 cppccsymbols=`echo $cppccsymbols`
22920                 $test "$silent" || sleep 1
22921         fi
22922         if $test -s ccsym.cpp; then
22923                 $test "$also" && echo " "
22924                 echo "Your C pre-processor ${also}defines the following symbols:"
22925                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22926                 also='further '
22927                 cppsymbols=`$cat ccsym.cpp`
22928                 cppsymbols=`echo $cppsymbols`
22929                 $test "$silent" || sleep 1
22930         fi
22931         if $test -s ccsym.own; then
22932                 $test "$also" && echo " "
22933                 echo "Your C compiler ${also}defines the following cpp symbols:"
22934                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22935                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22936                 ccsymbols=`$cat ccsym.own`
22937                 ccsymbols=`echo $ccsymbols`
22938                 $test "$silent" || sleep 1
22939         fi
22940 fi
22941
22942 : add -D_FORTIFY_SOURCE if feasible and not already there
22943 case "$gccversion" in
22944 [4567].*)       case "$optimize$ccflags" in
22945         *-O*)   case "$ccflags$cppsymbols" in
22946                 *_FORTIFY_SOURCE=*) # Don't add it again.
22947                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22948                         ;;
22949                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22950                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22951                         ;;
22952                 esac
22953                 ;;
22954         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22955                 ;;
22956         esac
22957         ;;
22958 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
22959         ;;
22960 esac
22961
22962 : script used to emit important warnings
22963 cat >warn <<EOS
22964 $startsh
22965 if test \$# -gt 0; then
22966         echo "\$@" >msg
22967 else
22968         cat >msg
22969 fi
22970 echo "*** WARNING:" >&4
22971 sed -e 's/^/*** /' <msg >&4
22972 echo "*** " >&4
22973 cat msg >>config.msg
22974 echo " " >>config.msg
22975 rm -f msg
22976 EOS
22977 chmod +x warn
22978 $eunicefix warn
22979
22980 : see if this is a termio system
22981 val="$undef"
22982 val2="$undef"
22983 val3="$undef"
22984 if $test `./findhdr termios.h`; then
22985     set tcsetattr i_termios
22986     eval $inlibc
22987     val3="$i_termios"
22988 fi
22989 echo " "
22990 case "$val3" in
22991     "$define") echo "You have POSIX termios.h... good!" >&4;;
22992     *)  if ./Cppsym pyr; then
22993             case "`$run /bin/universe`" in
22994                 ucb) if $test `./findhdr sgtty.h`; then
22995                         val2="$define"
22996                         echo "<sgtty.h> found." >&4
22997                     else
22998                         echo "System is pyramid with BSD universe."
22999                         ./warn "<sgtty.h> not found--you could have problems."
23000                     fi;;
23001                 *)  if $test `./findhdr termio.h`; then
23002                         val="$define"
23003                         echo "<termio.h> found." >&4
23004                     else
23005                         echo "System is pyramid with USG universe."
23006                         ./warn "<termio.h> not found--you could have problems."
23007                     fi;;
23008             esac
23009         elif ./usg; then
23010             if $test `./findhdr termio.h`; then
23011                 echo "<termio.h> found." >&4
23012                 val="$define"
23013             elif $test `./findhdr sgtty.h`; then
23014                 echo "<sgtty.h> found." >&4
23015                 val2="$define"
23016             else
23017                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23018             fi
23019         else
23020             if $test `./findhdr sgtty.h`; then
23021                 echo "<sgtty.h> found." >&4
23022                 val2="$define"
23023             elif $test `./findhdr termio.h`; then
23024                 echo "<termio.h> found." >&4
23025                 val="$define"
23026             else
23027                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23028             fi
23029         fi;;
23030 esac
23031 set i_termio; eval $setvar
23032 val=$val2; set i_sgtty; eval $setvar
23033 val=$val3; set i_termios; eval $setvar
23034
23035 : see if stdbool is available
23036 : we want a real compile instead of Inhdr because some Solaris systems
23037 : have stdbool.h, but it can only be used if the compiler indicates it
23038 : is sufficiently c99-compliant.
23039 echo " "
23040 $cat >try.c <<EOCP
23041 #include <stdio.h>
23042 #include <stdbool.h>
23043 int func(bool x)
23044 {
23045     return x ? 1 : 0;
23046 }
23047 int main(int argc, char **argv)
23048 {
23049     return func(0);
23050 }
23051 EOCP
23052 set try
23053 if eval $compile; then
23054         echo "<stdbool.h> found." >&4
23055         val="$define"
23056 else
23057         echo "<stdbool.h> NOT found." >&4
23058         val="$undef"
23059 fi
23060 $rm_try
23061 set i_stdbool
23062 eval $setvar
23063
23064 : see if stdint is available
23065 set stdint.h i_stdint
23066 eval $inhdr
23067
23068 : see if sys/access.h is available
23069 set sys/access.h i_sysaccess
23070 eval $inhdr
23071
23072 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23073 set sys/filio.h i_sysfilio
23074 eval $inhdr
23075 echo " "
23076 if $test `./findhdr sys/ioctl.h`; then
23077         val="$define"
23078         echo '<sys/ioctl.h> found.' >&4
23079 else
23080         val="$undef"
23081         if $test $i_sysfilio = "$define"; then
23082             echo '<sys/ioctl.h> NOT found.' >&4
23083         else
23084                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23085                 $test $i_termio = "$define" && xxx="termio.h"
23086                 $test $i_termios = "$define" && xxx="termios.h"
23087 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23088         fi
23089 fi
23090 set i_sysioctl
23091 eval $setvar
23092
23093 : see if socket ioctl defs are in sys/sockio.h
23094 echo " "
23095 xxx=`./findhdr sys/sockio.h`
23096 if $test "$xxx"; then
23097         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23098                 val="$define"
23099                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23100         else
23101                 val="$undef"
23102                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23103         fi
23104 else
23105         val="$undef"
23106         $cat <<EOM
23107 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23108 EOM
23109 fi
23110 set i_syssockio
23111 eval $setvar
23112
23113 : see if this is a syslog.h system
23114 set syslog.h i_syslog
23115 eval $inhdr
23116
23117 : see if this is a sys/mode.h system
23118 set sys/mode.h i_sysmode
23119 eval $inhdr
23120
23121 : see if there is a sys/poll.h file
23122 set sys/poll.h i_syspoll
23123 eval $inhdr
23124
23125 : see if sys/resource.h has to be included
23126 set sys/resource.h i_sysresrc
23127 eval $inhdr
23128
23129 : see if sys/security.h is available
23130 set sys/security.h i_syssecrt
23131 eval $inhdr
23132
23133 : see if this is a sys/statvfs.h system
23134 set sys/statvfs.h i_sysstatvfs
23135 eval $inhdr
23136
23137 : see if this is a sys/un.h system
23138 set sys/un.h i_sysun
23139 eval $inhdr
23140
23141 : see if this is a sys/utsname.h system
23142 set sys/utsname.h i_sysutsname
23143 eval $inhdr
23144
23145 : see if this is a syswait system
23146 set sys/wait.h i_syswait
23147 eval $inhdr
23148
23149 : see if this is a ustat.h system
23150 set ustat.h i_ustat
23151 eval $inhdr
23152
23153 : see if this is an utime system
23154 set utime.h i_utime
23155 eval $inhdr
23156
23157 : see if this is a vfork system
23158 case "$d_vfork" in
23159 "$define")
23160         set vfork.h i_vfork
23161         eval $inhdr
23162         ;;
23163 *)
23164         i_vfork="$undef"
23165         ;;
23166 esac
23167
23168 : see if wchar.h is present
23169 set wchar.h i_wchar
23170 eval $inhdr
23171
23172 : Check extensions
23173 echo " "
23174 echo "Looking for extensions..." >&4
23175 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23176 : contain old or inaccurate or duplicate values.
23177 nonxs_extensions=''
23178 xs_extensions=''
23179 : We do not use find because it might not be available.
23180 : We do not just use MANIFEST because the user may have dropped
23181 : some additional extensions into the source tree and expect them
23182 : to be built.
23183
23184 : Function to recursively find available extensions, ignoring DynaLoader
23185 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23186 : In 5.10.1 and later, extensions are stored in directories
23187 : like File-Glob instead of the older File/Glob/.
23188 find_extensions='
23189     for xxx in *; do
23190         case "$xxx" in
23191             DynaLoader|dynaload) ;;
23192             *)
23193             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23194             case "$this_ext" in
23195                 Scalar/List/Utils) this_ext="List/Util" ;;
23196                 PathTools)         this_ext="Cwd"       ;;
23197             esac;
23198             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23199             if $contains " $this_ext " "$tdir/$$.tmp"; then
23200                 echo >&4;
23201                 echo "Duplicate directories detected for extension $xxx" >&4;
23202                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23203                 case "$knowitall" in
23204                 "") dflt=y;;
23205                 *) dflt=n;;
23206                 esac;
23207                 . ../UU/myread;
23208                 case "$ans" in
23209                 n*|N*) ;;
23210                 *) echo >&4;
23211                     echo "Ok.  Stopping Configure." >&4;
23212                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23213                     exit 1;;
23214                 esac;
23215                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23216             fi;
23217             $ls -1 "$xxx" > "$tdir/$$.tmp";
23218             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23219                 xs_extensions="$xs_extensions $this_ext";
23220             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23221                 xs_extensions="$xs_extensions $this_ext";
23222             elif $test -d "$xxx"; then
23223                 nonxs_extensions="$nonxs_extensions $this_ext";
23224             fi;
23225             $rm -f "$tdir/$$.tmp";
23226             ;;
23227         esac;
23228     done'
23229 tdir=`pwd`
23230 cd "$rsrc/cpan"
23231 set X
23232 shift
23233 eval $find_extensions
23234 cd "$rsrc/dist"
23235 set X
23236 shift
23237 eval $find_extensions
23238 cd "$rsrc/ext"
23239 set X
23240 shift
23241 eval $find_extensions
23242 set X $xs_extensions
23243 shift
23244 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23245 set X $nonxs_extensions
23246 shift
23247 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23248 cd "$tdir"
23249 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23250
23251 : Now see which are supported on this system.
23252 avail_ext=''
23253 for xxx in $xs_extensions ; do
23254         case "$xxx" in
23255         Amiga*)
23256                 case "$osname" in
23257                 amigaos) avail_ext="$avail_ext $xxx" ;;
23258                 esac
23259                 ;;
23260         DB_File|db_file)
23261                 case "$i_db" in
23262                 $define) avail_ext="$avail_ext $xxx" ;;
23263                 esac
23264                 ;;
23265         GDBM_File|gdbm_fil)
23266                 case "$i_gdbm" in
23267                 $define) avail_ext="$avail_ext $xxx" ;;
23268                 esac
23269                 ;;
23270         I18N/Langinfo|i18n_lan)
23271                 case "$i_langinfo$d_nl_langinfo" in
23272                 $define$define) avail_ext="$avail_ext $xxx" ;;
23273                 esac
23274                 ;;
23275         IPC/SysV|ipc/sysv)
23276                 : XXX Do we need a useipcsysv variable here
23277                 case "${d_msg}${d_sem}${d_shm}" in
23278                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23279                 esac
23280                 ;;
23281         NDBM_File|ndbm_fil)
23282                 case "$d_ndbm" in
23283                 $define)
23284                     case "$osname-$use64bitint" in
23285                     hpux-define)
23286                         case "$libs" in
23287                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23288                         esac
23289                         ;;
23290                     *) avail_ext="$avail_ext $xxx" ;;
23291                     esac
23292                     ;;
23293                 esac
23294                 ;;
23295         ODBM_File|odbm_fil)
23296                 case "${i_dbm}${i_rpcsvcdbm}" in
23297                 *"${define}"*)
23298                     case "$d_cplusplus" in
23299                     define) ;; # delete as a function name will not work
23300                     *)  case "$osname-$use64bitint" in
23301                         hpux-define)
23302                             case "$libs" in
23303                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23304                             esac
23305                             ;;
23306                         *) avail_ext="$avail_ext $xxx" ;;
23307                         esac
23308                         ;;
23309                     esac
23310                     ;;
23311                 esac
23312                 ;;
23313         Opcode|opcode)
23314                 case "$useopcode" in
23315                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23316                 esac
23317                 ;;
23318         POSIX|posix)
23319                 case "$useposix" in
23320                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23321                 esac
23322                 ;;
23323         Socket|socket)
23324                 case "$d_socket" in
23325                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23326                 esac
23327                 ;;
23328         Sys/Syslog|sys/syslog)
23329                 case $osname in
23330                         amigaos) ;; # not really very useful on AmigaOS
23331                         *)
23332                         : XXX syslog requires socket
23333                         case "$d_socket" in
23334                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23335                         esac
23336                         ;;
23337                 esac
23338                 ;;
23339         Thread|thread)
23340                 case "$usethreads" in
23341                 true|$define|y)
23342                         case "$use5005threads" in
23343                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23344                         esac
23345                 esac
23346                 ;;
23347         threads|threads/shared)
23348                 # threads and threads::shared are special cases.
23349                 # To stop people from asking "Perl 5.8.0 was supposed
23350                 # to have this new fancy threads implementation but my
23351                 # perl doesn't have it" and from people trying to
23352                 # (re)install the threads module using CPAN.pm and
23353                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23354                 # the threads.pm and threads/shared.pm will always be
23355                 # there, croaking informatively ("you need to rebuild
23356                 # all of Perl with threads, sorry") when threads haven't
23357                 # been compiled in.
23358                 # --jhi
23359                 avail_ext="$avail_ext $xxx"
23360                 ;;
23361         VMS*)
23362                 ;;
23363         Win32*)
23364                 case "$osname" in
23365                 cygwin) avail_ext="$avail_ext $xxx" ;;
23366                 esac
23367                 ;;
23368         XS/APItest|xs/apitest)
23369                 # This is just for testing.  Skip it unless we have dynamic loading.
23370
23371                 case "$usedl" in
23372                 $define) avail_ext="$avail_ext $xxx" ;;
23373                 esac
23374                 ;;
23375         XS/Typemap|xs/typemap)
23376                 # This is just for testing.  Skip it unless we have dynamic loading.
23377                 case "$usedl" in
23378                 $define) avail_ext="$avail_ext $xxx" ;;
23379                 esac
23380                 ;;
23381         *)      avail_ext="$avail_ext $xxx"
23382                 ;;
23383         esac
23384 done
23385
23386 set X $avail_ext
23387 shift
23388 avail_ext="$*"
23389
23390 case "$onlyextensions" in
23391 '') ;;
23392 *)  keepextensions=''
23393     echo "You have requested that only certain extensions be included..." >&4
23394     for i in $onlyextensions; do
23395         case " $avail_ext " in
23396         *" $i "*)
23397             echo "Keeping extension $i."
23398             keepextensions="$keepextensions $i"
23399             ;;
23400         *) echo "Ignoring extension $i." ;;
23401         esac
23402     done
23403     avail_ext="$keepextensions"
23404     ;;
23405 esac
23406
23407 case "$noextensions" in
23408 '') ;;
23409 *)  keepextensions=''
23410     echo "You have requested that certain extensions be ignored..." >&4
23411     for i in $avail_ext; do
23412         case " $noextensions " in
23413         *" $i "*) echo "Ignoring extension $i." ;;
23414         *) echo "Keeping extension $i.";
23415            keepextensions="$keepextensions $i"
23416            ;;
23417         esac
23418     done
23419     avail_ext="$keepextensions"
23420     ;;
23421 esac
23422
23423 : Now see which nonxs extensions are supported on this system.
23424 : For now assume all are.
23425 nonxs_ext=''
23426 for xxx in $nonxs_extensions ; do
23427         case "$xxx" in
23428         VMS*)
23429                 ;;
23430         *)      nonxs_ext="$nonxs_ext $xxx"
23431                 ;;
23432         esac
23433 done
23434
23435 set X $nonxs_ext
23436 shift
23437 nonxs_ext="$*"
23438
23439 case $usedl in
23440 $define)
23441         $cat <<EOM
23442 A number of extensions are supplied with $package.  You may choose to
23443 compile these extensions for dynamic loading (the default), compile
23444 them into the $package executable (static loading), or not include
23445 them at all.  Answer "none" to include no extensions.
23446 Note that DynaLoader is always built and need not be mentioned here.
23447
23448 EOM
23449         case "$dynamic_ext" in
23450         '')
23451                 : Exclude those listed in static_ext
23452                 dflt=''
23453                 for xxx in $avail_ext; do
23454                         case " $static_ext " in
23455                         *" $xxx "*) ;;
23456                         *) dflt="$dflt $xxx" ;;
23457                         esac
23458                 done
23459                 set X $dflt
23460                 shift
23461                 dflt="$*"
23462                 ;;
23463         *)      dflt="$dynamic_ext"
23464                 # Perhaps we are reusing an old out-of-date config.sh.
23465                 case "$hint" in
23466                 previous)
23467                         if test X"$dynamic_ext" != X"$avail_ext"; then
23468                                 $cat <<EOM
23469 NOTICE:  Your previous config.sh list may be incorrect.
23470 The extensions now available to you are
23471         ${avail_ext}
23472 but the default list from your previous config.sh is
23473         ${dynamic_ext}
23474
23475 EOM
23476                         fi
23477                         ;;
23478                 esac
23479                 ;;
23480         esac
23481         case "$dflt" in
23482         '')     dflt=none;;
23483         esac
23484         rp="What extensions do you wish to load dynamically?"
23485         . ./myread
23486         case "$ans" in
23487         none) dynamic_ext=' ' ;;
23488         *) dynamic_ext="$ans" ;;
23489         esac
23490
23491         case "$static_ext" in
23492         '')
23493                 : Exclude those already listed in dynamic linking
23494                 dflt=''
23495                 for xxx in $avail_ext; do
23496                         case " $dynamic_ext " in
23497                         *" $xxx "*) ;;
23498                         *) dflt="$dflt $xxx" ;;
23499                         esac
23500                 done
23501                 set X $dflt
23502                 shift
23503                 dflt="$*"
23504                 ;;
23505         *)  dflt="$static_ext"
23506                 ;;
23507         esac
23508
23509         case "$dflt" in
23510         '')     dflt=none;;
23511         esac
23512         rp="What extensions do you wish to load statically?"
23513         . ./myread
23514         case "$ans" in
23515         none) static_ext=' ' ;;
23516         *) static_ext="$ans" ;;
23517         esac
23518         ;;
23519 *)
23520         $cat <<EOM
23521 A number of extensions are supplied with $package.  Answer "none"
23522 to include no extensions.
23523 Note that DynaLoader is always built and need not be mentioned here.
23524
23525 EOM
23526         case "$static_ext" in
23527         '') dflt="$avail_ext" ;;
23528         *)      dflt="$static_ext"
23529                 # Perhaps we are reusing an old out-of-date config.sh.
23530                 case "$hint" in
23531                 previous)
23532                         if test X"$static_ext" != X"$avail_ext"; then
23533                                 $cat <<EOM
23534 NOTICE:  Your previous config.sh list may be incorrect.
23535 The extensions now available to you are
23536         ${avail_ext}
23537 but the default list from your previous config.sh is
23538         ${static_ext}
23539
23540 EOM
23541                         fi
23542                         ;;
23543                 esac
23544                 ;;
23545         esac
23546         : Exclude those that are not xs extensions
23547         case "$dflt" in
23548         '')     dflt=none;;
23549         esac
23550         rp="What extensions do you wish to include?"
23551         . ./myread
23552         case "$ans" in
23553         none) static_ext=' ' ;;
23554         *) static_ext="$ans" ;;
23555         esac
23556         ;;
23557 esac
23558 #
23559 # Encode is a special case.  If we are building Encode as a static
23560 # extension, we need to explicitly list its subextensions as well.
23561 # For other nested extensions, this is handled automatically by
23562 # the appropriate Makefile.PL.
23563 case " $static_ext " in
23564         *" Encode "*) # Add the subextensions of Encode
23565         cd "$rsrc/cpan"
23566         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23567                 static_ext="$static_ext Encode/$xxx"
23568                 known_extensions="$known_extensions Encode/$xxx"
23569         done
23570         cd "$tdir"
23571         ;;
23572 esac
23573
23574 set X $dynamic_ext $static_ext $nonxs_ext
23575 shift
23576 extensions="$*"
23577
23578 # Sanity check:  We require an extension suitable for use with
23579 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23580 # should show up as failures in the test suite, but it's helpful to
23581 # catch them now.) The 'extensions' list is normally sorted
23582 # alphabetically, so we need to accept either
23583 #    DB_File ... Fcntl ... IO  ....
23584 # or something like
23585 #    Fcntl ... NDBM_File ... IO  ....
23586 case " $extensions"  in
23587 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23588 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23589 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23590 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23591    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23592    ;;
23593 esac
23594
23595 : Remove libraries needed only for extensions
23596 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23597 : The exception is SunOS 4.x, which needs them.
23598 case "${osname}X${osvers}" in
23599 sunos*X4*)
23600     perllibs="$libs"
23601     ;;
23602 *) case "$usedl" in
23603     $define|true|[yY]*)
23604             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23605             shift
23606             perllibs="$*"
23607             ;;
23608     *)  perllibs="$libs"
23609             ;;
23610     esac
23611     ;;
23612 esac
23613
23614 : Remove build directory name from cppstdin so it can be used from
23615 : either the present location or the final installed location.
23616 echo " "
23617 : Get out of the UU directory to get correct path name.
23618 cd ..
23619 case "$cppstdin" in
23620 `pwd`/cppstdin)
23621         echo "Stripping down cppstdin path name"
23622         cppstdin=cppstdin
23623         ;;
23624 esac
23625 cd UU
23626
23627 : end of configuration questions
23628 echo " "
23629 echo "End of configuration questions."
23630 echo " "
23631
23632 : back to where it started
23633 if test -d ../UU; then
23634         cd ..
23635 fi
23636
23637 : configuration may be unconditionally patched via a 'config.arch' file
23638 if $test -f config.arch; then
23639         echo "I see a config.arch file, loading it." >&4
23640         . ./config.arch
23641 fi
23642
23643 : configuration may be patched via a 'config.over' file
23644 if $test -f config.over; then
23645         echo " "
23646         dflt=y
23647         rp='I see a config.over file.  Do you wish to load it?'
23648         . UU/myread
23649         case "$ans" in
23650         n*) echo "OK, I'll ignore it.";;
23651         *)      . ./config.over
23652                 echo "Configuration override changes have been loaded."
23653                 ;;
23654         esac
23655 fi
23656
23657 : in case they want portability, strip down executable paths
23658 case "$d_portable" in
23659 "$define")
23660         echo " "
23661         echo "Stripping down executable paths..." >&4
23662         for file in $loclist $trylist; do
23663                 eval temp=\$$file
23664                 eval $file=`basename $temp`
23665         done
23666         ;;
23667 esac
23668
23669 : create config.sh file
23670 echo " "
23671 echo "Creating config.sh..." >&4
23672 $spitshell <<EOT >config.sh
23673 $startsh
23674 #
23675 # This file was produced by running the Configure script. It holds all the
23676 # definitions figured out by Configure. Should you modify one of these values,
23677 # do not forget to propagate your changes by running "Configure -der". You may
23678 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23679 #
23680
23681 # Package name      : $package
23682 # Source directory  : $src
23683 # Configuration time: $cf_time
23684 # Configured by     : $cf_by
23685 # Target system     : $myuname
23686
23687 EOT
23688 : Add in command line options if available
23689 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23690
23691 $spitshell <<EOT >>config.sh
23692
23693 Author='$Author'
23694 Date='$Date'
23695 Header='$Header'
23696 Id='$Id'
23697 Locker='$Locker'
23698 Log='$Log'
23699 RCSfile='$RCSfile'
23700 Revision='$Revision'
23701 Source='$Source'
23702 State='$State'
23703 _a='$_a'
23704 _exe='$_exe'
23705 _o='$_o'
23706 afs='$afs'
23707 afsroot='$afsroot'
23708 alignbytes='$alignbytes'
23709 aphostname='$aphostname'
23710 api_revision='$api_revision'
23711 api_subversion='$api_subversion'
23712 api_version='$api_version'
23713 api_versionstring='$api_versionstring'
23714 ar='$ar'
23715 archlib='$archlib'
23716 archlibexp='$archlibexp'
23717 archname64='$archname64'
23718 archname='$archname'
23719 archobjs='$archobjs'
23720 asctime_r_proto='$asctime_r_proto'
23721 awk='$awk'
23722 baserev='$baserev'
23723 bash='$bash'
23724 bin='$bin'
23725 bin_ELF='$bin_ELF'
23726 binexp='$binexp'
23727 bison='$bison'
23728 byacc='$byacc'
23729 byteorder='$byteorder'
23730 c='$c'
23731 castflags='$castflags'
23732 cat='$cat'
23733 cc='$cc'
23734 cccdlflags='$cccdlflags'
23735 ccdlflags='$ccdlflags'
23736 ccflags='$ccflags'
23737 ccflags_uselargefiles='$ccflags_uselargefiles'
23738 ccname='$ccname'
23739 ccsymbols='$ccsymbols'
23740 ccversion='$ccversion'
23741 cf_by='$cf_by'
23742 cf_email='$cf_email'
23743 cf_time='$cf_time'
23744 charbits='$charbits'
23745 charsize='$charsize'
23746 chgrp='$chgrp'
23747 chmod='$chmod'
23748 chown='$chown'
23749 clocktype='$clocktype'
23750 comm='$comm'
23751 compress='$compress'
23752 contains='$contains'
23753 cp='$cp'
23754 cpio='$cpio'
23755 cpp='$cpp'
23756 cpp_stuff='$cpp_stuff'
23757 cppccsymbols='$cppccsymbols'
23758 cppflags='$cppflags'
23759 cpplast='$cpplast'
23760 cppminus='$cppminus'
23761 cpprun='$cpprun'
23762 cppstdin='$cppstdin'
23763 cppsymbols='$cppsymbols'
23764 crypt_r_proto='$crypt_r_proto'
23765 cryptlib='$cryptlib'
23766 csh='$csh'
23767 ctermid_r_proto='$ctermid_r_proto'
23768 ctime_r_proto='$ctime_r_proto'
23769 d_Gconvert='$d_Gconvert'
23770 d_PRIEUldbl='$d_PRIEUldbl'
23771 d_PRIFUldbl='$d_PRIFUldbl'
23772 d_PRIGUldbl='$d_PRIGUldbl'
23773 d_PRIXU64='$d_PRIXU64'
23774 d_PRId64='$d_PRId64'
23775 d_PRIeldbl='$d_PRIeldbl'
23776 d_PRIfldbl='$d_PRIfldbl'
23777 d_PRIgldbl='$d_PRIgldbl'
23778 d_PRIi64='$d_PRIi64'
23779 d_PRIo64='$d_PRIo64'
23780 d_PRIu64='$d_PRIu64'
23781 d_PRIx64='$d_PRIx64'
23782 d_SCNfldbl='$d_SCNfldbl'
23783 d__fwalk='$d__fwalk'
23784 d_accept4='$d_accept4'
23785 d_access='$d_access'
23786 d_accessx='$d_accessx'
23787 d_acosh='$d_acosh'
23788 d_aintl='$d_aintl'
23789 d_alarm='$d_alarm'
23790 d_archlib='$d_archlib'
23791 d_asctime64='$d_asctime64'
23792 d_asctime_r='$d_asctime_r'
23793 d_asinh='$d_asinh'
23794 d_atanh='$d_atanh'
23795 d_atolf='$d_atolf'
23796 d_atoll='$d_atoll'
23797 d_attribute_deprecated='$d_attribute_deprecated'
23798 d_attribute_format='$d_attribute_format'
23799 d_attribute_malloc='$d_attribute_malloc'
23800 d_attribute_nonnull='$d_attribute_nonnull'
23801 d_attribute_noreturn='$d_attribute_noreturn'
23802 d_attribute_pure='$d_attribute_pure'
23803 d_attribute_unused='$d_attribute_unused'
23804 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23805 d_backtrace='$d_backtrace'
23806 d_bsd='$d_bsd'
23807 d_bsdgetpgrp='$d_bsdgetpgrp'
23808 d_bsdsetpgrp='$d_bsdsetpgrp'
23809 d_builtin_add_overflow='$d_builtin_add_overflow'
23810 d_builtin_choose_expr='$d_builtin_choose_expr'
23811 d_builtin_expect='$d_builtin_expect'
23812 d_builtin_mul_overflow='$d_builtin_mul_overflow'
23813 d_builtin_sub_overflow='$d_builtin_sub_overflow'
23814 d_c99_variadic_macros='$d_c99_variadic_macros'
23815 d_casti32='$d_casti32'
23816 d_castneg='$d_castneg'
23817 d_cbrt='$d_cbrt'
23818 d_chown='$d_chown'
23819 d_chroot='$d_chroot'
23820 d_chsize='$d_chsize'
23821 d_class='$d_class'
23822 d_clearenv='$d_clearenv'
23823 d_closedir='$d_closedir'
23824 d_cmsghdr_s='$d_cmsghdr_s'
23825 d_const='$d_const'
23826 d_copysign='$d_copysign'
23827 d_copysignl='$d_copysignl'
23828 d_cplusplus='$d_cplusplus'
23829 d_crypt='$d_crypt'
23830 d_crypt_r='$d_crypt_r'
23831 d_csh='$d_csh'
23832 d_ctermid='$d_ctermid'
23833 d_ctermid_r='$d_ctermid_r'
23834 d_ctime64='$d_ctime64'
23835 d_ctime_r='$d_ctime_r'
23836 d_cuserid='$d_cuserid'
23837 d_dbminitproto='$d_dbminitproto'
23838 d_difftime64='$d_difftime64'
23839 d_difftime='$d_difftime'
23840 d_dir_dd_fd='$d_dir_dd_fd'
23841 d_dirfd='$d_dirfd'
23842 d_dirnamlen='$d_dirnamlen'
23843 d_dladdr='$d_dladdr'
23844 d_dlerror='$d_dlerror'
23845 d_dlopen='$d_dlopen'
23846 d_dlsymun='$d_dlsymun'
23847 d_dosuid='$d_dosuid'
23848 d_double_has_inf='$d_double_has_inf'
23849 d_double_has_nan='$d_double_has_nan'
23850 d_double_has_negative_zero='$d_double_has_negative_zero'
23851 d_double_has_subnormals='$d_double_has_subnormals'
23852 d_double_style_cray='$d_double_style_cray'
23853 d_double_style_ibm='$d_double_style_ibm'
23854 d_double_style_ieee='$d_double_style_ieee'
23855 d_double_style_vax='$d_double_style_vax'
23856 d_drand48_r='$d_drand48_r'
23857 d_drand48proto='$d_drand48proto'
23858 d_dup2='$d_dup2'
23859 d_dup3='$d_dup3'
23860 d_duplocale='$d_duplocale'
23861 d_eaccess='$d_eaccess'
23862 d_endgrent='$d_endgrent'
23863 d_endgrent_r='$d_endgrent_r'
23864 d_endhent='$d_endhent'
23865 d_endhostent_r='$d_endhostent_r'
23866 d_endnent='$d_endnent'
23867 d_endnetent_r='$d_endnetent_r'
23868 d_endpent='$d_endpent'
23869 d_endprotoent_r='$d_endprotoent_r'
23870 d_endpwent='$d_endpwent'
23871 d_endpwent_r='$d_endpwent_r'
23872 d_endsent='$d_endsent'
23873 d_endservent_r='$d_endservent_r'
23874 d_eofnblk='$d_eofnblk'
23875 d_erf='$d_erf'
23876 d_erfc='$d_erfc'
23877 d_eunice='$d_eunice'
23878 d_exp2='$d_exp2'
23879 d_expm1='$d_expm1'
23880 d_faststdio='$d_faststdio'
23881 d_fchdir='$d_fchdir'
23882 d_fchmod='$d_fchmod'
23883 d_fchmodat='$d_fchmodat'
23884 d_fchown='$d_fchown'
23885 d_fcntl='$d_fcntl'
23886 d_fcntl_can_lock='$d_fcntl_can_lock'
23887 d_fd_macros='$d_fd_macros'
23888 d_fd_set='$d_fd_set'
23889 d_fdclose='$d_fdclose'
23890 d_fdim='$d_fdim'
23891 d_fds_bits='$d_fds_bits'
23892 d_fegetround='$d_fegetround'
23893 d_fgetpos='$d_fgetpos'
23894 d_finite='$d_finite'
23895 d_finitel='$d_finitel'
23896 d_flexfnam='$d_flexfnam'
23897 d_flock='$d_flock'
23898 d_flockproto='$d_flockproto'
23899 d_fma='$d_fma'
23900 d_fmax='$d_fmax'
23901 d_fmin='$d_fmin'
23902 d_fork='$d_fork'
23903 d_fp_class='$d_fp_class'
23904 d_fp_classify='$d_fp_classify'
23905 d_fp_classl='$d_fp_classl'
23906 d_fpathconf='$d_fpathconf'
23907 d_fpclass='$d_fpclass'
23908 d_fpclassify='$d_fpclassify'
23909 d_fpclassl='$d_fpclassl'
23910 d_fpgetround='$d_fpgetround'
23911 d_fpos64_t='$d_fpos64_t'
23912 d_freelocale='$d_freelocale'
23913 d_frexpl='$d_frexpl'
23914 d_fs_data_s='$d_fs_data_s'
23915 d_fseeko='$d_fseeko'
23916 d_fsetpos='$d_fsetpos'
23917 d_fstatfs='$d_fstatfs'
23918 d_fstatvfs='$d_fstatvfs'
23919 d_fsync='$d_fsync'
23920 d_ftello='$d_ftello'
23921 d_ftime='$d_ftime'
23922 d_futimes='$d_futimes'
23923 d_gai_strerror='$d_gai_strerror'
23924 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23925 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23926 d_getaddrinfo='$d_getaddrinfo'
23927 d_getcwd='$d_getcwd'
23928 d_getespwnam='$d_getespwnam'
23929 d_getfsstat='$d_getfsstat'
23930 d_getgrent='$d_getgrent'
23931 d_getgrent_r='$d_getgrent_r'
23932 d_getgrgid_r='$d_getgrgid_r'
23933 d_getgrnam_r='$d_getgrnam_r'
23934 d_getgrps='$d_getgrps'
23935 d_gethbyaddr='$d_gethbyaddr'
23936 d_gethbyname='$d_gethbyname'
23937 d_gethent='$d_gethent'
23938 d_gethname='$d_gethname'
23939 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23940 d_gethostbyname_r='$d_gethostbyname_r'
23941 d_gethostent_r='$d_gethostent_r'
23942 d_gethostprotos='$d_gethostprotos'
23943 d_getitimer='$d_getitimer'
23944 d_getlogin='$d_getlogin'
23945 d_getlogin_r='$d_getlogin_r'
23946 d_getmnt='$d_getmnt'
23947 d_getmntent='$d_getmntent'
23948 d_getnameinfo='$d_getnameinfo'
23949 d_getnbyaddr='$d_getnbyaddr'
23950 d_getnbyname='$d_getnbyname'
23951 d_getnent='$d_getnent'
23952 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23953 d_getnetbyname_r='$d_getnetbyname_r'
23954 d_getnetent_r='$d_getnetent_r'
23955 d_getnetprotos='$d_getnetprotos'
23956 d_getpagsz='$d_getpagsz'
23957 d_getpbyname='$d_getpbyname'
23958 d_getpbynumber='$d_getpbynumber'
23959 d_getpent='$d_getpent'
23960 d_getpgid='$d_getpgid'
23961 d_getpgrp2='$d_getpgrp2'
23962 d_getpgrp='$d_getpgrp'
23963 d_getppid='$d_getppid'
23964 d_getprior='$d_getprior'
23965 d_getprotobyname_r='$d_getprotobyname_r'
23966 d_getprotobynumber_r='$d_getprotobynumber_r'
23967 d_getprotoent_r='$d_getprotoent_r'
23968 d_getprotoprotos='$d_getprotoprotos'
23969 d_getprpwnam='$d_getprpwnam'
23970 d_getpwent='$d_getpwent'
23971 d_getpwent_r='$d_getpwent_r'
23972 d_getpwnam_r='$d_getpwnam_r'
23973 d_getpwuid_r='$d_getpwuid_r'
23974 d_getsbyname='$d_getsbyname'
23975 d_getsbyport='$d_getsbyport'
23976 d_getsent='$d_getsent'
23977 d_getservbyname_r='$d_getservbyname_r'
23978 d_getservbyport_r='$d_getservbyport_r'
23979 d_getservent_r='$d_getservent_r'
23980 d_getservprotos='$d_getservprotos'
23981 d_getspnam='$d_getspnam'
23982 d_getspnam_r='$d_getspnam_r'
23983 d_gettimeod='$d_gettimeod'
23984 d_gmtime64='$d_gmtime64'
23985 d_gmtime_r='$d_gmtime_r'
23986 d_gnulibc='$d_gnulibc'
23987 d_grpasswd='$d_grpasswd'
23988 d_hasmntopt='$d_hasmntopt'
23989 d_htonl='$d_htonl'
23990 d_hypot='$d_hypot'
23991 d_ilogb='$d_ilogb'
23992 d_ilogbl='$d_ilogbl'
23993 d_inc_version_list='$d_inc_version_list'
23994 d_inetaton='$d_inetaton'
23995 d_inetntop='$d_inetntop'
23996 d_inetpton='$d_inetpton'
23997 d_int64_t='$d_int64_t'
23998 d_ip_mreq='$d_ip_mreq'
23999 d_ip_mreq_source='$d_ip_mreq_source'
24000 d_ipv6_mreq='$d_ipv6_mreq'
24001 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24002 d_isascii='$d_isascii'
24003 d_isblank='$d_isblank'
24004 d_isfinite='$d_isfinite'
24005 d_isfinitel='$d_isfinitel'
24006 d_isinf='$d_isinf'
24007 d_isinfl='$d_isinfl'
24008 d_isless='$d_isless'
24009 d_isnan='$d_isnan'
24010 d_isnanl='$d_isnanl'
24011 d_isnormal='$d_isnormal'
24012 d_j0='$d_j0'
24013 d_j0l='$d_j0l'
24014 d_killpg='$d_killpg'
24015 d_lc_monetary_2008='$d_lc_monetary_2008'
24016 d_lchown='$d_lchown'
24017 d_ldbl_dig='$d_ldbl_dig'
24018 d_ldexpl='$d_ldexpl'
24019 d_lgamma='$d_lgamma'
24020 d_lgamma_r='$d_lgamma_r'
24021 d_libm_lib_version='$d_libm_lib_version'
24022 d_libname_unique='$d_libname_unique'
24023 d_link='$d_link'
24024 d_linkat='$d_linkat'
24025 d_llrint='$d_llrint'
24026 d_llrintl='$d_llrintl'
24027 d_llround='$d_llround'
24028 d_llroundl='$d_llroundl'
24029 d_localeconv_l='$d_localeconv_l'
24030 d_localtime64='$d_localtime64'
24031 d_localtime_r='$d_localtime_r'
24032 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24033 d_locconv='$d_locconv'
24034 d_lockf='$d_lockf'
24035 d_log1p='$d_log1p'
24036 d_log2='$d_log2'
24037 d_logb='$d_logb'
24038 d_long_double_style_ieee='$d_long_double_style_ieee'
24039 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24040 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24041 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24042 d_long_double_style_vax='$d_long_double_style_vax'
24043 d_longdbl='$d_longdbl'
24044 d_longlong='$d_longlong'
24045 d_lrint='$d_lrint'
24046 d_lrintl='$d_lrintl'
24047 d_lround='$d_lround'
24048 d_lroundl='$d_lroundl'
24049 d_lseekproto='$d_lseekproto'
24050 d_lstat='$d_lstat'
24051 d_madvise='$d_madvise'
24052 d_malloc_good_size='$d_malloc_good_size'
24053 d_malloc_size='$d_malloc_size'
24054 d_mblen='$d_mblen'
24055 d_mbrlen='$d_mbrlen'
24056 d_mbrtowc='$d_mbrtowc'
24057 d_mbstowcs='$d_mbstowcs'
24058 d_mbtowc='$d_mbtowc'
24059 d_memmem='$d_memmem'
24060 d_memrchr='$d_memrchr'
24061 d_mkdir='$d_mkdir'
24062 d_mkdtemp='$d_mkdtemp'
24063 d_mkfifo='$d_mkfifo'
24064 d_mkstemp='$d_mkstemp'
24065 d_mkstemps='$d_mkstemps'
24066 d_mktime64='$d_mktime64'
24067 d_mktime='$d_mktime'
24068 d_mmap='$d_mmap'
24069 d_modfl='$d_modfl'
24070 d_modflproto='$d_modflproto'
24071 d_mprotect='$d_mprotect'
24072 d_msg='$d_msg'
24073 d_msg_ctrunc='$d_msg_ctrunc'
24074 d_msg_dontroute='$d_msg_dontroute'
24075 d_msg_oob='$d_msg_oob'
24076 d_msg_peek='$d_msg_peek'
24077 d_msg_proxy='$d_msg_proxy'
24078 d_msgctl='$d_msgctl'
24079 d_msgget='$d_msgget'
24080 d_msghdr_s='$d_msghdr_s'
24081 d_msgrcv='$d_msgrcv'
24082 d_msgsnd='$d_msgsnd'
24083 d_msync='$d_msync'
24084 d_munmap='$d_munmap'
24085 d_mymalloc='$d_mymalloc'
24086 d_nan='$d_nan'
24087 d_nanosleep='$d_nanosleep'
24088 d_ndbm='$d_ndbm'
24089 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24090 d_nearbyint='$d_nearbyint'
24091 d_newlocale='$d_newlocale'
24092 d_nextafter='$d_nextafter'
24093 d_nexttoward='$d_nexttoward'
24094 d_nice='$d_nice'
24095 d_nl_langinfo='$d_nl_langinfo'
24096 d_nv_preserves_uv='$d_nv_preserves_uv'
24097 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24098 d_off64_t='$d_off64_t'
24099 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24100 d_oldpthreads='$d_oldpthreads'
24101 d_oldsock='$d_oldsock'
24102 d_open3='$d_open3'
24103 d_openat='$d_openat'
24104 d_pathconf='$d_pathconf'
24105 d_pause='$d_pause'
24106 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24107 d_phostname='$d_phostname'
24108 d_pipe2='$d_pipe2'
24109 d_pipe='$d_pipe'
24110 d_poll='$d_poll'
24111 d_portable='$d_portable'
24112 d_prctl='$d_prctl'
24113 d_prctl_set_name='$d_prctl_set_name'
24114 d_printf_format_null='$d_printf_format_null'
24115 d_procselfexe='$d_procselfexe'
24116 d_pseudofork='$d_pseudofork'
24117 d_pthread_atfork='$d_pthread_atfork'
24118 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24119 d_pthread_yield='$d_pthread_yield'
24120 d_ptrdiff_t='$d_ptrdiff_t'
24121 d_pwage='$d_pwage'
24122 d_pwchange='$d_pwchange'
24123 d_pwclass='$d_pwclass'
24124 d_pwcomment='$d_pwcomment'
24125 d_pwexpire='$d_pwexpire'
24126 d_pwgecos='$d_pwgecos'
24127 d_pwpasswd='$d_pwpasswd'
24128 d_pwquota='$d_pwquota'
24129 d_qgcvt='$d_qgcvt'
24130 d_quad='$d_quad'
24131 d_querylocale='$d_querylocale'
24132 d_random_r='$d_random_r'
24133 d_re_comp='$d_re_comp'
24134 d_readdir64_r='$d_readdir64_r'
24135 d_readdir='$d_readdir'
24136 d_readdir_r='$d_readdir_r'
24137 d_readlink='$d_readlink'
24138 d_readv='$d_readv'
24139 d_recvmsg='$d_recvmsg'
24140 d_regcmp='$d_regcmp'
24141 d_regcomp='$d_regcomp'
24142 d_remainder='$d_remainder'
24143 d_remquo='$d_remquo'
24144 d_rename='$d_rename'
24145 d_renameat='$d_renameat'
24146 d_rewinddir='$d_rewinddir'
24147 d_rint='$d_rint'
24148 d_rmdir='$d_rmdir'
24149 d_round='$d_round'
24150 d_sbrkproto='$d_sbrkproto'
24151 d_scalbn='$d_scalbn'
24152 d_scalbnl='$d_scalbnl'
24153 d_sched_yield='$d_sched_yield'
24154 d_scm_rights='$d_scm_rights'
24155 d_seekdir='$d_seekdir'
24156 d_select='$d_select'
24157 d_sem='$d_sem'
24158 d_semctl='$d_semctl'
24159 d_semctl_semid_ds='$d_semctl_semid_ds'
24160 d_semctl_semun='$d_semctl_semun'
24161 d_semget='$d_semget'
24162 d_semop='$d_semop'
24163 d_sendmsg='$d_sendmsg'
24164 d_setegid='$d_setegid'
24165 d_seteuid='$d_seteuid'
24166 d_setgrent='$d_setgrent'
24167 d_setgrent_r='$d_setgrent_r'
24168 d_setgrps='$d_setgrps'
24169 d_sethent='$d_sethent'
24170 d_sethostent_r='$d_sethostent_r'
24171 d_setitimer='$d_setitimer'
24172 d_setlinebuf='$d_setlinebuf'
24173 d_setlocale='$d_setlocale'
24174 d_setlocale_r='$d_setlocale_r'
24175 d_setnent='$d_setnent'
24176 d_setnetent_r='$d_setnetent_r'
24177 d_setpent='$d_setpent'
24178 d_setpgid='$d_setpgid'
24179 d_setpgrp2='$d_setpgrp2'
24180 d_setpgrp='$d_setpgrp'
24181 d_setprior='$d_setprior'
24182 d_setproctitle='$d_setproctitle'
24183 d_setprotoent_r='$d_setprotoent_r'
24184 d_setpwent='$d_setpwent'
24185 d_setpwent_r='$d_setpwent_r'
24186 d_setregid='$d_setregid'
24187 d_setresgid='$d_setresgid'
24188 d_setresuid='$d_setresuid'
24189 d_setreuid='$d_setreuid'
24190 d_setrgid='$d_setrgid'
24191 d_setruid='$d_setruid'
24192 d_setsent='$d_setsent'
24193 d_setservent_r='$d_setservent_r'
24194 d_setsid='$d_setsid'
24195 d_setvbuf='$d_setvbuf'
24196 d_shm='$d_shm'
24197 d_shmat='$d_shmat'
24198 d_shmatprototype='$d_shmatprototype'
24199 d_shmctl='$d_shmctl'
24200 d_shmdt='$d_shmdt'
24201 d_shmget='$d_shmget'
24202 d_sigaction='$d_sigaction'
24203 d_siginfo_si_addr='$d_siginfo_si_addr'
24204 d_siginfo_si_band='$d_siginfo_si_band'
24205 d_siginfo_si_errno='$d_siginfo_si_errno'
24206 d_siginfo_si_fd='$d_siginfo_si_fd'
24207 d_siginfo_si_pid='$d_siginfo_si_pid'
24208 d_siginfo_si_status='$d_siginfo_si_status'
24209 d_siginfo_si_uid='$d_siginfo_si_uid'
24210 d_siginfo_si_value='$d_siginfo_si_value'
24211 d_signbit='$d_signbit'
24212 d_sigprocmask='$d_sigprocmask'
24213 d_sigsetjmp='$d_sigsetjmp'
24214 d_sin6_scope_id='$d_sin6_scope_id'
24215 d_sitearch='$d_sitearch'
24216 d_snprintf='$d_snprintf'
24217 d_sockaddr_in6='$d_sockaddr_in6'
24218 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24219 d_sockatmark='$d_sockatmark'
24220 d_sockatmarkproto='$d_sockatmarkproto'
24221 d_socket='$d_socket'
24222 d_socklen_t='$d_socklen_t'
24223 d_sockpair='$d_sockpair'
24224 d_socks5_init='$d_socks5_init'
24225 d_sqrtl='$d_sqrtl'
24226 d_srand48_r='$d_srand48_r'
24227 d_srandom_r='$d_srandom_r'
24228 d_sresgproto='$d_sresgproto'
24229 d_sresuproto='$d_sresuproto'
24230 d_stat='$d_stat'
24231 d_statblks='$d_statblks'
24232 d_statfs_f_flags='$d_statfs_f_flags'
24233 d_statfs_s='$d_statfs_s'
24234 d_static_inline='$d_static_inline'
24235 d_statvfs='$d_statvfs'
24236 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24237 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24238 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24239 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24240 d_stdio_stream_array='$d_stdio_stream_array'
24241 d_stdiobase='$d_stdiobase'
24242 d_stdstdio='$d_stdstdio'
24243 d_strcoll='$d_strcoll'
24244 d_strerror_l='$d_strerror_l'
24245 d_strerror_r='$d_strerror_r'
24246 d_strftime='$d_strftime'
24247 d_strlcat='$d_strlcat'
24248 d_strlcpy='$d_strlcpy'
24249 d_strnlen='$d_strnlen'
24250 d_strtod='$d_strtod'
24251 d_strtol='$d_strtol'
24252 d_strtold='$d_strtold'
24253 d_strtold_l='$d_strtold_l'
24254 d_strtoll='$d_strtoll'
24255 d_strtoq='$d_strtoq'
24256 d_strtoul='$d_strtoul'
24257 d_strtoull='$d_strtoull'
24258 d_strtouq='$d_strtouq'
24259 d_strxfrm='$d_strxfrm'
24260 d_suidsafe='$d_suidsafe'
24261 d_symlink='$d_symlink'
24262 d_syscall='$d_syscall'
24263 d_syscallproto='$d_syscallproto'
24264 d_sysconf='$d_sysconf'
24265 d_sysernlst='$d_sysernlst'
24266 d_syserrlst='$d_syserrlst'
24267 d_system='$d_system'
24268 d_tcgetpgrp='$d_tcgetpgrp'
24269 d_tcsetpgrp='$d_tcsetpgrp'
24270 d_telldir='$d_telldir'
24271 d_telldirproto='$d_telldirproto'
24272 d_tgamma='$d_tgamma'
24273 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24274 d_time='$d_time'
24275 d_timegm='$d_timegm'
24276 d_times='$d_times'
24277 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24278 d_tm_tm_zone='$d_tm_tm_zone'
24279 d_tmpnam_r='$d_tmpnam_r'
24280 d_trunc='$d_trunc'
24281 d_truncate='$d_truncate'
24282 d_truncl='$d_truncl'
24283 d_ttyname_r='$d_ttyname_r'
24284 d_tzname='$d_tzname'
24285 d_u32align='$d_u32align'
24286 d_ualarm='$d_ualarm'
24287 d_umask='$d_umask'
24288 d_uname='$d_uname'
24289 d_union_semun='$d_union_semun'
24290 d_unlinkat='$d_unlinkat'
24291 d_unordered='$d_unordered'
24292 d_unsetenv='$d_unsetenv'
24293 d_uselocale='$d_uselocale'
24294 d_usleep='$d_usleep'
24295 d_usleepproto='$d_usleepproto'
24296 d_ustat='$d_ustat'
24297 d_vendorarch='$d_vendorarch'
24298 d_vendorbin='$d_vendorbin'
24299 d_vendorlib='$d_vendorlib'
24300 d_vendorscript='$d_vendorscript'
24301 d_vfork='$d_vfork'
24302 d_void_closedir='$d_void_closedir'
24303 d_voidsig='$d_voidsig'
24304 d_voidtty='$d_voidtty'
24305 d_vsnprintf='$d_vsnprintf'
24306 d_wait4='$d_wait4'
24307 d_waitpid='$d_waitpid'
24308 d_wcscmp='$d_wcscmp'
24309 d_wcstombs='$d_wcstombs'
24310 d_wcsxfrm='$d_wcsxfrm'
24311 d_wctomb='$d_wctomb'
24312 d_writev='$d_writev'
24313 d_xenix='$d_xenix'
24314 date='$date'
24315 db_hashtype='$db_hashtype'
24316 db_prefixtype='$db_prefixtype'
24317 db_version_major='$db_version_major'
24318 db_version_minor='$db_version_minor'
24319 db_version_patch='$db_version_patch'
24320 default_inc_excludes_dot='$default_inc_excludes_dot'
24321 direntrytype='$direntrytype'
24322 dlext='$dlext'
24323 dlsrc='$dlsrc'
24324 doubleinfbytes='$doubleinfbytes'
24325 doublekind='$doublekind'
24326 doublemantbits='$doublemantbits'
24327 doublenanbytes='$doublenanbytes'
24328 doublesize='$doublesize'
24329 drand01='$drand01'
24330 drand48_r_proto='$drand48_r_proto'
24331 dtrace='$dtrace'
24332 dtraceobject='$dtraceobject'
24333 dtracexnolibs='$dtracexnolibs'
24334 dynamic_ext='$dynamic_ext'
24335 eagain='$eagain'
24336 ebcdic='$ebcdic'
24337 echo='$echo'
24338 egrep='$egrep'
24339 emacs='$emacs'
24340 endgrent_r_proto='$endgrent_r_proto'
24341 endhostent_r_proto='$endhostent_r_proto'
24342 endnetent_r_proto='$endnetent_r_proto'
24343 endprotoent_r_proto='$endprotoent_r_proto'
24344 endpwent_r_proto='$endpwent_r_proto'
24345 endservent_r_proto='$endservent_r_proto'
24346 eunicefix='$eunicefix'
24347 exe_ext='$exe_ext'
24348 expr='$expr'
24349 extensions='$extensions'
24350 extern_C='$extern_C'
24351 extras='$extras'
24352 fflushNULL='$fflushNULL'
24353 fflushall='$fflushall'
24354 find='$find'
24355 firstmakefile='$firstmakefile'
24356 flex='$flex'
24357 fpossize='$fpossize'
24358 fpostype='$fpostype'
24359 freetype='$freetype'
24360 from='$from'
24361 full_ar='$full_ar'
24362 full_csh='$full_csh'
24363 full_sed='$full_sed'
24364 gccansipedantic='$gccansipedantic'
24365 gccosandvers='$gccosandvers'
24366 gccversion='$gccversion'
24367 getgrent_r_proto='$getgrent_r_proto'
24368 getgrgid_r_proto='$getgrgid_r_proto'
24369 getgrnam_r_proto='$getgrnam_r_proto'
24370 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24371 gethostbyname_r_proto='$gethostbyname_r_proto'
24372 gethostent_r_proto='$gethostent_r_proto'
24373 getlogin_r_proto='$getlogin_r_proto'
24374 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24375 getnetbyname_r_proto='$getnetbyname_r_proto'
24376 getnetent_r_proto='$getnetent_r_proto'
24377 getprotobyname_r_proto='$getprotobyname_r_proto'
24378 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24379 getprotoent_r_proto='$getprotoent_r_proto'
24380 getpwent_r_proto='$getpwent_r_proto'
24381 getpwnam_r_proto='$getpwnam_r_proto'
24382 getpwuid_r_proto='$getpwuid_r_proto'
24383 getservbyname_r_proto='$getservbyname_r_proto'
24384 getservbyport_r_proto='$getservbyport_r_proto'
24385 getservent_r_proto='$getservent_r_proto'
24386 getspnam_r_proto='$getspnam_r_proto'
24387 gidformat='$gidformat'
24388 gidsign='$gidsign'
24389 gidsize='$gidsize'
24390 gidtype='$gidtype'
24391 glibpth='$glibpth'
24392 gmake='$gmake'
24393 gmtime_r_proto='$gmtime_r_proto'
24394 gnulibc_version='$gnulibc_version'
24395 grep='$grep'
24396 groupcat='$groupcat'
24397 groupstype='$groupstype'
24398 gzip='$gzip'
24399 h_fcntl='$h_fcntl'
24400 h_sysfile='$h_sysfile'
24401 hint='$hint'
24402 hostcat='$hostcat'
24403 hostgenerate='$hostgenerate'
24404 hostosname='$hostosname'
24405 hostperl='$hostperl'
24406 html1dir='$html1dir'
24407 html1direxp='$html1direxp'
24408 html3dir='$html3dir'
24409 html3direxp='$html3direxp'
24410 i16size='$i16size'
24411 i16type='$i16type'
24412 i32size='$i32size'
24413 i32type='$i32type'
24414 i64size='$i64size'
24415 i64type='$i64type'
24416 i8size='$i8size'
24417 i8type='$i8type'
24418 i_arpainet='$i_arpainet'
24419 i_bfd='$i_bfd'
24420 i_bsdioctl='$i_bsdioctl'
24421 i_crypt='$i_crypt'
24422 i_db='$i_db'
24423 i_dbm='$i_dbm'
24424 i_dirent='$i_dirent'
24425 i_dlfcn='$i_dlfcn'
24426 i_execinfo='$i_execinfo'
24427 i_fcntl='$i_fcntl'
24428 i_fenv='$i_fenv'
24429 i_fp='$i_fp'
24430 i_fp_class='$i_fp_class'
24431 i_gdbm='$i_gdbm'
24432 i_gdbm_ndbm='$i_gdbm_ndbm'
24433 i_gdbmndbm='$i_gdbmndbm'
24434 i_grp='$i_grp'
24435 i_ieeefp='$i_ieeefp'
24436 i_inttypes='$i_inttypes'
24437 i_langinfo='$i_langinfo'
24438 i_libutil='$i_libutil'
24439 i_locale='$i_locale'
24440 i_machcthr='$i_machcthr'
24441 i_malloc='$i_malloc'
24442 i_mallocmalloc='$i_mallocmalloc'
24443 i_mntent='$i_mntent'
24444 i_ndbm='$i_ndbm'
24445 i_netdb='$i_netdb'
24446 i_neterrno='$i_neterrno'
24447 i_netinettcp='$i_netinettcp'
24448 i_niin='$i_niin'
24449 i_poll='$i_poll'
24450 i_prot='$i_prot'
24451 i_pthread='$i_pthread'
24452 i_pwd='$i_pwd'
24453 i_quadmath='$i_quadmath'
24454 i_rpcsvcdbm='$i_rpcsvcdbm'
24455 i_sgtty='$i_sgtty'
24456 i_shadow='$i_shadow'
24457 i_socks='$i_socks'
24458 i_stdbool='$i_stdbool'
24459 i_stdint='$i_stdint'
24460 i_stdlib='$i_stdlib'
24461 i_sunmath='$i_sunmath'
24462 i_sysaccess='$i_sysaccess'
24463 i_sysdir='$i_sysdir'
24464 i_sysfile='$i_sysfile'
24465 i_sysfilio='$i_sysfilio'
24466 i_sysin='$i_sysin'
24467 i_sysioctl='$i_sysioctl'
24468 i_syslog='$i_syslog'
24469 i_sysmman='$i_sysmman'
24470 i_sysmode='$i_sysmode'
24471 i_sysmount='$i_sysmount'
24472 i_sysndir='$i_sysndir'
24473 i_sysparam='$i_sysparam'
24474 i_syspoll='$i_syspoll'
24475 i_sysresrc='$i_sysresrc'
24476 i_syssecrt='$i_syssecrt'
24477 i_sysselct='$i_sysselct'
24478 i_syssockio='$i_syssockio'
24479 i_sysstat='$i_sysstat'
24480 i_sysstatfs='$i_sysstatfs'
24481 i_sysstatvfs='$i_sysstatvfs'
24482 i_systime='$i_systime'
24483 i_systimek='$i_systimek'
24484 i_systimes='$i_systimes'
24485 i_systypes='$i_systypes'
24486 i_sysuio='$i_sysuio'
24487 i_sysun='$i_sysun'
24488 i_sysutsname='$i_sysutsname'
24489 i_sysvfs='$i_sysvfs'
24490 i_syswait='$i_syswait'
24491 i_termio='$i_termio'
24492 i_termios='$i_termios'
24493 i_time='$i_time'
24494 i_unistd='$i_unistd'
24495 i_ustat='$i_ustat'
24496 i_utime='$i_utime'
24497 i_vfork='$i_vfork'
24498 i_wchar='$i_wchar'
24499 i_xlocale='$i_xlocale'
24500 ignore_versioned_solibs='$ignore_versioned_solibs'
24501 inc_version_list='$inc_version_list'
24502 inc_version_list_init='$inc_version_list_init'
24503 incpath='$incpath'
24504 incpth='$incpth'
24505 inews='$inews'
24506 initialinstalllocation='$initialinstalllocation'
24507 installarchlib='$installarchlib'
24508 installbin='$installbin'
24509 installhtml1dir='$installhtml1dir'
24510 installhtml3dir='$installhtml3dir'
24511 installman1dir='$installman1dir'
24512 installman3dir='$installman3dir'
24513 installprefix='$installprefix'
24514 installprefixexp='$installprefixexp'
24515 installprivlib='$installprivlib'
24516 installscript='$installscript'
24517 installsitearch='$installsitearch'
24518 installsitebin='$installsitebin'
24519 installsitehtml1dir='$installsitehtml1dir'
24520 installsitehtml3dir='$installsitehtml3dir'
24521 installsitelib='$installsitelib'
24522 installsiteman1dir='$installsiteman1dir'
24523 installsiteman3dir='$installsiteman3dir'
24524 installsitescript='$installsitescript'
24525 installstyle='$installstyle'
24526 installusrbinperl='$installusrbinperl'
24527 installvendorarch='$installvendorarch'
24528 installvendorbin='$installvendorbin'
24529 installvendorhtml1dir='$installvendorhtml1dir'
24530 installvendorhtml3dir='$installvendorhtml3dir'
24531 installvendorlib='$installvendorlib'
24532 installvendorman1dir='$installvendorman1dir'
24533 installvendorman3dir='$installvendorman3dir'
24534 installvendorscript='$installvendorscript'
24535 intsize='$intsize'
24536 issymlink='$issymlink'
24537 ivdformat='$ivdformat'
24538 ivsize='$ivsize'
24539 ivtype='$ivtype'
24540 known_extensions='$known_extensions'
24541 ksh='$ksh'
24542 ld='$ld'
24543 ld_can_script='$ld_can_script'
24544 lddlflags='$lddlflags'
24545 ldflags='$ldflags'
24546 ldflags_uselargefiles='$ldflags_uselargefiles'
24547 ldlibpthname='$ldlibpthname'
24548 less='$less'
24549 lib_ext='$lib_ext'
24550 libc='$libc'
24551 libperl='$libperl'
24552 libpth='$libpth'
24553 libs='$libs'
24554 libsdirs='$libsdirs'
24555 libsfiles='$libsfiles'
24556 libsfound='$libsfound'
24557 libspath='$libspath'
24558 libswanted='$libswanted'
24559 libswanted_uselargefiles='$libswanted_uselargefiles'
24560 line='$line'
24561 lint='$lint'
24562 lkflags='$lkflags'
24563 ln='$ln'
24564 lns='$lns'
24565 localtime_r_proto='$localtime_r_proto'
24566 locincpth='$locincpth'
24567 loclibpth='$loclibpth'
24568 longdblinfbytes='$longdblinfbytes'
24569 longdblkind='$longdblkind'
24570 longdblmantbits='$longdblmantbits'
24571 longdblnanbytes='$longdblnanbytes'
24572 longdblsize='$longdblsize'
24573 longlongsize='$longlongsize'
24574 longsize='$longsize'
24575 lp='$lp'
24576 lpr='$lpr'
24577 ls='$ls'
24578 lseeksize='$lseeksize'
24579 lseektype='$lseektype'
24580 mail='$mail'
24581 mailx='$mailx'
24582 make='$make'
24583 make_set_make='$make_set_make'
24584 mallocobj='$mallocobj'
24585 mallocsrc='$mallocsrc'
24586 malloctype='$malloctype'
24587 man1dir='$man1dir'
24588 man1direxp='$man1direxp'
24589 man1ext='$man1ext'
24590 man3dir='$man3dir'
24591 man3direxp='$man3direxp'
24592 man3ext='$man3ext'
24593 mips_type='$mips_type'
24594 mistrustnm='$mistrustnm'
24595 mkdir='$mkdir'
24596 mmaptype='$mmaptype'
24597 modetype='$modetype'
24598 more='$more'
24599 multiarch='$multiarch'
24600 mv='$mv'
24601 myarchname='$myarchname'
24602 mydomain='$mydomain'
24603 myhostname='$myhostname'
24604 myuname='$myuname'
24605 n='$n'
24606 need_va_copy='$need_va_copy'
24607 netdb_hlen_type='$netdb_hlen_type'
24608 netdb_host_type='$netdb_host_type'
24609 netdb_name_type='$netdb_name_type'
24610 netdb_net_type='$netdb_net_type'
24611 nm='$nm'
24612 nm_opt='$nm_opt'
24613 nm_so_opt='$nm_so_opt'
24614 nonxs_ext='$nonxs_ext'
24615 nroff='$nroff'
24616 nvEUformat='$nvEUformat'
24617 nvFUformat='$nvFUformat'
24618 nvGUformat='$nvGUformat'
24619 nv_overflows_integers_at='$nv_overflows_integers_at'
24620 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24621 nveformat='$nveformat'
24622 nvfformat='$nvfformat'
24623 nvgformat='$nvgformat'
24624 nvmantbits='$nvmantbits'
24625 nvsize='$nvsize'
24626 nvtype='$nvtype'
24627 o_nonblock='$o_nonblock'
24628 obj_ext='$obj_ext'
24629 old_pthread_create_joinable='$old_pthread_create_joinable'
24630 optimize='$optimize'
24631 orderlib='$orderlib'
24632 osname='$osname'
24633 osvers='$osvers'
24634 otherlibdirs='$otherlibdirs'
24635 package='$package'
24636 pager='$pager'
24637 passcat='$passcat'
24638 patchlevel='$patchlevel'
24639 path_sep='$path_sep'
24640 perl5='$perl5'
24641 perl='$perl'
24642 perl_patchlevel='$perl_patchlevel'
24643 perl_static_inline='$perl_static_inline'
24644 perladmin='$perladmin'
24645 perllibs='$perllibs'
24646 perlpath='$perlpath'
24647 pg='$pg'
24648 phostname='$phostname'
24649 pidtype='$pidtype'
24650 plibpth='$plibpth'
24651 pmake='$pmake'
24652 pr='$pr'
24653 prefix='$prefix'
24654 prefixexp='$prefixexp'
24655 privlib='$privlib'
24656 privlibexp='$privlibexp'
24657 procselfexe='$procselfexe'
24658 ptrsize='$ptrsize'
24659 quadkind='$quadkind'
24660 quadtype='$quadtype'
24661 randbits='$randbits'
24662 randfunc='$randfunc'
24663 random_r_proto='$random_r_proto'
24664 randseedtype='$randseedtype'
24665 ranlib='$ranlib'
24666 rd_nodata='$rd_nodata'
24667 readdir64_r_proto='$readdir64_r_proto'
24668 readdir_r_proto='$readdir_r_proto'
24669 revision='$revision'
24670 rm='$rm'
24671 rm_try='$rm_try'
24672 rmail='$rmail'
24673 run='$run'
24674 runnm='$runnm'
24675 sGMTIME_max='$sGMTIME_max'
24676 sGMTIME_min='$sGMTIME_min'
24677 sLOCALTIME_max='$sLOCALTIME_max'
24678 sLOCALTIME_min='$sLOCALTIME_min'
24679 sPRIEUldbl='$sPRIEUldbl'
24680 sPRIFUldbl='$sPRIFUldbl'
24681 sPRIGUldbl='$sPRIGUldbl'
24682 sPRIXU64='$sPRIXU64'
24683 sPRId64='$sPRId64'
24684 sPRIeldbl='$sPRIeldbl'
24685 sPRIfldbl='$sPRIfldbl'
24686 sPRIgldbl='$sPRIgldbl'
24687 sPRIi64='$sPRIi64'
24688 sPRIo64='$sPRIo64'
24689 sPRIu64='$sPRIu64'
24690 sPRIx64='$sPRIx64'
24691 sSCNfldbl='$sSCNfldbl'
24692 sched_yield='$sched_yield'
24693 scriptdir='$scriptdir'
24694 scriptdirexp='$scriptdirexp'
24695 sed='$sed'
24696 seedfunc='$seedfunc'
24697 selectminbits='$selectminbits'
24698 selecttype='$selecttype'
24699 sendmail='$sendmail'
24700 setgrent_r_proto='$setgrent_r_proto'
24701 sethostent_r_proto='$sethostent_r_proto'
24702 setlocale_r_proto='$setlocale_r_proto'
24703 setnetent_r_proto='$setnetent_r_proto'
24704 setprotoent_r_proto='$setprotoent_r_proto'
24705 setpwent_r_proto='$setpwent_r_proto'
24706 setservent_r_proto='$setservent_r_proto'
24707 sh='$sh'
24708 shar='$shar'
24709 sharpbang='$sharpbang'
24710 shmattype='$shmattype'
24711 shortsize='$shortsize'
24712 shrpenv='$shrpenv'
24713 shsharp='$shsharp'
24714 sig_count='$sig_count'
24715 sig_name='$sig_name'
24716 sig_name_init='$sig_name_init'
24717 sig_num='$sig_num'
24718 sig_num_init='$sig_num_init'
24719 sig_size='$sig_size'
24720 signal_t='$signal_t'
24721 sitearch='$sitearch'
24722 sitearchexp='$sitearchexp'
24723 sitebin='$sitebin'
24724 sitebinexp='$sitebinexp'
24725 sitehtml1dir='$sitehtml1dir'
24726 sitehtml1direxp='$sitehtml1direxp'
24727 sitehtml3dir='$sitehtml3dir'
24728 sitehtml3direxp='$sitehtml3direxp'
24729 sitelib='$sitelib'
24730 sitelib_stem='$sitelib_stem'
24731 sitelibexp='$sitelibexp'
24732 siteman1dir='$siteman1dir'
24733 siteman1direxp='$siteman1direxp'
24734 siteman3dir='$siteman3dir'
24735 siteman3direxp='$siteman3direxp'
24736 siteprefix='$siteprefix'
24737 siteprefixexp='$siteprefixexp'
24738 sitescript='$sitescript'
24739 sitescriptexp='$sitescriptexp'
24740 sizesize='$sizesize'
24741 sizetype='$sizetype'
24742 sleep='$sleep'
24743 smail='$smail'
24744 so='$so'
24745 sockethdr='$sockethdr'
24746 socketlib='$socketlib'
24747 socksizetype='$socksizetype'
24748 sort='$sort'
24749 spackage='$spackage'
24750 spitshell='$spitshell'
24751 srand48_r_proto='$srand48_r_proto'
24752 srandom_r_proto='$srandom_r_proto'
24753 src='$src'
24754 ssizetype='$ssizetype'
24755 st_ino_sign='$st_ino_sign'
24756 st_ino_size='$st_ino_size'
24757 startperl='$startperl'
24758 startsh='$startsh'
24759 static_ext='$static_ext'
24760 stdchar='$stdchar'
24761 stdio_base='$stdio_base'
24762 stdio_bufsiz='$stdio_bufsiz'
24763 stdio_cnt='$stdio_cnt'
24764 stdio_filbuf='$stdio_filbuf'
24765 stdio_ptr='$stdio_ptr'
24766 stdio_stream_array='$stdio_stream_array'
24767 strerror_r_proto='$strerror_r_proto'
24768 submit='$submit'
24769 subversion='$subversion'
24770 sysman='$sysman'
24771 sysroot='$sysroot'
24772 tail='$tail'
24773 tar='$tar'
24774 targetarch='$targetarch'
24775 targetdir='$targetdir'
24776 targetenv='$targetenv'
24777 targethost='$targethost'
24778 targetmkdir='$targetmkdir'
24779 targetport='$targetport'
24780 targetsh='$targetsh'
24781 tbl='$tbl'
24782 tee='$tee'
24783 test='$test'
24784 timeincl='$timeincl'
24785 timetype='$timetype'
24786 tmpnam_r_proto='$tmpnam_r_proto'
24787 to='$to'
24788 touch='$touch'
24789 tr='$tr'
24790 trnl='$trnl'
24791 troff='$troff'
24792 ttyname_r_proto='$ttyname_r_proto'
24793 u16size='$u16size'
24794 u16type='$u16type'
24795 u32size='$u32size'
24796 u32type='$u32type'
24797 u64size='$u64size'
24798 u64type='$u64type'
24799 u8size='$u8size'
24800 u8type='$u8type'
24801 uidformat='$uidformat'
24802 uidsign='$uidsign'
24803 uidsize='$uidsize'
24804 uidtype='$uidtype'
24805 uname='$uname'
24806 uniq='$uniq'
24807 uquadtype='$uquadtype'
24808 use5005threads='$use5005threads'
24809 use64bitall='$use64bitall'
24810 use64bitint='$use64bitint'
24811 usecbacktrace='$usecbacktrace'
24812 usecrosscompile='$usecrosscompile'
24813 usedevel='$usedevel'
24814 usedl='$usedl'
24815 usedtrace='$usedtrace'
24816 usefaststdio='$usefaststdio'
24817 useithreads='$useithreads'
24818 usekernprocpathname='$usekernprocpathname'
24819 uselargefiles='$uselargefiles'
24820 uselongdouble='$uselongdouble'
24821 usemallocwrap='$usemallocwrap'
24822 usemorebits='$usemorebits'
24823 usemultiplicity='$usemultiplicity'
24824 usemymalloc='$usemymalloc'
24825 usenm='$usenm'
24826 usensgetexecutablepath='$usensgetexecutablepath'
24827 useopcode='$useopcode'
24828 useperlio='$useperlio'
24829 useposix='$useposix'
24830 usequadmath='$usequadmath'
24831 usereentrant='$usereentrant'
24832 userelocatableinc='$userelocatableinc'
24833 useshrplib='$useshrplib'
24834 usesitecustomize='$usesitecustomize'
24835 usesocks='$usesocks'
24836 usethreads='$usethreads'
24837 usevendorprefix='$usevendorprefix'
24838 useversionedarchname='$useversionedarchname'
24839 usevfork='$usevfork'
24840 usrinc='$usrinc'
24841 uuname='$uuname'
24842 uvXUformat='$uvXUformat'
24843 uvoformat='$uvoformat'
24844 uvsize='$uvsize'
24845 uvtype='$uvtype'
24846 uvuformat='$uvuformat'
24847 uvxformat='$uvxformat'
24848 vendorarch='$vendorarch'
24849 vendorarchexp='$vendorarchexp'
24850 vendorbin='$vendorbin'
24851 vendorbinexp='$vendorbinexp'
24852 vendorhtml1dir='$vendorhtml1dir'
24853 vendorhtml1direxp='$vendorhtml1direxp'
24854 vendorhtml3dir='$vendorhtml3dir'
24855 vendorhtml3direxp='$vendorhtml3direxp'
24856 vendorlib='$vendorlib'
24857 vendorlib_stem='$vendorlib_stem'
24858 vendorlibexp='$vendorlibexp'
24859 vendorman1dir='$vendorman1dir'
24860 vendorman1direxp='$vendorman1direxp'
24861 vendorman3dir='$vendorman3dir'
24862 vendorman3direxp='$vendorman3direxp'
24863 vendorprefix='$vendorprefix'
24864 vendorprefixexp='$vendorprefixexp'
24865 vendorscript='$vendorscript'
24866 vendorscriptexp='$vendorscriptexp'
24867 version='$version'
24868 version_patchlevel_string='$version_patchlevel_string'
24869 versiononly='$versiononly'
24870 vi='$vi'
24871 xlibpth='$xlibpth'
24872 yacc='$yacc'
24873 yaccflags='$yaccflags'
24874 zcat='$zcat'
24875 zip='$zip'
24876 EOT
24877
24878 : add special variables
24879 $test -f $src/patchlevel.h && \
24880 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24881 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24882 echo "PERL_CONFIG_SH=true" >>config.sh
24883
24884 : propagate old symbols
24885 if $test -f UU/config.sh; then
24886         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24887         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24888                 config.sh config.sh UU/oldconfig.sh |\
24889                 $sort | $uniq -u >UU/oldsyms
24890         set X `$cat UU/oldsyms`
24891         shift
24892         case $# in
24893         0) ;;
24894         *)
24895                 $cat <<EOM
24896 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24897 EOM
24898                 echo ": Variables propagated from previous config.sh file." >>config.sh
24899                 for sym in `$cat UU/oldsyms`; do
24900                         echo "    Propagating $hint variable "'$'"$sym..."
24901                         eval 'tmp="$'"${sym}"'"'
24902                         echo "$tmp" | \
24903                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24904                 done
24905                 ;;
24906         esac
24907 fi
24908
24909 : preserve RCS keywords in files with variable substitution, grrr
24910 Id='$Id'
24911
24912 : Finish up by extracting the .SH files
24913 case "$alldone" in
24914 exit)
24915         echo "Stopping at your request, leaving temporary files around."
24916         exit 0
24917         ;;
24918 cont)
24919         ;;
24920 '')
24921         dflt=''
24922         nostick=true
24923         $cat <<EOM
24924
24925 If you'd like to make any changes to the config.sh file before I begin
24926 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24927
24928 EOM
24929         rp="Press return or use a shell escape to edit config.sh:"
24930         . UU/myread
24931         nostick=''
24932         case "$ans" in
24933         '') ;;
24934         *) : in case they cannot read
24935                 sh 1>&4 -c "$ans";;
24936         esac
24937         ;;
24938 esac
24939
24940 : if this fails, just run all the .SH files by hand
24941 . ./config.sh
24942
24943 echo " "
24944 exec 1>&4
24945 pwd=`pwd`
24946 . ./UU/extract
24947 cd "$pwd"
24948
24949 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24950         dflt=y
24951         case "$silent" in
24952         true) ;;
24953         *)
24954                 $cat <<EOM
24955
24956 Now you need to generate make dependencies by running "$make depend".
24957 You might prefer to run it in background: "$make depend > makedepend.out &"
24958 It can take a while, so you might not want to run it right now.
24959
24960 EOM
24961                 ;;
24962         esac
24963         rp="Run $make depend now?"
24964         . UU/myread
24965         case "$ans" in
24966         y*)
24967                 $make depend && echo "Now you must run '$make'."
24968                 ;;
24969         *)
24970                 echo "You must run '$make depend' then '$make'."
24971                 ;;
24972         esac
24973 elif test -f [Mm]akefile; then
24974         echo " "
24975         echo "Now you must run a $make."
24976 else
24977         echo "Configure done."
24978 fi
24979
24980 if $test -f Policy.sh; then
24981     $cat <<EOM
24982
24983 If you compile $package on a different machine or from a different object
24984 directory, copy the Policy.sh file from this object directory to the
24985 new one before you run Configure -- this will help you with most of
24986 the policy defaults.
24987
24988 EOM
24989 fi
24990 if $test -f UU/config.msg; then
24991     echo "Hmm.  I also noted the following information while running:"
24992     echo " "
24993     $cat UU/config.msg >&4
24994 fi
24995 $rm -f kit*isdone ark*isdone
24996 $rm -rf UU
24997
24998 : End of Configure
24999