This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
5.26.2 today
[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 usei18n_lang=''
233 useopcode=''
234 useposix=''
235 extras=''
236 d_bsd=''
237 d_eunice=''
238 d_xenix=''
239 eunicefix=''
240 ar=''
241 awk=''
242 bash=''
243 bison=''
244 byacc=''
245 cat=''
246 chgrp=''
247 chmod=''
248 chown=''
249 comm=''
250 compress=''
251 cp=''
252 cpio=''
253 cpp=''
254 csh=''
255 date=''
256 echo=''
257 egrep=''
258 emacs=''
259 expr=''
260 find=''
261 flex=''
262 gmake=''
263 grep=''
264 gzip=''
265 inews=''
266 ksh=''
267 less=''
268 line=''
269 lint=''
270 ln=''
271 lp=''
272 lpr=''
273 ls=''
274 mail=''
275 mailx=''
276 make=''
277 mkdir=''
278 more=''
279 mv=''
280 nm=''
281 nroff=''
282 perl=''
283 pg=''
284 pmake=''
285 pr=''
286 rm=''
287 rmail=''
288 sed=''
289 sendmail=''
290 shar=''
291 sleep=''
292 smail=''
293 sort=''
294 submit=''
295 tail=''
296 tar=''
297 tbl=''
298 tee=''
299 test=''
300 touch=''
301 tr=''
302 troff=''
303 uname=''
304 uniq=''
305 uuname=''
306 vi=''
307 zcat=''
308 zip=''
309 full_ar=''
310 full_sed=''
311 libswanted=''
312 hint=''
313 myuname=''
314 osname=''
315 osvers=''
316 Author=''
317 Date=''
318 Header=''
319 Id=''
320 Locker=''
321 Log=''
322 RCSfile=''
323 Revision=''
324 Source=''
325 State=''
326 sysroot=''
327 _a=''
328 _exe=''
329 _o=''
330 archobjs=''
331 exe_ext=''
332 firstmakefile=''
333 lib_ext=''
334 obj_ext=''
335 path_sep=''
336 rm_try=''
337 afs=''
338 afsroot=''
339 alignbytes=''
340 archlib=''
341 archlibexp=''
342 d_archlib=''
343 installarchlib=''
344 archname=''
345 myarchname=''
346 useversionedarchname=''
347 d_atolf=''
348 d_atoll=''
349 baserev=''
350 bin=''
351 binexp=''
352 initialinstalllocation=''
353 installbin=''
354 userelocatableinc=''
355 byteorder=''
356 cc=''
357 ccflags=''
358 cppflags=''
359 ldflags=''
360 lkflags=''
361 locincpth=''
362 optimize=''
363 cf_email=''
364 cf_by=''
365 cf_time=''
366 charbits=''
367 charsize=''
368 contains=''
369 cpp_stuff=''
370 cpplast=''
371 cppminus=''
372 cpprun=''
373 cppstdin=''
374 d__fwalk=''
375 d_accept4=''
376 d_access=''
377 d_accessx=''
378 d_acosh=''
379 d_aintl=''
380 d_alarm=''
381 asctime_r_proto=''
382 d_asctime_r=''
383 d_asinh=''
384 d_atanh=''
385 d_attribute_deprecated=''
386 d_attribute_format=''
387 d_attribute_malloc=''
388 d_attribute_nonnull=''
389 d_attribute_noreturn=''
390 d_attribute_pure=''
391 d_attribute_unused=''
392 d_attribute_warn_unused_result=''
393 d_printf_format_null=''
394 d_backtrace=''
395 d_builtin_choose_expr=''
396 d_builtin_expect=''
397 d_builtin_add_overflow=''
398 d_builtin_mul_overflow=''
399 d_builtin_sub_overflow=''
400 d_c99_variadic_macros=''
401 d_casti32=''
402 castflags=''
403 d_castneg=''
404 d_cbrt=''
405 d_chown=''
406 d_chroot=''
407 d_chsize=''
408 d_class=''
409 d_clearenv=''
410 d_closedir=''
411 d_void_closedir=''
412 d_cmsghdr_s=''
413 d_const=''
414 d_copysign=''
415 d_copysignl=''
416 d_cplusplus=''
417 cryptlib=''
418 d_crypt=''
419 crypt_r_proto=''
420 d_crypt_r=''
421 d_csh=''
422 full_csh=''
423 d_ctermid=''
424 ctermid_r_proto=''
425 d_ctermid_r=''
426 ctime_r_proto=''
427 d_ctime_r=''
428 d_cuserid=''
429 d_dbminitproto=''
430 d_difftime=''
431 d_dir_dd_fd=''
432 d_dirfd=''
433 d_dladdr=''
434 d_dlerror=''
435 d_dlopen=''
436 d_dlsymun=''
437 d_dosuid=''
438 d_suidsafe=''
439 d_drand48_r=''
440 drand48_r_proto=''
441 d_drand48proto=''
442 d_dup2=''
443 d_dup3=''
444 d_eaccess=''
445 d_endgrent=''
446 d_endgrent_r=''
447 endgrent_r_proto=''
448 d_endhent=''
449 d_endhostent_r=''
450 endhostent_r_proto=''
451 d_endnent=''
452 d_endnetent_r=''
453 endnetent_r_proto=''
454 d_endpent=''
455 d_endprotoent_r=''
456 endprotoent_r_proto=''
457 d_endpwent=''
458 d_endpwent_r=''
459 endpwent_r_proto=''
460 d_endsent=''
461 d_endservent_r=''
462 endservent_r_proto=''
463 d_erf=''
464 d_erfc=''
465 d_exp2=''
466 d_expm1=''
467 d_faststdio=''
468 d_fchdir=''
469 d_fchmod=''
470 d_fchown=''
471 d_fcntl=''
472 d_fcntl_can_lock=''
473 d_fd_macros=''
474 d_fd_set=''
475 d_fds_bits=''
476 d_fdclose=''
477 d_fdim=''
478 d_fegetround=''
479 d_fgetpos=''
480 d_finite=''
481 d_finitel=''
482 d_flexfnam=''
483 d_flock=''
484 d_flockproto=''
485 d_fma=''
486 d_fmax=''
487 d_fmin=''
488 d_fork=''
489 d_fp_class=''
490 d_fp_classl=''
491 d_fpclass=''
492 d_fp_classify=''
493 d_fpclassify=''
494 d_fpclassl=''
495 d_fpgetround=''
496 d_fpos64_t=''
497 d_frexpl=''
498 d_fs_data_s=''
499 d_fchmodat=''
500 d_linkat=''
501 d_openat=''
502 d_renameat=''
503 d_unlinkat=''
504 d_fseeko=''
505 d_fsetpos=''
506 d_fstatfs=''
507 d_fsync=''
508 d_ftello=''
509 d_ftime=''
510 d_gettimeod=''
511 d_futimes=''
512 d_gai_strerror=''
513 d_Gconvert=''
514 d_getaddrinfo=''
515 d_getcwd=''
516 d_getespwnam=''
517 d_getfsstat=''
518 d_getgrent=''
519 d_getgrent_r=''
520 getgrent_r_proto=''
521 d_getgrgid_r=''
522 getgrgid_r_proto=''
523 d_getgrnam_r=''
524 getgrnam_r_proto=''
525 d_getgrps=''
526 d_gethbyaddr=''
527 d_gethbyname=''
528 d_gethent=''
529 aphostname=''
530 d_gethname=''
531 d_phostname=''
532 d_uname=''
533 d_gethostbyaddr_r=''
534 gethostbyaddr_r_proto=''
535 d_gethostbyname_r=''
536 gethostbyname_r_proto=''
537 d_gethostent_r=''
538 gethostent_r_proto=''
539 d_gethostprotos=''
540 d_getitimer=''
541 d_getlogin=''
542 d_getlogin_r=''
543 getlogin_r_proto=''
544 d_getmnt=''
545 d_getmntent=''
546 d_getnameinfo=''
547 d_getnbyaddr=''
548 d_getnbyname=''
549 d_getnent=''
550 d_getnetbyaddr_r=''
551 getnetbyaddr_r_proto=''
552 d_getnetbyname_r=''
553 getnetbyname_r_proto=''
554 d_getnetent_r=''
555 getnetent_r_proto=''
556 d_getnetprotos=''
557 d_getpagsz=''
558 d_getpent=''
559 d_getpgid=''
560 d_getpgrp2=''
561 d_bsdgetpgrp=''
562 d_getpgrp=''
563 d_getppid=''
564 d_getprior=''
565 d_getpbyname=''
566 d_getpbynumber=''
567 d_getprotobyname_r=''
568 getprotobyname_r_proto=''
569 d_getprotobynumber_r=''
570 getprotobynumber_r_proto=''
571 d_getprotoent_r=''
572 getprotoent_r_proto=''
573 d_getprotoprotos=''
574 d_getprpwnam=''
575 d_getpwent=''
576 d_getpwent_r=''
577 getpwent_r_proto=''
578 d_getpwnam_r=''
579 getpwnam_r_proto=''
580 d_getpwuid_r=''
581 getpwuid_r_proto=''
582 d_getsent=''
583 d_getservbyname_r=''
584 getservbyname_r_proto=''
585 d_getservbyport_r=''
586 getservbyport_r_proto=''
587 d_getservent_r=''
588 getservent_r_proto=''
589 d_getservprotos=''
590 d_getspnam=''
591 d_getspnam_r=''
592 getspnam_r_proto=''
593 d_getsbyname=''
594 d_getsbyport=''
595 d_gmtime_r=''
596 gmtime_r_proto=''
597 d_gnulibc=''
598 gnulibc_version=''
599 d_hasmntopt=''
600 d_htonl=''
601 d_hypot=''
602 d_ilogb=''
603 d_ilogbl=''
604 d_inetaton=''
605 d_inetntop=''
606 d_inetpton=''
607 d_int64_t=''
608 d_isascii=''
609 d_isblank=''
610 d_isfinite=''
611 d_isfinitel=''
612 d_isinf=''
613 d_isinfl=''
614 d_isless=''
615 d_isnan=''
616 d_isnanl=''
617 d_isnormal=''
618 d_j0=''
619 d_j0l=''
620 d_killpg=''
621 d_lc_monetary_2008=''
622 d_lchown=''
623 d_ldbl_dig=''
624 d_lgamma=''
625 d_lgamma_r=''
626 d_libm_lib_version=''
627 d_link=''
628 d_llrint=''
629 d_llrintl=''
630 d_llround=''
631 d_llroundl=''
632 d_localeconv_l=''
633 d_localtime_r=''
634 d_localtime_r_needs_tzset=''
635 localtime_r_proto=''
636 d_locconv=''
637 d_lockf=''
638 d_log1p=''
639 d_log2=''
640 d_logb=''
641 d_ldexpl=''
642 d_long_double_style_ieee=''
643 d_long_double_style_ieee_doubledouble=''
644 d_long_double_style_ieee_extended=''
645 d_long_double_style_ieee_std=''
646 d_long_double_style_vax=''
647 d_longdbl=''
648 longdblkind=''
649 longdblsize=''
650 d_longlong=''
651 longlongsize=''
652 d_lrint=''
653 d_lrintl=''
654 d_lround=''
655 d_lroundl=''
656 d_lseekproto=''
657 d_lstat=''
658 d_madvise=''
659 d_malloc_good_size=''
660 d_malloc_size=''
661 d_mblen=''
662 d_mbrlen=''
663 d_mbrtowc=''
664 d_mbstowcs=''
665 d_mbtowc=''
666 d_memmem=''
667 d_memrchr=''
668 d_mkdir=''
669 d_mkdtemp=''
670 d_mkfifo=''
671 d_mkostemp=''
672 d_mkstemp=''
673 d_mkstemps=''
674 d_mktime=''
675 d_mmap=''
676 mmaptype=''
677 d_modfl=''
678 d_modflproto=''
679 d_mprotect=''
680 d_msg=''
681 d_msgctl=''
682 d_msgget=''
683 d_msghdr_s=''
684 d_msgrcv=''
685 d_msgsnd=''
686 d_msync=''
687 d_munmap=''
688 d_nan=''
689 d_nanosleep=''
690 d_nearbyint=''
691 d_duplocale=''
692 d_freelocale=''
693 d_newlocale=''
694 d_querylocale=''
695 d_uselocale=''
696 i_xlocale=''
697 d_nextafter=''
698 d_nexttoward=''
699 d_nice=''
700 d_nl_langinfo=''
701 d_thread_safe_nl_langinfo_l=''
702 d_off64_t=''
703 d_open3=''
704 d_fpathconf=''
705 d_pathconf=''
706 d_pause=''
707 d_pipe2=''
708 d_pipe=''
709 d_poll=''
710 d_portable=''
711 d_prctl=''
712 d_prctl_set_name=''
713 d_procselfexe=''
714 procselfexe=''
715 d_old_pthread_create_joinable=''
716 old_pthread_create_joinable=''
717 d_pthread_atfork=''
718 d_pthread_attr_setscope=''
719 d_pthread_yield=''
720 d_sched_yield=''
721 sched_yield=''
722 d_ptrdiff_t=''
723 d_qgcvt=''
724 d_random_r=''
725 random_r_proto=''
726 d_readdir64_r=''
727 readdir64_r_proto=''
728 d_readdir=''
729 d_rewinddir=''
730 d_seekdir=''
731 d_telldir=''
732 d_readdir_r=''
733 readdir_r_proto=''
734 d_readlink=''
735 d_readv=''
736 d_recvmsg=''
737 d_re_comp=''
738 d_regcmp=''
739 d_regcomp=''
740 d_remainder=''
741 d_remquo=''
742 d_rename=''
743 d_rint=''
744 d_rmdir=''
745 d_round=''
746 d_sbrkproto=''
747 d_scalbn=''
748 d_scalbnl=''
749 d_select=''
750 d_sem=''
751 d_semctl=''
752 d_semget=''
753 d_semop=''
754 d_sendmsg=''
755 d_setegid=''
756 d_seteuid=''
757 d_setgrent=''
758 d_setgrent_r=''
759 setgrent_r_proto=''
760 d_setgrps=''
761 d_sethent=''
762 d_sethostent_r=''
763 sethostent_r_proto=''
764 d_setitimer=''
765 d_setlinebuf=''
766 d_setlocale=''
767 d_setlocale_r=''
768 setlocale_r_proto=''
769 d_setnent=''
770 d_setnetent_r=''
771 setnetent_r_proto=''
772 d_setpent=''
773 d_setpgid=''
774 d_setpgrp2=''
775 d_bsdsetpgrp=''
776 d_setpgrp=''
777 d_setprior=''
778 d_setproctitle=''
779 d_setprotoent_r=''
780 setprotoent_r_proto=''
781 d_setpwent=''
782 d_setpwent_r=''
783 setpwent_r_proto=''
784 d_setregid=''
785 d_setresgid=''
786 d_setresuid=''
787 d_setreuid=''
788 d_setrgid=''
789 d_setruid=''
790 d_setsent=''
791 d_setservent_r=''
792 setservent_r_proto=''
793 d_setsid=''
794 d_setvbuf=''
795 d_shm=''
796 d_shmat=''
797 d_shmatprototype=''
798 shmattype=''
799 d_shmctl=''
800 d_shmdt=''
801 d_shmget=''
802 d_sigaction=''
803 d_siginfo_si_addr=''
804 d_siginfo_si_band=''
805 d_siginfo_si_errno=''
806 d_siginfo_si_fd=''
807 d_siginfo_si_pid=''
808 d_siginfo_si_status=''
809 d_siginfo_si_uid=''
810 d_siginfo_si_value=''
811 d_signbit=''
812 d_sigprocmask=''
813 d_sigsetjmp=''
814 usesitecustomize=''
815 d_snprintf=''
816 d_vsnprintf=''
817 d_sockatmark=''
818 d_sockatmarkproto=''
819 d_ip_mreq=''
820 d_ip_mreq_source=''
821 d_ipv6_mreq=''
822 d_ipv6_mreq_source=''
823 d_msg_ctrunc=''
824 d_msg_dontroute=''
825 d_msg_oob=''
826 d_msg_peek=''
827 d_msg_proxy=''
828 d_oldsock=''
829 d_scm_rights=''
830 d_sin6_scope_id=''
831 d_sockaddr_in6=''
832 d_sockaddr_sa_len=''
833 d_socket=''
834 d_sockpair=''
835 sockethdr=''
836 socketlib=''
837 d_socklen_t=''
838 d_socks5_init=''
839 d_sqrtl=''
840 d_srand48_r=''
841 srand48_r_proto=''
842 d_srandom_r=''
843 srandom_r_proto=''
844 d_sresgproto=''
845 d_sresuproto=''
846 d_stat=''
847 d_statblks=''
848 d_statfs_f_flags=''
849 d_statfs_s=''
850 d_static_inline=''
851 perl_static_inline=''
852 d_fstatvfs=''
853 d_statvfs=''
854 d_stdio_cnt_lval=''
855 d_stdio_ptr_lval=''
856 d_stdio_ptr_lval_nochange_cnt=''
857 d_stdio_ptr_lval_sets_cnt=''
858 d_stdiobase=''
859 d_stdstdio=''
860 stdio_base=''
861 stdio_bufsiz=''
862 stdio_cnt=''
863 stdio_filbuf=''
864 stdio_ptr=''
865 d_strcoll=''
866 d_sysernlst=''
867 d_syserrlst=''
868 d_strerror_l=''
869 d_strerror_r=''
870 strerror_r_proto=''
871 d_strftime=''
872 d_strlcat=''
873 d_strlcpy=''
874 d_strnlen=''
875 d_strtod=''
876 d_strtol=''
877 d_strtold=''
878 d_strtold_l=''
879 d_strtoll=''
880 d_strtoq=''
881 d_strtoul=''
882 d_strtoull=''
883 d_strtouq=''
884 d_strxfrm=''
885 d_symlink=''
886 d_syscall=''
887 d_syscallproto=''
888 d_sysconf=''
889 d_system=''
890 d_tcgetpgrp=''
891 d_tcsetpgrp=''
892 d_telldirproto=''
893 d_tgamma=''
894 d_time=''
895 timetype=''
896 d_asctime64=''
897 d_ctime64=''
898 d_difftime64=''
899 d_gmtime64=''
900 d_localtime64=''
901 d_mktime64=''
902 d_timegm=''
903 clocktype=''
904 d_times=''
905 d_tmpnam_r=''
906 tmpnam_r_proto=''
907 d_trunc=''
908 d_truncate=''
909 d_truncl=''
910 d_ttyname_r=''
911 ttyname_r_proto=''
912 d_tzname=''
913 d_u32align=''
914 d_ualarm=''
915 d_umask=''
916 d_semctl_semid_ds=''
917 d_semctl_semun=''
918 d_union_semun=''
919 d_unordered=''
920 d_unsetenv=''
921 d_usleep=''
922 d_usleepproto=''
923 d_ustat=''
924 d_pseudofork=''
925 d_vfork=''
926 usevfork=''
927 d_voidsig=''
928 signal_t=''
929 d_wait4=''
930 d_waitpid=''
931 d_wcscmp=''
932 d_wcstombs=''
933 d_wcsxfrm=''
934 d_wctomb=''
935 d_writev=''
936 default_inc_excludes_dot=''
937 dlext=''
938 bin_ELF=''
939 cccdlflags=''
940 ccdlflags=''
941 dlsrc=''
942 ld=''
943 ld_can_script=''
944 lddlflags=''
945 usedl=''
946 doublesize=''
947 dtraceobject=''
948 dtracexnolibs=''
949 ebcdic=''
950 fflushNULL=''
951 fflushall=''
952 fpossize=''
953 fpostype=''
954 gccansipedantic=''
955 gccosandvers=''
956 gccversion=''
957 gidformat=''
958 gidsign=''
959 gidsize=''
960 gidtype=''
961 groupstype=''
962 h_fcntl=''
963 h_sysfile=''
964 html1dir=''
965 html1direxp=''
966 installhtml1dir=''
967 html3dir=''
968 html3direxp=''
969 installhtml3dir=''
970 i_arpainet=''
971 i_bfd=''
972 i_crypt=''
973 db_hashtype=''
974 db_prefixtype=''
975 db_version_major=''
976 db_version_minor=''
977 db_version_patch=''
978 i_db=''
979 i_dbm=''
980 i_rpcsvcdbm=''
981 d_dirnamlen=''
982 direntrytype=''
983 i_dirent=''
984 i_dlfcn=''
985 i_execinfo=''
986 i_fcntl=''
987 i_fenv=''
988 i_fp=''
989 i_fp_class=''
990 i_gdbm=''
991 d_grpasswd=''
992 i_grp=''
993 i_ieeefp=''
994 i_inttypes=''
995 i_langinfo=''
996 i_libutil=''
997 i_locale=''
998 i_machcthr=''
999 i_malloc=''
1000 i_mallocmalloc=''
1001 i_mntent=''
1002 d_gdbm_ndbm_h_uses_prototypes=''
1003 d_gdbmndbm_h_uses_prototypes=''
1004 d_ndbm=''
1005 d_ndbm_h_uses_prototypes=''
1006 i_gdbm_ndbm=''
1007 i_gdbmndbm=''
1008 i_ndbm=''
1009 i_netdb=''
1010 i_neterrno=''
1011 i_netinettcp=''
1012 i_niin=''
1013 i_sysin=''
1014 i_poll=''
1015 i_prot=''
1016 i_pthread=''
1017 d_pwage=''
1018 d_pwchange=''
1019 d_pwclass=''
1020 d_pwcomment=''
1021 d_pwexpire=''
1022 d_pwgecos=''
1023 d_pwpasswd=''
1024 d_pwquota=''
1025 i_pwd=''
1026 i_quadmath=''
1027 i_shadow=''
1028 i_socks=''
1029 i_stdbool=''
1030 i_stdint=''
1031 i_stdlib=''
1032 i_sunmath=''
1033 i_sysaccess=''
1034 i_sysdir=''
1035 i_sysfile=''
1036 d_voidtty=''
1037 i_bsdioctl=''
1038 i_sysfilio=''
1039 i_sysioctl=''
1040 i_syssockio=''
1041 i_syslog=''
1042 i_sysmman=''
1043 i_sysmode=''
1044 i_sysmount=''
1045 i_sysndir=''
1046 i_sysparam=''
1047 i_syspoll=''
1048 i_sysresrc=''
1049 i_syssecrt=''
1050 i_sysselct=''
1051 i_sysstat=''
1052 i_sysstatfs=''
1053 i_sysstatvfs=''
1054 i_systimes=''
1055 i_systypes=''
1056 i_sysuio=''
1057 i_sysun=''
1058 i_sysutsname=''
1059 i_sysvfs=''
1060 i_syswait=''
1061 i_sgtty=''
1062 i_termio=''
1063 i_termios=''
1064 d_tm_tm_gmtoff=''
1065 d_tm_tm_zone=''
1066 i_systime=''
1067 i_systimek=''
1068 i_time=''
1069 timeincl=''
1070 i_unistd=''
1071 i_ustat=''
1072 i_utime=''
1073 i_vfork=''
1074 i_wchar=''
1075 d_inc_version_list=''
1076 inc_version_list=''
1077 inc_version_list_init=''
1078 doubleinfbytes=''
1079 doublenanbytes=''
1080 longdblinfbytes=''
1081 longdblnanbytes=''
1082 installprefix=''
1083 installprefixexp=''
1084 installstyle=''
1085 installusrbinperl=''
1086 intsize=''
1087 longsize=''
1088 shortsize=''
1089 issymlink=''
1090 libc=''
1091 ldlibpthname=''
1092 libperl=''
1093 shrpenv=''
1094 useshrplib=''
1095 glibpth=''
1096 incpth=''
1097 libpth=''
1098 loclibpth=''
1099 plibpth=''
1100 xlibpth=''
1101 ignore_versioned_solibs=''
1102 libs=''
1103 libsdirs=''
1104 libsfiles=''
1105 libsfound=''
1106 libspath=''
1107 lns=''
1108 d_PRIEUldbl=''
1109 d_PRIFUldbl=''
1110 d_PRIGUldbl=''
1111 d_PRIeldbl=''
1112 d_PRIfldbl=''
1113 d_PRIgldbl=''
1114 d_SCNfldbl=''
1115 d_double_has_inf=''
1116 d_double_has_nan=''
1117 d_double_has_negative_zero=''
1118 d_double_has_subnormals=''
1119 d_double_style_cray=''
1120 d_double_style_ibm=''
1121 d_double_style_ieee=''
1122 d_double_style_vax=''
1123 doublekind=''
1124 sPRIEUldbl=''
1125 sPRIFUldbl=''
1126 sPRIGUldbl=''
1127 sPRIeldbl=''
1128 sPRIfldbl=''
1129 sPRIgldbl=''
1130 sSCNfldbl=''
1131 lseeksize=''
1132 lseektype=''
1133 make_set_make=''
1134 d_mymalloc=''
1135 freetype=''
1136 mallocobj=''
1137 mallocsrc=''
1138 malloctype=''
1139 usemallocwrap=''
1140 usemymalloc=''
1141 installman1dir=''
1142 man1dir=''
1143 man1direxp=''
1144 man1ext=''
1145 installman3dir=''
1146 man3dir=''
1147 man3direxp=''
1148 man3ext=''
1149 doublemantbits=''
1150 longdblmantbits=''
1151 nvmantbits=''
1152 modetype=''
1153 multiarch=''
1154 mydomain=''
1155 myhostname=''
1156 phostname=''
1157 c=''
1158 n=''
1159 d_eofnblk=''
1160 eagain=''
1161 o_nonblock=''
1162 rd_nodata=''
1163 need_va_copy=''
1164 netdb_hlen_type=''
1165 netdb_host_type=''
1166 netdb_name_type=''
1167 netdb_net_type=''
1168 groupcat=''
1169 hostcat=''
1170 passcat=''
1171 orderlib=''
1172 ranlib=''
1173 d_perl_otherlibdirs=''
1174 otherlibdirs=''
1175 package=''
1176 spackage=''
1177 pager=''
1178 api_revision=''
1179 api_subversion=''
1180 api_version=''
1181 api_versionstring=''
1182 patchlevel=''
1183 perl_patchlevel=''
1184 revision=''
1185 subversion=''
1186 version=''
1187 version_patchlevel_string=''
1188 perl5=''
1189 perladmin=''
1190 perlpath=''
1191 d_nv_preserves_uv=''
1192 d_nv_zero_is_allbits_zero=''
1193 i16size=''
1194 i16type=''
1195 i32size=''
1196 i32type=''
1197 i64size=''
1198 i64type=''
1199 i8size=''
1200 i8type=''
1201 ivsize=''
1202 ivtype=''
1203 nv_overflows_integers_at=''
1204 nv_preserves_uv_bits=''
1205 nvsize=''
1206 nvtype=''
1207 u16size=''
1208 u16type=''
1209 u32size=''
1210 u32type=''
1211 u64size=''
1212 u64type=''
1213 u8size=''
1214 u8type=''
1215 uvsize=''
1216 uvtype=''
1217 ivdformat=''
1218 nvEUformat=''
1219 nvFUformat=''
1220 nvGUformat=''
1221 nveformat=''
1222 nvfformat=''
1223 nvgformat=''
1224 uvXUformat=''
1225 uvoformat=''
1226 uvuformat=''
1227 uvxformat=''
1228 pidtype=''
1229 prefix=''
1230 prefixexp=''
1231 installprivlib=''
1232 privlib=''
1233 privlibexp=''
1234 ptrsize=''
1235 d_PRIXU64=''
1236 d_PRId64=''
1237 d_PRIi64=''
1238 d_PRIo64=''
1239 d_PRIu64=''
1240 d_PRIx64=''
1241 sPRIXU64=''
1242 sPRId64=''
1243 sPRIi64=''
1244 sPRIo64=''
1245 sPRIu64=''
1246 sPRIx64=''
1247 d_quad=''
1248 quadkind=''
1249 quadtype=''
1250 uquadtype=''
1251 drand01=''
1252 randbits=''
1253 randfunc=''
1254 randseedtype=''
1255 seedfunc=''
1256 installscript=''
1257 scriptdir=''
1258 scriptdirexp=''
1259 selectminbits=''
1260 selecttype=''
1261 sh=''
1262 targetsh=''
1263 sig_count=''
1264 sig_name=''
1265 sig_name_init=''
1266 sig_num=''
1267 sig_num_init=''
1268 sig_size=''
1269 d_sitearch=''
1270 installsitearch=''
1271 sitearch=''
1272 sitearchexp=''
1273 installsitebin=''
1274 sitebin=''
1275 sitebinexp=''
1276 installsitehtml1dir=''
1277 sitehtml1dir=''
1278 sitehtml1direxp=''
1279 installsitehtml3dir=''
1280 sitehtml3dir=''
1281 sitehtml3direxp=''
1282 installsitelib=''
1283 sitelib=''
1284 sitelib_stem=''
1285 sitelibexp=''
1286 installsiteman1dir=''
1287 siteman1dir=''
1288 siteman1direxp=''
1289 installsiteman3dir=''
1290 siteman3dir=''
1291 siteman3direxp=''
1292 siteprefix=''
1293 siteprefixexp=''
1294 installsitescript=''
1295 sitescript=''
1296 sitescriptexp=''
1297 sizesize=''
1298 sizetype=''
1299 d_libname_unique=''
1300 so=''
1301 socksizetype=''
1302 sharpbang=''
1303 shsharp=''
1304 spitshell=''
1305 src=''
1306 ssizetype=''
1307 st_ino_sign=''
1308 st_ino_size=''
1309 startperl=''
1310 startsh=''
1311 stdchar=''
1312 d_stdio_stream_array=''
1313 stdio_stream_array=''
1314 sysman=''
1315 sGMTIME_max=''
1316 sGMTIME_min=''
1317 sLOCALTIME_max=''
1318 sLOCALTIME_min=''
1319 trnl=''
1320 uidformat=''
1321 uidsign=''
1322 uidsize=''
1323 uidtype=''
1324 archname64=''
1325 use64bitall=''
1326 use64bitint=''
1327 usecbacktrace=''
1328 dtrace=''
1329 usedtrace=''
1330 usefaststdio=''
1331 usekernprocpathname=''
1332 ccflags_uselargefiles=''
1333 ldflags_uselargefiles=''
1334 libswanted_uselargefiles=''
1335 uselargefiles=''
1336 uselongdouble=''
1337 usemorebits=''
1338 usemultiplicity=''
1339 nm_opt=''
1340 nm_so_opt=''
1341 runnm=''
1342 usenm=''
1343 usensgetexecutablepath=''
1344 useperlio=''
1345 usequadmath=''
1346 usesocks=''
1347 d_oldpthreads=''
1348 use5005threads=''
1349 useithreads=''
1350 usereentrant=''
1351 usethreads=''
1352 incpath=''
1353 mips_type=''
1354 usrinc=''
1355 d_vendorarch=''
1356 installvendorarch=''
1357 vendorarch=''
1358 vendorarchexp=''
1359 d_vendorbin=''
1360 installvendorbin=''
1361 vendorbin=''
1362 vendorbinexp=''
1363 installvendorhtml1dir=''
1364 vendorhtml1dir=''
1365 vendorhtml1direxp=''
1366 installvendorhtml3dir=''
1367 vendorhtml3dir=''
1368 vendorhtml3direxp=''
1369 d_vendorlib=''
1370 installvendorlib=''
1371 vendorlib=''
1372 vendorlib_stem=''
1373 vendorlibexp=''
1374 installvendorman1dir=''
1375 vendorman1dir=''
1376 vendorman1direxp=''
1377 installvendorman3dir=''
1378 vendorman3dir=''
1379 vendorman3direxp=''
1380 usevendorprefix=''
1381 vendorprefix=''
1382 vendorprefixexp=''
1383 d_vendorscript=''
1384 installvendorscript=''
1385 vendorscript=''
1386 vendorscriptexp=''
1387 versiononly=''
1388 yacc=''
1389 yaccflags=''
1390 CONFIG=''
1391
1392 : Detect odd OSs
1393 define='define'
1394 undef='undef'
1395 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1396 rmlist=''
1397
1398 : We must find out about Eunice early
1399 eunicefix=':'
1400 if test -f /etc/unixtovms; then
1401         eunicefix=/etc/unixtovms
1402 fi
1403 if test -f /etc/unixtovms.exe; then
1404         eunicefix=/etc/unixtovms.exe
1405 fi
1406
1407 : Set executable suffix now -- needed before hints available
1408 if test -f "/libs/version.library"; then
1409 : Amiga OS
1410     _exe=""
1411 elif test -f "/system/gnu_library/bin/ar.pm"; then
1412 : Stratus VOS
1413     _exe=".pm"
1414 elif test -n "$DJGPP"; then
1415 : DOS DJGPP
1416     _exe=".exe"
1417 elif test -f /kern/cookiejar; then
1418 : MiNT
1419     _exe=""
1420 elif test -d c:/. -o -n "$is_os2" ; then
1421 : OS/2 or cygwin
1422     _exe=".exe"
1423 fi
1424
1425 groupstype=''
1426 i_whoami=''
1427 : Possible local include directories to search.
1428 : Set locincpth to "" in a hint file to defeat local include searches.
1429 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1430 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1431 :
1432 : no include file wanted by default
1433 inclwanted=''
1434
1435 : Enable -DEBUGGING and -DDEBUGGING from the command line
1436 EBUGGING=''
1437 DEBUGGING=''
1438
1439 : Trailing extension.  Override this in a hint file, if needed.
1440 : Extra object files, if any, needed on this platform.
1441 archobjs=''
1442 libnames=''
1443 : change the next line if compiling for Xenix/286 on Xenix/386
1444 xlibpth='/usr/lib/386 /lib/386'
1445 : Possible local library directories to search.
1446 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1447 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1448
1449 : general looking path for locating libraries
1450 glibpth="/lib /usr/lib $xlibpth"
1451 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1452 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1453 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1454 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1455
1456 : Private path used by Configure to find libraries.  Its value
1457 : is prepended to libpth. This variable takes care of special
1458 : machines, like the mips.  Usually, it should be empty.
1459 plibpth=''
1460
1461 : default library list
1462 libswanted=''
1463 : some systems want to use only the non-versioned libso:s
1464 ignore_versioned_solibs=''
1465 ccname=''
1466 ccversion=''
1467 perllibs=''
1468 : set usei18n_lang=false in your hint file to disable the I18N_Langinfo extension.
1469 usei18n_lang=true
1470 : set useposix=false in your hint file to disable the POSIX extension.
1471 useposix=true
1472 : set useopcode=false in your hint file to disable the Opcode extension.
1473 useopcode=true
1474 archname64=''
1475 ccflags_uselargefiles=''
1476 ldflags_uselargefiles=''
1477 libswanted_uselargefiles=''
1478 : set usemultiplicity on the Configure command line to enable multiplicity.
1479 : set usesocks on the Configure command line to enable socks.
1480 archname=''
1481 : set usethreads on the Configure command line to enable threads.
1482 usereentrant='undef'
1483 : List of libraries we want.
1484 : If anyone needs extra -lxxx, put those in a hint file.
1485 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1486 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1487 : We probably want to search /usr/shlib before most other libraries.
1488 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1489 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1490 glibpth="/usr/shlib $glibpth"
1491 : Do not use vfork unless overridden by a hint file.
1492 usevfork=false
1493
1494 : Find the basic shell for Bourne shell scripts
1495 case "$sh" in
1496 '')
1497         case "$SYSTYPE" in
1498         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1499         *) xxx='/bin/sh';;
1500         esac
1501         if test -f "$xxx"; then
1502                 sh="$xxx"
1503         else
1504                 : Build up a list and do a single loop so we can 'break' out.
1505                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1506                 for xxx in sh bash ksh pdksh ash; do
1507                         for p in $pth; do
1508                                 try="$try ${p}/${xxx}"
1509                         done
1510                 done
1511                 for xxx in $try; do
1512                         if test -f "$xxx"; then
1513                                 sh="$xxx";
1514                                 break
1515                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1516                                 sh="$xxx";
1517                                 break
1518                         elif test -f "$xxx.exe"; then
1519                                 sh="$xxx";
1520                                 break
1521                         fi
1522                 done
1523         fi
1524         ;;
1525 esac
1526
1527 case "$sh" in
1528 '')     cat >&2 <<EOM
1529 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1530
1531 Usually it's in /bin/sh.  How did you even get this far?
1532 Please contact me (Perl Maintainers) at perlbug@perl.org and
1533 we'll try to straighten this all out.
1534 EOM
1535         exit 1
1536         ;;
1537 esac
1538
1539 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1540 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1541 targetsh=$sh
1542
1543 : see if sh knows # comments
1544 if `$sh -c '#' >/dev/null 2>&1`; then
1545         shsharp=true
1546         spitshell=cat
1547         xcat=/bin/cat
1548         test -f $xcat$_exe || xcat=/usr/bin/cat
1549         if test ! -f $xcat$_exe; then
1550                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1551                         if test -f $p/cat$_exe; then
1552                                 xcat=$p/cat
1553                                 break
1554                         fi
1555                 done
1556                 if test ! -f $xcat$_exe; then
1557                         echo "Can't find cat anywhere!"
1558                         exit 1
1559                 fi
1560         fi
1561         echo "#!$xcat" >sharp
1562         $eunicefix sharp
1563         chmod +x sharp
1564         ./sharp > today 2>/dev/null
1565         if test -s today; then
1566                 sharpbang='#!'
1567         else
1568                 echo "#! $xcat" > sharp
1569                 $eunicefix sharp
1570                 chmod +x sharp
1571                 ./sharp > today 2>/dev/null
1572                 if test -s today; then
1573                         sharpbang='#! '
1574                 else
1575                         sharpbang=': use '
1576                 fi
1577         fi
1578 else
1579         echo " "
1580         echo "Your $sh doesn't grok # comments--I will strip them later on."
1581         shsharp=false
1582         cd ..
1583         echo "exec grep -v '^[  ]*#'" >spitshell
1584         chmod +x spitshell
1585         $eunicefix spitshell
1586         spitshell=`pwd`/spitshell
1587         cd UU
1588         echo "I presume that if # doesn't work, #! won't work either!"
1589         sharpbang=': use '
1590 fi
1591 rm -f sharp today
1592
1593 : figure out how to guarantee sh startup
1594 case "$startsh" in
1595 '') startsh=${sharpbang}${sh} ;;
1596 *)
1597 esac
1598 cat >sharp <<EOSS
1599 $startsh
1600 set abc
1601 test "$?abc" != 1
1602 EOSS
1603
1604 chmod +x sharp
1605 $eunicefix sharp
1606 if ./sharp; then
1607         : echo "Yup, it does."
1608 else
1609         echo "Hmm... '$startsh' does not guarantee sh startup..."
1610         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1611 fi
1612 rm -f sharp
1613
1614 : Save command line options in file UU/cmdline.opt for later use in
1615 : generating config.sh.
1616 cat > cmdline.opt <<EOSH
1617 : Configure command line arguments.
1618 config_arg0='$0'
1619 config_args='$*'
1620 config_argc=$#
1621 EOSH
1622 argn=1
1623 args_exp=''
1624 args_sep=''
1625 for arg in "$@"; do
1626         cat >>cmdline.opt <<EOSH
1627 config_arg$argn='$arg'
1628 EOSH
1629         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1630 $arg
1631 EOC
1632         arg_exp=`cat cmdl.opt`
1633         args_exp="$args_exp$args_sep'$arg_exp'"
1634         argn=`expr $argn + 1`
1635         args_sep=' '
1636 done
1637 rm -f cmdl.opt
1638
1639 : produce awk script to parse command line options
1640 cat >options.awk <<'EOF'
1641 BEGIN {
1642         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1643
1644         len = length(optstr);
1645         for (i = 1; i <= len; i++) {
1646                 c = substr(optstr, i, 1);
1647                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1648                 if (a == ":") {
1649                         arg[c] = 1;
1650                         i++;
1651                 }
1652                 opt[c] = 1;
1653         }
1654 }
1655 {
1656         expect = 0;
1657         str = $0;
1658         if (substr(str, 1, 1) != "-") {
1659                 printf("'%s'\n", str);
1660                 next;
1661         }
1662         len = length($0);
1663         for (i = 2; i <= len; i++) {
1664                 c = substr(str, i, 1);
1665                 if (!opt[c]) {
1666                         printf("-%s\n", substr(str, i));
1667                         next;
1668                 }
1669                 printf("-%s\n", c);
1670                 if (arg[c]) {
1671                         if (i < len)
1672                                 printf("'%s'\n", substr(str, i + 1));
1673                         else
1674                                 expect = 1;
1675                         next;
1676                 }
1677         }
1678 }
1679 END {
1680         if (expect)
1681                 print "?";
1682 }
1683 EOF
1684
1685 : process the command line options
1686 set X `for arg in "$@"; do echo "X$arg"; done |
1687         sed -e s/X// | awk -f options.awk`
1688 eval "set $*"
1689 shift
1690 rm -f options.awk
1691
1692 : set up default values
1693 fastread=''
1694 reuseval=false
1695 config_sh=''
1696 alldone=''
1697 error=''
1698 silent=''
1699 extractsh=''
1700 knowitall=''
1701 rm -f optdef.sh posthint.sh
1702 cat >optdef.sh <<EOS
1703 $startsh
1704 EOS
1705
1706
1707 : option parsing
1708 while test $# -gt 0; do
1709         case "$1" in
1710         -d) shift; fastread=yes;;
1711         -e) shift; alldone=cont;;
1712         -f)
1713                 shift
1714                 cd ..
1715                 if test -r "$1"; then
1716                         config_sh="$1"
1717                 else
1718                         echo "$me: cannot read config file $1." >&2
1719                         error=true
1720                 fi
1721                 cd UU
1722                 shift;;
1723         --help|\
1724         -h) shift; error=true;;
1725         -r) shift; reuseval=true;;
1726         -s) shift; silent=true; realsilent=true;;
1727         -E) shift; alldone=exit;;
1728         -K) shift; knowitall=true;;
1729         -O) shift;;
1730         -S) shift; silent=true; extractsh=true;;
1731         -D)
1732                 shift
1733                 case "$1" in
1734                 *=)
1735                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1736                         echo "$me: ignoring -D $1" >&2
1737                         ;;
1738                 *=*) echo "$1" | \
1739                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1740                 *) echo "$1='define'" >> optdef.sh;;
1741                 esac
1742                 shift
1743                 ;;
1744         -U)
1745                 shift
1746                 case "$1" in
1747                 *=) echo "$1" >> optdef.sh;;
1748                 *=*)
1749                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1750                         echo "$me: ignoring -U $1" >&2
1751                         ;;
1752                 *) echo "$1='undef'" >> optdef.sh;;
1753                 esac
1754                 shift
1755                 ;;
1756         -A)
1757             shift
1758             xxx=''
1759             yyy="$1"
1760             zzz=''
1761             uuu=undef
1762             case "$yyy" in
1763             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1764                  case "$zzz" in
1765                  *:*) zzz='' ;;
1766                  *)   xxx=append
1767                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1768                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1769                  esac
1770                  ;;
1771             esac
1772             case "$xxx" in
1773             '')  case "$yyy" in
1774                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1775                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1776                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1777                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1778                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1779                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1780                  esac
1781                  ;;
1782             esac
1783             case "$xxx" in
1784             append)
1785                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1786             clear)
1787                 echo "$yyy=''"                  >> posthint.sh ;;
1788             define)
1789                 case "$zzz" in
1790                 '') zzz=define ;;
1791                 esac
1792                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1793             eval)
1794                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1795             prepend)
1796                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1797             undef)
1798                 case "$zzz" in
1799                 '') zzz="$uuu" ;;
1800                 esac
1801                 echo "$yyy=$zzz"                >> posthint.sh ;;
1802             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1803             esac
1804             shift
1805             ;;
1806         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1807             exit 0;;
1808         --) break;;
1809         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1810         *) break;;
1811         esac
1812 done
1813
1814 case "$error" in
1815 true)
1816         cat >&2 <<EOM
1817 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1818                  [-U symbol] [-U symbol=] [-A command:symbol...]
1819   -d : use defaults for all answers.
1820   -e : go on without questioning past the production of config.sh.
1821   -f : specify an alternate default configuration file.
1822   -h : print this help message and exit (with an error status).
1823   -r : reuse C symbols value if possible (skips costly nm extraction).
1824   -s : silent mode, only echoes questions and essential information.
1825   -D : define symbol to have some value:
1826          -D symbol         symbol gets the value 'define'
1827          -D symbol=value   symbol gets the value 'value'
1828        common used examples (see INSTALL for more info):
1829          -Duse64bitint            use 64bit integers
1830          -Duse64bitall            use 64bit integers and pointers
1831          -Dusethreads             use thread support
1832          -Dinc_version_list=none  do not include older perl trees in @INC
1833          -DEBUGGING=none          DEBUGGING options
1834          -Dcc=gcc                 choose your compiler
1835          -Dprefix=/opt/perl5      choose your destination
1836   -E : stop at the end of questions, after having produced config.sh.
1837   -K : do not use unless you know what you are doing.
1838   -O : ignored for backward compatibility
1839   -S : perform variable substitutions on all .SH files (can mix with -f)
1840   -U : undefine symbol:
1841          -U symbol    symbol gets the value 'undef'
1842          -U symbol=   symbol gets completely empty
1843        e.g.:  -Uversiononly
1844   -A : manipulate symbol after the platform specific hints have been applied:
1845          -A append:symbol=value   append value to symbol
1846          -A symbol=value          like append:, but with a separating space
1847          -A define:symbol=value   define symbol to have value
1848          -A clear:symbol          define symbol to be ''
1849          -A define:symbol         define symbol to be 'define'
1850          -A eval:symbol=value     define symbol to be eval of value
1851          -A prepend:symbol=value  prepend value to symbol
1852          -A undef:symbol          define symbol to be 'undef'
1853          -A undef:symbol=         define symbol to be ''
1854        e.g.:  -A prepend:libswanted='cl pthread '
1855               -A ccflags=-DSOME_MACRO
1856   -V : print version number and exit (with a zero status).
1857 EOM
1858         exit 1
1859         ;;
1860 esac
1861
1862 : Sanity checks
1863 case "$fastread$alldone" in
1864 yescont|yesexit) ;;
1865 *)
1866         case "$extractsh" in
1867         true) ;;
1868         *)
1869                 if test ! -t 0; then
1870                         echo "Say 'sh Configure', not 'sh <Configure'"
1871                         exit 1
1872                 fi
1873                 ;;
1874         esac
1875         ;;
1876 esac
1877
1878 exec 4>&1
1879 case "$silent" in
1880 true) exec 1>/dev/null;;
1881 esac
1882
1883 : run the defines and the undefines, if any, but leave the file out there...
1884 touch optdef.sh
1885 grep '\\' optdef.sh >/dev/null 2>&1
1886 if test $? = 0; then
1887     echo "Configure does not support \\ in -D arguments"
1888     exit 1
1889 fi
1890 . ./optdef.sh
1891 : create the posthint manipulation script and leave the file out there...
1892 touch posthint.sh
1893
1894 : set package name
1895 package='perl5'
1896 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1897 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1898 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1899 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1900 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1901 esac
1902
1903 : Some greps do not return status, grrr.
1904 echo "grimblepritz" >grimble
1905 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1906         contains=contains
1907 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1908         contains=grep
1909 else
1910         contains=contains
1911 fi
1912 rm -f grimble
1913 : the following should work in any shell
1914 case "$contains" in
1915 contains*)
1916         echo " "
1917         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1918         cat >contains <<'EOSS'
1919 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1920 EOSS
1921 chmod +x contains
1922 esac
1923
1924 : Find the path to the source tree
1925 case "$src" in
1926 '') case "$0" in
1927     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1928          case "$src" in
1929          /*)    ;;
1930          .)     ;;
1931          *)     src=`cd ../$src && pwd` ;;
1932          esac
1933          ;;
1934     *)   src='.';;
1935     esac;;
1936 esac
1937 case "$src" in
1938 '')     src=/
1939         rsrc=/
1940         ;;
1941 /*)     rsrc="$src";;
1942 *)      rsrc="../$src";;
1943 esac
1944 if test -f $rsrc/Configure && \
1945         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1946 then
1947    : found it, so we are ok.
1948 else
1949         rsrc=''
1950         for src in . .. ../.. ../../.. ../../../..; do
1951                 if test -f ../$src/Configure && \
1952                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1953                 then
1954                         rsrc=../$src
1955                         break
1956                 fi
1957         done
1958 fi
1959 case "$rsrc" in
1960 '')
1961         cat <<EOM >&4
1962
1963 Sorry, I can't seem to locate the source dir for $package.  Please start
1964 Configure with an explicit path -- i.e. /some/path/Configure.
1965
1966 EOM
1967         exit 1
1968         ;;
1969 ../.)   rsrc='..';;
1970 *)
1971         echo " "
1972         echo "Sources for $package found in \"$src\"." >&4
1973         ;;
1974 esac
1975
1976 : script used to extract .SH files with variable substitutions
1977 cat >extract <<'EOS'
1978 PERL_CONFIG_SH=true
1979 echo "Doing variable substitutions on .SH files..."
1980 if test -f MANIFEST; then
1981         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1982 else
1983         echo "(Looking for .SH files under the source directory.)"
1984         set x `(cd "$src"; find . -name "*.SH" -print)`
1985 fi
1986 shift
1987 case $# in
1988 0) set x `(cd "$src"; echo *.SH)`; shift;;
1989 esac
1990 if test ! -f "$src/$1"; then
1991         shift
1992 fi
1993 mkdir_p='
1994 name=$1;
1995 create="";
1996 while test $name; do
1997         if test ! -d "$name"; then
1998                 create="$name $create";
1999                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2000                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2001         else
2002                 name="";
2003         fi;
2004 done;
2005 for file in $create; do
2006         mkdir $file;
2007 done
2008 '
2009 for file in $*; do
2010         case "$src" in
2011         ".")
2012                 case "$file" in
2013                 */*)
2014                         dir=`expr X$file : 'X\(.*\)/'`
2015                         file=`expr X$file : 'X.*/\(.*\)'`
2016                         (cd "$dir" && . ./$file)
2017                         ;;
2018                 *)
2019                         . ./$file
2020                         ;;
2021                 esac
2022                 ;;
2023         *)
2024                 case "$file" in
2025                 */*)
2026                         dir=`expr X$file : 'X\(.*\)/'`
2027                         file=`expr X$file : 'X.*/\(.*\)'`
2028                         (set x $dir; shift; eval $mkdir_p)
2029                         sh <"$src/$dir/$file"
2030                         ;;
2031                 *)
2032                         sh <"$src/$file"
2033                         ;;
2034                 esac
2035                 ;;
2036         esac
2037 done
2038 if test -f "$src/config_h.SH"; then
2039         if test ! -f config.h; then
2040         : oops, they left it out of MANIFEST, probably, so do it anyway.
2041         . "$src/config_h.SH"
2042         fi
2043 fi
2044 EOS
2045
2046 : extract files and exit if asked to do so
2047 case "$extractsh" in
2048 true)
2049         case "$realsilent" in
2050         true) ;;
2051         *) exec 1>&4;;
2052         esac
2053         case "$config_sh" in
2054         '') config_sh='config.sh';;
2055         esac
2056         echo " "
2057         echo "Fetching answers from $config_sh..."
2058         cd ..
2059         . $config_sh
2060         . UU/optdef.sh
2061         echo " "
2062         . UU/extract
2063         rm -rf UU
2064         echo "Extraction done."
2065         exit 0
2066         ;;
2067 esac
2068
2069 : Eunice requires " " instead of "", can you believe it
2070 echo " "
2071 : Here we go...
2072 echo "Beginning of configuration questions for $package."
2073
2074 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2075
2076 : first determine how to suppress newline on echo command
2077 echo " "
2078 echo "Checking echo to see how to suppress newlines..."
2079 (echo "hi there\c" ; echo " ") >.echotmp
2080 if $contains c .echotmp >/dev/null 2>&1 ; then
2081         echo "...using -n."
2082         n='-n'
2083         c=''
2084 else
2085         cat <<'EOM'
2086 ...using \c
2087 EOM
2088         n=''
2089         c='\c'
2090 fi
2091 echo $n "The star should be here-->$c"
2092 echo '*'
2093 rm -f .echotmp
2094
2095 : Now test for existence of everything in MANIFEST
2096 echo " "
2097 if test -f "$rsrc/MANIFEST"; then
2098         echo "First let's make sure your kit is complete.  Checking..." >&4
2099         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2100                 (split -l 50 2>/dev/null || split -50)
2101         rm -f missing
2102         tmppwd=`pwd`
2103         for filelist in x??; do
2104                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2105                         >/dev/null 2>>"$tmppwd/missing")
2106         done
2107         if test -s missing; then
2108                 cat missing >&4
2109                 cat >&4 <<'EOM'
2110
2111 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2112
2113 You have the option of continuing the configuration process, despite the
2114 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2115 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2116 and contact the author (perlbug@perl.org).
2117
2118 EOM
2119                 echo $n "Continue? [n] $c" >&4
2120                 read ans
2121                 case "$ans" in
2122                 y*)
2123                         echo "Continuing..." >&4
2124                         rm -f missing
2125                         ;;
2126                 *)
2127                         echo "ABORTING..." >&4
2128                         kill $$
2129                         ;;
2130                 esac
2131         else
2132                 echo "Looks good..."
2133         fi
2134 else
2135         echo "There is no MANIFEST file.  I hope your kit is complete !"
2136 fi
2137 rm -f missing x??
2138
2139 : Find the appropriate value for a newline for tr
2140 if test -n "$DJGPP"; then
2141        trnl='\012'
2142 fi
2143 if test X"$trnl" = X; then
2144         case "`echo foo | tr '\n' x 2>/dev/null`" in
2145         foox) trnl='\n' ;;
2146         esac
2147 fi
2148 if test X"$trnl" = X; then
2149         case "`echo foo | tr '\012' x 2>/dev/null`" in
2150         foox) trnl='\012' ;;
2151         esac
2152 fi
2153 if test X"$trnl" = X; then
2154        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2155        fooxy) trnl='\n\r' ;;
2156        esac
2157 fi
2158 if test X"$trnl" = X; then
2159         cat <<EOM >&2
2160
2161 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2162
2163 EOM
2164         exit 1
2165 fi
2166
2167 : compute the number of columns on the terminal for proper question formatting
2168 case "$COLUMNS" in
2169 '') COLUMNS='80';;
2170 esac
2171
2172 : set up the echo used in my read
2173 myecho="case \"\$xxxm\" in
2174 '') echo $n \"\$rp $c\" >&4;;
2175 *) case \"\$rp\" in
2176         '') echo $n \"[\$xxxm] $c\";;
2177         *)
2178                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2179                         echo \"\$rp\" >&4
2180                         echo $n \"[\$xxxm] $c\" >&4
2181                 else
2182                         echo $n \"\$rp [\$xxxm] $c\" >&4
2183                 fi
2184                 ;;
2185         esac;;
2186 esac"
2187
2188 : now set up to do reads with possible shell escape and default assignment
2189 cat <<EOSC >myread
2190 $startsh
2191 xxxm=\$dflt
2192 $myecho
2193 ans='!'
2194 case "\$fastread" in
2195 yes) case "\$dflt" in
2196         '') ;;
2197         *) ans='';
2198                 case "\$silent-\$rp" in
2199                 true-) ;;
2200                 *) echo " " >&4;;
2201                 esac;;
2202         esac;;
2203 *) case "\$silent" in
2204         true) case "\$rp" in
2205                 '') ans='';;
2206                 esac;;
2207         esac;;
2208 esac
2209 while expr "X\$ans" : "X!" >/dev/null; do
2210         read answ
2211         set x \$xxxm
2212         shift
2213         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2214         case  "\$answ" in
2215         "!")
2216                 sh 1>&4
2217                 echo " "
2218                 $myecho
2219                 ;;
2220         !*)
2221                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2222                 shift
2223                 sh 1>&4 -c "\$*"
2224                 echo " "
2225                 $myecho
2226                 ;;
2227         "\$ans")
2228                 case "\$ans" in
2229                 \\&*)
2230                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2231                         shift
2232                         case "\$1" in
2233                         -d)
2234                                 fastread=yes
2235                                 echo "(OK, I'll run with -d after this question.)" >&4
2236                                 ;;
2237                         -*)
2238                                 echo "*** Sorry, \$1 not supported yet." >&4
2239                                 ;;
2240                         esac
2241                         $myecho
2242                         ans=!
2243                         ;;
2244                 esac;;
2245         *)
2246                 case "\$aok" in
2247                 y)
2248                         echo "*** Substitution done -- please confirm."
2249                         xxxm="\$ans"
2250                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2251                         xxxm="\$ans"
2252                         ans=!
2253                         ;;
2254                 *)
2255                         echo "*** Error -- try again."
2256                         ans=!
2257                         ;;
2258                 esac
2259                 $myecho
2260                 ;;
2261         esac
2262         case "\$ans\$xxxm\$nostick" in
2263         '')
2264                 ans=!
2265                 $myecho
2266                 ;;
2267         esac
2268 done
2269 case "\$ans" in
2270 '') ans="\$xxxm";;
2271 esac
2272 EOSC
2273
2274 : create .config dir to save info across Configure sessions
2275 test -d ../.config || mkdir ../.config
2276 cat >../.config/README <<EOF
2277 This directory created by Configure to save information that should
2278 persist across sessions for $package.
2279
2280 You may safely delete it if you wish.
2281 EOF
2282
2283 : See if we are using a devel version and want that
2284 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2285 case "$usedevel" in
2286 $define|true|[yY]*)
2287     usedevel="$define" ;;
2288 *) case "$xversion" in
2289    *[13579])
2290         cat >&4 <<EOH
2291 *** WHOA THERE!!! ***
2292
2293     This is an UNSTABLE DEVELOPMENT release.
2294     The version of this $package distribution is $xversion, that is, odd,
2295     (as opposed to even) and that signifies a development release.
2296     If you want a maintenance release, you want an even-numbered version.
2297
2298     Do ***NOT*** install this into production use.
2299     Data corruption and crashes are possible.
2300
2301     It is most seriously suggested that you do not continue any further
2302     unless you want to help in developing and debugging Perl.
2303
2304     If you *still* want to build perl, you can answer 'y' now,
2305     or pass -Dusedevel to Configure.
2306
2307 EOH
2308         rp='Do you really want to continue?'
2309         dflt='n'
2310         . ./myread
2311         case "$ans" in
2312         [yY]) echo >&4 "Okay, continuing."
2313               usedevel="$define" ;;
2314         *) echo >&4 "Okay, bye."
2315            exit 1
2316            ;;
2317         esac
2318         ;;
2319     esac
2320     usedevel="$undef"
2321     ;;
2322 esac
2323 case "$usedevel" in
2324 $define|true|[yY]*)
2325         case "$versiononly" in
2326         '') versiononly="$define" ;;
2327         esac
2328         case "$installusrbinperl" in
2329         '') installusrbinperl="$undef" ;;
2330         esac
2331         ;;
2332 esac
2333
2334 : general instructions
2335 needman=true
2336 firsttime=true
2337 user=`(logname) 2>/dev/null`
2338 case "$user" in
2339 '') user=`whoami 2>&1`;;
2340 esac
2341 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2342         firsttime=false
2343         echo " "
2344         rp='Would you like to see the instructions?'
2345         dflt=n
2346         . ./myread
2347         case "$ans" in
2348         [yY]*) ;;
2349         *) needman=false;;
2350         esac
2351 fi
2352 if $needman; then
2353         cat <<EOH
2354
2355 This installation shell script will examine your system and ask you questions
2356 to determine how the perl5 package should be installed. If you get
2357 stuck on a question, you may use a ! shell escape to start a subshell or
2358 execute a command.  Many of the questions will have default answers in square
2359 brackets; typing carriage return will give you the default.
2360
2361 On some of the questions which ask for file or directory names you are allowed
2362 to use the ~name construct to specify the login directory belonging to "name",
2363 even if you don't have a shell which knows about that.  Questions where this is
2364 allowed will be marked "(~name ok)".
2365
2366 EOH
2367         rp=''
2368         dflt='Type carriage return to continue'
2369         . ./myread
2370         cat <<'EOH'
2371
2372 The prompter used in this script allows you to use shell variables and
2373 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2374 in the default answer, as if the default line was a set of arguments given to a
2375 script shell.  This means you may also use $* to repeat the whole default line,
2376 so you do not have to re-type everything to add something to the default.
2377
2378 Every time there is a substitution, you will have to confirm.  If there is an
2379 error (e.g. an unmatched backtick), the default answer will remain unchanged
2380 and you will be prompted again.
2381
2382 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2383 the questions and use the computed defaults (or the previous answers if there
2384 was already a config.sh file). Type 'Configure -h' for a list of options.
2385 You may also start interactively and then answer '& -d' at any prompt to turn
2386 on the non-interactive behaviour for the remainder of the execution.
2387
2388 EOH
2389         . ./myread
2390         cat <<EOH
2391
2392 Much effort has been expended to ensure that this shell script will run on any
2393 Unix system.  If despite that it blows up on yours, your best bet is to edit
2394 Configure and run it again.  If you can't run Configure for some reason,
2395 you'll have to generate a config.sh file by hand.  Whatever problems you
2396 have, let me (perlbug@perl.org) know how I blew it.
2397
2398 This installation script affects things in two ways:
2399
2400 1) it may do direct variable substitutions on some of the files included
2401    in this kit.
2402 2) it builds a config.h file for inclusion in C programs.  You may edit
2403    any of these files as the need arises after running this script.
2404
2405 If you make a mistake on a question, there is no easy way to back up to it
2406 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2407 files.  Configure will offer to let you do this before it runs the SH files.
2408
2409 EOH
2410         dflt='Type carriage return to continue'
2411         . ./myread
2412         case "$firsttime" in
2413         true) echo $user >>../.config/instruct;;
2414         esac
2415 fi
2416
2417 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2418 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2419 if test "X$sysroot" = X; then
2420     sysroot=""
2421 else
2422     case "$cc" in
2423         *gcc*|*g++*)
2424             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2425             # _sysroot is used in places where we need --sysroot=foo
2426             # but using the rest of the flags could cause issues.
2427             _sysroot="--sysroot=$sysroot";
2428             case "$ccflags" in
2429                 *sysroot*) ;;
2430                 'undef'|*)
2431                 ccflags="$ccflags $_sysroot"
2432             esac
2433             case "$ldflags" in
2434                 *sysroot*) ;;
2435                 'undef'|*)
2436                 ldflags="$ldflags $_sysroot"
2437             esac
2438             case "$cppflags" in
2439                 *sysroot*) ;;
2440                 'undef'|*)
2441                 cppflags="$cppflags $_sysroot"
2442             esac
2443             # lddlflags updated below in lddlflags section;
2444             # same with cccdlflags
2445             ;;
2446     esac
2447
2448     # Adjust some defaults to also use $sysroot
2449     for var in xlibpth loclibpth locincpth glibpth; do
2450         eval xxx=\$$var
2451         eval $var=''
2452         for path in $xxx; do
2453             eval $var=\"\$$var $sysroot$path\"
2454         done
2455     done
2456
2457 fi
2458
2459 : find out where common programs are
2460 echo " "
2461 echo "Locating common programs..." >&4
2462 cat <<EOSC >loc
2463 $startsh
2464 case \$# in
2465 0) exit 1;;
2466 esac
2467 thing=\$1
2468 shift
2469 dflt=\$1
2470 shift
2471 for dir in \$*; do
2472         case "\$thing" in
2473         .)
2474         if test -d \$dir/\$thing; then
2475                 echo \$dir
2476                 exit 0
2477         fi
2478         ;;
2479         *)
2480         for thisthing in \$dir/\$thing; do
2481                 : just loop through to pick last item
2482         done
2483         if test -f \$thisthing; then
2484                 echo \$thisthing
2485                 exit 0
2486         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2487                 echo \$thisthing
2488                 exit 0
2489         elif test -f \$dir/\$thing.exe; then
2490                 if test -n "$DJGPP"; then
2491                         echo \$dir/\$thing.exe
2492                 elif test "$eunicefix" != ":"; then
2493                         : on Eunice apparently
2494                         echo \$dir/\$thing
2495                 fi
2496                 exit 0
2497         fi
2498         ;;
2499         esac
2500 done
2501 echo \$dflt
2502 exit 1
2503 EOSC
2504 chmod +x loc
2505 $eunicefix loc
2506 loclist="
2507 awk
2508 cat
2509 chmod
2510 comm
2511 cp
2512 echo
2513 expr
2514 grep
2515 ls
2516 mkdir
2517 rm
2518 sed
2519 sort
2520 touch
2521 tr
2522 uniq
2523 "
2524 trylist="
2525 ar
2526 bison
2527 byacc
2528 cpp
2529 csh
2530 date
2531 egrep
2532 gmake
2533 gzip
2534 less
2535 ln
2536 make
2537 more
2538 nm
2539 nroff
2540 perl
2541 pg
2542 test
2543 uname
2544 zip
2545 "
2546 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2547 pth="$pth $sysroot/lib $sysroot/usr/lib"
2548 for file in $loclist; do
2549         eval xxx=\$$file
2550         case "$xxx" in
2551         /*|?:[\\/]*)
2552                 if test -f "$xxx"; then
2553                         : ok
2554                 else
2555                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2556                         xxx=`./loc $file $file $pth`
2557                 fi
2558                 ;;
2559         '') xxx=`./loc $file $file $pth`;;
2560         *) xxx=`./loc $xxx $xxx $pth`;;
2561         esac
2562         eval $file=$xxx$_exe
2563         eval _$file=$xxx
2564         case "$xxx" in
2565         /*)
2566                 echo $file is in $xxx.
2567                 ;;
2568         ?:[\\/]*)
2569                 echo $file is in $xxx.
2570                 ;;
2571         *)
2572                 echo "I don't know where '$file' is, and my life depends on it." >&4
2573                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2574                 exit 1
2575                 ;;
2576         esac
2577 done
2578 echo " "
2579 echo "Don't worry if any of the following aren't found..."
2580 say=offhand
2581 for file in $trylist; do
2582         eval xxx=\$$file
2583         case "$xxx" in
2584         /*|?:[\\/]*)
2585                 if test -f "$xxx"; then
2586                         : ok
2587                 else
2588                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2589                         xxx=`./loc $file $file $pth`
2590                 fi
2591                 ;;
2592         '') xxx=`./loc $file $file $pth`;;
2593         *) xxx=`./loc $xxx $xxx $pth`;;
2594         esac
2595         eval $file=$xxx$_exe
2596         eval _$file=$xxx
2597         case "$xxx" in
2598         /*)
2599                 echo $file is in $xxx.
2600                 ;;
2601         ?:[\\/]*)
2602                 echo $file is in $xxx.
2603                 ;;
2604         *)
2605                 echo "I don't see $file out there, $say."
2606                 say=either
2607                 ;;
2608         esac
2609 done
2610 case "$egrep" in
2611 egrep)
2612         echo "Substituting grep for egrep."
2613         egrep=$grep
2614         _egrep=$grep
2615         ;;
2616 esac
2617 case "$less" in
2618 '')     ;;
2619 *)      if $less -R </dev/null >/dev/null 2>&1; then
2620                echo "Substituting less -R for less."
2621                less="$less -R"
2622                _less=$less
2623         fi
2624         ;;
2625 esac
2626 case "$ln" in
2627 ln)
2628         echo "Substituting cp for ln."
2629         ln=$cp
2630         _ln=$cp
2631         ;;
2632 esac
2633 case "$make" in
2634 make)
2635         case "$gmake" in
2636         gmake)
2637         echo "I can't find make or gmake, and my life depends on it." >&4
2638         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2639         exit 1
2640         ;;
2641         esac
2642         ;;
2643 esac
2644 case "$gmake" in
2645 gmake)  ;;
2646 *)      # We can't have osname yet.
2647         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2648                 # Assume that gmake, if found, is definitely GNU make
2649                 # and prefer it over the system make.
2650                 echo "Substituting gmake for make."
2651                 make=$gmake
2652                 _make=$gmake
2653         fi
2654         ;;
2655 esac
2656 case "$test" in
2657 test)
2658         echo "Hopefully test is built into your sh."
2659         ;;
2660 *)
2661         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2662                 echo "Using the test built into your sh."
2663                 test=test
2664                 _test=test
2665         fi
2666         ;;
2667 esac
2668 case "$echo" in
2669 echo)
2670         echo "Hopefully echo is built into your sh."
2671         ;;
2672 '') ;;
2673 *)
2674         echo " "
2675 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2676         $echo $n "hi there$c" >foo1
2677         echo $n "hi there$c" >foo2
2678         if cmp foo1 foo2 >/dev/null 2>&1; then
2679                 echo "They are compatible.  In fact, they may be identical."
2680         else
2681                 case "$n" in
2682                 '-n') n='' c='\c';;
2683                 *) n='-n' c='';;
2684                 esac
2685                 cat <<FOO
2686 They are not compatible!  You are probably running ksh on a non-USG system.
2687 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2688 have echo built in and we may have to run some Bourne shell scripts.  That
2689 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2690
2691 FOO
2692                 $echo $n "The star should be here-->$c"
2693                 $echo "*"
2694         fi
2695         $rm -f foo1 foo2
2696         ;;
2697 esac
2698
2699 # This question was auctioned at YAPC::Europe-2007 in Vienna
2700 # I never promised you could answer it. I only auctioned the question.
2701 cat <<FOO
2702 The following message is sponsored by
2703
2704   Dresden.pm<--The stars should be here.
2705
2706 Dear Perl user, system administrator or package
2707 maintainer, the Perl community sends greetings to
2708 you. Do you (emblematical) greet back [Y/n]? n
2709
2710 FOO
2711
2712 : Check what type of C compiler we use
2713 cat <<EOS >trygcc
2714 $startsh
2715 EOS
2716 cat <<'EOSC' >>trygcc
2717 case "$cc" in
2718 '') ;;
2719 *)  $rm -f try try.*
2720     $cat >try.c <<EOM
2721 int main(int argc, char *argv[]) {
2722   return 0;
2723 }
2724 EOM
2725     if $cc -o try $ccflags $ldflags try.c; then
2726        :
2727     else
2728         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2729         despair=yes
2730         trygcc=yes
2731         case "$cc" in
2732         *gcc*) trygcc=no ;;
2733         esac
2734         # Skip this test because it gives a false match on output like:
2735         #    ./trygcc: line 23: cc: command not found
2736         # case "`$cc -v -c try.c 2>&1`" in
2737         # *gcc*) trygcc=no ;;
2738         # esac
2739         if $test X"$trygcc" = Xyes; then
2740             if gcc -o try -c try.c; then
2741                 echo " "
2742                 echo "You seem to have a working gcc, though." >&4
2743                 # Switching compilers may undo the work of hints files.
2744                 # The most common problem is -D_REENTRANT for threads.
2745                 # This heuristic catches that case, but gets false positives
2746                 # if -Dusethreads was not actually specified.  Better to
2747                 # bail out here with a useful message than fail
2748                 # mysteriously later. Should we perhaps just try to
2749                 # re-invoke Configure -Dcc=gcc config_args ?
2750                 if $test -f usethreads.cbu; then
2751                         $cat >&4 <<EOM
2752
2753 *** However, any setting of the C compiler flags (e.g. for thread support)
2754 *** will be lost.  It may be necessary for you to restart Configure and
2755 *** add -Dcc=gcc to your Configure command line.
2756
2757 EOM
2758                         rp="Would you like to go ahead and try gcc anyway?"
2759                         dflt=n
2760                 else
2761                         rp="Would you like to use it?"
2762                         dflt=y
2763                 fi
2764                 if $test -f myread; then
2765                     . ./myread
2766                 else
2767                     if $test -f UU/myread; then
2768                         . ./UU/myread
2769                     else
2770                         echo "Cannot find myread, sorry.  Aborting." >&2
2771                         exit 1
2772                     fi
2773                 fi
2774                 case "$ans" in
2775                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2776                 esac
2777             fi
2778         fi
2779     fi
2780     $rm -f try try.*
2781     ;;
2782 esac
2783 EOSC
2784
2785 cat <<EOS >checkcc
2786 $startsh
2787 EOS
2788 cat <<'EOSC' >>checkcc
2789 case "$cc" in
2790 '') ;;
2791 *)  $rm -f try try.*
2792     $cat >try.c <<EOM
2793 int main(int argc, char *argv[]) {
2794   return 0;
2795 }
2796 EOM
2797     if $cc -o try $ccflags $ldflags try.c; then
2798        :
2799     else
2800         if $test X"$despair" = Xyes; then
2801            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2802         fi
2803         $cat >&4 <<EOM
2804 You need to find a working C compiler.
2805 Either (purchase and) install the C compiler supplied by your OS vendor,
2806 or for a free C compiler try http://gcc.gnu.org/
2807 I cannot continue any further, aborting.
2808 EOM
2809         exit 1
2810     fi
2811     $rm -f try try.*
2812     ;;
2813 esac
2814 EOSC
2815
2816 : determine whether symbolic links are supported
2817 echo " "
2818 $touch blurfl
2819 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2820         echo "Symbolic links are supported." >&4
2821         lns="$ln -s"
2822 else
2823         echo "Symbolic links are NOT supported." >&4
2824         lns="$ln"
2825 fi
2826 $rm -f blurfl sym
2827
2828 : determine whether symbolic links are supported
2829 echo " "
2830 case "$lns" in
2831 *"ln"*" -s")
2832         echo "Checking how to test for symbolic links..." >&4
2833         $lns blurfl sym
2834         if $test "X$issymlink" = X; then
2835                 case "$newsh" in
2836                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2837                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2838                 esac
2839                 if test $? = 0; then
2840                         issymlink="test -h"
2841                 else
2842                         echo "Your builtin 'test -h' may be broken." >&4
2843                         case "$test" in
2844                         /*)     ;;
2845                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2846                                 for p in $pth
2847                                 do
2848                                         if test -f "$p/$test"; then
2849                                                 test="$p/$test"
2850                                                 break
2851                                         fi
2852                                 done
2853                                 ;;
2854                         esac
2855                         case "$test" in
2856                         /*)
2857                                 echo "Trying external '$test -h'." >&4
2858                                 issymlink="$test -h"
2859                                 if $test ! -h sym >/dev/null 2>&1; then
2860                                         echo "External '$test -h' is broken, too." >&4
2861                                         issymlink=''
2862                                 fi
2863                                 ;;
2864                         *)      issymlink='' ;;
2865                         esac
2866                 fi
2867         fi
2868         if $test "X$issymlink" = X; then
2869                 if $test -L sym 2>/dev/null; then
2870                         issymlink="$test -L"
2871                         echo "The builtin '$test -L' worked." >&4
2872                 fi
2873         fi
2874         if $test "X$issymlink" != X; then
2875                 echo "You can test for symbolic links with '$issymlink'." >&4
2876         else
2877                 echo "I do not know how you can test for symbolic links." >&4
2878         fi
2879         $rm -f blurfl sym
2880         ;;
2881 *)      echo "No symbolic links, so not testing for their testing..." >&4
2882         ;;
2883 esac
2884
2885 : Make symlinks util
2886 case "$mksymlinks" in
2887 $define|true|[yY]*)
2888         case "$src" in
2889         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2890                 exit 1
2891                 ;;
2892         *)      case "$lns:$issymlink" in
2893                 *"ln"*" -s:"*"test -"?)
2894                         echo "Creating the symbolic links..." >&4
2895                         cd ..
2896                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2897                         awk 'NF == 1 {
2898                                 dir=".";
2899                                 file=$1 "";
2900                              }
2901                              NF == 2 {
2902                                 dir=$1 "";
2903                                 file=$2 "";
2904                              }
2905                              {
2906                                  print "# dir = ", dir, "file = ", file
2907                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2908                              } END {
2909                                  for (d in mf) {
2910                                      if (d != ".") { print("mkdir -p "d) }
2911                                      print("ln -sf "mf[d]" "d);
2912                                  }
2913                              }' source="$src" > UU/mksymlinks.$$
2914                         sh UU/mksymlinks.$$
2915                         rm UU/mksymlinks.$$
2916                         # Sanity check 1.
2917                         if test ! -d t/base; then
2918                                 echo "Failed to create the subdirectories.  Aborting." >&4
2919                                 exit 1
2920                         fi
2921                         # Sanity check 2.
2922                         if test ! -f t/base/lex.t; then
2923                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2924                                 exit 1
2925                         fi
2926                         if test ! -f win32/win32.c; then
2927                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2928                                 exit 1
2929                         fi
2930                         cd UU
2931                         ;;
2932                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2933                         ;;
2934                 esac
2935                 ;;
2936         esac
2937         ;;
2938 esac
2939
2940 : Check for Cross-Compilation
2941 if $test "X$targethost" = "X"; then
2942     targethost=""
2943 fi
2944 if $test "X$targetenv" = "X"; then
2945     targetenv=""
2946 fi
2947 case "$usecrosscompile" in
2948 $define|true|[yY]*)
2949         $echo "Cross-compiling..."
2950         croak=''
2951         case "$cc" in
2952         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2953             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2954             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2955             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2956             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2957             # leave out ld, choosing it is more complex
2958             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2959             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2960             # We are in a weird spot. Just before us, some values
2961             # were 'saved', to be restored after the hints are
2962             # run.  This means that the changes we made to ar,
2963             # nm and ranlib will get reverted.
2964             # To avoid that, we hijack the saving mechanism and
2965             # have it save our new values.
2966             for file in ar nm ranlib; do
2967                 eval xxx=\$$file
2968                 eval $file=$xxx$_exe
2969                 eval _$file=$xxx
2970             done
2971         ;;
2972         esac
2973         case "$targetarch" in
2974         '') echo "Targetarch not defined." >&4; croak=y ;;
2975         *)  echo "Using targetarch $targetarch." >&4 ;;
2976         esac
2977         case "$targethost" in
2978         '') echo "Targethost not defined." >&4; croak=n ;;
2979         *)  echo "Using targethost $targethost." >&4
2980         esac
2981         locincpth=' '
2982         loclibpth=' '
2983         case "$croak" in
2984         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2985         esac
2986     : compile a host miniperl and generate_uudmap, unless we got passed them
2987     if $test "X$hostperl" = X; then
2988       echo "Building host miniperl and generate_uudmap binaries" >&4
2989       before_host=`pwd`
2990       cd ..
2991       cd $src
2992       src=`pwd`
2993       rm -rf $src/host
2994       mkdir $src/host
2995       cd $src/host
2996       $src/Configure -des -Dusedevel -Dmksymlinks
2997       $make miniperl
2998       case "$hostgenerate" in
2999       '') $make generate_uudmap
3000           hostgenerate=$src/host/generate_uudmap
3001           ;;
3002        "$undef") hostgenerate=''
3003           ;;
3004       esac
3005       hostperl=$src/host/miniperl
3006       cd $before_host
3007     fi
3008     hostosname=`$hostperl -le 'print $^O'`
3009     ;;
3010 *)
3011     usecrosscompile="$undef"
3012     ;;
3013 esac
3014
3015 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3016 case "$targethost" in
3017     '') echo "Checking for cross-compile" >&4
3018     case "$usecrosscompile$multiarch" in
3019        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3020          if [ -f Makefile ]; then
3021            echo " "
3022            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3023          else
3024            echo "Configure done."
3025          fi
3026        exit 0
3027        ;;
3028      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3029         run=''
3030         to=:
3031         from=:
3032         ;;
3033     esac
3034     ;;
3035     *) echo "Using targethost $targethost." >&4
3036         case "$src" in
3037         /*) run=$src/Cross/run
3038             targetmkdir=$src/Cross/mkdir
3039             to=$src/Cross/to
3040             from=$src/Cross/from
3041             ;;
3042         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3043             run=$pwd/Cross/run
3044             targetmkdir=$pwd/Cross/mkdir
3045             to=$pwd/Cross/to
3046             from=$pwd/Cross/from
3047             ;;
3048         esac
3049         case "$targetrun" in
3050         '') targetrun=ssh ;;
3051         esac
3052         case "$targetto" in
3053         '') targetto=scp ;;
3054         esac
3055         case "$targetfrom" in
3056         '') targetfrom=scp ;;
3057         esac
3058         run=$run-$targetrun
3059         to=$to-$targetto
3060         from=$from-$targetfrom
3061         case "$targetdir" in
3062         '')  targetdir=/tmp
3063              echo "Guessing targetdir $targetdir." >&4
3064              ;;
3065         esac
3066         case "$targetuser" in
3067         '')  targetuser=root
3068              echo "Guessing targetuser $targetuser." >&4
3069              ;;
3070         esac
3071         case "$targetport" in
3072         '')  targetport=22
3073              echo "Guessing targetport $targetport." >&4
3074              ;;
3075         esac
3076         case "$targetfrom" in
3077         scp)    q=-q ;;
3078         *)      q='' ;;
3079         esac
3080         case "$targetrun" in
3081         ssh|rsh)
3082             cat >$run <<EOF
3083 #!/bin/sh
3084 env=''
3085 case "\$1" in
3086 -cwd)
3087   shift
3088   cwd=\$1
3089   shift
3090   ;;
3091 esac
3092 case "\$1" in
3093 -env)
3094   shift
3095   env=\$1
3096   shift
3097   ;;
3098 esac
3099 case "\$cwd" in
3100 '') cwd=$targetdir ;;
3101 esac
3102 exe=\$1
3103 shift
3104 $to \$exe
3105 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3106 EOF
3107             ;;
3108         adb)
3109             $touch $run
3110             ;;
3111         *)  echo "Unknown targetrun '$targetrun'" >&4
3112             exit 1
3113             ;;
3114         esac
3115         case "$targetmkdir" in
3116         */Cross/mkdir)
3117             cat >$targetmkdir <<EOF
3118 #!/bin/sh
3119 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3120 EOF
3121             $chmod a+rx $targetmkdir
3122             ;;
3123         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3124             exit 1
3125             ;;
3126         esac
3127         case "$targetto" in
3128         scp|rcp)
3129             cat >$to <<EOF
3130 #!/bin/sh
3131 for f in \$@
3132 do
3133   case "\$f" in
3134   /*)
3135     $targetmkdir \`dirname \$f\`
3136     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3137     ;;
3138   *)
3139     $targetmkdir $targetdir/\`dirname \$f\`
3140     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3141     ;;
3142   esac
3143 done
3144 exit 0
3145 EOF
3146             ;;
3147         cp) cat >$to <<EOF
3148 #!/bin/sh
3149 for f in \$@
3150 do
3151   case "\$f" in
3152   /*)
3153     $mkdir -p $targetdir/\`dirname \$f\`
3154     $cp \$f $targetdir/\$f || exit 1
3155     ;;
3156   *)
3157     $targetmkdir $targetdir/\`dirname \$f\`
3158     $cp \$f $targetdir/\$f || exit 1
3159     ;;
3160   esac
3161 done
3162 exit 0
3163 EOF
3164             ;;
3165         *)  echo "Unknown targetto '$targetto'" >&4
3166             exit 1
3167             ;;
3168         esac
3169         case "$targetfrom" in
3170         scp|rcp)
3171           cat >$from <<EOF
3172 #!/bin/sh
3173 for f in \$@
3174 do
3175   $rm -f \$f
3176   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3177 done
3178 exit 0
3179 EOF
3180             ;;
3181         cp) cat >$from <<EOF
3182 #!/bin/sh
3183 for f in \$@
3184 do
3185   $rm -f \$f
3186   cp $targetdir/\$f . || exit 1
3187 done
3188 exit 0
3189 EOF
3190             ;;
3191         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3192             exit 1
3193             ;;
3194         esac
3195         if $test ! -f $run; then
3196             echo "Target 'run' script '$run' not found." >&4
3197         else
3198             $chmod a+rx $run
3199         fi
3200         if $test ! -f $to; then
3201             echo "Target 'to' script '$to' not found." >&4
3202         else
3203             $chmod a+rx $to
3204         fi
3205         if $test ! -f $from; then
3206             echo "Target 'from' script '$from' not found." >&4
3207         else
3208             $chmod a+rx $from
3209         fi
3210         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3211             exit 1
3212         fi
3213         cat >&4 <<EOF
3214 Using '$run' for remote execution,
3215 and '$from' and '$to'
3216 for remote file transfer.
3217 EOF
3218         ;;
3219 *)      run=''
3220         to=:
3221         from=:
3222         usecrosscompile="$undef"
3223         targetarch=''
3224         ;;
3225 esac
3226
3227 : see whether [:lower:] and [:upper:] are supported character classes
3228 echo " "
3229 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3230 ABYZ-abyz)
3231         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3232         up='[:upper:]'
3233         low='[:lower:]'
3234         ;;
3235 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3236         # (0xd9 and 0xe2), therefore that is a nice testing point.
3237         if test "X$up" = X -o "X$low" = X; then
3238             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3239             rs) up='[A-Z]'
3240                 low='[a-z]'
3241                 ;;
3242             esac
3243         fi
3244         if test "X$up" = X -o "X$low" = X; then
3245             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3246             rs) up='A-Z'
3247                 low='a-z'
3248                 ;;
3249             esac
3250         fi
3251         if test "X$up" = X -o "X$low" = X; then
3252             case "`echo RS | od -x 2>/dev/null`" in
3253             *D9E2*|*d9e2*)
3254                 echo "Hey, this might be EBCDIC." >&4
3255                 if test "X$up" = X -o "X$low" = X; then
3256                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3257                     rs) up='[A-IJ-RS-Z]'
3258                         low='[a-ij-rs-z]'
3259                         ;;
3260                     esac
3261                 fi
3262                 if test "X$up" = X -o "X$low" = X; then
3263                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3264                     rs) up='A-IJ-RS-Z'
3265                         low='a-ij-rs-z'
3266                         ;;
3267                     esac
3268                 fi
3269                 ;;
3270             esac
3271         fi
3272 esac
3273 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3274 rs)
3275     echo "Using $up and $low to convert case." >&4
3276     ;;
3277 *)
3278     echo "I don't know how to translate letters from upper to lower case." >&4
3279     echo "Your tr is not acting any way I know of." >&4
3280     exit 1
3281     ;;
3282 esac
3283 : set up the translation script tr, must be called with ./tr of course
3284 cat >tr <<EOSC
3285 $startsh
3286 case "\$1\$2" in
3287 '[A-Z][a-z]') exec $tr '$up' '$low';;
3288 '[a-z][A-Z]') exec $tr '$low' '$up';;
3289 esac
3290 exec $tr "\$@"
3291 EOSC
3292 chmod +x tr
3293 $eunicefix tr
3294
3295 : Try to determine whether config.sh was made on this system
3296 case "$config_sh" in
3297 '')
3298 myuname=`$uname -a 2>/dev/null`
3299 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3300 # Downcase everything to avoid ambiguity.
3301 # Remove slashes and single quotes so we can use parts of this in
3302 # directory and file names.
3303 # Remove newlines so myuname is sane to use elsewhere.
3304 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3305 # because the A-Z/a-z are not consecutive.
3306 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3307         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3308 newmyuname="$myuname"
3309 dflt=n
3310 case "$knowitall" in
3311 '')
3312         if test -f ../config.sh; then
3313                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3314                         eval "`grep myuname= ../config.sh`"
3315                 fi
3316                 if test "X$myuname" = "X$newmyuname"; then
3317                         dflt=y
3318                 fi
3319         fi
3320         ;;
3321 *) dflt=y;;
3322 esac
3323
3324 : Get old answers from old config file if Configure was run on the
3325 : same system, otherwise use the hints.
3326 hint=default
3327 cd ..
3328 if test -f config.sh; then
3329         echo " "
3330         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3331         . UU/myread
3332         case "$ans" in
3333         n*|N*) echo "OK, I'll ignore it."
3334                 mv config.sh config.sh.old
3335                 myuname="$newmyuname"
3336                 ;;
3337         *)  echo "Fetching default answers from your old config.sh file..." >&4
3338                 tmp_n="$n"
3339                 tmp_c="$c"
3340                 tmp_sh="$sh"
3341                 . ./config.sh
3342                 cp config.sh UU
3343                 n="$tmp_n"
3344                 c="$tmp_c"
3345                 : Older versions did not always set $sh.  Catch re-use of such
3346                 : an old config.sh.
3347                 case "$sh" in
3348                 '') sh="$tmp_sh" ;;
3349                 esac
3350                 hint=previous
3351                 ;;
3352         esac
3353 fi
3354 . ./UU/checkcc
3355 if test ! -f config.sh; then
3356         $cat <<EOM
3357
3358 First time through, eh?  I have some defaults handy for some systems
3359 that need some extra help getting the Configure answers right:
3360
3361 EOM
3362         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3363         dflt=''
3364         : Half the following guesses are probably wrong... If you have better
3365         : tests or hints, please send them to perlbug@perl.org
3366         : The metaconfig authors would also appreciate a copy...
3367         $test -f /irix && osname=irix
3368         $test -f /xenix && osname=sco_xenix
3369         $test -f /dynix && osname=dynix
3370         $test -f /dnix && osname=dnix
3371         $test -f /lynx.os && osname=lynxos
3372         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3373         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3374         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3375         $test -f /bin/mips && /bin/mips && osname=mips
3376         $test -d /usr/apollo/bin && osname=apollo
3377         $test -f /etc/saf/_sactab && osname=svr4
3378         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3379         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3380         $test -f /sys/utilities/MultiView && osname=amigaos
3381         if $test -d /MachTen -o -d /MachTen_Folder; then
3382                 osname=machten
3383                 if $test -x /sbin/version; then
3384                         osvers=`/sbin/version | $awk '{print $2}' |
3385                         $sed -e 's/[A-Za-z]$//'`
3386                 elif $test -x /usr/etc/version; then
3387                         osvers=`/usr/etc/version | $awk '{print $2}' |
3388                         $sed -e 's/[A-Za-z]$//'`
3389                 else
3390                         osvers="$2.$3"
3391                 fi
3392         fi
3393
3394         $test -f /sys/posix.dll &&
3395                 $test -f /usr/bin/what &&
3396                 set X `/usr/bin/what /sys/posix.dll` &&
3397                 $test "$3" = UWIN &&
3398                 osname=uwin &&
3399                 osvers="$5"
3400
3401         if $test -f $uname; then
3402                 set X $myuname
3403                 shift
3404
3405                 case "$5" in
3406                 fps*) osname=fps ;;
3407                 mips*)
3408                         case "$4" in
3409                         umips) osname=umips ;;
3410                         *) osname=mips ;;
3411                         esac;;
3412                 [23]100) osname=mips ;;
3413                 i386*)
3414                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3415                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3416                                 osname='sco'
3417                                 osvers=$tmp
3418                         elif $test -f /etc/kconfig; then
3419                                 osname=isc
3420                                 if test "$lns" = "$ln -s"; then
3421                                         osvers=4
3422                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3423                                         osvers=3
3424                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3425                                         osvers=2
3426                                 fi
3427                         fi
3428                         tmp=''
3429                         ;;
3430                 pc*)
3431                         if test -n "$DJGPP"; then
3432                                 osname=dos
3433                                 osvers=djgpp
3434                         fi
3435                         ;;
3436                 esac
3437
3438                 case "$1" in
3439                 aix) osname=aix
3440                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3441                         case "$tmp" in
3442                         # oslevel can fail with:
3443                         # oslevel: Unable to acquire lock.
3444                         *not\ found) osvers="$4"."$3" ;;
3445                         '<3240'|'<>3240') osvers=3.2.0 ;;
3446                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3447                         '=3250'|'>3250') osvers=3.2.5 ;;
3448                         *) osvers=$tmp;;
3449                         esac
3450                         ;;
3451                 bitrig) osname=bitrig
3452                         osvers="$3"
3453                         ;;
3454                 bsd386) osname=bsd386
3455                         osvers=`$uname -r`
3456                         ;;
3457                 cygwin*) osname=cygwin
3458                         osvers="$3"
3459                         ;;
3460                 *dc.osx) osname=dcosx
3461                         osvers="$3"
3462                         ;;
3463                 dnix) osname=dnix
3464                         osvers="$3"
3465                         ;;
3466                 domainos) osname=apollo
3467                         osvers="$3"
3468                         ;;
3469                 dgux)   osname=dgux
3470                         osvers="$3"
3471                         ;;
3472                 dragonfly) osname=dragonfly
3473                         osvers="$3"
3474                         ;;
3475                 dynixptx*) osname=dynixptx
3476                         osvers=`echo "$4"|sed 's/^v//'`
3477                         ;;
3478                 freebsd) osname=freebsd
3479                         osvers="$3" ;;
3480                 genix)  osname=genix ;;
3481                 gnu)    osname=gnu
3482                         osvers="$3" ;;
3483                 hp*)    osname=hpux
3484                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3485                         ;;
3486                 irix*)  osname=irix
3487                         case "$3" in
3488                         4*) osvers=4 ;;
3489                         5*) osvers=5 ;;
3490                         *)      osvers="$3" ;;
3491                         esac
3492                         ;;
3493                 linux)  osname=linux
3494                         case "$3" in
3495                         *)      osvers="$3" ;;
3496                         esac
3497                         $test -f /system/lib/libandroid.so && osname=linux-android
3498                         ;;
3499                 MiNT)   osname=mint
3500                         ;;
3501                 netbsd*) osname=netbsd
3502                         osvers="$3"
3503                         ;;
3504                 news-os) osvers="$3"
3505                         case "$3" in
3506                         4*) osname=newsos4 ;;
3507                         *) osname=newsos ;;
3508                         esac
3509                         ;;
3510                 nonstop-ux) osname=nonstopux ;;
3511                 openbsd) osname=openbsd
3512                         osvers="$3"
3513                         ;;
3514                 os2)    osname=os2
3515                         osvers="$4"
3516                         ;;
3517                 POSIX-BC | posix-bc ) osname=posix-bc
3518                         osvers="$3"
3519                         ;;
3520                 powerux | power_ux | powermax_os | powermaxos | \
3521                 powerunix | power_unix) osname=powerux
3522                         osvers="$3"
3523                         ;;
3524                 qnx) osname=qnx
3525                         osvers="$4"
3526                         ;;
3527                 solaris) osname=solaris
3528                         case "$3" in
3529                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3530                         *)      osvers="$3" ;;
3531                         esac
3532                         ;;
3533                 sunos) osname=sunos
3534                         case "$3" in
3535                         5*) osname=solaris
3536                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3537                         *)      osvers="$3" ;;
3538                         esac
3539                         ;;
3540                 titanos) osname=titanos
3541                         case "$3" in
3542                         1*) osvers=1 ;;
3543                         2*) osvers=2 ;;
3544                         3*) osvers=3 ;;
3545                         4*) osvers=4 ;;
3546                         *)      osvers="$3" ;;
3547                         esac
3548                         ;;
3549                 ultrix) osname=ultrix
3550                         osvers="$3"
3551                         ;;
3552                 osf1|mls+)      case "$5" in
3553                                 alpha)
3554                                         osname=dec_osf
3555                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3556                                         case "$osvers" in
3557                                         [1-9].[0-9]*) ;;
3558                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3559                                         esac
3560                                         ;;
3561                         hp*)    osname=hp_osf1  ;;
3562                         mips)   osname=mips_osf1 ;;
3563                         esac
3564                         ;;
3565                 # UnixWare 7.1.2 is known as Open UNIX 8
3566                 openunix|unixware) osname=svr5
3567                         osvers="$4"
3568                         ;;
3569                 uts)    osname=uts
3570                         osvers="$3"
3571                         ;;
3572                 vos) osvers="$3"
3573                         ;;
3574                 $2) case "$osname" in
3575                         *isc*) ;;
3576                         *freebsd*) ;;
3577                         svr*)
3578                                 : svr4.x or possibly later
3579                                 case "svr$3" in
3580                                 ${osname}*)
3581                                         osname=svr$3
3582                                         osvers=$4
3583                                         ;;
3584                                 esac
3585                                 case "$osname" in
3586                                 svr4.0)
3587                                         : Check for ESIX
3588                                         if test -f /stand/boot ; then
3589                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3590                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3591                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3592                                                         if test -n "$isesix"; then
3593                                                                 osname=esix4
3594                                                         fi
3595                                                 fi
3596                                         fi
3597                                         ;;
3598                                 esac
3599                                 ;;
3600                         *)      if test -f /etc/systemid; then
3601                                         osname=sco
3602                                         set `echo $3 | $sed 's/\./ /g'` $4
3603                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3604                                                 osvers=$1.$2.$3
3605                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3606                                                 osvers=$1.$2
3607                                         elif $test -f $src/hints/sco_$1.sh; then
3608                                                 osvers=$1
3609                                         fi
3610                                 else
3611                                         case "$osname" in
3612                                         '') : Still unknown.  Probably a generic Sys V.
3613                                                 osname="sysv"
3614                                                 osvers="$3"
3615                                                 ;;
3616                                         esac
3617                                 fi
3618                                 ;;
3619                         esac
3620                         ;;
3621                 *)      case "$osname" in
3622                         '') : Still unknown.  Probably a generic BSD.
3623                                 osname="$1"
3624                                 osvers="$3"
3625                                 ;;
3626                         esac
3627                         ;;
3628                 esac
3629         else
3630                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3631                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3632                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3633                                 osname=news_os
3634                         fi
3635                         $rm -f UU/kernel.what
3636                 elif test -d c:/. -o -n "$is_os2" ; then
3637                         set X $myuname
3638                         osname=os2
3639                         osvers="$5"
3640                 fi
3641         fi
3642
3643         case "$targetarch" in
3644         '') ;;
3645         *)  hostarch=$osname
3646             case "$targetarch" in
3647                 nto*|*-nto-*)
3648                     # Will load qnx.sh, which should change osname to nto
3649                     osname=qnx
3650                     osvers=''
3651                     ;;
3652                 *linux-android*)
3653                     # Catch arm-linux-androideabi, mipsel-linux-android,
3654                     # and i686-linux-android
3655                     osname=linux-android
3656                     osvers=''
3657                     ;;
3658                 *linux*)
3659                     # Something like arm-linux-gnueabihf is really just
3660                     # plain linux.
3661                     osname=linux
3662                     osvers=''
3663                     ;;
3664                 *solaris*|*sunos*)
3665                     osname=solaris
3666                     # XXX perhaps we should just assume
3667                     # osvers to be 2, or maybe take the value
3668                     # from targetarch. Using $run before the
3669                     # hints are run is somewhat icky.
3670                     set X `$run $uname -a 2>/dev/null`
3671                     shift
3672                     case "$3" in
3673                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3674                         *)  osvers="$3" ;;
3675                     esac
3676                     ;;
3677                 *)
3678                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3679                     osvers=''
3680                 ;;
3681             esac
3682             ;;
3683         esac
3684
3685         : Now look for a hint file osname_osvers, unless one has been
3686         : specified already.
3687         case "$hintfile" in
3688         ''|' ')
3689                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3690                 : Also try without trailing minor version numbers.
3691                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3692                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3693                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3694                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3695                 case "$file" in
3696                 '') dflt=none ;;
3697                 *)  case "$osvers" in
3698                         '') dflt=$file
3699                                 ;;
3700                         *)  if $test -f $src/hints/$file.sh ; then
3701                                         dflt=$file
3702                                 elif $test -f $src/hints/$xfile.sh ; then
3703                                         dflt=$xfile
3704                                 elif $test -f $src/hints/$xxfile.sh ; then
3705                                         dflt=$xxfile
3706                                 elif $test -f $src/hints/$xxxfile.sh ; then
3707                                         dflt=$xxxfile
3708                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3709                                         dflt=$xxxxfile
3710                                 elif $test -f "$src/hints/${osname}.sh" ; then
3711                                         dflt="${osname}"
3712                                 else
3713                                         dflt=none
3714                                 fi
3715                                 ;;
3716                         esac
3717                         ;;
3718                 esac
3719                 if $test -f Policy.sh ; then
3720                         case "$dflt" in
3721                         *Policy*) ;;
3722                         none) dflt="Policy" ;;
3723                         *) dflt="Policy $dflt" ;;
3724                         esac
3725                 fi
3726                 ;;
3727         *)
3728                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3729                 ;;
3730         esac
3731
3732         if $test -f Policy.sh ; then
3733                 $cat <<EOM
3734
3735 There's also a Policy hint file available, which should make the
3736 site-specific (policy) questions easier to answer.
3737 EOM
3738
3739         fi
3740
3741         $cat <<EOM
3742
3743 You may give one or more space-separated answers, or "none" if appropriate.
3744 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3745 previous run of Configure, you may specify it as well as or instead of
3746 OS-specific hints.  If hints are provided for your OS, you should use them:
3747 although Perl can probably be built without hints on many platforms, using
3748 hints often improve performance and may enable features that Configure can't
3749 set up on its own. If there are no hints that match your OS, specify "none";
3750 DO NOT give a wrong version or a wrong OS.
3751
3752 EOM
3753
3754         rp="Which of these apply, if any?"
3755         . UU/myread
3756         tans=$ans
3757         for file in $tans; do
3758                 if $test X$file = XPolicy -a -f Policy.sh; then
3759                         . Policy.sh
3760                         $cat Policy.sh >> UU/config.sh
3761                 elif $test -f $src/hints/$file.sh; then
3762                         . $src/hints/$file.sh
3763                         $cat $src/hints/$file.sh >> UU/config.sh
3764                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3765                         : nothing
3766                 else
3767                         : Give one chance to correct a possible typo.
3768                         echo "$file.sh does not exist"
3769                         dflt=$file
3770                         rp="hint to use instead?"
3771                         . UU/myread
3772                         for file in $ans; do
3773                                 if $test -f "$src/hints/$file.sh"; then
3774                                         . $src/hints/$file.sh
3775                                         $cat $src/hints/$file.sh >> UU/config.sh
3776                                 elif $test X$ans = X -o X$ans = Xnone ; then
3777                                         : nothing
3778                                 else
3779                                         echo "$file.sh does not exist -- ignored."
3780                                 fi
3781                         done
3782                 fi
3783         done
3784
3785         hint=recommended
3786         : Remember our hint file for later.
3787         if $test -f "$src/hints/$file.sh" ; then
3788                 hintfile="$file"
3789         else
3790                 hintfile=''
3791         fi
3792 fi
3793 cd UU
3794 ;;
3795 *)
3796         echo " "
3797         echo "Fetching default answers from $config_sh..." >&4
3798         tmp_n="$n"
3799         tmp_c="$c"
3800         cd ..
3801         cp $config_sh config.sh 2>/dev/null
3802         chmod +w config.sh
3803         . ./config.sh
3804         cd UU
3805         cp ../config.sh .
3806         n="$tmp_n"
3807         c="$tmp_c"
3808         hint=previous
3809         ;;
3810 esac
3811 . ./optdef.sh
3812
3813 : Restore computed paths
3814 for file in $loclist $trylist; do
3815         eval $file="\$_$file"
3816 done
3817
3818 cat << EOM
3819
3820 Configure uses the operating system name and version to set some defaults.
3821 The default value is probably right if the name rings a bell. Otherwise,
3822 since spelling matters for me, either accept the default or answer "none"
3823 to leave it blank.
3824
3825 EOM
3826 case "$osname" in
3827         ''|' ')
3828                 case "$hintfile" in
3829                 ''|' '|none) dflt=none ;;
3830                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3831                 esac
3832                 ;;
3833         *) dflt="$osname" ;;
3834 esac
3835 rp="Operating system name?"
3836 . ./myread
3837 case "$ans" in
3838 none)  osname='' ;;
3839 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3840 esac
3841 echo " "
3842 case "$osvers" in
3843         ''|' ')
3844                 case "$hintfile" in
3845                 ''|' '|none) dflt=none ;;
3846                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3847                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3848                         case "$dflt" in
3849                         ''|' ') dflt=none ;;
3850                         esac
3851                         ;;
3852                 esac
3853                 ;;
3854         *) dflt="$osvers" ;;
3855 esac
3856 rp="Operating system version?"
3857 . ./myread
3858 case "$ans" in
3859 none)  osvers='' ;;
3860 *) osvers="$ans" ;;
3861 esac
3862
3863
3864 . ./posthint.sh
3865
3866 : who configured the system
3867 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3868 case "$cf_by" in
3869 "")
3870         cf_by=`(logname) 2>/dev/null`
3871         case "$cf_by" in
3872         "")
3873                 cf_by=`(whoami) 2>/dev/null`
3874                 case "$cf_by" in
3875                 "") cf_by=unknown ;;
3876                 esac ;;
3877         esac ;;
3878 esac
3879
3880 : decide how portable to be.  Allow command line overrides.
3881 case "$d_portable" in
3882 "$undef") ;;
3883 *)      d_portable="$define" ;;
3884 esac
3885
3886 : set up shell script to do ~ expansion
3887 cat >filexp <<EOSS
3888 $startsh
3889 : expand filename
3890 case "\$1" in
3891  \~/*|\~)
3892         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3893         ;;
3894  \~*)
3895         if $test -f /bin/csh; then
3896                 /bin/csh -f -c "glob \$1"
3897                 failed=\$?
3898                 echo ""
3899                 exit \$failed
3900         else
3901                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3902                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3903                 if $test ! -d "\$dir"; then
3904                         me=\`basename \$0\`
3905                         echo "\$me: can't locate home directory for: \$name" >&2
3906                         exit 1
3907                 fi
3908                 case "\$1" in
3909                 */*)
3910                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3911                         ;;
3912                 *)
3913                         echo \$dir
3914                         ;;
3915                 esac
3916         fi
3917         ;;
3918 *)
3919         echo \$1
3920         ;;
3921 esac
3922 EOSS
3923 chmod +x filexp
3924 $eunicefix filexp
3925
3926 : now set up to get a file name
3927 cat <<EOS >getfile
3928 $startsh
3929 EOS
3930 cat <<'EOSC' >>getfile
3931 tilde=''
3932 fullpath=''
3933 already=''
3934 skip=''
3935 none_ok=''
3936 exp_file=''
3937 nopath_ok=''
3938 orig_rp="$rp"
3939 orig_dflt="$dflt"
3940 case "$gfpth" in
3941 '') gfpth='.' ;;
3942 esac
3943
3944 case "$fn" in
3945 *\(*)
3946         : getfile will accept an answer from the comma-separated list
3947         : enclosed in parentheses even if it does not meet other criteria.
3948         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3949         fn=`echo $fn | sed 's/(.*)//'`
3950         ;;
3951 esac
3952
3953 case "$fn" in
3954 *:*)
3955         loc_file=`expr $fn : '.*:\(.*\)'`
3956         fn=`expr $fn : '\(.*\):.*'`
3957         ;;
3958 esac
3959
3960 case "$fn" in
3961 *~*) tilde=true;;
3962 esac
3963 case "$fn" in
3964 */*) fullpath=true;;
3965 esac
3966 case "$fn" in
3967 *+*) skip=true;;
3968 esac
3969 case "$fn" in
3970 *n*) none_ok=true;;
3971 esac
3972 case "$fn" in
3973 *e*) exp_file=true;;
3974 esac
3975 case "$fn" in
3976 *p*) nopath_ok=true;;
3977 esac
3978
3979 case "$fn" in
3980 *f*) type='File';;
3981 *d*) type='Directory';;
3982 *l*) type='Locate';;
3983 esac
3984
3985 what="$type"
3986 case "$what" in
3987 Locate) what='File';;
3988 esac
3989
3990 case "$exp_file" in
3991 '')
3992         case "$d_portable" in
3993         "$define") ;;
3994         *) exp_file=true;;
3995         esac
3996         ;;
3997 esac
3998
3999 cd ..
4000 while test "$type"; do
4001         redo=''
4002         rp="$orig_rp"
4003         dflt="$orig_dflt"
4004         case "$tilde" in
4005         true) rp="$rp (~name ok)";;
4006         esac
4007         . UU/myread
4008         if test -f UU/getfile.ok && \
4009                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4010         then
4011                 value="$ans"
4012                 ansexp="$ans"
4013                 break
4014         fi
4015         case "$ans" in
4016         none)
4017                 value=''
4018                 ansexp=''
4019                 case "$none_ok" in
4020                 true) type='';;
4021                 esac
4022                 ;;
4023         *)
4024                 case "$tilde" in
4025                 '') value="$ans"
4026                         ansexp="$ans";;
4027                 *)
4028                         value=`UU/filexp $ans`
4029                         case $? in
4030                         0)
4031                                 if test "$ans" != "$value"; then
4032                                         echo "(That expands to $value on this system.)"
4033                                 fi
4034                                 ;;
4035                         *) value="$ans";;
4036                         esac
4037                         ansexp="$value"
4038                         case "$exp_file" in
4039                         '') value="$ans";;
4040                         esac
4041                         ;;
4042                 esac
4043                 case "$fullpath" in
4044                 true)
4045                         case "$ansexp" in
4046                         /*) value="$ansexp" ;;
4047                         [a-zA-Z]:/*) value="$ansexp" ;;
4048                         *)
4049                                 redo=true
4050                                 case "$already" in
4051                                 true)
4052                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4053                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4054                                         ;;
4055                                 *)
4056                                 echo "Please give a full path name, starting with slash." >&4
4057                                         case "$tilde" in
4058                                         true)
4059                                 echo "Note that using ~name is ok provided it expands well." >&4
4060                                                 already=true
4061                                                 ;;
4062                                         esac
4063                                 esac
4064                                 ;;
4065                         esac
4066                         ;;
4067                 esac
4068                 case "$redo" in
4069                 '')
4070                         case "$type" in
4071                         File)
4072                                 for fp in $gfpth; do
4073                                         if test "X$fp" = X.; then
4074                                             pf="$ansexp"
4075                                         else    
4076                                             pf="$fp/$ansexp"
4077                                         fi
4078                                         if test -f "$pf"; then
4079                                                 type=''
4080                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4081                                         then
4082                                                 echo "($value is not a plain file, but that's ok.)"
4083                                                 type=''
4084                                         fi
4085                                         if test X"$type" = X; then
4086                                             value="$pf"
4087                                             break
4088                                         fi
4089                                 done
4090                                 ;;
4091                         Directory)
4092                                 for fp in $gfpth; do
4093                                         if test "X$fp" = X.; then
4094                                             dir="$ans"
4095                                             direxp="$ansexp"
4096                                         else    
4097                                             dir="$fp/$ansexp"
4098                                             direxp="$fp/$ansexp"
4099                                         fi
4100                                         if test -d "$direxp"; then
4101                                                 type=''
4102                                                 value="$dir"
4103                                                 break
4104                                         fi
4105                                 done
4106                                 ;;
4107                         Locate)
4108                                 if test -d "$ansexp"; then
4109                                         echo "(Looking for $loc_file in directory $value.)"
4110                                         value="$value/$loc_file"
4111                                         ansexp="$ansexp/$loc_file"
4112                                 fi
4113                                 if test -f "$ansexp"; then
4114                                         type=''
4115                                 fi
4116                                 case "$nopath_ok" in
4117                                 true)   case "$value" in
4118                                         */*) ;;
4119                                         *)      echo "Assuming $value will be in people's path."
4120                                                 type=''
4121                                                 ;;
4122                                         esac
4123                                         ;;
4124                                 esac
4125                                 ;;
4126                         esac
4127
4128                         case "$skip" in
4129                         true) type='';
4130                         esac
4131
4132                         case "$type" in
4133                         '') ;;
4134                         *)
4135                                 if test "$fastread" = yes; then
4136                                         dflt=y
4137                                 else
4138                                         dflt=n
4139                                 fi
4140                                 rp="$what $value doesn't exist.  Use that name anyway?"
4141                                 . UU/myread
4142                                 dflt=''
4143                                 case "$ans" in
4144                                 y*) type='';;
4145                                 *) echo " ";;
4146                                 esac
4147                                 ;;
4148                         esac
4149                         ;;
4150                 esac
4151                 ;;
4152         esac
4153 done
4154 cd UU
4155 ans="$value"
4156 rp="$orig_rp"
4157 dflt="$orig_dflt"
4158 rm -f getfile.ok
4159 test "X$gfpthkeep" != Xy && gfpth=""
4160 EOSC
4161
4162 : determine root of directory hierarchy where package will be installed.
4163 case "$prefix" in
4164 '')
4165         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4166         ;;
4167 *?/)
4168         dflt=`echo "$prefix" | sed 's/.$//'`
4169         ;;
4170 *)
4171         dflt="$prefix"
4172         ;;
4173 esac
4174 $cat <<EOM
4175
4176 By default, $package will be installed in $dflt/bin, manual pages
4177 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4178 installation directories. Typically this is something like /usr/local.
4179 If you wish to have binaries under /usr/bin but other parts of the
4180 installation under /usr/local, that's ok: you will be prompted
4181 separately for each of the installation directories, the prefix being
4182 only used to set the defaults.
4183
4184 EOM
4185 fn=d~
4186 rp='Installation prefix to use?'
4187 . ./getfile
4188 oldprefix=''
4189 case "$prefix" in
4190 '') ;;
4191 *)
4192         case "$ans" in
4193         "$prefix") ;;
4194         *) oldprefix="$prefix";;
4195         esac
4196         ;;
4197 esac
4198 prefix="$ans"
4199 prefixexp="$ansexp"
4200
4201 : allow them to override the AFS root
4202 case "$afsroot" in
4203 '')     afsroot=/afs ;;
4204 *)      afsroot=$afsroot ;;
4205 esac
4206
4207 : is AFS running?
4208 echo " "
4209 case "$afs" in
4210 $define|true)   afs=true ;;
4211 $undef|false)   afs=false ;;
4212 *)      if $test -d $afsroot; then
4213                 afs=true
4214         else
4215                 afs=false
4216         fi
4217         ;;
4218 esac
4219 if $afs; then
4220         echo "AFS may be running... I'll be extra cautious then..." >&4
4221 else
4222         echo "AFS does not seem to be running..." >&4
4223 fi
4224
4225 : determine installation prefix for where package is to be installed.
4226 if $afs; then
4227 $cat <<EOM
4228
4229 Since you are running AFS, I need to distinguish the directory in which
4230 files will reside from the directory in which they are installed (and from
4231 which they are presumably copied to the former directory by occult means).
4232
4233 EOM
4234         case "$installprefix" in
4235         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4236         *) dflt="$installprefix";;
4237         esac
4238 else
4239 $cat <<EOM
4240
4241 In some special cases, particularly when building $package for distribution,
4242 it is convenient to distinguish the directory in which files should be
4243 installed from the directory ($prefix) in which they will
4244 eventually reside.  For most users, these two directories are the same.
4245
4246 EOM
4247         case "$installprefix" in
4248         '') dflt=$prefix ;;
4249         *) dflt=$installprefix;;
4250         esac
4251 fi
4252 fn=d~
4253 rp='What installation prefix should I use for installing files?'
4254 . ./getfile
4255 installprefix="$ans"
4256 installprefixexp="$ansexp"
4257
4258 : Perform the prefixexp/installprefixexp correction if necessary
4259 cat <<EOS >installprefix
4260 $startsh
4261 EOS
4262 cat <<'EOSC' >>installprefix
4263 : Change installation prefix, if necessary.
4264 if $test X"$prefix" != X"$installprefix"; then
4265     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4266 else
4267     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4268 fi
4269 EOSC
4270 chmod +x installprefix
4271 $eunicefix installprefix
4272
4273 : Set variables such as privlib and privlibexp from the output of ./getfile
4274 : performing the prefixexp/installprefixexp correction if necessary.
4275 cat <<EOS >setprefixvar
4276 $startsh
4277 EOS
4278 cat <<'EOSC' >>setprefixvar
4279 eval "${prefixvar}=\"\$ans\""
4280 eval "${prefixvar}exp=\"\$ansexp\""
4281 . ./installprefix
4282 EOSC
4283 chmod +x setprefixvar
4284 $eunicefix setprefixvar
4285
4286 : set up the script used to warn in case of inconsistency
4287 cat <<EOS >whoa
4288 $startsh
4289 EOS
4290 cat <<'EOSC' >>whoa
4291 dflt=y
4292 case "$hint" in
4293     recommended)
4294         case "$hintfile" in
4295         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4296                 ;;
4297         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4298                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4299                 ;;
4300         esac
4301         ;;
4302     *)  echo " "
4303         echo "*** WHOA THERE!!! ***" >&4
4304         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4305         ;;
4306 esac
4307 rp="    Keep the $hint value?"
4308 . ./myread
4309 case "$ans" in
4310 y) td=$was; tu=$was;;
4311 esac
4312 EOSC
4313
4314 : function used to set '$1' to '$val'
4315 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4316 case "$val$was" in
4317 $define$undef) . ./whoa; eval "$var=\$td";;
4318 $undef$define) . ./whoa; eval "$var=\$tu";;
4319 *) eval "$var=$val";;
4320 esac'
4321
4322 : get the patchlevel
4323 echo " "
4324 echo "Getting the current patchlevel..." >&4
4325 if $test -r $rsrc/patchlevel.h;then
4326         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4327         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4328         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4329         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4330         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4331         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4332         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4333 else
4334         revision=0
4335         patchlevel=0
4336         subversion=0
4337         api_revision=0
4338         api_version=0
4339         api_subversion=0
4340         perl_patchlevel=0
4341         $echo "(You do not have patchlevel.h.  Eek.)"
4342 fi
4343 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4344 version_patchlevel_string="version $patchlevel subversion $subversion"
4345 case "$perl_patchlevel" in
4346 0|'') ;;
4347 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4348     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4349     ;;
4350 esac
4351
4352 $echo "(You have $package $version_patchlevel_string.)"
4353
4354 case "$osname" in
4355 dos|vms)
4356         : XXX Should be a Configure test for double-dots in filenames.
4357         version=`echo $revision $patchlevel $subversion | \
4358                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4359         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4360                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4361         ;;
4362 *)
4363         version=`echo $revision $patchlevel $subversion | \
4364                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4365         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4366                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4367         ;;
4368 esac
4369 : Special case the 5.005_xx maintenance series, which used 5.005
4370 : without any subversion label as a subdirectory in $sitelib
4371 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4372         api_versionstring='5.005'
4373 fi
4374
4375 : Do we want threads support and if so, what type
4376 case "$usethreads" in
4377 $define|true|[yY]*)     dflt='y';;
4378 *)     # Catch case where user specified ithreads or 5005threads but
4379        # forgot -Dusethreads (A.D. 4/2002)
4380        case "$useithreads$use5005threads" in
4381        *$define*)       dflt='y';;
4382        *)               dflt='n';;
4383        esac
4384        ;;
4385 esac
4386 cat <<EOM
4387
4388 Perl can be built to offer a form of threading support on some systems
4389 To do so, Configure can be run with -Dusethreads.
4390
4391 Note that Perl built with threading support runs slightly slower
4392 and uses slightly more memory than plain Perl.
4393
4394 If this doesn't make any sense to you, just accept the default '$dflt'.
4395 EOM
4396 rp='Build a threading Perl?'
4397 . ./myread
4398 case "$ans" in
4399 y|Y)    val="$define" ;;
4400 *)      val="$undef" ;;
4401 esac
4402 set usethreads
4403 eval $setvar
4404
4405 if $test $patchlevel -lt 9; then
4406     case "$usethreads" in
4407     $define)
4408         : Default to ithreads unless overridden on command line or with
4409         : old config.sh
4410         dflt='y'
4411         case "$use5005threads" in
4412                 $define|true|[yY]*)
4413                         echo "5.005 threads are no longer supported"
4414                         exit 1
4415                 ;;
4416         esac
4417         case "$useithreads" in
4418                 $undef|false|[nN]*) dflt='n';;
4419         esac
4420         rp='Use the newer interpreter-based ithreads?'
4421         . ./myread
4422         case "$ans" in
4423         y|Y)    val="$define" ;;
4424         *)      val="$undef" ;;
4425         esac
4426         set useithreads
4427         eval $setvar
4428         : Now set use5005threads to the opposite value.
4429         case "$useithreads" in
4430         $define) val="$undef" ;;
4431         *) val="$define" ;;
4432         esac
4433         set use5005threads
4434         eval $setvar
4435         ;;
4436     *)
4437         useithreads="$undef"
4438         use5005threads="$undef"
4439         ;;
4440     esac
4441
4442     case "$useithreads$use5005threads" in
4443     "$define$define")
4444         $cat >&4 <<EOM
4445
4446 You cannot have both the ithreads and the 5.005 threads enabled
4447 at the same time.  Disabling the 5.005 threads since they are
4448 much less stable than the ithreads.
4449
4450 EOM
4451         use5005threads="$undef"
4452         ;;
4453     esac
4454
4455 else
4456 : perl-5.9.x and later
4457
4458     if test X"$usethreads" = "X$define"; then
4459         case "$use5005threads" in
4460             $define|true|[yY]*)
4461                 $cat >&4 <<EOM
4462
4463 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4464
4465 EOM
4466             ;;
4467         esac
4468     fi
4469
4470     use5005threads="$undef"
4471     useithreads="$usethreads"
4472 fi
4473
4474 case "$d_oldpthreads" in
4475 '')     : Configure tests would be welcome here.  For now, assume undef.
4476         val="$undef" ;;
4477 *)      val="$d_oldpthreads" ;;
4478 esac
4479 set d_oldpthreads
4480 eval $setvar
4481
4482
4483 : Look for a hint-file generated 'call-back-unit'.  If the
4484 : user has specified that a threading perl is to be built,
4485 : we may need to set or change some other defaults.
4486 if $test -f usethreads.cbu; then
4487     echo "Your platform has some specific hints regarding threaded builds, using them..."
4488     . ./usethreads.cbu
4489 else
4490     case "$usethreads" in
4491         "$define"|true|[yY]*)
4492                 $cat <<EOM
4493 (Your platform does not have any specific hints for threaded builds.
4494  Assuming POSIX threads, then.)
4495 EOM
4496         ;;
4497     esac
4498 fi
4499
4500 : Check if multiplicity is required
4501 cat <<EOM
4502
4503 Perl can be built so that multiple Perl interpreters can coexist
4504 within the same Perl executable.
4505 EOM
4506
4507 case "$useithreads" in
4508 $define)
4509         cat <<EOM
4510 This multiple interpreter support is required for interpreter-based threads.
4511 EOM
4512         val="$define"
4513         ;;
4514 *)      case "$usemultiplicity" in
4515         $define|true|[yY]*)     dflt='y';;
4516         *) dflt='n';;
4517         esac
4518         echo " "
4519         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4520         rp='Build Perl for multiplicity?'
4521         . ./myread
4522         case "$ans" in
4523         y|Y)    val="$define" ;;
4524         *)      val="$undef" ;;
4525         esac
4526         ;;
4527 esac
4528 set usemultiplicity
4529 eval $setvar
4530
4531 : Check if morebits is requested
4532 case "$usemorebits" in
4533 "$define"|true|[yY]*)
4534         use64bitint="$define"
4535         uselongdouble="$define"
4536         usemorebits="$define"
4537         ;;
4538 *)      usemorebits="$undef"
4539         ;;
4540 esac
4541
4542 : Determine the C compiler to be used
4543 echo " "
4544 case "$cc" in
4545 '') dflt=cc;;
4546 *) dflt="$cc";;
4547 esac
4548 rp="Use which C compiler?"
4549 . ./myread
4550 cc="$ans"
4551
4552 : See whether they have no cc but they do have gcc
4553 . ./trygcc
4554 if $test -f cc.cbu; then
4555     . ./cc.cbu
4556 fi
4557 . ./checkcc
4558
4559 : make some quick guesses about what we are up against
4560 echo " "
4561 $echo $n "Hmm...  $c"
4562 echo exit 1 >bsd
4563 echo exit 1 >usg
4564 echo exit 1 >v7
4565 echo exit 1 >osf1
4566 echo exit 1 >eunice
4567 echo exit 1 >xenix
4568 echo exit 1 >venix
4569 echo exit 1 >os2
4570 d_bsd="$undef"
4571 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4572 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4573 then
4574         echo "Looks kind of like an OSF/1 system, but we'll see..."
4575         echo exit 0 >osf1
4576 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4577         xxx=`./loc addbib blurfl $pth`
4578         if $test -f $xxx; then
4579         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4580                 echo exit 0 >bsd
4581                 echo exit 0 >usg
4582         else
4583                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4584                         echo "Looks kind of like an extended USG system, but we'll see..."
4585                 else
4586                         echo "Looks kind of like a USG system, but we'll see..."
4587                 fi
4588                 echo exit 0 >usg
4589         fi
4590 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4591         echo "Looks kind of like a BSD system, but we'll see..."
4592         d_bsd="$define"
4593         echo exit 0 >bsd
4594 else
4595         echo "Looks kind of like a Version 7 system, but we'll see..."
4596         echo exit 0 >v7
4597 fi
4598 case "$eunicefix" in
4599 *unixtovms*)
4600         $cat <<'EOI'
4601 There is, however, a strange, musty smell in the air that reminds me of
4602 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4603 EOI
4604         echo exit 0 >eunice
4605         d_eunice="$define"
4606 : it so happens the Eunice I know will not run shell scripts in Unix format
4607         ;;
4608 *)
4609         echo " "
4610         echo "Congratulations.  You aren't running Eunice."
4611         d_eunice="$undef"
4612         ;;
4613 esac
4614 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4615 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4616 : semicolon as a patch separator
4617 case "$p_" in
4618 :) ;;
4619 *)
4620         $cat <<'EOI'
4621 I have the feeling something is not exactly right, however...don't tell me...
4622 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4623 (Or you may be running DOS with DJGPP.)
4624 EOI
4625         echo exit 0 >os2
4626         ;;
4627 esac
4628 if test -f /xenix; then
4629         echo "Actually, this looks more like a XENIX system..."
4630         echo exit 0 >xenix
4631         d_xenix="$define"
4632 else
4633         echo " "
4634         echo "It's not Xenix..."
4635         d_xenix="$undef"
4636 fi
4637 chmod +x xenix
4638 $eunicefix xenix
4639 if test -f /venix; then
4640         echo "Actually, this looks more like a VENIX system..."
4641         echo exit 0 >venix
4642 else
4643         echo " "
4644         if ./xenix; then
4645                 : null
4646         else
4647                 echo "Nor is it Venix..."
4648         fi
4649 fi
4650 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4651 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4652 $rm -f foo
4653
4654 : Check if we are using GNU gcc and what its version is
4655 echo " "
4656 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4657 $cat >try.c <<EOM
4658 #include <stdio.h>
4659 int main() {
4660 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4661 #ifdef __VERSION__
4662         printf("%s\n", __VERSION__);
4663 #else
4664         printf("%s\n", "1");
4665 #endif
4666 #endif
4667         return(0);
4668 }
4669 EOM
4670 if $cc -o try $ccflags $ldflags try.c; then
4671         gccversion=`$run ./try`
4672         case "$gccversion" in
4673         '') echo "You are not using GNU cc." ;;
4674         *)  echo "You are using GNU cc $gccversion."
4675             ccname=gcc
4676             ;;
4677         esac
4678 else
4679         echo " "
4680         echo "*** WHOA THERE!!! ***" >&4
4681         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4682         case "$knowitall" in
4683         '')
4684         echo "    You'd better start hunting for one and let me know about it." >&4
4685                 exit 1
4686                 ;;
4687         esac
4688 fi
4689 $rm -f try try.*
4690 case "$gccversion" in
4691 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4692 esac
4693 case "$gccversion" in
4694 '') gccosandvers='' ;;
4695 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4696    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4697    gccshortvers=''
4698    case "$gccosandvers" in
4699    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4700    $osname$osvers) ;; # looking good
4701    $osname*) cat <<EOM >&4
4702
4703 *** WHOA THERE!!! ***
4704
4705     Your gcc has not been compiled for the exact release of
4706     your operating system ($gccosandvers versus $osname$osvers).
4707
4708     In general it is a good idea to keep gcc synchronized with
4709     the operating system because otherwise serious problems
4710     may ensue when trying to compile software, like Perl.
4711
4712     I'm trying to be optimistic here, though, and will continue.
4713     If later during the configuration and build icky compilation
4714     problems appear (headerfile conflicts being the most common
4715     manifestation), I suggest reinstalling the gcc to match
4716     your operating system release.
4717
4718 EOM
4719       ;;
4720    *) gccosandvers='' ;; # failed to parse, better be silent
4721    esac
4722    ;;
4723 esac
4724 case "$ccname" in
4725 '') ccname="$cc" ;;
4726 esac
4727
4728 # gcc 3.* complain about adding -Idirectories that they already know about,
4729 # so we will take those off from locincpth.
4730 case "$gccversion" in
4731 3*)
4732     echo "main(){}">try.c
4733     for incdir in $locincpth; do
4734        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4735              grep '^c[cp]p*[01]: warning: changing search order '`
4736        if test "X$warn" != X; then
4737            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4738        fi
4739     done
4740     $rm -f try try.*
4741 esac
4742
4743 # gcc 4.9 by default does some optimizations that break perl.
4744 # see ticket 121505.
4745 #
4746 # The -fwrapv disables those optimizations (and probably others,) so
4747 # for gcc 4.9 (and later, since the optimizations probably won't go
4748 # away), add -fwrapv unless the user requests -fno-wrapv, which
4749 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4750 # which turns the overflows -fwrapv ignores into runtime errors.
4751 case "$gccversion" in
4752 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4753     case "$ccflags" in
4754     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4755     *) ccflags="$ccflags -fwrapv" ;;
4756     esac
4757 esac
4758
4759 : What should the include directory be ?
4760 : Use sysroot if set, so findhdr looks in the right place.
4761 echo " "
4762 $echo $n "Hmm...  $c"
4763 dflt="$sysroot/usr/include"
4764 incpath=''
4765 mips_type=''
4766 if $test -f /bin/mips && /bin/mips; then
4767         echo "Looks like a MIPS system..."
4768         $cat >usr.c <<'EOCP'
4769 #ifdef SYSTYPE_BSD43
4770 /bsd43
4771 #endif
4772 EOCP
4773         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4774                 dflt='/bsd43/usr/include'
4775                 incpath='/bsd43'
4776                 mips_type='BSD 4.3'
4777         else
4778                 mips_type='System V'
4779         fi
4780         $rm -f usr.c usr.out
4781         echo "and you're compiling with the $mips_type compiler and libraries."
4782         xxx_prompt=y
4783         echo "exit 0" >mips
4784 else
4785         echo "Doesn't look like a MIPS system."
4786         xxx_prompt=n
4787         echo "exit 1" >mips
4788 fi
4789 chmod +x mips
4790 $eunicefix mips
4791 case "$usrinc" in
4792 '') ;;
4793 *) dflt="$usrinc";;
4794 esac
4795 case "$xxx_prompt" in
4796 y)      fn=d/
4797         echo " "
4798         rp='Where are the include files you want to use?'
4799         . ./getfile
4800         usrinc="$ans"
4801         ;;
4802 *)      usrinc="$dflt"
4803         ;;
4804 esac
4805
4806 : see how we invoke the C preprocessor
4807 echo " "
4808 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4809 cat <<'EOT' >testcpp.c
4810 #define ABC abc
4811 #define XYZ xyz
4812 ABC.XYZ
4813 EOT
4814 cd ..
4815 if test ! -f cppstdin; then
4816         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4817                 # AIX cc -E doesn't show the absolute headerfile
4818                 # locations but we'll cheat by using the -M flag.
4819                 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
4820         else
4821                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4822         fi
4823 else
4824         echo "Keeping your $hint cppstdin wrapper."
4825 fi
4826 chmod 755 cppstdin
4827 wrapper=`pwd`/cppstdin
4828 ok='false'
4829 cd UU
4830
4831 if $test "X$cppstdin" != "X" && \
4832         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4833         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4834 then
4835         echo "You used to use $cppstdin $cppminus so we'll use that again."
4836         case "$cpprun" in
4837         '') echo "But let's see if we can live without a wrapper..." ;;
4838         *)
4839                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4840                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4841                 then
4842                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4843                         ok='true'
4844                 else
4845                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4846                 fi
4847                 ;;
4848         esac
4849 else
4850         case "$cppstdin" in
4851         '') ;;
4852         *)
4853                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4854                 ;;
4855         esac
4856 fi
4857
4858 if $ok; then
4859         : nothing
4860 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4861         $cc -E <testcpp.c >testcpp.out 2>&1; \
4862         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4863         echo "Yup, it does."
4864         x_cpp="$cc $cppflags -E"
4865         x_minus='';
4866 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4867         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4868         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4869         echo "Yup, it does."
4870         x_cpp="$cc $cppflags -E"
4871         x_minus='-';
4872 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4873         $cc -P <testcpp.c >testcpp.out 2>&1; \
4874         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4875         echo "Yipee, that works!"
4876         x_cpp="$cc $cppflags -P"
4877         x_minus='';
4878 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4879         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4880         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4881         echo "At long last!"
4882         x_cpp="$cc $cppflags -P"
4883         x_minus='-';
4884 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4885         $cpp <testcpp.c >testcpp.out 2>&1; \
4886         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4887         echo "It works!"
4888         x_cpp="$cpp $cppflags"
4889         x_minus='';
4890 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4891         $cpp - <testcpp.c >testcpp.out 2>&1; \
4892         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4893         echo "Hooray, it works!  I was beginning to wonder."
4894         x_cpp="$cpp $cppflags"
4895         x_minus='-';
4896 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4897         $wrapper <testcpp.c >testcpp.out 2>&1; \
4898         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4899         x_cpp="$wrapper"
4900         x_minus=''
4901         echo "Eureka!"
4902 else
4903         dflt=''
4904         rp="No dice.  I can't find a C preprocessor.  Name one:"
4905         . ./myread
4906         x_cpp="$ans"
4907         x_minus=''
4908         $x_cpp <testcpp.c >testcpp.out 2>&1
4909         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4910                 echo "OK, that will do." >&4
4911         else
4912 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4913                 exit 1
4914         fi
4915 fi
4916
4917 case "$ok" in
4918 false)
4919         cppstdin="$x_cpp"
4920         cppminus="$x_minus"
4921         cpprun="$x_cpp"
4922         cpplast="$x_minus"
4923         set X $x_cpp
4924         shift
4925         case "$1" in
4926         "$cpp")
4927                 echo "Perhaps can we force $cc -E using a wrapper..."
4928                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4929                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4930                 then
4931                         echo "Yup, we can."
4932                         cppstdin="$wrapper"
4933                         cppminus='';
4934                 else
4935                         echo "Nope, we'll have to live without it..."
4936                 fi
4937                 ;;
4938         esac
4939         case "$cpprun" in
4940         "$wrapper")
4941                 cpprun=''
4942                 cpplast=''
4943                 ;;
4944         esac
4945         ;;
4946 esac
4947
4948 case "$cppstdin" in
4949 "$wrapper"|'cppstdin') ;;
4950 *) $rm -f $wrapper;;
4951 esac
4952 $rm -f testcpp.c testcpp.out
4953
4954 : Adjust cppfilter for path component separator
4955 case "$osname" in
4956 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4957 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4958 *)   cppfilter='' ;;
4959 esac
4960
4961 : Use gcc to determine libpth and incpth
4962 # If using gcc or clang, we can get better values for libpth, incpth
4963 # and usrinc directly from the compiler.
4964 # Note that ccname for clang is also gcc.
4965 case "$ccname" in
4966     gcc)
4967         $echo 'extern int foo;' > try.c
4968         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4969         shift
4970         if $test $# -gt 0; then
4971             incpth="$incpth $*"
4972             incpth="`$echo $incpth|$sed 's/^ //'`"
4973             for i in $*; do
4974                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4975                 if $test -d $j; then
4976                     libpth="$libpth $j"
4977                 fi
4978             done
4979             libpth="`$echo $libpth|$sed 's/^ //'`"
4980             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4981                 if $test -d $xxx; then
4982                     case " $libpth " in
4983                     *" $xxx "*) ;;
4984                     *) libpth="$libpth $xxx";;
4985                     esac
4986                 fi
4987             done
4988         fi
4989         $rm -f try.c
4990         case "$usrinc" in
4991         '') for i in $incpth; do
4992                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4993                     usrinc="$i"
4994                     break
4995                 fi
4996             done
4997             ;;
4998         esac
4999
5000         case "$usecrosscompile" in
5001         $define|true|[yY]*)
5002             case "$incpth" in
5003                 '') echo "Incpth not defined." >&4; croak=y ;;
5004                 *)  echo "Using incpth '$incpth'." >&4 ;;
5005             esac
5006             case "$libpth" in
5007                 '') echo "Libpth not defined." >&4; croak=y ;;
5008                 *)  echo "Using libpth '$libpth'." >&4 ;;
5009             esac
5010             case "$usrinc" in
5011                 '') echo "Usrinc not defined." >&4; croak=y ;;
5012                 *)  echo "Using usrinc $usrinc." >&4 ;;
5013             esac
5014             case "$croak" in
5015                 y)
5016                 if test "X$sysroot" = X; then
5017                     echo "Cannot continue, aborting." >&4; exit 1
5018                 else
5019                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5020                 fi
5021                 ;;
5022             esac
5023             ;;
5024         esac
5025     ;;
5026 esac
5027
5028 : Default value for incpth is just usrinc
5029 case "$incpth" in
5030 '') incpth="$usrinc";;
5031 esac
5032
5033 : Set private lib path
5034 case "$plibpth" in
5035 '') if ./mips; then
5036         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5037     fi;;
5038 esac
5039 case "$libpth" in
5040 ' ') dlist='';;
5041 '') dlist="$loclibpth $plibpth $glibpth";;
5042 *) dlist="$libpth";;
5043 esac
5044
5045 : Now check and see which directories actually exist, avoiding duplicates
5046 for xxx in $dlist
5047 do
5048     if $test -d $xxx; then
5049                 case " $libpth " in
5050                 *" $xxx "*) ;;
5051                 *) libpth="$libpth $xxx";;
5052                 esac
5053     fi
5054 done
5055 $cat <<'EOM'
5056
5057 Some systems have incompatible or broken versions of libraries.  Among
5058 the directories listed in the question below, please remove any you
5059 know not to be holding relevant libraries, and add any that are needed.
5060 Say "none" for none.
5061
5062 EOM
5063
5064 if test "X$sysroot" != X; then
5065     $cat <<EOM
5066 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5067
5068 EOM
5069 fi
5070
5071 case "$libpth" in
5072 '') dflt='none';;
5073 *)
5074         set X $libpth
5075         shift
5076         dflt=${1+"$@"}
5077         ;;
5078 esac
5079 rp="Directories to use for library searches?"
5080 . ./myread
5081 case "$ans" in
5082 none) libpth=' ';;
5083 *) libpth="$ans";;
5084 esac
5085
5086 : compute shared library extension
5087 case "$so" in
5088 '')
5089         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5090                 dflt='sl'
5091         else
5092                 dflt='so'
5093         fi
5094         ;;
5095 *) dflt="$so";;
5096 esac
5097 $cat <<EOM
5098
5099 On some systems, shared libraries may be available.  Answer 'none' if
5100 you want to suppress searching of shared libraries for the remainder
5101 of this configuration.
5102
5103 EOM
5104 rp='What is the file extension used for shared libraries?'
5105 . ./myread
5106 so="$ans"
5107
5108 : Does target system insist that shared library basenames are unique
5109 $cat << EOM
5110
5111 Some dynamic loaders assume that the *basename* of shared library filenames
5112 are globally unique.  We'll default this to undef as we assume your system
5113 is not this weird. Set to defined if you're on one of them.
5114
5115 EOM
5116
5117 dflt='n'
5118 rp='Make shared library basenames unique?'
5119 . ./myread
5120 case "$ans" in
5121 y|Y) val="$define" ;;
5122 *)   val="$undef"  ;;
5123 esac
5124 set d_libname_unique
5125 eval $setvar
5126
5127 : Define several unixisms.
5128 : Hints files or command line option can be used to override them.
5129 : The convoluted testing is in case hints files set either the old
5130 : or the new name.
5131 case "$_exe" in
5132 '')     case "$exe_ext" in
5133         '')     ;;
5134         *)      _exe="$exe_ext" ;;
5135         esac
5136         ;;
5137 esac
5138 case "$_a" in
5139 '')     case "$lib_ext" in
5140     '') _a='.a';;
5141         *)      _a="$lib_ext" ;;
5142         esac
5143         ;;
5144 esac
5145 case "$_o" in
5146 '') case "$obj_ext" in
5147         '')     _o='.o';;
5148         *)      _o="$obj_ext";;
5149         esac
5150         ;;
5151 esac
5152 case "$p_" in
5153 '') case "$path_sep" in
5154         '')     p_=':';;
5155         *)      p_="$path_sep";;
5156         esac
5157         ;;
5158 esac
5159 exe_ext=$_exe
5160 lib_ext=$_a
5161 obj_ext=$_o
5162 path_sep=$p_
5163
5164 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5165
5166 : Which makefile gets called first.  This is used by make depend.
5167 case "$firstmakefile" in
5168 '') firstmakefile='makefile';;
5169 esac
5170
5171 : Check is we will use socks
5172 case "$usesocks" in
5173 $define|true|[yY]*)     dflt='y';;
5174 *) dflt='n';;
5175 esac
5176 cat <<EOM
5177
5178 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5179 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5180 to use the PerlIO abstraction layer, this will be implicitly selected.
5181
5182 If this doesn't make any sense to you, just accept the default '$dflt'.
5183 EOM
5184 rp='Build Perl for SOCKS?'
5185 . ./myread
5186 case "$ans" in
5187 y|Y)    val="$define" ;;
5188 *)      val="$undef" ;;
5189 esac
5190 set usesocks
5191 eval $setvar
5192
5193 : Check for uselongdouble support
5194 case "$ccflags" in
5195 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5196 esac
5197
5198 case "$uselongdouble" in
5199 $define|true|[yY]*)     dflt='y';;
5200 *) dflt='n';;
5201 esac
5202 cat <<EOM
5203
5204 Perl can be built to take advantage of long doubles which
5205 (if available) may give more accuracy and range for floating point numbers.
5206
5207 If this doesn't make any sense to you, just accept the default '$dflt'.
5208 EOM
5209 rp='Try to use long doubles if available?'
5210 . ./myread
5211 case "$ans" in
5212 y|Y)    val="$define"   ;;
5213 *)      val="$undef"    ;;
5214 esac
5215 set uselongdouble
5216 eval $setvar
5217
5218 case "$uselongdouble" in
5219 true|[yY]*) uselongdouble="$define" ;;
5220 esac
5221
5222 : Look for a hint-file generated 'call-back-unit'.  If the
5223 : user has specified that long doubles should be used,
5224 : we may need to set or change some other defaults.
5225 if $test -f uselongdouble.cbu; then
5226     echo "Your platform has some specific hints regarding long doubles, using them..."
5227     . ./uselongdouble.cbu
5228 else
5229     case "$uselongdouble" in
5230         $define)
5231                 $cat <<EOM
5232 (Your platform does not have any specific hints for long doubles.)
5233 EOM
5234         ;;
5235     esac
5236 fi
5237
5238 : Check if quadmath is requested
5239 case "$usequadmath" in
5240 "$define"|true|[yY]*) usequadmath="$define" ;;
5241 *)                    usequadmath="$undef"  ;;
5242 esac
5243
5244 : Fail if both uselongdouble and usequadmath are requested
5245 case "$usequadmath:$uselongdouble" in
5246 define:define)
5247         $cat <<EOM >&4
5248
5249 *** You requested the use of the quadmath library and use
5250 *** of long doubles.
5251 ***
5252 *** Please select one or the other.
5253 EOM
5254         exit 1
5255         ;;
5256 esac
5257
5258 : Looking for optional libraries
5259 echo " "
5260 echo "Checking for optional libraries..." >&4
5261 case "$libs" in
5262 ' '|'') dflt='';;
5263 *) dflt="$libs";;
5264 esac
5265 case "$libswanted" in
5266 '') libswanted='c_s';;
5267 esac
5268 case "$usesocks" in
5269 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5270 esac
5271 case "$usecbacktrace" in
5272 "$define") libswanted="$libswanted bfd" ;;
5273 esac
5274 case "$usequadmath" in
5275 "$define") libswanted="$libswanted quadmath" ;;
5276 esac
5277 libsfound=''
5278 libsfiles=''
5279 libsdirs=''
5280 libspath=''
5281 for thisdir in $libpth $xlibpth; do
5282   test -d $thisdir && libspath="$libspath $thisdir"
5283 done
5284 for thislib in $libswanted; do
5285         for thisdir in $libspath; do
5286             xxx=''
5287             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5288                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5289                 $test -f "$xxx" && eval $libscheck
5290                 $test -f "$xxx" && libstyle=shared
5291                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5292                 $test -f "$xxx" && eval $libscheck
5293                 $test -f "$xxx" && libstyle=shared
5294             fi
5295             if test ! -f "$xxx"; then
5296                 xxx=$thisdir/lib$thislib.$so
5297                 $test -f "$xxx" && eval $libscheck
5298                 $test -f "$xxx" && libstyle=shared
5299             fi
5300             if test ! -f "$xxx"; then
5301                 xxx=$thisdir/lib$thislib$_a
5302                 $test -f "$xxx" && eval $libscheck
5303                 $test -f "$xxx" && libstyle=static
5304             fi
5305             if test ! -f "$xxx"; then
5306                 xxx=$thisdir/$thislib$_a
5307                 $test -f "$xxx" && eval $libscheck
5308                 $test -f "$xxx" && libstyle=static
5309             fi
5310             if test ! -f "$xxx"; then
5311                 xxx=$thisdir/lib${thislib}_s$_a
5312                 $test -f "$xxx" && eval $libscheck
5313                 $test -f "$xxx" && libstyle=static
5314                 $test -f "$xxx" && thislib=${thislib}_s
5315             fi
5316             if test ! -f "$xxx"; then
5317                 xxx=$thisdir/Slib$thislib$_a
5318                 $test -f "$xxx" && eval $libscheck
5319                 $test -f "$xxx" && libstyle=static
5320             fi
5321             if $test -f "$xxx"; then
5322                 case "$libstyle" in
5323                 shared) echo "Found -l$thislib (shared)." ;;
5324                 static) echo "Found -l$thislib." ;;
5325                 *)      echo "Found -l$thislib ($libstyle)." ;;
5326                 esac
5327                 case " $dflt " in
5328                 *"-l$thislib "*);;
5329                 *) dflt="$dflt -l$thislib"
5330                    libsfound="$libsfound $xxx"
5331                    yyy=`basename $xxx`
5332                    libsfiles="$libsfiles $yyy"
5333                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5334                    case " $libsdirs " in
5335                    *" $yyy "*) ;;
5336                    *) libsdirs="$libsdirs $yyy" ;;
5337                    esac
5338                    ;;
5339                 esac
5340                 break
5341             fi
5342         done
5343         if $test ! -f "$xxx"; then
5344             echo "No -l$thislib."
5345         fi
5346 done
5347 set X $dflt
5348 shift
5349 dflt="$*"
5350 case "$libs" in
5351 '') dflt="$dflt";;
5352 *) dflt="$libs";;
5353 esac
5354 case "$dflt" in
5355 ' '|'') dflt='none';;
5356 esac
5357
5358 $cat <<EOM
5359
5360 In order to compile $package on your machine, a number of libraries
5361 are usually needed.  Include any other special libraries here as well.
5362 Say "none" for none.  The default list is almost always right.
5363 EOM
5364
5365 echo " "
5366 rp="What libraries to use?"
5367 . ./myread
5368 case "$ans" in
5369 none) libs=' ';;
5370 *) libs="$ans";;
5371 esac
5372
5373 : determine optimization, if desired, or use for debug flag also
5374 case "$optimize" in
5375 ' '|$undef) dflt='none';;
5376 '') dflt='-O';;
5377 *) dflt="$optimize";;
5378 esac
5379 $cat <<EOH
5380
5381 By default, $package compiles with the -O flag to use the optimizer.
5382 Alternately, you might want to use the symbolic debugger, which uses
5383 the -g flag (on traditional Unix systems).  Either flag can be
5384 specified here.  To use neither flag, specify the word "none".
5385
5386 EOH
5387 rp="What optimizer/debugger flag should be used?"
5388 . ./myread
5389 optimize="$ans"
5390 case "$optimize" in
5391 'none') optimize=" ";;
5392 esac
5393
5394 : Check what DEBUGGING is required from the command line
5395 : -DEBUGGING      or -DDEBUGGING or
5396 : -DEBUGGING=both                       = -g + -DDEBUGGING
5397 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5398 : -DEBUGGING=none or -UDEBUGGING        =
5399 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5400 case "$EBUGGING" in
5401 '')     ;;
5402 *)      DEBUGGING=$EBUGGING ;;
5403 esac
5404
5405 case "$DEBUGGING" in
5406 -g|both|$define)
5407     case "$optimize" in
5408         *-g*) ;;
5409         *)    optimize="$optimize -g" ;;
5410     esac ;;
5411 none|$undef)
5412     case "$optimize" in
5413         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5414                 shift
5415                 optimize="$*"
5416                 ;;
5417     esac ;;
5418 esac
5419
5420 dflt=''
5421 case "$DEBUGGING" in
5422 both|$define) dflt='-DDEBUGGING'
5423 esac
5424
5425 : argument order is deliberate, as the flag will start with - which set could
5426 : think is an option
5427 checkccflag='check=$1; flag=$2; callback=$3;
5428 echo " ";
5429 echo "Checking if your compiler accepts $flag" 2>&1;
5430 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5431 echo "int main(void) { return 0; }" > gcctest.c;
5432 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5433     echo "Yes, it does." 2>&1;
5434     if $test -s gcctest.out ; then
5435         echo "But your platform does not like it:";
5436         cat gcctest.out;
5437     else
5438         case "$ccflags" in
5439         *$check*)
5440             echo "Leaving current flags $ccflags alone." 2>&1
5441             ;;
5442         *) dflt="$dflt $flag";
5443             eval $callback
5444             ;;
5445         esac
5446     fi
5447 else
5448     echo "Nope, it does not, but that is ok." 2>&1;
5449 fi
5450 '
5451
5452 : We will not override a previous value, but we might want to
5453 : augment a hint file
5454 case "$hint" in
5455 default|recommended)
5456         case "$gccversion" in
5457         1*) dflt="$dflt -fpcc-struct-return" ;;
5458         esac
5459         case "$optimize:$DEBUGGING" in
5460         *-g*:old) dflt="$dflt -DDEBUGGING";;
5461         esac
5462         case "$gccversion" in
5463         2*) if $test -d /etc/conf/kconfig.d &&
5464                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5465                 then
5466                         # Interactive Systems (ISC) POSIX mode.
5467                         dflt="$dflt -posix"
5468                 fi
5469                 ;;
5470         esac
5471         case "$gccversion" in
5472         1*) ;;
5473         2.[0-8]*) ;;
5474         ?*)     set strict-aliasing -fno-strict-aliasing
5475                 eval $checkccflag
5476                 ;;
5477         esac
5478         # For gcc, adding -pipe speeds up compilations for some, but apparently
5479         # some assemblers can't read from stdin.  (It also slows down compilations
5480         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5481         case "$gccversion" in
5482         ?*)     set pipe -pipe
5483                 eval $checkccflag
5484                 ;;
5485         esac
5486
5487         # on x86_64 (at least) we require an extra library (libssp) in the
5488         # link command line. This library is not named, so I infer that it is
5489         # an implementation detail that may change. Hence the safest approach
5490         # is to add the flag to the flags passed to the compiler at link time,
5491         # as that way the compiler can do the right implementation dependant
5492         # thing. (NWC)
5493         case "$osname" in
5494         amigaos) ;; # -fstack-protector builds but doesn't work
5495         *)      case "$gccversion" in
5496                 ?*)     set stack-protector-strong -fstack-protector-strong
5497                         eval $checkccflag
5498                         case "$dflt" in
5499                         *-fstack-protector-strong*) ;; # It got added.
5500                         *) # Try the plain/older -fstack-protector.
5501                            set stack-protector -fstack-protector
5502                            eval $checkccflag
5503                            ;;
5504                         esac
5505                         ;;
5506                 esac
5507                 ;;
5508         esac
5509         ;;
5510 esac
5511
5512 case "$mips_type" in
5513 *BSD*|'') inclwanted="$locincpth $usrinc";;
5514 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5515 esac
5516 for thisincl in $inclwanted; do
5517         if $test -d $thisincl; then
5518                 if $test x$thisincl != x$usrinc; then
5519                         case "$dflt" in
5520                         *" -I$thisincl "*);;
5521                         *) dflt="$dflt -I$thisincl ";;
5522                         esac
5523                 fi
5524         fi
5525 done
5526
5527 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5528         xxx=true;
5529 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5530         xxx=true;
5531 else
5532         xxx=false;
5533 fi;
5534 if $xxx; then
5535         case "$dflt" in
5536         *$2*);;
5537         *) dflt="$dflt -D$2";;
5538         esac;
5539 fi'
5540
5541 set signal.h LANGUAGE_C; eval $inctest
5542
5543 case "$usesocks" in
5544 $define)
5545         ccflags="$ccflags -DSOCKS"
5546         ;;
5547 esac
5548
5549 case "$hint" in
5550 default|recommended) dflt="$ccflags $dflt" ;;
5551 *) dflt="$ccflags";;
5552 esac
5553
5554 case "$dflt" in
5555 ''|' ') dflt=none;;
5556 esac
5557
5558 $cat <<EOH
5559
5560 Your C compiler may want other flags.  For this question you should include
5561 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5562 but you should NOT include libraries or ld flags like -lwhatever.  If you
5563 want $package to honor its debug switch, you should include -DDEBUGGING here.
5564 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5565
5566 To use no flags, specify the word "none".
5567
5568 EOH
5569 set X $dflt
5570 shift
5571 dflt=${1+"$@"}
5572 rp="Any additional cc flags?"
5573 . ./myread
5574 case "$ans" in
5575 none) ccflags='';;
5576 *) ccflags="$ans";;
5577 esac
5578
5579 : the following weeds options from ccflags that are of no interest to cpp
5580 case "$cppflags" in
5581 '') cppflags="$ccflags" ;;
5582 *)  set X $ccflags; shift
5583     case " $cppflags " in
5584     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5585     *) cppflags="$cppflags $ccflags" ;;
5586     esac
5587     ;;
5588 esac
5589 case "$gccversion" in
5590 1*) cppflags="$cppflags -D__GNUC__"
5591 esac
5592 case "$mips_type" in
5593 '');;
5594 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5595 esac
5596 case "$cppflags" in
5597 '');;
5598 *)
5599         echo " "
5600         echo "Let me guess what the preprocessor flags are..." >&4
5601         set X $cppflags
5602         shift
5603         cppflags=''
5604         $cat >cpp.c <<'EOM'
5605 #define BLURFL foo
5606
5607 BLURFL xx LFRULB
5608 EOM
5609         previous=''
5610         for flag in $*
5611         do
5612                 case "$flag" in
5613                 -*) ftry="$flag";;
5614                 *) ftry="$previous $flag";;
5615                 esac
5616                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5617                         >cpp1.out 2>/dev/null && \
5618                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5619                         >cpp2.out 2>/dev/null && \
5620                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5621                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5622                 then
5623                         cppflags="$cppflags $ftry"
5624                         previous=''
5625                 else
5626                         previous="$flag"
5627                 fi
5628         done
5629         set X $cppflags
5630         shift
5631         cppflags=${1+"$@"}
5632         case "$cppflags" in
5633         *-*)  echo "They appear to be: $cppflags";;
5634         esac
5635         $rm -f cpp.c cpp?.out
5636         ;;
5637 esac
5638
5639 : flags used in final linking phase
5640 case "$ldflags" in
5641 '') if ./venix; then
5642                 dflt='-i -z'
5643         else
5644                 dflt=''
5645         fi
5646         case "$ccflags" in
5647         *-posix*) dflt="$dflt -posix" ;;
5648         esac
5649         ;;
5650 *) dflt="$ldflags";;
5651 esac
5652 # See note above about -fstack-protector
5653 case "$ccflags" in
5654 *-fstack-protector-strong*)
5655         case "$dflt" in
5656         *-fstack-protector-strong*) ;; # Don't add it again
5657         *) dflt="$dflt -fstack-protector-strong" ;;
5658         esac
5659         ;;
5660 *-fstack-protector*)
5661         case "$dflt" in
5662         *-fstack-protector*) ;; # Don't add it again
5663         *) dflt="$dflt -fstack-protector" ;;
5664         esac
5665         ;;
5666 esac
5667
5668 : Try to guess additional flags to pick up local libraries.
5669 for thislibdir in $libpth; do
5670         case " $loclibpth " in
5671         *" $thislibdir "*)
5672                 case "$dflt " in
5673                 *"-L$thislibdir "*) ;;
5674                 *)  dflt="$dflt -L$thislibdir" ;;
5675                 esac
5676                 ;;
5677         esac
5678 done
5679
5680 case "$dflt" in
5681 '') dflt='none' ;;
5682 esac
5683
5684 $cat <<EOH
5685
5686 Your C linker may need flags.  For this question you should
5687 include -L/whatever and any other flags used by the C linker, but you
5688 should NOT include libraries like -lwhatever.
5689
5690 Make sure you include the appropriate -L/path flags if your C linker
5691 does not normally search all of the directories you specified above,
5692 namely
5693         $libpth
5694 To use no flags, specify the word "none".
5695
5696 EOH
5697
5698 rp="Any additional ld flags (NOT including libraries)?"
5699 . ./myread
5700 case "$ans" in
5701 none) ldflags='';;
5702 *) ldflags="$ans";;
5703 esac
5704 rmlist="$rmlist pdp11"
5705
5706 : coherency check
5707 echo " "
5708 echo "Checking your choice of C compiler and flags for coherency..." >&4
5709 $cat > try.c <<'EOF'
5710 #include <stdio.h>
5711 int main() { printf("Ok\n"); return(0); }
5712 EOF
5713 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5714 shift
5715 $cat >try.msg <<'EOM'
5716 I've tried to compile and run the following simple program:
5717
5718 EOM
5719 $cat try.c >> try.msg
5720
5721 $cat >> try.msg <<EOM
5722
5723 I used the command:
5724
5725         $*
5726         $run ./try
5727
5728 and I got the following output:
5729
5730 EOM
5731 dflt=y
5732 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5733         if $sh -c "$run ./try " >>try.msg 2>&1; then
5734                 xxx=`$run ./try`
5735                 case "$xxx" in
5736                 "Ok") dflt=n ;;
5737                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5738                 esac
5739         else
5740                 echo "The program compiled OK, but exited with status $?." >>try.msg
5741                 rp="You have a problem.  Shall I abort Configure"
5742                 dflt=y
5743         fi
5744 else
5745         echo "I can't compile the test program." >>try.msg
5746         rp="You have a BIG problem.  Shall I abort Configure"
5747         dflt=y
5748 fi
5749 case "$dflt" in
5750 y)
5751         $cat try.msg >&4
5752         case "$knowitall" in
5753         '')
5754                 echo "(The supplied flags or libraries might be incorrect.)"
5755                 ;;
5756         *) dflt=n;;
5757         esac
5758         echo " "
5759         . ./myread
5760         case "$ans" in
5761         n*|N*) ;;
5762         *)      echo "Ok.  Stopping Configure." >&4
5763                 exit 1
5764                 ;;
5765         esac
5766         ;;
5767 n) echo "OK, that should do.";;
5768 esac
5769 $rm_try gcctest gcctest.out
5770
5771 : define a shorthand compile call
5772 compile='
5773 mc_file=$1;
5774 shift;
5775 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5776 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5777 exit 1;
5778 fi;
5779 esac;
5780 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5781 : define a shorthand compile call for compilations that should be ok.
5782 compile_ok='
5783 mc_file=$1;
5784 shift;
5785 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5786
5787 : stub, used only to satisfy other units
5788 i_stdlib='define'
5789
5790 : check for lengths of integral types
5791 echo " "
5792 case "$intsize" in
5793 '')
5794         echo "Checking to see how big your integers are..." >&4
5795         $cat >try.c <<EOCP
5796 #include <stdio.h>
5797 #$i_stdlib I_STDLIB
5798 #ifdef I_STDLIB
5799 #include <stdlib.h>
5800 #endif
5801 int main()
5802 {
5803         printf("intsize=%d;\n", (int)sizeof(int));
5804         printf("longsize=%d;\n", (int)sizeof(long));
5805         printf("shortsize=%d;\n", (int)sizeof(short));
5806         exit(0);
5807 }
5808 EOCP
5809         set try
5810         if eval $compile_ok && $run ./try > /dev/null; then
5811                 eval `$run ./try`
5812                 echo "Your integers are $intsize bytes long."
5813                 echo "Your long integers are $longsize bytes long."
5814                 echo "Your short integers are $shortsize bytes long."
5815         else
5816                 $cat >&4 <<EOM
5817 !
5818 Help! I can't compile and run the intsize test program: please enlighten me!
5819 (This is probably a misconfiguration in your system or libraries, and
5820 you really ought to fix it.  Still, I'll try anyway.)
5821 !
5822 EOM
5823                 dflt=4
5824                 rp="What is the size of an integer (in bytes)?"
5825                 . ./myread
5826                 intsize="$ans"
5827                 dflt=$intsize
5828                 rp="What is the size of a long integer (in bytes)?"
5829                 . ./myread
5830                 longsize="$ans"
5831                 dflt=2
5832                 rp="What is the size of a short integer (in bytes)?"
5833                 . ./myread
5834                 shortsize="$ans"
5835         fi
5836         ;;
5837 esac
5838 $rm_try
5839
5840 : check for long long
5841 echo " "
5842 echo "Checking to see if you have long long..." >&4
5843 echo 'int main() { long long x = 7; return 0; }' > try.c
5844 set try
5845 if eval $compile; then
5846         val="$define"
5847         echo "You have long long."
5848 else
5849         val="$undef"
5850         echo "You do not have long long."
5851 fi
5852 $rm_try
5853 set d_longlong
5854 eval $setvar
5855
5856 : check for length of long long
5857 case "${d_longlong}${longlongsize}" in
5858 $define)
5859         echo " "
5860         echo "Checking to see how big your long longs are..." >&4
5861         $cat >try.c <<'EOCP'
5862 #include <stdio.h>
5863 int main()
5864 {
5865     printf("%d\n", (int)sizeof(long long));
5866     return(0);
5867 }
5868 EOCP
5869         set try
5870         if eval $compile_ok; then
5871                 longlongsize=`$run ./try`
5872                 echo "Your long longs are $longlongsize bytes long."
5873         else
5874                 dflt='8'
5875                 echo " "
5876                 echo "(I can't seem to compile the test program.  Guessing...)"
5877                 rp="What is the size of a long long (in bytes)?"
5878                 . ./myread
5879                 longlongsize="$ans"
5880         fi
5881         if $test "X$longsize" = "X$longlongsize"; then
5882                 echo "(That isn't any different from an ordinary long.)"
5883         fi
5884         ;;
5885 esac
5886 $rm_try
5887
5888 : determine filename position in cpp output
5889 echo " "
5890 echo "Computing filename position in cpp output for #include directives..." >&4
5891 case "$osname" in
5892 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5893 esac
5894 case "$fieldn" in
5895 '')
5896 case "$osname" in
5897 vos) testaccess=-e ;;
5898 *)   testaccess=-r ;;
5899 esac
5900 echo '#include <stdio.h>' > foo.c
5901 $cat >fieldn <<EOF
5902 $startsh
5903 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5904 $grep '^[       ]*#.*stdio\.h' | \
5905 while read cline; do
5906         pos=1
5907         set \$cline
5908         while $test \$# -gt 0; do
5909                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5910                         echo "\$pos"
5911                         exit 0
5912                 fi
5913                 shift
5914                 pos=\`expr \$pos + 1\`
5915         done
5916 done
5917 EOF
5918 chmod +x fieldn
5919 fieldn=`./fieldn`
5920 $rm -f foo.c fieldn
5921 ;;
5922 esac
5923 case $fieldn in
5924 '') pos='???';;
5925 1) pos=first;;
5926 2) pos=second;;
5927 3) pos=third;;
5928 *) pos="${fieldn}th";;
5929 esac
5930 echo "Your cpp writes the filename in the $pos field of the line."
5931
5932 : locate header file
5933 $cat >findhdr <<EOF
5934 $startsh
5935 wanted=\$1
5936 name=''
5937 for usrincdir in $incpth
5938 do
5939         if test -f \$usrincdir/\$wanted; then
5940                 echo "\$usrincdir/\$wanted"
5941                 exit 0
5942         fi
5943 done
5944 awkprg='{ print \$$fieldn }'
5945 echo "#include <\$wanted>" > foo\$\$.c
5946 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5947 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5948 while read cline; do
5949         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5950         case "\$name" in
5951         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5952         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5953         *) exit 2;;
5954         esac;
5955 done;
5956 #
5957 # status = 0: grep returned 0 lines, case statement not executed
5958 # status = 1: headerfile found
5959 # status = 2: while loop executed, no headerfile found
5960 #
5961 status=\$?
5962 $rm -f foo\$\$.c;
5963 if test \$status -eq 1; then
5964         exit 0;
5965 fi
5966 exit 1
5967 EOF
5968 chmod +x findhdr
5969
5970 : define an alternate in-header-list? function
5971 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5972 cont=true; xxf="echo \"<\$1> found.\" >&4";
5973 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5974 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5975 esac;
5976 case $# in 4) instead=instead;; *) instead="at last";; esac;
5977 while $test "$cont"; do
5978         xxx=`./findhdr $1`
5979         var=$2; eval "was=\$$2";
5980         if $test "$xxx" && $test -r "$xxx";
5981         then eval $xxf;
5982         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5983                 cont="";
5984         else eval $xxnf;
5985         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5986         set $yyy; shift; shift; yyy=$@;
5987         case $# in 0) cont="";;
5988         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5989                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5990         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5991                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5992         esac;
5993 done;
5994 while $test "$yyy";
5995 do set $yyy; var=$2; eval "was=\$$2";
5996         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5997         set $yyy; shift; shift; yyy=$@;
5998 done'
5999
6000 : see if inttypes.h is available
6001 : we want a real compile instead of Inhdr because some systems
6002 : have an inttypes.h which includes non-existent headers
6003 echo " "
6004 $cat >try.c <<EOCP
6005 #include <inttypes.h>
6006 int main() {
6007         static int32_t foo32 = 0x12345678;
6008 }
6009 EOCP
6010 set try
6011 if eval $compile; then
6012         echo "<inttypes.h> found." >&4
6013         val="$define"
6014 else
6015         echo "<inttypes.h> NOT found." >&4
6016         val="$undef"
6017 fi
6018 $rm_try
6019 set i_inttypes
6020 eval $setvar
6021
6022 : check for int64_t
6023 echo " "
6024 echo "Checking to see if you have int64_t..." >&4
6025 $cat >try.c <<EOCP
6026 #include <sys/types.h>
6027 #$i_inttypes I_INTTYPES
6028 #ifdef I_INTTYPES
6029 #include <inttypes.h>
6030 #endif
6031 int main() { int64_t x = 7; }
6032 EOCP
6033 set try
6034 if eval $compile; then
6035         val="$define"
6036         echo "You have int64_t."
6037 else
6038         val="$undef"
6039         echo "You do not have int64_t."
6040 fi
6041 $rm_try
6042 set d_int64_t
6043 eval $setvar
6044
6045 : Check if 64bit ints have a quad type
6046 echo " "
6047 echo "Checking which 64-bit integer type we could use..." >&4
6048
6049 case "$intsize" in
6050 8) val=int
6051    set quadtype
6052    eval $setvar
6053    val='"unsigned int"'
6054    set uquadtype
6055    eval $setvar
6056    quadkind=1
6057    ;;
6058 *) case "$longsize" in
6059    8) val=long
6060       set quadtype
6061       eval $setvar
6062       val='"unsigned long"'
6063       set uquadtype
6064       eval $setvar
6065       quadkind=2
6066       ;;
6067    *) case "$d_longlong:$longlongsize" in
6068       define:8)
6069         val='"long long"'
6070         set quadtype
6071         eval $setvar
6072         val='"unsigned long long"'
6073         set uquadtype
6074         eval $setvar
6075         quadkind=3
6076         ;;
6077       *) case "$d_int64_t" in
6078          define)
6079            val=int64_t
6080            set quadtype
6081            eval $setvar
6082            val=uint64_t
6083            set uquadtype
6084            eval $setvar
6085            quadkind=4
6086            ;;
6087          esac
6088          ;;
6089       esac
6090       ;;
6091    esac
6092    ;;
6093 esac
6094
6095 case "$quadtype" in
6096 '')     echo "Alas, no 64-bit integer types in sight." >&4
6097         d_quad="$undef"
6098         ;;
6099 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6100         d_quad="$define"
6101         ;;
6102 esac
6103
6104 : Do we want 64bit support
6105 case "$uselonglong" in
6106 "$define"|true|[yY]*)
6107         cat <<EOM >&4
6108
6109 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6110 EOM
6111         use64bitint="$define"
6112         ;;
6113 esac
6114 case "$use64bits" in
6115 "$define"|true|[yY]*)
6116         cat <<EOM >&4
6117
6118 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6119 EOM
6120         use64bitint="$define"
6121         ;;
6122 esac
6123 case "$use64bitints" in
6124 "$define"|true|[yY]*)
6125         cat <<EOM >&4
6126
6127 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6128 EOM
6129         use64bitint="$define"
6130         ;;
6131 esac
6132 case "$use64bitsint" in
6133 "$define"|true|[yY]*)
6134         cat <<EOM >&4
6135
6136 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6137 EOM
6138         use64bitint="$define"
6139         ;;
6140 esac
6141 case "$uselonglongs" in
6142 "$define"|true|[yY]*)
6143         cat <<EOM >&4
6144
6145 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6146 EOM
6147         use64bitint="$define"
6148         ;;
6149 esac
6150 case "$use64bitsall" in
6151 "$define"|true|[yY]*)
6152         cat <<EOM >&4
6153
6154 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6155 EOM
6156         use64bitall="$define"
6157         ;;
6158 esac
6159
6160 case "$ccflags" in
6161 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6162 esac
6163 case "$use64bitall" in
6164 "$define"|true|[yY]*) use64bitint="$define" ;;
6165 esac
6166
6167 case "$longsize" in
6168 8) cat <<EOM
6169
6170 You have natively 64-bit long integers.
6171 EOM
6172    val="$define"
6173    ;;
6174 *) case "$use64bitint" in
6175    "$define"|true|[yY]*) dflt='y';;
6176    *) dflt='n';;
6177    esac
6178    case "$d_quad" in
6179    "$define") ;;
6180    *) dflt='n' ;;
6181    esac
6182    cat <<EOM
6183
6184 Perl can be built to take advantage of 64-bit integer types
6185 on some systems.  To do so, Configure can be run with -Duse64bitint.
6186 Choosing this option will most probably introduce binary incompatibilities.
6187
6188 If this doesn't make any sense to you, just accept the default '$dflt'.
6189 (The default has been chosen based on your configuration.)
6190 EOM
6191    rp='Try to use 64-bit integers, if available?'
6192    . ./myread
6193    case "$ans" in
6194    [yY]*) val="$define" ;;
6195    *)     val="$undef"  ;;
6196    esac
6197    ;;
6198 esac
6199 set use64bitint
6200 eval $setvar
6201
6202 case "$use64bitall" in
6203 "$define"|true|[yY]*) dflt='y' ;;
6204 *) case "$longsize" in
6205    8) dflt='y' ;;
6206    *) dflt='n' ;;
6207    esac
6208    ;;
6209 esac
6210 cat <<EOM
6211
6212 You may also choose to try maximal 64-bitness.  It means using as much
6213 64-bitness as possible on the platform.  This in turn means even more
6214 binary incompatibilities.  On the other hand, your platform may not
6215 have any more 64-bitness available than what you already have chosen.
6216
6217 If this doesn't make any sense to you, just accept the default '$dflt'.
6218 (The default has been chosen based on your configuration.)
6219 EOM
6220 rp='Try to use maximal 64-bit support, if available?'
6221 . ./myread
6222 case "$ans" in
6223 [yY]*) val="$define" ;;
6224 *)     val="$undef"  ;;
6225 esac
6226 set use64bitall
6227 eval $setvar
6228 case "$use64bitall" in
6229 "$define")
6230         case "$use64bitint" in
6231         "$undef")
6232                 cat <<EOM
6233
6234 Since you have chosen a maximally 64-bit build, I'm also turning on
6235 the use of 64-bit integers.
6236 EOM
6237                 use64bitint="$define" ;;
6238         esac
6239         ;;
6240 esac
6241
6242 : Look for a hint-file generated 'call-back-unit'.  If the
6243 : user has specified that a 64-bit perl is to be built,
6244 : we may need to set or change some other defaults.
6245 if $test -f use64bitint.cbu; then
6246         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6247         . ./use64bitint.cbu
6248 fi
6249 case "$use64bitint" in
6250 "$define"|true|[yY]*)
6251         : This test was common to all the OpenBSD forks, and seems harmless for
6252         : other platforms:
6253         echo " "
6254         echo "Checking if your C library has broken 64-bit functions..." >&4
6255         cat >try.c <<EOCP
6256 #include <stdio.h>
6257 typedef $uquadtype myULL;
6258 int main (void)
6259 {
6260     struct {
6261         double d;
6262         myULL  u;
6263     } *p, test[] = {
6264         {4294967303.15, 4294967303ULL},
6265         {4294967294.2,  4294967294ULL},
6266         {4294967295.7,  4294967295ULL},
6267         {0.0, 0ULL}
6268     };
6269     for (p = test; p->u; p++) {
6270         myULL x = (myULL)p->d;
6271         if (x != p->u) {
6272             printf("buggy\n");
6273             return 0;
6274         }
6275     }
6276     printf("ok\n");
6277     return 0;
6278 }
6279 EOCP
6280         set try
6281         if eval $compile_ok; then
6282             libcquad=`$run ./try`
6283             echo "Your C library's 64-bit functions are $libcquad."
6284         else
6285             echo "(I can't seem to compile the test program.)"
6286             echo "Assuming that your C library's 64-bit functions are ok."
6287             libcquad="ok"
6288         fi
6289         $rm_try
6290
6291         case "$libcquad" in
6292             buggy*)
6293                 cat >&4 <<EOM
6294
6295 *** You have a C library with broken 64-bit functions.
6296 *** 64-bit support does not work reliably in this configuration.
6297 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6298 *** Cannot continue, aborting.
6299
6300 EOM
6301                 exit 1
6302                 ;;
6303         esac
6304         case "$longsize" in
6305         4) case "$archname64" in
6306            '') archname64=64int ;;
6307            esac
6308            ;;
6309         esac
6310         ;;
6311 esac
6312
6313 : Look for a hint-file generated 'call-back-unit'.  If the
6314 : user has specified that a maximally 64-bit perl is to be built,
6315 : we may need to set or change some other defaults.
6316 if $test -f use64bitall.cbu; then
6317         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6318         . ./use64bitall.cbu
6319 fi
6320 case "$use64bitall" in
6321 "$define"|true|[yY]*)
6322         case "$longsize" in
6323         4) case "$archname64" in
6324            ''|64int) archname64=64all ;;
6325            esac
6326            ;;
6327         esac
6328         ;;
6329 esac
6330
6331 case "$d_quad:$use64bitint" in
6332 $undef:$define)
6333         cat >&4 <<EOF
6334
6335 *** You have chosen to use 64-bit integers,
6336 *** but none can be found.
6337 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6338 *** Cannot continue, aborting.
6339
6340 EOF
6341         exit 1
6342         ;;
6343 esac
6344
6345 : Check if we are using the GNU C library
6346 echo " "
6347 echo "Checking for GNU C Library..." >&4
6348 cat >try.c <<'EOCP'
6349 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6350    alone are insufficient to distinguish different versions, such as
6351    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6352    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6353 */
6354 #include <stdio.h>
6355 int main(void)
6356 {
6357 #ifdef __GLIBC__
6358 #   ifdef __GLIBC_MINOR__
6359 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6360 #           include <gnu/libc-version.h>
6361             printf("%s\n",  gnu_get_libc_version());
6362 #       else
6363             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6364 #       endif
6365 #   else
6366         printf("%d\n",  __GLIBC__);
6367 #   endif
6368     return 0;
6369 #else
6370     return 1;
6371 #endif
6372 }
6373 EOCP
6374 set try
6375 if eval $compile_ok && $run ./try > glibc.ver; then
6376         val="$define"
6377         gnulibc_version=`$cat glibc.ver`
6378         echo "You are using the GNU C Library version $gnulibc_version"
6379 else
6380         val="$undef"
6381         gnulibc_version=''
6382         echo "You are not using the GNU C Library"
6383 fi
6384 $rm_try glibc.ver
6385 set d_gnulibc
6386 eval $setvar
6387
6388 : see if nm is to be used to determine whether a symbol is defined or not
6389 case "$usenm" in
6390 '')
6391         dflt=''
6392         case "$d_gnulibc" in
6393         "$define")
6394                 echo " "
6395                 echo "nm probably won't work on the GNU C Library." >&4
6396                 dflt=n
6397                 ;;
6398         esac
6399         case "$dflt" in
6400         '')
6401                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6402                         echo " "
6403                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6404                         echo "'nm' won't be sufficient on this system." >&4
6405                         dflt=n
6406                 fi
6407                 ;;
6408         esac
6409         case "$dflt" in
6410         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6411                 if $test $dflt -gt 20; then
6412                         dflt=y
6413                 else
6414                         dflt=n
6415                 fi
6416                 ;;
6417         esac
6418         ;;
6419 *)
6420         case "$usenm" in
6421         true|$define) dflt=y;;
6422         *) dflt=n;;
6423         esac
6424         ;;
6425 esac
6426 $cat <<EOM
6427
6428 I can use $nm to extract the symbols from your C libraries. This
6429 is a time consuming task which may generate huge output on the disk (up
6430 to 3 megabytes) but that should make the symbols extraction faster. The
6431 alternative is to skip the 'nm' extraction part and to compile a small
6432 test program instead to determine whether each symbol is present. If
6433 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6434 this may be the best solution.
6435
6436 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6437
6438 EOM
6439 rp="Shall I use $nm to extract C symbols from the libraries?"
6440 . ./myread
6441 case "$ans" in
6442 [Nn]*) usenm=false;;
6443 *) usenm=true;;
6444 esac
6445
6446 runnm=$usenm
6447 case "$reuseval" in
6448 true) runnm=false;;
6449 esac
6450
6451 : nm options which may be necessary
6452 case "$nm_opt" in
6453 '') if $test -f /mach_boot; then
6454                 nm_opt=''       # Mach
6455         elif $test -d /usr/ccs/lib; then
6456                 nm_opt='-p'     # Solaris (and SunOS?)
6457         elif $test -f /dgux; then
6458                 nm_opt='-p'     # DG-UX
6459         elif $test -f /lib64/rld; then
6460                 nm_opt='-p'     # 64-bit Irix
6461         else
6462                 nm_opt=''
6463         fi;;
6464 esac
6465
6466 : nm options which may be necessary for shared libraries but illegal
6467 : for archive libraries.  Thank you, Linux.
6468 case "$nm_so_opt" in
6469 '')     case "$myuname" in
6470         *linux*|gnu*)
6471                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6472                         nm_so_opt='--dynamic'
6473                 fi
6474                 ;;
6475         esac
6476         ;;
6477 esac
6478
6479 : Figure out where the libc is located
6480 case "$runnm" in
6481 true)
6482 : get list of predefined functions in a handy place
6483 echo " "
6484 case "$libc" in
6485 '') libc=unknown
6486         case "$libs" in
6487         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6488         esac
6489         ;;
6490 esac
6491 case "$libs" in
6492 '') ;;
6493 *)  for thislib in $libs; do
6494         case "$thislib" in
6495         -lc|-lc_s)
6496                 : Handle C library specially below.
6497                 ;;
6498         -l*)
6499                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6500                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6501                         :
6502                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6503                         :
6504                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6505                         :
6506                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6507                         :
6508                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6509                         :
6510                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6511                         :
6512                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6513                         :
6514                 else
6515                         try=''
6516                 fi
6517                 libnames="$libnames $try"
6518                 ;;
6519         *) libnames="$libnames $thislib" ;;
6520         esac
6521         done
6522         ;;
6523 esac
6524 xxx=normal
6525 case "$libc" in
6526 unknown)
6527         set /lib/libc.$so
6528         for xxx in $libpth; do
6529                 $test -r $1 || set $xxx/libc.$so
6530                 : The messy sed command sorts on library version numbers.
6531                 $test -r $1 || \
6532                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6533                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6534                                 h
6535                                 s/[0-9][0-9]*/0000&/g
6536                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6537                                 G
6538                                 s/\n/ /' | \
6539                          $sort | $sed -e 's/^.* //'`
6540                 eval set \$$#
6541         done
6542         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6543         $test -r $1 || set $sysroot/lib/libsys_s$_a
6544         ;;
6545 *)
6546         set blurfl
6547         ;;
6548 esac
6549 if $test -r "$1"; then
6550         echo "Your (shared) C library seems to be in $1."
6551         libc="$1"
6552 elif $test -r /lib/libc && $test -r /lib/clib; then
6553         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6554         xxx=apollo
6555         libc='/lib/clib /lib/libc'
6556         if $test -r /lib/syslib; then
6557                 echo "(Your math library is in /lib/syslib.)"
6558                 libc="$libc /lib/syslib"
6559         fi
6560 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6561         echo "Your C library seems to be in $libc, as you said before."
6562 elif $test -r $incpath/usr/lib/libc$_a; then
6563         libc=$incpath/usr/lib/libc$_a;
6564         echo "Your C library seems to be in $libc.  That's fine."
6565 elif $test -r /lib/libc$_a; then
6566         libc=/lib/libc$_a;
6567         echo "Your C library seems to be in $libc.  You're normal."
6568 else
6569         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6570                 :
6571         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6572                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6573         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6574                 :
6575         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6576                 :
6577         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6578                 :
6579         else
6580                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6581         fi
6582         if $test -r "$tans"; then
6583                 echo "Your C library seems to be in $tans, of all places."
6584                 libc=$tans
6585         else
6586                 libc='blurfl'
6587         fi
6588 fi
6589 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6590         dflt="$libc"
6591         cat <<EOM
6592
6593 If the guess above is wrong (which it might be if you're using a strange
6594 compiler, or your machine supports multiple models), you can override it here.
6595
6596 EOM
6597 else
6598         dflt=''
6599         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6600         cat >&4 <<EOM
6601 I can't seem to find your C library.  I've looked in the following places:
6602
6603 EOM
6604         $sed 's/^/      /' libpath
6605         cat <<EOM
6606
6607 None of these seems to contain your C library. I need to get its name...
6608
6609 EOM
6610 fi
6611 fn=f
6612 rp='Where is your C library?'
6613 . ./getfile
6614 libc="$ans"
6615
6616 echo " "
6617 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6618 set X `cat libnames`
6619 shift
6620 xxx=files
6621 case $# in 1) xxx=file; esac
6622 echo "Extracting names from the following $xxx for later perusal:" >&4
6623 echo " "
6624 $sed 's/^/      /' libnames >&4
6625 echo " "
6626 $echo $n "This may take a while...$c" >&4
6627
6628 for file in $*; do
6629         case $file in
6630         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6631         *) $nm $nm_opt $file 2>/dev/null;;
6632         esac
6633 done >libc.tmp
6634
6635 $echo $n ".$c"
6636 $grep fprintf libc.tmp > libc.ptf
6637 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6638 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6639 xxx='[ADTSIWi]'
6640 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6641         eval $xscan;\
6642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6643                 eval $xrun
6644 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6645         eval $xscan;\
6646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6647                 eval $xrun
6648 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6649         eval $xscan;\
6650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6651                 eval $xrun
6652 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6653         eval $xscan;\
6654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6655                 eval $xrun
6656 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6657         eval $xscan;\
6658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6659                 eval $xrun
6660 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6661         eval $xscan;\
6662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6663                 eval $xrun
6664 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6665                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6666         eval $xscan;\
6667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6668                 eval $xrun
6669 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6670         eval $xscan;\
6671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6672                 eval $xrun
6673 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6674         eval $xscan;\
6675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6676                 eval $xrun
6677 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6678         eval $xscan;\
6679         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6680                 eval $xrun
6681 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6682         eval $xscan;\
6683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6684                 eval $xrun
6685 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6686         eval $xscan;\
6687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6688                 eval $xrun
6689 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6690         eval $xscan;\
6691         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6692                 eval $xrun
6693 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6694         eval $xscan;\
6695         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6696                 eval $xrun
6697 else
6698         $nm -p $* 2>/dev/null >libc.tmp
6699         $grep fprintf libc.tmp > libc.ptf
6700         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6701                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6702         then
6703                 nm_opt='-p'
6704                 eval $xrun
6705         else
6706                 echo " "
6707                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6708                 com=''
6709                 if $ar t $libc > libc.tmp && \
6710                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6711                 then
6712                         for thisname in $libnames $libc; do
6713                                 $ar t $thisname >>libc.tmp
6714                         done
6715                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6716                         echo "Ok." >&4
6717                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6718                         for thisname in $libnames $libc; do
6719                                 $ar tv $thisname >>libc.tmp
6720                                 emximp -o tmp.imp $thisname \
6721                                     2>/dev/null && \
6722                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6723                                     < tmp.imp >>libc.tmp
6724                                 $rm -f tmp.imp
6725                         done
6726                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6727                         echo "Ok." >&4
6728                 else
6729                         echo "$ar didn't seem to work right." >&4
6730                         echo "Maybe this is a Cray...trying bld instead..." >&4
6731                         if  bld t $libc | \
6732                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6733                                 $test -s libc.list
6734                         then
6735                                 for thisname in $libnames; do
6736                                         bld t $libnames | \
6737                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6738                                         $ar t $thisname >>libc.tmp
6739                                 done
6740                                 echo "Ok." >&4
6741                         else
6742                                 echo "That didn't work either.  Giving up." >&4
6743                                 exit 1
6744                         fi
6745                 fi
6746         fi
6747 fi
6748 nm_extract="$com"
6749 case "$PASE" in
6750 define)
6751     echo " "
6752     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6753     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6754     ;;
6755 *)  if $test -f /lib/syscalls.exp; then
6756         echo " "
6757         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6758         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6759                 /lib/syscalls.exp >>libc.list
6760     fi
6761     ;;
6762 esac
6763 ;;
6764 esac
6765 $rm -f libnames libpath
6766
6767 : Check if we are using C++
6768 echo " "
6769 echo "Checking for C++..." >&4
6770 $cat >try.c <<'EOCP'
6771 #include <stdio.h>
6772 int main(void)
6773 {
6774 #ifdef __cplusplus
6775     return 0;
6776 #else
6777     return 1;
6778 #endif
6779 }
6780 EOCP
6781 set try
6782 if eval $compile_ok && $run ./try; then
6783         val="$define"
6784         echo "You are using a C++ compiler."
6785 else
6786         val="$undef"
6787         echo "You are not using a C++ compiler."
6788 fi
6789 $rm_try cplusplus$$
6790 set d_cplusplus
6791 eval $setvar
6792
6793 : is a C symbol defined?
6794 csym='tlook=$1;
6795 case "$3" in
6796 -v) tf=libc.tmp; tdc="";;
6797 -a) tf=libc.tmp; tdc="[]";;
6798 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6799 esac;
6800 case "$d_cplusplus" in
6801     $define)    extern_C="extern \"C\"" ;;
6802     *)          extern_C="extern"       ;;
6803 esac;
6804 tx=yes;
6805 case "$reuseval-$4" in
6806 true-) ;;
6807 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6808 esac;
6809 case "$tx" in
6810 yes)
6811         tval=false;
6812         if $test "$runnm" = true; then
6813                 if $contains $tlook $tf >/dev/null 2>&1; then
6814                         tval=true;
6815                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6816                         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;
6817                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6818                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6819                         $rm_try;
6820                 fi;
6821         else
6822                 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;
6823                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6824                 $rm_try;
6825         fi;
6826         ;;
6827 *)
6828         case "$tval" in
6829         $define) tval=true;;
6830         *) tval=false;;
6831         esac;
6832         ;;
6833 esac;
6834 eval "$2=$tval"'
6835
6836 : define an is-in-libc? function
6837 inlibc='echo " "; td=$define; tu=$undef;
6838 sym=$1; var=$2; eval "was=\$$2";
6839 tx=yes;
6840 case "$reuseval$was" in
6841 true) ;;
6842 true*) tx=no;;
6843 esac;
6844 case "$tx" in
6845 yes)
6846         set $sym tres -f;
6847         eval $csym;
6848         case "$tres" in
6849         true)
6850                 echo "$sym() found." >&4;
6851                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6852         *)
6853                 echo "$sym() NOT found." >&4;
6854                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6855         esac;;
6856 *)
6857         case "$was" in
6858         $define) echo "$sym() found." >&4;;
6859         *) echo "$sym() NOT found." >&4;;
6860         esac;;
6861 esac'
6862
6863 : check for length of double
6864 echo " "
6865 case "$doublesize" in
6866 '')
6867         echo "Checking to see how big your double precision numbers are..." >&4
6868         $cat >try.c <<EOCP
6869 #include <stdio.h>
6870 #$i_stdlib I_STDLIB
6871 #ifdef I_STDLIB
6872 #include <stdlib.h>
6873 #endif
6874 int main()
6875 {
6876     printf("%d\n", (int)sizeof(double));
6877     exit(0);
6878 }
6879 EOCP
6880         set try
6881         if eval $compile_ok; then
6882                 doublesize=`$run ./try`
6883                 echo "Your double is $doublesize bytes long."
6884         else
6885                 dflt='8'
6886                 echo "(I can't seem to compile the test program.  Guessing...)"
6887                 rp="What is the size of a double precision number (in bytes)?"
6888                 . ./myread
6889                 doublesize="$ans"
6890         fi
6891         ;;
6892 esac
6893 $rm_try
6894
6895 : check for long doubles
6896 echo " "
6897 echo "Checking to see if you have long double..." >&4
6898 echo 'int main() { long double x = 7.0; }' > try.c
6899 set try
6900 if eval $compile; then
6901         val="$define"
6902         echo "You have long double."
6903 else
6904         val="$undef"
6905         echo "You do not have long double."
6906 fi
6907 $rm_try
6908 set d_longdbl
6909 eval $setvar
6910
6911 : see if ldexpl exists
6912 set ldexpl d_ldexpl
6913 eval $inlibc
6914
6915 : check for length of long double
6916 case "${d_longdbl}${longdblsize}" in
6917 $define)
6918         echo " "
6919         echo "Checking to see how big your long doubles are..." >&4
6920         $cat >try.c <<'EOCP'
6921 #include <stdio.h>
6922 int main()
6923 {
6924         printf("%d\n", sizeof(long double));
6925 }
6926 EOCP
6927         set try
6928         set try
6929         if eval $compile; then
6930                 longdblsize=`$run ./try`
6931                 echo "Your long doubles are $longdblsize bytes long."
6932         else
6933                 dflt='8'
6934                 echo " "
6935                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6936                 rp="What is the size of a long double (in bytes)?"
6937                 . ./myread
6938                 longdblsize="$ans"
6939         fi
6940         if $test "X$doublesize" = "X$longdblsize"; then
6941                 echo "That isn't any different from an ordinary double."
6942                 echo "I'll keep your setting anyway, but you may see some"
6943                 echo "harmless compilation warnings."
6944         fi
6945         ;;
6946 esac
6947 $rm_try
6948
6949 $echo "Checking the kind of long doubles you have..." >&4
6950 case "$d_longdbl" in
6951 define)
6952 $cat <<EOP >try.c
6953 #$i_stdlib I_STDLIB
6954 #define LONGDBLSIZE $longdblsize
6955 #define DOUBLESIZE $doublesize
6956 #include <float.h>
6957 #ifdef I_STDLIB
6958 #include <stdlib.h>
6959 #endif
6960 #include <stdio.h>
6961 static const long double d = -0.1L;
6962 int main() {
6963   unsigned const char* b = (unsigned const char*)(&d);
6964 #if DOUBLESIZE == LONGDBLSIZE
6965   printf("0\n"); /* if it floats like double */
6966   exit(0);
6967 #endif
6968 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6969   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6970     /* IEEE 754 128-bit little-endian */
6971     printf("1\n");
6972     exit(0);
6973   }
6974   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6975     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6976     printf("2\n");
6977     exit(0);
6978   }
6979 #endif
6980 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6981  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6982  * cannot be trusted. */
6983 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6984   if (b[0] == 0xCD && b[9] == 0xBF) {
6985     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6986      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6987      * Also known as "extended precision". */
6988     printf("3\n");
6989     exit(0);
6990   }
6991   if (b[0] == 0xBF && b[9] == 0xCD) {
6992     /* Is there ever big-endian 80-bit, really?
6993      *
6994      * The Motorola 68881 had another "extended precision" format:
6995      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6996      * for total of 96 bits of bytes.  The zero bits were unused.
6997      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
6998      * If it ever becomes relevant, this format should be allocated
6999      * a new doublekind code since it's quite different from the Intel x87.
7000      */
7001     printf("4\n");
7002     exit(0);
7003   }
7004 #endif
7005 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7006   /* software "double double", the 106 is 53+53.
7007    * but irix thinks it is 107. */
7008   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7009     /* double double 128-bit fully little-endian,
7010      * little-endian doubles in little-endian order,
7011      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7012     printf("5\n");
7013     exit(0);
7014   }
7015   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7016     /* double double 128-bit fully big-endian,
7017      * big-endian doubles in big-endian order,
7018      * e.g. PPC/Power and MIPS:
7019      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7020     printf("6\n");
7021     exit(0);
7022   }
7023   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7024     /* double double 128-bit mixed endian.
7025      * little-endian doubles in big-endian order,
7026      * e.g. ppc64el,
7027      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7028     printf("7\n");
7029     exit(0);
7030   }
7031   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7032     /* double double 128-bit mixed endian,
7033      * big-endian doubles in little-endian order,
7034      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7035     printf("8\n");
7036     exit(0);
7037   }
7038 #endif
7039 /* We are largely making this up because it may well be
7040  * that the VAX format H was never made available to C,
7041  * only to Fortran. */
7042 #if LONGDBLSIZE == 16 && defined(__vax__)
7043   if (b[0] == 0xFD && b[15] == 0x99) {
7044     /* VAX format H, PDP-11 mixed endian. */
7045     printf("9\n");
7046     exit(0);
7047   }
7048 #endif
7049   printf("-1\n"); /* unknown */
7050   exit(0);
7051 }
7052 EOP
7053 set try
7054 if eval $compile; then
7055     longdblkind=`$run ./try`
7056 else
7057     longdblkind=-1
7058 fi
7059 ;;
7060 *) longdblkind=0 ;;
7061 esac
7062 case "$longdblkind" in
7063 0) echo "Your long doubles are doubles." >&4 ;;
7064 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7065 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7066 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7067 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7068 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7069 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7070 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7071 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7072 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7073 *) echo "Cannot figure out your long double." >&4 ;;
7074 esac
7075 d_long_double_style_ieee=$undef
7076 d_long_double_style_ieee_std=$undef
7077 d_long_double_style_ieee_extended=$undef
7078 d_long_double_style_ieee_doubledouble=$undef
7079 d_long_double_style_vax=$undef
7080 case "$longdblkind" in
7081 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7082 esac
7083 case "$longdblkind" in
7084 1|2) d_long_double_style_ieee_std=$define ;;
7085 esac
7086 case "$longdblkind" in
7087 3|4) d_long_double_style_ieee_extended=$define ;;
7088 esac
7089 case "$longdblkind" in
7090 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7091 esac
7092 case "$longdblkind" in
7093 9) d_long_double_style_vax=$define ;;
7094 esac
7095 $rm_try
7096
7097 : determine the architecture name
7098 echo " "
7099 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7100         tarch=`arch`"-$osname"
7101 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7102         if uname -m > tmparch 2>&1 ; then
7103                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7104                         -e 's/$/'"-$osname/" tmparch`
7105         else
7106                 tarch="$osname"
7107         fi
7108         $rm -f tmparch
7109 else
7110         tarch="$osname"
7111 fi
7112 case "$myarchname" in
7113 ''|"$tarch") ;;
7114 *)
7115         echo "(Your architecture name used to be $myarchname.)"
7116         archname=''
7117         ;;
7118 esac
7119 case "$targetarch" in
7120 '') ;;
7121 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7122 esac
7123 myarchname="$tarch"
7124 case "$archname" in
7125 '') dflt="$tarch";;
7126 *) dflt="$archname";;
7127 esac
7128 rp='What is your architecture name'
7129 . ./myread
7130 archname="$ans"
7131
7132 : optionally add API version to the architecture for versioned archlibs
7133 case "$useversionedarchname" in
7134 $define|true|[yY]*) dflt='y';;
7135 *)                  dflt='n';;
7136 esac
7137 rp='Add the Perl API version to your archname?'
7138 . ./myread
7139 case "$ans" in
7140 y|Y)    useversionedarchname="$define" ;;
7141 *)      useversionedarchname="$undef" ;;
7142 esac
7143 case "$useversionedarchname" in
7144 $define)
7145         case "$archname" in
7146         *-$api_versionstring)
7147                 echo "...and architecture name already has -$api_versionstring" >&4
7148                 ;;
7149         *)
7150                 archname="$archname-$api_versionstring"
7151                 echo "...setting architecture name to $archname." >&4
7152                 ;;
7153         esac
7154         ;;
7155 esac
7156
7157 case "$usethreads" in
7158 $define)
7159         echo "Threads selected." >&4
7160         case "$archname" in
7161         *-thread*) echo "...and architecture name already has -thread." >&4
7162                 ;;
7163         *)      archname="$archname-thread"
7164                 echo "...setting architecture name to $archname." >&4
7165                 ;;
7166         esac
7167         ;;
7168 esac
7169 case "$usemultiplicity" in
7170 $define)
7171         echo "Multiplicity selected." >&4
7172         case "$archname" in
7173         *-multi*) echo "...and architecture name already has -multi." >&4
7174                 ;;
7175         *)      archname="$archname-multi"
7176                 echo "...setting architecture name to $archname." >&4
7177                 ;;
7178         esac
7179         ;;
7180 esac
7181 case "$use64bitint$use64bitall" in
7182 *"$define"*)
7183         case "$archname64" in
7184         '')
7185                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7186                 ;;
7187         *)
7188                 case "$use64bitint" in
7189                 "$define") echo "64 bit integers selected." >&4 ;;
7190                 esac
7191                 case "$use64bitall" in
7192                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7193                 esac
7194                 case "$archname" in
7195                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7196                         ;;
7197                 *)      archname="$archname-$archname64"
7198                         echo "...setting architecture name to $archname." >&4
7199                         ;;
7200                 esac
7201                 ;;
7202         esac
7203 esac
7204 case "$uselongdouble" in
7205 $define)
7206         echo "Long doubles selected." >&4
7207         case "$longdblsize" in
7208         $doublesize)
7209                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7210                 ;;
7211         *)
7212                 case "$archname" in
7213                 *-ld*) echo "...and architecture name already has -ld." >&4
7214                         ;;
7215                 *)      archname="$archname-ld"
7216                         echo "...setting architecture name to $archname." >&4
7217                         ;;
7218                 esac
7219                 ;;
7220         esac
7221         ;;
7222 esac
7223 case "$usequadmath" in
7224 $define)
7225         echo "quadmath selected." >&4
7226         case "$archname" in
7227         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7228                 ;;
7229         *)      archname="$archname-quadmath"
7230                 echo "...setting architecture name to $archname." >&4
7231                 ;;
7232         esac
7233         ;;
7234 esac
7235 if $test -f archname.cbu; then
7236         echo "Your platform has some specific hints for architecture name, using them..."
7237         . ./archname.cbu
7238 fi
7239
7240 : set the prefixit variable, to compute a suitable default value
7241 prefixit='case "$3" in
7242 ""|none)
7243         case "$oldprefix" in
7244         "") eval "$1=\"\$$2\"";;
7245         *)
7246                 case "$3" in
7247                 "") eval "$1=";;
7248                 none)
7249                         eval "tp=\"\$$2\"";
7250                         case "$tp" in
7251                         ""|" ") eval "$1=\"\$$2\"";;
7252                         *) eval "$1=";;
7253                         esac;;
7254                 esac;;
7255         esac;;
7256 *)
7257         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7258         case "$tp" in
7259         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7260         /*-$oldprefix/*|\~*-$oldprefix/*)
7261                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7262         *) eval "$1=\"\$$2\"";;
7263         esac;;
7264 esac'
7265
7266 : determine installation style
7267 : For now, try to deduce it from prefix unless it is already set.
7268 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7269 case "$installstyle" in
7270 '')     case "$prefix" in
7271                 *perl*) dflt='lib';;
7272                 *) dflt='lib/perl5' ;;
7273         esac
7274         ;;
7275 *)      dflt="$installstyle" ;;
7276 esac
7277 : Probably not worth prompting for this since we prompt for all
7278 : the directories individually, and the prompt would be too long and
7279 : confusing anyway.
7280 installstyle=$dflt
7281
7282 : determine where public executables go
7283 echo " "
7284 set dflt bin bin
7285 eval $prefixit
7286 fn=d~
7287 rp='Pathname where the public executables will reside?'
7288 . ./getfile
7289 if $test "X$ansexp" != "X$binexp"; then
7290         installbin=''
7291 fi
7292 prefixvar=bin
7293 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7294 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7295 :     this via initialinstalllocation
7296 . ./setprefixvar
7297
7298 case "$userelocatableinc" in
7299 $define|true|[yY]*)     dflt='y' ;;
7300 *)                      dflt='n' ;;
7301 esac
7302 cat <<EOM
7303
7304 Would you like to build Perl so that the installation is relocatable, so that
7305 library paths in @INC are determined relative to the path of the perl binary?
7306 This is not advised for system Perl installs, or if you need to run setid
7307 scripts or scripts under taint mode.
7308
7309 If this doesn't make any sense to you, just accept the default '$dflt'.
7310 EOM
7311 rp='Use relocatable @INC?'
7312 . ./myread
7313 case "$ans" in
7314 y|Y)    val="$define" ;;
7315 *)      val="$undef"  ;;
7316 esac
7317 set userelocatableinc
7318 eval $setvar
7319
7320 initialinstalllocation="$binexp"
7321 : Default prefix is now "up one level from where the binaries are"
7322 case "$userelocatableinc" in
7323 $define|true|[yY]*)
7324     bin=".../"
7325     binexp=".../"
7326     prefix=".../.."
7327     prefixexp=".../.."
7328     installprefixexp=".../.."
7329     ;;
7330 esac
7331
7332 : determine where private library files go
7333 : Usual default is /usr/local/lib/perl5/$version.
7334 : Also allow things like /opt/perl/lib/$version, since
7335 : /opt/perl/lib/perl5... would be redundant.
7336 : The default "style" setting is made in installstyle.U
7337 case "$installstyle" in
7338 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7339 *)       set dflt privlib lib/$version ;;
7340 esac
7341 eval $prefixit
7342 $cat <<EOM
7343
7344 There are some auxiliary files for $package that need to be put into a
7345 private library directory that is accessible by everyone.
7346
7347 EOM
7348 fn=$binexp
7349 fn=d~+
7350 rp='Pathname where the private library files will reside?'
7351 . ./getfile
7352 prefixvar=privlib
7353 . ./setprefixvar
7354
7355 : set the prefixup variable, to restore leading tilda escape
7356 prefixup='case "$prefixexp" in
7357 "$prefix") ;;
7358 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7359 esac'
7360
7361 : determine where public architecture dependent libraries go
7362 set archlib archlib
7363 eval $prefixit
7364 : privlib default is /usr/local/lib/$package/$version
7365 : archlib default is /usr/local/lib/$package/$version/$archname
7366 : privlib may have an optional trailing /share.
7367 tdflt=`echo $privlib | $sed 's,/share$,,'`
7368 tdflt=$tdflt/$archname
7369 case "$archlib" in
7370 '')     dflt=$tdflt
7371         ;;
7372 *)      dflt="$archlib"
7373     ;;
7374 esac
7375 $cat <<EOM
7376
7377 $spackage contains architecture-dependent library files.  If you are
7378 sharing libraries in a heterogeneous environment, you might store
7379 these files in a separate location.  Otherwise, you can just include
7380 them with the rest of the public library files.
7381
7382 EOM
7383 fn=$binexp
7384 fn=d+~
7385 rp='Where do you want to put the public architecture-dependent libraries?'
7386 . ./getfile
7387 prefixvar=archlib
7388 . ./setprefixvar
7389 if $test X"$archlib" = X"$privlib"; then
7390         d_archlib="$undef"
7391 else
7392         d_archlib="$define"
7393 fi
7394
7395 : see if setuid scripts can be secure
7396 $cat <<EOM
7397
7398 Some kernels have a bug that prevents setuid #! scripts from being
7399 secure.  Some sites have disabled setuid #! scripts because of this.
7400
7401 First let's decide if your kernel supports secure setuid #! scripts.
7402 (If setuid #! scripts would be secure but have been disabled anyway,
7403 don't say that they are secure if asked.)
7404
7405 EOM
7406
7407 val="$undef"
7408 if $test -d /dev/fd; then
7409         echo "#!$ls" >reflect
7410         chmod +x,u+s reflect
7411         ./reflect >flect 2>&1
7412         if $contains "/dev/fd" flect >/dev/null; then
7413                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7414                 val="$define"
7415         else
7416                 $cat <<EOM
7417 If you are not sure if they are secure, I can check but I'll need a
7418 username and password different from the one you are using right now.
7419 If you don't have such a username or don't want me to test, simply
7420 enter 'none'.
7421
7422 EOM
7423                 rp='Other username to test security of setuid scripts with?'
7424                 dflt='none'
7425                 . ./myread
7426                 case "$ans" in
7427                 n|none)
7428                         case "$d_suidsafe" in
7429                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7430                                 dflt=n;;
7431                         "$undef")
7432                                 echo "Well, the $hint value is *not* secure." >&4
7433                                 dflt=n;;
7434                         *)      echo "Well, the $hint value *is* secure." >&4
7435                                 dflt=y;;
7436                         esac
7437                         ;;
7438                 *)
7439                         $rm -f reflect flect
7440                         echo "#!$ls" >reflect
7441                         chmod +x,u+s reflect
7442                         echo >flect
7443                         chmod a+w flect
7444                         echo '"su" will (probably) prompt you for '"$ans's password."
7445                         su $ans -c './reflect >flect'
7446                         if $contains "/dev/fd" flect >/dev/null; then
7447                                 echo "Okay, it looks like setuid scripts are secure." >&4
7448                                 dflt=y
7449                         else
7450                                 echo "I don't think setuid scripts are secure." >&4
7451                                 dflt=n
7452                         fi
7453                         ;;
7454                 esac
7455                 rp='Does your kernel have *secure* setuid scripts?'
7456                 . ./myread
7457                 case "$ans" in
7458                 [yY]*)  val="$define";;
7459                 *)      val="$undef";;
7460                 esac
7461         fi
7462 else
7463         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7464         echo "(That's for file descriptors, not floppy disks.)"
7465         val="$undef"
7466 fi
7467 set d_suidsafe
7468 eval $setvar
7469
7470 $rm -f reflect flect
7471
7472 : now see if they want to do setuid emulation
7473 if $test $patchlevel -lt 11; then
7474 echo " "
7475 val="$undef"
7476 case "$d_suidsafe" in
7477 "$define")
7478         val="$undef"
7479         echo "No need to emulate SUID scripts since they are secure here." >&4
7480         ;;
7481 *)
7482         $cat <<EOM
7483 Some systems have disabled setuid scripts, especially systems where
7484 setuid scripts cannot be secure.  On systems where setuid scripts have
7485 been disabled, the setuid/setgid bits on scripts are currently
7486 useless.  It is possible for $package to detect those bits and emulate
7487 setuid/setgid in a secure fashion.  This emulation will only work if
7488 setuid scripts have been disabled in your kernel.
7489
7490 EOM
7491         case "$d_dosuid" in
7492         "$define") dflt=y ;;
7493         *) dflt=n ;;
7494         esac
7495         rp="Do you want to do setuid/setgid emulation?"
7496         . ./myread
7497         case "$ans" in
7498         [yY]*)  val="$define";;
7499         *)      val="$undef";;
7500         esac
7501         ;;
7502 esac
7503 set d_dosuid
7504 eval $setvar
7505 else
7506     case "$d_dosuid" in
7507         "$define")
7508         cat >&4 <<EOH
7509
7510 SUID emulation has been removed for 5.12
7511 Please re-run Configure without -Dd_dosuid
7512
7513 EOH
7514         exit 1;
7515         ;;
7516     esac
7517     d_dosuid=undef
7518 fi
7519
7520 : Find perl5.005 or later.
7521 echo "Looking for a previously installed perl5.005 or later... "
7522 case "$perl5" in
7523 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7524                 : Check if this perl is recent and can load a simple module
7525                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7526                         perl5=$tdir/perl
7527                         break;
7528                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7529                         perl5=$tdir/perl5
7530                         break;
7531                 fi
7532         done
7533         ;;
7534 *)      perl5="$perl5"
7535         ;;
7536 esac
7537 case "$perl5" in
7538 '')     echo "None found.  That's ok.";;
7539 *)      echo "Using $perl5." ;;
7540 esac
7541
7542 : Set the siteprefix variables
7543 $cat <<EOM
7544
7545 After $package is installed, you may wish to install various
7546 add-on modules and utilities.  Typically, these add-ons will
7547 be installed under $prefix with the rest
7548 of this package.  However, you may wish to install such add-ons
7549 elsewhere under a different prefix.
7550
7551 If you do not wish to put everything under a single prefix, that's
7552 ok.  You will be prompted for the individual locations; this siteprefix
7553 is only used to suggest the defaults.
7554
7555 The default should be fine for most people.
7556
7557 EOM
7558 fn=d~+
7559 rp='Installation prefix to use for add-on modules and utilities?'
7560 : XXX Here might be another good place for an installstyle setting.
7561 case "$siteprefix" in
7562 '') dflt=$prefix ;;
7563 *)  dflt=$siteprefix ;;
7564 esac
7565 . ./getfile
7566 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7567 oldsiteprefix=''
7568 case "$siteprefix" in
7569 '') ;;
7570 *)      case "$ans" in
7571         "$prefix") ;;
7572         *) oldsiteprefix="$prefix";;
7573         esac
7574         ;;
7575 esac
7576 siteprefix="$ans"
7577 siteprefixexp="$ansexp"
7578
7579 : determine where site specific libraries go.
7580 : Usual default is /usr/local/lib/perl5/site_perl/$version
7581 : The default "style" setting is made in installstyle.U
7582 : XXX No longer works with Prefixit stuff.
7583 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7584 case "$sitelib" in
7585 '') case "$installstyle" in
7586         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7587         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7588         esac
7589         ;;
7590 *)      dflt="$sitelib"
7591         ;;
7592 esac
7593 $cat <<EOM
7594
7595 The installation process will create a directory for
7596 site-specific extensions and modules.  Most users find it convenient
7597 to place all site-specific files in this directory rather than in the
7598 main distribution directory.
7599
7600 EOM
7601 fn=d~+
7602 rp='Pathname for the site-specific library files?'
7603 . ./getfile
7604 prefixvar=sitelib
7605 . ./setprefixvar
7606 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7607
7608 : Determine list of previous versions to include in @INC
7609 $cat > getverlist <<EOPL
7610 #!$perl5 -w
7611 use File::Basename;
7612 \$api_versionstring = "$api_versionstring";
7613 \$version = "$version";
7614 \$stem = "$sitelib_stem";
7615 \$archname = "$archname";
7616 EOPL
7617         $cat >> getverlist <<'EOPL'
7618 # The list found is store twice for each entry: the original name, and
7619 # the binary broken down version as pack "sss", so sorting is easy and
7620 # unambiguous. This will work for all versions that have a maximum of
7621 # three digit groups, separate by '.'s or '_'s. Names are extended with
7622 # ".0.0" to ensure at least three elements for the pack.
7623 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7624
7625 # Can't have leading @ because metaconfig interprets it as a command!
7626 ;@inc_version_list=();
7627 # XXX Redo to do opendir/readdir?
7628 if (-d $stem) {
7629     chdir($stem);
7630     ;@candidates = map {
7631         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7632     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7633 }
7634 else {
7635     ;@candidates = ();
7636 }
7637
7638 ($pversion, $aversion, $vsn5005) = map {
7639     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7640 foreach $d (@candidates) {
7641     if ($d->[1] lt $pversion) {
7642         if ($d->[1] ge $aversion) {
7643             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7644         }
7645         elsif ($d->[1] ge $vsn5005) {
7646             unshift(@inc_version_list, grep { -d } $d->[0]);
7647         }
7648     }
7649     else {
7650         # Skip newer version.  I.e. don't look in
7651         # 5.7.0 if we're installing 5.6.1.
7652     }
7653 }
7654
7655 if (@inc_version_list) {
7656     print join(' ', @inc_version_list);
7657 }
7658 else {
7659     # Blank space to preserve value for next Configure run.
7660     print " ";
7661 }
7662 EOPL
7663 chmod +x getverlist
7664 case "$inc_version_list" in
7665 '')     if test -x "$perl5$exe_ext"; then
7666                 dflt=`$perl5 getverlist`
7667         else
7668                 dflt='none'
7669         fi
7670         ;;
7671 $undef) dflt='none' ;;
7672 *)  eval dflt=\"$inc_version_list\" ;;
7673 esac
7674 case "$dflt" in
7675 ''|' ') dflt=none ;;
7676 esac
7677 case "$dflt" in
7678 5.005) dflt=none ;;
7679 esac
7680 $cat <<EOM
7681
7682 In order to ease the process of upgrading, this version of perl
7683 can be configured to use modules built and installed with earlier
7684 versions of perl that were installed under $prefix.  Specify here
7685 the list of earlier versions that this version of perl should check.
7686 If Configure detected no earlier versions of perl installed under
7687 $prefix, then the list will be empty.  Answer 'none' to tell perl
7688 to not search earlier versions.
7689
7690 The default should almost always be sensible, so if you're not sure,
7691 just accept the default.
7692 EOM
7693
7694 rp='List of earlier versions to include in @INC?'
7695 . ./myread
7696 case "$ans" in
7697 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7698 *) inc_version_list="$ans" ;;
7699 esac
7700 case "$inc_version_list" in
7701 ''|' ')
7702         inc_version_list_init='0'
7703         d_inc_version_list="$undef"
7704         ;;
7705 *)      inc_version_list_init=`echo $inc_version_list |
7706                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7707         d_inc_version_list="$define"
7708         ;;
7709 esac
7710 $rm -f getverlist
7711
7712 : see if malloc/malloc.h has to be included
7713 set malloc/malloc.h i_mallocmalloc
7714 eval $inhdr
7715
7716 : see if this is a malloc.h system
7717 : we want a real compile instead of Inhdr because some systems have a
7718 : malloc.h that just gives a compile error saying to use stdlib.h instead
7719 echo " "
7720 $cat >try.c <<EOCP
7721 #include <stdlib.h>
7722 #include <malloc.h>
7723 #$i_mallocmalloc I_MALLOCMALLOC
7724 #ifdef I_MALLOCMALLOC
7725 # include <malloc/malloc.h>
7726 #endif
7727
7728 int main () { return 0; }
7729 EOCP
7730 set try
7731 if eval $compile; then
7732     echo "<malloc.h> found." >&4
7733     val="$define"
7734 else
7735     echo "<malloc.h> NOT found." >&4
7736     val="$undef"
7737 fi
7738 $rm_try
7739 set i_malloc
7740 eval $setvar
7741
7742 : check for length of pointer
7743 echo " "
7744 case "$ptrsize" in
7745 '')
7746         echo "Checking to see how big your pointers are..." >&4
7747         $cat >try.c <<EOCP
7748 #include <stdio.h>
7749 #$i_stdlib I_STDLIB
7750 #ifdef I_STDLIB
7751 #include <stdlib.h>
7752 #endif
7753 int main()
7754 {
7755     printf("%d\n", (int)sizeof(void *));
7756     exit(0);
7757 }
7758 EOCP
7759         set try
7760         if eval $compile_ok; then
7761                 ptrsize=`$run ./try`
7762                 echo "Your pointers are $ptrsize bytes long."
7763         else
7764                 dflt='4'
7765                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7766                 rp="What is the size of a pointer (in bytes)?"
7767                 . ./myread
7768                 ptrsize="$ans"
7769         fi
7770         ;;
7771 esac
7772 $rm_try
7773 case "$use64bitall" in
7774 "$define"|true|[yY]*)
7775         case "$ptrsize" in
7776         4)      cat <<EOM >&4
7777
7778 *** You have chosen a maximally 64-bit build,
7779 *** but your pointers are only 4 bytes wide.
7780 *** Please rerun Configure without -Duse64bitall.
7781 EOM
7782                 case "$d_quad" in
7783                 define)
7784                         cat <<EOM >&4
7785 *** Since you have quads, you could possibly try with -Duse64bitint.
7786 EOM
7787                         ;;
7788                 esac
7789                 cat <<EOM >&4
7790 *** Cannot continue, aborting.
7791
7792 EOM
7793
7794                 exit 1
7795                 ;;
7796         esac
7797         ;;
7798 esac
7799
7800 : determine whether to use malloc wrapping
7801 echo " "
7802 case "$usemallocwrap" in
7803 [yY]*|true|$define)     dflt='y' ;;
7804 [nN]*|false|$undef)     dflt='n' ;;
7805 *)      case "$usedevel" in
7806         [yY]*|true|$define)     dflt='y' ;;
7807         *) dflt='n' ;;
7808         esac
7809         ;;
7810 esac
7811 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7812 . ./myread
7813 usemallocwrap="$ans"
7814 case "$ans" in
7815 y*|true)
7816         usemallocwrap="$define" ;;
7817 *)
7818         usemallocwrap="$undef" ;;
7819 esac
7820
7821 : determine which malloc to compile in
7822 echo " "
7823 case "$usemymalloc" in
7824 [yY]*|true|$define)     dflt='y' ;;
7825 [nN]*|false|$undef)     dflt='n' ;;
7826 *)      case "$ptrsize" in
7827         4) dflt='y' ;;
7828         *) dflt='n' ;;
7829         esac
7830         if test "$useithreads" = "$define"; then dflt='n'; fi
7831         ;;
7832 esac
7833 rp="Do you wish to attempt to use the malloc that comes with $package?"
7834 . ./myread
7835 usemymalloc="$ans"
7836 case "$ans" in
7837 y*|true)
7838         usemymalloc='y'
7839         mallocsrc='malloc.c'
7840         mallocobj="malloc$_o"
7841         d_mymalloc="$define"
7842         case "$libs" in
7843         *-lmalloc*)
7844                 : Remove malloc from list of libraries to use
7845                 echo "Removing unneeded -lmalloc from library list" >&4
7846                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7847                 shift
7848                 libs="$*"
7849                 echo "libs = $libs" >&4
7850                 ;;
7851         esac
7852         ;;
7853 *)
7854         usemymalloc='n'
7855         mallocsrc=''
7856         mallocobj=''
7857         d_mymalloc="$undef"
7858         ;;
7859 esac
7860
7861 : compute the return types of malloc and free
7862 echo " "
7863 $cat >malloc.c <<END
7864 #$i_malloc I_MALLOC
7865 #$i_stdlib I_STDLIB
7866 #include <stdio.h>
7867 #include <sys/types.h>
7868 #ifdef I_MALLOC
7869 #include <malloc.h>
7870 #endif
7871 #ifdef I_STDLIB
7872 #include <stdlib.h>
7873 #endif
7874 #ifdef TRY_MALLOC
7875 void *malloc();
7876 #endif
7877 #ifdef TRY_FREE
7878 void free();
7879 #endif
7880 END
7881 case "$malloctype" in
7882 '')
7883         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7884                 malloctype='void *'
7885         else
7886                 malloctype='char *'
7887         fi
7888         ;;
7889 esac
7890 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7891
7892 case "$freetype" in
7893 '')
7894         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7895                 freetype='void'
7896         else
7897                 freetype='int'
7898         fi
7899         ;;
7900 esac
7901 echo "Your system uses $freetype free(), it would seem." >&4
7902 $rm -f malloc.[co]
7903 : determine where site specific architecture-dependent libraries go.
7904 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7905 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7906 : sitelib may have an optional trailing /share.
7907 case "$sitearch" in
7908 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7909         dflt="$dflt/$archname"
7910         ;;
7911 *)      dflt="$sitearch"
7912         ;;
7913 esac
7914 set sitearch sitearch none
7915 eval $prefixit
7916 $cat <<EOM
7917
7918 The installation process will also create a directory for
7919 architecture-dependent site-specific extensions and modules.
7920
7921 EOM
7922 fn=d~+
7923 rp='Pathname for the site-specific architecture-dependent library files?'
7924 . ./getfile
7925 prefixvar=sitearch
7926 . ./setprefixvar
7927 if $test X"$sitearch" = X"$sitelib"; then
7928         d_sitearch="$undef"
7929 else
7930         d_sitearch="$define"
7931 fi
7932
7933 : Set the vendorprefix variables
7934 $cat <<EOM
7935
7936 The installation process will also create a directory for
7937 vendor-supplied add-ons.  Vendors who supply perl with their system
7938 may find it convenient to place all vendor-supplied files in this
7939 directory rather than in the main distribution directory.  This will
7940 ease upgrades between binary-compatible maintenance versions of perl.
7941
7942 Of course you may also use these directories in whatever way you see
7943 fit.  For example, you might use them to access modules shared over a
7944 company-wide network.
7945
7946 The default answer should be fine for most people.
7947 This causes further questions about vendor add-ons to be skipped
7948 and no vendor-specific directories will be configured for perl.
7949
7950 EOM
7951 rp='Do you want to configure vendor-specific add-on directories?'
7952 case "$usevendorprefix" in
7953 define|true|[yY]*) dflt=y ;;
7954 *)      : User may have set vendorprefix directly on Configure command line.
7955         case "$vendorprefix" in
7956         ''|' ') dflt=n ;;
7957         *)      dflt=y ;;
7958         esac
7959         ;;
7960 esac
7961 . ./myread
7962 case "$ans" in
7963 [yY]*)  fn=d~+
7964         rp='Installation prefix to use for vendor-supplied add-ons?'
7965         case "$vendorprefix" in
7966         '') dflt="$prefix" ;;
7967         *)  dflt=$vendorprefix ;;
7968         esac
7969         . ./getfile
7970         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7971         oldvendorprefix=''
7972         case "$vendorprefix" in
7973         '') ;;
7974         *)      case "$ans" in
7975                 "$prefix") ;;
7976                 *) oldvendorprefix="$prefix";;
7977                 esac
7978                 ;;
7979         esac
7980         usevendorprefix="$define"
7981         vendorprefix="$ans"
7982         vendorprefixexp="$ansexp"
7983         ;;
7984 *)      usevendorprefix="$undef"
7985         vendorprefix=''
7986         vendorprefixexp=''
7987         ;;
7988 esac
7989
7990 : Set the vendorlib variables
7991 case "$vendorprefix" in
7992 '')     d_vendorlib="$undef"
7993         vendorlib=''
7994         vendorlibexp=''
7995         ;;
7996 *)      d_vendorlib="$define"
7997         : determine where vendor-supplied modules go.
7998         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7999         case "$vendorlib" in
8000         '')
8001                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8002                 case "$installstyle" in
8003                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8004                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8005                 esac
8006                 ;;
8007         *)      dflt="$vendorlib"
8008                 ;;
8009         esac
8010         fn=d~+
8011         rp='Pathname for the vendor-supplied library files?'
8012         . ./getfile
8013         vendorlib="$ans"
8014         vendorlibexp="$ansexp"
8015         ;;
8016 esac
8017 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8018 prefixvar=vendorlib
8019 . ./installprefix
8020
8021 : Set the vendorarch variables
8022 case "$vendorprefix" in
8023 '')     d_vendorarch="$undef"
8024         vendorarch=''
8025         vendorarchexp=''
8026         ;;
8027 *)      d_vendorarch="$define"
8028         : determine where vendor-supplied architecture-dependent libraries go.
8029         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8030         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8031         : vendorlib may have an optional trailing /share.
8032         case "$vendorarch" in
8033         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8034                 dflt="$dflt/$archname"
8035                 ;;
8036         *)      dflt="$vendorarch" ;;
8037         esac
8038         fn=d~+
8039         rp='Pathname for vendor-supplied architecture-dependent files?'
8040         . ./getfile
8041         vendorarch="$ans"
8042         vendorarchexp="$ansexp"
8043         ;;
8044 esac
8045 prefixvar=vendorarch
8046 . ./installprefix
8047 if $test X"$vendorarch" = X"$vendorlib"; then
8048         d_vendorarch="$undef"
8049 else
8050         d_vendorarch="$define"
8051 fi
8052
8053 : Final catch-all directories to search
8054 $cat <<EOM
8055
8056 Lastly, you can have perl look in other directories for extensions and
8057 modules in addition to those already specified.
8058 These directories will be searched after
8059         $sitearch
8060         $sitelib
8061 EOM
8062 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8063 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8064 echo ' '
8065 case "$otherlibdirs" in
8066 ''|' ') dflt='none' ;;
8067 *)      dflt="$otherlibdirs" ;;
8068 esac
8069 $cat <<EOM
8070 Enter a colon-separated set of extra paths to include in perl's @INC
8071 search path, or enter 'none' for no extra paths.
8072
8073 EOM
8074
8075 rp='Colon-separated list of additional directories for perl to search?'
8076 . ./myread
8077 case "$ans" in
8078 ' '|''|none)    otherlibdirs=' ' ;;
8079 *)      otherlibdirs="$ans" ;;
8080 esac
8081 case "$otherlibdirs" in
8082 ' ') val=$undef ;;
8083 *)      val=$define ;;
8084 esac
8085 set d_perl_otherlibdirs
8086 eval $setvar
8087
8088 : DTrace support
8089 dflt_dtrace='/usr/sbin/dtrace'
8090 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8091
8092 cat <<EOM
8093
8094 Perl can be built to support DTrace on platforms that support it.
8095 DTrace is a diagnosis and performance analysis tool from Sun.
8096
8097 If this doesn't make any sense to you, just accept the default.
8098 EOM
8099
8100 while $test 1 ; do
8101         case "$usedtrace" in
8102         $define|true|[yY]*)
8103                 dflt='y'
8104                 ;;
8105         ?*)
8106                 dflt='y'
8107                 dflt_dtrace=$usedtrace
8108                 ;;
8109         *)
8110                 dflt='n'
8111                 ;;
8112         esac
8113
8114         rp='Support DTrace if available?'
8115         . ./myread
8116         case "$ans" in
8117         y|Y)    val="$define" ;;
8118         *)      val="$undef" ;;
8119         esac
8120         set usedtrace
8121         eval $setvar
8122
8123         test "X$usedtrace" != "X$define" && break
8124
8125         echo " "
8126         rp='Where is the dtrace executable?'
8127         dflt=$dflt_dtrace
8128         . ./getfile
8129         val="$ans"
8130         set dtrace
8131         eval $setvar
8132
8133         if $test -f $dtrace
8134         then
8135                 if $dtrace -h -s ../perldtrace.d \
8136                         -o perldtrace.tmp >/dev/null 2>&1 \
8137                         && rm -f perldtrace.tmp
8138                 then
8139                         echo " "
8140                         echo "Good: your $dtrace knows about the -h flag."
8141                 else
8142                         cat >&2 <<EOM
8143
8144 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8145 ***
8146 *** Your installed dtrace doesn't support the -h switch to compile a D
8147 *** program into a C header. Can't continue.
8148
8149 EOM
8150                         exit 1
8151                 fi
8152                 break;
8153         fi
8154
8155         case "$fastread" in
8156         yes)
8157                 cat >&2 <<EOM
8158
8159 *** $me:  Fatal Error:  $dtrace not found.
8160 *** Can't continue.
8161
8162 EOM
8163                 exit 1
8164                 ;;
8165         *)
8166                 echo "*** $dtrace was not found."
8167                 echo " "
8168                 ;;
8169         esac
8170 done
8171
8172 : See if we want extra modules installed
8173 echo " "
8174 case "$extras" in
8175 '') dflt='n';;
8176 *) dflt='y';;
8177 esac
8178 cat <<EOM
8179 Perl can be built with extra modules or bundles of modules which
8180 will be fetched from the CPAN and installed alongside Perl.
8181
8182 Notice that you will need access to the CPAN; either via the Internet,
8183 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8184 be asked later to configure the CPAN.pm module which will in turn do
8185 the installation of the rest of the extra modules or bundles.)
8186
8187 Notice also that if the modules require any external software such as
8188 libraries and headers (the libz library and the zlib.h header for the
8189 Compress::Zlib module, for example) you MUST have any such software
8190 already installed, this configuration process will NOT install such
8191 things for you.
8192
8193 If this doesn't make any sense to you, just accept the default '$dflt'.
8194 EOM
8195 rp='Install any extra modules (y or n)?'
8196 . ./myread
8197 case "$ans" in
8198 y|Y)
8199         cat <<EOM
8200
8201 Please list any extra modules or bundles to be installed from CPAN,
8202 with spaces between the names.  The names can be in any format the
8203 'install' command of CPAN.pm will understand.  (Answer 'none',
8204 without the quotes, to install no extra modules or bundles.)
8205 EOM
8206         rp='Extras?'
8207         dflt="$extras"
8208         . ./myread
8209         extras="$ans"
8210 esac
8211 case "$extras" in
8212 ''|'none')
8213         val=''
8214         $rm -f ../extras.lst
8215         ;;
8216 *)      echo "(Saving the list of extras for later...)"
8217         echo "$extras" > ../extras.lst
8218         val="'$extras'"
8219         ;;
8220 esac
8221 set extras
8222 eval $setvar
8223 echo " "
8224
8225 : determine where html pages for programs go
8226 set html1dir html1dir none
8227 eval $prefixit
8228 $cat <<EOM
8229
8230 If you wish to install html files for programs in $spackage, indicate
8231 the appropriate directory here.  To skip installing html files,
8232 answer "none".
8233 EOM
8234 case "$html1dir" in
8235 ''|none|$undef|' ') dflt=none ;;
8236 *) dflt=$html1dir ;;
8237 esac
8238 fn=dn+~
8239 rp="Directory for the main $spackage html pages?"
8240 . ./getfile
8241 prefixvar=html1dir
8242 . ./setprefixvar
8243 : Use ' ' for none so value is preserved next time through Configure
8244 $test X"$html1dir" = "X" && html1dir=' '
8245
8246 : determine where html pages for libraries and modules go
8247 set html3dir html3dir none
8248 eval $prefixit
8249 $cat <<EOM
8250
8251 If you wish to install html files for modules associated with $spackage,
8252 indicate the appropriate directory here.  To skip installing html files,
8253 answer "none".
8254 EOM
8255 : There is no obvious default.  If they have specified html1dir, then
8256 : try to key off that, possibly changing .../html1 into .../html3.
8257 case "$html3dir" in
8258 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8259 *) dflt=$html3dir ;;
8260 esac
8261 fn=dn+~
8262 rp="Directory for the $spackage module html pages?"
8263 . ./getfile
8264 prefixvar=html3dir
8265 . ./setprefixvar
8266 : Use ' ' for none so value is preserved next time through Configure
8267 $test X"$html3dir" = "X" && html3dir=' '
8268
8269 : determine whether to install perl also as /usr/bin/perl
8270
8271 echo " "
8272 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8273         $cat <<EOM
8274 Many scripts expect perl to be installed as /usr/bin/perl.
8275
8276 If you want to, I can install the perl you are about to compile
8277 as /usr/bin/perl (in addition to $bin/perl).
8278 EOM
8279         if test -f /usr/bin/perl; then
8280             $cat <<EOM
8281
8282 However, please note that because you already have a /usr/bin/perl,
8283 overwriting that with a new Perl would very probably cause problems.
8284 Therefore I'm assuming you don't want to do that (unless you insist).
8285
8286 EOM
8287             case "$installusrbinperl" in
8288             "$define"|[yY]*)    dflt='y';;
8289             *)                  dflt='n';;
8290             esac
8291         else
8292             $cat <<EOM
8293
8294 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8295
8296 EOM
8297             case "$installusrbinperl" in
8298             "$undef"|[nN]*)     dflt='n';;
8299             *)                  dflt='y';;
8300             esac
8301         fi
8302         rp="Do you want to install perl as /usr/bin/perl?"
8303         . ./myread
8304         case "$ans" in
8305         [yY]*)  val="$define";;
8306         *)      val="$undef" ;;
8307         esac
8308 else
8309         val="$undef"
8310 fi
8311 set installusrbinperl
8312 eval $setvar
8313
8314 : see if dlopen exists
8315 xxx_runnm="$runnm"
8316 xxx_ccflags="$ccflags"
8317 runnm=false
8318 : with g++ one needs -shared to get is-in-libc to work for dlopen
8319 case "$gccversion" in
8320 '')     ;;
8321 *Clang*)        ;;
8322 *)      case "$d_cplusplus" in
8323         "$define") ccflags="$ccflags -shared" ;;
8324         esac
8325         ;;
8326 esac
8327 set dlopen d_dlopen
8328 eval $inlibc
8329 runnm="$xxx_runnm"
8330 ccflags="$xxx_ccflags"
8331
8332 : see if this is a unistd.h system
8333 set unistd.h i_unistd
8334 eval $inhdr
8335
8336 : determine which dynamic loading, if any, to compile in
8337 echo " "
8338 dldir="ext/DynaLoader"
8339 case "$usedl" in
8340     $define|y|true)
8341         dflt='y'
8342         usedl="$define"
8343         ;;
8344     $undef|n|false)
8345         dflt='n'
8346         usedl="$undef"
8347         ;;
8348     *)
8349         dflt='n'
8350         case "$d_dlopen" in
8351             $define) dflt='y' ;;
8352         esac
8353         : Does a dl_xxx.xs file exist for this operating system
8354         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8355         ;;
8356 esac
8357 rp="Do you wish to use dynamic loading?"
8358 . ./myread
8359 usedl="$ans"
8360 bin_ELF="$undef"
8361 case "$ans" in
8362     y*) usedl="$define"
8363         case "$dlsrc" in
8364             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8365                     dflt="$dldir/dl_${osname}.xs"
8366                 elif $test "$d_dlopen" = "$define" ; then
8367                     dflt="$dldir/dl_dlopen.xs"
8368                 else
8369                     dflt=''
8370                 fi
8371                 ;;
8372             *)  dflt="$dldir/$dlsrc"
8373                 ;;
8374         esac
8375         echo "The following dynamic loading files are available:"
8376         : Can not go over to $dldir because getfile has path hard-coded in.
8377         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8378         rp="Source file to use for dynamic loading"
8379         fn="fne"
8380         gfpth="$src"
8381         . ./getfile
8382         usedl="$define"
8383         : emulate basename
8384         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8385
8386         $cat << EOM
8387
8388 Some systems may require passing special flags to $cc -c to
8389 compile modules that will be used to create a shared library.
8390 To use no flags, say "none".
8391
8392 EOM
8393         case "$cccdlflags" in
8394             '') case "$gccversion" in
8395                 '') case "$osname" in
8396                         hpux)   dflt='+z' ;;
8397                         irix*)  dflt='-KPIC' ;;
8398                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8399                         sunos)  dflt='-pic' ;;
8400                         *)      dflt='none' ;;
8401                     esac
8402                     ;;
8403                 *)  case "$osname" in
8404                         darwin) dflt='none' ;;
8405                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8406                         *)      dflt='-fpic' ;;
8407                     esac ;;
8408                 esac ;;
8409             ' ') dflt='none' ;;
8410             *)   dflt="$cccdlflags" ;;
8411         esac
8412
8413         case "$dflt" in
8414             none) dflt='' ;;
8415         esac
8416
8417         # If -Dsysroot was specified, now's the time to add it
8418         # to cccdlflags
8419         if test "X$sysroot" != X; then
8420             case "$gccversion" in
8421                 '') ;;
8422                 *)  case "$dflt" in
8423                         *sysroot*) ;;
8424                         'undef'|*)
8425                             dflt="$dflt --sysroot=$sysroot" ;;
8426                     esac
8427                     ;;
8428             esac
8429         fi
8430
8431         case "$dflt" in
8432             '') dflt='none';;
8433         esac
8434
8435         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8436         . ./myread
8437         case "$ans" in
8438             none) cccdlflags=' ' ;;
8439             *)    cccdlflags="$ans" ;;
8440         esac
8441
8442         cat << EOM
8443
8444 Some systems use ld to create libraries that can be dynamically loaded,
8445 while other systems (such as those using ELF) use $cc.
8446
8447 EOM
8448
8449 : Determine if this is ELF
8450         $cat >try.c <<EOM
8451 /* Test for whether ELF binaries are produced */
8452 #include <fcntl.h>
8453 #$i_stdlib I_STDLIB
8454 #ifdef I_STDLIB
8455 #include <stdlib.h>
8456 #endif
8457 #$i_unistd I_UNISTD
8458 #ifdef I_UNISTD
8459 #include <unistd.h>
8460 #endif
8461 int main() {
8462     char b[4];
8463     int i = open("a.out",O_RDONLY);
8464     if(i == -1)
8465         exit(1); /* fail */
8466     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8467         exit(0); /* succeed (yes, it is ELF) */
8468     exit(1); /* fail */
8469 }
8470 EOM
8471         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8472             bin_ELF="$define"
8473         fi
8474         $rm_try
8475
8476         case "$ld" in
8477             '') if $test $bin_ELF = "$define"; then
8478                     cat <<EOM
8479 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8480 EOM
8481                     dflt="$cc"
8482                 else
8483                     echo "I'll use ld to build dynamic libraries."
8484                     dflt='ld'
8485                 fi
8486                 ;;
8487             *)  dflt="$ld"
8488                 ;;
8489         esac
8490
8491         rp="What command should be used to create dynamic libraries?"
8492         . ./myread
8493         ld="$ans"
8494
8495         cat << EOM
8496
8497 Some systems may require passing special flags to $ld to create a
8498 library that can be dynamically loaded.  If your ld flags include
8499 -L/other/path options to locate libraries outside your loader's normal
8500 search path, you may need to specify those -L options here as well.  To
8501 use no flags, say "none".
8502
8503 EOM
8504         case "$lddlflags" in
8505             '') case "$osname" in
8506                     haiku) dflt='-shared' ;;
8507                     hpux) dflt='-b';
8508                           case "$gccversion" in
8509                               '') dflt="$dflt +vnocompatwarnings" ;;
8510                           esac
8511                           ;;
8512                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8513                     solaris) # See [perl #66604].
8514                             # On Solaris 11, gcc -m64 on amd64
8515                             # appears not to understand -G.  gcc versions at
8516                             # least as old as 3.4.3 support -shared, so just
8517                             # use that with Solaris 11 and later, but keep
8518                             # the old behavior for older Solaris versions.
8519                             case "$gccversion" in
8520                                 '') dflt='-G' ;;
8521                                 *)  case "$osvers" in
8522                                         2.?|2.10) dflt='-G' ;;
8523                                         *) dflt='-shared' ;;
8524                                     esac
8525                                     ;;
8526                             esac
8527                             ;;
8528                     sunos) dflt='-assert nodefinitions' ;;
8529                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8530                     *)     dflt='none' ;;
8531                 esac
8532                 ;;
8533             *) dflt="$lddlflags" ;;
8534         esac
8535
8536         : Only do this for gcc, since, for example, qcc has no concept
8537         : of --sysroot.
8538         if $test "X$sysroot" != X; then
8539             case "$gccversion" in
8540                 '') ;;
8541                 *)  dflt="$dflt --sysroot $sysroot" ;;
8542             esac
8543         fi
8544
8545         : Try to guess additional flags to pick up local libraries.
8546         : Be careful not to append to a plain 'none'
8547         case "$dflt" in
8548             none) dflt='' ;;
8549         esac
8550         for thisflag in $ldflags; do
8551             case "$thisflag" in
8552                 -L*|-R*|-Wl,-R*)
8553                     case " $dflt " in
8554                         *" $thisflag "*) ;;
8555                         *) dflt="$dflt $thisflag" ;;
8556                     esac
8557                     ;;
8558             esac
8559         done
8560
8561         case "$dflt" in
8562             ''|' ') dflt='none' ;;
8563         esac
8564
8565         case "$ldflags" in
8566             *-fstack-protector-strong*)
8567                 case "$dflt" in
8568                     *-fstack-protector-strong*) ;; # Don't add it again
8569                     *) dflt="$dflt -fstack-protector-strong" ;;
8570                 esac
8571                 ;;
8572             *-fstack-protector*)
8573                 case "$dflt" in
8574                     *-fstack-protector*) ;; # Don't add it again
8575                     *) dflt="$dflt -fstack-protector" ;;
8576                 esac
8577                 ;;
8578         esac
8579
8580         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8581         . ./myread
8582         case "$ans" in
8583             none) lddlflags=' ' ;;
8584             *) lddlflags="$ans" ;;
8585         esac
8586
8587         cat <<EOM
8588
8589 Some systems may require passing special flags to $cc to indicate that
8590 the resulting executable will use dynamic linking.  To use no flags,
8591 say "none".
8592
8593 EOM
8594         case "$ccdlflags" in
8595             '') case "$osname" in
8596                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8597                     sunos)             dflt='none'   ;;
8598                     *)                 dflt='none'   ;;
8599                 esac ;;
8600             ' ') dflt='none' ;;
8601             *)   dflt="$ccdlflags" ;;
8602         esac
8603         rp="Any special flags to pass to $cc to use dynamic linking?"
8604         . ./myread
8605         case "$ans" in
8606             none) ccdlflags=' ' ;;
8607             *)    ccdlflags="$ans" ;;
8608         esac
8609         ;;
8610
8611     *)  usedl="$undef"
8612         ld='ld'
8613         dlsrc='dl_none.xs'
8614         lddlflags=''
8615         ccdlflags=''
8616         ;;
8617 esac
8618
8619 ld_can_script="$undef"
8620 case "$bin_ELF$usedl" in
8621     $define$define)
8622         # Abuse try.h and a.out names for neat cleanup
8623         $cat >try.c <<EOM
8624 void foo() {}
8625 void bar() {}
8626 EOM
8627         $cat >try.h <<EOM
8628 LIBTEST_42 {
8629  global:
8630   foo;
8631  local: *;
8632  };
8633 EOM
8634         if $cc $cccdlflags $ccdlflags $ccflags \
8635                $ldflags $lddlflags -o a.out try.c \
8636                -Wl,--version-script=try.h >/dev/null 2>&1 \
8637            &&  $test -s a.out ; then
8638             echo "ld supports scripting" >&4
8639             ld_can_script="$define"
8640         else
8641             echo "ld does not support scripting" >&4
8642         fi
8643         $rm_try
8644         ;;
8645 esac
8646
8647 : Do we want a shared libperl?
8648 also=''
8649 case "$usedl" in
8650 $undef)
8651         # No dynamic loading being used, so don't bother even to prompt.
8652         useshrplib='false'
8653         ;;
8654 *)      case "$useshrplib" in
8655         '')     case "$osname" in
8656                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8657                         dflt=y
8658                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8659                         ;;
8660                 *)      dflt=n
8661                         ;;
8662                 esac
8663                 ;;
8664         $define|true|[Yy]*)
8665                 dflt=y
8666                 ;;
8667         *)      dflt=n
8668                 ;;
8669         esac
8670         $cat << EOM
8671
8672 The perl executable is normally obtained by linking perlmain.c with
8673 libperl${_a}, any static extensions (usually just DynaLoader), and
8674 any other libraries needed on this system (such as -lm, etc.).  Since
8675 your system supports dynamic loading, it is probably possible to build
8676 a shared libperl.$so.  If you will have more than one executable linked
8677 to libperl.$so, this will significantly reduce the size of each
8678 executable, but it may have a noticeable effect on performance.  The
8679 default is probably sensible for your system.
8680 $also
8681
8682 EOM
8683         rp="Build a shared libperl.$so (y/n)"
8684         . ./myread
8685         case "$ans" in
8686         true|$define|[Yy]*)
8687                 useshrplib='true'  ;;
8688         *)      useshrplib='false' ;;
8689         esac
8690         ;;
8691 esac
8692
8693 case "$useshrplib" in
8694 true)
8695         case "$userelocatableinc" in
8696         true|define)
8697                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8698                 echo "See INSTALL for an explanation why that won't work." >&4
8699                 exit 4
8700                 ;;
8701         esac
8702         case "$libperl" in
8703         '')
8704                 # Figure out a good name for libperl.so.  Since it gets stored in
8705                 # a version-specific architecture-dependent library, the version
8706                 # number isn't really that important, except for making cc/ld happy.
8707                 #
8708                 # A name such as libperl.so.10.1
8709                 majmin="libperl.$so.$patchlevel.$subversion"
8710                 # A name such as libperl.so.100
8711                 majonly=`echo $patchlevel $subversion |
8712                         $awk '{printf "%d%02d", $1, $2}'`
8713                 majonly=libperl.$so.$majonly
8714                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8715                 # rely on figuring it out from the naming of libc.
8716                 case "${osname}${osvers}" in
8717                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8718                         dflt=libperl.$so
8719                         ;;
8720                 cygwin*) # ld links now against the dll directly
8721                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8722                         majonly=`echo $patchlevel $subversion |
8723                                 $awk '{printf "%03d%03d", $1, $2}'`
8724                         majonly=cygperl5.$majonly.$so
8725                         dflt=$majmin
8726                         ;;
8727                 *)      # Try to guess based on whether libc has major.minor.
8728                         case "$libc" in
8729                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8730                         *libc.$so.[0-9]*) dflt=$majonly ;;
8731                         *)      dflt=libperl.$so ;;
8732                         esac
8733                         ;;
8734                 esac
8735                 ;;
8736         *)      dflt=$libperl
8737                 ;;
8738         esac
8739         cat << EOM
8740
8741 I need to select a good name for the shared libperl.  If your system uses
8742 library names with major and minor numbers, then you might want something
8743 like $majmin.  Alternatively, if your system uses a single version
8744 number for shared libraries, then you might want to use $majonly.
8745 Or, your system might be quite happy with a simple libperl.$so.
8746
8747 Since the shared libperl will get installed into a version-specific
8748 architecture-dependent directory, the version number of the shared perl
8749 library probably isn't important, so the default should be o.k.
8750
8751 EOM
8752         rp='What name do you want to give to the shared libperl?'
8753         . ./myread
8754         libperl=$ans
8755         echo "Ok, I'll use $libperl"
8756         ;;
8757 *)
8758         libperl="libperl${_a}"
8759         ;;
8760 esac
8761
8762 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8763 case "$shrpdir" in
8764 '') ;;
8765 *)      $cat >&4 <<EOM
8766 WARNING:  Use of the shrpdir variable for the installation location of
8767 the shared $libperl is not supported.  It was never documented and
8768 will not work in this version.  Let me (perlbug@perl.org)
8769 know of any problems this may cause.
8770
8771 EOM
8772         case "$shrpdir" in
8773         "$archlibexp/CORE")
8774                 $cat >&4 <<EOM
8775 But your current setting of $shrpdir is
8776 the default anyway, so it's harmless.
8777 EOM
8778                 ;;
8779         *)
8780                 $cat >&4 <<EOM
8781 Further, your current attempted setting of $shrpdir
8782 conflicts with the value of $archlibexp/CORE
8783 that installperl will use.
8784 EOM
8785                 ;;
8786         esac
8787         ;;
8788 esac
8789
8790 # How will the perl executable find the installed shared $libperl?
8791 # Add $xxx to ccdlflags.
8792 # If we can't figure out a command-line option, use $shrpenv to
8793 # set env LD_RUN_PATH.  The main perl makefile uses this.
8794 shrpdir=$archlibexp/CORE
8795 xxx=''
8796 tmp_shrpenv=''
8797 if "$useshrplib"; then
8798     case "$osname" in
8799         aix)
8800                 # We'll set it in Makefile.SH...
8801                 ;;
8802         solaris)
8803                 xxx="-R $shrpdir"
8804                 ;;
8805         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8806                 xxx="-Wl,-R$shrpdir"
8807                 ;;
8808         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8809                 xxx="-Wl,-rpath,$shrpdir"
8810                 ;;
8811         hpux*)
8812                 # hpux doesn't like the default, either.
8813                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8814                 ;;
8815         cygwin)
8816                 # cygwin needs only ldlibpth
8817                 ;;
8818         *)
8819                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8820                 ;;
8821         esac
8822         case "$xxx" in
8823         '') ;;
8824         *)
8825                 # Only add $xxx if it isn't already in ccdlflags.
8826                 case " $ccdlflags " in
8827                 *" $xxx "*)     ;;
8828                 *)      ccdlflags="$ccdlflags $xxx"
8829                         cat <<EOM >&4
8830
8831 Adding $xxx to the flags
8832 passed to $ld so that the perl executable will find the
8833 installed shared $libperl.
8834
8835 EOM
8836                         ;;
8837                 esac
8838                 ;;
8839         esac
8840 fi
8841 # Fix ccdlflags in AIX for building external extensions.
8842 # (For building Perl itself bare -bE:perl.exp is needed,
8843 #  Makefile.SH takes care of this.)
8844 case "$osname" in
8845 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8846 esac
8847 # Respect a hint or command-line value.
8848 case "$shrpenv" in
8849 '') shrpenv="$tmp_shrpenv" ;;
8850 esac
8851 case "$ldlibpthname" in
8852 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8853 none)   ldlibpthname='' ;;
8854 esac
8855
8856 : determine where manual pages are on this system
8857 echo " "
8858 case "$sysman" in
8859 '')
8860         syspath='/usr/share/man/man1 /usr/man/man1'
8861         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8862         syspath="$syspath /usr/man/u_man/man1"
8863         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8864         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8865         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8866         sysman=`./loc . /usr/man/man1 $syspath`
8867         ;;
8868 esac
8869 if $test -d "$sysman"; then
8870         echo "System manual is in $sysman." >&4
8871 else
8872         echo "Could not find manual pages in source form." >&4
8873 fi
8874
8875 : determine where manual pages go
8876 set man1dir man1dir none
8877 eval $prefixit
8878 $cat <<EOM
8879
8880 $spackage has manual pages available in source form.
8881 EOM
8882 case "$nroff" in
8883 nroff)
8884         echo "However, you don't have nroff, so they're probably useless to you."
8885         case "$man1dir" in
8886         '') man1dir="none";;
8887         esac;;
8888 esac
8889 echo "If you don't want the manual sources installed, answer 'none'."
8890 case "$man1dir" in
8891 ' ') dflt=none
8892         ;;
8893 '')
8894         lookpath="$prefixexp/share/man/man1"
8895         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8896         lookpath="$lookpath $prefixexp/man/p_man/man1"
8897         lookpath="$lookpath $prefixexp/man/u_man/man1"
8898         lookpath="$lookpath $prefixexp/man/man.1"
8899         case "$sysman" in
8900         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8901         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8902         esac
8903         set dflt
8904         eval $prefixup
8905         ;;
8906 *)  dflt="$man1dir"
8907         ;;
8908 esac
8909 echo " "
8910 fn=dn+~
8911 rp="Where do the main $spackage manual pages (source) go?"
8912 . ./getfile
8913 if $test "X$man1direxp" != "X$ansexp"; then
8914         installman1dir=''
8915 fi
8916 prefixvar=man1dir
8917 . ./setprefixvar
8918
8919 case "$man1dir" in
8920 '')     man1dir=' '
8921         installman1dir='';;
8922 esac
8923
8924 : What suffix to use on installed man pages
8925
8926 case "$man1dir" in
8927 ' ')
8928         man1ext='0'
8929         ;;
8930 *)
8931         rp="What suffix should be used for the main $spackage man pages?"
8932         case "$man1ext" in
8933         '')     case "$man1dir" in
8934                 *1)  dflt=1 ;;
8935                 *1p) dflt=1p ;;
8936                 *1pm) dflt=1pm ;;
8937                 *l) dflt=l;;
8938                 *n) dflt=n;;
8939                 *o) dflt=o;;
8940                 *p) dflt=p;;
8941                 *C) dflt=C;;
8942                 *L) dflt=L;;
8943                 *L1) dflt=L1;;
8944                 *) dflt=1;;
8945                 esac
8946                 ;;
8947         *)      dflt="$man1ext";;
8948         esac
8949         . ./myread
8950         man1ext="$ans"
8951         ;;
8952 esac
8953
8954 : see if we can have long filenames
8955 echo " "
8956 first=123456789abcdef
8957 $rm -f $first
8958 if (echo hi >$first) 2>/dev/null; then
8959         if $test -f 123456789abcde; then
8960                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8961                 val="$undef"
8962         else
8963                 echo 'You can have filenames longer than 14 characters.'>&4
8964                 val="$define"
8965         fi
8966 else
8967         $cat <<'EOM'
8968 You can't have filenames longer than 14 chars.
8969 You can't even think about them!
8970 EOM
8971         val="$undef"
8972 fi
8973 set d_flexfnam
8974 eval $setvar
8975 $rm -rf 123456789abcde*
8976
8977 : determine where library module manual pages go
8978 set man3dir man3dir none
8979 eval $prefixit
8980 $cat <<EOM
8981
8982 $spackage has manual pages for many of the library modules.
8983 EOM
8984
8985 case "$nroff" in
8986 nroff)
8987         $cat <<'EOM'
8988 However, you don't have nroff, so they're probably useless to you.
8989 EOM
8990         case "$man3dir" in
8991         '') man3dir="none";;
8992         esac;;
8993 esac
8994
8995 case "$d_flexfnam" in
8996 undef)
8997         $cat <<'EOM'
8998 However, your system can't handle the long file names like File::Basename.3.
8999 EOM
9000         case "$man3dir" in
9001         '') man3dir="none";;
9002         esac;;
9003 esac
9004
9005 echo "If you don't want the manual sources installed, answer 'none'."
9006 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9007 case "$man3dir" in
9008 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9009         if $test -d "$privlib/man/man3"; then
9010                 cat <<EOM >&4
9011
9012 WARNING:  Previous versions of perl installed man3 pages into
9013 $privlib/man/man3.  This version will suggest a
9014 new default of $dflt.
9015 EOM
9016                 tdflt=$dflt
9017                 dflt='n'
9018                 rp='Do you wish to preserve the old behavior?(y/n)'
9019                 . ./myread
9020                 case "$ans" in
9021                 y*) dflt="$privlib/man/man3" ;;
9022                 *)  dflt=$tdflt ;;
9023                 esac
9024     fi
9025         ;;
9026 *)      dflt="$man3dir" ;;
9027 esac
9028 case "$dflt" in
9029 ' ') dflt=none ;;
9030 esac
9031 echo " "
9032 fn=dn+~
9033 rp="Where do the $package library man pages (source) go?"
9034 . ./getfile
9035 prefixvar=man3dir
9036 . ./setprefixvar
9037
9038 case "$man3dir" in
9039 '')     man3dir=' '
9040         installman3dir='';;
9041 esac
9042
9043 : What suffix to use on installed man pages
9044 case "$man3dir" in
9045 ' ')
9046         man3ext='0'
9047         ;;
9048 *)
9049         rp="What suffix should be used for the $package library man pages?"
9050         case "$man3ext" in
9051         '')     case "$man3dir" in
9052                 *3)  dflt=3 ;;
9053                 *3p) dflt=3p ;;
9054                 *3pm) dflt=3pm ;;
9055                 *l) dflt=l;;
9056                 *n) dflt=n;;
9057                 *o) dflt=o;;
9058                 *p) dflt=p;;
9059                 *C) dflt=C;;
9060                 *L) dflt=L;;
9061                 *L3) dflt=L3;;
9062                 *) dflt=3;;
9063                 esac
9064                 ;;
9065         *)      dflt="$man3ext";;
9066         esac
9067         . ./myread
9068         man3ext="$ans"
9069         ;;
9070 esac
9071
9072 : see if we have to deal with yellow pages, now NIS.
9073 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9074         case "$hostcat" in
9075         nidump*) ;;
9076         *)
9077                 case "$hostcat" in
9078                 *ypcat*) dflt=y;;
9079                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9080                                 dflt=y
9081                         else
9082                                 dflt=n
9083                         fi;;
9084                 *) dflt=n;;
9085                 esac
9086                 echo " "
9087                 rp='Are you getting the hosts file via yellow pages?'
9088                 . ./myread
9089                 case "$ans" in
9090                 y*) hostcat='ypcat hosts';;
9091                 *) hostcat='cat /etc/hosts';;
9092                 esac
9093                 ;;
9094         esac
9095 fi
9096 case "$hostcat" in
9097 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9098 esac
9099 case "$groupcat" in
9100 '') test -f /etc/group && groupcat='cat /etc/group';;
9101 esac
9102 case "$passcat" in
9103 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9104 esac
9105
9106 : now get the host name
9107 echo " "
9108 echo "Figuring out host name..." >&4
9109 case "$myhostname" in
9110 '') cont=true
9111         echo 'Maybe "hostname" will work...'
9112         if tans=`sh -c hostname 2>&1` ; then
9113                 myhostname=$tans
9114                 phostname=hostname
9115                 cont=''
9116         fi
9117         ;;
9118 *) cont='';;
9119 esac
9120 if $test "$cont"; then
9121         if ./xenix; then
9122                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9123                 if tans=`cat /etc/systemid 2>&1` ; then
9124                         myhostname=$tans
9125                         phostname='cat /etc/systemid'
9126                         echo "Whadyaknow.  Xenix always was a bit strange..."
9127                         cont=''
9128                 fi
9129         elif $test -r /etc/systemid; then
9130                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9131         fi
9132 fi
9133 if $test "$cont"; then
9134         echo 'No, maybe "uuname -l" will work...'
9135         if tans=`sh -c 'uuname -l' 2>&1` ; then
9136                 myhostname=$tans
9137                 phostname='uuname -l'
9138         else
9139                 echo 'Strange.  Maybe "uname -n" will work...'
9140                 if tans=`sh -c 'uname -n' 2>&1` ; then
9141                         myhostname=$tans
9142                         phostname='uname -n'
9143                 else
9144                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9145                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9146                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9147                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9148                         else
9149                                 case "$myhostname" in
9150                                 '') echo "Does this machine have an identity crisis or something?"
9151                                         phostname='';;
9152                                 *)
9153                                         echo "Well, you said $myhostname before..."
9154                                         phostname='echo $myhostname';;
9155                                 esac
9156                         fi
9157                 fi
9158         fi
9159 fi
9160 case "$myhostname" in
9161 '') myhostname=noname ;;
9162 esac
9163 : you do not want to know about this
9164 set $myhostname
9165 myhostname=$1
9166
9167 : verify guess
9168 if $test "$myhostname" ; then
9169         dflt=y
9170         rp='Your host name appears to be "'$myhostname'".'" Right?"
9171         . ./myread
9172         case "$ans" in
9173         y*) ;;
9174         *) myhostname='';;
9175         esac
9176 fi
9177
9178 : bad guess or no guess
9179 while $test "X$myhostname" = X ; do
9180         dflt=''
9181         rp="Please type the (one word) name of your host:"
9182         . ./myread
9183         myhostname="$ans"
9184 done
9185
9186 : translate upper to lower if necessary
9187 case "$myhostname" in
9188 *[A-Z]*)
9189         echo "(Normalizing case in your host name)"
9190         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9191         ;;
9192 esac
9193
9194 case "$myhostname" in
9195 *.*)
9196         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9197         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9198         echo "(Trimming domain name from host name--host name is now $myhostname)"
9199         ;;
9200 *) case "$mydomain" in
9201         '')
9202                 {
9203                         test "X$hostcat" = "Xypcat hosts" &&
9204                         ypmatch "$myhostname" hosts 2>/dev/null |\
9205                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9206                         $test -s hosts
9207                 } || {
9208                         test "X$hostcat" != "X" &&
9209                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9210                                         /[       ]$myhostname[  . ]/p" > hosts
9211                 }
9212                 tmp_re="[       . ]"
9213                 if $test -f hosts; then
9214                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9215                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9216                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9217                                 hosts | $sort | $uniq | \
9218                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9219                         case `$echo X$dflt` in
9220                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9221                                 dflt=.
9222                                 ;;
9223                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9224                                 ;;
9225                         esac
9226                 else
9227                         echo "(I cannot locate a hosts database anywhere)"
9228                         dflt=.
9229                 fi
9230                 case "$dflt" in
9231                 .)
9232                         tans=`./loc resolv.conf X /etc /usr/etc`
9233                         if $test -f "$tans"; then
9234                                 echo "(Attempting domain name extraction from $tans)"
9235                                 dflt=.`$sed -n -e 's/   / /g' \
9236                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9237                                   -e 1q 2>/dev/null`
9238                                 case "$dflt" in
9239                                 .) dflt=.`$sed -n -e 's/        / /g' \
9240                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9241                                      -e 1q 2>/dev/null`
9242                                         ;;
9243                                 esac
9244                         fi
9245                         ;;
9246                 esac
9247                 case "$dflt" in
9248                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9249                         dflt=.`sh -c domainname 2>/dev/null`
9250                         case "$dflt" in
9251                         '') dflt='.';;
9252                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9253                         esac
9254                         ;;
9255                 esac
9256                 case "$dflt$osname" in
9257                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9258                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9259                         ;;
9260                 esac
9261                 case "$dflt" in
9262                 .) echo "(Lost all hope -- silly guess then)"
9263                         dflt='.nonet'
9264                         ;;
9265                 esac
9266                 $rm -f hosts
9267                 ;;
9268         *) dflt="$mydomain";;
9269         esac;;
9270 esac
9271 echo " "
9272 rp="What is your domain name?"
9273 . ./myread
9274 tans="$ans"
9275 case "$ans" in
9276 '') ;;
9277 .*) ;;
9278 *) tans=".$tans";;
9279 esac
9280 mydomain="$tans"
9281
9282 : translate upper to lower if necessary
9283 case "$mydomain" in
9284 *[A-Z]*)
9285         echo "(Normalizing case in your domain name)"
9286         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9287         ;;
9288 esac
9289
9290 : a little sanity check here
9291 case "$phostname" in
9292 '') ;;
9293 *)
9294         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9295         $myhostname$mydomain|$myhostname) ;;
9296         *)
9297                 case "$phostname" in
9298                 sed*)
9299                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9300                         ;;
9301                 *)
9302                         echo "(That doesn't agree with your $phostname command, by the way.)"
9303                         ;;
9304                 esac
9305         ;;
9306         esac
9307         ;;
9308 esac
9309
9310 : determine the e-mail address of the user who is running us
9311 $cat <<EOM
9312
9313 I need to get your e-mail address in Internet format if possible, i.e.
9314 something like user@host.domain. Please answer accurately since I have
9315 no easy means to double check it. The default value provided below
9316 is most probably close to reality but may not be valid from outside
9317 your organization...
9318
9319 EOM
9320 cont=x
9321 while test "$cont"; do
9322         case "$MAILDOMAIN" in
9323         '')
9324                 if $test -s /etc/mailname; then
9325                         maildomain=`$cat /etc/mailname`
9326                 else
9327                         maildomain="$myhostname$mydomain"
9328                 fi
9329                 ;;
9330         *)  maildomain="$MAILDOMAIN";;
9331         esac
9332         case "$cf_email" in
9333         '') dflt="$cf_by@$maildomain";;
9334         *)  dflt="$cf_email";;
9335         esac
9336         rp='What is your e-mail address?'
9337         . ./myread
9338         cf_email="$ans"
9339         case "$cf_email" in
9340         *@*.*) cont='' ;;
9341         *)
9342                 rp='Address does not look like an Internet one.  Use it anyway?'
9343                 case "$fastread" in
9344                 yes) dflt=y ;;
9345                 *) dflt=n ;;
9346                 esac
9347                 . ./myread
9348                 case "$ans" in
9349                 y*) cont='' ;;
9350                 *) echo " " ;;
9351                 esac
9352                 ;;
9353         esac
9354 done
9355
9356 : Ask e-mail of administrator
9357 $cat <<EOM
9358
9359 If you or somebody else will be maintaining perl at your site, please
9360 fill in the correct e-mail address here so that they may be contacted
9361 if necessary. Currently, the "perlbug" program included with perl
9362 will send mail to this address in addition to perlbug@perl.org. You may
9363 enter "none" for no administrator.
9364
9365 EOM
9366 case "$perladmin" in
9367 '') dflt="$cf_email";;
9368 *) dflt="$perladmin";;
9369 esac
9370 rp='Perl administrator e-mail address'
9371 . ./myread
9372 perladmin="$ans"
9373
9374 : determine whether to use a version number suffix for installed binaries
9375 echo " "
9376 $cat <<EOM
9377 Do you want to use a version number suffix for installed binaries? This
9378 will install 'perl$version' instead of 'perl', and likewise for other
9379 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9380 to be installed side-by-side. Unless you are a developer, you probably
9381 do *not* want to do this.
9382 EOM
9383 case "$versiononly" in
9384 "$define"|[Yy]*|true) dflt='y' ;;
9385 *) dflt='n';
9386 esac
9387 rp="Do you want to use a version number suffix for installed binaries?"
9388 . ./myread
9389 case "$ans" in
9390 [yY]*)  val="$define";;
9391 *)      val="$undef" ;;
9392 esac
9393 set versiononly
9394 eval $setvar
9395
9396 case "$versiononly" in
9397 "$define") inc_version_list=''
9398            inc_version_list_init=0
9399            ;;
9400 esac
9401
9402 : figure out how to guarantee perl startup
9403 : XXX Note that this currently takes advantage of the bug that binexp ignores
9404 :     the Configure -Dinstallprefix setting, which in turn means that under
9405 :     relocatable @INC, initialinstalllocation is what binexp started as.
9406 case "$startperl" in
9407 '')
9408         case "$sharpbang" in
9409         *!)
9410                 $cat <<EOH
9411
9412 I can use the #! construct to start perl on your system. This will
9413 make startup of perl scripts faster, but may cause problems if you
9414 want to share those scripts and perl is not in a standard place
9415 ($initialinstalllocation/perl) on all your platforms. The alternative
9416 is to force a shell by starting the script with a single ':' character.
9417
9418 EOH
9419                 case "$versiononly" in
9420                 "$define")      dflt="$initialinstalllocation/perl$version";;
9421                 *)              dflt="$initialinstalllocation/perl";;
9422                 esac
9423                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9424                 . ./myread
9425                 case "$ans" in
9426                 none)   startperl=": # use perl";;
9427                 *)      startperl="#!$ans"
9428                         if $test 30 -lt `echo "$ans" | wc -c`; then
9429                                 $cat >&4 <<EOM
9430
9431 WARNING:  Some systems limit the #! command to 32 characters.
9432 If you experience difficulty running Perl scripts with #!, try
9433 installing Perl in a directory with a shorter pathname.
9434
9435 EOM
9436                         fi ;;
9437                 esac
9438                 ;;
9439         *) startperl=": # use perl"
9440                 ;;
9441         esac
9442         ;;
9443 esac
9444 echo "I'll use $startperl to start perl scripts."
9445
9446 : figure best path for perl in scripts
9447 case "$perlpath" in
9448 '')
9449         case "$versiononly" in
9450         "$define")      perlpath="$initialinstalllocation/perl$version";;
9451         *)              perlpath="$initialinstalllocation/perl";;
9452         esac
9453         case "$startperl" in
9454         *!*) ;;
9455         *)
9456                 $cat <<EOH
9457
9458 I will use the "eval 'exec'" idiom to start Perl on your system.
9459 I can use the full path of your Perl binary for this purpose, but
9460 doing so may cause problems if you want to share those scripts and
9461 Perl is not always in a standard place ($initialinstalllocation/perl).
9462
9463 EOH
9464                 dflt="$initialinstalllocation/perl"
9465                 rp="What path shall I use in \"eval 'exec'\"?"
9466                 . ./myread
9467                 perlpath="$ans"
9468                 ;;
9469         esac
9470         ;;
9471 esac
9472 case "$startperl" in
9473 *!*)    ;;
9474 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9475 esac
9476
9477 : determine where public executable scripts go
9478 set scriptdir scriptdir
9479 eval $prefixit
9480 case "$scriptdir" in
9481 '')
9482         dflt="$bin"
9483         : guess some guesses
9484         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9485         $test -d /usr/share/bin     && dflt=/usr/share/bin
9486         $test -d /usr/local/script  && dflt=/usr/local/script
9487         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9488         $test -d $prefixexp/script  && dflt=$prefixexp/script
9489         set dflt
9490         eval $prefixup
9491         ;;
9492 *)  dflt="$scriptdir"
9493         ;;
9494 esac
9495 $cat <<EOM
9496
9497 Some installations have a separate directory just for executable scripts so
9498 that they can mount it across multiple architectures but keep the scripts in
9499 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9500 Or you might just lump your scripts in with all your other executables.
9501
9502 EOM
9503 fn=d~
9504 rp='Where do you keep publicly executable scripts?'
9505 . ./getfile
9506 if $test "X$ansexp" != "X$scriptdirexp"; then
9507         installscript=''
9508 fi
9509 installscriptdir=''
9510 prefixvar=scriptdir
9511 . ./setprefixvar
9512 : A little fix up for an irregularly named variable.
9513 installscript="$installscriptdir"
9514
9515 : determine where add-on public executables go
9516 case "$sitebin" in
9517 '')     dflt=$siteprefix/bin ;;
9518 *)      dflt=$sitebin ;;
9519 esac
9520 fn=d~
9521 rp='Pathname where the add-on public executables should be installed?'
9522 . ./getfile
9523 prefixvar=sitebin
9524 . ./setprefixvar
9525
9526 : determine where add-on html pages go
9527 : There is no standard location, so try to copy the previously-selected
9528 : directory structure for the core html pages.
9529 case "$sitehtml1dir" in
9530 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9531 *)     dflt=$sitehtml1dir ;;
9532 esac
9533 case "$dflt" in
9534 ''|' ') dflt=none ;;
9535 esac
9536 fn=dn+~
9537 rp='Pathname where the site-specific html pages should be installed?'
9538 . ./getfile
9539 prefixvar=sitehtml1dir
9540 . ./setprefixvar
9541
9542 : determine where add-on library html pages go
9543 : There is no standard location, so try to copy the previously-selected
9544 : directory structure for the core html pages.
9545 case "$sitehtml3dir" in
9546 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9547 *)     dflt=$sitehtml3dir ;;
9548 esac
9549 case "$dflt" in
9550 ''|' ') dflt=none ;;
9551 esac
9552 fn=dn+~
9553 rp='Pathname where the site-specific library html pages should be installed?'
9554 . ./getfile
9555 prefixvar=sitehtml3dir
9556 . ./setprefixvar
9557
9558 : determine where add-on manual pages go
9559 case "$siteman1dir" in
9560 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9561 *)      dflt=$siteman1dir ;;
9562 esac
9563 case "$dflt" in
9564 ''|' ') dflt=none ;;
9565 esac
9566 fn=dn+~
9567 rp='Pathname where the site-specific manual pages should be installed?'
9568 . ./getfile
9569 prefixvar=siteman1dir
9570 . ./setprefixvar
9571
9572 : determine where add-on library man pages go
9573 case "$siteman3dir" in
9574 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9575 *)      dflt=$siteman3dir ;;
9576 esac
9577 case "$dflt" in
9578 ''|' ') dflt=none ;;
9579 esac
9580 fn=dn+~
9581 rp='Pathname where the site-specific library manual pages should be installed?'
9582 . ./getfile
9583 prefixvar=siteman3dir
9584 . ./setprefixvar
9585
9586 : determine where add-on public executable scripts go
9587 case "$sitescript" in
9588 '')     dflt=$siteprefix/script
9589         $test -d $dflt || dflt=$sitebin ;;
9590 *)  dflt="$sitescript" ;;
9591 esac
9592 fn=d~+
9593 rp='Pathname where add-on public executable scripts should be installed?'
9594 . ./getfile
9595 prefixvar=sitescript
9596 . ./setprefixvar
9597
9598 : see if backtrace exists
9599 set backtrace d_backtrace
9600 eval $inlibc
9601
9602 : add flags if using c backtrace
9603 case "$usecbacktrace" in
9604   "") usecbacktrace=$undef ;;
9605   [yY]*|true|$define)
9606     case "$d_backtrace" in
9607       [yY]*|true|$define)
9608         case " $ccflags " in
9609           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9610           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9611           esac
9612         ;;
9613       *)
9614         echo "This system does not support backtrace" >&4
9615         usecbacktrace=$undef
9616         ;;
9617       esac
9618     ;;
9619   esac
9620
9621 : Check if faststdio is requested and available
9622 case "$usefaststdio" in
9623 $define|true|[yY]*|'')
9624         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9625         case "$xversion" in
9626         [68])   dflt='y' ;;
9627         *)      dflt='n' ;;
9628         esac
9629         ;;
9630 *) dflt='n';;
9631 esac
9632 cat <<EOM
9633
9634 Perl can be built to use 'fast stdio', which means using the stdio
9635 library but also directly manipulating the stdio buffers to enable
9636 faster I/O.  Using stdio is better for backward compatibility (especially
9637 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9638 interface has been preferred instead of stdio.
9639
9640 If this doesn't make any sense to you, just accept the default '$dflt'.
9641 EOM
9642 rp='Use the "fast stdio" if available?'
9643 . ./myread
9644 case "$ans" in
9645 y|Y)    val="$define" ;;
9646 *)      val="$undef" ;;
9647 esac
9648 set usefaststdio
9649 eval $setvar
9650
9651 : define an is-a-typedef? function
9652 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9653 case "$inclist" in
9654 "") inclist="sys/types.h";;
9655 esac;
9656 eval "varval=\$$var";
9657 case "$varval" in
9658 "")
9659         $rm -f temp.c;
9660         for inc in $inclist; do
9661                 echo "#include <$inc>" >>temp.c;
9662         done;
9663         echo "#ifdef $type" >> temp.c;
9664         echo "printf(\"We have $type\");" >> temp.c;
9665         echo "#endif" >> temp.c;
9666         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9667         if $contains $type temp.E >/dev/null 2>&1; then
9668                 eval "$var=\$type";
9669         else
9670                 eval "$var=\$def";
9671         fi;
9672         $rm -f temp.?;;
9673 *) eval "$var=\$varval";;
9674 esac'
9675
9676 : define an is-a-typedef? function that prompts if the type is not available.
9677 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9678 case "$inclist" in
9679 "") inclist="sys/types.h";;
9680 esac;
9681 eval "varval=\$$var";
9682 case "$varval" in
9683 "")
9684         $rm -f temp.c;
9685         for inc in $inclist; do
9686                 echo "#include <$inc>" >>temp.c;
9687         done;
9688         echo "#ifdef $type" >> temp.c;
9689         echo "printf(\"We have $type\");" >> temp.c;
9690         echo "#endif" >> temp.c;
9691         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9692         echo " " ;
9693         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9694         if $contains $type temp.E >/dev/null 2>&1; then
9695                 echo "$type found." >&4;
9696                 eval "$var=\$type";
9697         else
9698                 echo "$type NOT found." >&4;
9699                 dflt="$def";
9700                 . ./myread ;
9701                 eval "$var=\$ans";
9702         fi;
9703         $rm -f temp.?;;
9704 *) eval "$var=\$varval";;
9705 esac'
9706
9707 : see what type lseek is declared as in the kernel
9708 rp="What is the type used for lseek's offset on this system?"
9709 set off_t lseektype long stdio.h sys/types.h
9710 eval $typedef_ask
9711
9712 echo " "
9713 echo "Checking to see how big your file offsets are..." >&4
9714 $cat >try.c <<EOCP
9715 #include <sys/types.h>
9716 #include <stdio.h>
9717 int main()
9718 {
9719     printf("%d\n", (int)sizeof($lseektype));
9720     return(0);
9721 }
9722 EOCP
9723 set try
9724 if eval $compile_ok; then
9725         lseeksize=`$run ./try`
9726         echo "Your file offsets are $lseeksize bytes long."
9727 else
9728         dflt=$longsize
9729         echo " "
9730         echo "(I can't seem to compile the test program.  Guessing...)"
9731         rp="What is the size of your file offsets (in bytes)?"
9732         . ./myread
9733         lseeksize="$ans"
9734 fi
9735 $rm_try
9736
9737 : see what type file positions are declared as in the library
9738 rp="What is the type for file position used by fsetpos()?"
9739 set fpos_t fpostype long stdio.h sys/types.h
9740 eval $typedef_ask
9741
9742 : Check size for Fpos_t
9743 echo " "
9744 case "$fpostype" in
9745 *_t) zzz="$fpostype"    ;;
9746 *)   zzz="fpos_t"       ;;
9747 esac
9748 echo "Checking the size of $zzz..." >&4
9749 cat > try.c <<EOCP
9750 #include <sys/types.h>
9751 #include <stdio.h>
9752 #$i_stdlib I_STDLIB
9753 #ifdef I_STDLIB
9754 #include <stdlib.h>
9755 #endif
9756 int main() {
9757     printf("%d\n", (int)sizeof($fpostype));
9758     exit(0);
9759 }
9760 EOCP
9761 set try
9762 if eval $compile_ok; then
9763         yyy=`$run ./try`
9764         case "$yyy" in
9765         '')     fpossize=4
9766                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9767                 ;;
9768         *)      fpossize=$yyy
9769                 echo "Your $zzz is $fpossize bytes long."
9770                 ;;
9771         esac
9772 else
9773         dflt="$longsize"
9774         echo " " >&4
9775         echo "(I can't compile the test program.  Guessing...)" >&4
9776         rp="What is the size of your file positions (in bytes)?"
9777         . ./myread
9778         fpossize="$ans"
9779 fi
9780
9781 : Check for large file support
9782 # Backward compatibility (uselfs is deprecated).
9783 case "$uselfs" in
9784 "$define"|true|[yY]*)
9785         cat <<EOM >&4
9786
9787 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9788 EOM
9789         uselargefiles="$define"
9790         ;;
9791 esac
9792
9793 case "$lseeksize:$fpossize" in
9794 8:8) cat <<EOM
9795
9796 You can have files larger than 2 gigabytes.
9797 EOM
9798    val="$define" ;;
9799 *)    case "$uselargefiles" in
9800    "$undef"|false|[nN]*) dflt='n' ;;
9801    *)   dflt='y' ;;
9802    esac
9803    cat <<EOM
9804
9805 Perl can be built to understand large files (files larger than 2 gigabytes)
9806 on some systems.  To do so, Configure can be run with -Duselargefiles.
9807
9808 If this doesn't make any sense to you, just accept the default '$dflt'.
9809 EOM
9810    rp='Try to understand large files, if available?'
9811    . ./myread
9812    case "$ans" in
9813    y|Y) val="$define" ;;
9814    *)   val="$undef"  ;;
9815    esac
9816    ;;
9817 esac
9818 set uselargefiles
9819 eval $setvar
9820 : Look for a hint-file generated 'call-back-unit'.  If the
9821 : user has specified that a large files perl is to be built,
9822 : we may need to set or change some other defaults.
9823 if $test -f uselargefiles.cbu; then
9824         echo "Your platform has some specific hints regarding large file builds, using them..."
9825         . ./uselargefiles.cbu
9826 fi
9827 case "$uselargefiles" in
9828 "$define")
9829         if $test -f uselargefiles.cbu; then
9830                 echo " "
9831                 echo "Rechecking to see how big your file offsets are..." >&4
9832                 $cat >try.c <<EOCP
9833 #include <sys/types.h>
9834 #include <stdio.h>
9835 int main()
9836 {
9837     printf("%d\n", (int)sizeof($lseektype));
9838     return(0);
9839 }
9840 EOCP
9841                 set try
9842                 if eval $compile_ok; then
9843                         lseeksize=`$run ./try`
9844                         $echo "Your file offsets are now $lseeksize bytes long."
9845                 else
9846                         dflt="$lseeksize"
9847                         echo " "
9848                         echo "(I can't seem to compile the test program.  Guessing...)"
9849                         rp="What is the size of your file offsets (in bytes)?"
9850                         . ./myread
9851                         lseeksize="$ans"
9852                 fi
9853                 case "$fpostype" in
9854                 *_t) zzz="$fpostype"    ;;
9855                 *)   zzz="fpos_t"       ;;
9856                 esac
9857                 $echo $n "Rechecking the size of $zzz...$c" >&4
9858                 $cat > try.c <<EOCP
9859 #include <sys/types.h>
9860 #include <stdio.h>
9861 #$i_stdlib I_STDLIB
9862 #ifdef I_STDLIB
9863 #include <stdlib.h>
9864 #endif
9865 int main() {
9866     printf("%d\n", (int)sizeof($fpostype));
9867     return(0);
9868 }
9869 EOCP
9870                 set try
9871                 if eval $compile_ok; then
9872                         yyy=`$run ./try`
9873                         dflt="$lseeksize"
9874                         case "$yyy" in
9875                         '')     echo " "
9876                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9877                                 ;;
9878                         *)      fpossize=$yyy
9879                                 echo " $fpossize bytes." >&4
9880                                 ;;
9881                         esac
9882                 else
9883                         dflt="$fpossize"
9884                         echo " "
9885                         echo "(I can't compile the test program.  Guessing...)" >&4
9886                         rp="What is the size of your file positions (in bytes)?"
9887                         . ./myread
9888                         fpossize="$ans"
9889                 fi
9890                 $rm_try
9891         fi
9892         ;;
9893 esac
9894
9895 : Check if we want perlio
9896 useperlio="$define"
9897
9898 : Set the vendorbin variables
9899 case "$vendorprefix" in
9900 '')     d_vendorbin="$undef"
9901         vendorbin=''
9902         vendorbinexp=''
9903         ;;
9904 *)      d_vendorbin="$define"
9905         : determine where vendor-supplied executables go.
9906         case "$vendorbin" in
9907         '') dflt=$vendorprefix/bin ;;
9908         *)      dflt="$vendorbin" ;;
9909         esac
9910         fn=d~+
9911         rp='Pathname for the vendor-supplied executables directory?'
9912         . ./getfile
9913         vendorbin="$ans"
9914         vendorbinexp="$ansexp"
9915         ;;
9916 esac
9917 prefixvar=vendorbin
9918 . ./installprefix
9919
9920 : Set the vendorhtml1dir variables
9921 case "$vendorprefix" in
9922 '')     vendorhtml1dir=''
9923         vendorhtml1direxp=''
9924         ;;
9925 *)      : determine where vendor-supplied html pages go.
9926         : There is no standard location, so try to copy the previously-selected
9927         : directory structure for the core html pages.
9928         : XXX Better default suggestions would be welcome.
9929         case "$vendorhtml1dir" in
9930         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9931         *)      dflt=$vendorhtml1dir ;;
9932         esac
9933         case "$dflt" in
9934         ''|' ') dflt=none ;;
9935         esac
9936         fn=dn+~
9937         rp='Pathname for the vendor-supplied html pages?'
9938         . ./getfile
9939         vendorhtml1dir="$ans"
9940         vendorhtml1direxp="$ansexp"
9941         ;;
9942 esac
9943 : Use ' ' for none so value is preserved next time through Configure
9944 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9945 prefixvar=vendorhtml1dir
9946 . ./installprefix
9947
9948 : Set the vendorhtml3dir variables
9949 case "$vendorprefix" in
9950 '')     vendorhtml3dir=''
9951         vendorhtml3direxp=''
9952         ;;
9953 *)      : determine where vendor-supplied module html pages go.
9954         : There is no standard location, so try to copy the previously-selected
9955         : directory structure for the core html pages.
9956         : XXX Better default suggestions would be welcome.
9957         case "$vendorhtml3dir" in
9958         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9959         *)      dflt=$vendorhtml3dir ;;
9960         esac
9961         case "$dflt" in
9962         ''|' ') dflt=none ;;
9963         esac
9964         fn=dn+~
9965         rp='Pathname for the vendor-supplied html pages?'
9966         . ./getfile
9967         vendorhtml3dir="$ans"
9968         vendorhtml3direxp="$ansexp"
9969         ;;
9970 esac
9971 : Use ' ' for none so value is preserved next time through Configure
9972 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9973 prefixvar=vendorhtml3dir
9974 . ./installprefix
9975
9976 : Set the vendorman1dir variables
9977 case "$vendorprefix" in
9978 '')     vendorman1dir=''
9979         vendorman1direxp=''
9980         ;;
9981 *)      : determine where vendor-supplied manual pages go.
9982         case "$vendorman1dir" in
9983         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9984         *)      dflt=$vendorman1dir ;;
9985         esac
9986         case "$dflt" in
9987         ''|' ') dflt=none ;;
9988         esac
9989         fn=nd~+
9990         rp='Pathname for the vendor-supplied manual section 1 pages?'
9991         . ./getfile
9992         vendorman1dir="$ans"
9993         vendorman1direxp="$ansexp"
9994         ;;
9995 esac
9996 : Use ' ' for none so value is preserved next time through Configure
9997 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9998 prefixvar=vendorman1dir
9999 . ./installprefix
10000
10001 : Set the vendorman3dir variables
10002 case "$vendorprefix" in
10003 '')     vendorman3dir=''
10004         vendorman3direxp=''
10005         ;;
10006 *)      : determine where vendor-supplied module manual pages go.
10007         case "$vendorman3dir" in
10008         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10009         *)      dflt=$vendorman3dir ;;
10010         esac
10011         case "$dflt" in
10012         ''|' ') dflt=none ;;
10013         esac
10014         fn=nd~+
10015         rp='Pathname for the vendor-supplied manual section 3 pages?'
10016         . ./getfile
10017         vendorman3dir="$ans"
10018         vendorman3direxp="$ansexp"
10019         ;;
10020 esac
10021 : Use ' ' for none so value is preserved next time through Configure
10022 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10023 prefixvar=vendorman3dir
10024 . ./installprefix
10025
10026 : Set the vendorscript variables
10027 case "$vendorprefix" in
10028 '')     d_vendorscript="$undef"
10029         vendorscript=''
10030         vendorscriptexp=''
10031         ;;
10032 *)      d_vendorscript="$define"
10033         : determine where vendor-supplied scripts go.
10034         case "$vendorscript" in
10035         '')     dflt=$vendorprefix/script
10036                 $test -d $dflt || dflt=$vendorbin ;;
10037         *)  dflt="$vendorscript" ;;
10038         esac
10039         $cat <<EOM
10040
10041 The installation process will create a directory for
10042 vendor-supplied scripts.
10043
10044 EOM
10045         fn=d~+
10046         rp='Pathname for the vendor-supplied scripts directory?'
10047         . ./getfile
10048         vendorscript="$ans"
10049         vendorscriptexp="$ansexp"
10050         ;;
10051 esac
10052 prefixvar=vendorscript
10053 . ./installprefix
10054
10055 : see if qgcvt exists
10056 set qgcvt d_qgcvt
10057 eval $inlibc
10058
10059 : Check what kind of doubles your system has
10060 $echo "Checking the kind of doubles you have..." >&4
10061 $cat >try.c <<EOP
10062 #$i_stdlib I_STDLIB
10063 #define DOUBLESIZE $doublesize
10064 #ifdef I_STDLIB
10065 #include <stdlib.h>
10066 #endif
10067 #include <stdio.h>
10068 static const double d = -0.1;
10069 int main() {
10070   unsigned const char* b = (unsigned const char*)(&d);
10071 #if DOUBLESIZE == 4
10072   if (b[0] == 0xCD && b[3] == 0xBD) {
10073     /* IEEE 754 32-bit little-endian */
10074     printf("1\n");
10075     exit(0);
10076   }
10077   if (b[0] == 0xBD && b[3] == 0xCD) {
10078     /* IEEE 754 32-bit big-endian */
10079     printf("2\n");
10080     exit(0);
10081   }
10082   if (b[0] == 0xCC && b[3] == 0xCC) {
10083     /* VAX format F, 32-bit PDP-style mixed endian. */
10084     printf("9\n");
10085     exit(0);
10086   }
10087   if (b[0] == 0xC0 && b[3] == 0x9A) {
10088     /* IBM single 32-bit */
10089     printf("12\n");
10090     exit(0);
10091   }
10092 #endif
10093 #if DOUBLESIZE == 8
10094   if (b[0] == 0x9A && b[7] == 0xBF) {
10095     /* IEEE 754 64-bit little-endian */
10096     printf("3\n");
10097     exit(0);
10098   }
10099   if (b[0] == 0xBF && b[7] == 0x9A) {
10100     /* IEEE 754 64-bit big-endian */
10101     printf("4\n");
10102     exit(0);
10103   }
10104   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10105    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10106     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10107     * 99 99 b9 bf 9a 99 99 99 */
10108     printf("7\n");
10109     exit(0);
10110   }
10111   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10112    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10113     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10114     * 99 99 99 9a bf b9 99 99 */
10115     printf("8\n");
10116     exit(0);
10117   }
10118   if (b[0] == 0xCC && b[7] == 0xCC) {
10119    /* VAX format D, 64-bit PDP-style mixed endian. */
10120     printf("10\n");
10121     exit(0);
10122   }
10123   if (b[0] == 0xD9 && b[7] == 0x99) {
10124    /* VAX format G, 64-bit PDP-style mixed endian. */
10125     printf("11\n");
10126     exit(0);
10127   }
10128   if (b[0] == 0xC0 && b[7] == 0x9A) {
10129     /* IBM double 64-bit */
10130     printf("13\n");
10131     exit(0);
10132   }
10133   if (b[0] == 0xBF && b[7] == 0xCD) {
10134     /* CRAY single 64-bit */
10135     printf("14\n");
10136     exit(0);
10137   }
10138 #endif
10139 #if DOUBLESIZE == 16
10140   if (b[0] == 0x9A && b[15] == 0xBF) {
10141     /* IEEE 754 128-bit little-endian */
10142     printf("5\n");
10143     exit(0);
10144   }
10145   if (b[0] == 0xBF && b[15] == 0x9A) {
10146     /* IEEE 754 128-bit big-endian */
10147     printf("6\n");
10148     exit(0);
10149   }
10150 #endif
10151   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10152    * Whether those environments can still build Perl is debatable. */
10153   printf("-1\n"); /* unknown */
10154   exit(0);
10155 }
10156 EOP
10157 set try
10158 if eval $compile; then
10159     doublekind=`$run ./try`
10160 else
10161     doublekind=-1
10162 fi
10163 case "$doublekind" in
10164 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10165 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10166 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10167 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10168 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10169 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10170 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10171 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10172 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10173 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10174 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10175 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10176 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10177 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10178 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10179 esac
10180 d_double_style_ieee=$undef
10181 d_double_style_vax=$undef
10182 d_double_style_ibm=$undef
10183 d_double_style_cray=$undef
10184 case "$doublekind" in
10185 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10186 9|10|11) d_double_style_vax=$define ;;
10187 12|13) d_double_style_ibm=$define ;;
10188 14) d_double_style_cray=$define ;;
10189 esac
10190 case "$d_double_style_ieee" in
10191 $define)
10192     d_double_has_inf=$define
10193     d_double_has_nan=$define
10194     d_double_has_negative_zero=$define
10195     d_double_has_subnormals=$define
10196     ;;
10197 *)
10198     d_double_has_inf=$undef
10199     d_double_has_nan=$undef
10200     d_double_has_negative_zero=$undef
10201     d_double_has_subnormals=$undef
10202     ;;
10203 esac
10204 $rm_try
10205
10206 : Check print/scan long double stuff
10207 echo " "
10208
10209 if $test X"$d_longdbl" = X"$define"; then
10210
10211 echo "Checking how to print long doubles..." >&4
10212
10213 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10214         $cat >try.c <<'EOCP'
10215 #include <sys/types.h>
10216 #include <stdio.h>
10217 int main() {
10218   double d = 123.456;
10219   printf("%.3f\n", d);
10220 }
10221 EOCP
10222         set try
10223         if eval $compile; then
10224                 yyy=`$run ./try`
10225                 case "$yyy" in
10226                 123.456)
10227                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10228                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10229                         echo "We will use %f."
10230                         ;;
10231                 esac
10232         fi
10233 fi
10234
10235 if $test X"$sPRIfldbl" = X; then
10236         $cat >try.c <<'EOCP'
10237 #include <sys/types.h>
10238 #include <stdio.h>
10239 int main() {
10240   long double d = 123.456;
10241   printf("%.3Lf\n", d);
10242 }
10243 EOCP
10244         set try
10245         if eval $compile; then
10246                 yyy=`$run ./try`
10247                 case "$yyy" in
10248                 123.456)
10249                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10250                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10251                         echo "We will use %Lf."
10252                         ;;
10253                 esac
10254         fi
10255 fi
10256
10257 if $test X"$sPRIfldbl" = X; then
10258         $cat >try.c <<'EOCP'
10259 #include <sys/types.h>
10260 #include <stdio.h>
10261 int main() {
10262   long double d = 123.456;
10263   printf("%.3llf\n", d);
10264 }
10265 EOCP
10266         set try
10267         if eval $compile; then
10268                 yyy=`$run ./try`
10269                 case "$yyy" in
10270                 123.456)
10271                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10272                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10273                         echo "We will use %llf."
10274                         ;;
10275                 esac
10276         fi
10277 fi
10278
10279 if $test X"$sPRIfldbl" = X; then
10280         $cat >try.c <<'EOCP'
10281 #include <sys/types.h>
10282 #include <stdio.h>
10283 int main() {
10284   long double d = 123.456;
10285   printf("%.3lf\n", d);
10286 }
10287 EOCP
10288         set try
10289         if eval $compile; then
10290                 yyy=`$run ./try`
10291                 case "$yyy" in
10292                 123.456)
10293                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10294                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10295                         echo "We will use %lf."
10296                         ;;
10297                 esac
10298         fi
10299 fi
10300
10301 if $test X"$sPRIfldbl" = X; then
10302         echo "Cannot figure out how to print long doubles." >&4
10303 else
10304         sSCNfldbl=$sPRIfldbl    # expect consistency
10305 fi
10306
10307 $rm_try
10308
10309 fi # d_longdbl
10310
10311 case "$sPRIfldbl" in
10312 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10313         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10314         d_SCNfldbl="$undef";
10315         ;;
10316 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10317         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10318         d_SCNfldbl="$define";
10319         ;;
10320 esac
10321
10322 : Before committing on uselongdouble, see whether that looks sane.
10323 if $test "$uselongdouble" = "$define"; then
10324     message=""
10325     echo " "
10326     echo "Checking if your long double math functions work right..." >&4
10327     $cat > try.c <<EOF
10328 #include <math.h>
10329 #include <stdio.h>
10330 int main() {
10331   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10332 }
10333 EOF
10334     case "$osname:$gccversion" in
10335     aix:)       saveccflags="$ccflags"
10336                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10337     esac
10338     set try
10339     if eval $compile_ok; then
10340       yyy=`$run ./try`
10341     fi
10342     case "$yyy" in
10343     3) echo "Your long double math functions are working correctly." >&4 ;;
10344     *) echo "Your long double math functions are broken, not using long doubles." >&4
10345        uselongdouble=$undef
10346        ;;
10347     esac
10348     $rm_try
10349     case "$osname:$gccversion" in
10350     aix:)       ccflags="$saveccflags" ;; # restore
10351     esac
10352 fi
10353
10354 : Check how to convert floats to strings.
10355
10356 if test "X$d_Gconvert" = X; then
10357
10358 echo " "
10359 echo "Checking for an efficient way to convert floats to strings."
10360 echo " " > try.c
10361 case "$uselongdouble" in
10362 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10363 esac
10364 case "$d_longdbl" in
10365 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10366 esac
10367 case "$d_PRIgldbl" in
10368 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10369 esac
10370 $cat >>try.c <<EOP
10371 #ifdef TRY_gconvert
10372 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10373 char *myname = "gconvert";
10374 #endif
10375 #ifdef TRY_gcvt
10376 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10377 char *myname = "gcvt";
10378 #endif
10379 #ifdef TRY_qgcvt
10380 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10381 char *myname = "qgcvt";
10382 #define DOUBLETYPE long double
10383 #endif
10384 #ifdef TRY_sprintf
10385 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10386 #ifdef HAS_PRIgldbl
10387 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10388 #else
10389 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10390 #endif
10391 #else
10392 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10393 #endif
10394 char *myname = "sprintf";
10395 #endif
10396
10397 #ifndef DOUBLETYPE
10398 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10399 #define DOUBLETYPE long double
10400 #else
10401 #define DOUBLETYPE double
10402 #endif
10403 #endif
10404
10405 #include <stdio.h>
10406
10407 #$i_stdlib I_STDLIB
10408 #ifdef I_STDLIB
10409 #include <stdlib.h>
10410 #endif
10411 #include <string.h>
10412
10413 int checkit(char *expect, char *got)
10414 {
10415     if (strcmp(expect, got)) {
10416                 printf("%s oddity:  Expected %s, got %s\n",
10417                         myname, expect, got);
10418                 exit(1);
10419         }
10420 }
10421
10422 int main()
10423 {
10424         char buf[64];
10425         buf[63] = '\0';
10426
10427         /* This must be 1st test on (which?) platform */
10428         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10429         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10430         checkit("0.1", buf);
10431
10432         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10433         checkit("0.01", buf);
10434
10435         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10436         checkit("0.001", buf);
10437
10438         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10439         checkit("0.0001", buf);
10440
10441         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10442         if (strlen(buf) > 5)
10443             checkit("9e-005", buf); /* for Microsoft ?? */
10444         else
10445             checkit("9e-05", buf);
10446
10447         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10448         checkit("1", buf);
10449
10450         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10451         checkit("1.1", buf);
10452
10453         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10454         checkit("1.01", buf);
10455
10456         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10457         checkit("1.001", buf);
10458
10459         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10460         checkit("1.0001", buf);
10461
10462         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10463         checkit("1.00001", buf);
10464
10465         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10466         checkit("1.000001", buf);
10467
10468         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10469         checkit("0", buf);
10470
10471         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10472         checkit("-1", buf);
10473
10474         /* Some Linux gcvt's give 1.e+5 here. */
10475         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10476         checkit("100000", buf);
10477
10478         /* Some Linux gcvt's give -1.e+5 here. */
10479         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10480         checkit("-100000", buf);
10481
10482         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10483         checkit("123.456", buf);
10484
10485         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10486         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10487         /* 34 should be enough to scare even long double
10488          * places into using the e notation. */
10489         if (strlen(buf) > 5)
10490             checkit("1e+034", buf); /* for Microsoft */
10491         else
10492             checkit("1e+34", buf);
10493
10494         /* For Perl, if you add additional tests here, also add them to
10495          * t/base/num.t for benefit of platforms not using Configure or
10496          * overriding d_Gconvert */
10497
10498         exit(0);
10499 }
10500 EOP
10501 : first add preferred functions to our list
10502 xxx_list=""
10503 for xxx_convert in $gconvert_preference; do
10504     case $xxx_convert in
10505     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10506     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10507     esac
10508 done
10509 : then add any others
10510 for xxx_convert in gconvert gcvt sprintf; do
10511     case "$xxx_list" in
10512     *$xxx_convert*) ;;
10513     *) xxx_list="$xxx_list $xxx_convert" ;;
10514     esac
10515 done
10516
10517 case "$d_longdbl$uselongdouble" in
10518 "$define$define")
10519     : again, add preferred functions to our list first
10520     xxx_ld_list=""
10521     for xxx_convert in $gconvert_ld_preference; do
10522         case $xxx_convert in
10523         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10524         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10525         esac
10526     done
10527     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10528     for xxx_convert in qgcvt sprintf $xxx_list; do
10529         case "$xxx_ld_list" in
10530         $xxx_convert*|*" $xxx_convert"*) ;;
10531         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10532         esac
10533     done
10534     : if sprintf cannot do long doubles, move it to the end
10535     if test "$d_PRIgldbl" != "$define"; then
10536         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10537     fi
10538     : if no qgcvt, remove it
10539     if test "$d_qgcvt" != "$define"; then
10540         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10541     fi
10542     : use the ld_list
10543     xxx_list="$xxx_ld_list"
10544     ;;
10545 esac
10546
10547 for xxx_convert in $xxx_list; do
10548         echo "Trying $xxx_convert..."
10549         $rm -f try try$_o core
10550         set try -DTRY_$xxx_convert
10551         if eval $compile; then
10552                 echo "$xxx_convert() found." >&4
10553                 if $run ./try; then
10554                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10555                         break;
10556                 else
10557                         echo "...But $xxx_convert didn't work as I expected."
10558                         xxx_convert=''
10559                 fi
10560         else
10561                 echo "$xxx_convert NOT found." >&4
10562         fi
10563 done
10564
10565 if test X$xxx_convert = X; then
10566     echo "*** WHOA THERE!!! ***" >&4
10567     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10568     xxx_convert=sprintf
10569 fi
10570
10571 case "$xxx_convert" in
10572 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10573 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10574 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10575 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10576    "$define$define$define")
10577       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10578    "$define$define$undef")
10579       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10580    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10581    esac
10582    ;;
10583 esac
10584
10585 fi
10586 $rm_try
10587
10588 : see if _fwalk exists
10589 set fwalk d__fwalk
10590 eval $inlibc
10591
10592 : see if accept4 exists
10593 set accept4 d_accept4
10594 eval $inlibc
10595
10596 : Initialize h_fcntl
10597 h_fcntl=false
10598
10599 : Initialize h_sysfile
10600 h_sysfile=false
10601
10602 : access call always available on UNIX
10603 set access d_access
10604 eval $inlibc
10605
10606 : locate the flags for 'access()'
10607 case "$d_access" in
10608 "$define")
10609         echo " "
10610         $cat >access.c <<EOCP
10611 #include <sys/types.h>
10612 #ifdef I_FCNTL
10613 #include <fcntl.h>
10614 #endif
10615 #ifdef I_SYS_FILE
10616 #include <sys/file.h>
10617 #endif
10618 #ifdef I_UNISTD
10619 #include <unistd.h>
10620 #endif
10621 #$i_stdlib I_STDLIB
10622 #ifdef I_STDLIB
10623 #include <stdlib.h>
10624 #endif
10625 int main() {
10626         exit(R_OK);
10627 }
10628 EOCP
10629         : check sys/file.h first, no particular reason here
10630         if $test `./findhdr sys/file.h` && \
10631                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10632                 h_sysfile=true;
10633                 echo "<sys/file.h> defines the *_OK access constants." >&4
10634         elif $test `./findhdr fcntl.h` && \
10635                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10636                 h_fcntl=true;
10637                 echo "<fcntl.h> defines the *_OK access constants." >&4
10638         elif $test `./findhdr unistd.h` && \
10639                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10640                 echo "<unistd.h> defines the *_OK access constants." >&4
10641         else
10642                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10643         fi
10644         ;;
10645 esac
10646 $rm -f access*
10647
10648 : see if accessx exists
10649 set accessx d_accessx
10650 eval $inlibc
10651
10652 : see if acosh exists
10653 set acosh d_acosh
10654 eval $inlibc
10655
10656 : see if aintl exists
10657 set aintl d_aintl
10658 eval $inlibc
10659
10660 : see if alarm exists
10661 set alarm d_alarm
10662 eval $inlibc
10663
10664 : see if 64bit time functions exists
10665
10666 set ctime64 d_ctime64
10667 eval $inlibc
10668
10669 set localtime64 d_localtime64
10670 eval $inlibc
10671
10672 set gmtime64 d_gmtime64
10673 eval $inlibc
10674
10675 set mktime64 d_mktime64
10676 eval $inlibc
10677
10678 set difftime64 d_difftime64
10679 eval $inlibc
10680
10681 set asctime64 d_asctime64
10682 eval $inlibc
10683
10684 : see if POSIX threads are available
10685 set pthread.h i_pthread
10686 eval $inhdr
10687
10688 : define a function to check prototypes
10689 $cat > protochk <<EOSH
10690 $startsh
10691 cc="$cc"
10692 optimize="$optimize"
10693 ccflags="$ccflags"
10694 define="$define"
10695 rm_try="$rm_try"
10696 usethreads=$usethreads
10697 i_pthread=$i_pthread
10698 pthread_h_first=$pthread_h_first
10699 EOSH
10700
10701 $cat >> protochk <<'EOSH'
10702
10703 $rm_try
10704 foo="$1"
10705 shift
10706 while test $# -ge 2; do
10707         case "$1" in
10708                 $define) echo "#include <$2>" >> try.c ;;
10709                 literal) echo "$2" >> try.c ;;
10710         esac
10711     # Extra magic for the benefit of systems that need pthread.h
10712     # to be included early to correctly detect threadsafe functions.
10713     # Such functions must guarantee themselves, though, that the usethreads
10714     # and i_pthread have been defined, before calling protochk.
10715     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10716         echo "#include <pthread.h>" >> try.c
10717         pthread_h_done=yes
10718     fi
10719     shift 2
10720 done
10721 cat >> try.c <<'EOCP'
10722 #define _(args) args
10723 EOCP
10724 echo "$foo" >> try.c
10725 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10726 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10727 status=$?
10728 $rm_try
10729 exit $status
10730 EOSH
10731 chmod +x protochk
10732 $eunicefix protochk
10733
10734 : Define hasproto macro for Configure internal use
10735 hasproto='varname=$1; func=$2; shift; shift;
10736 while $test $# -ge 2; do
10737         case "$1" in
10738         $define) echo "#include <$2>";;
10739         esac ;
10740     shift 2;
10741 done > try.c;
10742 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10743 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10744         echo "$func() prototype found.";
10745         val="$define";
10746 else
10747         echo "$func() prototype NOT found.";
10748         val="$undef";
10749 fi;
10750 set $varname;
10751 eval $setvar;
10752 $rm_try tryout.c'
10753
10754 : see if sys/types.h has to be included
10755 set sys/types.h i_systypes
10756 eval $inhdr
10757
10758 : see if sys/select.h has to be included
10759 set sys/select.h i_sysselct
10760 eval $inhdr
10761
10762 : Define hasfield macro for Configure internal use
10763 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10764 while $test $# -ge 2; do
10765         case "$1" in
10766         $define) echo "#include <$2>";;
10767         esac ;
10768     shift 2;
10769 done > try.c;
10770 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10771 set try;
10772 if eval $compile; then
10773         val="$define";
10774 else
10775         val="$undef";
10776 fi;
10777 set $varname;
10778 eval $setvar;
10779 $rm_try'
10780
10781 : see if we should include sys/time.h
10782 echo " "
10783 i_time='define'
10784 if test "X$timeincl" = X; then
10785         echo "Testing to see if we should include <sys/time.h>." >&4
10786         $echo $n "I'm now running the test program...$c"
10787         $cat >try.c <<EOCP
10788 #include <sys/types.h>
10789 #include <time.h>
10790 #ifdef I_SYSTIME
10791 #ifdef SYSTIMEKERNEL
10792 #define KERNEL
10793 #endif
10794 #include <sys/time.h>
10795 #endif
10796 #ifdef I_SYSSELECT
10797 #include <sys/select.h>
10798 #endif
10799 #$i_stdlib I_STDLIB
10800 #ifdef I_STDLIB
10801 #include <stdlib.h>
10802 #endif
10803 int main()
10804 {
10805         struct tm foo;
10806 #ifdef S_TIMEVAL
10807         struct timeval bar;
10808 #endif
10809 #ifdef S_TIMEZONE
10810         struct timezone tzp;
10811 #endif
10812         if (foo.tm_sec == foo.tm_sec)
10813                 exit(0);
10814 #ifdef S_TIMEVAL
10815         if (bar.tv_sec == bar.tv_sec)
10816                 exit(0);
10817 #endif
10818         exit(1);
10819 }
10820 EOCP
10821         flags=''
10822         for s_timezone in '-DS_TIMEZONE' ''; do
10823         sysselect=''
10824         for s_timeval in '-DS_TIMEVAL' ''; do
10825         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10826         for i_systime in '-DI_SYSTIME' ''; do
10827                 case "$flags" in
10828                 '') $echo $n ".$c"
10829                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10830                         if eval $compile; then
10831                                 set X $i_systime $i_systimek $sysselect $s_timeval
10832                                 shift
10833                                 flags="$*"
10834                                 echo " "
10835                                 $echo $n "Succeeded with $flags$c"
10836                         fi
10837                         ;;
10838                 esac
10839         done
10840         done
10841         done
10842         done
10843         timeincl=''
10844         echo " "
10845         case "$flags" in
10846         *SYSTIMEKERNEL*) i_systimek="$define"
10847                 timeincl=`./findhdr sys/time.h`
10848                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10849         *) i_systimek="$undef";;
10850         esac
10851         case "$flags" in
10852         *I_SYSTIME*) i_systime="$define"
10853                 timeincl=`./findhdr sys/time.h`" $timeincl"
10854                 echo "We'll include <sys/time.h>." >&4;;
10855         *) i_systime="$undef";;
10856         esac
10857         $rm_try
10858 fi
10859 : see if struct tm knows about tm_zone
10860 case "$i_systime$i_time" in
10861 *$define*)
10862         echo " "
10863         echo "Checking to see if your struct tm has tm_zone field..." >&4
10864         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10865         eval $hasfield
10866         ;;
10867 *)      val="$undef"
10868         set d_tm_tm_zone
10869         eval $setvar
10870         ;;
10871 esac
10872 case "$d_tm_tm_zone" in
10873 "$define")      echo "Yes, it does."   ;;
10874 *)              echo "No, it doesn't." ;;
10875 esac
10876 : see if struct tm knows about tm_gmtoff
10877 case "$i_systime$i_time" in
10878 *$define*)
10879         echo " "
10880         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10881         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10882         eval $hasfield
10883         ;;
10884 *)      val="$undef"
10885         set d_tm_tm_gmtoff
10886         eval $setvar
10887         ;;
10888 esac
10889 case "$d_tm_tm_gmtoff" in
10890 "$define")      echo "Yes, it does."   ;;
10891 *)              echo "No, it doesn't." ;;
10892 esac
10893
10894 : see if asctime_r exists
10895 set asctime_r d_asctime_r
10896 eval $inlibc
10897 case "$d_asctime_r" in
10898 "$define")
10899         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10900         case "$d_asctime_r_proto:$usethreads" in
10901         ":define")      d_asctime_r_proto=define
10902                 set d_asctime_r_proto asctime_r $hdrs
10903                 eval $hasproto ;;
10904         *)      ;;
10905         esac
10906         case "$d_asctime_r_proto" in
10907         define)
10908         case "$asctime_r_proto" in
10909         ''|0) try='char* asctime_r(const struct tm*, char*);'
10910         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10911         esac
10912         case "$asctime_r_proto" in
10913         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10914         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10915         esac
10916         case "$asctime_r_proto" in
10917         ''|0) try='int asctime_r(const struct tm*, char*);'
10918         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10919         esac
10920         case "$asctime_r_proto" in
10921         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10922         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10923         esac
10924         case "$asctime_r_proto" in
10925         ''|0)   d_asctime_r=undef
10926                 asctime_r_proto=0
10927                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10928         * )     case "$asctime_r_proto" in
10929                 REENTRANT_PROTO*) ;;
10930                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10931                 esac
10932                 echo "Prototype: $try" ;;
10933         esac
10934         ;;
10935         *)      case "$usethreads" in
10936                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10937                 esac
10938                 d_asctime_r=undef
10939                 asctime_r_proto=0
10940                 ;;
10941         esac
10942         ;;
10943 *)      asctime_r_proto=0
10944         ;;
10945 esac
10946
10947 : see if asinh exists
10948 set asinh d_asinh
10949 eval $inlibc
10950
10951 : see if atanh exists
10952 set atanh d_atanh
10953 eval $inlibc
10954
10955 : see if atolf exists
10956 set atolf d_atolf
10957 eval $inlibc
10958
10959 : see if atoll exists
10960 set atoll d_atoll
10961 eval $inlibc
10962
10963 : Look for GCC-style attribute format
10964 case "$d_attribute_format" in
10965 '')
10966 echo " "
10967 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10968 $cat >attrib.c <<'EOCP'
10969 #include <stdio.h>
10970 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10971 EOCP
10972 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10973         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10974                 echo "Your C compiler doesn't support __attribute__((format))."
10975                 val="$undef"
10976         else
10977                 echo "Your C compiler supports __attribute__((format))."
10978                 val="$define"
10979         fi
10980 else
10981         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10982         val="$undef"
10983 fi
10984 ;;
10985 *) val="$d_attribute_format" ;;
10986 esac
10987 set d_attribute_format
10988 eval $setvar
10989 $rm -f attrib*
10990
10991 : Look for GCC-style attribute format with null format allowed
10992 case "$d_printf_format_null" in
10993 '') case "$d_attribute_format" in
10994     $define)
10995         echo " "
10996         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10997 $cat >attrib.c <<EOCP
10998 #include <stdio.h>
10999 #$i_stdlib I_STDLIB
11000 #ifdef I_STDLIB
11001 #include <stdlib.h>
11002 #endif
11003 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11004 int null_printf (char* pat,...) { return (int)pat; }
11005 int main () { exit(null_printf(NULL)); }
11006 EOCP
11007         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11008             : run the executable in case it produces a run-time warning
11009             if $run ./attrib >>attrib.out 2>&1; then
11010                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11011                     echo "Your C compiler doesn't allow __printf__ format to be null."
11012                     val="$undef"
11013                 else
11014                     echo "Your C compiler allows __printf__ format to be null."
11015                     val="$define"
11016                 fi
11017             else
11018             echo "Your C compiler executable failed with __printf__ format null."
11019             val="$undef"
11020         fi
11021     else
11022         echo "Your C compiler fails with __printf__ format null."
11023         val="$undef"
11024     fi
11025     ;;
11026     *)  val="$undef" ;;
11027     esac
11028 ;;
11029 *)  val="$d_printf_format_null" ;;
11030 esac
11031 set d_printf_format_null
11032 eval $setvar
11033 $rm -f attrib*
11034
11035 : Look for GCC-style attribute malloc
11036 case "$d_attribute_malloc" in
11037 '')
11038 echo " "
11039 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11040 $cat >attrib.c <<'EOCP'
11041 #include <stdio.h>
11042 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11043 EOCP
11044 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11045         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11046                 echo "Your C compiler doesn't support __attribute__((malloc))."
11047                 val="$undef"
11048         else
11049                 echo "Your C compiler supports __attribute__((malloc))."
11050                 val="$define"
11051         fi
11052 else
11053         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11054         val="$undef"
11055 fi
11056 ;;
11057 *) val="$d_attribute_malloc" ;;
11058 esac
11059 set d_attribute_malloc
11060 eval $setvar
11061 $rm -f attrib*
11062
11063 : Look for GCC-style attribute nonnull
11064 case "$d_attribute_nonnull" in
11065 '')
11066 echo " "
11067 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11068 $cat >attrib.c <<'EOCP'
11069 #include <stdio.h>
11070 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11071 EOCP
11072 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11073         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11074                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11075                 val="$undef"
11076         else
11077                 echo "Your C compiler supports __attribute__((nonnull))."
11078                 val="$define"
11079         fi
11080 else
11081         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11082         val="$undef"
11083 fi
11084 ;;
11085 *) val="$d_attribute_nonnull" ;;
11086 esac
11087 set d_attribute_nonnull
11088 eval $setvar
11089 $rm -f attrib*
11090
11091 : Look for GCC-style attribute noreturn
11092 case "$d_attribute_noreturn" in
11093 '')
11094 echo " "
11095 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11096 $cat >attrib.c <<'EOCP'
11097 #include <stdio.h>
11098 void fall_over_dead( void ) __attribute__((noreturn));
11099 EOCP
11100 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11101         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11102                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11103                 val="$undef"
11104         else
11105                 echo "Your C compiler supports __attribute__((noreturn))."
11106                 val="$define"
11107         fi
11108 else
11109         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11110         val="$undef"
11111 fi
11112 ;;
11113 *) val="$d_attribute_noreturn" ;;
11114 esac
11115 set d_attribute_noreturn
11116 eval $setvar
11117 $rm -f attrib*
11118
11119 : Look for GCC-style attribute pure
11120 case "$d_attribute_pure" in
11121 '')
11122 echo " "
11123 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11124 $cat >attrib.c <<'EOCP'
11125 #include <stdio.h>
11126 int square( int n ) __attribute__((pure));
11127 EOCP
11128 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11129         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11130                 echo "Your C compiler doesn't support __attribute__((pure))."
11131                 val="$undef"
11132         else
11133                 echo "Your C compiler supports __attribute__((pure))."
11134                 val="$define"
11135         fi
11136 else
11137         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11138         val="$undef"
11139 fi
11140 ;;
11141 *) val="$d_attribute_pure" ;;
11142 esac
11143 set d_attribute_pure
11144 eval $setvar
11145 $rm -f attrib*
11146
11147 : Look for GCC-style attribute unused
11148 case "$d_attribute_unused" in
11149 '')
11150 echo " "
11151 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11152 $cat >attrib.c <<'EOCP'
11153 #include <stdio.h>
11154 int do_something( int dummy __attribute__((unused)), int n );
11155 EOCP
11156 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11157         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11158                 echo "Your C compiler doesn't support __attribute__((unused))."
11159                 val="$undef"
11160         else
11161                 echo "Your C compiler supports __attribute__((unused))."
11162                 val="$define"
11163         fi
11164 else
11165         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11166         val="$undef"
11167 fi
11168 ;;
11169 *) val="$d_attribute_unused" ;;
11170 esac
11171 set d_attribute_unused
11172 eval $setvar
11173 $rm -f attrib*
11174
11175 : Look for GCC-style attribute deprecated
11176 case "$d_attribute_deprecated" in
11177 '')
11178 echo " "
11179 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11180 $cat >attrib.c <<'EOCP'
11181 #include <stdio.h>
11182 int I_am_deprecated(void) __attribute__((deprecated));
11183 EOCP
11184 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11185         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11186                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11187                 val="$undef"
11188         else
11189                 echo "Your C compiler supports __attribute__((deprecated))."
11190                 val="$define"
11191         fi
11192 else
11193         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11194         val="$undef"
11195 fi
11196 ;;
11197 *) val="$d_attribute_deprecated" ;;
11198 esac
11199 set d_attribute_deprecated
11200 eval $setvar
11201 $rm -f attrib*
11202
11203 : Look for GCC-style attribute warn_unused_result
11204 case "$d_attribute_warn_unused_result" in
11205 '')
11206 echo " "
11207 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11208 $cat >attrib.c <<'EOCP'
11209 #include <stdio.h>
11210 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11211 EOCP
11212 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11213         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11214                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11215                 val="$undef"
11216         else
11217                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11218                 val="$define"
11219         fi
11220 else
11221         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11222         val="$undef"
11223 fi
11224 ;;
11225 *) val="$d_attribute_warn_unused_result" ;;
11226 esac
11227 set d_attribute_warn_unused_result
11228 eval $setvar
11229 $rm -f attrib*
11230
11231 : see if getpgrp exists
11232 set getpgrp d_getpgrp
11233 eval $inlibc
11234
11235 case "$d_getpgrp" in
11236 "$define")
11237         echo " "
11238         echo "Checking to see which flavor of getpgrp is in use..."
11239         $cat >try.c <<EOP
11240 #$i_unistd I_UNISTD
11241 #include <sys/types.h>
11242 #ifdef I_UNISTD
11243 #  include <unistd.h>
11244 #endif
11245 #$i_stdlib I_STDLIB
11246 #ifdef I_STDLIB
11247 #include <stdlib.h>
11248 #endif
11249 int main()
11250 {
11251         if (getuid() == 0) {
11252                 printf("(I see you are running Configure as super-user...)\n");
11253                 setuid(1);
11254         }
11255 #ifdef TRY_BSD_PGRP
11256         if (getpgrp(1) == 0)
11257                 exit(0);
11258 #else
11259         if (getpgrp() > 0)
11260                 exit(0);
11261 #endif
11262         exit(1);
11263 }
11264 EOP
11265         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11266                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11267                 val="$define"
11268         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11269                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11270                 val="$undef"
11271         else
11272                 echo "I can't seem to compile and run the test program."
11273                 if ./usg; then
11274                         xxx="a USG one, i.e. you use getpgrp()."
11275                 else
11276                         # SVR4 systems can appear rather BSD-ish.
11277                         case "$i_unistd" in
11278                         $undef)
11279                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11280                                 val="$define"
11281                                 ;;
11282                         $define)
11283                                 xxx="probably a USG one, i.e. you use getpgrp()."
11284                                 val="$undef"
11285                                 ;;
11286                         esac
11287                 fi
11288                 echo "Assuming your getpgrp is $xxx" >&4
11289         fi
11290         ;;
11291 *) val="$undef";;
11292 esac
11293 set d_bsdgetpgrp
11294 eval $setvar
11295 $rm_try
11296
11297 : see if setpgrp exists
11298 set setpgrp d_setpgrp
11299 eval $inlibc
11300
11301 case "$d_setpgrp" in
11302 "$define")
11303         echo " "
11304         echo "Checking to see which flavor of setpgrp is in use..."
11305         $cat >try.c <<EOP
11306 #$i_unistd I_UNISTD
11307 #include <sys/types.h>
11308 #ifdef I_UNISTD
11309 #  include <unistd.h>
11310 #endif
11311 #$i_stdlib I_STDLIB
11312 #ifdef I_STDLIB
11313 #include <stdlib.h>
11314 #endif
11315 int main()
11316 {
11317         if (getuid() == 0) {
11318                 printf("(I see you are running Configure as super-user...)\n");
11319                 setuid(1);
11320         }
11321 #ifdef TRY_BSD_PGRP
11322         if (-1 == setpgrp(1, 1))
11323                 exit(0);
11324 #else
11325         if (setpgrp() != -1)
11326                 exit(0);
11327 #endif
11328         exit(1);
11329 }
11330 EOP
11331         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11332                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11333                 val="$define"
11334         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11335                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11336                 val="$undef"
11337         else
11338                 echo "(I can't seem to compile and run the test program.)"
11339                 if ./usg; then
11340                         xxx="a USG one, i.e. you use setpgrp()."
11341                 else
11342                         # SVR4 systems can appear rather BSD-ish.
11343                         case "$i_unistd" in
11344                         $undef)
11345                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11346                                 val="$define"
11347                                 ;;
11348                         $define)
11349                                 xxx="probably a USG one, i.e. you use setpgrp()."
11350                                 val="$undef"
11351                                 ;;
11352                         esac
11353                 fi
11354                 echo "Assuming your setpgrp is $xxx" >&4
11355         fi
11356         ;;
11357 *) val="$undef";;
11358 esac
11359 set d_bsdsetpgrp
11360 eval $setvar
11361 $rm_try
11362
11363 : Look for GCC-style __builtin_add_overflow
11364 case "$d_builtin_add_overflow" in
11365 '')
11366     echo " "
11367     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11368     $cat >try.c <<'EOCP'
11369 int main(void) {
11370     const unsigned int uint_max = ~0u;
11371     int target_int = 0;
11372     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11373         return 1;
11374     }
11375     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11376         return 1;
11377     }
11378     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11379         return 1;
11380     }
11381     return 0;
11382 }
11383 EOCP
11384     set try
11385     if eval $compile && $run ./try; then
11386         echo "Your C compiler supports __builtin_add_overflow."
11387         val="$define"
11388     else
11389         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11390         val="$undef"
11391     fi
11392     ;;
11393 *) val="$d_builtin_add_overflow" ;;
11394 esac
11395
11396 set d_builtin_add_overflow
11397 eval $setvar
11398 $rm_try
11399
11400 : Look for GCC-style __builtin_sub_overflow
11401 case "$d_builtin_sub_overflow" in
11402 '')
11403     echo " "
11404     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11405     $cat >try.c <<'EOCP'
11406 int main(void) {
11407     const unsigned int uint_max = ~0u;
11408     int target_int = 0;
11409     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11410         return 1;
11411     }
11412     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11413         return 1;
11414     }
11415     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11416         return 1;
11417     }
11418     return 0;
11419 }
11420 EOCP
11421     set try
11422     if eval $compile && $run ./try; then
11423         echo "Your C compiler supports __builtin_sub_overflow."
11424         val="$define"
11425     else
11426         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11427         val="$undef"
11428     fi
11429     ;;
11430 *) val="$d_builtin_sub_overflow" ;;
11431 esac
11432
11433 set d_builtin_sub_overflow
11434 eval $setvar
11435 $rm_try
11436
11437 : Look for GCC-style __builtin_mul_overflow
11438 case "$d_builtin_mul_overflow" in
11439 '')
11440     echo " "
11441     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11442     $cat >try.c <<'EOCP'
11443 int main(void) {
11444     const unsigned int uint_max = ~0u;
11445     int target_int = 0;
11446     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11447         return 1;
11448     }
11449     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11450         return 1;
11451     }
11452     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11453         return 1;
11454     }
11455     return 0;
11456 }
11457 EOCP
11458     set try
11459     if eval $compile && $run ./try; then
11460         echo "Your C compiler supports __builtin_mul_overflow."
11461         val="$define"
11462     else
11463         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11464         val="$undef"
11465     fi
11466     ;;
11467 *) val="$d_builtin_mul_overflow" ;;
11468 esac
11469
11470 set d_builtin_mul_overflow
11471 eval $setvar
11472 $rm_try
11473
11474 : Look for GCC-style __builtin_choose_expr
11475 case "$d_builtin_choose_expr" in
11476 '')
11477     echo " "
11478     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11479     $cat >try.c <<'EOCP'
11480 #include <assert.h>
11481 #include <stdlib.h>
11482 #include <stdio.h>
11483
11484 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11485
11486 int main(void) {
11487     assert( SYRINX(1) == 2112 );
11488     assert( SYRINX(1) != 5150 );
11489     assert( SYRINX(0) == 5150 );
11490     assert( SYRINX(0) != 2112 );
11491     puts( "All good!" );
11492     exit(0);
11493 }
11494
11495 EOCP
11496     set try
11497     if eval $compile && $run ./try; then
11498         echo "Your C compiler supports __builtin_choose_expr."
11499         val="$define"
11500     else
11501         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11502         val="$undef"
11503     fi
11504 ;;
11505 *) val="$d_builtin_choose_expr" ;;
11506 esac
11507
11508 set d_builtin_choose_expr
11509 eval $setvar
11510 $rm_try
11511
11512 : Look for GCC-style __builtin_expect
11513 case "$d_builtin_expect" in
11514 '')
11515     echo " "
11516     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11517     $cat >try.c <<'EOCP'
11518 int main(void) {
11519     int n = 50;
11520     if ( __builtin_expect(n, 0) ) n = 1;
11521     /* Remember shell exit code truth is 0, C truth is non-zero */
11522     return !(n == 1);
11523 }
11524 EOCP
11525     set try
11526     if eval $compile && $run ./try; then
11527         echo "Your C compiler supports __builtin_expect."
11528         val="$define"
11529     else
11530         echo "Your C compiler doesn't seem to understand __builtin_expect."
11531         val="$undef"
11532     fi
11533     ;;
11534 *) val="$d_builtin_expect" ;;
11535 esac
11536
11537 set d_builtin_expect
11538 eval $setvar
11539 $rm_try
11540
11541 : see if the Compiler supports C99 variadic macros
11542 echo "Checking for C99 variadic macros." >&4
11543 $cat >try.c <<EOCP
11544 #include <stdio.h>
11545 #include <stdarg.h>
11546
11547 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11548
11549 int main() {
11550   char buf[20];
11551   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11552   puts(buf);
11553   return 0;
11554 }
11555 EOCP
11556 set try
11557 if eval $compile && $run ./try 2>&1 >/dev/null; then
11558     case "`$run ./try`" in
11559         "123 456 789")
11560         echo "You have C99 variadic macros." >&4
11561         d_c99_variadic_macros="$define"
11562         ;;
11563         *)
11564         echo "You don't have functional C99 variadic macros." >&4
11565         d_c99_variadic_macros="$undef"
11566         ;;
11567     esac
11568 else
11569     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11570     d_c99_variadic_macros="$undef"
11571 fi
11572 $rm_try
11573
11574 : see if signal is declared as pointer to function returning int or void
11575 echo " "
11576 xxx=`./findhdr signal.h`
11577 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11578 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11579         echo "You have int (*signal())() instead of void." >&4
11580         val="$undef"
11581 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11582         echo "You have void (*signal())()." >&4
11583         val="$define"
11584 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11585         echo "You have int (*signal())() instead of void." >&4
11586         val="$undef"
11587 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11588         echo "You have void (*signal())()." >&4
11589         val="$define"
11590 else
11591         case "$d_voidsig" in
11592         '')
11593         echo "I can't determine whether signal handler returns void or int..." >&4
11594                 dflt=void
11595                 rp="What type does your signal handler return?"
11596                 . ./myread
11597                 case "$ans" in
11598                 v*) val="$define";;
11599                 *) val="$undef";;
11600                 esac;;
11601         "$define")
11602                 echo "As you already told me, signal handler returns void." >&4
11603                 val="$define"
11604                 ;;
11605         *)      echo "As you already told me, signal handler returns int." >&4
11606                 val="$undef"
11607                 ;;
11608         esac
11609 fi
11610 set d_voidsig
11611 eval $setvar
11612 case "$d_voidsig" in
11613 "$define") signal_t="void";;
11614 *) signal_t="int";;
11615 esac
11616 $rm -f $$.tmp
11617
11618 : check for ability to cast large floats to 32-bit ints.
11619 echo " "
11620 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11621 if $test "$intsize" -ge 4; then
11622         xxx=int
11623 else
11624         xxx=long
11625 fi
11626 $cat >try.c <<EOCP
11627 #include <stdio.h>
11628 #$i_stdlib I_STDLIB
11629 #ifdef I_STDLIB
11630 #include <stdlib.h>
11631 #endif
11632 #include <sys/types.h>
11633 #include <signal.h>
11634 $signal_t blech(int s) { exit(3); }
11635 int main()
11636 {
11637         $xxx i32;
11638         double f, g;
11639         int result = 0;
11640         char str[16];
11641         signal(SIGFPE, blech);
11642
11643         /* Don't let compiler optimize the test away.  Store the number
11644            in a writable string for gcc to pass to sscanf under HP-UX.
11645         */
11646         sprintf(str, "2147483647");
11647         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11648         g = 10 * f;
11649         i32  = ($xxx) g;
11650
11651         /* x86 processors will probably give 0x8000 0000, which is a
11652            sign change.  We don't want that.  We want to mimic SPARC
11653            behavior here, which is to preserve the sign and give
11654            back 0x7fff ffff.
11655         */
11656         if (i32 != ($xxx) f)
11657                 result |= 1;
11658         exit(result);
11659 }
11660 EOCP
11661 set try
11662 if eval $compile_ok; then
11663         $run ./try 2>/dev/null
11664         yyy=$?
11665 else
11666         echo "(I can't seem to compile the test program--assuming it can't)"
11667         yyy=1
11668 fi
11669 case "$yyy" in
11670 0)      val="$define"
11671         echo "Yup, it can."
11672         ;;
11673 *)      val="$undef"
11674         echo "Nope, it can't."
11675         ;;
11676 esac
11677 set d_casti32
11678 eval $setvar
11679 $rm_try
11680
11681 : check for ability to cast negative floats to unsigned
11682 echo " "
11683 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11684 $cat >try.c <<EOCP
11685 #include <stdio.h>
11686 #$i_stdlib I_STDLIB
11687 #ifdef I_STDLIB
11688 #include <stdlib.h>
11689 #endif
11690 #include <sys/types.h>
11691 #include <signal.h>
11692 $signal_t blech(int s) { exit(7); }
11693 $signal_t blech_in_list(int s) { exit(4); }
11694 unsigned long dummy_long(unsigned long p) { return p; }
11695 unsigned int dummy_int(unsigned int p) { return p; }
11696 unsigned short dummy_short(unsigned short p) { return p; }
11697 int main()
11698 {
11699         double f;
11700         unsigned long along;
11701         unsigned int aint;
11702         unsigned short ashort;
11703         int result = 0;
11704         char str[16];
11705
11706         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11707            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11708            optimized the whole file away
11709         */
11710         /* Store the number in a writable string for gcc to pass to
11711            sscanf under HP-UX.
11712         */
11713         sprintf(str, "-123");
11714         sscanf(str, "%lf", &f);  /* f = -123.; */
11715
11716         signal(SIGFPE, blech);
11717         along = (unsigned long)f;
11718         aint = (unsigned int)f;
11719         ashort = (unsigned short)f;
11720         if (along != (unsigned long)-123)
11721                 result |= 1;
11722         if (aint != (unsigned int)-123)
11723                 result |= 1;
11724         if (ashort != (unsigned short)-123)
11725                 result |= 1;
11726         sprintf(str, "1073741824.");
11727         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11728         f = f + f;
11729         along = 0;
11730         along = (unsigned long)f;
11731         if (along != 0x80000000)
11732                 result |= 2;
11733         f -= 1.;
11734         along = 0;
11735         along = (unsigned long)f;
11736         if (along != 0x7fffffff)
11737                 result |= 1;
11738         f += 2.;
11739         along = 0;
11740         along = (unsigned long)f;
11741         if (along != 0x80000001)
11742                 result |= 2;
11743         if (result)
11744                 exit(result);
11745         signal(SIGFPE, blech_in_list);
11746         sprintf(str, "123.");
11747         sscanf(str, "%lf", &f);  /* f = 123.; */
11748         along = dummy_long((unsigned long)f);
11749         aint = dummy_int((unsigned int)f);
11750         ashort = dummy_short((unsigned short)f);
11751         if (along != (unsigned long)123)
11752                 result |= 4;
11753         if (aint != (unsigned int)123)
11754                 result |= 4;
11755         if (ashort != (unsigned short)123)
11756                 result |= 4;
11757         exit(result);
11758
11759 }
11760 EOCP
11761 set try
11762 if eval $compile_ok; then
11763         $run ./try 2>/dev/null
11764         castflags=$?
11765 else
11766         echo "(I can't seem to compile the test program--assuming it can't)"
11767         castflags=7
11768 fi
11769 case "$castflags" in
11770 0)      val="$define"
11771         echo "Yup, it can."
11772         ;;
11773 *)      val="$undef"
11774         echo "Nope, it can't."
11775         ;;
11776 esac
11777 set d_castneg
11778 eval $setvar
11779 $rm_try
11780
11781 : see if cbrt exists
11782 set cbrt d_cbrt
11783 eval $inlibc
11784
11785 : see if chown exists
11786 set chown d_chown
11787 eval $inlibc
11788
11789 : see if chroot exists
11790 set chroot d_chroot
11791 eval $inlibc
11792
11793 : see if chsize exists
11794 set chsize d_chsize
11795 eval $inlibc
11796
11797 : see if class exists
11798 set class d_class
11799 eval $inlibc
11800
11801 : see if clearenv exists
11802 set clearenv d_clearenv
11803 eval $inlibc
11804
11805 : Define hasstruct macro for Configure internal use
11806 hasstruct='varname=$1; struct=$2; shift; shift;
11807 while $test $# -ge 2; do
11808         case "$1" in
11809         $define) echo "#include <$2>";;
11810         esac ;
11811     shift 2;
11812 done > try.c;
11813 echo "int main () { struct $struct foo; }" >> try.c;
11814 set try;
11815 if eval $compile; then
11816         val="$define";
11817 else
11818         val="$undef";
11819 fi;
11820 set $varname;
11821 eval $setvar;
11822 $rm_try'
11823
11824 : see whether socket exists
11825 socketlib=''
11826 sockethdr=''
11827 echo " "
11828 $echo $n "Hmm... $c" >&4
11829 if set socket val -f d_socket; eval $csym; $val; then
11830     echo "Looks like you have Berkeley networking support." >&4
11831     d_socket="$define"
11832     if set setsockopt val -f; eval $csym; $val; then
11833         d_oldsock="$undef"
11834     else
11835         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11836         d_oldsock="$define"
11837     fi
11838 else
11839     if $contains socklib libc.list >/dev/null 2>&1; then
11840         echo "Looks like you have Berkeley networking support." >&4
11841         d_socket="$define"
11842         : we will have to assume that it supports the 4.2 BSD interface
11843         d_oldsock="$undef"
11844     else
11845         echo "You don't have Berkeley networking in libc$_a..." >&4
11846         if test "X$d_socket" = "X$define"; then
11847             echo "...but you seem to believe that you have sockets." >&4
11848         else
11849             for net in net socket
11850             do
11851                 if test -f $sysroot/usr/lib/lib$net$_a; then
11852                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11853                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11854                     if $contains socket libc.list >/dev/null 2>&1; then
11855                         d_socket="$define"
11856                         socketlib="-l$net"
11857                         case "$net" in
11858                         net)
11859                             echo "...but the Wollongong group seems to have hacked it in." >&4
11860                             sockethdr="-I$sysroot/usr/netinclude"
11861                             ;;
11862                         esac
11863                         echo "Found Berkeley sockets interface in lib$net." >&4
11864                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11865                             d_oldsock="$undef"
11866                         else
11867                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11868                             d_oldsock="$define"
11869                         fi
11870                         break
11871                     fi
11872                 fi
11873             done
11874             if test "X$d_socket" != "X$define"; then
11875                echo "or anywhere else I see." >&4
11876                d_socket="$undef"
11877                d_oldsock="$undef"
11878             fi
11879         fi
11880     fi
11881 fi
11882
11883 : see if socketpair exists
11884 set socketpair d_sockpair
11885 eval $inlibc
11886
11887
11888 echo " "
11889 echo "Checking the availability sa_len in the sock struct ..." >&4
11890 $cat >try.c <<EOF
11891 #include <sys/types.h>
11892 #include <sys/socket.h>
11893 int main() {
11894 struct sockaddr sa;
11895 return (sa.sa_len);
11896 }
11897 EOF
11898 val="$undef"
11899 set try; if eval $compile; then
11900     val="$define"
11901 fi
11902 set d_sockaddr_sa_len; eval $setvar
11903 $rm_try
11904
11905 echo " "
11906 echo "Checking the availability struct sockaddr_in6 ..." >&4
11907 $cat >try.c <<EOF
11908 #include <sys/types.h>
11909 #include <sys/socket.h>
11910 #include <netinet/in.h>
11911 int main() {
11912 struct sockaddr_in6 sin6;
11913 return (sin6.sin6_family);
11914 }
11915 EOF
11916 val="$undef"
11917 set try; if eval $compile; then
11918     val="$define"
11919 fi
11920 set d_sockaddr_in6; eval $setvar
11921 $rm_try
11922
11923 echo " "
11924 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11925 $cat >try.c <<EOF
11926 #include <sys/types.h>
11927 #include <sys/socket.h>
11928 #include <netinet/in.h>
11929 int main() {
11930 struct sockaddr_in6 sin6;
11931 return (sin6.sin6_scope_id);
11932 }
11933 EOF
11934 val="$undef"
11935 set try; if eval $compile; then
11936     val="$define"
11937 fi
11938 set d_sin6_scope_id; eval $setvar
11939 $rm_try
11940
11941 echo " "
11942 echo "Checking the availability struct ip_mreq ..." >&4
11943 $cat >try.c <<EOF
11944 #include <sys/types.h>
11945 #include <sys/socket.h>
11946 #include <netinet/in.h>
11947 int main() {
11948 struct ip_mreq mreq;
11949 return (mreq.imr_multiaddr.s_addr);
11950 }
11951 EOF
11952 val="$undef"
11953 set try; if eval $compile; then
11954        val="$define"
11955 fi
11956 set d_ip_mreq; eval $setvar
11957 $rm_try
11958
11959 echo " "
11960 echo "Checking the availability struct ip_mreq_source ..." >&4
11961 $cat >try.c <<EOF
11962 #include <sys/types.h>
11963 #include <sys/socket.h>
11964 #include <netinet/in.h>
11965 int main() {
11966 struct ip_mreq_source mreq;
11967 return (mreq.imr_multiaddr.s_addr);
11968 }
11969 EOF
11970 val="$undef"
11971 set try; if eval $compile; then
11972        val="$define"
11973 fi
11974 set d_ip_mreq_source; eval $setvar
11975 $rm_try
11976
11977 echo " "
11978 echo "Checking the availability struct ipv6_mreq ..." >&4
11979 $cat >try.c <<EOF
11980 #include <sys/types.h>
11981 #include <sys/socket.h>
11982 #include <netinet/in.h>
11983 int main() {
11984 struct ipv6_mreq mreq;
11985 return (mreq.ipv6mr_interface);
11986 }
11987 EOF
11988 val="$undef"
11989 set try; if eval $compile; then
11990     val="$define"
11991 fi
11992 set d_ipv6_mreq; eval $setvar
11993 $rm_try
11994
11995 echo " "
11996 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11997 $cat >try.c <<EOF
11998 #include <sys/types.h>
11999 #include <sys/socket.h>
12000 #include <netinet/in.h>
12001 int main() {
12002 struct ipv6_mreq_source mreq;
12003 return (mreq.imr_multiaddr.s_addr);
12004 }
12005 EOF
12006 val="$undef"
12007 set try; if eval $compile; then
12008        val="$define"
12009 fi
12010 set d_ipv6_mreq_source; eval $setvar
12011 $rm_try
12012
12013 echo " "
12014 echo "Checking the availability of certain socket constants..." >&4
12015 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12016     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12017     $cat >try.c <<EOF
12018 #include <sys/types.h>
12019 #include <sys/socket.h>
12020 int main() {
12021     int i = $ENUM;
12022 }
12023 EOF
12024     val="$undef"
12025     set try; if eval $compile; then
12026         val="$define"
12027     fi
12028     set d_${enum}; eval $setvar
12029     $rm_try
12030 done
12031
12032 : see if this is a sys/uio.h system
12033 set sys/uio.h i_sysuio
12034 eval $inhdr
12035
12036 : Check for cmsghdr support
12037 echo " "
12038 echo "Checking to see if your system supports struct cmsghdr..." >&4
12039 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12040 eval $hasstruct
12041 case "$d_cmsghdr_s" in
12042 "$define")      echo "Yes, it does."   ;;
12043 *)              echo "No, it doesn't." ;;
12044 esac
12045
12046 : check for const keyword
12047 echo " "
12048 echo 'Checking to see if your C compiler knows about "const"...' >&4
12049 $cat >const.c <<'EOCP'
12050 typedef struct spug { int drokk; } spug;
12051 int main()
12052 {
12053         const char *foo;
12054         const spug y = { 0 };
12055 }
12056 EOCP
12057 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12058         val="$define"
12059         echo "Yup, it does."
12060 else
12061         val="$undef"
12062         echo "Nope, it doesn't."
12063 fi
12064 set d_const
12065 eval $setvar
12066
12067 : see if copysign exists
12068 set copysign d_copysign
12069 eval $inlibc
12070
12071 : see if copysignl exists
12072 set copysignl d_copysignl
12073 eval $inlibc
12074
12075 : see if crypt exists
12076 echo " "
12077 set crypt d_crypt
12078 eval $inlibc
12079 case "$d_crypt" in
12080 $define) cryptlib='' ;;
12081 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12082                 echo 'crypt() found.' >&4
12083                 val="$define"
12084                 cryptlib=''
12085         else
12086                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12087                 if $test -z "$cryptlib"; then
12088                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12089                 else
12090                         cryptlib=-lcrypt
12091                 fi
12092                 if $test -z "$cryptlib"; then
12093                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12094                 else
12095                         cryptlib=-lcrypt
12096                 fi
12097                 if $test -z "$cryptlib"; then
12098                         cryptlib=`./loc libcrypt$_a "" $libpth`
12099                 else
12100                         cryptlib=-lcrypt
12101                 fi
12102                 if $test -z "$cryptlib"; then
12103                         echo 'crypt() NOT found.' >&4
12104                         val="$undef"
12105                 else
12106                         val="$define"
12107                 fi
12108         fi
12109         set d_crypt
12110         eval $setvar
12111         ;;
12112 esac
12113
12114 : see if this is a crypt.h system
12115 set crypt.h i_crypt
12116 eval $inhdr
12117
12118 : see if crypt_r exists
12119 set crypt_r d_crypt_r
12120 eval $inlibc
12121 case "$d_crypt_r" in
12122 "$define")
12123         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12124         case "$d_crypt_r_proto:$usethreads" in
12125         ":define")      d_crypt_r_proto=define
12126                 set d_crypt_r_proto crypt_r $hdrs
12127                 eval $hasproto ;;
12128         *)      ;;
12129         esac
12130         case "$d_crypt_r_proto" in
12131         define)
12132         case "$crypt_r_proto" in
12133         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12134         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12135         esac
12136         case "$crypt_r_proto" in
12137         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12138         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12139         esac
12140         case "$crypt_r_proto" in
12141         ''|0)   d_crypt_r=undef
12142                 crypt_r_proto=0
12143                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12144         * )     case "$crypt_r_proto" in
12145                 REENTRANT_PROTO*) ;;
12146                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12147                 esac
12148                 echo "Prototype: $try" ;;
12149         esac
12150         ;;
12151         *)      case "$usethreads" in
12152                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12153                 esac
12154                 d_crypt_r=undef
12155                 crypt_r_proto=0
12156                 ;;
12157         esac
12158         ;;
12159 *)      crypt_r_proto=0
12160         ;;
12161 esac
12162
12163 : get csh whereabouts
12164 case "$csh" in
12165 'csh') val="$undef" ;;
12166 *) val="$define" ;;
12167 esac
12168 set d_csh
12169 eval $setvar
12170 : Respect a hint or command line value for full_csh.
12171 case "$full_csh" in
12172 '') full_csh=$csh ;;
12173 esac
12174
12175 : see if ctermid exists
12176 set ctermid d_ctermid
12177 eval $inlibc
12178
12179 : see if ctermid_r exists
12180 set ctermid_r d_ctermid_r
12181 eval $inlibc
12182 case "$d_ctermid_r" in
12183 "$define")
12184         hdrs="$i_systypes sys/types.h define stdio.h "
12185         case "$d_ctermid_r_proto:$usethreads" in
12186         ":define")      d_ctermid_r_proto=define
12187                 set d_ctermid_r_proto ctermid_r $hdrs
12188                 eval $hasproto ;;
12189         *)      ;;
12190         esac
12191         case "$d_ctermid_r_proto" in
12192         define)
12193         case "$ctermid_r_proto" in
12194         ''|0) try='char* ctermid_r(char*);'
12195         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12196         esac
12197         case "$ctermid_r_proto" in
12198         ''|0)   d_ctermid_r=undef
12199                 ctermid_r_proto=0
12200                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12201         * )     case "$ctermid_r_proto" in
12202                 REENTRANT_PROTO*) ;;
12203                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12204                 esac
12205                 echo "Prototype: $try" ;;
12206         esac
12207         ;;
12208         *)      case "$usethreads" in
12209                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12210                 esac
12211                 d_ctermid_r=undef
12212                 ctermid_r_proto=0
12213                 ;;
12214         esac
12215         ;;
12216 *)      ctermid_r_proto=0
12217         ;;
12218 esac
12219
12220 : see if ctime_r exists
12221 set ctime_r d_ctime_r
12222 eval $inlibc
12223 case "$d_ctime_r" in
12224 "$define")
12225         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12226         case "$d_ctime_r_proto:$usethreads" in
12227         ":define")      d_ctime_r_proto=define
12228                 set d_ctime_r_proto ctime_r $hdrs
12229                 eval $hasproto ;;
12230         *)      ;;
12231         esac
12232         case "$d_ctime_r_proto" in
12233         define)
12234         case "$ctime_r_proto" in
12235         ''|0) try='char* ctime_r(const time_t*, char*);'
12236         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12237         esac
12238         case "$ctime_r_proto" in
12239         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12240         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12241         esac
12242         case "$ctime_r_proto" in
12243         ''|0) try='int ctime_r(const time_t*, char*);'
12244         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12245         esac
12246         case "$ctime_r_proto" in
12247         ''|0) try='int ctime_r(const time_t*, char*, int);'
12248         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12249         esac
12250         case "$ctime_r_proto" in
12251         ''|0)   d_ctime_r=undef
12252                 ctime_r_proto=0
12253                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12254         * )     case "$ctime_r_proto" in
12255                 REENTRANT_PROTO*) ;;
12256                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12257                 esac
12258                 echo "Prototype: $try" ;;
12259         esac
12260         ;;
12261         *)      case "$usethreads" in
12262                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12263                 esac
12264                 d_ctime_r=undef
12265                 ctime_r_proto=0
12266                 ;;
12267         esac
12268         ;;
12269 *)      ctime_r_proto=0
12270         ;;
12271 esac
12272
12273 : see if cuserid exists
12274 set cuserid d_cuserid
12275 eval $inlibc
12276
12277 : see if dbm.h is available
12278 : see if dbmclose exists
12279 set dbmclose d_dbmclose
12280 eval $inlibc
12281
12282 case "$d_dbmclose" in
12283 $define)
12284         set dbm.h i_dbm
12285         eval $inhdr
12286         case "$i_dbm" in
12287         $define)
12288                 val="$undef"
12289                 set i_rpcsvcdbm
12290                 eval $setvar
12291                 ;;
12292         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12293                 eval $inhdr
12294                 ;;
12295         esac
12296         ;;
12297 *)      echo "We won't be including <dbm.h>"
12298         val="$undef"
12299         set i_dbm
12300         eval $setvar
12301         val="$undef"
12302         set i_rpcsvcdbm
12303         eval $setvar
12304         ;;
12305 esac
12306
12307 : see if prototype for dbminit is available
12308 echo " "
12309 set d_dbminitproto dbminit $i_dbm dbm.h
12310 eval $hasproto
12311
12312 : see if difftime exists
12313 set difftime d_difftime
12314 eval $inlibc
12315
12316 : see if this is a dirent system
12317 echo " "
12318 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12319         val="$define"
12320         echo "<dirent.h> found." >&4
12321 else
12322         val="$undef"
12323         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12324                 echo "<sys/dir.h> found." >&4
12325                 echo " "
12326         else
12327                 xinc=`./findhdr sys/ndir.h`
12328         fi
12329         echo "<dirent.h> NOT found." >&4
12330 fi
12331 set i_dirent
12332 eval $setvar
12333
12334 : Look for type of directory structure.
12335 echo " "
12336 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12337
12338 case "$direntrytype" in
12339 ''|' ')
12340         case "$i_dirent" in
12341         $define) guess1='struct dirent' ;;
12342         *) guess1='struct direct'  ;;
12343         esac
12344         ;;
12345 *)      guess1="$direntrytype"
12346         ;;
12347 esac
12348
12349 case "$guess1" in
12350 'struct dirent') guess2='struct direct' ;;
12351 *) guess2='struct dirent' ;;
12352 esac
12353
12354 if $contains "$guess1" try.c >/dev/null 2>&1; then
12355         direntrytype="$guess1"
12356         echo "Your directory entries are $direntrytype." >&4
12357 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12358         direntrytype="$guess2"
12359         echo "Your directory entries seem to be $direntrytype." >&4
12360 else
12361         echo "I don't recognize your system's directory entries." >&4
12362         rp="What type is used for directory entries on this system?"
12363         dflt="$guess1"
12364         . ./myread
12365         direntrytype="$ans"
12366 fi
12367 $rm_try
12368
12369 : see if the directory entry stores field length
12370 echo " "
12371 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12372 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12373         echo "Good, your directory entry keeps length information in d_namlen." >&4
12374         val="$define"
12375 else
12376         echo "Your directory entry does not know about the d_namlen field." >&4
12377         val="$undef"
12378 fi
12379 set d_dirnamlen
12380 eval $setvar
12381 $rm_try
12382
12383 : Look for DIR.dd_fd
12384 case "$i_dirent" in
12385 "$define")
12386     echo "Checking to see if DIR has a dd_fd member variable" >&4
12387     $cat >try.c <<EOCP
12388 #$i_stdlib I_STDLIB
12389 #ifdef I_STDLIB
12390 #include <stdlib.h>
12391 #endif
12392 #include <dirent.h>
12393
12394 int main() {
12395     DIR dir;
12396     dir.dd_fd = 1;
12397     return 0;
12398 }
12399 EOCP
12400     val=$undef
12401     set try
12402     if eval $compile; then
12403         echo "Yes, it does."
12404         val="$define"
12405     else
12406         echo "No, it does not."
12407         val="$undef"
12408     fi
12409     ;;
12410 *)
12411     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12412     val="$undef"
12413     ;;
12414 esac
12415 set d_dir_dd_fd
12416 eval $setvar
12417 $rm_try
12418
12419 : see if this is an sysdir system
12420 set sys/dir.h i_sysdir
12421 eval $inhdr
12422
12423 : see if this is an sysndir system
12424 set sys/ndir.h i_sysndir
12425 eval $inhdr
12426
12427 : Look for dirfd
12428 echo " "
12429 $cat >dirfd.c <<EOM
12430 #include <stdio.h>
12431 #$i_stdlib I_STDLIB
12432 #ifdef I_STDLIB
12433 #include <stdlib.h>
12434 #endif
12435 #$i_dirent I_DIRENT             /**/
12436 #$i_sysdir I_SYS_DIR            /**/
12437 #$i_sysndir I_SYS_NDIR          /**/
12438 #$i_systypes I_SYS_TYPES        /**/
12439 #if defined(I_SYS_TYPES)
12440 #include <sys/types.h>
12441 #endif
12442 #if defined(I_DIRENT)
12443 #include <dirent.h>
12444 #else
12445 #ifdef I_SYS_NDIR
12446 #include <sys/ndir.h>
12447 #else
12448 #ifdef I_SYS_DIR
12449 #include <sys/dir.h>
12450 #endif
12451 #endif
12452 #endif
12453 int main() {
12454         DIR *dirp = opendir(".");
12455         if (dirfd(dirp) >= 0)
12456                 exit(0);
12457         else
12458                 exit(1);
12459 }
12460 EOM
12461 val=$undef
12462 set dirfd
12463 if eval $compile; then
12464         val="$define"
12465 fi
12466 case "$val" in
12467 $define)        echo "dirfd() found." >&4       ;;
12468 *)              echo "dirfd() NOT found." >&4   ;;
12469 esac
12470 set d_dirfd
12471 eval $setvar
12472 $rm -f dirfd*
12473
12474 : see if dladdr exists
12475 set dladdr d_dladdr
12476 eval $inlibc
12477
12478 : see if dlerror exists
12479 xxx_runnm="$runnm"
12480 runnm=false
12481 set dlerror d_dlerror
12482 eval $inlibc
12483 runnm="$xxx_runnm"
12484
12485 : see if dlfcn is available
12486 set dlfcn.h i_dlfcn
12487 eval $inhdr
12488
12489 : Check what extension to use for shared libs
12490 case "$usedl" in
12491 $define|y|true)
12492         $cat << EOM
12493
12494 On a few systems, the dynamically loaded modules that perl generates and uses
12495 will need a different extension than shared libs. The default will probably
12496 be appropriate.
12497
12498 EOM
12499         case "$dlext" in
12500         '')     dflt="$so" ;;
12501         *)      dflt="$dlext" ;;
12502         esac
12503         rp='What is the extension of dynamically loaded modules'
12504         . ./myread
12505         dlext="$ans"
12506         ;;
12507 *)
12508         dlext="none"
12509         ;;
12510 esac
12511
12512 : Check if dlsym need a leading underscore
12513 echo " "
12514 val="$undef"
12515
12516 case "$dlsrc" in
12517 dl_dlopen.xs)
12518         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12519         $cat >dyna.c <<'EOM'
12520 fred () { }
12521 EOM
12522
12523 $cat >fred.c<<EOM
12524
12525 #include <stdio.h>
12526 #$i_stdlib I_STDLIB
12527 #ifdef I_STDLIB
12528 #include <stdlib.h>
12529 #endif
12530 #$i_dlfcn I_DLFCN
12531 #ifdef I_DLFCN
12532 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12533 #else
12534 #include <sys/types.h>
12535 #include <nlist.h>
12536 #include <link.h>
12537 #endif
12538
12539 extern int fred() ;
12540
12541 int main()
12542 {
12543     void * handle ;
12544     void * symbol ;
12545 #ifndef RTLD_LAZY
12546     int mode = 1 ;
12547 #else
12548     int mode = RTLD_LAZY ;
12549 #endif
12550     handle = dlopen("./dyna.$dlext", mode) ;
12551     if (handle == NULL) {
12552         printf ("1\n") ;
12553         fflush (stdout) ;
12554         exit(0);
12555     }
12556     symbol = dlsym(handle, "fred") ;
12557     if (symbol == NULL) {
12558         /* try putting a leading underscore */
12559         symbol = dlsym(handle, "_fred") ;
12560         if (symbol == NULL) {
12561             printf ("2\n") ;
12562             fflush (stdout) ;
12563             exit(0);
12564         }
12565         printf ("3\n") ;
12566     }
12567     else
12568         printf ("4\n") ;
12569     fflush (stdout) ;
12570     exit(0);
12571 }
12572 EOM
12573         : Call the object file tmp-dyna.o in case dlext=o.
12574         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12575                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12576                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12577                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12578                 xxx=`$run ./fred`
12579                 case $xxx in
12580                 1)      echo "Test program failed using dlopen." >&4
12581                         echo "Perhaps you should not use dynamic loading." >&4;;
12582                 2)      echo "Test program failed using dlsym." >&4
12583                         echo "Perhaps you should not use dynamic loading." >&4;;
12584                 3)      echo "dlsym needs a leading underscore" >&4
12585                         val="$define" ;;
12586                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12587                 esac
12588         else
12589                 echo "I can't compile and run the test program." >&4
12590                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12591         fi
12592         ;;
12593 esac
12594
12595 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12596
12597 set d_dlsymun
12598 eval $setvar
12599
12600 : see if drand48_r exists
12601 set drand48_r d_drand48_r
12602 eval $inlibc
12603 case "$d_drand48_r" in
12604 "$define")
12605         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12606         case "$d_drand48_r_proto:$usethreads" in
12607         ":define")      d_drand48_r_proto=define
12608                 set d_drand48_r_proto drand48_r $hdrs
12609                 eval $hasproto ;;
12610         *)      ;;
12611         esac
12612         case "$d_drand48_r_proto" in
12613         define)
12614         case "$drand48_r_proto" in
12615         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12616         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12617         esac
12618         case "$drand48_r_proto" in
12619         ''|0)   d_drand48_r=undef
12620                 drand48_r_proto=0
12621                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12622         * )     case "$drand48_r_proto" in
12623                 REENTRANT_PROTO*) ;;
12624                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12625                 esac
12626                 echo "Prototype: $try" ;;
12627         esac
12628         ;;
12629         *)      case "$usethreads" in
12630                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12631                 esac
12632                 d_drand48_r=undef
12633                 drand48_r_proto=0
12634                 ;;
12635         esac
12636         ;;
12637 *)      drand48_r_proto=0
12638         ;;
12639 esac
12640
12641 : see if prototype for drand48 is available
12642 echo " "
12643 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12644 eval $hasproto
12645
12646 : see if dup2 exists
12647 set dup2 d_dup2
12648 eval $inlibc
12649
12650 : see if dup3 exists
12651 set dup3 d_dup3
12652 eval $inlibc
12653
12654 : see if eaccess exists
12655 set eaccess d_eaccess
12656 eval $inlibc
12657
12658 : see if endgrent exists
12659 set endgrent d_endgrent
12660 eval $inlibc
12661
12662 : see if this is an grp system
12663 set grp.h i_grp
12664 eval $inhdr
12665
12666 case "$i_grp" in
12667 $define)
12668         xxx=`./findhdr grp.h`
12669         $cppstdin $cppflags $cppminus < $xxx >$$.h
12670
12671         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12672                 val="$define"
12673         else
12674                 val="$undef"
12675         fi
12676         set d_grpasswd
12677         eval $setvar
12678
12679         $rm -f $$.h
12680         ;;
12681 *)
12682         val="$undef";
12683         set d_grpasswd; eval $setvar
12684         ;;
12685 esac
12686
12687 : see if endgrent_r exists
12688 set endgrent_r d_endgrent_r
12689 eval $inlibc
12690 case "$d_endgrent_r" in
12691 "$define")
12692         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12693         case "$d_endgrent_r_proto:$usethreads" in
12694         ":define")      d_endgrent_r_proto=define
12695                 set d_endgrent_r_proto endgrent_r $hdrs
12696                 eval $hasproto ;;
12697         *)      ;;
12698         esac
12699         case "$d_endgrent_r_proto" in
12700         define)
12701         case "$endgrent_r_proto" in
12702         ''|0) try='int endgrent_r(FILE**);'
12703         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12704         esac
12705         case "$endgrent_r_proto" in
12706         ''|0) try='void endgrent_r(FILE**);'
12707         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12708         esac
12709         case "$endgrent_r_proto" in
12710         ''|0)   d_endgrent_r=undef
12711                 endgrent_r_proto=0
12712                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12713         * )     case "$endgrent_r_proto" in
12714                 REENTRANT_PROTO*) ;;
12715                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12716                 esac
12717                 echo "Prototype: $try" ;;
12718         esac
12719         ;;
12720         *)      case "$usethreads" in
12721                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12722                 esac
12723                 d_endgrent_r=undef
12724                 endgrent_r_proto=0
12725                 ;;
12726         esac
12727         ;;
12728 *)      endgrent_r_proto=0
12729         ;;
12730 esac
12731
12732 : see if endhostent exists
12733 set endhostent d_endhent
12734 eval $inlibc
12735
12736 : see if this is a netdb.h system
12737 set netdb.h i_netdb
12738 eval $inhdr
12739
12740 : see if endhostent_r exists
12741 set endhostent_r d_endhostent_r
12742 eval $inlibc
12743 case "$d_endhostent_r" in
12744 "$define")
12745         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12746         case "$d_endhostent_r_proto:$usethreads" in
12747         ":define")      d_endhostent_r_proto=define
12748                 set d_endhostent_r_proto endhostent_r $hdrs
12749                 eval $hasproto ;;
12750         *)      ;;
12751         esac
12752         case "$d_endhostent_r_proto" in
12753         define)
12754         case "$endhostent_r_proto" in
12755         ''|0) try='int endhostent_r(struct hostent_data*);'
12756         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12757         esac
12758         case "$endhostent_r_proto" in
12759         ''|0) try='void endhostent_r(struct hostent_data*);'
12760         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12761         esac
12762         case "$endhostent_r_proto" in
12763         ''|0)   d_endhostent_r=undef
12764                 endhostent_r_proto=0
12765                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12766         * )     case "$endhostent_r_proto" in
12767                 REENTRANT_PROTO*) ;;
12768                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12769                 esac
12770                 echo "Prototype: $try" ;;
12771         esac
12772         ;;
12773         *)      case "$usethreads" in
12774                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12775                 esac
12776                 d_endhostent_r=undef
12777                 endhostent_r_proto=0
12778                 ;;
12779         esac
12780         ;;
12781 *)      endhostent_r_proto=0
12782         ;;
12783 esac
12784
12785 : see if endnetent exists
12786 set endnetent d_endnent
12787 eval $inlibc
12788
12789 : see if endnetent_r exists
12790 set endnetent_r d_endnetent_r
12791 eval $inlibc
12792 case "$d_endnetent_r" in
12793 "$define")
12794         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12795         case "$d_endnetent_r_proto:$usethreads" in
12796         ":define")      d_endnetent_r_proto=define
12797                 set d_endnetent_r_proto endnetent_r $hdrs
12798                 eval $hasproto ;;
12799         *)      ;;
12800         esac
12801         case "$d_endnetent_r_proto" in
12802         define)
12803         case "$endnetent_r_proto" in
12804         ''|0) try='int endnetent_r(struct netent_data*);'
12805         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12806         esac
12807         case "$endnetent_r_proto" in
12808         ''|0) try='void endnetent_r(struct netent_data*);'
12809         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12810         esac
12811         case "$endnetent_r_proto" in
12812         ''|0)   d_endnetent_r=undef
12813                 endnetent_r_proto=0
12814                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12815         * )     case "$endnetent_r_proto" in
12816                 REENTRANT_PROTO*) ;;
12817                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12818                 esac
12819                 echo "Prototype: $try" ;;
12820         esac
12821         ;;
12822         *)      case "$usethreads" in
12823                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12824                 esac
12825                 d_endnetent_r=undef
12826                 endnetent_r_proto=0
12827                 ;;
12828         esac
12829         ;;
12830 *)      endnetent_r_proto=0
12831         ;;
12832 esac
12833
12834 : see if endprotoent exists
12835 set endprotoent d_endpent
12836 eval $inlibc
12837
12838 : see if endprotoent_r exists
12839 set endprotoent_r d_endprotoent_r
12840 eval $inlibc
12841 case "$d_endprotoent_r" in
12842 "$define")
12843         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12844         case "$d_endprotoent_r_proto:$usethreads" in
12845         ":define")      d_endprotoent_r_proto=define
12846                 set d_endprotoent_r_proto endprotoent_r $hdrs
12847                 eval $hasproto ;;
12848         *)      ;;
12849         esac
12850         case "$d_endprotoent_r_proto" in
12851         define)
12852         case "$endprotoent_r_proto" in
12853         ''|0) try='int endprotoent_r(struct protoent_data*);'
12854         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12855         esac
12856         case "$endprotoent_r_proto" in
12857         ''|0) try='void endprotoent_r(struct protoent_data*);'
12858         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12859         esac
12860         case "$endprotoent_r_proto" in
12861         ''|0)   d_endprotoent_r=undef
12862                 endprotoent_r_proto=0
12863                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12864         * )     case "$endprotoent_r_proto" in
12865                 REENTRANT_PROTO*) ;;
12866                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12867                 esac
12868                 echo "Prototype: $try" ;;
12869         esac
12870         ;;
12871         *)      case "$usethreads" in
12872                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12873                 esac
12874                 d_endprotoent_r=undef
12875                 endprotoent_r_proto=0
12876                 ;;
12877         esac
12878         ;;
12879 *)      endprotoent_r_proto=0
12880         ;;
12881 esac
12882
12883 : see if endpwent exists
12884 set endpwent d_endpwent
12885 eval $inlibc
12886
12887 : see if this is a pwd.h system
12888 set pwd.h i_pwd
12889 eval $inhdr
12890
12891 case "$i_pwd" in
12892 $define)
12893         xxx=`./findhdr pwd.h`
12894         $cppstdin $cppflags $cppminus < $xxx >$$.h
12895
12896         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12897                 val="$define"
12898         else
12899                 val="$undef"
12900         fi
12901         set d_pwquota
12902         eval $setvar
12903
12904         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12905                 val="$define"
12906         else
12907                 val="$undef"
12908         fi
12909         set d_pwage
12910         eval $setvar
12911
12912         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12913                 val="$define"
12914         else
12915                 val="$undef"
12916         fi
12917         set d_pwchange
12918         eval $setvar
12919
12920         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12921                 val="$define"
12922         else
12923                 val="$undef"
12924         fi
12925         set d_pwclass
12926         eval $setvar
12927
12928         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12929                 val="$define"
12930         else
12931                 val="$undef"
12932         fi
12933         set d_pwexpire
12934         eval $setvar
12935
12936         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12937                 val="$define"
12938         else
12939                 val="$undef"
12940         fi
12941         set d_pwcomment
12942         eval $setvar
12943
12944         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12945                 val="$define"
12946         else
12947                 val="$undef"
12948         fi
12949         set d_pwgecos
12950         eval $setvar
12951
12952         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12953                 val="$define"
12954         else
12955                 val="$undef"
12956         fi
12957         set d_pwpasswd
12958         eval $setvar
12959
12960         $rm -f $$.h
12961         ;;
12962 *)
12963         val="$undef";
12964         set d_pwquota; eval $setvar
12965         set d_pwage; eval $setvar
12966         set d_pwchange; eval $setvar
12967         set d_pwclass; eval $setvar
12968         set d_pwexpire; eval $setvar
12969         set d_pwcomment; eval $setvar
12970         set d_pwgecos; eval $setvar
12971         set d_pwpasswd; eval $setvar
12972         ;;
12973 esac
12974
12975 : see if endpwent_r exists
12976 set endpwent_r d_endpwent_r
12977 eval $inlibc
12978 case "$d_endpwent_r" in
12979 "$define")
12980         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12981         case "$d_endpwent_r_proto:$usethreads" in
12982         ":define")      d_endpwent_r_proto=define
12983                 set d_endpwent_r_proto endpwent_r $hdrs
12984                 eval $hasproto ;;
12985         *)      ;;
12986         esac
12987         case "$d_endpwent_r_proto" in
12988         define)
12989         case "$endpwent_r_proto" in
12990         ''|0) try='int endpwent_r(FILE**);'
12991         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12992         esac
12993         case "$endpwent_r_proto" in
12994         ''|0) try='void endpwent_r(FILE**);'
12995         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12996         esac
12997         case "$endpwent_r_proto" in
12998         ''|0)   d_endpwent_r=undef
12999                 endpwent_r_proto=0
13000                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13001         * )     case "$endpwent_r_proto" in
13002                 REENTRANT_PROTO*) ;;
13003                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13004                 esac
13005                 echo "Prototype: $try" ;;
13006         esac
13007         ;;
13008         *)      case "$usethreads" in
13009                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13010                 esac
13011                 d_endpwent_r=undef
13012                 endpwent_r_proto=0
13013                 ;;
13014         esac
13015         ;;
13016 *)      endpwent_r_proto=0
13017         ;;
13018 esac
13019
13020 : see if endservent exists
13021 set endservent d_endsent
13022 eval $inlibc
13023
13024 : see if endservent_r exists
13025 set endservent_r d_endservent_r
13026 eval $inlibc
13027 case "$d_endservent_r" in
13028 "$define")
13029         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13030         case "$d_endservent_r_proto:$usethreads" in
13031         ":define")      d_endservent_r_proto=define
13032                 set d_endservent_r_proto endservent_r $hdrs
13033                 eval $hasproto ;;
13034         *)      ;;
13035         esac
13036         case "$d_endservent_r_proto" in
13037         define)
13038         case "$endservent_r_proto" in
13039         ''|0) try='int endservent_r(struct servent_data*);'
13040         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13041         esac
13042         case "$endservent_r_proto" in
13043         ''|0) try='void endservent_r(struct servent_data*);'
13044         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13045         esac
13046         case "$endservent_r_proto" in
13047         ''|0)   d_endservent_r=undef
13048                 endservent_r_proto=0
13049                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13050         * )     case "$endservent_r_proto" in
13051                 REENTRANT_PROTO*) ;;
13052                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13053                 esac
13054                 echo "Prototype: $try" ;;
13055         esac
13056         ;;
13057         *)      case "$usethreads" in
13058                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13059                 esac
13060                 d_endservent_r=undef
13061                 endservent_r_proto=0
13062                 ;;
13063         esac
13064         ;;
13065 *)      endservent_r_proto=0
13066         ;;
13067 esac
13068
13069 : Locate the flags for 'open()'
13070 echo " "
13071 $cat >try.c <<EOCP
13072 #include <sys/types.h>
13073 #ifdef I_FCNTL
13074 #include <fcntl.h>
13075 #endif
13076 #ifdef I_SYS_FILE
13077 #include <sys/file.h>
13078 #endif
13079 #$i_stdlib I_STDLIB
13080 #ifdef I_STDLIB
13081 #include <stdlib.h>
13082 #endif
13083 int main() {
13084         if(O_RDONLY);
13085 #ifdef O_TRUNC
13086         exit(0);
13087 #else
13088         exit(1);
13089 #endif
13090 }
13091 EOCP
13092 : check sys/file.h first to get FREAD on Sun
13093 if $test `./findhdr sys/file.h` && \
13094                 set try -DI_SYS_FILE && eval $compile; then
13095         h_sysfile=true;
13096         echo "<sys/file.h> defines the O_* constants..." >&4
13097         if $run ./try; then
13098                 echo "and you have the 3 argument form of open()." >&4
13099                 val="$define"
13100         else
13101                 echo "but not the 3 argument form of open().  Oh, well." >&4
13102                 val="$undef"
13103         fi
13104 elif $test `./findhdr fcntl.h` && \
13105                 set try -DI_FCNTL && eval $compile; then
13106         h_fcntl=true;
13107         echo "<fcntl.h> defines the O_* constants..." >&4
13108         if $run ./try; then
13109                 echo "and you have the 3 argument form of open()." >&4
13110                 val="$define"
13111         else
13112                 echo "but not the 3 argument form of open().  Oh, well." >&4
13113                 val="$undef"
13114         fi
13115 else
13116         val="$undef"
13117         echo "I can't find the O_* constant definitions!  You got problems." >&4
13118 fi
13119 set d_open3
13120 eval $setvar
13121 $rm_try
13122
13123 : see if this is a sys/file.h system
13124 val=''
13125 set sys/file.h val
13126 eval $inhdr
13127
13128 : do we need to include sys/file.h ?
13129 case "$val" in
13130 "$define")
13131         echo " "
13132         if $h_sysfile; then
13133                 val="$define"
13134                 echo "We'll be including <sys/file.h>." >&4
13135         else
13136                 val="$undef"
13137                 echo "We won't be including <sys/file.h>." >&4
13138         fi
13139         ;;
13140 *)
13141         h_sysfile=false
13142         ;;
13143 esac
13144 set i_sysfile
13145 eval $setvar
13146
13147 : see if fcntl.h is there
13148 val=''
13149 set fcntl.h val
13150 eval $inhdr
13151
13152 : see if we can include fcntl.h
13153 case "$val" in
13154 "$define")
13155         echo " "
13156         if $h_fcntl; then
13157                 val="$define"
13158                 echo "We'll be including <fcntl.h>." >&4
13159         else
13160                 val="$undef"
13161                 if $h_sysfile; then
13162         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13163                 else
13164                         echo "We won't be including <fcntl.h>." >&4
13165                 fi
13166         fi
13167         ;;
13168 *)
13169         h_fcntl=false
13170         val="$undef"
13171         ;;
13172 esac
13173 set i_fcntl
13174 eval $setvar
13175
13176 : see if fork exists
13177 set fork d_fork
13178 eval $inlibc
13179
13180 : see if pipe exists
13181 set pipe d_pipe
13182 eval $inlibc
13183
13184 : check for non-blocking I/O stuff
13185 case "$h_sysfile" in
13186 true) echo "#include <sys/file.h>" > head.c;;
13187 *)
13188        case "$h_fcntl" in
13189        true) echo "#include <fcntl.h>" > head.c;;
13190        *) echo "#include <sys/fcntl.h>" > head.c;;
13191        esac
13192        ;;
13193 esac
13194 echo " "
13195 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13196 case "$o_nonblock" in
13197 '')
13198         $cat head.c > try.c
13199         $cat >>try.c <<EOCP
13200 #include <stdio.h>
13201 #$i_stdlib I_STDLIB
13202 #ifdef I_STDLIB
13203 #include <stdlib.h>
13204 #endif
13205 #$i_fcntl I_FCNTL
13206 #ifdef I_FCNTL
13207 #include <fcntl.h>
13208 #endif
13209 int main() {
13210 #ifdef O_NONBLOCK
13211         printf("O_NONBLOCK\n");
13212         exit(0);
13213 #endif
13214 #ifdef O_NDELAY
13215         printf("O_NDELAY\n");
13216         exit(0);
13217 #endif
13218 #ifdef FNDELAY
13219         printf("FNDELAY\n");
13220         exit(0);
13221 #endif
13222         exit(0);
13223 }
13224 EOCP
13225         set try
13226         if eval $compile_ok; then
13227                 o_nonblock=`$run ./try`
13228                 case "$o_nonblock" in
13229                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13230                 *) echo "Seems like we can use $o_nonblock.";;
13231                 esac
13232         else
13233                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13234         fi
13235         ;;
13236 *) echo "Using $hint value $o_nonblock.";;
13237 esac
13238 $rm_try
13239
13240 echo " "
13241 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13242 case "$eagain" in
13243 '')
13244         case "$d_fork:$d_pipe:$d_alarm" in
13245         define:define:define)
13246         $cat head.c > try.c
13247         $cat >>try.c <<EOCP
13248 #include <errno.h>
13249 #include <sys/types.h>
13250 #include <signal.h>
13251 #include <stdio.h>
13252 #$i_stdlib I_STDLIB
13253 #ifdef I_STDLIB
13254 #include <stdlib.h>
13255 #endif
13256 #$i_fcntl I_FCNTL
13257 #ifdef I_FCNTL
13258 #include <fcntl.h>
13259 #endif
13260 #define MY_O_NONBLOCK $o_nonblock
13261 #ifndef errno  /* XXX need better Configure test */
13262 extern int errno;
13263 #endif
13264 #$i_unistd I_UNISTD
13265 #ifdef I_UNISTD
13266 #include <unistd.h>
13267 #endif
13268 #include <string.h>
13269 $signal_t blech(int x) { exit(3); }
13270 EOCP
13271         $cat >> try.c <<'EOCP'
13272 int main()
13273 {
13274         int pd[2];
13275         int pu[2];
13276         char buf[1];
13277         char string[100];
13278         int ret;
13279
13280         ret = pipe(pd); /* Down: child -> parent */
13281         if (ret != 0)
13282                 exit(3);
13283         ret = pipe(pu); /* Up: parent -> child */
13284         if (ret != 0)
13285                 exit(3);
13286         if (0 != fork()) {
13287                 close(pd[1]);   /* Parent reads from pd[0] */
13288                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13289 #ifdef F_SETFL
13290                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13291                         exit(1);
13292 #else
13293                 exit(4);
13294 #endif
13295                 signal(SIGALRM, blech);
13296                 alarm(5);
13297                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13298                         exit(2);
13299                 sprintf(string, "%d\n", ret);
13300                 ret = write(2, string, strlen(string));
13301                 if (ret != strlen(string))
13302                         exit(3);
13303                 alarm(0);
13304 #ifdef EAGAIN
13305                 if (errno == EAGAIN) {
13306                         printf("EAGAIN\n");
13307                         goto ok;
13308                 }
13309 #endif
13310 #ifdef EWOULDBLOCK
13311                 if (errno == EWOULDBLOCK)
13312                         printf("EWOULDBLOCK\n");
13313 #endif
13314         ok:
13315                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13316                 if (ret != 1)
13317                         exit(3);
13318                 sleep(2);                               /* Give it time to close our pipe */
13319                 alarm(5);
13320                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13321                 alarm(0);
13322                 sprintf(string, "%d\n", ret);
13323                 ret = write(4, string, strlen(string));
13324                 if (ret != strlen(string))
13325                         exit(3);
13326                 exit(0);
13327         }
13328
13329         close(pd[0]);                   /* We write to pd[1] */
13330         close(pu[1]);                   /* We read from pu[0] */
13331         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13332         if (ret != 1)
13333                 exit(3);
13334         close(pd[1]);                   /* Pipe pd is now fully closed! */
13335         exit(0);                                /* Bye bye, thank you for playing! */
13336 }
13337 EOCP
13338         set try
13339         if eval $compile_ok; then
13340                 echo "$startsh" >mtry
13341                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13342                 chmod +x mtry
13343                 $run ./mtry >/dev/null 2>&1
13344                 case $? in
13345                 0) eagain=`$cat try.out`;;
13346                 1) echo "Could not perform non-blocking setting!";;
13347                 2) echo "I did a successful read() for something that was not there!";;
13348                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13349                 4) echo "Could not find F_SETFL!";;
13350                 *) echo "Something terribly wrong happened during testing.";;
13351                 esac
13352                 rd_nodata=`$cat try.ret`
13353                 echo "A read() system call with no data present returns $rd_nodata."
13354                 case "$rd_nodata" in
13355                 0|-1) ;;
13356                 *)
13357                         echo "(That's peculiar, fixing that to be -1.)"
13358                         rd_nodata=-1
13359                         ;;
13360                 esac
13361                 case "$eagain" in
13362                 '')
13363                         echo "Forcing errno EAGAIN on read() with no data available."
13364                         eagain=EAGAIN
13365                         ;;
13366                 *)
13367                         echo "Your read() sets errno to $eagain when no data is available."
13368                         ;;
13369                 esac
13370                 status=`$cat try.err`
13371                 case "$status" in
13372                 0) echo "And it correctly returns 0 to signal EOF.";;
13373                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13374                 *) echo "However, your read() returns '$status' on EOF??";;
13375                 esac
13376                 val="$define"
13377                 if test "$status" = "$rd_nodata"; then
13378                         echo "WARNING: you can't distinguish between EOF and no data!"
13379                         val="$undef"
13380                 fi
13381         else
13382                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13383                 eagain=EAGAIN
13384         fi
13385         ;;
13386         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13387                 eagain=EAGAIN
13388                 val="$define"
13389                 ;;
13390         esac
13391         set d_eofnblk
13392         eval $setvar
13393         ;;
13394 *)
13395         echo "Using $hint value $eagain."
13396         echo "Your read() returns $rd_nodata when no data is present."
13397         case "$d_eofnblk" in
13398         "$define") echo "And you can see EOF because read() returns 0.";;
13399         "$undef") echo "But you can't see EOF status from read() returned value.";;
13400         *)
13401                 echo "(Assuming you can't see EOF status from read anyway.)"
13402                 d_eofnblk=$undef
13403                 ;;
13404         esac
13405         ;;
13406 esac
13407 $rm_try head.c mtry
13408
13409 : see if erf exists
13410 set erf d_erf
13411 eval $inlibc
13412
13413 : see if erfc exists
13414 set erfc d_erfc
13415 eval $inlibc
13416
13417 : see if exp2 exists
13418 set exp2 d_exp2
13419 eval $inlibc
13420
13421 : see if expm1 exists
13422 set expm1 d_expm1
13423 eval $inlibc
13424
13425 : see if _ptr and _cnt from stdio act std
13426 echo " "
13427
13428 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13429         echo "(Looks like you have stdio.h from BSD.)"
13430         case "$stdio_ptr" in
13431         '') stdio_ptr='((fp)->_p)'
13432                 ptr_lval=$define
13433                 ;;
13434         *)      ptr_lval=$d_stdio_ptr_lval;;
13435         esac
13436         case "$stdio_cnt" in
13437         '') stdio_cnt='((fp)->_r)'
13438                 cnt_lval=$define
13439                 ;;
13440         *)      cnt_lval=$d_stdio_cnt_lval;;
13441         esac
13442         case "$stdio_base" in
13443         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13444         esac
13445         case "$stdio_bufsiz" in
13446         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13447         esac
13448 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13449         echo "(Looks like you have stdio.h from Linux.)"
13450         case "$stdio_ptr" in
13451         '') stdio_ptr='((fp)->_IO_read_ptr)'
13452                 ptr_lval=$define
13453                 ;;
13454         *)      ptr_lval=$d_stdio_ptr_lval;;
13455         esac
13456         case "$stdio_cnt" in
13457         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13458                 cnt_lval=$undef
13459                 ;;
13460         *)      cnt_lval=$d_stdio_cnt_lval;;
13461         esac
13462         case "$stdio_base" in
13463         '') stdio_base='((fp)->_IO_read_base)';;
13464         esac
13465         case "$stdio_bufsiz" in
13466         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13467         esac
13468 else
13469         case "$stdio_ptr" in
13470         '') stdio_ptr='((fp)->_ptr)'
13471                 ptr_lval=$define
13472                 ;;
13473         *)      ptr_lval=$d_stdio_ptr_lval;;
13474         esac
13475         case "$stdio_cnt" in
13476         '') stdio_cnt='((fp)->_cnt)'
13477                 cnt_lval=$define
13478                 ;;
13479         *)      cnt_lval=$d_stdio_cnt_lval;;
13480         esac
13481         case "$stdio_base" in
13482         '') stdio_base='((fp)->_base)';;
13483         esac
13484         case "$stdio_bufsiz" in
13485         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13486         esac
13487 fi
13488
13489 : test whether _ptr and _cnt really work
13490 echo "Checking how std your stdio is..." >&4
13491 $cat >try.c <<EOP
13492 #include <stdio.h>
13493 #$i_stdlib I_STDLIB
13494 #ifdef I_STDLIB
13495 #include <stdlib.h>
13496 #endif
13497 #define FILE_ptr(fp)    $stdio_ptr
13498 #define FILE_cnt(fp)    $stdio_cnt
13499 int main() {
13500         FILE *fp = fopen("try.c", "r");
13501         char c = getc(fp);
13502         if (
13503                 18 <= FILE_cnt(fp) &&
13504                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13505         )
13506                 exit(0);
13507         exit(1);
13508 }
13509 EOP
13510 val="$undef"
13511 set try
13512 if eval $compile && $to try.c; then
13513         if $run ./try; then
13514                 echo "Your stdio acts pretty std."
13515                 val="$define"
13516         else
13517                 echo "Your stdio isn't very std."
13518         fi
13519 else
13520         echo "Your stdio doesn't appear very std."
13521 fi
13522 $rm_try
13523
13524 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13525 # direct buffer manipulation no longer works.  The Configure tests
13526 # should be changed to correctly detect this, but until then,
13527 # the following check should at least let perl compile and run.
13528 # (This quick fix should be updated before 5.8.1.)
13529 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13530 # A. Dougherty, June 3, 2002.
13531 case "$d_gnulibc" in
13532 $define)
13533         case "$gnulibc_version" in
13534         2.[01]*)  ;;
13535         2.2) ;;
13536         2.2.[0-9]) ;;
13537         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13538                 val="$undef"
13539                 ;;
13540         esac
13541         ;;
13542 esac
13543 set d_stdstdio
13544 eval $setvar
13545
13546 : Can _ptr be used as an lvalue?
13547 case "$d_stdstdio$ptr_lval" in
13548 $define$define) val=$define ;;
13549 *) val=$undef ;;
13550 esac
13551 set d_stdio_ptr_lval
13552 eval $setvar
13553
13554 : Can _cnt be used as an lvalue?
13555 case "$d_stdstdio$cnt_lval" in
13556 $define$define) val=$define ;;
13557 *) val=$undef ;;
13558 esac
13559 set d_stdio_cnt_lval
13560 eval $setvar
13561
13562
13563 : test whether setting _ptr sets _cnt as a side effect
13564 d_stdio_ptr_lval_sets_cnt="$undef"
13565 d_stdio_ptr_lval_nochange_cnt="$undef"
13566 case "$d_stdio_ptr_lval$d_stdstdio" in
13567 $define$define)
13568         echo "Checking to see what happens if we set the stdio ptr..." >&4
13569 $cat >try.c <<EOP
13570 #include <stdio.h>
13571 /* Can we scream? */
13572 /* Eat dust sed :-) */
13573 /* In the buffer space, no one can hear you scream. */
13574 #$i_stdlib I_STDLIB
13575 #ifdef I_STDLIB
13576 #include <stdlib.h>
13577 #endif
13578 #define FILE_ptr(fp)    $stdio_ptr
13579 #define FILE_cnt(fp)    $stdio_cnt
13580 #include <sys/types.h>
13581 int main() {
13582         FILE *fp = fopen("try.c", "r");
13583         int c;
13584         char *ptr;
13585         size_t cnt;
13586         if (!fp) {
13587             puts("Fail even to read");
13588             exit(1);
13589         }
13590         c = getc(fp); /* Read away the first # */
13591         if (c == EOF) {
13592             puts("Fail even to read");
13593             exit(1);
13594         }
13595         if (!(
13596                 18 <= FILE_cnt(fp) &&
13597                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13598         )) {
13599                 puts("Fail even to read");
13600                 exit (1);
13601         }
13602         ptr = (char*) FILE_ptr(fp);
13603         cnt = (size_t)FILE_cnt(fp);
13604
13605         FILE_ptr(fp) += 42;
13606
13607         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13608                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13609                 exit (1);
13610         }
13611         if (FILE_cnt(fp) <= 20) {
13612                 printf ("Fail (<20 chars to test)");
13613                 exit (1);
13614         }
13615         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13616                 puts("Fail compare");
13617                 exit (1);
13618         }
13619         if (cnt == FILE_cnt(fp)) {
13620                 puts("Pass_unchanged");
13621                 exit (0);
13622         }
13623         if (FILE_cnt(fp) == (cnt - 42)) {
13624                 puts("Pass_changed");
13625                 exit (0);
13626         }
13627         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13628         return 1;
13629
13630 }
13631 EOP
13632         set try
13633         if eval $compile && $to try.c; then
13634                 case `$run ./try` in
13635                 Pass_changed)
13636                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13637                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13638                 Pass_unchanged)
13639                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13640                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13641                 Fail*)
13642                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13643                 *)
13644                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13645         esac
13646         else
13647                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13648         fi
13649         $rm_try
13650         ;;
13651 esac
13652
13653 : see if _base is also standard
13654 val="$undef"
13655 case "$d_stdstdio" in
13656 $define)
13657         $cat >try.c <<EOP
13658 #include <stdio.h>
13659 #$i_stdlib I_STDLIB
13660 #ifdef I_STDLIB
13661 #include <stdlib.h>
13662 #endif
13663 #define FILE_base(fp)   $stdio_base
13664 #define FILE_bufsiz(fp) $stdio_bufsiz
13665 int main() {
13666         FILE *fp = fopen("try.c", "r");
13667         char c = getc(fp);
13668         if (
13669                 19 <= FILE_bufsiz(fp) &&
13670                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13671         )
13672                 exit(0);
13673         exit(1);
13674 }
13675 EOP
13676         set try
13677         if eval $compile && $to try.c; then
13678                 if $run ./try; then
13679                         echo "And its _base field acts std."
13680                         val="$define"
13681                 else
13682                         echo "But its _base field isn't std."
13683                 fi
13684         else
13685                 echo "However, it seems to be lacking the _base field."
13686         fi
13687         $rm_try
13688         ;;
13689 esac
13690 set d_stdiobase
13691 eval $setvar
13692
13693 : see if fast_stdio exists
13694 val="$undef"
13695 case "$d_stdstdio:$d_stdio_ptr_lval" in
13696 "$define:$define")
13697         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13698         *$define*)
13699                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13700                 val="$define"
13701                 ;;
13702         esac
13703         ;;
13704 esac
13705 set d_faststdio
13706 eval $setvar
13707
13708 : see if fchdir exists
13709 set fchdir d_fchdir
13710 eval $inlibc
13711
13712 : see if fchmod exists
13713 set fchmod d_fchmod
13714 eval $inlibc
13715
13716 : check for openat, unlinkat, renameat, linkat, fchmodat
13717 set openat d_openat
13718 eval $inlibc
13719
13720 set unlinkat d_unlinkat
13721 eval $inlibc
13722
13723 set renameat d_renameat
13724 eval $inlibc
13725
13726 set linkat d_linkat
13727 eval $inlibc
13728
13729 set fchmodat d_fchmodat
13730 eval $inlibc
13731
13732 : see if fchown exists
13733 set fchown d_fchown
13734 eval $inlibc
13735
13736 : see if this is an fcntl system
13737 set fcntl d_fcntl
13738 eval $inlibc
13739
13740 : See if fcntl-based locking works.
13741 echo " "
13742 $cat >try.c <<EOCP
13743 #$i_stdlib I_STDLIB
13744 #ifdef I_STDLIB
13745 #include <stdlib.h>
13746 #endif
13747 #include <unistd.h>
13748 #include <fcntl.h>
13749 #include <signal.h>
13750 $signal_t blech(int x) { exit(3); }
13751 int main() {
13752 #if defined(F_SETLK) && defined(F_SETLKW)
13753      struct flock flock;
13754      int retval, fd;
13755      fd = open("try.c", O_RDONLY);
13756      flock.l_type = F_RDLCK;
13757      flock.l_whence = SEEK_SET;
13758      flock.l_start = flock.l_len = 0;
13759      signal(SIGALRM, blech);
13760      alarm(10);
13761      retval = fcntl(fd, F_SETLK, &flock);
13762      close(fd);
13763      (retval < 0 ? exit(2) : exit(0));
13764 #else
13765      exit(2);
13766 #endif
13767 }
13768 EOCP
13769 echo "Checking if fcntl-based file locking works... "
13770 case "$d_fcntl" in
13771 "$define")
13772         set try
13773         if eval $compile_ok; then
13774                 if $run ./try; then
13775                         echo "Yes, it seems to work."
13776                         val="$define"
13777                 else
13778                         echo "Nope, it didn't work."
13779                         val="$undef"
13780                         case "$?" in
13781                         3) $cat >&4 <<EOM
13782 ***
13783 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13784 *** This is (almost) impossible.
13785 *** If your NFS lock daemons are not feeling well, something like
13786 *** this may happen, please investigate.  Cannot continue, aborting.
13787 ***
13788 EOM
13789                                 exit 1
13790                                 ;;
13791                         esac
13792                 fi
13793         else
13794                 echo "I'm unable to compile the test program, so I'll assume not."
13795                 val="$undef"
13796         fi
13797         ;;
13798 *) val="$undef";
13799         echo "Nope, since you don't even have fcntl()."
13800         ;;
13801 esac
13802 set d_fcntl_can_lock
13803 eval $setvar
13804 $rm_try
13805
13806 : check for fd_set items
13807 $cat <<EOM
13808
13809 Checking to see how well your C compiler handles fd_set and friends ...
13810 EOM
13811 $cat >try.c <<EOCP
13812 #$i_stdlib I_STDLIB
13813 #ifdef I_STDLIB
13814 #include <stdlib.h>
13815 #endif
13816 #$i_systime I_SYS_TIME
13817 #$i_sysselct I_SYS_SELECT
13818 #$d_socket HAS_SOCKET
13819 #include <sys/types.h>
13820 #ifdef HAS_SOCKET
13821 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13822 #endif
13823 #ifdef I_SYS_TIME
13824 #include <sys/time.h>
13825 #endif
13826 #ifdef I_SYS_SELECT
13827 #include <sys/select.h>
13828 #endif
13829 int main() {
13830         fd_set fds;
13831
13832 #ifdef TRYBITS
13833         if(fds.fds_bits);
13834 #endif
13835
13836 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13837         exit(0);
13838 #else
13839         exit(1);
13840 #endif
13841 }
13842 EOCP
13843 set try -DTRYBITS
13844 if eval $compile; then
13845         d_fds_bits="$define"
13846         d_fd_set="$define"
13847         echo "Well, your system knows about the normal fd_set typedef..." >&4
13848         if $run ./try; then
13849                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13850                 d_fd_macros="$define"
13851         else
13852                 $cat >&4 <<'EOM'
13853 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13854 EOM
13855                 d_fd_macros="$undef"
13856         fi
13857 else
13858         $cat <<'EOM'
13859 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13860 EOM
13861         set try
13862         if eval $compile; then
13863                 d_fds_bits="$undef"
13864                 d_fd_set="$define"
13865                 echo "Well, your system has some sort of fd_set available..." >&4
13866                 if $run ./try; then
13867                         echo "and you have the normal fd_set macros." >&4
13868                         d_fd_macros="$define"
13869                 else
13870                         $cat <<'EOM'
13871 but not the normal fd_set macros!  Gross!  More work for me...
13872 EOM
13873                         d_fd_macros="$undef"
13874                 fi
13875         else
13876         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13877                 d_fd_set="$undef"
13878                 d_fds_bits="$undef"
13879                 d_fd_macros="$undef"
13880         fi
13881 fi
13882 $rm_try
13883
13884 : see if fdclose exists
13885 set fdclose d_fdclose
13886 eval $inlibc
13887
13888 : see if fdim exists
13889 set fdim d_fdim
13890 eval $inlibc
13891
13892 : see if fegetround exists
13893 set fegetround d_fegetround
13894 eval $inlibc
13895
13896 : see if fgetpos exists
13897 set fgetpos d_fgetpos
13898 eval $inlibc
13899
13900 : see if finite exists
13901 set finite d_finite
13902 eval $inlibc
13903
13904 : see if finitel exists
13905 set finitel d_finitel
13906 eval $inlibc
13907
13908 : see if flock exists
13909 set flock d_flock
13910 eval $inlibc
13911
13912 : see if prototype for flock is available
13913 echo " "
13914 set d_flockproto flock $i_sysfile sys/file.h
13915 eval $hasproto
13916
13917 : see if fma exists
13918 set fma d_fma
13919 eval $inlibc
13920
13921 : see if fmax exists
13922 set fmax d_fmax
13923 eval $inlibc
13924
13925 : see if fmin exists
13926 set fmin d_fmin
13927 eval $inlibc
13928
13929 : see if fp_class exists
13930 set fp_class d_fp_class
13931 eval $inlibc
13932
13933 : check for fpclassify
13934 echo "Checking to see if you have fpclassify..." >&4
13935 $cat >try.c <<EOCP
13936 #include <math.h>
13937 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13938 EOCP
13939 set try
13940 if eval $compile; then
13941         val="$define"
13942         echo "You have fpclassify."
13943 else
13944         val="$undef"
13945         echo "You do not have fpclassify."
13946 fi
13947 $rm_try
13948 set d_fpclassify
13949 eval $setvar
13950
13951 : see if fp_classify exists
13952 set fp_classify d_fp_classify
13953 eval $inlibc
13954
13955 : see if fp_classl exists
13956 set fp_classl d_fp_classl
13957 eval $inlibc
13958
13959 : see if pathconf exists
13960 set pathconf d_pathconf
13961 eval $inlibc
13962
13963 : see if fpathconf exists
13964 set fpathconf d_fpathconf
13965 eval $inlibc
13966
13967 : see if fpclass exists
13968 set fpclass d_fpclass
13969 eval $inlibc
13970
13971 : see if fpclassl exists
13972 set fpclassl d_fpclassl
13973 eval $inlibc
13974
13975 : see if fpgetround exists
13976 set fpgetround d_fpgetround
13977 eval $inlibc
13978
13979 : check for fpos64_t
13980 echo " "
13981 echo "Checking to see if you have fpos64_t..." >&4
13982 $cat >try.c <<EOCP
13983 #include <stdio.h>
13984 int main() { fpos64_t x = 7; }
13985 EOCP
13986 set try
13987 if eval $compile; then
13988         val="$define"
13989         echo "You have fpos64_t."
13990 else
13991         val="$undef"
13992         echo "You do not have fpos64_t."
13993         case "$fpossize" in
13994         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13995         esac
13996 fi
13997 $rm_try
13998 set d_fpos64_t
13999 eval $setvar
14000
14001 : see if this is an xlocale.h system
14002 set xlocale.h i_xlocale
14003 eval $inhdr
14004
14005 : see if newlocale exists
14006 set newlocale d_newlocale
14007 eval $inlibc
14008
14009 : see if freelocale exists
14010 set freelocale d_freelocale
14011 eval $inlibc
14012
14013 : see if uselocale exists
14014 set uselocale d_uselocale
14015 eval $inlibc
14016
14017 : see if duplocale exists
14018 set duplocale d_duplocale
14019 eval $inlibc
14020
14021 : see if querylocale exists
14022 set querylocale d_querylocale
14023 eval $inlibc
14024
14025 : see if frexpl exists
14026 set frexpl d_frexpl
14027 eval $inlibc
14028
14029 : see if this is a sys/param system
14030 set sys/param.h i_sysparam
14031 eval $inhdr
14032
14033 : see if this is a sys/mount.h system
14034 set sys/mount.h i_sysmount
14035 eval $inhdr
14036
14037 : Check for fs_data_s
14038 echo " "
14039 echo "Checking to see if your system supports struct fs_data..." >&4
14040 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14041 eval $hasstruct
14042 case "$d_fs_data_s" in
14043 "$define")      echo "Yes, it does."   ;;
14044 *)              echo "No, it doesn't." ;;
14045 esac
14046
14047 : see if fseeko exists
14048 set fseeko d_fseeko
14049 eval $inlibc
14050 case "$longsize" in
14051 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14052 esac
14053
14054 : see if fsetpos exists
14055 set fsetpos d_fsetpos
14056 eval $inlibc
14057
14058 : see if fstatfs exists
14059 set fstatfs d_fstatfs
14060 eval $inlibc
14061
14062 : see if statvfs exists
14063 set statvfs d_statvfs
14064 eval $inlibc
14065
14066 : see if fstatvfs exists
14067 set fstatvfs d_fstatvfs
14068 eval $inlibc
14069
14070 : see if fsync exists
14071 set fsync d_fsync
14072 eval $inlibc
14073
14074 : see if ftello exists
14075 set ftello d_ftello
14076 eval $inlibc
14077 case "$longsize" in
14078 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14079 esac
14080
14081 : check for a working futimes
14082 d_futimes="$undef"
14083 echo " "
14084 echo "Checking if you have a working futimes()" >&4
14085 $cat >try.c <<EOCP
14086 #include <stdio.h>
14087 #include <sys/time.h>
14088 #include <errno.h>
14089 #include <fcntl.h>
14090
14091 int main ()
14092 {
14093     int fd, rv;
14094     fd = open ("try.c", O_RDWR);
14095     if (-1 == fd) exit (1);
14096     rv = futimes (fd, NULL);
14097     exit (rv == -1 ? errno : 0);
14098 }
14099 EOCP
14100 set try
14101 if eval $compile; then
14102     `$run ./try`
14103     rc=$?
14104     case "$rc" in
14105         0)  echo "Yes, you have" >&4
14106             d_futimes="$define"
14107             ;;
14108         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14109             ;;
14110     esac
14111 else
14112     echo "No, it does not (probably harmless)" >&4
14113 fi
14114 $rm_try
14115
14116 : look for gai_strerror
14117 echo " "
14118 $cat >try.c <<'EOCP'
14119 #include <sys/types.h>
14120 #include <sys/socket.h>
14121 #include <netdb.h>
14122 int main ()
14123 {
14124     return (gai_strerror (0) ? 0 : 1);
14125     }
14126 EOCP
14127 set try
14128 val="$undef"
14129 if eval $compile; then
14130     `$run ./try`
14131     case "$?" in
14132         0)  echo "A working gai_strerror() found." >&4
14133             val="$define" ;;
14134         *)  echo "gai_strerror() found, but it doesn't work" >&4
14135             ;;
14136         esac
14137 else
14138     echo "gai_strerror() NOT found." >&4
14139     fi
14140 set d_gai_strerror
14141 eval $setvar
14142 $rm_try
14143
14144 : see if ndbm.h is available
14145 set ndbm.h i_ndbm
14146 eval $inhdr
14147 : Compatibility location for RedHat 7.1
14148 set gdbm/ndbm.h i_gdbmndbm
14149 eval $inhdr
14150 : Compatibility location for Debian 4.0
14151 set gdbm-ndbm.h i_gdbm_ndbm
14152 eval $inhdr
14153
14154 val="$undef"
14155 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14156         : see if dbm_open exists
14157         set dbm_open d_dbm_open
14158         eval $inlibc
14159         case "$d_dbm_open" in
14160         $undef)
14161                 i_ndbm="$undef"
14162                 i_gdbmndbm="$undef"
14163                 i_gdbm_ndbm="$undef"
14164                 echo "We won't be including <ndbm.h>"
14165                 val="$undef"
14166                 ;;
14167         *) val="$define"
14168            ;;
14169         esac
14170 fi
14171 set d_ndbm
14172 eval $setvar
14173
14174 ndbm_hdr_protochk='name=$1; hdr=$2;
14175 eval "ihdr=\$""i_$name";
14176 val="$undef";
14177 if $test "$ihdr" = "$define"; then
14178         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14179         case "$d_cplusplus" in
14180         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14181         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14182         esac;
14183         case "$val" in
14184         $define) $echo "Your <$hdr> seems to have prototypes";;
14185         *) $echo "Your <$hdr> does not seem to have prototypes";;
14186         esac;
14187 fi;
14188 set "d_${name}_h_uses_prototypes";
14189 eval $setvar'
14190
14191 set ndbm ndbm.h
14192 eval $ndbm_hdr_protochk
14193 set gdbmndbm gdbm/ndbm.h
14194 eval $ndbm_hdr_protochk
14195 set gdbm_ndbm gdbm-ndbm.h
14196 eval $ndbm_hdr_protochk
14197
14198 : see if getaddrinfo exists
14199 set getaddrinfo d_getaddrinfo
14200 eval $inlibc
14201
14202 : see if getcwd exists
14203 set getcwd d_getcwd
14204 eval $inlibc
14205
14206 : see if getespwnam exists
14207 set getespwnam d_getespwnam
14208 eval $inlibc
14209
14210 : see if getfsstat exists
14211 set getfsstat d_getfsstat
14212 eval $inlibc
14213
14214 : see if getgrent exists
14215 set getgrent d_getgrent
14216 eval $inlibc
14217
14218 : see if getgrent_r exists
14219 set getgrent_r d_getgrent_r
14220 eval $inlibc
14221 case "$d_getgrent_r" in
14222 "$define")
14223         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14224         case "$d_getgrent_r_proto:$usethreads" in
14225         ":define")      d_getgrent_r_proto=define
14226                 set d_getgrent_r_proto getgrent_r $hdrs
14227                 eval $hasproto ;;
14228         *)      ;;
14229         esac
14230         case "$d_getgrent_r_proto" in
14231         define)
14232         case "$getgrent_r_proto" in
14233         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14234         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14235         esac
14236         case "$getgrent_r_proto" in
14237         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14238         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14239         esac
14240         case "$getgrent_r_proto" in
14241         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14242         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14243         esac
14244         case "$getgrent_r_proto" in
14245         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14246         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14247         esac
14248         case "$getgrent_r_proto" in
14249         ''|0) try='int getgrent_r(struct group*, char*, int);'
14250         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14251         esac
14252         case "$getgrent_r_proto" in
14253         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14254         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14255         esac
14256         case "$getgrent_r_proto" in
14257         ''|0)   d_getgrent_r=undef
14258                 getgrent_r_proto=0
14259                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14260         * )     case "$getgrent_r_proto" in
14261                 REENTRANT_PROTO*) ;;
14262                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14263                 esac
14264                 echo "Prototype: $try" ;;
14265         esac
14266         ;;
14267         *)      case "$usethreads" in
14268                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14269                 esac
14270                 d_getgrent_r=undef
14271                 getgrent_r_proto=0
14272                 ;;
14273         esac
14274         ;;
14275 *)      getgrent_r_proto=0
14276         ;;
14277 esac
14278
14279 : see if getgrgid_r exists
14280 set getgrgid_r d_getgrgid_r
14281 eval $inlibc
14282 case "$d_getgrgid_r" in
14283 "$define")
14284         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14285         case "$d_getgrgid_r_proto:$usethreads" in
14286         ":define")      d_getgrgid_r_proto=define
14287                 set d_getgrgid_r_proto getgrgid_r $hdrs
14288                 eval $hasproto ;;
14289         *)      ;;
14290         esac
14291         case "$d_getgrgid_r_proto" in
14292         define)
14293         case "$getgrgid_r_proto" in
14294         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14295         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14296         esac
14297         case "$getgrgid_r_proto" in
14298         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14299         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14300         esac
14301         case "$getgrgid_r_proto" in
14302         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14303         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14304         esac
14305         case "$getgrgid_r_proto" in
14306         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14307         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14308         esac
14309         case "$getgrgid_r_proto" in
14310         ''|0)   d_getgrgid_r=undef
14311                 getgrgid_r_proto=0
14312                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14313         * )     case "$getgrgid_r_proto" in
14314                 REENTRANT_PROTO*) ;;
14315                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14316                 esac
14317                 echo "Prototype: $try" ;;
14318         esac
14319         ;;
14320         *)      case "$usethreads" in
14321                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14322                 esac
14323                 d_getgrgid_r=undef
14324                 getgrgid_r_proto=0
14325                 ;;
14326         esac
14327         ;;
14328 *)      getgrgid_r_proto=0
14329         ;;
14330 esac
14331
14332 : see if getgrnam_r exists
14333 set getgrnam_r d_getgrnam_r
14334 eval $inlibc
14335 case "$d_getgrnam_r" in
14336 "$define")
14337         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14338         case "$d_getgrnam_r_proto:$usethreads" in
14339         ":define")      d_getgrnam_r_proto=define
14340                 set d_getgrnam_r_proto getgrnam_r $hdrs
14341                 eval $hasproto ;;
14342         *)      ;;
14343         esac
14344         case "$d_getgrnam_r_proto" in
14345         define)
14346         case "$getgrnam_r_proto" in
14347         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14348         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14349         esac
14350         case "$getgrnam_r_proto" in
14351         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14352         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14353         esac
14354         case "$getgrnam_r_proto" in
14355         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14356         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14357         esac
14358         case "$getgrnam_r_proto" in
14359         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14360         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14361         esac
14362         case "$getgrnam_r_proto" in
14363         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14364         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14365         esac
14366         case "$getgrnam_r_proto" in
14367         ''|0)   d_getgrnam_r=undef
14368                 getgrnam_r_proto=0
14369                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14370         * )     case "$getgrnam_r_proto" in
14371                 REENTRANT_PROTO*) ;;
14372                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14373                 esac
14374                 echo "Prototype: $try" ;;
14375         esac
14376         ;;
14377         *)      case "$usethreads" in
14378                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14379                 esac
14380                 d_getgrnam_r=undef
14381                 getgrnam_r_proto=0
14382                 ;;
14383         esac
14384         ;;
14385 *)      getgrnam_r_proto=0
14386         ;;
14387 esac
14388
14389 : see if gethostbyaddr exists
14390 set gethostbyaddr d_gethbyaddr
14391 eval $inlibc
14392
14393 : see if gethostbyname exists
14394 set gethostbyname d_gethbyname
14395 eval $inlibc
14396
14397 : see if gethostent exists
14398 set gethostent d_gethent
14399 eval $inlibc
14400
14401 : see how we will look up host name
14402 echo " "
14403 call=''
14404 if set gethostname val -f d_gethname; eval $csym; $val; then
14405         echo 'gethostname() found.' >&4
14406         d_gethname="$define"
14407         call=gethostname
14408 fi
14409 if set uname val -f d_uname; eval $csym; $val; then
14410         if ./xenix; then
14411                 $cat <<'EOM'
14412 uname() was found, but you're running xenix, and older versions of xenix
14413 have a broken uname(). If you don't really know whether your xenix is old
14414 enough to have a broken system call, use the default answer.
14415
14416 EOM
14417                 dflt=y
14418                 case "$d_uname" in
14419                 "$define") dflt=n;;
14420                 esac
14421                 rp='Is your uname() broken?'
14422                 . ./myread
14423                 case "$ans" in
14424                 n*) d_uname="$define"; call=uname;;
14425                 esac
14426         else
14427                 echo 'uname() found.' >&4
14428                 d_uname="$define"
14429                 case "$call" in
14430                 '') call=uname ;;
14431                 esac
14432         fi
14433 fi
14434 case "$d_gethname" in
14435 '') d_gethname="$undef";;
14436 esac
14437 case "$d_uname" in
14438 '') d_uname="$undef";;
14439 esac
14440 case "$d_uname$d_gethname" in
14441 *define*)
14442         dflt=n
14443         cat <<EOM
14444
14445 Every now and then someone has a $call() that lies about the hostname
14446 but can't be fixed for political or economic reasons.  If you wish, I can
14447 pretend $call() isn't there and maybe compute hostname at run-time
14448 thanks to the '$phostname' command.
14449
14450 EOM
14451         rp="Shall I ignore $call() from now on?"
14452         . ./myread
14453         case "$ans" in
14454         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14455         esac;;
14456 esac
14457 case "$phostname" in
14458 '') aphostname='';;
14459 *) case "$aphostname" in
14460         /*) ;;
14461         *) set X $phostname
14462                 shift
14463                 file=$1
14464                 shift
14465                 file=`./loc $file $file $pth`
14466                 aphostname=`echo $file $*`
14467                 ;;
14468         esac
14469         ;;
14470 esac
14471 case "$d_uname$d_gethname" in
14472 *define*) ;;
14473 *)
14474         case "$phostname" in
14475         '')
14476                 echo "There will be no way for $package to get your hostname." >&4;;
14477         *)
14478         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14479                 ;;
14480         esac;;
14481 esac
14482 case "$d_phostname" in
14483 '') d_phostname="$undef";;
14484 esac
14485
14486 : see if gethostbyaddr_r exists
14487 set gethostbyaddr_r d_gethostbyaddr_r
14488 eval $inlibc
14489 case "$d_gethostbyaddr_r" in
14490 "$define")
14491         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14492         case "$d_gethostbyaddr_r_proto:$usethreads" in
14493         ":define")      d_gethostbyaddr_r_proto=define
14494                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14495                 eval $hasproto ;;
14496         *)      ;;
14497         esac
14498         case "$d_gethostbyaddr_r_proto" in
14499         define)
14500         case "$gethostbyaddr_r_proto" in
14501         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14502         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14503         esac
14504         case "$gethostbyaddr_r_proto" in
14505         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14506         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14507         esac
14508         case "$gethostbyaddr_r_proto" in
14509         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14510         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14511         esac
14512         case "$gethostbyaddr_r_proto" in
14513         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14514         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14515         esac
14516         case "$gethostbyaddr_r_proto" in
14517         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14518         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14519         esac
14520         case "$gethostbyaddr_r_proto" in
14521         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14522         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14523         esac
14524         case "$gethostbyaddr_r_proto" in
14525         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14526         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14527         esac
14528         case "$gethostbyaddr_r_proto" in
14529         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14530         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14531         esac
14532         case "$gethostbyaddr_r_proto" in
14533         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14534         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14535         esac
14536         case "$gethostbyaddr_r_proto" in
14537         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14538         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14539         esac
14540         case "$gethostbyaddr_r_proto" in
14541         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14542         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14543         esac
14544         case "$gethostbyaddr_r_proto" in
14545         ''|0)   d_gethostbyaddr_r=undef
14546                 gethostbyaddr_r_proto=0
14547                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14548         * )     case "$gethostbyaddr_r_proto" in
14549                 REENTRANT_PROTO*) ;;
14550                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14551                 esac
14552                 echo "Prototype: $try" ;;
14553         esac
14554         ;;
14555         *)      case "$usethreads" in
14556                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14557                 esac
14558                 d_gethostbyaddr_r=undef
14559                 gethostbyaddr_r_proto=0
14560                 ;;
14561         esac
14562         ;;
14563 *)      gethostbyaddr_r_proto=0
14564         ;;
14565 esac
14566
14567 : see if gethostbyname_r exists
14568 set gethostbyname_r d_gethostbyname_r
14569 eval $inlibc
14570 case "$d_gethostbyname_r" in
14571 "$define")
14572         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14573         case "$d_gethostbyname_r_proto:$usethreads" in
14574         ":define")      d_gethostbyname_r_proto=define
14575                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14576                 eval $hasproto ;;
14577         *)      ;;
14578         esac
14579         case "$d_gethostbyname_r_proto" in
14580         define)
14581         case "$gethostbyname_r_proto" in
14582         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14583         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14584         esac
14585         case "$gethostbyname_r_proto" in
14586         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14587         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14588         esac
14589         case "$gethostbyname_r_proto" in
14590         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14591         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14592         esac
14593         case "$gethostbyname_r_proto" in
14594         ''|0)   d_gethostbyname_r=undef
14595                 gethostbyname_r_proto=0
14596                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14597         * )     case "$gethostbyname_r_proto" in
14598                 REENTRANT_PROTO*) ;;
14599                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14600                 esac
14601                 echo "Prototype: $try" ;;
14602         esac
14603         ;;
14604         *)      case "$usethreads" in
14605                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14606                 esac
14607                 d_gethostbyname_r=undef
14608                 gethostbyname_r_proto=0
14609                 ;;
14610         esac
14611         ;;
14612 *)      gethostbyname_r_proto=0
14613         ;;
14614 esac
14615
14616 : see if gethostent_r exists
14617 set gethostent_r d_gethostent_r
14618 eval $inlibc
14619 case "$d_gethostent_r" in
14620 "$define")
14621         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14622         case "$d_gethostent_r_proto:$usethreads" in
14623         ":define")      d_gethostent_r_proto=define
14624                 set d_gethostent_r_proto gethostent_r $hdrs
14625                 eval $hasproto ;;
14626         *)      ;;
14627         esac
14628         case "$d_gethostent_r_proto" in
14629         define)
14630         case "$gethostent_r_proto" in
14631         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14632         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14633         esac
14634         case "$gethostent_r_proto" in
14635         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14636         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14637         esac
14638         case "$gethostent_r_proto" in
14639         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14640         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14641         esac
14642         case "$gethostent_r_proto" in
14643         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14644         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14645         esac
14646         case "$gethostent_r_proto" in
14647         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14648         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14649         esac
14650         case "$gethostent_r_proto" in
14651         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14652         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14653         esac
14654         case "$gethostent_r_proto" in
14655         ''|0)   d_gethostent_r=undef
14656                 gethostent_r_proto=0
14657                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14658         * )     case "$gethostent_r_proto" in
14659                 REENTRANT_PROTO*) ;;
14660                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14661                 esac
14662                 echo "Prototype: $try" ;;
14663         esac
14664         ;;
14665         *)      case "$usethreads" in
14666                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14667                 esac
14668                 d_gethostent_r=undef
14669                 gethostent_r_proto=0
14670                 ;;
14671         esac
14672         ;;
14673 *)      gethostent_r_proto=0
14674         ;;
14675 esac
14676
14677 : see if prototypes for various gethostxxx netdb.h functions are available
14678 echo " "
14679 set d_gethostprotos gethostent $i_netdb netdb.h
14680 eval $hasproto
14681
14682 : see if getitimer exists
14683 set getitimer d_getitimer
14684 eval $inlibc
14685
14686 : see if getlogin exists
14687 set getlogin d_getlogin
14688 eval $inlibc
14689
14690 : see if getlogin_r exists
14691 set getlogin_r d_getlogin_r
14692 eval $inlibc
14693 case "$d_getlogin_r" in
14694 "$define")
14695         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14696         case "$d_getlogin_r_proto:$usethreads" in
14697         ":define")      d_getlogin_r_proto=define
14698                 set d_getlogin_r_proto getlogin_r $hdrs
14699                 eval $hasproto ;;
14700         *)      ;;
14701         esac
14702         case "$d_getlogin_r_proto" in
14703         define)
14704         case "$getlogin_r_proto" in
14705         ''|0) try='int getlogin_r(char*, size_t);'
14706         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14707         esac
14708         case "$getlogin_r_proto" in
14709         ''|0) try='int getlogin_r(char*, int);'
14710         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14711         esac
14712         case "$getlogin_r_proto" in
14713         ''|0) try='char* getlogin_r(char*, size_t);'
14714         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14715         esac
14716         case "$getlogin_r_proto" in
14717         ''|0) try='char* getlogin_r(char*, int);'
14718         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14719         esac
14720         case "$getlogin_r_proto" in
14721         ''|0)   d_getlogin_r=undef
14722                 getlogin_r_proto=0
14723                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14724         * )     case "$getlogin_r_proto" in
14725                 REENTRANT_PROTO*) ;;
14726                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14727                 esac
14728                 echo "Prototype: $try" ;;
14729         esac
14730         ;;
14731         *)      case "$usethreads" in
14732                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14733                 esac
14734                 d_getlogin_r=undef
14735                 getlogin_r_proto=0
14736                 ;;
14737         esac
14738         ;;
14739 *)      getlogin_r_proto=0
14740         ;;
14741 esac
14742
14743 : see if getmnt exists
14744 set getmnt d_getmnt
14745 eval $inlibc
14746
14747 : see if getmntent exists
14748 set getmntent d_getmntent
14749 eval $inlibc
14750
14751 : see if getnameinfo exists
14752 set getnameinfo d_getnameinfo
14753 eval $inlibc
14754
14755 : see if getnetbyaddr exists
14756 set getnetbyaddr d_getnbyaddr
14757 eval $inlibc
14758
14759 : see if getnetbyname exists
14760 set getnetbyname d_getnbyname
14761 eval $inlibc
14762
14763 : see if getnetent exists
14764 set getnetent d_getnent
14765 eval $inlibc
14766
14767 : see if getnetbyaddr_r exists
14768 set getnetbyaddr_r d_getnetbyaddr_r
14769 eval $inlibc
14770 case "$d_getnetbyaddr_r" in
14771 "$define")
14772         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14773         case "$d_getnetbyaddr_r_proto:$usethreads" in
14774         ":define")      d_getnetbyaddr_r_proto=define
14775                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14776                 eval $hasproto ;;
14777         *)      ;;
14778         esac
14779         case "$d_getnetbyaddr_r_proto" in
14780         define)
14781         case "$getnetbyaddr_r_proto" in
14782         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14783         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14784         esac
14785         case "$getnetbyaddr_r_proto" in
14786         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14787         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14788         esac
14789         case "$getnetbyaddr_r_proto" in
14790         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14791         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14792         esac
14793         case "$getnetbyaddr_r_proto" in
14794         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14795         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14796         esac
14797         case "$getnetbyaddr_r_proto" in
14798         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14799         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14800         esac
14801         case "$getnetbyaddr_r_proto" in
14802         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14803         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14804         esac
14805         case "$getnetbyaddr_r_proto" in
14806         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14807         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14808         esac
14809         case "$getnetbyaddr_r_proto" in
14810         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14811         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14812         esac
14813         case "$getnetbyaddr_r_proto" in
14814         ''|0)   d_getnetbyaddr_r=undef
14815                 getnetbyaddr_r_proto=0
14816                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14817         * )     case "$getnetbyaddr_r_proto" in
14818                 REENTRANT_PROTO*) ;;
14819                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14820                 esac
14821                 echo "Prototype: $try" ;;
14822         esac
14823         ;;
14824         *)      case "$usethreads" in
14825                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14826                 esac
14827                 d_getnetbyaddr_r=undef
14828                 getnetbyaddr_r_proto=0
14829                 ;;
14830         esac
14831         ;;
14832 *)      getnetbyaddr_r_proto=0
14833         ;;
14834 esac
14835
14836 : see if getnetbyname_r exists
14837 set getnetbyname_r d_getnetbyname_r
14838 eval $inlibc
14839 case "$d_getnetbyname_r" in
14840 "$define")
14841         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14842         case "$d_getnetbyname_r_proto:$usethreads" in
14843         ":define")      d_getnetbyname_r_proto=define
14844                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14845                 eval $hasproto ;;
14846         *)      ;;
14847         esac
14848         case "$d_getnetbyname_r_proto" in
14849         define)
14850         case "$getnetbyname_r_proto" in
14851         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14852         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14853         esac
14854         case "$getnetbyname_r_proto" in
14855         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14856         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14857         esac
14858         case "$getnetbyname_r_proto" in
14859         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14860         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14861         esac
14862         case "$getnetbyname_r_proto" in
14863         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14864         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14865         esac
14866         case "$getnetbyname_r_proto" in
14867         ''|0)   d_getnetbyname_r=undef
14868                 getnetbyname_r_proto=0
14869                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14870         * )     case "$getnetbyname_r_proto" in
14871                 REENTRANT_PROTO*) ;;
14872                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14873                 esac
14874                 echo "Prototype: $try" ;;
14875         esac
14876         ;;
14877         *)      case "$usethreads" in
14878                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14879                 esac
14880                 d_getnetbyname_r=undef
14881                 getnetbyname_r_proto=0
14882                 ;;
14883         esac
14884         ;;
14885 *)      getnetbyname_r_proto=0
14886         ;;
14887 esac
14888
14889 : see if getnetent_r exists
14890 set getnetent_r d_getnetent_r
14891 eval $inlibc
14892 case "$d_getnetent_r" in
14893 "$define")
14894         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14895         case "$d_getnetent_r_proto:$usethreads" in
14896         ":define")      d_getnetent_r_proto=define
14897                 set d_getnetent_r_proto getnetent_r $hdrs
14898                 eval $hasproto ;;
14899         *)      ;;
14900         esac
14901         case "$d_getnetent_r_proto" in
14902         define)
14903         case "$getnetent_r_proto" in
14904         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14905         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14906         esac
14907         case "$getnetent_r_proto" in
14908         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14909         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14910         esac
14911         case "$getnetent_r_proto" in
14912         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14913         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14914         esac
14915         case "$getnetent_r_proto" in
14916         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14917         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14918         esac
14919         case "$getnetent_r_proto" in
14920         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14921         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14922         esac
14923         case "$getnetent_r_proto" in
14924         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14925         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14926         esac
14927         case "$getnetent_r_proto" in
14928         ''|0)   d_getnetent_r=undef
14929                 getnetent_r_proto=0
14930                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14931         * )     case "$getnetent_r_proto" in
14932                 REENTRANT_PROTO*) ;;
14933                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14934                 esac
14935                 echo "Prototype: $try" ;;
14936         esac
14937         ;;
14938         *)      case "$usethreads" in
14939                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14940                 esac
14941                 d_getnetent_r=undef
14942                 getnetent_r_proto=0
14943                 ;;
14944         esac
14945         ;;
14946 *)      getnetent_r_proto=0
14947         ;;
14948 esac
14949
14950 : see if prototypes for various getnetxxx netdb.h functions are available
14951 echo " "
14952 set d_getnetprotos getnetent $i_netdb netdb.h
14953 eval $hasproto
14954
14955 : see if getpagesize exists
14956 set getpagesize d_getpagsz
14957 eval $inlibc
14958
14959 : Optional checks for getprotobyname and getprotobynumber
14960
14961 : see if getprotobyname exists
14962 set getprotobyname d_getpbyname
14963 eval $inlibc
14964
14965 : see if getprotobynumber exists
14966 set getprotobynumber d_getpbynumber
14967 eval $inlibc
14968
14969 : see if getprotoent exists
14970 set getprotoent d_getpent
14971 eval $inlibc
14972
14973 : see if getpgid exists
14974 set getpgid d_getpgid
14975 eval $inlibc
14976
14977 : see if getpgrp2 exists
14978 set getpgrp2 d_getpgrp2
14979 eval $inlibc
14980
14981 : see if getppid exists
14982 set getppid d_getppid
14983 eval $inlibc
14984
14985 : see if getpriority exists
14986 set getpriority d_getprior
14987 eval $inlibc
14988
14989 : see if getprotobyname_r exists
14990 set getprotobyname_r d_getprotobyname_r
14991 eval $inlibc
14992 case "$d_getprotobyname_r" in
14993 "$define")
14994         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14995         case "$d_getprotobyname_r_proto:$usethreads" in
14996         ":define")      d_getprotobyname_r_proto=define
14997                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14998                 eval $hasproto ;;
14999         *)      ;;
15000         esac
15001         case "$d_getprotobyname_r_proto" in
15002         define)
15003         case "$getprotobyname_r_proto" in
15004         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15005         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15006         esac
15007         case "$getprotobyname_r_proto" in
15008         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15009         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15010         esac
15011         case "$getprotobyname_r_proto" in
15012         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15013         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15014         esac
15015         case "$getprotobyname_r_proto" in
15016         ''|0)   d_getprotobyname_r=undef
15017                 getprotobyname_r_proto=0
15018                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15019         * )     case "$getprotobyname_r_proto" in
15020                 REENTRANT_PROTO*) ;;
15021                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15022                 esac
15023                 echo "Prototype: $try" ;;
15024         esac
15025         ;;
15026         *)      case "$usethreads" in
15027                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15028                 esac
15029                 d_getprotobyname_r=undef
15030                 getprotobyname_r_proto=0
15031                 ;;
15032         esac
15033         ;;
15034 *)      getprotobyname_r_proto=0
15035         ;;
15036 esac
15037
15038 : see if getprotobynumber_r exists
15039 set getprotobynumber_r d_getprotobynumber_r
15040 eval $inlibc
15041 case "$d_getprotobynumber_r" in
15042 "$define")
15043         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15044         case "$d_getprotobynumber_r_proto:$usethreads" in
15045         ":define")      d_getprotobynumber_r_proto=define
15046                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15047                 eval $hasproto ;;
15048         *)      ;;
15049         esac
15050         case "$d_getprotobynumber_r_proto" in
15051         define)
15052         case "$getprotobynumber_r_proto" in
15053         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15054         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15055         esac
15056         case "$getprotobynumber_r_proto" in
15057         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15058         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15059         esac
15060         case "$getprotobynumber_r_proto" in
15061         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15062         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15063         esac
15064         case "$getprotobynumber_r_proto" in
15065         ''|0)   d_getprotobynumber_r=undef
15066                 getprotobynumber_r_proto=0
15067                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15068         * )     case "$getprotobynumber_r_proto" in
15069                 REENTRANT_PROTO*) ;;
15070                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15071                 esac
15072                 echo "Prototype: $try" ;;
15073         esac
15074         ;;
15075         *)      case "$usethreads" in
15076                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15077                 esac
15078                 d_getprotobynumber_r=undef
15079                 getprotobynumber_r_proto=0
15080                 ;;
15081         esac
15082         ;;
15083 *)      getprotobynumber_r_proto=0
15084         ;;
15085 esac
15086
15087 : see if getprotoent_r exists
15088 set getprotoent_r d_getprotoent_r
15089 eval $inlibc
15090 case "$d_getprotoent_r" in
15091 "$define")
15092         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15093         case "$d_getprotoent_r_proto:$usethreads" in
15094         ":define")      d_getprotoent_r_proto=define
15095                 set d_getprotoent_r_proto getprotoent_r $hdrs
15096                 eval $hasproto ;;
15097         *)      ;;
15098         esac
15099         case "$d_getprotoent_r_proto" in
15100         define)
15101         case "$getprotoent_r_proto" in
15102         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15103         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15104         esac
15105         case "$getprotoent_r_proto" in
15106         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15107         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15108         esac
15109         case "$getprotoent_r_proto" in
15110         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15111         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15112         esac
15113         case "$getprotoent_r_proto" in
15114         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15115         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15116         esac
15117         case "$getprotoent_r_proto" in
15118         ''|0)   d_getprotoent_r=undef
15119                 getprotoent_r_proto=0
15120                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15121         * )     case "$getprotoent_r_proto" in
15122                 REENTRANT_PROTO*) ;;
15123                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15124                 esac
15125                 echo "Prototype: $try" ;;
15126         esac
15127         ;;
15128         *)      case "$usethreads" in
15129                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15130                 esac
15131                 d_getprotoent_r=undef
15132                 getprotoent_r_proto=0
15133                 ;;
15134         esac
15135         ;;
15136 *)      getprotoent_r_proto=0
15137         ;;
15138 esac
15139
15140 : see if prototypes for various getprotoxxx netdb.h functions are available
15141 echo " "
15142 set d_getprotoprotos getprotoent $i_netdb netdb.h
15143 eval $hasproto
15144
15145 : see if getprpwnam exists
15146 set getprpwnam d_getprpwnam
15147 eval $inlibc
15148
15149 : see if getpwent exists
15150 set getpwent d_getpwent
15151 eval $inlibc
15152
15153 : see if getpwent_r exists
15154 set getpwent_r d_getpwent_r
15155 eval $inlibc
15156 case "$d_getpwent_r" in
15157 "$define")
15158         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15159         case "$d_getpwent_r_proto:$usethreads" in
15160         ":define")      d_getpwent_r_proto=define
15161                 set d_getpwent_r_proto getpwent_r $hdrs
15162                 eval $hasproto ;;
15163         *)      ;;
15164         esac
15165         case "$d_getpwent_r_proto" in
15166         define)
15167         case "$getpwent_r_proto" in
15168         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15169         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15170         esac
15171         case "$getpwent_r_proto" in
15172         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15173         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15174         esac
15175         case "$getpwent_r_proto" in
15176         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15177         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15178         esac
15179         case "$getpwent_r_proto" in
15180         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15181         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15182         esac
15183         case "$getpwent_r_proto" in
15184         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15185         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15186         esac
15187         case "$getpwent_r_proto" in
15188         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15189         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15190         esac
15191         case "$getpwent_r_proto" in
15192         ''|0)   d_getpwent_r=undef
15193                 getpwent_r_proto=0
15194                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15195         * )     case "$getpwent_r_proto" in
15196                 REENTRANT_PROTO*) ;;
15197                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15198                 esac
15199                 echo "Prototype: $try" ;;
15200         esac
15201         ;;
15202         *)      case "$usethreads" in
15203                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15204                 esac
15205                 d_getpwent_r=undef
15206                 getpwent_r_proto=0
15207                 ;;
15208         esac
15209         ;;
15210 *)      getpwent_r_proto=0
15211         ;;
15212 esac
15213
15214 : see if getpwnam_r exists
15215 set getpwnam_r d_getpwnam_r
15216 eval $inlibc
15217 case "$d_getpwnam_r" in
15218 "$define")
15219         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15220         case "$d_getpwnam_r_proto:$usethreads" in
15221         ":define")      d_getpwnam_r_proto=define
15222                 set d_getpwnam_r_proto getpwnam_r $hdrs
15223                 eval $hasproto ;;
15224         *)      ;;
15225         esac
15226         case "$d_getpwnam_r_proto" in
15227         define)
15228         case "$getpwnam_r_proto" in
15229         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15230         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15231         esac
15232         case "$getpwnam_r_proto" in
15233         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15234         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15235         esac
15236         case "$getpwnam_r_proto" in
15237         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15238         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15239         esac
15240         case "$getpwnam_r_proto" in
15241         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15242         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15243         esac
15244         case "$getpwnam_r_proto" in
15245         ''|0)   d_getpwnam_r=undef
15246                 getpwnam_r_proto=0
15247                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15248         * )     case "$getpwnam_r_proto" in
15249                 REENTRANT_PROTO*) ;;
15250                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15251                 esac
15252                 echo "Prototype: $try" ;;
15253         esac
15254         ;;
15255         *)      case "$usethreads" in
15256                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15257                 esac
15258                 d_getpwnam_r=undef
15259                 getpwnam_r_proto=0
15260                 ;;
15261         esac
15262         ;;
15263 *)      getpwnam_r_proto=0
15264         ;;
15265 esac
15266
15267 : see if getpwuid_r exists
15268 set getpwuid_r d_getpwuid_r
15269 eval $inlibc
15270 case "$d_getpwuid_r" in
15271 "$define")
15272         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15273         case "$d_getpwuid_r_proto:$usethreads" in
15274         ":define")      d_getpwuid_r_proto=define
15275                 set d_getpwuid_r_proto getpwuid_r $hdrs
15276                 eval $hasproto ;;
15277         *)      ;;
15278         esac
15279         case "$d_getpwuid_r_proto" in
15280         define)
15281         case "$getpwuid_r_proto" in
15282         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15283         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15284         esac
15285         case "$getpwuid_r_proto" in
15286         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15287         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15288         esac
15289         case "$getpwuid_r_proto" in
15290         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15291         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15292         esac
15293         case "$getpwuid_r_proto" in
15294         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15295         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15296         esac
15297         case "$getpwuid_r_proto" in
15298         ''|0)   d_getpwuid_r=undef
15299                 getpwuid_r_proto=0
15300                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15301         * )     case "$getpwuid_r_proto" in
15302                 REENTRANT_PROTO*) ;;
15303                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15304                 esac
15305                 echo "Prototype: $try" ;;
15306         esac
15307         ;;
15308         *)      case "$usethreads" in
15309                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15310                 esac
15311                 d_getpwuid_r=undef
15312                 getpwuid_r_proto=0
15313                 ;;
15314         esac
15315         ;;
15316 *)      getpwuid_r_proto=0
15317         ;;
15318 esac
15319
15320 : Optional checks for getsbyname and getsbyport
15321
15322 : see if getservbyname exists
15323 set getservbyname d_getsbyname
15324 eval $inlibc
15325
15326 : see if getservbyport exists
15327 set getservbyport d_getsbyport
15328 eval $inlibc
15329
15330 : see if getservent exists
15331 set getservent d_getsent
15332 eval $inlibc
15333
15334 : see if getservbyname_r exists
15335 set getservbyname_r d_getservbyname_r
15336 eval $inlibc
15337 case "$d_getservbyname_r" in
15338 "$define")
15339         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15340         case "$d_getservbyname_r_proto:$usethreads" in
15341         ":define")      d_getservbyname_r_proto=define
15342                 set d_getservbyname_r_proto getservbyname_r $hdrs
15343                 eval $hasproto ;;
15344         *)      ;;
15345         esac
15346         case "$d_getservbyname_r_proto" in
15347         define)
15348         case "$getservbyname_r_proto" in
15349         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15350         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15351         esac
15352         case "$getservbyname_r_proto" in
15353         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15354         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15355         esac
15356         case "$getservbyname_r_proto" in
15357         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15358         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15359         esac
15360         case "$getservbyname_r_proto" in
15361         ''|0)   d_getservbyname_r=undef
15362                 getservbyname_r_proto=0
15363                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15364         * )     case "$getservbyname_r_proto" in
15365                 REENTRANT_PROTO*) ;;
15366                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15367                 esac
15368                 echo "Prototype: $try" ;;
15369         esac
15370         ;;
15371         *)      case "$usethreads" in
15372                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15373                 esac
15374                 d_getservbyname_r=undef
15375                 getservbyname_r_proto=0
15376                 ;;
15377         esac
15378         ;;
15379 *)      getservbyname_r_proto=0
15380         ;;
15381 esac
15382
15383 : see if getservbyport_r exists
15384 set getservbyport_r d_getservbyport_r
15385 eval $inlibc
15386 case "$d_getservbyport_r" in
15387 "$define")
15388         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15389         case "$d_getservbyport_r_proto:$usethreads" in
15390         ":define")      d_getservbyport_r_proto=define
15391                 set d_getservbyport_r_proto getservbyport_r $hdrs
15392                 eval $hasproto ;;
15393         *)      ;;
15394         esac
15395         case "$d_getservbyport_r_proto" in
15396         define)
15397         case "$getservbyport_r_proto" in
15398         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15399         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15400         esac
15401         case "$getservbyport_r_proto" in
15402         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15403         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15404         esac
15405         case "$getservbyport_r_proto" in
15406         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15407         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15408         esac
15409         case "$getservbyport_r_proto" in
15410         ''|0)   d_getservbyport_r=undef
15411                 getservbyport_r_proto=0
15412                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15413         * )     case "$getservbyport_r_proto" in
15414                 REENTRANT_PROTO*) ;;
15415                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15416                 esac
15417                 echo "Prototype: $try" ;;
15418         esac
15419         ;;
15420         *)      case "$usethreads" in
15421                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15422                 esac
15423                 d_getservbyport_r=undef
15424                 getservbyport_r_proto=0
15425                 ;;
15426         esac
15427         ;;
15428 *)      getservbyport_r_proto=0
15429         ;;
15430 esac
15431
15432 : see if getservent_r exists
15433 set getservent_r d_getservent_r
15434 eval $inlibc
15435 case "$d_getservent_r" in
15436 "$define")
15437         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15438         case "$d_getservent_r_proto:$usethreads" in
15439         ":define")      d_getservent_r_proto=define
15440                 set d_getservent_r_proto getservent_r $hdrs
15441                 eval $hasproto ;;
15442         *)      ;;
15443         esac
15444         case "$d_getservent_r_proto" in
15445         define)
15446         case "$getservent_r_proto" in
15447         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15448         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15449         esac
15450         case "$getservent_r_proto" in
15451         ''|0) try='int getservent_r(struct servent*, char*, int);'
15452         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15453         esac
15454         case "$getservent_r_proto" in
15455         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15456         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15457         esac
15458         case "$getservent_r_proto" in
15459         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15460         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15461         esac
15462         case "$getservent_r_proto" in
15463         ''|0)   d_getservent_r=undef
15464                 getservent_r_proto=0
15465                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15466         * )     case "$getservent_r_proto" in
15467                 REENTRANT_PROTO*) ;;
15468                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15469                 esac
15470                 echo "Prototype: $try" ;;
15471         esac
15472         ;;
15473         *)      case "$usethreads" in
15474                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15475                 esac
15476                 d_getservent_r=undef
15477                 getservent_r_proto=0
15478                 ;;
15479         esac
15480         ;;
15481 *)      getservent_r_proto=0
15482         ;;
15483 esac
15484
15485 : see if prototypes for various getservxxx netdb.h functions are available
15486 echo " "
15487 set d_getservprotos getservent $i_netdb netdb.h
15488 eval $hasproto
15489
15490 : see if getspnam exists
15491 set getspnam d_getspnam
15492 eval $inlibc
15493
15494 : see if this is a shadow.h system
15495 set shadow.h i_shadow
15496 eval $inhdr
15497
15498 : see if getspnam_r exists
15499 set getspnam_r d_getspnam_r
15500 eval $inlibc
15501 case "$d_getspnam_r" in
15502 "$define")
15503         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15504         case "$d_getspnam_r_proto:$usethreads" in
15505         ":define")      d_getspnam_r_proto=define
15506                 set d_getspnam_r_proto getspnam_r $hdrs
15507                 eval $hasproto ;;
15508         *)      ;;
15509         esac
15510         case "$d_getspnam_r_proto" in
15511         define)
15512         case "$getspnam_r_proto" in
15513         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15514         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15515         esac
15516         case "$getspnam_r_proto" in
15517         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15518         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15519         esac
15520         case "$getspnam_r_proto" in
15521         ''|0)   d_getspnam_r=undef
15522                 getspnam_r_proto=0
15523                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15524         * )     case "$getspnam_r_proto" in
15525                 REENTRANT_PROTO*) ;;
15526                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15527                 esac
15528                 echo "Prototype: $try" ;;
15529         esac
15530         ;;
15531         *)      case "$usethreads" in
15532                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15533                 esac
15534                 d_getspnam_r=undef
15535                 getspnam_r_proto=0
15536                 ;;
15537         esac
15538         ;;
15539 *)      getspnam_r_proto=0
15540         ;;
15541 esac
15542
15543 : see if gettimeofday or ftime exists
15544 set gettimeofday d_gettimeod
15545 eval $inlibc
15546 case "$d_gettimeod" in
15547 "$undef")
15548         set ftime d_ftime 
15549         eval $inlibc
15550         ;;
15551 *)
15552         val="$undef"; set d_ftime; eval $setvar
15553         ;;
15554 esac
15555 case "$d_gettimeod$d_ftime" in
15556 "$undef$undef")
15557         echo " "
15558         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15559         ;;
15560 esac
15561
15562 : see if gmtime_r exists
15563 set gmtime_r d_gmtime_r
15564 eval $inlibc
15565 case "$d_gmtime_r" in
15566 "$define")
15567         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15568         case "$d_gmtime_r_proto:$usethreads" in
15569         ":define")      d_gmtime_r_proto=define
15570                 set d_gmtime_r_proto gmtime_r $hdrs
15571                 eval $hasproto ;;
15572         *)      ;;
15573         esac
15574         case "$d_gmtime_r_proto" in
15575         define)
15576         case "$gmtime_r_proto" in
15577         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15578         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15579         esac
15580         case "$gmtime_r_proto" in
15581         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15582         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15583         esac
15584         case "$gmtime_r_proto" in
15585         ''|0)   d_gmtime_r=undef
15586                 gmtime_r_proto=0
15587                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15588         * )     case "$gmtime_r_proto" in
15589                 REENTRANT_PROTO*) ;;
15590                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15591                 esac
15592                 echo "Prototype: $try" ;;
15593         esac
15594         ;;
15595         *)      case "$usethreads" in
15596                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15597                 esac
15598                 d_gmtime_r=undef
15599                 gmtime_r_proto=0
15600                 ;;
15601         esac
15602         ;;
15603 *)      gmtime_r_proto=0
15604         ;;
15605 esac
15606
15607 : see if hasmntopt exists
15608 set hasmntopt d_hasmntopt
15609 eval $inlibc
15610
15611 : see if this is a netinet/in.h or sys/in.h system
15612 set netinet/in.h i_niin sys/in.h i_sysin
15613 eval $inhdr
15614
15615 : see if arpa/inet.h has to be included
15616 set arpa/inet.h i_arpainet
15617 eval $inhdr
15618
15619 : see if htonl --and friends-- exists
15620 val=''
15621 set htonl val
15622 eval $inlibc
15623
15624 : Maybe they are macros.
15625 case "$val" in
15626 $undef)
15627         $cat >htonl.c <<EOM
15628 #include <stdio.h>
15629 #include <sys/types.h>
15630 #$i_niin I_NETINET_IN
15631 #$i_sysin I_SYS_IN
15632 #$i_arpainet I_ARPA_INET
15633 #ifdef I_NETINET_IN
15634 #include <netinet/in.h>
15635 #endif
15636 #ifdef I_SYS_IN
15637 #include <sys/in.h>
15638 #endif
15639 #ifdef I_ARPA_INET
15640 #include <arpa/inet.h>
15641 #endif
15642 #ifdef htonl
15643 printf("Defined as a macro.");
15644 #endif
15645 EOM
15646         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15647         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15648                 val="$define"
15649                 echo "But it seems to be defined as a macro." >&4
15650         fi
15651         $rm -f htonl.?
15652         ;;
15653 esac
15654 set d_htonl
15655 eval $setvar
15656
15657 : see if hypot exists
15658 set hypot d_hypot
15659 eval $inlibc
15660
15661 : see if ilogb exists
15662 set ilogb d_ilogb
15663 eval $inlibc
15664
15665 : see if ilogbl exists
15666 set ilogbl d_ilogbl
15667 eval $inlibc
15668
15669 : check whether inet_aton exists
15670 set inet_aton d_inetaton
15671 eval $inlibc
15672
15673 : see if inet_ntop exists
15674 set inet_ntop d_inetntop
15675 eval $inlibc
15676
15677 : see if inet_pton exists
15678 set inet_pton d_inetpton
15679 eval $inlibc
15680
15681 : Look for isascii
15682 echo " "
15683 $cat >isascii.c <<EOCP
15684 #include <stdio.h>
15685 #include <ctype.h>
15686 #$i_stdlib I_STDLIB
15687 #ifdef I_STDLIB
15688 #include <stdlib.h>
15689 #endif
15690 int main() {
15691         int c = 'A';
15692         if (isascii(c))
15693                 exit(0);
15694         else
15695                 exit(1);
15696 }
15697 EOCP
15698 set isascii
15699 if eval $compile; then
15700         echo "isascii() found." >&4
15701         val="$define"
15702 else
15703         echo "isascii() NOT found." >&4
15704         val="$undef"
15705 fi
15706 set d_isascii
15707 eval $setvar
15708 $rm -f isascii*
15709
15710 : Look for isblank
15711 echo " "
15712 $cat >isblank.c <<'EOCP'
15713 #include <stdio.h>
15714 #include <ctype.h>
15715 int main() {
15716         int c = ' ';
15717         if (isblank(c))
15718                 return 0 ;
15719         else
15720                 return 1 ;
15721 }
15722 EOCP
15723 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15724         echo "isblank() found." >&4
15725         val="$define"
15726 else
15727         echo "isblank() NOT found." >&4
15728         val="$undef"
15729 fi
15730 set d_isblank
15731 eval $setvar
15732 $rm -f isblank*
15733
15734 : check for isfinite
15735 echo "Checking to see if you have isfinite..." >&4
15736 $cat >try.c <<EOCP
15737 #include <math.h>
15738 int main() { return isfinite(0.0); }
15739 EOCP
15740 set try
15741 if eval $compile; then
15742         val="$define"
15743         echo "You have isfinite."
15744 else
15745         val="$undef"
15746         echo "You do not have isfinite."
15747 fi
15748 $rm_try
15749 set d_isfinite
15750 eval $setvar
15751
15752 : see if isfinitel exists
15753 set isfinitel d_isfinitel
15754 eval $inlibc
15755
15756 : check for isinf
15757 echo "Checking to see if you have isinf..." >&4
15758 $cat >try.c <<EOCP
15759 #include <math.h>
15760 int main() { return isinf(0.0); }
15761 EOCP
15762 set try
15763 if eval $compile; then
15764         val="$define"
15765         echo "You have isinf."
15766 else
15767         val="$undef"
15768         echo "You do not have isinf."
15769 fi
15770 $rm_try
15771 set d_isinf
15772 eval $setvar
15773
15774 : see if isinfl exists
15775 set isinfl d_isinfl
15776 eval $inlibc
15777
15778 : check for isless
15779 echo "Checking to see if you have isless..." >&4
15780 $cat >try.c <<EOCP
15781 #include <math.h>
15782 int main() { return isless(0.0); }
15783 EOCP
15784 set try
15785 if eval $compile; then
15786         val="$define"
15787         echo "You have isless."
15788 else
15789         val="$undef"
15790         echo "You do not have isless."
15791 fi
15792 $rm_try
15793 set d_isless
15794 eval $setvar
15795
15796 : check for isnan
15797 echo "Checking to see if you have isnan..." >&4
15798 $cat >try.c <<EOCP
15799 #include <math.h>
15800 int main() { return isnan(0.0); }
15801 EOCP
15802 set try
15803 if eval $compile; then
15804         val="$define"
15805         echo "You have isnan."
15806 else
15807         val="$undef"
15808         echo "You do not have isnan."
15809 fi
15810 $rm_try
15811 set d_isnan
15812 eval $setvar
15813
15814 : see if isnanl exists
15815 set isnanl d_isnanl
15816 eval $inlibc
15817
15818 : check for isnormal
15819 echo "Checking to see if you have isnormal..." >&4
15820 $cat >try.c <<EOCP
15821 #include <math.h>
15822 int main() { return isnormal(0.0); }
15823 EOCP
15824 set try
15825 if eval $compile; then
15826         val="$define"
15827         echo "You have isnormal."
15828 else
15829         val="$undef"
15830         echo "You do not have isnormal."
15831 fi
15832 $rm_try
15833 set d_isnormal
15834 eval $setvar
15835
15836 : see if j0 exists
15837 set j0 d_j0
15838 eval $inlibc
15839
15840 : see if j0l exists
15841 set j0l d_j0l
15842 eval $inlibc
15843
15844 : see if killpg exists
15845 set killpg d_killpg
15846 eval $inlibc
15847
15848 : see if localeconv exists
15849 set localeconv d_locconv
15850 eval $inlibc
15851
15852 : see if libc has the POSIX.1-2008 currency locale rules
15853 case "$d_locconv:$d_lc_monetary_2008" in
15854 $define:)
15855         $cat >try.c <<EOCP
15856 #include <locale.h>
15857 int main() {
15858         struct lconv *lc = localeconv();
15859         char int_p_cs_precedes = lc->int_p_cs_precedes;
15860         return 0;
15861 }
15862 EOCP
15863         set try
15864         if eval $compile; then
15865                 d_lc_monetary_2008="$define"
15866         else
15867                 d_lc_monetary_2008="$undef"
15868         fi;
15869         $rm_try
15870         ;;
15871 esac
15872
15873 : see if lchown exists
15874 echo " "
15875 $cat > try.c <<'EOCP'
15876 /* System header to define __stub macros and hopefully few prototypes,
15877     which can conflict with char lchown(); below.  */
15878 #include <assert.h>
15879 /* Override any gcc2 internal prototype to avoid an error.  */
15880 /* We use char because int might match the return type of a gcc2
15881    builtin and then its argument prototype would still apply.  */
15882 char lchown();
15883 int main() {
15884     /*  The GNU C library defines this for functions which it implements
15885         to always fail with ENOSYS.  Some functions are actually named
15886         something starting with __ and the normal name is an alias.  */
15887 #if defined (__stub_lchown) || defined (__stub___lchown)
15888 choke me
15889 #else
15890 lchown();
15891 #endif
15892 ; return 0; }
15893 EOCP
15894 set try
15895 if eval $compile; then
15896     $echo "lchown() found." >&4
15897     val="$define"
15898 else
15899     $echo "lchown() NOT found." >&4
15900     val="$undef"
15901 fi
15902 set d_lchown
15903 eval $setvar
15904
15905 : See if number of significant digits in a double precision number is known
15906 echo " "
15907 $cat >ldbl_dig.c <<EOM
15908 #include <limits.h>
15909 #include <float.h>
15910 #ifdef LDBL_DIG
15911 printf("Contains LDBL_DIG");
15912 #endif
15913 EOM
15914 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15915 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15916         echo "LDBL_DIG found." >&4
15917         val="$define"
15918 else
15919         echo "LDBL_DIG NOT found." >&4
15920         val="$undef"
15921 fi
15922 $rm -f ldbl_dig.?
15923 set d_ldbl_dig
15924 eval $setvar
15925
15926 : see if lgamma exists
15927 set lgamma d_lgamma
15928 eval $inlibc
15929
15930 : see if lgamma_r exists
15931 set lgamma_r d_lgamma_r
15932 eval $inlibc
15933
15934 : check to see if math.h defines _LIB_VERSION
15935 d_libm_lib_version="$undef"
15936 echo " "
15937 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15938 $cat >try.c <<EOCP
15939 #include <unistd.h>
15940 #include <math.h>
15941 int main (int argc, char *argv[])
15942 {
15943     printf ("%d\n", _LIB_VERSION);
15944     return (0);
15945     } /* main */
15946 EOCP
15947 set try
15948 if eval $compile; then
15949     foo=`$run ./try`
15950     echo "Yes, it does ($foo)" >&4
15951     d_libm_lib_version="$define"
15952 else
15953     echo "No, it does not (probably harmless)" >&4
15954     fi
15955 $rm_try
15956
15957 : see if link exists
15958 set link d_link
15959 eval $inlibc
15960
15961 : see if llrint exists
15962 set llrint d_llrint
15963 eval $inlibc
15964
15965 : see if llrintl exists
15966 set llrintl d_llrintl
15967 eval $inlibc
15968
15969 : see if llround exists
15970 set llround d_llround
15971 eval $inlibc
15972
15973 : see if llroundl exists
15974 set llroundl d_llroundl
15975 eval $inlibc
15976
15977 : see if localeconv_l exists
15978 set localeconv_l d_localeconv_l
15979 eval $inlibc
15980
15981 : see if localtime_r exists
15982 set localtime_r d_localtime_r
15983 eval $inlibc
15984 case "$d_localtime_r" in
15985 "$define")
15986         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15987         case "$d_localtime_r_proto:$usethreads" in
15988         ":define")      d_localtime_r_proto=define
15989                 set d_localtime_r_proto localtime_r $hdrs
15990                 eval $hasproto ;;
15991         *)      ;;
15992         esac
15993         case "$d_localtime_r_proto" in
15994         define)
15995         case "$localtime_r_proto" in
15996         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15997         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15998         esac
15999         case "$localtime_r_proto" in
16000         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16001         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16002         esac
16003         case "$localtime_r_proto" in
16004         ''|0)   d_localtime_r=undef
16005                 localtime_r_proto=0
16006                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16007         * )     case "$localtime_r_proto" in
16008                 REENTRANT_PROTO*) ;;
16009                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16010                 esac
16011                 echo "Prototype: $try" ;;
16012         esac
16013         ;;
16014         *)      case "$usethreads" in
16015                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16016                 esac
16017                 d_localtime_r=undef
16018                 localtime_r_proto=0
16019                 ;;
16020         esac
16021         ;;
16022 *)      localtime_r_proto=0
16023         ;;
16024 esac
16025
16026 : see if localtime_r calls tzset
16027 case "$localtime_r_proto" in
16028 REENTRANT_PROTO*)
16029         $cat >try.c <<EOCP
16030 /*  Does our libc's localtime_r call tzset ?
16031  *  return 0 if so, 1 otherwise.
16032  */
16033 #$i_systypes    I_SYS_TYPES
16034 #$i_unistd      I_UNISTD
16035 #$i_time        I_TIME
16036 #$i_stdlib      I_STDLIB
16037 #$i_malloc      I_MALLOC
16038 #ifdef I_SYS_TYPES
16039 #  include <sys/types.h>
16040 #endif
16041 #ifdef I_UNISTD
16042 #  include <unistd.h>
16043 #endif
16044 #ifdef I_TIME
16045 #  include <time.h>
16046 #endif
16047 #ifdef I_STDLIB
16048 #include <stdlib.h>
16049 #endif
16050 #include <string.h>
16051 #ifdef I_MALLOC
16052 #  include <malloc.h>
16053 #endif
16054 int main()
16055 {
16056     time_t t = time(0L);
16057     char w_tz[]="TZ" "=GMT+5",
16058          e_tz[]="TZ" "=GMT-5",
16059         *tz_e = (char*)malloc(16),
16060         *tz_w = (char*)malloc(16);
16061     struct tm tm_e, tm_w;
16062     memset(&tm_e,'\0',sizeof(struct tm));
16063     memset(&tm_w,'\0',sizeof(struct tm));
16064     strcpy(tz_e,e_tz);
16065     strcpy(tz_w,w_tz);
16066
16067     putenv(tz_e);
16068     localtime_r(&t, &tm_e);
16069
16070     putenv(tz_w);
16071     localtime_r(&t, &tm_w);
16072
16073     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16074         return 1;
16075     return 0;
16076 }
16077 EOCP
16078         set try
16079         if eval $compile; then
16080             if $run ./try; then
16081                 d_localtime_r_needs_tzset=undef;
16082             else
16083                 d_localtime_r_needs_tzset=define;
16084             fi;
16085         else
16086             d_localtime_r_needs_tzset=undef;
16087         fi;
16088      ;;
16089   *)
16090      d_localtime_r_needs_tzset=undef;
16091      ;;
16092 esac
16093 $rm_try
16094
16095 : see if lockf exists
16096 set lockf d_lockf
16097 eval $inlibc
16098
16099 : see if log1p exists
16100 set log1p d_log1p
16101 eval $inlibc
16102
16103 : see if log2 exists
16104 set log2 d_log2
16105 eval $inlibc
16106
16107 : see if logb exists
16108 set logb d_logb
16109 eval $inlibc
16110
16111 : see if lrint exists
16112 set lrint d_lrint
16113 eval $inlibc
16114
16115 : see if lrintl exists
16116 set lrintl d_lrintl
16117 eval $inlibc
16118
16119 : see if lround exists
16120 set lround d_lround
16121 eval $inlibc
16122
16123 : see if lroundl exists
16124 set lroundl d_lroundl
16125 eval $inlibc
16126
16127 : see if prototype for lseek is available
16128 echo " "
16129 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16130 eval $hasproto
16131
16132 : see if lstat exists
16133 set lstat d_lstat
16134 eval $inlibc
16135
16136 : see if madvise exists
16137 set madvise d_madvise
16138 eval $inlibc
16139
16140 : see if malloc_size exists
16141 set malloc_size d_malloc_size
16142 eval $inlibc
16143
16144 : see if malloc_size_good exists
16145 set malloc_good_size d_malloc_good_size
16146 eval $inlibc
16147
16148 : see if mblen exists
16149 set mblen d_mblen
16150 eval $inlibc
16151
16152 : see if mbrlen exists
16153 set mbrlen d_mbrlen
16154 eval $inlibc
16155
16156 : see if mbrtowc exists
16157 set mbrtowc d_mbrtowc
16158 eval $inlibc
16159
16160 : see if mbstowcs exists
16161 set mbstowcs d_mbstowcs
16162 eval $inlibc
16163
16164 : see if mbtowc exists
16165 set mbtowc d_mbtowc
16166 eval $inlibc
16167
16168 : see if memmem exists
16169 set memmem d_memmem
16170 eval $inlibc
16171
16172 : see if memrchr exists
16173 set memrchr d_memrchr
16174 eval $inlibc
16175
16176 : see if mkdir exists
16177 set mkdir d_mkdir
16178 eval $inlibc
16179
16180 : see if mkdtemp exists
16181 set mkdtemp d_mkdtemp
16182 eval $inlibc
16183
16184 : see if mkfifo exists
16185 set mkfifo d_mkfifo
16186 eval $inlibc
16187
16188 : see if mkostemp exists
16189 set mkostemp d_mkostemp
16190 eval $inlibc
16191
16192 : see if mkstemp exists
16193 set mkstemp d_mkstemp
16194 eval $inlibc
16195
16196 : see if mkstemps exists
16197 set mkstemps d_mkstemps
16198 eval $inlibc
16199
16200 : see if mktime exists
16201 set mktime d_mktime
16202 eval $inlibc
16203
16204 : see if sys/mman.h has to be included
16205 set sys/mman.h i_sysmman
16206 eval $inhdr
16207
16208 : see if mmap exists
16209 set mmap d_mmap
16210 eval $inlibc
16211 : see what shmat returns
16212 : default to something harmless
16213 mmaptype='void *'
16214 case "$i_sysmman$d_mmap" in
16215 "$define$define")
16216         $cat >mmap.c <<'END'
16217 #include <sys/mman.h>
16218 void *mmap();
16219 END
16220         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16221                 mmaptype='void *'
16222         else
16223                 mmaptype='caddr_t'
16224         fi
16225         echo "and it returns ($mmaptype)." >&4
16226         ;;
16227 esac
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 : see if msync exists
16359 set msync d_msync
16360 eval $inlibc
16361
16362 : see if munmap exists
16363 set munmap d_munmap
16364 eval $inlibc
16365
16366 : see if nan exists
16367 set nan d_nan
16368 eval $inlibc
16369
16370 : see if nanosleep exists
16371 set nanosleep d_nanosleep
16372 eval $inlibc
16373
16374 : see if nearbyint exists
16375 set nearbyint d_nearbyint
16376 eval $inlibc
16377
16378 : see if nextafter exists
16379 set nextafter d_nextafter
16380 eval $inlibc
16381
16382 : see if nexttoward exists
16383 set nexttoward d_nexttoward
16384 eval $inlibc
16385
16386 : see if nice exists
16387 set nice d_nice
16388 eval $inlibc
16389
16390 : see if this is a langinfo.h system
16391 set langinfo.h i_langinfo
16392 eval $inhdr
16393
16394 : see if nl_langinfo exists
16395 set nl_langinfo d_nl_langinfo
16396 eval $inlibc
16397
16398 : see if this is a quadmath.h system
16399 set quadmath.h i_quadmath
16400 eval $inhdr
16401
16402 : Check basic sizes
16403 echo " "
16404 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16405
16406 case "$use64bitint:$d_quad:$quadtype" in
16407 define:define:?*)
16408         ivtype="$quadtype"
16409         uvtype="$uquadtype"
16410         ivsize=8
16411         uvsize=8
16412         ;;
16413 *)      ivtype="long"
16414         uvtype="unsigned long"
16415         ivsize=$longsize
16416         uvsize=$longsize
16417         ;;
16418 esac
16419
16420 case "$uselongdouble:$d_longdbl" in
16421 define:define)
16422         nvtype="long double"
16423         nvsize=$longdblsize
16424         ;;
16425 *)      nvtype=double
16426         nvsize=$doublesize
16427         ;;
16428 esac
16429
16430 case "$usequadmath:$i_quadmath" in
16431 define:define)
16432   nvtype="__float128"
16433   nvsize=16
16434   case "$libs" in
16435   *quadmath*) ;;
16436   *) $cat <<EOM >&4
16437
16438 *** You requested the use of the quadmath library, but you
16439 *** do not seem to have the quadmath library installed.
16440 *** Cannot continue, aborting.
16441 EOM
16442     exit 1
16443     ;;
16444   esac
16445   ;;
16446 define:*) $cat <<EOM >&4
16447
16448 *** You requested the use of the quadmath library, but you
16449 *** do not seem to have the required header, <quadmath.h>.
16450 EOM
16451   case "$gccversion" in
16452   [23].*|4.[0-5]*)
16453    $cat <<EOM >&4
16454 *** Your gcc looks a bit old:
16455 *** $gccversion
16456 EOM
16457     ;;
16458   '')
16459    $cat <<EOM >&4
16460 *** You are not running a gcc.
16461 EOM
16462     ;;
16463   esac
16464   $cat <<EOM >&4
16465 *** For the quadmath library you need at least gcc 4.6.
16466 *** Cannot continue, aborting.
16467 EOM
16468   exit 1
16469   ;;
16470 esac
16471
16472 $echo "(IV will be "$ivtype", $ivsize bytes)"
16473 $echo "(UV will be "$uvtype", $uvsize bytes)"
16474 $echo "(NV will be "$nvtype", $nvsize bytes)"
16475
16476 $cat >try.c <<EOCP
16477 #$i_inttypes I_INTTYPES
16478 #ifdef I_INTTYPES
16479 #include <inttypes.h>
16480 #endif
16481 #include <stdio.h>
16482 int main() {
16483 #ifdef INT8
16484    int8_t i =  INT8_MAX;
16485   uint8_t u = UINT8_MAX;
16486   printf("int8_t\n");
16487 #endif
16488 #ifdef INT16
16489    int16_t i =  INT16_MAX;
16490   uint16_t u = UINT16_MAX;
16491   printf("int16_t\n");
16492 #endif
16493 #ifdef INT32
16494    int32_t i =  INT32_MAX;
16495   uint32_t u = UINT32_MAX;
16496   printf("int32_t\n");
16497 #endif
16498 }
16499 EOCP
16500
16501 i8type="signed char"
16502 u8type="unsigned char"
16503 i8size=1
16504 u8size=1
16505
16506 case "$i16type" in
16507 '')     case "$shortsize" in
16508         2)      i16type=short
16509                 u16type="unsigned short"
16510                 i16size=$shortsize
16511                 u16size=$shortsize
16512                 ;;
16513         esac
16514         ;;
16515 esac
16516 case "$i16type" in
16517 '')     set try -DINT16
16518         if eval $compile; then
16519                 case "`$run ./try`" in
16520                 int16_t)
16521                         i16type=int16_t
16522                         u16type=uint16_t
16523                         i16size=2
16524                         u16size=2
16525                         ;;
16526                 esac
16527         fi
16528         ;;
16529 esac
16530 case "$i16type" in
16531 '')     if $test $shortsize -ge 2; then
16532                 i16type=short
16533                 u16type="unsigned short"
16534                 i16size=$shortsize
16535                 u16size=$shortsize
16536         fi
16537         ;;
16538 esac
16539
16540 case "$i32type" in
16541 '')     case "$longsize" in
16542         4)      i32type=long
16543                 u32type="unsigned long"
16544                 i32size=$longsize
16545                 u32size=$longsize
16546                 ;;
16547         *)      case "$intsize" in
16548                 4)      i32type=int
16549                         u32type="unsigned int"
16550                         i32size=$intsize
16551                         u32size=$intsize
16552                         ;;
16553                 esac
16554                 ;;
16555         esac
16556         ;;
16557 esac
16558 case "$i32type" in
16559 '')     set try -DINT32
16560         if eval $compile; then
16561                 case "`$run ./try`" in
16562                 int32_t)
16563                         i32type=int32_t
16564                         u32type=uint32_t
16565                         i32size=4
16566                         u32size=4
16567                         ;;
16568                 esac
16569         fi
16570         ;;
16571 esac
16572 case "$i32type" in
16573 '')     if $test $intsize -ge 4; then
16574                 i32type=int
16575                 u32type="unsigned int"
16576                 i32size=$intsize
16577                 u32size=$intsize
16578         fi
16579         ;;
16580 esac
16581
16582 case "$i64type" in
16583 '')     case "$d_quad:$quadtype" in
16584         define:?*)
16585                 i64type="$quadtype"
16586                 u64type="$uquadtype"
16587                 i64size=8
16588                 u64size=8
16589                 ;;
16590         esac
16591         ;;
16592 esac
16593
16594 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16595 $cat <<EOP >try.c
16596 #include <stdio.h>
16597 #$i_stdlib I_STDLIB
16598 #ifdef I_STDLIB
16599 #include <stdlib.h>
16600 #endif
16601 #include <sys/types.h>
16602 #include <signal.h>
16603 #ifdef SIGFPE
16604 /* volatile so that the compiler has to store it out to memory */
16605 volatile int bletched = 0;
16606 $signal_t blech(int s) { bletched = 1; }
16607 #endif
16608 int main() {
16609     $uvtype u = 0;
16610     $nvtype d;
16611     int     n = 8 * $uvsize;
16612     int     i;
16613 #ifdef SIGFPE
16614     signal(SIGFPE, blech);
16615 #endif
16616
16617     for (i = 0; i < n; i++) {
16618       u = u << 1 | ($uvtype)1;
16619       d = ($nvtype)u;
16620       if (($uvtype)d != u)
16621         break;
16622       if (d <= 0)
16623         break;
16624       d = ($nvtype)(u - 1);
16625       if (($uvtype)d != (u - 1))
16626         break;
16627 #ifdef SIGFPE
16628       if (bletched)
16629         break;
16630 #endif
16631     }
16632     printf("%d\n", ((i == n) ? -n : i));
16633     exit(0);
16634 }
16635 EOP
16636 set try
16637
16638 d_nv_preserves_uv="$undef"
16639 if eval $compile; then
16640         nv_preserves_uv_bits="`$run ./try`"
16641 fi
16642 case "$nv_preserves_uv_bits" in
16643 \-[1-9]*)
16644         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16645         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16646         d_nv_preserves_uv="$define"
16647         ;;
16648 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16649         d_nv_preserves_uv="$undef" ;;
16650 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16651         nv_preserves_uv_bits="0" ;;
16652 esac
16653 $rm_try
16654
16655 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16656 $cat <<EOP >try.c
16657 #include <stdio.h>
16658
16659 typedef $nvtype NV;
16660
16661 int
16662 main() {
16663   NV value = 2;
16664   int count = 1;
16665
16666   while(count < 256) {
16667     /* volatile so that the compiler has to store it out to memory */
16668     volatile NV up = value + 1.0;
16669     volatile NV negated = -value;
16670     volatile NV down = negated - 1.0;
16671     volatile NV got_up = up - value;
16672     int up_good = got_up == 1.0;
16673     int got_down = down - negated;
16674     int down_good = got_down == -1.0;
16675
16676     if (down_good != up_good) {
16677       fprintf(stderr,
16678               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16679               up_good, (double) got_up, down_good, (double) got_down,
16680               count, (double) value);
16681       return 1;
16682     }
16683     if (!up_good) {
16684       while (1) {
16685         if (count > 8) {
16686           count -= 8;
16687           fputs("256.0", stdout);
16688         } else {
16689           count--;
16690           fputs("2.0", stdout);
16691         }
16692         if (!count) {
16693           puts("");
16694           return 0;
16695         }
16696         fputs("*", stdout);
16697       }
16698     }
16699     value *= 2;
16700     ++count;
16701   }
16702   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16703           count, (double) value);
16704   return 1;
16705 }
16706 EOP
16707 set try
16708
16709 nv_overflows_integers_at='0'
16710 if eval $compile; then
16711     xxx="`$run ./try`"
16712     case "$?" in
16713         0)
16714             case "$xxx" in
16715                 2*)  cat >&4 <<EOM
16716 The largest integer your NVs can preserve is equal to $xxx
16717 EOM
16718                     nv_overflows_integers_at="$xxx"
16719                     ;;
16720                 *)  cat >&4 <<EOM
16721 Cannot determine the largest integer value your NVs can hold, unexpected output
16722 '$xxx'
16723 EOM
16724                     ;;
16725             esac
16726             ;;
16727         *)  cat >&4 <<EOM
16728 Cannot determine the largest integer value your NVs can hold
16729 EOM
16730             ;;
16731     esac
16732 fi
16733 $rm_try
16734
16735 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16736 $cat <<EOP >try.c
16737 #include <stdio.h>
16738 #$i_stdlib I_STDLIB
16739 #ifdef I_STDLIB
16740 #include <stdlib.h>
16741 #endif
16742 #include <string.h>
16743 #include <sys/types.h>
16744 #include <signal.h>
16745 #ifdef SIGFPE
16746 /* volatile so that the compiler has to store it out to memory */
16747 volatile int bletched = 0;
16748 $signal_t blech(int s) { bletched = 1; }
16749 #endif
16750
16751 int checkit($nvtype d, const char *where) {
16752     void *v = &d;
16753     unsigned char *p = (unsigned char *)v;
16754     unsigned char *end = p + sizeof(d);
16755     int fail = 0;
16756
16757     while (p < end)
16758         fail += *p++;
16759
16760     if (!fail)
16761         return 0;
16762
16763     p = (unsigned char *)v;
16764     printf("No - %s: 0x", where);
16765     while (p < end)
16766         printf ("%02X", *p++);
16767     printf("\n");
16768     return 1;
16769 }
16770
16771 int main(int argc, char **argv) {
16772     $nvtype d = 0.0;
16773     int fail = 0;
16774     fail += checkit(d, "0.0");
16775
16776     /* The compiler shouldn't be assuming that bletched is 0  */
16777     d = bletched;
16778
16779     fail += checkit(d, "bleched");
16780
16781 #ifdef SIGFPE
16782     signal(SIGFPE, blech);
16783 #endif
16784
16785     /* Paranoia - the compiler should have no way of knowing that ANSI says
16786        that argv[argc] will always be NULL.  Actually, if it did assume this it
16787        would be buggy, as this is C and main() can be called from elsewhere in
16788        the program.  */
16789     d = argv[argc] ? 1 : 0;
16790
16791     if (d) {
16792         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16793     }
16794
16795     fail += checkit(d, "ternary");
16796
16797     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16798
16799     if (d != 0.0) {
16800         printf("No - memset doesn't give 0.0\n");
16801         /* This might just blow up:  */
16802         printf("(gives %g)\n", d);
16803         return 1;
16804     }
16805
16806 #ifdef SIGFPE
16807     if (bletched) {
16808         printf("No - something bleched\n");
16809         return 1;
16810     }
16811 #endif
16812     if (fail) {
16813       printf("No - %d fail(s)\n", fail);
16814       return 1;
16815     }
16816     printf("Yes\n");
16817     return 0;
16818 }
16819 EOP
16820 set try
16821
16822 d_nv_zero_is_allbits_zero="$undef"
16823 if eval $compile; then
16824     xxx="`$run ./try`"
16825     case "$?" in
16826         0)
16827             case "$xxx" in
16828                 Yes)  cat >&4 <<EOM
16829 0.0 is represented as all bits zero in memory
16830 EOM
16831                     d_nv_zero_is_allbits_zero="$define"
16832                     ;;
16833                 *)  cat >&4 <<EOM
16834 0.0 is not represented as all bits zero in memory
16835 EOM
16836                     d_nv_zero_is_allbits_zero="$undef"
16837                     ;;
16838             esac
16839             ;;
16840         *)  cat >&4 <<EOM
16841 0.0 is not represented as all bits zero in memory
16842 EOM
16843             d_nv_zero_is_allbits_zero="$undef"
16844             ;;
16845     esac
16846 fi
16847 $rm_try
16848
16849 : check for off64_t
16850 echo " "
16851 echo "Checking to see if you have off64_t..." >&4
16852 $cat >try.c <<EOCP
16853 #include <sys/types.h>
16854 #include <unistd.h>
16855 int main() { off64_t x = 7; }
16856 EOCP
16857 set try
16858 if eval $compile; then
16859         val="$define"
16860         echo "You have off64_t."
16861 else
16862         val="$undef"
16863         echo "You do not have off64_t."
16864         case "$lseeksize" in
16865         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16866         esac
16867 fi
16868 $rm_try
16869 set d_off64_t
16870 eval $setvar
16871
16872 : how to create joinable pthreads
16873 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16874         echo " "
16875         echo "Checking what constant to use for creating joinable pthreads..." >&4
16876         $cat >try.c <<'EOCP'
16877 #include <pthread.h>
16878 int main() {
16879     int detachstate = JOINABLE;
16880 }
16881 EOCP
16882         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16883         if eval $compile; then
16884                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16885                 val="$undef" # Yes, undef.
16886                 set d_old_pthread_create_joinable
16887                 eval $setvar
16888                 val=""
16889                 set old_pthread_create_joinable
16890                 eval $setvar
16891         else
16892                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16893                 if eval $compile; then
16894                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16895                         val="$define"
16896                         set d_old_pthread_create_joinable
16897                         eval $setvar
16898                         val=PTHREAD_CREATE_UNDETACHED
16899                         set old_pthread_create_joinable
16900                         eval $setvar
16901                 else
16902                         set try -DJOINABLE=__UNDETACHED
16903                         if eval $compile; then
16904                                 echo "You seem to use __UNDETACHED." >&4
16905                                 val="$define"
16906                                 set d_old_pthread_create_joinable
16907                                 eval $setvar
16908                                 val=__UNDETACHED
16909                                 set old_pthread_create_joinable
16910                                 eval $setvar
16911                         else
16912                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16913                                 val="$define"
16914                                 set d_old_pthread_create_joinable
16915                                 eval $setvar
16916                                 val=0
16917                                 set old_pthread_create_joinable
16918                                 eval $setvar
16919                         fi
16920                 fi
16921         fi
16922         $rm_try
16923 else
16924     d_old_pthread_create_joinable="$undef"
16925     old_pthread_create_joinable=""
16926 fi
16927
16928 : see if pause exists
16929 set pause d_pause
16930 eval $inlibc
16931
16932 : see if pipe2 exists
16933 set pipe2 d_pipe2
16934 eval $inlibc
16935
16936 : see if poll exists
16937 set poll d_poll
16938 eval $inlibc
16939
16940 : see if prctl exists
16941 set prctl d_prctl
16942 eval $inlibc
16943
16944 : see if prctl supports PR_SET_NAME
16945 d_prctl_set_name=$undef
16946 case $d_prctl in
16947     $define)
16948         $cat >try.c <<EOM
16949 #ifdef __ANDROID__
16950 #include <unistd.h>
16951 #endif
16952 #include <sys/prctl.h>
16953
16954 int main (int argc, char *argv[])
16955 {
16956     return (prctl (PR_SET_NAME, "Test"));
16957     } /* main */
16958 EOM
16959         set try
16960         if eval $compile_ok && $run ./try; then
16961             echo "Your prctl (PR_SET_NAME, ...) works"
16962             d_prctl_set_name=$define
16963             fi
16964         $rm_try
16965         ;;
16966     esac
16967
16968 : see if readlink exists
16969 set readlink d_readlink
16970 eval $inlibc
16971
16972 : Check if there is a /proc symlink to the abs path of
16973 : the executing program.  We will honor hints of d_procselfexe=$undef
16974 : or procselfexe being non-empty, otherwise will try to determine both
16975 : if we have readlink.
16976 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
16977 : referenced, and AmigaOS does not have a proc filesystem anyway.
16978 echo " "
16979 val="$undef"
16980 if $test "X$d_procselfexe" = Xundef; then
16981         procselfexe=''
16982 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
16983         val="$define"
16984 elif $test "X$d_readlink" = Xdefine; then
16985         : NetBSD first as /proc/self is a symlink to /proc/curproc,
16986         : and it feels more tidy to avoid an extra level of symlink
16987         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16988         while test $# -gt 0; do
16989             type=$1; try=$2
16990             shift; shift
16991             if $issymlink $try; then
16992                 $ls -l $try > reflect
16993                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16994                     echo "You have $type-like $try."
16995                     procselfexe='"'$try'"'
16996                     val="$define"
16997                     : This will break out of the loop
16998                     set X; shift
16999                 fi
17000             fi
17001         done
17002 fi
17003 $rm -f reflect
17004 set d_procselfexe
17005 eval $setvar
17006
17007 : backward compatibility for d_hvfork
17008 if test X$d_hvfork != X; then
17009         d_vfork="$d_hvfork"
17010         d_hvfork=''
17011 fi
17012 : see if there is a vfork
17013 val=''
17014 set vfork val
17015 eval $inlibc
17016
17017 d_pseudofork=$undef
17018
17019 : Ok, but do we want to use it. vfork is reportedly unreliable in
17020 : perl on Solaris 2.x, and probably elsewhere.
17021 case "$val" in
17022 $define)
17023         echo " "
17024         case "$usevfork" in
17025         false) dflt='n';;
17026         *) dflt='y';;
17027         esac
17028         cat <<'EOM'
17029
17030 Perl can only use a vfork() that doesn't suffer from strict
17031 restrictions on calling functions or modifying global data in
17032 the child.  For example, glibc-2.1 contains such a vfork()
17033 that is unsuitable.  If your system provides a proper fork()
17034 call, chances are that you do NOT want perl to use vfork().
17035
17036 EOM
17037         rp="Do you still want to use vfork()?"
17038         . ./myread
17039         case "$ans" in
17040         y|Y) ;;
17041         *)
17042                 echo "Ok, we won't use vfork()."
17043                 val="$undef"
17044                 ;;
17045         esac
17046         ;;
17047 esac
17048 set d_vfork
17049 eval $setvar
17050 case "$d_vfork" in
17051 $define) usevfork='true';;
17052 *) usevfork='false';;
17053 esac
17054
17055 : see whether the pthread_atfork exists
17056 $cat >try.c <<EOP
17057 #include <pthread.h>
17058 #include <stdio.h>
17059 int main() {
17060 #ifdef  PTHREAD_ATFORK
17061         pthread_atfork(NULL,NULL,NULL);
17062 #endif
17063 }
17064 EOP
17065
17066 : see if pthread_atfork exists
17067 set try -DPTHREAD_ATFORK
17068 if eval $compile; then
17069     val="$define"
17070 else
17071     val="$undef"
17072 fi
17073 case "$usethreads" in
17074 $define)
17075         case "$val" in
17076         $define) echo 'pthread_atfork found.' >&4        ;;
17077         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17078         esac
17079 esac
17080 set d_pthread_atfork
17081 eval $setvar
17082
17083 : see if pthread_attr_setscope exists
17084 set pthread_attr_setscope d_pthread_attr_setscope
17085 eval $inlibc
17086
17087 : see whether the various POSIXish _yields exist
17088 $cat >try.c <<EOP
17089 #include <pthread.h>
17090 #include <stdio.h>
17091 int main() {
17092 #ifdef SCHED_YIELD
17093         sched_yield();
17094 #else
17095 #ifdef PTHREAD_YIELD
17096         pthread_yield();
17097 #else
17098 #ifdef PTHREAD_YIELD_NULL
17099         pthread_yield(NULL);
17100 #endif
17101 #endif
17102 #endif
17103 }
17104 EOP
17105 : see if sched_yield exists
17106 set try -DSCHED_YIELD
17107 if eval $compile; then
17108     val="$define"
17109     sched_yield='sched_yield()'
17110 else
17111     val="$undef"
17112 fi
17113 case "$usethreads" in
17114 $define)
17115         case "$val" in
17116         $define) echo 'sched_yield() found.' >&4        ;;
17117         *)       echo 'sched_yield() NOT found.' >&4    ;;
17118         esac
17119 esac
17120 set d_sched_yield
17121 eval $setvar
17122
17123 : see if pthread_yield exists
17124 set try -DPTHREAD_YIELD
17125 if eval $compile; then
17126     val="$define"
17127     case "$sched_yield" in
17128     '') sched_yield='pthread_yield()' ;;
17129     esac
17130 else
17131     set try -DPTHREAD_YIELD_NULL
17132     if eval $compile; then
17133         val="$define"
17134         case "$sched_yield" in
17135         '') sched_yield='pthread_yield(NULL)' ;;
17136         esac
17137     else
17138         val="$undef"
17139     fi
17140 fi
17141 case "$usethreads" in
17142 $define)
17143         case "$val" in
17144         $define) echo 'pthread_yield() found.' >&4      ;;
17145         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17146         esac
17147         ;;
17148 esac
17149 set d_pthread_yield
17150 eval $setvar
17151 case "$sched_yield" in
17152 '') sched_yield=undef ;;
17153 esac
17154 $rm_try
17155
17156 : check for ptrdiff_t
17157 echo " "
17158 echo "Checking to see if you have ptrdiff_t..." >&4
17159 $cat >try.c <<EOCP
17160 #include <stddef.h>
17161 int main() { ptrdiff_t x = 7; }
17162 EOCP
17163 set try
17164 if eval $compile; then
17165         val="$define"
17166         echo "You have ptrdiff_t."
17167 else
17168         val="$undef"
17169         echo "You do not have ptrdiff_t."
17170 fi
17171 $rm_try
17172 set d_ptrdiff_t
17173 eval $setvar
17174
17175 : see if random_r exists
17176 set random_r d_random_r
17177 eval $inlibc
17178 case "$d_random_r" in
17179 "$define")
17180         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17181         case "$d_random_r_proto:$usethreads" in
17182         ":define")      d_random_r_proto=define
17183                 set d_random_r_proto random_r $hdrs
17184                 eval $hasproto ;;
17185         *)      ;;
17186         esac
17187         case "$d_random_r_proto" in
17188         define)
17189         case "$random_r_proto" in
17190         ''|0) try='int random_r(int*, struct random_data*);'
17191         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17192         esac
17193         case "$random_r_proto" in
17194         ''|0) try='int random_r(long*, struct random_data*);'
17195         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17196         esac
17197         case "$random_r_proto" in
17198         ''|0) try='int random_r(struct random_data*, int32_t*);'
17199         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17200         esac
17201         case "$random_r_proto" in
17202         ''|0)   d_random_r=undef
17203                 random_r_proto=0
17204                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17205         * )     case "$random_r_proto" in
17206                 REENTRANT_PROTO*) ;;
17207                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17208                 esac
17209                 echo "Prototype: $try" ;;
17210         esac
17211         ;;
17212         *)      case "$usethreads" in
17213                 define) echo "random_r has no prototype, not using it." >&4 ;;
17214                 esac
17215                 d_random_r=undef
17216                 random_r_proto=0
17217                 ;;
17218         esac
17219         ;;
17220 *)      random_r_proto=0
17221         ;;
17222 esac
17223
17224 : see if readdir and friends exist
17225 set readdir d_readdir
17226 eval $inlibc
17227 set seekdir d_seekdir
17228 eval $inlibc
17229 set telldir d_telldir
17230 eval $inlibc
17231 set rewinddir d_rewinddir
17232 eval $inlibc
17233
17234 : see if readdir64_r exists
17235 set readdir64_r d_readdir64_r
17236 eval $inlibc
17237 case "$d_readdir64_r" in
17238 "$define")
17239         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17240         case "$d_readdir64_r_proto:$usethreads" in
17241         ":define")      d_readdir64_r_proto=define
17242                 set d_readdir64_r_proto readdir64_r $hdrs
17243                 eval $hasproto ;;
17244         *)      ;;
17245         esac
17246         case "$d_readdir64_r_proto" in
17247         define)
17248         case "$readdir64_r_proto" in
17249         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17250         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17251         esac
17252         case "$readdir64_r_proto" in
17253         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17254         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17255         esac
17256         case "$readdir64_r_proto" in
17257         ''|0)   d_readdir64_r=undef
17258                 readdir64_r_proto=0
17259                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17260         * )     case "$readdir64_r_proto" in
17261                 REENTRANT_PROTO*) ;;
17262                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17263                 esac
17264                 echo "Prototype: $try" ;;
17265         esac
17266         ;;
17267         *)      case "$usethreads" in
17268                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17269                 esac
17270                 d_readdir64_r=undef
17271                 readdir64_r_proto=0
17272                 ;;
17273         esac
17274         ;;
17275 *)      readdir64_r_proto=0
17276         ;;
17277 esac
17278
17279 : see if readdir_r exists
17280 set readdir_r d_readdir_r
17281 eval $inlibc
17282 case "$d_readdir_r" in
17283 "$define")
17284         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17285         case "$d_readdir_r_proto:$usethreads" in
17286         ":define")      d_readdir_r_proto=define
17287                 set d_readdir_r_proto readdir_r $hdrs
17288                 eval $hasproto ;;
17289         *)      ;;
17290         esac
17291         case "$d_readdir_r_proto" in
17292         define)
17293         case "$readdir_r_proto" in
17294         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17295         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17296         esac
17297         case "$readdir_r_proto" in
17298         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17299         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17300         esac
17301         case "$readdir_r_proto" in
17302         ''|0)   d_readdir_r=undef
17303                 readdir_r_proto=0
17304                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17305         * )     case "$readdir_r_proto" in
17306                 REENTRANT_PROTO*) ;;
17307                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17308                 esac
17309                 echo "Prototype: $try" ;;
17310         esac
17311         ;;
17312         *)      case "$usethreads" in
17313                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17314                 esac
17315                 d_readdir_r=undef
17316                 readdir_r_proto=0
17317                 ;;
17318         esac
17319         ;;
17320 *)      readdir_r_proto=0
17321         ;;
17322 esac
17323
17324 : see if readv exists
17325 set readv d_readv
17326 eval $inlibc
17327
17328 : see if recvmsg exists
17329 set recvmsg d_recvmsg
17330 eval $inlibc
17331
17332 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17333 echo " "
17334 if set regcomp val -f d_regcomp; eval $csym; $val; then
17335         echo 'regcomp() found.' >&4
17336         d_regcomp="$define"
17337         d_regcmp="$undef"
17338         d_re_comp="$undef"
17339 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17340         echo 'regcmp() found.' >&4
17341         d_regcmp="$define"
17342         d_regcomp="$undef"
17343         d_re_comp="$undef"
17344 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17345         echo 're_comp() found, assuming re_exec() also exists.' >&4
17346         d_re_comp="$define"
17347         d_regcomp="$undef"
17348         d_regcmp="$undef"
17349 else
17350         $cat >&4 <<EOM
17351 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17352 EOM
17353         d_regcmp="$undef"
17354         d_re_comp="$undef"
17355         d_regcomp="$undef"
17356 fi
17357
17358 : see if remainder exists
17359 set remainder d_remainder
17360 eval $inlibc
17361
17362 : see if remquo exists
17363 set remquo d_remquo
17364 eval $inlibc
17365
17366 : see if rename exists
17367 set rename d_rename
17368 eval $inlibc
17369
17370 : see if rint exists
17371 set rint d_rint
17372 eval $inlibc
17373
17374 : see if rmdir exists
17375 set rmdir d_rmdir
17376 eval $inlibc
17377
17378 : see if round exists
17379 set round d_round
17380 eval $inlibc
17381
17382 : see if prototype for sbrk is available
17383 echo " "
17384 set d_sbrkproto sbrk $i_unistd unistd.h
17385 eval $hasproto
17386
17387 : see if scalbn exists
17388 set scalbn d_scalbn
17389 eval $inlibc
17390
17391 : see if select exists
17392 set select d_select
17393 eval $inlibc
17394
17395 : see if semctl exists
17396 set semctl d_semctl
17397 eval $inlibc
17398
17399 : see if semget exists
17400 set semget d_semget
17401 eval $inlibc
17402
17403 : see if semop exists
17404 set semop d_semop
17405 eval $inlibc
17406
17407 : see how much of the 'sem*(2)' library is present.
17408 h_sem=true
17409 echo " "
17410 case "$d_semctl$d_semget$d_semop" in
17411 *"$undef"*) h_sem=false;;
17412 esac
17413 case "$osname" in
17414 freebsd)
17415     case "`ipcs 2>&1`" in
17416     "SVID messages"*"not configured"*)
17417         echo "Your $osname does not have the sem*(2) configured." >&4
17418         h_sem=false
17419         val="$undef"
17420         set semctl d_semctl
17421         eval $setvar
17422         set semget d_semget
17423         eval $setvar
17424         set semop d_semop
17425         eval $setvar
17426         ;;
17427     esac
17428     ;;
17429 esac
17430 : we could also check for sys/ipc.h ...
17431 if $h_sem && $test `./findhdr sys/sem.h`; then
17432         echo "You have the full sem*(2) library." >&4
17433         val="$define"
17434 else
17435         echo "You don't have the full sem*(2) library." >&4
17436         val="$undef"
17437 fi
17438 set d_sem
17439 eval $setvar
17440
17441 : see whether sys/sem.h defines union semun
17442 echo " "
17443 $cat > try.c <<'END'
17444 #include <sys/types.h>
17445 #include <sys/ipc.h>
17446 #include <sys/sem.h>
17447 int main () { union semun semun; semun.buf = 0; }
17448 END
17449 set try
17450 if eval $compile; then
17451     echo "You have union semun in <sys/sem.h>." >&4
17452     val="$define"
17453 else
17454     echo "You do not have union semun in <sys/sem.h>." >&4
17455     val="$undef"
17456 fi
17457 $rm_try
17458 set d_union_semun
17459 eval $setvar
17460
17461 : see how to do semctl IPC_STAT
17462 case "$d_sem" in
17463 $define)
17464     echo " "
17465     $cat > tryh.h <<END
17466 #ifndef S_IRUSR
17467 #   ifdef S_IREAD
17468 #       define S_IRUSR S_IREAD
17469 #       define S_IWUSR S_IWRITE
17470 #       define S_IXUSR S_IEXEC
17471 #   else
17472 #       define S_IRUSR 0400
17473 #       define S_IWUSR 0200
17474 #       define S_IXUSR 0100
17475 #   endif
17476 #   define S_IRGRP (S_IRUSR>>3)
17477 #   define S_IWGRP (S_IWUSR>>3)
17478 #   define S_IXGRP (S_IXUSR>>3)
17479 #   define S_IROTH (S_IRUSR>>6)
17480 #   define S_IWOTH (S_IWUSR>>6)
17481 #   define S_IXOTH (S_IXUSR>>6)
17482 #endif
17483 #ifndef S_IRWXU
17484 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17485 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17486 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17487 #endif
17488 END
17489     : see whether semctl IPC_STAT can use union semun
17490     case "$d_semctl_semun" in
17491     '')
17492       val="$undef"
17493       $cat > try.c <<END
17494 #include <sys/types.h>
17495 #include <sys/ipc.h>
17496 #include <sys/sem.h>
17497 #include <sys/stat.h>
17498 #include <stdio.h>
17499 #include <errno.h>
17500 #include "tryh.h"
17501 #ifndef errno
17502 extern int errno;
17503 #endif
17504 #$d_union_semun HAS_UNION_SEMUN
17505 int main() {
17506     union semun
17507 #ifndef HAS_UNION_SEMUN
17508     {
17509         int val;
17510         struct semid_ds *buf;
17511         unsigned short *array;
17512     }
17513 #endif
17514     arg;
17515     int sem, st;
17516
17517 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17518     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17519     if (sem > -1) {
17520         struct semid_ds argbuf;
17521         arg.buf = &argbuf;
17522 #       ifdef IPC_STAT
17523         st = semctl(sem, 0, IPC_STAT, arg);
17524         if (st == 0)
17525             printf("semun\n");
17526         else
17527 #       endif /* IPC_STAT */
17528             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17529 #       ifdef IPC_RMID
17530         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17531 #       endif /* IPC_RMID */
17532             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17533     } else
17534 #endif /* IPC_PRIVATE && ... */
17535         printf("semget failed: errno = %d\n", errno);
17536   return 0;
17537 }
17538 END
17539       set try
17540       if eval $compile; then
17541           xxx=`$run ./try`
17542           case "$xxx" in
17543           semun) val="$define" ;;
17544           esac
17545       fi
17546       $rm_try
17547       set d_semctl_semun
17548       eval $setvar
17549       ;;
17550     esac
17551     case "$d_semctl_semun" in
17552     $define)
17553         echo "You can use union semun for semctl IPC_STAT." >&4
17554         also='also'
17555         ;;
17556     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17557         also=''
17558         ;;
17559     esac
17560
17561     : see whether semctl IPC_STAT can use struct semid_ds pointer
17562     case "$d_semctl_semid_ds" in
17563     '')
17564       val="$undef"
17565       $cat > try.c <<'END'
17566 #include <sys/types.h>
17567 #include <sys/ipc.h>
17568 #include <sys/sem.h>
17569 #include <sys/stat.h>
17570 #include "tryh.h"
17571 #include <stdio.h>
17572 #include <errno.h>
17573 #ifndef errno
17574 extern int errno;
17575 #endif
17576 int main() {
17577     struct semid_ds arg;
17578     int sem, st;
17579
17580 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17581     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17582     if (sem > -1) {
17583 #       ifdef IPC_STAT
17584         st = semctl(sem, 0, IPC_STAT, &arg);
17585         if (st == 0)
17586             printf("semid_ds\n");
17587         else
17588 #       endif /* IPC_STAT */
17589             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17590 #       ifdef IPC_RMID
17591         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17592 #       endif /* IPC_RMID */
17593             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17594     } else
17595 #endif /* IPC_PRIVATE && ... */
17596         printf("semget failed: errno = %d\n", errno);
17597
17598     return 0;
17599 }
17600 END
17601       set try
17602       if eval $compile; then
17603           xxx=`$run ./try`
17604           case "$xxx" in
17605           semid_ds) val="$define" ;;
17606           esac
17607       fi
17608       $rm_try
17609       set d_semctl_semid_ds
17610       eval $setvar
17611       ;;
17612     esac
17613     case "$d_semctl_semid_ds" in
17614     $define)
17615         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17616         ;;
17617     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17618         ;;
17619     esac
17620     ;;
17621 *)  val="$undef"
17622
17623     # We do not have the full sem*(2) library, so assume we can not
17624     # use either.
17625
17626     set d_semctl_semun
17627     eval $setvar
17628
17629     set d_semctl_semid_ds
17630     eval $setvar
17631     ;;
17632 esac
17633 $rm_try tryh.h
17634
17635 : see if sendmsg exists
17636 set sendmsg d_sendmsg
17637 eval $inlibc
17638
17639 : see if setegid exists
17640 set setegid d_setegid
17641 eval $inlibc
17642
17643 : see if seteuid exists
17644 set seteuid d_seteuid
17645 eval $inlibc
17646
17647 : see if setgrent exists
17648 set setgrent d_setgrent
17649 eval $inlibc
17650
17651 : see if setgrent_r exists
17652 set setgrent_r d_setgrent_r
17653 eval $inlibc
17654 case "$d_setgrent_r" in
17655 "$define")
17656         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17657         case "$d_setgrent_r_proto:$usethreads" in
17658         ":define")      d_setgrent_r_proto=define
17659                 set d_setgrent_r_proto setgrent_r $hdrs
17660                 eval $hasproto ;;
17661         *)      ;;
17662         esac
17663         case "$d_setgrent_r_proto" in
17664         define)
17665         case "$setgrent_r_proto" in
17666         ''|0) try='int setgrent_r(FILE**);'
17667         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17668         esac
17669         case "$setgrent_r_proto" in
17670         ''|0) try='void setgrent_r(FILE**);'
17671         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17672         esac
17673         case "$setgrent_r_proto" in
17674         ''|0)   d_setgrent_r=undef
17675                 setgrent_r_proto=0
17676                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17677         * )     case "$setgrent_r_proto" in
17678                 REENTRANT_PROTO*) ;;
17679                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17680                 esac
17681                 echo "Prototype: $try" ;;
17682         esac
17683         ;;
17684         *)      case "$usethreads" in
17685                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17686                 esac
17687                 d_setgrent_r=undef
17688                 setgrent_r_proto=0
17689                 ;;
17690         esac
17691         ;;
17692 *)      setgrent_r_proto=0
17693         ;;
17694 esac
17695
17696 : see if sethostent exists
17697 set sethostent d_sethent
17698 eval $inlibc
17699
17700 : see if sethostent_r exists
17701 set sethostent_r d_sethostent_r
17702 eval $inlibc
17703 case "$d_sethostent_r" in
17704 "$define")
17705         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17706         case "$d_sethostent_r_proto:$usethreads" in
17707         ":define")      d_sethostent_r_proto=define
17708                 set d_sethostent_r_proto sethostent_r $hdrs
17709                 eval $hasproto ;;
17710         *)      ;;
17711         esac
17712         case "$d_sethostent_r_proto" in
17713         define)
17714         case "$sethostent_r_proto" in
17715         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17716         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17717         esac
17718         case "$sethostent_r_proto" in
17719         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17720         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17721         esac
17722         case "$sethostent_r_proto" in
17723         ''|0)   d_sethostent_r=undef
17724                 sethostent_r_proto=0
17725                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17726         * )     case "$sethostent_r_proto" in
17727                 REENTRANT_PROTO*) ;;
17728                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17729                 esac
17730                 echo "Prototype: $try" ;;
17731         esac
17732         ;;
17733         *)      case "$usethreads" in
17734                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17735                 esac
17736                 d_sethostent_r=undef
17737                 sethostent_r_proto=0
17738                 ;;
17739         esac
17740         ;;
17741 *)      sethostent_r_proto=0
17742         ;;
17743 esac
17744
17745 : see if setitimer exists
17746 set setitimer d_setitimer
17747 eval $inlibc
17748
17749 : see if setlinebuf exists
17750 set setlinebuf d_setlinebuf
17751 eval $inlibc
17752
17753 : see if setlocale exists
17754 set setlocale d_setlocale
17755 eval $inlibc
17756
17757 : see if locale.h is available
17758 set locale.h i_locale
17759 eval $inhdr
17760
17761 : see if setlocale_r exists
17762 set setlocale_r d_setlocale_r
17763 eval $inlibc
17764 case "$d_setlocale_r" in
17765 "$define")
17766         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17767         case "$d_setlocale_r_proto:$usethreads" in
17768         ":define")      d_setlocale_r_proto=define
17769                 set d_setlocale_r_proto setlocale_r $hdrs
17770                 eval $hasproto ;;
17771         *)      ;;
17772         esac
17773         case "$d_setlocale_r_proto" in
17774         define)
17775         case "$setlocale_r_proto" in
17776         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17777         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17778         esac
17779         case "$setlocale_r_proto" in
17780         ''|0)   d_setlocale_r=undef
17781                 setlocale_r_proto=0
17782                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17783         * )     case "$setlocale_r_proto" in
17784                 REENTRANT_PROTO*) ;;
17785                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17786                 esac
17787                 echo "Prototype: $try" ;;
17788         esac
17789         ;;
17790         *)      case "$usethreads" in
17791                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17792                 esac
17793                 d_setlocale_r=undef
17794                 setlocale_r_proto=0
17795                 ;;
17796         esac
17797         ;;
17798 *)      setlocale_r_proto=0
17799         ;;
17800 esac
17801
17802 : see if setnetent exists
17803 set setnetent d_setnent
17804 eval $inlibc
17805
17806 : see if setnetent_r exists
17807 set setnetent_r d_setnetent_r
17808 eval $inlibc
17809 case "$d_setnetent_r" in
17810 "$define")
17811         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17812         case "$d_setnetent_r_proto:$usethreads" in
17813         ":define")      d_setnetent_r_proto=define
17814                 set d_setnetent_r_proto setnetent_r $hdrs
17815                 eval $hasproto ;;
17816         *)      ;;
17817         esac
17818         case "$d_setnetent_r_proto" in
17819         define)
17820         case "$setnetent_r_proto" in
17821         ''|0) try='int setnetent_r(int, struct netent_data*);'
17822         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17823         esac
17824         case "$setnetent_r_proto" in
17825         ''|0) try='void setnetent_r(int, struct netent_data*);'
17826         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17827         esac
17828         case "$setnetent_r_proto" in
17829         ''|0)   d_setnetent_r=undef
17830                 setnetent_r_proto=0
17831                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17832         * )     case "$setnetent_r_proto" in
17833                 REENTRANT_PROTO*) ;;
17834                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17835                 esac
17836                 echo "Prototype: $try" ;;
17837         esac
17838         ;;
17839         *)      case "$usethreads" in
17840                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17841                 esac
17842                 d_setnetent_r=undef
17843                 setnetent_r_proto=0
17844                 ;;
17845         esac
17846         ;;
17847 *)      setnetent_r_proto=0
17848         ;;
17849 esac
17850
17851 : see if setprotoent exists
17852 set setprotoent d_setpent
17853 eval $inlibc
17854
17855 : see if setpgid exists
17856 set setpgid d_setpgid
17857 eval $inlibc
17858
17859 : see if setpgrp2 exists
17860 set setpgrp2 d_setpgrp2
17861 eval $inlibc
17862
17863 : see if setpriority exists
17864 set setpriority d_setprior
17865 eval $inlibc
17866
17867 : see if setproctitle exists
17868 set setproctitle d_setproctitle
17869 eval $inlibc
17870
17871 : see if setprotoent_r exists
17872 set setprotoent_r d_setprotoent_r
17873 eval $inlibc
17874 case "$d_setprotoent_r" in
17875 "$define")
17876         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17877         case "$d_setprotoent_r_proto:$usethreads" in
17878         ":define")      d_setprotoent_r_proto=define
17879                 set d_setprotoent_r_proto setprotoent_r $hdrs
17880                 eval $hasproto ;;
17881         *)      ;;
17882         esac
17883         case "$d_setprotoent_r_proto" in
17884         define)
17885         case "$setprotoent_r_proto" in
17886         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17887         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17888         esac
17889         case "$setprotoent_r_proto" in
17890         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17891         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17892         esac
17893         case "$setprotoent_r_proto" in
17894         ''|0)   d_setprotoent_r=undef
17895                 setprotoent_r_proto=0
17896                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17897         * )     case "$setprotoent_r_proto" in
17898                 REENTRANT_PROTO*) ;;
17899                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17900                 esac
17901                 echo "Prototype: $try" ;;
17902         esac
17903         ;;
17904         *)      case "$usethreads" in
17905                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17906                 esac
17907                 d_setprotoent_r=undef
17908                 setprotoent_r_proto=0
17909                 ;;
17910         esac
17911         ;;
17912 *)      setprotoent_r_proto=0
17913         ;;
17914 esac
17915
17916 : see if setpwent exists
17917 set setpwent d_setpwent
17918 eval $inlibc
17919
17920 : see if setpwent_r exists
17921 set setpwent_r d_setpwent_r
17922 eval $inlibc
17923 case "$d_setpwent_r" in
17924 "$define")
17925         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17926         case "$d_setpwent_r_proto:$usethreads" in
17927         ":define")      d_setpwent_r_proto=define
17928                 set d_setpwent_r_proto setpwent_r $hdrs
17929                 eval $hasproto ;;
17930         *)      ;;
17931         esac
17932         case "$d_setpwent_r_proto" in
17933         define)
17934         case "$setpwent_r_proto" in
17935         ''|0) try='int setpwent_r(FILE**);'
17936         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17937         esac
17938         case "$setpwent_r_proto" in
17939         ''|0) try='void setpwent_r(FILE**);'
17940         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17941         esac
17942         case "$setpwent_r_proto" in
17943         ''|0)   d_setpwent_r=undef
17944                 setpwent_r_proto=0
17945                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17946         * )     case "$setpwent_r_proto" in
17947                 REENTRANT_PROTO*) ;;
17948                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17949                 esac
17950                 echo "Prototype: $try" ;;
17951         esac
17952         ;;
17953         *)      case "$usethreads" in
17954                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17955                 esac
17956                 d_setpwent_r=undef
17957                 setpwent_r_proto=0
17958                 ;;
17959         esac
17960         ;;
17961 *)      setpwent_r_proto=0
17962         ;;
17963 esac
17964
17965 : see if setregid exists
17966 set setregid d_setregid
17967 eval $inlibc
17968 set setresgid d_setresgid
17969 eval $inlibc
17970
17971 : see if setreuid exists
17972 set setreuid d_setreuid
17973 eval $inlibc
17974 set setresuid d_setresuid
17975 eval $inlibc
17976
17977 : see if setrgid exists
17978 set setrgid d_setrgid
17979 eval $inlibc
17980
17981 : see if setruid exists
17982 set setruid d_setruid
17983 eval $inlibc
17984
17985 : see if setservent exists
17986 set setservent d_setsent
17987 eval $inlibc
17988
17989 : see if setservent_r exists
17990 set setservent_r d_setservent_r
17991 eval $inlibc
17992 case "$d_setservent_r" in
17993 "$define")
17994         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17995         case "$d_setservent_r_proto:$usethreads" in
17996         ":define")      d_setservent_r_proto=define
17997                 set d_setservent_r_proto setservent_r $hdrs
17998                 eval $hasproto ;;
17999         *)      ;;
18000         esac
18001         case "$d_setservent_r_proto" in
18002         define)
18003         case "$setservent_r_proto" in
18004         ''|0) try='int setservent_r(int, struct servent_data*);'
18005         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18006         esac
18007         case "$setservent_r_proto" in
18008         ''|0) try='void setservent_r(int, struct servent_data*);'
18009         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18010         esac
18011         case "$setservent_r_proto" in
18012         ''|0)   d_setservent_r=undef
18013                 setservent_r_proto=0
18014                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18015         * )     case "$setservent_r_proto" in
18016                 REENTRANT_PROTO*) ;;
18017                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18018                 esac
18019                 echo "Prototype: $try" ;;
18020         esac
18021         ;;
18022         *)      case "$usethreads" in
18023                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18024                 esac
18025                 d_setservent_r=undef
18026                 setservent_r_proto=0
18027                 ;;
18028         esac
18029         ;;
18030 *)      setservent_r_proto=0
18031         ;;
18032 esac
18033
18034 : see if setsid exists
18035 set setsid d_setsid
18036 eval $inlibc
18037
18038 : see if setvbuf exists
18039 set setvbuf d_setvbuf
18040 eval $inlibc
18041
18042 : see if shmctl exists
18043 set shmctl d_shmctl
18044 eval $inlibc
18045
18046 : see if shmget exists
18047 set shmget d_shmget
18048 eval $inlibc
18049
18050 : see if shmat exists
18051 set shmat d_shmat
18052 eval $inlibc
18053 : see what shmat returns
18054 case "$d_shmat" in
18055 "$define")
18056         $cat >shmat.c <<'END'
18057 #include <sys/shm.h>
18058 void *shmat();
18059 END
18060         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18061                 shmattype='void *'
18062         else
18063                 shmattype='char *'
18064         fi
18065         echo "and it returns ($shmattype)." >&4
18066         : see if a prototype for shmat is available
18067         xxx=`./findhdr sys/shm.h`
18068         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18069         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18070                 val="$define"
18071         else
18072                 val="$undef"
18073         fi
18074         $rm -f shmat.[co]
18075         ;;
18076 *)
18077         val="$undef"
18078         ;;
18079 esac
18080 set d_shmatprototype
18081 eval $setvar
18082
18083 : see if shmdt exists
18084 set shmdt d_shmdt
18085 eval $inlibc
18086
18087 : see how much of the 'shm*(2)' library is present.
18088 h_shm=true
18089 echo " "
18090 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18091 *"$undef"*) h_shm=false;;
18092 esac
18093 case "$osname" in
18094 freebsd)
18095     case "`ipcs 2>&1`" in
18096     "SVID shared memory"*"not configured"*)
18097         echo "Your $osname does not have the shm*(2) configured." >&4
18098         h_shm=false
18099         val="$undef"
18100         set shmctl d_shmctl
18101         eval $setvar
18102         set shmget d_shmget
18103         eval $setvar
18104         set shmat d_shmat
18105         eval $setvar
18106         set shmdt d_shmdt
18107         eval $setvar
18108         ;;
18109     esac
18110     ;;
18111 esac
18112 : we could also check for sys/ipc.h ...
18113 if $h_shm && $test `./findhdr sys/shm.h`; then
18114         echo "You have the full shm*(2) library." >&4
18115         val="$define"
18116 else
18117         echo "You don't have the full shm*(2) library." >&4
18118         val="$undef"
18119 fi
18120 set d_shm
18121 eval $setvar
18122
18123 : see if we have sigaction
18124 echo " "
18125 if set sigaction val -f d_sigaction; eval $csym; $val; then
18126         echo 'sigaction() found.' >&4
18127         $cat > try.c <<EOP
18128 #include <stdio.h>
18129 #include <sys/types.h>
18130 #include <signal.h>
18131 #$i_stdlib I_STDLIB
18132 #ifdef I_STDLIB
18133 #include <stdlib.h>
18134 #endif
18135 int main()
18136 {
18137     struct sigaction act, oact;
18138     act.sa_flags = 0;
18139     oact.sa_handler = 0;
18140     /* so that act and oact are used */
18141     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18142 }
18143 EOP
18144         set try
18145         if eval $compile_ok; then
18146                 val="$define"
18147         else
18148                 echo "But you don't seem to have a usable struct sigaction." >&4
18149                 val="$undef"
18150         fi
18151 else
18152         echo 'sigaction NOT found.' >&4
18153         val="$undef"
18154 fi
18155 set d_sigaction; eval $setvar
18156 $rm_try
18157
18158 : see what type pids are declared as in the kernel
18159 rp="What is the type of process ids on this system?"
18160 set pid_t pidtype int stdio.h sys/types.h
18161 eval $typedef_ask
18162
18163 : see what type uids are declared as in the kernel
18164 echo " "
18165 echo "Looking for the type for user ids returned by getuid()."
18166 set uid_t uidtype xxx stdio.h sys/types.h
18167 eval $typedef
18168 case "$uidtype" in
18169 xxx)
18170         xxx=`./findhdr sys/user.h`
18171         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18172         case $1 in
18173         unsigned) dflt="$1 $2" ;;
18174         *) dflt="$1" ;;
18175         esac
18176         ;;
18177 *) dflt="$uidtype";;
18178 esac
18179 case "$uidtype" in
18180 uid_t)  echo "uid_t found." ;;
18181 *)      rp="What is the type for user ids returned by getuid()?"
18182         . ./myread
18183         uidtype="$ans"
18184         ;;
18185 esac
18186
18187 : Define hasfield_t macro for Configure internal use
18188 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18189 while $test $# -ge 2; do
18190     case "$1" in
18191         $define) echo "#include <$2>";;
18192     esac ;
18193     shift 2;
18194 done > try.c;
18195 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18196 set try;
18197 if eval $compile; then
18198         val="$define";
18199 else
18200         val="$undef";
18201 fi;
18202 set $varname;
18203 eval $setvar;
18204 $rm_try'
18205
18206 : see what siginfo fields we have
18207 case "$d_sigaction" in
18208 "$define")
18209         echo "Checking if your siginfo_t has si_errno field...">&4
18210         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18211         eval $hasfield_t;
18212
18213         echo "Checking if your siginfo_t has si_pid field...">&4
18214         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18215         eval $hasfield_t;
18216
18217         echo "Checking if your siginfo_t has si_uid field...">&4
18218         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18219         eval $hasfield_t;
18220
18221         echo "Checking if your siginfo_t has si_addr field...">&4
18222         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18223         eval $hasfield_t;
18224
18225         echo "Checking if your siginfo_t has si_status field...">&4
18226         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18227         eval $hasfield_t;
18228
18229         echo "Checking if your siginfo_t has si_band field...">&4
18230         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18231         eval $hasfield_t;
18232
18233         echo "Checking if your siginfo_t has si_value field...">&4
18234         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18235         eval $hasfield_t;
18236
18237         echo "Checking if your siginfo_t has si_fd field...">&4
18238         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18239         eval $hasfield_t;
18240
18241         ;;
18242 *)
18243         d_siginfo_si_errno="$undef"
18244         d_siginfo_si_pid="$undef"
18245         d_siginfo_si_uid="$undef"
18246         d_siginfo_si_addr="$undef"
18247         d_siginfo_si_status="$undef"
18248         d_siginfo_si_band="$undef"
18249         d_siginfo_si_value="$undef"
18250         d_siginfo_si_fd="$undef"
18251         ;;
18252 esac
18253
18254 : see if this is a sunmath.h system
18255 set sunmath.h i_sunmath
18256 eval $inhdr
18257
18258 : see if signbit exists
18259 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18260 $cat >try.c <<EOCP
18261 #$i_sunmath I_SUNMATH
18262 #include <math.h>
18263 #ifdef I_SUNMATH  /* Solaris special math library */
18264 #  include <sunmath.h>
18265 #endif
18266 #define NV $nvtype
18267 int main(int argc, char **argv)
18268 {
18269     NV x = 0.0;
18270     NV y = -1.0;
18271     if ((signbit(x) == 0) && (signbit(y) != 0))
18272         return 0;
18273     else
18274         return 1;
18275 }
18276 EOCP
18277 val="$undef"
18278 set try
18279 if eval $compile; then
18280     if $run ./try; then
18281         $echo "Yes." >&4
18282         val="$define"
18283     else
18284         $echo "Signbit seems to be available, but doesn't work as I expected."
18285         $echo "I won't use it." >&4
18286         val="$undef"
18287     fi
18288 else
18289     $echo "Nope." >&4
18290     dflt="$undef"
18291 fi
18292 set d_signbit
18293 eval $setvar
18294 $rm_try
18295
18296 : see if sigprocmask exists
18297 set sigprocmask d_sigprocmask
18298 eval $inlibc
18299
18300 : see if sigsetjmp exists
18301 echo " "
18302 case "$d_sigsetjmp" in
18303 '')
18304         $cat >try.c <<EOP
18305 #include <setjmp.h>
18306 #$i_stdlib I_STDLIB
18307 #ifdef I_STDLIB
18308 #include <stdlib.h>
18309 #endif
18310 sigjmp_buf env;
18311 int set = 1;
18312 int main()
18313 {
18314         if (sigsetjmp(env,1))
18315                 exit(set);
18316         set = 0;
18317         siglongjmp(env, 1);
18318         exit(1);
18319 }
18320 EOP
18321         set try
18322         if eval $compile; then
18323                 if $run ./try >/dev/null 2>&1; then
18324                         echo "POSIX sigsetjmp found." >&4
18325                         val="$define"
18326                 else
18327                         $cat >&4 <<EOM
18328 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18329 I'll ignore them.
18330 EOM
18331                         val="$undef"
18332                 fi
18333         else
18334                 echo "sigsetjmp not found." >&4
18335                 val="$undef"
18336         fi
18337         ;;
18338 *) val="$d_sigsetjmp"
18339         case "$d_sigsetjmp" in
18340         $define) echo "POSIX sigsetjmp found." >&4;;
18341         $undef) echo "sigsetjmp not found." >&4;;
18342         esac
18343         ;;
18344 esac
18345 set d_sigsetjmp
18346 eval $setvar
18347 $rm_try
18348
18349 : see if snprintf exists
18350 set snprintf d_snprintf
18351 eval $inlibc
18352
18353 : see if vsnprintf exists
18354 set vsnprintf d_vsnprintf
18355 eval $inlibc
18356
18357 case "$d_snprintf-$d_vsnprintf" in
18358 "$define-$define")
18359     $cat <<EOM
18360 Checking whether your snprintf() and vsnprintf() work okay...
18361 EOM
18362     $cat >try.c <<'EOCP'
18363 /* v?snprintf testing logic courtesy of Russ Allbery.
18364  * According to C99:
18365  * - if the buffer is too short it still must be \0-terminated
18366  * - if the buffer is too short the potentially required length
18367  *   must be returned and not -1
18368  * - if the buffer is NULL the potentially required length
18369  *   must be returned and not -1 or core dump
18370  */
18371 #include <stdio.h>
18372 #include <stdarg.h>
18373
18374 char buf[2];
18375
18376 int test (char *format, ...)
18377 {
18378     va_list args;
18379     int count;
18380
18381     va_start (args, format);
18382     count = vsnprintf (buf, sizeof buf, format, args);
18383     va_end (args);
18384     return count;
18385 }
18386
18387 int main ()
18388 {
18389     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18390              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18391 }
18392 EOCP
18393     set try
18394     if eval $compile; then
18395         `$run ./try`
18396         case "$?" in
18397         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18398         *) cat <<EOM >&4
18399 Your snprintf() and snprintf() don't seem to be working okay.
18400 EOM
18401            d_snprintf="$undef"
18402            d_vsnprintf="$undef"
18403            ;;
18404         esac
18405     else
18406         echo "(I can't seem to compile the test program--assuming they don't)"
18407         d_snprintf="$undef"
18408         d_vsnprintf="$undef"
18409     fi
18410     $rm_try
18411     ;;
18412 esac
18413
18414 : see if sockatmark exists
18415 set sockatmark d_sockatmark
18416 eval $inlibc
18417
18418 : see if prototype for sockatmark is available
18419 echo " "
18420 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18421 eval $hasproto
18422
18423 : see if socks5_init exists
18424 set socks5_init d_socks5_init
18425 eval $inlibc
18426
18427 : see if srand48_r exists
18428 set srand48_r d_srand48_r
18429 eval $inlibc
18430 case "$d_srand48_r" in
18431 "$define")
18432         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18433         case "$d_srand48_r_proto:$usethreads" in
18434         ":define")      d_srand48_r_proto=define
18435                 set d_srand48_r_proto srand48_r $hdrs
18436                 eval $hasproto ;;
18437         *)      ;;
18438         esac
18439         case "$d_srand48_r_proto" in
18440         define)
18441         case "$srand48_r_proto" in
18442         ''|0) try='int srand48_r(long, struct drand48_data*);'
18443         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18444         esac
18445         case "$srand48_r_proto" in
18446         ''|0)   d_srand48_r=undef
18447                 srand48_r_proto=0
18448                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18449         * )     case "$srand48_r_proto" in
18450                 REENTRANT_PROTO*) ;;
18451                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18452                 esac
18453                 echo "Prototype: $try" ;;
18454         esac
18455         ;;
18456         *)      case "$usethreads" in
18457                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18458                 esac
18459                 d_srand48_r=undef
18460                 srand48_r_proto=0
18461                 ;;
18462         esac
18463         ;;
18464 *)      srand48_r_proto=0
18465         ;;
18466 esac
18467
18468 : see if srandom_r exists
18469 set srandom_r d_srandom_r
18470 eval $inlibc
18471 case "$d_srandom_r" in
18472 "$define")
18473         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18474         case "$d_srandom_r_proto:$usethreads" in
18475         ":define")      d_srandom_r_proto=define
18476                 set d_srandom_r_proto srandom_r $hdrs
18477                 eval $hasproto ;;
18478         *)      ;;
18479         esac
18480         case "$d_srandom_r_proto" in
18481         define)
18482         case "$srandom_r_proto" in
18483         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18484         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18485         esac
18486         case "$srandom_r_proto" in
18487         ''|0)   d_srandom_r=undef
18488                 srandom_r_proto=0
18489                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18490         * )     case "$srandom_r_proto" in
18491                 REENTRANT_PROTO*) ;;
18492                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18493                 esac
18494                 echo "Prototype: $try" ;;
18495         esac
18496         ;;
18497         *)      case "$usethreads" in
18498                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18499                 esac
18500                 d_srandom_r=undef
18501                 srandom_r_proto=0
18502                 ;;
18503         esac
18504         ;;
18505 *)      srandom_r_proto=0
18506         ;;
18507 esac
18508
18509 : see if prototype for setresgid is available
18510 echo " "
18511 set d_sresgproto setresgid $i_unistd unistd.h
18512 eval $hasproto
18513
18514 : see if prototype for setresuid is available
18515 echo " "
18516 set d_sresuproto setresuid $i_unistd unistd.h
18517 eval $hasproto
18518
18519 : see if stat exists
18520 set stat d_stat
18521 eval $inlibc
18522
18523 : see if sys/stat.h is available
18524 set sys/stat.h i_sysstat
18525 eval $inhdr
18526
18527 : see if stat knows about block sizes
18528 echo " "
18529 echo "Checking to see if your struct stat has st_blocks field..." >&4
18530 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18531 eval $hasfield
18532
18533 : see if this is a sys/vfs.h system
18534 set sys/vfs.h i_sysvfs
18535 eval $inhdr
18536
18537 : see if this is a sys/statfs.h system
18538 set sys/statfs.h i_sysstatfs
18539 eval $inhdr
18540
18541 : Check for statfs_s
18542 echo " "
18543 echo "Checking to see if your system supports struct statfs..." >&4
18544 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
18545 eval $hasstruct
18546 case "$d_statfs_s" in
18547 "$define")      echo "Yes, it does."   ;;
18548 *)              echo "No, it doesn't." ;;
18549 esac
18550
18551 : see if struct statfs knows about f_flags
18552 case "$d_statfs_s" in
18553 define)
18554         echo " "
18555         echo "Checking to see if your struct statfs has f_flags field..." >&4
18556         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
18557         eval $hasfield
18558         ;;
18559 *)      val="$undef"
18560         set d_statfs_f_flags
18561         eval $setvar
18562         ;;
18563 esac
18564 case "$d_statfs_f_flags" in
18565 "$define")      echo "Yes, it does."   ;;
18566 *)              echo "No, it doesn't." ;;
18567 esac
18568
18569 : see what flavor, if any, of static inline is supported
18570 echo " "
18571 echo "Checking to see if your system supports static inline..."
18572 $cat > try.c <<'EOCP'
18573 #include <stdlib.h>
18574 extern int f_via_a(int x);
18575 extern int f_via_b(int x);
18576 int main(int argc, char **argv)
18577 {
18578     int y;
18579
18580     y = f_via_a(0);
18581 #ifdef USE_B
18582     y = f_via_b(0);
18583 #endif
18584     if (y == 42) {
18585         return EXIT_SUCCESS;
18586     }
18587     else {
18588         return EXIT_FAILURE;
18589     }
18590 }
18591 EOCP
18592 $cat > a.c <<'EOCP'
18593 static INLINE int f(int x) {
18594     int y;
18595     y = x + 42;
18596     return y;
18597 }
18598
18599 int f_via_a(int x)
18600 {
18601     return f(x);
18602 }
18603 EOCP
18604 $cat > b.c <<'EOCP'
18605 extern int f(int x);
18606
18607 int f_via_b(int x)
18608 {
18609     return f(x);
18610 }
18611 EOCP
18612
18613 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18614 case "$perl_static_inline" in
18615 '')     # Check the various possibilities, and break out on success.
18616         # For gcc, prefer __inline__, which will still permit
18617         # cflags.SH to add in -ansi.
18618         case "$gccversion" in
18619                 '') xxx="inline __inline__ __inline _inline";;
18620                 *)  xxx="__inline__ inline __inline _inline";;
18621         esac
18622         for inline in $xxx; do
18623                 set try -DINLINE=$inline a.c
18624                 if eval $compile && $run ./try; then
18625                         # Now make sure there is no external linkage of static
18626                         # functions
18627                         set try -DINLINE=$inline -DUSE_B a.c b.c
18628                         if eval $compile && $run ./try; then
18629                                 $echo "Your compiler supports static $inline, " >&4
18630                                 $echo "but it also creates an external definition," >&4
18631                                 $echo "so I won't use it." >&4
18632                                 val=$undef
18633                         else
18634                                 $echo "Your compiler supports static $inline." >&4
18635                                 val=$define
18636                                 perl_static_inline="static $inline";
18637                                 break;
18638                         fi
18639                 else
18640                         $echo "Your compiler does NOT support static $inline." >&4
18641                         val="$undef"
18642                 fi
18643         done
18644         ;;
18645 *inline*) # Some variant of inline exists.
18646         echo "Keeping your $hint value of $perl_static_inline."
18647         val=$define
18648         ;;
18649 static)  # No inline capabilities
18650         echo "Keeping your $hint value of $perl_static_inline."
18651         val=$undef
18652         ;;
18653 *)  # Unrecognized previous value -- blindly trust the supplied
18654         # value and hope it makes sense.  Use old value for
18655         # d_static_inline, if there is one.
18656         echo "Keeping your $hint value of $perl_static_inline."
18657         case "$d_static_inline" in
18658                 '') val=$define ;;
18659                 *)  val=$d_static_inline ;;
18660         esac
18661         ;;
18662 esac
18663 # Fallback to plain 'static' if nothing worked.
18664 case "$perl_static_inline" in
18665 '')
18666         perl_static_inline="static"
18667         val=$undef
18668         ;;
18669 esac
18670 set d_static_inline
18671 eval $setvar
18672 $rm -f a.[co] b.[co]
18673 $rm_try
18674
18675 : Check stream access
18676 $cat >&4 <<EOM
18677 Checking how to access stdio streams by file descriptor number...
18678 EOM
18679 case "$stdio_stream_array" in
18680 '')     $cat >try.c <<EOCP
18681 #include <stdio.h>
18682 int main() {
18683   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18684     printf("yes\n");
18685 }
18686 EOCP
18687         for s in _iob __iob __sF
18688         do
18689                 set try -DSTDIO_STREAM_ARRAY=$s
18690                 if eval $compile; then
18691                         case "`$run ./try`" in
18692                         yes)    stdio_stream_array=$s; break ;;
18693                         esac
18694                 fi
18695         done
18696         $rm_try
18697 esac
18698 case "$stdio_stream_array" in
18699 '')     $cat >&4 <<EOM
18700 I can't figure out how to access stdio streams by file descriptor number.
18701 EOM
18702         d_stdio_stream_array="$undef"
18703         ;;
18704 *)      $cat >&4 <<EOM
18705 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18706 EOM
18707         d_stdio_stream_array="$define"
18708         ;;
18709 esac
18710
18711 : see if strcoll exists
18712 set strcoll d_strcoll
18713 eval $inlibc
18714
18715 : see if strerror_l exists
18716 set strerror_l d_strerror_l
18717 eval $inlibc
18718
18719 : see if strerror_r exists
18720 set strerror_r d_strerror_r
18721 eval $inlibc
18722 case "$d_strerror_r" in
18723 "$define")
18724         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18725         case "$d_strerror_r_proto:$usethreads" in
18726         ":define")      d_strerror_r_proto=define
18727                 set d_strerror_r_proto strerror_r $hdrs
18728                 eval $hasproto ;;
18729         *)      ;;
18730         esac
18731         case "$d_strerror_r_proto" in
18732         define)
18733         case "$strerror_r_proto" in
18734         ''|0) try='int strerror_r(int, char*, size_t);'
18735         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18736         esac
18737         case "$strerror_r_proto" in
18738         ''|0) try='int strerror_r(int, char*, int);'
18739         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18740         esac
18741         case "$strerror_r_proto" in
18742         ''|0) try='char* strerror_r(int, char*, size_t);'
18743         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18744         esac
18745         case "$strerror_r_proto" in
18746         ''|0)   d_strerror_r=undef
18747                 strerror_r_proto=0
18748                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18749         * )     case "$strerror_r_proto" in
18750                 REENTRANT_PROTO*) ;;
18751                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18752                 esac
18753                 echo "Prototype: $try" ;;
18754         esac
18755         ;;
18756         *)      case "$usethreads" in
18757                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18758                 esac
18759                 d_strerror_r=undef
18760                 strerror_r_proto=0
18761                 ;;
18762         esac
18763         ;;
18764 *)      strerror_r_proto=0
18765         ;;
18766 esac
18767
18768 : see if strftime exists
18769 set strftime d_strftime
18770 eval $inlibc
18771
18772 : see if strlcat exists
18773 set strlcat d_strlcat
18774 eval $inlibc
18775
18776 : see if strlcpy exists
18777 set strlcpy d_strlcpy
18778 eval $inlibc
18779
18780 : see if strnlen exists
18781 set strnlen d_strnlen
18782 eval $inlibc
18783
18784 : see if strtod exists
18785 set strtod d_strtod
18786 eval $inlibc
18787
18788 : see if strtol exists
18789 set strtol d_strtol
18790 eval $inlibc
18791
18792 : see if strtold exists
18793 set strtold d_strtold
18794 eval $inlibc
18795
18796 : see if strtold_l exists
18797 set strtold_l d_strtold_l
18798 eval $inlibc
18799
18800 : see if strtoll exists
18801 set strtoll d_strtoll
18802 eval $inlibc
18803
18804 case "$d_longlong-$d_strtoll" in
18805 "$define-$define")
18806         $cat <<EOM
18807 Checking whether your strtoll() works okay...
18808 EOM
18809         $cat >try.c <<'EOCP'
18810 #include <errno.h>
18811 #ifdef __hpux
18812 #define strtoll __strtoll
18813 #endif
18814 #ifdef __EMX__
18815 #define strtoll _strtoll
18816 #endif
18817 #include <stdio.h>
18818 extern long long int strtoll(char *s, char **, int);
18819 static int bad = 0;
18820 int check(char *s, long long ell, int een) {
18821         long long gll;
18822         errno = 0;
18823         gll = strtoll(s, 0, 10);
18824         if (!((gll == ell) && (errno == een)))
18825                 bad++;
18826 }
18827 int main() {
18828         check(" 1",                                      1LL, 0);
18829         check(" 0",                                      0LL, 0);
18830         check("-1",                                     -1LL, 0);
18831         check("-9223372036854775808", -9223372036854775808LL, 0);
18832         check("-9223372036854775808", -9223372036854775808LL, 0);
18833         check(" 9223372036854775807",  9223372036854775807LL, 0);
18834         check("-9223372036854775808", -9223372036854775808LL, 0);
18835         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18836         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18837         if (!bad)
18838                 printf("ok\n");
18839 }
18840 EOCP
18841         set try
18842         if eval $compile; then
18843                 yyy=`$run ./try`
18844                 case "$yyy" in
18845                 ok) echo "Your strtoll() seems to be working okay." ;;
18846                 *) cat <<EOM >&4
18847 Your strtoll() doesn't seem to be working okay.
18848 EOM
18849                    d_strtoll="$undef"
18850                    ;;
18851                 esac
18852         else
18853                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18854                 d_strtoll="$undef"
18855         fi
18856         ;;
18857 esac
18858
18859 : see if strtoq exists
18860 set strtoq d_strtoq
18861 eval $inlibc
18862
18863 : see if strtoul exists
18864 set strtoul d_strtoul
18865 eval $inlibc
18866
18867 case "$d_strtoul" in
18868 "$define")
18869         $cat <<EOM
18870 Checking whether your strtoul() works okay...
18871 EOM
18872         $cat >try.c <<'EOCP'
18873 #include <errno.h>
18874 #include <stdio.h>
18875 extern unsigned long int strtoul(char *s, char **, int);
18876 static int bad = 0;
18877 void check(char *s, unsigned long eul, int een) {
18878         unsigned long gul;
18879         errno = 0;
18880         gul = strtoul(s, 0, 10);
18881         if (!((gul == eul) && (errno == een)))
18882                 bad++;
18883 }
18884 int main() {
18885         check(" 1", 1L, 0);
18886         check(" 0", 0L, 0);
18887 EOCP
18888         case "$longsize" in
18889         8)
18890             $cat >>try.c <<'EOCP'
18891         check("18446744073709551615", 18446744073709551615UL, 0);
18892         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18893 #if 0 /* strtoul() for /^-/ strings is undefined. */
18894         check("-1", 18446744073709551615UL, 0);
18895         check("-18446744073709551614", 2, 0);
18896         check("-18446744073709551615", 1, 0);
18897         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18898         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18899 #endif
18900 EOCP
18901                 ;;
18902         4)
18903                     $cat >>try.c <<'EOCP'
18904         check("4294967295", 4294967295UL, 0);
18905         check("4294967296", 4294967295UL, ERANGE);
18906 #if 0 /* strtoul() for /^-/ strings is undefined. */
18907         check("-1", 4294967295UL, 0);
18908         check("-4294967294", 2, 0);
18909         check("-4294967295", 1, 0);
18910         check("-4294967296", 4294967295UL, ERANGE);
18911         check("-4294967297", 4294967295UL, ERANGE);
18912 #endif
18913 EOCP
18914                 ;;
18915         *)
18916 : Should we write these tests to be more portable by sprintf-ing
18917 : ~0 and then manipulating that char string as input for strtol?
18918                 ;;
18919         esac
18920         $cat >>try.c <<'EOCP'
18921         if (!bad)
18922                 printf("ok\n");
18923         return 0;
18924 }
18925 EOCP
18926         set try
18927         if eval $compile; then
18928                 case "`$run ./try`" in
18929                 ok) echo "Your strtoul() seems to be working okay." ;;
18930                 *) cat <<EOM >&4
18931 Your strtoul() doesn't seem to be working okay.
18932 EOM
18933                    d_strtoul="$undef"
18934                    ;;
18935                 esac
18936         else
18937                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18938                 d_strtoul="$undef"
18939         fi
18940         ;;
18941 esac
18942
18943 : see if strtoull exists
18944 set strtoull d_strtoull
18945 eval $inlibc
18946
18947 case "$d_longlong-$d_strtoull" in
18948 "$define-$define")
18949         $cat <<EOM
18950 Checking whether your strtoull() works okay...
18951 EOM
18952         $cat >try.c <<'EOCP'
18953 #include <errno.h>
18954 #ifdef __hpux
18955 #define strtoull __strtoull
18956 #endif
18957 #include <stdio.h>
18958 extern unsigned long long int strtoull(char *s, char **, int);
18959 static int bad = 0;
18960 int check(char *s, long long eull, int een) {
18961         long long gull;
18962         errno = 0;
18963         gull = strtoull(s, 0, 10);
18964         if (!((gull == eull) && (errno == een)))
18965                 bad++;
18966 }
18967 int main() {
18968         check(" 1",                                        1LL, 0);
18969         check(" 0",                                        0LL, 0);
18970         check("18446744073709551615",  18446744073709551615ULL, 0);
18971         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18972 #if 0 /* strtoull() for /^-/ strings is undefined. */
18973         check("-1",                    18446744073709551615ULL, 0);
18974         check("-18446744073709551614",                     2LL, 0);
18975         check("-18446744073709551615",                     1LL, 0);
18976         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18977         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18978 #endif
18979         if (!bad)
18980                 printf("ok\n");
18981 }
18982 EOCP
18983         set try
18984         if eval $compile; then
18985                 case "`$run ./try`" in
18986                 ok) echo "Your strtoull() seems to be working okay." ;;
18987                 *) cat <<EOM >&4
18988 Your strtoull() doesn't seem to be working okay.
18989 EOM
18990                    d_strtoull="$undef"
18991                    ;;
18992                 esac
18993         else
18994                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18995                 d_strtoull="$undef"
18996         fi
18997         ;;
18998 esac
18999
19000 : see if strtouq exists
19001 set strtouq d_strtouq
19002 eval $inlibc
19003
19004 case "$d_strtouq" in
19005 "$define")
19006         $cat <<EOM
19007 Checking whether your strtouq() works okay...
19008 EOM
19009         $cat >try.c <<'EOCP'
19010 #include <errno.h>
19011 #include <stdio.h>
19012 extern unsigned long long int strtouq(char *s, char **, int);
19013 static int bad = 0;
19014 void check(char *s, unsigned long long eull, int een) {
19015         unsigned long long gull;
19016         errno = 0;
19017         gull = strtouq(s, 0, 10);
19018         if (!((gull == eull) && (errno == een)))
19019                 bad++;
19020 }
19021 int main() {
19022         check(" 1",                                        1LL, 0);
19023         check(" 0",                                        0LL, 0);
19024         check("18446744073709551615",  18446744073709551615ULL, 0);
19025         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19026 #if 0 /* strtouq() for /^-/ strings is undefined. */
19027         check("-1",                    18446744073709551615ULL, 0);
19028         check("-18446744073709551614",                     2LL, 0);
19029         check("-18446744073709551615",                     1LL, 0);
19030         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19031         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19032 #endif
19033         if (!bad)
19034                 printf("ok\n");
19035         return 0;
19036 }
19037 EOCP
19038         set try
19039         if eval $compile; then
19040                 case "`$run ./try`" in
19041                 ok) echo "Your strtouq() seems to be working okay." ;;
19042                 *) cat <<EOM >&4
19043 Your strtouq() doesn't seem to be working okay.
19044 EOM
19045                    d_strtouq="$undef"
19046                    ;;
19047                 esac
19048         else
19049                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19050                 d_strtouq="$undef"
19051         fi
19052         ;;
19053 esac
19054
19055 : see if strxfrm exists
19056 set strxfrm d_strxfrm
19057 eval $inlibc
19058
19059 : see if symlink exists
19060 set symlink d_symlink
19061 eval $inlibc
19062
19063 : see if syscall exists
19064 set syscall d_syscall
19065 eval $inlibc
19066
19067 : see if prototype for syscall is available
19068 echo " "
19069 set d_syscallproto syscall $i_unistd unistd.h
19070 eval $hasproto
19071
19072 : see if sysconf exists
19073 set sysconf d_sysconf
19074 eval $inlibc
19075
19076 : see if sys_errlist[] exists
19077 echo " "
19078 if test "X$d_syserrlst" = X; then
19079         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19080                 echo "You have sys_errlist[], so we could roll our own strerror."
19081                 d_syserrlst="$define"
19082         else
19083                 echo "You don't have sys_errlist[], so strerror() is welcome."
19084                 d_syserrlst="$undef"
19085         fi
19086 fi
19087
19088 : see if system exists
19089 set system d_system
19090 eval $inlibc
19091
19092 : see if tcgetpgrp exists
19093 set tcgetpgrp d_tcgetpgrp
19094 eval $inlibc
19095
19096 : see if tcsetpgrp exists
19097 set tcsetpgrp d_tcsetpgrp
19098 eval $inlibc
19099
19100 : see if prototype for telldir is available
19101 echo " "
19102 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19103 eval $hasproto
19104
19105 : see if tgamma exists
19106 set tgamma d_tgamma
19107 eval $inlibc
19108
19109 : check for thread_safe_nl_langinfo_l item
19110 $cat <<EOM
19111
19112 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19113 EOM
19114 $cat >try.c <<EOCP
19115 #$i_stdlib I_STDLIB
19116 #ifdef I_STDLIB
19117 #  include <stdlib.h>
19118 #endif
19119 #include <string.h>
19120 #$i_langinfo I_LANGINFO
19121 #ifdef I_LANGINFO
19122 #  include <langinfo.h>
19123 #endif
19124 #$i_pthread I_PTHREAD
19125 #ifdef I_PTHREAD
19126 #  include <pthread.h>
19127 #endif
19128 #$i_locale I_LOCALE
19129 #ifdef I_LOCALE
19130 #  include <locale.h>
19131 #endif
19132
19133 void *
19134 thread_start(void * arg)
19135 {
19136     nl_langinfo(RADIXCHAR);
19137 }
19138
19139 int main() {
19140     char * main_buffer;
19141     char save_main_buffer[1000];
19142     pthread_t subthread;
19143     pthread_attr_t attr;
19144
19145     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19146
19147     /* If too large for our generous allowance, just assume we don't have
19148      * it. */
19149     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19150         exit(1);
19151     }
19152
19153     strcpy(save_main_buffer, main_buffer);
19154
19155     if (pthread_attr_init(&attr) != 0) {
19156         exit(1);
19157     }
19158
19159     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19160         exit(1);
19161     }
19162
19163     if (pthread_join(subthread, NULL) != 0) {
19164         exit(1);
19165     }
19166
19167     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19168 }
19169 EOCP
19170 case "$usethreads" in
19171     define)
19172         set try
19173         if eval $compile; then
19174             echo "Your system has nl_langinfo_l()..." >&4
19175             if $run ./try; then
19176                 echo "and it is thread-safe (just as I'd hoped)." >&4
19177                 d_thread_safe_nl_langinfo_l="$define"
19178                 echo "$d_thread_safe_nl_langinfo_l" >&4
19179             else
19180                 echo "but it isn't thread-safe, so we won't use it." >&4
19181             fi
19182         else
19183             echo "your system does not have nl_langinfo_l()" >&4
19184         fi
19185         ;;
19186     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19187 esac
19188 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19189         d_thread_safe_nl_langinfo_l="$undef"
19190 fi
19191 $rm_try
19192
19193 : see if time exists
19194 echo " "
19195 if test "X$d_time" = X -o X"$timetype" = X; then
19196     if set time val -f d_time; eval $csym; $val; then
19197                 echo 'time() found.' >&4
19198                 val="$define"
19199                 rp="What is the type returned by time() on this system?"
19200                 set time_t timetype long stdio.h sys/types.h
19201                 eval $typedef_ask
19202     else
19203                 echo 'time() not found, hope that will do.' >&4
19204                 val="$undef"
19205                 timetype='int';
19206     fi
19207     set d_time
19208     eval $setvar
19209 fi
19210
19211 : see if timegm exists
19212 set timegm d_timegm
19213 eval $inlibc
19214
19215 : see if this is a sys/times.h system
19216 set sys/times.h i_systimes
19217 eval $inhdr
19218
19219 : see if times exists
19220 echo " "
19221 if set times val -f d_times; eval $csym; $val; then
19222         echo 'times() found.' >&4
19223         d_times="$define"
19224         inc=''
19225         case "$i_systimes" in
19226         "$define") inc='sys/times.h';;
19227         esac
19228         rp="What is the type returned by times() on this system?"
19229         set clock_t clocktype long stdio.h sys/types.h $inc
19230         eval $typedef_ask
19231 else
19232         echo 'times() NOT found, hope that will do.' >&4
19233         d_times="$undef"
19234         clocktype='int'
19235 fi
19236
19237 : see if tmpnam_r exists
19238 set tmpnam_r d_tmpnam_r
19239 eval $inlibc
19240 case "$d_tmpnam_r" in
19241 "$define")
19242         hdrs="$i_systypes sys/types.h define stdio.h "
19243         case "$d_tmpnam_r_proto:$usethreads" in
19244         ":define")      d_tmpnam_r_proto=define
19245                 set d_tmpnam_r_proto tmpnam_r $hdrs
19246                 eval $hasproto ;;
19247         *)      ;;
19248         esac
19249         case "$d_tmpnam_r_proto" in
19250         define)
19251         case "$tmpnam_r_proto" in
19252         ''|0) try='char* tmpnam_r(char*);'
19253         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19254         esac
19255         case "$tmpnam_r_proto" in
19256         ''|0)   d_tmpnam_r=undef
19257                 tmpnam_r_proto=0
19258                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19259         * )     case "$tmpnam_r_proto" in
19260                 REENTRANT_PROTO*) ;;
19261                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19262                 esac
19263                 echo "Prototype: $try" ;;
19264         esac
19265         ;;
19266         *)      case "$usethreads" in
19267                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19268                 esac
19269                 d_tmpnam_r=undef
19270                 tmpnam_r_proto=0
19271                 ;;
19272         esac
19273         ;;
19274 *)      tmpnam_r_proto=0
19275         ;;
19276 esac
19277
19278 : see if trunc exists
19279 set trunc d_trunc
19280 eval $inlibc
19281
19282 : see if truncate exists
19283 set truncate d_truncate
19284 eval $inlibc
19285
19286 : see if ttyname_r exists
19287 set ttyname_r d_ttyname_r
19288 eval $inlibc
19289 case "$d_ttyname_r" in
19290 "$define")
19291         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19292         case "$d_ttyname_r_proto:$usethreads" in
19293         ":define")      d_ttyname_r_proto=define
19294                 set d_ttyname_r_proto ttyname_r $hdrs
19295                 eval $hasproto ;;
19296         *)      ;;
19297         esac
19298         case "$d_ttyname_r_proto" in
19299         define)
19300         case "$ttyname_r_proto" in
19301         ''|0) try='int ttyname_r(int, char*, size_t);'
19302         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19303         esac
19304         case "$ttyname_r_proto" in
19305         ''|0) try='int ttyname_r(int, char*, int);'
19306         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19307         esac
19308         case "$ttyname_r_proto" in
19309         ''|0) try='char* ttyname_r(int, char*, int);'
19310         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19311         esac
19312         case "$ttyname_r_proto" in
19313         ''|0)   d_ttyname_r=undef
19314                 ttyname_r_proto=0
19315                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19316         * )     case "$ttyname_r_proto" in
19317                 REENTRANT_PROTO*) ;;
19318                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19319                 esac
19320                 echo "Prototype: $try" ;;
19321         esac
19322         ;;
19323         *)      case "$usethreads" in
19324                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19325                 esac
19326                 d_ttyname_r=undef
19327                 ttyname_r_proto=0
19328                 ;;
19329         esac
19330         ;;
19331 *)      ttyname_r_proto=0
19332         ;;
19333 esac
19334
19335 : see if tzname[] exists
19336 echo " "
19337 if set tzname val -a d_tzname; eval $csym; $val; then
19338         val="$define"
19339         echo 'tzname[] found.' >&4
19340 else
19341         val="$undef"
19342         echo 'tzname[] NOT found.' >&4
19343 fi
19344 set d_tzname
19345 eval $setvar
19346
19347 : Check if is a multiplatform env
19348 case "$osname" in
19349 darwin) multiarch="$define" ;;
19350 esac
19351 case "$multiarch" in
19352 ''|[nN]*) multiarch="$undef" ;;
19353 esac
19354
19355 : check for ordering of bytes in a UV
19356 echo " "
19357 case "$multiarch" in
19358 *$define*)
19359         $cat <<EOM
19360 You seem to be doing a multiarchitecture build,
19361 skipping the byteorder check.
19362
19363 EOM
19364         byteorder='ffff'
19365         ;;
19366 *)
19367         case "$byteorder" in
19368         '')
19369                 $cat <<'EOM'
19370 In the following, larger digits indicate more significance.  A big-endian
19371 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19372 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19373 machines may have weird orders like 3412.  A Cray will report 87654321,
19374 an Alpha will report 12345678. If the test program works the default is
19375 probably right.
19376 I'm now running the test program...
19377 EOM
19378                 $cat >try.c <<EOCP
19379 #include <stdio.h>
19380 #$i_stdlib I_STDLIB
19381 #ifdef I_STDLIB
19382 #include <stdlib.h>
19383 #endif
19384 #include <sys/types.h>
19385 typedef $uvtype UV;
19386 int main()
19387 {
19388         int i;
19389         union {
19390                 UV l;
19391                 char c[$uvsize];
19392         } u;
19393
19394         if ($uvsize > 4)
19395                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19396         else
19397                 u.l = (UV)0x04030201;
19398         for (i = 0; i < $uvsize; i++)
19399                 printf("%c", u.c[i]+'0');
19400         printf("\n");
19401         exit(0);
19402 }
19403 EOCP
19404                 xxx_prompt=y
19405                 set try
19406                 if eval $compile && $run ./try > /dev/null; then
19407                         dflt=`$run ./try`
19408                         case "$dflt" in
19409                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19410                                 echo "(The test program ran ok.)"
19411                                 echo "byteorder=$dflt"
19412                                 xxx_prompt=n
19413                         ;;
19414                         ????|????????) echo "(The test program ran ok.)" ;;
19415                         *) echo "(The test program didn't run right for some reason.)" ;;
19416                         esac
19417                 else
19418                         dflt='4321'
19419                         cat <<'EOM'
19420 (I can't seem to compile the test program.  Guessing big-endian...)
19421 EOM
19422                 fi
19423                 case "$xxx_prompt" in
19424                 y)
19425                         rp="What is the order of bytes in $uvtype?"
19426                         . ./myread
19427                         byteorder="$ans"
19428                         ;;
19429                 *)      byteorder=$dflt
19430                         ;;
19431                 esac
19432                 ;;
19433         esac
19434         $rm_try
19435         ;;
19436 esac
19437
19438 : Checking 32bit alignedness
19439 $cat <<EOM
19440
19441 Checking to see whether you can access character data unalignedly...
19442 EOM
19443 case "$d_u32align" in
19444 '')   $cat >try.c <<EOCP
19445 #include <stdio.h>
19446 #$i_stdlib I_STDLIB
19447 #ifdef I_STDLIB
19448 #include <stdlib.h>
19449 #endif
19450 #define U32 $u32type
19451 #define BYTEORDER 0x$byteorder
19452 #define U8 $u8type
19453 #include <signal.h>
19454 #ifdef SIGBUS
19455 $signal_t bletch(int s) { exit(4); }
19456 #endif
19457 int main() {
19458 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19459     volatile U8 buf[8];
19460     volatile U32 *up;
19461     int i;
19462
19463     if (sizeof(U32) != 4) {
19464         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19465         exit(1);
19466     }
19467
19468     fflush(stdout);
19469
19470 #ifdef SIGBUS
19471     signal(SIGBUS, bletch);
19472 #endif
19473
19474     buf[0] = 0;
19475     buf[1] = 0;
19476     buf[2] = 0;
19477     buf[3] = 1;
19478     buf[4] = 0;
19479     buf[5] = 0;
19480     buf[6] = 0;
19481     buf[7] = 1;
19482
19483     for (i = 0; i < 4; i++) {
19484         up = (U32*)(buf + i);
19485         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19486                (*up == 1 << (8*(3-i)))  /* little-endian */
19487               )
19488            )
19489         {
19490             printf("read failed (%x)\n", *up);
19491             exit(2);
19492         }
19493     }
19494
19495     /* write test */
19496     for (i = 0; i < 4; i++) {
19497         up = (U32*)(buf + i);
19498         *up = 0xBeef;
19499         if (*up != 0xBeef) {
19500             printf("write failed (%x)\n", *up);
19501             exit(3);
19502         }
19503     }
19504
19505     exit(0);
19506 #else
19507     printf("1\n");
19508     exit(1);
19509 #endif
19510     return 0;
19511 }
19512 EOCP
19513 set try
19514 if eval $compile_ok; then
19515         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19516         $run ./try 2>&1 >/dev/null
19517         case "$?" in
19518         0)      cat >&4 <<EOM
19519 You can access character data pretty unalignedly.
19520 EOM
19521                 d_u32align="$undef"
19522                 ;;
19523         *)      cat >&4 <<EOM
19524 It seems that you must access character data in an aligned manner.
19525 EOM
19526                 d_u32align="$define"
19527                 ;;
19528         esac
19529 else
19530         rp='Can you access character data at unaligned addresses?'
19531         dflt='n'
19532         . ./myread
19533         case "$ans" in
19534         [yY]*)  d_u32align="$undef"  ;;
19535         *)      d_u32align="$define" ;;
19536         esac
19537 fi
19538 $rm_try
19539 ;;
19540 esac
19541
19542 : see if ualarm exists
19543 set ualarm d_ualarm
19544 eval $inlibc
19545
19546 : see if umask exists
19547 set umask d_umask
19548 eval $inlibc
19549
19550 : see if unordered exists
19551 set unordered d_unordered
19552 eval $inlibc
19553
19554 : see if unsetenv exists
19555 set unsetenv d_unsetenv
19556 eval $inlibc
19557
19558 : see if usleep exists
19559 set usleep d_usleep
19560 eval $inlibc
19561
19562 : see if prototype for usleep is available
19563 echo " "
19564 set d_usleepproto usleep $i_unistd unistd.h
19565 eval $hasproto
19566
19567 : see if ustat exists
19568 set ustat d_ustat
19569 eval $inlibc
19570
19571 : see if closedir exists
19572 set closedir d_closedir
19573 eval $inlibc
19574
19575 case "$d_closedir" in
19576 "$define")
19577         echo " "
19578         echo "Checking whether closedir() returns a status..." >&4
19579         cat > try.c <<EOM
19580 #$i_dirent I_DIRENT             /**/
19581 #$i_sysdir I_SYS_DIR            /**/
19582 #$i_sysndir I_SYS_NDIR          /**/
19583 #$i_systypes I_SYS_TYPES        /**/
19584
19585 #if defined(I_SYS_TYPES)
19586 #include <sys/types.h>
19587 #endif
19588 #if defined(I_DIRENT)
19589 #include <dirent.h>
19590 #else
19591 #ifdef I_SYS_NDIR
19592 #include <sys/ndir.h>
19593 #else
19594 #ifdef I_SYS_DIR
19595 #include <sys/dir.h>
19596 #endif
19597 #endif
19598 #endif
19599 int main() { return closedir(opendir(".")); }
19600 EOM
19601         set try
19602         if eval $compile_ok; then
19603                 if $run ./try > /dev/null 2>&1 ; then
19604                         echo "Yes, it does."
19605                         val="$undef"
19606                 else
19607                         echo "No, it doesn't."
19608                         val="$define"
19609                 fi
19610         else
19611                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19612                 val="$define"
19613         fi
19614         ;;
19615 *)
19616         val="$undef";
19617         ;;
19618 esac
19619 set d_void_closedir
19620 eval $setvar
19621 $rm_try
19622
19623 : see if there is a wait4
19624 set wait4 d_wait4
19625 eval $inlibc
19626
19627 : see if waitpid exists
19628 set waitpid d_waitpid
19629 eval $inlibc
19630
19631 : look for wcscmp
19632 echo " "
19633 $cat >try.c <<'EOCP'
19634 #include <stdio.h>
19635 #include <wchar.h>
19636 int main ()
19637 {
19638     wchar_t *s = L" ";
19639     return (wcscmp (s, s) ? 1 : 0);
19640     }
19641 EOCP
19642 set try
19643 val="$undef"
19644 if eval $compile; then
19645     `$run ./try`
19646     case "$?" in
19647         0)  echo "A working wcscmp() found." >&4
19648             val="$define" ;;
19649         *)  echo "wcscmp() found, but it doesn't work" >&4
19650             ;;
19651         esac
19652 else
19653     echo "wcscmp() NOT found." >&4
19654     fi
19655 set d_wcscmp
19656 eval $setvar
19657 $rm_try
19658
19659 : see if wcstombs exists
19660 set wcstombs d_wcstombs
19661 eval $inlibc
19662
19663 : look for wcsxfrm
19664 echo " "
19665 $cat >try.c <<'EOCP'
19666 #include <errno.h>
19667 #include <wchar.h>
19668 int main ()
19669 {
19670     wchar_t dst[4], *src = L" ";
19671     errno = 0;
19672     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19673     }
19674 EOCP
19675 set try
19676 val="$undef"
19677 if eval $compile; then
19678     `$run ./try`
19679     case "$?" in
19680         0)  echo "A working wcsxfrm() found." >&4
19681             val="$define" ;;
19682         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19683             ;;
19684         esac
19685 else
19686     echo "wcsxfrm() NOT found." >&4
19687     fi
19688 set d_wcsxfrm
19689 eval $setvar
19690 $rm_try
19691
19692 : see if wctomb exists
19693 set wctomb d_wctomb
19694 eval $inlibc
19695
19696 : see if writev exists
19697 set writev d_writev
19698 eval $inlibc
19699
19700 : check for alignment requirements
19701 echo " "
19702 case "$alignbytes" in
19703     '') echo "Checking alignment constraints..." >&4
19704         $cat >try.c <<EOCP
19705 #include <stdio.h>
19706 struct foobar {
19707     char foo;
19708     $nvtype bar;
19709 } try_algn;
19710 int main()
19711 {
19712     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19713     return(0);
19714 }
19715 EOCP
19716         set try
19717         if eval $compile_ok; then
19718             dflt=`$run ./try`
19719         else
19720             dflt='8'
19721             echo "(I can't seem to compile the test program...)"
19722         fi
19723         case "$multiarch" in
19724             *$define*)
19725                 : The usual safe value is 8, but Darwin with -Duselongdouble
19726                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19727                 : Configure to pick a larger value if needed.
19728                 if $test "$dflt" -lt 8; then
19729                     dflt='8'
19730                     echo "Setting alignment to 8 for multiarch support.">&4
19731                 fi
19732                 ;;
19733         esac
19734         ;;
19735     *) dflt="$alignbytes"
19736         ;;
19737 esac
19738 rp="Doubles must be aligned on a how-many-byte boundary?"
19739 . ./myread
19740 alignbytes="$ans"
19741 $rm_try
19742
19743 : set the base revision
19744 baserev=5.0
19745
19746 : length of character in bytes. Is always 1, otherwise it is not C
19747 : This used to be a test using sizeof
19748 charsize=1
19749
19750 : Check for the number of bits in a character
19751 case "$charbits" in
19752 '')     echo "Checking how long a character is (in bits)..." >&4
19753         $cat >try.c <<EOCP
19754 #include <stdio.h>
19755 int main ()
19756 {
19757     int n;
19758     unsigned char c;
19759     for (c = 1, n = 0; c; c <<= 1, n++) ;
19760     printf ("%d\n", n);
19761     return (0);
19762     }
19763 EOCP
19764         set try
19765         if eval $compile_ok; then
19766                 dflt=`$run ./try`
19767         else
19768                 dflt='8'
19769                 echo "(I can't seem to compile the test program.  Guessing...)"
19770         fi
19771         ;;
19772 *)
19773         dflt="$charbits"
19774         ;;
19775 esac
19776 rp="What is the length of a character (in bits)?"
19777 . ./myread
19778 charbits="$ans"
19779 $rm_try
19780 case "$charbits" in
19781 8)      ;;
19782 *)      cat >&4 << EOM
19783 Your system has an unsigned character size of $charbits bits, which
19784 is rather unusual (normally it is 8 bits).  Perl likely will not work
19785 correctly on your system, with subtle bugs in various places.
19786 EOM
19787         rp='Do you really want to continue?'
19788         dflt='n'
19789         . ./myread
19790         case "$ans" in
19791                 [yY])   echo >&4 "Okay, continuing."    ;;
19792                 *)      exit 1                          ;;
19793         esac
19794 esac
19795
19796 : how do we concatenate cpp tokens here?
19797 echo " "
19798 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19799 $cat >cpp_stuff.c <<'EOCP'
19800 #define RCAT(a,b)a/**/b
19801 #define ACAT(a,b)a ## b
19802 RCAT(Rei,ser)
19803 ACAT(Cir,cus)
19804 EOCP
19805 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19806 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19807         echo "Oh!  Smells like ANSI's been here." >&4
19808         echo "We can catify or stringify, separately or together!"
19809         cpp_stuff=42
19810 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19811         echo "Ah, yes!  The good old days!" >&4
19812         echo "However, in the good old days we don't know how to stringify and"
19813         echo "catify at the same time."
19814         cpp_stuff=1
19815 else
19816         $cat >&4 <<EOM
19817 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19818 You're going to have to edit the values of CAT[2-5] in config.h...
19819 EOM
19820         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19821 fi
19822 $rm -f cpp_stuff.*
19823
19824 : see if this is a db.h system
19825 set db.h i_db
19826 eval $inhdr
19827
19828 case "$i_db" in
19829 $define)
19830         : Check db version.
19831         echo " "
19832         echo "Checking Berkeley DB version ..." >&4
19833         $cat >try.c <<EOCP
19834 #$d_const HASCONST
19835 #ifndef HASCONST
19836 #define const
19837 #endif
19838 #include <sys/types.h>
19839 #include <stdio.h>
19840 #$i_stdlib I_STDLIB
19841 #ifdef I_STDLIB
19842 #include <stdlib.h>
19843 #endif
19844 #include <db.h>
19845 int main(int argc, char *argv[])
19846 {
19847 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19848     int Major, Minor, Patch ;
19849     unsigned long Version ;
19850     (void)db_version(&Major, &Minor, &Patch) ;
19851     if (argc == 2) {
19852         printf("%d %d %d %d %d %d\n",
19853                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19854                Major, Minor, Patch);
19855         exit(0);
19856     }
19857     printf("You have Berkeley DB Version 2 or greater.\n");
19858
19859     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19860                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19861     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19862                 Major, Minor, Patch) ;
19863
19864     /* check that db.h & libdb are compatible */
19865     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19866         printf("db.h and libdb are incompatible.\n") ;
19867         exit(3);
19868     }
19869
19870     printf("db.h and libdb are compatible.\n") ;
19871
19872     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19873                 + DB_VERSION_PATCH ;
19874
19875     /* needs to be >= 2.3.4 */
19876     if (Version < 2003004) {
19877     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19878         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19879         exit(2);
19880     }
19881
19882     exit(0);
19883 #else
19884 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19885     if (argc == 2) {
19886         printf("1 0 0\n");
19887         exit(0);
19888     }
19889     printf("You have Berkeley DB Version 1.\n");
19890     exit(0);    /* DB version < 2: the coast is clear. */
19891 #else
19892     exit(1);    /* <db.h> not Berkeley DB? */
19893 #endif
19894 #endif
19895 }
19896 EOCP
19897         set try
19898         if eval $compile_ok && $run ./try; then
19899                 echo 'Looks OK.' >&4
19900                 set `$run ./try 1`
19901                 db_version_major=$1
19902                 db_version_minor=$2
19903                 db_version_patch=$3
19904         else
19905                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19906                 i_db=$undef
19907                 case " $libs " in
19908                 *"-ldb "*)
19909                         : Remove db from list of libraries to use
19910                         echo "Removing unusable -ldb from library list" >&4
19911                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19912                         shift
19913                         libs="$*"
19914                         echo "libs = $libs" >&4
19915                         ;;
19916                 esac
19917         fi
19918         $rm_try
19919         ;;
19920 esac
19921
19922 case "$i_db" in
19923 define)
19924         : Check the return type needed for hash
19925         echo " "
19926         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19927         $cat >try.c <<EOCP
19928 #$d_const HASCONST
19929 #ifndef HASCONST
19930 #define const
19931 #endif
19932 #include <sys/types.h>
19933 #include <db.h>
19934
19935 #ifndef DB_VERSION_MAJOR
19936 u_int32_t hash_cb (const void* ptr, size_t size)
19937 {
19938 }
19939 HASHINFO info;
19940 int main()
19941 {
19942         info.hash = hash_cb;
19943 }
19944 #endif
19945 EOCP
19946         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19947                 if $contains warning try.out >>/dev/null 2>&1 ; then
19948                         db_hashtype='int'
19949                 else
19950                         db_hashtype='u_int32_t'
19951                 fi
19952         else
19953                 : XXX Maybe we should just give up here.
19954                 db_hashtype=u_int32_t
19955                 $cat try.out >&4
19956                 echo "Help:  I can't seem to compile the db test program." >&4
19957                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19958         fi
19959         $rm_try
19960         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19961         ;;
19962 *)      db_hashtype=u_int32_t
19963         ;;
19964 esac
19965 case "$i_db" in
19966 define)
19967         : Check the return type needed for prefix
19968         echo " "
19969         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19970         cat >try.c <<EOCP
19971 #$d_const HASCONST
19972 #ifndef HASCONST
19973 #define const
19974 #endif
19975 #include <sys/types.h>
19976 #include <db.h>
19977
19978 #ifndef DB_VERSION_MAJOR
19979 size_t prefix_cb (const DBT *key1, const DBT *key2)
19980 {
19981 }
19982 BTREEINFO info;
19983 int main()
19984 {
19985         info.prefix = prefix_cb;
19986 }
19987 #endif
19988 EOCP
19989         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19990                 if $contains warning try.out >>/dev/null 2>&1 ; then
19991                         db_prefixtype='int'
19992                 else
19993                         db_prefixtype='size_t'
19994                 fi
19995         else
19996                 db_prefixtype='size_t'
19997                 : XXX Maybe we should just give up here.
19998                 $cat try.out >&4
19999                 echo "Help:  I can't seem to compile the db test program." >&4
20000                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20001         fi
20002         $rm_try
20003         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20004         ;;
20005 *)      db_prefixtype='size_t'
20006         ;;
20007 esac
20008
20009 : Include . in @INC
20010 $cat <<EOM
20011
20012 Historically Perl has provided a final fallback of the current working
20013 directory '.' when searching for a library. This, however, can lead to
20014 problems when a Perl program which loads optional modules is called from
20015 a shared directory. This can lead to executing unexpected code.
20016
20017 EOM
20018
20019 # When changing to exclude by default:
20020 case "$default_inc_excludes_dot" in
20021     $undef|false|[nN]*) dflt="n" ;;
20022     *)                  dflt="y" ;;
20023 esac
20024 # To turn exclude off by default:
20025 #case "$default_inc_excludes_dot" in
20026 #    $define|true|[yY]*) dflt="y" ;;
20027 #    *)                  dflt="n" ;;
20028 #esac
20029
20030 rp='Exclude '.' from @INC by default? '
20031 . ./myread
20032 case "$ans" in
20033     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20034     *)          default_inc_excludes_dot="$define" ;;
20035 esac
20036
20037 : Check what kind of inf/nan your system has
20038 $echo "Checking the kind of infinities and nans you have..." >&4
20039 $echo "(The following tests may crash.  That's okay.)" >&4
20040 $cat >try.c <<EOP
20041 #define DOUBLESIZE $doublesize
20042 #$d_longdbl HAS_LONG_DOUBLE
20043 #ifdef HAS_LONG_DOUBLE
20044 #define LONG_DOUBLESIZE $longdblsize
20045 #define LONG_DOUBLEKIND $longdblkind
20046 #endif
20047 #include <math.h>
20048 #include <string.h>
20049 #include <stdio.h>
20050 /* Note that whether the sign bit is on or off
20051  * for NaN depends on the CPU/FPU, and possibly
20052  * can be affected by the build toolchain.
20053  *
20054  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20055  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20056  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20057  * (respectively) as opposed to the more usual
20058  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20059  *
20060  * Pre-IEEE-754 floating point format do not even have inf/nan support
20061  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20062  * to even mention, causing immediate SIGFPE or equivalent: this is
20063  * the case with VAX floating point, for example.
20064  */
20065 static void bytes(void *v, unsigned int n) {
20066   unsigned char *p = (unsigned char *)v;
20067   int i;
20068   for (i = 0; i < n; i++) {
20069     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20070   }
20071 }
20072 int main(int argc, char *argv[]) {
20073    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20074     * because some compilers are 'smart' and not only warn but refuse to
20075     * compile such 'illegal' values. */
20076    double dinf = exp(1e9);
20077    double dnan = sqrt(-1.0);
20078 #ifdef HAS_LONG_DOUBLE
20079    long double ldinf = (long double)exp(1e9);
20080    long double ldnan = (long double)sqrt(-1.0);
20081 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20082 /* the 80-bit long doubles might have garbage in their excess bytes */
20083     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20084     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20085 # endif
20086   if (argc == 2) {
20087     switch (argv[1][0]) {
20088     case '1': bytes(&dinf, sizeof(dinf)); break;
20089     case '2': bytes(&dnan, sizeof(dnan)); break;
20090     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20091     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20092 #endif
20093     }
20094   }
20095   return 0;
20096 }
20097 EOP
20098 set try
20099 if eval $compile; then
20100     doubleinfbytes=`$run ./try 1`
20101     doublenanbytes=`$run ./try 2`
20102     case "$d_longdbl" in
20103     $define)
20104       longdblinfbytes=`$run ./try 3`
20105       longdblnanbytes=`$run ./try 4`
20106       ;;
20107     esac
20108 else
20109     # Defaults in case the above test program failed.
20110     case "$doublekind" in
20111     1) # IEEE 754 32-bit LE
20112        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20113        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20114        ;;
20115     2) # IEEE 754 32-bit BE
20116        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20117        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20118        ;;
20119     3) # IEEE 754 64-bit LE
20120        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20121        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20122        ;;
20123     4) # IEEE 754 64-bit BE
20124        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20125        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20126        ;;
20127     5) # IEEE 754 128-bit LE
20128        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20129        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20130        ;;
20131     6) # IEEE 754 128-bit BE
20132        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20133        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20134        ;;
20135     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20136        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20137        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20138        ;;
20139     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20140        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20141        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20142        ;;
20143     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20144        doubleinfbytes=$undef
20145        doublenanbytes=$undef
20146        ;;
20147     *) # No idea.
20148        doubleinfbytes=$undef
20149        doublenanbytes=$undef
20150        ;;
20151     esac
20152     case "$longdblkind" in
20153     1) # IEEE 754 128-bit LE
20154        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20155        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20156        ;;
20157     2) # IEEE 754 128-bit BE
20158        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20159        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20160        ;;
20161     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20162        case "$longdblsize" in
20163        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20164            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20165            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20166            ;;
20167        16) # x86_64
20168            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20169            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20170            ;;
20171        *)  # No idea.
20172            longdblinfbytes=$undef
20173            longdblnanbytes=$undef
20174        ;;
20175        esac
20176        ;;
20177     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20178        case "$longdblsize" in
20179        12) # 32-bit system
20180            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20181            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20182            ;;
20183        16) # 64-bit system
20184            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20185            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20186            ;;
20187        *)  # No idea.
20188            longdblinfbytes=$undef
20189            longdblnanbytes=$undef
20190        ;;
20191        esac
20192        ;;
20193     5) # 128-bit LE-LE "double double"
20194        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20195        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20196        ;;
20197     6) # 128-bit BE-BE "double double"
20198        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20199        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20200        ;;
20201     7) # 128-bit LE-BE "double double"
20202        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20203        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20204        ;;
20205     8) # 128-bit BE-LE "double double"
20206        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20207        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20208        ;;
20209     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20210        longdblinfbytes=$undef
20211        longdblnanbytes=$undef
20212        ;;
20213     *) # No idea.
20214        longdblinfbytes=$undef
20215        longdblnanbytes=$undef
20216        ;;
20217     esac
20218 fi
20219 # In case the program crashed the values are empty, turn them undef.
20220 case "$doubleinfbytes" in
20221 '') doubleinfbytes=$undef ;;
20222 esac
20223 case "$doublenanbytes" in
20224 '') doublenanbytes=$undef ;;
20225 esac
20226 case "$longdblinfbytes" in
20227 '') longdblinfbytes=$undef ;;
20228 esac
20229 case "$longdblnanbytes" in
20230 '') longdblnanbytes=$undef ;;
20231 esac
20232 $rm_try
20233
20234 : Check the length of the double mantissa
20235 $echo "Checking how many mantissa bits your doubles have..." >&4
20236 $cat >try.c <<EOP
20237 #$i_sunmath I_SUNMATH
20238 #include <float.h>
20239 #ifdef I_SUNMATH
20240 # include <sunmath.h>
20241 #endif
20242 #ifdef DBL_MANT_DIG
20243 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20244 #endif
20245 #include <stdio.h>
20246 int main(int argc, char *argv[]) {
20247 #ifdef BITS
20248   printf("%d\n", BITS);
20249 #endif
20250   return 0;
20251 }
20252 EOP
20253 set try
20254 if eval $compile; then
20255     doublemantbits=`$run ./try`
20256 else
20257     doublemantbits="$undef"
20258 fi
20259 $rm_try
20260
20261 : Check the length of the longdouble mantissa
20262 $echo "Checking how many mantissa bits your long doubles have..." >&4
20263 $cat >try.c <<EOP
20264 #$i_sunmath I_SUNMATH
20265 #include <float.h>
20266 #ifdef I_SUNMATH
20267 # include <sunmath.h>
20268 #endif
20269 #$d_longdbl HAS_LONG_DOUBLE
20270 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20271 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20272 /* This format has no implicit bit.  Beware, however, that for
20273  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20274  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20275  * and the top bit must have been one since 387, zero is plain invalid.
20276  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20277 #  define BITS LDBL_MANT_DIG
20278 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20279 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20280  * reason e.g. Irix thinks 107.  But in any case, we want only
20281  * the number of real bits, the implicit bits are of no interest.  */
20282 #  define BITS 2 * (DBL_MANT_DIG - 1)
20283 # else
20284 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20285 # endif
20286 #endif
20287 #include <stdio.h>
20288 int main(int argc, char *argv[]) {
20289 #ifdef BITS
20290   printf("%d\n", BITS);
20291 #endif
20292   return 0;
20293 }
20294 EOP
20295 set try
20296 if eval $compile; then
20297     longdblmantbits=`$run ./try`
20298 else
20299     longdblmantbits="$undef"
20300 fi
20301 $rm_try
20302
20303 : Check the length of the NV mantissa
20304 $echo "Checking how many mantissa bits your NVs have..." >&4
20305 if test "X$usequadmath" = "X$define"; then
20306   nvmantbits=112 # 128-1-15
20307 else
20308   if test "X$nvsize" = "X$doublesize"; then
20309     nvmantbits="$doublemantbits"
20310   else
20311      if test "X$nvsize" = "X$longdblsize"; then
20312        nvmantbits="$longdblmantbits"
20313      else
20314        nvmantbits="$undef"
20315      fi
20316   fi
20317 fi
20318
20319 : How can we generate normalized random numbers ?
20320 echo " "
20321 echo "Using our internal random number implementation..." >&4
20322
20323 case "$ccflags" in
20324 *-Dmy_rand=*|*-Dmy_srand=*)
20325         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20326         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20327         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20328         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20329         ;;
20330 esac
20331
20332 randfunc=Perl_drand48
20333 drand01="Perl_drand48()"
20334 seedfunc="Perl_drand48_init"
20335 randbits=48
20336 randseedtype=U32
20337
20338 : Probe whether dtrace builds an object, as newer Illumos requires an input
20339 : object file that uses at least one of the probes defined in the .d file
20340 case "$usedtrace" in
20341 $define)
20342     case "$dtracexnolibs" in
20343     $define|true|[yY]*)
20344         dtracexnolibs=$define
20345         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20346         ;;
20347     ' '|'')
20348         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20349              dtracexnolibs=$define
20350              echo "Your dtrace accepts -xnolibs"
20351         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20352              dtracexnolibs=$undef
20353              echo "Your dtrace doesn't accept -xnolibs"
20354         else
20355              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20356              exit 1
20357         fi
20358         ;;
20359     *)
20360         dtracexnolibs=$undef
20361         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20362         ;;
20363     esac
20364     case $dtracexnolibs in
20365     $define) xnolibs=-xnolibs ;;
20366     *) xnolibs= ;;
20367     esac
20368
20369     case "$dtraceobject" in
20370     $define|true|[yY]*)
20371         dtraceobject=$define
20372         ;;
20373     ' '|'')
20374         $cat >try.c <<EOM
20375 #include "perldtrace.h"
20376 int main(void) {
20377     PERL_LOADED_FILE("dummy");
20378     return 0;
20379 }
20380 EOM
20381         dtraceobject=$undef
20382         if $cc -c -o try.o $optimize $ccflags try.c \
20383                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20384                 dtraceobject=$define
20385             echo "Your dtrace builds an object file"
20386         fi
20387         ;;
20388     *) dtraceobject=$undef ;;
20389     esac
20390     $rm_try perldtrace.o perldtrace.h
20391 esac
20392
20393 : Determine if this is an EBCDIC system
20394 echo " "
20395 echo "Determining whether or not we are on an EBCDIC system..." >&4
20396 $cat >try.c <<'EOM'
20397 int main()
20398 {
20399   if ('M'==0xd4) return 0;
20400   return 1;
20401 }
20402 EOM
20403
20404 val=$undef
20405 set try
20406 if eval $compile_ok; then
20407         if $run ./try; then
20408                 echo "You seem to speak EBCDIC." >&4
20409                 val="$define"
20410         else
20411                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20412         fi
20413 else
20414         echo "I'm unable to compile the test program." >&4
20415         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20416 fi
20417 $rm_try
20418 set ebcdic
20419 eval $setvar
20420
20421 : Check how to flush
20422 echo " "
20423 $cat >&4 <<EOM
20424 Checking how to flush all pending stdio output...
20425 EOM
20426 # I only know how to find the first 32 possibly open files on SunOS.
20427 # See also hints/sunos_4_1.sh and util.c  --AD
20428 case "$osname" in
20429 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20430 esac
20431 $cat >>try.c <<EOCP
20432 #include <stdio.h>
20433 #$i_stdlib I_STDLIB
20434 #ifdef I_STDLIB
20435 #include <stdlib.h>
20436 #endif
20437 #$i_unistd I_UNISTD
20438 #ifdef I_UNISTD
20439 # include <unistd.h>
20440 #endif
20441 #$d_sysconf HAS_SYSCONF
20442 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20443 #ifdef HAS_STDIO_STREAM_ARRAY
20444 # define STDIO_STREAM_ARRAY $stdio_stream_array
20445 #endif
20446 int main() {
20447   FILE* p;
20448   unlink("try.out");
20449   p = fopen("try.out", "w");
20450 #ifdef TRY_FPUTC
20451   fputc('x', p);
20452 #else
20453 # ifdef TRY_FPRINTF
20454   fprintf(p, "x");
20455 # endif
20456 #endif
20457 #ifdef TRY_FFLUSH_NULL
20458   fflush(NULL);
20459 #endif
20460 #ifdef TRY_FFLUSH_ALL
20461   {
20462     long open_max = -1;
20463 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20464     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20465 # else
20466 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20467     open_max = sysconf(_SC_OPEN_MAX);
20468 #  else
20469 #   ifdef FOPEN_MAX
20470     open_max = FOPEN_MAX;
20471 #   else
20472 #    ifdef OPEN_MAX
20473     open_max = OPEN_MAX;
20474 #    else
20475 #     ifdef _NFILE
20476     open_max = _NFILE;
20477 #     endif
20478 #    endif
20479 #   endif
20480 #  endif
20481 # endif
20482 # ifdef HAS_STDIO_STREAM_ARRAY
20483     if (open_max > 0) {
20484       long i;
20485       for (i = 0; i < open_max; i++)
20486             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20487                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20488                 STDIO_STREAM_ARRAY[i]._flag)
20489                 fflush(&STDIO_STREAM_ARRAY[i]);
20490     }
20491   }
20492 # endif
20493 #endif
20494   _exit(42);
20495 }
20496 EOCP
20497 : first we have to find out how _not_ to flush
20498 $to try.c
20499 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20500     output=''
20501     set try -DTRY_FPUTC
20502     if eval $compile; then
20503             $run ./try 2>/dev/null
20504             code="$?"
20505             $from try.out
20506             if $test ! -s try.out -a "X$code" = X42; then
20507                 output=-DTRY_FPUTC
20508             fi
20509     fi
20510     case "$output" in
20511     '')
20512             set try -DTRY_FPRINTF
20513             if eval $compile; then
20514                     $run ./try 2>/dev/null
20515                     code="$?"
20516                     $from try.out
20517                     if $test ! -s try.out -a "X$code" = X42; then
20518                         output=-DTRY_FPRINTF
20519                     fi
20520             fi
20521         ;;
20522     esac
20523 fi
20524 : check for fflush NULL behavior
20525 case "$fflushNULL" in
20526 '')     set try -DTRY_FFLUSH_NULL $output
20527         if eval $compile; then
20528                 $run ./try 2>/dev/null
20529                 code="$?"
20530                 $from try.out
20531                 if $test -s try.out -a "X$code" = X42; then
20532                         fflushNULL="`$cat try.out`"
20533                 else
20534                         if $test "X$code" != X42; then
20535                                 $cat >&4 <<EOM
20536 (If this test failed, don't worry, we'll try another method shortly.)
20537 EOM
20538                         fi
20539                 fi
20540         fi
20541         $rm -f core try.core core.try.*
20542         case "$fflushNULL" in
20543         x)      $cat >&4 <<EOM
20544 Your fflush(NULL) works okay for output streams.
20545 Let's see if it clobbers input pipes...
20546 EOM
20547 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20548 # bug that improperly flushes the input end of pipes.  So we avoid the
20549 # autoflush on fork/system/exec support for now. :-(
20550 $cat >tryp.c <<EOCP
20551 #include <stdio.h>
20552 int
20553 main(int argc, char **argv)
20554 {
20555     char buf[1024];
20556     int i;
20557     char *bp = buf;
20558     while (1) {
20559         while ((i = getc(stdin)) != -1
20560                && (*bp++ = i) != '\n'
20561                && bp < &buf[1024])
20562         /* DO NOTHING */ ;
20563         *bp = '\0';
20564         fprintf(stdout, "%s", buf);
20565         fflush(NULL);
20566         if (i == -1)
20567             return 0;
20568         bp = buf;
20569     }
20570 }
20571 EOCP
20572                 fflushNULL="$define"
20573                 set tryp
20574                 if eval $compile; then
20575                     $rm -f tryp.out
20576                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20577                     if $test "X$targethost" != X; then
20578                         $to tryp.c
20579                         $to tryp
20580                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20581                     else
20582                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20583                     fi
20584                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20585                        $cat >&4 <<EOM
20586 fflush(NULL) seems to behave okay with input streams.
20587 EOM
20588                         fflushNULL="$define"
20589                     else
20590                         $cat >&4 <<EOM
20591 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20592 EOM
20593                         fflushNULL="$undef"
20594                     fi
20595                 fi
20596                 $rm -f core tryp.c tryp.core core.tryp.*
20597                 ;;
20598         '')     $cat >&4 <<EOM
20599 Your fflush(NULL) isn't working (contrary to ANSI C).
20600 EOM
20601                 fflushNULL="$undef"
20602                 ;;
20603         *)      $cat >&4 <<EOM
20604 Cannot figure out whether your fflush(NULL) works or not.
20605 I'm assuming it doesn't (contrary to ANSI C).
20606 EOM
20607                 fflushNULL="$undef"
20608                 ;;
20609         esac
20610         ;;
20611 $define|true|[yY]*)
20612         fflushNULL="$define"
20613         ;;
20614 *)
20615         fflushNULL="$undef"
20616         ;;
20617 esac
20618 : check explicit looping only if NULL did not work, and if the pipe
20619 : bug does not show up on an explicit flush too
20620 case "$fflushNULL" in
20621 "$undef")
20622         $cat >tryp.c <<EOCP
20623 #include <stdio.h>
20624 int
20625 main(int argc, char **argv)
20626 {
20627     char buf[1024];
20628     int i;
20629     char *bp = buf;
20630     while (1) {
20631         while ((i = getc(stdin)) != -1
20632                && (*bp++ = i) != '\n'
20633                && bp < &buf[1024])
20634         /* DO NOTHING */ ;
20635         *bp = '\0';
20636         fprintf(stdout, "%s", buf);
20637         fflush(stdin);
20638         if (i == -1)
20639             return 0;
20640         bp = buf;
20641     }
20642 }
20643 EOCP
20644         set tryp
20645         if eval $compile; then
20646             $rm -f tryp.out
20647             if $test "X$targethost" != X; then
20648                 $to tryp.c
20649                 $to tryp
20650                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20651             else
20652                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20653             fi
20654             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20655                $cat >&4 <<EOM
20656 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20657 EOM
20658                 : now check for fflushall behaviour
20659                 case "$fflushall" in
20660                 '')     set try -DTRY_FFLUSH_ALL $output
20661                         if eval $compile; then
20662                                 $cat >&4 <<EOM
20663 (Now testing the other method--but note that this also may fail.)
20664 EOM
20665                                 $run ./try 2>/dev/null
20666                                 code=$?
20667                                 $from try.out
20668                                 if $test -s try.out -a "X$code" = X42; then
20669                                         fflushall="`$cat try.out`"
20670                                 fi
20671                         fi
20672                         $rm_try
20673                         case "$fflushall" in
20674                         x)      $cat >&4 <<EOM
20675 Whew. Flushing explicitly all the stdio streams works.
20676 EOM
20677                                 fflushall="$define"
20678                                 ;;
20679                         '')     $cat >&4 <<EOM
20680 Sigh. Flushing explicitly all the stdio streams doesn't work.
20681 EOM
20682                                 fflushall="$undef"
20683                                 ;;
20684                         *)      $cat >&4 <<EOM
20685 Cannot figure out whether flushing stdio streams explicitly works or not.
20686 I'm assuming it doesn't.
20687 EOM
20688                                 fflushall="$undef"
20689                                 ;;
20690                         esac
20691                         ;;
20692                 "$define"|true|[yY]*)
20693                         fflushall="$define"
20694                         ;;
20695                 *)
20696                         fflushall="$undef"
20697                         ;;
20698                 esac
20699             else
20700                 $cat >&4 <<EOM
20701 All is futile.  Even fflush(stdin) clobbers input pipes!
20702 EOM
20703                 fflushall="$undef"
20704             fi
20705         else
20706             fflushall="$undef"
20707         fi
20708         $rm -f core tryp.c tryp.core core.tryp.*
20709         ;;
20710 *)      fflushall="$undef"
20711         ;;
20712 esac
20713
20714 case "$fflushNULL$fflushall" in
20715 undefundef)
20716         $cat <<EOM
20717 OK, I give up.  I cannot figure out how to flush pending stdio output.
20718 We won't be flushing handles at all before fork/exec/popen.
20719 EOM
20720         ;;
20721 esac
20722 $rm_try tryp
20723
20724 : Store the full pathname to the ar program for use in the C program
20725 : Respect a hint or command line value for full_ar.
20726 case "$full_ar" in
20727 '') full_ar=$ar ;;
20728 esac
20729
20730 : Store the full pathname to the sed program for use in the C program
20731 full_sed=$sed
20732
20733 : see what type gids are declared as in the kernel
20734 echo " "
20735 echo "Looking for the type for group ids returned by getgid()."
20736 set gid_t gidtype xxx stdio.h sys/types.h
20737 eval $typedef
20738 case "$gidtype" in
20739 xxx)
20740         xxx=`./findhdr sys/user.h`
20741         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20742         case $1 in
20743         unsigned) dflt="$1 $2" ;;
20744         *) dflt="$1" ;;
20745         esac
20746         ;;
20747 *) dflt="$gidtype";;
20748 esac
20749 case "$gidtype" in
20750 gid_t) echo "gid_t found." ;;
20751 *)      rp="What is the type for group ids returned by getgid()?"
20752         . ./myread
20753         gidtype="$ans"
20754         ;;
20755 esac
20756
20757 : Check the size of GID
20758 echo " "
20759 case "$gidtype" in
20760 *_t) zzz="$gidtype"     ;;
20761 *)   zzz="gid"          ;;
20762 esac
20763 echo "Checking the size of $zzz..." >&4
20764 cat > try.c <<EOCP
20765 #include <sys/types.h>
20766 #include <stdio.h>
20767 #$i_stdlib I_STDLIB
20768 #ifdef I_STDLIB
20769 #include <stdlib.h>
20770 #endif
20771 int main() {
20772     printf("%d\n", (int)sizeof($gidtype));
20773     exit(0);
20774 }
20775 EOCP
20776 set try
20777 if eval $compile_ok; then
20778         yyy=`$run ./try`
20779         case "$yyy" in
20780         '')     gidsize=4
20781                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20782                 ;;
20783         *)      gidsize=$yyy
20784                 echo "Your $zzz is $gidsize bytes long."
20785                 ;;
20786         esac
20787 else
20788         gidsize=4
20789         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20790 fi
20791
20792 : Check if GID is signed
20793 echo " "
20794 case "$gidtype" in
20795 *_t) zzz="$gidtype"     ;;
20796 *)   zzz="gid"          ;;
20797 esac
20798 echo "Checking the sign of $zzz..." >&4
20799 cat > try.c <<EOCP
20800 #include <sys/types.h>
20801 #include <stdio.h>
20802 int main() {
20803         $gidtype foo = -1;
20804         if (foo < 0)
20805                 printf("-1\n");
20806         else
20807                 printf("1\n");
20808 }
20809 EOCP
20810 set try
20811 if eval $compile; then
20812         yyy=`$run ./try`
20813         case "$yyy" in
20814         '')     gidsign=1
20815                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20816                 ;;
20817         *)      gidsign=$yyy
20818                 case "$gidsign" in
20819                  1) echo "Your $zzz is unsigned." ;;
20820                 -1) echo "Your $zzz is signed."   ;;
20821                 esac
20822                 ;;
20823         esac
20824 else
20825         gidsign=1
20826         echo "(I can't compile the test program--guessing unsigned.)" >&4
20827 fi
20828
20829 : Check 64bit sizes
20830 echo " "
20831
20832 if $test X"$quadtype" != X; then
20833
20834 echo "Checking how to print 64-bit integers..." >&4
20835
20836 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20837         $cat >try.c <<'EOCP'
20838 #include <sys/types.h>
20839 #include <stdio.h>
20840 int main() {
20841   int q = 12345678901;
20842   printf("%ld\n", q);
20843 }
20844 EOCP
20845         set try
20846         if eval $compile; then
20847                 yyy=`$run ./try`
20848                 case "$yyy" in
20849                 12345678901)
20850                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20851                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20852                         echo "We will use %d."
20853                         ;;
20854                 esac
20855         fi
20856 fi
20857
20858 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20859         $cat >try.c <<'EOCP'
20860 #include <sys/types.h>
20861 #include <stdio.h>
20862 int main() {
20863   long q = 12345678901;
20864   printf("%ld\n", q);
20865 }
20866 EOCP
20867         set try
20868         if eval $compile; then
20869                 yyy=`$run ./try`
20870                 case "$yyy" in
20871                 12345678901)
20872                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20873                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20874                         echo "We will use %ld."
20875                         ;;
20876                 esac
20877         fi
20878 fi
20879
20880 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20881         $cat >try.c <<'EOCP'
20882 #include <sys/types.h>
20883 #include <inttypes.h>
20884 #include <stdio.h>
20885 int main() {
20886   int64_t q = 12345678901;
20887   printf("%" PRId64 "\n", q);
20888 }
20889 EOCP
20890         set try
20891         if eval $compile; then
20892                 yyy=`$run ./try`
20893                 case "$yyy" in
20894                 12345678901)
20895                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20896                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20897                         echo "We will use the C9X style."
20898                         ;;
20899                 esac
20900         fi
20901 fi
20902
20903 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20904         $cat >try.c <<EOCP
20905 #include <sys/types.h>
20906 #include <stdio.h>
20907 int main() {
20908   $quadtype q = 12345678901;
20909   printf("%Ld\n", q);
20910 }
20911 EOCP
20912         set try
20913         if eval $compile; then
20914                 yyy=`$run ./try`
20915                 case "$yyy" in
20916                 12345678901)
20917                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20918                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20919                         echo "We will use %Ld."
20920                         ;;
20921                 esac
20922         fi
20923 fi
20924
20925 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20926         $cat >try.c <<'EOCP'
20927 #include <sys/types.h>
20928 #include <stdio.h>
20929 int main() {
20930   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20931   printf("%lld\n", q);
20932 }
20933 EOCP
20934         set try
20935         if eval $compile; then
20936                 yyy=`$run ./try`
20937                 case "$yyy" in
20938                 12345678901)
20939                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20940                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20941                         echo "We will use the %lld style."
20942                         ;;
20943                 esac
20944         fi
20945 fi
20946
20947 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20948         $cat >try.c <<EOCP
20949 #include <sys/types.h>
20950 #include <stdio.h>
20951 int main() {
20952   $quadtype q = 12345678901;
20953   printf("%qd\n", q);
20954 }
20955 EOCP
20956         set try
20957         if eval $compile; then
20958                 yyy=`$run ./try`
20959                 case "$yyy" in
20960                 12345678901)
20961                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20962                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20963                         echo "We will use %qd."
20964                         ;;
20965                 esac
20966         fi
20967 fi
20968
20969 if $test X"$sPRId64" = X; then
20970         echo "Cannot figure out how to print 64-bit integers." >&4
20971 fi
20972 $rm_try
20973
20974 fi
20975
20976 case "$sPRId64" in
20977 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20978         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20979         ;;
20980 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20981         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20982         ;;
20983 esac
20984
20985 : Check format strings for internal types
20986 echo " "
20987 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20988
20989 if $test X"$ivsize" = X8; then
20990         ivdformat="$sPRId64"
20991         uvuformat="$sPRIu64"
20992         uvoformat="$sPRIo64"
20993         uvxformat="$sPRIx64"
20994         uvXUformat="$sPRIXU64"
20995 else
20996         if $test X"$ivsize" = X"$longsize"; then
20997                 ivdformat='"ld"'
20998                 uvuformat='"lu"'
20999                 uvoformat='"lo"'
21000                 uvxformat='"lx"'
21001                 uvXUformat='"lX"'
21002         else
21003                 if $test X"$ivsize" = X"$intsize"; then
21004                         ivdformat='"d"'
21005                         uvuformat='"u"'
21006                         uvoformat='"o"'
21007                         uvxformat='"x"'
21008                         uvXUformat='"X"'
21009                 else
21010                         : far out
21011                         if $test X"$ivsize" = X"$shortsize"; then
21012                                 ivdformat='"hd"'
21013                                 uvuformat='"hu"'
21014                                 uvoformat='"ho"'
21015                                 uvxformat='"hx"'
21016                                 uvXUformat='"hX"'
21017                         fi
21018                 fi
21019         fi
21020 fi
21021
21022 if $test X"$usequadmath" = X"$define"; then
21023     nveformat='"Qe"'
21024     nvfformat='"Qf"'
21025     nvgformat='"Qg"'
21026     nvEUformat='"QE"'
21027     nvFUformat='"QF"'
21028     nvGUformat='"QG"'
21029 else
21030     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21031         nveformat="$sPRIeldbl"
21032         nvfformat="$sPRIfldbl"
21033         nvgformat="$sPRIgldbl"
21034         nvEUformat="$sPRIEUldbl"
21035         nvFUformat="$sPRIFUldbl"
21036         nvGUformat="$sPRIGUldbl"
21037     else
21038         nveformat='"e"'
21039         nvfformat='"f"'
21040         nvgformat='"g"'
21041         nvEUformat='"E"'
21042         nvFUformat='"F"'
21043         nvGUformat='"G"'
21044     fi
21045 fi
21046
21047 case "$ivdformat" in
21048 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21049     exit 1
21050     ;;
21051 esac
21052
21053 : Check format string for GID
21054
21055 echo " "
21056 $echo "Checking the format string to be used for gids..." >&4
21057
21058 case "$gidsign" in
21059 -1)     if $test X"$gidsize" = X"$ivsize"; then
21060                 gidformat="$ivdformat"
21061         else
21062                 if $test X"$gidsize" = X"$longsize"; then
21063                         gidformat='"ld"'
21064                 else
21065                         if $test X"$gidsize" = X"$intsize"; then
21066                                 gidformat='"d"'
21067                         else
21068                                 if $test X"$gidsize" = X"$shortsize"; then
21069                                         gidformat='"hd"'
21070                                 fi
21071                         fi
21072                 fi
21073         fi
21074         ;;
21075 *)      if $test X"$gidsize" = X"$uvsize"; then
21076                 gidformat="$uvuformat"
21077         else
21078                 if $test X"$gidsize" = X"$longsize"; then
21079                         gidformat='"lu"'
21080                 else
21081                         if $test X"$gidsize" = X"$intsize"; then
21082                                 gidformat='"u"'
21083                         else
21084                                 if $test X"$gidsize" = X"$shortsize"; then
21085                                         gidformat='"hu"'
21086                                 fi
21087                         fi
21088                 fi
21089         fi
21090         ;;
21091 esac
21092
21093 : see if getgroups exists
21094 set getgroups d_getgrps
21095 eval $inlibc
21096
21097 : see if setgroups exists
21098 set setgroups d_setgrps
21099 eval $inlibc
21100
21101 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21102 echo " "
21103 case "$d_getgrps$d_setgrps" in
21104 *define*)
21105         case "$groupstype" in
21106         '') dflt="$gidtype" ;;
21107         *)  dflt="$groupstype" ;;
21108         esac
21109         $cat <<EOM
21110 What type of pointer is the second argument to getgroups() and setgroups()?
21111 Usually this is the same as group ids, $gidtype, but not always.
21112
21113 EOM
21114         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21115         . ./myread
21116         groupstype="$ans"
21117         ;;
21118 *)  groupstype="$gidtype";;
21119 esac
21120
21121 : check whether make sets MAKE
21122 echo " "
21123 echo "Checking if your $make program sets \$(MAKE)..." >&4
21124 case "$make_set_make" in
21125 '')
21126         $sed 's/^X //' > testmake.mak << 'EOF'
21127 Xall:
21128 X       @echo 'maketemp="$(MAKE)"'
21129 EOF
21130         case "`$make -f testmake.mak 2>/dev/null`" in
21131         *maketemp=*) make_set_make='#' ;;
21132         *)      make_set_make="MAKE=$make" ;;
21133         esac
21134         $rm -f testmake.mak
21135         ;;
21136 esac
21137 case "$make_set_make" in
21138 '#') echo "Yup, it does.";;
21139 *) echo "Nope, it doesn't.";;
21140 esac
21141
21142 : see what type is used for mode_t
21143 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21144 set mode_t modetype int stdio.h sys/types.h
21145 eval $typedef_ask
21146
21147 : see if we need va_copy
21148 echo " "
21149 $cat >try.c <<EOCP
21150 #include <stdarg.h>
21151 #include <stdio.h>
21152 #include <stdlib.h>
21153 #include <signal.h>
21154
21155 int
21156 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21157 {
21158   return vfprintf(f, fmt, *valp);
21159 }
21160
21161 int
21162 myvfprintf(FILE *f, const  char *fmt, va_list val)
21163 {
21164   return ivfprintf(f, fmt, &val);
21165 }
21166
21167 int
21168 myprintf(char *fmt, ...)
21169 {
21170   va_list val;
21171   va_start(val, fmt);
21172   return myvfprintf(stdout, fmt, val);
21173 }
21174
21175 int
21176 main(int ac, char **av)
21177 {
21178   signal(SIGSEGV, exit);
21179
21180   myprintf("%s%cs all right, then\n", "that", '\'');
21181   exit(0);
21182 }
21183 EOCP
21184 set try
21185 if eval $compile && $run ./try 2>&1 >/dev/null; then
21186         case "`$run ./try`" in
21187         "that's all right, then")
21188                 okay=yes
21189                 ;;
21190         esac
21191 fi
21192 case "$okay" in
21193 yes)    echo "It seems that you don't need va_copy()." >&4
21194         need_va_copy="$undef"
21195         ;;
21196 *)      echo "It seems that va_copy() or similar will be needed." >&4
21197         need_va_copy="$define"
21198         ;;
21199 esac
21200 $rm_try
21201
21202 : see what type is used for size_t
21203 rp="What is the type used for the length parameter for string functions?"
21204 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21205 eval $typedef_ask
21206
21207 : check for type of arguments to gethostbyaddr.
21208 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21209         case "$d_gethbyaddr" in
21210         $define)
21211                 $cat <<EOM
21212
21213 Checking to see what type of arguments are accepted by gethostbyaddr().
21214 EOM
21215                 hdrs="$define sys/types.h
21216                         $d_socket sys/socket.h
21217                         $i_niin netinet/in.h
21218                         $i_netdb netdb.h
21219                         $i_unistd unistd.h"
21220                 : The first arg can 'char *' or 'void *'
21221                 : The second arg is some of integral type
21222                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21223                         for yyy in size_t long int; do
21224                                 case "$netdb_host_type" in
21225                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21226                                         if ./protochk "$try" $hdrs; then
21227                                                 echo "Your system accepts $xxx for the first arg."
21228                                                 echo "...and $yyy for the second arg."
21229                                                 netdb_host_type="$xxx"
21230                                                 netdb_hlen_type="$yyy"
21231                                         fi
21232                                         ;;
21233                                 esac
21234                         done
21235                 done
21236                 : In case none of those worked, prompt the user.
21237                 case "$netdb_host_type" in
21238                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21239                         dflt='char *'
21240                         . ./myread
21241                         netdb_host_type=$ans
21242                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21243                         dflt="$sizetype"
21244                         . ./myread
21245                         netdb_hlen_type=$ans
21246                         ;;
21247                 esac
21248                 ;;
21249         *)      : no gethostbyaddr, so pick harmless defaults
21250                 netdb_host_type='char *'
21251                 netdb_hlen_type="$sizetype"
21252                 ;;
21253         esac
21254         # Remove the "const" if needed. -- but then we'll have a
21255         # prototype clash!
21256         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21257 fi
21258
21259 : check for type of argument to gethostbyname.
21260 if test "X$netdb_name_type" = X ; then
21261         case "$d_gethbyname" in
21262         $define)
21263                 $cat <<EOM
21264
21265 Checking to see what type of argument is accepted by gethostbyname().
21266 EOM
21267                 hdrs="$define sys/types.h
21268                         $d_socket sys/socket.h
21269                         $i_niin netinet/in.h
21270                         $i_netdb netdb.h
21271                         $i_unistd unistd.h"
21272                 for xxx in "const char *" "char *"; do
21273                         case "$netdb_name_type" in
21274                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21275                                 if ./protochk "$try" $hdrs; then
21276                                         echo "Your system accepts $xxx."
21277                                         netdb_name_type="$xxx"
21278                                 fi
21279                                 ;;
21280                         esac
21281                 done
21282                 : In case none of those worked, prompt the user.
21283                 case "$netdb_name_type" in
21284                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21285                         dflt='char *'
21286                         . ./myread
21287                         netdb_name_type=$ans
21288                         ;;
21289                 esac
21290                 ;;
21291         *)      : no gethostbyname, so pick harmless default
21292                 netdb_name_type='char *'
21293                 ;;
21294         esac
21295 fi
21296
21297 : check for type of 1st argument to getnetbyaddr.
21298 if test "X$netdb_net_type" = X ; then
21299         case "$d_getnbyaddr" in
21300         $define)
21301                 $cat <<EOM
21302
21303 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21304 EOM
21305                 hdrs="$define sys/types.h
21306                         $d_socket sys/socket.h
21307                         $i_niin netinet/in.h
21308                         $i_netdb netdb.h
21309                         $i_unistd unistd.h"
21310                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21311                         case "$netdb_net_type" in
21312                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21313                                 if ./protochk "$try" $hdrs; then
21314                                         echo "Your system accepts $xxx."
21315                                         netdb_net_type="$xxx"
21316                                 fi
21317                                 ;;
21318                         esac
21319                 done
21320                 : In case none of those worked, prompt the user.
21321                 case "$netdb_net_type" in
21322                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21323                         dflt='long'
21324                         . ./myread
21325                         netdb_net_type=$ans
21326                         ;;
21327                 esac
21328                 ;;
21329         *)      : no getnetbyaddr, so pick harmless default
21330                 netdb_net_type='long'
21331                 ;;
21332         esac
21333 fi
21334 : locate the preferred pager for this system
21335 fn=f/
21336 case "$pager" in
21337 '')
21338         dflt=''
21339         case "$pg" in
21340         /*) dflt=$pg;;
21341         [a-zA-Z]:/*) dflt=$pg;;
21342         esac
21343         case "$more" in
21344         /*) dflt=$more;;
21345         [a-zA-Z]:/*) dflt=$more;;
21346         esac
21347         case "$less" in
21348         /*) dflt=$less;;
21349         [a-zA-Z]:/*) dflt=$less;;
21350         esac
21351         case "$dflt" in
21352         '') dflt=/usr/ucb/more;;
21353         esac
21354         ;;
21355 *)      dflt="$pager"
21356         ;;
21357 esac
21358 fn="f/($dflt)"
21359 echo " "
21360 rp='What pager is used on your system?'
21361 . ./getfile
21362 pager="$ans"
21363
21364 : see if ar generates random libraries by itself
21365 echo " "
21366 echo "Checking how to generate random libraries on your machine..." >&4
21367 echo 'int bar1() { return bar2(); }' > bar1.c
21368 echo 'int bar2() { return 2; }' > bar2.c
21369 $cat > foo.c <<EOP
21370 #$i_stdlib I_STDLIB
21371 #ifdef I_STDLIB
21372 #include <stdlib.h>
21373 #endif
21374 int main() { printf("%d\n", bar1()); exit(0); }
21375 EOP
21376 $cc $ccflags -c bar1.c >/dev/null 2>&1
21377 $cc $ccflags -c bar2.c >/dev/null 2>&1
21378 $cc $ccflags -c foo.c >/dev/null 2>&1
21379 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21380 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21381         $run ./foobar >/dev/null 2>&1; then
21382         echo "$ar appears to generate random libraries itself."
21383         orderlib=false
21384         if [ "X$ranlib" = "X" ]; then
21385             ranlib=":"
21386         fi
21387 elif $ar s bar$_a >/dev/null 2>&1 &&
21388         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21389         $run ./foobar >/dev/null 2>&1; then
21390                 echo "a table of contents needs to be added with '$ar s'."
21391                 orderlib=false
21392                 ranlib="$ar s"
21393 elif $ar ts bar$_a >/dev/null 2>&1 &&
21394         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21395         $run ./foobar >/dev/null 2>&1; then
21396                 echo "a table of contents needs to be added with '$ar ts'."
21397                 orderlib=false
21398                 ranlib="$ar ts"
21399 else
21400         case "$ranlib" in
21401         :) ranlib='';;
21402         '')
21403                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21404                 $test -f $ranlib || ranlib=''
21405                 ;;
21406         esac
21407         if $test -n "$ranlib"; then
21408                 echo "your system has '$ranlib'; we'll use that."
21409                 orderlib=false
21410         else
21411                 echo "your system doesn't seem to support random libraries"
21412                 echo "so we'll use lorder and tsort to order the libraries."
21413                 orderlib=true
21414                 ranlib=":"
21415         fi
21416 fi
21417 $rm -f foo* bar*
21418
21419 : Check the max offset that gmtime and localtime accept
21420 echo "Checking max offsets that gmtime () accepts"
21421
21422 case "$sGMTIME_min/$sGMTIME_max" in
21423     0/0|/)
21424         $cat >try.c <<EOCP
21425 #include <sys/types.h>
21426 #include <stdio.h>
21427 #include <time.h>
21428
21429 int i;
21430 struct tm *tmp;
21431 time_t pt;
21432
21433 void gm_check (time_t t, int min_year, int max_year)
21434 {
21435     tmp = gmtime (&t);
21436     if ( tmp == NULL ||
21437         /* Check tm_year overflow */
21438          tmp->tm_year < min_year || tmp->tm_year > max_year)
21439         tmp = NULL;
21440     else
21441         pt = t;
21442     } /* gm_check */
21443
21444 int check_max ()
21445 {
21446     tmp = NULL;
21447     pt  = 0;
21448 #ifdef MAXLONG
21449     gm_check (MAXLONG, 69, 0x7fffffff);
21450 #endif
21451     if (tmp == NULL || tmp->tm_year < 0) {
21452         for (i = 63; i >= 0; i--) {
21453             time_t x = pt | ((time_t)1 << i);
21454             if (x < 0 || x < pt) continue;
21455             gm_check (x, 69, 0x7fffffff);
21456             }
21457         }
21458     printf ("sGMTIME_max=%ld\n", pt);
21459     return (0);
21460     } /* check_max */
21461
21462 int check_min ()
21463 {
21464     tmp = NULL;
21465     pt  = 0;
21466 #ifdef MINLONG
21467     gm_check (MINLONG, -1900, 70);
21468 #endif
21469     if (tmp == NULL) {
21470         for (i = 36; i >= 0; i--) {
21471             time_t x = pt - ((time_t)1 << i);
21472             if (x > 0) continue;
21473             gm_check (x, -1900, 70);
21474             }
21475         }
21476     printf ("sGMTIME_min=%ld\n", pt);
21477     return (0);
21478     } /* check_min */
21479
21480 int main (int argc, char *argv[])
21481 {
21482     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21483     check_max ();
21484     check_min ();
21485     return (0);
21486     } /* main */
21487 EOCP
21488         set try
21489         if eval $compile; then
21490             eval `$run ./try 2>/dev/null`
21491         else
21492             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21493             fi
21494         $rm_try
21495         ;;
21496     esac
21497
21498 echo "Checking max offsets that localtime () accepts"
21499
21500 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21501     0/0|/)
21502         $cat >try.c <<EOCP
21503 #include <sys/types.h>
21504 #include <stdio.h>
21505 #include <time.h>
21506
21507 int i;
21508 struct tm *tmp;
21509 time_t pt;
21510
21511 void local_check (time_t t, int min_year, int max_year)
21512 {
21513     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21514         tmp = NULL;
21515     else
21516         tmp = localtime (&t);
21517     if ( tmp == NULL ||
21518         /* Check tm_year overflow */
21519          tmp->tm_year < min_year || tmp->tm_year > max_year)
21520         tmp = NULL;
21521     else
21522         pt = t;
21523     } /* local_check */
21524
21525 int check_max ()
21526 {
21527     tmp = NULL;
21528     pt  = 0;
21529 #ifdef MAXLONG
21530     local_check (MAXLONG, 69, 0x7fffffff);
21531 #endif
21532     if (tmp == NULL || tmp->tm_year < 0) {
21533         for (i = 63; i >= 0; i--) {
21534             time_t x = pt | ((time_t)1 << i);
21535             if (x < 0 || x < pt) continue;
21536             local_check (x, 69, 0x7fffffff);
21537             }
21538         }
21539     printf ("sLOCALTIME_max=%ld\n", pt);
21540     return (0);
21541    } /* check_max */
21542
21543 int check_min ()
21544 {
21545     tmp = NULL;
21546     pt  = 0;
21547 #ifdef MINLONG
21548     local_check (MINLONG, -1900, 70);
21549 #endif
21550     if (tmp == NULL) {
21551         for (i = 36; i >= 0; i--) {
21552             time_t x = pt - ((time_t)1 << i);
21553             if (x > 0) continue;
21554             local_check (x, -1900, 70);
21555             }
21556         }
21557     printf ("sLOCALTIME_min=%ld\n", pt);
21558     return (0);
21559     } /* check_min */
21560
21561 int main (int argc, char *argv[])
21562 {
21563     check_max ();
21564     check_min ();
21565     return (0);
21566     } /* main */
21567 EOCP
21568         set try
21569         if eval $compile; then
21570             eval `$run ./try 2>/dev/null`
21571         else
21572             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21573             fi
21574         $rm_try
21575         ;;
21576     esac
21577
21578 : check for type of arguments to select.
21579 case "$selecttype" in
21580 '') case "$d_select" in
21581         $define)
21582                 echo " "
21583                 $cat <<EOM
21584 Checking to see what type of arguments are accepted by select().
21585 EOM
21586                 hdrs="$define sys/types.h
21587                         $i_systime sys/time.h
21588                         $i_sysselct sys/select.h
21589                         $d_socket sys/socket.h"
21590                 : The first arg can be int, unsigned, or size_t
21591                 : The last arg may or may not be 'const'
21592                 val=''
21593                 : void pointer has been seen but using that
21594                 : breaks the selectminbits test
21595                 for xxx in 'fd_set *' 'int *'; do
21596                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21597                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21598                                         case "$val" in
21599                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21600                                                 if ./protochk "$try" $hdrs; then
21601                                                         echo "Your system accepts $xxx."
21602                                                         val="$xxx"
21603                                                 fi
21604                                                 ;;
21605                                         esac
21606                                 done
21607                         done
21608                 done
21609                 case "$val" in
21610                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21611                         case "$d_fd_set" in
21612                                 $define) dflt="fd_set *" ;;
21613                                 *)              dflt="int *" ;;
21614                         esac
21615                         . ./myread
21616                         val=$ans
21617                         ;;
21618                 esac
21619                 selecttype="$val"
21620                 ;;
21621         *)      : no select, so pick a harmless default
21622                 selecttype='int *'
21623                 ;;
21624         esac
21625         ;;
21626 esac
21627
21628 : check for the select 'width'
21629 case "$selectminbits" in
21630 '') safebits=`expr $ptrsize \* 8`
21631     case "$d_select" in
21632         $define)
21633                 $cat <<EOM
21634
21635 Checking to see on how many bits at a time your select() operates...
21636 EOM
21637                 $cat >try.c <<EOCP
21638 #include <sys/types.h>
21639 #$i_time I_TIME
21640 #$i_systime I_SYS_TIME
21641 #$i_systimek I_SYS_TIME_KERNEL
21642 #ifdef I_TIME
21643 #   include <time.h>
21644 #endif
21645 #ifdef I_SYS_TIME
21646 #   ifdef I_SYS_TIME_KERNEL
21647 #       define KERNEL
21648 #   endif
21649 #   include <sys/time.h>
21650 #   ifdef I_SYS_TIME_KERNEL
21651 #       undef KERNEL
21652 #   endif
21653 #endif
21654 #$i_sysselct I_SYS_SELECT
21655 #ifdef I_SYS_SELECT
21656 #include <sys/select.h>
21657 #endif
21658 #$d_socket HAS_SOCKET
21659 #ifdef HAS_SOCKET
21660 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21661 #endif
21662 #include <stdio.h>
21663 #$i_stdlib I_STDLIB
21664 #ifdef I_STDLIB
21665 #include <stdlib.h>
21666 #endif
21667 $selecttype b;
21668 #define S sizeof(*(b))
21669 #define MINBITS 64
21670 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21671 #define NBITS  (NBYTES * 8)
21672 int main() {
21673     char *s = (char *)malloc(NBYTES);
21674     struct timeval t;
21675     int i;
21676     FILE* fp;
21677     int fd;
21678
21679     if (!s)
21680         exit(1);
21681     fclose(stdin);
21682     fp = fopen("try.c", "r");
21683     if (fp == 0)
21684       exit(2);
21685     fd = fileno(fp);
21686     if (fd < 0)
21687       exit(3);
21688     b = ($selecttype)s;
21689     for (i = 0; i < NBITS; i++)
21690         FD_SET(i, b);
21691     t.tv_sec  = 0;
21692     t.tv_usec = 0;
21693     select(fd + 1, b, 0, 0, &t);
21694     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21695     free(s);
21696     printf("%d\n", i + 1);
21697     return 0;
21698 }
21699 EOCP
21700                 set try
21701                 if eval $compile_ok; then
21702                         selectminbits=`$run ./try 2>/dev/null`
21703                         case "$selectminbits" in
21704                         '')     cat >&4 <<EOM
21705 Cannot figure out on how many bits at a time your select() operates.
21706 I'll play safe and guess it is $safebits bits.
21707 EOM
21708                                 selectminbits=$safebits
21709                                 bits="$safebits bits"
21710                                 ;;
21711                         1)      bits="1 bit" ;;
21712                         *)      bits="$selectminbits bits" ;;
21713                         esac
21714                         echo "Your select() operates on $bits at a time." >&4
21715                 else
21716                         rp='What is the minimum number of bits your select() operates on?'
21717                         case "$byteorder" in
21718                         12345678)       dflt=64 ;;
21719                         1234)           dflt=32 ;;
21720                         *)              dflt=1  ;;
21721                         esac
21722                         . ./myread
21723                         val=$ans
21724                         selectminbits="$val"
21725                 fi
21726                 $rm_try
21727                 ;;
21728         *)      : no select, so pick a harmless default
21729                 selectminbits=$safebits
21730                 ;;
21731         esac
21732         ;;
21733 esac
21734
21735 : Trace out the files included by signal.h, then look for SIGxxx names.
21736 case "$sig_num_init" in
21737 '')
21738 if [ "X$fieldn" = X ]; then
21739         : Just make some guesses.  We check them later.
21740         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21741 else
21742         xxx=`echo '#include <signal.h>' |
21743         $cppstdin $cppminus $cppflags 2>/dev/null |
21744         $grep '^[       ]*#.*include' |
21745         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21746                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21747 fi
21748 xxxfiles=''
21749 for xx in $xxx /dev/null ; do
21750         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21751 done
21752 case "$xxxfiles" in
21753 '')     xxxfiles=`./findhdr signal.h` ;;
21754 esac
21755 xxx=`awk '
21756 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21757         print substr($2, 4, 20)
21758 }
21759 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21760         print substr($3, 4, 20)
21761 }' $xxxfiles`
21762 : Append some common names just in case the awk scan failed.
21763 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21764 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21765 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21766 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21767 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21768
21769 : generate a few handy files for later
21770 $cat > signal.c <<EOCP
21771 #include <sys/types.h>
21772 #include <signal.h>
21773 #$i_stdlib I_STDLIB
21774 #ifdef I_STDLIB
21775 #include <stdlib.h>
21776 #endif
21777 #include <stdio.h>
21778 int main() {
21779
21780 /* Strange style to avoid deeply-nested #if/#else/#endif */
21781 #ifndef NSIG
21782 #  ifdef _NSIG
21783 #    define NSIG (_NSIG)
21784 #  endif
21785 #endif
21786
21787 #ifndef NSIG
21788 #  ifdef SIGMAX
21789 #    define NSIG (SIGMAX+1)
21790 #  endif
21791 #endif
21792
21793 #ifndef NSIG
21794 #  ifdef SIG_MAX
21795 #    define NSIG (SIG_MAX+1)
21796 #  endif
21797 #endif
21798
21799 #ifndef NSIG
21800 #  ifdef _SIG_MAX
21801 #    define NSIG (_SIG_MAX+1)
21802 #  endif
21803 #endif
21804
21805 #ifndef NSIG
21806 #  ifdef MAXSIG
21807 #    define NSIG (MAXSIG+1)
21808 #  endif
21809 #endif
21810
21811 #ifndef NSIG
21812 #  ifdef MAX_SIG
21813 #    define NSIG (MAX_SIG+1)
21814 #  endif
21815 #endif
21816
21817 #ifndef NSIG
21818 #  ifdef SIGARRAYSIZE
21819 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21820 #  endif
21821 #endif
21822
21823 #ifndef NSIG
21824 #  ifdef _sys_nsig
21825 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21826 #  endif
21827 #endif
21828
21829 /* Default to some arbitrary number that's big enough to get most
21830    of the common signals.
21831 */
21832 #ifndef NSIG
21833 #    define NSIG 50
21834 #endif
21835
21836 printf("NSIG %d\n", NSIG);
21837
21838 #ifndef JUST_NSIG
21839
21840 EOCP
21841
21842 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21843 {
21844         printf "#ifdef SIG"; printf $1; printf "\n"
21845         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21846         printf $1; printf ");\n"
21847         printf "#endif\n"
21848 }
21849 END {
21850         printf "#endif /* JUST_NSIG */\n";
21851         printf "exit(0);\n}\n";
21852 }
21853 ' >>signal.c
21854 $cat >signal.awk <<'EOP'
21855 BEGIN { ndups = 0 }
21856 $1 ~ /^NSIG$/ { nsig = $2 }
21857 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21858     if ($2 > maxsig) { maxsig = $2 }
21859     if (sig_name[$2]) {
21860         dup_name[ndups] = $1
21861         dup_num[ndups] = $2
21862         ndups++
21863     }
21864     else {
21865         sig_name[$2] = $1
21866         sig_num[$2] = $2
21867     }
21868 }
21869 END {
21870     if (nsig == 0) {
21871         nsig = maxsig + 1
21872     }
21873     printf("NSIG %d\n", nsig);
21874     for (n = 1; n < nsig; n++) {
21875         if (sig_name[n]) {
21876             printf("%s %d\n", sig_name[n], sig_num[n])
21877         }
21878         else {
21879             printf("NUM%d %d\n", n, n)
21880         }
21881     }
21882     for (n = 0; n < ndups; n++) {
21883         printf("%s %d\n", dup_name[n], dup_num[n])
21884     }
21885 }
21886 EOP
21887 $cat >signal_cmd <<EOS
21888 $startsh
21889 if $test -s signal.lst; then
21890     echo "Using your existing signal.lst file"
21891         exit 0
21892 fi
21893 xxx="$xxx"
21894 EOS
21895 $cat >>signal_cmd <<'EOS'
21896
21897 set signal
21898 if eval $compile_ok; then
21899         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21900                 $uniq | $awk -f signal.awk >signal.lst
21901 else
21902         echo "(I can't seem be able to compile the whole test program)" >&4
21903         echo "(I'll try it in little pieces.)" >&4
21904         set signal -DJUST_NSIG
21905         if eval $compile_ok; then
21906                 $run ./signal$_exe > signal.nsg
21907                 $cat signal.nsg
21908         else
21909                 echo "I can't seem to figure out how many signals you have." >&4
21910                 echo "Guessing 50." >&4
21911                 echo 'NSIG 50' > signal.nsg
21912         fi
21913         : Now look at all the signal names, one at a time.
21914         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21915                 $cat > signal.c <<EOCP
21916 #include <sys/types.h>
21917 #include <signal.h>
21918 #include <stdio.h>
21919 int main() {
21920 printf("$xx %d\n", SIG${xx});
21921 return 0;
21922 }
21923 EOCP
21924                 set signal
21925                 if eval $compile; then
21926                         echo "SIG${xx} found."
21927                         $run ./signal$_exe  >> signal.ls1
21928                 else
21929                         echo "SIG${xx} NOT found."
21930                 fi
21931         done
21932         if $test -s signal.ls1; then
21933                 $cat signal.nsg signal.ls1 |
21934                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21935         fi
21936
21937 fi
21938 if $test -s signal.lst; then
21939         :
21940 else
21941         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21942         echo 'kill -l' >signal
21943         set X `csh -f <signal`
21944         $rm -f signal
21945         shift
21946         case $# in
21947         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21948         esac
21949         echo $@ | $tr ' ' $trnl | \
21950             $awk '{ printf "%s %d\n", $1, ++s; }
21951                   END { printf "NSIG %d\n", ++s }' >signal.lst
21952 fi
21953 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21954 EOS
21955 chmod a+x signal_cmd
21956 $eunicefix signal_cmd
21957 ;;
21958 esac
21959
21960 : generate list of signal names
21961 case "$sig_num_init" in
21962 '')
21963 echo " "
21964 case "$sig_name_init" in
21965 '') doinit=yes ;;
21966 *)  case "$sig_num_init" in
21967     ''|*,*) doinit=yes ;;
21968     esac ;;
21969 esac
21970 case "$doinit" in
21971 yes)
21972         echo "Generating a list of signal names and numbers..." >&4
21973         . ./signal_cmd
21974         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21975         sig_name=`$awk 'BEGIN { printf "ZERO " }
21976                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21977         sig_num=`$awk  'BEGIN { printf "0 " }
21978                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21979         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21980                              !/^NSIG/   { printf "\"%s\", ", $1 }
21981                              END        { printf "0\n" }' signal.lst`
21982         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21983                              !/^NSIG/   { printf "%d, ", $2}
21984                              END        { printf "0\n"}' signal.lst`
21985         ;;
21986 esac
21987 echo "The following $sig_count signals are available:"
21988 echo " "
21989 echo $sig_name | $awk \
21990 'BEGIN { linelen = 0 }
21991 {
21992         for (i = 1; i <= NF; i++) {
21993                 name = "SIG" $i " "
21994                 linelen = linelen + length(name)
21995                 if (linelen > 70) {
21996                         printf "\n"
21997                         linelen = length(name)
21998                 }
21999                 printf "%s", name
22000         }
22001         printf "\n"
22002 }'
22003 sig_size=`echo $sig_name | awk '{print NF}'`
22004 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22005 ;;
22006 esac
22007
22008 : Check size of size
22009 echo " "
22010 case "$sizetype" in
22011 *_t) zzz="$sizetype"    ;;
22012 *)   zzz="filesize"     ;;
22013 esac
22014 echo "Checking the size of $zzz..." >&4
22015 cat > try.c <<EOCP
22016 #include <sys/types.h>
22017 #include <stdio.h>
22018 #$i_stdlib I_STDLIB
22019 #ifdef I_STDLIB
22020 #include <stdlib.h>
22021 #endif
22022 int main() {
22023     printf("%d\n", (int)sizeof($sizetype));
22024     exit(0);
22025 }
22026 EOCP
22027 set try
22028 if eval $compile_ok; then
22029         yyy=`$run ./try`
22030         case "$yyy" in
22031         '')     sizesize=4
22032                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22033                 ;;
22034         *)      sizesize=$yyy
22035                 echo "Your $zzz size is $sizesize bytes."
22036                 ;;
22037         esac
22038 else
22039         sizesize=4
22040         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22041 fi
22042
22043 : check for socklen_t
22044 echo " "
22045 echo "Checking to see if you have socklen_t..." >&4
22046 $cat >try.c <<EOCP
22047 #include <sys/types.h>
22048 #$d_socket HAS_SOCKET
22049 #ifdef HAS_SOCKET
22050 #include <sys/socket.h>
22051 #endif
22052 int main() { socklen_t x = 16; }
22053 EOCP
22054 set try
22055 if eval $compile; then
22056         val="$define"
22057         echo "You have socklen_t."
22058 else
22059         val="$undef"
22060         echo "You do not have socklen_t."
22061         case "$sizetype" in
22062         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22063         esac
22064 fi
22065 $rm_try
22066 set d_socklen_t
22067 eval $setvar
22068
22069 : see if this is a socks.h system
22070 set socks.h i_socks
22071 eval $inhdr
22072
22073 : check for type of the size argument to socket calls
22074 case "$d_socket" in
22075 "$define")
22076         $cat <<EOM
22077
22078 Checking to see what type is the last argument of accept().
22079 EOM
22080         yyy=''
22081         case "$d_socklen_t" in
22082         "$define") yyy="$yyy socklen_t"
22083         esac
22084         yyy="$yyy $sizetype int long unsigned"
22085         for xxx in $yyy; do
22086                 case "$socksizetype" in
22087                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22088                         case "$usesocks" in
22089                         "$define")
22090                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22091                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22092                                         socksizetype="$xxx"
22093                                 fi
22094                                 ;;
22095                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22096                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22097                                         socksizetype="$xxx"
22098                                 fi
22099                                 ;;
22100                         esac
22101                         ;;
22102                 esac
22103         done
22104 : In case none of those worked, prompt the user.
22105         case "$socksizetype" in
22106         '')     rp='What is the type for socket address structure sizes?'
22107                 dflt='int'
22108                 . ./myread
22109                 socksizetype=$ans
22110                 ;;
22111         esac
22112         ;;
22113 *)      : no sockets, so pick relatively harmless default
22114         socksizetype='int'
22115         ;;
22116 esac
22117
22118 : see what type is used for signed size_t
22119 set ssize_t ssizetype int stdio.h sys/types.h
22120 eval $typedef
22121 dflt="$ssizetype"
22122 $cat > try.c <<EOM
22123 #include <stdio.h>
22124 #$i_stdlib I_STDLIB
22125 #ifdef I_STDLIB
22126 #include <stdlib.h>
22127 #endif
22128 #include <sys/types.h>
22129 #define Size_t $sizetype
22130 #define SSize_t $dflt
22131 int main()
22132 {
22133         if (sizeof(Size_t) == sizeof(SSize_t))
22134                 printf("$dflt\n");
22135         else if (sizeof(Size_t) == sizeof(int))
22136                 printf("int\n");
22137         else
22138                 printf("long\n");
22139         exit(0);
22140 }
22141 EOM
22142 echo " "
22143 set try
22144 if eval $compile_ok && $run ./try > /dev/null; then
22145         ssizetype=`$run ./try`
22146         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22147 else
22148         $cat >&4 <<EOM
22149 Help! I can't compile and run the ssize_t test program: please enlighten me!
22150 (This is probably a misconfiguration in your system or libraries, and
22151 you really ought to fix it.  Still, I'll try anyway.)
22152
22153 I need a type that is the same size as $sizetype, but is guaranteed to
22154 be signed.  Common values are ssize_t, int and long.
22155
22156 EOM
22157         rp="What signed type is the same size as $sizetype?"
22158         . ./myread
22159         ssizetype="$ans"
22160 fi
22161 $rm_try
22162
22163 : Check the size of st_ino
22164 $echo " "
22165 $echo "Checking the size of st_ino..." >&4
22166 $cat > try.c <<EOCP
22167 #include <sys/stat.h>
22168 #include <stdio.h>
22169 #$i_stdlib I_STDLIB
22170 #ifdef I_STDLIB
22171 #include <stdlib.h>
22172 #endif
22173 int main() {
22174     struct stat st;
22175     printf("%d\n", (int)sizeof(st.st_ino));
22176     exit(0);
22177 }
22178 EOCP
22179 set try
22180 if eval $compile_ok; then
22181         val=`$run ./try`
22182         case "$val" in
22183         '')     st_ino_size=4
22184                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22185                 ;;
22186         *)      st_ino_size=$val
22187                 $echo "Your st_ino is $st_ino_size bytes long."
22188                 ;;
22189         esac
22190 else
22191         st_ino_size=4
22192         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22193 fi
22194 $rm_try
22195
22196 : Check if st_ino is signed
22197 $echo " "
22198 $echo "Checking the sign of st_ino..." >&4
22199 $cat > try.c <<EOCP
22200 #include <sys/stat.h>
22201 #include <stdio.h>
22202 int main() {
22203         struct stat foo;
22204         foo.st_ino = -1;
22205         if (foo.st_ino < 0)
22206                 printf("-1\n");
22207         else
22208                 printf("1\n");
22209 }
22210 EOCP
22211 set try
22212 if eval $compile; then
22213         val=`$run ./try`
22214         case "$val" in
22215         '')     st_ino_sign=1
22216                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22217                 ;;
22218         *)      st_ino_sign=$val
22219                 case "$st_ino_sign" in
22220                  1) $echo "Your st_ino is unsigned." ;;
22221                 -1) $echo "Your st_ino is signed."   ;;
22222                 esac
22223                 ;;
22224         esac
22225 else
22226         st_ino_sign=1
22227         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22228 fi
22229 $rm_try
22230
22231 : see what type of char stdio uses.
22232 echo " "
22233 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22234 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22235         echo "Your stdio uses unsigned chars." >&4
22236         stdchar="unsigned char"
22237 else
22238         echo "Your stdio uses signed chars." >&4
22239         stdchar="char"
22240 fi
22241 $rm -f stdioh
22242
22243 : Check size of UID
22244 echo " "
22245 case "$uidtype" in
22246 *_t) zzz="$uidtype"     ;;
22247 *)   zzz="uid"          ;;
22248 esac
22249 echo "Checking the size of $zzz..." >&4
22250 cat > try.c <<EOCP
22251 #include <sys/types.h>
22252 #include <stdio.h>
22253 #$i_stdlib I_STDLIB
22254 #ifdef I_STDLIB
22255 #include <stdlib.h>
22256 #endif
22257 int main() {
22258     printf("%d\n", (int)sizeof($uidtype));
22259     exit(0);
22260 }
22261 EOCP
22262 set try
22263 if eval $compile_ok; then
22264         yyy=`$run ./try`
22265         case "$yyy" in
22266         '')     uidsize=4
22267                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22268                 ;;
22269         *)      uidsize=$yyy
22270                 echo "Your $zzz is $uidsize bytes long."
22271                 ;;
22272         esac
22273 else
22274         uidsize=4
22275         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22276 fi
22277
22278 : Check if UID is signed
22279 echo " "
22280 case "$uidtype" in
22281 *_t) zzz="$uidtype"     ;;
22282 *)   zzz="uid"          ;;
22283 esac
22284 echo "Checking the sign of $zzz..." >&4
22285 cat > try.c <<EOCP
22286 #include <sys/types.h>
22287 #include <stdio.h>
22288 int main() {
22289         $uidtype foo = -1;
22290         if (foo < 0)
22291                 printf("-1\n");
22292         else
22293                 printf("1\n");
22294 }
22295 EOCP
22296 set try
22297 if eval $compile; then
22298         yyy=`$run ./try`
22299         case "$yyy" in
22300         '')     uidsign=1
22301                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22302                 ;;
22303         *)      uidsign=$yyy
22304                 case "$uidsign" in
22305                  1) echo "Your $zzz is unsigned." ;;
22306                 -1) echo "Your $zzz is signed."   ;;
22307                 esac
22308                 ;;
22309         esac
22310 else
22311         uidsign=1
22312         echo "(I can't compile the test program--guessing unsigned.)" >&4
22313 fi
22314
22315 : Check format string for UID
22316 echo " "
22317 $echo "Checking the format string to be used for uids..." >&4
22318
22319 case "$uidsign" in
22320 -1)     if $test X"$uidsize" = X"$ivsize"; then
22321                 uidformat="$ivdformat"
22322         else
22323                 if $test X"$uidsize" = X"$longsize"; then
22324                         uidformat='"ld"'
22325                 else
22326                         if $test X"$uidsize" = X"$intsize"; then
22327                                 uidformat='"d"'
22328                         else
22329                                 if $test X"$uidsize" = X"$shortsize"; then
22330                                         uidformat='"hd"'
22331                                 fi
22332                         fi
22333                 fi
22334         fi
22335         ;;
22336 *)      if $test X"$uidsize" = X"$uvsize"; then
22337                 uidformat="$uvuformat"
22338         else
22339                 if $test X"$uidsize" = X"$longsize"; then
22340                         uidformat='"lu"'
22341                 else
22342                         if $test X"$uidsize" = X"$intsize"; then
22343                                 uidformat='"u"'
22344                         else
22345                                 if $test X"$uidsize" = X"$shortsize"; then
22346                                         uidformat='"hu"'
22347                                 fi
22348                         fi
22349                 fi
22350         fi
22351         ;;
22352 esac
22353
22354 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22355 echo " "
22356 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22357 $cat >try.c <<'EOM'
22358 /* Intentionally a long probe as I'd like to sanity check that the exact
22359    approach is going to work, as thinking it will work, but only having it
22360    part working at runtime is worse than not having it.  */
22361
22362 #include <sys/types.h>
22363 #include <sys/sysctl.h>
22364 #include <sys/param.h>
22365 #include <stdio.h>
22366 #include <string.h>
22367 #include <stdlib.h>
22368 #include <unistd.h>
22369
22370 int
22371 main(int argc, char **argv) {
22372     char *buffer;
22373     char *argv_leaf = strrchr(argv[0], '/');
22374     char *buffer_leaf;
22375     size_t size = 0;
22376     int mib[4];
22377
22378     mib[0] = CTL_KERN;
22379     mib[1] = KERN_PROC;
22380     mib[2] = KERN_PROC_PATHNAME;
22381     mib[3] = -1;
22382
22383     if (!argv_leaf) {
22384         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22385         return 1;
22386     }
22387
22388     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22389         perror("sysctl");
22390         return 2;
22391     }
22392
22393     if (size < strlen(argv_leaf) + 1) {
22394         fprintf(stderr, "size %lu is too short for a path\n",
22395                 (unsigned long) size);
22396         return 3;
22397     }
22398
22399     if (size > MAXPATHLEN * MAXPATHLEN) {
22400         fprintf(stderr, "size %lu is too long for a path\n",
22401                 (unsigned long) size);
22402         return 4;
22403     }
22404
22405     buffer = (char *)malloc(size);
22406     if (!buffer) {
22407         perror("malloc");
22408         return 5;
22409     }
22410
22411     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22412         perror("sysctl");
22413         return 6;
22414     }
22415
22416     if (strlen(buffer) + 1 != size) {
22417         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22418                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22419         return 7;
22420     }
22421
22422
22423     if (*buffer != '/') {
22424         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22425         return 8;
22426     }
22427
22428     if (strstr(buffer, "/./")) {
22429         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22430         return 9;
22431     }
22432
22433     if (strstr(buffer, "/../")) {
22434         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22435         return 10;
22436     }
22437
22438     buffer_leaf = strrchr(buffer, '/');
22439     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22440         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22441         return 11;
22442     }
22443
22444     free(buffer);
22445
22446     return 0;
22447 }
22448 EOM
22449
22450 val=$undef
22451 set try
22452 if eval $compile; then
22453         if $run ./try; then
22454                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22455                 val="$define"
22456         else
22457                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22458                 val="$undef"
22459         fi
22460 else
22461         echo "I'm unable to compile the test program." >&4
22462         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22463         val="$undef"
22464 fi
22465 $rm_try
22466 set usekernprocpathname
22467 eval $setvar
22468
22469 : Determine if we can use _NSGetExecutablePath to find executing program
22470 echo " "
22471 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22472 $cat >try.c <<'EOM'
22473 /* Intentionally a long probe as I'd like to sanity check that the exact
22474    approach is going to work, as thinking it will work, but only having it
22475    part working at runtime is worse than not having it.  */
22476 #include <mach-o/dyld.h>
22477 #include <stdio.h>
22478 #include <stdlib.h>
22479 #include <sys/param.h>
22480 #include <string.h>
22481
22482 int
22483 main(int argc, char **argv) {
22484     char buf[1];
22485     uint32_t size = sizeof(buf);
22486     int result;
22487     char *buffer;
22488     char *tidied;
22489     char *argv_leaf = strrchr(argv[0], '/');
22490     char *tidied_leaf;
22491
22492     if (!argv_leaf) {
22493         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22494         return 1;
22495     }
22496
22497     _NSGetExecutablePath(buf, &size);
22498     if (size > MAXPATHLEN * MAXPATHLEN) {
22499         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22500                 (unsigned int) size);
22501         return 2;
22502     }
22503
22504     buffer = (char *)malloc(size);
22505     if (!buffer) {
22506         perror("malloc");
22507         return 3;
22508     }
22509
22510     result = _NSGetExecutablePath(buffer, &size);
22511     if (result != 0) {
22512         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22513                 result, (unsigned int) size);
22514         return 4;
22515     }
22516
22517     tidied = realpath(buffer, NULL);
22518     if (!tidied) {
22519         perror("realpath");
22520         return 5;
22521     }
22522
22523     free(buffer);
22524
22525     if (*tidied != '/') {
22526         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22527         return 6;
22528     }
22529
22530     if (strstr(tidied, "/./")) {
22531         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22532         return 7;
22533     }
22534
22535     if (strstr(tidied, "/../")) {
22536         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22537         return 8;
22538     }
22539
22540     tidied_leaf = strrchr(tidied, '/');
22541     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22542         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22543         return 9;
22544     }
22545
22546     free(tidied);
22547
22548     return 0;
22549 }
22550 EOM
22551
22552 val=$undef
22553 set try
22554 if eval $compile; then
22555         if $run ./try; then
22556                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22557                 val="$define"
22558         else
22559                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22560         fi
22561 else
22562         echo "I'm unable to compile the test program." >&4
22563         echo "I'll assume no _NSGetExecutablePath here." >&4
22564 fi
22565 $rm_try
22566 set usensgetexecutablepath
22567 eval $setvar
22568
22569 : Check if site customization support was requested
22570 case "$usesitecustomize" in
22571     $define|true|[Yy]*)
22572         usesitecustomize="$define"
22573         ;;
22574     *)
22575         usesitecustomize="$undef"
22576         ;;
22577     esac
22578
22579 : determine compiler compiler
22580 case "$yacc" in
22581 '')
22582         dflt=yacc;;
22583 *)
22584         dflt="$yacc";;
22585 esac
22586 echo " "
22587 comp='yacc'
22588 if $test -f "$byacc$_exe"; then
22589         dflt="$byacc"
22590         comp="byacc or $comp"
22591 fi
22592 if $test -f "$bison$_exe"; then
22593         comp="$comp or bison -y"
22594 fi
22595 rp="Which compiler compiler ($comp) shall I use?"
22596 . ./myread
22597 yacc="$ans"
22598 case "$yacc" in
22599 *bis*)
22600         case "$yacc" in
22601         *-y*) ;;
22602         *)
22603                 yacc="$yacc -y"
22604                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22605                 ;;
22606         esac
22607         ;;
22608 esac
22609
22610 : see if this is a bfd.h system
22611 set bfd.h i_bfd
22612 eval $inhdr
22613
22614 : see if this is an execinfo.h system
22615 set execinfo.h i_execinfo
22616 eval $inhdr
22617
22618 : see if this is a fenv.h system
22619 set fenv.h i_fenv
22620 eval $inhdr
22621
22622 : see if this is a fp.h system
22623 set fp.h i_fp
22624 eval $inhdr
22625
22626 : see if this is a fp_class.h system
22627 set fp_class.h i_fp_class
22628 eval $inhdr
22629
22630 : see if gdbm.h is available
22631 set gdbm.h t_gdbm
22632 eval $inhdr
22633 case "$t_gdbm" in
22634 $define)
22635         : see if gdbm_open exists
22636         set gdbm_open d_gdbm_open
22637         eval $inlibc
22638         case "$d_gdbm_open" in
22639         $undef)
22640                 t_gdbm="$undef"
22641                 echo "We won't be including <gdbm.h>"
22642                 ;;
22643         esac
22644         ;;
22645 esac
22646 val="$t_gdbm"
22647 set i_gdbm
22648 eval $setvar
22649
22650 : see if this is a ieeefp.h system
22651 case "$i_ieeefp" in
22652 '' ) set ieeefp.h i_ieeefp
22653      eval $inhdr
22654      ;;
22655 esac
22656
22657 : see if this is a libutil.h system
22658 set libutil.h i_libutil
22659 eval $inhdr
22660
22661 : see if mach cthreads are available
22662 if test "X$usethreads" = "X$define"; then
22663         set mach/cthreads.h i_machcthr
22664         eval $inhdr
22665 else
22666         i_machcthr="$undef"
22667 fi
22668
22669 : see if this is a mntent.h system
22670 set mntent.h i_mntent
22671 eval $inhdr
22672
22673 : see if net/errno.h is available
22674 val=''
22675 set net/errno.h val
22676 eval $inhdr
22677
22678 : Unfortunately, it causes problems on some systems.  Arrgh.
22679 case "$val" in
22680 $define)
22681         cat > try.c <<'EOM'
22682 #include <stdio.h>
22683 #include <errno.h>
22684 #include <net/errno.h>
22685 int func()
22686 {
22687         return ENOTSOCK;
22688 }
22689 EOM
22690         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22691                 echo "We'll be including <net/errno.h>." >&4
22692         else
22693                 echo "We won't be including <net/errno.h>." >&4
22694                 val="$undef"
22695         fi
22696         $rm_try
22697         ;;
22698 esac
22699 set i_neterrno
22700 eval $setvar
22701
22702 : see if netinet/tcp.h is available
22703 set netinet/tcp.h i_netinettcp
22704 eval $inhdr
22705
22706 : see if this is a poll.h system
22707 set poll.h i_poll
22708 eval $inhdr
22709
22710 : see if this is a prot.h system
22711 set prot.h i_prot
22712 eval $inhdr
22713
22714 : Preprocessor symbols
22715 echo " "
22716 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22717 $cat <<'EOSH' > Cppsym.know
22718 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22719 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22720 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22721 arch_pwr ardent ARM ARM32 atarist att386 att3b
22722 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22723 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22724 byteorder byte_order
22725 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22726 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22727 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22728 ELF encore EPI EXTENSIONS
22729 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22730 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22731 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22732 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22733 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
22734 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22735 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22736 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22737 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22738 ksr1
22739 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22740 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22741 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22742 luna88k Lynx
22743 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22744 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22745 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22746 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22747 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22748 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22749 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22750 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22751 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22752 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22753 ns32000 ns32016 ns32332 ns32k nsc32000
22754 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22755 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22756 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22757 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22758 QK_USER QNX
22759 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22760 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22761 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22762 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22763 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22764 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22765 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22766 SYSV4 SYSV5 sysV68 sysV88
22767 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22768 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22769 tower32_800 tower32_850 tss
22770 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22771 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22772 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22773 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22774 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22775 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22776 uxpm uxps
22777 vax venix VMESA vms
22778 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22779 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22780 z8000 zarch
22781 EOSH
22782 # Maybe put other stuff here too.
22783 ./tr '-' '_' <<EOSH >>Cppsym.know
22784 $osname
22785 EOSH
22786 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22787 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22788 $cat Cppsym.know > Cppsym.c
22789 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22790 $rm -f Cppsym.a Cppsym.b Cppsym.c
22791 cat <<EOSH > Cppsym
22792 $startsh
22793 if $test \$# -gt 0; then
22794     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22795     if $test -s Cppsym.got; then
22796         $rm -f Cppsym.got
22797         exit 0
22798     fi
22799     $rm -f Cppsym.got
22800     exit 1
22801 else
22802     $tr " " "$trnl" | ./Cppsym.try
22803     exit 0
22804 fi
22805 EOSH
22806 chmod +x Cppsym
22807 $eunicefix Cppsym
22808 cat <<EOSH > Cppsym.try
22809 $startsh
22810 cat <<'EOCP' > try.c
22811 #include <stdio.h>
22812 #if cpp_stuff == 1
22813 #define STRINGIFY(a)    "a"
22814 #endif
22815 #if cpp_stuff == 42
22816 #define StGiFy(a)  #a
22817 #define STRINGIFY(a)    StGiFy(a)
22818 #endif
22819 #if $cpp_stuff != 1 && $cpp_stuff != 42
22820 #   include "Bletch: How does this C preprocessor stringify macros?"
22821 #endif
22822 int main() {
22823 EOCP
22824 $awk \\
22825 EOSH
22826 cat <<'EOSH' >> Cppsym.try
22827 'length($1) > 0 {
22828     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22829     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22830     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22831     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22832 }' >> try.c
22833 echo 'return 0;}' >> try.c
22834 EOSH
22835 cat <<EOSH >> Cppsym.try
22836 ccflags="$ccflags"
22837 case "$osname-$gccversion" in
22838 irix-) ccflags="\$ccflags -woff 1178" ;;
22839 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22840 esac
22841 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
22842 EOSH
22843 chmod +x Cppsym.try
22844 $eunicefix Cppsym.try
22845 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22846 : Add in any Linux cpp "predefined macros":
22847 case "$osname::$gccversion" in
22848   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22849     tHdrH=_tmpHdr
22850     rm -f $tHdrH'.h' $tHdrH
22851     touch $tHdrH'.h'
22852     # Filter out macro arguments, such as Linux's __INT8_C(c)
22853     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22854        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22855        if [ -s $tHdrH'_cppsym.real' ]; then
22856           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22857        fi
22858     fi
22859     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22860   ;;
22861 esac
22862 : now check the C compiler for additional symbols
22863 postprocess_cc_v=''
22864 case "$osname" in
22865 aix) postprocess_cc_v="|$tr , ' '" ;;
22866 esac
22867 $cat >ccsym <<EOS
22868 $startsh
22869 $cat >tmp.c <<EOF
22870 extern int foo;
22871 EOF
22872 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22873 do
22874         case "\$i" in
22875         -D*) echo "\$i" | $sed 's/^-D//';;
22876         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22877         esac
22878 done
22879 $rm_try
22880 EOS
22881 postprocess_cc_v=''
22882 chmod +x ccsym
22883 $eunicefix ccsym
22884 ./ccsym > ccsym1.raw
22885 if $test -s ccsym1.raw; then
22886     $sort ccsym1.raw | $uniq >ccsym.raw
22887 else
22888     mv ccsym1.raw ccsym.raw
22889 fi
22890
22891 $awk '/\=/ { print $0; next }
22892         { print $0"=1" }' ccsym.raw >ccsym.list
22893 $comm -13 Cppsym.true ccsym.list >ccsym.own
22894 $comm -12 Cppsym.true ccsym.list >ccsym.com
22895 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22896 also=''
22897 if $test -z ccsym.raw; then
22898         echo "Your C compiler doesn't seem to define any symbols!" >&4
22899         echo " "
22900         echo "However, your C preprocessor defines the following symbols:"
22901         $cat Cppsym.true
22902         ccsymbols=''
22903         cppsymbols=`$cat Cppsym.true`
22904         cppsymbols=`echo $cppsymbols`
22905         cppccsymbols="$cppsymbols"
22906 else
22907         if $test -s ccsym.com; then
22908                 echo "Your C compiler and pre-processor define these symbols:"
22909                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22910                 also='also '
22911                 symbols='ones'
22912                 cppccsymbols=`$cat ccsym.com`
22913                 cppccsymbols=`echo $cppccsymbols`
22914                 $test "$silent" || sleep 1
22915         fi
22916         if $test -s ccsym.cpp; then
22917                 $test "$also" && echo " "
22918                 echo "Your C pre-processor ${also}defines the following symbols:"
22919                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22920                 also='further '
22921                 cppsymbols=`$cat ccsym.cpp`
22922                 cppsymbols=`echo $cppsymbols`
22923                 $test "$silent" || sleep 1
22924         fi
22925         if $test -s ccsym.own; then
22926                 $test "$also" && echo " "
22927                 echo "Your C compiler ${also}defines the following cpp symbols:"
22928                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22929                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22930                 ccsymbols=`$cat ccsym.own`
22931                 ccsymbols=`echo $ccsymbols`
22932                 $test "$silent" || sleep 1
22933         fi
22934 fi
22935
22936 : add -D_FORTIFY_SOURCE if feasible and not already there
22937 case "$gccversion" in
22938 [4567].*)       case "$optimize$ccflags" in
22939         *-O*)   case "$ccflags$cppsymbols" in
22940                 *_FORTIFY_SOURCE=*) # Don't add it again.
22941                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22942                         ;;
22943                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22944                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22945                         ;;
22946                 esac
22947                 ;;
22948         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22949                 ;;
22950         esac
22951         ;;
22952 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
22953         ;;
22954 esac
22955
22956 : script used to emit important warnings
22957 cat >warn <<EOS
22958 $startsh
22959 if test \$# -gt 0; then
22960         echo "\$@" >msg
22961 else
22962         cat >msg
22963 fi
22964 echo "*** WARNING:" >&4
22965 sed -e 's/^/*** /' <msg >&4
22966 echo "*** " >&4
22967 cat msg >>config.msg
22968 echo " " >>config.msg
22969 rm -f msg
22970 EOS
22971 chmod +x warn
22972 $eunicefix warn
22973
22974 : see if this is a termio system
22975 val="$undef"
22976 val2="$undef"
22977 val3="$undef"
22978 if $test `./findhdr termios.h`; then
22979     set tcsetattr i_termios
22980     eval $inlibc
22981     val3="$i_termios"
22982 fi
22983 echo " "
22984 case "$val3" in
22985     "$define") echo "You have POSIX termios.h... good!" >&4;;
22986     *)  if ./Cppsym pyr; then
22987             case "`$run /bin/universe`" in
22988                 ucb) if $test `./findhdr sgtty.h`; then
22989                         val2="$define"
22990                         echo "<sgtty.h> found." >&4
22991                     else
22992                         echo "System is pyramid with BSD universe."
22993                         ./warn "<sgtty.h> not found--you could have problems."
22994                     fi;;
22995                 *)  if $test `./findhdr termio.h`; then
22996                         val="$define"
22997                         echo "<termio.h> found." >&4
22998                     else
22999                         echo "System is pyramid with USG universe."
23000                         ./warn "<termio.h> not found--you could have problems."
23001                     fi;;
23002             esac
23003         elif ./usg; then
23004             if $test `./findhdr termio.h`; then
23005                 echo "<termio.h> found." >&4
23006                 val="$define"
23007             elif $test `./findhdr sgtty.h`; then
23008                 echo "<sgtty.h> found." >&4
23009                 val2="$define"
23010             else
23011                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23012             fi
23013         else
23014             if $test `./findhdr sgtty.h`; then
23015                 echo "<sgtty.h> found." >&4
23016                 val2="$define"
23017             elif $test `./findhdr termio.h`; then
23018                 echo "<termio.h> found." >&4
23019                 val="$define"
23020             else
23021                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23022             fi
23023         fi;;
23024 esac
23025 set i_termio; eval $setvar
23026 val=$val2; set i_sgtty; eval $setvar
23027 val=$val3; set i_termios; eval $setvar
23028
23029 : see if stdbool is available
23030 : we want a real compile instead of Inhdr because some Solaris systems
23031 : have stdbool.h, but it can only be used if the compiler indicates it
23032 : is sufficiently c99-compliant.
23033 echo " "
23034 $cat >try.c <<EOCP
23035 #include <stdio.h>
23036 #include <stdbool.h>
23037 int func(bool x)
23038 {
23039     return x ? 1 : 0;
23040 }
23041 int main(int argc, char **argv)
23042 {
23043     return func(0);
23044 }
23045 EOCP
23046 set try
23047 if eval $compile; then
23048         echo "<stdbool.h> found." >&4
23049         val="$define"
23050 else
23051         echo "<stdbool.h> NOT found." >&4
23052         val="$undef"
23053 fi
23054 $rm_try
23055 set i_stdbool
23056 eval $setvar
23057
23058 : see if stdint is available
23059 set stdint.h i_stdint
23060 eval $inhdr
23061
23062 : see if sys/access.h is available
23063 set sys/access.h i_sysaccess
23064 eval $inhdr
23065
23066 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23067 set sys/filio.h i_sysfilio
23068 eval $inhdr
23069 echo " "
23070 if $test `./findhdr sys/ioctl.h`; then
23071         val="$define"
23072         echo '<sys/ioctl.h> found.' >&4
23073 else
23074         val="$undef"
23075         if $test $i_sysfilio = "$define"; then
23076             echo '<sys/ioctl.h> NOT found.' >&4
23077         else
23078                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23079                 $test $i_termio = "$define" && xxx="termio.h"
23080                 $test $i_termios = "$define" && xxx="termios.h"
23081 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23082         fi
23083 fi
23084 set i_sysioctl
23085 eval $setvar
23086
23087 : see if socket ioctl defs are in sys/sockio.h
23088 echo " "
23089 xxx=`./findhdr sys/sockio.h`
23090 if $test "$xxx"; then
23091         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23092                 val="$define"
23093                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23094         else
23095                 val="$undef"
23096                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23097         fi
23098 else
23099         val="$undef"
23100         $cat <<EOM
23101 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23102 EOM
23103 fi
23104 set i_syssockio
23105 eval $setvar
23106
23107 : see if this is a syslog.h system
23108 set syslog.h i_syslog
23109 eval $inhdr
23110
23111 : see if this is a sys/mode.h system
23112 set sys/mode.h i_sysmode
23113 eval $inhdr
23114
23115 : see if there is a sys/poll.h file
23116 set sys/poll.h i_syspoll
23117 eval $inhdr
23118
23119 : see if sys/resource.h has to be included
23120 set sys/resource.h i_sysresrc
23121 eval $inhdr
23122
23123 : see if sys/security.h is available
23124 set sys/security.h i_syssecrt
23125 eval $inhdr
23126
23127 : see if this is a sys/statvfs.h system
23128 set sys/statvfs.h i_sysstatvfs
23129 eval $inhdr
23130
23131 : see if this is a sys/un.h system
23132 set sys/un.h i_sysun
23133 eval $inhdr
23134
23135 : see if this is a sys/utsname.h system
23136 set sys/utsname.h i_sysutsname
23137 eval $inhdr
23138
23139 : see if this is a syswait system
23140 set sys/wait.h i_syswait
23141 eval $inhdr
23142
23143 : see if this is a ustat.h system
23144 set ustat.h i_ustat
23145 eval $inhdr
23146
23147 : see if this is an utime system
23148 set utime.h i_utime
23149 eval $inhdr
23150
23151 : see if this is a vfork system
23152 case "$d_vfork" in
23153 "$define")
23154         set vfork.h i_vfork
23155         eval $inhdr
23156         ;;
23157 *)
23158         i_vfork="$undef"
23159         ;;
23160 esac
23161
23162 : see if wchar.h is present
23163 set wchar.h i_wchar
23164 eval $inhdr
23165
23166 : Check extensions
23167 echo " "
23168 echo "Looking for extensions..." >&4
23169 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23170 : contain old or inaccurate or duplicate values.
23171 nonxs_extensions=''
23172 xs_extensions=''
23173 : We do not use find because it might not be available.
23174 : We do not just use MANIFEST because the user may have dropped
23175 : some additional extensions into the source tree and expect them
23176 : to be built.
23177
23178 : Function to recursively find available extensions, ignoring DynaLoader
23179 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23180 : In 5.10.1 and later, extensions are stored in directories
23181 : like File-Glob instead of the older File/Glob/.
23182 find_extensions='
23183     for xxx in *; do
23184         case "$xxx" in
23185             DynaLoader|dynaload) ;;
23186             *)
23187             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23188             case "$this_ext" in
23189                 Scalar/List/Utils) this_ext="List/Util" ;;
23190                 PathTools)         this_ext="Cwd"       ;;
23191             esac;
23192             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23193             if $contains " $this_ext " "$tdir/$$.tmp"; then
23194                 echo >&4;
23195                 echo "Duplicate directories detected for extension $xxx" >&4;
23196                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23197                 case "$knowitall" in
23198                 "") dflt=y;;
23199                 *) dflt=n;;
23200                 esac;
23201                 . ../UU/myread;
23202                 case "$ans" in
23203                 n*|N*) ;;
23204                 *) echo >&4;
23205                     echo "Ok.  Stopping Configure." >&4;
23206                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23207                     exit 1;;
23208                 esac;
23209                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23210             fi;
23211             $ls -1 "$xxx" > "$tdir/$$.tmp";
23212             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23213                 xs_extensions="$xs_extensions $this_ext";
23214             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23215                 xs_extensions="$xs_extensions $this_ext";
23216             elif $test -d "$xxx"; then
23217                 nonxs_extensions="$nonxs_extensions $this_ext";
23218             fi;
23219             $rm -f "$tdir/$$.tmp";
23220             ;;
23221         esac;
23222     done'
23223 tdir=`pwd`
23224 cd "$rsrc/cpan"
23225 set X
23226 shift
23227 eval $find_extensions
23228 cd "$rsrc/dist"
23229 set X
23230 shift
23231 eval $find_extensions
23232 cd "$rsrc/ext"
23233 set X
23234 shift
23235 eval $find_extensions
23236 set X $xs_extensions
23237 shift
23238 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23239 set X $nonxs_extensions
23240 shift
23241 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23242 cd "$tdir"
23243 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23244
23245 : Now see which are supported on this system.
23246 avail_ext=''
23247 for xxx in $xs_extensions ; do
23248         case "$xxx" in
23249         Amiga*)
23250                 case "$osname" in
23251                 amigaos) avail_ext="$avail_ext $xxx" ;;
23252                 esac
23253                 ;;
23254         DB_File|db_file)
23255                 case "$i_db" in
23256                 $define) avail_ext="$avail_ext $xxx" ;;
23257                 esac
23258                 ;;
23259         GDBM_File|gdbm_fil)
23260                 case "$i_gdbm" in
23261                 $define) avail_ext="$avail_ext $xxx" ;;
23262                 esac
23263                 ;;
23264         I18N/Langinfo|i18n_lan)
23265                 case "$usei18n_lang" in
23266                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23267                 esac
23268                 ;;
23269         IPC/SysV|ipc/sysv)
23270                 : XXX Do we need a useipcsysv variable here
23271                 case "${d_msg}${d_sem}${d_shm}" in
23272                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23273                 esac
23274                 ;;
23275         NDBM_File|ndbm_fil)
23276                 case "$d_ndbm" in
23277                 $define)
23278                     case "$osname-$use64bitint" in
23279                     hpux-define)
23280                         case "$libs" in
23281                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23282                         esac
23283                         ;;
23284                     *) avail_ext="$avail_ext $xxx" ;;
23285                     esac
23286                     ;;
23287                 esac
23288                 ;;
23289         ODBM_File|odbm_fil)
23290                 case "${i_dbm}${i_rpcsvcdbm}" in
23291                 *"${define}"*)
23292                     case "$d_cplusplus" in
23293                     define) ;; # delete as a function name will not work
23294                     *)  case "$osname-$use64bitint" in
23295                         hpux-define)
23296                             case "$libs" in
23297                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23298                             esac
23299                             ;;
23300                         *) avail_ext="$avail_ext $xxx" ;;
23301                         esac
23302                         ;;
23303                     esac
23304                     ;;
23305                 esac
23306                 ;;
23307         Opcode|opcode)
23308                 case "$useopcode" in
23309                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23310                 esac
23311                 ;;
23312         POSIX|posix)
23313                 case "$useposix" in
23314                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23315                 esac
23316                 ;;
23317         Socket|socket)
23318                 case "$d_socket" in
23319                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23320                 esac
23321                 ;;
23322         Sys/Syslog|sys/syslog)
23323                 case $osname in
23324                         amigaos) ;; # not really very useful on AmigaOS
23325                         *)
23326                         : XXX syslog requires socket
23327                         case "$d_socket" in
23328                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23329                         esac
23330                         ;;
23331                 esac
23332                 ;;
23333         Thread|thread)
23334                 case "$usethreads" in
23335                 true|$define|y)
23336                         case "$use5005threads" in
23337                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23338                         esac
23339                 esac
23340                 ;;
23341         threads|threads/shared)
23342                 # threads and threads::shared are special cases.
23343                 # To stop people from asking "Perl 5.8.0 was supposed
23344                 # to have this new fancy threads implementation but my
23345                 # perl doesn't have it" and from people trying to
23346                 # (re)install the threads module using CPAN.pm and
23347                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23348                 # the threads.pm and threads/shared.pm will always be
23349                 # there, croaking informatively ("you need to rebuild
23350                 # all of Perl with threads, sorry") when threads haven't
23351                 # been compiled in.
23352                 # --jhi
23353                 avail_ext="$avail_ext $xxx"
23354                 ;;
23355         VMS*)
23356                 ;;
23357         Win32*)
23358                 case "$osname" in
23359                 cygwin) avail_ext="$avail_ext $xxx" ;;
23360                 esac
23361                 ;;
23362         XS/APItest|xs/apitest)
23363                 # This is just for testing.  Skip it unless we have dynamic loading.
23364
23365                 case "$usedl" in
23366                 $define) avail_ext="$avail_ext $xxx" ;;
23367                 esac
23368                 ;;
23369         XS/Typemap|xs/typemap)
23370                 # This is just for testing.  Skip it unless we have dynamic loading.
23371                 case "$usedl" in
23372                 $define) avail_ext="$avail_ext $xxx" ;;
23373                 esac
23374                 ;;
23375         *)      avail_ext="$avail_ext $xxx"
23376                 ;;
23377         esac
23378 done
23379
23380 set X $avail_ext
23381 shift
23382 avail_ext="$*"
23383
23384 case "$onlyextensions" in
23385 '') ;;
23386 *)  keepextensions=''
23387     echo "You have requested that only certain extensions be included..." >&4
23388     for i in $onlyextensions; do
23389         case " $avail_ext " in
23390         *" $i "*)
23391             echo "Keeping extension $i."
23392             keepextensions="$keepextensions $i"
23393             ;;
23394         *) echo "Ignoring extension $i." ;;
23395         esac
23396     done
23397     avail_ext="$keepextensions"
23398     ;;
23399 esac
23400
23401 case "$noextensions" in
23402 '') ;;
23403 *)  keepextensions=''
23404     echo "You have requested that certain extensions be ignored..." >&4
23405     for i in $avail_ext; do
23406         case " $noextensions " in
23407         *" $i "*) echo "Ignoring extension $i." ;;
23408         *) echo "Keeping extension $i.";
23409            keepextensions="$keepextensions $i"
23410            ;;
23411         esac
23412     done
23413     avail_ext="$keepextensions"
23414     ;;
23415 esac
23416
23417 : Now see which nonxs extensions are supported on this system.
23418 : For now assume all are.
23419 nonxs_ext=''
23420 for xxx in $nonxs_extensions ; do
23421         case "$xxx" in
23422         VMS*)
23423                 ;;
23424         *)      nonxs_ext="$nonxs_ext $xxx"
23425                 ;;
23426         esac
23427 done
23428
23429 set X $nonxs_ext
23430 shift
23431 nonxs_ext="$*"
23432
23433 case $usedl in
23434 $define)
23435         $cat <<EOM
23436 A number of extensions are supplied with $package.  You may choose to
23437 compile these extensions for dynamic loading (the default), compile
23438 them into the $package executable (static loading), or not include
23439 them at all.  Answer "none" to include no extensions.
23440 Note that DynaLoader is always built and need not be mentioned here.
23441
23442 EOM
23443         case "$dynamic_ext" in
23444         '')
23445                 : Exclude those listed in static_ext
23446                 dflt=''
23447                 for xxx in $avail_ext; do
23448                         case " $static_ext " in
23449                         *" $xxx "*) ;;
23450                         *) dflt="$dflt $xxx" ;;
23451                         esac
23452                 done
23453                 set X $dflt
23454                 shift
23455                 dflt="$*"
23456                 ;;
23457         *)      dflt="$dynamic_ext"
23458                 # Perhaps we are reusing an old out-of-date config.sh.
23459                 case "$hint" in
23460                 previous)
23461                         if test X"$dynamic_ext" != X"$avail_ext"; then
23462                                 $cat <<EOM
23463 NOTICE:  Your previous config.sh list may be incorrect.
23464 The extensions now available to you are
23465         ${avail_ext}
23466 but the default list from your previous config.sh is
23467         ${dynamic_ext}
23468
23469 EOM
23470                         fi
23471                         ;;
23472                 esac
23473                 ;;
23474         esac
23475         case "$dflt" in
23476         '')     dflt=none;;
23477         esac
23478         rp="What extensions do you wish to load dynamically?"
23479         . ./myread
23480         case "$ans" in
23481         none) dynamic_ext=' ' ;;
23482         *) dynamic_ext="$ans" ;;
23483         esac
23484
23485         case "$static_ext" in
23486         '')
23487                 : Exclude those already listed in dynamic linking
23488                 dflt=''
23489                 for xxx in $avail_ext; do
23490                         case " $dynamic_ext " in
23491                         *" $xxx "*) ;;
23492                         *) dflt="$dflt $xxx" ;;
23493                         esac
23494                 done
23495                 set X $dflt
23496                 shift
23497                 dflt="$*"
23498                 ;;
23499         *)  dflt="$static_ext"
23500                 ;;
23501         esac
23502
23503         case "$dflt" in
23504         '')     dflt=none;;
23505         esac
23506         rp="What extensions do you wish to load statically?"
23507         . ./myread
23508         case "$ans" in
23509         none) static_ext=' ' ;;
23510         *) static_ext="$ans" ;;
23511         esac
23512         ;;
23513 *)
23514         $cat <<EOM
23515 A number of extensions are supplied with $package.  Answer "none"
23516 to include no extensions.
23517 Note that DynaLoader is always built and need not be mentioned here.
23518
23519 EOM
23520         case "$static_ext" in
23521         '') dflt="$avail_ext" ;;
23522         *)      dflt="$static_ext"
23523                 # Perhaps we are reusing an old out-of-date config.sh.
23524                 case "$hint" in
23525                 previous)
23526                         if test X"$static_ext" != X"$avail_ext"; then
23527                                 $cat <<EOM
23528 NOTICE:  Your previous config.sh list may be incorrect.
23529 The extensions now available to you are
23530         ${avail_ext}
23531 but the default list from your previous config.sh is
23532         ${static_ext}
23533
23534 EOM
23535                         fi
23536                         ;;
23537                 esac
23538                 ;;
23539         esac
23540         : Exclude those that are not xs extensions
23541         case "$dflt" in
23542         '')     dflt=none;;
23543         esac
23544         rp="What extensions do you wish to include?"
23545         . ./myread
23546         case "$ans" in
23547         none) static_ext=' ' ;;
23548         *) static_ext="$ans" ;;
23549         esac
23550         ;;
23551 esac
23552 #
23553 # Encode is a special case.  If we are building Encode as a static
23554 # extension, we need to explicitly list its subextensions as well.
23555 # For other nested extensions, this is handled automatically by
23556 # the appropriate Makefile.PL.
23557 case " $static_ext " in
23558         *" Encode "*) # Add the subextensions of Encode
23559         cd "$rsrc/cpan"
23560         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23561                 static_ext="$static_ext Encode/$xxx"
23562                 known_extensions="$known_extensions Encode/$xxx"
23563         done
23564         cd "$tdir"
23565         ;;
23566 esac
23567
23568 set X $dynamic_ext $static_ext $nonxs_ext
23569 shift
23570 extensions="$*"
23571
23572 # Sanity check:  We require an extension suitable for use with
23573 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23574 # should show up as failures in the test suite, but it's helpful to
23575 # catch them now.) The 'extensions' list is normally sorted
23576 # alphabetically, so we need to accept either
23577 #    DB_File ... Fcntl ... IO  ....
23578 # or something like
23579 #    Fcntl ... NDBM_File ... IO  ....
23580 case " $extensions"  in
23581 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23582 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23583 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23584 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23585    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23586    ;;
23587 esac
23588
23589 : Remove libraries needed only for extensions
23590 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23591 : The exception is SunOS 4.x, which needs them.
23592 case "${osname}X${osvers}" in
23593 sunos*X4*)
23594     perllibs="$libs"
23595     ;;
23596 *) case "$usedl" in
23597     $define|true|[yY]*)
23598             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23599             shift
23600             perllibs="$*"
23601             ;;
23602     *)  perllibs="$libs"
23603             ;;
23604     esac
23605     ;;
23606 esac
23607
23608 : Remove build directory name from cppstdin so it can be used from
23609 : either the present location or the final installed location.
23610 echo " "
23611 : Get out of the UU directory to get correct path name.
23612 cd ..
23613 case "$cppstdin" in
23614 `pwd`/cppstdin)
23615         echo "Stripping down cppstdin path name"
23616         cppstdin=cppstdin
23617         ;;
23618 esac
23619 cd UU
23620
23621 : end of configuration questions
23622 echo " "
23623 echo "End of configuration questions."
23624 echo " "
23625
23626 : back to where it started
23627 if test -d ../UU; then
23628         cd ..
23629 fi
23630
23631 : configuration may be unconditionally patched via a 'config.arch' file
23632 if $test -f config.arch; then
23633         echo "I see a config.arch file, loading it." >&4
23634         . ./config.arch
23635 fi
23636
23637 : configuration may be patched via a 'config.over' file
23638 if $test -f config.over; then
23639         echo " "
23640         dflt=y
23641         rp='I see a config.over file.  Do you wish to load it?'
23642         . UU/myread
23643         case "$ans" in
23644         n*) echo "OK, I'll ignore it.";;
23645         *)      . ./config.over
23646                 echo "Configuration override changes have been loaded."
23647                 ;;
23648         esac
23649 fi
23650
23651 : in case they want portability, strip down executable paths
23652 case "$d_portable" in
23653 "$define")
23654         echo " "
23655         echo "Stripping down executable paths..." >&4
23656         for file in $loclist $trylist; do
23657                 eval temp=\$$file
23658                 eval $file=`basename $temp`
23659         done
23660         ;;
23661 esac
23662
23663 : create config.sh file
23664 echo " "
23665 echo "Creating config.sh..." >&4
23666 $spitshell <<EOT >config.sh
23667 $startsh
23668 #
23669 # This file was produced by running the Configure script. It holds all the
23670 # definitions figured out by Configure. Should you modify one of these values,
23671 # do not forget to propagate your changes by running "Configure -der". You may
23672 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23673 #
23674
23675 # Package name      : $package
23676 # Source directory  : $src
23677 # Configuration time: $cf_time
23678 # Configured by     : $cf_by
23679 # Target system     : $myuname
23680
23681 EOT
23682 : Add in command line options if available
23683 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23684
23685 $spitshell <<EOT >>config.sh
23686
23687 Author='$Author'
23688 Date='$Date'
23689 Header='$Header'
23690 Id='$Id'
23691 Locker='$Locker'
23692 Log='$Log'
23693 RCSfile='$RCSfile'
23694 Revision='$Revision'
23695 Source='$Source'
23696 State='$State'
23697 _a='$_a'
23698 _exe='$_exe'
23699 _o='$_o'
23700 afs='$afs'
23701 afsroot='$afsroot'
23702 alignbytes='$alignbytes'
23703 aphostname='$aphostname'
23704 api_revision='$api_revision'
23705 api_subversion='$api_subversion'
23706 api_version='$api_version'
23707 api_versionstring='$api_versionstring'
23708 ar='$ar'
23709 archlib='$archlib'
23710 archlibexp='$archlibexp'
23711 archname64='$archname64'
23712 archname='$archname'
23713 archobjs='$archobjs'
23714 asctime_r_proto='$asctime_r_proto'
23715 awk='$awk'
23716 baserev='$baserev'
23717 bash='$bash'
23718 bin='$bin'
23719 bin_ELF='$bin_ELF'
23720 binexp='$binexp'
23721 bison='$bison'
23722 byacc='$byacc'
23723 byteorder='$byteorder'
23724 c='$c'
23725 castflags='$castflags'
23726 cat='$cat'
23727 cc='$cc'
23728 cccdlflags='$cccdlflags'
23729 ccdlflags='$ccdlflags'
23730 ccflags='$ccflags'
23731 ccflags_uselargefiles='$ccflags_uselargefiles'
23732 ccname='$ccname'
23733 ccsymbols='$ccsymbols'
23734 ccversion='$ccversion'
23735 cf_by='$cf_by'
23736 cf_email='$cf_email'
23737 cf_time='$cf_time'
23738 charbits='$charbits'
23739 charsize='$charsize'
23740 chgrp='$chgrp'
23741 chmod='$chmod'
23742 chown='$chown'
23743 clocktype='$clocktype'
23744 comm='$comm'
23745 compress='$compress'
23746 contains='$contains'
23747 cp='$cp'
23748 cpio='$cpio'
23749 cpp='$cpp'
23750 cpp_stuff='$cpp_stuff'
23751 cppccsymbols='$cppccsymbols'
23752 cppflags='$cppflags'
23753 cpplast='$cpplast'
23754 cppminus='$cppminus'
23755 cpprun='$cpprun'
23756 cppstdin='$cppstdin'
23757 cppsymbols='$cppsymbols'
23758 crypt_r_proto='$crypt_r_proto'
23759 cryptlib='$cryptlib'
23760 csh='$csh'
23761 ctermid_r_proto='$ctermid_r_proto'
23762 ctime_r_proto='$ctime_r_proto'
23763 d_Gconvert='$d_Gconvert'
23764 d_PRIEUldbl='$d_PRIEUldbl'
23765 d_PRIFUldbl='$d_PRIFUldbl'
23766 d_PRIGUldbl='$d_PRIGUldbl'
23767 d_PRIXU64='$d_PRIXU64'
23768 d_PRId64='$d_PRId64'
23769 d_PRIeldbl='$d_PRIeldbl'
23770 d_PRIfldbl='$d_PRIfldbl'
23771 d_PRIgldbl='$d_PRIgldbl'
23772 d_PRIi64='$d_PRIi64'
23773 d_PRIo64='$d_PRIo64'
23774 d_PRIu64='$d_PRIu64'
23775 d_PRIx64='$d_PRIx64'
23776 d_SCNfldbl='$d_SCNfldbl'
23777 d__fwalk='$d__fwalk'
23778 d_accept4='$d_accept4'
23779 d_access='$d_access'
23780 d_accessx='$d_accessx'
23781 d_acosh='$d_acosh'
23782 d_aintl='$d_aintl'
23783 d_alarm='$d_alarm'
23784 d_archlib='$d_archlib'
23785 d_asctime64='$d_asctime64'
23786 d_asctime_r='$d_asctime_r'
23787 d_asinh='$d_asinh'
23788 d_atanh='$d_atanh'
23789 d_atolf='$d_atolf'
23790 d_atoll='$d_atoll'
23791 d_attribute_deprecated='$d_attribute_deprecated'
23792 d_attribute_format='$d_attribute_format'
23793 d_attribute_malloc='$d_attribute_malloc'
23794 d_attribute_nonnull='$d_attribute_nonnull'
23795 d_attribute_noreturn='$d_attribute_noreturn'
23796 d_attribute_pure='$d_attribute_pure'
23797 d_attribute_unused='$d_attribute_unused'
23798 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23799 d_backtrace='$d_backtrace'
23800 d_bsd='$d_bsd'
23801 d_bsdgetpgrp='$d_bsdgetpgrp'
23802 d_bsdsetpgrp='$d_bsdsetpgrp'
23803 d_builtin_add_overflow='$d_builtin_add_overflow'
23804 d_builtin_choose_expr='$d_builtin_choose_expr'
23805 d_builtin_expect='$d_builtin_expect'
23806 d_builtin_mul_overflow='$d_builtin_mul_overflow'
23807 d_builtin_sub_overflow='$d_builtin_sub_overflow'
23808 d_c99_variadic_macros='$d_c99_variadic_macros'
23809 d_casti32='$d_casti32'
23810 d_castneg='$d_castneg'
23811 d_cbrt='$d_cbrt'
23812 d_chown='$d_chown'
23813 d_chroot='$d_chroot'
23814 d_chsize='$d_chsize'
23815 d_class='$d_class'
23816 d_clearenv='$d_clearenv'
23817 d_closedir='$d_closedir'
23818 d_cmsghdr_s='$d_cmsghdr_s'
23819 d_const='$d_const'
23820 d_copysign='$d_copysign'
23821 d_copysignl='$d_copysignl'
23822 d_cplusplus='$d_cplusplus'
23823 d_crypt='$d_crypt'
23824 d_crypt_r='$d_crypt_r'
23825 d_csh='$d_csh'
23826 d_ctermid='$d_ctermid'
23827 d_ctermid_r='$d_ctermid_r'
23828 d_ctime64='$d_ctime64'
23829 d_ctime_r='$d_ctime_r'
23830 d_cuserid='$d_cuserid'
23831 d_dbminitproto='$d_dbminitproto'
23832 d_difftime64='$d_difftime64'
23833 d_difftime='$d_difftime'
23834 d_dir_dd_fd='$d_dir_dd_fd'
23835 d_dirfd='$d_dirfd'
23836 d_dirnamlen='$d_dirnamlen'
23837 d_dladdr='$d_dladdr'
23838 d_dlerror='$d_dlerror'
23839 d_dlopen='$d_dlopen'
23840 d_dlsymun='$d_dlsymun'
23841 d_dosuid='$d_dosuid'
23842 d_double_has_inf='$d_double_has_inf'
23843 d_double_has_nan='$d_double_has_nan'
23844 d_double_has_negative_zero='$d_double_has_negative_zero'
23845 d_double_has_subnormals='$d_double_has_subnormals'
23846 d_double_style_cray='$d_double_style_cray'
23847 d_double_style_ibm='$d_double_style_ibm'
23848 d_double_style_ieee='$d_double_style_ieee'
23849 d_double_style_vax='$d_double_style_vax'
23850 d_drand48_r='$d_drand48_r'
23851 d_drand48proto='$d_drand48proto'
23852 d_dup2='$d_dup2'
23853 d_dup3='$d_dup3'
23854 d_duplocale='$d_duplocale'
23855 d_eaccess='$d_eaccess'
23856 d_endgrent='$d_endgrent'
23857 d_endgrent_r='$d_endgrent_r'
23858 d_endhent='$d_endhent'
23859 d_endhostent_r='$d_endhostent_r'
23860 d_endnent='$d_endnent'
23861 d_endnetent_r='$d_endnetent_r'
23862 d_endpent='$d_endpent'
23863 d_endprotoent_r='$d_endprotoent_r'
23864 d_endpwent='$d_endpwent'
23865 d_endpwent_r='$d_endpwent_r'
23866 d_endsent='$d_endsent'
23867 d_endservent_r='$d_endservent_r'
23868 d_eofnblk='$d_eofnblk'
23869 d_erf='$d_erf'
23870 d_erfc='$d_erfc'
23871 d_eunice='$d_eunice'
23872 d_exp2='$d_exp2'
23873 d_expm1='$d_expm1'
23874 d_faststdio='$d_faststdio'
23875 d_fchdir='$d_fchdir'
23876 d_fchmod='$d_fchmod'
23877 d_fchmodat='$d_fchmodat'
23878 d_fchown='$d_fchown'
23879 d_fcntl='$d_fcntl'
23880 d_fcntl_can_lock='$d_fcntl_can_lock'
23881 d_fd_macros='$d_fd_macros'
23882 d_fd_set='$d_fd_set'
23883 d_fdclose='$d_fdclose'
23884 d_fdim='$d_fdim'
23885 d_fds_bits='$d_fds_bits'
23886 d_fegetround='$d_fegetround'
23887 d_fgetpos='$d_fgetpos'
23888 d_finite='$d_finite'
23889 d_finitel='$d_finitel'
23890 d_flexfnam='$d_flexfnam'
23891 d_flock='$d_flock'
23892 d_flockproto='$d_flockproto'
23893 d_fma='$d_fma'
23894 d_fmax='$d_fmax'
23895 d_fmin='$d_fmin'
23896 d_fork='$d_fork'
23897 d_fp_class='$d_fp_class'
23898 d_fp_classify='$d_fp_classify'
23899 d_fp_classl='$d_fp_classl'
23900 d_fpathconf='$d_fpathconf'
23901 d_fpclass='$d_fpclass'
23902 d_fpclassify='$d_fpclassify'
23903 d_fpclassl='$d_fpclassl'
23904 d_fpgetround='$d_fpgetround'
23905 d_fpos64_t='$d_fpos64_t'
23906 d_freelocale='$d_freelocale'
23907 d_frexpl='$d_frexpl'
23908 d_fs_data_s='$d_fs_data_s'
23909 d_fseeko='$d_fseeko'
23910 d_fsetpos='$d_fsetpos'
23911 d_fstatfs='$d_fstatfs'
23912 d_fstatvfs='$d_fstatvfs'
23913 d_fsync='$d_fsync'
23914 d_ftello='$d_ftello'
23915 d_ftime='$d_ftime'
23916 d_futimes='$d_futimes'
23917 d_gai_strerror='$d_gai_strerror'
23918 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23919 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23920 d_getaddrinfo='$d_getaddrinfo'
23921 d_getcwd='$d_getcwd'
23922 d_getespwnam='$d_getespwnam'
23923 d_getfsstat='$d_getfsstat'
23924 d_getgrent='$d_getgrent'
23925 d_getgrent_r='$d_getgrent_r'
23926 d_getgrgid_r='$d_getgrgid_r'
23927 d_getgrnam_r='$d_getgrnam_r'
23928 d_getgrps='$d_getgrps'
23929 d_gethbyaddr='$d_gethbyaddr'
23930 d_gethbyname='$d_gethbyname'
23931 d_gethent='$d_gethent'
23932 d_gethname='$d_gethname'
23933 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23934 d_gethostbyname_r='$d_gethostbyname_r'
23935 d_gethostent_r='$d_gethostent_r'
23936 d_gethostprotos='$d_gethostprotos'
23937 d_getitimer='$d_getitimer'
23938 d_getlogin='$d_getlogin'
23939 d_getlogin_r='$d_getlogin_r'
23940 d_getmnt='$d_getmnt'
23941 d_getmntent='$d_getmntent'
23942 d_getnameinfo='$d_getnameinfo'
23943 d_getnbyaddr='$d_getnbyaddr'
23944 d_getnbyname='$d_getnbyname'
23945 d_getnent='$d_getnent'
23946 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23947 d_getnetbyname_r='$d_getnetbyname_r'
23948 d_getnetent_r='$d_getnetent_r'
23949 d_getnetprotos='$d_getnetprotos'
23950 d_getpagsz='$d_getpagsz'
23951 d_getpbyname='$d_getpbyname'
23952 d_getpbynumber='$d_getpbynumber'
23953 d_getpent='$d_getpent'
23954 d_getpgid='$d_getpgid'
23955 d_getpgrp2='$d_getpgrp2'
23956 d_getpgrp='$d_getpgrp'
23957 d_getppid='$d_getppid'
23958 d_getprior='$d_getprior'
23959 d_getprotobyname_r='$d_getprotobyname_r'
23960 d_getprotobynumber_r='$d_getprotobynumber_r'
23961 d_getprotoent_r='$d_getprotoent_r'
23962 d_getprotoprotos='$d_getprotoprotos'
23963 d_getprpwnam='$d_getprpwnam'
23964 d_getpwent='$d_getpwent'
23965 d_getpwent_r='$d_getpwent_r'
23966 d_getpwnam_r='$d_getpwnam_r'
23967 d_getpwuid_r='$d_getpwuid_r'
23968 d_getsbyname='$d_getsbyname'
23969 d_getsbyport='$d_getsbyport'
23970 d_getsent='$d_getsent'
23971 d_getservbyname_r='$d_getservbyname_r'
23972 d_getservbyport_r='$d_getservbyport_r'
23973 d_getservent_r='$d_getservent_r'
23974 d_getservprotos='$d_getservprotos'
23975 d_getspnam='$d_getspnam'
23976 d_getspnam_r='$d_getspnam_r'
23977 d_gettimeod='$d_gettimeod'
23978 d_gmtime64='$d_gmtime64'
23979 d_gmtime_r='$d_gmtime_r'
23980 d_gnulibc='$d_gnulibc'
23981 d_grpasswd='$d_grpasswd'
23982 d_hasmntopt='$d_hasmntopt'
23983 d_htonl='$d_htonl'
23984 d_hypot='$d_hypot'
23985 d_ilogb='$d_ilogb'
23986 d_ilogbl='$d_ilogbl'
23987 d_inc_version_list='$d_inc_version_list'
23988 d_inetaton='$d_inetaton'
23989 d_inetntop='$d_inetntop'
23990 d_inetpton='$d_inetpton'
23991 d_int64_t='$d_int64_t'
23992 d_ip_mreq='$d_ip_mreq'
23993 d_ip_mreq_source='$d_ip_mreq_source'
23994 d_ipv6_mreq='$d_ipv6_mreq'
23995 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23996 d_isascii='$d_isascii'
23997 d_isblank='$d_isblank'
23998 d_isfinite='$d_isfinite'
23999 d_isfinitel='$d_isfinitel'
24000 d_isinf='$d_isinf'
24001 d_isinfl='$d_isinfl'
24002 d_isless='$d_isless'
24003 d_isnan='$d_isnan'
24004 d_isnanl='$d_isnanl'
24005 d_isnormal='$d_isnormal'
24006 d_j0='$d_j0'
24007 d_j0l='$d_j0l'
24008 d_killpg='$d_killpg'
24009 d_lc_monetary_2008='$d_lc_monetary_2008'
24010 d_lchown='$d_lchown'
24011 d_ldbl_dig='$d_ldbl_dig'
24012 d_ldexpl='$d_ldexpl'
24013 d_lgamma='$d_lgamma'
24014 d_lgamma_r='$d_lgamma_r'
24015 d_libm_lib_version='$d_libm_lib_version'
24016 d_libname_unique='$d_libname_unique'
24017 d_link='$d_link'
24018 d_linkat='$d_linkat'
24019 d_llrint='$d_llrint'
24020 d_llrintl='$d_llrintl'
24021 d_llround='$d_llround'
24022 d_llroundl='$d_llroundl'
24023 d_localeconv_l='$d_localeconv_l'
24024 d_localtime64='$d_localtime64'
24025 d_localtime_r='$d_localtime_r'
24026 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24027 d_locconv='$d_locconv'
24028 d_lockf='$d_lockf'
24029 d_log1p='$d_log1p'
24030 d_log2='$d_log2'
24031 d_logb='$d_logb'
24032 d_long_double_style_ieee='$d_long_double_style_ieee'
24033 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24034 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24035 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24036 d_long_double_style_vax='$d_long_double_style_vax'
24037 d_longdbl='$d_longdbl'
24038 d_longlong='$d_longlong'
24039 d_lrint='$d_lrint'
24040 d_lrintl='$d_lrintl'
24041 d_lround='$d_lround'
24042 d_lroundl='$d_lroundl'
24043 d_lseekproto='$d_lseekproto'
24044 d_lstat='$d_lstat'
24045 d_madvise='$d_madvise'
24046 d_malloc_good_size='$d_malloc_good_size'
24047 d_malloc_size='$d_malloc_size'
24048 d_mblen='$d_mblen'
24049 d_mbrlen='$d_mbrlen'
24050 d_mbrtowc='$d_mbrtowc'
24051 d_mbstowcs='$d_mbstowcs'
24052 d_mbtowc='$d_mbtowc'
24053 d_memmem='$d_memmem'
24054 d_memrchr='$d_memrchr'
24055 d_mkdir='$d_mkdir'
24056 d_mkdtemp='$d_mkdtemp'
24057 d_mkfifo='$d_mkfifo'
24058 d_mkostemp='$d_mkostemp'
24059 d_mkstemp='$d_mkstemp'
24060 d_mkstemps='$d_mkstemps'
24061 d_mktime64='$d_mktime64'
24062 d_mktime='$d_mktime'
24063 d_mmap='$d_mmap'
24064 d_modfl='$d_modfl'
24065 d_modflproto='$d_modflproto'
24066 d_mprotect='$d_mprotect'
24067 d_msg='$d_msg'
24068 d_msg_ctrunc='$d_msg_ctrunc'
24069 d_msg_dontroute='$d_msg_dontroute'
24070 d_msg_oob='$d_msg_oob'
24071 d_msg_peek='$d_msg_peek'
24072 d_msg_proxy='$d_msg_proxy'
24073 d_msgctl='$d_msgctl'
24074 d_msgget='$d_msgget'
24075 d_msghdr_s='$d_msghdr_s'
24076 d_msgrcv='$d_msgrcv'
24077 d_msgsnd='$d_msgsnd'
24078 d_msync='$d_msync'
24079 d_munmap='$d_munmap'
24080 d_mymalloc='$d_mymalloc'
24081 d_nan='$d_nan'
24082 d_nanosleep='$d_nanosleep'
24083 d_ndbm='$d_ndbm'
24084 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24085 d_nearbyint='$d_nearbyint'
24086 d_newlocale='$d_newlocale'
24087 d_nextafter='$d_nextafter'
24088 d_nexttoward='$d_nexttoward'
24089 d_nice='$d_nice'
24090 d_nl_langinfo='$d_nl_langinfo'
24091 d_nv_preserves_uv='$d_nv_preserves_uv'
24092 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24093 d_off64_t='$d_off64_t'
24094 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24095 d_oldpthreads='$d_oldpthreads'
24096 d_oldsock='$d_oldsock'
24097 d_open3='$d_open3'
24098 d_openat='$d_openat'
24099 d_pathconf='$d_pathconf'
24100 d_pause='$d_pause'
24101 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24102 d_phostname='$d_phostname'
24103 d_pipe2='$d_pipe2'
24104 d_pipe='$d_pipe'
24105 d_poll='$d_poll'
24106 d_portable='$d_portable'
24107 d_prctl='$d_prctl'
24108 d_prctl_set_name='$d_prctl_set_name'
24109 d_printf_format_null='$d_printf_format_null'
24110 d_procselfexe='$d_procselfexe'
24111 d_pseudofork='$d_pseudofork'
24112 d_pthread_atfork='$d_pthread_atfork'
24113 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24114 d_pthread_yield='$d_pthread_yield'
24115 d_ptrdiff_t='$d_ptrdiff_t'
24116 d_pwage='$d_pwage'
24117 d_pwchange='$d_pwchange'
24118 d_pwclass='$d_pwclass'
24119 d_pwcomment='$d_pwcomment'
24120 d_pwexpire='$d_pwexpire'
24121 d_pwgecos='$d_pwgecos'
24122 d_pwpasswd='$d_pwpasswd'
24123 d_pwquota='$d_pwquota'
24124 d_qgcvt='$d_qgcvt'
24125 d_quad='$d_quad'
24126 d_querylocale='$d_querylocale'
24127 d_random_r='$d_random_r'
24128 d_re_comp='$d_re_comp'
24129 d_readdir64_r='$d_readdir64_r'
24130 d_readdir='$d_readdir'
24131 d_readdir_r='$d_readdir_r'
24132 d_readlink='$d_readlink'
24133 d_readv='$d_readv'
24134 d_recvmsg='$d_recvmsg'
24135 d_regcmp='$d_regcmp'
24136 d_regcomp='$d_regcomp'
24137 d_remainder='$d_remainder'
24138 d_remquo='$d_remquo'
24139 d_rename='$d_rename'
24140 d_renameat='$d_renameat'
24141 d_rewinddir='$d_rewinddir'
24142 d_rint='$d_rint'
24143 d_rmdir='$d_rmdir'
24144 d_round='$d_round'
24145 d_sbrkproto='$d_sbrkproto'
24146 d_scalbn='$d_scalbn'
24147 d_scalbnl='$d_scalbnl'
24148 d_sched_yield='$d_sched_yield'
24149 d_scm_rights='$d_scm_rights'
24150 d_seekdir='$d_seekdir'
24151 d_select='$d_select'
24152 d_sem='$d_sem'
24153 d_semctl='$d_semctl'
24154 d_semctl_semid_ds='$d_semctl_semid_ds'
24155 d_semctl_semun='$d_semctl_semun'
24156 d_semget='$d_semget'
24157 d_semop='$d_semop'
24158 d_sendmsg='$d_sendmsg'
24159 d_setegid='$d_setegid'
24160 d_seteuid='$d_seteuid'
24161 d_setgrent='$d_setgrent'
24162 d_setgrent_r='$d_setgrent_r'
24163 d_setgrps='$d_setgrps'
24164 d_sethent='$d_sethent'
24165 d_sethostent_r='$d_sethostent_r'
24166 d_setitimer='$d_setitimer'
24167 d_setlinebuf='$d_setlinebuf'
24168 d_setlocale='$d_setlocale'
24169 d_setlocale_r='$d_setlocale_r'
24170 d_setnent='$d_setnent'
24171 d_setnetent_r='$d_setnetent_r'
24172 d_setpent='$d_setpent'
24173 d_setpgid='$d_setpgid'
24174 d_setpgrp2='$d_setpgrp2'
24175 d_setpgrp='$d_setpgrp'
24176 d_setprior='$d_setprior'
24177 d_setproctitle='$d_setproctitle'
24178 d_setprotoent_r='$d_setprotoent_r'
24179 d_setpwent='$d_setpwent'
24180 d_setpwent_r='$d_setpwent_r'
24181 d_setregid='$d_setregid'
24182 d_setresgid='$d_setresgid'
24183 d_setresuid='$d_setresuid'
24184 d_setreuid='$d_setreuid'
24185 d_setrgid='$d_setrgid'
24186 d_setruid='$d_setruid'
24187 d_setsent='$d_setsent'
24188 d_setservent_r='$d_setservent_r'
24189 d_setsid='$d_setsid'
24190 d_setvbuf='$d_setvbuf'
24191 d_shm='$d_shm'
24192 d_shmat='$d_shmat'
24193 d_shmatprototype='$d_shmatprototype'
24194 d_shmctl='$d_shmctl'
24195 d_shmdt='$d_shmdt'
24196 d_shmget='$d_shmget'
24197 d_sigaction='$d_sigaction'
24198 d_siginfo_si_addr='$d_siginfo_si_addr'
24199 d_siginfo_si_band='$d_siginfo_si_band'
24200 d_siginfo_si_errno='$d_siginfo_si_errno'
24201 d_siginfo_si_fd='$d_siginfo_si_fd'
24202 d_siginfo_si_pid='$d_siginfo_si_pid'
24203 d_siginfo_si_status='$d_siginfo_si_status'
24204 d_siginfo_si_uid='$d_siginfo_si_uid'
24205 d_siginfo_si_value='$d_siginfo_si_value'
24206 d_signbit='$d_signbit'
24207 d_sigprocmask='$d_sigprocmask'
24208 d_sigsetjmp='$d_sigsetjmp'
24209 d_sin6_scope_id='$d_sin6_scope_id'
24210 d_sitearch='$d_sitearch'
24211 d_snprintf='$d_snprintf'
24212 d_sockaddr_in6='$d_sockaddr_in6'
24213 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24214 d_sockatmark='$d_sockatmark'
24215 d_sockatmarkproto='$d_sockatmarkproto'
24216 d_socket='$d_socket'
24217 d_socklen_t='$d_socklen_t'
24218 d_sockpair='$d_sockpair'
24219 d_socks5_init='$d_socks5_init'
24220 d_sqrtl='$d_sqrtl'
24221 d_srand48_r='$d_srand48_r'
24222 d_srandom_r='$d_srandom_r'
24223 d_sresgproto='$d_sresgproto'
24224 d_sresuproto='$d_sresuproto'
24225 d_stat='$d_stat'
24226 d_statblks='$d_statblks'
24227 d_statfs_f_flags='$d_statfs_f_flags'
24228 d_statfs_s='$d_statfs_s'
24229 d_static_inline='$d_static_inline'
24230 d_statvfs='$d_statvfs'
24231 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24232 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24233 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24234 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24235 d_stdio_stream_array='$d_stdio_stream_array'
24236 d_stdiobase='$d_stdiobase'
24237 d_stdstdio='$d_stdstdio'
24238 d_strcoll='$d_strcoll'
24239 d_strerror_l='$d_strerror_l'
24240 d_strerror_r='$d_strerror_r'
24241 d_strftime='$d_strftime'
24242 d_strlcat='$d_strlcat'
24243 d_strlcpy='$d_strlcpy'
24244 d_strnlen='$d_strnlen'
24245 d_strtod='$d_strtod'
24246 d_strtol='$d_strtol'
24247 d_strtold='$d_strtold'
24248 d_strtold_l='$d_strtold_l'
24249 d_strtoll='$d_strtoll'
24250 d_strtoq='$d_strtoq'
24251 d_strtoul='$d_strtoul'
24252 d_strtoull='$d_strtoull'
24253 d_strtouq='$d_strtouq'
24254 d_strxfrm='$d_strxfrm'
24255 d_suidsafe='$d_suidsafe'
24256 d_symlink='$d_symlink'
24257 d_syscall='$d_syscall'
24258 d_syscallproto='$d_syscallproto'
24259 d_sysconf='$d_sysconf'
24260 d_sysernlst='$d_sysernlst'
24261 d_syserrlst='$d_syserrlst'
24262 d_system='$d_system'
24263 d_tcgetpgrp='$d_tcgetpgrp'
24264 d_tcsetpgrp='$d_tcsetpgrp'
24265 d_telldir='$d_telldir'
24266 d_telldirproto='$d_telldirproto'
24267 d_tgamma='$d_tgamma'
24268 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24269 d_time='$d_time'
24270 d_timegm='$d_timegm'
24271 d_times='$d_times'
24272 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24273 d_tm_tm_zone='$d_tm_tm_zone'
24274 d_tmpnam_r='$d_tmpnam_r'
24275 d_trunc='$d_trunc'
24276 d_truncate='$d_truncate'
24277 d_truncl='$d_truncl'
24278 d_ttyname_r='$d_ttyname_r'
24279 d_tzname='$d_tzname'
24280 d_u32align='$d_u32align'
24281 d_ualarm='$d_ualarm'
24282 d_umask='$d_umask'
24283 d_uname='$d_uname'
24284 d_union_semun='$d_union_semun'
24285 d_unlinkat='$d_unlinkat'
24286 d_unordered='$d_unordered'
24287 d_unsetenv='$d_unsetenv'
24288 d_uselocale='$d_uselocale'
24289 d_usleep='$d_usleep'
24290 d_usleepproto='$d_usleepproto'
24291 d_ustat='$d_ustat'
24292 d_vendorarch='$d_vendorarch'
24293 d_vendorbin='$d_vendorbin'
24294 d_vendorlib='$d_vendorlib'
24295 d_vendorscript='$d_vendorscript'
24296 d_vfork='$d_vfork'
24297 d_void_closedir='$d_void_closedir'
24298 d_voidsig='$d_voidsig'
24299 d_voidtty='$d_voidtty'
24300 d_vsnprintf='$d_vsnprintf'
24301 d_wait4='$d_wait4'
24302 d_waitpid='$d_waitpid'
24303 d_wcscmp='$d_wcscmp'
24304 d_wcstombs='$d_wcstombs'
24305 d_wcsxfrm='$d_wcsxfrm'
24306 d_wctomb='$d_wctomb'
24307 d_writev='$d_writev'
24308 d_xenix='$d_xenix'
24309 date='$date'
24310 db_hashtype='$db_hashtype'
24311 db_prefixtype='$db_prefixtype'
24312 db_version_major='$db_version_major'
24313 db_version_minor='$db_version_minor'
24314 db_version_patch='$db_version_patch'
24315 default_inc_excludes_dot='$default_inc_excludes_dot'
24316 direntrytype='$direntrytype'
24317 dlext='$dlext'
24318 dlsrc='$dlsrc'
24319 doubleinfbytes='$doubleinfbytes'
24320 doublekind='$doublekind'
24321 doublemantbits='$doublemantbits'
24322 doublenanbytes='$doublenanbytes'
24323 doublesize='$doublesize'
24324 drand01='$drand01'
24325 drand48_r_proto='$drand48_r_proto'
24326 dtrace='$dtrace'
24327 dtraceobject='$dtraceobject'
24328 dtracexnolibs='$dtracexnolibs'
24329 dynamic_ext='$dynamic_ext'
24330 eagain='$eagain'
24331 ebcdic='$ebcdic'
24332 echo='$echo'
24333 egrep='$egrep'
24334 emacs='$emacs'
24335 endgrent_r_proto='$endgrent_r_proto'
24336 endhostent_r_proto='$endhostent_r_proto'
24337 endnetent_r_proto='$endnetent_r_proto'
24338 endprotoent_r_proto='$endprotoent_r_proto'
24339 endpwent_r_proto='$endpwent_r_proto'
24340 endservent_r_proto='$endservent_r_proto'
24341 eunicefix='$eunicefix'
24342 exe_ext='$exe_ext'
24343 expr='$expr'
24344 extensions='$extensions'
24345 extern_C='$extern_C'
24346 extras='$extras'
24347 fflushNULL='$fflushNULL'
24348 fflushall='$fflushall'
24349 find='$find'
24350 firstmakefile='$firstmakefile'
24351 flex='$flex'
24352 fpossize='$fpossize'
24353 fpostype='$fpostype'
24354 freetype='$freetype'
24355 from='$from'
24356 full_ar='$full_ar'
24357 full_csh='$full_csh'
24358 full_sed='$full_sed'
24359 gccansipedantic='$gccansipedantic'
24360 gccosandvers='$gccosandvers'
24361 gccversion='$gccversion'
24362 getgrent_r_proto='$getgrent_r_proto'
24363 getgrgid_r_proto='$getgrgid_r_proto'
24364 getgrnam_r_proto='$getgrnam_r_proto'
24365 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24366 gethostbyname_r_proto='$gethostbyname_r_proto'
24367 gethostent_r_proto='$gethostent_r_proto'
24368 getlogin_r_proto='$getlogin_r_proto'
24369 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24370 getnetbyname_r_proto='$getnetbyname_r_proto'
24371 getnetent_r_proto='$getnetent_r_proto'
24372 getprotobyname_r_proto='$getprotobyname_r_proto'
24373 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24374 getprotoent_r_proto='$getprotoent_r_proto'
24375 getpwent_r_proto='$getpwent_r_proto'
24376 getpwnam_r_proto='$getpwnam_r_proto'
24377 getpwuid_r_proto='$getpwuid_r_proto'
24378 getservbyname_r_proto='$getservbyname_r_proto'
24379 getservbyport_r_proto='$getservbyport_r_proto'
24380 getservent_r_proto='$getservent_r_proto'
24381 getspnam_r_proto='$getspnam_r_proto'
24382 gidformat='$gidformat'
24383 gidsign='$gidsign'
24384 gidsize='$gidsize'
24385 gidtype='$gidtype'
24386 glibpth='$glibpth'
24387 gmake='$gmake'
24388 gmtime_r_proto='$gmtime_r_proto'
24389 gnulibc_version='$gnulibc_version'
24390 grep='$grep'
24391 groupcat='$groupcat'
24392 groupstype='$groupstype'
24393 gzip='$gzip'
24394 h_fcntl='$h_fcntl'
24395 h_sysfile='$h_sysfile'
24396 hint='$hint'
24397 hostcat='$hostcat'
24398 hostgenerate='$hostgenerate'
24399 hostosname='$hostosname'
24400 hostperl='$hostperl'
24401 html1dir='$html1dir'
24402 html1direxp='$html1direxp'
24403 html3dir='$html3dir'
24404 html3direxp='$html3direxp'
24405 i16size='$i16size'
24406 i16type='$i16type'
24407 i32size='$i32size'
24408 i32type='$i32type'
24409 i64size='$i64size'
24410 i64type='$i64type'
24411 i8size='$i8size'
24412 i8type='$i8type'
24413 i_arpainet='$i_arpainet'
24414 i_bfd='$i_bfd'
24415 i_bsdioctl='$i_bsdioctl'
24416 i_crypt='$i_crypt'
24417 i_db='$i_db'
24418 i_dbm='$i_dbm'
24419 i_dirent='$i_dirent'
24420 i_dlfcn='$i_dlfcn'
24421 i_execinfo='$i_execinfo'
24422 i_fcntl='$i_fcntl'
24423 i_fenv='$i_fenv'
24424 i_fp='$i_fp'
24425 i_fp_class='$i_fp_class'
24426 i_gdbm='$i_gdbm'
24427 i_gdbm_ndbm='$i_gdbm_ndbm'
24428 i_gdbmndbm='$i_gdbmndbm'
24429 i_grp='$i_grp'
24430 i_ieeefp='$i_ieeefp'
24431 i_inttypes='$i_inttypes'
24432 i_langinfo='$i_langinfo'
24433 i_libutil='$i_libutil'
24434 i_locale='$i_locale'
24435 i_machcthr='$i_machcthr'
24436 i_malloc='$i_malloc'
24437 i_mallocmalloc='$i_mallocmalloc'
24438 i_mntent='$i_mntent'
24439 i_ndbm='$i_ndbm'
24440 i_netdb='$i_netdb'
24441 i_neterrno='$i_neterrno'
24442 i_netinettcp='$i_netinettcp'
24443 i_niin='$i_niin'
24444 i_poll='$i_poll'
24445 i_prot='$i_prot'
24446 i_pthread='$i_pthread'
24447 i_pwd='$i_pwd'
24448 i_quadmath='$i_quadmath'
24449 i_rpcsvcdbm='$i_rpcsvcdbm'
24450 i_sgtty='$i_sgtty'
24451 i_shadow='$i_shadow'
24452 i_socks='$i_socks'
24453 i_stdbool='$i_stdbool'
24454 i_stdint='$i_stdint'
24455 i_stdlib='$i_stdlib'
24456 i_sunmath='$i_sunmath'
24457 i_sysaccess='$i_sysaccess'
24458 i_sysdir='$i_sysdir'
24459 i_sysfile='$i_sysfile'
24460 i_sysfilio='$i_sysfilio'
24461 i_sysin='$i_sysin'
24462 i_sysioctl='$i_sysioctl'
24463 i_syslog='$i_syslog'
24464 i_sysmman='$i_sysmman'
24465 i_sysmode='$i_sysmode'
24466 i_sysmount='$i_sysmount'
24467 i_sysndir='$i_sysndir'
24468 i_sysparam='$i_sysparam'
24469 i_syspoll='$i_syspoll'
24470 i_sysresrc='$i_sysresrc'
24471 i_syssecrt='$i_syssecrt'
24472 i_sysselct='$i_sysselct'
24473 i_syssockio='$i_syssockio'
24474 i_sysstat='$i_sysstat'
24475 i_sysstatfs='$i_sysstatfs'
24476 i_sysstatvfs='$i_sysstatvfs'
24477 i_systime='$i_systime'
24478 i_systimek='$i_systimek'
24479 i_systimes='$i_systimes'
24480 i_systypes='$i_systypes'
24481 i_sysuio='$i_sysuio'
24482 i_sysun='$i_sysun'
24483 i_sysutsname='$i_sysutsname'
24484 i_sysvfs='$i_sysvfs'
24485 i_syswait='$i_syswait'
24486 i_termio='$i_termio'
24487 i_termios='$i_termios'
24488 i_time='$i_time'
24489 i_unistd='$i_unistd'
24490 i_ustat='$i_ustat'
24491 i_utime='$i_utime'
24492 i_vfork='$i_vfork'
24493 i_wchar='$i_wchar'
24494 i_xlocale='$i_xlocale'
24495 ignore_versioned_solibs='$ignore_versioned_solibs'
24496 inc_version_list='$inc_version_list'
24497 inc_version_list_init='$inc_version_list_init'
24498 incpath='$incpath'
24499 incpth='$incpth'
24500 inews='$inews'
24501 initialinstalllocation='$initialinstalllocation'
24502 installarchlib='$installarchlib'
24503 installbin='$installbin'
24504 installhtml1dir='$installhtml1dir'
24505 installhtml3dir='$installhtml3dir'
24506 installman1dir='$installman1dir'
24507 installman3dir='$installman3dir'
24508 installprefix='$installprefix'
24509 installprefixexp='$installprefixexp'
24510 installprivlib='$installprivlib'
24511 installscript='$installscript'
24512 installsitearch='$installsitearch'
24513 installsitebin='$installsitebin'
24514 installsitehtml1dir='$installsitehtml1dir'
24515 installsitehtml3dir='$installsitehtml3dir'
24516 installsitelib='$installsitelib'
24517 installsiteman1dir='$installsiteman1dir'
24518 installsiteman3dir='$installsiteman3dir'
24519 installsitescript='$installsitescript'
24520 installstyle='$installstyle'
24521 installusrbinperl='$installusrbinperl'
24522 installvendorarch='$installvendorarch'
24523 installvendorbin='$installvendorbin'
24524 installvendorhtml1dir='$installvendorhtml1dir'
24525 installvendorhtml3dir='$installvendorhtml3dir'
24526 installvendorlib='$installvendorlib'
24527 installvendorman1dir='$installvendorman1dir'
24528 installvendorman3dir='$installvendorman3dir'
24529 installvendorscript='$installvendorscript'
24530 intsize='$intsize'
24531 issymlink='$issymlink'
24532 ivdformat='$ivdformat'
24533 ivsize='$ivsize'
24534 ivtype='$ivtype'
24535 known_extensions='$known_extensions'
24536 ksh='$ksh'
24537 ld='$ld'
24538 ld_can_script='$ld_can_script'
24539 lddlflags='$lddlflags'
24540 ldflags='$ldflags'
24541 ldflags_uselargefiles='$ldflags_uselargefiles'
24542 ldlibpthname='$ldlibpthname'
24543 less='$less'
24544 lib_ext='$lib_ext'
24545 libc='$libc'
24546 libperl='$libperl'
24547 libpth='$libpth'
24548 libs='$libs'
24549 libsdirs='$libsdirs'
24550 libsfiles='$libsfiles'
24551 libsfound='$libsfound'
24552 libspath='$libspath'
24553 libswanted='$libswanted'
24554 libswanted_uselargefiles='$libswanted_uselargefiles'
24555 line='$line'
24556 lint='$lint'
24557 lkflags='$lkflags'
24558 ln='$ln'
24559 lns='$lns'
24560 localtime_r_proto='$localtime_r_proto'
24561 locincpth='$locincpth'
24562 loclibpth='$loclibpth'
24563 longdblinfbytes='$longdblinfbytes'
24564 longdblkind='$longdblkind'
24565 longdblmantbits='$longdblmantbits'
24566 longdblnanbytes='$longdblnanbytes'
24567 longdblsize='$longdblsize'
24568 longlongsize='$longlongsize'
24569 longsize='$longsize'
24570 lp='$lp'
24571 lpr='$lpr'
24572 ls='$ls'
24573 lseeksize='$lseeksize'
24574 lseektype='$lseektype'
24575 mail='$mail'
24576 mailx='$mailx'
24577 make='$make'
24578 make_set_make='$make_set_make'
24579 mallocobj='$mallocobj'
24580 mallocsrc='$mallocsrc'
24581 malloctype='$malloctype'
24582 man1dir='$man1dir'
24583 man1direxp='$man1direxp'
24584 man1ext='$man1ext'
24585 man3dir='$man3dir'
24586 man3direxp='$man3direxp'
24587 man3ext='$man3ext'
24588 mips_type='$mips_type'
24589 mistrustnm='$mistrustnm'
24590 mkdir='$mkdir'
24591 mmaptype='$mmaptype'
24592 modetype='$modetype'
24593 more='$more'
24594 multiarch='$multiarch'
24595 mv='$mv'
24596 myarchname='$myarchname'
24597 mydomain='$mydomain'
24598 myhostname='$myhostname'
24599 myuname='$myuname'
24600 n='$n'
24601 need_va_copy='$need_va_copy'
24602 netdb_hlen_type='$netdb_hlen_type'
24603 netdb_host_type='$netdb_host_type'
24604 netdb_name_type='$netdb_name_type'
24605 netdb_net_type='$netdb_net_type'
24606 nm='$nm'
24607 nm_opt='$nm_opt'
24608 nm_so_opt='$nm_so_opt'
24609 nonxs_ext='$nonxs_ext'
24610 nroff='$nroff'
24611 nvEUformat='$nvEUformat'
24612 nvFUformat='$nvFUformat'
24613 nvGUformat='$nvGUformat'
24614 nv_overflows_integers_at='$nv_overflows_integers_at'
24615 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24616 nveformat='$nveformat'
24617 nvfformat='$nvfformat'
24618 nvgformat='$nvgformat'
24619 nvmantbits='$nvmantbits'
24620 nvsize='$nvsize'
24621 nvtype='$nvtype'
24622 o_nonblock='$o_nonblock'
24623 obj_ext='$obj_ext'
24624 old_pthread_create_joinable='$old_pthread_create_joinable'
24625 optimize='$optimize'
24626 orderlib='$orderlib'
24627 osname='$osname'
24628 osvers='$osvers'
24629 otherlibdirs='$otherlibdirs'
24630 package='$package'
24631 pager='$pager'
24632 passcat='$passcat'
24633 patchlevel='$patchlevel'
24634 path_sep='$path_sep'
24635 perl5='$perl5'
24636 perl='$perl'
24637 perl_patchlevel='$perl_patchlevel'
24638 perl_static_inline='$perl_static_inline'
24639 perladmin='$perladmin'
24640 perllibs='$perllibs'
24641 perlpath='$perlpath'
24642 pg='$pg'
24643 phostname='$phostname'
24644 pidtype='$pidtype'
24645 plibpth='$plibpth'
24646 pmake='$pmake'
24647 pr='$pr'
24648 prefix='$prefix'
24649 prefixexp='$prefixexp'
24650 privlib='$privlib'
24651 privlibexp='$privlibexp'
24652 procselfexe='$procselfexe'
24653 ptrsize='$ptrsize'
24654 quadkind='$quadkind'
24655 quadtype='$quadtype'
24656 randbits='$randbits'
24657 randfunc='$randfunc'
24658 random_r_proto='$random_r_proto'
24659 randseedtype='$randseedtype'
24660 ranlib='$ranlib'
24661 rd_nodata='$rd_nodata'
24662 readdir64_r_proto='$readdir64_r_proto'
24663 readdir_r_proto='$readdir_r_proto'
24664 revision='$revision'
24665 rm='$rm'
24666 rm_try='$rm_try'
24667 rmail='$rmail'
24668 run='$run'
24669 runnm='$runnm'
24670 sGMTIME_max='$sGMTIME_max'
24671 sGMTIME_min='$sGMTIME_min'
24672 sLOCALTIME_max='$sLOCALTIME_max'
24673 sLOCALTIME_min='$sLOCALTIME_min'
24674 sPRIEUldbl='$sPRIEUldbl'
24675 sPRIFUldbl='$sPRIFUldbl'
24676 sPRIGUldbl='$sPRIGUldbl'
24677 sPRIXU64='$sPRIXU64'
24678 sPRId64='$sPRId64'
24679 sPRIeldbl='$sPRIeldbl'
24680 sPRIfldbl='$sPRIfldbl'
24681 sPRIgldbl='$sPRIgldbl'
24682 sPRIi64='$sPRIi64'
24683 sPRIo64='$sPRIo64'
24684 sPRIu64='$sPRIu64'
24685 sPRIx64='$sPRIx64'
24686 sSCNfldbl='$sSCNfldbl'
24687 sched_yield='$sched_yield'
24688 scriptdir='$scriptdir'
24689 scriptdirexp='$scriptdirexp'
24690 sed='$sed'
24691 seedfunc='$seedfunc'
24692 selectminbits='$selectminbits'
24693 selecttype='$selecttype'
24694 sendmail='$sendmail'
24695 setgrent_r_proto='$setgrent_r_proto'
24696 sethostent_r_proto='$sethostent_r_proto'
24697 setlocale_r_proto='$setlocale_r_proto'
24698 setnetent_r_proto='$setnetent_r_proto'
24699 setprotoent_r_proto='$setprotoent_r_proto'
24700 setpwent_r_proto='$setpwent_r_proto'
24701 setservent_r_proto='$setservent_r_proto'
24702 sh='$sh'
24703 shar='$shar'
24704 sharpbang='$sharpbang'
24705 shmattype='$shmattype'
24706 shortsize='$shortsize'
24707 shrpenv='$shrpenv'
24708 shsharp='$shsharp'
24709 sig_count='$sig_count'
24710 sig_name='$sig_name'
24711 sig_name_init='$sig_name_init'
24712 sig_num='$sig_num'
24713 sig_num_init='$sig_num_init'
24714 sig_size='$sig_size'
24715 signal_t='$signal_t'
24716 sitearch='$sitearch'
24717 sitearchexp='$sitearchexp'
24718 sitebin='$sitebin'
24719 sitebinexp='$sitebinexp'
24720 sitehtml1dir='$sitehtml1dir'
24721 sitehtml1direxp='$sitehtml1direxp'
24722 sitehtml3dir='$sitehtml3dir'
24723 sitehtml3direxp='$sitehtml3direxp'
24724 sitelib='$sitelib'
24725 sitelib_stem='$sitelib_stem'
24726 sitelibexp='$sitelibexp'
24727 siteman1dir='$siteman1dir'
24728 siteman1direxp='$siteman1direxp'
24729 siteman3dir='$siteman3dir'
24730 siteman3direxp='$siteman3direxp'
24731 siteprefix='$siteprefix'
24732 siteprefixexp='$siteprefixexp'
24733 sitescript='$sitescript'
24734 sitescriptexp='$sitescriptexp'
24735 sizesize='$sizesize'
24736 sizetype='$sizetype'
24737 sleep='$sleep'
24738 smail='$smail'
24739 so='$so'
24740 sockethdr='$sockethdr'
24741 socketlib='$socketlib'
24742 socksizetype='$socksizetype'
24743 sort='$sort'
24744 spackage='$spackage'
24745 spitshell='$spitshell'
24746 srand48_r_proto='$srand48_r_proto'
24747 srandom_r_proto='$srandom_r_proto'
24748 src='$src'
24749 ssizetype='$ssizetype'
24750 st_ino_sign='$st_ino_sign'
24751 st_ino_size='$st_ino_size'
24752 startperl='$startperl'
24753 startsh='$startsh'
24754 static_ext='$static_ext'
24755 stdchar='$stdchar'
24756 stdio_base='$stdio_base'
24757 stdio_bufsiz='$stdio_bufsiz'
24758 stdio_cnt='$stdio_cnt'
24759 stdio_filbuf='$stdio_filbuf'
24760 stdio_ptr='$stdio_ptr'
24761 stdio_stream_array='$stdio_stream_array'
24762 strerror_r_proto='$strerror_r_proto'
24763 submit='$submit'
24764 subversion='$subversion'
24765 sysman='$sysman'
24766 sysroot='$sysroot'
24767 tail='$tail'
24768 tar='$tar'
24769 targetarch='$targetarch'
24770 targetdir='$targetdir'
24771 targetenv='$targetenv'
24772 targethost='$targethost'
24773 targetmkdir='$targetmkdir'
24774 targetport='$targetport'
24775 targetsh='$targetsh'
24776 tbl='$tbl'
24777 tee='$tee'
24778 test='$test'
24779 timeincl='$timeincl'
24780 timetype='$timetype'
24781 tmpnam_r_proto='$tmpnam_r_proto'
24782 to='$to'
24783 touch='$touch'
24784 tr='$tr'
24785 trnl='$trnl'
24786 troff='$troff'
24787 ttyname_r_proto='$ttyname_r_proto'
24788 u16size='$u16size'
24789 u16type='$u16type'
24790 u32size='$u32size'
24791 u32type='$u32type'
24792 u64size='$u64size'
24793 u64type='$u64type'
24794 u8size='$u8size'
24795 u8type='$u8type'
24796 uidformat='$uidformat'
24797 uidsign='$uidsign'
24798 uidsize='$uidsize'
24799 uidtype='$uidtype'
24800 uname='$uname'
24801 uniq='$uniq'
24802 uquadtype='$uquadtype'
24803 use5005threads='$use5005threads'
24804 use64bitall='$use64bitall'
24805 use64bitint='$use64bitint'
24806 usecbacktrace='$usecbacktrace'
24807 usecrosscompile='$usecrosscompile'
24808 usedevel='$usedevel'
24809 usedl='$usedl'
24810 usedtrace='$usedtrace'
24811 usefaststdio='$usefaststdio'
24812 usei18n_lang='$i18n_lang'
24813 useithreads='$useithreads'
24814 usekernprocpathname='$usekernprocpathname'
24815 uselargefiles='$uselargefiles'
24816 uselongdouble='$uselongdouble'
24817 usemallocwrap='$usemallocwrap'
24818 usemorebits='$usemorebits'
24819 usemultiplicity='$usemultiplicity'
24820 usemymalloc='$usemymalloc'
24821 usenm='$usenm'
24822 usensgetexecutablepath='$usensgetexecutablepath'
24823 useopcode='$useopcode'
24824 useperlio='$useperlio'
24825 useposix='$useposix'
24826 usequadmath='$usequadmath'
24827 usereentrant='$usereentrant'
24828 userelocatableinc='$userelocatableinc'
24829 useshrplib='$useshrplib'
24830 usesitecustomize='$usesitecustomize'
24831 usesocks='$usesocks'
24832 usethreads='$usethreads'
24833 usevendorprefix='$usevendorprefix'
24834 useversionedarchname='$useversionedarchname'
24835 usevfork='$usevfork'
24836 usrinc='$usrinc'
24837 uuname='$uuname'
24838 uvXUformat='$uvXUformat'
24839 uvoformat='$uvoformat'
24840 uvsize='$uvsize'
24841 uvtype='$uvtype'
24842 uvuformat='$uvuformat'
24843 uvxformat='$uvxformat'
24844 vendorarch='$vendorarch'
24845 vendorarchexp='$vendorarchexp'
24846 vendorbin='$vendorbin'
24847 vendorbinexp='$vendorbinexp'
24848 vendorhtml1dir='$vendorhtml1dir'
24849 vendorhtml1direxp='$vendorhtml1direxp'
24850 vendorhtml3dir='$vendorhtml3dir'
24851 vendorhtml3direxp='$vendorhtml3direxp'
24852 vendorlib='$vendorlib'
24853 vendorlib_stem='$vendorlib_stem'
24854 vendorlibexp='$vendorlibexp'
24855 vendorman1dir='$vendorman1dir'
24856 vendorman1direxp='$vendorman1direxp'
24857 vendorman3dir='$vendorman3dir'
24858 vendorman3direxp='$vendorman3direxp'
24859 vendorprefix='$vendorprefix'
24860 vendorprefixexp='$vendorprefixexp'
24861 vendorscript='$vendorscript'
24862 vendorscriptexp='$vendorscriptexp'
24863 version='$version'
24864 version_patchlevel_string='$version_patchlevel_string'
24865 versiononly='$versiononly'
24866 vi='$vi'
24867 xlibpth='$xlibpth'
24868 yacc='$yacc'
24869 yaccflags='$yaccflags'
24870 zcat='$zcat'
24871 zip='$zip'
24872 EOT
24873
24874 : add special variables
24875 $test -f $src/patchlevel.h && \
24876 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24877 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24878 echo "PERL_CONFIG_SH=true" >>config.sh
24879
24880 : propagate old symbols
24881 if $test -f UU/config.sh; then
24882         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24883         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24884                 config.sh config.sh UU/oldconfig.sh |\
24885                 $sort | $uniq -u >UU/oldsyms
24886         set X `$cat UU/oldsyms`
24887         shift
24888         case $# in
24889         0) ;;
24890         *)
24891                 $cat <<EOM
24892 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24893 EOM
24894                 echo ": Variables propagated from previous config.sh file." >>config.sh
24895                 for sym in `$cat UU/oldsyms`; do
24896                         echo "    Propagating $hint variable "'$'"$sym..."
24897                         eval 'tmp="$'"${sym}"'"'
24898                         echo "$tmp" | \
24899                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24900                 done
24901                 ;;
24902         esac
24903 fi
24904
24905 : preserve RCS keywords in files with variable substitution, grrr
24906 Id='$Id'
24907
24908 : Finish up by extracting the .SH files
24909 case "$alldone" in
24910 exit)
24911         echo "Stopping at your request, leaving temporary files around."
24912         exit 0
24913         ;;
24914 cont)
24915         ;;
24916 '')
24917         dflt=''
24918         nostick=true
24919         $cat <<EOM
24920
24921 If you'd like to make any changes to the config.sh file before I begin
24922 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24923
24924 EOM
24925         rp="Press return or use a shell escape to edit config.sh:"
24926         . UU/myread
24927         nostick=''
24928         case "$ans" in
24929         '') ;;
24930         *) : in case they cannot read
24931                 sh 1>&4 -c "$ans";;
24932         esac
24933         ;;
24934 esac
24935
24936 : if this fails, just run all the .SH files by hand
24937 . ./config.sh
24938
24939 echo " "
24940 exec 1>&4
24941 pwd=`pwd`
24942 . ./UU/extract
24943 cd "$pwd"
24944
24945 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24946         dflt=y
24947         case "$silent" in
24948         true) ;;
24949         *)
24950                 $cat <<EOM
24951
24952 Now you need to generate make dependencies by running "$make depend".
24953 You might prefer to run it in background: "$make depend > makedepend.out &"
24954 It can take a while, so you might not want to run it right now.
24955
24956 EOM
24957                 ;;
24958         esac
24959         rp="Run $make depend now?"
24960         . UU/myread
24961         case "$ans" in
24962         y*)
24963                 $make depend && echo "Now you must run '$make'."
24964                 ;;
24965         *)
24966                 echo "You must run '$make depend' then '$make'."
24967                 ;;
24968         esac
24969 elif test -f [Mm]akefile; then
24970         echo " "
24971         echo "Now you must run a $make."
24972 else
24973         echo "Configure done."
24974 fi
24975
24976 if $test -f Policy.sh; then
24977     $cat <<EOM
24978
24979 If you compile $package on a different machine or from a different object
24980 directory, copy the Policy.sh file from this object directory to the
24981 new one before you run Configure -- this will help you with most of
24982 the policy defaults.
24983
24984 EOM
24985 fi
24986 if $test -f UU/config.msg; then
24987     echo "Hmm.  I also noted the following information while running:"
24988     echo " "
24989     $cat UU/config.msg >&4
24990 fi
24991 $rm -f kit*isdone ark*isdone
24992 $rm -rf UU
24993
24994 : End of Configure
24995