This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove relics of regex swash use
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically by the tool
15 # called "metaconfig". Rather than working with this copy of Configure,
16 # you should use metaconfig. Perl uses a modified version of this
17 # tool, and this, together with the metaconfig units, are available
18 # in the git repository:
19 #    $ git clone https://github.com/perl5-metaconfig/metaconfig metaconfig
20 # The original dist package (including metaconfig) is available on github:
21 #    $ git clone https://github.com/rmanfredi/dist.git dist-git
22 #
23 # Though this script was generated by metaconfig from metaunits, it is
24 # OK to send patches against Configure itself (but not to commit them
25 # to blead). It's up to
26 # the Configure maintainers to backport the patch to the metaunits if it
27 # is accepted. Exceptions to this rule, and more information, is in
28 # Porting/pumpkin.pod.
29
30 # Generated using [metaconfig 3.5 PL0]
31 # (with additional metaconfig patches by perlbug@perl.org)
32
33 cat >c1$$ <<EOF
34 ARGGGHHHH!!!!!
35
36 SCO csh still thinks true is false.  Write to SCO today and tell them that next
37 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
38
39 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
40 we'd have to do is go in and swap the && and || tokens, wherever they are.)
41
42 [End of diatribe. We now return you to your regularly scheduled programming...]
43 EOF
44 cat >c2$$ <<EOF
45
46 OOPS!  You naughty creature!  You didn't run Configure with sh!
47 I will attempt to remedy the situation by running sh for you...
48 EOF
49
50 true || cat c1$$ c2$$
51 true || exec sh $0 $argv:q
52
53 (exit $?0) || cat c2$$
54 (exit $?0) || exec sh $0 $argv:q
55 rm -f c1$$ c2$$
56
57 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
58         cat <<EOF
59 ***
60 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
61 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
62 *** Please read the README.plan9 for further instructions.
63 *** Cannot continue, aborting.
64 ***
65 EOF
66         exit 1
67 fi
68
69 if test -f /sys/utilities/MultiView ; then
70         # AmigaOS, test -c for /dev/null is not useful
71         :
72 elif test ! -c /dev/null ; then
73         cat <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin|*msys) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 hostgenerate=''
212 hostosname=''
213 hostperl=''
214 run=''
215 targetarch=''
216 targetdir=''
217 targetenv=''
218 targethost=''
219 targetmkdir=''
220 targetport=''
221 to=''
222 usecrosscompile=''
223 extern_C=''
224 mistrustnm=''
225 usedevel=''
226 perllibs=''
227 dynamic_ext=''
228 extensions=''
229 known_extensions=''
230 nonxs_ext=''
231 static_ext=''
232 uselanginfo=''
233 useopcode=''
234 useposix=''
235 extras=''
236 d_bsd=''
237 d_eunice=''
238 d_xenix=''
239 eunicefix=''
240 ar=''
241 awk=''
242 bash=''
243 bison=''
244 byacc=''
245 cat=''
246 chgrp=''
247 chmod=''
248 chown=''
249 comm=''
250 compress=''
251 cp=''
252 cpio=''
253 cpp=''
254 csh=''
255 date=''
256 echo=''
257 egrep=''
258 emacs=''
259 expr=''
260 find=''
261 flex=''
262 gmake=''
263 grep=''
264 gzip=''
265 inews=''
266 ksh=''
267 less=''
268 line=''
269 lint=''
270 ln=''
271 lp=''
272 lpr=''
273 ls=''
274 mail=''
275 mailx=''
276 make=''
277 mkdir=''
278 more=''
279 mv=''
280 nm=''
281 nroff=''
282 perl=''
283 pg=''
284 pmake=''
285 pr=''
286 rm=''
287 rmail=''
288 sed=''
289 sendmail=''
290 shar=''
291 sleep=''
292 smail=''
293 sort=''
294 submit=''
295 tail=''
296 tar=''
297 tbl=''
298 tee=''
299 test=''
300 touch=''
301 tr=''
302 troff=''
303 uname=''
304 uniq=''
305 uuname=''
306 vi=''
307 zcat=''
308 zip=''
309 full_ar=''
310 full_sed=''
311 libswanted=''
312 hint=''
313 myuname=''
314 osname=''
315 osvers=''
316 Author=''
317 Date=''
318 Header=''
319 Id=''
320 Locker=''
321 Log=''
322 RCSfile=''
323 Revision=''
324 Source=''
325 State=''
326 sysroot=''
327 _a=''
328 _exe=''
329 _o=''
330 archobjs=''
331 exe_ext=''
332 firstmakefile=''
333 lib_ext=''
334 obj_ext=''
335 path_sep=''
336 rm_try=''
337 afs=''
338 afsroot=''
339 alignbytes=''
340 archlib=''
341 archlibexp=''
342 d_archlib=''
343 installarchlib=''
344 archname=''
345 myarchname=''
346 useversionedarchname=''
347 d_atolf=''
348 d_atoll=''
349 baserev=''
350 bin=''
351 binexp=''
352 initialinstalllocation=''
353 installbin=''
354 userelocatableinc=''
355 byteorder=''
356 cc=''
357 ccflags=''
358 cppflags=''
359 ldflags=''
360 lkflags=''
361 locincpth=''
362 optimize=''
363 cf_email=''
364 cf_by=''
365 cf_time=''
366 charbits=''
367 charsize=''
368 contains=''
369 cpp_stuff=''
370 cpplast=''
371 cppminus=''
372 cpprun=''
373 cppstdin=''
374 d__fwalk=''
375 d_accept4=''
376 d_access=''
377 d_accessx=''
378 d_acosh=''
379 d_aintl=''
380 d_alarm=''
381 asctime_r_proto=''
382 d_asctime_r=''
383 d_asinh=''
384 d_atanh=''
385 d_attribute_deprecated=''
386 d_attribute_format=''
387 d_attribute_malloc=''
388 d_attribute_nonnull=''
389 d_attribute_noreturn=''
390 d_attribute_pure=''
391 d_attribute_unused=''
392 d_attribute_warn_unused_result=''
393 d_printf_format_null=''
394 d_backtrace=''
395 d_builtin_choose_expr=''
396 d_builtin_expect=''
397 d_builtin_add_overflow=''
398 d_builtin_mul_overflow=''
399 d_builtin_sub_overflow=''
400 d_c99_variadic_macros=''
401 d_casti32=''
402 castflags=''
403 d_castneg=''
404 d_cbrt=''
405 d_chown=''
406 d_chroot=''
407 d_chsize=''
408 d_class=''
409 d_clearenv=''
410 d_closedir=''
411 d_void_closedir=''
412 d_cmsghdr_s=''
413 d_copysign=''
414 d_copysignl=''
415 d_cplusplus=''
416 cryptlib=''
417 d_crypt=''
418 crypt_r_proto=''
419 d_crypt_r=''
420 d_csh=''
421 full_csh=''
422 d_ctermid=''
423 ctermid_r_proto=''
424 d_ctermid_r=''
425 ctime_r_proto=''
426 d_ctime_r=''
427 d_cuserid=''
428 d_dbminitproto=''
429 d_difftime=''
430 d_dir_dd_fd=''
431 d_dirfd=''
432 d_dladdr=''
433 d_dlerror=''
434 d_dlopen=''
435 d_dlsymun=''
436 d_dosuid=''
437 d_suidsafe=''
438 d_drand48_r=''
439 drand48_r_proto=''
440 d_drand48proto=''
441 d_dup2=''
442 d_dup3=''
443 d_eaccess=''
444 d_endgrent=''
445 d_endgrent_r=''
446 endgrent_r_proto=''
447 d_endhent=''
448 d_endhostent_r=''
449 endhostent_r_proto=''
450 d_endnent=''
451 d_endnetent_r=''
452 endnetent_r_proto=''
453 d_endpent=''
454 d_endprotoent_r=''
455 endprotoent_r_proto=''
456 d_endpwent=''
457 d_endpwent_r=''
458 endpwent_r_proto=''
459 d_endsent=''
460 d_endservent_r=''
461 endservent_r_proto=''
462 d_erf=''
463 d_erfc=''
464 d_exp2=''
465 d_expm1=''
466 d_faststdio=''
467 d_fchdir=''
468 d_fchmod=''
469 d_fchown=''
470 d_fcntl=''
471 d_fcntl_can_lock=''
472 d_fd_macros=''
473 d_fd_set=''
474 d_fds_bits=''
475 d_fdclose=''
476 d_fdim=''
477 d_fegetround=''
478 d_fgetpos=''
479 d_finite=''
480 d_finitel=''
481 d_flexfnam=''
482 d_flock=''
483 d_flockproto=''
484 d_fma=''
485 d_fmax=''
486 d_fmin=''
487 d_fork=''
488 d_fp_class=''
489 d_fp_classl=''
490 d_fpclass=''
491 d_fp_classify=''
492 d_fpclassify=''
493 d_fpclassl=''
494 d_fpgetround=''
495 d_fpos64_t=''
496 d_frexpl=''
497 d_fs_data_s=''
498 d_fchmodat=''
499 d_linkat=''
500 d_openat=''
501 d_renameat=''
502 d_unlinkat=''
503 d_fseeko=''
504 d_fsetpos=''
505 d_fstatfs=''
506 d_fsync=''
507 d_ftello=''
508 d_ftime=''
509 d_gettimeod=''
510 d_futimes=''
511 d_gai_strerror=''
512 d_Gconvert=''
513 d_getaddrinfo=''
514 d_getcwd=''
515 d_getespwnam=''
516 d_getfsstat=''
517 d_getgrent=''
518 d_getgrent_r=''
519 getgrent_r_proto=''
520 d_getgrgid_r=''
521 getgrgid_r_proto=''
522 d_getgrnam_r=''
523 getgrnam_r_proto=''
524 d_getgrps=''
525 d_gethbyaddr=''
526 d_gethbyname=''
527 d_gethent=''
528 aphostname=''
529 d_gethname=''
530 d_phostname=''
531 d_uname=''
532 d_gethostbyaddr_r=''
533 gethostbyaddr_r_proto=''
534 d_gethostbyname_r=''
535 gethostbyname_r_proto=''
536 d_gethostent_r=''
537 gethostent_r_proto=''
538 d_gethostprotos=''
539 d_getitimer=''
540 d_getlogin=''
541 d_getlogin_r=''
542 getlogin_r_proto=''
543 d_getmnt=''
544 d_getmntent=''
545 d_getnameinfo=''
546 d_getnbyaddr=''
547 d_getnbyname=''
548 d_getnent=''
549 d_getnetbyaddr_r=''
550 getnetbyaddr_r_proto=''
551 d_getnetbyname_r=''
552 getnetbyname_r_proto=''
553 d_getnetent_r=''
554 getnetent_r_proto=''
555 d_getnetprotos=''
556 d_getpagsz=''
557 d_getpent=''
558 d_getpgid=''
559 d_getpgrp2=''
560 d_bsdgetpgrp=''
561 d_getpgrp=''
562 d_getppid=''
563 d_getprior=''
564 d_getpbyname=''
565 d_getpbynumber=''
566 d_getprotobyname_r=''
567 getprotobyname_r_proto=''
568 d_getprotobynumber_r=''
569 getprotobynumber_r_proto=''
570 d_getprotoent_r=''
571 getprotoent_r_proto=''
572 d_getprotoprotos=''
573 d_getprpwnam=''
574 d_getpwent=''
575 d_getpwent_r=''
576 getpwent_r_proto=''
577 d_getpwnam_r=''
578 getpwnam_r_proto=''
579 d_getpwuid_r=''
580 getpwuid_r_proto=''
581 d_getsent=''
582 d_getservbyname_r=''
583 getservbyname_r_proto=''
584 d_getservbyport_r=''
585 getservbyport_r_proto=''
586 d_getservent_r=''
587 getservent_r_proto=''
588 d_getservprotos=''
589 d_getspnam=''
590 d_getspnam_r=''
591 getspnam_r_proto=''
592 d_getsbyname=''
593 d_getsbyport=''
594 d_gmtime_r=''
595 gmtime_r_proto=''
596 d_gnulibc=''
597 gnulibc_version=''
598 d_hasmntopt=''
599 d_htonl=''
600 d_hypot=''
601 d_ilogb=''
602 d_ilogbl=''
603 d_inetaton=''
604 d_inetntop=''
605 d_inetpton=''
606 d_int64_t=''
607 d_isascii=''
608 d_isblank=''
609 d_isfinite=''
610 d_isfinitel=''
611 d_isinf=''
612 d_isinfl=''
613 d_isless=''
614 d_isnan=''
615 d_isnanl=''
616 d_isnormal=''
617 d_j0=''
618 d_j0l=''
619 d_killpg=''
620 d_lc_monetary_2008=''
621 d_lchown=''
622 d_ldbl_dig=''
623 d_lgamma=''
624 d_lgamma_r=''
625 d_libm_lib_version=''
626 d_link=''
627 d_llrint=''
628 d_llrintl=''
629 d_llround=''
630 d_llroundl=''
631 d_localeconv_l=''
632 d_localtime_r=''
633 d_localtime_r_needs_tzset=''
634 localtime_r_proto=''
635 d_locconv=''
636 d_lockf=''
637 d_log1p=''
638 d_log2=''
639 d_logb=''
640 d_ldexpl=''
641 d_long_double_style_ieee=''
642 d_long_double_style_ieee_doubledouble=''
643 d_long_double_style_ieee_extended=''
644 d_long_double_style_ieee_std=''
645 d_long_double_style_vax=''
646 d_longdbl=''
647 longdblkind=''
648 longdblsize=''
649 d_longlong=''
650 longlongsize=''
651 d_lrint=''
652 d_lrintl=''
653 d_lround=''
654 d_lroundl=''
655 d_lseekproto=''
656 d_lstat=''
657 d_madvise=''
658 d_malloc_good_size=''
659 d_malloc_size=''
660 d_mblen=''
661 d_mbrlen=''
662 d_mbrtowc=''
663 d_mbstowcs=''
664 d_mbtowc=''
665 d_memmem=''
666 d_memrchr=''
667 d_mkdir=''
668 d_mkdtemp=''
669 d_mkfifo=''
670 d_mkostemp=''
671 d_mkstemp=''
672 d_mkstemps=''
673 d_mktime=''
674 d_mmap=''
675 mmaptype=''
676 d_modfl=''
677 d_modflproto=''
678 d_mprotect=''
679 d_msg=''
680 d_msgctl=''
681 d_msgget=''
682 d_msghdr_s=''
683 d_msgrcv=''
684 d_msgsnd=''
685 d_msync=''
686 d_munmap=''
687 d_nan=''
688 d_nanosleep=''
689 d_nearbyint=''
690 d_duplocale=''
691 d_freelocale=''
692 d_newlocale=''
693 d_querylocale=''
694 d_uselocale=''
695 i_xlocale=''
696 d_nextafter=''
697 d_nexttoward=''
698 d_nice=''
699 d_nl_langinfo=''
700 d_thread_safe_nl_langinfo_l=''
701 d_off64_t=''
702 d_open3=''
703 d_fpathconf=''
704 d_pathconf=''
705 d_pause=''
706 d_pipe2=''
707 d_pipe=''
708 d_poll=''
709 d_portable=''
710 d_prctl=''
711 d_prctl_set_name=''
712 d_procselfexe=''
713 procselfexe=''
714 d_old_pthread_create_joinable=''
715 old_pthread_create_joinable=''
716 d_pthread_atfork=''
717 d_pthread_attr_setscope=''
718 d_pthread_yield=''
719 d_sched_yield=''
720 sched_yield=''
721 d_ptrdiff_t=''
722 d_qgcvt=''
723 d_random_r=''
724 random_r_proto=''
725 d_readdir64_r=''
726 readdir64_r_proto=''
727 d_readdir=''
728 d_rewinddir=''
729 d_seekdir=''
730 d_telldir=''
731 d_readdir_r=''
732 readdir_r_proto=''
733 d_readlink=''
734 d_readv=''
735 d_recvmsg=''
736 d_re_comp=''
737 d_regcmp=''
738 d_regcomp=''
739 d_remainder=''
740 d_remquo=''
741 d_rename=''
742 d_rint=''
743 d_rmdir=''
744 d_round=''
745 d_sbrkproto=''
746 d_scalbn=''
747 d_scalbnl=''
748 d_select=''
749 d_sem=''
750 d_semctl=''
751 d_semget=''
752 d_semop=''
753 d_sendmsg=''
754 d_setegid=''
755 d_seteuid=''
756 d_setgrent=''
757 d_setgrent_r=''
758 setgrent_r_proto=''
759 d_setgrps=''
760 d_sethent=''
761 d_sethostent_r=''
762 sethostent_r_proto=''
763 d_setitimer=''
764 d_setlinebuf=''
765 d_setlocale=''
766 d_setlocale_r=''
767 setlocale_r_proto=''
768 d_setnent=''
769 d_setnetent_r=''
770 setnetent_r_proto=''
771 d_setpent=''
772 d_setpgid=''
773 d_setpgrp2=''
774 d_bsdsetpgrp=''
775 d_setpgrp=''
776 d_setprior=''
777 d_setproctitle=''
778 d_setprotoent_r=''
779 setprotoent_r_proto=''
780 d_setpwent=''
781 d_setpwent_r=''
782 setpwent_r_proto=''
783 d_setregid=''
784 d_setresgid=''
785 d_setresuid=''
786 d_setreuid=''
787 d_setrgid=''
788 d_setruid=''
789 d_setsent=''
790 d_setservent_r=''
791 setservent_r_proto=''
792 d_setsid=''
793 d_setvbuf=''
794 d_shm=''
795 d_shmat=''
796 d_shmatprototype=''
797 shmattype=''
798 d_shmctl=''
799 d_shmdt=''
800 d_shmget=''
801 d_sigaction=''
802 d_siginfo_si_addr=''
803 d_siginfo_si_band=''
804 d_siginfo_si_errno=''
805 d_siginfo_si_fd=''
806 d_siginfo_si_pid=''
807 d_siginfo_si_status=''
808 d_siginfo_si_uid=''
809 d_siginfo_si_value=''
810 d_signbit=''
811 d_sigprocmask=''
812 d_sigsetjmp=''
813 usesitecustomize=''
814 d_snprintf=''
815 d_vsnprintf=''
816 d_sockatmark=''
817 d_sockatmarkproto=''
818 d_ip_mreq=''
819 d_ip_mreq_source=''
820 d_ipv6_mreq=''
821 d_ipv6_mreq_source=''
822 d_msg_ctrunc=''
823 d_msg_dontroute=''
824 d_msg_oob=''
825 d_msg_peek=''
826 d_msg_proxy=''
827 d_oldsock=''
828 d_scm_rights=''
829 d_sin6_scope_id=''
830 d_sockaddr_in6=''
831 d_sockaddr_sa_len=''
832 d_socket=''
833 d_sockpair=''
834 sockethdr=''
835 socketlib=''
836 d_socklen_t=''
837 d_socks5_init=''
838 d_sqrtl=''
839 d_srand48_r=''
840 srand48_r_proto=''
841 d_srandom_r=''
842 srandom_r_proto=''
843 d_sresgproto=''
844 d_sresuproto=''
845 d_stat=''
846 d_statblks=''
847 d_statfs_f_flags=''
848 d_statfs_s=''
849 d_static_inline=''
850 perl_static_inline=''
851 d_fstatvfs=''
852 d_statvfs=''
853 d_stdio_cnt_lval=''
854 d_stdio_ptr_lval=''
855 d_stdio_ptr_lval_nochange_cnt=''
856 d_stdio_ptr_lval_sets_cnt=''
857 d_stdiobase=''
858 d_stdstdio=''
859 stdio_base=''
860 stdio_bufsiz=''
861 stdio_cnt=''
862 stdio_filbuf=''
863 stdio_ptr=''
864 d_strcoll=''
865 d_sysernlst=''
866 d_syserrlst=''
867 d_strerror_l=''
868 d_strerror_r=''
869 strerror_r_proto=''
870 d_strftime=''
871 d_strlcat=''
872 d_strlcpy=''
873 d_strnlen=''
874 d_strtod=''
875 d_strtod_l=''
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 useposix=false in your hint file to disable the POSIX extension.
1469 useposix=true
1470 : set useopcode=false in your hint file to disable the Opcode extension.
1471 useopcode=true
1472 : set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1473 uselanginfo=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                 minix)  osname=minix
3502                         osvers=`$uname -r`
3503                         ;;
3504                 netbsd*) osname=netbsd
3505                         osvers="$3"
3506                         ;;
3507                 news-os) osvers="$3"
3508                         case "$3" in
3509                         4*) osname=newsos4 ;;
3510                         *) osname=newsos ;;
3511                         esac
3512                         ;;
3513                 nonstop-ux) osname=nonstopux ;;
3514                 openbsd) osname=openbsd
3515                         osvers="$3"
3516                         ;;
3517                 os2)    osname=os2
3518                         osvers="$4"
3519                         ;;
3520                 POSIX-BC | posix-bc ) osname=posix-bc
3521                         osvers="$3"
3522                         ;;
3523                 powerux | power_ux | powermax_os | powermaxos | \
3524                 powerunix | power_unix) osname=powerux
3525                         osvers="$3"
3526                         ;;
3527                 qnx) osname=qnx
3528                         osvers="$4"
3529                         ;;
3530                 solaris) osname=solaris
3531                         case "$3" in
3532                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3533                         *)      osvers="$3" ;;
3534                         esac
3535                         ;;
3536                 sunos) osname=sunos
3537                         case "$3" in
3538                         5*) osname=solaris
3539                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3540                         *)      osvers="$3" ;;
3541                         esac
3542                         ;;
3543                 titanos) osname=titanos
3544                         case "$3" in
3545                         1*) osvers=1 ;;
3546                         2*) osvers=2 ;;
3547                         3*) osvers=3 ;;
3548                         4*) osvers=4 ;;
3549                         *)      osvers="$3" ;;
3550                         esac
3551                         ;;
3552                 ultrix) osname=ultrix
3553                         osvers="$3"
3554                         ;;
3555                 osf1|mls+)      case "$5" in
3556                                 alpha)
3557                                         osname=dec_osf
3558                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3559                                         case "$osvers" in
3560                                         [1-9].[0-9]*) ;;
3561                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3562                                         esac
3563                                         ;;
3564                         hp*)    osname=hp_osf1  ;;
3565                         mips)   osname=mips_osf1 ;;
3566                         esac
3567                         ;;
3568                 # UnixWare 7.1.2 is known as Open UNIX 8
3569                 openunix|unixware) osname=svr5
3570                         osvers="$4"
3571                         ;;
3572                 uts)    osname=uts
3573                         osvers="$3"
3574                         ;;
3575                 vos) osvers="$3"
3576                         ;;
3577                 $2) case "$osname" in
3578                         *isc*) ;;
3579                         *freebsd*) ;;
3580                         svr*)
3581                                 : svr4.x or possibly later
3582                                 case "svr$3" in
3583                                 ${osname}*)
3584                                         osname=svr$3
3585                                         osvers=$4
3586                                         ;;
3587                                 esac
3588                                 case "$osname" in
3589                                 svr4.0)
3590                                         : Check for ESIX
3591                                         if test -f /stand/boot ; then
3592                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3593                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3594                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3595                                                         if test -n "$isesix"; then
3596                                                                 osname=esix4
3597                                                         fi
3598                                                 fi
3599                                         fi
3600                                         ;;
3601                                 esac
3602                                 ;;
3603                         *)      if test -f /etc/systemid; then
3604                                         osname=sco
3605                                         set `echo $3 | $sed 's/\./ /g'` $4
3606                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3607                                                 osvers=$1.$2.$3
3608                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3609                                                 osvers=$1.$2
3610                                         elif $test -f $src/hints/sco_$1.sh; then
3611                                                 osvers=$1
3612                                         fi
3613                                 else
3614                                         case "$osname" in
3615                                         '') : Still unknown.  Probably a generic Sys V.
3616                                                 osname="sysv"
3617                                                 osvers="$3"
3618                                                 ;;
3619                                         esac
3620                                 fi
3621                                 ;;
3622                         esac
3623                         ;;
3624                 *)      case "$osname" in
3625                         '') : Still unknown.  Probably a generic BSD.
3626                                 osname="$1"
3627                                 osvers="$3"
3628                                 ;;
3629                         esac
3630                         ;;
3631                 esac
3632         else
3633                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3634                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3635                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3636                                 osname=news_os
3637                         fi
3638                         $rm -f UU/kernel.what
3639                 elif test -d c:/. -o -n "$is_os2" ; then
3640                         set X $myuname
3641                         osname=os2
3642                         osvers="$5"
3643                 fi
3644         fi
3645
3646         case "$targetarch" in
3647         '') ;;
3648         *)  hostarch=$osname
3649             case "$targetarch" in
3650                 nto*|*-nto-*)
3651                     # Will load qnx.sh, which should change osname to nto
3652                     osname=qnx
3653                     osvers=''
3654                     ;;
3655                 *linux-android*)
3656                     # Catch arm-linux-androideabi, mipsel-linux-android,
3657                     # and i686-linux-android
3658                     osname=linux-android
3659                     osvers=''
3660                     ;;
3661                 *linux*)
3662                     # Something like arm-linux-gnueabihf is really just
3663                     # plain linux.
3664                     osname=linux
3665                     osvers=''
3666                     ;;
3667                 *solaris*|*sunos*)
3668                     osname=solaris
3669                     # XXX perhaps we should just assume
3670                     # osvers to be 2, or maybe take the value
3671                     # from targetarch. Using $run before the
3672                     # hints are run is somewhat icky.
3673                     set X `$run $uname -a 2>/dev/null`
3674                     shift
3675                     case "$3" in
3676                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3677                         *)  osvers="$3" ;;
3678                     esac
3679                     ;;
3680                 *)
3681                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3682                     osvers=''
3683                 ;;
3684             esac
3685             ;;
3686         esac
3687
3688         : Now look for a hint file osname_osvers, unless one has been
3689         : specified already.
3690         case "$hintfile" in
3691         ''|' ')
3692                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3693                 : Also try without trailing minor version numbers.
3694                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3695                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3696                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3697                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3698                 case "$file" in
3699                 '') dflt=none ;;
3700                 *)  case "$osvers" in
3701                         '') dflt=$file
3702                                 ;;
3703                         *)  if $test -f $src/hints/$file.sh ; then
3704                                         dflt=$file
3705                                 elif $test -f $src/hints/$xfile.sh ; then
3706                                         dflt=$xfile
3707                                 elif $test -f $src/hints/$xxfile.sh ; then
3708                                         dflt=$xxfile
3709                                 elif $test -f $src/hints/$xxxfile.sh ; then
3710                                         dflt=$xxxfile
3711                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3712                                         dflt=$xxxxfile
3713                                 elif $test -f "$src/hints/${osname}.sh" ; then
3714                                         dflt="${osname}"
3715                                 else
3716                                         dflt=none
3717                                 fi
3718                                 ;;
3719                         esac
3720                         ;;
3721                 esac
3722                 if $test -f Policy.sh ; then
3723                         case "$dflt" in
3724                         *Policy*) ;;
3725                         none) dflt="Policy" ;;
3726                         *) dflt="Policy $dflt" ;;
3727                         esac
3728                 fi
3729                 ;;
3730         *)
3731                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3732                 ;;
3733         esac
3734
3735         if $test -f Policy.sh ; then
3736                 $cat <<EOM
3737
3738 There's also a Policy hint file available, which should make the
3739 site-specific (policy) questions easier to answer.
3740 EOM
3741
3742         fi
3743
3744         $cat <<EOM
3745
3746 You may give one or more space-separated answers, or "none" if appropriate.
3747 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3748 previous run of Configure, you may specify it as well as or instead of
3749 OS-specific hints.  If hints are provided for your OS, you should use them:
3750 although Perl can probably be built without hints on many platforms, using
3751 hints often improve performance and may enable features that Configure can't
3752 set up on its own. If there are no hints that match your OS, specify "none";
3753 DO NOT give a wrong version or a wrong OS.
3754
3755 EOM
3756
3757         rp="Which of these apply, if any?"
3758         . UU/myread
3759         tans=$ans
3760         for file in $tans; do
3761                 if $test X$file = XPolicy -a -f Policy.sh; then
3762                         . Policy.sh
3763                         $cat Policy.sh >> UU/config.sh
3764                 elif $test -f $src/hints/$file.sh; then
3765                         . $src/hints/$file.sh
3766                         $cat $src/hints/$file.sh >> UU/config.sh
3767                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3768                         : nothing
3769                 else
3770                         : Give one chance to correct a possible typo.
3771                         echo "$file.sh does not exist"
3772                         dflt=$file
3773                         rp="hint to use instead?"
3774                         . UU/myread
3775                         for file in $ans; do
3776                                 if $test -f "$src/hints/$file.sh"; then
3777                                         . $src/hints/$file.sh
3778                                         $cat $src/hints/$file.sh >> UU/config.sh
3779                                 elif $test X$ans = X -o X$ans = Xnone ; then
3780                                         : nothing
3781                                 else
3782                                         echo "$file.sh does not exist -- ignored."
3783                                 fi
3784                         done
3785                 fi
3786         done
3787
3788         hint=recommended
3789         : Remember our hint file for later.
3790         if $test -f "$src/hints/$file.sh" ; then
3791                 hintfile="$file"
3792         else
3793                 hintfile=''
3794         fi
3795 fi
3796 cd UU
3797 ;;
3798 *)
3799         echo " "
3800         echo "Fetching default answers from $config_sh..." >&4
3801         tmp_n="$n"
3802         tmp_c="$c"
3803         cd ..
3804         cp $config_sh config.sh 2>/dev/null
3805         chmod +w config.sh
3806         . ./config.sh
3807         cd UU
3808         cp ../config.sh .
3809         n="$tmp_n"
3810         c="$tmp_c"
3811         hint=previous
3812         ;;
3813 esac
3814 . ./optdef.sh
3815
3816 : Restore computed paths
3817 for file in $loclist $trylist; do
3818         eval $file="\$_$file"
3819 done
3820
3821 cat << EOM
3822
3823 Configure uses the operating system name and version to set some defaults.
3824 The default value is probably right if the name rings a bell. Otherwise,
3825 since spelling matters for me, either accept the default or answer "none"
3826 to leave it blank.
3827
3828 EOM
3829 case "$osname" in
3830         ''|' ')
3831                 case "$hintfile" in
3832                 ''|' '|none) dflt=none ;;
3833                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3834                 esac
3835                 ;;
3836         *) dflt="$osname" ;;
3837 esac
3838 rp="Operating system name?"
3839 . ./myread
3840 case "$ans" in
3841 none)  osname='' ;;
3842 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3843 esac
3844 echo " "
3845 case "$osvers" in
3846         ''|' ')
3847                 case "$hintfile" in
3848                 ''|' '|none) dflt=none ;;
3849                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3850                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3851                         case "$dflt" in
3852                         ''|' ') dflt=none ;;
3853                         esac
3854                         ;;
3855                 esac
3856                 ;;
3857         *) dflt="$osvers" ;;
3858 esac
3859 rp="Operating system version?"
3860 . ./myread
3861 case "$ans" in
3862 none)  osvers='' ;;
3863 *) osvers="$ans" ;;
3864 esac
3865
3866
3867 . ./posthint.sh
3868
3869 : who configured the system
3870 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3871 case "$cf_by" in
3872 "")
3873         cf_by=`(logname) 2>/dev/null`
3874         case "$cf_by" in
3875         "")
3876                 cf_by=`(whoami) 2>/dev/null`
3877                 case "$cf_by" in
3878                 "") cf_by=unknown ;;
3879                 esac ;;
3880         esac ;;
3881 esac
3882
3883 : decide how portable to be.  Allow command line overrides.
3884 case "$d_portable" in
3885 "$undef") ;;
3886 *)      d_portable="$define" ;;
3887 esac
3888
3889 : set up shell script to do ~ expansion
3890 cat >filexp <<EOSS
3891 $startsh
3892 : expand filename
3893 case "\$1" in
3894  \~/*|\~)
3895         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3896         ;;
3897  \~*)
3898         if $test -f /bin/csh; then
3899                 /bin/csh -f -c "glob \$1"
3900                 failed=\$?
3901                 echo ""
3902                 exit \$failed
3903         else
3904                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3905                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3906                 if $test ! -d "\$dir"; then
3907                         me=\`basename \$0\`
3908                         echo "\$me: can't locate home directory for: \$name" >&2
3909                         exit 1
3910                 fi
3911                 case "\$1" in
3912                 */*)
3913                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3914                         ;;
3915                 *)
3916                         echo \$dir
3917                         ;;
3918                 esac
3919         fi
3920         ;;
3921 *)
3922         echo \$1
3923         ;;
3924 esac
3925 EOSS
3926 chmod +x filexp
3927 $eunicefix filexp
3928
3929 : now set up to get a file name
3930 cat <<EOS >getfile
3931 $startsh
3932 EOS
3933 cat <<'EOSC' >>getfile
3934 tilde=''
3935 fullpath=''
3936 already=''
3937 skip=''
3938 none_ok=''
3939 exp_file=''
3940 nopath_ok=''
3941 orig_rp="$rp"
3942 orig_dflt="$dflt"
3943 case "$gfpth" in
3944 '') gfpth='.' ;;
3945 esac
3946
3947 case "$fn" in
3948 *\(*)
3949         : getfile will accept an answer from the comma-separated list
3950         : enclosed in parentheses even if it does not meet other criteria.
3951         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3952         fn=`echo $fn | sed 's/(.*)//'`
3953         ;;
3954 esac
3955
3956 case "$fn" in
3957 *:*)
3958         loc_file=`expr $fn : '.*:\(.*\)'`
3959         fn=`expr $fn : '\(.*\):.*'`
3960         ;;
3961 esac
3962
3963 case "$fn" in
3964 *~*) tilde=true;;
3965 esac
3966 case "$fn" in
3967 */*) fullpath=true;;
3968 esac
3969 case "$fn" in
3970 *+*) skip=true;;
3971 esac
3972 case "$fn" in
3973 *n*) none_ok=true;;
3974 esac
3975 case "$fn" in
3976 *e*) exp_file=true;;
3977 esac
3978 case "$fn" in
3979 *p*) nopath_ok=true;;
3980 esac
3981
3982 case "$fn" in
3983 *f*) type='File';;
3984 *d*) type='Directory';;
3985 *l*) type='Locate';;
3986 esac
3987
3988 what="$type"
3989 case "$what" in
3990 Locate) what='File';;
3991 esac
3992
3993 case "$exp_file" in
3994 '')
3995         case "$d_portable" in
3996         "$define") ;;
3997         *) exp_file=true;;
3998         esac
3999         ;;
4000 esac
4001
4002 cd ..
4003 while test "$type"; do
4004         redo=''
4005         rp="$orig_rp"
4006         dflt="$orig_dflt"
4007         case "$tilde" in
4008         true) rp="$rp (~name ok)";;
4009         esac
4010         . UU/myread
4011         if test -f UU/getfile.ok && \
4012                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4013         then
4014                 value="$ans"
4015                 ansexp="$ans"
4016                 break
4017         fi
4018         case "$ans" in
4019         none)
4020                 value=''
4021                 ansexp=''
4022                 case "$none_ok" in
4023                 true) type='';;
4024                 esac
4025                 ;;
4026         *)
4027                 case "$tilde" in
4028                 '') value="$ans"
4029                         ansexp="$ans";;
4030                 *)
4031                         value=`UU/filexp $ans`
4032                         case $? in
4033                         0)
4034                                 if test "$ans" != "$value"; then
4035                                         echo "(That expands to $value on this system.)"
4036                                 fi
4037                                 ;;
4038                         *) value="$ans";;
4039                         esac
4040                         ansexp="$value"
4041                         case "$exp_file" in
4042                         '') value="$ans";;
4043                         esac
4044                         ;;
4045                 esac
4046                 case "$fullpath" in
4047                 true)
4048                         case "$ansexp" in
4049                         /*) value="$ansexp" ;;
4050                         [a-zA-Z]:/*) value="$ansexp" ;;
4051                         *)
4052                                 redo=true
4053                                 case "$already" in
4054                                 true)
4055                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4056                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4057                                         ;;
4058                                 *)
4059                                 echo "Please give a full path name, starting with slash." >&4
4060                                         case "$tilde" in
4061                                         true)
4062                                 echo "Note that using ~name is ok provided it expands well." >&4
4063                                                 already=true
4064                                                 ;;
4065                                         esac
4066                                 esac
4067                                 ;;
4068                         esac
4069                         ;;
4070                 esac
4071                 case "$redo" in
4072                 '')
4073                         case "$type" in
4074                         File)
4075                                 for fp in $gfpth; do
4076                                         if test "X$fp" = X.; then
4077                                             pf="$ansexp"
4078                                         else    
4079                                             pf="$fp/$ansexp"
4080                                         fi
4081                                         if test -f "$pf"; then
4082                                                 type=''
4083                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4084                                         then
4085                                                 echo "($value is not a plain file, but that's ok.)"
4086                                                 type=''
4087                                         fi
4088                                         if test X"$type" = X; then
4089                                             value="$pf"
4090                                             break
4091                                         fi
4092                                 done
4093                                 ;;
4094                         Directory)
4095                                 for fp in $gfpth; do
4096                                         if test "X$fp" = X.; then
4097                                             dir="$ans"
4098                                             direxp="$ansexp"
4099                                         else    
4100                                             dir="$fp/$ansexp"
4101                                             direxp="$fp/$ansexp"
4102                                         fi
4103                                         if test -d "$direxp"; then
4104                                                 type=''
4105                                                 value="$dir"
4106                                                 break
4107                                         fi
4108                                 done
4109                                 ;;
4110                         Locate)
4111                                 if test -d "$ansexp"; then
4112                                         echo "(Looking for $loc_file in directory $value.)"
4113                                         value="$value/$loc_file"
4114                                         ansexp="$ansexp/$loc_file"
4115                                 fi
4116                                 if test -f "$ansexp"; then
4117                                         type=''
4118                                 fi
4119                                 case "$nopath_ok" in
4120                                 true)   case "$value" in
4121                                         */*) ;;
4122                                         *)      echo "Assuming $value will be in people's path."
4123                                                 type=''
4124                                                 ;;
4125                                         esac
4126                                         ;;
4127                                 esac
4128                                 ;;
4129                         esac
4130
4131                         case "$skip" in
4132                         true) type='';
4133                         esac
4134
4135                         case "$type" in
4136                         '') ;;
4137                         *)
4138                                 if test "$fastread" = yes; then
4139                                         dflt=y
4140                                 else
4141                                         dflt=n
4142                                 fi
4143                                 rp="$what $value doesn't exist.  Use that name anyway?"
4144                                 . UU/myread
4145                                 dflt=''
4146                                 case "$ans" in
4147                                 y*) type='';;
4148                                 *) echo " ";;
4149                                 esac
4150                                 ;;
4151                         esac
4152                         ;;
4153                 esac
4154                 ;;
4155         esac
4156 done
4157 cd UU
4158 ans="$value"
4159 rp="$orig_rp"
4160 dflt="$orig_dflt"
4161 rm -f getfile.ok
4162 test "X$gfpthkeep" != Xy && gfpth=""
4163 EOSC
4164
4165 : determine root of directory hierarchy where package will be installed.
4166 case "$prefix" in
4167 '')
4168         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4169         ;;
4170 *?/)
4171         dflt=`echo "$prefix" | sed 's/.$//'`
4172         ;;
4173 *)
4174         dflt="$prefix"
4175         ;;
4176 esac
4177 $cat <<EOM
4178
4179 By default, $package will be installed in $dflt/bin, manual pages
4180 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4181 installation directories. Typically this is something like /usr/local.
4182 If you wish to have binaries under /usr/bin but other parts of the
4183 installation under /usr/local, that's ok: you will be prompted
4184 separately for each of the installation directories, the prefix being
4185 only used to set the defaults.
4186
4187 EOM
4188 fn=d~
4189 rp='Installation prefix to use?'
4190 . ./getfile
4191 oldprefix=''
4192 case "$prefix" in
4193 '') ;;
4194 *)
4195         case "$ans" in
4196         "$prefix") ;;
4197         *) oldprefix="$prefix";;
4198         esac
4199         ;;
4200 esac
4201 prefix="$ans"
4202 prefixexp="$ansexp"
4203
4204 : allow them to override the AFS root
4205 case "$afsroot" in
4206 '')     afsroot=/afs ;;
4207 *)      afsroot=$afsroot ;;
4208 esac
4209
4210 : is AFS running?
4211 echo " "
4212 case "$afs" in
4213 $define|true)   afs=true ;;
4214 $undef|false)   afs=false ;;
4215 *)      if $test -d $afsroot; then
4216                 afs=true
4217         else
4218                 afs=false
4219         fi
4220         ;;
4221 esac
4222 if $afs; then
4223         echo "AFS may be running... I'll be extra cautious then..." >&4
4224 else
4225         echo "AFS does not seem to be running..." >&4
4226 fi
4227
4228 : determine installation prefix for where package is to be installed.
4229 if $afs; then
4230 $cat <<EOM
4231
4232 Since you are running AFS, I need to distinguish the directory in which
4233 files will reside from the directory in which they are installed (and from
4234 which they are presumably copied to the former directory by occult means).
4235
4236 EOM
4237         case "$installprefix" in
4238         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4239         *) dflt="$installprefix";;
4240         esac
4241 else
4242 $cat <<EOM
4243
4244 In some special cases, particularly when building $package for distribution,
4245 it is convenient to distinguish the directory in which files should be
4246 installed from the directory ($prefix) in which they will
4247 eventually reside.  For most users, these two directories are the same.
4248
4249 EOM
4250         case "$installprefix" in
4251         '') dflt=$prefix ;;
4252         *) dflt=$installprefix;;
4253         esac
4254 fi
4255 fn=d~
4256 rp='What installation prefix should I use for installing files?'
4257 . ./getfile
4258 installprefix="$ans"
4259 installprefixexp="$ansexp"
4260
4261 : Perform the prefixexp/installprefixexp correction if necessary
4262 cat <<EOS >installprefix
4263 $startsh
4264 EOS
4265 cat <<'EOSC' >>installprefix
4266 : Change installation prefix, if necessary.
4267 if $test X"$prefix" != X"$installprefix"; then
4268     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4269 else
4270     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4271 fi
4272 EOSC
4273 chmod +x installprefix
4274 $eunicefix installprefix
4275
4276 : Set variables such as privlib and privlibexp from the output of ./getfile
4277 : performing the prefixexp/installprefixexp correction if necessary.
4278 cat <<EOS >setprefixvar
4279 $startsh
4280 EOS
4281 cat <<'EOSC' >>setprefixvar
4282 eval "${prefixvar}=\"\$ans\""
4283 eval "${prefixvar}exp=\"\$ansexp\""
4284 . ./installprefix
4285 EOSC
4286 chmod +x setprefixvar
4287 $eunicefix setprefixvar
4288
4289 : set up the script used to warn in case of inconsistency
4290 cat <<EOS >whoa
4291 $startsh
4292 EOS
4293 cat <<'EOSC' >>whoa
4294 dflt=y
4295 case "$hint" in
4296     recommended)
4297         case "$hintfile" in
4298         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4299                 ;;
4300         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4301                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4302                 ;;
4303         esac
4304         ;;
4305     *)  echo " "
4306         echo "*** WHOA THERE!!! ***" >&4
4307         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4308         ;;
4309 esac
4310 rp="    Keep the $hint value?"
4311 . ./myread
4312 case "$ans" in
4313 y) td=$was; tu=$was;;
4314 esac
4315 EOSC
4316
4317 : function used to set '$1' to '$val'
4318 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4319 case "$val$was" in
4320 $define$undef) . ./whoa; eval "$var=\$td";;
4321 $undef$define) . ./whoa; eval "$var=\$tu";;
4322 *) eval "$var=$val";;
4323 esac'
4324
4325 : get the patchlevel
4326 echo " "
4327 echo "Getting the current patchlevel..." >&4
4328 if $test -r $rsrc/patchlevel.h;then
4329         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4330         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4331         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4332         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4333         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4334         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4335         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4336 else
4337         revision=0
4338         patchlevel=0
4339         subversion=0
4340         api_revision=0
4341         api_version=0
4342         api_subversion=0
4343         perl_patchlevel=0
4344         $echo "(You do not have patchlevel.h.  Eek.)"
4345 fi
4346 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4347 version_patchlevel_string="version $patchlevel subversion $subversion"
4348 case "$perl_patchlevel" in
4349 0|'') ;;
4350 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4351     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4352     ;;
4353 esac
4354
4355 $echo "(You have $package $version_patchlevel_string.)"
4356
4357 case "$osname" in
4358 dos|vms)
4359         : XXX Should be a Configure test for double-dots in filenames.
4360         version=`echo $revision $patchlevel $subversion | \
4361                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4362         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4363                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4364         ;;
4365 *)
4366         version=`echo $revision $patchlevel $subversion | \
4367                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4368         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4369                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4370         ;;
4371 esac
4372 : Special case the 5.005_xx maintenance series, which used 5.005
4373 : without any subversion label as a subdirectory in $sitelib
4374 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4375         api_versionstring='5.005'
4376 fi
4377
4378 : Do we want threads support and if so, what type
4379 case "$usethreads" in
4380 $define|true|[yY]*)     dflt='y';;
4381 *)     # Catch case where user specified ithreads or 5005threads but
4382        # forgot -Dusethreads (A.D. 4/2002)
4383        case "$useithreads$use5005threads" in
4384        *$define*)       dflt='y';;
4385        *)               dflt='n';;
4386        esac
4387        ;;
4388 esac
4389 cat <<EOM
4390
4391 Perl can be built to offer a form of threading support on some systems
4392 To do so, Configure can be run with -Dusethreads.
4393
4394 Note that Perl built with threading support runs slightly slower
4395 and uses slightly more memory than plain Perl.
4396
4397 If this doesn't make any sense to you, just accept the default '$dflt'.
4398 EOM
4399 rp='Build a threading Perl?'
4400 . ./myread
4401 case "$ans" in
4402 y|Y)    val="$define" ;;
4403 *)      val="$undef" ;;
4404 esac
4405 set usethreads
4406 eval $setvar
4407
4408 if $test $patchlevel -lt 9; then
4409     case "$usethreads" in
4410     $define)
4411         : Default to ithreads unless overridden on command line or with
4412         : old config.sh
4413         dflt='y'
4414         case "$use5005threads" in
4415                 $define|true|[yY]*)
4416                         echo "5.005 threads are no longer supported"
4417                         exit 1
4418                 ;;
4419         esac
4420         case "$useithreads" in
4421                 $undef|false|[nN]*) dflt='n';;
4422         esac
4423         rp='Use the newer interpreter-based ithreads?'
4424         . ./myread
4425         case "$ans" in
4426         y|Y)    val="$define" ;;
4427         *)      val="$undef" ;;
4428         esac
4429         set useithreads
4430         eval $setvar
4431         : Now set use5005threads to the opposite value.
4432         case "$useithreads" in
4433         $define) val="$undef" ;;
4434         *) val="$define" ;;
4435         esac
4436         set use5005threads
4437         eval $setvar
4438         ;;
4439     *)
4440         useithreads="$undef"
4441         use5005threads="$undef"
4442         ;;
4443     esac
4444
4445     case "$useithreads$use5005threads" in
4446     "$define$define")
4447         $cat >&4 <<EOM
4448
4449 You cannot have both the ithreads and the 5.005 threads enabled
4450 at the same time.  Disabling the 5.005 threads since they are
4451 much less stable than the ithreads.
4452
4453 EOM
4454         use5005threads="$undef"
4455         ;;
4456     esac
4457
4458 else
4459 : perl-5.9.x and later
4460
4461     if test X"$usethreads" = "X$define"; then
4462         case "$use5005threads" in
4463             $define|true|[yY]*)
4464                 $cat >&4 <<EOM
4465
4466 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4467
4468 EOM
4469             ;;
4470         esac
4471     fi
4472
4473     use5005threads="$undef"
4474     useithreads="$usethreads"
4475 fi
4476
4477 case "$d_oldpthreads" in
4478 '')     : Configure tests would be welcome here.  For now, assume undef.
4479         val="$undef" ;;
4480 *)      val="$d_oldpthreads" ;;
4481 esac
4482 set d_oldpthreads
4483 eval $setvar
4484
4485
4486 : Look for a hint-file generated 'call-back-unit'.  If the
4487 : user has specified that a threading perl is to be built,
4488 : we may need to set or change some other defaults.
4489 if $test -f usethreads.cbu; then
4490     echo "Your platform has some specific hints regarding threaded builds, using them..."
4491     . ./usethreads.cbu
4492 else
4493     case "$usethreads" in
4494         "$define"|true|[yY]*)
4495                 $cat <<EOM
4496 (Your platform does not have any specific hints for threaded builds.
4497  Assuming POSIX threads, then.)
4498 EOM
4499         ;;
4500     esac
4501 fi
4502
4503 : Check if multiplicity is required
4504 cat <<EOM
4505
4506 Perl can be built so that multiple Perl interpreters can coexist
4507 within the same Perl executable.
4508 EOM
4509
4510 case "$useithreads" in
4511 $define)
4512         cat <<EOM
4513 This multiple interpreter support is required for interpreter-based threads.
4514 EOM
4515         val="$define"
4516         ;;
4517 *)      case "$usemultiplicity" in
4518         $define|true|[yY]*)     dflt='y';;
4519         *) dflt='n';;
4520         esac
4521         echo " "
4522         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4523         rp='Build Perl for multiplicity?'
4524         . ./myread
4525         case "$ans" in
4526         y|Y)    val="$define" ;;
4527         *)      val="$undef" ;;
4528         esac
4529         ;;
4530 esac
4531 set usemultiplicity
4532 eval $setvar
4533
4534 : Check if morebits is requested
4535 case "$usemorebits" in
4536 "$define"|true|[yY]*)
4537         use64bitint="$define"
4538         uselongdouble="$define"
4539         usemorebits="$define"
4540         ;;
4541 *)      usemorebits="$undef"
4542         ;;
4543 esac
4544
4545 : Determine the C compiler to be used
4546 echo " "
4547 case "$cc" in
4548 '') dflt=cc;;
4549 *) dflt="$cc";;
4550 esac
4551 rp="Use which C compiler?"
4552 . ./myread
4553 cc="$ans"
4554
4555 : See whether they have no cc but they do have gcc
4556 . ./trygcc
4557 if $test -f cc.cbu; then
4558     . ./cc.cbu
4559 fi
4560 . ./checkcc
4561
4562 : make some quick guesses about what we are up against
4563 echo " "
4564 $echo $n "Hmm...  $c"
4565 echo exit 1 >bsd
4566 echo exit 1 >usg
4567 echo exit 1 >v7
4568 echo exit 1 >osf1
4569 echo exit 1 >eunice
4570 echo exit 1 >xenix
4571 echo exit 1 >venix
4572 echo exit 1 >os2
4573 d_bsd="$undef"
4574 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4575 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4576 then
4577         echo "Looks kind of like an OSF/1 system, but we'll see..."
4578         echo exit 0 >osf1
4579 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4580         xxx=`./loc addbib blurfl $pth`
4581         if $test -f $xxx; then
4582         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4583                 echo exit 0 >bsd
4584                 echo exit 0 >usg
4585         else
4586                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4587                         echo "Looks kind of like an extended USG system, but we'll see..."
4588                 else
4589                         echo "Looks kind of like a USG system, but we'll see..."
4590                 fi
4591                 echo exit 0 >usg
4592         fi
4593 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4594         echo "Looks kind of like a BSD system, but we'll see..."
4595         d_bsd="$define"
4596         echo exit 0 >bsd
4597 else
4598         echo "Looks kind of like a Version 7 system, but we'll see..."
4599         echo exit 0 >v7
4600 fi
4601 case "$eunicefix" in
4602 *unixtovms*)
4603         $cat <<'EOI'
4604 There is, however, a strange, musty smell in the air that reminds me of
4605 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4606 EOI
4607         echo exit 0 >eunice
4608         d_eunice="$define"
4609 : it so happens the Eunice I know will not run shell scripts in Unix format
4610         ;;
4611 *)
4612         echo " "
4613         echo "Congratulations.  You aren't running Eunice."
4614         d_eunice="$undef"
4615         ;;
4616 esac
4617 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4618 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4619 : semicolon as a patch separator
4620 case "$p_" in
4621 :) ;;
4622 *)
4623         $cat <<'EOI'
4624 I have the feeling something is not exactly right, however...don't tell me...
4625 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4626 (Or you may be running DOS with DJGPP.)
4627 EOI
4628         echo exit 0 >os2
4629         ;;
4630 esac
4631 if test -f /xenix; then
4632         echo "Actually, this looks more like a XENIX system..."
4633         echo exit 0 >xenix
4634         d_xenix="$define"
4635 else
4636         echo " "
4637         echo "It's not Xenix..."
4638         d_xenix="$undef"
4639 fi
4640 chmod +x xenix
4641 $eunicefix xenix
4642 if test -f /venix; then
4643         echo "Actually, this looks more like a VENIX system..."
4644         echo exit 0 >venix
4645 else
4646         echo " "
4647         if ./xenix; then
4648                 : null
4649         else
4650                 echo "Nor is it Venix..."
4651         fi
4652 fi
4653 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4654 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4655 $rm -f foo
4656
4657 : Check if we are using GNU gcc and what its version is
4658 echo " "
4659 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4660 $cat >try.c <<EOM
4661 #include <stdio.h>
4662 int main() {
4663 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4664 #ifdef __VERSION__
4665         printf("%s\n", __VERSION__);
4666 #else
4667         printf("%s\n", "1");
4668 #endif
4669 #endif
4670         return(0);
4671 }
4672 EOM
4673 if $cc -o try $ccflags $ldflags try.c; then
4674         gccversion=`$run ./try`
4675         case "$gccversion" in
4676         '') echo "You are not using GNU cc." ;;
4677         *)  echo "You are using GNU cc $gccversion."
4678             ccname=gcc
4679             ;;
4680         esac
4681 else
4682         echo " "
4683         echo "*** WHOA THERE!!! ***" >&4
4684         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4685         case "$knowitall" in
4686         '')
4687         echo "    You'd better start hunting for one and let me know about it." >&4
4688                 exit 1
4689                 ;;
4690         esac
4691 fi
4692 $rm -f try try.*
4693 case "$gccversion" in
4694 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4695 esac
4696 case "$gccversion" in
4697 '') gccosandvers='' ;;
4698 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4699    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4700    gccshortvers=''
4701    case "$gccosandvers" in
4702    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4703    $osname$osvers) ;; # looking good
4704    $osname*) cat <<EOM >&4
4705
4706 *** WHOA THERE!!! ***
4707
4708     Your gcc has not been compiled for the exact release of
4709     your operating system ($gccosandvers versus $osname$osvers).
4710
4711     In general it is a good idea to keep gcc synchronized with
4712     the operating system because otherwise serious problems
4713     may ensue when trying to compile software, like Perl.
4714
4715     I'm trying to be optimistic here, though, and will continue.
4716     If later during the configuration and build icky compilation
4717     problems appear (headerfile conflicts being the most common
4718     manifestation), I suggest reinstalling the gcc to match
4719     your operating system release.
4720
4721 EOM
4722       ;;
4723    *) gccosandvers='' ;; # failed to parse, better be silent
4724    esac
4725    ;;
4726 esac
4727 case "$ccname" in
4728 '') ccname="$cc" ;;
4729 esac
4730
4731 # gcc 3.* complain about adding -Idirectories that they already know about,
4732 # so we will take those off from locincpth.
4733 case "$gccversion" in
4734 3*)
4735     echo "main(){}">try.c
4736     for incdir in $locincpth; do
4737        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4738              grep '^c[cp]p*[01]: warning: changing search order '`
4739        if test "X$warn" != X; then
4740            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4741        fi
4742     done
4743     $rm -f try try.*
4744 esac
4745
4746 # gcc 4.9 by default does some optimizations that break perl.
4747 # see ticket 121505.
4748 #
4749 # The -fwrapv disables those optimizations (and probably others,) so
4750 # for gcc 4.9 (and later, since the optimizations probably won't go
4751 # away), add -fwrapv unless the user requests -fno-wrapv, which
4752 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4753 # which turns the overflows -fwrapv ignores into runtime errors.
4754 case "$gccversion" in
4755 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4756     case "$ccflags" in
4757     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4758     *) ccflags="$ccflags -fwrapv" ;;
4759     esac
4760 esac
4761
4762 : What should the include directory be ?
4763 : Use sysroot if set, so findhdr looks in the right place.
4764 echo " "
4765 $echo $n "Hmm...  $c"
4766 dflt="$sysroot/usr/include"
4767 incpath=''
4768 mips_type=''
4769 if $test -f /bin/mips && /bin/mips; then
4770         echo "Looks like a MIPS system..."
4771         $cat >usr.c <<'EOCP'
4772 #ifdef SYSTYPE_BSD43
4773 /bsd43
4774 #endif
4775 EOCP
4776         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4777                 dflt='/bsd43/usr/include'
4778                 incpath='/bsd43'
4779                 mips_type='BSD 4.3'
4780         else
4781                 mips_type='System V'
4782         fi
4783         $rm -f usr.c usr.out
4784         echo "and you're compiling with the $mips_type compiler and libraries."
4785         xxx_prompt=y
4786         echo "exit 0" >mips
4787 else
4788         echo "Doesn't look like a MIPS system."
4789         xxx_prompt=n
4790         echo "exit 1" >mips
4791 fi
4792 chmod +x mips
4793 $eunicefix mips
4794 case "$usrinc" in
4795 '') ;;
4796 *) dflt="$usrinc";;
4797 esac
4798 case "$xxx_prompt" in
4799 y)      fn=d/
4800         echo " "
4801         rp='Where are the include files you want to use?'
4802         . ./getfile
4803         usrinc="$ans"
4804         ;;
4805 *)      usrinc="$dflt"
4806         ;;
4807 esac
4808
4809 : see how we invoke the C preprocessor
4810 echo " "
4811 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4812 cat <<'EOT' >testcpp.c
4813 #define ABC abc
4814 #define XYZ xyz
4815 ABC.XYZ
4816 EOT
4817 cd ..
4818 if test ! -f cppstdin; then
4819         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4820                 # AIX cc -E doesn't show the absolute headerfile
4821                 # locations but we'll cheat by using the -M flag.
4822                 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
4823         else
4824                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4825         fi
4826 else
4827         echo "Keeping your $hint cppstdin wrapper."
4828 fi
4829 chmod 755 cppstdin
4830 wrapper=`pwd`/cppstdin
4831 ok='false'
4832 cd UU
4833
4834 if $test "X$cppstdin" != "X" && \
4835         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4836         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4837 then
4838         echo "You used to use $cppstdin $cppminus so we'll use that again."
4839         case "$cpprun" in
4840         '') echo "But let's see if we can live without a wrapper..." ;;
4841         *)
4842                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4843                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4844                 then
4845                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4846                         ok='true'
4847                 else
4848                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4849                 fi
4850                 ;;
4851         esac
4852 else
4853         case "$cppstdin" in
4854         '') ;;
4855         *)
4856                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4857                 ;;
4858         esac
4859 fi
4860
4861 if $ok; then
4862         : nothing
4863 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4864         $cc -E <testcpp.c >testcpp.out 2>&1; \
4865         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4866         echo "Yup, it does."
4867         x_cpp="$cc $cppflags -E"
4868         x_minus='';
4869 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4870         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4871         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4872         echo "Yup, it does."
4873         x_cpp="$cc $cppflags -E"
4874         x_minus='-';
4875 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4876         $cc -P <testcpp.c >testcpp.out 2>&1; \
4877         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4878         echo "Yipee, that works!"
4879         x_cpp="$cc $cppflags -P"
4880         x_minus='';
4881 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4882         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4883         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4884         echo "At long last!"
4885         x_cpp="$cc $cppflags -P"
4886         x_minus='-';
4887 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4888         $cpp <testcpp.c >testcpp.out 2>&1; \
4889         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4890         echo "It works!"
4891         x_cpp="$cpp $cppflags"
4892         x_minus='';
4893 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4894         $cpp - <testcpp.c >testcpp.out 2>&1; \
4895         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4896         echo "Hooray, it works!  I was beginning to wonder."
4897         x_cpp="$cpp $cppflags"
4898         x_minus='-';
4899 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4900         $wrapper <testcpp.c >testcpp.out 2>&1; \
4901         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4902         x_cpp="$wrapper"
4903         x_minus=''
4904         echo "Eureka!"
4905 else
4906         dflt=''
4907         rp="No dice.  I can't find a C preprocessor.  Name one:"
4908         . ./myread
4909         x_cpp="$ans"
4910         x_minus=''
4911         $x_cpp <testcpp.c >testcpp.out 2>&1
4912         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4913                 echo "OK, that will do." >&4
4914         else
4915 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4916                 exit 1
4917         fi
4918 fi
4919
4920 case "$ok" in
4921 false)
4922         cppstdin="$x_cpp"
4923         cppminus="$x_minus"
4924         cpprun="$x_cpp"
4925         cpplast="$x_minus"
4926         set X $x_cpp
4927         shift
4928         case "$1" in
4929         "$cpp")
4930                 echo "Perhaps can we force $cc -E using a wrapper..."
4931                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4932                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4933                 then
4934                         echo "Yup, we can."
4935                         cppstdin="$wrapper"
4936                         cppminus='';
4937                 else
4938                         echo "Nope, we'll have to live without it..."
4939                 fi
4940                 ;;
4941         esac
4942         case "$cpprun" in
4943         "$wrapper")
4944                 cpprun=''
4945                 cpplast=''
4946                 ;;
4947         esac
4948         ;;
4949 esac
4950
4951 case "$cppstdin" in
4952 "$wrapper"|'cppstdin') ;;
4953 *) $rm -f $wrapper;;
4954 esac
4955 $rm -f testcpp.c testcpp.out
4956
4957 : Adjust cppfilter for path component separator
4958 case "$osname" in
4959 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4960 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4961 *)   cppfilter='' ;;
4962 esac
4963
4964 : Use gcc to determine libpth and incpth
4965 # If using gcc or clang, we can get better values for libpth, incpth
4966 # and usrinc directly from the compiler.
4967 # Note that ccname for clang is also gcc.
4968 case "$ccname" in
4969     gcc)
4970         $echo 'extern int foo;' > try.c
4971         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4972         shift
4973         if $test $# -gt 0; then
4974             incpth="$incpth $*"
4975             incpth="`$echo $incpth|$sed 's/^ //'`"
4976             for i in $*; do
4977                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4978                 if $test -d $j; then
4979                     libpth="$libpth $j"
4980                 fi
4981             done
4982             libpth="`$echo $libpth|$sed 's/^ //'`"
4983             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4984                 if $test -d $xxx; then
4985                     case " $libpth " in
4986                     *" $xxx "*) ;;
4987                     *) libpth="$libpth $xxx";;
4988                     esac
4989                 fi
4990             done
4991         fi
4992         $rm -f try.c
4993         case "$usrinc" in
4994         '') for i in $incpth; do
4995                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4996                     usrinc="$i"
4997                     break
4998                 fi
4999             done
5000             ;;
5001         esac
5002
5003         case "$usecrosscompile" in
5004         $define|true|[yY]*)
5005             case "$incpth" in
5006                 '') echo "Incpth not defined." >&4; croak=y ;;
5007                 *)  echo "Using incpth '$incpth'." >&4 ;;
5008             esac
5009             case "$libpth" in
5010                 '') echo "Libpth not defined." >&4; croak=y ;;
5011                 *)  echo "Using libpth '$libpth'." >&4 ;;
5012             esac
5013             case "$usrinc" in
5014                 '') echo "Usrinc not defined." >&4; croak=y ;;
5015                 *)  echo "Using usrinc $usrinc." >&4 ;;
5016             esac
5017             case "$croak" in
5018                 y)
5019                 if test "X$sysroot" = X; then
5020                     echo "Cannot continue, aborting." >&4; exit 1
5021                 else
5022                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5023                 fi
5024                 ;;
5025             esac
5026             ;;
5027         esac
5028     ;;
5029 esac
5030
5031 : Default value for incpth is just usrinc
5032 case "$incpth" in
5033 '') incpth="$usrinc";;
5034 esac
5035
5036 : Set private lib path
5037 case "$plibpth" in
5038 '') if ./mips; then
5039         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5040     fi;;
5041 esac
5042 case "$libpth" in
5043 ' ') dlist='';;
5044 '') dlist="$loclibpth $plibpth $glibpth";;
5045 *) dlist="$libpth";;
5046 esac
5047
5048 : Now check and see which directories actually exist, avoiding duplicates
5049 for xxx in $dlist
5050 do
5051     if $test -d $xxx; then
5052                 case " $libpth " in
5053                 *" $xxx "*) ;;
5054                 *) libpth="$libpth $xxx";;
5055                 esac
5056     fi
5057 done
5058 $cat <<'EOM'
5059
5060 Some systems have incompatible or broken versions of libraries.  Among
5061 the directories listed in the question below, please remove any you
5062 know not to be holding relevant libraries, and add any that are needed.
5063 Say "none" for none.
5064
5065 EOM
5066
5067 if test "X$sysroot" != X; then
5068     $cat <<EOM
5069 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5070
5071 EOM
5072 fi
5073
5074 case "$libpth" in
5075 '') dflt='none';;
5076 *)
5077         set X $libpth
5078         shift
5079         dflt=${1+"$@"}
5080         ;;
5081 esac
5082 rp="Directories to use for library searches?"
5083 . ./myread
5084 case "$ans" in
5085 none) libpth=' ';;
5086 *) libpth="$ans";;
5087 esac
5088
5089 : compute shared library extension
5090 case "$so" in
5091 '')
5092         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5093                 dflt='sl'
5094         else
5095                 dflt='so'
5096         fi
5097         ;;
5098 *) dflt="$so";;
5099 esac
5100 $cat <<EOM
5101
5102 On some systems, shared libraries may be available.  Answer 'none' if
5103 you want to suppress searching of shared libraries for the remainder
5104 of this configuration.
5105
5106 EOM
5107 rp='What is the file extension used for shared libraries?'
5108 . ./myread
5109 so="$ans"
5110
5111 : Does target system insist that shared library basenames are unique
5112 $cat << EOM
5113
5114 Some dynamic loaders assume that the *basename* of shared library filenames
5115 are globally unique.  We'll default this to undef as we assume your system
5116 is not this weird. Set to defined if you're on one of them.
5117
5118 EOM
5119
5120 dflt='n'
5121 rp='Make shared library basenames unique?'
5122 . ./myread
5123 case "$ans" in
5124 y|Y) val="$define" ;;
5125 *)   val="$undef"  ;;
5126 esac
5127 set d_libname_unique
5128 eval $setvar
5129
5130 : Define several unixisms.
5131 : Hints files or command line option can be used to override them.
5132 : The convoluted testing is in case hints files set either the old
5133 : or the new name.
5134 case "$_exe" in
5135 '')     case "$exe_ext" in
5136         '')     ;;
5137         *)      _exe="$exe_ext" ;;
5138         esac
5139         ;;
5140 esac
5141 case "$_a" in
5142 '')     case "$lib_ext" in
5143     '') _a='.a';;
5144         *)      _a="$lib_ext" ;;
5145         esac
5146         ;;
5147 esac
5148 case "$_o" in
5149 '') case "$obj_ext" in
5150         '')     _o='.o';;
5151         *)      _o="$obj_ext";;
5152         esac
5153         ;;
5154 esac
5155 case "$p_" in
5156 '') case "$path_sep" in
5157         '')     p_=':';;
5158         *)      p_="$path_sep";;
5159         esac
5160         ;;
5161 esac
5162 exe_ext=$_exe
5163 lib_ext=$_a
5164 obj_ext=$_o
5165 path_sep=$p_
5166
5167 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5168
5169 : Which makefile gets called first.  This is used by make depend.
5170 case "$firstmakefile" in
5171 '') firstmakefile='makefile';;
5172 esac
5173
5174 : Check is we will use socks
5175 case "$usesocks" in
5176 $define|true|[yY]*)     dflt='y';;
5177 *) dflt='n';;
5178 esac
5179 cat <<EOM
5180
5181 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5182 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5183 to use the PerlIO abstraction layer, this will be implicitly selected.
5184
5185 If this doesn't make any sense to you, just accept the default '$dflt'.
5186 EOM
5187 rp='Build Perl for SOCKS?'
5188 . ./myread
5189 case "$ans" in
5190 y|Y)    val="$define" ;;
5191 *)      val="$undef" ;;
5192 esac
5193 set usesocks
5194 eval $setvar
5195
5196 : Check for uselongdouble support
5197 case "$ccflags" in
5198 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5199 esac
5200
5201 case "$uselongdouble" in
5202 $define|true|[yY]*)     dflt='y';;
5203 *) dflt='n';;
5204 esac
5205 cat <<EOM
5206
5207 Perl can be built to take advantage of long doubles which
5208 (if available) may give more accuracy and range for floating point numbers.
5209
5210 If this doesn't make any sense to you, just accept the default '$dflt'.
5211 EOM
5212 rp='Try to use long doubles if available?'
5213 . ./myread
5214 case "$ans" in
5215 y|Y)    val="$define"   ;;
5216 *)      val="$undef"    ;;
5217 esac
5218 set uselongdouble
5219 eval $setvar
5220
5221 case "$uselongdouble" in
5222 true|[yY]*) uselongdouble="$define" ;;
5223 esac
5224
5225 : Look for a hint-file generated 'call-back-unit'.  If the
5226 : user has specified that long doubles should be used,
5227 : we may need to set or change some other defaults.
5228 if $test -f uselongdouble.cbu; then
5229     echo "Your platform has some specific hints regarding long doubles, using them..."
5230     . ./uselongdouble.cbu
5231 else
5232     case "$uselongdouble" in
5233         $define)
5234                 $cat <<EOM
5235 (Your platform does not have any specific hints for long doubles.)
5236 EOM
5237         ;;
5238     esac
5239 fi
5240
5241 : Check if quadmath is requested
5242 case "$usequadmath" in
5243 "$define"|true|[yY]*) usequadmath="$define" ;;
5244 *)                    usequadmath="$undef"  ;;
5245 esac
5246
5247 : Fail if both uselongdouble and usequadmath are requested
5248 case "$usequadmath:$uselongdouble" in
5249 define:define)
5250         $cat <<EOM >&4
5251
5252 *** You requested the use of the quadmath library and use
5253 *** of long doubles.
5254 ***
5255 *** Please select one or the other.
5256 EOM
5257         exit 1
5258         ;;
5259 esac
5260
5261 : Looking for optional libraries
5262 echo " "
5263 echo "Checking for optional libraries..." >&4
5264 case "$libs" in
5265 ' '|'') dflt='';;
5266 *) dflt="$libs";;
5267 esac
5268 case "$libswanted" in
5269 '') libswanted='c_s';;
5270 esac
5271 case "$usesocks" in
5272 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5273 esac
5274 case "$usecbacktrace" in
5275 "$define") libswanted="$libswanted bfd" ;;
5276 esac
5277 case "$usequadmath" in
5278 "$define") libswanted="$libswanted quadmath" ;;
5279 esac
5280 libsfound=''
5281 libsfiles=''
5282 libsdirs=''
5283 libspath=''
5284 for thisdir in $libpth $xlibpth; do
5285   test -d $thisdir && libspath="$libspath $thisdir"
5286 done
5287 for thislib in $libswanted; do
5288         for thisdir in $libspath; do
5289             xxx=''
5290             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5291                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5292                 $test -f "$xxx" && eval $libscheck
5293                 $test -f "$xxx" && libstyle=shared
5294                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5295                 $test -f "$xxx" && eval $libscheck
5296                 $test -f "$xxx" && libstyle=shared
5297             fi
5298             if test ! -f "$xxx"; then
5299                 xxx=$thisdir/lib$thislib.$so
5300                 $test -f "$xxx" && eval $libscheck
5301                 $test -f "$xxx" && libstyle=shared
5302             fi
5303             if test ! -f "$xxx"; then
5304                 xxx=$thisdir/lib$thislib$_a
5305                 $test -f "$xxx" && eval $libscheck
5306                 $test -f "$xxx" && libstyle=static
5307             fi
5308             if test ! -f "$xxx"; then
5309                 xxx=$thisdir/$thislib$_a
5310                 $test -f "$xxx" && eval $libscheck
5311                 $test -f "$xxx" && libstyle=static
5312             fi
5313             if test ! -f "$xxx"; then
5314                 xxx=$thisdir/lib${thislib}_s$_a
5315                 $test -f "$xxx" && eval $libscheck
5316                 $test -f "$xxx" && libstyle=static
5317                 $test -f "$xxx" && thislib=${thislib}_s
5318             fi
5319             if test ! -f "$xxx"; then
5320                 xxx=$thisdir/Slib$thislib$_a
5321                 $test -f "$xxx" && eval $libscheck
5322                 $test -f "$xxx" && libstyle=static
5323             fi
5324             if $test -f "$xxx"; then
5325                 case "$libstyle" in
5326                 shared) echo "Found -l$thislib (shared)." ;;
5327                 static) echo "Found -l$thislib." ;;
5328                 *)      echo "Found -l$thislib ($libstyle)." ;;
5329                 esac
5330                 case " $dflt " in
5331                 *"-l$thislib "*);;
5332                 *) dflt="$dflt -l$thislib"
5333                    libsfound="$libsfound $xxx"
5334                    yyy=`basename $xxx`
5335                    libsfiles="$libsfiles $yyy"
5336                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5337                    case " $libsdirs " in
5338                    *" $yyy "*) ;;
5339                    *) libsdirs="$libsdirs $yyy" ;;
5340                    esac
5341                    ;;
5342                 esac
5343                 break
5344             fi
5345         done
5346         if $test ! -f "$xxx"; then
5347             echo "No -l$thislib."
5348         fi
5349 done
5350 set X $dflt
5351 shift
5352 dflt="$*"
5353 case "$libs" in
5354 '') dflt="$dflt";;
5355 *) dflt="$libs";;
5356 esac
5357 case "$dflt" in
5358 ' '|'') dflt='none';;
5359 esac
5360
5361 $cat <<EOM
5362
5363 In order to compile $package on your machine, a number of libraries
5364 are usually needed.  Include any other special libraries here as well.
5365 Say "none" for none.  The default list is almost always right.
5366 EOM
5367
5368 echo " "
5369 rp="What libraries to use?"
5370 . ./myread
5371 case "$ans" in
5372 none) libs=' ';;
5373 *) libs="$ans";;
5374 esac
5375
5376 : determine optimization, if desired, or use for debug flag also
5377 case "$optimize" in
5378 ' '|$undef) dflt='none';;
5379 '') dflt='-O';;
5380 *) dflt="$optimize";;
5381 esac
5382 $cat <<EOH
5383
5384 By default, $package compiles with the -O flag to use the optimizer.
5385 Alternately, you might want to use the symbolic debugger, which uses
5386 the -g flag (on traditional Unix systems).  Either flag can be
5387 specified here.  To use neither flag, specify the word "none".
5388
5389 EOH
5390 rp="What optimizer/debugger flag should be used?"
5391 . ./myread
5392 optimize="$ans"
5393 case "$optimize" in
5394 'none') optimize=" ";;
5395 esac
5396
5397 : Check what DEBUGGING is required from the command line
5398 : -DEBUGGING      or -DDEBUGGING or
5399 : -DEBUGGING=both                       = -g + -DDEBUGGING
5400 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5401 : -DEBUGGING=none or -UDEBUGGING        =
5402 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5403 case "$EBUGGING" in
5404 '')     ;;
5405 *)      DEBUGGING=$EBUGGING ;;
5406 esac
5407
5408 case "$DEBUGGING" in
5409 -g|both|$define)
5410     case "$optimize" in
5411         *-g*) ;;
5412         *)    optimize="$optimize -g" ;;
5413     esac ;;
5414 none|$undef)
5415     case "$optimize" in
5416         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5417                 shift
5418                 optimize="$*"
5419                 ;;
5420     esac ;;
5421 esac
5422
5423 dflt=''
5424 case "$DEBUGGING" in
5425 both|$define) dflt='-DDEBUGGING'
5426 esac
5427
5428 : argument order is deliberate, as the flag will start with - which set could
5429 : think is an option
5430 checkccflag='check=$1; flag=$2; callback=$3;
5431 echo " ";
5432 echo "Checking if your compiler accepts $flag" 2>&1;
5433 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5434 echo "int main(void) { return 0; }" > gcctest.c;
5435 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5436     echo "Yes, it does." 2>&1;
5437     if $test -s gcctest.out ; then
5438         echo "But your platform does not like it:";
5439         cat gcctest.out;
5440     else
5441         case "$ccflags" in
5442         *$check*)
5443             echo "Leaving current flags $ccflags alone." 2>&1
5444             ;;
5445         *) dflt="$dflt $flag";
5446             eval $callback
5447             ;;
5448         esac
5449     fi
5450 else
5451     echo "Nope, it does not, but that is ok." 2>&1;
5452 fi
5453 '
5454
5455 : We will not override a previous value, but we might want to
5456 : augment a hint file
5457 case "$hint" in
5458 default|recommended)
5459         case "$gccversion" in
5460         1*) dflt="$dflt -fpcc-struct-return" ;;
5461         esac
5462         case "$optimize:$DEBUGGING" in
5463         *-g*:old) dflt="$dflt -DDEBUGGING";;
5464         esac
5465         case "$gccversion" in
5466         2*) if $test -d /etc/conf/kconfig.d &&
5467                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5468                 then
5469                         # Interactive Systems (ISC) POSIX mode.
5470                         dflt="$dflt -posix"
5471                 fi
5472                 ;;
5473         esac
5474         case "$gccversion" in
5475         1*) ;;
5476         2.[0-8]*) ;;
5477         ?*)     set strict-aliasing -fno-strict-aliasing
5478                 eval $checkccflag
5479                 ;;
5480         esac
5481         # For gcc, adding -pipe speeds up compilations for some, but apparently
5482         # some assemblers can't read from stdin.  (It also slows down compilations
5483         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5484         case "$gccversion" in
5485         ?*)     set pipe -pipe
5486                 eval $checkccflag
5487                 ;;
5488         esac
5489
5490         # on x86_64 (at least) we require an extra library (libssp) in the
5491         # link command line. This library is not named, so I infer that it is
5492         # an implementation detail that may change. Hence the safest approach
5493         # is to add the flag to the flags passed to the compiler at link time,
5494         # as that way the compiler can do the right implementation dependant
5495         # thing. (NWC)
5496         case "$osname" in
5497         amigaos) ;; # -fstack-protector builds but doesn't work
5498         *)      case "$gccversion" in
5499                 ?*)     set stack-protector-strong -fstack-protector-strong
5500                         eval $checkccflag
5501                         case "$dflt" in
5502                         *-fstack-protector-strong*) ;; # It got added.
5503                         *) # Try the plain/older -fstack-protector.
5504                            set stack-protector -fstack-protector
5505                            eval $checkccflag
5506                            ;;
5507                         esac
5508                         ;;
5509                 esac
5510                 ;;
5511         esac
5512         ;;
5513 esac
5514
5515 case "$mips_type" in
5516 *BSD*|'') inclwanted="$locincpth $usrinc";;
5517 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5518 esac
5519 for thisincl in $inclwanted; do
5520         if $test -d $thisincl; then
5521                 if $test x$thisincl != x$usrinc; then
5522                         case "$dflt" in
5523                         *" -I$thisincl "*);;
5524                         *) dflt="$dflt -I$thisincl ";;
5525                         esac
5526                 fi
5527         fi
5528 done
5529
5530 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5531         xxx=true;
5532 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5533         xxx=true;
5534 else
5535         xxx=false;
5536 fi;
5537 if $xxx; then
5538         case "$dflt" in
5539         *$2*);;
5540         *) dflt="$dflt -D$2";;
5541         esac;
5542 fi'
5543
5544 set signal.h LANGUAGE_C; eval $inctest
5545
5546 case "$usesocks" in
5547 $define)
5548         ccflags="$ccflags -DSOCKS"
5549         ;;
5550 esac
5551
5552 case "$hint" in
5553 default|recommended) dflt="$ccflags $dflt" ;;
5554 *) dflt="$ccflags";;
5555 esac
5556
5557 case "$dflt" in
5558 ''|' ') dflt=none;;
5559 esac
5560
5561 $cat <<EOH
5562
5563 Your C compiler may want other flags.  For this question you should include
5564 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5565 but you should NOT include libraries or ld flags like -lwhatever.  If you
5566 want $package to honor its debug switch, you should include -DDEBUGGING here.
5567 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5568
5569 To use no flags, specify the word "none".
5570
5571 EOH
5572 set X $dflt
5573 shift
5574 dflt=${1+"$@"}
5575 rp="Any additional cc flags?"
5576 . ./myread
5577 case "$ans" in
5578 none) ccflags='';;
5579 *) ccflags="$ans";;
5580 esac
5581
5582 : the following weeds options from ccflags that are of no interest to cpp
5583 case "$cppflags" in
5584 '') cppflags="$ccflags" ;;
5585 *)  set X $ccflags; shift
5586     case " $cppflags " in
5587     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5588     *) cppflags="$cppflags $ccflags" ;;
5589     esac
5590     ;;
5591 esac
5592 case "$gccversion" in
5593 1*) cppflags="$cppflags -D__GNUC__"
5594 esac
5595 case "$mips_type" in
5596 '');;
5597 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5598 esac
5599 case "$cppflags" in
5600 '');;
5601 *)
5602         echo " "
5603         echo "Let me guess what the preprocessor flags are..." >&4
5604         set X $cppflags
5605         shift
5606         cppflags=''
5607         $cat >cpp.c <<'EOM'
5608 #define BLURFL foo
5609
5610 BLURFL xx LFRULB
5611 EOM
5612         previous=''
5613         for flag in $*
5614         do
5615                 case "$flag" in
5616                 -*) ftry="$flag";;
5617                 *) ftry="$previous $flag";;
5618                 esac
5619                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5620                         >cpp1.out 2>/dev/null && \
5621                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5622                         >cpp2.out 2>/dev/null && \
5623                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5624                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5625                 then
5626                         cppflags="$cppflags $ftry"
5627                         previous=''
5628                 else
5629                         previous="$flag"
5630                 fi
5631         done
5632         set X $cppflags
5633         shift
5634         cppflags=${1+"$@"}
5635         case "$cppflags" in
5636         *-*)  echo "They appear to be: $cppflags";;
5637         esac
5638         $rm -f cpp.c cpp?.out
5639         ;;
5640 esac
5641
5642 : flags used in final linking phase
5643 case "$ldflags" in
5644 '') if ./venix; then
5645                 dflt='-i -z'
5646         else
5647                 dflt=''
5648         fi
5649         case "$ccflags" in
5650         *-posix*) dflt="$dflt -posix" ;;
5651         esac
5652         ;;
5653 *) dflt="$ldflags";;
5654 esac
5655 # See note above about -fstack-protector
5656 case "$ccflags" in
5657 *-fstack-protector-strong*)
5658         case "$dflt" in
5659         *-fstack-protector-strong*) ;; # Don't add it again
5660         *) dflt="$dflt -fstack-protector-strong" ;;
5661         esac
5662         ;;
5663 *-fstack-protector*)
5664         case "$dflt" in
5665         *-fstack-protector*) ;; # Don't add it again
5666         *) dflt="$dflt -fstack-protector" ;;
5667         esac
5668         ;;
5669 esac
5670
5671 : Try to guess additional flags to pick up local libraries.
5672 for thislibdir in $libpth; do
5673         case " $loclibpth " in
5674         *" $thislibdir "*)
5675                 case "$dflt " in
5676                 *"-L$thislibdir "*) ;;
5677                 *)  dflt="$dflt -L$thislibdir" ;;
5678                 esac
5679                 ;;
5680         esac
5681 done
5682
5683 case "$dflt" in
5684 '') dflt='none' ;;
5685 esac
5686
5687 $cat <<EOH
5688
5689 Your C linker may need flags.  For this question you should
5690 include -L/whatever and any other flags used by the C linker, but you
5691 should NOT include libraries like -lwhatever.
5692
5693 Make sure you include the appropriate -L/path flags if your C linker
5694 does not normally search all of the directories you specified above,
5695 namely
5696         $libpth
5697 To use no flags, specify the word "none".
5698
5699 EOH
5700
5701 rp="Any additional ld flags (NOT including libraries)?"
5702 . ./myread
5703 case "$ans" in
5704 none) ldflags='';;
5705 *) ldflags="$ans";;
5706 esac
5707 rmlist="$rmlist pdp11"
5708
5709 : coherency check
5710 echo " "
5711 echo "Checking your choice of C compiler and flags for coherency..." >&4
5712 $cat > try.c <<'EOF'
5713 #include <stdio.h>
5714 int main() { printf("Ok\n"); return(0); }
5715 EOF
5716 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5717 shift
5718 $cat >try.msg <<'EOM'
5719 I've tried to compile and run the following simple program:
5720
5721 EOM
5722 $cat try.c >> try.msg
5723
5724 $cat >> try.msg <<EOM
5725
5726 I used the command:
5727
5728         $*
5729         $run ./try
5730
5731 and I got the following output:
5732
5733 EOM
5734 dflt=y
5735 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5736         if $sh -c "$run ./try " >>try.msg 2>&1; then
5737                 xxx=`$run ./try`
5738                 case "$xxx" in
5739                 "Ok") dflt=n ;;
5740                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5741                 esac
5742         else
5743                 echo "The program compiled OK, but exited with status $?." >>try.msg
5744                 rp="You have a problem.  Shall I abort Configure"
5745                 dflt=y
5746         fi
5747 else
5748         echo "I can't compile the test program." >>try.msg
5749         rp="You have a BIG problem.  Shall I abort Configure"
5750         dflt=y
5751 fi
5752 case "$dflt" in
5753 y)
5754         $cat try.msg >&4
5755         case "$knowitall" in
5756         '')
5757                 echo "(The supplied flags or libraries might be incorrect.)"
5758                 ;;
5759         *) dflt=n;;
5760         esac
5761         echo " "
5762         . ./myread
5763         case "$ans" in
5764         n*|N*) ;;
5765         *)      echo "Ok.  Stopping Configure." >&4
5766                 exit 1
5767                 ;;
5768         esac
5769         ;;
5770 n) echo "OK, that should do.";;
5771 esac
5772 $rm_try gcctest gcctest.out
5773
5774 : define a shorthand compile call
5775 compile='
5776 mc_file=$1;
5777 shift;
5778 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5779 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5780 exit 1;
5781 fi;
5782 esac;
5783 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5784 : define a shorthand compile call for compilations that should be ok.
5785 compile_ok='
5786 mc_file=$1;
5787 shift;
5788 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5789
5790 : stub, used only to satisfy other units
5791 i_stdlib='define'
5792
5793 : check for lengths of integral types
5794 echo " "
5795 case "$intsize" in
5796 '')
5797         echo "Checking to see how big your integers are..." >&4
5798         $cat >try.c <<EOCP
5799 #include <stdio.h>
5800 #$i_stdlib I_STDLIB
5801 #ifdef I_STDLIB
5802 #include <stdlib.h>
5803 #endif
5804 int main()
5805 {
5806         printf("intsize=%d;\n", (int)sizeof(int));
5807         printf("longsize=%d;\n", (int)sizeof(long));
5808         printf("shortsize=%d;\n", (int)sizeof(short));
5809         exit(0);
5810 }
5811 EOCP
5812         set try
5813         if eval $compile_ok && $run ./try > /dev/null; then
5814                 eval `$run ./try`
5815                 echo "Your integers are $intsize bytes long."
5816                 echo "Your long integers are $longsize bytes long."
5817                 echo "Your short integers are $shortsize bytes long."
5818         else
5819                 $cat >&4 <<EOM
5820 !
5821 Help! I can't compile and run the intsize test program: please enlighten me!
5822 (This is probably a misconfiguration in your system or libraries, and
5823 you really ought to fix it.  Still, I'll try anyway.)
5824 !
5825 EOM
5826                 dflt=4
5827                 rp="What is the size of an integer (in bytes)?"
5828                 . ./myread
5829                 intsize="$ans"
5830                 dflt=$intsize
5831                 rp="What is the size of a long integer (in bytes)?"
5832                 . ./myread
5833                 longsize="$ans"
5834                 dflt=2
5835                 rp="What is the size of a short integer (in bytes)?"
5836                 . ./myread
5837                 shortsize="$ans"
5838         fi
5839         ;;
5840 esac
5841 $rm_try
5842
5843 : check for long long
5844 echo " "
5845 echo "Checking to see if you have long long..." >&4
5846 echo 'int main() { long long x = 7; return 0; }' > try.c
5847 set try
5848 if eval $compile; then
5849         val="$define"
5850         echo "You have long long."
5851 else
5852         val="$undef"
5853         echo "You do not have long long."
5854 fi
5855 $rm_try
5856 set d_longlong
5857 eval $setvar
5858
5859 : check for length of long long
5860 case "${d_longlong}${longlongsize}" in
5861 $define)
5862         echo " "
5863         echo "Checking to see how big your long longs are..." >&4
5864         $cat >try.c <<'EOCP'
5865 #include <stdio.h>
5866 int main()
5867 {
5868     printf("%d\n", (int)sizeof(long long));
5869     return(0);
5870 }
5871 EOCP
5872         set try
5873         if eval $compile_ok; then
5874                 longlongsize=`$run ./try`
5875                 echo "Your long longs are $longlongsize bytes long."
5876         else
5877                 dflt='8'
5878                 echo " "
5879                 echo "(I can't seem to compile the test program.  Guessing...)"
5880                 rp="What is the size of a long long (in bytes)?"
5881                 . ./myread
5882                 longlongsize="$ans"
5883         fi
5884         if $test "X$longsize" = "X$longlongsize"; then
5885                 echo "(That isn't any different from an ordinary long.)"
5886         fi
5887         ;;
5888 esac
5889 $rm_try
5890
5891 : determine filename position in cpp output
5892 echo " "
5893 echo "Computing filename position in cpp output for #include directives..." >&4
5894 case "$osname" in
5895 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5896 esac
5897 case "$fieldn" in
5898 '')
5899 case "$osname" in
5900 vos) testaccess=-e ;;
5901 *)   testaccess=-r ;;
5902 esac
5903 echo '#include <stdio.h>' > foo.c
5904 $cat >fieldn <<EOF
5905 $startsh
5906 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5907 $grep '^[       ]*#.*stdio\.h' | \
5908 while read cline; do
5909         pos=1
5910         set \$cline
5911         while $test \$# -gt 0; do
5912                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5913                         echo "\$pos"
5914                         exit 0
5915                 fi
5916                 shift
5917                 pos=\`expr \$pos + 1\`
5918         done
5919 done
5920 EOF
5921 chmod +x fieldn
5922 fieldn=`./fieldn`
5923 $rm -f foo.c fieldn
5924 ;;
5925 esac
5926 case $fieldn in
5927 '') pos='???';;
5928 1) pos=first;;
5929 2) pos=second;;
5930 3) pos=third;;
5931 *) pos="${fieldn}th";;
5932 esac
5933 echo "Your cpp writes the filename in the $pos field of the line."
5934
5935 : locate header file
5936 $cat >findhdr <<EOF
5937 $startsh
5938 wanted=\$1
5939 name=''
5940 for usrincdir in $incpth
5941 do
5942         if test -f \$usrincdir/\$wanted; then
5943                 echo "\$usrincdir/\$wanted"
5944                 exit 0
5945         fi
5946 done
5947 awkprg='{ print \$$fieldn }'
5948 echo "#include <\$wanted>" > foo\$\$.c
5949 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5950 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5951 while read cline; do
5952         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5953         case "\$name" in
5954         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5955         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5956         *) exit 2;;
5957         esac;
5958 done;
5959 #
5960 # status = 0: grep returned 0 lines, case statement not executed
5961 # status = 1: headerfile found
5962 # status = 2: while loop executed, no headerfile found
5963 #
5964 status=\$?
5965 $rm -f foo\$\$.c;
5966 if test \$status -eq 1; then
5967         exit 0;
5968 fi
5969 exit 1
5970 EOF
5971 chmod +x findhdr
5972
5973 : define an alternate in-header-list? function
5974 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5975 cont=true; xxf="echo \"<\$1> found.\" >&4";
5976 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5977 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5978 esac;
5979 case $# in 4) instead=instead;; *) instead="at last";; esac;
5980 while $test "$cont"; do
5981         xxx=`./findhdr $1`
5982         var=$2; eval "was=\$$2";
5983         if $test "$xxx" && $test -r "$xxx";
5984         then eval $xxf;
5985         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5986                 cont="";
5987         else eval $xxnf;
5988         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5989         set $yyy; shift; shift; yyy=$@;
5990         case $# in 0) cont="";;
5991         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5992                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5993         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5994                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5995         esac;
5996 done;
5997 while $test "$yyy";
5998 do set $yyy; var=$2; eval "was=\$$2";
5999         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
6000         set $yyy; shift; shift; yyy=$@;
6001 done'
6002
6003 : see if inttypes.h is available
6004 : we want a real compile instead of Inhdr because some systems
6005 : have an inttypes.h which includes non-existent headers
6006 echo " "
6007 $cat >try.c <<EOCP
6008 #include <inttypes.h>
6009 int main() {
6010         static int32_t foo32 = 0x12345678;
6011 }
6012 EOCP
6013 set try
6014 if eval $compile; then
6015         echo "<inttypes.h> found." >&4
6016         val="$define"
6017 else
6018         echo "<inttypes.h> NOT found." >&4
6019         val="$undef"
6020 fi
6021 $rm_try
6022 set i_inttypes
6023 eval $setvar
6024
6025 : check for int64_t
6026 echo " "
6027 echo "Checking to see if you have int64_t..." >&4
6028 $cat >try.c <<EOCP
6029 #include <sys/types.h>
6030 #$i_inttypes I_INTTYPES
6031 #ifdef I_INTTYPES
6032 #include <inttypes.h>
6033 #endif
6034 int main() { int64_t x = 7; }
6035 EOCP
6036 set try
6037 if eval $compile; then
6038         val="$define"
6039         echo "You have int64_t."
6040 else
6041         val="$undef"
6042         echo "You do not have int64_t."
6043 fi
6044 $rm_try
6045 set d_int64_t
6046 eval $setvar
6047
6048 : Check if 64bit ints have a quad type
6049 echo " "
6050 echo "Checking which 64-bit integer type we could use..." >&4
6051
6052 case "$intsize" in
6053 8) val=int
6054    set quadtype
6055    eval $setvar
6056    val='"unsigned int"'
6057    set uquadtype
6058    eval $setvar
6059    quadkind=1
6060    ;;
6061 *) case "$longsize" in
6062    8) val=long
6063       set quadtype
6064       eval $setvar
6065       val='"unsigned long"'
6066       set uquadtype
6067       eval $setvar
6068       quadkind=2
6069       ;;
6070    *) case "$d_longlong:$longlongsize" in
6071       define:8)
6072         val='"long long"'
6073         set quadtype
6074         eval $setvar
6075         val='"unsigned long long"'
6076         set uquadtype
6077         eval $setvar
6078         quadkind=3
6079         ;;
6080       *) case "$d_int64_t" in
6081          define)
6082            val=int64_t
6083            set quadtype
6084            eval $setvar
6085            val=uint64_t
6086            set uquadtype
6087            eval $setvar
6088            quadkind=4
6089            ;;
6090          esac
6091          ;;
6092       esac
6093       ;;
6094    esac
6095    ;;
6096 esac
6097
6098 case "$quadtype" in
6099 '')     echo "Alas, no 64-bit integer types in sight." >&4
6100         d_quad="$undef"
6101         ;;
6102 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6103         d_quad="$define"
6104         ;;
6105 esac
6106
6107 : Do we want 64bit support
6108 case "$uselonglong" in
6109 "$define"|true|[yY]*)
6110         cat <<EOM >&4
6111
6112 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6113 EOM
6114         use64bitint="$define"
6115         ;;
6116 esac
6117 case "$use64bits" in
6118 "$define"|true|[yY]*)
6119         cat <<EOM >&4
6120
6121 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6122 EOM
6123         use64bitint="$define"
6124         ;;
6125 esac
6126 case "$use64bitints" in
6127 "$define"|true|[yY]*)
6128         cat <<EOM >&4
6129
6130 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6131 EOM
6132         use64bitint="$define"
6133         ;;
6134 esac
6135 case "$use64bitsint" in
6136 "$define"|true|[yY]*)
6137         cat <<EOM >&4
6138
6139 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6140 EOM
6141         use64bitint="$define"
6142         ;;
6143 esac
6144 case "$uselonglongs" in
6145 "$define"|true|[yY]*)
6146         cat <<EOM >&4
6147
6148 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6149 EOM
6150         use64bitint="$define"
6151         ;;
6152 esac
6153 case "$use64bitsall" in
6154 "$define"|true|[yY]*)
6155         cat <<EOM >&4
6156
6157 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6158 EOM
6159         use64bitall="$define"
6160         ;;
6161 esac
6162
6163 case "$ccflags" in
6164 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6165 esac
6166 case "$use64bitall" in
6167 "$define"|true|[yY]*) use64bitint="$define" ;;
6168 esac
6169
6170 case "$longsize" in
6171 8) cat <<EOM
6172
6173 You have natively 64-bit long integers.
6174 EOM
6175    val="$define"
6176    ;;
6177 *) case "$use64bitint" in
6178    "$define"|true|[yY]*) dflt='y';;
6179    *) dflt='n';;
6180    esac
6181    case "$d_quad" in
6182    "$define") ;;
6183    *) dflt='n' ;;
6184    esac
6185    cat <<EOM
6186
6187 Perl can be built to take advantage of 64-bit integer types
6188 on some systems.  To do so, Configure can be run with -Duse64bitint.
6189 Choosing this option will most probably introduce binary incompatibilities.
6190
6191 If this doesn't make any sense to you, just accept the default '$dflt'.
6192 (The default has been chosen based on your configuration.)
6193 EOM
6194    rp='Try to use 64-bit integers, if available?'
6195    . ./myread
6196    case "$ans" in
6197    [yY]*) val="$define" ;;
6198    *)     val="$undef"  ;;
6199    esac
6200    ;;
6201 esac
6202 set use64bitint
6203 eval $setvar
6204
6205 case "$use64bitall" in
6206 "$define"|true|[yY]*) dflt='y' ;;
6207 *) case "$longsize" in
6208    8) dflt='y' ;;
6209    *) dflt='n' ;;
6210    esac
6211    ;;
6212 esac
6213 cat <<EOM
6214
6215 You may also choose to try maximal 64-bitness.  It means using as much
6216 64-bitness as possible on the platform.  This in turn means even more
6217 binary incompatibilities.  On the other hand, your platform may not
6218 have any more 64-bitness available than what you already have chosen.
6219
6220 If this doesn't make any sense to you, just accept the default '$dflt'.
6221 (The default has been chosen based on your configuration.)
6222 EOM
6223 rp='Try to use maximal 64-bit support, if available?'
6224 . ./myread
6225 case "$ans" in
6226 [yY]*) val="$define" ;;
6227 *)     val="$undef"  ;;
6228 esac
6229 set use64bitall
6230 eval $setvar
6231 case "$use64bitall" in
6232 "$define")
6233         case "$use64bitint" in
6234         "$undef")
6235                 cat <<EOM
6236
6237 Since you have chosen a maximally 64-bit build, I'm also turning on
6238 the use of 64-bit integers.
6239 EOM
6240                 use64bitint="$define" ;;
6241         esac
6242         ;;
6243 esac
6244
6245 : Look for a hint-file generated 'call-back-unit'.  If the
6246 : user has specified that a 64-bit perl is to be built,
6247 : we may need to set or change some other defaults.
6248 if $test -f use64bitint.cbu; then
6249         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6250         . ./use64bitint.cbu
6251 fi
6252 case "$use64bitint" in
6253 "$define"|true|[yY]*)
6254         : This test was common to all the OpenBSD forks, and seems harmless for
6255         : other platforms:
6256         echo " "
6257         echo "Checking if your C library has broken 64-bit functions..." >&4
6258         cat >try.c <<EOCP
6259 #include <stdio.h>
6260 typedef $uquadtype myULL;
6261 int main (void)
6262 {
6263     struct {
6264         double d;
6265         myULL  u;
6266     } *p, test[] = {
6267         {4294967303.15, 4294967303ULL},
6268         {4294967294.2,  4294967294ULL},
6269         {4294967295.7,  4294967295ULL},
6270         {0.0, 0ULL}
6271     };
6272     for (p = test; p->u; p++) {
6273         myULL x = (myULL)p->d;
6274         if (x != p->u) {
6275             printf("buggy\n");
6276             return 0;
6277         }
6278     }
6279     printf("ok\n");
6280     return 0;
6281 }
6282 EOCP
6283         set try
6284         if eval $compile_ok; then
6285             libcquad=`$run ./try`
6286             echo "Your C library's 64-bit functions are $libcquad."
6287         else
6288             echo "(I can't seem to compile the test program.)"
6289             echo "Assuming that your C library's 64-bit functions are ok."
6290             libcquad="ok"
6291         fi
6292         $rm_try
6293
6294         case "$libcquad" in
6295             buggy*)
6296                 cat >&4 <<EOM
6297
6298 *** You have a C library with broken 64-bit functions.
6299 *** 64-bit support does not work reliably in this configuration.
6300 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6301 *** Cannot continue, aborting.
6302
6303 EOM
6304                 exit 1
6305                 ;;
6306         esac
6307         case "$longsize" in
6308         4) case "$archname64" in
6309            '') archname64=64int ;;
6310            esac
6311            ;;
6312         esac
6313         ;;
6314 esac
6315
6316 : Look for a hint-file generated 'call-back-unit'.  If the
6317 : user has specified that a maximally 64-bit perl is to be built,
6318 : we may need to set or change some other defaults.
6319 if $test -f use64bitall.cbu; then
6320         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6321         . ./use64bitall.cbu
6322 fi
6323 case "$use64bitall" in
6324 "$define"|true|[yY]*)
6325         case "$longsize" in
6326         4) case "$archname64" in
6327            ''|64int) archname64=64all ;;
6328            esac
6329            ;;
6330         esac
6331         ;;
6332 esac
6333
6334 case "$d_quad:$use64bitint" in
6335 $undef:$define)
6336         cat >&4 <<EOF
6337
6338 *** You have chosen to use 64-bit integers,
6339 *** but none can be found.
6340 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6341 *** Cannot continue, aborting.
6342
6343 EOF
6344         exit 1
6345         ;;
6346 esac
6347
6348 : Check if we are using the GNU C library
6349 echo " "
6350 echo "Checking for GNU C Library..." >&4
6351 cat >try.c <<'EOCP'
6352 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6353    alone are insufficient to distinguish different versions, such as
6354    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6355    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6356 */
6357 #include <stdio.h>
6358 int main(void)
6359 {
6360 #ifdef __GLIBC__
6361 #   ifdef __GLIBC_MINOR__
6362 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6363 #           include <gnu/libc-version.h>
6364             printf("%s\n",  gnu_get_libc_version());
6365 #       else
6366             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6367 #       endif
6368 #   else
6369         printf("%d\n",  __GLIBC__);
6370 #   endif
6371     return 0;
6372 #else
6373     return 1;
6374 #endif
6375 }
6376 EOCP
6377 set try
6378 if eval $compile_ok && $run ./try > glibc.ver; then
6379         val="$define"
6380         gnulibc_version=`$cat glibc.ver`
6381         echo "You are using the GNU C Library version $gnulibc_version"
6382 else
6383         val="$undef"
6384         gnulibc_version=''
6385         echo "You are not using the GNU C Library"
6386 fi
6387 $rm_try glibc.ver
6388 set d_gnulibc
6389 eval $setvar
6390
6391 : see if nm is to be used to determine whether a symbol is defined or not
6392 case "$usenm" in
6393 '')
6394         dflt=''
6395         case "$d_gnulibc" in
6396         "$define")
6397                 echo " "
6398                 echo "nm probably won't work on the GNU C Library." >&4
6399                 dflt=n
6400                 ;;
6401         esac
6402         case "$dflt" in
6403         '')
6404                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6405                         echo " "
6406                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6407                         echo "'nm' won't be sufficient on this system." >&4
6408                         dflt=n
6409                 fi
6410                 ;;
6411         esac
6412         case "$dflt" in
6413         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6414                 if $test $dflt -gt 20; then
6415                         dflt=y
6416                 else
6417                         dflt=n
6418                 fi
6419                 ;;
6420         esac
6421         ;;
6422 *)
6423         case "$usenm" in
6424         true|$define) dflt=y;;
6425         *) dflt=n;;
6426         esac
6427         ;;
6428 esac
6429 $cat <<EOM
6430
6431 I can use $nm to extract the symbols from your C libraries. This
6432 is a time consuming task which may generate huge output on the disk (up
6433 to 3 megabytes) but that should make the symbols extraction faster. The
6434 alternative is to skip the 'nm' extraction part and to compile a small
6435 test program instead to determine whether each symbol is present. If
6436 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6437 this may be the best solution.
6438
6439 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6440
6441 EOM
6442 rp="Shall I use $nm to extract C symbols from the libraries?"
6443 . ./myread
6444 case "$ans" in
6445 [Nn]*) usenm=false;;
6446 *) usenm=true;;
6447 esac
6448
6449 runnm=$usenm
6450 case "$reuseval" in
6451 true) runnm=false;;
6452 esac
6453
6454 : nm options which may be necessary
6455 case "$nm_opt" in
6456 '') if $test -f /mach_boot; then
6457                 nm_opt=''       # Mach
6458         elif $test -d /usr/ccs/lib; then
6459                 nm_opt='-p'     # Solaris (and SunOS?)
6460         elif $test -f /dgux; then
6461                 nm_opt='-p'     # DG-UX
6462         elif $test -f /lib64/rld; then
6463                 nm_opt='-p'     # 64-bit Irix
6464         else
6465                 nm_opt=''
6466         fi;;
6467 esac
6468
6469 : nm options which may be necessary for shared libraries but illegal
6470 : for archive libraries.  Thank you, Linux.
6471 case "$nm_so_opt" in
6472 '')     case "$myuname" in
6473         *linux*|gnu*)
6474                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6475                         nm_so_opt='--dynamic'
6476                 fi
6477                 ;;
6478         esac
6479         ;;
6480 esac
6481
6482 : Figure out where the libc is located
6483 case "$runnm" in
6484 true)
6485 : get list of predefined functions in a handy place
6486 echo " "
6487 case "$libc" in
6488 '') libc=unknown
6489         case "$libs" in
6490         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6491         esac
6492         ;;
6493 esac
6494 case "$libs" in
6495 '') ;;
6496 *)  for thislib in $libs; do
6497         case "$thislib" in
6498         -lc|-lc_s)
6499                 : Handle C library specially below.
6500                 ;;
6501         -l*)
6502                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6503                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6504                         :
6505                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6506                         :
6507                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6508                         :
6509                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6510                         :
6511                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6512                         :
6513                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6514                         :
6515                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6516                         :
6517                 else
6518                         try=''
6519                 fi
6520                 libnames="$libnames $try"
6521                 ;;
6522         *) libnames="$libnames $thislib" ;;
6523         esac
6524         done
6525         ;;
6526 esac
6527 xxx=normal
6528 case "$libc" in
6529 unknown)
6530         set /lib/libc.$so
6531         for xxx in $libpth; do
6532                 $test -r $1 || set $xxx/libc.$so
6533                 : The messy sed command sorts on library version numbers.
6534                 $test -r $1 || \
6535                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6536                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6537                                 h
6538                                 s/[0-9][0-9]*/0000&/g
6539                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6540                                 G
6541                                 s/\n/ /' | \
6542                          $sort | $sed -e 's/^.* //'`
6543                 eval set \$$#
6544         done
6545         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6546         $test -r $1 || set $sysroot/lib/libsys_s$_a
6547         ;;
6548 *)
6549         set blurfl
6550         ;;
6551 esac
6552 if $test -r "$1"; then
6553         echo "Your (shared) C library seems to be in $1."
6554         libc="$1"
6555 elif $test -r /lib/libc && $test -r /lib/clib; then
6556         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6557         xxx=apollo
6558         libc='/lib/clib /lib/libc'
6559         if $test -r /lib/syslib; then
6560                 echo "(Your math library is in /lib/syslib.)"
6561                 libc="$libc /lib/syslib"
6562         fi
6563 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6564         echo "Your C library seems to be in $libc, as you said before."
6565 elif $test -r $incpath/usr/lib/libc$_a; then
6566         libc=$incpath/usr/lib/libc$_a;
6567         echo "Your C library seems to be in $libc.  That's fine."
6568 elif $test -r /lib/libc$_a; then
6569         libc=/lib/libc$_a;
6570         echo "Your C library seems to be in $libc.  You're normal."
6571 else
6572         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6573                 :
6574         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6575                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6576         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6577                 :
6578         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6579                 :
6580         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6581                 :
6582         else
6583                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6584         fi
6585         if $test -r "$tans"; then
6586                 echo "Your C library seems to be in $tans, of all places."
6587                 libc=$tans
6588         else
6589                 libc='blurfl'
6590         fi
6591 fi
6592 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6593         dflt="$libc"
6594         cat <<EOM
6595
6596 If the guess above is wrong (which it might be if you're using a strange
6597 compiler, or your machine supports multiple models), you can override it here.
6598
6599 EOM
6600 else
6601         dflt=''
6602         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6603         cat >&4 <<EOM
6604 I can't seem to find your C library.  I've looked in the following places:
6605
6606 EOM
6607         $sed 's/^/      /' libpath
6608         cat <<EOM
6609
6610 None of these seems to contain your C library. I need to get its name...
6611
6612 EOM
6613 fi
6614 fn=f
6615 rp='Where is your C library?'
6616 . ./getfile
6617 libc="$ans"
6618
6619 echo " "
6620 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6621 set X `cat libnames`
6622 shift
6623 xxx=files
6624 case $# in 1) xxx=file; esac
6625 echo "Extracting names from the following $xxx for later perusal:" >&4
6626 echo " "
6627 $sed 's/^/      /' libnames >&4
6628 echo " "
6629 $echo $n "This may take a while...$c" >&4
6630
6631 for file in $*; do
6632         case $file in
6633         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6634         *) $nm $nm_opt $file 2>/dev/null;;
6635         esac
6636 done >libc.tmp
6637
6638 $echo $n ".$c"
6639 $grep fprintf libc.tmp > libc.ptf
6640 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6641 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6642 xxx='[ADTSIWi]'
6643 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6644         eval $xscan;\
6645         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6646                 eval $xrun
6647 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6648         eval $xscan;\
6649         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6650                 eval $xrun
6651 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6652         eval $xscan;\
6653         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6654                 eval $xrun
6655 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6656         eval $xscan;\
6657         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6658                 eval $xrun
6659 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6660         eval $xscan;\
6661         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6662                 eval $xrun
6663 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6664         eval $xscan;\
6665         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6666                 eval $xrun
6667 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6668                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6669         eval $xscan;\
6670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6671                 eval $xrun
6672 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6673         eval $xscan;\
6674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6675                 eval $xrun
6676 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6677         eval $xscan;\
6678         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6679                 eval $xrun
6680 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6681         eval $xscan;\
6682         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6683                 eval $xrun
6684 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6685         eval $xscan;\
6686         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6687                 eval $xrun
6688 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6689         eval $xscan;\
6690         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6691                 eval $xrun
6692 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6693         eval $xscan;\
6694         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6695                 eval $xrun
6696 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6697         eval $xscan;\
6698         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6699                 eval $xrun
6700 else
6701         $nm -p $* 2>/dev/null >libc.tmp
6702         $grep fprintf libc.tmp > libc.ptf
6703         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6704                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6705         then
6706                 nm_opt='-p'
6707                 eval $xrun
6708         else
6709                 echo " "
6710                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6711                 com=''
6712                 if $ar t $libc > libc.tmp && \
6713                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6714                 then
6715                         for thisname in $libnames $libc; do
6716                                 $ar t $thisname >>libc.tmp
6717                         done
6718                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6719                         echo "Ok." >&4
6720                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6721                         for thisname in $libnames $libc; do
6722                                 $ar tv $thisname >>libc.tmp
6723                                 emximp -o tmp.imp $thisname \
6724                                     2>/dev/null && \
6725                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6726                                     < tmp.imp >>libc.tmp
6727                                 $rm -f tmp.imp
6728                         done
6729                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6730                         echo "Ok." >&4
6731                 else
6732                         echo "$ar didn't seem to work right." >&4
6733                         echo "Maybe this is a Cray...trying bld instead..." >&4
6734                         if  bld t $libc | \
6735                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6736                                 $test -s libc.list
6737                         then
6738                                 for thisname in $libnames; do
6739                                         bld t $libnames | \
6740                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6741                                         $ar t $thisname >>libc.tmp
6742                                 done
6743                                 echo "Ok." >&4
6744                         else
6745                                 echo "That didn't work either.  Giving up." >&4
6746                                 exit 1
6747                         fi
6748                 fi
6749         fi
6750 fi
6751 nm_extract="$com"
6752 case "$PASE" in
6753 define)
6754     echo " "
6755     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6756     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6757     ;;
6758 *)  if $test -f /lib/syscalls.exp; then
6759         echo " "
6760         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6761         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6762                 /lib/syscalls.exp >>libc.list
6763     fi
6764     ;;
6765 esac
6766 ;;
6767 esac
6768 $rm -f libnames libpath
6769
6770 : Check if we are using C++
6771 echo " "
6772 echo "Checking for C++..." >&4
6773 $cat >try.c <<'EOCP'
6774 #include <stdio.h>
6775 int main(void)
6776 {
6777 #ifdef __cplusplus
6778     return 0;
6779 #else
6780     return 1;
6781 #endif
6782 }
6783 EOCP
6784 set try
6785 if eval $compile_ok && $run ./try; then
6786         val="$define"
6787         echo "You are using a C++ compiler."
6788 else
6789         val="$undef"
6790         echo "You are not using a C++ compiler."
6791 fi
6792 $rm_try cplusplus$$
6793 set d_cplusplus
6794 eval $setvar
6795
6796 : is a C symbol defined?
6797 csym='tlook=$1;
6798 case "$3" in
6799 -v) tf=libc.tmp; tdc="";;
6800 -a) tf=libc.tmp; tdc="[]";;
6801 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6802 esac;
6803 case "$d_cplusplus" in
6804     $define)    extern_C="extern \"C\"" ;;
6805     *)          extern_C="extern"       ;;
6806 esac;
6807 tx=yes;
6808 case "$reuseval-$4" in
6809 true-) ;;
6810 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6811 esac;
6812 case "$tx" in
6813 yes)
6814         tval=false;
6815         if $test "$runnm" = true; then
6816                 if $contains $tlook $tf >/dev/null 2>&1; then
6817                         tval=true;
6818                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6819                         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;
6820                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6821                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6822                         $rm_try;
6823                 fi;
6824         else
6825                 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;
6826                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6827                 $rm_try;
6828         fi;
6829         ;;
6830 *)
6831         case "$tval" in
6832         $define) tval=true;;
6833         *) tval=false;;
6834         esac;
6835         ;;
6836 esac;
6837 eval "$2=$tval"'
6838
6839 : define an is-in-libc? function
6840 inlibc='echo " "; td=$define; tu=$undef;
6841 sym=$1; var=$2; eval "was=\$$2";
6842 tx=yes;
6843 case "$reuseval$was" in
6844 true) ;;
6845 true*) tx=no;;
6846 esac;
6847 case "$tx" in
6848 yes)
6849         set $sym tres -f;
6850         eval $csym;
6851         case "$tres" in
6852         true)
6853                 echo "$sym() found." >&4;
6854                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6855         *)
6856                 echo "$sym() NOT found." >&4;
6857                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6858         esac;;
6859 *)
6860         case "$was" in
6861         $define) echo "$sym() found." >&4;;
6862         *) echo "$sym() NOT found." >&4;;
6863         esac;;
6864 esac'
6865
6866 : check for length of double
6867 echo " "
6868 case "$doublesize" in
6869 '')
6870         echo "Checking to see how big your double precision numbers are..." >&4
6871         $cat >try.c <<EOCP
6872 #include <stdio.h>
6873 #$i_stdlib I_STDLIB
6874 #ifdef I_STDLIB
6875 #include <stdlib.h>
6876 #endif
6877 int main()
6878 {
6879     printf("%d\n", (int)sizeof(double));
6880     exit(0);
6881 }
6882 EOCP
6883         set try
6884         if eval $compile_ok; then
6885                 doublesize=`$run ./try`
6886                 echo "Your double is $doublesize bytes long."
6887         else
6888                 dflt='8'
6889                 echo "(I can't seem to compile the test program.  Guessing...)"
6890                 rp="What is the size of a double precision number (in bytes)?"
6891                 . ./myread
6892                 doublesize="$ans"
6893         fi
6894         ;;
6895 esac
6896 $rm_try
6897
6898 : check for long doubles
6899 echo " "
6900 echo "Checking to see if you have long double..." >&4
6901 echo 'int main() { long double x = 7.0; }' > try.c
6902 set try
6903 if eval $compile; then
6904         val="$define"
6905         echo "You have long double."
6906 else
6907         val="$undef"
6908         echo "You do not have long double."
6909 fi
6910 $rm_try
6911 set d_longdbl
6912 eval $setvar
6913
6914 : see if ldexpl exists
6915 set ldexpl d_ldexpl
6916 eval $inlibc
6917
6918 : check for length of long double
6919 case "${d_longdbl}${longdblsize}" in
6920 $define)
6921         echo " "
6922         echo "Checking to see how big your long doubles are..." >&4
6923         $cat >try.c <<'EOCP'
6924 #include <stdio.h>
6925 int main()
6926 {
6927         printf("%d\n", sizeof(long double));
6928 }
6929 EOCP
6930         set try
6931         set try
6932         if eval $compile; then
6933                 longdblsize=`$run ./try`
6934                 echo "Your long doubles are $longdblsize bytes long."
6935         else
6936                 dflt='8'
6937                 echo " "
6938                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6939                 rp="What is the size of a long double (in bytes)?"
6940                 . ./myread
6941                 longdblsize="$ans"
6942         fi
6943         if $test "X$doublesize" = "X$longdblsize"; then
6944                 echo "That isn't any different from an ordinary double."
6945                 echo "I'll keep your setting anyway, but you may see some"
6946                 echo "harmless compilation warnings."
6947         fi
6948         ;;
6949 esac
6950 $rm_try
6951
6952 $echo "Checking the kind of long doubles you have..." >&4
6953 case "$d_longdbl" in
6954 define)
6955 $cat <<EOP >try.c
6956 #$i_stdlib I_STDLIB
6957 #define LONGDBLSIZE $longdblsize
6958 #define DOUBLESIZE $doublesize
6959 #include <float.h>
6960 #ifdef I_STDLIB
6961 #include <stdlib.h>
6962 #endif
6963 #include <stdio.h>
6964 static const long double d = -0.1L;
6965 int main() {
6966   unsigned const char* b = (unsigned const char*)(&d);
6967 #if DOUBLESIZE == LONGDBLSIZE
6968   printf("0\n"); /* if it floats like double */
6969   exit(0);
6970 #endif
6971 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6972   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6973     /* IEEE 754 128-bit little-endian */
6974     printf("1\n");
6975     exit(0);
6976   }
6977   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6978     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6979     printf("2\n");
6980     exit(0);
6981   }
6982 #endif
6983 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6984  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6985  * cannot be trusted. */
6986 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6987   if (b[0] == 0xCD && b[9] == 0xBF) {
6988     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6989      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6990      * Also known as "extended precision". */
6991     printf("3\n");
6992     exit(0);
6993   }
6994   if (b[0] == 0xBF && b[9] == 0xCD) {
6995     /* Is there ever big-endian 80-bit, really?
6996      *
6997      * The Motorola 68881 had another "extended precision" format:
6998      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6999      * for total of 96 bits of bytes.  The zero bits were unused.
7000      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7001      * If it ever becomes relevant, this format should be allocated
7002      * a new doublekind code since it's quite different from the Intel x87.
7003      */
7004     printf("4\n");
7005     exit(0);
7006   }
7007 #endif
7008 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7009   /* software "double double", the 106 is 53+53.
7010    * but irix thinks it is 107. */
7011   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7012     /* double double 128-bit fully little-endian,
7013      * little-endian doubles in little-endian order,
7014      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7015     printf("5\n");
7016     exit(0);
7017   }
7018   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7019     /* double double 128-bit fully big-endian,
7020      * big-endian doubles in big-endian order,
7021      * e.g. PPC/Power and MIPS:
7022      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7023     printf("6\n");
7024     exit(0);
7025   }
7026   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7027     /* double double 128-bit mixed endian.
7028      * little-endian doubles in big-endian order,
7029      * e.g. ppc64el,
7030      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7031     printf("7\n");
7032     exit(0);
7033   }
7034   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7035     /* double double 128-bit mixed endian,
7036      * big-endian doubles in little-endian order,
7037      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7038     printf("8\n");
7039     exit(0);
7040   }
7041 #endif
7042 /* We are largely making this up because it may well be
7043  * that the VAX format H was never made available to C,
7044  * only to Fortran. */
7045 #if LONGDBLSIZE == 16 && defined(__vax__)
7046   if (b[0] == 0xFD && b[15] == 0x99) {
7047     /* VAX format H, PDP-11 mixed endian. */
7048     printf("9\n");
7049     exit(0);
7050   }
7051 #endif
7052   printf("-1\n"); /* unknown */
7053   exit(0);
7054 }
7055 EOP
7056 set try
7057 if eval $compile; then
7058     longdblkind=`$run ./try`
7059 else
7060     longdblkind=-1
7061 fi
7062 ;;
7063 *) longdblkind=0 ;;
7064 esac
7065 case "$longdblkind" in
7066 0) echo "Your long doubles are doubles." >&4 ;;
7067 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7068 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7069 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7070 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7071 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7072 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7073 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7074 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7075 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7076 *) echo "Cannot figure out your long double." >&4 ;;
7077 esac
7078 d_long_double_style_ieee=$undef
7079 d_long_double_style_ieee_std=$undef
7080 d_long_double_style_ieee_extended=$undef
7081 d_long_double_style_ieee_doubledouble=$undef
7082 d_long_double_style_vax=$undef
7083 case "$longdblkind" in
7084 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7085 esac
7086 case "$longdblkind" in
7087 1|2) d_long_double_style_ieee_std=$define ;;
7088 esac
7089 case "$longdblkind" in
7090 3|4) d_long_double_style_ieee_extended=$define ;;
7091 esac
7092 case "$longdblkind" in
7093 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7094 esac
7095 case "$longdblkind" in
7096 9) d_long_double_style_vax=$define ;;
7097 esac
7098 $rm_try
7099
7100 : determine the architecture name
7101 echo " "
7102 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7103         tarch=`arch`"-$osname"
7104 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7105         if uname -m > tmparch 2>&1 ; then
7106                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7107                         -e 's/$/'"-$osname/" tmparch`
7108         else
7109                 tarch="$osname"
7110         fi
7111         $rm -f tmparch
7112 else
7113         tarch="$osname"
7114 fi
7115 case "$myarchname" in
7116 ''|"$tarch") ;;
7117 *)
7118         echo "(Your architecture name used to be $myarchname.)"
7119         archname=''
7120         ;;
7121 esac
7122 case "$targetarch" in
7123 '') ;;
7124 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7125 esac
7126 myarchname="$tarch"
7127 case "$archname" in
7128 '') dflt="$tarch";;
7129 *) dflt="$archname";;
7130 esac
7131 rp='What is your architecture name'
7132 . ./myread
7133 archname="$ans"
7134
7135 : optionally add API version to the architecture for versioned archlibs
7136 case "$useversionedarchname" in
7137 $define|true|[yY]*) dflt='y';;
7138 *)                  dflt='n';;
7139 esac
7140 rp='Add the Perl API version to your archname?'
7141 . ./myread
7142 case "$ans" in
7143 y|Y)    useversionedarchname="$define" ;;
7144 *)      useversionedarchname="$undef" ;;
7145 esac
7146 case "$useversionedarchname" in
7147 $define)
7148         case "$archname" in
7149         *-$api_versionstring)
7150                 echo "...and architecture name already has -$api_versionstring" >&4
7151                 ;;
7152         *)
7153                 archname="$archname-$api_versionstring"
7154                 echo "...setting architecture name to $archname." >&4
7155                 ;;
7156         esac
7157         ;;
7158 esac
7159
7160 case "$usethreads" in
7161 $define)
7162         echo "Threads selected." >&4
7163         case "$archname" in
7164         *-thread*) echo "...and architecture name already has -thread." >&4
7165                 ;;
7166         *)      archname="$archname-thread"
7167                 echo "...setting architecture name to $archname." >&4
7168                 ;;
7169         esac
7170         ;;
7171 esac
7172 case "$usemultiplicity" in
7173 $define)
7174         echo "Multiplicity selected." >&4
7175         case "$archname" in
7176         *-multi*) echo "...and architecture name already has -multi." >&4
7177                 ;;
7178         *)      archname="$archname-multi"
7179                 echo "...setting architecture name to $archname." >&4
7180                 ;;
7181         esac
7182         ;;
7183 esac
7184 case "$use64bitint$use64bitall" in
7185 *"$define"*)
7186         case "$archname64" in
7187         '')
7188                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7189                 ;;
7190         *)
7191                 case "$use64bitint" in
7192                 "$define") echo "64 bit integers selected." >&4 ;;
7193                 esac
7194                 case "$use64bitall" in
7195                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7196                 esac
7197                 case "$archname" in
7198                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7199                         ;;
7200                 *)      archname="$archname-$archname64"
7201                         echo "...setting architecture name to $archname." >&4
7202                         ;;
7203                 esac
7204                 ;;
7205         esac
7206 esac
7207 case "$uselongdouble" in
7208 $define)
7209         echo "Long doubles selected." >&4
7210         case "$longdblsize" in
7211         $doublesize)
7212                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7213                 ;;
7214         *)
7215                 case "$archname" in
7216                 *-ld*) echo "...and architecture name already has -ld." >&4
7217                         ;;
7218                 *)      archname="$archname-ld"
7219                         echo "...setting architecture name to $archname." >&4
7220                         ;;
7221                 esac
7222                 ;;
7223         esac
7224         ;;
7225 esac
7226 case "$usequadmath" in
7227 $define)
7228         echo "quadmath selected." >&4
7229         case "$archname" in
7230         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7231                 ;;
7232         *)      archname="$archname-quadmath"
7233                 echo "...setting architecture name to $archname." >&4
7234                 ;;
7235         esac
7236         ;;
7237 esac
7238 if $test -f archname.cbu; then
7239         echo "Your platform has some specific hints for architecture name, using them..."
7240         . ./archname.cbu
7241 fi
7242
7243 : set the prefixit variable, to compute a suitable default value
7244 prefixit='case "$3" in
7245 ""|none)
7246         case "$oldprefix" in
7247         "") eval "$1=\"\$$2\"";;
7248         *)
7249                 case "$3" in
7250                 "") eval "$1=";;
7251                 none)
7252                         eval "tp=\"\$$2\"";
7253                         case "$tp" in
7254                         ""|" ") eval "$1=\"\$$2\"";;
7255                         *) eval "$1=";;
7256                         esac;;
7257                 esac;;
7258         esac;;
7259 *)
7260         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7261         case "$tp" in
7262         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7263         /*-$oldprefix/*|\~*-$oldprefix/*)
7264                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7265         *) eval "$1=\"\$$2\"";;
7266         esac;;
7267 esac'
7268
7269 : determine installation style
7270 : For now, try to deduce it from prefix unless it is already set.
7271 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7272 case "$installstyle" in
7273 '')     case "$prefix" in
7274                 *perl*) dflt='lib';;
7275                 *) dflt='lib/perl5' ;;
7276         esac
7277         ;;
7278 *)      dflt="$installstyle" ;;
7279 esac
7280 : Probably not worth prompting for this since we prompt for all
7281 : the directories individually, and the prompt would be too long and
7282 : confusing anyway.
7283 installstyle=$dflt
7284
7285 : determine where public executables go
7286 echo " "
7287 set dflt bin bin
7288 eval $prefixit
7289 fn=d~
7290 rp='Pathname where the public executables will reside?'
7291 . ./getfile
7292 if $test "X$ansexp" != "X$binexp"; then
7293         installbin=''
7294 fi
7295 prefixvar=bin
7296 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7297 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7298 :     this via initialinstalllocation
7299 . ./setprefixvar
7300
7301 case "$userelocatableinc" in
7302 $define|true|[yY]*)     dflt='y' ;;
7303 *)                      dflt='n' ;;
7304 esac
7305 cat <<EOM
7306
7307 Would you like to build Perl so that the installation is relocatable, so that
7308 library paths in @INC are determined relative to the path of the perl binary?
7309 This is not advised for system Perl installs, or if you need to run setid
7310 scripts or scripts under taint mode.
7311
7312 If this doesn't make any sense to you, just accept the default '$dflt'.
7313 EOM
7314 rp='Use relocatable @INC?'
7315 . ./myread
7316 case "$ans" in
7317 y|Y)    val="$define" ;;
7318 *)      val="$undef"  ;;
7319 esac
7320 set userelocatableinc
7321 eval $setvar
7322
7323 initialinstalllocation="$binexp"
7324 : Default prefix is now "up one level from where the binaries are"
7325 case "$userelocatableinc" in
7326 $define|true|[yY]*)
7327     bin=".../"
7328     binexp=".../"
7329     prefix=".../.."
7330     prefixexp=".../.."
7331     installprefixexp=".../.."
7332     ;;
7333 esac
7334
7335 : determine where private library files go
7336 : Usual default is /usr/local/lib/perl5/$version.
7337 : Also allow things like /opt/perl/lib/$version, since
7338 : /opt/perl/lib/perl5... would be redundant.
7339 : The default "style" setting is made in installstyle.U
7340 case "$installstyle" in
7341 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7342 *)       set dflt privlib lib/$version ;;
7343 esac
7344 eval $prefixit
7345 $cat <<EOM
7346
7347 There are some auxiliary files for $package that need to be put into a
7348 private library directory that is accessible by everyone.
7349
7350 EOM
7351 fn=$binexp
7352 fn=d~+
7353 rp='Pathname where the private library files will reside?'
7354 . ./getfile
7355 prefixvar=privlib
7356 . ./setprefixvar
7357
7358 : set the prefixup variable, to restore leading tilda escape
7359 prefixup='case "$prefixexp" in
7360 "$prefix") ;;
7361 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7362 esac'
7363
7364 : determine where public architecture dependent libraries go
7365 set archlib archlib
7366 eval $prefixit
7367 : privlib default is /usr/local/lib/$package/$version
7368 : archlib default is /usr/local/lib/$package/$version/$archname
7369 : privlib may have an optional trailing /share.
7370 tdflt=`echo $privlib | $sed 's,/share$,,'`
7371 tdflt=$tdflt/$archname
7372 case "$archlib" in
7373 '')     dflt=$tdflt
7374         ;;
7375 *)      dflt="$archlib"
7376     ;;
7377 esac
7378 $cat <<EOM
7379
7380 $spackage contains architecture-dependent library files.  If you are
7381 sharing libraries in a heterogeneous environment, you might store
7382 these files in a separate location.  Otherwise, you can just include
7383 them with the rest of the public library files.
7384
7385 EOM
7386 fn=$binexp
7387 fn=d+~
7388 rp='Where do you want to put the public architecture-dependent libraries?'
7389 . ./getfile
7390 prefixvar=archlib
7391 . ./setprefixvar
7392 if $test X"$archlib" = X"$privlib"; then
7393         d_archlib="$undef"
7394 else
7395         d_archlib="$define"
7396 fi
7397
7398 : see if setuid scripts can be secure
7399 $cat <<EOM
7400
7401 Some kernels have a bug that prevents setuid #! scripts from being
7402 secure.  Some sites have disabled setuid #! scripts because of this.
7403
7404 First let's decide if your kernel supports secure setuid #! scripts.
7405 (If setuid #! scripts would be secure but have been disabled anyway,
7406 don't say that they are secure if asked.)
7407
7408 EOM
7409
7410 val="$undef"
7411 if $test -d /dev/fd; then
7412         echo "#!$ls" >reflect
7413         chmod +x,u+s reflect
7414         ./reflect >flect 2>&1
7415         if $contains "/dev/fd" flect >/dev/null; then
7416                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7417                 val="$define"
7418         else
7419                 $cat <<EOM
7420 If you are not sure if they are secure, I can check but I'll need a
7421 username and password different from the one you are using right now.
7422 If you don't have such a username or don't want me to test, simply
7423 enter 'none'.
7424
7425 EOM
7426                 rp='Other username to test security of setuid scripts with?'
7427                 dflt='none'
7428                 . ./myread
7429                 case "$ans" in
7430                 n|none)
7431                         case "$d_suidsafe" in
7432                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7433                                 dflt=n;;
7434                         "$undef")
7435                                 echo "Well, the $hint value is *not* secure." >&4
7436                                 dflt=n;;
7437                         *)      echo "Well, the $hint value *is* secure." >&4
7438                                 dflt=y;;
7439                         esac
7440                         ;;
7441                 *)
7442                         $rm -f reflect flect
7443                         echo "#!$ls" >reflect
7444                         chmod +x,u+s reflect
7445                         echo >flect
7446                         chmod a+w flect
7447                         echo '"su" will (probably) prompt you for '"$ans's password."
7448                         su $ans -c './reflect >flect'
7449                         if $contains "/dev/fd" flect >/dev/null; then
7450                                 echo "Okay, it looks like setuid scripts are secure." >&4
7451                                 dflt=y
7452                         else
7453                                 echo "I don't think setuid scripts are secure." >&4
7454                                 dflt=n
7455                         fi
7456                         ;;
7457                 esac
7458                 rp='Does your kernel have *secure* setuid scripts?'
7459                 . ./myread
7460                 case "$ans" in
7461                 [yY]*)  val="$define";;
7462                 *)      val="$undef";;
7463                 esac
7464         fi
7465 else
7466         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7467         echo "(That's for file descriptors, not floppy disks.)"
7468         val="$undef"
7469 fi
7470 set d_suidsafe
7471 eval $setvar
7472
7473 $rm -f reflect flect
7474
7475 : now see if they want to do setuid emulation
7476 if $test $patchlevel -lt 11; then
7477 echo " "
7478 val="$undef"
7479 case "$d_suidsafe" in
7480 "$define")
7481         val="$undef"
7482         echo "No need to emulate SUID scripts since they are secure here." >&4
7483         ;;
7484 *)
7485         $cat <<EOM
7486 Some systems have disabled setuid scripts, especially systems where
7487 setuid scripts cannot be secure.  On systems where setuid scripts have
7488 been disabled, the setuid/setgid bits on scripts are currently
7489 useless.  It is possible for $package to detect those bits and emulate
7490 setuid/setgid in a secure fashion.  This emulation will only work if
7491 setuid scripts have been disabled in your kernel.
7492
7493 EOM
7494         case "$d_dosuid" in
7495         "$define") dflt=y ;;
7496         *) dflt=n ;;
7497         esac
7498         rp="Do you want to do setuid/setgid emulation?"
7499         . ./myread
7500         case "$ans" in
7501         [yY]*)  val="$define";;
7502         *)      val="$undef";;
7503         esac
7504         ;;
7505 esac
7506 set d_dosuid
7507 eval $setvar
7508 else
7509     case "$d_dosuid" in
7510         "$define")
7511         cat >&4 <<EOH
7512
7513 SUID emulation has been removed for 5.12
7514 Please re-run Configure without -Dd_dosuid
7515
7516 EOH
7517         exit 1;
7518         ;;
7519     esac
7520     d_dosuid=undef
7521 fi
7522
7523 : Find perl5.005 or later.
7524 echo "Looking for a previously installed perl5.005 or later... "
7525 case "$perl5" in
7526 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7527                 : Check if this perl is recent and can load a simple module
7528                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7529                         perl5=$tdir/perl
7530                         break;
7531                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7532                         perl5=$tdir/perl5
7533                         break;
7534                 fi
7535         done
7536         ;;
7537 *)      perl5="$perl5"
7538         ;;
7539 esac
7540 case "$perl5" in
7541 '')     echo "None found.  That's ok.";;
7542 *)      echo "Using $perl5." ;;
7543 esac
7544
7545 : Set the siteprefix variables
7546 $cat <<EOM
7547
7548 After $package is installed, you may wish to install various
7549 add-on modules and utilities.  Typically, these add-ons will
7550 be installed under $prefix with the rest
7551 of this package.  However, you may wish to install such add-ons
7552 elsewhere under a different prefix.
7553
7554 If you do not wish to put everything under a single prefix, that's
7555 ok.  You will be prompted for the individual locations; this siteprefix
7556 is only used to suggest the defaults.
7557
7558 The default should be fine for most people.
7559
7560 EOM
7561 fn=d~+
7562 rp='Installation prefix to use for add-on modules and utilities?'
7563 : XXX Here might be another good place for an installstyle setting.
7564 case "$siteprefix" in
7565 '') dflt=$prefix ;;
7566 *)  dflt=$siteprefix ;;
7567 esac
7568 . ./getfile
7569 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7570 oldsiteprefix=''
7571 case "$siteprefix" in
7572 '') ;;
7573 *)      case "$ans" in
7574         "$prefix") ;;
7575         *) oldsiteprefix="$prefix";;
7576         esac
7577         ;;
7578 esac
7579 siteprefix="$ans"
7580 siteprefixexp="$ansexp"
7581
7582 : determine where site specific libraries go.
7583 : Usual default is /usr/local/lib/perl5/site_perl/$version
7584 : The default "style" setting is made in installstyle.U
7585 : XXX No longer works with Prefixit stuff.
7586 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7587 case "$sitelib" in
7588 '') case "$installstyle" in
7589         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7590         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7591         esac
7592         ;;
7593 *)      dflt="$sitelib"
7594         ;;
7595 esac
7596 $cat <<EOM
7597
7598 The installation process will create a directory for
7599 site-specific extensions and modules.  Most users find it convenient
7600 to place all site-specific files in this directory rather than in the
7601 main distribution directory.
7602
7603 EOM
7604 fn=d~+
7605 rp='Pathname for the site-specific library files?'
7606 . ./getfile
7607 prefixvar=sitelib
7608 . ./setprefixvar
7609 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7610
7611 : Determine list of previous versions to include in @INC
7612 $cat > getverlist <<EOPL
7613 #!$perl5 -w
7614 use File::Basename;
7615 \$api_versionstring = "$api_versionstring";
7616 \$version = "$version";
7617 \$stem = "$sitelib_stem";
7618 \$archname = "$archname";
7619 EOPL
7620         $cat >> getverlist <<'EOPL'
7621 # The list found is store twice for each entry: the original name, and
7622 # the binary broken down version as pack "sss", so sorting is easy and
7623 # unambiguous. This will work for all versions that have a maximum of
7624 # three digit groups, separate by '.'s or '_'s. Names are extended with
7625 # ".0.0" to ensure at least three elements for the pack.
7626 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7627
7628 # Can't have leading @ because metaconfig interprets it as a command!
7629 ;@inc_version_list=();
7630 # XXX Redo to do opendir/readdir?
7631 if (-d $stem) {
7632     chdir($stem);
7633     ;@candidates = map {
7634         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7635     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7636 }
7637 else {
7638     ;@candidates = ();
7639 }
7640
7641 ($pversion, $aversion, $vsn5005) = map {
7642     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7643 foreach $d (@candidates) {
7644     if ($d->[1] lt $pversion) {
7645         if ($d->[1] ge $aversion) {
7646             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7647         }
7648         elsif ($d->[1] ge $vsn5005) {
7649             unshift(@inc_version_list, grep { -d } $d->[0]);
7650         }
7651     }
7652     else {
7653         # Skip newer version.  I.e. don't look in
7654         # 5.7.0 if we're installing 5.6.1.
7655     }
7656 }
7657
7658 if (@inc_version_list) {
7659     print join(' ', @inc_version_list);
7660 }
7661 else {
7662     # Blank space to preserve value for next Configure run.
7663     print " ";
7664 }
7665 EOPL
7666 chmod +x getverlist
7667 case "$inc_version_list" in
7668 '')     if test -x "$perl5$exe_ext"; then
7669                 dflt=`$perl5 getverlist`
7670         else
7671                 dflt='none'
7672         fi
7673         ;;
7674 $undef) dflt='none' ;;
7675 *)  eval dflt=\"$inc_version_list\" ;;
7676 esac
7677 case "$dflt" in
7678 ''|' ') dflt=none ;;
7679 esac
7680 case "$dflt" in
7681 5.005) dflt=none ;;
7682 esac
7683 $cat <<EOM
7684
7685 In order to ease the process of upgrading, this version of perl
7686 can be configured to use modules built and installed with earlier
7687 versions of perl that were installed under $prefix.  Specify here
7688 the list of earlier versions that this version of perl should check.
7689 If Configure detected no earlier versions of perl installed under
7690 $prefix, then the list will be empty.  Answer 'none' to tell perl
7691 to not search earlier versions.
7692
7693 The default should almost always be sensible, so if you're not sure,
7694 just accept the default.
7695 EOM
7696
7697 rp='List of earlier versions to include in @INC?'
7698 . ./myread
7699 case "$ans" in
7700 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7701 *) inc_version_list="$ans" ;;
7702 esac
7703 case "$inc_version_list" in
7704 ''|' ')
7705         inc_version_list_init='0'
7706         d_inc_version_list="$undef"
7707         ;;
7708 *)      inc_version_list_init=`echo $inc_version_list |
7709                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7710         d_inc_version_list="$define"
7711         ;;
7712 esac
7713 $rm -f getverlist
7714
7715 : see if malloc/malloc.h has to be included
7716 set malloc/malloc.h i_mallocmalloc
7717 eval $inhdr
7718
7719 : see if this is a malloc.h system
7720 : we want a real compile instead of Inhdr because some systems have a
7721 : malloc.h that just gives a compile error saying to use stdlib.h instead
7722 echo " "
7723 $cat >try.c <<EOCP
7724 #include <stdlib.h>
7725 #include <malloc.h>
7726 #$i_mallocmalloc I_MALLOCMALLOC
7727 #ifdef I_MALLOCMALLOC
7728 # include <malloc/malloc.h>
7729 #endif
7730
7731 int main () { return 0; }
7732 EOCP
7733 set try
7734 if eval $compile; then
7735     echo "<malloc.h> found." >&4
7736     val="$define"
7737 else
7738     echo "<malloc.h> NOT found." >&4
7739     val="$undef"
7740 fi
7741 $rm_try
7742 set i_malloc
7743 eval $setvar
7744
7745 : check for length of pointer
7746 echo " "
7747 case "$ptrsize" in
7748 '')
7749         echo "Checking to see how big your pointers are..." >&4
7750         $cat >try.c <<EOCP
7751 #include <stdio.h>
7752 #$i_stdlib I_STDLIB
7753 #ifdef I_STDLIB
7754 #include <stdlib.h>
7755 #endif
7756 int main()
7757 {
7758     printf("%d\n", (int)sizeof(void *));
7759     exit(0);
7760 }
7761 EOCP
7762         set try
7763         if eval $compile_ok; then
7764                 ptrsize=`$run ./try`
7765                 echo "Your pointers are $ptrsize bytes long."
7766         else
7767                 dflt='4'
7768                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7769                 rp="What is the size of a pointer (in bytes)?"
7770                 . ./myread
7771                 ptrsize="$ans"
7772         fi
7773         ;;
7774 esac
7775 $rm_try
7776 case "$use64bitall" in
7777 "$define"|true|[yY]*)
7778         case "$ptrsize" in
7779         4)      cat <<EOM >&4
7780
7781 *** You have chosen a maximally 64-bit build,
7782 *** but your pointers are only 4 bytes wide.
7783 *** Please rerun Configure without -Duse64bitall.
7784 EOM
7785                 case "$d_quad" in
7786                 define)
7787                         cat <<EOM >&4
7788 *** Since you have quads, you could possibly try with -Duse64bitint.
7789 EOM
7790                         ;;
7791                 esac
7792                 cat <<EOM >&4
7793 *** Cannot continue, aborting.
7794
7795 EOM
7796
7797                 exit 1
7798                 ;;
7799         esac
7800         ;;
7801 esac
7802
7803 : determine whether to use malloc wrapping
7804 echo " "
7805 case "$usemallocwrap" in
7806 [yY]*|true|$define)     dflt='y' ;;
7807 [nN]*|false|$undef)     dflt='n' ;;
7808 *)      case "$usedevel" in
7809         [yY]*|true|$define)     dflt='y' ;;
7810         *) dflt='n' ;;
7811         esac
7812         ;;
7813 esac
7814 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7815 . ./myread
7816 usemallocwrap="$ans"
7817 case "$ans" in
7818 y*|true)
7819         usemallocwrap="$define" ;;
7820 *)
7821         usemallocwrap="$undef" ;;
7822 esac
7823
7824 : determine which malloc to compile in
7825 echo " "
7826 case "$usemymalloc" in
7827 [yY]*|true|$define)     dflt='y' ;;
7828 [nN]*|false|$undef)     dflt='n' ;;
7829 *)      case "$ptrsize" in
7830         4) dflt='y' ;;
7831         *) dflt='n' ;;
7832         esac
7833         if test "$useithreads" = "$define"; then dflt='n'; fi
7834         ;;
7835 esac
7836 rp="Do you wish to attempt to use the malloc that comes with $package?"
7837 . ./myread
7838 usemymalloc="$ans"
7839 case "$ans" in
7840 y*|true)
7841         usemymalloc='y'
7842         mallocsrc='malloc.c'
7843         mallocobj="malloc$_o"
7844         d_mymalloc="$define"
7845         case "$libs" in
7846         *-lmalloc*)
7847                 : Remove malloc from list of libraries to use
7848                 echo "Removing unneeded -lmalloc from library list" >&4
7849                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7850                 shift
7851                 libs="$*"
7852                 echo "libs = $libs" >&4
7853                 ;;
7854         esac
7855         ;;
7856 *)
7857         usemymalloc='n'
7858         mallocsrc=''
7859         mallocobj=''
7860         d_mymalloc="$undef"
7861         ;;
7862 esac
7863
7864 : compute the return types of malloc and free
7865 echo " "
7866 $cat >malloc.c <<END
7867 #$i_malloc I_MALLOC
7868 #$i_stdlib I_STDLIB
7869 #include <stdio.h>
7870 #include <sys/types.h>
7871 #ifdef I_MALLOC
7872 #include <malloc.h>
7873 #endif
7874 #ifdef I_STDLIB
7875 #include <stdlib.h>
7876 #endif
7877 #ifdef TRY_MALLOC
7878 void *malloc();
7879 #endif
7880 #ifdef TRY_FREE
7881 void free();
7882 #endif
7883 END
7884 case "$malloctype" in
7885 '')
7886         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7887                 malloctype='void *'
7888         else
7889                 malloctype='char *'
7890         fi
7891         ;;
7892 esac
7893 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7894
7895 case "$freetype" in
7896 '')
7897         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7898                 freetype='void'
7899         else
7900                 freetype='int'
7901         fi
7902         ;;
7903 esac
7904 echo "Your system uses $freetype free(), it would seem." >&4
7905 $rm -f malloc.[co]
7906 : determine where site specific architecture-dependent libraries go.
7907 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7908 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7909 : sitelib may have an optional trailing /share.
7910 case "$sitearch" in
7911 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7912         dflt="$dflt/$archname"
7913         ;;
7914 *)      dflt="$sitearch"
7915         ;;
7916 esac
7917 set sitearch sitearch none
7918 eval $prefixit
7919 $cat <<EOM
7920
7921 The installation process will also create a directory for
7922 architecture-dependent site-specific extensions and modules.
7923
7924 EOM
7925 fn=d~+
7926 rp='Pathname for the site-specific architecture-dependent library files?'
7927 . ./getfile
7928 prefixvar=sitearch
7929 . ./setprefixvar
7930 if $test X"$sitearch" = X"$sitelib"; then
7931         d_sitearch="$undef"
7932 else
7933         d_sitearch="$define"
7934 fi
7935
7936 : Set the vendorprefix variables
7937 $cat <<EOM
7938
7939 The installation process will also create a directory for
7940 vendor-supplied add-ons.  Vendors who supply perl with their system
7941 may find it convenient to place all vendor-supplied files in this
7942 directory rather than in the main distribution directory.  This will
7943 ease upgrades between binary-compatible maintenance versions of perl.
7944
7945 Of course you may also use these directories in whatever way you see
7946 fit.  For example, you might use them to access modules shared over a
7947 company-wide network.
7948
7949 The default answer should be fine for most people.
7950 This causes further questions about vendor add-ons to be skipped
7951 and no vendor-specific directories will be configured for perl.
7952
7953 EOM
7954 rp='Do you want to configure vendor-specific add-on directories?'
7955 case "$usevendorprefix" in
7956 define|true|[yY]*) dflt=y ;;
7957 *)      : User may have set vendorprefix directly on Configure command line.
7958         case "$vendorprefix" in
7959         ''|' ') dflt=n ;;
7960         *)      dflt=y ;;
7961         esac
7962         ;;
7963 esac
7964 . ./myread
7965 case "$ans" in
7966 [yY]*)  fn=d~+
7967         rp='Installation prefix to use for vendor-supplied add-ons?'
7968         case "$vendorprefix" in
7969         '') dflt="$prefix" ;;
7970         *)  dflt=$vendorprefix ;;
7971         esac
7972         . ./getfile
7973         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7974         oldvendorprefix=''
7975         case "$vendorprefix" in
7976         '') ;;
7977         *)      case "$ans" in
7978                 "$prefix") ;;
7979                 *) oldvendorprefix="$prefix";;
7980                 esac
7981                 ;;
7982         esac
7983         usevendorprefix="$define"
7984         vendorprefix="$ans"
7985         vendorprefixexp="$ansexp"
7986         ;;
7987 *)      usevendorprefix="$undef"
7988         vendorprefix=''
7989         vendorprefixexp=''
7990         ;;
7991 esac
7992
7993 : Set the vendorlib variables
7994 case "$vendorprefix" in
7995 '')     d_vendorlib="$undef"
7996         vendorlib=''
7997         vendorlibexp=''
7998         ;;
7999 *)      d_vendorlib="$define"
8000         : determine where vendor-supplied modules go.
8001         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8002         case "$vendorlib" in
8003         '')
8004                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8005                 case "$installstyle" in
8006                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8007                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8008                 esac
8009                 ;;
8010         *)      dflt="$vendorlib"
8011                 ;;
8012         esac
8013         fn=d~+
8014         rp='Pathname for the vendor-supplied library files?'
8015         . ./getfile
8016         vendorlib="$ans"
8017         vendorlibexp="$ansexp"
8018         ;;
8019 esac
8020 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8021 prefixvar=vendorlib
8022 . ./installprefix
8023
8024 : Set the vendorarch variables
8025 case "$vendorprefix" in
8026 '')     d_vendorarch="$undef"
8027         vendorarch=''
8028         vendorarchexp=''
8029         ;;
8030 *)      d_vendorarch="$define"
8031         : determine where vendor-supplied architecture-dependent libraries go.
8032         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8033         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8034         : vendorlib may have an optional trailing /share.
8035         case "$vendorarch" in
8036         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8037                 dflt="$dflt/$archname"
8038                 ;;
8039         *)      dflt="$vendorarch" ;;
8040         esac
8041         fn=d~+
8042         rp='Pathname for vendor-supplied architecture-dependent files?'
8043         . ./getfile
8044         vendorarch="$ans"
8045         vendorarchexp="$ansexp"
8046         ;;
8047 esac
8048 prefixvar=vendorarch
8049 . ./installprefix
8050 if $test X"$vendorarch" = X"$vendorlib"; then
8051         d_vendorarch="$undef"
8052 else
8053         d_vendorarch="$define"
8054 fi
8055
8056 : Final catch-all directories to search
8057 $cat <<EOM
8058
8059 Lastly, you can have perl look in other directories for extensions and
8060 modules in addition to those already specified.
8061 These directories will be searched after
8062         $sitearch
8063         $sitelib
8064 EOM
8065 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8066 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8067 echo ' '
8068 case "$otherlibdirs" in
8069 ''|' ') dflt='none' ;;
8070 *)      dflt="$otherlibdirs" ;;
8071 esac
8072 $cat <<EOM
8073 Enter a colon-separated set of extra paths to include in perl's @INC
8074 search path, or enter 'none' for no extra paths.
8075
8076 EOM
8077
8078 rp='Colon-separated list of additional directories for perl to search?'
8079 . ./myread
8080 case "$ans" in
8081 ' '|''|none)    otherlibdirs=' ' ;;
8082 *)      otherlibdirs="$ans" ;;
8083 esac
8084 case "$otherlibdirs" in
8085 ' ') val=$undef ;;
8086 *)      val=$define ;;
8087 esac
8088 set d_perl_otherlibdirs
8089 eval $setvar
8090
8091 : DTrace support
8092 dflt_dtrace='/usr/sbin/dtrace'
8093 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8094
8095 cat <<EOM
8096
8097 Perl can be built to support DTrace on platforms that support it.
8098 DTrace is a diagnosis and performance analysis tool from Sun.
8099
8100 If this doesn't make any sense to you, just accept the default.
8101 EOM
8102
8103 while $test 1 ; do
8104         case "$usedtrace" in
8105         $define|true|[yY]*)
8106                 dflt='y'
8107                 ;;
8108         ?*)
8109                 dflt='y'
8110                 dflt_dtrace=$usedtrace
8111                 ;;
8112         *)
8113                 dflt='n'
8114                 ;;
8115         esac
8116
8117         rp='Support DTrace if available?'
8118         . ./myread
8119         case "$ans" in
8120         y|Y)    val="$define" ;;
8121         *)      val="$undef" ;;
8122         esac
8123         set usedtrace
8124         eval $setvar
8125
8126         test "X$usedtrace" != "X$define" && break
8127
8128         echo " "
8129         rp='Where is the dtrace executable?'
8130         dflt=$dflt_dtrace
8131         . ./getfile
8132         val="$ans"
8133         set dtrace
8134         eval $setvar
8135
8136         if $test -f $dtrace
8137         then
8138                 if $dtrace -h -s ../perldtrace.d \
8139                         -o perldtrace.tmp >/dev/null 2>&1 \
8140                         && rm -f perldtrace.tmp
8141                 then
8142                         echo " "
8143                         echo "Good: your $dtrace knows about the -h flag."
8144                 else
8145                         cat >&2 <<EOM
8146
8147 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8148 ***
8149 *** Your installed dtrace doesn't support the -h switch to compile a D
8150 *** program into a C header. Can't continue.
8151
8152 EOM
8153                         exit 1
8154                 fi
8155                 break;
8156         fi
8157
8158         case "$fastread" in
8159         yes)
8160                 cat >&2 <<EOM
8161
8162 *** $me:  Fatal Error:  $dtrace not found.
8163 *** Can't continue.
8164
8165 EOM
8166                 exit 1
8167                 ;;
8168         *)
8169                 echo "*** $dtrace was not found."
8170                 echo " "
8171                 ;;
8172         esac
8173 done
8174
8175 : See if we want extra modules installed
8176 echo " "
8177 case "$extras" in
8178 '') dflt='n';;
8179 *) dflt='y';;
8180 esac
8181 cat <<EOM
8182 Perl can be built with extra modules or bundles of modules which
8183 will be fetched from the CPAN and installed alongside Perl.
8184
8185 Notice that you will need access to the CPAN; either via the Internet,
8186 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8187 be asked later to configure the CPAN.pm module which will in turn do
8188 the installation of the rest of the extra modules or bundles.)
8189
8190 Notice also that if the modules require any external software such as
8191 libraries and headers (the libz library and the zlib.h header for the
8192 Compress::Zlib module, for example) you MUST have any such software
8193 already installed, this configuration process will NOT install such
8194 things for you.
8195
8196 If this doesn't make any sense to you, just accept the default '$dflt'.
8197 EOM
8198 rp='Install any extra modules (y or n)?'
8199 . ./myread
8200 case "$ans" in
8201 y|Y)
8202         cat <<EOM
8203
8204 Please list any extra modules or bundles to be installed from CPAN,
8205 with spaces between the names.  The names can be in any format the
8206 'install' command of CPAN.pm will understand.  (Answer 'none',
8207 without the quotes, to install no extra modules or bundles.)
8208 EOM
8209         rp='Extras?'
8210         dflt="$extras"
8211         . ./myread
8212         extras="$ans"
8213 esac
8214 case "$extras" in
8215 ''|'none')
8216         val=''
8217         $rm -f ../extras.lst
8218         ;;
8219 *)      echo "(Saving the list of extras for later...)"
8220         echo "$extras" > ../extras.lst
8221         val="'$extras'"
8222         ;;
8223 esac
8224 set extras
8225 eval $setvar
8226 echo " "
8227
8228 : determine where html pages for programs go
8229 set html1dir html1dir none
8230 eval $prefixit
8231 $cat <<EOM
8232
8233 If you wish to install html files for programs in $spackage, indicate
8234 the appropriate directory here.  To skip installing html files,
8235 answer "none".
8236 EOM
8237 case "$html1dir" in
8238 ''|none|$undef|' ') dflt=none ;;
8239 *) dflt=$html1dir ;;
8240 esac
8241 fn=dn+~
8242 rp="Directory for the main $spackage html pages?"
8243 . ./getfile
8244 prefixvar=html1dir
8245 . ./setprefixvar
8246 : Use ' ' for none so value is preserved next time through Configure
8247 $test X"$html1dir" = "X" && html1dir=' '
8248
8249 : determine where html pages for libraries and modules go
8250 set html3dir html3dir none
8251 eval $prefixit
8252 $cat <<EOM
8253
8254 If you wish to install html files for modules associated with $spackage,
8255 indicate the appropriate directory here.  To skip installing html files,
8256 answer "none".
8257 EOM
8258 : There is no obvious default.  If they have specified html1dir, then
8259 : try to key off that, possibly changing .../html1 into .../html3.
8260 case "$html3dir" in
8261 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8262 *) dflt=$html3dir ;;
8263 esac
8264 fn=dn+~
8265 rp="Directory for the $spackage module html pages?"
8266 . ./getfile
8267 prefixvar=html3dir
8268 . ./setprefixvar
8269 : Use ' ' for none so value is preserved next time through Configure
8270 $test X"$html3dir" = "X" && html3dir=' '
8271
8272 : determine whether to install perl also as /usr/bin/perl
8273
8274 echo " "
8275 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8276         $cat <<EOM
8277 Many scripts expect perl to be installed as /usr/bin/perl.
8278
8279 If you want to, I can install the perl you are about to compile
8280 as /usr/bin/perl (in addition to $bin/perl).
8281 EOM
8282         if test -f /usr/bin/perl; then
8283             $cat <<EOM
8284
8285 However, please note that because you already have a /usr/bin/perl,
8286 overwriting that with a new Perl would very probably cause problems.
8287 Therefore I'm assuming you don't want to do that (unless you insist).
8288
8289 EOM
8290             case "$installusrbinperl" in
8291             "$define"|[yY]*)    dflt='y';;
8292             *)                  dflt='n';;
8293             esac
8294         else
8295             $cat <<EOM
8296
8297 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8298
8299 EOM
8300             case "$installusrbinperl" in
8301             "$undef"|[nN]*)     dflt='n';;
8302             *)                  dflt='y';;
8303             esac
8304         fi
8305         rp="Do you want to install perl as /usr/bin/perl?"
8306         . ./myread
8307         case "$ans" in
8308         [yY]*)  val="$define";;
8309         *)      val="$undef" ;;
8310         esac
8311 else
8312         val="$undef"
8313 fi
8314 set installusrbinperl
8315 eval $setvar
8316
8317 : see if dlopen exists
8318 xxx_runnm="$runnm"
8319 xxx_ccflags="$ccflags"
8320 runnm=false
8321 : with g++ one needs -shared to get is-in-libc to work for dlopen
8322 case "$gccversion" in
8323 '')     ;;
8324 *Clang*)        ;;
8325 *)      case "$d_cplusplus" in
8326         "$define") ccflags="$ccflags -shared" ;;
8327         esac
8328         ;;
8329 esac
8330 set dlopen d_dlopen
8331 eval $inlibc
8332 runnm="$xxx_runnm"
8333 ccflags="$xxx_ccflags"
8334
8335 : see if this is a unistd.h system
8336 set unistd.h i_unistd
8337 eval $inhdr
8338
8339 : determine which dynamic loading, if any, to compile in
8340 echo " "
8341 dldir="ext/DynaLoader"
8342 case "$usedl" in
8343     $define|y|true)
8344         dflt='y'
8345         usedl="$define"
8346         ;;
8347     $undef|n|false)
8348         dflt='n'
8349         usedl="$undef"
8350         ;;
8351     *)
8352         dflt='n'
8353         case "$d_dlopen" in
8354             $define) dflt='y' ;;
8355         esac
8356         : Does a dl_xxx.xs file exist for this operating system
8357         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8358         ;;
8359 esac
8360 rp="Do you wish to use dynamic loading?"
8361 . ./myread
8362 usedl="$ans"
8363 bin_ELF="$undef"
8364 case "$ans" in
8365     y*) usedl="$define"
8366         case "$dlsrc" in
8367             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8368                     dflt="$dldir/dl_${osname}.xs"
8369                 elif $test "$d_dlopen" = "$define" ; then
8370                     dflt="$dldir/dl_dlopen.xs"
8371                 else
8372                     dflt=''
8373                 fi
8374                 ;;
8375             *)  dflt="$dldir/$dlsrc"
8376                 ;;
8377         esac
8378         echo "The following dynamic loading files are available:"
8379         : Can not go over to $dldir because getfile has path hard-coded in.
8380         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8381         rp="Source file to use for dynamic loading"
8382         fn="fne"
8383         gfpth="$src"
8384         . ./getfile
8385         usedl="$define"
8386         : emulate basename
8387         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8388
8389         $cat << EOM
8390
8391 Some systems may require passing special flags to $cc -c to
8392 compile modules that will be used to create a shared library.
8393 To use no flags, say "none".
8394
8395 EOM
8396         case "$cccdlflags" in
8397             '') case "$gccversion" in
8398                 '') case "$osname" in
8399                         hpux)   dflt='+z' ;;
8400                         irix*)  dflt='-KPIC' ;;
8401                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8402                         sunos)  dflt='-pic' ;;
8403                         *)      dflt='none' ;;
8404                     esac
8405                     ;;
8406                 *)  case "$osname" in
8407                         darwin) dflt='none' ;;
8408                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8409                         *)      dflt='-fpic' ;;
8410                     esac ;;
8411                 esac ;;
8412             ' ') dflt='none' ;;
8413             *)   dflt="$cccdlflags" ;;
8414         esac
8415
8416         case "$dflt" in
8417             none) dflt='' ;;
8418         esac
8419
8420         # If -Dsysroot was specified, now's the time to add it
8421         # to cccdlflags
8422         if test "X$sysroot" != X; then
8423             case "$gccversion" in
8424                 '') ;;
8425                 *)  case "$dflt" in
8426                         *sysroot*) ;;
8427                         'undef'|*)
8428                             dflt="$dflt --sysroot=$sysroot" ;;
8429                     esac
8430                     ;;
8431             esac
8432         fi
8433
8434         case "$dflt" in
8435             '') dflt='none';;
8436         esac
8437
8438         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8439         . ./myread
8440         case "$ans" in
8441             none) cccdlflags=' ' ;;
8442             *)    cccdlflags="$ans" ;;
8443         esac
8444
8445         cat << EOM
8446
8447 Some systems use ld to create libraries that can be dynamically loaded,
8448 while other systems (such as those using ELF) use $cc.
8449
8450 EOM
8451
8452 : Determine if this is ELF
8453         $cat >try.c <<EOM
8454 /* Test for whether ELF binaries are produced */
8455 #include <fcntl.h>
8456 #$i_stdlib I_STDLIB
8457 #ifdef I_STDLIB
8458 #include <stdlib.h>
8459 #endif
8460 #$i_unistd I_UNISTD
8461 #ifdef I_UNISTD
8462 #include <unistd.h>
8463 #endif
8464 int main() {
8465     char b[4];
8466     int i = open("a.out",O_RDONLY);
8467     if(i == -1)
8468         exit(1); /* fail */
8469     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8470         exit(0); /* succeed (yes, it is ELF) */
8471     exit(1); /* fail */
8472 }
8473 EOM
8474         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8475             bin_ELF="$define"
8476         fi
8477         $rm_try
8478
8479         case "$ld" in
8480             '') if $test $bin_ELF = "$define"; then
8481                     cat <<EOM
8482 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8483 EOM
8484                     dflt="$cc"
8485                 else
8486                     echo "I'll use ld to build dynamic libraries."
8487                     dflt='ld'
8488                 fi
8489                 ;;
8490             *)  dflt="$ld"
8491                 ;;
8492         esac
8493
8494         rp="What command should be used to create dynamic libraries?"
8495         . ./myread
8496         ld="$ans"
8497
8498         cat << EOM
8499
8500 Some systems may require passing special flags to $ld to create a
8501 library that can be dynamically loaded.  If your ld flags include
8502 -L/other/path options to locate libraries outside your loader's normal
8503 search path, you may need to specify those -L options here as well.  To
8504 use no flags, say "none".
8505
8506 EOM
8507         case "$lddlflags" in
8508             '') case "$osname" in
8509                     haiku) dflt='-shared' ;;
8510                     hpux) dflt='-b';
8511                           case "$gccversion" in
8512                               '') dflt="$dflt +vnocompatwarnings" ;;
8513                           esac
8514                           ;;
8515                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8516                     solaris) # See [perl #66604].
8517                             # On Solaris 11, gcc -m64 on amd64
8518                             # appears not to understand -G.  gcc versions at
8519                             # least as old as 3.4.3 support -shared, so just
8520                             # use that with Solaris 11 and later, but keep
8521                             # the old behavior for older Solaris versions.
8522                             case "$gccversion" in
8523                                 '') dflt='-G' ;;
8524                                 *)  case "$osvers" in
8525                                         2.?|2.10) dflt='-G' ;;
8526                                         *) dflt='-shared' ;;
8527                                     esac
8528                                     ;;
8529                             esac
8530                             ;;
8531                     sunos) dflt='-assert nodefinitions' ;;
8532                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8533                     *)     dflt='none' ;;
8534                 esac
8535                 ;;
8536             *) dflt="$lddlflags" ;;
8537         esac
8538
8539         : Only do this for gcc, since, for example, qcc has no concept
8540         : of --sysroot.
8541         if $test "X$sysroot" != X; then
8542             case "$gccversion" in
8543                 '') ;;
8544                 *)  dflt="$dflt --sysroot $sysroot" ;;
8545             esac
8546         fi
8547
8548         : Try to guess additional flags to pick up local libraries.
8549         : Be careful not to append to a plain 'none'
8550         case "$dflt" in
8551             none) dflt='' ;;
8552         esac
8553         for thisflag in $ldflags; do
8554             case "$thisflag" in
8555                 -L*|-R*|-Wl,-R*)
8556                     case " $dflt " in
8557                         *" $thisflag "*) ;;
8558                         *) dflt="$dflt $thisflag" ;;
8559                     esac
8560                     ;;
8561             esac
8562         done
8563
8564         case "$dflt" in
8565             ''|' ') dflt='none' ;;
8566         esac
8567
8568         case "$ldflags" in
8569             *-fstack-protector-strong*)
8570                 case "$dflt" in
8571                     *-fstack-protector-strong*) ;; # Don't add it again
8572                     *) dflt="$dflt -fstack-protector-strong" ;;
8573                 esac
8574                 ;;
8575             *-fstack-protector*)
8576                 case "$dflt" in
8577                     *-fstack-protector*) ;; # Don't add it again
8578                     *) dflt="$dflt -fstack-protector" ;;
8579                 esac
8580                 ;;
8581         esac
8582
8583         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8584         . ./myread
8585         case "$ans" in
8586             none) lddlflags=' ' ;;
8587             *) lddlflags="$ans" ;;
8588         esac
8589
8590         cat <<EOM
8591
8592 Some systems may require passing special flags to $cc to indicate that
8593 the resulting executable will use dynamic linking.  To use no flags,
8594 say "none".
8595
8596 EOM
8597         case "$ccdlflags" in
8598             '') case "$osname" in
8599                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8600                     sunos)             dflt='none'   ;;
8601                     *)                 dflt='none'   ;;
8602                 esac ;;
8603             ' ') dflt='none' ;;
8604             *)   dflt="$ccdlflags" ;;
8605         esac
8606         rp="Any special flags to pass to $cc to use dynamic linking?"
8607         . ./myread
8608         case "$ans" in
8609             none) ccdlflags=' ' ;;
8610             *)    ccdlflags="$ans" ;;
8611         esac
8612         ;;
8613
8614     *)  usedl="$undef"
8615         ld='ld'
8616         dlsrc='dl_none.xs'
8617         lddlflags=''
8618         ccdlflags=''
8619         ;;
8620 esac
8621
8622 ld_can_script="$undef"
8623 case "$bin_ELF$usedl" in
8624     $define$define)
8625         # Abuse try.h and a.out names for neat cleanup
8626         $cat >try.c <<EOM
8627 void foo() {}
8628 void bar() {}
8629 EOM
8630         $cat >try.h <<EOM
8631 LIBTEST_42 {
8632  global:
8633   foo;
8634  local: *;
8635  };
8636 EOM
8637         if $cc $cccdlflags $ccdlflags $ccflags \
8638                $ldflags $lddlflags -o a.out try.c \
8639                -Wl,--version-script=try.h >/dev/null 2>&1 \
8640            &&  $test -s a.out ; then
8641             echo "ld supports scripting" >&4
8642             ld_can_script="$define"
8643         else
8644             echo "ld does not support scripting" >&4
8645         fi
8646         $rm_try
8647         ;;
8648 esac
8649
8650 : Do we want a shared libperl?
8651 also=''
8652 case "$usedl" in
8653 $undef)
8654         # No dynamic loading being used, so don't bother even to prompt.
8655         useshrplib='false'
8656         ;;
8657 *)      case "$useshrplib" in
8658         '')     case "$osname" in
8659                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8660                         dflt=y
8661                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8662                         ;;
8663                 *)      dflt=n
8664                         ;;
8665                 esac
8666                 ;;
8667         $define|true|[Yy]*)
8668                 dflt=y
8669                 ;;
8670         *)      dflt=n
8671                 ;;
8672         esac
8673         $cat << EOM
8674
8675 The perl executable is normally obtained by linking perlmain.c with
8676 libperl${_a}, any static extensions (usually just DynaLoader), and
8677 any other libraries needed on this system (such as -lm, etc.).  Since
8678 your system supports dynamic loading, it is probably possible to build
8679 a shared libperl.$so.  If you will have more than one executable linked
8680 to libperl.$so, this will significantly reduce the size of each
8681 executable, but it may have a noticeable effect on performance.  The
8682 default is probably sensible for your system.
8683 $also
8684
8685 EOM
8686         rp="Build a shared libperl.$so (y/n)"
8687         . ./myread
8688         case "$ans" in
8689         true|$define|[Yy]*)
8690                 useshrplib='true'  ;;
8691         *)      useshrplib='false' ;;
8692         esac
8693         ;;
8694 esac
8695
8696 case "$useshrplib" in
8697 true)
8698         case "$userelocatableinc" in
8699         true|define)
8700                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8701                 echo "See INSTALL for an explanation why that won't work." >&4
8702                 exit 4
8703                 ;;
8704         esac
8705         case "$libperl" in
8706         '')
8707                 # Figure out a good name for libperl.so.  Since it gets stored in
8708                 # a version-specific architecture-dependent library, the version
8709                 # number isn't really that important, except for making cc/ld happy.
8710                 #
8711                 # A name such as libperl.so.10.1
8712                 majmin="libperl.$so.$patchlevel.$subversion"
8713                 # A name such as libperl.so.100
8714                 majonly=`echo $patchlevel $subversion |
8715                         $awk '{printf "%d%02d", $1, $2}'`
8716                 majonly=libperl.$so.$majonly
8717                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8718                 # rely on figuring it out from the naming of libc.
8719                 case "${osname}${osvers}" in
8720                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8721                         dflt=libperl.$so
8722                         ;;
8723                 cygwin*) # ld links now against the dll directly
8724                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8725                         majonly=`echo $patchlevel $subversion |
8726                                 $awk '{printf "%03d%03d", $1, $2}'`
8727                         majonly=cygperl5.$majonly.$so
8728                         dflt=$majmin
8729                         ;;
8730                 *)      # Try to guess based on whether libc has major.minor.
8731                         case "$libc" in
8732                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8733                         *libc.$so.[0-9]*) dflt=$majonly ;;
8734                         *)      dflt=libperl.$so ;;
8735                         esac
8736                         ;;
8737                 esac
8738                 ;;
8739         *)      dflt=$libperl
8740                 ;;
8741         esac
8742         cat << EOM
8743
8744 I need to select a good name for the shared libperl.  If your system uses
8745 library names with major and minor numbers, then you might want something
8746 like $majmin.  Alternatively, if your system uses a single version
8747 number for shared libraries, then you might want to use $majonly.
8748 Or, your system might be quite happy with a simple libperl.$so.
8749
8750 Since the shared libperl will get installed into a version-specific
8751 architecture-dependent directory, the version number of the shared perl
8752 library probably isn't important, so the default should be o.k.
8753
8754 EOM
8755         rp='What name do you want to give to the shared libperl?'
8756         . ./myread
8757         libperl=$ans
8758         echo "Ok, I'll use $libperl"
8759         ;;
8760 *)
8761         libperl="libperl${_a}"
8762         ;;
8763 esac
8764
8765 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8766 case "$shrpdir" in
8767 '') ;;
8768 *)      $cat >&4 <<EOM
8769 WARNING:  Use of the shrpdir variable for the installation location of
8770 the shared $libperl is not supported.  It was never documented and
8771 will not work in this version.  Let me (perlbug@perl.org)
8772 know of any problems this may cause.
8773
8774 EOM
8775         case "$shrpdir" in
8776         "$archlibexp/CORE")
8777                 $cat >&4 <<EOM
8778 But your current setting of $shrpdir is
8779 the default anyway, so it's harmless.
8780 EOM
8781                 ;;
8782         *)
8783                 $cat >&4 <<EOM
8784 Further, your current attempted setting of $shrpdir
8785 conflicts with the value of $archlibexp/CORE
8786 that installperl will use.
8787 EOM
8788                 ;;
8789         esac
8790         ;;
8791 esac
8792
8793 # How will the perl executable find the installed shared $libperl?
8794 # Add $xxx to ccdlflags.
8795 # If we can't figure out a command-line option, use $shrpenv to
8796 # set env LD_RUN_PATH.  The main perl makefile uses this.
8797 shrpdir=$archlibexp/CORE
8798 xxx=''
8799 tmp_shrpenv=''
8800 if "$useshrplib"; then
8801     case "$osname" in
8802         aix)
8803                 # We'll set it in Makefile.SH...
8804                 ;;
8805         solaris)
8806                 xxx="-R $shrpdir"
8807                 ;;
8808         freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8809                 xxx="-Wl,-R$shrpdir"
8810                 ;;
8811         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8812                 xxx="-Wl,-rpath,$shrpdir"
8813                 ;;
8814         hpux*)
8815                 # hpux doesn't like the default, either.
8816                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8817                 ;;
8818         cygwin)
8819                 # cygwin needs only ldlibpth
8820                 ;;
8821         *)
8822                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8823                 ;;
8824         esac
8825         case "$xxx" in
8826         '') ;;
8827         *)
8828                 # Only add $xxx if it isn't already in ccdlflags.
8829                 case " $ccdlflags " in
8830                 *" $xxx "*)     ;;
8831                 *)      ccdlflags="$ccdlflags $xxx"
8832                         cat <<EOM >&4
8833
8834 Adding $xxx to the flags
8835 passed to $ld so that the perl executable will find the
8836 installed shared $libperl.
8837
8838 EOM
8839                         ;;
8840                 esac
8841                 ;;
8842         esac
8843 fi
8844 # Fix ccdlflags in AIX for building external extensions.
8845 # (For building Perl itself bare -bE:perl.exp is needed,
8846 #  Makefile.SH takes care of this.)
8847 case "$osname" in
8848 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8849 esac
8850 # Respect a hint or command-line value.
8851 case "$shrpenv" in
8852 '') shrpenv="$tmp_shrpenv" ;;
8853 esac
8854 case "$ldlibpthname" in
8855 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8856 none)   ldlibpthname='' ;;
8857 esac
8858
8859 : determine where manual pages are on this system
8860 echo " "
8861 case "$sysman" in
8862 '')
8863         syspath='/usr/share/man/man1 /usr/man/man1'
8864         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8865         syspath="$syspath /usr/man/u_man/man1"
8866         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8867         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8868         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8869         sysman=`./loc . /usr/man/man1 $syspath`
8870         ;;
8871 esac
8872 if $test -d "$sysman"; then
8873         echo "System manual is in $sysman." >&4
8874 else
8875         echo "Could not find manual pages in source form." >&4
8876 fi
8877
8878 : determine where manual pages go
8879 set man1dir man1dir none
8880 eval $prefixit
8881 $cat <<EOM
8882
8883 $spackage has manual pages available in source form.
8884 EOM
8885 case "$nroff" in
8886 nroff)
8887         echo "However, you don't have nroff, so they're probably useless to you."
8888         case "$man1dir" in
8889         '') man1dir="none";;
8890         esac;;
8891 esac
8892 echo "If you don't want the manual sources installed, answer 'none'."
8893 case "$man1dir" in
8894 ' ') dflt=none
8895         ;;
8896 '')
8897         lookpath="$prefixexp/share/man/man1"
8898         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8899         lookpath="$lookpath $prefixexp/man/p_man/man1"
8900         lookpath="$lookpath $prefixexp/man/u_man/man1"
8901         lookpath="$lookpath $prefixexp/man/man.1"
8902         case "$sysman" in
8903         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8904         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8905         esac
8906         set dflt
8907         eval $prefixup
8908         ;;
8909 *)  dflt="$man1dir"
8910         ;;
8911 esac
8912 echo " "
8913 fn=dn+~
8914 rp="Where do the main $spackage manual pages (source) go?"
8915 . ./getfile
8916 if $test "X$man1direxp" != "X$ansexp"; then
8917         installman1dir=''
8918 fi
8919 prefixvar=man1dir
8920 . ./setprefixvar
8921
8922 case "$man1dir" in
8923 '')     man1dir=' '
8924         installman1dir='';;
8925 esac
8926
8927 : What suffix to use on installed man pages
8928
8929 case "$man1dir" in
8930 ' ')
8931         man1ext='0'
8932         ;;
8933 *)
8934         rp="What suffix should be used for the main $spackage man pages?"
8935         case "$man1ext" in
8936         '')     case "$man1dir" in
8937                 *1)  dflt=1 ;;
8938                 *1p) dflt=1p ;;
8939                 *1pm) dflt=1pm ;;
8940                 *l) dflt=l;;
8941                 *n) dflt=n;;
8942                 *o) dflt=o;;
8943                 *p) dflt=p;;
8944                 *C) dflt=C;;
8945                 *L) dflt=L;;
8946                 *L1) dflt=L1;;
8947                 *) dflt=1;;
8948                 esac
8949                 ;;
8950         *)      dflt="$man1ext";;
8951         esac
8952         . ./myread
8953         man1ext="$ans"
8954         ;;
8955 esac
8956
8957 : see if we can have long filenames
8958 echo " "
8959 first=123456789abcdef
8960 $rm -f $first
8961 if (echo hi >$first) 2>/dev/null; then
8962         if $test -f 123456789abcde; then
8963                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8964                 val="$undef"
8965         else
8966                 echo 'You can have filenames longer than 14 characters.'>&4
8967                 val="$define"
8968         fi
8969 else
8970         $cat <<'EOM'
8971 You can't have filenames longer than 14 chars.
8972 You can't even think about them!
8973 EOM
8974         val="$undef"
8975 fi
8976 set d_flexfnam
8977 eval $setvar
8978 $rm -rf 123456789abcde*
8979
8980 : determine where library module manual pages go
8981 set man3dir man3dir none
8982 eval $prefixit
8983 $cat <<EOM
8984
8985 $spackage has manual pages for many of the library modules.
8986 EOM
8987
8988 case "$nroff" in
8989 nroff)
8990         $cat <<'EOM'
8991 However, you don't have nroff, so they're probably useless to you.
8992 EOM
8993         case "$man3dir" in
8994         '') man3dir="none";;
8995         esac;;
8996 esac
8997
8998 case "$d_flexfnam" in
8999 undef)
9000         $cat <<'EOM'
9001 However, your system can't handle the long file names like File::Basename.3.
9002 EOM
9003         case "$man3dir" in
9004         '') man3dir="none";;
9005         esac;;
9006 esac
9007
9008 echo "If you don't want the manual sources installed, answer 'none'."
9009 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9010 case "$man3dir" in
9011 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9012         if $test -d "$privlib/man/man3"; then
9013                 cat <<EOM >&4
9014
9015 WARNING:  Previous versions of perl installed man3 pages into
9016 $privlib/man/man3.  This version will suggest a
9017 new default of $dflt.
9018 EOM
9019                 tdflt=$dflt
9020                 dflt='n'
9021                 rp='Do you wish to preserve the old behavior?(y/n)'
9022                 . ./myread
9023                 case "$ans" in
9024                 y*) dflt="$privlib/man/man3" ;;
9025                 *)  dflt=$tdflt ;;
9026                 esac
9027     fi
9028         ;;
9029 *)      dflt="$man3dir" ;;
9030 esac
9031 case "$dflt" in
9032 ' ') dflt=none ;;
9033 esac
9034 echo " "
9035 fn=dn+~
9036 rp="Where do the $package library man pages (source) go?"
9037 . ./getfile
9038 prefixvar=man3dir
9039 . ./setprefixvar
9040
9041 case "$man3dir" in
9042 '')     man3dir=' '
9043         installman3dir='';;
9044 esac
9045
9046 : What suffix to use on installed man pages
9047 case "$man3dir" in
9048 ' ')
9049         man3ext='0'
9050         ;;
9051 *)
9052         rp="What suffix should be used for the $package library man pages?"
9053         case "$man3ext" in
9054         '')     case "$man3dir" in
9055                 *3)  dflt=3 ;;
9056                 *3p) dflt=3p ;;
9057                 *3pm) dflt=3pm ;;
9058                 *l) dflt=l;;
9059                 *n) dflt=n;;
9060                 *o) dflt=o;;
9061                 *p) dflt=p;;
9062                 *C) dflt=C;;
9063                 *L) dflt=L;;
9064                 *L3) dflt=L3;;
9065                 *) dflt=3;;
9066                 esac
9067                 ;;
9068         *)      dflt="$man3ext";;
9069         esac
9070         . ./myread
9071         man3ext="$ans"
9072         ;;
9073 esac
9074
9075 : see if we have to deal with yellow pages, now NIS.
9076 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9077         case "$hostcat" in
9078         nidump*) ;;
9079         *)
9080                 case "$hostcat" in
9081                 *ypcat*) dflt=y;;
9082                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9083                                 dflt=y
9084                         else
9085                                 dflt=n
9086                         fi;;
9087                 *) dflt=n;;
9088                 esac
9089                 echo " "
9090                 rp='Are you getting the hosts file via yellow pages?'
9091                 . ./myread
9092                 case "$ans" in
9093                 y*) hostcat='ypcat hosts';;
9094                 *) hostcat='cat /etc/hosts';;
9095                 esac
9096                 ;;
9097         esac
9098 fi
9099 case "$hostcat" in
9100 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9101 esac
9102 case "$groupcat" in
9103 '') test -f /etc/group && groupcat='cat /etc/group';;
9104 esac
9105 case "$passcat" in
9106 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9107 esac
9108
9109 : now get the host name
9110 echo " "
9111 echo "Figuring out host name..." >&4
9112 case "$myhostname" in
9113 '') cont=true
9114         echo 'Maybe "hostname" will work...'
9115         if tans=`sh -c hostname 2>&1` ; then
9116                 myhostname=$tans
9117                 phostname=hostname
9118                 cont=''
9119         fi
9120         ;;
9121 *) cont='';;
9122 esac
9123 if $test "$cont"; then
9124         if ./xenix; then
9125                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9126                 if tans=`cat /etc/systemid 2>&1` ; then
9127                         myhostname=$tans
9128                         phostname='cat /etc/systemid'
9129                         echo "Whadyaknow.  Xenix always was a bit strange..."
9130                         cont=''
9131                 fi
9132         elif $test -r /etc/systemid; then
9133                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9134         fi
9135 fi
9136 if $test "$cont"; then
9137         echo 'No, maybe "uuname -l" will work...'
9138         if tans=`sh -c 'uuname -l' 2>&1` ; then
9139                 myhostname=$tans
9140                 phostname='uuname -l'
9141         else
9142                 echo 'Strange.  Maybe "uname -n" will work...'
9143                 if tans=`sh -c 'uname -n' 2>&1` ; then
9144                         myhostname=$tans
9145                         phostname='uname -n'
9146                 else
9147                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9148                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9149                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9150                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9151                         else
9152                                 case "$myhostname" in
9153                                 '') echo "Does this machine have an identity crisis or something?"
9154                                         phostname='';;
9155                                 *)
9156                                         echo "Well, you said $myhostname before..."
9157                                         phostname='echo $myhostname';;
9158                                 esac
9159                         fi
9160                 fi
9161         fi
9162 fi
9163 case "$myhostname" in
9164 '') myhostname=noname ;;
9165 esac
9166 : you do not want to know about this
9167 set $myhostname
9168 myhostname=$1
9169
9170 : verify guess
9171 if $test "$myhostname" ; then
9172         dflt=y
9173         rp='Your host name appears to be "'$myhostname'".'" Right?"
9174         . ./myread
9175         case "$ans" in
9176         y*) ;;
9177         *) myhostname='';;
9178         esac
9179 fi
9180
9181 : bad guess or no guess
9182 while $test "X$myhostname" = X ; do
9183         dflt=''
9184         rp="Please type the (one word) name of your host:"
9185         . ./myread
9186         myhostname="$ans"
9187 done
9188
9189 : translate upper to lower if necessary
9190 case "$myhostname" in
9191 *[A-Z]*)
9192         echo "(Normalizing case in your host name)"
9193         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9194         ;;
9195 esac
9196
9197 case "$myhostname" in
9198 *.*)
9199         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9200         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9201         echo "(Trimming domain name from host name--host name is now $myhostname)"
9202         ;;
9203 *) case "$mydomain" in
9204         '')
9205                 {
9206                         test "X$hostcat" = "Xypcat hosts" &&
9207                         ypmatch "$myhostname" hosts 2>/dev/null |\
9208                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9209                         $test -s hosts
9210                 } || {
9211                         test "X$hostcat" != "X" &&
9212                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9213                                         /[       ]$myhostname[  . ]/p" > hosts
9214                 }
9215                 tmp_re="[       . ]"
9216                 if $test -f hosts; then
9217                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9218                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9219                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9220                                 hosts | $sort | $uniq | \
9221                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9222                         case `$echo X$dflt` in
9223                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9224                                 dflt=.
9225                                 ;;
9226                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9227                                 ;;
9228                         esac
9229                 else
9230                         echo "(I cannot locate a hosts database anywhere)"
9231                         dflt=.
9232                 fi
9233                 case "$dflt" in
9234                 .)
9235                         tans=`./loc resolv.conf X /etc /usr/etc`
9236                         if $test -f "$tans"; then
9237                                 echo "(Attempting domain name extraction from $tans)"
9238                                 dflt=.`$sed -n -e 's/   / /g' \
9239                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9240                                   -e 1q 2>/dev/null`
9241                                 case "$dflt" in
9242                                 .) dflt=.`$sed -n -e 's/        / /g' \
9243                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9244                                      -e 1q 2>/dev/null`
9245                                         ;;
9246                                 esac
9247                         fi
9248                         ;;
9249                 esac
9250                 case "$dflt" in
9251                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9252                         dflt=.`sh -c domainname 2>/dev/null`
9253                         case "$dflt" in
9254                         '') dflt='.';;
9255                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9256                         esac
9257                         ;;
9258                 esac
9259                 case "$dflt$osname" in
9260                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9261                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9262                         ;;
9263                 esac
9264                 case "$dflt" in
9265                 .) echo "(Lost all hope -- silly guess then)"
9266                         dflt='.nonet'
9267                         ;;
9268                 esac
9269                 $rm -f hosts
9270                 ;;
9271         *) dflt="$mydomain";;
9272         esac;;
9273 esac
9274 echo " "
9275 rp="What is your domain name?"
9276 . ./myread
9277 tans="$ans"
9278 case "$ans" in
9279 '') ;;
9280 .*) ;;
9281 *) tans=".$tans";;
9282 esac
9283 mydomain="$tans"
9284
9285 : translate upper to lower if necessary
9286 case "$mydomain" in
9287 *[A-Z]*)
9288         echo "(Normalizing case in your domain name)"
9289         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9290         ;;
9291 esac
9292
9293 : a little sanity check here
9294 case "$phostname" in
9295 '') ;;
9296 *)
9297         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9298         $myhostname$mydomain|$myhostname) ;;
9299         *)
9300                 case "$phostname" in
9301                 sed*)
9302                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9303                         ;;
9304                 *)
9305                         echo "(That doesn't agree with your $phostname command, by the way.)"
9306                         ;;
9307                 esac
9308         ;;
9309         esac
9310         ;;
9311 esac
9312
9313 : determine the e-mail address of the user who is running us
9314 $cat <<EOM
9315
9316 I need to get your e-mail address in Internet format if possible, i.e.
9317 something like user@host.domain. Please answer accurately since I have
9318 no easy means to double check it. The default value provided below
9319 is most probably close to reality but may not be valid from outside
9320 your organization...
9321
9322 EOM
9323 cont=x
9324 while test "$cont"; do
9325         case "$MAILDOMAIN" in
9326         '')
9327                 if $test -s /etc/mailname; then
9328                         maildomain=`$cat /etc/mailname`
9329                 else
9330                         maildomain="$myhostname$mydomain"
9331                 fi
9332                 ;;
9333         *)  maildomain="$MAILDOMAIN";;
9334         esac
9335         case "$cf_email" in
9336         '') dflt="$cf_by@$maildomain";;
9337         *)  dflt="$cf_email";;
9338         esac
9339         rp='What is your e-mail address?'
9340         . ./myread
9341         cf_email="$ans"
9342         case "$cf_email" in
9343         *@*.*) cont='' ;;
9344         *)
9345                 rp='Address does not look like an Internet one.  Use it anyway?'
9346                 case "$fastread" in
9347                 yes) dflt=y ;;
9348                 *) dflt=n ;;
9349                 esac
9350                 . ./myread
9351                 case "$ans" in
9352                 y*) cont='' ;;
9353                 *) echo " " ;;
9354                 esac
9355                 ;;
9356         esac
9357 done
9358
9359 : Ask e-mail of administrator
9360 $cat <<EOM
9361
9362 If you or somebody else will be maintaining perl at your site, please
9363 fill in the correct e-mail address here so that they may be contacted
9364 if necessary. Currently, the "perlbug" program included with perl
9365 will send mail to this address in addition to perlbug@perl.org. You may
9366 enter "none" for no administrator.
9367
9368 EOM
9369 case "$perladmin" in
9370 '') dflt="$cf_email";;
9371 *) dflt="$perladmin";;
9372 esac
9373 rp='Perl administrator e-mail address'
9374 . ./myread
9375 perladmin="$ans"
9376
9377 : determine whether to use a version number suffix for installed binaries
9378 echo " "
9379 $cat <<EOM
9380 Do you want to use a version number suffix for installed binaries? This
9381 will install 'perl$version' instead of 'perl', and likewise for other
9382 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9383 to be installed side-by-side. Unless you are a developer, you probably
9384 do *not* want to do this.
9385 EOM
9386 case "$versiononly" in
9387 "$define"|[Yy]*|true) dflt='y' ;;
9388 *) dflt='n';
9389 esac
9390 rp="Do you want to use a version number suffix for installed binaries?"
9391 . ./myread
9392 case "$ans" in
9393 [yY]*)  val="$define";;
9394 *)      val="$undef" ;;
9395 esac
9396 set versiononly
9397 eval $setvar
9398
9399 case "$versiononly" in
9400 "$define") inc_version_list=''
9401            inc_version_list_init=0
9402            ;;
9403 esac
9404
9405 : figure out how to guarantee perl startup
9406 : XXX Note that this currently takes advantage of the bug that binexp ignores
9407 :     the Configure -Dinstallprefix setting, which in turn means that under
9408 :     relocatable @INC, initialinstalllocation is what binexp started as.
9409 case "$startperl" in
9410 '')
9411         case "$sharpbang" in
9412         *!)
9413                 $cat <<EOH
9414
9415 I can use the #! construct to start perl on your system. This will
9416 make startup of perl scripts faster, but may cause problems if you
9417 want to share those scripts and perl is not in a standard place
9418 ($initialinstalllocation/perl) on all your platforms. The alternative
9419 is to force a shell by starting the script with a single ':' character.
9420
9421 EOH
9422                 case "$versiononly" in
9423                 "$define")      dflt="$initialinstalllocation/perl$version";;
9424                 *)              dflt="$initialinstalllocation/perl";;
9425                 esac
9426                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9427                 . ./myread
9428                 case "$ans" in
9429                 none)   startperl=": # use perl";;
9430                 *)      startperl="#!$ans"
9431                         if $test 30 -lt `echo "$ans" | wc -c`; then
9432                                 $cat >&4 <<EOM
9433
9434 WARNING:  Some systems limit the #! command to 32 characters.
9435 If you experience difficulty running Perl scripts with #!, try
9436 installing Perl in a directory with a shorter pathname.
9437
9438 EOM
9439                         fi ;;
9440                 esac
9441                 ;;
9442         *) startperl=": # use perl"
9443                 ;;
9444         esac
9445         ;;
9446 esac
9447 echo "I'll use $startperl to start perl scripts."
9448
9449 : figure best path for perl in scripts
9450 case "$perlpath" in
9451 '')
9452         case "$versiononly" in
9453         "$define")      perlpath="$initialinstalllocation/perl$version";;
9454         *)              perlpath="$initialinstalllocation/perl";;
9455         esac
9456         case "$startperl" in
9457         *!*) ;;
9458         *)
9459                 $cat <<EOH
9460
9461 I will use the "eval 'exec'" idiom to start Perl on your system.
9462 I can use the full path of your Perl binary for this purpose, but
9463 doing so may cause problems if you want to share those scripts and
9464 Perl is not always in a standard place ($initialinstalllocation/perl).
9465
9466 EOH
9467                 dflt="$initialinstalllocation/perl"
9468                 rp="What path shall I use in \"eval 'exec'\"?"
9469                 . ./myread
9470                 perlpath="$ans"
9471                 ;;
9472         esac
9473         ;;
9474 esac
9475 case "$startperl" in
9476 *!*)    ;;
9477 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9478 esac
9479
9480 : determine where public executable scripts go
9481 set scriptdir scriptdir
9482 eval $prefixit
9483 case "$scriptdir" in
9484 '')
9485         dflt="$bin"
9486         : guess some guesses
9487         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9488         $test -d /usr/share/bin     && dflt=/usr/share/bin
9489         $test -d /usr/local/script  && dflt=/usr/local/script
9490         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9491         $test -d $prefixexp/script  && dflt=$prefixexp/script
9492         set dflt
9493         eval $prefixup
9494         ;;
9495 *)  dflt="$scriptdir"
9496         ;;
9497 esac
9498 $cat <<EOM
9499
9500 Some installations have a separate directory just for executable scripts so
9501 that they can mount it across multiple architectures but keep the scripts in
9502 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9503 Or you might just lump your scripts in with all your other executables.
9504
9505 EOM
9506 fn=d~
9507 rp='Where do you keep publicly executable scripts?'
9508 . ./getfile
9509 if $test "X$ansexp" != "X$scriptdirexp"; then
9510         installscript=''
9511 fi
9512 installscriptdir=''
9513 prefixvar=scriptdir
9514 . ./setprefixvar
9515 : A little fix up for an irregularly named variable.
9516 installscript="$installscriptdir"
9517
9518 : determine where add-on public executables go
9519 case "$sitebin" in
9520 '')     dflt=$siteprefix/bin ;;
9521 *)      dflt=$sitebin ;;
9522 esac
9523 fn=d~
9524 rp='Pathname where the add-on public executables should be installed?'
9525 . ./getfile
9526 prefixvar=sitebin
9527 . ./setprefixvar
9528
9529 : determine where add-on html pages go
9530 : There is no standard location, so try to copy the previously-selected
9531 : directory structure for the core html pages.
9532 case "$sitehtml1dir" in
9533 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9534 *)     dflt=$sitehtml1dir ;;
9535 esac
9536 case "$dflt" in
9537 ''|' ') dflt=none ;;
9538 esac
9539 fn=dn+~
9540 rp='Pathname where the site-specific html pages should be installed?'
9541 . ./getfile
9542 prefixvar=sitehtml1dir
9543 . ./setprefixvar
9544
9545 : determine where add-on library html pages go
9546 : There is no standard location, so try to copy the previously-selected
9547 : directory structure for the core html pages.
9548 case "$sitehtml3dir" in
9549 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9550 *)     dflt=$sitehtml3dir ;;
9551 esac
9552 case "$dflt" in
9553 ''|' ') dflt=none ;;
9554 esac
9555 fn=dn+~
9556 rp='Pathname where the site-specific library html pages should be installed?'
9557 . ./getfile
9558 prefixvar=sitehtml3dir
9559 . ./setprefixvar
9560
9561 : determine where add-on manual pages go
9562 case "$siteman1dir" in
9563 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9564 *)      dflt=$siteman1dir ;;
9565 esac
9566 case "$dflt" in
9567 ''|' ') dflt=none ;;
9568 esac
9569 fn=dn+~
9570 rp='Pathname where the site-specific manual pages should be installed?'
9571 . ./getfile
9572 prefixvar=siteman1dir
9573 . ./setprefixvar
9574
9575 : determine where add-on library man pages go
9576 case "$siteman3dir" in
9577 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9578 *)      dflt=$siteman3dir ;;
9579 esac
9580 case "$dflt" in
9581 ''|' ') dflt=none ;;
9582 esac
9583 fn=dn+~
9584 rp='Pathname where the site-specific library manual pages should be installed?'
9585 . ./getfile
9586 prefixvar=siteman3dir
9587 . ./setprefixvar
9588
9589 : determine where add-on public executable scripts go
9590 case "$sitescript" in
9591 '')     dflt=$siteprefix/script
9592         $test -d $dflt || dflt=$sitebin ;;
9593 *)  dflt="$sitescript" ;;
9594 esac
9595 fn=d~+
9596 rp='Pathname where add-on public executable scripts should be installed?'
9597 . ./getfile
9598 prefixvar=sitescript
9599 . ./setprefixvar
9600
9601 : see if backtrace exists
9602 set backtrace d_backtrace
9603 eval $inlibc
9604
9605 : add flags if using c backtrace
9606 case "$usecbacktrace" in
9607   "") usecbacktrace=$undef ;;
9608   [yY]*|true|$define)
9609     case "$d_backtrace" in
9610       [yY]*|true|$define)
9611         case " $ccflags " in
9612           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9613           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9614           esac
9615         ;;
9616       *)
9617         echo "This system does not support backtrace" >&4
9618         usecbacktrace=$undef
9619         ;;
9620       esac
9621     ;;
9622   esac
9623
9624 : Check if faststdio is requested and available
9625 case "$usefaststdio" in
9626 $define|true|[yY]*|'')
9627         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9628         case "$xversion" in
9629         [68])   dflt='y' ;;
9630         *)      dflt='n' ;;
9631         esac
9632         ;;
9633 *) dflt='n';;
9634 esac
9635 cat <<EOM
9636
9637 Perl can be built to use 'fast stdio', which means using the stdio
9638 library but also directly manipulating the stdio buffers to enable
9639 faster I/O.  Using stdio is better for backward compatibility (especially
9640 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9641 interface has been preferred instead of stdio.
9642
9643 If this doesn't make any sense to you, just accept the default '$dflt'.
9644 EOM
9645 rp='Use the "fast stdio" if available?'
9646 . ./myread
9647 case "$ans" in
9648 y|Y)    val="$define" ;;
9649 *)      val="$undef" ;;
9650 esac
9651 set usefaststdio
9652 eval $setvar
9653
9654 : define an is-a-typedef? function
9655 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9656 case "$inclist" in
9657 "") inclist="sys/types.h";;
9658 esac;
9659 eval "varval=\$$var";
9660 case "$varval" in
9661 "")
9662         $rm -f temp.c;
9663         for inc in $inclist; do
9664                 echo "#include <$inc>" >>temp.c;
9665         done;
9666         echo "#ifdef $type" >> temp.c;
9667         echo "printf(\"We have $type\");" >> temp.c;
9668         echo "#endif" >> temp.c;
9669         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9670         if $contains $type temp.E >/dev/null 2>&1; then
9671                 eval "$var=\$type";
9672         else
9673                 eval "$var=\$def";
9674         fi;
9675         $rm -f temp.?;;
9676 *) eval "$var=\$varval";;
9677 esac'
9678
9679 : define an is-a-typedef? function that prompts if the type is not available.
9680 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9681 case "$inclist" in
9682 "") inclist="sys/types.h";;
9683 esac;
9684 eval "varval=\$$var";
9685 case "$varval" in
9686 "")
9687         $rm -f temp.c;
9688         for inc in $inclist; do
9689                 echo "#include <$inc>" >>temp.c;
9690         done;
9691         echo "#ifdef $type" >> temp.c;
9692         echo "printf(\"We have $type\");" >> temp.c;
9693         echo "#endif" >> temp.c;
9694         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9695         echo " " ;
9696         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9697         if $contains $type temp.E >/dev/null 2>&1; then
9698                 echo "$type found." >&4;
9699                 eval "$var=\$type";
9700         else
9701                 echo "$type NOT found." >&4;
9702                 dflt="$def";
9703                 . ./myread ;
9704                 eval "$var=\$ans";
9705         fi;
9706         $rm -f temp.?;;
9707 *) eval "$var=\$varval";;
9708 esac'
9709
9710 : see what type lseek is declared as in the kernel
9711 rp="What is the type used for lseek's offset on this system?"
9712 set off_t lseektype long stdio.h sys/types.h
9713 eval $typedef_ask
9714
9715 echo " "
9716 echo "Checking to see how big your file offsets are..." >&4
9717 $cat >try.c <<EOCP
9718 #include <sys/types.h>
9719 #include <stdio.h>
9720 int main()
9721 {
9722     printf("%d\n", (int)sizeof($lseektype));
9723     return(0);
9724 }
9725 EOCP
9726 set try
9727 if eval $compile_ok; then
9728         lseeksize=`$run ./try`
9729         echo "Your file offsets are $lseeksize bytes long."
9730 else
9731         dflt=$longsize
9732         echo " "
9733         echo "(I can't seem to compile the test program.  Guessing...)"
9734         rp="What is the size of your file offsets (in bytes)?"
9735         . ./myread
9736         lseeksize="$ans"
9737 fi
9738 $rm_try
9739
9740 : see what type file positions are declared as in the library
9741 rp="What is the type for file position used by fsetpos()?"
9742 set fpos_t fpostype long stdio.h sys/types.h
9743 eval $typedef_ask
9744
9745 : Check size for Fpos_t
9746 echo " "
9747 case "$fpostype" in
9748 *_t) zzz="$fpostype"    ;;
9749 *)   zzz="fpos_t"       ;;
9750 esac
9751 echo "Checking the size of $zzz..." >&4
9752 cat > try.c <<EOCP
9753 #include <sys/types.h>
9754 #include <stdio.h>
9755 #$i_stdlib I_STDLIB
9756 #ifdef I_STDLIB
9757 #include <stdlib.h>
9758 #endif
9759 int main() {
9760     printf("%d\n", (int)sizeof($fpostype));
9761     exit(0);
9762 }
9763 EOCP
9764 set try
9765 if eval $compile_ok; then
9766         yyy=`$run ./try`
9767         case "$yyy" in
9768         '')     fpossize=4
9769                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9770                 ;;
9771         *)      fpossize=$yyy
9772                 echo "Your $zzz is $fpossize bytes long."
9773                 ;;
9774         esac
9775 else
9776         dflt="$longsize"
9777         echo " " >&4
9778         echo "(I can't compile the test program.  Guessing...)" >&4
9779         rp="What is the size of your file positions (in bytes)?"
9780         . ./myread
9781         fpossize="$ans"
9782 fi
9783
9784 : Check for large file support
9785 # Backward compatibility (uselfs is deprecated).
9786 case "$uselfs" in
9787 "$define"|true|[yY]*)
9788         cat <<EOM >&4
9789
9790 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9791 EOM
9792         uselargefiles="$define"
9793         ;;
9794 esac
9795
9796 case "$lseeksize:$fpossize" in
9797 8:8) cat <<EOM
9798
9799 You can have files larger than 2 gigabytes.
9800 EOM
9801    val="$define" ;;
9802 *)    case "$uselargefiles" in
9803    "$undef"|false|[nN]*) dflt='n' ;;
9804    *)   dflt='y' ;;
9805    esac
9806    cat <<EOM
9807
9808 Perl can be built to understand large files (files larger than 2 gigabytes)
9809 on some systems.  To do so, Configure can be run with -Duselargefiles.
9810
9811 If this doesn't make any sense to you, just accept the default '$dflt'.
9812 EOM
9813    rp='Try to understand large files, if available?'
9814    . ./myread
9815    case "$ans" in
9816    y|Y) val="$define" ;;
9817    *)   val="$undef"  ;;
9818    esac
9819    ;;
9820 esac
9821 set uselargefiles
9822 eval $setvar
9823 : Look for a hint-file generated 'call-back-unit'.  If the
9824 : user has specified that a large files perl is to be built,
9825 : we may need to set or change some other defaults.
9826 if $test -f uselargefiles.cbu; then
9827         echo "Your platform has some specific hints regarding large file builds, using them..."
9828         . ./uselargefiles.cbu
9829 fi
9830 case "$uselargefiles" in
9831 "$define")
9832         if $test -f uselargefiles.cbu; then
9833                 echo " "
9834                 echo "Rechecking to see how big your file offsets are..." >&4
9835                 $cat >try.c <<EOCP
9836 #include <sys/types.h>
9837 #include <stdio.h>
9838 int main()
9839 {
9840     printf("%d\n", (int)sizeof($lseektype));
9841     return(0);
9842 }
9843 EOCP
9844                 set try
9845                 if eval $compile_ok; then
9846                         lseeksize=`$run ./try`
9847                         $echo "Your file offsets are now $lseeksize bytes long."
9848                 else
9849                         dflt="$lseeksize"
9850                         echo " "
9851                         echo "(I can't seem to compile the test program.  Guessing...)"
9852                         rp="What is the size of your file offsets (in bytes)?"
9853                         . ./myread
9854                         lseeksize="$ans"
9855                 fi
9856                 case "$fpostype" in
9857                 *_t) zzz="$fpostype"    ;;
9858                 *)   zzz="fpos_t"       ;;
9859                 esac
9860                 $echo $n "Rechecking the size of $zzz...$c" >&4
9861                 $cat > try.c <<EOCP
9862 #include <sys/types.h>
9863 #include <stdio.h>
9864 #$i_stdlib I_STDLIB
9865 #ifdef I_STDLIB
9866 #include <stdlib.h>
9867 #endif
9868 int main() {
9869     printf("%d\n", (int)sizeof($fpostype));
9870     return(0);
9871 }
9872 EOCP
9873                 set try
9874                 if eval $compile_ok; then
9875                         yyy=`$run ./try`
9876                         dflt="$lseeksize"
9877                         case "$yyy" in
9878                         '')     echo " "
9879                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9880                                 ;;
9881                         *)      fpossize=$yyy
9882                                 echo " $fpossize bytes." >&4
9883                                 ;;
9884                         esac
9885                 else
9886                         dflt="$fpossize"
9887                         echo " "
9888                         echo "(I can't compile the test program.  Guessing...)" >&4
9889                         rp="What is the size of your file positions (in bytes)?"
9890                         . ./myread
9891                         fpossize="$ans"
9892                 fi
9893                 $rm_try
9894         fi
9895         ;;
9896 esac
9897
9898 : Check if we want perlio
9899 useperlio="$define"
9900
9901 : Set the vendorbin variables
9902 case "$vendorprefix" in
9903 '')     d_vendorbin="$undef"
9904         vendorbin=''
9905         vendorbinexp=''
9906         ;;
9907 *)      d_vendorbin="$define"
9908         : determine where vendor-supplied executables go.
9909         case "$vendorbin" in
9910         '') dflt=$vendorprefix/bin ;;
9911         *)      dflt="$vendorbin" ;;
9912         esac
9913         fn=d~+
9914         rp='Pathname for the vendor-supplied executables directory?'
9915         . ./getfile
9916         vendorbin="$ans"
9917         vendorbinexp="$ansexp"
9918         ;;
9919 esac
9920 prefixvar=vendorbin
9921 . ./installprefix
9922
9923 : Set the vendorhtml1dir variables
9924 case "$vendorprefix" in
9925 '')     vendorhtml1dir=''
9926         vendorhtml1direxp=''
9927         ;;
9928 *)      : determine where vendor-supplied html pages go.
9929         : There is no standard location, so try to copy the previously-selected
9930         : directory structure for the core html pages.
9931         : XXX Better default suggestions would be welcome.
9932         case "$vendorhtml1dir" in
9933         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9934         *)      dflt=$vendorhtml1dir ;;
9935         esac
9936         case "$dflt" in
9937         ''|' ') dflt=none ;;
9938         esac
9939         fn=dn+~
9940         rp='Pathname for the vendor-supplied html pages?'
9941         . ./getfile
9942         vendorhtml1dir="$ans"
9943         vendorhtml1direxp="$ansexp"
9944         ;;
9945 esac
9946 : Use ' ' for none so value is preserved next time through Configure
9947 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9948 prefixvar=vendorhtml1dir
9949 . ./installprefix
9950
9951 : Set the vendorhtml3dir variables
9952 case "$vendorprefix" in
9953 '')     vendorhtml3dir=''
9954         vendorhtml3direxp=''
9955         ;;
9956 *)      : determine where vendor-supplied module html pages go.
9957         : There is no standard location, so try to copy the previously-selected
9958         : directory structure for the core html pages.
9959         : XXX Better default suggestions would be welcome.
9960         case "$vendorhtml3dir" in
9961         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9962         *)      dflt=$vendorhtml3dir ;;
9963         esac
9964         case "$dflt" in
9965         ''|' ') dflt=none ;;
9966         esac
9967         fn=dn+~
9968         rp='Pathname for the vendor-supplied html pages?'
9969         . ./getfile
9970         vendorhtml3dir="$ans"
9971         vendorhtml3direxp="$ansexp"
9972         ;;
9973 esac
9974 : Use ' ' for none so value is preserved next time through Configure
9975 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9976 prefixvar=vendorhtml3dir
9977 . ./installprefix
9978
9979 : Set the vendorman1dir variables
9980 case "$vendorprefix" in
9981 '')     vendorman1dir=''
9982         vendorman1direxp=''
9983         ;;
9984 *)      : determine where vendor-supplied manual pages go.
9985         case "$vendorman1dir" in
9986         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9987         *)      dflt=$vendorman1dir ;;
9988         esac
9989         case "$dflt" in
9990         ''|' ') dflt=none ;;
9991         esac
9992         fn=nd~+
9993         rp='Pathname for the vendor-supplied manual section 1 pages?'
9994         . ./getfile
9995         vendorman1dir="$ans"
9996         vendorman1direxp="$ansexp"
9997         ;;
9998 esac
9999 : Use ' ' for none so value is preserved next time through Configure
10000 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10001 prefixvar=vendorman1dir
10002 . ./installprefix
10003
10004 : Set the vendorman3dir variables
10005 case "$vendorprefix" in
10006 '')     vendorman3dir=''
10007         vendorman3direxp=''
10008         ;;
10009 *)      : determine where vendor-supplied module manual pages go.
10010         case "$vendorman3dir" in
10011         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10012         *)      dflt=$vendorman3dir ;;
10013         esac
10014         case "$dflt" in
10015         ''|' ') dflt=none ;;
10016         esac
10017         fn=nd~+
10018         rp='Pathname for the vendor-supplied manual section 3 pages?'
10019         . ./getfile
10020         vendorman3dir="$ans"
10021         vendorman3direxp="$ansexp"
10022         ;;
10023 esac
10024 : Use ' ' for none so value is preserved next time through Configure
10025 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10026 prefixvar=vendorman3dir
10027 . ./installprefix
10028
10029 : Set the vendorscript variables
10030 case "$vendorprefix" in
10031 '')     d_vendorscript="$undef"
10032         vendorscript=''
10033         vendorscriptexp=''
10034         ;;
10035 *)      d_vendorscript="$define"
10036         : determine where vendor-supplied scripts go.
10037         case "$vendorscript" in
10038         '')     dflt=$vendorprefix/script
10039                 $test -d $dflt || dflt=$vendorbin ;;
10040         *)  dflt="$vendorscript" ;;
10041         esac
10042         $cat <<EOM
10043
10044 The installation process will create a directory for
10045 vendor-supplied scripts.
10046
10047 EOM
10048         fn=d~+
10049         rp='Pathname for the vendor-supplied scripts directory?'
10050         . ./getfile
10051         vendorscript="$ans"
10052         vendorscriptexp="$ansexp"
10053         ;;
10054 esac
10055 prefixvar=vendorscript
10056 . ./installprefix
10057
10058 : see if qgcvt exists
10059 set qgcvt d_qgcvt
10060 eval $inlibc
10061
10062 : Check what kind of doubles your system has
10063 $echo "Checking the kind of doubles you have..." >&4
10064 $cat >try.c <<EOP
10065 #$i_stdlib I_STDLIB
10066 #define DOUBLESIZE $doublesize
10067 #ifdef I_STDLIB
10068 #include <stdlib.h>
10069 #endif
10070 #include <stdio.h>
10071 static const double d = -0.1;
10072 int main() {
10073   unsigned const char* b = (unsigned const char*)(&d);
10074 #if DOUBLESIZE == 4
10075   if (b[0] == 0xCD && b[3] == 0xBD) {
10076     /* IEEE 754 32-bit little-endian */
10077     printf("1\n");
10078     exit(0);
10079   }
10080   if (b[0] == 0xBD && b[3] == 0xCD) {
10081     /* IEEE 754 32-bit big-endian */
10082     printf("2\n");
10083     exit(0);
10084   }
10085   if (b[0] == 0xCC && b[3] == 0xCC) {
10086     /* VAX format F, 32-bit PDP-style mixed endian. */
10087     printf("9\n");
10088     exit(0);
10089   }
10090   if (b[0] == 0xC0 && b[3] == 0x9A) {
10091     /* IBM single 32-bit */
10092     printf("12\n");
10093     exit(0);
10094   }
10095 #endif
10096 #if DOUBLESIZE == 8
10097   if (b[0] == 0x9A && b[7] == 0xBF) {
10098     /* IEEE 754 64-bit little-endian */
10099     printf("3\n");
10100     exit(0);
10101   }
10102   if (b[0] == 0xBF && b[7] == 0x9A) {
10103     /* IEEE 754 64-bit big-endian */
10104     printf("4\n");
10105     exit(0);
10106   }
10107   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10108    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10109     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10110     * 99 99 b9 bf 9a 99 99 99 */
10111     printf("7\n");
10112     exit(0);
10113   }
10114   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10115    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10116     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10117     * 99 99 99 9a bf b9 99 99 */
10118     printf("8\n");
10119     exit(0);
10120   }
10121   if (b[0] == 0xCC && b[7] == 0xCC) {
10122    /* VAX format D, 64-bit PDP-style mixed endian. */
10123     printf("10\n");
10124     exit(0);
10125   }
10126   if (b[0] == 0xD9 && b[7] == 0x99) {
10127    /* VAX format G, 64-bit PDP-style mixed endian. */
10128     printf("11\n");
10129     exit(0);
10130   }
10131   if (b[0] == 0xC0 && b[7] == 0x9A) {
10132     /* IBM double 64-bit */
10133     printf("13\n");
10134     exit(0);
10135   }
10136   if (b[0] == 0xBF && b[7] == 0xCD) {
10137     /* CRAY single 64-bit */
10138     printf("14\n");
10139     exit(0);
10140   }
10141 #endif
10142 #if DOUBLESIZE == 16
10143   if (b[0] == 0x9A && b[15] == 0xBF) {
10144     /* IEEE 754 128-bit little-endian */
10145     printf("5\n");
10146     exit(0);
10147   }
10148   if (b[0] == 0xBF && b[15] == 0x9A) {
10149     /* IEEE 754 128-bit big-endian */
10150     printf("6\n");
10151     exit(0);
10152   }
10153 #endif
10154   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10155    * Whether those environments can still build Perl is debatable. */
10156   printf("-1\n"); /* unknown */
10157   exit(0);
10158 }
10159 EOP
10160 set try
10161 if eval $compile; then
10162     doublekind=`$run ./try`
10163 else
10164     doublekind=-1
10165 fi
10166 case "$doublekind" in
10167 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10168 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10169 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10170 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10171 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10172 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10173 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10174 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10175 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10176 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10177 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10178 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10179 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10180 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10181 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10182 esac
10183 d_double_style_ieee=$undef
10184 d_double_style_vax=$undef
10185 d_double_style_ibm=$undef
10186 d_double_style_cray=$undef
10187 case "$doublekind" in
10188 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10189 9|10|11) d_double_style_vax=$define ;;
10190 12|13) d_double_style_ibm=$define ;;
10191 14) d_double_style_cray=$define ;;
10192 esac
10193 case "$d_double_style_ieee" in
10194 $define)
10195     d_double_has_inf=$define
10196     d_double_has_nan=$define
10197     d_double_has_negative_zero=$define
10198     d_double_has_subnormals=$define
10199     ;;
10200 *)
10201     d_double_has_inf=$undef
10202     d_double_has_nan=$undef
10203     d_double_has_negative_zero=$undef
10204     d_double_has_subnormals=$undef
10205     ;;
10206 esac
10207 $rm_try
10208
10209 : Check print/scan long double stuff
10210 echo " "
10211
10212 if $test X"$d_longdbl" = X"$define"; then
10213
10214 echo "Checking how to print long doubles..." >&4
10215
10216 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10217         $cat >try.c <<'EOCP'
10218 #include <sys/types.h>
10219 #include <stdio.h>
10220 int main() {
10221   double d = 123.456;
10222   printf("%.3f\n", d);
10223 }
10224 EOCP
10225         set try
10226         if eval $compile; then
10227                 yyy=`$run ./try`
10228                 case "$yyy" in
10229                 123.456)
10230                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10231                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10232                         echo "We will use %f."
10233                         ;;
10234                 esac
10235         fi
10236 fi
10237
10238 if $test X"$sPRIfldbl" = X; then
10239         $cat >try.c <<'EOCP'
10240 #include <sys/types.h>
10241 #include <stdio.h>
10242 int main() {
10243   long double d = 123.456;
10244   printf("%.3Lf\n", d);
10245 }
10246 EOCP
10247         set try
10248         if eval $compile; then
10249                 yyy=`$run ./try`
10250                 case "$yyy" in
10251                 123.456)
10252                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10253                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10254                         echo "We will use %Lf."
10255                         ;;
10256                 esac
10257         fi
10258 fi
10259
10260 if $test X"$sPRIfldbl" = X; then
10261         $cat >try.c <<'EOCP'
10262 #include <sys/types.h>
10263 #include <stdio.h>
10264 int main() {
10265   long double d = 123.456;
10266   printf("%.3llf\n", d);
10267 }
10268 EOCP
10269         set try
10270         if eval $compile; then
10271                 yyy=`$run ./try`
10272                 case "$yyy" in
10273                 123.456)
10274                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10275                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10276                         echo "We will use %llf."
10277                         ;;
10278                 esac
10279         fi
10280 fi
10281
10282 if $test X"$sPRIfldbl" = X; then
10283         $cat >try.c <<'EOCP'
10284 #include <sys/types.h>
10285 #include <stdio.h>
10286 int main() {
10287   long double d = 123.456;
10288   printf("%.3lf\n", d);
10289 }
10290 EOCP
10291         set try
10292         if eval $compile; then
10293                 yyy=`$run ./try`
10294                 case "$yyy" in
10295                 123.456)
10296                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10297                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10298                         echo "We will use %lf."
10299                         ;;
10300                 esac
10301         fi
10302 fi
10303
10304 if $test X"$sPRIfldbl" = X; then
10305         echo "Cannot figure out how to print long doubles." >&4
10306 else
10307         sSCNfldbl=$sPRIfldbl    # expect consistency
10308 fi
10309
10310 $rm_try
10311
10312 fi # d_longdbl
10313
10314 case "$sPRIfldbl" in
10315 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10316         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10317         d_SCNfldbl="$undef";
10318         ;;
10319 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10320         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10321         d_SCNfldbl="$define";
10322         ;;
10323 esac
10324
10325 : Before committing on uselongdouble, see whether that looks sane.
10326 if $test "$uselongdouble" = "$define"; then
10327     message=""
10328     echo " "
10329     echo "Checking if your long double math functions work right..." >&4
10330     $cat > try.c <<EOF
10331 #include <math.h>
10332 #include <stdio.h>
10333 int main() {
10334   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10335 }
10336 EOF
10337     case "$osname:$gccversion" in
10338     aix:)       saveccflags="$ccflags"
10339                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10340     esac
10341     set try
10342     if eval $compile_ok; then
10343       yyy=`$run ./try`
10344     fi
10345     case "$yyy" in
10346     3) echo "Your long double math functions are working correctly." >&4 ;;
10347     *) echo "Your long double math functions are broken, not using long doubles." >&4
10348        uselongdouble=$undef
10349        ;;
10350     esac
10351     $rm_try
10352     case "$osname:$gccversion" in
10353     aix:)       ccflags="$saveccflags" ;; # restore
10354     esac
10355 fi
10356
10357 : Check how to convert floats to strings.
10358
10359 if test "X$d_Gconvert" = X; then
10360
10361 echo " "
10362 echo "Checking for an efficient way to convert floats to strings."
10363 echo " " > try.c
10364 case "$uselongdouble" in
10365 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10366 esac
10367 case "$d_longdbl" in
10368 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10369 esac
10370 case "$d_PRIgldbl" in
10371 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10372 esac
10373 $cat >>try.c <<EOP
10374 #ifdef TRY_gconvert
10375 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10376 char *myname = "gconvert";
10377 #endif
10378 #ifdef TRY_gcvt
10379 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10380 char *myname = "gcvt";
10381 #endif
10382 #ifdef TRY_qgcvt
10383 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10384 char *myname = "qgcvt";
10385 #define DOUBLETYPE long double
10386 #endif
10387 #ifdef TRY_sprintf
10388 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10389 #ifdef HAS_PRIgldbl
10390 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10391 #else
10392 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10393 #endif
10394 #else
10395 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10396 #endif
10397 char *myname = "sprintf";
10398 #endif
10399
10400 #ifndef DOUBLETYPE
10401 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10402 #define DOUBLETYPE long double
10403 #else
10404 #define DOUBLETYPE double
10405 #endif
10406 #endif
10407
10408 #include <stdio.h>
10409
10410 #$i_stdlib I_STDLIB
10411 #ifdef I_STDLIB
10412 #include <stdlib.h>
10413 #endif
10414 #include <string.h>
10415
10416 int checkit(char *expect, char *got)
10417 {
10418     if (strcmp(expect, got)) {
10419                 printf("%s oddity:  Expected %s, got %s\n",
10420                         myname, expect, got);
10421                 exit(1);
10422         }
10423 }
10424
10425 int main()
10426 {
10427         char buf[64];
10428         buf[63] = '\0';
10429
10430         /* This must be 1st test on (which?) platform */
10431         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10432         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10433         checkit("0.1", buf);
10434
10435         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10436         checkit("0.01", buf);
10437
10438         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10439         checkit("0.001", buf);
10440
10441         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10442         checkit("0.0001", buf);
10443
10444         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10445         if (strlen(buf) > 5)
10446             checkit("9e-005", buf); /* for Microsoft ?? */
10447         else
10448             checkit("9e-05", buf);
10449
10450         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10451         checkit("1", buf);
10452
10453         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10454         checkit("1.1", buf);
10455
10456         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10457         checkit("1.01", buf);
10458
10459         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10460         checkit("1.001", buf);
10461
10462         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10463         checkit("1.0001", buf);
10464
10465         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10466         checkit("1.00001", buf);
10467
10468         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10469         checkit("1.000001", buf);
10470
10471         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10472         checkit("0", buf);
10473
10474         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10475         checkit("-1", buf);
10476
10477         /* Some Linux gcvt's give 1.e+5 here. */
10478         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10479         checkit("100000", buf);
10480
10481         /* Some Linux gcvt's give -1.e+5 here. */
10482         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10483         checkit("-100000", buf);
10484
10485         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10486         checkit("123.456", buf);
10487
10488         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10489         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10490         /* 34 should be enough to scare even long double
10491          * places into using the e notation. */
10492         if (strlen(buf) > 5)
10493             checkit("1e+034", buf); /* for Microsoft */
10494         else
10495             checkit("1e+34", buf);
10496
10497         /* For Perl, if you add additional tests here, also add them to
10498          * t/base/num.t for benefit of platforms not using Configure or
10499          * overriding d_Gconvert */
10500
10501         exit(0);
10502 }
10503 EOP
10504 : first add preferred functions to our list
10505 xxx_list=""
10506 for xxx_convert in $gconvert_preference; do
10507     case $xxx_convert in
10508     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10509     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10510     esac
10511 done
10512 : then add any others
10513 for xxx_convert in gconvert gcvt sprintf; do
10514     case "$xxx_list" in
10515     *$xxx_convert*) ;;
10516     *) xxx_list="$xxx_list $xxx_convert" ;;
10517     esac
10518 done
10519
10520 case "$d_longdbl$uselongdouble" in
10521 "$define$define")
10522     : again, add preferred functions to our list first
10523     xxx_ld_list=""
10524     for xxx_convert in $gconvert_ld_preference; do
10525         case $xxx_convert in
10526         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10527         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10528         esac
10529     done
10530     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10531     for xxx_convert in qgcvt sprintf $xxx_list; do
10532         case "$xxx_ld_list" in
10533         $xxx_convert*|*" $xxx_convert"*) ;;
10534         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10535         esac
10536     done
10537     : if sprintf cannot do long doubles, move it to the end
10538     if test "$d_PRIgldbl" != "$define"; then
10539         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10540     fi
10541     : if no qgcvt, remove it
10542     if test "$d_qgcvt" != "$define"; then
10543         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10544     fi
10545     : use the ld_list
10546     xxx_list="$xxx_ld_list"
10547     ;;
10548 esac
10549
10550 for xxx_convert in $xxx_list; do
10551         echo "Trying $xxx_convert..."
10552         $rm -f try try$_o core
10553         set try -DTRY_$xxx_convert
10554         if eval $compile; then
10555                 echo "$xxx_convert() found." >&4
10556                 if $run ./try; then
10557                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10558                         break;
10559                 else
10560                         echo "...But $xxx_convert didn't work as I expected."
10561                         xxx_convert=''
10562                 fi
10563         else
10564                 echo "$xxx_convert NOT found." >&4
10565         fi
10566 done
10567
10568 if test X$xxx_convert = X; then
10569     echo "*** WHOA THERE!!! ***" >&4
10570     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10571     xxx_convert=sprintf
10572 fi
10573
10574 case "$xxx_convert" in
10575 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10576 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10577 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10578 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10579    "$define$define$define")
10580       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10581    "$define$define$undef")
10582       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10583    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10584    esac
10585    ;;
10586 esac
10587
10588 fi
10589 $rm_try
10590
10591 : see if _fwalk exists
10592 set fwalk d__fwalk
10593 eval $inlibc
10594
10595 : see if accept4 exists
10596 set accept4 d_accept4
10597 eval $inlibc
10598
10599 : Initialize h_fcntl
10600 h_fcntl=false
10601
10602 : Initialize h_sysfile
10603 h_sysfile=false
10604
10605 : access call always available on UNIX
10606 set access d_access
10607 eval $inlibc
10608
10609 : locate the flags for 'access()'
10610 case "$d_access" in
10611 "$define")
10612         echo " "
10613         $cat >access.c <<EOCP
10614 #include <sys/types.h>
10615 #ifdef I_FCNTL
10616 #include <fcntl.h>
10617 #endif
10618 #ifdef I_SYS_FILE
10619 #include <sys/file.h>
10620 #endif
10621 #ifdef I_UNISTD
10622 #include <unistd.h>
10623 #endif
10624 #$i_stdlib I_STDLIB
10625 #ifdef I_STDLIB
10626 #include <stdlib.h>
10627 #endif
10628 int main() {
10629         exit(R_OK);
10630 }
10631 EOCP
10632         : check sys/file.h first, no particular reason here
10633         if $test `./findhdr sys/file.h` && \
10634                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10635                 h_sysfile=true;
10636                 echo "<sys/file.h> defines the *_OK access constants." >&4
10637         elif $test `./findhdr fcntl.h` && \
10638                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10639                 h_fcntl=true;
10640                 echo "<fcntl.h> defines the *_OK access constants." >&4
10641         elif $test `./findhdr unistd.h` && \
10642                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10643                 echo "<unistd.h> defines the *_OK access constants." >&4
10644         else
10645                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10646         fi
10647         ;;
10648 esac
10649 $rm -f access*
10650
10651 : see if accessx exists
10652 set accessx d_accessx
10653 eval $inlibc
10654
10655 : see if acosh exists
10656 set acosh d_acosh
10657 eval $inlibc
10658
10659 : see if aintl exists
10660 set aintl d_aintl
10661 eval $inlibc
10662
10663 : see if alarm exists
10664 set alarm d_alarm
10665 eval $inlibc
10666
10667 : see if 64bit time functions exists
10668
10669 set ctime64 d_ctime64
10670 eval $inlibc
10671
10672 set localtime64 d_localtime64
10673 eval $inlibc
10674
10675 set gmtime64 d_gmtime64
10676 eval $inlibc
10677
10678 set mktime64 d_mktime64
10679 eval $inlibc
10680
10681 set difftime64 d_difftime64
10682 eval $inlibc
10683
10684 set asctime64 d_asctime64
10685 eval $inlibc
10686
10687 : see if POSIX threads are available
10688 set pthread.h i_pthread
10689 eval $inhdr
10690
10691 : define a function to check prototypes
10692 $cat > protochk <<EOSH
10693 $startsh
10694 cc="$cc"
10695 optimize="$optimize"
10696 ccflags="$ccflags"
10697 define="$define"
10698 rm_try="$rm_try"
10699 usethreads=$usethreads
10700 i_pthread=$i_pthread
10701 pthread_h_first=$pthread_h_first
10702 EOSH
10703
10704 $cat >> protochk <<'EOSH'
10705
10706 $rm_try
10707 foo="$1"
10708 shift
10709 while test $# -ge 2; do
10710         case "$1" in
10711                 $define) echo "#include <$2>" >> try.c ;;
10712                 literal) echo "$2" >> try.c ;;
10713         esac
10714     # Extra magic for the benefit of systems that need pthread.h
10715     # to be included early to correctly detect threadsafe functions.
10716     # Such functions must guarantee themselves, though, that the usethreads
10717     # and i_pthread have been defined, before calling protochk.
10718     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10719         echo "#include <pthread.h>" >> try.c
10720         pthread_h_done=yes
10721     fi
10722     shift 2
10723 done
10724 cat >> try.c <<'EOCP'
10725 #define _(args) args
10726 EOCP
10727 echo "$foo" >> try.c
10728 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10729 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10730 status=$?
10731 $rm_try
10732 exit $status
10733 EOSH
10734 chmod +x protochk
10735 $eunicefix protochk
10736
10737 : Define hasproto macro for Configure internal use
10738 hasproto='varname=$1; func=$2; shift; shift;
10739 while $test $# -ge 2; do
10740         case "$1" in
10741         $define) echo "#include <$2>";;
10742         literal) echo "$2" ;;
10743         esac ;
10744     shift 2;
10745 done > try.c;
10746 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10747 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10748         echo "$func() prototype found.";
10749         val="$define";
10750 else
10751         echo "$func() prototype NOT found.";
10752         val="$undef";
10753 fi;
10754 set $varname;
10755 eval $setvar;
10756 $rm_try tryout.c'
10757
10758 : see if sys/types.h has to be included
10759 set sys/types.h i_systypes
10760 eval $inhdr
10761
10762 : see if sys/select.h has to be included
10763 set sys/select.h i_sysselct
10764 eval $inhdr
10765
10766 : Define hasfield macro for Configure internal use
10767 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10768 while $test $# -ge 2; do
10769         case "$1" in
10770         $define) echo "#include <$2>";;
10771         esac ;
10772     shift 2;
10773 done > try.c;
10774 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10775 set try;
10776 if eval $compile; then
10777         val="$define";
10778 else
10779         val="$undef";
10780 fi;
10781 set $varname;
10782 eval $setvar;
10783 $rm_try'
10784
10785 : see if we should include sys/time.h
10786 echo " "
10787 i_time='define'
10788 if test "X$timeincl" = X; then
10789         echo "Testing to see if we should include <sys/time.h>." >&4
10790         $echo $n "I'm now running the test program...$c"
10791         $cat >try.c <<EOCP
10792 #include <sys/types.h>
10793 #include <time.h>
10794 #ifdef I_SYSTIME
10795 #ifdef SYSTIMEKERNEL
10796 #define KERNEL
10797 #endif
10798 #include <sys/time.h>
10799 #endif
10800 #ifdef I_SYSSELECT
10801 #include <sys/select.h>
10802 #endif
10803 #$i_stdlib I_STDLIB
10804 #ifdef I_STDLIB
10805 #include <stdlib.h>
10806 #endif
10807 int main()
10808 {
10809         struct tm foo;
10810 #ifdef S_TIMEVAL
10811         struct timeval bar;
10812 #endif
10813 #ifdef S_TIMEZONE
10814         struct timezone tzp;
10815 #endif
10816         if (foo.tm_sec == foo.tm_sec)
10817                 exit(0);
10818 #ifdef S_TIMEVAL
10819         if (bar.tv_sec == bar.tv_sec)
10820                 exit(0);
10821 #endif
10822         exit(1);
10823 }
10824 EOCP
10825         flags=''
10826         for s_timezone in '-DS_TIMEZONE' ''; do
10827         sysselect=''
10828         for s_timeval in '-DS_TIMEVAL' ''; do
10829         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10830         for i_systime in '-DI_SYSTIME' ''; do
10831                 case "$flags" in
10832                 '') $echo $n ".$c"
10833                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10834                         if eval $compile; then
10835                                 set X $i_systime $i_systimek $sysselect $s_timeval
10836                                 shift
10837                                 flags="$*"
10838                                 echo " "
10839                                 $echo $n "Succeeded with $flags$c"
10840                         fi
10841                         ;;
10842                 esac
10843         done
10844         done
10845         done
10846         done
10847         timeincl=''
10848         echo " "
10849         case "$flags" in
10850         *SYSTIMEKERNEL*) i_systimek="$define"
10851                 timeincl=`./findhdr sys/time.h`
10852                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10853         *) i_systimek="$undef";;
10854         esac
10855         case "$flags" in
10856         *I_SYSTIME*) i_systime="$define"
10857                 timeincl=`./findhdr sys/time.h`" $timeincl"
10858                 echo "We'll include <sys/time.h>." >&4;;
10859         *) i_systime="$undef";;
10860         esac
10861         $rm_try
10862 fi
10863 : see if struct tm knows about tm_zone
10864 case "$i_systime$i_time" in
10865 *$define*)
10866         echo " "
10867         echo "Checking to see if your struct tm has tm_zone field..." >&4
10868         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10869         eval $hasfield
10870         ;;
10871 *)      val="$undef"
10872         set d_tm_tm_zone
10873         eval $setvar
10874         ;;
10875 esac
10876 case "$d_tm_tm_zone" in
10877 "$define")      echo "Yes, it does."   ;;
10878 *)              echo "No, it doesn't." ;;
10879 esac
10880 : see if struct tm knows about tm_gmtoff
10881 case "$i_systime$i_time" in
10882 *$define*)
10883         echo " "
10884         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10885         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10886         eval $hasfield
10887         ;;
10888 *)      val="$undef"
10889         set d_tm_tm_gmtoff
10890         eval $setvar
10891         ;;
10892 esac
10893 case "$d_tm_tm_gmtoff" in
10894 "$define")      echo "Yes, it does."   ;;
10895 *)              echo "No, it doesn't." ;;
10896 esac
10897
10898 : see if asctime_r exists
10899 set asctime_r d_asctime_r
10900 eval $inlibc
10901 case "$d_asctime_r" in
10902 "$define")
10903         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10904         case "$d_asctime_r_proto:$usethreads" in
10905         ":define")      d_asctime_r_proto=define
10906                 set d_asctime_r_proto asctime_r $hdrs
10907                 eval $hasproto ;;
10908         *)      ;;
10909         esac
10910         case "$d_asctime_r_proto" in
10911         define)
10912         case "$asctime_r_proto" in
10913         ''|0) try='char* asctime_r(const struct tm*, char*);'
10914         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10915         esac
10916         case "$asctime_r_proto" in
10917         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10918         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10919         esac
10920         case "$asctime_r_proto" in
10921         ''|0) try='int asctime_r(const struct tm*, char*);'
10922         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10923         esac
10924         case "$asctime_r_proto" in
10925         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10926         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10927         esac
10928         case "$asctime_r_proto" in
10929         ''|0)   d_asctime_r=undef
10930                 asctime_r_proto=0
10931                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10932         * )     case "$asctime_r_proto" in
10933                 REENTRANT_PROTO*) ;;
10934                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10935                 esac
10936                 echo "Prototype: $try" ;;
10937         esac
10938         ;;
10939         *)      case "$usethreads" in
10940                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10941                 esac
10942                 d_asctime_r=undef
10943                 asctime_r_proto=0
10944                 ;;
10945         esac
10946         ;;
10947 *)      asctime_r_proto=0
10948         ;;
10949 esac
10950
10951 : see if asinh exists
10952 set asinh d_asinh
10953 eval $inlibc
10954
10955 : see if atanh exists
10956 set atanh d_atanh
10957 eval $inlibc
10958
10959 : see if atolf exists
10960 set atolf d_atolf
10961 eval $inlibc
10962
10963 : see if atoll exists
10964 set atoll d_atoll
10965 eval $inlibc
10966
10967 : Look for GCC-style attribute format
10968 case "$d_attribute_format" in
10969 '')
10970 echo " "
10971 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10972 $cat >attrib.c <<'EOCP'
10973 #include <stdio.h>
10974 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10975 EOCP
10976 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10977         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10978                 echo "Your C compiler doesn't support __attribute__((format))."
10979                 val="$undef"
10980         else
10981                 echo "Your C compiler supports __attribute__((format))."
10982                 val="$define"
10983         fi
10984 else
10985         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10986         val="$undef"
10987 fi
10988 ;;
10989 *) val="$d_attribute_format" ;;
10990 esac
10991 set d_attribute_format
10992 eval $setvar
10993 $rm -f attrib*
10994
10995 : Look for GCC-style attribute format with null format allowed
10996 case "$d_printf_format_null" in
10997 '') case "$d_attribute_format" in
10998     $define)
10999         echo " "
11000         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11001 $cat >attrib.c <<EOCP
11002 #include <stdio.h>
11003 #$i_stdlib I_STDLIB
11004 #ifdef I_STDLIB
11005 #include <stdlib.h>
11006 #endif
11007 #$i_inttypes I_INTTYPES
11008 #ifdef I_INTTYPES
11009 #include <inttypes.h>
11010 #endif
11011 #ifndef INTPTR_MAX
11012 #define intptr_t int
11013 #endif
11014 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11015 int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11016 int main () { exit(null_printf(NULL)); }
11017 EOCP
11018         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11019             : run the executable in case it produces a run-time warning
11020             if $run ./attrib >>attrib.out 2>&1; then
11021                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11022                     echo "Your C compiler doesn't allow __printf__ format to be null."
11023                     val="$undef"
11024                 else
11025                     echo "Your C compiler allows __printf__ format to be null."
11026                     val="$define"
11027                 fi
11028             else
11029             echo "Your C compiler executable failed with __printf__ format null."
11030             val="$undef"
11031         fi
11032     else
11033         echo "Your C compiler fails with __printf__ format null."
11034         val="$undef"
11035     fi
11036     ;;
11037     *)  val="$undef" ;;
11038     esac
11039 ;;
11040 *)  val="$d_printf_format_null" ;;
11041 esac
11042 set d_printf_format_null
11043 eval $setvar
11044 $rm -f attrib*
11045
11046 : Look for GCC-style attribute malloc
11047 case "$d_attribute_malloc" in
11048 '')
11049 echo " "
11050 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11051 $cat >attrib.c <<'EOCP'
11052 #include <stdio.h>
11053 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11054 EOCP
11055 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11056         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11057                 echo "Your C compiler doesn't support __attribute__((malloc))."
11058                 val="$undef"
11059         else
11060                 echo "Your C compiler supports __attribute__((malloc))."
11061                 val="$define"
11062         fi
11063 else
11064         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11065         val="$undef"
11066 fi
11067 ;;
11068 *) val="$d_attribute_malloc" ;;
11069 esac
11070 set d_attribute_malloc
11071 eval $setvar
11072 $rm -f attrib*
11073
11074 : Look for GCC-style attribute nonnull
11075 case "$d_attribute_nonnull" in
11076 '')
11077 echo " "
11078 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11079 $cat >attrib.c <<'EOCP'
11080 #include <stdio.h>
11081 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11082 EOCP
11083 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11084         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11085                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11086                 val="$undef"
11087         else
11088                 echo "Your C compiler supports __attribute__((nonnull))."
11089                 val="$define"
11090         fi
11091 else
11092         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11093         val="$undef"
11094 fi
11095 ;;
11096 *) val="$d_attribute_nonnull" ;;
11097 esac
11098 set d_attribute_nonnull
11099 eval $setvar
11100 $rm -f attrib*
11101
11102 : Look for GCC-style attribute noreturn
11103 case "$d_attribute_noreturn" in
11104 '')
11105 echo " "
11106 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11107 $cat >attrib.c <<'EOCP'
11108 #include <stdio.h>
11109 void fall_over_dead( void ) __attribute__((noreturn));
11110 EOCP
11111 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11112         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11113                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11114                 val="$undef"
11115         else
11116                 echo "Your C compiler supports __attribute__((noreturn))."
11117                 val="$define"
11118         fi
11119 else
11120         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11121         val="$undef"
11122 fi
11123 ;;
11124 *) val="$d_attribute_noreturn" ;;
11125 esac
11126 set d_attribute_noreturn
11127 eval $setvar
11128 $rm -f attrib*
11129
11130 : Look for GCC-style attribute pure
11131 case "$d_attribute_pure" in
11132 '')
11133 echo " "
11134 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11135 $cat >attrib.c <<'EOCP'
11136 #include <stdio.h>
11137 int square( int n ) __attribute__((pure));
11138 EOCP
11139 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11140         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11141                 echo "Your C compiler doesn't support __attribute__((pure))."
11142                 val="$undef"
11143         else
11144                 echo "Your C compiler supports __attribute__((pure))."
11145                 val="$define"
11146         fi
11147 else
11148         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11149         val="$undef"
11150 fi
11151 ;;
11152 *) val="$d_attribute_pure" ;;
11153 esac
11154 set d_attribute_pure
11155 eval $setvar
11156 $rm -f attrib*
11157
11158 : Look for GCC-style attribute unused
11159 case "$d_attribute_unused" in
11160 '')
11161 echo " "
11162 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11163 $cat >attrib.c <<'EOCP'
11164 #include <stdio.h>
11165 int do_something( int dummy __attribute__((unused)), int n );
11166 EOCP
11167 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11168         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11169                 echo "Your C compiler doesn't support __attribute__((unused))."
11170                 val="$undef"
11171         else
11172                 echo "Your C compiler supports __attribute__((unused))."
11173                 val="$define"
11174         fi
11175 else
11176         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11177         val="$undef"
11178 fi
11179 ;;
11180 *) val="$d_attribute_unused" ;;
11181 esac
11182 set d_attribute_unused
11183 eval $setvar
11184 $rm -f attrib*
11185
11186 : Look for GCC-style attribute deprecated
11187 case "$d_attribute_deprecated" in
11188 '')
11189 echo " "
11190 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11191 $cat >attrib.c <<'EOCP'
11192 #include <stdio.h>
11193 int I_am_deprecated(void) __attribute__((deprecated));
11194 EOCP
11195 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11196         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11197                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11198                 val="$undef"
11199         else
11200                 echo "Your C compiler supports __attribute__((deprecated))."
11201                 val="$define"
11202         fi
11203 else
11204         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11205         val="$undef"
11206 fi
11207 ;;
11208 *) val="$d_attribute_deprecated" ;;
11209 esac
11210 set d_attribute_deprecated
11211 eval $setvar
11212 $rm -f attrib*
11213
11214 : Look for GCC-style attribute warn_unused_result
11215 case "$d_attribute_warn_unused_result" in
11216 '')
11217 echo " "
11218 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11219 $cat >attrib.c <<'EOCP'
11220 #include <stdio.h>
11221 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11222 EOCP
11223 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11224         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11225                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11226                 val="$undef"
11227         else
11228                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11229                 val="$define"
11230         fi
11231 else
11232         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11233         val="$undef"
11234 fi
11235 ;;
11236 *) val="$d_attribute_warn_unused_result" ;;
11237 esac
11238 set d_attribute_warn_unused_result
11239 eval $setvar
11240 $rm -f attrib*
11241
11242 : see if getpgrp exists
11243 set getpgrp d_getpgrp
11244 eval $inlibc
11245
11246 case "$d_getpgrp" in
11247 "$define")
11248         echo " "
11249         echo "Checking to see which flavor of getpgrp is in use..."
11250         $cat >try.c <<EOP
11251 #$i_unistd I_UNISTD
11252 #include <sys/types.h>
11253 #ifdef I_UNISTD
11254 #  include <unistd.h>
11255 #endif
11256 #$i_stdlib I_STDLIB
11257 #ifdef I_STDLIB
11258 #include <stdlib.h>
11259 #endif
11260 int main()
11261 {
11262         if (getuid() == 0) {
11263                 printf("(I see you are running Configure as super-user...)\n");
11264                 setuid(1);
11265         }
11266 #ifdef TRY_BSD_PGRP
11267         if (getpgrp(1) == 0)
11268                 exit(0);
11269 #else
11270         if (getpgrp() > 0)
11271                 exit(0);
11272 #endif
11273         exit(1);
11274 }
11275 EOP
11276         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11277                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11278                 val="$define"
11279         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11280                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11281                 val="$undef"
11282         else
11283                 echo "I can't seem to compile and run the test program."
11284                 if ./usg; then
11285                         xxx="a USG one, i.e. you use getpgrp()."
11286                 else
11287                         # SVR4 systems can appear rather BSD-ish.
11288                         case "$i_unistd" in
11289                         $undef)
11290                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11291                                 val="$define"
11292                                 ;;
11293                         $define)
11294                                 xxx="probably a USG one, i.e. you use getpgrp()."
11295                                 val="$undef"
11296                                 ;;
11297                         esac
11298                 fi
11299                 echo "Assuming your getpgrp is $xxx" >&4
11300         fi
11301         ;;
11302 *) val="$undef";;
11303 esac
11304 set d_bsdgetpgrp
11305 eval $setvar
11306 $rm_try
11307
11308 : see if setpgrp exists
11309 set setpgrp d_setpgrp
11310 eval $inlibc
11311
11312 case "$d_setpgrp" in
11313 "$define")
11314         echo " "
11315         echo "Checking to see which flavor of setpgrp is in use..."
11316         $cat >try.c <<EOP
11317 #$i_unistd I_UNISTD
11318 #include <sys/types.h>
11319 #ifdef I_UNISTD
11320 #  include <unistd.h>
11321 #endif
11322 #$i_stdlib I_STDLIB
11323 #ifdef I_STDLIB
11324 #include <stdlib.h>
11325 #endif
11326 int main()
11327 {
11328         if (getuid() == 0) {
11329                 printf("(I see you are running Configure as super-user...)\n");
11330                 setuid(1);
11331         }
11332 #ifdef TRY_BSD_PGRP
11333         if (-1 == setpgrp(1, 1))
11334                 exit(0);
11335 #else
11336         if (setpgrp() != -1)
11337                 exit(0);
11338 #endif
11339         exit(1);
11340 }
11341 EOP
11342         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11343                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11344                 val="$define"
11345         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11346                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11347                 val="$undef"
11348         else
11349                 echo "(I can't seem to compile and run the test program.)"
11350                 if ./usg; then
11351                         xxx="a USG one, i.e. you use setpgrp()."
11352                 else
11353                         # SVR4 systems can appear rather BSD-ish.
11354                         case "$i_unistd" in
11355                         $undef)
11356                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11357                                 val="$define"
11358                                 ;;
11359                         $define)
11360                                 xxx="probably a USG one, i.e. you use setpgrp()."
11361                                 val="$undef"
11362                                 ;;
11363                         esac
11364                 fi
11365                 echo "Assuming your setpgrp is $xxx" >&4
11366         fi
11367         ;;
11368 *) val="$undef";;
11369 esac
11370 set d_bsdsetpgrp
11371 eval $setvar
11372 $rm_try
11373
11374 : Look for GCC-style __builtin_add_overflow
11375 case "$d_builtin_add_overflow" in
11376 '')
11377     echo " "
11378     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11379     $cat >try.c <<'EOCP'
11380 int main(void) {
11381     const unsigned int uint_max = ~0u;
11382     int target_int = 0;
11383     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11384         return 1;
11385     }
11386     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11387         return 1;
11388     }
11389     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11390         return 1;
11391     }
11392     return 0;
11393 }
11394 EOCP
11395     set try
11396     if eval $compile && $run ./try; then
11397         echo "Your C compiler supports __builtin_add_overflow."
11398         val="$define"
11399     else
11400         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11401         val="$undef"
11402     fi
11403     ;;
11404 *) val="$d_builtin_add_overflow" ;;
11405 esac
11406
11407 set d_builtin_add_overflow
11408 eval $setvar
11409 $rm_try
11410
11411 : Look for GCC-style __builtin_sub_overflow
11412 case "$d_builtin_sub_overflow" in
11413 '')
11414     echo " "
11415     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11416     $cat >try.c <<'EOCP'
11417 int main(void) {
11418     const unsigned int uint_max = ~0u;
11419     int target_int = 0;
11420     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11421         return 1;
11422     }
11423     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11424         return 1;
11425     }
11426     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11427         return 1;
11428     }
11429     return 0;
11430 }
11431 EOCP
11432     set try
11433     if eval $compile && $run ./try; then
11434         echo "Your C compiler supports __builtin_sub_overflow."
11435         val="$define"
11436     else
11437         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11438         val="$undef"
11439     fi
11440     ;;
11441 *) val="$d_builtin_sub_overflow" ;;
11442 esac
11443
11444 set d_builtin_sub_overflow
11445 eval $setvar
11446 $rm_try
11447
11448 : Look for GCC-style __builtin_mul_overflow
11449 case "$d_builtin_mul_overflow" in
11450 '')
11451     echo " "
11452     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11453     $cat >try.c <<'EOCP'
11454 int main(void) {
11455     const unsigned int uint_max = ~0u;
11456     int target_int = 0;
11457     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11458         return 1;
11459     }
11460     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11461         return 1;
11462     }
11463     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11464         return 1;
11465     }
11466     return 0;
11467 }
11468 EOCP
11469     set try
11470     if eval $compile && $run ./try; then
11471         echo "Your C compiler supports __builtin_mul_overflow."
11472         val="$define"
11473     else
11474         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11475         val="$undef"
11476     fi
11477     ;;
11478 *) val="$d_builtin_mul_overflow" ;;
11479 esac
11480
11481 set d_builtin_mul_overflow
11482 eval $setvar
11483 $rm_try
11484
11485 : Look for GCC-style __builtin_choose_expr
11486 case "$d_builtin_choose_expr" in
11487 '')
11488     echo " "
11489     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11490     $cat >try.c <<'EOCP'
11491 #include <assert.h>
11492 #include <stdlib.h>
11493 #include <stdio.h>
11494
11495 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11496
11497 int main(void) {
11498     assert( SYRINX(1) == 2112 );
11499     assert( SYRINX(1) != 5150 );
11500     assert( SYRINX(0) == 5150 );
11501     assert( SYRINX(0) != 2112 );
11502     puts( "All good!" );
11503     exit(0);
11504 }
11505
11506 EOCP
11507     set try
11508     if eval $compile && $run ./try; then
11509         echo "Your C compiler supports __builtin_choose_expr."
11510         val="$define"
11511     else
11512         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11513         val="$undef"
11514     fi
11515 ;;
11516 *) val="$d_builtin_choose_expr" ;;
11517 esac
11518
11519 set d_builtin_choose_expr
11520 eval $setvar
11521 $rm_try
11522
11523 : Look for GCC-style __builtin_expect
11524 case "$d_builtin_expect" in
11525 '')
11526     echo " "
11527     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11528     $cat >try.c <<'EOCP'
11529 int main(void) {
11530     int n = 50;
11531     if ( __builtin_expect(n, 0) ) n = 1;
11532     /* Remember shell exit code truth is 0, C truth is non-zero */
11533     return !(n == 1);
11534 }
11535 EOCP
11536     set try
11537     if eval $compile && $run ./try; then
11538         echo "Your C compiler supports __builtin_expect."
11539         val="$define"
11540     else
11541         echo "Your C compiler doesn't seem to understand __builtin_expect."
11542         val="$undef"
11543     fi
11544     ;;
11545 *) val="$d_builtin_expect" ;;
11546 esac
11547
11548 set d_builtin_expect
11549 eval $setvar
11550 $rm_try
11551
11552 : see if the Compiler supports C99 variadic macros
11553 echo "Checking for C99 variadic macros." >&4
11554 $cat >try.c <<EOCP
11555 #include <stdio.h>
11556 #include <stdarg.h>
11557
11558 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11559
11560 int main() {
11561   char buf[20];
11562   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11563   puts(buf);
11564   return 0;
11565 }
11566 EOCP
11567 set try
11568 if eval $compile && $run ./try 2>&1 >/dev/null; then
11569     case "`$run ./try`" in
11570         "123 456 789")
11571         echo "You have C99 variadic macros." >&4
11572         d_c99_variadic_macros="$define"
11573         ;;
11574         *)
11575         echo "You don't have functional C99 variadic macros." >&4
11576         d_c99_variadic_macros="$undef"
11577         ;;
11578     esac
11579 else
11580     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11581     d_c99_variadic_macros="$undef"
11582 fi
11583 $rm_try
11584
11585 : see if signal is declared as pointer to function returning int or void
11586 echo " "
11587 xxx=`./findhdr signal.h`
11588 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11589 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11590         echo "You have int (*signal())() instead of void." >&4
11591         val="$undef"
11592 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11593         echo "You have void (*signal())()." >&4
11594         val="$define"
11595 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11596         echo "You have int (*signal())() instead of void." >&4
11597         val="$undef"
11598 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11599         echo "You have void (*signal())()." >&4
11600         val="$define"
11601 else
11602         case "$d_voidsig" in
11603         '')
11604         echo "I can't determine whether signal handler returns void or int..." >&4
11605                 dflt=void
11606                 rp="What type does your signal handler return?"
11607                 . ./myread
11608                 case "$ans" in
11609                 v*) val="$define";;
11610                 *) val="$undef";;
11611                 esac;;
11612         "$define")
11613                 echo "As you already told me, signal handler returns void." >&4
11614                 val="$define"
11615                 ;;
11616         *)      echo "As you already told me, signal handler returns int." >&4
11617                 val="$undef"
11618                 ;;
11619         esac
11620 fi
11621 set d_voidsig
11622 eval $setvar
11623 case "$d_voidsig" in
11624 "$define") signal_t="void";;
11625 *) signal_t="int";;
11626 esac
11627 $rm -f $$.tmp
11628
11629 : check for ability to cast large floats to 32-bit ints.
11630 echo " "
11631 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11632 if $test "$intsize" -ge 4; then
11633         xxx=int
11634 else
11635         xxx=long
11636 fi
11637 $cat >try.c <<EOCP
11638 #include <stdio.h>
11639 #$i_stdlib I_STDLIB
11640 #ifdef I_STDLIB
11641 #include <stdlib.h>
11642 #endif
11643 #include <sys/types.h>
11644 #include <signal.h>
11645 $signal_t blech(int s) { exit(3); }
11646 int main()
11647 {
11648         $xxx i32;
11649         double f, g;
11650         int result = 0;
11651         char str[16];
11652         signal(SIGFPE, blech);
11653
11654         /* Don't let compiler optimize the test away.  Store the number
11655            in a writable string for gcc to pass to sscanf under HP-UX.
11656         */
11657         sprintf(str, "2147483647");
11658         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11659         g = 10 * f;
11660         i32  = ($xxx) g;
11661
11662         /* x86 processors will probably give 0x8000 0000, which is a
11663            sign change.  We don't want that.  We want to mimic SPARC
11664            behavior here, which is to preserve the sign and give
11665            back 0x7fff ffff.
11666         */
11667         if (i32 != ($xxx) f)
11668                 result |= 1;
11669         exit(result);
11670 }
11671 EOCP
11672 set try
11673 if eval $compile_ok; then
11674         $run ./try 2>/dev/null
11675         yyy=$?
11676 else
11677         echo "(I can't seem to compile the test program--assuming it can't)"
11678         yyy=1
11679 fi
11680 case "$yyy" in
11681 0)      val="$define"
11682         echo "Yup, it can."
11683         ;;
11684 *)      val="$undef"
11685         echo "Nope, it can't."
11686         ;;
11687 esac
11688 set d_casti32
11689 eval $setvar
11690 $rm_try
11691
11692 : check for ability to cast negative floats to unsigned
11693 echo " "
11694 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11695 $cat >try.c <<EOCP
11696 #include <stdio.h>
11697 #$i_stdlib I_STDLIB
11698 #ifdef I_STDLIB
11699 #include <stdlib.h>
11700 #endif
11701 #include <sys/types.h>
11702 #include <signal.h>
11703 $signal_t blech(int s) { exit(7); }
11704 $signal_t blech_in_list(int s) { exit(4); }
11705 unsigned long dummy_long(unsigned long p) { return p; }
11706 unsigned int dummy_int(unsigned int p) { return p; }
11707 unsigned short dummy_short(unsigned short p) { return p; }
11708 int main()
11709 {
11710         double f;
11711         unsigned long along;
11712         unsigned int aint;
11713         unsigned short ashort;
11714         int result = 0;
11715         char str[16];
11716
11717         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11718            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11719            optimized the whole file away
11720         */
11721         /* Store the number in a writable string for gcc to pass to
11722            sscanf under HP-UX.
11723         */
11724         sprintf(str, "-123");
11725         sscanf(str, "%lf", &f);  /* f = -123.; */
11726
11727         signal(SIGFPE, blech);
11728         along = (unsigned long)f;
11729         aint = (unsigned int)f;
11730         ashort = (unsigned short)f;
11731         if (along != (unsigned long)-123)
11732                 result |= 1;
11733         if (aint != (unsigned int)-123)
11734                 result |= 1;
11735         if (ashort != (unsigned short)-123)
11736                 result |= 1;
11737         sprintf(str, "1073741824.");
11738         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11739         f = f + f;
11740         along = 0;
11741         along = (unsigned long)f;
11742         if (along != 0x80000000)
11743                 result |= 2;
11744         f -= 1.;
11745         along = 0;
11746         along = (unsigned long)f;
11747         if (along != 0x7fffffff)
11748                 result |= 1;
11749         f += 2.;
11750         along = 0;
11751         along = (unsigned long)f;
11752         if (along != 0x80000001)
11753                 result |= 2;
11754         if (result)
11755                 exit(result);
11756         signal(SIGFPE, blech_in_list);
11757         sprintf(str, "123.");
11758         sscanf(str, "%lf", &f);  /* f = 123.; */
11759         along = dummy_long((unsigned long)f);
11760         aint = dummy_int((unsigned int)f);
11761         ashort = dummy_short((unsigned short)f);
11762         if (along != (unsigned long)123)
11763                 result |= 4;
11764         if (aint != (unsigned int)123)
11765                 result |= 4;
11766         if (ashort != (unsigned short)123)
11767                 result |= 4;
11768         exit(result);
11769
11770 }
11771 EOCP
11772 set try
11773 if eval $compile_ok; then
11774         $run ./try 2>/dev/null
11775         castflags=$?
11776 else
11777         echo "(I can't seem to compile the test program--assuming it can't)"
11778         castflags=7
11779 fi
11780 case "$castflags" in
11781 0)      val="$define"
11782         echo "Yup, it can."
11783         ;;
11784 *)      val="$undef"
11785         echo "Nope, it can't."
11786         ;;
11787 esac
11788 set d_castneg
11789 eval $setvar
11790 $rm_try
11791
11792 : see if cbrt exists
11793 set cbrt d_cbrt
11794 eval $inlibc
11795
11796 : see if chown exists
11797 set chown d_chown
11798 eval $inlibc
11799
11800 : see if chroot exists
11801 set chroot d_chroot
11802 eval $inlibc
11803
11804 : see if chsize exists
11805 set chsize d_chsize
11806 eval $inlibc
11807
11808 : see if class exists
11809 set class d_class
11810 eval $inlibc
11811
11812 : see if clearenv exists
11813 set clearenv d_clearenv
11814 eval $inlibc
11815
11816 : Define hasstruct macro for Configure internal use
11817 hasstruct='varname=$1; struct=$2; shift; shift;
11818 while $test $# -ge 2; do
11819         case "$1" in
11820         $define) echo "#include <$2>";;
11821         esac ;
11822     shift 2;
11823 done > try.c;
11824 echo "int main () { struct $struct foo; }" >> try.c;
11825 set try;
11826 if eval $compile; then
11827         val="$define";
11828 else
11829         val="$undef";
11830 fi;
11831 set $varname;
11832 eval $setvar;
11833 $rm_try'
11834
11835 : see whether socket exists
11836 socketlib=''
11837 sockethdr=''
11838 echo " "
11839 $echo $n "Hmm... $c" >&4
11840 if set socket val -f d_socket; eval $csym; $val; then
11841     echo "Looks like you have Berkeley networking support." >&4
11842     d_socket="$define"
11843     if set setsockopt val -f; eval $csym; $val; then
11844         d_oldsock="$undef"
11845     else
11846         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11847         d_oldsock="$define"
11848     fi
11849 else
11850     if $contains socklib libc.list >/dev/null 2>&1; then
11851         echo "Looks like you have Berkeley networking support." >&4
11852         d_socket="$define"
11853         : we will have to assume that it supports the 4.2 BSD interface
11854         d_oldsock="$undef"
11855     else
11856         echo "You don't have Berkeley networking in libc$_a..." >&4
11857         if test "X$d_socket" = "X$define"; then
11858             echo "...but you seem to believe that you have sockets." >&4
11859         else
11860             for net in net socket
11861             do
11862                 if test -f $sysroot/usr/lib/lib$net$_a; then
11863                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11864                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11865                     if $contains socket libc.list >/dev/null 2>&1; then
11866                         d_socket="$define"
11867                         socketlib="-l$net"
11868                         case "$net" in
11869                         net)
11870                             echo "...but the Wollongong group seems to have hacked it in." >&4
11871                             sockethdr="-I$sysroot/usr/netinclude"
11872                             ;;
11873                         esac
11874                         echo "Found Berkeley sockets interface in lib$net." >&4
11875                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11876                             d_oldsock="$undef"
11877                         else
11878                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11879                             d_oldsock="$define"
11880                         fi
11881                         break
11882                     fi
11883                 fi
11884             done
11885             if test "X$d_socket" != "X$define"; then
11886                echo "or anywhere else I see." >&4
11887                d_socket="$undef"
11888                d_oldsock="$undef"
11889             fi
11890         fi
11891     fi
11892 fi
11893
11894 : see if socketpair exists
11895 set socketpair d_sockpair
11896 eval $inlibc
11897
11898
11899 echo " "
11900 echo "Checking the availability sa_len in the sock struct ..." >&4
11901 $cat >try.c <<EOF
11902 #include <sys/types.h>
11903 #include <sys/socket.h>
11904 int main() {
11905 struct sockaddr sa;
11906 return (sa.sa_len);
11907 }
11908 EOF
11909 val="$undef"
11910 set try; if eval $compile; then
11911     val="$define"
11912 fi
11913 set d_sockaddr_sa_len; eval $setvar
11914 $rm_try
11915
11916 echo " "
11917 echo "Checking the availability struct sockaddr_in6 ..." >&4
11918 $cat >try.c <<EOF
11919 #include <sys/types.h>
11920 #include <sys/socket.h>
11921 #include <netinet/in.h>
11922 int main() {
11923 struct sockaddr_in6 sin6;
11924 return (sin6.sin6_family);
11925 }
11926 EOF
11927 val="$undef"
11928 set try; if eval $compile; then
11929     val="$define"
11930 fi
11931 set d_sockaddr_in6; eval $setvar
11932 $rm_try
11933
11934 echo " "
11935 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11936 $cat >try.c <<EOF
11937 #include <sys/types.h>
11938 #include <sys/socket.h>
11939 #include <netinet/in.h>
11940 int main() {
11941 struct sockaddr_in6 sin6;
11942 return (sin6.sin6_scope_id);
11943 }
11944 EOF
11945 val="$undef"
11946 set try; if eval $compile; then
11947     val="$define"
11948 fi
11949 set d_sin6_scope_id; eval $setvar
11950 $rm_try
11951
11952 echo " "
11953 echo "Checking the availability struct ip_mreq ..." >&4
11954 $cat >try.c <<EOF
11955 #include <sys/types.h>
11956 #include <sys/socket.h>
11957 #include <netinet/in.h>
11958 int main() {
11959 struct ip_mreq mreq;
11960 return (mreq.imr_multiaddr.s_addr);
11961 }
11962 EOF
11963 val="$undef"
11964 set try; if eval $compile; then
11965        val="$define"
11966 fi
11967 set d_ip_mreq; eval $setvar
11968 $rm_try
11969
11970 echo " "
11971 echo "Checking the availability struct ip_mreq_source ..." >&4
11972 $cat >try.c <<EOF
11973 #include <sys/types.h>
11974 #include <sys/socket.h>
11975 #include <netinet/in.h>
11976 int main() {
11977 struct ip_mreq_source mreq;
11978 return (mreq.imr_multiaddr.s_addr);
11979 }
11980 EOF
11981 val="$undef"
11982 set try; if eval $compile; then
11983        val="$define"
11984 fi
11985 set d_ip_mreq_source; eval $setvar
11986 $rm_try
11987
11988 echo " "
11989 echo "Checking the availability struct ipv6_mreq ..." >&4
11990 $cat >try.c <<EOF
11991 #include <sys/types.h>
11992 #include <sys/socket.h>
11993 #include <netinet/in.h>
11994 int main() {
11995 struct ipv6_mreq mreq;
11996 return (mreq.ipv6mr_interface);
11997 }
11998 EOF
11999 val="$undef"
12000 set try; if eval $compile; then
12001     val="$define"
12002 fi
12003 set d_ipv6_mreq; eval $setvar
12004 $rm_try
12005
12006 echo " "
12007 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12008 $cat >try.c <<EOF
12009 #include <sys/types.h>
12010 #include <sys/socket.h>
12011 #include <netinet/in.h>
12012 int main() {
12013 struct ipv6_mreq_source mreq;
12014 return (mreq.imr_multiaddr.s_addr);
12015 }
12016 EOF
12017 val="$undef"
12018 set try; if eval $compile; then
12019        val="$define"
12020 fi
12021 set d_ipv6_mreq_source; eval $setvar
12022 $rm_try
12023
12024 echo " "
12025 echo "Checking the availability of certain socket constants..." >&4
12026 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12027     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12028     $cat >try.c <<EOF
12029 #include <sys/types.h>
12030 #include <sys/socket.h>
12031 int main() {
12032     int i = $ENUM;
12033 }
12034 EOF
12035     val="$undef"
12036     set try; if eval $compile; then
12037         val="$define"
12038     fi
12039     set d_${enum}; eval $setvar
12040     $rm_try
12041 done
12042
12043 : see if this is a sys/uio.h system
12044 set sys/uio.h i_sysuio
12045 eval $inhdr
12046
12047 : Check for cmsghdr support
12048 echo " "
12049 echo "Checking to see if your system supports struct cmsghdr..." >&4
12050 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12051 eval $hasstruct
12052 case "$d_cmsghdr_s" in
12053 "$define")      echo "Yes, it does."   ;;
12054 *)              echo "No, it doesn't." ;;
12055 esac
12056
12057 : see if copysign exists
12058 set copysign d_copysign
12059 eval $inlibc
12060
12061 : see if copysignl exists
12062 set copysignl d_copysignl
12063 eval $inlibc
12064
12065 : see if crypt exists
12066 echo " "
12067 set crypt d_crypt
12068 eval $inlibc
12069 case "$d_crypt" in
12070 $define) cryptlib='' ;;
12071 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12072                 echo 'crypt() found.' >&4
12073                 val="$define"
12074                 cryptlib=''
12075         else
12076                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12077                 if $test -z "$cryptlib"; then
12078                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12079                 else
12080                         cryptlib=-lcrypt
12081                 fi
12082                 if $test -z "$cryptlib"; then
12083                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12084                 else
12085                         cryptlib=-lcrypt
12086                 fi
12087                 if $test -z "$cryptlib"; then
12088                         cryptlib=`./loc libcrypt$_a "" $libpth`
12089                 else
12090                         cryptlib=-lcrypt
12091                 fi
12092                 if $test -z "$cryptlib"; then
12093                         echo 'crypt() NOT found.' >&4
12094                         val="$undef"
12095                 else
12096                         val="$define"
12097                 fi
12098         fi
12099         set d_crypt
12100         eval $setvar
12101         ;;
12102 esac
12103
12104 : see if this is a crypt.h system
12105 set crypt.h i_crypt
12106 eval $inhdr
12107
12108 : see if crypt_r exists
12109 set crypt_r d_crypt_r
12110 eval $inlibc
12111 case "$d_crypt_r" in
12112 "$define")
12113         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12114         case "$d_crypt_r_proto:$usethreads" in
12115         ":define")      d_crypt_r_proto=define
12116                 set d_crypt_r_proto crypt_r $hdrs
12117                 eval $hasproto ;;
12118         *)      ;;
12119         esac
12120         case "$d_crypt_r_proto" in
12121         define)
12122         case "$crypt_r_proto" in
12123         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12124         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12125         esac
12126         case "$crypt_r_proto" in
12127         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12128         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12129         esac
12130         case "$crypt_r_proto" in
12131         ''|0)   d_crypt_r=undef
12132                 crypt_r_proto=0
12133                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12134         * )     case "$crypt_r_proto" in
12135                 REENTRANT_PROTO*) ;;
12136                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12137                 esac
12138                 echo "Prototype: $try" ;;
12139         esac
12140         ;;
12141         *)      case "$usethreads" in
12142                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12143                 esac
12144                 d_crypt_r=undef
12145                 crypt_r_proto=0
12146                 ;;
12147         esac
12148         ;;
12149 *)      crypt_r_proto=0
12150         ;;
12151 esac
12152
12153 : get csh whereabouts
12154 case "$csh" in
12155 'csh') val="$undef" ;;
12156 *) val="$define" ;;
12157 esac
12158 set d_csh
12159 eval $setvar
12160 : Respect a hint or command line value for full_csh.
12161 case "$full_csh" in
12162 '') full_csh=$csh ;;
12163 esac
12164
12165 : see if ctermid exists
12166 set ctermid d_ctermid
12167 eval $inlibc
12168
12169 : see if ctermid_r exists
12170 set ctermid_r d_ctermid_r
12171 eval $inlibc
12172 case "$d_ctermid_r" in
12173 "$define")
12174         hdrs="$i_systypes sys/types.h define stdio.h "
12175         case "$d_ctermid_r_proto:$usethreads" in
12176         ":define")      d_ctermid_r_proto=define
12177                 set d_ctermid_r_proto ctermid_r $hdrs
12178                 eval $hasproto ;;
12179         *)      ;;
12180         esac
12181         case "$d_ctermid_r_proto" in
12182         define)
12183         case "$ctermid_r_proto" in
12184         ''|0) try='char* ctermid_r(char*);'
12185         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12186         esac
12187         case "$ctermid_r_proto" in
12188         ''|0)   d_ctermid_r=undef
12189                 ctermid_r_proto=0
12190                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12191         * )     case "$ctermid_r_proto" in
12192                 REENTRANT_PROTO*) ;;
12193                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12194                 esac
12195                 echo "Prototype: $try" ;;
12196         esac
12197         ;;
12198         *)      case "$usethreads" in
12199                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12200                 esac
12201                 d_ctermid_r=undef
12202                 ctermid_r_proto=0
12203                 ;;
12204         esac
12205         ;;
12206 *)      ctermid_r_proto=0
12207         ;;
12208 esac
12209
12210 : see if ctime_r exists
12211 set ctime_r d_ctime_r
12212 eval $inlibc
12213 case "$d_ctime_r" in
12214 "$define")
12215         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12216         case "$d_ctime_r_proto:$usethreads" in
12217         ":define")      d_ctime_r_proto=define
12218                 set d_ctime_r_proto ctime_r $hdrs
12219                 eval $hasproto ;;
12220         *)      ;;
12221         esac
12222         case "$d_ctime_r_proto" in
12223         define)
12224         case "$ctime_r_proto" in
12225         ''|0) try='char* ctime_r(const time_t*, char*);'
12226         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12227         esac
12228         case "$ctime_r_proto" in
12229         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12230         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12231         esac
12232         case "$ctime_r_proto" in
12233         ''|0) try='int ctime_r(const time_t*, char*);'
12234         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12235         esac
12236         case "$ctime_r_proto" in
12237         ''|0) try='int ctime_r(const time_t*, char*, int);'
12238         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12239         esac
12240         case "$ctime_r_proto" in
12241         ''|0)   d_ctime_r=undef
12242                 ctime_r_proto=0
12243                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12244         * )     case "$ctime_r_proto" in
12245                 REENTRANT_PROTO*) ;;
12246                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12247                 esac
12248                 echo "Prototype: $try" ;;
12249         esac
12250         ;;
12251         *)      case "$usethreads" in
12252                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12253                 esac
12254                 d_ctime_r=undef
12255                 ctime_r_proto=0
12256                 ;;
12257         esac
12258         ;;
12259 *)      ctime_r_proto=0
12260         ;;
12261 esac
12262
12263 : see if cuserid exists
12264 set cuserid d_cuserid
12265 eval $inlibc
12266
12267 : see if dbm.h is available
12268 : see if dbmclose exists
12269 set dbmclose d_dbmclose
12270 eval $inlibc
12271
12272 case "$d_dbmclose" in
12273 $define)
12274         set dbm.h i_dbm
12275         eval $inhdr
12276         case "$i_dbm" in
12277         $define)
12278                 val="$undef"
12279                 set i_rpcsvcdbm
12280                 eval $setvar
12281                 ;;
12282         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12283                 eval $inhdr
12284                 ;;
12285         esac
12286         ;;
12287 *)      echo "We won't be including <dbm.h>"
12288         val="$undef"
12289         set i_dbm
12290         eval $setvar
12291         val="$undef"
12292         set i_rpcsvcdbm
12293         eval $setvar
12294         ;;
12295 esac
12296
12297 : see if prototype for dbminit is available
12298 echo " "
12299 set d_dbminitproto dbminit $i_dbm dbm.h
12300 eval $hasproto
12301
12302 : see if difftime exists
12303 set difftime d_difftime
12304 eval $inlibc
12305
12306 : see if this is a dirent system
12307 echo " "
12308 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12309         val="$define"
12310         echo "<dirent.h> found." >&4
12311 else
12312         val="$undef"
12313         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12314                 echo "<sys/dir.h> found." >&4
12315                 echo " "
12316         else
12317                 xinc=`./findhdr sys/ndir.h`
12318         fi
12319         echo "<dirent.h> NOT found." >&4
12320 fi
12321 set i_dirent
12322 eval $setvar
12323
12324 : Look for type of directory structure.
12325 echo " "
12326 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12327
12328 case "$direntrytype" in
12329 ''|' ')
12330         case "$i_dirent" in
12331         $define) guess1='struct dirent' ;;
12332         *) guess1='struct direct'  ;;
12333         esac
12334         ;;
12335 *)      guess1="$direntrytype"
12336         ;;
12337 esac
12338
12339 case "$guess1" in
12340 'struct dirent') guess2='struct direct' ;;
12341 *) guess2='struct dirent' ;;
12342 esac
12343
12344 if $contains "$guess1" try.c >/dev/null 2>&1; then
12345         direntrytype="$guess1"
12346         echo "Your directory entries are $direntrytype." >&4
12347 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12348         direntrytype="$guess2"
12349         echo "Your directory entries seem to be $direntrytype." >&4
12350 else
12351         echo "I don't recognize your system's directory entries." >&4
12352         rp="What type is used for directory entries on this system?"
12353         dflt="$guess1"
12354         . ./myread
12355         direntrytype="$ans"
12356 fi
12357 $rm_try
12358
12359 : see if the directory entry stores field length
12360 echo " "
12361 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12362 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12363         echo "Good, your directory entry keeps length information in d_namlen." >&4
12364         val="$define"
12365 else
12366         echo "Your directory entry does not know about the d_namlen field." >&4
12367         val="$undef"
12368 fi
12369 set d_dirnamlen
12370 eval $setvar
12371 $rm_try
12372
12373 : Look for DIR.dd_fd
12374 case "$i_dirent" in
12375 "$define")
12376     echo "Checking to see if DIR has a dd_fd member variable" >&4
12377     $cat >try.c <<EOCP
12378 #$i_stdlib I_STDLIB
12379 #ifdef I_STDLIB
12380 #include <stdlib.h>
12381 #endif
12382 #include <dirent.h>
12383
12384 int main() {
12385     DIR dir;
12386     dir.dd_fd = 1;
12387     return 0;
12388 }
12389 EOCP
12390     val=$undef
12391     set try
12392     if eval $compile; then
12393         echo "Yes, it does."
12394         val="$define"
12395     else
12396         echo "No, it does not."
12397         val="$undef"
12398     fi
12399     ;;
12400 *)
12401     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12402     val="$undef"
12403     ;;
12404 esac
12405 set d_dir_dd_fd
12406 eval $setvar
12407 $rm_try
12408
12409 : see if this is an sysdir system
12410 set sys/dir.h i_sysdir
12411 eval $inhdr
12412
12413 : see if this is an sysndir system
12414 set sys/ndir.h i_sysndir
12415 eval $inhdr
12416
12417 : Look for dirfd
12418 echo " "
12419 $cat >dirfd.c <<EOM
12420 #include <stdio.h>
12421 #$i_stdlib I_STDLIB
12422 #ifdef I_STDLIB
12423 #include <stdlib.h>
12424 #endif
12425 #$i_dirent I_DIRENT             /**/
12426 #$i_sysdir I_SYS_DIR            /**/
12427 #$i_sysndir I_SYS_NDIR          /**/
12428 #$i_systypes I_SYS_TYPES        /**/
12429 #if defined(I_SYS_TYPES)
12430 #include <sys/types.h>
12431 #endif
12432 #if defined(I_DIRENT)
12433 #include <dirent.h>
12434 #else
12435 #ifdef I_SYS_NDIR
12436 #include <sys/ndir.h>
12437 #else
12438 #ifdef I_SYS_DIR
12439 #include <sys/dir.h>
12440 #endif
12441 #endif
12442 #endif
12443 int main() {
12444         DIR *dirp = opendir(".");
12445         if (dirfd(dirp) >= 0)
12446                 exit(0);
12447         else
12448                 exit(1);
12449 }
12450 EOM
12451 val=$undef
12452 set dirfd
12453 if eval $compile; then
12454         val="$define"
12455 fi
12456 case "$val" in
12457 $define)        echo "dirfd() found." >&4       ;;
12458 *)              echo "dirfd() NOT found." >&4   ;;
12459 esac
12460 set d_dirfd
12461 eval $setvar
12462 $rm -f dirfd*
12463
12464 : see if dladdr exists
12465 set dladdr d_dladdr
12466 eval $inlibc
12467
12468 : see if dlerror exists
12469 xxx_runnm="$runnm"
12470 runnm=false
12471 set dlerror d_dlerror
12472 eval $inlibc
12473 runnm="$xxx_runnm"
12474
12475 : see if dlfcn is available
12476 set dlfcn.h i_dlfcn
12477 eval $inhdr
12478
12479 : Check what extension to use for shared libs
12480 case "$usedl" in
12481 $define|y|true)
12482         $cat << EOM
12483
12484 On a few systems, the dynamically loaded modules that perl generates and uses
12485 will need a different extension than shared libs. The default will probably
12486 be appropriate.
12487
12488 EOM
12489         case "$dlext" in
12490         '')     dflt="$so" ;;
12491         *)      dflt="$dlext" ;;
12492         esac
12493         rp='What is the extension of dynamically loaded modules'
12494         . ./myread
12495         dlext="$ans"
12496         ;;
12497 *)
12498         dlext="none"
12499         ;;
12500 esac
12501
12502 : Check if dlsym need a leading underscore
12503 echo " "
12504 val="$undef"
12505
12506 case "$dlsrc" in
12507 dl_dlopen.xs)
12508         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12509         $cat >dyna.c <<'EOM'
12510 fred () { }
12511 EOM
12512
12513 $cat >fred.c<<EOM
12514
12515 #include <stdio.h>
12516 #$i_stdlib I_STDLIB
12517 #ifdef I_STDLIB
12518 #include <stdlib.h>
12519 #endif
12520 #$i_dlfcn I_DLFCN
12521 #ifdef I_DLFCN
12522 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12523 #else
12524 #include <sys/types.h>
12525 #include <nlist.h>
12526 #include <link.h>
12527 #endif
12528
12529 extern int fred() ;
12530
12531 int main()
12532 {
12533     void * handle ;
12534     void * symbol ;
12535 #ifndef RTLD_LAZY
12536     int mode = 1 ;
12537 #else
12538     int mode = RTLD_LAZY ;
12539 #endif
12540     handle = dlopen("./dyna.$dlext", mode) ;
12541     if (handle == NULL) {
12542         printf ("1\n") ;
12543         fflush (stdout) ;
12544         exit(0);
12545     }
12546     symbol = dlsym(handle, "fred") ;
12547     if (symbol == NULL) {
12548         /* try putting a leading underscore */
12549         symbol = dlsym(handle, "_fred") ;
12550         if (symbol == NULL) {
12551             printf ("2\n") ;
12552             fflush (stdout) ;
12553             exit(0);
12554         }
12555         printf ("3\n") ;
12556     }
12557     else
12558         printf ("4\n") ;
12559     fflush (stdout) ;
12560     exit(0);
12561 }
12562 EOM
12563         : Call the object file tmp-dyna.o in case dlext=o.
12564         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12565                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12566                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12567                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12568                 xxx=`$run ./fred`
12569                 case $xxx in
12570                 1)      echo "Test program failed using dlopen." >&4
12571                         echo "Perhaps you should not use dynamic loading." >&4;;
12572                 2)      echo "Test program failed using dlsym." >&4
12573                         echo "Perhaps you should not use dynamic loading." >&4;;
12574                 3)      echo "dlsym needs a leading underscore" >&4
12575                         val="$define" ;;
12576                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12577                 esac
12578         else
12579                 echo "I can't compile and run the test program." >&4
12580                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12581         fi
12582         ;;
12583 esac
12584
12585 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12586
12587 set d_dlsymun
12588 eval $setvar
12589
12590 : see if drand48_r exists
12591 set drand48_r d_drand48_r
12592 eval $inlibc
12593 case "$d_drand48_r" in
12594 "$define")
12595         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12596         case "$d_drand48_r_proto:$usethreads" in
12597         ":define")      d_drand48_r_proto=define
12598                 set d_drand48_r_proto drand48_r $hdrs
12599                 eval $hasproto ;;
12600         *)      ;;
12601         esac
12602         case "$d_drand48_r_proto" in
12603         define)
12604         case "$drand48_r_proto" in
12605         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12606         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12607         esac
12608         case "$drand48_r_proto" in
12609         ''|0)   d_drand48_r=undef
12610                 drand48_r_proto=0
12611                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12612         * )     case "$drand48_r_proto" in
12613                 REENTRANT_PROTO*) ;;
12614                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12615                 esac
12616                 echo "Prototype: $try" ;;
12617         esac
12618         ;;
12619         *)      case "$usethreads" in
12620                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12621                 esac
12622                 d_drand48_r=undef
12623                 drand48_r_proto=0
12624                 ;;
12625         esac
12626         ;;
12627 *)      drand48_r_proto=0
12628         ;;
12629 esac
12630
12631 : see if prototype for drand48 is available
12632 echo " "
12633 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12634 eval $hasproto
12635
12636 : see if dup2 exists
12637 set dup2 d_dup2
12638 eval $inlibc
12639
12640 : see if dup3 exists
12641 set dup3 d_dup3
12642 eval $inlibc
12643
12644 : see if this is an xlocale.h system
12645 set xlocale.h i_xlocale
12646 eval $inhdr
12647
12648 : see if newlocale exists
12649 set newlocale d_newlocale
12650 eval $inlibc
12651
12652 : see if freelocale exists
12653 set freelocale d_freelocale
12654 eval $inlibc
12655
12656 : see if uselocale exists
12657 set uselocale d_uselocale
12658 eval $inlibc
12659
12660 : see if duplocale exists
12661 set duplocale d_duplocale
12662 eval $inlibc
12663
12664 : see if querylocale exists
12665 set querylocale d_querylocale
12666 eval $inlibc
12667
12668 : see if eaccess exists
12669 set eaccess d_eaccess
12670 eval $inlibc
12671
12672 : see if endgrent exists
12673 set endgrent d_endgrent
12674 eval $inlibc
12675
12676 : see if this is an grp system
12677 set grp.h i_grp
12678 eval $inhdr
12679
12680 case "$i_grp" in
12681 $define)
12682         xxx=`./findhdr grp.h`
12683         $cppstdin $cppflags $cppminus < $xxx >$$.h
12684
12685         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12686                 val="$define"
12687         else
12688                 val="$undef"
12689         fi
12690         set d_grpasswd
12691         eval $setvar
12692
12693         $rm -f $$.h
12694         ;;
12695 *)
12696         val="$undef";
12697         set d_grpasswd; eval $setvar
12698         ;;
12699 esac
12700
12701 : see if endgrent_r exists
12702 set endgrent_r d_endgrent_r
12703 eval $inlibc
12704 case "$d_endgrent_r" in
12705 "$define")
12706         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12707         case "$d_endgrent_r_proto:$usethreads" in
12708         ":define")      d_endgrent_r_proto=define
12709                 set d_endgrent_r_proto endgrent_r $hdrs
12710                 eval $hasproto ;;
12711         *)      ;;
12712         esac
12713         case "$d_endgrent_r_proto" in
12714         define)
12715         case "$endgrent_r_proto" in
12716         ''|0) try='int endgrent_r(FILE**);'
12717         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12718         esac
12719         case "$endgrent_r_proto" in
12720         ''|0) try='void endgrent_r(FILE**);'
12721         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12722         esac
12723         case "$endgrent_r_proto" in
12724         ''|0)   d_endgrent_r=undef
12725                 endgrent_r_proto=0
12726                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12727         * )     case "$endgrent_r_proto" in
12728                 REENTRANT_PROTO*) ;;
12729                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12730                 esac
12731                 echo "Prototype: $try" ;;
12732         esac
12733         ;;
12734         *)      case "$usethreads" in
12735                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12736                 esac
12737                 d_endgrent_r=undef
12738                 endgrent_r_proto=0
12739                 ;;
12740         esac
12741         ;;
12742 *)      endgrent_r_proto=0
12743         ;;
12744 esac
12745
12746 : see if endhostent exists
12747 set endhostent d_endhent
12748 eval $inlibc
12749
12750 : see if this is a netdb.h system
12751 set netdb.h i_netdb
12752 eval $inhdr
12753
12754 : see if endhostent_r exists
12755 set endhostent_r d_endhostent_r
12756 eval $inlibc
12757 case "$d_endhostent_r" in
12758 "$define")
12759         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12760         case "$d_endhostent_r_proto:$usethreads" in
12761         ":define")      d_endhostent_r_proto=define
12762                 set d_endhostent_r_proto endhostent_r $hdrs
12763                 eval $hasproto ;;
12764         *)      ;;
12765         esac
12766         case "$d_endhostent_r_proto" in
12767         define)
12768         case "$endhostent_r_proto" in
12769         ''|0) try='int endhostent_r(struct hostent_data*);'
12770         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12771         esac
12772         case "$endhostent_r_proto" in
12773         ''|0) try='void endhostent_r(struct hostent_data*);'
12774         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12775         esac
12776         case "$endhostent_r_proto" in
12777         ''|0)   d_endhostent_r=undef
12778                 endhostent_r_proto=0
12779                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12780         * )     case "$endhostent_r_proto" in
12781                 REENTRANT_PROTO*) ;;
12782                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12783                 esac
12784                 echo "Prototype: $try" ;;
12785         esac
12786         ;;
12787         *)      case "$usethreads" in
12788                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12789                 esac
12790                 d_endhostent_r=undef
12791                 endhostent_r_proto=0
12792                 ;;
12793         esac
12794         ;;
12795 *)      endhostent_r_proto=0
12796         ;;
12797 esac
12798
12799 : see if endnetent exists
12800 set endnetent d_endnent
12801 eval $inlibc
12802
12803 : see if endnetent_r exists
12804 set endnetent_r d_endnetent_r
12805 eval $inlibc
12806 case "$d_endnetent_r" in
12807 "$define")
12808         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12809         case "$d_endnetent_r_proto:$usethreads" in
12810         ":define")      d_endnetent_r_proto=define
12811                 set d_endnetent_r_proto endnetent_r $hdrs
12812                 eval $hasproto ;;
12813         *)      ;;
12814         esac
12815         case "$d_endnetent_r_proto" in
12816         define)
12817         case "$endnetent_r_proto" in
12818         ''|0) try='int endnetent_r(struct netent_data*);'
12819         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12820         esac
12821         case "$endnetent_r_proto" in
12822         ''|0) try='void endnetent_r(struct netent_data*);'
12823         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12824         esac
12825         case "$endnetent_r_proto" in
12826         ''|0)   d_endnetent_r=undef
12827                 endnetent_r_proto=0
12828                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12829         * )     case "$endnetent_r_proto" in
12830                 REENTRANT_PROTO*) ;;
12831                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12832                 esac
12833                 echo "Prototype: $try" ;;
12834         esac
12835         ;;
12836         *)      case "$usethreads" in
12837                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12838                 esac
12839                 d_endnetent_r=undef
12840                 endnetent_r_proto=0
12841                 ;;
12842         esac
12843         ;;
12844 *)      endnetent_r_proto=0
12845         ;;
12846 esac
12847
12848 : see if endprotoent exists
12849 set endprotoent d_endpent
12850 eval $inlibc
12851
12852 : see if endprotoent_r exists
12853 set endprotoent_r d_endprotoent_r
12854 eval $inlibc
12855 case "$d_endprotoent_r" in
12856 "$define")
12857         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12858         case "$d_endprotoent_r_proto:$usethreads" in
12859         ":define")      d_endprotoent_r_proto=define
12860                 set d_endprotoent_r_proto endprotoent_r $hdrs
12861                 eval $hasproto ;;
12862         *)      ;;
12863         esac
12864         case "$d_endprotoent_r_proto" in
12865         define)
12866         case "$endprotoent_r_proto" in
12867         ''|0) try='int endprotoent_r(struct protoent_data*);'
12868         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12869         esac
12870         case "$endprotoent_r_proto" in
12871         ''|0) try='void endprotoent_r(struct protoent_data*);'
12872         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12873         esac
12874         case "$endprotoent_r_proto" in
12875         ''|0)   d_endprotoent_r=undef
12876                 endprotoent_r_proto=0
12877                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12878         * )     case "$endprotoent_r_proto" in
12879                 REENTRANT_PROTO*) ;;
12880                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12881                 esac
12882                 echo "Prototype: $try" ;;
12883         esac
12884         ;;
12885         *)      case "$usethreads" in
12886                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12887                 esac
12888                 d_endprotoent_r=undef
12889                 endprotoent_r_proto=0
12890                 ;;
12891         esac
12892         ;;
12893 *)      endprotoent_r_proto=0
12894         ;;
12895 esac
12896
12897 : see if endpwent exists
12898 set endpwent d_endpwent
12899 eval $inlibc
12900
12901 : see if this is a pwd.h system
12902 set pwd.h i_pwd
12903 eval $inhdr
12904
12905 case "$i_pwd" in
12906 $define)
12907         xxx=`./findhdr pwd.h`
12908         $cppstdin $cppflags $cppminus < $xxx >$$.h
12909
12910         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12911                 val="$define"
12912         else
12913                 val="$undef"
12914         fi
12915         set d_pwquota
12916         eval $setvar
12917
12918         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12919                 val="$define"
12920         else
12921                 val="$undef"
12922         fi
12923         set d_pwage
12924         eval $setvar
12925
12926         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12927                 val="$define"
12928         else
12929                 val="$undef"
12930         fi
12931         set d_pwchange
12932         eval $setvar
12933
12934         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12935                 val="$define"
12936         else
12937                 val="$undef"
12938         fi
12939         set d_pwclass
12940         eval $setvar
12941
12942         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12943                 val="$define"
12944         else
12945                 val="$undef"
12946         fi
12947         set d_pwexpire
12948         eval $setvar
12949
12950         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12951                 val="$define"
12952         else
12953                 val="$undef"
12954         fi
12955         set d_pwcomment
12956         eval $setvar
12957
12958         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12959                 val="$define"
12960         else
12961                 val="$undef"
12962         fi
12963         set d_pwgecos
12964         eval $setvar
12965
12966         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12967                 val="$define"
12968         else
12969                 val="$undef"
12970         fi
12971         set d_pwpasswd
12972         eval $setvar
12973
12974         $rm -f $$.h
12975         ;;
12976 *)
12977         val="$undef";
12978         set d_pwquota; eval $setvar
12979         set d_pwage; eval $setvar
12980         set d_pwchange; eval $setvar
12981         set d_pwclass; eval $setvar
12982         set d_pwexpire; eval $setvar
12983         set d_pwcomment; eval $setvar
12984         set d_pwgecos; eval $setvar
12985         set d_pwpasswd; eval $setvar
12986         ;;
12987 esac
12988
12989 : see if endpwent_r exists
12990 set endpwent_r d_endpwent_r
12991 eval $inlibc
12992 case "$d_endpwent_r" in
12993 "$define")
12994         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12995         case "$d_endpwent_r_proto:$usethreads" in
12996         ":define")      d_endpwent_r_proto=define
12997                 set d_endpwent_r_proto endpwent_r $hdrs
12998                 eval $hasproto ;;
12999         *)      ;;
13000         esac
13001         case "$d_endpwent_r_proto" in
13002         define)
13003         case "$endpwent_r_proto" in
13004         ''|0) try='int endpwent_r(FILE**);'
13005         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13006         esac
13007         case "$endpwent_r_proto" in
13008         ''|0) try='void endpwent_r(FILE**);'
13009         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13010         esac
13011         case "$endpwent_r_proto" in
13012         ''|0)   d_endpwent_r=undef
13013                 endpwent_r_proto=0
13014                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13015         * )     case "$endpwent_r_proto" in
13016                 REENTRANT_PROTO*) ;;
13017                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13018                 esac
13019                 echo "Prototype: $try" ;;
13020         esac
13021         ;;
13022         *)      case "$usethreads" in
13023                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13024                 esac
13025                 d_endpwent_r=undef
13026                 endpwent_r_proto=0
13027                 ;;
13028         esac
13029         ;;
13030 *)      endpwent_r_proto=0
13031         ;;
13032 esac
13033
13034 : see if endservent exists
13035 set endservent d_endsent
13036 eval $inlibc
13037
13038 : see if endservent_r exists
13039 set endservent_r d_endservent_r
13040 eval $inlibc
13041 case "$d_endservent_r" in
13042 "$define")
13043         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13044         case "$d_endservent_r_proto:$usethreads" in
13045         ":define")      d_endservent_r_proto=define
13046                 set d_endservent_r_proto endservent_r $hdrs
13047                 eval $hasproto ;;
13048         *)      ;;
13049         esac
13050         case "$d_endservent_r_proto" in
13051         define)
13052         case "$endservent_r_proto" in
13053         ''|0) try='int endservent_r(struct servent_data*);'
13054         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13055         esac
13056         case "$endservent_r_proto" in
13057         ''|0) try='void endservent_r(struct servent_data*);'
13058         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13059         esac
13060         case "$endservent_r_proto" in
13061         ''|0)   d_endservent_r=undef
13062                 endservent_r_proto=0
13063                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13064         * )     case "$endservent_r_proto" in
13065                 REENTRANT_PROTO*) ;;
13066                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13067                 esac
13068                 echo "Prototype: $try" ;;
13069         esac
13070         ;;
13071         *)      case "$usethreads" in
13072                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13073                 esac
13074                 d_endservent_r=undef
13075                 endservent_r_proto=0
13076                 ;;
13077         esac
13078         ;;
13079 *)      endservent_r_proto=0
13080         ;;
13081 esac
13082
13083 : Locate the flags for 'open()'
13084 echo " "
13085 $cat >try.c <<EOCP
13086 #include <sys/types.h>
13087 #ifdef I_FCNTL
13088 #include <fcntl.h>
13089 #endif
13090 #ifdef I_SYS_FILE
13091 #include <sys/file.h>
13092 #endif
13093 #$i_stdlib I_STDLIB
13094 #ifdef I_STDLIB
13095 #include <stdlib.h>
13096 #endif
13097 int main() {
13098         if(O_RDONLY);
13099 #ifdef O_TRUNC
13100         exit(0);
13101 #else
13102         exit(1);
13103 #endif
13104 }
13105 EOCP
13106 : check sys/file.h first to get FREAD on Sun
13107 if $test `./findhdr sys/file.h` && \
13108                 set try -DI_SYS_FILE && eval $compile; then
13109         h_sysfile=true;
13110         echo "<sys/file.h> defines the O_* constants..." >&4
13111         if $run ./try; then
13112                 echo "and you have the 3 argument form of open()." >&4
13113                 val="$define"
13114         else
13115                 echo "but not the 3 argument form of open().  Oh, well." >&4
13116                 val="$undef"
13117         fi
13118 elif $test `./findhdr fcntl.h` && \
13119                 set try -DI_FCNTL && eval $compile; then
13120         h_fcntl=true;
13121         echo "<fcntl.h> defines the O_* constants..." >&4
13122         if $run ./try; then
13123                 echo "and you have the 3 argument form of open()." >&4
13124                 val="$define"
13125         else
13126                 echo "but not the 3 argument form of open().  Oh, well." >&4
13127                 val="$undef"
13128         fi
13129 else
13130         val="$undef"
13131         echo "I can't find the O_* constant definitions!  You got problems." >&4
13132 fi
13133 set d_open3
13134 eval $setvar
13135 $rm_try
13136
13137 : see if this is a sys/file.h system
13138 val=''
13139 set sys/file.h val
13140 eval $inhdr
13141
13142 : do we need to include sys/file.h ?
13143 case "$val" in
13144 "$define")
13145         echo " "
13146         if $h_sysfile; then
13147                 val="$define"
13148                 echo "We'll be including <sys/file.h>." >&4
13149         else
13150                 val="$undef"
13151                 echo "We won't be including <sys/file.h>." >&4
13152         fi
13153         ;;
13154 *)
13155         h_sysfile=false
13156         ;;
13157 esac
13158 set i_sysfile
13159 eval $setvar
13160
13161 : see if fcntl.h is there
13162 val=''
13163 set fcntl.h val
13164 eval $inhdr
13165
13166 : see if we can include fcntl.h
13167 case "$val" in
13168 "$define")
13169         echo " "
13170         if $h_fcntl; then
13171                 val="$define"
13172                 echo "We'll be including <fcntl.h>." >&4
13173         else
13174                 val="$undef"
13175                 if $h_sysfile; then
13176         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13177                 else
13178                         echo "We won't be including <fcntl.h>." >&4
13179                 fi
13180         fi
13181         ;;
13182 *)
13183         h_fcntl=false
13184         val="$undef"
13185         ;;
13186 esac
13187 set i_fcntl
13188 eval $setvar
13189
13190 : see if fork exists
13191 set fork d_fork
13192 eval $inlibc
13193
13194 : see if pipe exists
13195 set pipe d_pipe
13196 eval $inlibc
13197
13198 : check for non-blocking I/O stuff
13199 case "$h_sysfile" in
13200 true) echo "#include <sys/file.h>" > head.c;;
13201 *)
13202        case "$h_fcntl" in
13203        true) echo "#include <fcntl.h>" > head.c;;
13204        *) echo "#include <sys/fcntl.h>" > head.c;;
13205        esac
13206        ;;
13207 esac
13208 echo " "
13209 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13210 case "$o_nonblock" in
13211 '')
13212         $cat head.c > try.c
13213         $cat >>try.c <<EOCP
13214 #include <stdio.h>
13215 #$i_stdlib I_STDLIB
13216 #ifdef I_STDLIB
13217 #include <stdlib.h>
13218 #endif
13219 #$i_fcntl I_FCNTL
13220 #ifdef I_FCNTL
13221 #include <fcntl.h>
13222 #endif
13223 int main() {
13224 #ifdef O_NONBLOCK
13225         printf("O_NONBLOCK\n");
13226         exit(0);
13227 #endif
13228 #ifdef O_NDELAY
13229         printf("O_NDELAY\n");
13230         exit(0);
13231 #endif
13232 #ifdef FNDELAY
13233         printf("FNDELAY\n");
13234         exit(0);
13235 #endif
13236         exit(0);
13237 }
13238 EOCP
13239         set try
13240         if eval $compile_ok; then
13241                 o_nonblock=`$run ./try`
13242                 case "$o_nonblock" in
13243                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13244                 *) echo "Seems like we can use $o_nonblock.";;
13245                 esac
13246         else
13247                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13248         fi
13249         ;;
13250 *) echo "Using $hint value $o_nonblock.";;
13251 esac
13252 $rm_try
13253
13254 echo " "
13255 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13256 case "$eagain" in
13257 '')
13258         case "$d_fork:$d_pipe:$d_alarm" in
13259         define:define:define)
13260         $cat head.c > try.c
13261         $cat >>try.c <<EOCP
13262 #include <errno.h>
13263 #include <sys/types.h>
13264 #include <signal.h>
13265 #include <stdio.h>
13266 #$i_stdlib I_STDLIB
13267 #ifdef I_STDLIB
13268 #include <stdlib.h>
13269 #endif
13270 #$i_fcntl I_FCNTL
13271 #ifdef I_FCNTL
13272 #include <fcntl.h>
13273 #endif
13274 #define MY_O_NONBLOCK $o_nonblock
13275 #ifndef errno  /* XXX need better Configure test */
13276 extern int errno;
13277 #endif
13278 #$i_unistd I_UNISTD
13279 #ifdef I_UNISTD
13280 #include <unistd.h>
13281 #endif
13282 #include <string.h>
13283 $signal_t blech(int x) { exit(3); }
13284 EOCP
13285         $cat >> try.c <<'EOCP'
13286 int main()
13287 {
13288         int pd[2];
13289         int pu[2];
13290         char buf[1];
13291         char string[100];
13292         int ret;
13293
13294         ret = pipe(pd); /* Down: child -> parent */
13295         if (ret != 0)
13296                 exit(3);
13297         ret = pipe(pu); /* Up: parent -> child */
13298         if (ret != 0)
13299                 exit(3);
13300         if (0 != fork()) {
13301                 close(pd[1]);   /* Parent reads from pd[0] */
13302                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13303 #ifdef F_SETFL
13304                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13305                         exit(1);
13306 #else
13307                 exit(4);
13308 #endif
13309                 signal(SIGALRM, blech);
13310                 alarm(5);
13311                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13312                         exit(2);
13313                 sprintf(string, "%d\n", ret);
13314                 ret = write(2, string, strlen(string));
13315                 if (ret != strlen(string))
13316                         exit(3);
13317                 alarm(0);
13318 #ifdef EAGAIN
13319                 if (errno == EAGAIN) {
13320                         printf("EAGAIN\n");
13321                         goto ok;
13322                 }
13323 #endif
13324 #ifdef EWOULDBLOCK
13325                 if (errno == EWOULDBLOCK)
13326                         printf("EWOULDBLOCK\n");
13327 #endif
13328         ok:
13329                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13330                 if (ret != 1)
13331                         exit(3);
13332                 sleep(2);                               /* Give it time to close our pipe */
13333                 alarm(5);
13334                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13335                 alarm(0);
13336                 sprintf(string, "%d\n", ret);
13337                 ret = write(4, string, strlen(string));
13338                 if (ret != strlen(string))
13339                         exit(3);
13340                 exit(0);
13341         }
13342
13343         close(pd[0]);                   /* We write to pd[1] */
13344         close(pu[1]);                   /* We read from pu[0] */
13345         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13346         if (ret != 1)
13347                 exit(3);
13348         close(pd[1]);                   /* Pipe pd is now fully closed! */
13349         exit(0);                                /* Bye bye, thank you for playing! */
13350 }
13351 EOCP
13352         set try
13353         if eval $compile_ok; then
13354                 echo "$startsh" >mtry
13355                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13356                 chmod +x mtry
13357                 $run ./mtry >/dev/null 2>&1
13358                 case $? in
13359                 0) eagain=`$cat try.out`;;
13360                 1) echo "Could not perform non-blocking setting!";;
13361                 2) echo "I did a successful read() for something that was not there!";;
13362                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13363                 4) echo "Could not find F_SETFL!";;
13364                 *) echo "Something terribly wrong happened during testing.";;
13365                 esac
13366                 rd_nodata=`$cat try.ret`
13367                 echo "A read() system call with no data present returns $rd_nodata."
13368                 case "$rd_nodata" in
13369                 0|-1) ;;
13370                 *)
13371                         echo "(That's peculiar, fixing that to be -1.)"
13372                         rd_nodata=-1
13373                         ;;
13374                 esac
13375                 case "$eagain" in
13376                 '')
13377                         echo "Forcing errno EAGAIN on read() with no data available."
13378                         eagain=EAGAIN
13379                         ;;
13380                 *)
13381                         echo "Your read() sets errno to $eagain when no data is available."
13382                         ;;
13383                 esac
13384                 status=`$cat try.err`
13385                 case "$status" in
13386                 0) echo "And it correctly returns 0 to signal EOF.";;
13387                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13388                 *) echo "However, your read() returns '$status' on EOF??";;
13389                 esac
13390                 val="$define"
13391                 if test "$status" = "$rd_nodata"; then
13392                         echo "WARNING: you can't distinguish between EOF and no data!"
13393                         val="$undef"
13394                 fi
13395         else
13396                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13397                 eagain=EAGAIN
13398         fi
13399         ;;
13400         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13401                 eagain=EAGAIN
13402                 val="$define"
13403                 ;;
13404         esac
13405         set d_eofnblk
13406         eval $setvar
13407         ;;
13408 *)
13409         echo "Using $hint value $eagain."
13410         echo "Your read() returns $rd_nodata when no data is present."
13411         case "$d_eofnblk" in
13412         "$define") echo "And you can see EOF because read() returns 0.";;
13413         "$undef") echo "But you can't see EOF status from read() returned value.";;
13414         *)
13415                 echo "(Assuming you can't see EOF status from read anyway.)"
13416                 d_eofnblk=$undef
13417                 ;;
13418         esac
13419         ;;
13420 esac
13421 $rm_try head.c mtry
13422
13423 : see if erf exists
13424 set erf d_erf
13425 eval $inlibc
13426
13427 : see if erfc exists
13428 set erfc d_erfc
13429 eval $inlibc
13430
13431 : see if exp2 exists
13432 set exp2 d_exp2
13433 eval $inlibc
13434
13435 : see if expm1 exists
13436 set expm1 d_expm1
13437 eval $inlibc
13438
13439 : see if _ptr and _cnt from stdio act std
13440 echo " "
13441
13442 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13443         echo "(Looks like you have stdio.h from BSD.)"
13444         case "$stdio_ptr" in
13445         '') stdio_ptr='((fp)->_p)'
13446                 ptr_lval=$define
13447                 ;;
13448         *)      ptr_lval=$d_stdio_ptr_lval;;
13449         esac
13450         case "$stdio_cnt" in
13451         '') stdio_cnt='((fp)->_r)'
13452                 cnt_lval=$define
13453                 ;;
13454         *)      cnt_lval=$d_stdio_cnt_lval;;
13455         esac
13456         case "$stdio_base" in
13457         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13458         esac
13459         case "$stdio_bufsiz" in
13460         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13461         esac
13462 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13463         echo "(Looks like you have stdio.h from Linux.)"
13464         case "$stdio_ptr" in
13465         '') stdio_ptr='((fp)->_IO_read_ptr)'
13466                 ptr_lval=$define
13467                 ;;
13468         *)      ptr_lval=$d_stdio_ptr_lval;;
13469         esac
13470         case "$stdio_cnt" in
13471         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13472                 cnt_lval=$undef
13473                 ;;
13474         *)      cnt_lval=$d_stdio_cnt_lval;;
13475         esac
13476         case "$stdio_base" in
13477         '') stdio_base='((fp)->_IO_read_base)';;
13478         esac
13479         case "$stdio_bufsiz" in
13480         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13481         esac
13482 else
13483         case "$stdio_ptr" in
13484         '') stdio_ptr='((fp)->_ptr)'
13485                 ptr_lval=$define
13486                 ;;
13487         *)      ptr_lval=$d_stdio_ptr_lval;;
13488         esac
13489         case "$stdio_cnt" in
13490         '') stdio_cnt='((fp)->_cnt)'
13491                 cnt_lval=$define
13492                 ;;
13493         *)      cnt_lval=$d_stdio_cnt_lval;;
13494         esac
13495         case "$stdio_base" in
13496         '') stdio_base='((fp)->_base)';;
13497         esac
13498         case "$stdio_bufsiz" in
13499         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13500         esac
13501 fi
13502
13503 : test whether _ptr and _cnt really work
13504 echo "Checking how std your stdio is..." >&4
13505 $cat >try.c <<EOP
13506 #include <stdio.h>
13507 #$i_stdlib I_STDLIB
13508 #ifdef I_STDLIB
13509 #include <stdlib.h>
13510 #endif
13511 #define FILE_ptr(fp)    $stdio_ptr
13512 #define FILE_cnt(fp)    $stdio_cnt
13513 int main() {
13514         FILE *fp = fopen("try.c", "r");
13515         char c = getc(fp);
13516         if (
13517                 18 <= FILE_cnt(fp) &&
13518                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13519         )
13520                 exit(0);
13521         exit(1);
13522 }
13523 EOP
13524 val="$undef"
13525 set try
13526 if eval $compile && $to try.c; then
13527         if $run ./try; then
13528                 echo "Your stdio acts pretty std."
13529                 val="$define"
13530         else
13531                 echo "Your stdio isn't very std."
13532         fi
13533 else
13534         echo "Your stdio doesn't appear very std."
13535 fi
13536 $rm_try
13537
13538 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13539 # direct buffer manipulation no longer works.  The Configure tests
13540 # should be changed to correctly detect this, but until then,
13541 # the following check should at least let perl compile and run.
13542 # (This quick fix should be updated before 5.8.1.)
13543 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13544 # A. Dougherty, June 3, 2002.
13545 case "$d_gnulibc" in
13546 $define)
13547         case "$gnulibc_version" in
13548         2.[01]*)  ;;
13549         2.2) ;;
13550         2.2.[0-9]) ;;
13551         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13552                 val="$undef"
13553                 ;;
13554         esac
13555         ;;
13556 esac
13557 set d_stdstdio
13558 eval $setvar
13559
13560 : Can _ptr be used as an lvalue?
13561 case "$d_stdstdio$ptr_lval" in
13562 $define$define) val=$define ;;
13563 *) val=$undef ;;
13564 esac
13565 set d_stdio_ptr_lval
13566 eval $setvar
13567
13568 : Can _cnt be used as an lvalue?
13569 case "$d_stdstdio$cnt_lval" in
13570 $define$define) val=$define ;;
13571 *) val=$undef ;;
13572 esac
13573 set d_stdio_cnt_lval
13574 eval $setvar
13575
13576
13577 : test whether setting _ptr sets _cnt as a side effect
13578 d_stdio_ptr_lval_sets_cnt="$undef"
13579 d_stdio_ptr_lval_nochange_cnt="$undef"
13580 case "$d_stdio_ptr_lval$d_stdstdio" in
13581 $define$define)
13582         echo "Checking to see what happens if we set the stdio ptr..." >&4
13583 $cat >try.c <<EOP
13584 #include <stdio.h>
13585 /* Can we scream? */
13586 /* Eat dust sed :-) */
13587 /* In the buffer space, no one can hear you scream. */
13588 #$i_stdlib I_STDLIB
13589 #ifdef I_STDLIB
13590 #include <stdlib.h>
13591 #endif
13592 #define FILE_ptr(fp)    $stdio_ptr
13593 #define FILE_cnt(fp)    $stdio_cnt
13594 #include <sys/types.h>
13595 int main() {
13596         FILE *fp = fopen("try.c", "r");
13597         int c;
13598         char *ptr;
13599         size_t cnt;
13600         if (!fp) {
13601             puts("Fail even to read");
13602             exit(1);
13603         }
13604         c = getc(fp); /* Read away the first # */
13605         if (c == EOF) {
13606             puts("Fail even to read");
13607             exit(1);
13608         }
13609         if (!(
13610                 18 <= FILE_cnt(fp) &&
13611                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13612         )) {
13613                 puts("Fail even to read");
13614                 exit (1);
13615         }
13616         ptr = (char*) FILE_ptr(fp);
13617         cnt = (size_t)FILE_cnt(fp);
13618
13619         FILE_ptr(fp) += 42;
13620
13621         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13622                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13623                 exit (1);
13624         }
13625         if (FILE_cnt(fp) <= 20) {
13626                 printf ("Fail (<20 chars to test)");
13627                 exit (1);
13628         }
13629         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13630                 puts("Fail compare");
13631                 exit (1);
13632         }
13633         if (cnt == FILE_cnt(fp)) {
13634                 puts("Pass_unchanged");
13635                 exit (0);
13636         }
13637         if (FILE_cnt(fp) == (cnt - 42)) {
13638                 puts("Pass_changed");
13639                 exit (0);
13640         }
13641         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13642         return 1;
13643
13644 }
13645 EOP
13646         set try
13647         if eval $compile && $to try.c; then
13648                 case `$run ./try` in
13649                 Pass_changed)
13650                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13651                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13652                 Pass_unchanged)
13653                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13654                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13655                 Fail*)
13656                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13657                 *)
13658                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13659         esac
13660         else
13661                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13662         fi
13663         $rm_try
13664         ;;
13665 esac
13666
13667 : see if _base is also standard
13668 val="$undef"
13669 case "$d_stdstdio" in
13670 $define)
13671         $cat >try.c <<EOP
13672 #include <stdio.h>
13673 #$i_stdlib I_STDLIB
13674 #ifdef I_STDLIB
13675 #include <stdlib.h>
13676 #endif
13677 #define FILE_base(fp)   $stdio_base
13678 #define FILE_bufsiz(fp) $stdio_bufsiz
13679 int main() {
13680         FILE *fp = fopen("try.c", "r");
13681         char c = getc(fp);
13682         if (
13683                 19 <= FILE_bufsiz(fp) &&
13684                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13685         )
13686                 exit(0);
13687         exit(1);
13688 }
13689 EOP
13690         set try
13691         if eval $compile && $to try.c; then
13692                 if $run ./try; then
13693                         echo "And its _base field acts std."
13694                         val="$define"
13695                 else
13696                         echo "But its _base field isn't std."
13697                 fi
13698         else
13699                 echo "However, it seems to be lacking the _base field."
13700         fi
13701         $rm_try
13702         ;;
13703 esac
13704 set d_stdiobase
13705 eval $setvar
13706
13707 : see if fast_stdio exists
13708 val="$undef"
13709 case "$d_stdstdio:$d_stdio_ptr_lval" in
13710 "$define:$define")
13711         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13712         *$define*)
13713                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13714                 val="$define"
13715                 ;;
13716         esac
13717         ;;
13718 esac
13719 set d_faststdio
13720 eval $setvar
13721
13722 : see if fchdir exists
13723 set fchdir d_fchdir
13724 eval $inlibc
13725
13726 : see if fchmod exists
13727 set fchmod d_fchmod
13728 eval $inlibc
13729
13730 : check for openat, unlinkat, renameat, linkat, fchmodat
13731 set openat d_openat
13732 eval $inlibc
13733
13734 set unlinkat d_unlinkat
13735 eval $inlibc
13736
13737 set renameat d_renameat
13738 eval $inlibc
13739
13740 set linkat d_linkat
13741 eval $inlibc
13742
13743 set fchmodat d_fchmodat
13744 eval $inlibc
13745
13746 : see if fchown exists
13747 set fchown d_fchown
13748 eval $inlibc
13749
13750 : see if this is an fcntl system
13751 set fcntl d_fcntl
13752 eval $inlibc
13753
13754 : See if fcntl-based locking works.
13755 echo " "
13756 $cat >try.c <<EOCP
13757 #$i_stdlib I_STDLIB
13758 #ifdef I_STDLIB
13759 #include <stdlib.h>
13760 #endif
13761 #include <unistd.h>
13762 #include <fcntl.h>
13763 #include <signal.h>
13764 $signal_t blech(int x) { exit(3); }
13765 int main() {
13766 #if defined(F_SETLK) && defined(F_SETLKW)
13767      struct flock flock;
13768      int retval, fd;
13769      fd = open("try.c", O_RDONLY);
13770      flock.l_type = F_RDLCK;
13771      flock.l_whence = SEEK_SET;
13772      flock.l_start = flock.l_len = 0;
13773      signal(SIGALRM, blech);
13774      alarm(10);
13775      retval = fcntl(fd, F_SETLK, &flock);
13776      close(fd);
13777      (retval < 0 ? exit(2) : exit(0));
13778 #else
13779      exit(2);
13780 #endif
13781 }
13782 EOCP
13783 echo "Checking if fcntl-based file locking works... "
13784 case "$d_fcntl" in
13785 "$define")
13786         set try
13787         if eval $compile_ok; then
13788                 if $run ./try; then
13789                         echo "Yes, it seems to work."
13790                         val="$define"
13791                 else
13792                         echo "Nope, it didn't work."
13793                         val="$undef"
13794                         case "$?" in
13795                         3) $cat >&4 <<EOM
13796 ***
13797 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13798 *** This is (almost) impossible.
13799 *** If your NFS lock daemons are not feeling well, something like
13800 *** this may happen, please investigate.  Cannot continue, aborting.
13801 ***
13802 EOM
13803                                 exit 1
13804                                 ;;
13805                         esac
13806                 fi
13807         else
13808                 echo "I'm unable to compile the test program, so I'll assume not."
13809                 val="$undef"
13810         fi
13811         ;;
13812 *) val="$undef";
13813         echo "Nope, since you don't even have fcntl()."
13814         ;;
13815 esac
13816 set d_fcntl_can_lock
13817 eval $setvar
13818 $rm_try
13819
13820 : check for fd_set items
13821 $cat <<EOM
13822
13823 Checking to see how well your C compiler handles fd_set and friends ...
13824 EOM
13825 $cat >try.c <<EOCP
13826 #$i_stdlib I_STDLIB
13827 #ifdef I_STDLIB
13828 #include <stdlib.h>
13829 #endif
13830 #$i_systime I_SYS_TIME
13831 #$i_sysselct I_SYS_SELECT
13832 #$d_socket HAS_SOCKET
13833 #include <sys/types.h>
13834 #ifdef HAS_SOCKET
13835 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13836 #endif
13837 #ifdef I_SYS_TIME
13838 #include <sys/time.h>
13839 #endif
13840 #ifdef I_SYS_SELECT
13841 #include <sys/select.h>
13842 #endif
13843 int main() {
13844         fd_set fds;
13845
13846 #ifdef TRYBITS
13847         if(fds.fds_bits);
13848 #endif
13849
13850 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13851         exit(0);
13852 #else
13853         exit(1);
13854 #endif
13855 }
13856 EOCP
13857 set try -DTRYBITS
13858 if eval $compile; then
13859         d_fds_bits="$define"
13860         d_fd_set="$define"
13861         echo "Well, your system knows about the normal fd_set typedef..." >&4
13862         if $run ./try; then
13863                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13864                 d_fd_macros="$define"
13865         else
13866                 $cat >&4 <<'EOM'
13867 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13868 EOM
13869                 d_fd_macros="$undef"
13870         fi
13871 else
13872         $cat <<'EOM'
13873 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13874 EOM
13875         set try
13876         if eval $compile; then
13877                 d_fds_bits="$undef"
13878                 d_fd_set="$define"
13879                 echo "Well, your system has some sort of fd_set available..." >&4
13880                 if $run ./try; then
13881                         echo "and you have the normal fd_set macros." >&4
13882                         d_fd_macros="$define"
13883                 else
13884                         $cat <<'EOM'
13885 but not the normal fd_set macros!  Gross!  More work for me...
13886 EOM
13887                         d_fd_macros="$undef"
13888                 fi
13889         else
13890         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13891                 d_fd_set="$undef"
13892                 d_fds_bits="$undef"
13893                 d_fd_macros="$undef"
13894         fi
13895 fi
13896 $rm_try
13897
13898 : see if fdclose exists
13899 set fdclose d_fdclose
13900 eval $inlibc
13901
13902 : see if fdim exists
13903 set fdim d_fdim
13904 eval $inlibc
13905
13906 : see if fegetround exists
13907 set fegetround d_fegetround
13908 eval $inlibc
13909
13910 : see if fgetpos exists
13911 set fgetpos d_fgetpos
13912 eval $inlibc
13913
13914 : see if finite exists
13915 set finite d_finite
13916 eval $inlibc
13917
13918 : see if finitel exists
13919 set finitel d_finitel
13920 eval $inlibc
13921
13922 : see if flock exists
13923 set flock d_flock
13924 eval $inlibc
13925
13926 : see if prototype for flock is available
13927 echo " "
13928 set d_flockproto flock $i_sysfile sys/file.h
13929 eval $hasproto
13930
13931 : see if fma exists
13932 set fma d_fma
13933 eval $inlibc
13934
13935 : see if fmax exists
13936 set fmax d_fmax
13937 eval $inlibc
13938
13939 : see if fmin exists
13940 set fmin d_fmin
13941 eval $inlibc
13942
13943 : see if fp_class exists
13944 set fp_class d_fp_class
13945 eval $inlibc
13946
13947 : check for fpclassify
13948 echo "Checking to see if you have fpclassify..." >&4
13949 $cat >try.c <<EOCP
13950 #include <math.h>
13951 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13952 EOCP
13953 set try
13954 if eval $compile; then
13955         val="$define"
13956         echo "You have fpclassify."
13957 else
13958         val="$undef"
13959         echo "You do not have fpclassify."
13960 fi
13961 $rm_try
13962 set d_fpclassify
13963 eval $setvar
13964
13965 : see if fp_classify exists
13966 set fp_classify d_fp_classify
13967 eval $inlibc
13968
13969 : see if fp_classl exists
13970 set fp_classl d_fp_classl
13971 eval $inlibc
13972
13973 : see if pathconf exists
13974 set pathconf d_pathconf
13975 eval $inlibc
13976
13977 : see if fpathconf exists
13978 set fpathconf d_fpathconf
13979 eval $inlibc
13980
13981 : see if fpclass exists
13982 set fpclass d_fpclass
13983 eval $inlibc
13984
13985 : see if fpclassl exists
13986 set fpclassl d_fpclassl
13987 eval $inlibc
13988
13989 : see if fpgetround exists
13990 set fpgetround d_fpgetround
13991 eval $inlibc
13992
13993 : check for fpos64_t
13994 echo " "
13995 echo "Checking to see if you have fpos64_t..." >&4
13996 $cat >try.c <<EOCP
13997 #include <stdio.h>
13998 int main() { fpos64_t x = 7; }
13999 EOCP
14000 set try
14001 if eval $compile; then
14002         val="$define"
14003         echo "You have fpos64_t."
14004 else
14005         val="$undef"
14006         echo "You do not have fpos64_t."
14007         case "$fpossize" in
14008         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14009         esac
14010 fi
14011 $rm_try
14012 set d_fpos64_t
14013 eval $setvar
14014
14015 : see if frexpl exists
14016 set frexpl d_frexpl
14017 eval $inlibc
14018
14019 : see if this is a sys/param system
14020 set sys/param.h i_sysparam
14021 eval $inhdr
14022
14023 : see if this is a sys/mount.h system
14024 set sys/mount.h i_sysmount
14025 eval $inhdr
14026
14027 : Check for fs_data_s
14028 echo " "
14029 echo "Checking to see if your system supports struct fs_data..." >&4
14030 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14031 eval $hasstruct
14032 case "$d_fs_data_s" in
14033 "$define")      echo "Yes, it does."   ;;
14034 *)              echo "No, it doesn't." ;;
14035 esac
14036
14037 : see if fseeko exists
14038 set fseeko d_fseeko
14039 eval $inlibc
14040 case "$longsize" in
14041 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14042 esac
14043
14044 : see if fsetpos exists
14045 set fsetpos d_fsetpos
14046 eval $inlibc
14047
14048 : see if fstatfs exists
14049 set fstatfs d_fstatfs
14050 eval $inlibc
14051
14052 : see if statvfs exists
14053 set statvfs d_statvfs
14054 eval $inlibc
14055
14056 : see if fstatvfs exists
14057 set fstatvfs d_fstatvfs
14058 eval $inlibc
14059
14060 : see if fsync exists
14061 set fsync d_fsync
14062 eval $inlibc
14063
14064 : see if ftello exists
14065 set ftello d_ftello
14066 eval $inlibc
14067 case "$longsize" in
14068 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14069 esac
14070
14071 : check for a working futimes
14072 d_futimes="$undef"
14073 echo " "
14074 echo "Checking if you have a working futimes()" >&4
14075 $cat >try.c <<EOCP
14076 #include <stdio.h>
14077 #include <sys/time.h>
14078 #include <errno.h>
14079 #include <fcntl.h>
14080
14081 int main ()
14082 {
14083     int fd, rv;
14084     fd = open ("try.c", O_RDWR);
14085     if (-1 == fd) exit (1);
14086     rv = futimes (fd, NULL);
14087     exit (rv == -1 ? errno : 0);
14088 }
14089 EOCP
14090 set try
14091 if eval $compile; then
14092     `$run ./try`
14093     rc=$?
14094     case "$rc" in
14095         0)  echo "Yes, you have" >&4
14096             d_futimes="$define"
14097             ;;
14098         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14099             ;;
14100     esac
14101 else
14102     echo "No, it does not (probably harmless)" >&4
14103 fi
14104 $rm_try
14105
14106 : look for gai_strerror
14107 echo " "
14108 $cat >try.c <<'EOCP'
14109 #include <sys/types.h>
14110 #include <sys/socket.h>
14111 #include <netdb.h>
14112 int main ()
14113 {
14114     return (gai_strerror (0) ? 0 : 1);
14115     }
14116 EOCP
14117 set try
14118 val="$undef"
14119 if eval $compile; then
14120     `$run ./try`
14121     case "$?" in
14122         0)  echo "A working gai_strerror() found." >&4
14123             val="$define" ;;
14124         *)  echo "gai_strerror() found, but it doesn't work" >&4
14125             ;;
14126         esac
14127 else
14128     echo "gai_strerror() NOT found." >&4
14129     fi
14130 set d_gai_strerror
14131 eval $setvar
14132 $rm_try
14133
14134 : see if ndbm.h is available
14135 set ndbm.h i_ndbm
14136 eval $inhdr
14137 : Compatibility location for RedHat 7.1
14138 set gdbm/ndbm.h i_gdbmndbm
14139 eval $inhdr
14140 : Compatibility location for Debian 4.0
14141 set gdbm-ndbm.h i_gdbm_ndbm
14142 eval $inhdr
14143
14144 val="$undef"
14145 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14146         : see if dbm_open exists
14147         set dbm_open d_dbm_open
14148         eval $inlibc
14149         case "$d_dbm_open" in
14150         $undef)
14151                 i_ndbm="$undef"
14152                 i_gdbmndbm="$undef"
14153                 i_gdbm_ndbm="$undef"
14154                 echo "We won't be including <ndbm.h>"
14155                 val="$undef"
14156                 ;;
14157         *) val="$define"
14158            ;;
14159         esac
14160 fi
14161 set d_ndbm
14162 eval $setvar
14163
14164 ndbm_hdr_protochk='name=$1; hdr=$2;
14165 eval "ihdr=\$""i_$name";
14166 val="$undef";
14167 if $test "$ihdr" = "$define"; then
14168         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14169         case "$d_cplusplus" in
14170         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14171         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14172         esac;
14173         case "$val" in
14174         $define) $echo "Your <$hdr> seems to have prototypes";;
14175         *) $echo "Your <$hdr> does not seem to have prototypes";;
14176         esac;
14177 fi;
14178 set "d_${name}_h_uses_prototypes";
14179 eval $setvar'
14180
14181 set ndbm ndbm.h
14182 eval $ndbm_hdr_protochk
14183 set gdbmndbm gdbm/ndbm.h
14184 eval $ndbm_hdr_protochk
14185 set gdbm_ndbm gdbm-ndbm.h
14186 eval $ndbm_hdr_protochk
14187
14188 : see if getaddrinfo exists
14189 set getaddrinfo d_getaddrinfo
14190 eval $inlibc
14191
14192 : see if getcwd exists
14193 set getcwd d_getcwd
14194 eval $inlibc
14195
14196 : see if getespwnam exists
14197 set getespwnam d_getespwnam
14198 eval $inlibc
14199
14200 : see if getfsstat exists
14201 set getfsstat d_getfsstat
14202 eval $inlibc
14203
14204 : see if getgrent exists
14205 set getgrent d_getgrent
14206 eval $inlibc
14207
14208 : see if getgrent_r exists
14209 set getgrent_r d_getgrent_r
14210 eval $inlibc
14211 case "$d_getgrent_r" in
14212 "$define")
14213         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14214         case "$d_getgrent_r_proto:$usethreads" in
14215         ":define")      d_getgrent_r_proto=define
14216                 set d_getgrent_r_proto getgrent_r $hdrs
14217                 eval $hasproto ;;
14218         *)      ;;
14219         esac
14220         case "$d_getgrent_r_proto" in
14221         define)
14222         case "$getgrent_r_proto" in
14223         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14224         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14225         esac
14226         case "$getgrent_r_proto" in
14227         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14228         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14229         esac
14230         case "$getgrent_r_proto" in
14231         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14232         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14233         esac
14234         case "$getgrent_r_proto" in
14235         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14236         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14237         esac
14238         case "$getgrent_r_proto" in
14239         ''|0) try='int getgrent_r(struct group*, char*, int);'
14240         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14241         esac
14242         case "$getgrent_r_proto" in
14243         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14244         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14245         esac
14246         case "$getgrent_r_proto" in
14247         ''|0)   d_getgrent_r=undef
14248                 getgrent_r_proto=0
14249                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14250         * )     case "$getgrent_r_proto" in
14251                 REENTRANT_PROTO*) ;;
14252                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14253                 esac
14254                 echo "Prototype: $try" ;;
14255         esac
14256         ;;
14257         *)      case "$usethreads" in
14258                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14259                 esac
14260                 d_getgrent_r=undef
14261                 getgrent_r_proto=0
14262                 ;;
14263         esac
14264         ;;
14265 *)      getgrent_r_proto=0
14266         ;;
14267 esac
14268
14269 : see if getgrgid_r exists
14270 set getgrgid_r d_getgrgid_r
14271 eval $inlibc
14272 case "$d_getgrgid_r" in
14273 "$define")
14274         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14275         case "$d_getgrgid_r_proto:$usethreads" in
14276         ":define")      d_getgrgid_r_proto=define
14277                 set d_getgrgid_r_proto getgrgid_r $hdrs
14278                 eval $hasproto ;;
14279         *)      ;;
14280         esac
14281         case "$d_getgrgid_r_proto" in
14282         define)
14283         case "$getgrgid_r_proto" in
14284         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14285         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14286         esac
14287         case "$getgrgid_r_proto" in
14288         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14289         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14290         esac
14291         case "$getgrgid_r_proto" in
14292         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14293         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14294         esac
14295         case "$getgrgid_r_proto" in
14296         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14297         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14298         esac
14299         case "$getgrgid_r_proto" in
14300         ''|0)   d_getgrgid_r=undef
14301                 getgrgid_r_proto=0
14302                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14303         * )     case "$getgrgid_r_proto" in
14304                 REENTRANT_PROTO*) ;;
14305                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14306                 esac
14307                 echo "Prototype: $try" ;;
14308         esac
14309         ;;
14310         *)      case "$usethreads" in
14311                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14312                 esac
14313                 d_getgrgid_r=undef
14314                 getgrgid_r_proto=0
14315                 ;;
14316         esac
14317         ;;
14318 *)      getgrgid_r_proto=0
14319         ;;
14320 esac
14321
14322 : see if getgrnam_r exists
14323 set getgrnam_r d_getgrnam_r
14324 eval $inlibc
14325 case "$d_getgrnam_r" in
14326 "$define")
14327         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14328         case "$d_getgrnam_r_proto:$usethreads" in
14329         ":define")      d_getgrnam_r_proto=define
14330                 set d_getgrnam_r_proto getgrnam_r $hdrs
14331                 eval $hasproto ;;
14332         *)      ;;
14333         esac
14334         case "$d_getgrnam_r_proto" in
14335         define)
14336         case "$getgrnam_r_proto" in
14337         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14338         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14339         esac
14340         case "$getgrnam_r_proto" in
14341         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14342         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14343         esac
14344         case "$getgrnam_r_proto" in
14345         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14346         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14347         esac
14348         case "$getgrnam_r_proto" in
14349         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14350         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14351         esac
14352         case "$getgrnam_r_proto" in
14353         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14354         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14355         esac
14356         case "$getgrnam_r_proto" in
14357         ''|0)   d_getgrnam_r=undef
14358                 getgrnam_r_proto=0
14359                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14360         * )     case "$getgrnam_r_proto" in
14361                 REENTRANT_PROTO*) ;;
14362                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14363                 esac
14364                 echo "Prototype: $try" ;;
14365         esac
14366         ;;
14367         *)      case "$usethreads" in
14368                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14369                 esac
14370                 d_getgrnam_r=undef
14371                 getgrnam_r_proto=0
14372                 ;;
14373         esac
14374         ;;
14375 *)      getgrnam_r_proto=0
14376         ;;
14377 esac
14378
14379 : see if gethostbyaddr exists
14380 set gethostbyaddr d_gethbyaddr
14381 eval $inlibc
14382
14383 : see if gethostbyname exists
14384 set gethostbyname d_gethbyname
14385 eval $inlibc
14386
14387 : see if gethostent exists
14388 set gethostent d_gethent
14389 eval $inlibc
14390
14391 : see how we will look up host name
14392 echo " "
14393 call=''
14394 if set gethostname val -f d_gethname; eval $csym; $val; then
14395         echo 'gethostname() found.' >&4
14396         d_gethname="$define"
14397         call=gethostname
14398 fi
14399 if set uname val -f d_uname; eval $csym; $val; then
14400         if ./xenix; then
14401                 $cat <<'EOM'
14402 uname() was found, but you're running xenix, and older versions of xenix
14403 have a broken uname(). If you don't really know whether your xenix is old
14404 enough to have a broken system call, use the default answer.
14405
14406 EOM
14407                 dflt=y
14408                 case "$d_uname" in
14409                 "$define") dflt=n;;
14410                 esac
14411                 rp='Is your uname() broken?'
14412                 . ./myread
14413                 case "$ans" in
14414                 n*) d_uname="$define"; call=uname;;
14415                 esac
14416         else
14417                 echo 'uname() found.' >&4
14418                 d_uname="$define"
14419                 case "$call" in
14420                 '') call=uname ;;
14421                 esac
14422         fi
14423 fi
14424 case "$d_gethname" in
14425 '') d_gethname="$undef";;
14426 esac
14427 case "$d_uname" in
14428 '') d_uname="$undef";;
14429 esac
14430 case "$d_uname$d_gethname" in
14431 *define*)
14432         dflt=n
14433         cat <<EOM
14434
14435 Every now and then someone has a $call() that lies about the hostname
14436 but can't be fixed for political or economic reasons.  If you wish, I can
14437 pretend $call() isn't there and maybe compute hostname at run-time
14438 thanks to the '$phostname' command.
14439
14440 EOM
14441         rp="Shall I ignore $call() from now on?"
14442         . ./myread
14443         case "$ans" in
14444         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14445         esac;;
14446 esac
14447 case "$phostname" in
14448 '') aphostname='';;
14449 *) case "$aphostname" in
14450         /*) ;;
14451         *) set X $phostname
14452                 shift
14453                 file=$1
14454                 shift
14455                 file=`./loc $file $file $pth`
14456                 aphostname=`echo $file $*`
14457                 ;;
14458         esac
14459         ;;
14460 esac
14461 case "$d_uname$d_gethname" in
14462 *define*) ;;
14463 *)
14464         case "$phostname" in
14465         '')
14466                 echo "There will be no way for $package to get your hostname." >&4;;
14467         *)
14468         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14469                 ;;
14470         esac;;
14471 esac
14472 case "$d_phostname" in
14473 '') d_phostname="$undef";;
14474 esac
14475
14476 : see if gethostbyaddr_r exists
14477 set gethostbyaddr_r d_gethostbyaddr_r
14478 eval $inlibc
14479 case "$d_gethostbyaddr_r" in
14480 "$define")
14481         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14482         case "$d_gethostbyaddr_r_proto:$usethreads" in
14483         ":define")      d_gethostbyaddr_r_proto=define
14484                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14485                 eval $hasproto ;;
14486         *)      ;;
14487         esac
14488         case "$d_gethostbyaddr_r_proto" in
14489         define)
14490         case "$gethostbyaddr_r_proto" in
14491         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14492         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14493         esac
14494         case "$gethostbyaddr_r_proto" in
14495         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14496         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14497         esac
14498         case "$gethostbyaddr_r_proto" in
14499         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14500         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14501         esac
14502         case "$gethostbyaddr_r_proto" in
14503         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14504         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14505         esac
14506         case "$gethostbyaddr_r_proto" in
14507         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14508         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14509         esac
14510         case "$gethostbyaddr_r_proto" in
14511         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14512         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14513         esac
14514         case "$gethostbyaddr_r_proto" in
14515         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14516         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14517         esac
14518         case "$gethostbyaddr_r_proto" in
14519         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14520         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14521         esac
14522         case "$gethostbyaddr_r_proto" in
14523         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14524         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14525         esac
14526         case "$gethostbyaddr_r_proto" in
14527         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14528         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14529         esac
14530         case "$gethostbyaddr_r_proto" in
14531         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14532         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14533         esac
14534         case "$gethostbyaddr_r_proto" in
14535         ''|0)   d_gethostbyaddr_r=undef
14536                 gethostbyaddr_r_proto=0
14537                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14538         * )     case "$gethostbyaddr_r_proto" in
14539                 REENTRANT_PROTO*) ;;
14540                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14541                 esac
14542                 echo "Prototype: $try" ;;
14543         esac
14544         ;;
14545         *)      case "$usethreads" in
14546                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14547                 esac
14548                 d_gethostbyaddr_r=undef
14549                 gethostbyaddr_r_proto=0
14550                 ;;
14551         esac
14552         ;;
14553 *)      gethostbyaddr_r_proto=0
14554         ;;
14555 esac
14556
14557 : see if gethostbyname_r exists
14558 set gethostbyname_r d_gethostbyname_r
14559 eval $inlibc
14560 case "$d_gethostbyname_r" in
14561 "$define")
14562         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14563         case "$d_gethostbyname_r_proto:$usethreads" in
14564         ":define")      d_gethostbyname_r_proto=define
14565                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14566                 eval $hasproto ;;
14567         *)      ;;
14568         esac
14569         case "$d_gethostbyname_r_proto" in
14570         define)
14571         case "$gethostbyname_r_proto" in
14572         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14573         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14574         esac
14575         case "$gethostbyname_r_proto" in
14576         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14577         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14578         esac
14579         case "$gethostbyname_r_proto" in
14580         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14581         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14582         esac
14583         case "$gethostbyname_r_proto" in
14584         ''|0)   d_gethostbyname_r=undef
14585                 gethostbyname_r_proto=0
14586                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14587         * )     case "$gethostbyname_r_proto" in
14588                 REENTRANT_PROTO*) ;;
14589                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14590                 esac
14591                 echo "Prototype: $try" ;;
14592         esac
14593         ;;
14594         *)      case "$usethreads" in
14595                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14596                 esac
14597                 d_gethostbyname_r=undef
14598                 gethostbyname_r_proto=0
14599                 ;;
14600         esac
14601         ;;
14602 *)      gethostbyname_r_proto=0
14603         ;;
14604 esac
14605
14606 : see if gethostent_r exists
14607 set gethostent_r d_gethostent_r
14608 eval $inlibc
14609 case "$d_gethostent_r" in
14610 "$define")
14611         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14612         case "$d_gethostent_r_proto:$usethreads" in
14613         ":define")      d_gethostent_r_proto=define
14614                 set d_gethostent_r_proto gethostent_r $hdrs
14615                 eval $hasproto ;;
14616         *)      ;;
14617         esac
14618         case "$d_gethostent_r_proto" in
14619         define)
14620         case "$gethostent_r_proto" in
14621         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14622         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14623         esac
14624         case "$gethostent_r_proto" in
14625         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14626         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14627         esac
14628         case "$gethostent_r_proto" in
14629         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14630         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14631         esac
14632         case "$gethostent_r_proto" in
14633         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14634         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14635         esac
14636         case "$gethostent_r_proto" in
14637         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14638         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14639         esac
14640         case "$gethostent_r_proto" in
14641         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14642         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14643         esac
14644         case "$gethostent_r_proto" in
14645         ''|0)   d_gethostent_r=undef
14646                 gethostent_r_proto=0
14647                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14648         * )     case "$gethostent_r_proto" in
14649                 REENTRANT_PROTO*) ;;
14650                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14651                 esac
14652                 echo "Prototype: $try" ;;
14653         esac
14654         ;;
14655         *)      case "$usethreads" in
14656                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14657                 esac
14658                 d_gethostent_r=undef
14659                 gethostent_r_proto=0
14660                 ;;
14661         esac
14662         ;;
14663 *)      gethostent_r_proto=0
14664         ;;
14665 esac
14666
14667 : see if prototypes for various gethostxxx netdb.h functions are available
14668 echo " "
14669 set d_gethostprotos gethostent $i_netdb netdb.h
14670 eval $hasproto
14671
14672 : see if getitimer exists
14673 set getitimer d_getitimer
14674 eval $inlibc
14675
14676 : see if getlogin exists
14677 set getlogin d_getlogin
14678 eval $inlibc
14679
14680 : see if getlogin_r exists
14681 set getlogin_r d_getlogin_r
14682 eval $inlibc
14683 case "$d_getlogin_r" in
14684 "$define")
14685         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14686         case "$d_getlogin_r_proto:$usethreads" in
14687         ":define")      d_getlogin_r_proto=define
14688                 set d_getlogin_r_proto getlogin_r $hdrs
14689                 eval $hasproto ;;
14690         *)      ;;
14691         esac
14692         case "$d_getlogin_r_proto" in
14693         define)
14694         case "$getlogin_r_proto" in
14695         ''|0) try='int getlogin_r(char*, size_t);'
14696         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14697         esac
14698         case "$getlogin_r_proto" in
14699         ''|0) try='int getlogin_r(char*, int);'
14700         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14701         esac
14702         case "$getlogin_r_proto" in
14703         ''|0) try='char* getlogin_r(char*, size_t);'
14704         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14705         esac
14706         case "$getlogin_r_proto" in
14707         ''|0) try='char* getlogin_r(char*, int);'
14708         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14709         esac
14710         case "$getlogin_r_proto" in
14711         ''|0)   d_getlogin_r=undef
14712                 getlogin_r_proto=0
14713                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14714         * )     case "$getlogin_r_proto" in
14715                 REENTRANT_PROTO*) ;;
14716                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14717                 esac
14718                 echo "Prototype: $try" ;;
14719         esac
14720         ;;
14721         *)      case "$usethreads" in
14722                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14723                 esac
14724                 d_getlogin_r=undef
14725                 getlogin_r_proto=0
14726                 ;;
14727         esac
14728         ;;
14729 *)      getlogin_r_proto=0
14730         ;;
14731 esac
14732
14733 : see if getmnt exists
14734 set getmnt d_getmnt
14735 eval $inlibc
14736
14737 : see if getmntent exists
14738 set getmntent d_getmntent
14739 eval $inlibc
14740
14741 : see if getnameinfo exists
14742 set getnameinfo d_getnameinfo
14743 eval $inlibc
14744
14745 : see if getnetbyaddr exists
14746 set getnetbyaddr d_getnbyaddr
14747 eval $inlibc
14748
14749 : see if getnetbyname exists
14750 set getnetbyname d_getnbyname
14751 eval $inlibc
14752
14753 : see if getnetent exists
14754 set getnetent d_getnent
14755 eval $inlibc
14756
14757 : see if getnetbyaddr_r exists
14758 set getnetbyaddr_r d_getnetbyaddr_r
14759 eval $inlibc
14760 case "$d_getnetbyaddr_r" in
14761 "$define")
14762         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14763         case "$d_getnetbyaddr_r_proto:$usethreads" in
14764         ":define")      d_getnetbyaddr_r_proto=define
14765                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14766                 eval $hasproto ;;
14767         *)      ;;
14768         esac
14769         case "$d_getnetbyaddr_r_proto" in
14770         define)
14771         case "$getnetbyaddr_r_proto" in
14772         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14773         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14774         esac
14775         case "$getnetbyaddr_r_proto" in
14776         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14777         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14778         esac
14779         case "$getnetbyaddr_r_proto" in
14780         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14781         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14782         esac
14783         case "$getnetbyaddr_r_proto" in
14784         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14785         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14786         esac
14787         case "$getnetbyaddr_r_proto" in
14788         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14789         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14790         esac
14791         case "$getnetbyaddr_r_proto" in
14792         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14793         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14794         esac
14795         case "$getnetbyaddr_r_proto" in
14796         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14797         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14798         esac
14799         case "$getnetbyaddr_r_proto" in
14800         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14801         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14802         esac
14803         case "$getnetbyaddr_r_proto" in
14804         ''|0)   d_getnetbyaddr_r=undef
14805                 getnetbyaddr_r_proto=0
14806                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14807         * )     case "$getnetbyaddr_r_proto" in
14808                 REENTRANT_PROTO*) ;;
14809                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14810                 esac
14811                 echo "Prototype: $try" ;;
14812         esac
14813         ;;
14814         *)      case "$usethreads" in
14815                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14816                 esac
14817                 d_getnetbyaddr_r=undef
14818                 getnetbyaddr_r_proto=0
14819                 ;;
14820         esac
14821         ;;
14822 *)      getnetbyaddr_r_proto=0
14823         ;;
14824 esac
14825
14826 : see if getnetbyname_r exists
14827 set getnetbyname_r d_getnetbyname_r
14828 eval $inlibc
14829 case "$d_getnetbyname_r" in
14830 "$define")
14831         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14832         case "$d_getnetbyname_r_proto:$usethreads" in
14833         ":define")      d_getnetbyname_r_proto=define
14834                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14835                 eval $hasproto ;;
14836         *)      ;;
14837         esac
14838         case "$d_getnetbyname_r_proto" in
14839         define)
14840         case "$getnetbyname_r_proto" in
14841         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14842         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14843         esac
14844         case "$getnetbyname_r_proto" in
14845         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14846         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14847         esac
14848         case "$getnetbyname_r_proto" in
14849         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14850         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14851         esac
14852         case "$getnetbyname_r_proto" in
14853         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14854         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14855         esac
14856         case "$getnetbyname_r_proto" in
14857         ''|0)   d_getnetbyname_r=undef
14858                 getnetbyname_r_proto=0
14859                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14860         * )     case "$getnetbyname_r_proto" in
14861                 REENTRANT_PROTO*) ;;
14862                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14863                 esac
14864                 echo "Prototype: $try" ;;
14865         esac
14866         ;;
14867         *)      case "$usethreads" in
14868                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14869                 esac
14870                 d_getnetbyname_r=undef
14871                 getnetbyname_r_proto=0
14872                 ;;
14873         esac
14874         ;;
14875 *)      getnetbyname_r_proto=0
14876         ;;
14877 esac
14878
14879 : see if getnetent_r exists
14880 set getnetent_r d_getnetent_r
14881 eval $inlibc
14882 case "$d_getnetent_r" in
14883 "$define")
14884         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14885         case "$d_getnetent_r_proto:$usethreads" in
14886         ":define")      d_getnetent_r_proto=define
14887                 set d_getnetent_r_proto getnetent_r $hdrs
14888                 eval $hasproto ;;
14889         *)      ;;
14890         esac
14891         case "$d_getnetent_r_proto" in
14892         define)
14893         case "$getnetent_r_proto" in
14894         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14895         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14896         esac
14897         case "$getnetent_r_proto" in
14898         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14899         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14900         esac
14901         case "$getnetent_r_proto" in
14902         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14903         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14904         esac
14905         case "$getnetent_r_proto" in
14906         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14907         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14908         esac
14909         case "$getnetent_r_proto" in
14910         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14911         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14912         esac
14913         case "$getnetent_r_proto" in
14914         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14915         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14916         esac
14917         case "$getnetent_r_proto" in
14918         ''|0)   d_getnetent_r=undef
14919                 getnetent_r_proto=0
14920                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14921         * )     case "$getnetent_r_proto" in
14922                 REENTRANT_PROTO*) ;;
14923                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14924                 esac
14925                 echo "Prototype: $try" ;;
14926         esac
14927         ;;
14928         *)      case "$usethreads" in
14929                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14930                 esac
14931                 d_getnetent_r=undef
14932                 getnetent_r_proto=0
14933                 ;;
14934         esac
14935         ;;
14936 *)      getnetent_r_proto=0
14937         ;;
14938 esac
14939
14940 : see if prototypes for various getnetxxx netdb.h functions are available
14941 echo " "
14942 set d_getnetprotos getnetent $i_netdb netdb.h
14943 eval $hasproto
14944
14945 : see if getpagesize exists
14946 set getpagesize d_getpagsz
14947 eval $inlibc
14948
14949 : Optional checks for getprotobyname and getprotobynumber
14950
14951 : see if getprotobyname exists
14952 set getprotobyname d_getpbyname
14953 eval $inlibc
14954
14955 : see if getprotobynumber exists
14956 set getprotobynumber d_getpbynumber
14957 eval $inlibc
14958
14959 : see if getprotoent exists
14960 set getprotoent d_getpent
14961 eval $inlibc
14962
14963 : see if getpgid exists
14964 set getpgid d_getpgid
14965 eval $inlibc
14966
14967 : see if getpgrp2 exists
14968 set getpgrp2 d_getpgrp2
14969 eval $inlibc
14970
14971 : see if getppid exists
14972 set getppid d_getppid
14973 eval $inlibc
14974
14975 : see if getpriority exists
14976 set getpriority d_getprior
14977 eval $inlibc
14978
14979 : see if getprotobyname_r exists
14980 set getprotobyname_r d_getprotobyname_r
14981 eval $inlibc
14982 case "$d_getprotobyname_r" in
14983 "$define")
14984         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14985         case "$d_getprotobyname_r_proto:$usethreads" in
14986         ":define")      d_getprotobyname_r_proto=define
14987                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14988                 eval $hasproto ;;
14989         *)      ;;
14990         esac
14991         case "$d_getprotobyname_r_proto" in
14992         define)
14993         case "$getprotobyname_r_proto" in
14994         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14995         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14996         esac
14997         case "$getprotobyname_r_proto" in
14998         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14999         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15000         esac
15001         case "$getprotobyname_r_proto" in
15002         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15003         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15004         esac
15005         case "$getprotobyname_r_proto" in
15006         ''|0)   d_getprotobyname_r=undef
15007                 getprotobyname_r_proto=0
15008                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15009         * )     case "$getprotobyname_r_proto" in
15010                 REENTRANT_PROTO*) ;;
15011                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15012                 esac
15013                 echo "Prototype: $try" ;;
15014         esac
15015         ;;
15016         *)      case "$usethreads" in
15017                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15018                 esac
15019                 d_getprotobyname_r=undef
15020                 getprotobyname_r_proto=0
15021                 ;;
15022         esac
15023         ;;
15024 *)      getprotobyname_r_proto=0
15025         ;;
15026 esac
15027
15028 : see if getprotobynumber_r exists
15029 set getprotobynumber_r d_getprotobynumber_r
15030 eval $inlibc
15031 case "$d_getprotobynumber_r" in
15032 "$define")
15033         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15034         case "$d_getprotobynumber_r_proto:$usethreads" in
15035         ":define")      d_getprotobynumber_r_proto=define
15036                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15037                 eval $hasproto ;;
15038         *)      ;;
15039         esac
15040         case "$d_getprotobynumber_r_proto" in
15041         define)
15042         case "$getprotobynumber_r_proto" in
15043         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15044         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15045         esac
15046         case "$getprotobynumber_r_proto" in
15047         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15048         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15049         esac
15050         case "$getprotobynumber_r_proto" in
15051         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15052         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15053         esac
15054         case "$getprotobynumber_r_proto" in
15055         ''|0)   d_getprotobynumber_r=undef
15056                 getprotobynumber_r_proto=0
15057                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15058         * )     case "$getprotobynumber_r_proto" in
15059                 REENTRANT_PROTO*) ;;
15060                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15061                 esac
15062                 echo "Prototype: $try" ;;
15063         esac
15064         ;;
15065         *)      case "$usethreads" in
15066                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15067                 esac
15068                 d_getprotobynumber_r=undef
15069                 getprotobynumber_r_proto=0
15070                 ;;
15071         esac
15072         ;;
15073 *)      getprotobynumber_r_proto=0
15074         ;;
15075 esac
15076
15077 : see if getprotoent_r exists
15078 set getprotoent_r d_getprotoent_r
15079 eval $inlibc
15080 case "$d_getprotoent_r" in
15081 "$define")
15082         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15083         case "$d_getprotoent_r_proto:$usethreads" in
15084         ":define")      d_getprotoent_r_proto=define
15085                 set d_getprotoent_r_proto getprotoent_r $hdrs
15086                 eval $hasproto ;;
15087         *)      ;;
15088         esac
15089         case "$d_getprotoent_r_proto" in
15090         define)
15091         case "$getprotoent_r_proto" in
15092         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15093         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15094         esac
15095         case "$getprotoent_r_proto" in
15096         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15097         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15098         esac
15099         case "$getprotoent_r_proto" in
15100         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15101         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15102         esac
15103         case "$getprotoent_r_proto" in
15104         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15105         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15106         esac
15107         case "$getprotoent_r_proto" in
15108         ''|0)   d_getprotoent_r=undef
15109                 getprotoent_r_proto=0
15110                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15111         * )     case "$getprotoent_r_proto" in
15112                 REENTRANT_PROTO*) ;;
15113                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15114                 esac
15115                 echo "Prototype: $try" ;;
15116         esac
15117         ;;
15118         *)      case "$usethreads" in
15119                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15120                 esac
15121                 d_getprotoent_r=undef
15122                 getprotoent_r_proto=0
15123                 ;;
15124         esac
15125         ;;
15126 *)      getprotoent_r_proto=0
15127         ;;
15128 esac
15129
15130 : see if prototypes for various getprotoxxx netdb.h functions are available
15131 echo " "
15132 set d_getprotoprotos getprotoent $i_netdb netdb.h
15133 eval $hasproto
15134
15135 : see if getprpwnam exists
15136 set getprpwnam d_getprpwnam
15137 eval $inlibc
15138
15139 : see if getpwent exists
15140 set getpwent d_getpwent
15141 eval $inlibc
15142
15143 : see if getpwent_r exists
15144 set getpwent_r d_getpwent_r
15145 eval $inlibc
15146 case "$d_getpwent_r" in
15147 "$define")
15148         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15149         case "$d_getpwent_r_proto:$usethreads" in
15150         ":define")      d_getpwent_r_proto=define
15151                 set d_getpwent_r_proto getpwent_r $hdrs
15152                 eval $hasproto ;;
15153         *)      ;;
15154         esac
15155         case "$d_getpwent_r_proto" in
15156         define)
15157         case "$getpwent_r_proto" in
15158         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15159         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15160         esac
15161         case "$getpwent_r_proto" in
15162         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15163         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15164         esac
15165         case "$getpwent_r_proto" in
15166         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15167         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15168         esac
15169         case "$getpwent_r_proto" in
15170         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15171         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15172         esac
15173         case "$getpwent_r_proto" in
15174         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15175         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15176         esac
15177         case "$getpwent_r_proto" in
15178         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15179         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15180         esac
15181         case "$getpwent_r_proto" in
15182         ''|0)   d_getpwent_r=undef
15183                 getpwent_r_proto=0
15184                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15185         * )     case "$getpwent_r_proto" in
15186                 REENTRANT_PROTO*) ;;
15187                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15188                 esac
15189                 echo "Prototype: $try" ;;
15190         esac
15191         ;;
15192         *)      case "$usethreads" in
15193                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15194                 esac
15195                 d_getpwent_r=undef
15196                 getpwent_r_proto=0
15197                 ;;
15198         esac
15199         ;;
15200 *)      getpwent_r_proto=0
15201         ;;
15202 esac
15203
15204 : see if getpwnam_r exists
15205 set getpwnam_r d_getpwnam_r
15206 eval $inlibc
15207 case "$d_getpwnam_r" in
15208 "$define")
15209         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15210         case "$d_getpwnam_r_proto:$usethreads" in
15211         ":define")      d_getpwnam_r_proto=define
15212                 set d_getpwnam_r_proto getpwnam_r $hdrs
15213                 eval $hasproto ;;
15214         *)      ;;
15215         esac
15216         case "$d_getpwnam_r_proto" in
15217         define)
15218         case "$getpwnam_r_proto" in
15219         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15220         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15221         esac
15222         case "$getpwnam_r_proto" in
15223         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15224         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15225         esac
15226         case "$getpwnam_r_proto" in
15227         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15228         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15229         esac
15230         case "$getpwnam_r_proto" in
15231         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15232         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15233         esac
15234         case "$getpwnam_r_proto" in
15235         ''|0)   d_getpwnam_r=undef
15236                 getpwnam_r_proto=0
15237                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15238         * )     case "$getpwnam_r_proto" in
15239                 REENTRANT_PROTO*) ;;
15240                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15241                 esac
15242                 echo "Prototype: $try" ;;
15243         esac
15244         ;;
15245         *)      case "$usethreads" in
15246                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15247                 esac
15248                 d_getpwnam_r=undef
15249                 getpwnam_r_proto=0
15250                 ;;
15251         esac
15252         ;;
15253 *)      getpwnam_r_proto=0
15254         ;;
15255 esac
15256
15257 : see if getpwuid_r exists
15258 set getpwuid_r d_getpwuid_r
15259 eval $inlibc
15260 case "$d_getpwuid_r" in
15261 "$define")
15262         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15263         case "$d_getpwuid_r_proto:$usethreads" in
15264         ":define")      d_getpwuid_r_proto=define
15265                 set d_getpwuid_r_proto getpwuid_r $hdrs
15266                 eval $hasproto ;;
15267         *)      ;;
15268         esac
15269         case "$d_getpwuid_r_proto" in
15270         define)
15271         case "$getpwuid_r_proto" in
15272         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15273         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15274         esac
15275         case "$getpwuid_r_proto" in
15276         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15277         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15278         esac
15279         case "$getpwuid_r_proto" in
15280         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15281         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15282         esac
15283         case "$getpwuid_r_proto" in
15284         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15285         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15286         esac
15287         case "$getpwuid_r_proto" in
15288         ''|0)   d_getpwuid_r=undef
15289                 getpwuid_r_proto=0
15290                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15291         * )     case "$getpwuid_r_proto" in
15292                 REENTRANT_PROTO*) ;;
15293                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15294                 esac
15295                 echo "Prototype: $try" ;;
15296         esac
15297         ;;
15298         *)      case "$usethreads" in
15299                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15300                 esac
15301                 d_getpwuid_r=undef
15302                 getpwuid_r_proto=0
15303                 ;;
15304         esac
15305         ;;
15306 *)      getpwuid_r_proto=0
15307         ;;
15308 esac
15309
15310 : Optional checks for getsbyname and getsbyport
15311
15312 : see if getservbyname exists
15313 set getservbyname d_getsbyname
15314 eval $inlibc
15315
15316 : see if getservbyport exists
15317 set getservbyport d_getsbyport
15318 eval $inlibc
15319
15320 : see if getservent exists
15321 set getservent d_getsent
15322 eval $inlibc
15323
15324 : see if getservbyname_r exists
15325 set getservbyname_r d_getservbyname_r
15326 eval $inlibc
15327 case "$d_getservbyname_r" in
15328 "$define")
15329         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15330         case "$d_getservbyname_r_proto:$usethreads" in
15331         ":define")      d_getservbyname_r_proto=define
15332                 set d_getservbyname_r_proto getservbyname_r $hdrs
15333                 eval $hasproto ;;
15334         *)      ;;
15335         esac
15336         case "$d_getservbyname_r_proto" in
15337         define)
15338         case "$getservbyname_r_proto" in
15339         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15340         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15341         esac
15342         case "$getservbyname_r_proto" in
15343         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15344         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15345         esac
15346         case "$getservbyname_r_proto" in
15347         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15348         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15349         esac
15350         case "$getservbyname_r_proto" in
15351         ''|0)   d_getservbyname_r=undef
15352                 getservbyname_r_proto=0
15353                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15354         * )     case "$getservbyname_r_proto" in
15355                 REENTRANT_PROTO*) ;;
15356                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15357                 esac
15358                 echo "Prototype: $try" ;;
15359         esac
15360         ;;
15361         *)      case "$usethreads" in
15362                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15363                 esac
15364                 d_getservbyname_r=undef
15365                 getservbyname_r_proto=0
15366                 ;;
15367         esac
15368         ;;
15369 *)      getservbyname_r_proto=0
15370         ;;
15371 esac
15372
15373 : see if getservbyport_r exists
15374 set getservbyport_r d_getservbyport_r
15375 eval $inlibc
15376 case "$d_getservbyport_r" in
15377 "$define")
15378         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15379         case "$d_getservbyport_r_proto:$usethreads" in
15380         ":define")      d_getservbyport_r_proto=define
15381                 set d_getservbyport_r_proto getservbyport_r $hdrs
15382                 eval $hasproto ;;
15383         *)      ;;
15384         esac
15385         case "$d_getservbyport_r_proto" in
15386         define)
15387         case "$getservbyport_r_proto" in
15388         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15389         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15390         esac
15391         case "$getservbyport_r_proto" in
15392         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15393         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15394         esac
15395         case "$getservbyport_r_proto" in
15396         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15397         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15398         esac
15399         case "$getservbyport_r_proto" in
15400         ''|0)   d_getservbyport_r=undef
15401                 getservbyport_r_proto=0
15402                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15403         * )     case "$getservbyport_r_proto" in
15404                 REENTRANT_PROTO*) ;;
15405                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15406                 esac
15407                 echo "Prototype: $try" ;;
15408         esac
15409         ;;
15410         *)      case "$usethreads" in
15411                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15412                 esac
15413                 d_getservbyport_r=undef
15414                 getservbyport_r_proto=0
15415                 ;;
15416         esac
15417         ;;
15418 *)      getservbyport_r_proto=0
15419         ;;
15420 esac
15421
15422 : see if getservent_r exists
15423 set getservent_r d_getservent_r
15424 eval $inlibc
15425 case "$d_getservent_r" in
15426 "$define")
15427         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15428         case "$d_getservent_r_proto:$usethreads" in
15429         ":define")      d_getservent_r_proto=define
15430                 set d_getservent_r_proto getservent_r $hdrs
15431                 eval $hasproto ;;
15432         *)      ;;
15433         esac
15434         case "$d_getservent_r_proto" in
15435         define)
15436         case "$getservent_r_proto" in
15437         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15438         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15439         esac
15440         case "$getservent_r_proto" in
15441         ''|0) try='int getservent_r(struct servent*, char*, int);'
15442         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15443         esac
15444         case "$getservent_r_proto" in
15445         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15446         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15447         esac
15448         case "$getservent_r_proto" in
15449         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15450         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15451         esac
15452         case "$getservent_r_proto" in
15453         ''|0)   d_getservent_r=undef
15454                 getservent_r_proto=0
15455                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15456         * )     case "$getservent_r_proto" in
15457                 REENTRANT_PROTO*) ;;
15458                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15459                 esac
15460                 echo "Prototype: $try" ;;
15461         esac
15462         ;;
15463         *)      case "$usethreads" in
15464                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15465                 esac
15466                 d_getservent_r=undef
15467                 getservent_r_proto=0
15468                 ;;
15469         esac
15470         ;;
15471 *)      getservent_r_proto=0
15472         ;;
15473 esac
15474
15475 : see if prototypes for various getservxxx netdb.h functions are available
15476 echo " "
15477 set d_getservprotos getservent $i_netdb netdb.h
15478 eval $hasproto
15479
15480 : see if getspnam exists
15481 set getspnam d_getspnam
15482 eval $inlibc
15483
15484 : see if this is a shadow.h system
15485 set shadow.h i_shadow
15486 eval $inhdr
15487
15488 : see if getspnam_r exists
15489 set getspnam_r d_getspnam_r
15490 eval $inlibc
15491 case "$d_getspnam_r" in
15492 "$define")
15493         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15494         case "$d_getspnam_r_proto:$usethreads" in
15495         ":define")      d_getspnam_r_proto=define
15496                 set d_getspnam_r_proto getspnam_r $hdrs
15497                 eval $hasproto ;;
15498         *)      ;;
15499         esac
15500         case "$d_getspnam_r_proto" in
15501         define)
15502         case "$getspnam_r_proto" in
15503         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15504         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15505         esac
15506         case "$getspnam_r_proto" in
15507         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15508         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15509         esac
15510         case "$getspnam_r_proto" in
15511         ''|0)   d_getspnam_r=undef
15512                 getspnam_r_proto=0
15513                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15514         * )     case "$getspnam_r_proto" in
15515                 REENTRANT_PROTO*) ;;
15516                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15517                 esac
15518                 echo "Prototype: $try" ;;
15519         esac
15520         ;;
15521         *)      case "$usethreads" in
15522                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15523                 esac
15524                 d_getspnam_r=undef
15525                 getspnam_r_proto=0
15526                 ;;
15527         esac
15528         ;;
15529 *)      getspnam_r_proto=0
15530         ;;
15531 esac
15532
15533 : see if gettimeofday or ftime exists
15534 set gettimeofday d_gettimeod
15535 eval $inlibc
15536 case "$d_gettimeod" in
15537 "$undef")
15538         set ftime d_ftime 
15539         eval $inlibc
15540         ;;
15541 *)
15542         val="$undef"; set d_ftime; eval $setvar
15543         ;;
15544 esac
15545 case "$d_gettimeod$d_ftime" in
15546 "$undef$undef")
15547         echo " "
15548         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15549         ;;
15550 esac
15551
15552 : see if gmtime_r exists
15553 set gmtime_r d_gmtime_r
15554 eval $inlibc
15555 case "$d_gmtime_r" in
15556 "$define")
15557         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15558         case "$d_gmtime_r_proto:$usethreads" in
15559         ":define")      d_gmtime_r_proto=define
15560                 set d_gmtime_r_proto gmtime_r $hdrs
15561                 eval $hasproto ;;
15562         *)      ;;
15563         esac
15564         case "$d_gmtime_r_proto" in
15565         define)
15566         case "$gmtime_r_proto" in
15567         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15568         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15569         esac
15570         case "$gmtime_r_proto" in
15571         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15572         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15573         esac
15574         case "$gmtime_r_proto" in
15575         ''|0)   d_gmtime_r=undef
15576                 gmtime_r_proto=0
15577                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15578         * )     case "$gmtime_r_proto" in
15579                 REENTRANT_PROTO*) ;;
15580                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15581                 esac
15582                 echo "Prototype: $try" ;;
15583         esac
15584         ;;
15585         *)      case "$usethreads" in
15586                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15587                 esac
15588                 d_gmtime_r=undef
15589                 gmtime_r_proto=0
15590                 ;;
15591         esac
15592         ;;
15593 *)      gmtime_r_proto=0
15594         ;;
15595 esac
15596
15597 : see if hasmntopt exists
15598 set hasmntopt d_hasmntopt
15599 eval $inlibc
15600
15601 : see if this is a netinet/in.h or sys/in.h system
15602 set netinet/in.h i_niin sys/in.h i_sysin
15603 eval $inhdr
15604
15605 : see if arpa/inet.h has to be included
15606 set arpa/inet.h i_arpainet
15607 eval $inhdr
15608
15609 : see if htonl --and friends-- exists
15610 val=''
15611 set htonl val
15612 eval $inlibc
15613
15614 : Maybe they are macros.
15615 case "$val" in
15616 $undef)
15617         $cat >htonl.c <<EOM
15618 #include <stdio.h>
15619 #include <sys/types.h>
15620 #$i_niin I_NETINET_IN
15621 #$i_sysin I_SYS_IN
15622 #$i_arpainet I_ARPA_INET
15623 #ifdef I_NETINET_IN
15624 #include <netinet/in.h>
15625 #endif
15626 #ifdef I_SYS_IN
15627 #include <sys/in.h>
15628 #endif
15629 #ifdef I_ARPA_INET
15630 #include <arpa/inet.h>
15631 #endif
15632 #ifdef htonl
15633 printf("Defined as a macro.");
15634 #endif
15635 EOM
15636         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15637         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15638                 val="$define"
15639                 echo "But it seems to be defined as a macro." >&4
15640         fi
15641         $rm -f htonl.?
15642         ;;
15643 esac
15644 set d_htonl
15645 eval $setvar
15646
15647 : see if hypot exists
15648 set hypot d_hypot
15649 eval $inlibc
15650
15651 : see if ilogb exists
15652 set ilogb d_ilogb
15653 eval $inlibc
15654
15655 : see if ilogbl exists
15656 set ilogbl d_ilogbl
15657 eval $inlibc
15658
15659 : check whether inet_aton exists
15660 set inet_aton d_inetaton
15661 eval $inlibc
15662
15663 : see if inet_ntop exists
15664 set inet_ntop d_inetntop
15665 eval $inlibc
15666
15667 : see if inet_pton exists
15668 set inet_pton d_inetpton
15669 eval $inlibc
15670
15671 : Look for isascii
15672 echo " "
15673 $cat >isascii.c <<EOCP
15674 #include <stdio.h>
15675 #include <ctype.h>
15676 #$i_stdlib I_STDLIB
15677 #ifdef I_STDLIB
15678 #include <stdlib.h>
15679 #endif
15680 int main() {
15681         int c = 'A';
15682         if (isascii(c))
15683                 exit(0);
15684         else
15685                 exit(1);
15686 }
15687 EOCP
15688 set isascii
15689 if eval $compile; then
15690         echo "isascii() found." >&4
15691         val="$define"
15692 else
15693         echo "isascii() NOT found." >&4
15694         val="$undef"
15695 fi
15696 set d_isascii
15697 eval $setvar
15698 $rm -f isascii*
15699
15700 : Look for isblank
15701 echo " "
15702 $cat >isblank.c <<'EOCP'
15703 #include <stdio.h>
15704 #include <ctype.h>
15705 int main() {
15706         int c = ' ';
15707         if (isblank(c))
15708                 return 0 ;
15709         else
15710                 return 1 ;
15711 }
15712 EOCP
15713 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15714         echo "isblank() found." >&4
15715         val="$define"
15716 else
15717         echo "isblank() NOT found." >&4
15718         val="$undef"
15719 fi
15720 set d_isblank
15721 eval $setvar
15722 $rm -f isblank*
15723
15724 : check for isfinite
15725 echo "Checking to see if you have isfinite..." >&4
15726 $cat >try.c <<EOCP
15727 #include <math.h>
15728 int main() { return isfinite(0.0); }
15729 EOCP
15730 set try
15731 if eval $compile; then
15732         val="$define"
15733         echo "You have isfinite."
15734 else
15735         val="$undef"
15736         echo "You do not have isfinite."
15737 fi
15738 $rm_try
15739 set d_isfinite
15740 eval $setvar
15741
15742 : see if isfinitel exists
15743 set isfinitel d_isfinitel
15744 eval $inlibc
15745
15746 : check for isinf
15747 echo "Checking to see if you have isinf..." >&4
15748 $cat >try.c <<EOCP
15749 #include <math.h>
15750 int main() { return isinf(0.0); }
15751 EOCP
15752 set try
15753 if eval $compile; then
15754         val="$define"
15755         echo "You have isinf."
15756 else
15757         val="$undef"
15758         echo "You do not have isinf."
15759 fi
15760 $rm_try
15761 set d_isinf
15762 eval $setvar
15763
15764 : see if isinfl exists
15765 set isinfl d_isinfl
15766 eval $inlibc
15767
15768 : check for isless
15769 echo "Checking to see if you have isless..." >&4
15770 $cat >try.c <<EOCP
15771 #include <math.h>
15772 int main() { return isless(0.0); }
15773 EOCP
15774 set try
15775 if eval $compile; then
15776         val="$define"
15777         echo "You have isless."
15778 else
15779         val="$undef"
15780         echo "You do not have isless."
15781 fi
15782 $rm_try
15783 set d_isless
15784 eval $setvar
15785
15786 : check for isnan
15787 echo "Checking to see if you have isnan..." >&4
15788 $cat >try.c <<EOCP
15789 #include <math.h>
15790 int main() { return isnan(0.0); }
15791 EOCP
15792 set try
15793 if eval $compile; then
15794         val="$define"
15795         echo "You have isnan."
15796 else
15797         val="$undef"
15798         echo "You do not have isnan."
15799 fi
15800 $rm_try
15801 set d_isnan
15802 eval $setvar
15803
15804 : see if isnanl exists
15805 set isnanl d_isnanl
15806 eval $inlibc
15807
15808 : check for isnormal
15809 echo "Checking to see if you have isnormal..." >&4
15810 $cat >try.c <<EOCP
15811 #include <math.h>
15812 int main() { return isnormal(0.0); }
15813 EOCP
15814 set try
15815 if eval $compile; then
15816         val="$define"
15817         echo "You have isnormal."
15818 else
15819         val="$undef"
15820         echo "You do not have isnormal."
15821 fi
15822 $rm_try
15823 set d_isnormal
15824 eval $setvar
15825
15826 : see if j0 exists
15827 set j0 d_j0
15828 eval $inlibc
15829
15830 : see if j0l exists
15831 set j0l d_j0l
15832 eval $inlibc
15833
15834 : see if killpg exists
15835 set killpg d_killpg
15836 eval $inlibc
15837
15838 : see if localeconv exists
15839 set localeconv d_locconv
15840 eval $inlibc
15841
15842 : see if libc has the POSIX.1-2008 currency locale rules
15843 case "$d_locconv:$d_lc_monetary_2008" in
15844 $define:)
15845         $cat >try.c <<EOCP
15846 #include <locale.h>
15847 int main() {
15848         struct lconv *lc = localeconv();
15849         char int_p_cs_precedes = lc->int_p_cs_precedes;
15850         return 0;
15851 }
15852 EOCP
15853         set try
15854         if eval $compile; then
15855                 d_lc_monetary_2008="$define"
15856         else
15857                 d_lc_monetary_2008="$undef"
15858         fi;
15859         $rm_try
15860         ;;
15861 esac
15862
15863 : see if lchown exists
15864 echo " "
15865 $cat > try.c <<'EOCP'
15866 /* System header to define __stub macros and hopefully few prototypes,
15867     which can conflict with char lchown(); below.  */
15868 #include <assert.h>
15869 /* Override any gcc2 internal prototype to avoid an error.  */
15870 /* We use char because int might match the return type of a gcc2
15871    builtin and then its argument prototype would still apply.  */
15872 char lchown();
15873 int main() {
15874     /*  The GNU C library defines this for functions which it implements
15875         to always fail with ENOSYS.  Some functions are actually named
15876         something starting with __ and the normal name is an alias.  */
15877 #if defined (__stub_lchown) || defined (__stub___lchown)
15878 choke me
15879 #else
15880 lchown();
15881 #endif
15882 ; return 0; }
15883 EOCP
15884 set try
15885 if eval $compile; then
15886     $echo "lchown() found." >&4
15887     val="$define"
15888 else
15889     $echo "lchown() NOT found." >&4
15890     val="$undef"
15891 fi
15892 set d_lchown
15893 eval $setvar
15894
15895 : See if number of significant digits in a double precision number is known
15896 echo " "
15897 $cat >ldbl_dig.c <<EOM
15898 #include <limits.h>
15899 #include <float.h>
15900 #ifdef LDBL_DIG
15901 printf("Contains LDBL_DIG");
15902 #endif
15903 EOM
15904 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15905 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15906         echo "LDBL_DIG found." >&4
15907         val="$define"
15908 else
15909         echo "LDBL_DIG NOT found." >&4
15910         val="$undef"
15911 fi
15912 $rm -f ldbl_dig.?
15913 set d_ldbl_dig
15914 eval $setvar
15915
15916 : see if lgamma exists
15917 set lgamma d_lgamma
15918 eval $inlibc
15919
15920 : see if lgamma_r exists
15921 set lgamma_r d_lgamma_r
15922 eval $inlibc
15923
15924 : check to see if math.h defines _LIB_VERSION
15925 d_libm_lib_version="$undef"
15926 echo " "
15927 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15928 $cat >try.c <<EOCP
15929 #include <unistd.h>
15930 #include <math.h>
15931 int main (int argc, char *argv[])
15932 {
15933     printf ("%d\n", _LIB_VERSION);
15934     return (0);
15935     } /* main */
15936 EOCP
15937 set try
15938 if eval $compile; then
15939     foo=`$run ./try`
15940     echo "Yes, it does ($foo)" >&4
15941     d_libm_lib_version="$define"
15942 else
15943     echo "No, it does not (probably harmless)" >&4
15944     fi
15945 $rm_try
15946
15947 : see if link exists
15948 set link d_link
15949 eval $inlibc
15950
15951 : see if llrint exists
15952 set llrint d_llrint
15953 eval $inlibc
15954
15955 : see if llrintl exists
15956 set llrintl d_llrintl
15957 eval $inlibc
15958
15959 : see if llround exists
15960 set llround d_llround
15961 eval $inlibc
15962
15963 : see if llroundl exists
15964 set llroundl d_llroundl
15965 eval $inlibc
15966
15967 : see if localeconv_l exists
15968 set localeconv_l d_localeconv_l
15969 eval $inlibc
15970
15971 : see if localtime_r exists
15972 set localtime_r d_localtime_r
15973 eval $inlibc
15974 case "$d_localtime_r" in
15975 "$define")
15976         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15977         case "$d_localtime_r_proto:$usethreads" in
15978         ":define")      d_localtime_r_proto=define
15979                 set d_localtime_r_proto localtime_r $hdrs
15980                 eval $hasproto ;;
15981         *)      ;;
15982         esac
15983         case "$d_localtime_r_proto" in
15984         define)
15985         case "$localtime_r_proto" in
15986         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15987         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15988         esac
15989         case "$localtime_r_proto" in
15990         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15991         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15992         esac
15993         case "$localtime_r_proto" in
15994         ''|0)   d_localtime_r=undef
15995                 localtime_r_proto=0
15996                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15997         * )     case "$localtime_r_proto" in
15998                 REENTRANT_PROTO*) ;;
15999                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16000                 esac
16001                 echo "Prototype: $try" ;;
16002         esac
16003         ;;
16004         *)      case "$usethreads" in
16005                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16006                 esac
16007                 d_localtime_r=undef
16008                 localtime_r_proto=0
16009                 ;;
16010         esac
16011         ;;
16012 *)      localtime_r_proto=0
16013         ;;
16014 esac
16015
16016 : see if localtime_r calls tzset
16017 case "$localtime_r_proto" in
16018 REENTRANT_PROTO*)
16019         $cat >try.c <<EOCP
16020 /*  Does our libc's localtime_r call tzset ?
16021  *  return 0 if so, 1 otherwise.
16022  */
16023 #$i_systypes    I_SYS_TYPES
16024 #$i_unistd      I_UNISTD
16025 #$i_time        I_TIME
16026 #$i_stdlib      I_STDLIB
16027 #$i_malloc      I_MALLOC
16028 #ifdef I_SYS_TYPES
16029 #  include <sys/types.h>
16030 #endif
16031 #ifdef I_UNISTD
16032 #  include <unistd.h>
16033 #endif
16034 #ifdef I_TIME
16035 #  include <time.h>
16036 #endif
16037 #ifdef I_STDLIB
16038 #include <stdlib.h>
16039 #endif
16040 #include <string.h>
16041 #ifdef I_MALLOC
16042 #  include <malloc.h>
16043 #endif
16044 int main()
16045 {
16046     time_t t = time(0L);
16047     char w_tz[]="TZ" "=GMT+5",
16048          e_tz[]="TZ" "=GMT-5",
16049         *tz_e = (char*)malloc(16),
16050         *tz_w = (char*)malloc(16);
16051     struct tm tm_e, tm_w;
16052     memset(&tm_e,'\0',sizeof(struct tm));
16053     memset(&tm_w,'\0',sizeof(struct tm));
16054     strcpy(tz_e,e_tz);
16055     strcpy(tz_w,w_tz);
16056
16057     putenv(tz_e);
16058     localtime_r(&t, &tm_e);
16059
16060     putenv(tz_w);
16061     localtime_r(&t, &tm_w);
16062
16063     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16064         return 1;
16065     return 0;
16066 }
16067 EOCP
16068         set try
16069         if eval $compile; then
16070             if $run ./try; then
16071                 d_localtime_r_needs_tzset=undef;
16072             else
16073                 d_localtime_r_needs_tzset=define;
16074             fi;
16075         else
16076             d_localtime_r_needs_tzset=undef;
16077         fi;
16078      ;;
16079   *)
16080      d_localtime_r_needs_tzset=undef;
16081      ;;
16082 esac
16083 $rm_try
16084
16085 : see if lockf exists
16086 set lockf d_lockf
16087 eval $inlibc
16088
16089 : see if log1p exists
16090 set log1p d_log1p
16091 eval $inlibc
16092
16093 : see if log2 exists
16094 set log2 d_log2
16095 eval $inlibc
16096
16097 : see if logb exists
16098 set logb d_logb
16099 eval $inlibc
16100
16101 : see if lrint exists
16102 set lrint d_lrint
16103 eval $inlibc
16104
16105 : see if lrintl exists
16106 set lrintl d_lrintl
16107 eval $inlibc
16108
16109 : see if lround exists
16110 set lround d_lround
16111 eval $inlibc
16112
16113 : see if lroundl exists
16114 set lroundl d_lroundl
16115 eval $inlibc
16116
16117 : see if prototype for lseek is available
16118 echo " "
16119 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16120 eval $hasproto
16121
16122 : see if lstat exists
16123 set lstat d_lstat
16124 eval $inlibc
16125
16126 : see if madvise exists
16127 set madvise d_madvise
16128 eval $inlibc
16129
16130 : see if malloc_size exists
16131 set malloc_size d_malloc_size
16132 eval $inlibc
16133
16134 : see if malloc_size_good exists
16135 set malloc_good_size d_malloc_good_size
16136 eval $inlibc
16137
16138 : see if mblen exists
16139 set mblen d_mblen
16140 eval $inlibc
16141
16142 : see if mbrlen exists
16143 set mbrlen d_mbrlen
16144 eval $inlibc
16145
16146 : see if mbrtowc exists
16147 set mbrtowc d_mbrtowc
16148 eval $inlibc
16149
16150 : see if mbstowcs exists
16151 set mbstowcs d_mbstowcs
16152 eval $inlibc
16153
16154 : see if mbtowc exists
16155 set mbtowc d_mbtowc
16156 eval $inlibc
16157
16158 : see if memmem exists
16159 : We need both a prototype in string.h and the symbol in libc.
16160 echo " "
16161 d_memmem_proto=''
16162 xx1="#$d_gnulibc HAS_GNULIBC"
16163 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16164 xx3='#   define _GNU_SOURCE'
16165 xx4='#endif'
16166 set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16167 eval $hasproto
16168 case "$d_memmem_proto" in
16169     define) # see if memmem exists
16170         set memmem d_memmem
16171         eval $inlibc
16172         ;;
16173     *)  val=$undef
16174         set d_memmem
16175         eval $setvar
16176         ;;
16177 esac
16178
16179 : see if memrchr exists
16180 : We need both a prototype in string.h and the symbol in libc.
16181 echo " "
16182 d_memrchr_proto=''
16183 xx1="#$d_gnulibc HAS_GNULIBC"
16184 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16185 xx3='#   define _GNU_SOURCE'
16186 xx4='#endif'
16187 set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16188 eval $hasproto
16189 case "$d_memrchr_proto" in
16190     define) # see if memrchr exists
16191         set memrchr d_memrchr
16192         eval $inlibc
16193         ;;
16194     *)  val=$undef
16195         set d_memrchr
16196         eval $setvar
16197         ;;
16198 esac
16199
16200 : see if mkdir exists
16201 set mkdir d_mkdir
16202 eval $inlibc
16203
16204 : see if mkdtemp exists
16205 set mkdtemp d_mkdtemp
16206 eval $inlibc
16207
16208 : see if mkfifo exists
16209 set mkfifo d_mkfifo
16210 eval $inlibc
16211
16212 : see if mkostemp exists
16213 set mkostemp d_mkostemp
16214 eval $inlibc
16215
16216 : see if mkstemp exists
16217 set mkstemp d_mkstemp
16218 eval $inlibc
16219
16220 : see if mkstemps exists
16221 set mkstemps d_mkstemps
16222 eval $inlibc
16223
16224 : see if mktime exists
16225 set mktime d_mktime
16226 eval $inlibc
16227
16228 : see if sys/mman.h has to be included
16229 set sys/mman.h i_sysmman
16230 eval $inhdr
16231
16232 : see if mmap exists
16233 set mmap d_mmap
16234 eval $inlibc
16235 : see what shmat returns
16236 : default to something harmless
16237 mmaptype='void *'
16238 case "$i_sysmman$d_mmap" in
16239 "$define$define")
16240         $cat >mmap.c <<'END'
16241 #include <sys/mman.h>
16242 void *mmap();
16243 END
16244         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16245                 mmaptype='void *'
16246         else
16247                 mmaptype='caddr_t'
16248         fi
16249         echo "and it returns ($mmaptype)." >&4
16250         ;;
16251 esac
16252
16253 : see if sqrtl exists
16254 set sqrtl d_sqrtl
16255 eval $inlibc
16256
16257 : see if scalbnl exists
16258 set scalbnl d_scalbnl
16259 eval $inlibc
16260
16261 : see if truncl exists
16262 set truncl d_truncl
16263 eval $inlibc
16264
16265 : see if modfl exists
16266 set modfl d_modfl
16267 eval $inlibc
16268
16269 : see if prototype for modfl is available
16270 echo " "
16271 set d_modflproto modfl define math.h
16272 eval $hasproto
16273
16274 if $test "$uselongdouble" = "$define"; then
16275     message=""
16276     if $test "$d_sqrtl" != "$define"; then
16277         message="$message sqrtl"
16278     fi
16279     if $test "$d_modfl" != "$define"; then
16280         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16281             echo "You have both truncl and copysignl, so I can emulate modfl."
16282         else
16283             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16284                 echo "You have both aintl and copysignl, so I can emulate modfl."
16285             else
16286                 message="$message modfl"
16287             fi
16288         fi
16289     fi
16290     if $test "$d_frexpl" != "$define"; then
16291         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16292             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16293         else
16294             message="$message frexpl"
16295         fi
16296     fi
16297     if $test "$d_ldexpl" != "$define"; then
16298         message="$message ldexpl"
16299     fi
16300
16301     if $test "$message" != ""; then
16302         $cat <<EOM >&4
16303
16304 *** You requested the use of long doubles but you do not seem to have
16305 *** the following mathematical functions needed for long double support:
16306 ***    $message
16307 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16308 *** Cannot continue, aborting.
16309
16310 EOM
16311
16312         exit 1
16313     fi
16314 fi
16315
16316 : see if mprotect exists
16317 set mprotect d_mprotect
16318 eval $inlibc
16319
16320 : see if msgctl exists
16321 set msgctl d_msgctl
16322 eval $inlibc
16323
16324 : see if msgget exists
16325 set msgget d_msgget
16326 eval $inlibc
16327
16328 : see if msgsnd exists
16329 set msgsnd d_msgsnd
16330 eval $inlibc
16331
16332 : see if msgrcv exists
16333 set msgrcv d_msgrcv
16334 eval $inlibc
16335
16336 : see how much of the 'msg*(2)' library is present.
16337 h_msg=true
16338 echo " "
16339 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16340 *"$undef"*) h_msg=false;;
16341 esac
16342 case "$osname" in
16343 freebsd)
16344     case "`ipcs 2>&1`" in
16345     "SVID messages"*"not configured"*)
16346         echo "Your $osname does not have the msg*(2) configured." >&4
16347         h_msg=false
16348         val="$undef"
16349         set msgctl d_msgctl
16350         eval $setvar
16351         set msgget d_msgget
16352         eval $setvar
16353         set msgsnd d_msgsnd
16354         eval $setvar
16355         set msgrcv d_msgrcv
16356         eval $setvar
16357         ;;
16358     esac
16359     ;;
16360 esac
16361 : we could also check for sys/ipc.h ...
16362 if $h_msg && $test `./findhdr sys/msg.h`; then
16363         echo "You have the full msg*(2) library." >&4
16364         val="$define"
16365 else
16366         echo "You don't have the full msg*(2) library." >&4
16367         val="$undef"
16368 fi
16369 set d_msg
16370 eval $setvar
16371
16372 : Check for msghdr_s
16373 echo " "
16374 echo "Checking to see if your system supports struct msghdr..." >&4
16375 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16376 eval $hasstruct
16377 case "$d_msghdr_s" in
16378 "$define")      echo "Yes, it does."   ;;
16379 *)              echo "No, it doesn't." ;;
16380 esac
16381
16382 : see if msync exists
16383 set msync d_msync
16384 eval $inlibc
16385
16386 : see if munmap exists
16387 set munmap d_munmap
16388 eval $inlibc
16389
16390 : see if nan exists
16391 set nan d_nan
16392 eval $inlibc
16393
16394 : see if nanosleep exists
16395 set nanosleep d_nanosleep
16396 eval $inlibc
16397
16398 : see if nearbyint exists
16399 set nearbyint d_nearbyint
16400 eval $inlibc
16401
16402 : see if nextafter exists
16403 set nextafter d_nextafter
16404 eval $inlibc
16405
16406 : see if nexttoward exists
16407 set nexttoward d_nexttoward
16408 eval $inlibc
16409
16410 : see if nice exists
16411 set nice d_nice
16412 eval $inlibc
16413
16414 : see if this is a langinfo.h system
16415 set langinfo.h i_langinfo
16416 eval $inhdr
16417
16418 : see if nl_langinfo exists
16419 set nl_langinfo d_nl_langinfo
16420 eval $inlibc
16421
16422 : see if this is a quadmath.h system
16423 set quadmath.h i_quadmath
16424 eval $inhdr
16425
16426 : Check basic sizes
16427 echo " "
16428 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16429
16430 case "$use64bitint:$d_quad:$quadtype" in
16431 define:define:?*)
16432         ivtype="$quadtype"
16433         uvtype="$uquadtype"
16434         ivsize=8
16435         uvsize=8
16436         ;;
16437 *)      ivtype="long"
16438         uvtype="unsigned long"
16439         ivsize=$longsize
16440         uvsize=$longsize
16441         ;;
16442 esac
16443
16444 case "$uselongdouble:$d_longdbl" in
16445 define:define)
16446         nvtype="long double"
16447         nvsize=$longdblsize
16448         ;;
16449 *)      nvtype=double
16450         nvsize=$doublesize
16451         ;;
16452 esac
16453
16454 case "$usequadmath:$i_quadmath" in
16455 define:define)
16456   nvtype="__float128"
16457   nvsize=16
16458   case "$libs" in
16459   *quadmath*) ;;
16460   *) $cat <<EOM >&4
16461
16462 *** You requested the use of the quadmath library, but you
16463 *** do not seem to have the quadmath library installed.
16464 *** Cannot continue, aborting.
16465 EOM
16466     exit 1
16467     ;;
16468   esac
16469   ;;
16470 define:*) $cat <<EOM >&4
16471
16472 *** You requested the use of the quadmath library, but you
16473 *** do not seem to have the required header, <quadmath.h>.
16474 EOM
16475   case "$gccversion" in
16476   [23].*|4.[0-5]*)
16477    $cat <<EOM >&4
16478 *** Your gcc looks a bit old:
16479 *** $gccversion
16480 EOM
16481     ;;
16482   '')
16483    $cat <<EOM >&4
16484 *** You are not running a gcc.
16485 EOM
16486     ;;
16487   esac
16488   $cat <<EOM >&4
16489 *** For the quadmath library you need at least gcc 4.6.
16490 *** Cannot continue, aborting.
16491 EOM
16492   exit 1
16493   ;;
16494 esac
16495
16496 $echo "(IV will be "$ivtype", $ivsize bytes)"
16497 $echo "(UV will be "$uvtype", $uvsize bytes)"
16498 $echo "(NV will be "$nvtype", $nvsize bytes)"
16499
16500 $cat >try.c <<EOCP
16501 #$i_inttypes I_INTTYPES
16502 #ifdef I_INTTYPES
16503 #include <inttypes.h>
16504 #endif
16505 #include <stdio.h>
16506 int main() {
16507 #ifdef INT8
16508    int8_t i =  INT8_MAX;
16509   uint8_t u = UINT8_MAX;
16510   printf("int8_t\n");
16511 #endif
16512 #ifdef INT16
16513    int16_t i =  INT16_MAX;
16514   uint16_t u = UINT16_MAX;
16515   printf("int16_t\n");
16516 #endif
16517 #ifdef INT32
16518    int32_t i =  INT32_MAX;
16519   uint32_t u = UINT32_MAX;
16520   printf("int32_t\n");
16521 #endif
16522 }
16523 EOCP
16524
16525 i8type="signed char"
16526 u8type="unsigned char"
16527 i8size=1
16528 u8size=1
16529
16530 case "$i16type" in
16531 '')     case "$shortsize" in
16532         2)      i16type=short
16533                 u16type="unsigned short"
16534                 i16size=$shortsize
16535                 u16size=$shortsize
16536                 ;;
16537         esac
16538         ;;
16539 esac
16540 case "$i16type" in
16541 '')     set try -DINT16
16542         if eval $compile; then
16543                 case "`$run ./try`" in
16544                 int16_t)
16545                         i16type=int16_t
16546                         u16type=uint16_t
16547                         i16size=2
16548                         u16size=2
16549                         ;;
16550                 esac
16551         fi
16552         ;;
16553 esac
16554 case "$i16type" in
16555 '')     if $test $shortsize -ge 2; then
16556                 i16type=short
16557                 u16type="unsigned short"
16558                 i16size=$shortsize
16559                 u16size=$shortsize
16560         fi
16561         ;;
16562 esac
16563
16564 case "$i32type" in
16565 '')     case "$longsize" in
16566         4)      i32type=long
16567                 u32type="unsigned long"
16568                 i32size=$longsize
16569                 u32size=$longsize
16570                 ;;
16571         *)      case "$intsize" in
16572                 4)      i32type=int
16573                         u32type="unsigned int"
16574                         i32size=$intsize
16575                         u32size=$intsize
16576                         ;;
16577                 esac
16578                 ;;
16579         esac
16580         ;;
16581 esac
16582 case "$i32type" in
16583 '')     set try -DINT32
16584         if eval $compile; then
16585                 case "`$run ./try`" in
16586                 int32_t)
16587                         i32type=int32_t
16588                         u32type=uint32_t
16589                         i32size=4
16590                         u32size=4
16591                         ;;
16592                 esac
16593         fi
16594         ;;
16595 esac
16596 case "$i32type" in
16597 '')     if $test $intsize -ge 4; then
16598                 i32type=int
16599                 u32type="unsigned int"
16600                 i32size=$intsize
16601                 u32size=$intsize
16602         fi
16603         ;;
16604 esac
16605
16606 case "$i64type" in
16607 '')     case "$d_quad:$quadtype" in
16608         define:?*)
16609                 i64type="$quadtype"
16610                 u64type="$uquadtype"
16611                 i64size=8
16612                 u64size=8
16613                 ;;
16614         esac
16615         ;;
16616 esac
16617
16618 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16619 $cat <<EOP >try.c
16620 #include <stdio.h>
16621 #$i_stdlib I_STDLIB
16622 #ifdef I_STDLIB
16623 #include <stdlib.h>
16624 #endif
16625 #include <sys/types.h>
16626 #include <signal.h>
16627 #ifdef SIGFPE
16628 /* volatile so that the compiler has to store it out to memory */
16629 volatile int bletched = 0;
16630 $signal_t blech(int s) { bletched = 1; }
16631 #endif
16632 int main() {
16633     $uvtype u = 0;
16634     $nvtype d;
16635     int     n = 8 * $uvsize;
16636     int     i;
16637 #ifdef SIGFPE
16638     signal(SIGFPE, blech);
16639 #endif
16640
16641     for (i = 0; i < n; i++) {
16642       u = u << 1 | ($uvtype)1;
16643       d = ($nvtype)u;
16644       if (($uvtype)d != u)
16645         break;
16646       if (d <= 0)
16647         break;
16648       d = ($nvtype)(u - 1);
16649       if (($uvtype)d != (u - 1))
16650         break;
16651 #ifdef SIGFPE
16652       if (bletched)
16653         break;
16654 #endif
16655     }
16656     printf("%d\n", ((i == n) ? -n : i));
16657     exit(0);
16658 }
16659 EOP
16660 set try
16661
16662 d_nv_preserves_uv="$undef"
16663 if eval $compile; then
16664         nv_preserves_uv_bits="`$run ./try`"
16665 fi
16666 case "$nv_preserves_uv_bits" in
16667 \-[1-9]*)
16668         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16669         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16670         d_nv_preserves_uv="$define"
16671         ;;
16672 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16673         d_nv_preserves_uv="$undef" ;;
16674 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16675         nv_preserves_uv_bits="0" ;;
16676 esac
16677 $rm_try
16678
16679 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16680 $cat <<EOP >try.c
16681 #include <stdio.h>
16682
16683 typedef $nvtype NV;
16684
16685 int
16686 main() {
16687   NV value = 2;
16688   int count = 1;
16689
16690   while(count < 256) {
16691     /* volatile so that the compiler has to store it out to memory */
16692     volatile NV up = value + 1.0;
16693     volatile NV negated = -value;
16694     volatile NV down = negated - 1.0;
16695     volatile NV got_up = up - value;
16696     int up_good = got_up == 1.0;
16697     int got_down = down - negated;
16698     int down_good = got_down == -1.0;
16699
16700     if (down_good != up_good) {
16701       fprintf(stderr,
16702               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16703               up_good, (double) got_up, down_good, (double) got_down,
16704               count, (double) value);
16705       return 1;
16706     }
16707     if (!up_good) {
16708       while (1) {
16709         if (count > 8) {
16710           count -= 8;
16711           fputs("256.0", stdout);
16712         } else {
16713           count--;
16714           fputs("2.0", stdout);
16715         }
16716         if (!count) {
16717           puts("");
16718           return 0;
16719         }
16720         fputs("*", stdout);
16721       }
16722     }
16723     value *= 2;
16724     ++count;
16725   }
16726   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16727           count, (double) value);
16728   return 1;
16729 }
16730 EOP
16731 set try
16732
16733 nv_overflows_integers_at='0'
16734 if eval $compile; then
16735     xxx="`$run ./try`"
16736     case "$?" in
16737         0)
16738             case "$xxx" in
16739                 2*)  cat >&4 <<EOM
16740 The largest integer your NVs can preserve is equal to $xxx
16741 EOM
16742                     nv_overflows_integers_at="$xxx"
16743                     ;;
16744                 *)  cat >&4 <<EOM
16745 Cannot determine the largest integer value your NVs can hold, unexpected output
16746 '$xxx'
16747 EOM
16748                     ;;
16749             esac
16750             ;;
16751         *)  cat >&4 <<EOM
16752 Cannot determine the largest integer value your NVs can hold
16753 EOM
16754             ;;
16755     esac
16756 fi
16757 $rm_try
16758
16759 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16760 $cat <<EOP >try.c
16761 #include <stdio.h>
16762 #$i_stdlib I_STDLIB
16763 #ifdef I_STDLIB
16764 #include <stdlib.h>
16765 #endif
16766 #include <string.h>
16767 #include <sys/types.h>
16768 #include <signal.h>
16769 #ifdef SIGFPE
16770 /* volatile so that the compiler has to store it out to memory */
16771 volatile int bletched = 0;
16772 $signal_t blech(int s) { bletched = 1; }
16773 #endif
16774
16775 int checkit($nvtype d, const char *where) {
16776     void *v = &d;
16777     unsigned char *p = (unsigned char *)v;
16778     unsigned char *end = p + sizeof(d);
16779     int fail = 0;
16780
16781     while (p < end)
16782         fail += *p++;
16783
16784     if (!fail)
16785         return 0;
16786
16787     p = (unsigned char *)v;
16788     printf("No - %s: 0x", where);
16789     while (p < end)
16790         printf ("%02X", *p++);
16791     printf("\n");
16792     return 1;
16793 }
16794
16795 int main(int argc, char **argv) {
16796     $nvtype d = 0.0;
16797     int fail = 0;
16798     fail += checkit(d, "0.0");
16799
16800     /* The compiler shouldn't be assuming that bletched is 0  */
16801     d = bletched;
16802
16803     fail += checkit(d, "bleched");
16804
16805 #ifdef SIGFPE
16806     signal(SIGFPE, blech);
16807 #endif
16808
16809     /* Paranoia - the compiler should have no way of knowing that ANSI says
16810        that argv[argc] will always be NULL.  Actually, if it did assume this it
16811        would be buggy, as this is C and main() can be called from elsewhere in
16812        the program.  */
16813     d = argv[argc] ? 1 : 0;
16814
16815     if (d) {
16816         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16817     }
16818
16819     fail += checkit(d, "ternary");
16820
16821     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16822
16823     if (d != 0.0) {
16824         printf("No - memset doesn't give 0.0\n");
16825         /* This might just blow up:  */
16826         printf("(gives %g)\n", d);
16827         return 1;
16828     }
16829
16830 #ifdef SIGFPE
16831     if (bletched) {
16832         printf("No - something bleched\n");
16833         return 1;
16834     }
16835 #endif
16836     if (fail) {
16837       printf("No - %d fail(s)\n", fail);
16838       return 1;
16839     }
16840     printf("Yes\n");
16841     return 0;
16842 }
16843 EOP
16844 set try
16845
16846 d_nv_zero_is_allbits_zero="$undef"
16847 if eval $compile; then
16848     xxx="`$run ./try`"
16849     case "$?" in
16850         0)
16851             case "$xxx" in
16852                 Yes)  cat >&4 <<EOM
16853 0.0 is represented as all bits zero in memory
16854 EOM
16855                     d_nv_zero_is_allbits_zero="$define"
16856                     ;;
16857                 *)  cat >&4 <<EOM
16858 0.0 is not represented as all bits zero in memory
16859 EOM
16860                     d_nv_zero_is_allbits_zero="$undef"
16861                     ;;
16862             esac
16863             ;;
16864         *)  cat >&4 <<EOM
16865 0.0 is not represented as all bits zero in memory
16866 EOM
16867             d_nv_zero_is_allbits_zero="$undef"
16868             ;;
16869     esac
16870 fi
16871 $rm_try
16872
16873 : check for off64_t
16874 echo " "
16875 echo "Checking to see if you have off64_t..." >&4
16876 $cat >try.c <<EOCP
16877 #include <sys/types.h>
16878 #include <unistd.h>
16879 int main() { off64_t x = 7; }
16880 EOCP
16881 set try
16882 if eval $compile; then
16883         val="$define"
16884         echo "You have off64_t."
16885 else
16886         val="$undef"
16887         echo "You do not have off64_t."
16888         case "$lseeksize" in
16889         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16890         esac
16891 fi
16892 $rm_try
16893 set d_off64_t
16894 eval $setvar
16895
16896 : how to create joinable pthreads
16897 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16898         echo " "
16899         echo "Checking what constant to use for creating joinable pthreads..." >&4
16900         $cat >try.c <<'EOCP'
16901 #include <pthread.h>
16902 int main() {
16903     int detachstate = JOINABLE;
16904 }
16905 EOCP
16906         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16907         if eval $compile; then
16908                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16909                 val="$undef" # Yes, undef.
16910                 set d_old_pthread_create_joinable
16911                 eval $setvar
16912                 val=""
16913                 set old_pthread_create_joinable
16914                 eval $setvar
16915         else
16916                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16917                 if eval $compile; then
16918                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16919                         val="$define"
16920                         set d_old_pthread_create_joinable
16921                         eval $setvar
16922                         val=PTHREAD_CREATE_UNDETACHED
16923                         set old_pthread_create_joinable
16924                         eval $setvar
16925                 else
16926                         set try -DJOINABLE=__UNDETACHED
16927                         if eval $compile; then
16928                                 echo "You seem to use __UNDETACHED." >&4
16929                                 val="$define"
16930                                 set d_old_pthread_create_joinable
16931                                 eval $setvar
16932                                 val=__UNDETACHED
16933                                 set old_pthread_create_joinable
16934                                 eval $setvar
16935                         else
16936                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16937                                 val="$define"
16938                                 set d_old_pthread_create_joinable
16939                                 eval $setvar
16940                                 val=0
16941                                 set old_pthread_create_joinable
16942                                 eval $setvar
16943                         fi
16944                 fi
16945         fi
16946         $rm_try
16947 else
16948     d_old_pthread_create_joinable="$undef"
16949     old_pthread_create_joinable=""
16950 fi
16951
16952 : see if pause exists
16953 set pause d_pause
16954 eval $inlibc
16955
16956 : see if pipe2 exists
16957 set pipe2 d_pipe2
16958 eval $inlibc
16959
16960 : see if poll exists
16961 set poll d_poll
16962 eval $inlibc
16963
16964 : see if prctl exists
16965 set prctl d_prctl
16966 eval $inlibc
16967
16968 : see if prctl supports PR_SET_NAME
16969 d_prctl_set_name=$undef
16970 case $d_prctl in
16971     $define)
16972         $cat >try.c <<EOM
16973 #ifdef __ANDROID__
16974 #include <unistd.h>
16975 #endif
16976 #include <sys/prctl.h>
16977
16978 int main (int argc, char *argv[])
16979 {
16980     return (prctl (PR_SET_NAME, "Test"));
16981     } /* main */
16982 EOM
16983         set try
16984         if eval $compile_ok && $run ./try; then
16985             echo "Your prctl (PR_SET_NAME, ...) works"
16986             d_prctl_set_name=$define
16987             fi
16988         $rm_try
16989         ;;
16990     esac
16991
16992 : see if readlink exists
16993 set readlink d_readlink
16994 eval $inlibc
16995
16996 : Check if there is a /proc symlink to the abs path of
16997 : the executing program.  We will honor hints of d_procselfexe=$undef
16998 : or procselfexe being non-empty, otherwise will try to determine both
16999 : if we have readlink.
17000 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17001 : referenced, and AmigaOS does not have a proc filesystem anyway.
17002 echo " "
17003 val="$undef"
17004 if $test "X$d_procselfexe" = Xundef; then
17005         procselfexe=''
17006 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17007         val="$define"
17008 elif $test "X$d_readlink" = Xdefine; then
17009         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17010         : and it feels more tidy to avoid an extra level of symlink
17011         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17012         while test $# -gt 0; do
17013             type=$1; try=$2
17014             shift; shift
17015             if $issymlink $try; then
17016                 $ls -l $try > reflect
17017                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17018                     echo "You have $type-like $try."
17019                     procselfexe='"'$try'"'
17020                     val="$define"
17021                     : This will break out of the loop
17022                     set X; shift
17023                 fi
17024             fi
17025         done
17026 fi
17027 $rm -f reflect
17028 set d_procselfexe
17029 eval $setvar
17030
17031 : backward compatibility for d_hvfork
17032 if test X$d_hvfork != X; then
17033         d_vfork="$d_hvfork"
17034         d_hvfork=''
17035 fi
17036 : see if there is a vfork
17037 val=''
17038 set vfork val
17039 eval $inlibc
17040
17041 d_pseudofork=$undef
17042
17043 : Ok, but do we want to use it. vfork is reportedly unreliable in
17044 : perl on Solaris 2.x, and probably elsewhere.
17045 case "$val" in
17046 $define)
17047         echo " "
17048         case "$usevfork" in
17049         false) dflt='n';;
17050         *) dflt='y';;
17051         esac
17052         cat <<'EOM'
17053
17054 Perl can only use a vfork() that doesn't suffer from strict
17055 restrictions on calling functions or modifying global data in
17056 the child.  For example, glibc-2.1 contains such a vfork()
17057 that is unsuitable.  If your system provides a proper fork()
17058 call, chances are that you do NOT want perl to use vfork().
17059
17060 EOM
17061         rp="Do you still want to use vfork()?"
17062         . ./myread
17063         case "$ans" in
17064         y|Y) ;;
17065         *)
17066                 echo "Ok, we won't use vfork()."
17067                 val="$undef"
17068                 ;;
17069         esac
17070         ;;
17071 esac
17072 set d_vfork
17073 eval $setvar
17074 case "$d_vfork" in
17075 $define) usevfork='true';;
17076 *) usevfork='false';;
17077 esac
17078
17079 : see whether the pthread_atfork exists
17080 $cat >try.c <<EOP
17081 #include <pthread.h>
17082 #include <stdio.h>
17083 int main() {
17084 #ifdef  PTHREAD_ATFORK
17085         pthread_atfork(NULL,NULL,NULL);
17086 #endif
17087 }
17088 EOP
17089
17090 : see if pthread_atfork exists
17091 set try -DPTHREAD_ATFORK
17092 if eval $compile; then
17093     val="$define"
17094 else
17095     val="$undef"
17096 fi
17097 case "$usethreads" in
17098 $define)
17099         case "$val" in
17100         $define) echo 'pthread_atfork found.' >&4        ;;
17101         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17102         esac
17103 esac
17104 set d_pthread_atfork
17105 eval $setvar
17106
17107 : see if pthread_attr_setscope exists
17108 set pthread_attr_setscope d_pthread_attr_setscope
17109 eval $inlibc
17110
17111 : see whether the various POSIXish _yields exist
17112 $cat >try.c <<EOP
17113 #include <pthread.h>
17114 #include <stdio.h>
17115 int main() {
17116 #ifdef SCHED_YIELD
17117         sched_yield();
17118 #else
17119 #ifdef PTHREAD_YIELD
17120         pthread_yield();
17121 #else
17122 #ifdef PTHREAD_YIELD_NULL
17123         pthread_yield(NULL);
17124 #endif
17125 #endif
17126 #endif
17127 }
17128 EOP
17129 : see if sched_yield exists
17130 set try -DSCHED_YIELD
17131 if eval $compile; then
17132     val="$define"
17133     sched_yield='sched_yield()'
17134 else
17135     val="$undef"
17136 fi
17137 case "$usethreads" in
17138 $define)
17139         case "$val" in
17140         $define) echo 'sched_yield() found.' >&4        ;;
17141         *)       echo 'sched_yield() NOT found.' >&4    ;;
17142         esac
17143 esac
17144 set d_sched_yield
17145 eval $setvar
17146
17147 : see if pthread_yield exists
17148 set try -DPTHREAD_YIELD
17149 if eval $compile; then
17150     val="$define"
17151     case "$sched_yield" in
17152     '') sched_yield='pthread_yield()' ;;
17153     esac
17154 else
17155     set try -DPTHREAD_YIELD_NULL
17156     if eval $compile; then
17157         val="$define"
17158         case "$sched_yield" in
17159         '') sched_yield='pthread_yield(NULL)' ;;
17160         esac
17161     else
17162         val="$undef"
17163     fi
17164 fi
17165 case "$usethreads" in
17166 $define)
17167         case "$val" in
17168         $define) echo 'pthread_yield() found.' >&4      ;;
17169         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17170         esac
17171         ;;
17172 esac
17173 set d_pthread_yield
17174 eval $setvar
17175 case "$sched_yield" in
17176 '') sched_yield=undef ;;
17177 esac
17178 $rm_try
17179
17180 : check for ptrdiff_t
17181 echo " "
17182 echo "Checking to see if you have ptrdiff_t..." >&4
17183 $cat >try.c <<EOCP
17184 #include <stddef.h>
17185 int main() { ptrdiff_t x = 7; }
17186 EOCP
17187 set try
17188 if eval $compile; then
17189         val="$define"
17190         echo "You have ptrdiff_t."
17191 else
17192         val="$undef"
17193         echo "You do not have ptrdiff_t."
17194 fi
17195 $rm_try
17196 set d_ptrdiff_t
17197 eval $setvar
17198
17199 : see if random_r exists
17200 set random_r d_random_r
17201 eval $inlibc
17202 case "$d_random_r" in
17203 "$define")
17204         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17205         case "$d_random_r_proto:$usethreads" in
17206         ":define")      d_random_r_proto=define
17207                 set d_random_r_proto random_r $hdrs
17208                 eval $hasproto ;;
17209         *)      ;;
17210         esac
17211         case "$d_random_r_proto" in
17212         define)
17213         case "$random_r_proto" in
17214         ''|0) try='int random_r(int*, struct random_data*);'
17215         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17216         esac
17217         case "$random_r_proto" in
17218         ''|0) try='int random_r(long*, struct random_data*);'
17219         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17220         esac
17221         case "$random_r_proto" in
17222         ''|0) try='int random_r(struct random_data*, int32_t*);'
17223         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17224         esac
17225         case "$random_r_proto" in
17226         ''|0)   d_random_r=undef
17227                 random_r_proto=0
17228                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17229         * )     case "$random_r_proto" in
17230                 REENTRANT_PROTO*) ;;
17231                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17232                 esac
17233                 echo "Prototype: $try" ;;
17234         esac
17235         ;;
17236         *)      case "$usethreads" in
17237                 define) echo "random_r has no prototype, not using it." >&4 ;;
17238                 esac
17239                 d_random_r=undef
17240                 random_r_proto=0
17241                 ;;
17242         esac
17243         ;;
17244 *)      random_r_proto=0
17245         ;;
17246 esac
17247
17248 : see if readdir and friends exist
17249 set readdir d_readdir
17250 eval $inlibc
17251 set seekdir d_seekdir
17252 eval $inlibc
17253 set telldir d_telldir
17254 eval $inlibc
17255 set rewinddir d_rewinddir
17256 eval $inlibc
17257
17258 : see if readdir64_r exists
17259 set readdir64_r d_readdir64_r
17260 eval $inlibc
17261 case "$d_readdir64_r" in
17262 "$define")
17263         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17264         case "$d_readdir64_r_proto:$usethreads" in
17265         ":define")      d_readdir64_r_proto=define
17266                 set d_readdir64_r_proto readdir64_r $hdrs
17267                 eval $hasproto ;;
17268         *)      ;;
17269         esac
17270         case "$d_readdir64_r_proto" in
17271         define)
17272         case "$readdir64_r_proto" in
17273         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17274         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17275         esac
17276         case "$readdir64_r_proto" in
17277         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17278         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17279         esac
17280         case "$readdir64_r_proto" in
17281         ''|0)   d_readdir64_r=undef
17282                 readdir64_r_proto=0
17283                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17284         * )     case "$readdir64_r_proto" in
17285                 REENTRANT_PROTO*) ;;
17286                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17287                 esac
17288                 echo "Prototype: $try" ;;
17289         esac
17290         ;;
17291         *)      case "$usethreads" in
17292                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17293                 esac
17294                 d_readdir64_r=undef
17295                 readdir64_r_proto=0
17296                 ;;
17297         esac
17298         ;;
17299 *)      readdir64_r_proto=0
17300         ;;
17301 esac
17302
17303 : see if readdir_r exists
17304 set readdir_r d_readdir_r
17305 eval $inlibc
17306 case "$d_readdir_r" in
17307 "$define")
17308         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17309         case "$d_readdir_r_proto:$usethreads" in
17310         ":define")      d_readdir_r_proto=define
17311                 set d_readdir_r_proto readdir_r $hdrs
17312                 eval $hasproto ;;
17313         *)      ;;
17314         esac
17315         case "$d_readdir_r_proto" in
17316         define)
17317         case "$readdir_r_proto" in
17318         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17319         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17320         esac
17321         case "$readdir_r_proto" in
17322         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17323         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17324         esac
17325         case "$readdir_r_proto" in
17326         ''|0)   d_readdir_r=undef
17327                 readdir_r_proto=0
17328                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17329         * )     case "$readdir_r_proto" in
17330                 REENTRANT_PROTO*) ;;
17331                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17332                 esac
17333                 echo "Prototype: $try" ;;
17334         esac
17335         ;;
17336         *)      case "$usethreads" in
17337                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17338                 esac
17339                 d_readdir_r=undef
17340                 readdir_r_proto=0
17341                 ;;
17342         esac
17343         ;;
17344 *)      readdir_r_proto=0
17345         ;;
17346 esac
17347
17348 : see if readv exists
17349 set readv d_readv
17350 eval $inlibc
17351
17352 : see if recvmsg exists
17353 set recvmsg d_recvmsg
17354 eval $inlibc
17355
17356 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17357 echo " "
17358 if set regcomp val -f d_regcomp; eval $csym; $val; then
17359         echo 'regcomp() found.' >&4
17360         d_regcomp="$define"
17361         d_regcmp="$undef"
17362         d_re_comp="$undef"
17363 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17364         echo 'regcmp() found.' >&4
17365         d_regcmp="$define"
17366         d_regcomp="$undef"
17367         d_re_comp="$undef"
17368 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17369         echo 're_comp() found, assuming re_exec() also exists.' >&4
17370         d_re_comp="$define"
17371         d_regcomp="$undef"
17372         d_regcmp="$undef"
17373 else
17374         $cat >&4 <<EOM
17375 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17376 EOM
17377         d_regcmp="$undef"
17378         d_re_comp="$undef"
17379         d_regcomp="$undef"
17380 fi
17381
17382 : see if remainder exists
17383 set remainder d_remainder
17384 eval $inlibc
17385
17386 : see if remquo exists
17387 set remquo d_remquo
17388 eval $inlibc
17389
17390 : see if rename exists
17391 set rename d_rename
17392 eval $inlibc
17393
17394 : see if rint exists
17395 set rint d_rint
17396 eval $inlibc
17397
17398 : see if rmdir exists
17399 set rmdir d_rmdir
17400 eval $inlibc
17401
17402 : see if round exists
17403 set round d_round
17404 eval $inlibc
17405
17406 : see if prototype for sbrk is available
17407 echo " "
17408 set d_sbrkproto sbrk $i_unistd unistd.h
17409 eval $hasproto
17410
17411 : see if scalbn exists
17412 set scalbn d_scalbn
17413 eval $inlibc
17414
17415 : see if select exists
17416 set select d_select
17417 eval $inlibc
17418
17419 : see if semctl exists
17420 set semctl d_semctl
17421 eval $inlibc
17422
17423 : see if semget exists
17424 set semget d_semget
17425 eval $inlibc
17426
17427 : see if semop exists
17428 set semop d_semop
17429 eval $inlibc
17430
17431 : see how much of the 'sem*(2)' library is present.
17432 h_sem=true
17433 echo " "
17434 case "$d_semctl$d_semget$d_semop" in
17435 *"$undef"*) h_sem=false;;
17436 esac
17437 case "$osname" in
17438 freebsd)
17439     case "`ipcs 2>&1`" in
17440     "SVID messages"*"not configured"*)
17441         echo "Your $osname does not have the sem*(2) configured." >&4
17442         h_sem=false
17443         val="$undef"
17444         set semctl d_semctl
17445         eval $setvar
17446         set semget d_semget
17447         eval $setvar
17448         set semop d_semop
17449         eval $setvar
17450         ;;
17451     esac
17452     ;;
17453 esac
17454 : we could also check for sys/ipc.h ...
17455 if $h_sem && $test `./findhdr sys/sem.h`; then
17456         echo "You have the full sem*(2) library." >&4
17457         val="$define"
17458 else
17459         echo "You don't have the full sem*(2) library." >&4
17460         val="$undef"
17461 fi
17462 set d_sem
17463 eval $setvar
17464
17465 : see whether sys/sem.h defines union semun
17466 echo " "
17467 $cat > try.c <<'END'
17468 #include <sys/types.h>
17469 #include <sys/ipc.h>
17470 #include <sys/sem.h>
17471 int main () { union semun semun; semun.buf = 0; }
17472 END
17473 set try
17474 if eval $compile; then
17475     echo "You have union semun in <sys/sem.h>." >&4
17476     val="$define"
17477 else
17478     echo "You do not have union semun in <sys/sem.h>." >&4
17479     val="$undef"
17480 fi
17481 $rm_try
17482 set d_union_semun
17483 eval $setvar
17484
17485 : see how to do semctl IPC_STAT
17486 case "$d_sem" in
17487 $define)
17488     echo " "
17489     $cat > tryh.h <<END
17490 #ifndef S_IRUSR
17491 #   ifdef S_IREAD
17492 #       define S_IRUSR S_IREAD
17493 #       define S_IWUSR S_IWRITE
17494 #       define S_IXUSR S_IEXEC
17495 #   else
17496 #       define S_IRUSR 0400
17497 #       define S_IWUSR 0200
17498 #       define S_IXUSR 0100
17499 #   endif
17500 #   define S_IRGRP (S_IRUSR>>3)
17501 #   define S_IWGRP (S_IWUSR>>3)
17502 #   define S_IXGRP (S_IXUSR>>3)
17503 #   define S_IROTH (S_IRUSR>>6)
17504 #   define S_IWOTH (S_IWUSR>>6)
17505 #   define S_IXOTH (S_IXUSR>>6)
17506 #endif
17507 #ifndef S_IRWXU
17508 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17509 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17510 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17511 #endif
17512 END
17513     : see whether semctl IPC_STAT can use union semun
17514     case "$d_semctl_semun" in
17515     '')
17516       val="$undef"
17517       $cat > try.c <<END
17518 #include <sys/types.h>
17519 #include <sys/ipc.h>
17520 #include <sys/sem.h>
17521 #include <sys/stat.h>
17522 #include <stdio.h>
17523 #include <errno.h>
17524 #include "tryh.h"
17525 #ifndef errno
17526 extern int errno;
17527 #endif
17528 #$d_union_semun HAS_UNION_SEMUN
17529 int main() {
17530     union semun
17531 #ifndef HAS_UNION_SEMUN
17532     {
17533         int val;
17534         struct semid_ds *buf;
17535         unsigned short *array;
17536     }
17537 #endif
17538     arg;
17539     int sem, st;
17540
17541 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17542     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17543     if (sem > -1) {
17544         struct semid_ds argbuf;
17545         arg.buf = &argbuf;
17546 #       ifdef IPC_STAT
17547         st = semctl(sem, 0, IPC_STAT, arg);
17548         if (st == 0)
17549             printf("semun\n");
17550         else
17551 #       endif /* IPC_STAT */
17552             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17553 #       ifdef IPC_RMID
17554         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17555 #       endif /* IPC_RMID */
17556             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17557     } else
17558 #endif /* IPC_PRIVATE && ... */
17559         printf("semget failed: errno = %d\n", errno);
17560   return 0;
17561 }
17562 END
17563       set try
17564       if eval $compile; then
17565           xxx=`$run ./try`
17566           case "$xxx" in
17567           semun) val="$define" ;;
17568           esac
17569       fi
17570       $rm_try
17571       set d_semctl_semun
17572       eval $setvar
17573       ;;
17574     esac
17575     case "$d_semctl_semun" in
17576     $define)
17577         echo "You can use union semun for semctl IPC_STAT." >&4
17578         also='also'
17579         ;;
17580     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17581         also=''
17582         ;;
17583     esac
17584
17585     : see whether semctl IPC_STAT can use struct semid_ds pointer
17586     case "$d_semctl_semid_ds" in
17587     '')
17588       val="$undef"
17589       $cat > try.c <<'END'
17590 #include <sys/types.h>
17591 #include <sys/ipc.h>
17592 #include <sys/sem.h>
17593 #include <sys/stat.h>
17594 #include "tryh.h"
17595 #include <stdio.h>
17596 #include <errno.h>
17597 #ifndef errno
17598 extern int errno;
17599 #endif
17600 int main() {
17601     union semun
17602 #ifndef HAS_UNION_SEMUN
17603     {
17604         int val;
17605         struct semid_ds *buf;
17606         unsigned short *array;
17607     }
17608 #endif
17609     arg;
17610     struct semid_ds argbuf;
17611     int sem, st;
17612
17613 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17614     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17615     if (sem > -1) {
17616         arg.buf = &argbuf;
17617 #       ifdef IPC_STAT
17618         st = semctl(sem, 0, IPC_STAT, arg);
17619         if (st == 0)
17620             printf("semid_ds\n");
17621         else
17622 #       endif /* IPC_STAT */
17623             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17624 #       ifdef IPC_RMID
17625         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17626 #       endif /* IPC_RMID */
17627             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17628     } else
17629 #endif /* IPC_PRIVATE && ... */
17630         printf("semget failed: errno = %d\n", errno);
17631
17632     return 0;
17633 }
17634 END
17635       set try
17636       if eval $compile; then
17637           xxx=`$run ./try`
17638           case "$xxx" in
17639           semid_ds) val="$define" ;;
17640           esac
17641       fi
17642       $rm_try
17643       set d_semctl_semid_ds
17644       eval $setvar
17645       ;;
17646     esac
17647     case "$d_semctl_semid_ds" in
17648     $define)
17649         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17650         ;;
17651     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17652         ;;
17653     esac
17654     ;;
17655 *)  val="$undef"
17656
17657     # We do not have the full sem*(2) library, so assume we can not
17658     # use either.
17659
17660     set d_semctl_semun
17661     eval $setvar
17662
17663     set d_semctl_semid_ds
17664     eval $setvar
17665     ;;
17666 esac
17667 $rm_try tryh.h
17668
17669 : see if sendmsg exists
17670 set sendmsg d_sendmsg
17671 eval $inlibc
17672
17673 : see if setegid exists
17674 set setegid d_setegid
17675 eval $inlibc
17676
17677 : see if seteuid exists
17678 set seteuid d_seteuid
17679 eval $inlibc
17680
17681 : see if setgrent exists
17682 set setgrent d_setgrent
17683 eval $inlibc
17684
17685 : see if setgrent_r exists
17686 set setgrent_r d_setgrent_r
17687 eval $inlibc
17688 case "$d_setgrent_r" in
17689 "$define")
17690         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17691         case "$d_setgrent_r_proto:$usethreads" in
17692         ":define")      d_setgrent_r_proto=define
17693                 set d_setgrent_r_proto setgrent_r $hdrs
17694                 eval $hasproto ;;
17695         *)      ;;
17696         esac
17697         case "$d_setgrent_r_proto" in
17698         define)
17699         case "$setgrent_r_proto" in
17700         ''|0) try='int setgrent_r(FILE**);'
17701         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17702         esac
17703         case "$setgrent_r_proto" in
17704         ''|0) try='void setgrent_r(FILE**);'
17705         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17706         esac
17707         case "$setgrent_r_proto" in
17708         ''|0)   d_setgrent_r=undef
17709                 setgrent_r_proto=0
17710                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17711         * )     case "$setgrent_r_proto" in
17712                 REENTRANT_PROTO*) ;;
17713                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17714                 esac
17715                 echo "Prototype: $try" ;;
17716         esac
17717         ;;
17718         *)      case "$usethreads" in
17719                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17720                 esac
17721                 d_setgrent_r=undef
17722                 setgrent_r_proto=0
17723                 ;;
17724         esac
17725         ;;
17726 *)      setgrent_r_proto=0
17727         ;;
17728 esac
17729
17730 : see if sethostent exists
17731 set sethostent d_sethent
17732 eval $inlibc
17733
17734 : see if sethostent_r exists
17735 set sethostent_r d_sethostent_r
17736 eval $inlibc
17737 case "$d_sethostent_r" in
17738 "$define")
17739         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17740         case "$d_sethostent_r_proto:$usethreads" in
17741         ":define")      d_sethostent_r_proto=define
17742                 set d_sethostent_r_proto sethostent_r $hdrs
17743                 eval $hasproto ;;
17744         *)      ;;
17745         esac
17746         case "$d_sethostent_r_proto" in
17747         define)
17748         case "$sethostent_r_proto" in
17749         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17750         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17751         esac
17752         case "$sethostent_r_proto" in
17753         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17754         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17755         esac
17756         case "$sethostent_r_proto" in
17757         ''|0)   d_sethostent_r=undef
17758                 sethostent_r_proto=0
17759                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17760         * )     case "$sethostent_r_proto" in
17761                 REENTRANT_PROTO*) ;;
17762                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17763                 esac
17764                 echo "Prototype: $try" ;;
17765         esac
17766         ;;
17767         *)      case "$usethreads" in
17768                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17769                 esac
17770                 d_sethostent_r=undef
17771                 sethostent_r_proto=0
17772                 ;;
17773         esac
17774         ;;
17775 *)      sethostent_r_proto=0
17776         ;;
17777 esac
17778
17779 : see if setitimer exists
17780 set setitimer d_setitimer
17781 eval $inlibc
17782
17783 : see if setlinebuf exists
17784 set setlinebuf d_setlinebuf
17785 eval $inlibc
17786
17787 : see if setlocale exists
17788 set setlocale d_setlocale
17789 eval $inlibc
17790
17791 : see if locale.h is available
17792 set locale.h i_locale
17793 eval $inhdr
17794
17795 : see if setlocale_r exists
17796 set setlocale_r d_setlocale_r
17797 eval $inlibc
17798 case "$d_setlocale_r" in
17799 "$define")
17800         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17801         case "$d_setlocale_r_proto:$usethreads" in
17802         ":define")      d_setlocale_r_proto=define
17803                 set d_setlocale_r_proto setlocale_r $hdrs
17804                 eval $hasproto ;;
17805         *)      ;;
17806         esac
17807         case "$d_setlocale_r_proto" in
17808         define)
17809         case "$setlocale_r_proto" in
17810         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17811         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17812         esac
17813         case "$setlocale_r_proto" in
17814         ''|0)   d_setlocale_r=undef
17815                 setlocale_r_proto=0
17816                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17817         * )     case "$setlocale_r_proto" in
17818                 REENTRANT_PROTO*) ;;
17819                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17820                 esac
17821                 echo "Prototype: $try" ;;
17822         esac
17823         ;;
17824         *)      case "$usethreads" in
17825                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17826                 esac
17827                 d_setlocale_r=undef
17828                 setlocale_r_proto=0
17829                 ;;
17830         esac
17831         ;;
17832 *)      setlocale_r_proto=0
17833         ;;
17834 esac
17835
17836 : see if setnetent exists
17837 set setnetent d_setnent
17838 eval $inlibc
17839
17840 : see if setnetent_r exists
17841 set setnetent_r d_setnetent_r
17842 eval $inlibc
17843 case "$d_setnetent_r" in
17844 "$define")
17845         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17846         case "$d_setnetent_r_proto:$usethreads" in
17847         ":define")      d_setnetent_r_proto=define
17848                 set d_setnetent_r_proto setnetent_r $hdrs
17849                 eval $hasproto ;;
17850         *)      ;;
17851         esac
17852         case "$d_setnetent_r_proto" in
17853         define)
17854         case "$setnetent_r_proto" in
17855         ''|0) try='int setnetent_r(int, struct netent_data*);'
17856         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17857         esac
17858         case "$setnetent_r_proto" in
17859         ''|0) try='void setnetent_r(int, struct netent_data*);'
17860         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17861         esac
17862         case "$setnetent_r_proto" in
17863         ''|0)   d_setnetent_r=undef
17864                 setnetent_r_proto=0
17865                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17866         * )     case "$setnetent_r_proto" in
17867                 REENTRANT_PROTO*) ;;
17868                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17869                 esac
17870                 echo "Prototype: $try" ;;
17871         esac
17872         ;;
17873         *)      case "$usethreads" in
17874                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17875                 esac
17876                 d_setnetent_r=undef
17877                 setnetent_r_proto=0
17878                 ;;
17879         esac
17880         ;;
17881 *)      setnetent_r_proto=0
17882         ;;
17883 esac
17884
17885 : see if setprotoent exists
17886 set setprotoent d_setpent
17887 eval $inlibc
17888
17889 : see if setpgid exists
17890 set setpgid d_setpgid
17891 eval $inlibc
17892
17893 : see if setpgrp2 exists
17894 set setpgrp2 d_setpgrp2
17895 eval $inlibc
17896
17897 : see if setpriority exists
17898 set setpriority d_setprior
17899 eval $inlibc
17900
17901 : see if setproctitle exists
17902 set setproctitle d_setproctitle
17903 eval $inlibc
17904
17905 : see if setprotoent_r exists
17906 set setprotoent_r d_setprotoent_r
17907 eval $inlibc
17908 case "$d_setprotoent_r" in
17909 "$define")
17910         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17911         case "$d_setprotoent_r_proto:$usethreads" in
17912         ":define")      d_setprotoent_r_proto=define
17913                 set d_setprotoent_r_proto setprotoent_r $hdrs
17914                 eval $hasproto ;;
17915         *)      ;;
17916         esac
17917         case "$d_setprotoent_r_proto" in
17918         define)
17919         case "$setprotoent_r_proto" in
17920         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17921         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17922         esac
17923         case "$setprotoent_r_proto" in
17924         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17925         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17926         esac
17927         case "$setprotoent_r_proto" in
17928         ''|0)   d_setprotoent_r=undef
17929                 setprotoent_r_proto=0
17930                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17931         * )     case "$setprotoent_r_proto" in
17932                 REENTRANT_PROTO*) ;;
17933                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17934                 esac
17935                 echo "Prototype: $try" ;;
17936         esac
17937         ;;
17938         *)      case "$usethreads" in
17939                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17940                 esac
17941                 d_setprotoent_r=undef
17942                 setprotoent_r_proto=0
17943                 ;;
17944         esac
17945         ;;
17946 *)      setprotoent_r_proto=0
17947         ;;
17948 esac
17949
17950 : see if setpwent exists
17951 set setpwent d_setpwent
17952 eval $inlibc
17953
17954 : see if setpwent_r exists
17955 set setpwent_r d_setpwent_r
17956 eval $inlibc
17957 case "$d_setpwent_r" in
17958 "$define")
17959         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17960         case "$d_setpwent_r_proto:$usethreads" in
17961         ":define")      d_setpwent_r_proto=define
17962                 set d_setpwent_r_proto setpwent_r $hdrs
17963                 eval $hasproto ;;
17964         *)      ;;
17965         esac
17966         case "$d_setpwent_r_proto" in
17967         define)
17968         case "$setpwent_r_proto" in
17969         ''|0) try='int setpwent_r(FILE**);'
17970         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17971         esac
17972         case "$setpwent_r_proto" in
17973         ''|0) try='void setpwent_r(FILE**);'
17974         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17975         esac
17976         case "$setpwent_r_proto" in
17977         ''|0)   d_setpwent_r=undef
17978                 setpwent_r_proto=0
17979                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17980         * )     case "$setpwent_r_proto" in
17981                 REENTRANT_PROTO*) ;;
17982                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17983                 esac
17984                 echo "Prototype: $try" ;;
17985         esac
17986         ;;
17987         *)      case "$usethreads" in
17988                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17989                 esac
17990                 d_setpwent_r=undef
17991                 setpwent_r_proto=0
17992                 ;;
17993         esac
17994         ;;
17995 *)      setpwent_r_proto=0
17996         ;;
17997 esac
17998
17999 : see if setregid exists
18000 set setregid d_setregid
18001 eval $inlibc
18002 set setresgid d_setresgid
18003 eval $inlibc
18004
18005 : see if setreuid exists
18006 set setreuid d_setreuid
18007 eval $inlibc
18008 set setresuid d_setresuid
18009 eval $inlibc
18010
18011 : see if setrgid exists
18012 set setrgid d_setrgid
18013 eval $inlibc
18014
18015 : see if setruid exists
18016 set setruid d_setruid
18017 eval $inlibc
18018
18019 : see if setservent exists
18020 set setservent d_setsent
18021 eval $inlibc
18022
18023 : see if setservent_r exists
18024 set setservent_r d_setservent_r
18025 eval $inlibc
18026 case "$d_setservent_r" in
18027 "$define")
18028         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18029         case "$d_setservent_r_proto:$usethreads" in
18030         ":define")      d_setservent_r_proto=define
18031                 set d_setservent_r_proto setservent_r $hdrs
18032                 eval $hasproto ;;
18033         *)      ;;
18034         esac
18035         case "$d_setservent_r_proto" in
18036         define)
18037         case "$setservent_r_proto" in
18038         ''|0) try='int setservent_r(int, struct servent_data*);'
18039         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18040         esac
18041         case "$setservent_r_proto" in
18042         ''|0) try='void setservent_r(int, struct servent_data*);'
18043         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18044         esac
18045         case "$setservent_r_proto" in
18046         ''|0)   d_setservent_r=undef
18047                 setservent_r_proto=0
18048                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18049         * )     case "$setservent_r_proto" in
18050                 REENTRANT_PROTO*) ;;
18051                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18052                 esac
18053                 echo "Prototype: $try" ;;
18054         esac
18055         ;;
18056         *)      case "$usethreads" in
18057                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18058                 esac
18059                 d_setservent_r=undef
18060                 setservent_r_proto=0
18061                 ;;
18062         esac
18063         ;;
18064 *)      setservent_r_proto=0
18065         ;;
18066 esac
18067
18068 : see if setsid exists
18069 set setsid d_setsid
18070 eval $inlibc
18071
18072 : see if setvbuf exists
18073 set setvbuf d_setvbuf
18074 eval $inlibc
18075
18076 : see if shmctl exists
18077 set shmctl d_shmctl
18078 eval $inlibc
18079
18080 : see if shmget exists
18081 set shmget d_shmget
18082 eval $inlibc
18083
18084 : see if shmat exists
18085 set shmat d_shmat
18086 eval $inlibc
18087 : see what shmat returns
18088 case "$d_shmat" in
18089 "$define")
18090         $cat >shmat.c <<'END'
18091 #include <sys/shm.h>
18092 void *shmat();
18093 END
18094         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18095                 shmattype='void *'
18096         else
18097                 shmattype='char *'
18098         fi
18099         echo "and it returns ($shmattype)." >&4
18100         : see if a prototype for shmat is available
18101         xxx=`./findhdr sys/shm.h`
18102         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18103         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18104                 val="$define"
18105         else
18106                 val="$undef"
18107         fi
18108         $rm -f shmat.[co]
18109         ;;
18110 *)
18111         val="$undef"
18112         ;;
18113 esac
18114 set d_shmatprototype
18115 eval $setvar
18116
18117 : see if shmdt exists
18118 set shmdt d_shmdt
18119 eval $inlibc
18120
18121 : see how much of the 'shm*(2)' library is present.
18122 h_shm=true
18123 echo " "
18124 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18125 *"$undef"*) h_shm=false;;
18126 esac
18127 case "$osname" in
18128 freebsd)
18129     case "`ipcs 2>&1`" in
18130     "SVID shared memory"*"not configured"*)
18131         echo "Your $osname does not have the shm*(2) configured." >&4
18132         h_shm=false
18133         val="$undef"
18134         set shmctl d_shmctl
18135         eval $setvar
18136         set shmget d_shmget
18137         eval $setvar
18138         set shmat d_shmat
18139         eval $setvar
18140         set shmdt d_shmdt
18141         eval $setvar
18142         ;;
18143     esac
18144     ;;
18145 esac
18146 : we could also check for sys/ipc.h ...
18147 if $h_shm && $test `./findhdr sys/shm.h`; then
18148         echo "You have the full shm*(2) library." >&4
18149         val="$define"
18150 else
18151         echo "You don't have the full shm*(2) library." >&4
18152         val="$undef"
18153 fi
18154 set d_shm
18155 eval $setvar
18156
18157 : see if we have sigaction
18158 echo " "
18159 if set sigaction val -f d_sigaction; eval $csym; $val; then
18160         echo 'sigaction() found.' >&4
18161         $cat > try.c <<EOP
18162 #include <stdio.h>
18163 #include <sys/types.h>
18164 #include <signal.h>
18165 #$i_stdlib I_STDLIB
18166 #ifdef I_STDLIB
18167 #include <stdlib.h>
18168 #endif
18169 int main()
18170 {
18171     struct sigaction act, oact;
18172     act.sa_flags = 0;
18173     oact.sa_handler = 0;
18174     /* so that act and oact are used */
18175     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18176 }
18177 EOP
18178         set try
18179         if eval $compile_ok; then
18180                 val="$define"
18181         else
18182                 echo "But you don't seem to have a usable struct sigaction." >&4
18183                 val="$undef"
18184         fi
18185 else
18186         echo 'sigaction NOT found.' >&4
18187         val="$undef"
18188 fi
18189 set d_sigaction; eval $setvar
18190 $rm_try
18191
18192 : see what type pids are declared as in the kernel
18193 rp="What is the type of process ids on this system?"
18194 set pid_t pidtype int stdio.h sys/types.h
18195 eval $typedef_ask
18196
18197 : see what type uids are declared as in the kernel
18198 echo " "
18199 echo "Looking for the type for user ids returned by getuid()."
18200 set uid_t uidtype xxx stdio.h sys/types.h
18201 eval $typedef
18202 case "$uidtype" in
18203 xxx)
18204         xxx=`./findhdr sys/user.h`
18205         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18206         case $1 in
18207         unsigned) dflt="$1 $2" ;;
18208         *) dflt="$1" ;;
18209         esac
18210         ;;
18211 *) dflt="$uidtype";;
18212 esac
18213 case "$uidtype" in
18214 uid_t)  echo "uid_t found." ;;
18215 *)      rp="What is the type for user ids returned by getuid()?"
18216         . ./myread
18217         uidtype="$ans"
18218         ;;
18219 esac
18220
18221 : Define hasfield_t macro for Configure internal use
18222 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18223 while $test $# -ge 2; do
18224     case "$1" in
18225         $define) echo "#include <$2>";;
18226     esac ;
18227     shift 2;
18228 done > try.c;
18229 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18230 set try;
18231 if eval $compile; then
18232         val="$define";
18233 else
18234         val="$undef";
18235 fi;
18236 set $varname;
18237 eval $setvar;
18238 $rm_try'
18239
18240 : see what siginfo fields we have
18241 case "$d_sigaction" in
18242 "$define")
18243         echo "Checking if your siginfo_t has si_errno field...">&4
18244         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18245         eval $hasfield_t;
18246
18247         echo "Checking if your siginfo_t has si_pid field...">&4
18248         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18249         eval $hasfield_t;
18250
18251         echo "Checking if your siginfo_t has si_uid field...">&4
18252         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18253         eval $hasfield_t;
18254
18255         echo "Checking if your siginfo_t has si_addr field...">&4
18256         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18257         eval $hasfield_t;
18258
18259         echo "Checking if your siginfo_t has si_status field...">&4
18260         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18261         eval $hasfield_t;
18262
18263         echo "Checking if your siginfo_t has si_band field...">&4
18264         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18265         eval $hasfield_t;
18266
18267         echo "Checking if your siginfo_t has si_value field...">&4
18268         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18269         eval $hasfield_t;
18270
18271         echo "Checking if your siginfo_t has si_fd field...">&4
18272         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18273         eval $hasfield_t;
18274
18275         ;;
18276 *)
18277         d_siginfo_si_errno="$undef"
18278         d_siginfo_si_pid="$undef"
18279         d_siginfo_si_uid="$undef"
18280         d_siginfo_si_addr="$undef"
18281         d_siginfo_si_status="$undef"
18282         d_siginfo_si_band="$undef"
18283         d_siginfo_si_value="$undef"
18284         d_siginfo_si_fd="$undef"
18285         ;;
18286 esac
18287
18288 : see if this is a sunmath.h system
18289 set sunmath.h i_sunmath
18290 eval $inhdr
18291
18292 : see if signbit exists
18293 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18294 $cat >try.c <<EOCP
18295 #$i_sunmath I_SUNMATH
18296 #include <math.h>
18297 #ifdef I_SUNMATH  /* Solaris special math library */
18298 #  include <sunmath.h>
18299 #endif
18300 #define NV $nvtype
18301 int main(int argc, char **argv)
18302 {
18303     NV x = 0.0;
18304     NV y = -1.0;
18305     if ((signbit(x) == 0) && (signbit(y) != 0))
18306         return 0;
18307     else
18308         return 1;
18309 }
18310 EOCP
18311 val="$undef"
18312 set try
18313 if eval $compile; then
18314     if $run ./try; then
18315         $echo "Yes." >&4
18316         val="$define"
18317     else
18318         $echo "Signbit seems to be available, but doesn't work as I expected."
18319         $echo "I won't use it." >&4
18320         val="$undef"
18321     fi
18322 else
18323     $echo "Nope." >&4
18324     dflt="$undef"
18325 fi
18326 set d_signbit
18327 eval $setvar
18328 $rm_try
18329
18330 : see if sigprocmask exists
18331 set sigprocmask d_sigprocmask
18332 eval $inlibc
18333
18334 : see if sigsetjmp exists
18335 echo " "
18336 case "$d_sigsetjmp" in
18337 '')
18338         $cat >try.c <<EOP
18339 #include <setjmp.h>
18340 #$i_stdlib I_STDLIB
18341 #ifdef I_STDLIB
18342 #include <stdlib.h>
18343 #endif
18344 sigjmp_buf env;
18345 int set = 1;
18346 int main()
18347 {
18348         if (sigsetjmp(env,1))
18349                 exit(set);
18350         set = 0;
18351         siglongjmp(env, 1);
18352         exit(1);
18353 }
18354 EOP
18355         set try
18356         if eval $compile; then
18357                 if $run ./try >/dev/null 2>&1; then
18358                         echo "POSIX sigsetjmp found." >&4
18359                         val="$define"
18360                 else
18361                         $cat >&4 <<EOM
18362 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18363 I'll ignore them.
18364 EOM
18365                         val="$undef"
18366                 fi
18367         else
18368                 echo "sigsetjmp not found." >&4
18369                 val="$undef"
18370         fi
18371         ;;
18372 *) val="$d_sigsetjmp"
18373         case "$d_sigsetjmp" in
18374         $define) echo "POSIX sigsetjmp found." >&4;;
18375         $undef) echo "sigsetjmp not found." >&4;;
18376         esac
18377         ;;
18378 esac
18379 set d_sigsetjmp
18380 eval $setvar
18381 $rm_try
18382
18383 : see if snprintf exists
18384 set snprintf d_snprintf
18385 eval $inlibc
18386
18387 : see if vsnprintf exists
18388 set vsnprintf d_vsnprintf
18389 eval $inlibc
18390
18391 case "$d_snprintf-$d_vsnprintf" in
18392 "$define-$define")
18393     $cat <<EOM
18394 Checking whether your snprintf() and vsnprintf() work okay...
18395 EOM
18396     $cat >try.c <<'EOCP'
18397 /* v?snprintf testing logic courtesy of Russ Allbery.
18398  * According to C99:
18399  * - if the buffer is too short it still must be \0-terminated
18400  * - if the buffer is too short the potentially required length
18401  *   must be returned and not -1
18402  * - if the buffer is NULL the potentially required length
18403  *   must be returned and not -1 or core dump
18404  */
18405 #include <stdio.h>
18406 #include <stdarg.h>
18407
18408 char buf[2];
18409
18410 int test (char *format, ...)
18411 {
18412     va_list args;
18413     int count;
18414
18415     va_start (args, format);
18416     count = vsnprintf (buf, sizeof buf, format, args);
18417     va_end (args);
18418     return count;
18419 }
18420
18421 int main ()
18422 {
18423     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18424              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18425 }
18426 EOCP
18427     set try
18428     if eval $compile; then
18429         `$run ./try`
18430         case "$?" in
18431         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18432         *) cat <<EOM >&4
18433 Your snprintf() and snprintf() don't seem to be working okay.
18434 EOM
18435            d_snprintf="$undef"
18436            d_vsnprintf="$undef"
18437            ;;
18438         esac
18439     else
18440         echo "(I can't seem to compile the test program--assuming they don't)"
18441         d_snprintf="$undef"
18442         d_vsnprintf="$undef"
18443     fi
18444     $rm_try
18445     ;;
18446 esac
18447
18448 : see if sockatmark exists
18449 set sockatmark d_sockatmark
18450 eval $inlibc
18451
18452 : see if prototype for sockatmark is available
18453 echo " "
18454 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18455 eval $hasproto
18456
18457 : see if socks5_init exists
18458 set socks5_init d_socks5_init
18459 eval $inlibc
18460
18461 : see if srand48_r exists
18462 set srand48_r d_srand48_r
18463 eval $inlibc
18464 case "$d_srand48_r" in
18465 "$define")
18466         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18467         case "$d_srand48_r_proto:$usethreads" in
18468         ":define")      d_srand48_r_proto=define
18469                 set d_srand48_r_proto srand48_r $hdrs
18470                 eval $hasproto ;;
18471         *)      ;;
18472         esac
18473         case "$d_srand48_r_proto" in
18474         define)
18475         case "$srand48_r_proto" in
18476         ''|0) try='int srand48_r(long, struct drand48_data*);'
18477         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18478         esac
18479         case "$srand48_r_proto" in
18480         ''|0)   d_srand48_r=undef
18481                 srand48_r_proto=0
18482                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18483         * )     case "$srand48_r_proto" in
18484                 REENTRANT_PROTO*) ;;
18485                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18486                 esac
18487                 echo "Prototype: $try" ;;
18488         esac
18489         ;;
18490         *)      case "$usethreads" in
18491                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18492                 esac
18493                 d_srand48_r=undef
18494                 srand48_r_proto=0
18495                 ;;
18496         esac
18497         ;;
18498 *)      srand48_r_proto=0
18499         ;;
18500 esac
18501
18502 : see if srandom_r exists
18503 set srandom_r d_srandom_r
18504 eval $inlibc
18505 case "$d_srandom_r" in
18506 "$define")
18507         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18508         case "$d_srandom_r_proto:$usethreads" in
18509         ":define")      d_srandom_r_proto=define
18510                 set d_srandom_r_proto srandom_r $hdrs
18511                 eval $hasproto ;;
18512         *)      ;;
18513         esac
18514         case "$d_srandom_r_proto" in
18515         define)
18516         case "$srandom_r_proto" in
18517         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18518         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18519         esac
18520         case "$srandom_r_proto" in
18521         ''|0)   d_srandom_r=undef
18522                 srandom_r_proto=0
18523                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18524         * )     case "$srandom_r_proto" in
18525                 REENTRANT_PROTO*) ;;
18526                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18527                 esac
18528                 echo "Prototype: $try" ;;
18529         esac
18530         ;;
18531         *)      case "$usethreads" in
18532                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18533                 esac
18534                 d_srandom_r=undef
18535                 srandom_r_proto=0
18536                 ;;
18537         esac
18538         ;;
18539 *)      srandom_r_proto=0
18540         ;;
18541 esac
18542
18543 : see if prototype for setresgid is available
18544 echo " "
18545 set d_sresgproto setresgid $i_unistd unistd.h
18546 eval $hasproto
18547
18548 : see if prototype for setresuid is available
18549 echo " "
18550 set d_sresuproto setresuid $i_unistd unistd.h
18551 eval $hasproto
18552
18553 : see if stat exists
18554 set stat d_stat
18555 eval $inlibc
18556
18557 : see if sys/stat.h is available
18558 set sys/stat.h i_sysstat
18559 eval $inhdr
18560
18561 : see if stat knows about block sizes
18562 echo " "
18563 echo "Checking to see if your struct stat has st_blocks field..." >&4
18564 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18565 eval $hasfield
18566
18567 : see if this is a sys/vfs.h system
18568 set sys/vfs.h i_sysvfs
18569 eval $inhdr
18570
18571 : see if this is a sys/statfs.h system
18572 set sys/statfs.h i_sysstatfs
18573 eval $inhdr
18574
18575 : Check for statfs_s
18576 echo " "
18577 echo "Checking to see if your system supports struct statfs..." >&4
18578 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
18579 eval $hasstruct
18580 case "$d_statfs_s" in
18581 "$define")      echo "Yes, it does."   ;;
18582 *)              echo "No, it doesn't." ;;
18583 esac
18584
18585 : see if struct statfs knows about f_flags
18586 case "$d_statfs_s" in
18587 define)
18588         echo " "
18589         echo "Checking to see if your struct statfs has f_flags field..." >&4
18590         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
18591         eval $hasfield
18592         ;;
18593 *)      val="$undef"
18594         set d_statfs_f_flags
18595         eval $setvar
18596         ;;
18597 esac
18598 case "$d_statfs_f_flags" in
18599 "$define")      echo "Yes, it does."   ;;
18600 *)              echo "No, it doesn't." ;;
18601 esac
18602
18603 : see what flavor, if any, of static inline is supported
18604 echo " "
18605 echo "Checking to see if your system supports static inline..."
18606 $cat > try.c <<'EOCP'
18607 #include <stdlib.h>
18608 extern int f_via_a(int x);
18609 extern int f_via_b(int x);
18610 int main(int argc, char **argv)
18611 {
18612     int y;
18613
18614     y = f_via_a(0);
18615 #ifdef USE_B
18616     y = f_via_b(0);
18617 #endif
18618     if (y == 42) {
18619         return EXIT_SUCCESS;
18620     }
18621     else {
18622         return EXIT_FAILURE;
18623     }
18624 }
18625 EOCP
18626 $cat > a.c <<'EOCP'
18627 static INLINE int f(int x) {
18628     int y;
18629     y = x + 42;
18630     return y;
18631 }
18632
18633 int f_via_a(int x)
18634 {
18635     return f(x);
18636 }
18637 EOCP
18638 $cat > b.c <<'EOCP'
18639 extern int f(int x);
18640
18641 int f_via_b(int x)
18642 {
18643     return f(x);
18644 }
18645 EOCP
18646
18647 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18648 case "$perl_static_inline" in
18649 '')     # Check the various possibilities, and break out on success.
18650         # For gcc, prefer __inline__, which will still permit
18651         # cflags.SH to add in -ansi.
18652         case "$gccversion" in
18653                 '') xxx="inline __inline__ __inline _inline";;
18654                 *)  xxx="__inline__ inline __inline _inline";;
18655         esac
18656         for inline in $xxx; do
18657                 set try -DINLINE=$inline a.c
18658                 if eval $compile && $run ./try; then
18659                         # Now make sure there is no external linkage of static
18660                         # functions
18661                         set try -DINLINE=$inline -DUSE_B a.c b.c
18662                         if eval $compile && $run ./try; then
18663                                 $echo "Your compiler supports static $inline, " >&4
18664                                 $echo "but it also creates an external definition," >&4
18665                                 $echo "so I won't use it." >&4
18666                                 val=$undef
18667                         else
18668                                 $echo "Your compiler supports static $inline." >&4
18669                                 val=$define
18670                                 perl_static_inline="static $inline";
18671                                 break;
18672                         fi
18673                 else
18674                         $echo "Your compiler does NOT support static $inline." >&4
18675                         val="$undef"
18676                 fi
18677         done
18678         ;;
18679 *inline*) # Some variant of inline exists.
18680         echo "Keeping your $hint value of $perl_static_inline."
18681         val=$define
18682         ;;
18683 static)  # No inline capabilities
18684         echo "Keeping your $hint value of $perl_static_inline."
18685         val=$undef
18686         ;;
18687 *)  # Unrecognized previous value -- blindly trust the supplied
18688         # value and hope it makes sense.  Use old value for
18689         # d_static_inline, if there is one.
18690         echo "Keeping your $hint value of $perl_static_inline."
18691         case "$d_static_inline" in
18692                 '') val=$define ;;
18693                 *)  val=$d_static_inline ;;
18694         esac
18695         ;;
18696 esac
18697 # Fallback to plain 'static' if nothing worked.
18698 case "$perl_static_inline" in
18699 '')
18700         perl_static_inline="static"
18701         val=$undef
18702         ;;
18703 esac
18704 set d_static_inline
18705 eval $setvar
18706 $rm -f a.[co] b.[co]
18707 $rm_try
18708
18709 : Check stream access
18710 $cat >&4 <<EOM
18711 Checking how to access stdio streams by file descriptor number...
18712 EOM
18713 case "$stdio_stream_array" in
18714 '')     $cat >try.c <<EOCP
18715 #include <stdio.h>
18716 int main() {
18717   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18718     printf("yes\n");
18719 }
18720 EOCP
18721         for s in _iob __iob __sF
18722         do
18723                 set try -DSTDIO_STREAM_ARRAY=$s
18724                 if eval $compile; then
18725                         case "`$run ./try`" in
18726                         yes)    stdio_stream_array=$s; break ;;
18727                         esac
18728                 fi
18729         done
18730         $rm_try
18731 esac
18732 case "$stdio_stream_array" in
18733 '')     $cat >&4 <<EOM
18734 I can't figure out how to access stdio streams by file descriptor number.
18735 EOM
18736         d_stdio_stream_array="$undef"
18737         ;;
18738 *)      $cat >&4 <<EOM
18739 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18740 EOM
18741         d_stdio_stream_array="$define"
18742         ;;
18743 esac
18744
18745 : see if strcoll exists
18746 set strcoll d_strcoll
18747 eval $inlibc
18748
18749 : see if strerror_l exists
18750 set strerror_l d_strerror_l
18751 eval $inlibc
18752
18753 : see if strerror_r exists
18754 set strerror_r d_strerror_r
18755 eval $inlibc
18756 case "$d_strerror_r" in
18757 "$define")
18758         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18759         case "$d_strerror_r_proto:$usethreads" in
18760         ":define")      d_strerror_r_proto=define
18761                 set d_strerror_r_proto strerror_r $hdrs
18762                 eval $hasproto ;;
18763         *)      ;;
18764         esac
18765         case "$d_strerror_r_proto" in
18766         define)
18767         case "$strerror_r_proto" in
18768         ''|0) try='int strerror_r(int, char*, size_t);'
18769         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18770         esac
18771         case "$strerror_r_proto" in
18772         ''|0) try='int strerror_r(int, char*, int);'
18773         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18774         esac
18775         case "$strerror_r_proto" in
18776         ''|0) try='char* strerror_r(int, char*, size_t);'
18777         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18778         esac
18779         case "$strerror_r_proto" in
18780         ''|0)   d_strerror_r=undef
18781                 strerror_r_proto=0
18782                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18783         * )     case "$strerror_r_proto" in
18784                 REENTRANT_PROTO*) ;;
18785                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18786                 esac
18787                 echo "Prototype: $try" ;;
18788         esac
18789         ;;
18790         *)      case "$usethreads" in
18791                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18792                 esac
18793                 d_strerror_r=undef
18794                 strerror_r_proto=0
18795                 ;;
18796         esac
18797         ;;
18798 *)      strerror_r_proto=0
18799         ;;
18800 esac
18801
18802 : see if strftime exists
18803 set strftime d_strftime
18804 eval $inlibc
18805
18806 : see if strlcat exists
18807 : We need both a prototype in string.h and the symbol in libc.
18808 echo " "
18809 d_strlcat_proto=''
18810 xx1="#$d_gnulibc HAS_GNULIBC"
18811 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
18812 xx3='#   define _GNU_SOURCE'
18813 xx4='#endif'
18814 set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
18815 eval $hasproto
18816 case "$d_strlcat_proto" in
18817     define) # see if strlcat exists
18818         set strlcat d_strlcat
18819         eval $inlibc
18820         ;;
18821     *)  val=$undef
18822         set d_strlcat
18823         eval $setvar
18824         ;;
18825 esac
18826
18827 : see if strlcpy exists
18828 : We need both a prototype in string.h and the symbol in libc.
18829 echo " "
18830 d_strlcpy_proto=''
18831 xx1="#$d_gnulibc HAS_GNULIBC"
18832 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
18833 xx3='#   define _GNU_SOURCE'
18834 xx4='#endif'
18835 set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
18836 eval $hasproto
18837 case "$d_strlcpy_proto" in
18838     define) # see if strlcpy exists
18839         set strlcpy d_strlcpy
18840         eval $inlibc
18841         ;;
18842     *)  val=$undef
18843         set d_strlcpy
18844         eval $setvar
18845         ;;
18846 esac
18847
18848 : see if strnlen exists
18849 set strnlen d_strnlen
18850 eval $inlibc
18851
18852 : see if strtod exists
18853 set strtod d_strtod
18854 eval $inlibc
18855
18856 : see if strtod_l exists
18857 set strtod_l d_strtod_l
18858 eval $inlibc
18859
18860 : see if strtol exists
18861 set strtol d_strtol
18862 eval $inlibc
18863
18864 : see if strtold exists
18865 set strtold d_strtold
18866 eval $inlibc
18867
18868 : see if strtold_l exists
18869 set strtold_l d_strtold_l
18870 eval $inlibc
18871
18872 : see if strtoll exists
18873 set strtoll d_strtoll
18874 eval $inlibc
18875
18876 case "$d_longlong-$d_strtoll" in
18877 "$define-$define")
18878         $cat <<EOM
18879 Checking whether your strtoll() works okay...
18880 EOM
18881         $cat >try.c <<'EOCP'
18882 #include <errno.h>
18883 #ifdef __hpux
18884 #define strtoll __strtoll
18885 #endif
18886 #ifdef __EMX__
18887 #define strtoll _strtoll
18888 #endif
18889 #include <stdio.h>
18890 extern long long int strtoll(char *s, char **, int);
18891 static int bad = 0;
18892 int check(char *s, long long ell, int een) {
18893         long long gll;
18894         errno = 0;
18895         gll = strtoll(s, 0, 10);
18896         if (!((gll == ell) && (errno == een)))
18897                 bad++;
18898 }
18899 int main() {
18900         check(" 1",                                      1LL, 0);
18901         check(" 0",                                      0LL, 0);
18902         check("-1",                                     -1LL, 0);
18903         check("-9223372036854775808", -9223372036854775808LL, 0);
18904         check("-9223372036854775808", -9223372036854775808LL, 0);
18905         check(" 9223372036854775807",  9223372036854775807LL, 0);
18906         check("-9223372036854775808", -9223372036854775808LL, 0);
18907         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18908         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18909         if (!bad)
18910                 printf("ok\n");
18911 }
18912 EOCP
18913         set try
18914         if eval $compile; then
18915                 yyy=`$run ./try`
18916                 case "$yyy" in
18917                 ok) echo "Your strtoll() seems to be working okay." ;;
18918                 *) cat <<EOM >&4
18919 Your strtoll() doesn't seem to be working okay.
18920 EOM
18921                    d_strtoll="$undef"
18922                    ;;
18923                 esac
18924         else
18925                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18926                 d_strtoll="$undef"
18927         fi
18928         ;;
18929 esac
18930
18931 : see if strtoq exists
18932 set strtoq d_strtoq
18933 eval $inlibc
18934
18935 : see if strtoul exists
18936 set strtoul d_strtoul
18937 eval $inlibc
18938
18939 case "$d_strtoul" in
18940 "$define")
18941         $cat <<EOM
18942 Checking whether your strtoul() works okay...
18943 EOM
18944         $cat >try.c <<'EOCP'
18945 #include <errno.h>
18946 #include <stdio.h>
18947 extern unsigned long int strtoul(char *s, char **, int);
18948 static int bad = 0;
18949 void check(char *s, unsigned long eul, int een) {
18950         unsigned long gul;
18951         errno = 0;
18952         gul = strtoul(s, 0, 10);
18953         if (!((gul == eul) && (errno == een)))
18954                 bad++;
18955 }
18956 int main() {
18957         check(" 1", 1L, 0);
18958         check(" 0", 0L, 0);
18959 EOCP
18960         case "$longsize" in
18961         8)
18962             $cat >>try.c <<'EOCP'
18963         check("18446744073709551615", 18446744073709551615UL, 0);
18964         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18965 #if 0 /* strtoul() for /^-/ strings is undefined. */
18966         check("-1", 18446744073709551615UL, 0);
18967         check("-18446744073709551614", 2, 0);
18968         check("-18446744073709551615", 1, 0);
18969         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18970         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18971 #endif
18972 EOCP
18973                 ;;
18974         4)
18975                     $cat >>try.c <<'EOCP'
18976         check("4294967295", 4294967295UL, 0);
18977         check("4294967296", 4294967295UL, ERANGE);
18978 #if 0 /* strtoul() for /^-/ strings is undefined. */
18979         check("-1", 4294967295UL, 0);
18980         check("-4294967294", 2, 0);
18981         check("-4294967295", 1, 0);
18982         check("-4294967296", 4294967295UL, ERANGE);
18983         check("-4294967297", 4294967295UL, ERANGE);
18984 #endif
18985 EOCP
18986                 ;;
18987         *)
18988 : Should we write these tests to be more portable by sprintf-ing
18989 : ~0 and then manipulating that char string as input for strtol?
18990                 ;;
18991         esac
18992         $cat >>try.c <<'EOCP'
18993         if (!bad)
18994                 printf("ok\n");
18995         return 0;
18996 }
18997 EOCP
18998         set try
18999         if eval $compile; then
19000                 case "`$run ./try`" in
19001                 ok) echo "Your strtoul() seems to be working okay." ;;
19002                 *) cat <<EOM >&4
19003 Your strtoul() doesn't seem to be working okay.
19004 EOM
19005                    d_strtoul="$undef"
19006                    ;;
19007                 esac
19008         else
19009                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19010                 d_strtoul="$undef"
19011         fi
19012         ;;
19013 esac
19014
19015 : see if strtoull exists
19016 set strtoull d_strtoull
19017 eval $inlibc
19018
19019 case "$d_longlong-$d_strtoull" in
19020 "$define-$define")
19021         $cat <<EOM
19022 Checking whether your strtoull() works okay...
19023 EOM
19024         $cat >try.c <<'EOCP'
19025 #include <errno.h>
19026 #ifdef __hpux
19027 #define strtoull __strtoull
19028 #endif
19029 #include <stdio.h>
19030 extern unsigned long long int strtoull(char *s, char **, int);
19031 static int bad = 0;
19032 int check(char *s, long long eull, int een) {
19033         long long gull;
19034         errno = 0;
19035         gull = strtoull(s, 0, 10);
19036         if (!((gull == eull) && (errno == een)))
19037                 bad++;
19038 }
19039 int main() {
19040         check(" 1",                                        1LL, 0);
19041         check(" 0",                                        0LL, 0);
19042         check("18446744073709551615",  18446744073709551615ULL, 0);
19043         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19044 #if 0 /* strtoull() for /^-/ strings is undefined. */
19045         check("-1",                    18446744073709551615ULL, 0);
19046         check("-18446744073709551614",                     2LL, 0);
19047         check("-18446744073709551615",                     1LL, 0);
19048         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19049         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19050 #endif
19051         if (!bad)
19052                 printf("ok\n");
19053 }
19054 EOCP
19055         set try
19056         if eval $compile; then
19057                 case "`$run ./try`" in
19058                 ok) echo "Your strtoull() seems to be working okay." ;;
19059                 *) cat <<EOM >&4
19060 Your strtoull() doesn't seem to be working okay.
19061 EOM
19062                    d_strtoull="$undef"
19063                    ;;
19064                 esac
19065         else
19066                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19067                 d_strtoull="$undef"
19068         fi
19069         ;;
19070 esac
19071
19072 : see if strtouq exists
19073 set strtouq d_strtouq
19074 eval $inlibc
19075
19076 case "$d_strtouq" in
19077 "$define")
19078         $cat <<EOM
19079 Checking whether your strtouq() works okay...
19080 EOM
19081         $cat >try.c <<'EOCP'
19082 #include <errno.h>
19083 #include <stdio.h>
19084 extern unsigned long long int strtouq(char *s, char **, int);
19085 static int bad = 0;
19086 void check(char *s, unsigned long long eull, int een) {
19087         unsigned long long gull;
19088         errno = 0;
19089         gull = strtouq(s, 0, 10);
19090         if (!((gull == eull) && (errno == een)))
19091                 bad++;
19092 }
19093 int main() {
19094         check(" 1",                                        1LL, 0);
19095         check(" 0",                                        0LL, 0);
19096         check("18446744073709551615",  18446744073709551615ULL, 0);
19097         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19098 #if 0 /* strtouq() for /^-/ strings is undefined. */
19099         check("-1",                    18446744073709551615ULL, 0);
19100         check("-18446744073709551614",                     2LL, 0);
19101         check("-18446744073709551615",                     1LL, 0);
19102         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19103         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19104 #endif
19105         if (!bad)
19106                 printf("ok\n");
19107         return 0;
19108 }
19109 EOCP
19110         set try
19111         if eval $compile; then
19112                 case "`$run ./try`" in
19113                 ok) echo "Your strtouq() seems to be working okay." ;;
19114                 *) cat <<EOM >&4
19115 Your strtouq() doesn't seem to be working okay.
19116 EOM
19117                    d_strtouq="$undef"
19118                    ;;
19119                 esac
19120         else
19121                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19122                 d_strtouq="$undef"
19123         fi
19124         ;;
19125 esac
19126
19127 : see if strxfrm exists
19128 set strxfrm d_strxfrm
19129 eval $inlibc
19130
19131 : see if symlink exists
19132 set symlink d_symlink
19133 eval $inlibc
19134
19135 : see if syscall exists
19136 set syscall d_syscall
19137 eval $inlibc
19138
19139 : see if prototype for syscall is available
19140 echo " "
19141 set d_syscallproto syscall $i_unistd unistd.h
19142 eval $hasproto
19143
19144 : see if sysconf exists
19145 set sysconf d_sysconf
19146 eval $inlibc
19147
19148 : see if sys_errlist[] exists
19149 echo " "
19150 if test "X$d_syserrlst" = X; then
19151         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19152                 echo "You have sys_errlist[], so we could roll our own strerror."
19153                 d_syserrlst="$define"
19154         else
19155                 echo "You don't have sys_errlist[], so strerror() is welcome."
19156                 d_syserrlst="$undef"
19157         fi
19158 fi
19159
19160 : see if system exists
19161 set system d_system
19162 eval $inlibc
19163
19164 : see if tcgetpgrp exists
19165 set tcgetpgrp d_tcgetpgrp
19166 eval $inlibc
19167
19168 : see if tcsetpgrp exists
19169 set tcsetpgrp d_tcsetpgrp
19170 eval $inlibc
19171
19172 : see if prototype for telldir is available
19173 echo " "
19174 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19175 eval $hasproto
19176
19177 : see if tgamma exists
19178 set tgamma d_tgamma
19179 eval $inlibc
19180
19181 : check for thread_safe_nl_langinfo_l item
19182 $cat <<EOM
19183
19184 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19185 EOM
19186 $cat >try.c <<EOCP
19187 #$i_stdlib I_STDLIB
19188 #ifdef I_STDLIB
19189 #  include <stdlib.h>
19190 #endif
19191 #include <string.h>
19192 #$i_langinfo I_LANGINFO
19193 #ifdef I_LANGINFO
19194 #  include <langinfo.h>
19195 #endif
19196 #$i_pthread I_PTHREAD
19197 #ifdef I_PTHREAD
19198 #  include <pthread.h>
19199 #endif
19200 #$i_locale I_LOCALE
19201 #ifdef I_LOCALE
19202 #  include <locale.h>
19203 #endif
19204
19205 void *
19206 thread_start(void * arg)
19207 {
19208     nl_langinfo(RADIXCHAR);
19209 }
19210
19211 int main() {
19212     char * main_buffer;
19213     char save_main_buffer[1000];
19214     pthread_t subthread;
19215     pthread_attr_t attr;
19216
19217     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19218
19219     /* If too large for our generous allowance, just assume we don't have
19220      * it. */
19221     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19222         exit(1);
19223     }
19224
19225     strcpy(save_main_buffer, main_buffer);
19226
19227     if (pthread_attr_init(&attr) != 0) {
19228         exit(1);
19229     }
19230
19231     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19232         exit(1);
19233     }
19234
19235     if (pthread_join(subthread, NULL) != 0) {
19236         exit(1);
19237     }
19238
19239     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19240 }
19241 EOCP
19242 case "$usethreads" in
19243     define)
19244         set try
19245         if eval $compile; then
19246             echo "Your system has nl_langinfo_l()..." >&4
19247             if $run ./try; then
19248                 echo "and it is thread-safe (just as I'd hoped)." >&4
19249                 d_thread_safe_nl_langinfo_l="$define"
19250                 echo "$d_thread_safe_nl_langinfo_l" >&4
19251             else
19252                 echo "but it isn't thread-safe, so we won't use it." >&4
19253             fi
19254         else
19255             echo "your system does not have nl_langinfo_l()" >&4
19256         fi
19257         ;;
19258     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19259 esac
19260 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19261         d_thread_safe_nl_langinfo_l="$undef"
19262 fi
19263 $rm_try
19264
19265 : see if time exists
19266 echo " "
19267 if test "X$d_time" = X -o X"$timetype" = X; then
19268     if set time val -f d_time; eval $csym; $val; then
19269                 echo 'time() found.' >&4
19270                 val="$define"
19271                 rp="What is the type returned by time() on this system?"
19272                 set time_t timetype long stdio.h sys/types.h
19273                 eval $typedef_ask
19274     else
19275                 echo 'time() not found, hope that will do.' >&4
19276                 val="$undef"
19277                 timetype='int';
19278     fi
19279     set d_time
19280     eval $setvar
19281 fi
19282
19283 : see if timegm exists
19284 set timegm d_timegm
19285 eval $inlibc
19286
19287 : see if this is a sys/times.h system
19288 set sys/times.h i_systimes
19289 eval $inhdr
19290
19291 : see if times exists
19292 echo " "
19293 if set times val -f d_times; eval $csym; $val; then
19294         echo 'times() found.' >&4
19295         d_times="$define"
19296         inc=''
19297         case "$i_systimes" in
19298         "$define") inc='sys/times.h';;
19299         esac
19300         rp="What is the type returned by times() on this system?"
19301         set clock_t clocktype long stdio.h sys/types.h $inc
19302         eval $typedef_ask
19303 else
19304         echo 'times() NOT found, hope that will do.' >&4
19305         d_times="$undef"
19306         clocktype='int'
19307 fi
19308
19309 : see if tmpnam_r exists
19310 set tmpnam_r d_tmpnam_r
19311 eval $inlibc
19312 case "$d_tmpnam_r" in
19313 "$define")
19314         hdrs="$i_systypes sys/types.h define stdio.h "
19315         case "$d_tmpnam_r_proto:$usethreads" in
19316         ":define")      d_tmpnam_r_proto=define
19317                 set d_tmpnam_r_proto tmpnam_r $hdrs
19318                 eval $hasproto ;;
19319         *)      ;;
19320         esac
19321         case "$d_tmpnam_r_proto" in
19322         define)
19323         case "$tmpnam_r_proto" in
19324         ''|0) try='char* tmpnam_r(char*);'
19325         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19326         esac
19327         case "$tmpnam_r_proto" in
19328         ''|0)   d_tmpnam_r=undef
19329                 tmpnam_r_proto=0
19330                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19331         * )     case "$tmpnam_r_proto" in
19332                 REENTRANT_PROTO*) ;;
19333                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19334                 esac
19335                 echo "Prototype: $try" ;;
19336         esac
19337         ;;
19338         *)      case "$usethreads" in
19339                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19340                 esac
19341                 d_tmpnam_r=undef
19342                 tmpnam_r_proto=0
19343                 ;;
19344         esac
19345         ;;
19346 *)      tmpnam_r_proto=0
19347         ;;
19348 esac
19349
19350 : see if trunc exists
19351 set trunc d_trunc
19352 eval $inlibc
19353
19354 : see if truncate exists
19355 set truncate d_truncate
19356 eval $inlibc
19357
19358 : see if ttyname_r exists
19359 set ttyname_r d_ttyname_r
19360 eval $inlibc
19361 case "$d_ttyname_r" in
19362 "$define")
19363         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19364         case "$d_ttyname_r_proto:$usethreads" in
19365         ":define")      d_ttyname_r_proto=define
19366                 set d_ttyname_r_proto ttyname_r $hdrs
19367                 eval $hasproto ;;
19368         *)      ;;
19369         esac
19370         case "$d_ttyname_r_proto" in
19371         define)
19372         case "$ttyname_r_proto" in
19373         ''|0) try='int ttyname_r(int, char*, size_t);'
19374         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19375         esac
19376         case "$ttyname_r_proto" in
19377         ''|0) try='int ttyname_r(int, char*, int);'
19378         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19379         esac
19380         case "$ttyname_r_proto" in
19381         ''|0) try='char* ttyname_r(int, char*, int);'
19382         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19383         esac
19384         case "$ttyname_r_proto" in
19385         ''|0)   d_ttyname_r=undef
19386                 ttyname_r_proto=0
19387                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19388         * )     case "$ttyname_r_proto" in
19389                 REENTRANT_PROTO*) ;;
19390                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19391                 esac
19392                 echo "Prototype: $try" ;;
19393         esac
19394         ;;
19395         *)      case "$usethreads" in
19396                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19397                 esac
19398                 d_ttyname_r=undef
19399                 ttyname_r_proto=0
19400                 ;;
19401         esac
19402         ;;
19403 *)      ttyname_r_proto=0
19404         ;;
19405 esac
19406
19407 : see if tzname[] exists
19408 echo " "
19409 if set tzname val -a d_tzname; eval $csym; $val; then
19410         val="$define"
19411         echo 'tzname[] found.' >&4
19412 else
19413         val="$undef"
19414         echo 'tzname[] NOT found.' >&4
19415 fi
19416 set d_tzname
19417 eval $setvar
19418
19419 : Check if is a multiplatform env
19420 case "$osname" in
19421 darwin) multiarch="$define" ;;
19422 esac
19423 case "$multiarch" in
19424 ''|[nN]*) multiarch="$undef" ;;
19425 esac
19426
19427 : check for ordering of bytes in a UV
19428 echo " "
19429 case "$multiarch" in
19430 *$define*)
19431         $cat <<EOM
19432 You seem to be doing a multiarchitecture build,
19433 skipping the byteorder check.
19434
19435 EOM
19436         byteorder='ffff'
19437         ;;
19438 *)
19439         case "$byteorder" in
19440         '')
19441                 $cat <<'EOM'
19442 In the following, larger digits indicate more significance.  A big-endian
19443 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19444 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19445 machines may have weird orders like 3412.  A Cray will report 87654321,
19446 an Alpha will report 12345678. If the test program works the default is
19447 probably right.
19448 I'm now running the test program...
19449 EOM
19450                 $cat >try.c <<EOCP
19451 #include <stdio.h>
19452 #$i_stdlib I_STDLIB
19453 #ifdef I_STDLIB
19454 #include <stdlib.h>
19455 #endif
19456 #include <sys/types.h>
19457 typedef $uvtype UV;
19458 int main()
19459 {
19460         int i;
19461         union {
19462                 UV l;
19463                 char c[$uvsize];
19464         } u;
19465
19466         if ($uvsize > 4)
19467                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19468         else
19469                 u.l = (UV)0x04030201;
19470         for (i = 0; i < $uvsize; i++)
19471                 printf("%c", u.c[i]+'0');
19472         printf("\n");
19473         exit(0);
19474 }
19475 EOCP
19476                 xxx_prompt=y
19477                 set try
19478                 if eval $compile && $run ./try > /dev/null; then
19479                         dflt=`$run ./try`
19480                         case "$dflt" in
19481                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19482                                 echo "(The test program ran ok.)"
19483                                 echo "byteorder=$dflt"
19484                                 xxx_prompt=n
19485                         ;;
19486                         ????|????????) echo "(The test program ran ok.)" ;;
19487                         *) echo "(The test program didn't run right for some reason.)" ;;
19488                         esac
19489                 else
19490                         dflt='4321'
19491                         cat <<'EOM'
19492 (I can't seem to compile the test program.  Guessing big-endian...)
19493 EOM
19494                 fi
19495                 case "$xxx_prompt" in
19496                 y)
19497                         rp="What is the order of bytes in $uvtype?"
19498                         . ./myread
19499                         byteorder="$ans"
19500                         ;;
19501                 *)      byteorder=$dflt
19502                         ;;
19503                 esac
19504                 ;;
19505         esac
19506         $rm_try
19507         ;;
19508 esac
19509
19510 : Checking 32bit alignedness
19511 $cat <<EOM
19512
19513 Checking to see whether you can access character data unalignedly...
19514 EOM
19515 case "$d_u32align" in
19516 '')   $cat >try.c <<EOCP
19517 #include <stdio.h>
19518 #$i_stdlib I_STDLIB
19519 #ifdef I_STDLIB
19520 #include <stdlib.h>
19521 #endif
19522 #define U32 $u32type
19523 #define BYTEORDER 0x$byteorder
19524 #define U8 $u8type
19525 #include <signal.h>
19526 #ifdef SIGBUS
19527 $signal_t bletch(int s) { exit(4); }
19528 #endif
19529 int main() {
19530 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19531     volatile U8 buf[8];
19532     volatile U32 *up;
19533     int i;
19534
19535     if (sizeof(U32) != 4) {
19536         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19537         exit(1);
19538     }
19539
19540     fflush(stdout);
19541
19542 #ifdef SIGBUS
19543     signal(SIGBUS, bletch);
19544 #endif
19545
19546     buf[0] = 0;
19547     buf[1] = 0;
19548     buf[2] = 0;
19549     buf[3] = 1;
19550     buf[4] = 0;
19551     buf[5] = 0;
19552     buf[6] = 0;
19553     buf[7] = 1;
19554
19555     for (i = 0; i < 4; i++) {
19556         up = (U32*)(buf + i);
19557         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19558                (*up == 1 << (8*(3-i)))  /* little-endian */
19559               )
19560            )
19561         {
19562             printf("read failed (%x)\n", *up);
19563             exit(2);
19564         }
19565     }
19566
19567     /* write test */
19568     for (i = 0; i < 4; i++) {
19569         up = (U32*)(buf + i);
19570         *up = 0xBeef;
19571         if (*up != 0xBeef) {
19572             printf("write failed (%x)\n", *up);
19573             exit(3);
19574         }
19575     }
19576
19577     exit(0);
19578 #else
19579     printf("1\n");
19580     exit(1);
19581 #endif
19582     return 0;
19583 }
19584 EOCP
19585 set try
19586 if eval $compile_ok; then
19587         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19588         $run ./try 2>&1 >/dev/null
19589         case "$?" in
19590         0)      cat >&4 <<EOM
19591 You can access character data pretty unalignedly.
19592 EOM
19593                 d_u32align="$undef"
19594                 ;;
19595         *)      cat >&4 <<EOM
19596 It seems that you must access character data in an aligned manner.
19597 EOM
19598                 d_u32align="$define"
19599                 ;;
19600         esac
19601 else
19602         rp='Can you access character data at unaligned addresses?'
19603         dflt='n'
19604         . ./myread
19605         case "$ans" in
19606         [yY]*)  d_u32align="$undef"  ;;
19607         *)      d_u32align="$define" ;;
19608         esac
19609 fi
19610 $rm_try
19611 ;;
19612 esac
19613
19614 : see if ualarm exists
19615 set ualarm d_ualarm
19616 eval $inlibc
19617
19618 : see if umask exists
19619 set umask d_umask
19620 eval $inlibc
19621
19622 : see if unordered exists
19623 set unordered d_unordered
19624 eval $inlibc
19625
19626 : see if unsetenv exists
19627 set unsetenv d_unsetenv
19628 eval $inlibc
19629
19630 : see if usleep exists
19631 set usleep d_usleep
19632 eval $inlibc
19633
19634 : see if prototype for usleep is available
19635 echo " "
19636 set d_usleepproto usleep $i_unistd unistd.h
19637 eval $hasproto
19638
19639 : see if ustat exists
19640 set ustat d_ustat
19641 eval $inlibc
19642
19643 : see if closedir exists
19644 set closedir d_closedir
19645 eval $inlibc
19646
19647 case "$d_closedir" in
19648 "$define")
19649         echo " "
19650         echo "Checking whether closedir() returns a status..." >&4
19651         cat > try.c <<EOM
19652 #$i_dirent I_DIRENT             /**/
19653 #$i_sysdir I_SYS_DIR            /**/
19654 #$i_sysndir I_SYS_NDIR          /**/
19655 #$i_systypes I_SYS_TYPES        /**/
19656
19657 #if defined(I_SYS_TYPES)
19658 #include <sys/types.h>
19659 #endif
19660 #if defined(I_DIRENT)
19661 #include <dirent.h>
19662 #else
19663 #ifdef I_SYS_NDIR
19664 #include <sys/ndir.h>
19665 #else
19666 #ifdef I_SYS_DIR
19667 #include <sys/dir.h>
19668 #endif
19669 #endif
19670 #endif
19671 int main() { return closedir(opendir(".")); }
19672 EOM
19673         set try
19674         if eval $compile_ok; then
19675                 if $run ./try > /dev/null 2>&1 ; then
19676                         echo "Yes, it does."
19677                         val="$undef"
19678                 else
19679                         echo "No, it doesn't."
19680                         val="$define"
19681                 fi
19682         else
19683                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19684                 val="$define"
19685         fi
19686         ;;
19687 *)
19688         val="$undef";
19689         ;;
19690 esac
19691 set d_void_closedir
19692 eval $setvar
19693 $rm_try
19694
19695 : see if there is a wait4
19696 set wait4 d_wait4
19697 eval $inlibc
19698
19699 : see if waitpid exists
19700 set waitpid d_waitpid
19701 eval $inlibc
19702
19703 : look for wcscmp
19704 echo " "
19705 $cat >try.c <<'EOCP'
19706 #include <stdio.h>
19707 #include <wchar.h>
19708 int main ()
19709 {
19710     wchar_t *s = L" ";
19711     return (wcscmp (s, s) ? 1 : 0);
19712     }
19713 EOCP
19714 set try
19715 val="$undef"
19716 if eval $compile; then
19717     `$run ./try`
19718     case "$?" in
19719         0)  echo "A working wcscmp() found." >&4
19720             val="$define" ;;
19721         *)  echo "wcscmp() found, but it doesn't work" >&4
19722             ;;
19723         esac
19724 else
19725     echo "wcscmp() NOT found." >&4
19726     fi
19727 set d_wcscmp
19728 eval $setvar
19729 $rm_try
19730
19731 : see if wcstombs exists
19732 set wcstombs d_wcstombs
19733 eval $inlibc
19734
19735 : look for wcsxfrm
19736 echo " "
19737 $cat >try.c <<'EOCP'
19738 #include <errno.h>
19739 #include <wchar.h>
19740 int main ()
19741 {
19742     wchar_t dst[4], *src = L" ";
19743     errno = 0;
19744     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19745     }
19746 EOCP
19747 set try
19748 val="$undef"
19749 if eval $compile; then
19750     `$run ./try`
19751     case "$?" in
19752         0)  echo "A working wcsxfrm() found." >&4
19753             val="$define" ;;
19754         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19755             ;;
19756         esac
19757 else
19758     echo "wcsxfrm() NOT found." >&4
19759     fi
19760 set d_wcsxfrm
19761 eval $setvar
19762 $rm_try
19763
19764 : see if wctomb exists
19765 set wctomb d_wctomb
19766 eval $inlibc
19767
19768 : see if writev exists
19769 set writev d_writev
19770 eval $inlibc
19771
19772 : check for alignment requirements
19773 echo " "
19774 case "$alignbytes" in
19775     '') echo "Checking alignment constraints..." >&4
19776         $cat >try.c <<EOCP
19777 #include <stdio.h>
19778 struct foobar {
19779     char foo;
19780     $nvtype bar;
19781 } try_algn;
19782 int main()
19783 {
19784     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19785     return(0);
19786 }
19787 EOCP
19788         set try
19789         if eval $compile_ok; then
19790             dflt=`$run ./try`
19791         else
19792             dflt='8'
19793             echo "(I can't seem to compile the test program...)"
19794         fi
19795         case "$multiarch" in
19796             *$define*)
19797                 : The usual safe value is 8, but Darwin with -Duselongdouble
19798                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19799                 : Configure to pick a larger value if needed.
19800                 if $test "$dflt" -lt 8; then
19801                     dflt='8'
19802                     echo "Setting alignment to 8 for multiarch support.">&4
19803                 fi
19804                 ;;
19805         esac
19806         ;;
19807     *) dflt="$alignbytes"
19808         ;;
19809 esac
19810 rp="Doubles must be aligned on a how-many-byte boundary?"
19811 . ./myread
19812 alignbytes="$ans"
19813 $rm_try
19814
19815 : set the base revision
19816 baserev=5.0
19817
19818 : length of character in bytes. Is always 1, otherwise it is not C
19819 : This used to be a test using sizeof
19820 charsize=1
19821
19822 : Check for the number of bits in a character
19823 case "$charbits" in
19824 '')     echo "Checking how long a character is (in bits)..." >&4
19825         $cat >try.c <<EOCP
19826 #include <stdio.h>
19827 int main ()
19828 {
19829     int n;
19830     unsigned char c;
19831     for (c = 1, n = 0; c; c <<= 1, n++) ;
19832     printf ("%d\n", n);
19833     return (0);
19834     }
19835 EOCP
19836         set try
19837         if eval $compile_ok; then
19838                 dflt=`$run ./try`
19839         else
19840                 dflt='8'
19841                 echo "(I can't seem to compile the test program.  Guessing...)"
19842         fi
19843         ;;
19844 *)
19845         dflt="$charbits"
19846         ;;
19847 esac
19848 rp="What is the length of a character (in bits)?"
19849 . ./myread
19850 charbits="$ans"
19851 $rm_try
19852 case "$charbits" in
19853 8)      ;;
19854 *)      cat >&4 << EOM
19855 Your system has an unsigned character size of $charbits bits, which
19856 is rather unusual (normally it is 8 bits).  Perl likely will not work
19857 correctly on your system, with subtle bugs in various places.
19858 EOM
19859         rp='Do you really want to continue?'
19860         dflt='n'
19861         . ./myread
19862         case "$ans" in
19863                 [yY])   echo >&4 "Okay, continuing."    ;;
19864                 *)      exit 1                          ;;
19865         esac
19866 esac
19867
19868 : how do we concatenate cpp tokens here?
19869 echo " "
19870 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19871 $cat >cpp_stuff.c <<'EOCP'
19872 #define RCAT(a,b)a/**/b
19873 #define ACAT(a,b)a ## b
19874 RCAT(Rei,ser)
19875 ACAT(Cir,cus)
19876 EOCP
19877 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19878 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19879         echo "Oh!  Smells like ANSI's been here." >&4
19880         echo "We can catify or stringify, separately or together!"
19881         cpp_stuff=42
19882 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19883         echo "Ah, yes!  The good old days!" >&4
19884         echo "However, in the good old days we don't know how to stringify and"
19885         echo "catify at the same time."
19886         cpp_stuff=1
19887 else
19888         $cat >&4 <<EOM
19889 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19890 You're going to have to edit the values of CAT[2-5] in config.h...
19891 EOM
19892         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19893 fi
19894 $rm -f cpp_stuff.*
19895
19896 : see if this is a db.h system
19897 set db.h i_db
19898 eval $inhdr
19899
19900 case "$i_db" in
19901 $define)
19902         : Check db version.
19903         echo " "
19904         echo "Checking Berkeley DB version ..." >&4
19905         $cat >try.c <<EOCP
19906 #include <sys/types.h>
19907 #include <stdio.h>
19908 #$i_stdlib I_STDLIB
19909 #ifdef I_STDLIB
19910 #include <stdlib.h>
19911 #endif
19912 #include <db.h>
19913 int main(int argc, char *argv[])
19914 {
19915 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19916     int Major, Minor, Patch ;
19917     unsigned long Version ;
19918     (void)db_version(&Major, &Minor, &Patch) ;
19919     if (argc == 2) {
19920         printf("%d %d %d %d %d %d\n",
19921                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19922                Major, Minor, Patch);
19923         exit(0);
19924     }
19925     printf("You have Berkeley DB Version 2 or greater.\n");
19926
19927     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19928                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19929     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19930                 Major, Minor, Patch) ;
19931
19932     /* check that db.h & libdb are compatible */
19933     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19934         printf("db.h and libdb are incompatible.\n") ;
19935         exit(3);
19936     }
19937
19938     printf("db.h and libdb are compatible.\n") ;
19939
19940     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19941                 + DB_VERSION_PATCH ;
19942
19943     /* needs to be >= 2.3.4 */
19944     if (Version < 2003004) {
19945     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19946         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19947         exit(2);
19948     }
19949
19950     exit(0);
19951 #else
19952 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19953     if (argc == 2) {
19954         printf("1 0 0\n");
19955         exit(0);
19956     }
19957     printf("You have Berkeley DB Version 1.\n");
19958     exit(0);    /* DB version < 2: the coast is clear. */
19959 #else
19960     exit(1);    /* <db.h> not Berkeley DB? */
19961 #endif
19962 #endif
19963 }
19964 EOCP
19965         set try
19966         if eval $compile_ok && $run ./try; then
19967                 echo 'Looks OK.' >&4
19968                 set `$run ./try 1`
19969                 db_version_major=$1
19970                 db_version_minor=$2
19971                 db_version_patch=$3
19972         else
19973                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19974                 i_db=$undef
19975                 case " $libs " in
19976                 *"-ldb "*)
19977                         : Remove db from list of libraries to use
19978                         echo "Removing unusable -ldb from library list" >&4
19979                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19980                         shift
19981                         libs="$*"
19982                         echo "libs = $libs" >&4
19983                         ;;
19984                 esac
19985         fi
19986         $rm_try
19987         ;;
19988 esac
19989
19990 case "$i_db" in
19991 define)
19992         : Check the return type needed for hash
19993         echo " "
19994         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19995         $cat >try.c <<EOCP
19996 #include <sys/types.h>
19997 #include <db.h>
19998
19999 #ifndef DB_VERSION_MAJOR
20000 u_int32_t hash_cb (const void* ptr, size_t size)
20001 {
20002         return 0;
20003 }
20004 HASHINFO info;
20005 int main()
20006 {
20007         info.hash = hash_cb;
20008 }
20009 #endif
20010 EOCP
20011         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20012                 if $contains warning try.out >>/dev/null 2>&1 ; then
20013                         db_hashtype='int'
20014                 else
20015                         db_hashtype='u_int32_t'
20016                 fi
20017         else
20018                 : XXX Maybe we should just give up here.
20019                 db_hashtype=u_int32_t
20020                 $cat try.out >&4
20021                 echo "Help:  I can't seem to compile the db test program." >&4
20022                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20023         fi
20024         $rm_try
20025         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20026         ;;
20027 *)      db_hashtype=u_int32_t
20028         ;;
20029 esac
20030 case "$i_db" in
20031 define)
20032         : Check the return type needed for prefix
20033         echo " "
20034         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20035         cat >try.c <<EOCP
20036 #include <sys/types.h>
20037 #include <db.h>
20038
20039 #ifndef DB_VERSION_MAJOR
20040 size_t prefix_cb (const DBT *key1, const DBT *key2)
20041 {
20042         return 0;
20043 }
20044 BTREEINFO info;
20045 int main()
20046 {
20047         info.prefix = prefix_cb;
20048 }
20049 #endif
20050 EOCP
20051         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20052                 if $contains warning try.out >>/dev/null 2>&1 ; then
20053                         db_prefixtype='int'
20054                 else
20055                         db_prefixtype='size_t'
20056                 fi
20057         else
20058                 db_prefixtype='size_t'
20059                 : XXX Maybe we should just give up here.
20060                 $cat try.out >&4
20061                 echo "Help:  I can't seem to compile the db test program." >&4
20062                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20063         fi
20064         $rm_try
20065         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20066         ;;
20067 *)      db_prefixtype='size_t'
20068         ;;
20069 esac
20070
20071 : Include . in @INC
20072 $cat <<EOM
20073
20074 Historically Perl has provided a final fallback of the current working
20075 directory '.' when searching for a library. This, however, can lead to
20076 problems when a Perl program which loads optional modules is called from
20077 a shared directory. This can lead to executing unexpected code.
20078
20079 EOM
20080
20081 # When changing to exclude by default:
20082 case "$default_inc_excludes_dot" in
20083     $undef|false|[nN]*) dflt="n" ;;
20084     *)                  dflt="y" ;;
20085 esac
20086 # To turn exclude off by default:
20087 #case "$default_inc_excludes_dot" in
20088 #    $define|true|[yY]*) dflt="y" ;;
20089 #    *)                  dflt="n" ;;
20090 #esac
20091
20092 rp='Exclude '.' from @INC by default? '
20093 . ./myread
20094 case "$ans" in
20095     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20096     *)          default_inc_excludes_dot="$define" ;;
20097 esac
20098
20099 : Check what kind of inf/nan your system has
20100 $echo "Checking the kind of infinities and nans you have..." >&4
20101 $echo "(The following tests may crash.  That's okay.)" >&4
20102 $cat >try.c <<EOP
20103 #define DOUBLESIZE $doublesize
20104 #$d_longdbl HAS_LONG_DOUBLE
20105 #ifdef HAS_LONG_DOUBLE
20106 #define LONG_DOUBLESIZE $longdblsize
20107 #define LONG_DOUBLEKIND $longdblkind
20108 #endif
20109 #include <math.h>
20110 #include <string.h>
20111 #include <stdio.h>
20112 /* Note that whether the sign bit is on or off
20113  * for NaN depends on the CPU/FPU, and possibly
20114  * can be affected by the build toolchain.
20115  *
20116  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20117  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20118  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20119  * (respectively) as opposed to the more usual
20120  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20121  *
20122  * Pre-IEEE-754 floating point format do not even have inf/nan support
20123  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20124  * to even mention, causing immediate SIGFPE or equivalent: this is
20125  * the case with VAX floating point, for example.
20126  */
20127 static void bytes(void *v, unsigned int n) {
20128   unsigned char *p = (unsigned char *)v;
20129   int i;
20130   for (i = 0; i < n; i++) {
20131     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20132   }
20133 }
20134 int main(int argc, char *argv[]) {
20135    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20136     * because some compilers are 'smart' and not only warn but refuse to
20137     * compile such 'illegal' values. */
20138    double dinf = exp(1e9);
20139    double dnan = sqrt(-1.0);
20140 #ifdef HAS_LONG_DOUBLE
20141    long double ldinf = (long double)exp(1e9);
20142    long double ldnan = (long double)sqrt(-1.0);
20143 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20144 /* the 80-bit long doubles might have garbage in their excess bytes */
20145     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20146     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20147 # endif
20148   if (argc == 2) {
20149     switch (argv[1][0]) {
20150     case '1': bytes(&dinf, sizeof(dinf)); break;
20151     case '2': bytes(&dnan, sizeof(dnan)); break;
20152     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20153     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20154 #endif
20155     }
20156   }
20157   return 0;
20158 }
20159 EOP
20160 set try
20161 if eval $compile; then
20162     doubleinfbytes=`$run ./try 1`
20163     doublenanbytes=`$run ./try 2`
20164     case "$d_longdbl" in
20165     $define)
20166       longdblinfbytes=`$run ./try 3`
20167       longdblnanbytes=`$run ./try 4`
20168       ;;
20169     esac
20170 else
20171     # Defaults in case the above test program failed.
20172     case "$doublekind" in
20173     1) # IEEE 754 32-bit LE
20174        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20175        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20176        ;;
20177     2) # IEEE 754 32-bit BE
20178        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20179        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20180        ;;
20181     3) # IEEE 754 64-bit LE
20182        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20183        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20184        ;;
20185     4) # IEEE 754 64-bit BE
20186        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20187        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20188        ;;
20189     5) # IEEE 754 128-bit LE
20190        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20191        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20192        ;;
20193     6) # IEEE 754 128-bit BE
20194        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20195        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20196        ;;
20197     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20198        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20199        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20200        ;;
20201     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20202        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20203        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20204        ;;
20205     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20206        doubleinfbytes=$undef
20207        doublenanbytes=$undef
20208        ;;
20209     *) # No idea.
20210        doubleinfbytes=$undef
20211        doublenanbytes=$undef
20212        ;;
20213     esac
20214     case "$longdblkind" in
20215     1) # IEEE 754 128-bit LE
20216        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20217        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20218        ;;
20219     2) # IEEE 754 128-bit BE
20220        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20221        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20222        ;;
20223     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20224        case "$longdblsize" in
20225        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20226            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20227            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20228            ;;
20229        16) # x86_64
20230            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20231            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20232            ;;
20233        *)  # No idea.
20234            longdblinfbytes=$undef
20235            longdblnanbytes=$undef
20236        ;;
20237        esac
20238        ;;
20239     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20240        case "$longdblsize" in
20241        12) # 32-bit system
20242            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20243            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20244            ;;
20245        16) # 64-bit system
20246            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20247            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20248            ;;
20249        *)  # No idea.
20250            longdblinfbytes=$undef
20251            longdblnanbytes=$undef
20252        ;;
20253        esac
20254        ;;
20255     5) # 128-bit LE-LE "double double"
20256        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20257        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20258        ;;
20259     6) # 128-bit BE-BE "double double"
20260        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20261        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20262        ;;
20263     7) # 128-bit LE-BE "double double"
20264        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20265        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20266        ;;
20267     8) # 128-bit BE-LE "double double"
20268        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20269        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20270        ;;
20271     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20272        longdblinfbytes=$undef
20273        longdblnanbytes=$undef
20274        ;;
20275     *) # No idea.
20276        longdblinfbytes=$undef
20277        longdblnanbytes=$undef
20278        ;;
20279     esac
20280 fi
20281 # In case the program crashed the values are empty, turn them undef.
20282 case "$doubleinfbytes" in
20283 '') doubleinfbytes=$undef ;;
20284 esac
20285 case "$doublenanbytes" in
20286 '') doublenanbytes=$undef ;;
20287 esac
20288 case "$longdblinfbytes" in
20289 '') longdblinfbytes=$undef ;;
20290 esac
20291 case "$longdblnanbytes" in
20292 '') longdblnanbytes=$undef ;;
20293 esac
20294 $rm_try
20295
20296 : Check the length of the double mantissa
20297 $echo "Checking how many mantissa bits your doubles have..." >&4
20298 $cat >try.c <<EOP
20299 #$i_sunmath I_SUNMATH
20300 #include <float.h>
20301 #ifdef I_SUNMATH
20302 # include <sunmath.h>
20303 #endif
20304 #ifdef DBL_MANT_DIG
20305 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20306 #endif
20307 #include <stdio.h>
20308 int main(int argc, char *argv[]) {
20309 #ifdef BITS
20310   printf("%d\n", BITS);
20311 #endif
20312   return 0;
20313 }
20314 EOP
20315 set try
20316 if eval $compile; then
20317     doublemantbits=`$run ./try`
20318 else
20319     doublemantbits="$undef"
20320 fi
20321 $rm_try
20322
20323 : Check the length of the longdouble mantissa
20324 $echo "Checking how many mantissa bits your long doubles have..." >&4
20325 $cat >try.c <<EOP
20326 #$i_sunmath I_SUNMATH
20327 #include <float.h>
20328 #ifdef I_SUNMATH
20329 # include <sunmath.h>
20330 #endif
20331 #$d_longdbl HAS_LONG_DOUBLE
20332 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20333 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20334 /* This format has no implicit bit.  Beware, however, that for
20335  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20336  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20337  * and the top bit must have been one since 387, zero is plain invalid.
20338  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20339 #  define BITS LDBL_MANT_DIG
20340 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20341 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20342  * reason e.g. Irix thinks 107.  But in any case, we want only
20343  * the number of real bits, the implicit bits are of no interest.  */
20344 #  define BITS 2 * (DBL_MANT_DIG - 1)
20345 # else
20346 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20347 # endif
20348 #endif
20349 #include <stdio.h>
20350 int main(int argc, char *argv[]) {
20351 #ifdef BITS
20352   printf("%d\n", BITS);
20353 #endif
20354   return 0;
20355 }
20356 EOP
20357 set try
20358 if eval $compile; then
20359     longdblmantbits=`$run ./try`
20360 else
20361     longdblmantbits="$undef"
20362 fi
20363 $rm_try
20364
20365 : Check the length of the NV mantissa
20366 $echo "Checking how many mantissa bits your NVs have..." >&4
20367 if test "X$usequadmath" = "X$define"; then
20368   nvmantbits=112 # 128-1-15
20369 else
20370   if test "X$nvsize" = "X$doublesize"; then
20371     nvmantbits="$doublemantbits"
20372   else
20373      if test "X$nvsize" = "X$longdblsize"; then
20374        nvmantbits="$longdblmantbits"
20375      else
20376        nvmantbits="$undef"
20377      fi
20378   fi
20379 fi
20380
20381 : How can we generate normalized random numbers ?
20382 echo " "
20383 echo "Using our internal random number implementation..." >&4
20384
20385 case "$ccflags" in
20386 *-Dmy_rand=*|*-Dmy_srand=*)
20387         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20388         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20389         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20390         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20391         ;;
20392 esac
20393
20394 randfunc=Perl_drand48
20395 drand01="Perl_drand48()"
20396 seedfunc="Perl_drand48_init"
20397 randbits=48
20398 randseedtype=U32
20399
20400 : Probe whether dtrace builds an object, as newer Illumos requires an input
20401 : object file that uses at least one of the probes defined in the .d file
20402 case "$usedtrace" in
20403 $define)
20404     case "$dtracexnolibs" in
20405     $define|true|[yY]*)
20406         dtracexnolibs=$define
20407         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20408         ;;
20409     ' '|'')
20410         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20411              dtracexnolibs=$define
20412              echo "Your dtrace accepts -xnolibs"
20413         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20414              dtracexnolibs=$undef
20415              echo "Your dtrace doesn't accept -xnolibs"
20416         else
20417              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20418              exit 1
20419         fi
20420         ;;
20421     *)
20422         dtracexnolibs=$undef
20423         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20424         ;;
20425     esac
20426     case $dtracexnolibs in
20427     $define) xnolibs=-xnolibs ;;
20428     *) xnolibs= ;;
20429     esac
20430
20431     case "$dtraceobject" in
20432     $define|true|[yY]*)
20433         dtraceobject=$define
20434         ;;
20435     ' '|'')
20436         $cat >try.c <<EOM
20437 #include "perldtrace.h"
20438 int main(void) {
20439     PERL_LOADED_FILE("dummy");
20440     return 0;
20441 }
20442 EOM
20443         dtraceobject=$undef
20444         if $cc -c -o try.o $optimize $ccflags try.c \
20445                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20446                 dtraceobject=$define
20447             echo "Your dtrace builds an object file"
20448         fi
20449         ;;
20450     *) dtraceobject=$undef ;;
20451     esac
20452     $rm_try perldtrace.o perldtrace.h
20453 esac
20454
20455 : Determine if this is an EBCDIC system
20456 echo " "
20457 echo "Determining whether or not we are on an EBCDIC system..." >&4
20458 $cat >try.c <<'EOM'
20459 int main()
20460 {
20461   if ('M'==0xd4) return 0;
20462   return 1;
20463 }
20464 EOM
20465
20466 val=$undef
20467 set try
20468 if eval $compile_ok; then
20469         if $run ./try; then
20470                 echo "You seem to speak EBCDIC." >&4
20471                 val="$define"
20472         else
20473                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20474         fi
20475 else
20476         echo "I'm unable to compile the test program." >&4
20477         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20478 fi
20479 $rm_try
20480 set ebcdic
20481 eval $setvar
20482
20483 : Check how to flush
20484 echo " "
20485 $cat >&4 <<EOM
20486 Checking how to flush all pending stdio output...
20487 EOM
20488 # I only know how to find the first 32 possibly open files on SunOS.
20489 # See also hints/sunos_4_1.sh and util.c  --AD
20490 case "$osname" in
20491 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20492 esac
20493 $cat >>try.c <<EOCP
20494 #include <stdio.h>
20495 #$i_stdlib I_STDLIB
20496 #ifdef I_STDLIB
20497 #include <stdlib.h>
20498 #endif
20499 #$i_unistd I_UNISTD
20500 #ifdef I_UNISTD
20501 # include <unistd.h>
20502 #endif
20503 #$d_sysconf HAS_SYSCONF
20504 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20505 #ifdef HAS_STDIO_STREAM_ARRAY
20506 # define STDIO_STREAM_ARRAY $stdio_stream_array
20507 #endif
20508 int main() {
20509   FILE* p;
20510   unlink("try.out");
20511   p = fopen("try.out", "w");
20512 #ifdef TRY_FPUTC
20513   fputc('x', p);
20514 #else
20515 # ifdef TRY_FPRINTF
20516   fprintf(p, "x");
20517 # endif
20518 #endif
20519 #ifdef TRY_FFLUSH_NULL
20520   fflush(NULL);
20521 #endif
20522 #ifdef TRY_FFLUSH_ALL
20523   {
20524     long open_max = -1;
20525 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20526     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20527 # else
20528 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20529     open_max = sysconf(_SC_OPEN_MAX);
20530 #  else
20531 #   ifdef FOPEN_MAX
20532     open_max = FOPEN_MAX;
20533 #   else
20534 #    ifdef OPEN_MAX
20535     open_max = OPEN_MAX;
20536 #    else
20537 #     ifdef _NFILE
20538     open_max = _NFILE;
20539 #     endif
20540 #    endif
20541 #   endif
20542 #  endif
20543 # endif
20544 # ifdef HAS_STDIO_STREAM_ARRAY
20545     if (open_max > 0) {
20546       long i;
20547       for (i = 0; i < open_max; i++)
20548             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20549                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20550                 STDIO_STREAM_ARRAY[i]._flag)
20551                 fflush(&STDIO_STREAM_ARRAY[i]);
20552     }
20553   }
20554 # endif
20555 #endif
20556   _exit(42);
20557 }
20558 EOCP
20559 : first we have to find out how _not_ to flush
20560 $to try.c
20561 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20562     output=''
20563     set try -DTRY_FPUTC
20564     if eval $compile; then
20565             $run ./try 2>/dev/null
20566             code="$?"
20567             $from try.out
20568             if $test ! -s try.out -a "X$code" = X42; then
20569                 output=-DTRY_FPUTC
20570             fi
20571     fi
20572     case "$output" in
20573     '')
20574             set try -DTRY_FPRINTF
20575             if eval $compile; then
20576                     $run ./try 2>/dev/null
20577                     code="$?"
20578                     $from try.out
20579                     if $test ! -s try.out -a "X$code" = X42; then
20580                         output=-DTRY_FPRINTF
20581                     fi
20582             fi
20583         ;;
20584     esac
20585 fi
20586 : check for fflush NULL behavior
20587 case "$fflushNULL" in
20588 '')     set try -DTRY_FFLUSH_NULL $output
20589         if eval $compile; then
20590                 $run ./try 2>/dev/null
20591                 code="$?"
20592                 $from try.out
20593                 if $test -s try.out -a "X$code" = X42; then
20594                         fflushNULL="`$cat try.out`"
20595                 else
20596                         if $test "X$code" != X42; then
20597                                 $cat >&4 <<EOM
20598 (If this test failed, don't worry, we'll try another method shortly.)
20599 EOM
20600                         fi
20601                 fi
20602         fi
20603         $rm -f core try.core core.try.*
20604         case "$fflushNULL" in
20605         x)      $cat >&4 <<EOM
20606 Your fflush(NULL) works okay for output streams.
20607 Let's see if it clobbers input pipes...
20608 EOM
20609 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20610 # bug that improperly flushes the input end of pipes.  So we avoid the
20611 # autoflush on fork/system/exec support for now. :-(
20612 $cat >tryp.c <<EOCP
20613 #include <stdio.h>
20614 int
20615 main(int argc, char **argv)
20616 {
20617     char buf[1024];
20618     int i;
20619     char *bp = buf;
20620     while (1) {
20621         while ((i = getc(stdin)) != -1
20622                && (*bp++ = i) != '\n'
20623                && bp < &buf[1024])
20624         /* DO NOTHING */ ;
20625         *bp = '\0';
20626         fprintf(stdout, "%s", buf);
20627         fflush(NULL);
20628         if (i == -1)
20629             return 0;
20630         bp = buf;
20631     }
20632 }
20633 EOCP
20634                 fflushNULL="$define"
20635                 set tryp
20636                 if eval $compile; then
20637                     $rm -f tryp.out
20638                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20639                     if $test "X$targethost" != X; then
20640                         $to tryp.c
20641                         $to tryp
20642                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20643                     else
20644                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20645                     fi
20646                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20647                        $cat >&4 <<EOM
20648 fflush(NULL) seems to behave okay with input streams.
20649 EOM
20650                         fflushNULL="$define"
20651                     else
20652                         $cat >&4 <<EOM
20653 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20654 EOM
20655                         fflushNULL="$undef"
20656                     fi
20657                 fi
20658                 $rm -f core tryp.c tryp.core core.tryp.*
20659                 ;;
20660         '')     $cat >&4 <<EOM
20661 Your fflush(NULL) isn't working (contrary to ANSI C).
20662 EOM
20663                 fflushNULL="$undef"
20664                 ;;
20665         *)      $cat >&4 <<EOM
20666 Cannot figure out whether your fflush(NULL) works or not.
20667 I'm assuming it doesn't (contrary to ANSI C).
20668 EOM
20669                 fflushNULL="$undef"
20670                 ;;
20671         esac
20672         ;;
20673 $define|true|[yY]*)
20674         fflushNULL="$define"
20675         ;;
20676 *)
20677         fflushNULL="$undef"
20678         ;;
20679 esac
20680 : check explicit looping only if NULL did not work, and if the pipe
20681 : bug does not show up on an explicit flush too
20682 case "$fflushNULL" in
20683 "$undef")
20684         $cat >tryp.c <<EOCP
20685 #include <stdio.h>
20686 int
20687 main(int argc, char **argv)
20688 {
20689     char buf[1024];
20690     int i;
20691     char *bp = buf;
20692     while (1) {
20693         while ((i = getc(stdin)) != -1
20694                && (*bp++ = i) != '\n'
20695                && bp < &buf[1024])
20696         /* DO NOTHING */ ;
20697         *bp = '\0';
20698         fprintf(stdout, "%s", buf);
20699         fflush(stdin);
20700         if (i == -1)
20701             return 0;
20702         bp = buf;
20703     }
20704 }
20705 EOCP
20706         set tryp
20707         if eval $compile; then
20708             $rm -f tryp.out
20709             if $test "X$targethost" != X; then
20710                 $to tryp.c
20711                 $to tryp
20712                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20713             else
20714                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20715             fi
20716             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20717                $cat >&4 <<EOM
20718 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20719 EOM
20720                 : now check for fflushall behaviour
20721                 case "$fflushall" in
20722                 '')     set try -DTRY_FFLUSH_ALL $output
20723                         if eval $compile; then
20724                                 $cat >&4 <<EOM
20725 (Now testing the other method--but note that this also may fail.)
20726 EOM
20727                                 $run ./try 2>/dev/null
20728                                 code=$?
20729                                 $from try.out
20730                                 if $test -s try.out -a "X$code" = X42; then
20731                                         fflushall="`$cat try.out`"
20732                                 fi
20733                         fi
20734                         $rm_try
20735                         case "$fflushall" in
20736                         x)      $cat >&4 <<EOM
20737 Whew. Flushing explicitly all the stdio streams works.
20738 EOM
20739                                 fflushall="$define"
20740                                 ;;
20741                         '')     $cat >&4 <<EOM
20742 Sigh. Flushing explicitly all the stdio streams doesn't work.
20743 EOM
20744                                 fflushall="$undef"
20745                                 ;;
20746                         *)      $cat >&4 <<EOM
20747 Cannot figure out whether flushing stdio streams explicitly works or not.
20748 I'm assuming it doesn't.
20749 EOM
20750                                 fflushall="$undef"
20751                                 ;;
20752                         esac
20753                         ;;
20754                 "$define"|true|[yY]*)
20755                         fflushall="$define"
20756                         ;;
20757                 *)
20758                         fflushall="$undef"
20759                         ;;
20760                 esac
20761             else
20762                 $cat >&4 <<EOM
20763 All is futile.  Even fflush(stdin) clobbers input pipes!
20764 EOM
20765                 fflushall="$undef"
20766             fi
20767         else
20768             fflushall="$undef"
20769         fi
20770         $rm -f core tryp.c tryp.core core.tryp.*
20771         ;;
20772 *)      fflushall="$undef"
20773         ;;
20774 esac
20775
20776 case "$fflushNULL$fflushall" in
20777 undefundef)
20778         $cat <<EOM
20779 OK, I give up.  I cannot figure out how to flush pending stdio output.
20780 We won't be flushing handles at all before fork/exec/popen.
20781 EOM
20782         ;;
20783 esac
20784 $rm_try tryp
20785
20786 : Store the full pathname to the ar program for use in the C program
20787 : Respect a hint or command line value for full_ar.
20788 case "$full_ar" in
20789 '') full_ar=$ar ;;
20790 esac
20791
20792 : Store the full pathname to the sed program for use in the C program
20793 full_sed=$sed
20794
20795 : see what type gids are declared as in the kernel
20796 echo " "
20797 echo "Looking for the type for group ids returned by getgid()."
20798 set gid_t gidtype xxx stdio.h sys/types.h
20799 eval $typedef
20800 case "$gidtype" in
20801 xxx)
20802         xxx=`./findhdr sys/user.h`
20803         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20804         case $1 in
20805         unsigned) dflt="$1 $2" ;;
20806         *) dflt="$1" ;;
20807         esac
20808         ;;
20809 *) dflt="$gidtype";;
20810 esac
20811 case "$gidtype" in
20812 gid_t) echo "gid_t found." ;;
20813 *)      rp="What is the type for group ids returned by getgid()?"
20814         . ./myread
20815         gidtype="$ans"
20816         ;;
20817 esac
20818
20819 : Check the size of GID
20820 echo " "
20821 case "$gidtype" in
20822 *_t) zzz="$gidtype"     ;;
20823 *)   zzz="gid"          ;;
20824 esac
20825 echo "Checking the size of $zzz..." >&4
20826 cat > try.c <<EOCP
20827 #include <sys/types.h>
20828 #include <stdio.h>
20829 #$i_stdlib I_STDLIB
20830 #ifdef I_STDLIB
20831 #include <stdlib.h>
20832 #endif
20833 int main() {
20834     printf("%d\n", (int)sizeof($gidtype));
20835     exit(0);
20836 }
20837 EOCP
20838 set try
20839 if eval $compile_ok; then
20840         yyy=`$run ./try`
20841         case "$yyy" in
20842         '')     gidsize=4
20843                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20844                 ;;
20845         *)      gidsize=$yyy
20846                 echo "Your $zzz is $gidsize bytes long."
20847                 ;;
20848         esac
20849 else
20850         gidsize=4
20851         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20852 fi
20853
20854 : Check if GID is signed
20855 echo " "
20856 case "$gidtype" in
20857 *_t) zzz="$gidtype"     ;;
20858 *)   zzz="gid"          ;;
20859 esac
20860 echo "Checking the sign of $zzz..." >&4
20861 cat > try.c <<EOCP
20862 #include <sys/types.h>
20863 #include <stdio.h>
20864 int main() {
20865         $gidtype foo = -1;
20866         if (foo < 0)
20867                 printf("-1\n");
20868         else
20869                 printf("1\n");
20870 }
20871 EOCP
20872 set try
20873 if eval $compile; then
20874         yyy=`$run ./try`
20875         case "$yyy" in
20876         '')     gidsign=1
20877                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20878                 ;;
20879         *)      gidsign=$yyy
20880                 case "$gidsign" in
20881                  1) echo "Your $zzz is unsigned." ;;
20882                 -1) echo "Your $zzz is signed."   ;;
20883                 esac
20884                 ;;
20885         esac
20886 else
20887         gidsign=1
20888         echo "(I can't compile the test program--guessing unsigned.)" >&4
20889 fi
20890
20891 : Check 64bit sizes
20892 echo " "
20893
20894 if $test X"$quadtype" != X; then
20895
20896 echo "Checking how to print 64-bit integers..." >&4
20897
20898 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20899         $cat >try.c <<'EOCP'
20900 #include <sys/types.h>
20901 #include <stdio.h>
20902 int main() {
20903   int q = 12345678901;
20904   printf("%ld\n", q);
20905 }
20906 EOCP
20907         set try
20908         if eval $compile; then
20909                 yyy=`$run ./try`
20910                 case "$yyy" in
20911                 12345678901)
20912                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20913                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20914                         echo "We will use %d."
20915                         ;;
20916                 esac
20917         fi
20918 fi
20919
20920 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20921         $cat >try.c <<'EOCP'
20922 #include <sys/types.h>
20923 #include <stdio.h>
20924 int main() {
20925   long q = 12345678901;
20926   printf("%ld\n", q);
20927 }
20928 EOCP
20929         set try
20930         if eval $compile; then
20931                 yyy=`$run ./try`
20932                 case "$yyy" in
20933                 12345678901)
20934                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20935                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20936                         echo "We will use %ld."
20937                         ;;
20938                 esac
20939         fi
20940 fi
20941
20942 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20943         $cat >try.c <<'EOCP'
20944 #include <sys/types.h>
20945 #include <inttypes.h>
20946 #include <stdio.h>
20947 int main() {
20948   int64_t q = 12345678901;
20949   printf("%" PRId64 "\n", q);
20950 }
20951 EOCP
20952         set try
20953         if eval $compile; then
20954                 yyy=`$run ./try`
20955                 case "$yyy" in
20956                 12345678901)
20957                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20958                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20959                         echo "We will use the C9X style."
20960                         ;;
20961                 esac
20962         fi
20963 fi
20964
20965 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20966         $cat >try.c <<EOCP
20967 #include <sys/types.h>
20968 #include <stdio.h>
20969 int main() {
20970   $quadtype q = 12345678901;
20971   printf("%Ld\n", q);
20972 }
20973 EOCP
20974         set try
20975         if eval $compile; then
20976                 yyy=`$run ./try`
20977                 case "$yyy" in
20978                 12345678901)
20979                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20980                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20981                         echo "We will use %Ld."
20982                         ;;
20983                 esac
20984         fi
20985 fi
20986
20987 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20988         $cat >try.c <<'EOCP'
20989 #include <sys/types.h>
20990 #include <stdio.h>
20991 int main() {
20992   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20993   printf("%lld\n", q);
20994 }
20995 EOCP
20996         set try
20997         if eval $compile; then
20998                 yyy=`$run ./try`
20999                 case "$yyy" in
21000                 12345678901)
21001                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21002                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21003                         echo "We will use the %lld style."
21004                         ;;
21005                 esac
21006         fi
21007 fi
21008
21009 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21010         $cat >try.c <<EOCP
21011 #include <sys/types.h>
21012 #include <stdio.h>
21013 int main() {
21014   $quadtype q = 12345678901;
21015   printf("%qd\n", q);
21016 }
21017 EOCP
21018         set try
21019         if eval $compile; then
21020                 yyy=`$run ./try`
21021                 case "$yyy" in
21022                 12345678901)
21023                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21024                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21025                         echo "We will use %qd."
21026                         ;;
21027                 esac
21028         fi
21029 fi
21030
21031 if $test X"$sPRId64" = X; then
21032         echo "Cannot figure out how to print 64-bit integers." >&4
21033 fi
21034 $rm_try
21035
21036 fi
21037
21038 case "$sPRId64" in
21039 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21040         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21041         ;;
21042 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21043         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21044         ;;
21045 esac
21046
21047 : Check format strings for internal types
21048 echo " "
21049 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21050
21051 if $test X"$ivsize" = X8; then
21052         ivdformat="$sPRId64"
21053         uvuformat="$sPRIu64"
21054         uvoformat="$sPRIo64"
21055         uvxformat="$sPRIx64"
21056         uvXUformat="$sPRIXU64"
21057 else
21058         if $test X"$ivsize" = X"$longsize"; then
21059                 ivdformat='"ld"'
21060                 uvuformat='"lu"'
21061                 uvoformat='"lo"'
21062                 uvxformat='"lx"'
21063                 uvXUformat='"lX"'
21064         else
21065                 if $test X"$ivsize" = X"$intsize"; then
21066                         ivdformat='"d"'
21067                         uvuformat='"u"'
21068                         uvoformat='"o"'
21069                         uvxformat='"x"'
21070                         uvXUformat='"X"'
21071                 else
21072                         : far out
21073                         if $test X"$ivsize" = X"$shortsize"; then
21074                                 ivdformat='"hd"'
21075                                 uvuformat='"hu"'
21076                                 uvoformat='"ho"'
21077                                 uvxformat='"hx"'
21078                                 uvXUformat='"hX"'
21079                         fi
21080                 fi
21081         fi
21082 fi
21083
21084 if $test X"$usequadmath" = X"$define"; then
21085     nveformat='"Qe"'
21086     nvfformat='"Qf"'
21087     nvgformat='"Qg"'
21088     nvEUformat='"QE"'
21089     nvFUformat='"QF"'
21090     nvGUformat='"QG"'
21091 else
21092     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21093         nveformat="$sPRIeldbl"
21094         nvfformat="$sPRIfldbl"
21095         nvgformat="$sPRIgldbl"
21096         nvEUformat="$sPRIEUldbl"
21097         nvFUformat="$sPRIFUldbl"
21098         nvGUformat="$sPRIGUldbl"
21099     else
21100         nveformat='"e"'
21101         nvfformat='"f"'
21102         nvgformat='"g"'
21103         nvEUformat='"E"'
21104         nvFUformat='"F"'
21105         nvGUformat='"G"'
21106     fi
21107 fi
21108
21109 case "$ivdformat" in
21110 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21111     exit 1
21112     ;;
21113 esac
21114
21115 : Check format string for GID
21116
21117 echo " "
21118 $echo "Checking the format string to be used for gids..." >&4
21119
21120 case "$gidsign" in
21121 -1)     if $test X"$gidsize" = X"$ivsize"; then
21122                 gidformat="$ivdformat"
21123         else
21124                 if $test X"$gidsize" = X"$longsize"; then
21125                         gidformat='"ld"'
21126                 else
21127                         if $test X"$gidsize" = X"$intsize"; then
21128                                 gidformat='"d"'
21129                         else
21130                                 if $test X"$gidsize" = X"$shortsize"; then
21131                                         gidformat='"hd"'
21132                                 fi
21133                         fi
21134                 fi
21135         fi
21136         ;;
21137 *)      if $test X"$gidsize" = X"$uvsize"; then
21138                 gidformat="$uvuformat"
21139         else
21140                 if $test X"$gidsize" = X"$longsize"; then
21141                         gidformat='"lu"'
21142                 else
21143                         if $test X"$gidsize" = X"$intsize"; then
21144                                 gidformat='"u"'
21145                         else
21146                                 if $test X"$gidsize" = X"$shortsize"; then
21147                                         gidformat='"hu"'
21148                                 fi
21149                         fi
21150                 fi
21151         fi
21152         ;;
21153 esac
21154
21155 : see if getgroups exists
21156 set getgroups d_getgrps
21157 eval $inlibc
21158
21159 : see if setgroups exists
21160 set setgroups d_setgrps
21161 eval $inlibc
21162
21163 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21164 echo " "
21165 case "$d_getgrps$d_setgrps" in
21166 *define*)
21167         case "$groupstype" in
21168         '') dflt="$gidtype" ;;
21169         *)  dflt="$groupstype" ;;
21170         esac
21171         $cat <<EOM
21172 What type of pointer is the second argument to getgroups() and setgroups()?
21173 Usually this is the same as group ids, $gidtype, but not always.
21174
21175 EOM
21176         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21177         . ./myread
21178         groupstype="$ans"
21179         ;;
21180 *)  groupstype="$gidtype";;
21181 esac
21182
21183 : check whether make sets MAKE
21184 echo " "
21185 echo "Checking if your $make program sets \$(MAKE)..." >&4
21186 case "$make_set_make" in
21187 '')
21188         $sed 's/^X //' > testmake.mak << 'EOF'
21189 Xall:
21190 X       @echo 'maketemp="$(MAKE)"'
21191 EOF
21192         case "`$make -f testmake.mak 2>/dev/null`" in
21193         *maketemp=*) make_set_make='#' ;;
21194         *)      make_set_make="MAKE=$make" ;;
21195         esac
21196         $rm -f testmake.mak
21197         ;;
21198 esac
21199 case "$make_set_make" in
21200 '#') echo "Yup, it does.";;
21201 *) echo "Nope, it doesn't.";;
21202 esac
21203
21204 : see what type is used for mode_t
21205 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21206 set mode_t modetype int stdio.h sys/types.h
21207 eval $typedef_ask
21208
21209 : see if we need va_copy
21210 echo " "
21211 $cat >try.c <<EOCP
21212 #include <stdarg.h>
21213 #include <stdio.h>
21214 #include <stdlib.h>
21215 #include <signal.h>
21216
21217 int
21218 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21219 {
21220   return vfprintf(f, fmt, *valp);
21221 }
21222
21223 int
21224 myvfprintf(FILE *f, const  char *fmt, va_list val)
21225 {
21226   return ivfprintf(f, fmt, &val);
21227 }
21228
21229 int
21230 myprintf(char *fmt, ...)
21231 {
21232   va_list val;
21233   va_start(val, fmt);
21234   return myvfprintf(stdout, fmt, val);
21235 }
21236
21237 int
21238 main(int ac, char **av)
21239 {
21240   signal(SIGSEGV, exit);
21241
21242   myprintf("%s%cs all right, then\n", "that", '\'');
21243   exit(0);
21244 }
21245 EOCP
21246 set try
21247 if eval $compile && $run ./try 2>&1 >/dev/null; then
21248         case "`$run ./try`" in
21249         "that's all right, then")
21250                 okay=yes
21251                 ;;
21252         esac
21253 fi
21254 case "$okay" in
21255 yes)    echo "It seems that you don't need va_copy()." >&4
21256         need_va_copy="$undef"
21257         ;;
21258 *)      echo "It seems that va_copy() or similar will be needed." >&4
21259         need_va_copy="$define"
21260         ;;
21261 esac
21262 $rm_try
21263
21264 : see what type is used for size_t
21265 rp="What is the type used for the length parameter for string functions?"
21266 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21267 eval $typedef_ask
21268
21269 : check for type of arguments to gethostbyaddr.
21270 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21271         case "$d_gethbyaddr" in
21272         $define)
21273                 $cat <<EOM
21274
21275 Checking to see what type of arguments are accepted by gethostbyaddr().
21276 EOM
21277                 hdrs="$define sys/types.h
21278                         $d_socket sys/socket.h
21279                         $i_niin netinet/in.h
21280                         $i_netdb netdb.h
21281                         $i_unistd unistd.h"
21282                 : The first arg can 'char *' or 'void *'
21283                 : The second arg is some of integral type
21284                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21285                         for yyy in size_t long int; do
21286                                 case "$netdb_host_type" in
21287                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21288                                         if ./protochk "$try" $hdrs; then
21289                                                 echo "Your system accepts $xxx for the first arg."
21290                                                 echo "...and $yyy for the second arg."
21291                                                 netdb_host_type="$xxx"
21292                                                 netdb_hlen_type="$yyy"
21293                                         fi
21294                                         ;;
21295                                 esac
21296                         done
21297                 done
21298                 : In case none of those worked, prompt the user.
21299                 case "$netdb_host_type" in
21300                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21301                         dflt='char *'
21302                         . ./myread
21303                         netdb_host_type=$ans
21304                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21305                         dflt="$sizetype"
21306                         . ./myread
21307                         netdb_hlen_type=$ans
21308                         ;;
21309                 esac
21310                 ;;
21311         *)      : no gethostbyaddr, so pick harmless defaults
21312                 netdb_host_type='char *'
21313                 netdb_hlen_type="$sizetype"
21314                 ;;
21315         esac
21316         # Remove the "const" if needed. -- but then we'll have a
21317         # prototype clash!
21318         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21319 fi
21320
21321 : check for type of argument to gethostbyname.
21322 if test "X$netdb_name_type" = X ; then
21323         case "$d_gethbyname" in
21324         $define)
21325                 $cat <<EOM
21326
21327 Checking to see what type of argument is accepted by gethostbyname().
21328 EOM
21329                 hdrs="$define sys/types.h
21330                         $d_socket sys/socket.h
21331                         $i_niin netinet/in.h
21332                         $i_netdb netdb.h
21333                         $i_unistd unistd.h"
21334                 for xxx in "const char *" "char *"; do
21335                         case "$netdb_name_type" in
21336                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21337                                 if ./protochk "$try" $hdrs; then
21338                                         echo "Your system accepts $xxx."
21339                                         netdb_name_type="$xxx"
21340                                 fi
21341                                 ;;
21342                         esac
21343                 done
21344                 : In case none of those worked, prompt the user.
21345                 case "$netdb_name_type" in
21346                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21347                         dflt='char *'
21348                         . ./myread
21349                         netdb_name_type=$ans
21350                         ;;
21351                 esac
21352                 ;;
21353         *)      : no gethostbyname, so pick harmless default
21354                 netdb_name_type='char *'
21355                 ;;
21356         esac
21357 fi
21358
21359 : check for type of 1st argument to getnetbyaddr.
21360 if test "X$netdb_net_type" = X ; then
21361         case "$d_getnbyaddr" in
21362         $define)
21363                 $cat <<EOM
21364
21365 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21366 EOM
21367                 hdrs="$define sys/types.h
21368                         $d_socket sys/socket.h
21369                         $i_niin netinet/in.h
21370                         $i_netdb netdb.h
21371                         $i_unistd unistd.h"
21372                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21373                         case "$netdb_net_type" in
21374                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21375                                 if ./protochk "$try" $hdrs; then
21376                                         echo "Your system accepts $xxx."
21377                                         netdb_net_type="$xxx"
21378                                 fi
21379                                 ;;
21380                         esac
21381                 done
21382                 : In case none of those worked, prompt the user.
21383                 case "$netdb_net_type" in
21384                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21385                         dflt='long'
21386                         . ./myread
21387                         netdb_net_type=$ans
21388                         ;;
21389                 esac
21390                 ;;
21391         *)      : no getnetbyaddr, so pick harmless default
21392                 netdb_net_type='long'
21393                 ;;
21394         esac
21395 fi
21396 : locate the preferred pager for this system
21397 fn=f/
21398 case "$pager" in
21399 '')
21400         dflt=''
21401         case "$pg" in
21402         /*) dflt=$pg;;
21403         [a-zA-Z]:/*) dflt=$pg;;
21404         esac
21405         case "$more" in
21406         /*) dflt=$more;;
21407         [a-zA-Z]:/*) dflt=$more;;
21408         esac
21409         case "$less" in
21410         /*) dflt=$less;;
21411         [a-zA-Z]:/*) dflt=$less;;
21412         esac
21413         case "$dflt" in
21414         '') dflt=/usr/ucb/more;;
21415         esac
21416         ;;
21417 *)      dflt="$pager"
21418         ;;
21419 esac
21420 fn="f/($dflt)"
21421 echo " "
21422 rp='What pager is used on your system?'
21423 . ./getfile
21424 pager="$ans"
21425
21426 : see if ar generates random libraries by itself
21427 echo " "
21428 echo "Checking how to generate random libraries on your machine..." >&4
21429 echo 'int bar1() { return bar2(); }' > bar1.c
21430 echo 'int bar2() { return 2; }' > bar2.c
21431 $cat > foo.c <<EOP
21432 #$i_stdlib I_STDLIB
21433 #ifdef I_STDLIB
21434 #include <stdlib.h>
21435 #endif
21436 int main() { printf("%d\n", bar1()); exit(0); }
21437 EOP
21438 $cc $ccflags -c bar1.c >/dev/null 2>&1
21439 $cc $ccflags -c bar2.c >/dev/null 2>&1
21440 $cc $ccflags -c foo.c >/dev/null 2>&1
21441 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21442 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21443         $run ./foobar >/dev/null 2>&1; then
21444         echo "$ar appears to generate random libraries itself."
21445         orderlib=false
21446         if [ "X$ranlib" = "X" ]; then
21447             ranlib=":"
21448         fi
21449 elif $ar s bar$_a >/dev/null 2>&1 &&
21450         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21451         $run ./foobar >/dev/null 2>&1; then
21452                 echo "a table of contents needs to be added with '$ar s'."
21453                 orderlib=false
21454                 ranlib="$ar s"
21455 elif $ar ts bar$_a >/dev/null 2>&1 &&
21456         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21457         $run ./foobar >/dev/null 2>&1; then
21458                 echo "a table of contents needs to be added with '$ar ts'."
21459                 orderlib=false
21460                 ranlib="$ar ts"
21461 else
21462         case "$ranlib" in
21463         :) ranlib='';;
21464         '')
21465                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21466                 $test -f $ranlib || ranlib=''
21467                 ;;
21468         esac
21469         if $test -n "$ranlib"; then
21470                 echo "your system has '$ranlib'; we'll use that."
21471                 orderlib=false
21472         else
21473                 echo "your system doesn't seem to support random libraries"
21474                 echo "so we'll use lorder and tsort to order the libraries."
21475                 orderlib=true
21476                 ranlib=":"
21477         fi
21478 fi
21479 $rm -f foo* bar*
21480
21481 : Check the max offset that gmtime and localtime accept
21482 echo "Checking max offsets that gmtime () accepts"
21483
21484 case "$sGMTIME_min/$sGMTIME_max" in
21485     0/0|/)
21486         $cat >try.c <<EOCP
21487 #include <sys/types.h>
21488 #include <stdio.h>
21489 #include <time.h>
21490
21491 int i;
21492 struct tm *tmp;
21493 time_t pt;
21494
21495 void gm_check (time_t t, int min_year, int max_year)
21496 {
21497     tmp = gmtime (&t);
21498     if ( tmp == NULL ||
21499         /* Check tm_year overflow */
21500          tmp->tm_year < min_year || tmp->tm_year > max_year)
21501         tmp = NULL;
21502     else
21503         pt = t;
21504     } /* gm_check */
21505
21506 int check_max ()
21507 {
21508     tmp = NULL;
21509     pt  = 0;
21510 #ifdef MAXLONG
21511     gm_check (MAXLONG, 69, 0x7fffffff);
21512 #endif
21513     if (tmp == NULL || tmp->tm_year < 0) {
21514         for (i = 63; i >= 0; i--) {
21515             time_t x = pt | ((time_t)1 << i);
21516             if (x < 0 || x < pt) continue;
21517             gm_check (x, 69, 0x7fffffff);
21518             }
21519         }
21520     printf ("sGMTIME_max=%ld\n", pt);
21521     return (0);
21522     } /* check_max */
21523
21524 int check_min ()
21525 {
21526     tmp = NULL;
21527     pt  = 0;
21528 #ifdef MINLONG
21529     gm_check (MINLONG, -1900, 70);
21530 #endif
21531     if (tmp == NULL) {
21532         for (i = 36; i >= 0; i--) {
21533             time_t x = pt - ((time_t)1 << i);
21534             if (x > 0) continue;
21535             gm_check (x, -1900, 70);
21536             }
21537         }
21538     printf ("sGMTIME_min=%ld\n", pt);
21539     return (0);
21540     } /* check_min */
21541
21542 int main (int argc, char *argv[])
21543 {
21544     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21545     check_max ();
21546     check_min ();
21547     return (0);
21548     } /* main */
21549 EOCP
21550         set try
21551         if eval $compile; then
21552             eval `$run ./try 2>/dev/null`
21553         else
21554             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21555             fi
21556         $rm_try
21557         ;;
21558     esac
21559
21560 echo "Checking max offsets that localtime () accepts"
21561
21562 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21563     0/0|/)
21564         $cat >try.c <<EOCP
21565 #include <sys/types.h>
21566 #include <stdio.h>
21567 #include <time.h>
21568
21569 int i;
21570 struct tm *tmp;
21571 time_t pt;
21572
21573 void local_check (time_t t, int min_year, int max_year)
21574 {
21575     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21576         tmp = NULL;
21577     else
21578         tmp = localtime (&t);
21579     if ( tmp == NULL ||
21580         /* Check tm_year overflow */
21581          tmp->tm_year < min_year || tmp->tm_year > max_year)
21582         tmp = NULL;
21583     else
21584         pt = t;
21585     } /* local_check */
21586
21587 int check_max ()
21588 {
21589     tmp = NULL;
21590     pt  = 0;
21591 #ifdef MAXLONG
21592     local_check (MAXLONG, 69, 0x7fffffff);
21593 #endif
21594     if (tmp == NULL || tmp->tm_year < 0) {
21595         for (i = 63; i >= 0; i--) {
21596             time_t x = pt | ((time_t)1 << i);
21597             if (x < 0 || x < pt) continue;
21598             local_check (x, 69, 0x7fffffff);
21599             }
21600         }
21601     printf ("sLOCALTIME_max=%ld\n", pt);
21602     return (0);
21603    } /* check_max */
21604
21605 int check_min ()
21606 {
21607     tmp = NULL;
21608     pt  = 0;
21609 #ifdef MINLONG
21610     local_check (MINLONG, -1900, 70);
21611 #endif
21612     if (tmp == NULL) {
21613         for (i = 36; i >= 0; i--) {
21614             time_t x = pt - ((time_t)1 << i);
21615             if (x > 0) continue;
21616             local_check (x, -1900, 70);
21617             }
21618         }
21619     printf ("sLOCALTIME_min=%ld\n", pt);
21620     return (0);
21621     } /* check_min */
21622
21623 int main (int argc, char *argv[])
21624 {
21625     check_max ();
21626     check_min ();
21627     return (0);
21628     } /* main */
21629 EOCP
21630         set try
21631         if eval $compile; then
21632             eval `$run ./try 2>/dev/null`
21633         else
21634             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21635             fi
21636         $rm_try
21637         ;;
21638     esac
21639
21640 : check for type of arguments to select.
21641 case "$selecttype" in
21642 '') case "$d_select" in
21643         $define)
21644                 echo " "
21645                 $cat <<EOM
21646 Checking to see what type of arguments are accepted by select().
21647 EOM
21648                 hdrs="$define sys/types.h
21649                         $i_systime sys/time.h
21650                         $i_sysselct sys/select.h
21651                         $d_socket sys/socket.h"
21652                 : The first arg can be int, unsigned, or size_t
21653                 : The last arg may or may not be 'const'
21654                 val=''
21655                 : void pointer has been seen but using that
21656                 : breaks the selectminbits test
21657                 for xxx in 'fd_set *' 'int *'; do
21658                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21659                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21660                                         case "$val" in
21661                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21662                                                 if ./protochk "$try" $hdrs; then
21663                                                         echo "Your system accepts $xxx."
21664                                                         val="$xxx"
21665                                                 fi
21666                                                 ;;
21667                                         esac
21668                                 done
21669                         done
21670                 done
21671                 case "$val" in
21672                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21673                         case "$d_fd_set" in
21674                                 $define) dflt="fd_set *" ;;
21675                                 *)              dflt="int *" ;;
21676                         esac
21677                         . ./myread
21678                         val=$ans
21679                         ;;
21680                 esac
21681                 selecttype="$val"
21682                 ;;
21683         *)      : no select, so pick a harmless default
21684                 selecttype='int *'
21685                 ;;
21686         esac
21687         ;;
21688 esac
21689
21690 : check for the select 'width'
21691 case "$selectminbits" in
21692 '') safebits=`expr $ptrsize \* 8`
21693     case "$d_select" in
21694         $define)
21695                 $cat <<EOM
21696
21697 Checking to see on how many bits at a time your select() operates...
21698 EOM
21699                 $cat >try.c <<EOCP
21700 #include <sys/types.h>
21701 #$i_time I_TIME
21702 #$i_systime I_SYS_TIME
21703 #$i_systimek I_SYS_TIME_KERNEL
21704 #ifdef I_TIME
21705 #   include <time.h>
21706 #endif
21707 #ifdef I_SYS_TIME
21708 #   ifdef I_SYS_TIME_KERNEL
21709 #       define KERNEL
21710 #   endif
21711 #   include <sys/time.h>
21712 #   ifdef I_SYS_TIME_KERNEL
21713 #       undef KERNEL
21714 #   endif
21715 #endif
21716 #$i_sysselct I_SYS_SELECT
21717 #ifdef I_SYS_SELECT
21718 #include <sys/select.h>
21719 #endif
21720 #$d_socket HAS_SOCKET
21721 #ifdef HAS_SOCKET
21722 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21723 #endif
21724 #include <stdio.h>
21725 #$i_stdlib I_STDLIB
21726 #ifdef I_STDLIB
21727 #include <stdlib.h>
21728 #endif
21729 $selecttype b;
21730 #define S sizeof(*(b))
21731 #define MINBITS 64
21732 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21733 #define NBITS  (NBYTES * 8)
21734 int main() {
21735     char *s = (char *)malloc(NBYTES);
21736     struct timeval t;
21737     int i;
21738     FILE* fp;
21739     int fd;
21740
21741     if (!s)
21742         exit(1);
21743     fclose(stdin);
21744     fp = fopen("try.c", "r");
21745     if (fp == 0)
21746       exit(2);
21747     fd = fileno(fp);
21748     if (fd < 0)
21749       exit(3);
21750     b = ($selecttype)s;
21751     for (i = 0; i < NBITS; i++)
21752         FD_SET(i, b);
21753     t.tv_sec  = 0;
21754     t.tv_usec = 0;
21755     select(fd + 1, b, 0, 0, &t);
21756     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21757     free(s);
21758     printf("%d\n", i + 1);
21759     return 0;
21760 }
21761 EOCP
21762                 set try
21763                 if eval $compile_ok; then
21764                         selectminbits=`$run ./try 2>/dev/null`
21765                         case "$selectminbits" in
21766                         '')     cat >&4 <<EOM
21767 Cannot figure out on how many bits at a time your select() operates.
21768 I'll play safe and guess it is $safebits bits.
21769 EOM
21770                                 selectminbits=$safebits
21771                                 bits="$safebits bits"
21772                                 ;;
21773                         1)      bits="1 bit" ;;
21774                         *)      bits="$selectminbits bits" ;;
21775                         esac
21776                         echo "Your select() operates on $bits at a time." >&4
21777                 else
21778                         rp='What is the minimum number of bits your select() operates on?'
21779                         case "$byteorder" in
21780                         12345678)       dflt=64 ;;
21781                         1234)           dflt=32 ;;
21782                         *)              dflt=1  ;;
21783                         esac
21784                         . ./myread
21785                         val=$ans
21786                         selectminbits="$val"
21787                 fi
21788                 $rm_try
21789                 ;;
21790         *)      : no select, so pick a harmless default
21791                 selectminbits=$safebits
21792                 ;;
21793         esac
21794         ;;
21795 esac
21796
21797 : Trace out the files included by signal.h, then look for SIGxxx names.
21798 case "$sig_num_init" in
21799 '')
21800 if [ "X$fieldn" = X ]; then
21801         : Just make some guesses.  We check them later.
21802         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21803 else
21804         xxx=`echo '#include <signal.h>' |
21805         $cppstdin $cppminus $cppflags 2>/dev/null |
21806         $grep '^[       ]*#.*include' |
21807         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21808                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21809 fi
21810 xxxfiles=''
21811 for xx in $xxx /dev/null ; do
21812         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21813 done
21814 case "$xxxfiles" in
21815 '')     xxxfiles=`./findhdr signal.h` ;;
21816 esac
21817 xxx=`awk '
21818 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21819         print substr($2, 4, 20)
21820 }
21821 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21822         print substr($3, 4, 20)
21823 }' $xxxfiles`
21824 : Append some common names just in case the awk scan failed.
21825 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21826 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21827 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21828 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21829 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21830
21831 : generate a few handy files for later
21832 $cat > signal.c <<EOCP
21833 #include <sys/types.h>
21834 #include <signal.h>
21835 #$i_stdlib I_STDLIB
21836 #ifdef I_STDLIB
21837 #include <stdlib.h>
21838 #endif
21839 #include <stdio.h>
21840 int main() {
21841
21842 /* Strange style to avoid deeply-nested #if/#else/#endif */
21843 #ifndef NSIG
21844 #  ifdef _NSIG
21845 #    define NSIG (_NSIG)
21846 #  endif
21847 #endif
21848
21849 #ifndef NSIG
21850 #  ifdef SIGMAX
21851 #    define NSIG (SIGMAX+1)
21852 #  endif
21853 #endif
21854
21855 #ifndef NSIG
21856 #  ifdef SIG_MAX
21857 #    define NSIG (SIG_MAX+1)
21858 #  endif
21859 #endif
21860
21861 #ifndef NSIG
21862 #  ifdef _SIG_MAX
21863 #    define NSIG (_SIG_MAX+1)
21864 #  endif
21865 #endif
21866
21867 #ifndef NSIG
21868 #  ifdef MAXSIG
21869 #    define NSIG (MAXSIG+1)
21870 #  endif
21871 #endif
21872
21873 #ifndef NSIG
21874 #  ifdef MAX_SIG
21875 #    define NSIG (MAX_SIG+1)
21876 #  endif
21877 #endif
21878
21879 #ifndef NSIG
21880 #  ifdef SIGARRAYSIZE
21881 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21882 #  endif
21883 #endif
21884
21885 #ifndef NSIG
21886 #  ifdef _sys_nsig
21887 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21888 #  endif
21889 #endif
21890
21891 /* Default to some arbitrary number that's big enough to get most
21892    of the common signals.
21893 */
21894 #ifndef NSIG
21895 #    define NSIG 50
21896 #endif
21897
21898 printf("NSIG %d\n", NSIG);
21899
21900 #ifndef JUST_NSIG
21901
21902 EOCP
21903
21904 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21905 {
21906         printf "#ifdef SIG"; printf $1; printf "\n"
21907         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21908         printf $1; printf ");\n"
21909         printf "#endif\n"
21910 }
21911 END {
21912         printf "#endif /* JUST_NSIG */\n";
21913         printf "exit(0);\n}\n";
21914 }
21915 ' >>signal.c
21916 $cat >signal.awk <<'EOP'
21917 BEGIN { ndups = 0 }
21918 $1 ~ /^NSIG$/ { nsig = $2 }
21919 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21920     if ($2 > maxsig) { maxsig = $2 }
21921     if (sig_name[$2]) {
21922         dup_name[ndups] = $1
21923         dup_num[ndups] = $2
21924         ndups++
21925     }
21926     else {
21927         sig_name[$2] = $1
21928         sig_num[$2] = $2
21929     }
21930 }
21931 END {
21932     if (nsig == 0) {
21933         nsig = maxsig + 1
21934     }
21935     printf("NSIG %d\n", nsig);
21936     for (n = 1; n < nsig; n++) {
21937         if (sig_name[n]) {
21938             printf("%s %d\n", sig_name[n], sig_num[n])
21939         }
21940         else {
21941             printf("NUM%d %d\n", n, n)
21942         }
21943     }
21944     for (n = 0; n < ndups; n++) {
21945         printf("%s %d\n", dup_name[n], dup_num[n])
21946     }
21947 }
21948 EOP
21949 $cat >signal_cmd <<EOS
21950 $startsh
21951 if $test -s signal.lst; then
21952     echo "Using your existing signal.lst file"
21953         exit 0
21954 fi
21955 xxx="$xxx"
21956 EOS
21957 $cat >>signal_cmd <<'EOS'
21958
21959 set signal
21960 if eval $compile_ok; then
21961         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21962                 $uniq | $awk -f signal.awk >signal.lst
21963 else
21964         echo "(I can't seem be able to compile the whole test program)" >&4
21965         echo "(I'll try it in little pieces.)" >&4
21966         set signal -DJUST_NSIG
21967         if eval $compile_ok; then
21968                 $run ./signal$_exe > signal.nsg
21969                 $cat signal.nsg
21970         else
21971                 echo "I can't seem to figure out how many signals you have." >&4
21972                 echo "Guessing 50." >&4
21973                 echo 'NSIG 50' > signal.nsg
21974         fi
21975         : Now look at all the signal names, one at a time.
21976         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21977                 $cat > signal.c <<EOCP
21978 #include <sys/types.h>
21979 #include <signal.h>
21980 #include <stdio.h>
21981 int main() {
21982 printf("$xx %d\n", SIG${xx});
21983 return 0;
21984 }
21985 EOCP
21986                 set signal
21987                 if eval $compile; then
21988                         echo "SIG${xx} found."
21989                         $run ./signal$_exe  >> signal.ls1
21990                 else
21991                         echo "SIG${xx} NOT found."
21992                 fi
21993         done
21994         if $test -s signal.ls1; then
21995                 $cat signal.nsg signal.ls1 |
21996                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21997         fi
21998
21999 fi
22000 if $test -s signal.lst; then
22001         :
22002 else
22003         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22004         echo 'kill -l' >signal
22005         set X `csh -f <signal`
22006         $rm -f signal
22007         shift
22008         case $# in
22009         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22010         esac
22011         echo $@ | $tr ' ' $trnl | \
22012             $awk '{ printf "%s %d\n", $1, ++s; }
22013                   END { printf "NSIG %d\n", ++s }' >signal.lst
22014 fi
22015 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22016 EOS
22017 chmod a+x signal_cmd
22018 $eunicefix signal_cmd
22019 ;;
22020 esac
22021
22022 : generate list of signal names
22023 case "$sig_num_init" in
22024 '')
22025 echo " "
22026 case "$sig_name_init" in
22027 '') doinit=yes ;;
22028 *)  case "$sig_num_init" in
22029     ''|*,*) doinit=yes ;;
22030     esac ;;
22031 esac
22032 case "$doinit" in
22033 yes)
22034         echo "Generating a list of signal names and numbers..." >&4
22035         . ./signal_cmd
22036         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22037         sig_name=`$awk 'BEGIN { printf "ZERO " }
22038                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22039         sig_num=`$awk  'BEGIN { printf "0 " }
22040                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22041         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22042                              !/^NSIG/   { printf "\"%s\", ", $1 }
22043                              END        { printf "0\n" }' signal.lst`
22044         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22045                              !/^NSIG/   { printf "%d, ", $2}
22046                              END        { printf "0\n"}' signal.lst`
22047         ;;
22048 esac
22049 echo "The following $sig_count signals are available:"
22050 echo " "
22051 echo $sig_name | $awk \
22052 'BEGIN { linelen = 0 }
22053 {
22054         for (i = 1; i <= NF; i++) {
22055                 name = "SIG" $i " "
22056                 linelen = linelen + length(name)
22057                 if (linelen > 70) {
22058                         printf "\n"
22059                         linelen = length(name)
22060                 }
22061                 printf "%s", name
22062         }
22063         printf "\n"
22064 }'
22065 sig_size=`echo $sig_name | awk '{print NF}'`
22066 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22067 ;;
22068 esac
22069
22070 : Check size of size
22071 echo " "
22072 case "$sizetype" in
22073 *_t) zzz="$sizetype"    ;;
22074 *)   zzz="filesize"     ;;
22075 esac
22076 echo "Checking the size of $zzz..." >&4
22077 cat > try.c <<EOCP
22078 #include <sys/types.h>
22079 #include <stdio.h>
22080 #$i_stdlib I_STDLIB
22081 #ifdef I_STDLIB
22082 #include <stdlib.h>
22083 #endif
22084 int main() {
22085     printf("%d\n", (int)sizeof($sizetype));
22086     exit(0);
22087 }
22088 EOCP
22089 set try
22090 if eval $compile_ok; then
22091         yyy=`$run ./try`
22092         case "$yyy" in
22093         '')     sizesize=4
22094                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22095                 ;;
22096         *)      sizesize=$yyy
22097                 echo "Your $zzz size is $sizesize bytes."
22098                 ;;
22099         esac
22100 else
22101         sizesize=4
22102         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22103 fi
22104
22105 : check for socklen_t
22106 echo " "
22107 echo "Checking to see if you have socklen_t..." >&4
22108 $cat >try.c <<EOCP
22109 #include <sys/types.h>
22110 #$d_socket HAS_SOCKET
22111 #ifdef HAS_SOCKET
22112 #include <sys/socket.h>
22113 #endif
22114 int main() { socklen_t x = 16; }
22115 EOCP
22116 set try
22117 if eval $compile; then
22118         val="$define"
22119         echo "You have socklen_t."
22120 else
22121         val="$undef"
22122         echo "You do not have socklen_t."
22123         case "$sizetype" in
22124         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22125         esac
22126 fi
22127 $rm_try
22128 set d_socklen_t
22129 eval $setvar
22130
22131 : see if this is a socks.h system
22132 set socks.h i_socks
22133 eval $inhdr
22134
22135 : check for type of the size argument to socket calls
22136 case "$d_socket" in
22137 "$define")
22138         $cat <<EOM
22139
22140 Checking to see what type is the last argument of accept().
22141 EOM
22142         yyy=''
22143         case "$d_socklen_t" in
22144         "$define") yyy="$yyy socklen_t"
22145         esac
22146         yyy="$yyy $sizetype int long unsigned"
22147         for xxx in $yyy; do
22148                 case "$socksizetype" in
22149                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22150                         case "$usesocks" in
22151                         "$define")
22152                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22153                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22154                                         socksizetype="$xxx"
22155                                 fi
22156                                 ;;
22157                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22158                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22159                                         socksizetype="$xxx"
22160                                 fi
22161                                 ;;
22162                         esac
22163                         ;;
22164                 esac
22165         done
22166 : In case none of those worked, prompt the user.
22167         case "$socksizetype" in
22168         '')     rp='What is the type for socket address structure sizes?'
22169                 dflt='int'
22170                 . ./myread
22171                 socksizetype=$ans
22172                 ;;
22173         esac
22174         ;;
22175 *)      : no sockets, so pick relatively harmless default
22176         socksizetype='int'
22177         ;;
22178 esac
22179
22180 : see what type is used for signed size_t
22181 set ssize_t ssizetype int stdio.h sys/types.h
22182 eval $typedef
22183 dflt="$ssizetype"
22184 $cat > try.c <<EOM
22185 #include <stdio.h>
22186 #$i_stdlib I_STDLIB
22187 #ifdef I_STDLIB
22188 #include <stdlib.h>
22189 #endif
22190 #include <sys/types.h>
22191 #define Size_t $sizetype
22192 #define SSize_t $dflt
22193 int main()
22194 {
22195         if (sizeof(Size_t) == sizeof(SSize_t))
22196                 printf("$dflt\n");
22197         else if (sizeof(Size_t) == sizeof(int))
22198                 printf("int\n");
22199         else
22200                 printf("long\n");
22201         exit(0);
22202 }
22203 EOM
22204 echo " "
22205 set try
22206 if eval $compile_ok && $run ./try > /dev/null; then
22207         ssizetype=`$run ./try`
22208         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22209 else
22210         $cat >&4 <<EOM
22211 Help! I can't compile and run the ssize_t test program: please enlighten me!
22212 (This is probably a misconfiguration in your system or libraries, and
22213 you really ought to fix it.  Still, I'll try anyway.)
22214
22215 I need a type that is the same size as $sizetype, but is guaranteed to
22216 be signed.  Common values are ssize_t, int and long.
22217
22218 EOM
22219         rp="What signed type is the same size as $sizetype?"
22220         . ./myread
22221         ssizetype="$ans"
22222 fi
22223 $rm_try
22224
22225 : Check the size of st_ino
22226 $echo " "
22227 $echo "Checking the size of st_ino..." >&4
22228 $cat > try.c <<EOCP
22229 #include <sys/stat.h>
22230 #include <stdio.h>
22231 #$i_stdlib I_STDLIB
22232 #ifdef I_STDLIB
22233 #include <stdlib.h>
22234 #endif
22235 int main() {
22236     struct stat st;
22237     printf("%d\n", (int)sizeof(st.st_ino));
22238     exit(0);
22239 }
22240 EOCP
22241 set try
22242 if eval $compile_ok; then
22243         val=`$run ./try`
22244         case "$val" in
22245         '')     st_ino_size=4
22246                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22247                 ;;
22248         *)      st_ino_size=$val
22249                 $echo "Your st_ino is $st_ino_size bytes long."
22250                 ;;
22251         esac
22252 else
22253         st_ino_size=4
22254         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22255 fi
22256 $rm_try
22257
22258 : Check if st_ino is signed
22259 $echo " "
22260 $echo "Checking the sign of st_ino..." >&4
22261 $cat > try.c <<EOCP
22262 #include <sys/stat.h>
22263 #include <stdio.h>
22264 int main() {
22265         struct stat foo;
22266         foo.st_ino = -1;
22267         if (foo.st_ino < 0)
22268                 printf("-1\n");
22269         else
22270                 printf("1\n");
22271 }
22272 EOCP
22273 set try
22274 if eval $compile; then
22275         val=`$run ./try`
22276         case "$val" in
22277         '')     st_ino_sign=1
22278                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22279                 ;;
22280         *)      st_ino_sign=$val
22281                 case "$st_ino_sign" in
22282                  1) $echo "Your st_ino is unsigned." ;;
22283                 -1) $echo "Your st_ino is signed."   ;;
22284                 esac
22285                 ;;
22286         esac
22287 else
22288         st_ino_sign=1
22289         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22290 fi
22291 $rm_try
22292
22293 : see what type of char stdio uses.
22294 echo " "
22295 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22296 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22297         echo "Your stdio uses unsigned chars." >&4
22298         stdchar="unsigned char"
22299 else
22300         echo "Your stdio uses signed chars." >&4
22301         stdchar="char"
22302 fi
22303 $rm -f stdioh
22304
22305 : Check size of UID
22306 echo " "
22307 case "$uidtype" in
22308 *_t) zzz="$uidtype"     ;;
22309 *)   zzz="uid"          ;;
22310 esac
22311 echo "Checking the size of $zzz..." >&4
22312 cat > try.c <<EOCP
22313 #include <sys/types.h>
22314 #include <stdio.h>
22315 #$i_stdlib I_STDLIB
22316 #ifdef I_STDLIB
22317 #include <stdlib.h>
22318 #endif
22319 int main() {
22320     printf("%d\n", (int)sizeof($uidtype));
22321     exit(0);
22322 }
22323 EOCP
22324 set try
22325 if eval $compile_ok; then
22326         yyy=`$run ./try`
22327         case "$yyy" in
22328         '')     uidsize=4
22329                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22330                 ;;
22331         *)      uidsize=$yyy
22332                 echo "Your $zzz is $uidsize bytes long."
22333                 ;;
22334         esac
22335 else
22336         uidsize=4
22337         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22338 fi
22339
22340 : Check if UID is signed
22341 echo " "
22342 case "$uidtype" in
22343 *_t) zzz="$uidtype"     ;;
22344 *)   zzz="uid"          ;;
22345 esac
22346 echo "Checking the sign of $zzz..." >&4
22347 cat > try.c <<EOCP
22348 #include <sys/types.h>
22349 #include <stdio.h>
22350 int main() {
22351         $uidtype foo = -1;
22352         if (foo < 0)
22353                 printf("-1\n");
22354         else
22355                 printf("1\n");
22356 }
22357 EOCP
22358 set try
22359 if eval $compile; then
22360         yyy=`$run ./try`
22361         case "$yyy" in
22362         '')     uidsign=1
22363                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22364                 ;;
22365         *)      uidsign=$yyy
22366                 case "$uidsign" in
22367                  1) echo "Your $zzz is unsigned." ;;
22368                 -1) echo "Your $zzz is signed."   ;;
22369                 esac
22370                 ;;
22371         esac
22372 else
22373         uidsign=1
22374         echo "(I can't compile the test program--guessing unsigned.)" >&4
22375 fi
22376
22377 : Check format string for UID
22378 echo " "
22379 $echo "Checking the format string to be used for uids..." >&4
22380
22381 case "$uidsign" in
22382 -1)     if $test X"$uidsize" = X"$ivsize"; then
22383                 uidformat="$ivdformat"
22384         else
22385                 if $test X"$uidsize" = X"$longsize"; then
22386                         uidformat='"ld"'
22387                 else
22388                         if $test X"$uidsize" = X"$intsize"; then
22389                                 uidformat='"d"'
22390                         else
22391                                 if $test X"$uidsize" = X"$shortsize"; then
22392                                         uidformat='"hd"'
22393                                 fi
22394                         fi
22395                 fi
22396         fi
22397         ;;
22398 *)      if $test X"$uidsize" = X"$uvsize"; then
22399                 uidformat="$uvuformat"
22400         else
22401                 if $test X"$uidsize" = X"$longsize"; then
22402                         uidformat='"lu"'
22403                 else
22404                         if $test X"$uidsize" = X"$intsize"; then
22405                                 uidformat='"u"'
22406                         else
22407                                 if $test X"$uidsize" = X"$shortsize"; then
22408                                         uidformat='"hu"'
22409                                 fi
22410                         fi
22411                 fi
22412         fi
22413         ;;
22414 esac
22415
22416 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22417 echo " "
22418 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22419 $cat >try.c <<'EOM'
22420 /* Intentionally a long probe as I'd like to sanity check that the exact
22421    approach is going to work, as thinking it will work, but only having it
22422    part working at runtime is worse than not having it.  */
22423
22424 #include <sys/types.h>
22425 #include <sys/sysctl.h>
22426 #include <sys/param.h>
22427 #include <stdio.h>
22428 #include <string.h>
22429 #include <stdlib.h>
22430 #include <unistd.h>
22431
22432 int
22433 main(int argc, char **argv) {
22434     char *buffer;
22435     char *argv_leaf = strrchr(argv[0], '/');
22436     char *buffer_leaf;
22437     size_t size = 0;
22438     int mib[4];
22439
22440     mib[0] = CTL_KERN;
22441     mib[1] = KERN_PROC;
22442     mib[2] = KERN_PROC_PATHNAME;
22443     mib[3] = -1;
22444
22445     if (!argv_leaf) {
22446         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22447         return 1;
22448     }
22449
22450     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22451         perror("sysctl");
22452         return 2;
22453     }
22454
22455     if (size < strlen(argv_leaf) + 1) {
22456         fprintf(stderr, "size %lu is too short for a path\n",
22457                 (unsigned long) size);
22458         return 3;
22459     }
22460
22461     if (size > MAXPATHLEN * MAXPATHLEN) {
22462         fprintf(stderr, "size %lu is too long for a path\n",
22463                 (unsigned long) size);
22464         return 4;
22465     }
22466
22467     buffer = (char *)malloc(size);
22468     if (!buffer) {
22469         perror("malloc");
22470         return 5;
22471     }
22472
22473     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22474         perror("sysctl");
22475         return 6;
22476     }
22477
22478     if (strlen(buffer) + 1 != size) {
22479         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22480                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22481         return 7;
22482     }
22483
22484
22485     if (*buffer != '/') {
22486         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22487         return 8;
22488     }
22489
22490     if (strstr(buffer, "/./")) {
22491         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22492         return 9;
22493     }
22494
22495     if (strstr(buffer, "/../")) {
22496         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22497         return 10;
22498     }
22499
22500     buffer_leaf = strrchr(buffer, '/');
22501     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22502         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22503         return 11;
22504     }
22505
22506     free(buffer);
22507
22508     return 0;
22509 }
22510 EOM
22511
22512 val=$undef
22513 set try
22514 if eval $compile; then
22515         if $run ./try; then
22516                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22517                 val="$define"
22518         else
22519                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22520                 val="$undef"
22521         fi
22522 else
22523         echo "I'm unable to compile the test program." >&4
22524         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22525         val="$undef"
22526 fi
22527 $rm_try
22528 set usekernprocpathname
22529 eval $setvar
22530
22531 : Determine if we can use _NSGetExecutablePath to find executing program
22532 echo " "
22533 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22534 $cat >try.c <<'EOM'
22535 /* Intentionally a long probe as I'd like to sanity check that the exact
22536    approach is going to work, as thinking it will work, but only having it
22537    part working at runtime is worse than not having it.  */
22538 #include <mach-o/dyld.h>
22539 #include <stdio.h>
22540 #include <stdlib.h>
22541 #include <sys/param.h>
22542 #include <string.h>
22543
22544 int
22545 main(int argc, char **argv) {
22546     char buf[1];
22547     uint32_t size = sizeof(buf);
22548     int result;
22549     char *buffer;
22550     char *tidied;
22551     char *argv_leaf = strrchr(argv[0], '/');
22552     char *tidied_leaf;
22553
22554     if (!argv_leaf) {
22555         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22556         return 1;
22557     }
22558
22559     _NSGetExecutablePath(buf, &size);
22560     if (size > MAXPATHLEN * MAXPATHLEN) {
22561         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22562                 (unsigned int) size);
22563         return 2;
22564     }
22565
22566     buffer = (char *)malloc(size);
22567     if (!buffer) {
22568         perror("malloc");
22569         return 3;
22570     }
22571
22572     result = _NSGetExecutablePath(buffer, &size);
22573     if (result != 0) {
22574         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22575                 result, (unsigned int) size);
22576         return 4;
22577     }
22578
22579     tidied = realpath(buffer, NULL);
22580     if (!tidied) {
22581         perror("realpath");
22582         return 5;
22583     }
22584
22585     free(buffer);
22586
22587     if (*tidied != '/') {
22588         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22589         return 6;
22590     }
22591
22592     if (strstr(tidied, "/./")) {
22593         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22594         return 7;
22595     }
22596
22597     if (strstr(tidied, "/../")) {
22598         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22599         return 8;
22600     }
22601
22602     tidied_leaf = strrchr(tidied, '/');
22603     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22604         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22605         return 9;
22606     }
22607
22608     free(tidied);
22609
22610     return 0;
22611 }
22612 EOM
22613
22614 val=$undef
22615 set try
22616 if eval $compile; then
22617         if $run ./try; then
22618                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22619                 val="$define"
22620         else
22621                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22622         fi
22623 else
22624         echo "I'm unable to compile the test program." >&4
22625         echo "I'll assume no _NSGetExecutablePath here." >&4
22626 fi
22627 $rm_try
22628 set usensgetexecutablepath
22629 eval $setvar
22630
22631 : Check if site customization support was requested
22632 case "$usesitecustomize" in
22633     $define|true|[Yy]*)
22634         usesitecustomize="$define"
22635         ;;
22636     *)
22637         usesitecustomize="$undef"
22638         ;;
22639     esac
22640
22641 : determine compiler compiler
22642 case "$yacc" in
22643 '')
22644         dflt=yacc;;
22645 *)
22646         dflt="$yacc";;
22647 esac
22648 echo " "
22649 comp='yacc'
22650 if $test -f "$byacc$_exe"; then
22651         dflt="$byacc"
22652         comp="byacc or $comp"
22653 fi
22654 if $test -f "$bison$_exe"; then
22655         comp="$comp or bison -y"
22656 fi
22657 rp="Which compiler compiler ($comp) shall I use?"
22658 . ./myread
22659 yacc="$ans"
22660 case "$yacc" in
22661 *bis*)
22662         case "$yacc" in
22663         *-y*) ;;
22664         *)
22665                 yacc="$yacc -y"
22666                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22667                 ;;
22668         esac
22669         ;;
22670 esac
22671
22672 : see if this is a bfd.h system
22673 set bfd.h i_bfd
22674 eval $inhdr
22675
22676 : see if this is an execinfo.h system
22677 set execinfo.h i_execinfo
22678 eval $inhdr
22679
22680 : see if this is a fenv.h system
22681 set fenv.h i_fenv
22682 eval $inhdr
22683
22684 : see if this is a fp.h system
22685 set fp.h i_fp
22686 eval $inhdr
22687
22688 : see if this is a fp_class.h system
22689 set fp_class.h i_fp_class
22690 eval $inhdr
22691
22692 : see if gdbm.h is available
22693 set gdbm.h t_gdbm
22694 eval $inhdr
22695 case "$t_gdbm" in
22696 $define)
22697         : see if gdbm_open exists
22698         set gdbm_open d_gdbm_open
22699         eval $inlibc
22700         case "$d_gdbm_open" in
22701         $undef)
22702                 t_gdbm="$undef"
22703                 echo "We won't be including <gdbm.h>"
22704                 ;;
22705         esac
22706         ;;
22707 esac
22708 val="$t_gdbm"
22709 set i_gdbm
22710 eval $setvar
22711
22712 : see if this is a ieeefp.h system
22713 case "$i_ieeefp" in
22714 '' ) set ieeefp.h i_ieeefp
22715      eval $inhdr
22716      ;;
22717 esac
22718
22719 : see if this is a libutil.h system
22720 set libutil.h i_libutil
22721 eval $inhdr
22722
22723 : see if mach cthreads are available
22724 if test "X$usethreads" = "X$define"; then
22725         set mach/cthreads.h i_machcthr
22726         eval $inhdr
22727 else
22728         i_machcthr="$undef"
22729 fi
22730
22731 : see if this is a mntent.h system
22732 set mntent.h i_mntent
22733 eval $inhdr
22734
22735 : see if net/errno.h is available
22736 val=''
22737 set net/errno.h val
22738 eval $inhdr
22739
22740 : Unfortunately, it causes problems on some systems.  Arrgh.
22741 case "$val" in
22742 $define)
22743         cat > try.c <<'EOM'
22744 #include <stdio.h>
22745 #include <errno.h>
22746 #include <net/errno.h>
22747 int func()
22748 {
22749         return ENOTSOCK;
22750 }
22751 EOM
22752         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22753                 echo "We'll be including <net/errno.h>." >&4
22754         else
22755                 echo "We won't be including <net/errno.h>." >&4
22756                 val="$undef"
22757         fi
22758         $rm_try
22759         ;;
22760 esac
22761 set i_neterrno
22762 eval $setvar
22763
22764 : see if netinet/tcp.h is available
22765 set netinet/tcp.h i_netinettcp
22766 eval $inhdr
22767
22768 : see if this is a poll.h system
22769 set poll.h i_poll
22770 eval $inhdr
22771
22772 : see if this is a prot.h system
22773 set prot.h i_prot
22774 eval $inhdr
22775
22776 : Preprocessor symbols
22777 echo " "
22778 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22779 $cat <<'EOSH' > Cppsym.know
22780 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22781 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22782 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22783 arch_pwr ardent ARM ARM32 atarist att386 att3b
22784 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22785 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22786 byteorder byte_order
22787 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22788 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22789 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22790 ELF encore EPI EXTENSIONS
22791 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22792 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22793 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22794 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22795 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
22796 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22797 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22798 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22799 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22800 ksr1
22801 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22802 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22803 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22804 luna88k Lynx
22805 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22806 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22807 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22808 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22809 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22810 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22811 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22812 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22813 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22814 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22815 ns32000 ns32016 ns32332 ns32k nsc32000
22816 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22817 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22818 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22819 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22820 QK_USER QNX
22821 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22822 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22823 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22824 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22825 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22826 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22827 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22828 SYSV4 SYSV5 sysV68 sysV88
22829 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22830 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22831 tower32_800 tower32_850 tss
22832 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22833 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22834 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22835 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22836 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22837 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22838 uxpm uxps
22839 vax venix VMESA vms
22840 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22841 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22842 z8000 zarch
22843 EOSH
22844 # Maybe put other stuff here too.
22845 ./tr '-' '_' <<EOSH >>Cppsym.know
22846 $osname
22847 EOSH
22848 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22849 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22850 $cat Cppsym.know > Cppsym.c
22851 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22852 $rm -f Cppsym.a Cppsym.b Cppsym.c
22853 cat <<EOSH > Cppsym
22854 $startsh
22855 if $test \$# -gt 0; then
22856     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22857     if $test -s Cppsym.got; then
22858         $rm -f Cppsym.got
22859         exit 0
22860     fi
22861     $rm -f Cppsym.got
22862     exit 1
22863 else
22864     $tr " " "$trnl" | ./Cppsym.try
22865     exit 0
22866 fi
22867 EOSH
22868 chmod +x Cppsym
22869 $eunicefix Cppsym
22870 cat <<EOSH > Cppsym.try
22871 $startsh
22872 cat <<'EOCP' > try.c
22873 #include <stdio.h>
22874 #if cpp_stuff == 1
22875 #define STRINGIFY(a)    "a"
22876 #endif
22877 #if cpp_stuff == 42
22878 #define StGiFy(a)  #a
22879 #define STRINGIFY(a)    StGiFy(a)
22880 #endif
22881 #if $cpp_stuff != 1 && $cpp_stuff != 42
22882 #   include "Bletch: How does this C preprocessor stringify macros?"
22883 #endif
22884 int main() {
22885 EOCP
22886 $awk \\
22887 EOSH
22888 cat <<'EOSH' >> Cppsym.try
22889 'length($1) > 0 {
22890     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22891     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22892     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22893     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22894 }' >> try.c
22895 echo 'return 0;}' >> try.c
22896 EOSH
22897 cat <<EOSH >> Cppsym.try
22898 ccflags="$ccflags"
22899 case "$osname-$gccversion" in
22900 irix-) ccflags="\$ccflags -woff 1178" ;;
22901 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22902 esac
22903 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
22904 EOSH
22905 chmod +x Cppsym.try
22906 $eunicefix Cppsym.try
22907 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22908 : Add in any Linux cpp "predefined macros":
22909 case "$osname::$gccversion" in
22910   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22911     tHdrH=_tmpHdr
22912     rm -f $tHdrH'.h' $tHdrH
22913     touch $tHdrH'.h'
22914     # Filter out macro arguments, such as Linux's __INT8_C(c)
22915     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22916        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22917        if [ -s $tHdrH'_cppsym.real' ]; then
22918           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22919        fi
22920     fi
22921     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22922   ;;
22923 esac
22924 : now check the C compiler for additional symbols
22925 postprocess_cc_v=''
22926 case "$osname" in
22927 aix) postprocess_cc_v="|$tr , ' '" ;;
22928 esac
22929 $cat >ccsym <<EOS
22930 $startsh
22931 $cat >tmp.c <<EOF
22932 extern int foo;
22933 EOF
22934 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22935 do
22936         case "\$i" in
22937         -D*) echo "\$i" | $sed 's/^-D//';;
22938         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22939         esac
22940 done
22941 $rm_try
22942 EOS
22943 postprocess_cc_v=''
22944 chmod +x ccsym
22945 $eunicefix ccsym
22946 ./ccsym > ccsym1.raw
22947 if $test -s ccsym1.raw; then
22948     $sort ccsym1.raw | $uniq >ccsym.raw
22949 else
22950     mv ccsym1.raw ccsym.raw
22951 fi
22952
22953 $awk '/\=/ { print $0; next }
22954         { print $0"=1" }' ccsym.raw >ccsym.list
22955 $comm -13 Cppsym.true ccsym.list >ccsym.own
22956 $comm -12 Cppsym.true ccsym.list >ccsym.com
22957 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22958 also=''
22959 if $test -z ccsym.raw; then
22960         echo "Your C compiler doesn't seem to define any symbols!" >&4
22961         echo " "
22962         echo "However, your C preprocessor defines the following symbols:"
22963         $cat Cppsym.true
22964         ccsymbols=''
22965         cppsymbols=`$cat Cppsym.true`
22966         cppsymbols=`echo $cppsymbols`
22967         cppccsymbols="$cppsymbols"
22968 else
22969         if $test -s ccsym.com; then
22970                 echo "Your C compiler and pre-processor define these symbols:"
22971                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22972                 also='also '
22973                 symbols='ones'
22974                 cppccsymbols=`$cat ccsym.com`
22975                 cppccsymbols=`echo $cppccsymbols`
22976                 $test "$silent" || sleep 1
22977         fi
22978         if $test -s ccsym.cpp; then
22979                 $test "$also" && echo " "
22980                 echo "Your C pre-processor ${also}defines the following symbols:"
22981                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22982                 also='further '
22983                 cppsymbols=`$cat ccsym.cpp`
22984                 cppsymbols=`echo $cppsymbols`
22985                 $test "$silent" || sleep 1
22986         fi
22987         if $test -s ccsym.own; then
22988                 $test "$also" && echo " "
22989                 echo "Your C compiler ${also}defines the following cpp symbols:"
22990                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22991                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22992                 ccsymbols=`$cat ccsym.own`
22993                 ccsymbols=`echo $ccsymbols`
22994                 $test "$silent" || sleep 1
22995         fi
22996 fi
22997
22998 : add -D_FORTIFY_SOURCE if feasible and not already there
22999 case "$gccversion" in
23000 [456789].*)     case "$optimize$ccflags" in
23001         *-O*)   case "$ccflags$cppsymbols" in
23002                 *_FORTIFY_SOURCE=*) # Don't add it again.
23003                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23004                         ;;
23005                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23006                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23007                         ;;
23008                 esac
23009                 ;;
23010         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23011                 ;;
23012         esac
23013         ;;
23014 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23015         ;;
23016 esac
23017
23018 : script used to emit important warnings
23019 cat >warn <<EOS
23020 $startsh
23021 if test \$# -gt 0; then
23022         echo "\$@" >msg
23023 else
23024         cat >msg
23025 fi
23026 echo "*** WARNING:" >&4
23027 sed -e 's/^/*** /' <msg >&4
23028 echo "*** " >&4
23029 cat msg >>config.msg
23030 echo " " >>config.msg
23031 rm -f msg
23032 EOS
23033 chmod +x warn
23034 $eunicefix warn
23035
23036 : see if this is a termio system
23037 val="$undef"
23038 val2="$undef"
23039 val3="$undef"
23040 if $test `./findhdr termios.h`; then
23041     set tcsetattr i_termios
23042     eval $inlibc
23043     val3="$i_termios"
23044 fi
23045 echo " "
23046 case "$val3" in
23047     "$define") echo "You have POSIX termios.h... good!" >&4;;
23048     *)  if ./Cppsym pyr; then
23049             case "`$run /bin/universe`" in
23050                 ucb) if $test `./findhdr sgtty.h`; then
23051                         val2="$define"
23052                         echo "<sgtty.h> found." >&4
23053                     else
23054                         echo "System is pyramid with BSD universe."
23055                         ./warn "<sgtty.h> not found--you could have problems."
23056                     fi;;
23057                 *)  if $test `./findhdr termio.h`; then
23058                         val="$define"
23059                         echo "<termio.h> found." >&4
23060                     else
23061                         echo "System is pyramid with USG universe."
23062                         ./warn "<termio.h> not found--you could have problems."
23063                     fi;;
23064             esac
23065         elif ./usg; then
23066             if $test `./findhdr termio.h`; then
23067                 echo "<termio.h> found." >&4
23068                 val="$define"
23069             elif $test `./findhdr sgtty.h`; then
23070                 echo "<sgtty.h> found." >&4
23071                 val2="$define"
23072             else
23073                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23074             fi
23075         else
23076             if $test `./findhdr sgtty.h`; then
23077                 echo "<sgtty.h> found." >&4
23078                 val2="$define"
23079             elif $test `./findhdr termio.h`; then
23080                 echo "<termio.h> found." >&4
23081                 val="$define"
23082             else
23083                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23084             fi
23085         fi;;
23086 esac
23087 set i_termio; eval $setvar
23088 val=$val2; set i_sgtty; eval $setvar
23089 val=$val3; set i_termios; eval $setvar
23090
23091 : see if stdbool is available
23092 : we want a real compile instead of Inhdr because some Solaris systems
23093 : have stdbool.h, but it can only be used if the compiler indicates it
23094 : is sufficiently c99-compliant.
23095 echo " "
23096 $cat >try.c <<EOCP
23097 #include <stdio.h>
23098 #include <stdbool.h>
23099 int func(bool x)
23100 {
23101     return x ? 1 : 0;
23102 }
23103 int main(int argc, char **argv)
23104 {
23105     return func(0);
23106 }
23107 EOCP
23108 set try
23109 if eval $compile; then
23110         echo "<stdbool.h> found." >&4
23111         val="$define"
23112 else
23113         echo "<stdbool.h> NOT found." >&4
23114         val="$undef"
23115 fi
23116 $rm_try
23117 set i_stdbool
23118 eval $setvar
23119
23120 : see if stdint is available
23121 set stdint.h i_stdint
23122 eval $inhdr
23123
23124 : see if sys/access.h is available
23125 set sys/access.h i_sysaccess
23126 eval $inhdr
23127
23128 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23129 set sys/filio.h i_sysfilio
23130 eval $inhdr
23131 echo " "
23132 if $test `./findhdr sys/ioctl.h`; then
23133         val="$define"
23134         echo '<sys/ioctl.h> found.' >&4
23135 else
23136         val="$undef"
23137         if $test $i_sysfilio = "$define"; then
23138             echo '<sys/ioctl.h> NOT found.' >&4
23139         else
23140                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23141                 $test $i_termio = "$define" && xxx="termio.h"
23142                 $test $i_termios = "$define" && xxx="termios.h"
23143 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23144         fi
23145 fi
23146 set i_sysioctl
23147 eval $setvar
23148
23149 : see if socket ioctl defs are in sys/sockio.h
23150 echo " "
23151 xxx=`./findhdr sys/sockio.h`
23152 if $test "$xxx"; then
23153         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23154                 val="$define"
23155                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23156         else
23157                 val="$undef"
23158                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23159         fi
23160 else
23161         val="$undef"
23162         $cat <<EOM
23163 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23164 EOM
23165 fi
23166 set i_syssockio
23167 eval $setvar
23168
23169 : see if this is a syslog.h system
23170 set syslog.h i_syslog
23171 eval $inhdr
23172
23173 : see if this is a sys/mode.h system
23174 set sys/mode.h i_sysmode
23175 eval $inhdr
23176
23177 : see if there is a sys/poll.h file
23178 set sys/poll.h i_syspoll
23179 eval $inhdr
23180
23181 : see if sys/resource.h has to be included
23182 set sys/resource.h i_sysresrc
23183 eval $inhdr
23184
23185 : see if sys/security.h is available
23186 set sys/security.h i_syssecrt
23187 eval $inhdr
23188
23189 : see if this is a sys/statvfs.h system
23190 set sys/statvfs.h i_sysstatvfs
23191 eval $inhdr
23192
23193 : see if this is a sys/un.h system
23194 set sys/un.h i_sysun
23195 eval $inhdr
23196
23197 : see if this is a sys/utsname.h system
23198 set sys/utsname.h i_sysutsname
23199 eval $inhdr
23200
23201 : see if this is a syswait system
23202 set sys/wait.h i_syswait
23203 eval $inhdr
23204
23205 : see if this is a ustat.h system
23206 set ustat.h i_ustat
23207 eval $inhdr
23208
23209 : see if this is an utime system
23210 set utime.h i_utime
23211 eval $inhdr
23212
23213 : see if this is a vfork system
23214 case "$d_vfork" in
23215 "$define")
23216         set vfork.h i_vfork
23217         eval $inhdr
23218         ;;
23219 *)
23220         i_vfork="$undef"
23221         ;;
23222 esac
23223
23224 : see if wchar.h is present
23225 set wchar.h i_wchar
23226 eval $inhdr
23227
23228 : Check extensions
23229 echo " "
23230 echo "Looking for extensions..." >&4
23231 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23232 : contain old or inaccurate or duplicate values.
23233 nonxs_extensions=''
23234 xs_extensions=''
23235 : We do not use find because it might not be available.
23236 : We do not just use MANIFEST because the user may have dropped
23237 : some additional extensions into the source tree and expect them
23238 : to be built.
23239
23240 : Function to recursively find available extensions, ignoring DynaLoader
23241 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23242 : In 5.10.1 and later, extensions are stored in directories
23243 : like File-Glob instead of the older File/Glob/.
23244 find_extensions='
23245     for xxx in *; do
23246         case "$xxx" in
23247             DynaLoader|dynaload) ;;
23248             *)
23249             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23250             case "$this_ext" in
23251                 Scalar/List/Utils) this_ext="List/Util" ;;
23252                 PathTools)         this_ext="Cwd"       ;;
23253             esac;
23254             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23255             if $contains " $this_ext " "$tdir/$$.tmp"; then
23256                 echo >&4;
23257                 echo "Duplicate directories detected for extension $xxx" >&4;
23258                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23259                 case "$knowitall" in
23260                 "") dflt=y;;
23261                 *) dflt=n;;
23262                 esac;
23263                 . ../UU/myread;
23264                 case "$ans" in
23265                 n*|N*) ;;
23266                 *) echo >&4;
23267                     echo "Ok.  Stopping Configure." >&4;
23268                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23269                     exit 1;;
23270                 esac;
23271                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23272             fi;
23273             $ls -1 "$xxx" > "$tdir/$$.tmp";
23274             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23275                 xs_extensions="$xs_extensions $this_ext";
23276             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23277                 xs_extensions="$xs_extensions $this_ext";
23278             elif $test -d "$xxx"; then
23279                 nonxs_extensions="$nonxs_extensions $this_ext";
23280             fi;
23281             $rm -f "$tdir/$$.tmp";
23282             ;;
23283         esac;
23284     done'
23285 tdir=`pwd`
23286 cd "$rsrc/cpan"
23287 set X
23288 shift
23289 eval $find_extensions
23290 cd "$rsrc/dist"
23291 set X
23292 shift
23293 eval $find_extensions
23294 cd "$rsrc/ext"
23295 set X
23296 shift
23297 eval $find_extensions
23298 set X $xs_extensions
23299 shift
23300 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23301 set X $nonxs_extensions
23302 shift
23303 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23304 cd "$tdir"
23305 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23306
23307 : Now see which are supported on this system.
23308 avail_ext=''
23309 for xxx in $xs_extensions ; do
23310         case "$xxx" in
23311         Amiga*)
23312                 case "$osname" in
23313                 amigaos) avail_ext="$avail_ext $xxx" ;;
23314                 esac
23315                 ;;
23316         DB_File|db_file)
23317                 case "$i_db" in
23318                 $define) avail_ext="$avail_ext $xxx" ;;
23319                 esac
23320                 ;;
23321         GDBM_File|gdbm_fil)
23322                 case "$i_gdbm" in
23323                 $define) avail_ext="$avail_ext $xxx" ;;
23324                 esac
23325                 ;;
23326         IPC/SysV|ipc/sysv)
23327                 : XXX Do we need a useipcsysv variable here
23328                 case "${d_msg}${d_sem}${d_shm}" in
23329                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23330                 esac
23331                 ;;
23332         NDBM_File|ndbm_fil)
23333                 case "$d_ndbm" in
23334                 $define)
23335                     case "$osname-$use64bitint" in
23336                     hpux-define)
23337                         case "$libs" in
23338                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23339                         esac
23340                         ;;
23341                     *) avail_ext="$avail_ext $xxx" ;;
23342                     esac
23343                     ;;
23344                 esac
23345                 ;;
23346         ODBM_File|odbm_fil)
23347                 case "${i_dbm}${i_rpcsvcdbm}" in
23348                 *"${define}"*)
23349                     case "$d_cplusplus" in
23350                     define) ;; # delete as a function name will not work
23351                     *)  case "$osname-$use64bitint" in
23352                         hpux-define)
23353                             case "$libs" in
23354                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23355                             esac
23356                             ;;
23357                         *) avail_ext="$avail_ext $xxx" ;;
23358                         esac
23359                         ;;
23360                     esac
23361                     ;;
23362                 esac
23363                 ;;
23364         Opcode|opcode)
23365                 case "$useopcode" in
23366                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23367                 esac
23368                 ;;
23369         POSIX|posix)
23370                 case "$useposix" in
23371                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23372                 esac
23373                 ;;
23374         Socket|socket)
23375                 case "$d_socket" in
23376                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23377                 esac
23378                 ;;
23379         I18N/Langinfo|langinfo)
23380                 case "$uselanginfo" in
23381                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23382                 esac
23383                 ;;
23384         Sys/Syslog|sys/syslog)
23385                 case $osname in
23386                         amigaos) ;; # not really very useful on AmigaOS
23387                         *)
23388                         : XXX syslog requires socket
23389                         case "$d_socket" in
23390                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23391                         esac
23392                         ;;
23393                 esac
23394                 ;;
23395         Thread|thread)
23396                 case "$usethreads" in
23397                 true|$define|y)
23398                         case "$use5005threads" in
23399                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23400                         esac
23401                 esac
23402                 ;;
23403         threads|threads/shared)
23404                 # threads and threads::shared are special cases.
23405                 # To stop people from asking "Perl 5.8.0 was supposed
23406                 # to have this new fancy threads implementation but my
23407                 # perl doesn't have it" and from people trying to
23408                 # (re)install the threads module using CPAN.pm and
23409                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23410                 # the threads.pm and threads/shared.pm will always be
23411                 # there, croaking informatively ("you need to rebuild
23412                 # all of Perl with threads, sorry") when threads haven't
23413                 # been compiled in.
23414                 # --jhi
23415                 avail_ext="$avail_ext $xxx"
23416                 ;;
23417         VMS*)
23418                 ;;
23419         Win32*)
23420                 case "$osname" in
23421                 cygwin) avail_ext="$avail_ext $xxx" ;;
23422                 esac
23423                 ;;
23424         XS/APItest|xs/apitest)
23425                 # This is just for testing.  Skip it unless we have dynamic loading.
23426
23427                 case "$usedl" in
23428                 $define) avail_ext="$avail_ext $xxx" ;;
23429                 esac
23430                 ;;
23431         XS/Typemap|xs/typemap)
23432                 # This is just for testing.  Skip it unless we have dynamic loading.
23433                 case "$usedl" in
23434                 $define) avail_ext="$avail_ext $xxx" ;;
23435                 esac
23436                 ;;
23437         *)      avail_ext="$avail_ext $xxx"
23438                 ;;
23439         esac
23440 done
23441
23442 set X $avail_ext
23443 shift
23444 avail_ext="$*"
23445
23446 case "$onlyextensions" in
23447 '') ;;
23448 *)  keepextensions=''
23449     echo "You have requested that only certain extensions be included..." >&4
23450     for i in $onlyextensions; do
23451         case " $avail_ext " in
23452         *" $i "*)
23453             echo "Keeping extension $i."
23454             keepextensions="$keepextensions $i"
23455             ;;
23456         *) echo "Ignoring extension $i." ;;
23457         esac
23458     done
23459     avail_ext="$keepextensions"
23460     ;;
23461 esac
23462
23463 case "$noextensions" in
23464 '') ;;
23465 *)  keepextensions=''
23466     echo "You have requested that certain extensions be ignored..." >&4
23467     for i in $avail_ext; do
23468         case " $noextensions " in
23469         *" $i "*) echo "Ignoring extension $i." ;;
23470         *) echo "Keeping extension $i.";
23471            keepextensions="$keepextensions $i"
23472            ;;
23473         esac
23474     done
23475     avail_ext="$keepextensions"
23476     ;;
23477 esac
23478
23479 : Now see which nonxs extensions are supported on this system.
23480 : For now assume all are.
23481 nonxs_ext=''
23482 for xxx in $nonxs_extensions ; do
23483         case "$xxx" in
23484         VMS*)
23485                 ;;
23486         *)      nonxs_ext="$nonxs_ext $xxx"
23487                 ;;
23488         esac
23489 done
23490
23491 set X $nonxs_ext
23492 shift
23493 nonxs_ext="$*"
23494
23495 case $usedl in
23496 $define)
23497         $cat <<EOM
23498 A number of extensions are supplied with $package.  You may choose to
23499 compile these extensions for dynamic loading (the default), compile
23500 them into the $package executable (static loading), or not include
23501 them at all.  Answer "none" to include no extensions.
23502 Note that DynaLoader is always built and need not be mentioned here.
23503
23504 EOM
23505         case "$dynamic_ext" in
23506         '')
23507                 : Exclude those listed in static_ext
23508                 dflt=''
23509                 for xxx in $avail_ext; do
23510                         case " $static_ext " in
23511                         *" $xxx "*) ;;
23512                         *) dflt="$dflt $xxx" ;;
23513                         esac
23514                 done
23515                 set X $dflt
23516                 shift
23517                 dflt="$*"
23518                 ;;
23519         *)      dflt="$dynamic_ext"
23520                 # Perhaps we are reusing an old out-of-date config.sh.
23521                 case "$hint" in
23522                 previous)
23523                         if test X"$dynamic_ext" != X"$avail_ext"; then
23524                                 $cat <<EOM
23525 NOTICE:  Your previous config.sh list may be incorrect.
23526 The extensions now available to you are
23527         ${avail_ext}
23528 but the default list from your previous config.sh is
23529         ${dynamic_ext}
23530
23531 EOM
23532                         fi
23533                         ;;
23534                 esac
23535                 ;;
23536         esac
23537         case "$dflt" in
23538         '')     dflt=none;;
23539         esac
23540         rp="What extensions do you wish to load dynamically?"
23541         . ./myread
23542         case "$ans" in
23543         none) dynamic_ext=' ' ;;
23544         *) dynamic_ext="$ans" ;;
23545         esac
23546
23547         case "$static_ext" in
23548         '')
23549                 : Exclude those already listed in dynamic linking
23550                 dflt=''
23551                 for xxx in $avail_ext; do
23552                         case " $dynamic_ext " in
23553                         *" $xxx "*) ;;
23554                         *) dflt="$dflt $xxx" ;;
23555                         esac
23556                 done
23557                 set X $dflt
23558                 shift
23559                 dflt="$*"
23560                 ;;
23561         *)  dflt="$static_ext"
23562                 ;;
23563         esac
23564
23565         case "$dflt" in
23566         '')     dflt=none;;
23567         esac
23568         rp="What extensions do you wish to load statically?"
23569         . ./myread
23570         case "$ans" in
23571         none) static_ext=' ' ;;
23572         *) static_ext="$ans" ;;
23573         esac
23574         ;;
23575 *)
23576         $cat <<EOM
23577 A number of extensions are supplied with $package.  Answer "none"
23578 to include no extensions.
23579 Note that DynaLoader is always built and need not be mentioned here.
23580
23581 EOM
23582         case "$static_ext" in
23583         '') dflt="$avail_ext" ;;
23584         *)      dflt="$static_ext"
23585                 # Perhaps we are reusing an old out-of-date config.sh.
23586                 case "$hint" in
23587                 previous)
23588                         if test X"$static_ext" != X"$avail_ext"; then
23589                                 $cat <<EOM
23590 NOTICE:  Your previous config.sh list may be incorrect.
23591 The extensions now available to you are
23592         ${avail_ext}
23593 but the default list from your previous config.sh is
23594         ${static_ext}
23595
23596 EOM
23597                         fi
23598                         ;;
23599                 esac
23600                 ;;
23601         esac
23602         : Exclude those that are not xs extensions
23603         case "$dflt" in
23604         '')     dflt=none;;
23605         esac
23606         rp="What extensions do you wish to include?"
23607         . ./myread
23608         case "$ans" in
23609         none) static_ext=' ' ;;
23610         *) static_ext="$ans" ;;
23611         esac
23612         ;;
23613 esac
23614 #
23615 # Encode is a special case.  If we are building Encode as a static
23616 # extension, we need to explicitly list its subextensions as well.
23617 # For other nested extensions, this is handled automatically by
23618 # the appropriate Makefile.PL.
23619 case " $static_ext " in
23620         *" Encode "*) # Add the subextensions of Encode
23621         cd "$rsrc/cpan"
23622         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23623                 static_ext="$static_ext Encode/$xxx"
23624                 known_extensions="$known_extensions Encode/$xxx"
23625         done
23626         cd "$tdir"
23627         ;;
23628 esac
23629
23630 set X $dynamic_ext $static_ext $nonxs_ext
23631 shift
23632 extensions="$*"
23633
23634 # Sanity check:  We require an extension suitable for use with
23635 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23636 # should show up as failures in the test suite, but it's helpful to
23637 # catch them now.) The 'extensions' list is normally sorted
23638 # alphabetically, so we need to accept either
23639 #    DB_File ... Fcntl ... IO  ....
23640 # or something like
23641 #    Fcntl ... NDBM_File ... IO  ....
23642 case " $extensions"  in
23643 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23644 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23645 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23646 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23647    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23648    ;;
23649 esac
23650
23651 : Remove libraries needed only for extensions
23652 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23653 : The exception is SunOS 4.x, which needs them.
23654 case "${osname}X${osvers}" in
23655 sunos*X4*)
23656     perllibs="$libs"
23657     ;;
23658 *) case "$usedl" in
23659     $define|true|[yY]*)
23660             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23661             shift
23662             perllibs="$*"
23663             ;;
23664     *)  perllibs="$libs"
23665             ;;
23666     esac
23667     ;;
23668 esac
23669
23670 : Remove build directory name from cppstdin so it can be used from
23671 : either the present location or the final installed location.
23672 echo " "
23673 : Get out of the UU directory to get correct path name.
23674 cd ..
23675 case "$cppstdin" in
23676 `pwd`/cppstdin)
23677         echo "Stripping down cppstdin path name"
23678         cppstdin=cppstdin
23679         ;;
23680 esac
23681 cd UU
23682
23683 : end of configuration questions
23684 echo " "
23685 echo "End of configuration questions."
23686 echo " "
23687
23688 : back to where it started
23689 if test -d ../UU; then
23690         cd ..
23691 fi
23692
23693 : configuration may be unconditionally patched via a 'config.arch' file
23694 if $test -f config.arch; then
23695         echo "I see a config.arch file, loading it." >&4
23696         . ./config.arch
23697 fi
23698
23699 : configuration may be patched via a 'config.over' file
23700 if $test -f config.over; then
23701         echo " "
23702         dflt=y
23703         rp='I see a config.over file.  Do you wish to load it?'
23704         . UU/myread
23705         case "$ans" in
23706         n*) echo "OK, I'll ignore it.";;
23707         *)      . ./config.over
23708                 echo "Configuration override changes have been loaded."
23709                 ;;
23710         esac
23711 fi
23712
23713 : in case they want portability, strip down executable paths
23714 case "$d_portable" in
23715 "$define")
23716         echo " "
23717         echo "Stripping down executable paths..." >&4
23718         for file in $loclist $trylist; do
23719                 eval temp=\$$file
23720                 eval $file=`basename $temp`
23721         done
23722         ;;
23723 esac
23724
23725 : create config.sh file
23726 echo " "
23727 echo "Creating config.sh..." >&4
23728 $spitshell <<EOT >config.sh
23729 $startsh
23730 #
23731 # This file was produced by running the Configure script. It holds all the
23732 # definitions figured out by Configure. Should you modify one of these values,
23733 # do not forget to propagate your changes by running "Configure -der". You may
23734 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23735 #
23736
23737 # Package name      : $package
23738 # Source directory  : $src
23739 # Configuration time: $cf_time
23740 # Configured by     : $cf_by
23741 # Target system     : $myuname
23742
23743 EOT
23744 : Add in command line options if available
23745 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23746
23747 $spitshell <<EOT >>config.sh
23748
23749 Author='$Author'
23750 Date='$Date'
23751 Header='$Header'
23752 Id='$Id'
23753 Locker='$Locker'
23754 Log='$Log'
23755 RCSfile='$RCSfile'
23756 Revision='$Revision'
23757 Source='$Source'
23758 State='$State'
23759 _a='$_a'
23760 _exe='$_exe'
23761 _o='$_o'
23762 afs='$afs'
23763 afsroot='$afsroot'
23764 alignbytes='$alignbytes'
23765 aphostname='$aphostname'
23766 api_revision='$api_revision'
23767 api_subversion='$api_subversion'
23768 api_version='$api_version'
23769 api_versionstring='$api_versionstring'
23770 ar='$ar'
23771 archlib='$archlib'
23772 archlibexp='$archlibexp'
23773 archname64='$archname64'
23774 archname='$archname'
23775 archobjs='$archobjs'
23776 asctime_r_proto='$asctime_r_proto'
23777 awk='$awk'
23778 baserev='$baserev'
23779 bash='$bash'
23780 bin='$bin'
23781 bin_ELF='$bin_ELF'
23782 binexp='$binexp'
23783 bison='$bison'
23784 byacc='$byacc'
23785 byteorder='$byteorder'
23786 c='$c'
23787 castflags='$castflags'
23788 cat='$cat'
23789 cc='$cc'
23790 cccdlflags='$cccdlflags'
23791 ccdlflags='$ccdlflags'
23792 ccflags='$ccflags'
23793 ccflags_uselargefiles='$ccflags_uselargefiles'
23794 ccname='$ccname'
23795 ccsymbols='$ccsymbols'
23796 ccversion='$ccversion'
23797 cf_by='$cf_by'
23798 cf_email='$cf_email'
23799 cf_time='$cf_time'
23800 charbits='$charbits'
23801 charsize='$charsize'
23802 chgrp='$chgrp'
23803 chmod='$chmod'
23804 chown='$chown'
23805 clocktype='$clocktype'
23806 comm='$comm'
23807 compress='$compress'
23808 contains='$contains'
23809 cp='$cp'
23810 cpio='$cpio'
23811 cpp='$cpp'
23812 cpp_stuff='$cpp_stuff'
23813 cppccsymbols='$cppccsymbols'
23814 cppflags='$cppflags'
23815 cpplast='$cpplast'
23816 cppminus='$cppminus'
23817 cpprun='$cpprun'
23818 cppstdin='$cppstdin'
23819 cppsymbols='$cppsymbols'
23820 crypt_r_proto='$crypt_r_proto'
23821 cryptlib='$cryptlib'
23822 csh='$csh'
23823 ctermid_r_proto='$ctermid_r_proto'
23824 ctime_r_proto='$ctime_r_proto'
23825 d_Gconvert='$d_Gconvert'
23826 d_PRIEUldbl='$d_PRIEUldbl'
23827 d_PRIFUldbl='$d_PRIFUldbl'
23828 d_PRIGUldbl='$d_PRIGUldbl'
23829 d_PRIXU64='$d_PRIXU64'
23830 d_PRId64='$d_PRId64'
23831 d_PRIeldbl='$d_PRIeldbl'
23832 d_PRIfldbl='$d_PRIfldbl'
23833 d_PRIgldbl='$d_PRIgldbl'
23834 d_PRIi64='$d_PRIi64'
23835 d_PRIo64='$d_PRIo64'
23836 d_PRIu64='$d_PRIu64'
23837 d_PRIx64='$d_PRIx64'
23838 d_SCNfldbl='$d_SCNfldbl'
23839 d__fwalk='$d__fwalk'
23840 d_accept4='$d_accept4'
23841 d_access='$d_access'
23842 d_accessx='$d_accessx'
23843 d_acosh='$d_acosh'
23844 d_aintl='$d_aintl'
23845 d_alarm='$d_alarm'
23846 d_archlib='$d_archlib'
23847 d_asctime64='$d_asctime64'
23848 d_asctime_r='$d_asctime_r'
23849 d_asinh='$d_asinh'
23850 d_atanh='$d_atanh'
23851 d_atolf='$d_atolf'
23852 d_atoll='$d_atoll'
23853 d_attribute_deprecated='$d_attribute_deprecated'
23854 d_attribute_format='$d_attribute_format'
23855 d_attribute_malloc='$d_attribute_malloc'
23856 d_attribute_nonnull='$d_attribute_nonnull'
23857 d_attribute_noreturn='$d_attribute_noreturn'
23858 d_attribute_pure='$d_attribute_pure'
23859 d_attribute_unused='$d_attribute_unused'
23860 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23861 d_backtrace='$d_backtrace'
23862 d_bsd='$d_bsd'
23863 d_bsdgetpgrp='$d_bsdgetpgrp'
23864 d_bsdsetpgrp='$d_bsdsetpgrp'
23865 d_builtin_add_overflow='$d_builtin_add_overflow'
23866 d_builtin_choose_expr='$d_builtin_choose_expr'
23867 d_builtin_expect='$d_builtin_expect'
23868 d_builtin_mul_overflow='$d_builtin_mul_overflow'
23869 d_builtin_sub_overflow='$d_builtin_sub_overflow'
23870 d_c99_variadic_macros='$d_c99_variadic_macros'
23871 d_casti32='$d_casti32'
23872 d_castneg='$d_castneg'
23873 d_cbrt='$d_cbrt'
23874 d_chown='$d_chown'
23875 d_chroot='$d_chroot'
23876 d_chsize='$d_chsize'
23877 d_class='$d_class'
23878 d_clearenv='$d_clearenv'
23879 d_closedir='$d_closedir'
23880 d_cmsghdr_s='$d_cmsghdr_s'
23881 d_copysign='$d_copysign'
23882 d_copysignl='$d_copysignl'
23883 d_cplusplus='$d_cplusplus'
23884 d_crypt='$d_crypt'
23885 d_crypt_r='$d_crypt_r'
23886 d_csh='$d_csh'
23887 d_ctermid='$d_ctermid'
23888 d_ctermid_r='$d_ctermid_r'
23889 d_ctime64='$d_ctime64'
23890 d_ctime_r='$d_ctime_r'
23891 d_cuserid='$d_cuserid'
23892 d_dbminitproto='$d_dbminitproto'
23893 d_difftime64='$d_difftime64'
23894 d_difftime='$d_difftime'
23895 d_dir_dd_fd='$d_dir_dd_fd'
23896 d_dirfd='$d_dirfd'
23897 d_dirnamlen='$d_dirnamlen'
23898 d_dladdr='$d_dladdr'
23899 d_dlerror='$d_dlerror'
23900 d_dlopen='$d_dlopen'
23901 d_dlsymun='$d_dlsymun'
23902 d_dosuid='$d_dosuid'
23903 d_double_has_inf='$d_double_has_inf'
23904 d_double_has_nan='$d_double_has_nan'
23905 d_double_has_negative_zero='$d_double_has_negative_zero'
23906 d_double_has_subnormals='$d_double_has_subnormals'
23907 d_double_style_cray='$d_double_style_cray'
23908 d_double_style_ibm='$d_double_style_ibm'
23909 d_double_style_ieee='$d_double_style_ieee'
23910 d_double_style_vax='$d_double_style_vax'
23911 d_drand48_r='$d_drand48_r'
23912 d_drand48proto='$d_drand48proto'
23913 d_dup2='$d_dup2'
23914 d_dup3='$d_dup3'
23915 d_duplocale='$d_duplocale'
23916 d_eaccess='$d_eaccess'
23917 d_endgrent='$d_endgrent'
23918 d_endgrent_r='$d_endgrent_r'
23919 d_endhent='$d_endhent'
23920 d_endhostent_r='$d_endhostent_r'
23921 d_endnent='$d_endnent'
23922 d_endnetent_r='$d_endnetent_r'
23923 d_endpent='$d_endpent'
23924 d_endprotoent_r='$d_endprotoent_r'
23925 d_endpwent='$d_endpwent'
23926 d_endpwent_r='$d_endpwent_r'
23927 d_endsent='$d_endsent'
23928 d_endservent_r='$d_endservent_r'
23929 d_eofnblk='$d_eofnblk'
23930 d_erf='$d_erf'
23931 d_erfc='$d_erfc'
23932 d_eunice='$d_eunice'
23933 d_exp2='$d_exp2'
23934 d_expm1='$d_expm1'
23935 d_faststdio='$d_faststdio'
23936 d_fchdir='$d_fchdir'
23937 d_fchmod='$d_fchmod'
23938 d_fchmodat='$d_fchmodat'
23939 d_fchown='$d_fchown'
23940 d_fcntl='$d_fcntl'
23941 d_fcntl_can_lock='$d_fcntl_can_lock'
23942 d_fd_macros='$d_fd_macros'
23943 d_fd_set='$d_fd_set'
23944 d_fdclose='$d_fdclose'
23945 d_fdim='$d_fdim'
23946 d_fds_bits='$d_fds_bits'
23947 d_fegetround='$d_fegetround'
23948 d_fgetpos='$d_fgetpos'
23949 d_finite='$d_finite'
23950 d_finitel='$d_finitel'
23951 d_flexfnam='$d_flexfnam'
23952 d_flock='$d_flock'
23953 d_flockproto='$d_flockproto'
23954 d_fma='$d_fma'
23955 d_fmax='$d_fmax'
23956 d_fmin='$d_fmin'
23957 d_fork='$d_fork'
23958 d_fp_class='$d_fp_class'
23959 d_fp_classify='$d_fp_classify'
23960 d_fp_classl='$d_fp_classl'
23961 d_fpathconf='$d_fpathconf'
23962 d_fpclass='$d_fpclass'
23963 d_fpclassify='$d_fpclassify'
23964 d_fpclassl='$d_fpclassl'
23965 d_fpgetround='$d_fpgetround'
23966 d_fpos64_t='$d_fpos64_t'
23967 d_freelocale='$d_freelocale'
23968 d_frexpl='$d_frexpl'
23969 d_fs_data_s='$d_fs_data_s'
23970 d_fseeko='$d_fseeko'
23971 d_fsetpos='$d_fsetpos'
23972 d_fstatfs='$d_fstatfs'
23973 d_fstatvfs='$d_fstatvfs'
23974 d_fsync='$d_fsync'
23975 d_ftello='$d_ftello'
23976 d_ftime='$d_ftime'
23977 d_futimes='$d_futimes'
23978 d_gai_strerror='$d_gai_strerror'
23979 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23980 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23981 d_getaddrinfo='$d_getaddrinfo'
23982 d_getcwd='$d_getcwd'
23983 d_getespwnam='$d_getespwnam'
23984 d_getfsstat='$d_getfsstat'
23985 d_getgrent='$d_getgrent'
23986 d_getgrent_r='$d_getgrent_r'
23987 d_getgrgid_r='$d_getgrgid_r'
23988 d_getgrnam_r='$d_getgrnam_r'
23989 d_getgrps='$d_getgrps'
23990 d_gethbyaddr='$d_gethbyaddr'
23991 d_gethbyname='$d_gethbyname'
23992 d_gethent='$d_gethent'
23993 d_gethname='$d_gethname'
23994 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23995 d_gethostbyname_r='$d_gethostbyname_r'
23996 d_gethostent_r='$d_gethostent_r'
23997 d_gethostprotos='$d_gethostprotos'
23998 d_getitimer='$d_getitimer'
23999 d_getlogin='$d_getlogin'
24000 d_getlogin_r='$d_getlogin_r'
24001 d_getmnt='$d_getmnt'
24002 d_getmntent='$d_getmntent'
24003 d_getnameinfo='$d_getnameinfo'
24004 d_getnbyaddr='$d_getnbyaddr'
24005 d_getnbyname='$d_getnbyname'
24006 d_getnent='$d_getnent'
24007 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24008 d_getnetbyname_r='$d_getnetbyname_r'
24009 d_getnetent_r='$d_getnetent_r'
24010 d_getnetprotos='$d_getnetprotos'
24011 d_getpagsz='$d_getpagsz'
24012 d_getpbyname='$d_getpbyname'
24013 d_getpbynumber='$d_getpbynumber'
24014 d_getpent='$d_getpent'
24015 d_getpgid='$d_getpgid'
24016 d_getpgrp2='$d_getpgrp2'
24017 d_getpgrp='$d_getpgrp'
24018 d_getppid='$d_getppid'
24019 d_getprior='$d_getprior'
24020 d_getprotobyname_r='$d_getprotobyname_r'
24021 d_getprotobynumber_r='$d_getprotobynumber_r'
24022 d_getprotoent_r='$d_getprotoent_r'
24023 d_getprotoprotos='$d_getprotoprotos'
24024 d_getprpwnam='$d_getprpwnam'
24025 d_getpwent='$d_getpwent'
24026 d_getpwent_r='$d_getpwent_r'
24027 d_getpwnam_r='$d_getpwnam_r'
24028 d_getpwuid_r='$d_getpwuid_r'
24029 d_getsbyname='$d_getsbyname'
24030 d_getsbyport='$d_getsbyport'
24031 d_getsent='$d_getsent'
24032 d_getservbyname_r='$d_getservbyname_r'
24033 d_getservbyport_r='$d_getservbyport_r'
24034 d_getservent_r='$d_getservent_r'
24035 d_getservprotos='$d_getservprotos'
24036 d_getspnam='$d_getspnam'
24037 d_getspnam_r='$d_getspnam_r'
24038 d_gettimeod='$d_gettimeod'
24039 d_gmtime64='$d_gmtime64'
24040 d_gmtime_r='$d_gmtime_r'
24041 d_gnulibc='$d_gnulibc'
24042 d_grpasswd='$d_grpasswd'
24043 d_hasmntopt='$d_hasmntopt'
24044 d_htonl='$d_htonl'
24045 d_hypot='$d_hypot'
24046 d_ilogb='$d_ilogb'
24047 d_ilogbl='$d_ilogbl'
24048 d_inc_version_list='$d_inc_version_list'
24049 d_inetaton='$d_inetaton'
24050 d_inetntop='$d_inetntop'
24051 d_inetpton='$d_inetpton'
24052 d_int64_t='$d_int64_t'
24053 d_ip_mreq='$d_ip_mreq'
24054 d_ip_mreq_source='$d_ip_mreq_source'
24055 d_ipv6_mreq='$d_ipv6_mreq'
24056 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24057 d_isascii='$d_isascii'
24058 d_isblank='$d_isblank'
24059 d_isfinite='$d_isfinite'
24060 d_isfinitel='$d_isfinitel'
24061 d_isinf='$d_isinf'
24062 d_isinfl='$d_isinfl'
24063 d_isless='$d_isless'
24064 d_isnan='$d_isnan'
24065 d_isnanl='$d_isnanl'
24066 d_isnormal='$d_isnormal'
24067 d_j0='$d_j0'
24068 d_j0l='$d_j0l'
24069 d_killpg='$d_killpg'
24070 d_lc_monetary_2008='$d_lc_monetary_2008'
24071 d_lchown='$d_lchown'
24072 d_ldbl_dig='$d_ldbl_dig'
24073 d_ldexpl='$d_ldexpl'
24074 d_lgamma='$d_lgamma'
24075 d_lgamma_r='$d_lgamma_r'
24076 d_libm_lib_version='$d_libm_lib_version'
24077 d_libname_unique='$d_libname_unique'
24078 d_link='$d_link'
24079 d_linkat='$d_linkat'
24080 d_llrint='$d_llrint'
24081 d_llrintl='$d_llrintl'
24082 d_llround='$d_llround'
24083 d_llroundl='$d_llroundl'
24084 d_localeconv_l='$d_localeconv_l'
24085 d_localtime64='$d_localtime64'
24086 d_localtime_r='$d_localtime_r'
24087 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24088 d_locconv='$d_locconv'
24089 d_lockf='$d_lockf'
24090 d_log1p='$d_log1p'
24091 d_log2='$d_log2'
24092 d_logb='$d_logb'
24093 d_long_double_style_ieee='$d_long_double_style_ieee'
24094 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24095 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24096 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24097 d_long_double_style_vax='$d_long_double_style_vax'
24098 d_longdbl='$d_longdbl'
24099 d_longlong='$d_longlong'
24100 d_lrint='$d_lrint'
24101 d_lrintl='$d_lrintl'
24102 d_lround='$d_lround'
24103 d_lroundl='$d_lroundl'
24104 d_lseekproto='$d_lseekproto'
24105 d_lstat='$d_lstat'
24106 d_madvise='$d_madvise'
24107 d_malloc_good_size='$d_malloc_good_size'
24108 d_malloc_size='$d_malloc_size'
24109 d_mblen='$d_mblen'
24110 d_mbrlen='$d_mbrlen'
24111 d_mbrtowc='$d_mbrtowc'
24112 d_mbstowcs='$d_mbstowcs'
24113 d_mbtowc='$d_mbtowc'
24114 d_memmem='$d_memmem'
24115 d_memrchr='$d_memrchr'
24116 d_mkdir='$d_mkdir'
24117 d_mkdtemp='$d_mkdtemp'
24118 d_mkfifo='$d_mkfifo'
24119 d_mkostemp='$d_mkostemp'
24120 d_mkstemp='$d_mkstemp'
24121 d_mkstemps='$d_mkstemps'
24122 d_mktime64='$d_mktime64'
24123 d_mktime='$d_mktime'
24124 d_mmap='$d_mmap'
24125 d_modfl='$d_modfl'
24126 d_modflproto='$d_modflproto'
24127 d_mprotect='$d_mprotect'
24128 d_msg='$d_msg'
24129 d_msg_ctrunc='$d_msg_ctrunc'
24130 d_msg_dontroute='$d_msg_dontroute'
24131 d_msg_oob='$d_msg_oob'
24132 d_msg_peek='$d_msg_peek'
24133 d_msg_proxy='$d_msg_proxy'
24134 d_msgctl='$d_msgctl'
24135 d_msgget='$d_msgget'
24136 d_msghdr_s='$d_msghdr_s'
24137 d_msgrcv='$d_msgrcv'
24138 d_msgsnd='$d_msgsnd'
24139 d_msync='$d_msync'
24140 d_munmap='$d_munmap'
24141 d_mymalloc='$d_mymalloc'
24142 d_nan='$d_nan'
24143 d_nanosleep='$d_nanosleep'
24144 d_ndbm='$d_ndbm'
24145 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24146 d_nearbyint='$d_nearbyint'
24147 d_newlocale='$d_newlocale'
24148 d_nextafter='$d_nextafter'
24149 d_nexttoward='$d_nexttoward'
24150 d_nice='$d_nice'
24151 d_nl_langinfo='$d_nl_langinfo'
24152 d_nv_preserves_uv='$d_nv_preserves_uv'
24153 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24154 d_off64_t='$d_off64_t'
24155 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24156 d_oldpthreads='$d_oldpthreads'
24157 d_oldsock='$d_oldsock'
24158 d_open3='$d_open3'
24159 d_openat='$d_openat'
24160 d_pathconf='$d_pathconf'
24161 d_pause='$d_pause'
24162 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24163 d_phostname='$d_phostname'
24164 d_pipe2='$d_pipe2'
24165 d_pipe='$d_pipe'
24166 d_poll='$d_poll'
24167 d_portable='$d_portable'
24168 d_prctl='$d_prctl'
24169 d_prctl_set_name='$d_prctl_set_name'
24170 d_printf_format_null='$d_printf_format_null'
24171 d_procselfexe='$d_procselfexe'
24172 d_pseudofork='$d_pseudofork'
24173 d_pthread_atfork='$d_pthread_atfork'
24174 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24175 d_pthread_yield='$d_pthread_yield'
24176 d_ptrdiff_t='$d_ptrdiff_t'
24177 d_pwage='$d_pwage'
24178 d_pwchange='$d_pwchange'
24179 d_pwclass='$d_pwclass'
24180 d_pwcomment='$d_pwcomment'
24181 d_pwexpire='$d_pwexpire'
24182 d_pwgecos='$d_pwgecos'
24183 d_pwpasswd='$d_pwpasswd'
24184 d_pwquota='$d_pwquota'
24185 d_qgcvt='$d_qgcvt'
24186 d_quad='$d_quad'
24187 d_querylocale='$d_querylocale'
24188 d_random_r='$d_random_r'
24189 d_re_comp='$d_re_comp'
24190 d_readdir64_r='$d_readdir64_r'
24191 d_readdir='$d_readdir'
24192 d_readdir_r='$d_readdir_r'
24193 d_readlink='$d_readlink'
24194 d_readv='$d_readv'
24195 d_recvmsg='$d_recvmsg'
24196 d_regcmp='$d_regcmp'
24197 d_regcomp='$d_regcomp'
24198 d_remainder='$d_remainder'
24199 d_remquo='$d_remquo'
24200 d_rename='$d_rename'
24201 d_renameat='$d_renameat'
24202 d_rewinddir='$d_rewinddir'
24203 d_rint='$d_rint'
24204 d_rmdir='$d_rmdir'
24205 d_round='$d_round'
24206 d_sbrkproto='$d_sbrkproto'
24207 d_scalbn='$d_scalbn'
24208 d_scalbnl='$d_scalbnl'
24209 d_sched_yield='$d_sched_yield'
24210 d_scm_rights='$d_scm_rights'
24211 d_seekdir='$d_seekdir'
24212 d_select='$d_select'
24213 d_sem='$d_sem'
24214 d_semctl='$d_semctl'
24215 d_semctl_semid_ds='$d_semctl_semid_ds'
24216 d_semctl_semun='$d_semctl_semun'
24217 d_semget='$d_semget'
24218 d_semop='$d_semop'
24219 d_sendmsg='$d_sendmsg'
24220 d_setegid='$d_setegid'
24221 d_seteuid='$d_seteuid'
24222 d_setgrent='$d_setgrent'
24223 d_setgrent_r='$d_setgrent_r'
24224 d_setgrps='$d_setgrps'
24225 d_sethent='$d_sethent'
24226 d_sethostent_r='$d_sethostent_r'
24227 d_setitimer='$d_setitimer'
24228 d_setlinebuf='$d_setlinebuf'
24229 d_setlocale='$d_setlocale'
24230 d_setlocale_r='$d_setlocale_r'
24231 d_setnent='$d_setnent'
24232 d_setnetent_r='$d_setnetent_r'
24233 d_setpent='$d_setpent'
24234 d_setpgid='$d_setpgid'
24235 d_setpgrp2='$d_setpgrp2'
24236 d_setpgrp='$d_setpgrp'
24237 d_setprior='$d_setprior'
24238 d_setproctitle='$d_setproctitle'
24239 d_setprotoent_r='$d_setprotoent_r'
24240 d_setpwent='$d_setpwent'
24241 d_setpwent_r='$d_setpwent_r'
24242 d_setregid='$d_setregid'
24243 d_setresgid='$d_setresgid'
24244 d_setresuid='$d_setresuid'
24245 d_setreuid='$d_setreuid'
24246 d_setrgid='$d_setrgid'
24247 d_setruid='$d_setruid'
24248 d_setsent='$d_setsent'
24249 d_setservent_r='$d_setservent_r'
24250 d_setsid='$d_setsid'
24251 d_setvbuf='$d_setvbuf'
24252 d_shm='$d_shm'
24253 d_shmat='$d_shmat'
24254 d_shmatprototype='$d_shmatprototype'
24255 d_shmctl='$d_shmctl'
24256 d_shmdt='$d_shmdt'
24257 d_shmget='$d_shmget'
24258 d_sigaction='$d_sigaction'
24259 d_siginfo_si_addr='$d_siginfo_si_addr'
24260 d_siginfo_si_band='$d_siginfo_si_band'
24261 d_siginfo_si_errno='$d_siginfo_si_errno'
24262 d_siginfo_si_fd='$d_siginfo_si_fd'
24263 d_siginfo_si_pid='$d_siginfo_si_pid'
24264 d_siginfo_si_status='$d_siginfo_si_status'
24265 d_siginfo_si_uid='$d_siginfo_si_uid'
24266 d_siginfo_si_value='$d_siginfo_si_value'
24267 d_signbit='$d_signbit'
24268 d_sigprocmask='$d_sigprocmask'
24269 d_sigsetjmp='$d_sigsetjmp'
24270 d_sin6_scope_id='$d_sin6_scope_id'
24271 d_sitearch='$d_sitearch'
24272 d_snprintf='$d_snprintf'
24273 d_sockaddr_in6='$d_sockaddr_in6'
24274 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24275 d_sockatmark='$d_sockatmark'
24276 d_sockatmarkproto='$d_sockatmarkproto'
24277 d_socket='$d_socket'
24278 d_socklen_t='$d_socklen_t'
24279 d_sockpair='$d_sockpair'
24280 d_socks5_init='$d_socks5_init'
24281 d_sqrtl='$d_sqrtl'
24282 d_srand48_r='$d_srand48_r'
24283 d_srandom_r='$d_srandom_r'
24284 d_sresgproto='$d_sresgproto'
24285 d_sresuproto='$d_sresuproto'
24286 d_stat='$d_stat'
24287 d_statblks='$d_statblks'
24288 d_statfs_f_flags='$d_statfs_f_flags'
24289 d_statfs_s='$d_statfs_s'
24290 d_static_inline='$d_static_inline'
24291 d_statvfs='$d_statvfs'
24292 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24293 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24294 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24295 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24296 d_stdio_stream_array='$d_stdio_stream_array'
24297 d_stdiobase='$d_stdiobase'
24298 d_stdstdio='$d_stdstdio'
24299 d_strcoll='$d_strcoll'
24300 d_strerror_l='$d_strerror_l'
24301 d_strerror_r='$d_strerror_r'
24302 d_strftime='$d_strftime'
24303 d_strlcat='$d_strlcat'
24304 d_strlcpy='$d_strlcpy'
24305 d_strnlen='$d_strnlen'
24306 d_strtod='$d_strtod'
24307 d_strtod_l='$d_strtod_l'
24308 d_strtol='$d_strtol'
24309 d_strtold='$d_strtold'
24310 d_strtold_l='$d_strtold_l'
24311 d_strtoll='$d_strtoll'
24312 d_strtoq='$d_strtoq'
24313 d_strtoul='$d_strtoul'
24314 d_strtoull='$d_strtoull'
24315 d_strtouq='$d_strtouq'
24316 d_strxfrm='$d_strxfrm'
24317 d_suidsafe='$d_suidsafe'
24318 d_symlink='$d_symlink'
24319 d_syscall='$d_syscall'
24320 d_syscallproto='$d_syscallproto'
24321 d_sysconf='$d_sysconf'
24322 d_sysernlst='$d_sysernlst'
24323 d_syserrlst='$d_syserrlst'
24324 d_system='$d_system'
24325 d_tcgetpgrp='$d_tcgetpgrp'
24326 d_tcsetpgrp='$d_tcsetpgrp'
24327 d_telldir='$d_telldir'
24328 d_telldirproto='$d_telldirproto'
24329 d_tgamma='$d_tgamma'
24330 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24331 d_time='$d_time'
24332 d_timegm='$d_timegm'
24333 d_times='$d_times'
24334 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24335 d_tm_tm_zone='$d_tm_tm_zone'
24336 d_tmpnam_r='$d_tmpnam_r'
24337 d_trunc='$d_trunc'
24338 d_truncate='$d_truncate'
24339 d_truncl='$d_truncl'
24340 d_ttyname_r='$d_ttyname_r'
24341 d_tzname='$d_tzname'
24342 d_u32align='$d_u32align'
24343 d_ualarm='$d_ualarm'
24344 d_umask='$d_umask'
24345 d_uname='$d_uname'
24346 d_union_semun='$d_union_semun'
24347 d_unlinkat='$d_unlinkat'
24348 d_unordered='$d_unordered'
24349 d_unsetenv='$d_unsetenv'
24350 d_uselocale='$d_uselocale'
24351 d_usleep='$d_usleep'
24352 d_usleepproto='$d_usleepproto'
24353 d_ustat='$d_ustat'
24354 d_vendorarch='$d_vendorarch'
24355 d_vendorbin='$d_vendorbin'
24356 d_vendorlib='$d_vendorlib'
24357 d_vendorscript='$d_vendorscript'
24358 d_vfork='$d_vfork'
24359 d_void_closedir='$d_void_closedir'
24360 d_voidsig='$d_voidsig'
24361 d_voidtty='$d_voidtty'
24362 d_vsnprintf='$d_vsnprintf'
24363 d_wait4='$d_wait4'
24364 d_waitpid='$d_waitpid'
24365 d_wcscmp='$d_wcscmp'
24366 d_wcstombs='$d_wcstombs'
24367 d_wcsxfrm='$d_wcsxfrm'
24368 d_wctomb='$d_wctomb'
24369 d_writev='$d_writev'
24370 d_xenix='$d_xenix'
24371 date='$date'
24372 db_hashtype='$db_hashtype'
24373 db_prefixtype='$db_prefixtype'
24374 db_version_major='$db_version_major'
24375 db_version_minor='$db_version_minor'
24376 db_version_patch='$db_version_patch'
24377 default_inc_excludes_dot='$default_inc_excludes_dot'
24378 direntrytype='$direntrytype'
24379 dlext='$dlext'
24380 dlsrc='$dlsrc'
24381 doubleinfbytes='$doubleinfbytes'
24382 doublekind='$doublekind'
24383 doublemantbits='$doublemantbits'
24384 doublenanbytes='$doublenanbytes'
24385 doublesize='$doublesize'
24386 drand01='$drand01'
24387 drand48_r_proto='$drand48_r_proto'
24388 dtrace='$dtrace'
24389 dtraceobject='$dtraceobject'
24390 dtracexnolibs='$dtracexnolibs'
24391 dynamic_ext='$dynamic_ext'
24392 eagain='$eagain'
24393 ebcdic='$ebcdic'
24394 echo='$echo'
24395 egrep='$egrep'
24396 emacs='$emacs'
24397 endgrent_r_proto='$endgrent_r_proto'
24398 endhostent_r_proto='$endhostent_r_proto'
24399 endnetent_r_proto='$endnetent_r_proto'
24400 endprotoent_r_proto='$endprotoent_r_proto'
24401 endpwent_r_proto='$endpwent_r_proto'
24402 endservent_r_proto='$endservent_r_proto'
24403 eunicefix='$eunicefix'
24404 exe_ext='$exe_ext'
24405 expr='$expr'
24406 extensions='$extensions'
24407 extern_C='$extern_C'
24408 extras='$extras'
24409 fflushNULL='$fflushNULL'
24410 fflushall='$fflushall'
24411 find='$find'
24412 firstmakefile='$firstmakefile'
24413 flex='$flex'
24414 fpossize='$fpossize'
24415 fpostype='$fpostype'
24416 freetype='$freetype'
24417 from='$from'
24418 full_ar='$full_ar'
24419 full_csh='$full_csh'
24420 full_sed='$full_sed'
24421 gccansipedantic='$gccansipedantic'
24422 gccosandvers='$gccosandvers'
24423 gccversion='$gccversion'
24424 getgrent_r_proto='$getgrent_r_proto'
24425 getgrgid_r_proto='$getgrgid_r_proto'
24426 getgrnam_r_proto='$getgrnam_r_proto'
24427 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24428 gethostbyname_r_proto='$gethostbyname_r_proto'
24429 gethostent_r_proto='$gethostent_r_proto'
24430 getlogin_r_proto='$getlogin_r_proto'
24431 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24432 getnetbyname_r_proto='$getnetbyname_r_proto'
24433 getnetent_r_proto='$getnetent_r_proto'
24434 getprotobyname_r_proto='$getprotobyname_r_proto'
24435 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24436 getprotoent_r_proto='$getprotoent_r_proto'
24437 getpwent_r_proto='$getpwent_r_proto'
24438 getpwnam_r_proto='$getpwnam_r_proto'
24439 getpwuid_r_proto='$getpwuid_r_proto'
24440 getservbyname_r_proto='$getservbyname_r_proto'
24441 getservbyport_r_proto='$getservbyport_r_proto'
24442 getservent_r_proto='$getservent_r_proto'
24443 getspnam_r_proto='$getspnam_r_proto'
24444 gidformat='$gidformat'
24445 gidsign='$gidsign'
24446 gidsize='$gidsize'
24447 gidtype='$gidtype'
24448 glibpth='$glibpth'
24449 gmake='$gmake'
24450 gmtime_r_proto='$gmtime_r_proto'
24451 gnulibc_version='$gnulibc_version'
24452 grep='$grep'
24453 groupcat='$groupcat'
24454 groupstype='$groupstype'
24455 gzip='$gzip'
24456 h_fcntl='$h_fcntl'
24457 h_sysfile='$h_sysfile'
24458 hint='$hint'
24459 hostcat='$hostcat'
24460 hostgenerate='$hostgenerate'
24461 hostosname='$hostosname'
24462 hostperl='$hostperl'
24463 html1dir='$html1dir'
24464 html1direxp='$html1direxp'
24465 html3dir='$html3dir'
24466 html3direxp='$html3direxp'
24467 i16size='$i16size'
24468 i16type='$i16type'
24469 i32size='$i32size'
24470 i32type='$i32type'
24471 i64size='$i64size'
24472 i64type='$i64type'
24473 i8size='$i8size'
24474 i8type='$i8type'
24475 i_arpainet='$i_arpainet'
24476 i_bfd='$i_bfd'
24477 i_bsdioctl='$i_bsdioctl'
24478 i_crypt='$i_crypt'
24479 i_db='$i_db'
24480 i_dbm='$i_dbm'
24481 i_dirent='$i_dirent'
24482 i_dlfcn='$i_dlfcn'
24483 i_execinfo='$i_execinfo'
24484 i_fcntl='$i_fcntl'
24485 i_fenv='$i_fenv'
24486 i_fp='$i_fp'
24487 i_fp_class='$i_fp_class'
24488 i_gdbm='$i_gdbm'
24489 i_gdbm_ndbm='$i_gdbm_ndbm'
24490 i_gdbmndbm='$i_gdbmndbm'
24491 i_grp='$i_grp'
24492 i_ieeefp='$i_ieeefp'
24493 i_inttypes='$i_inttypes'
24494 i_langinfo='$i_langinfo'
24495 i_libutil='$i_libutil'
24496 i_locale='$i_locale'
24497 i_machcthr='$i_machcthr'
24498 i_malloc='$i_malloc'
24499 i_mallocmalloc='$i_mallocmalloc'
24500 i_mntent='$i_mntent'
24501 i_ndbm='$i_ndbm'
24502 i_netdb='$i_netdb'
24503 i_neterrno='$i_neterrno'
24504 i_netinettcp='$i_netinettcp'
24505 i_niin='$i_niin'
24506 i_poll='$i_poll'
24507 i_prot='$i_prot'
24508 i_pthread='$i_pthread'
24509 i_pwd='$i_pwd'
24510 i_quadmath='$i_quadmath'
24511 i_rpcsvcdbm='$i_rpcsvcdbm'
24512 i_sgtty='$i_sgtty'
24513 i_shadow='$i_shadow'
24514 i_socks='$i_socks'
24515 i_stdbool='$i_stdbool'
24516 i_stdint='$i_stdint'
24517 i_stdlib='$i_stdlib'
24518 i_sunmath='$i_sunmath'
24519 i_sysaccess='$i_sysaccess'
24520 i_sysdir='$i_sysdir'
24521 i_sysfile='$i_sysfile'
24522 i_sysfilio='$i_sysfilio'
24523 i_sysin='$i_sysin'
24524 i_sysioctl='$i_sysioctl'
24525 i_syslog='$i_syslog'
24526 i_sysmman='$i_sysmman'
24527 i_sysmode='$i_sysmode'
24528 i_sysmount='$i_sysmount'
24529 i_sysndir='$i_sysndir'
24530 i_sysparam='$i_sysparam'
24531 i_syspoll='$i_syspoll'
24532 i_sysresrc='$i_sysresrc'
24533 i_syssecrt='$i_syssecrt'
24534 i_sysselct='$i_sysselct'
24535 i_syssockio='$i_syssockio'
24536 i_sysstat='$i_sysstat'
24537 i_sysstatfs='$i_sysstatfs'
24538 i_sysstatvfs='$i_sysstatvfs'
24539 i_systime='$i_systime'
24540 i_systimek='$i_systimek'
24541 i_systimes='$i_systimes'
24542 i_systypes='$i_systypes'
24543 i_sysuio='$i_sysuio'
24544 i_sysun='$i_sysun'
24545 i_sysutsname='$i_sysutsname'
24546 i_sysvfs='$i_sysvfs'
24547 i_syswait='$i_syswait'
24548 i_termio='$i_termio'
24549 i_termios='$i_termios'
24550 i_time='$i_time'
24551 i_unistd='$i_unistd'
24552 i_ustat='$i_ustat'
24553 i_utime='$i_utime'
24554 i_vfork='$i_vfork'
24555 i_wchar='$i_wchar'
24556 i_xlocale='$i_xlocale'
24557 ignore_versioned_solibs='$ignore_versioned_solibs'
24558 inc_version_list='$inc_version_list'
24559 inc_version_list_init='$inc_version_list_init'
24560 incpath='$incpath'
24561 incpth='$incpth'
24562 inews='$inews'
24563 initialinstalllocation='$initialinstalllocation'
24564 installarchlib='$installarchlib'
24565 installbin='$installbin'
24566 installhtml1dir='$installhtml1dir'
24567 installhtml3dir='$installhtml3dir'
24568 installman1dir='$installman1dir'
24569 installman3dir='$installman3dir'
24570 installprefix='$installprefix'
24571 installprefixexp='$installprefixexp'
24572 installprivlib='$installprivlib'
24573 installscript='$installscript'
24574 installsitearch='$installsitearch'
24575 installsitebin='$installsitebin'
24576 installsitehtml1dir='$installsitehtml1dir'
24577 installsitehtml3dir='$installsitehtml3dir'
24578 installsitelib='$installsitelib'
24579 installsiteman1dir='$installsiteman1dir'
24580 installsiteman3dir='$installsiteman3dir'
24581 installsitescript='$installsitescript'
24582 installstyle='$installstyle'
24583 installusrbinperl='$installusrbinperl'
24584 installvendorarch='$installvendorarch'
24585 installvendorbin='$installvendorbin'
24586 installvendorhtml1dir='$installvendorhtml1dir'
24587 installvendorhtml3dir='$installvendorhtml3dir'
24588 installvendorlib='$installvendorlib'
24589 installvendorman1dir='$installvendorman1dir'
24590 installvendorman3dir='$installvendorman3dir'
24591 installvendorscript='$installvendorscript'
24592 intsize='$intsize'
24593 issymlink='$issymlink'
24594 ivdformat='$ivdformat'
24595 ivsize='$ivsize'
24596 ivtype='$ivtype'
24597 known_extensions='$known_extensions'
24598 ksh='$ksh'
24599 ld='$ld'
24600 ld_can_script='$ld_can_script'
24601 lddlflags='$lddlflags'
24602 ldflags='$ldflags'
24603 ldflags_uselargefiles='$ldflags_uselargefiles'
24604 ldlibpthname='$ldlibpthname'
24605 less='$less'
24606 lib_ext='$lib_ext'
24607 libc='$libc'
24608 libperl='$libperl'
24609 libpth='$libpth'
24610 libs='$libs'
24611 libsdirs='$libsdirs'
24612 libsfiles='$libsfiles'
24613 libsfound='$libsfound'
24614 libspath='$libspath'
24615 libswanted='$libswanted'
24616 libswanted_uselargefiles='$libswanted_uselargefiles'
24617 line='$line'
24618 lint='$lint'
24619 lkflags='$lkflags'
24620 ln='$ln'
24621 lns='$lns'
24622 localtime_r_proto='$localtime_r_proto'
24623 locincpth='$locincpth'
24624 loclibpth='$loclibpth'
24625 longdblinfbytes='$longdblinfbytes'
24626 longdblkind='$longdblkind'
24627 longdblmantbits='$longdblmantbits'
24628 longdblnanbytes='$longdblnanbytes'
24629 longdblsize='$longdblsize'
24630 longlongsize='$longlongsize'
24631 longsize='$longsize'
24632 lp='$lp'
24633 lpr='$lpr'
24634 ls='$ls'
24635 lseeksize='$lseeksize'
24636 lseektype='$lseektype'
24637 mail='$mail'
24638 mailx='$mailx'
24639 make='$make'
24640 make_set_make='$make_set_make'
24641 mallocobj='$mallocobj'
24642 mallocsrc='$mallocsrc'
24643 malloctype='$malloctype'
24644 man1dir='$man1dir'
24645 man1direxp='$man1direxp'
24646 man1ext='$man1ext'
24647 man3dir='$man3dir'
24648 man3direxp='$man3direxp'
24649 man3ext='$man3ext'
24650 mips_type='$mips_type'
24651 mistrustnm='$mistrustnm'
24652 mkdir='$mkdir'
24653 mmaptype='$mmaptype'
24654 modetype='$modetype'
24655 more='$more'
24656 multiarch='$multiarch'
24657 mv='$mv'
24658 myarchname='$myarchname'
24659 mydomain='$mydomain'
24660 myhostname='$myhostname'
24661 myuname='$myuname'
24662 n='$n'
24663 need_va_copy='$need_va_copy'
24664 netdb_hlen_type='$netdb_hlen_type'
24665 netdb_host_type='$netdb_host_type'
24666 netdb_name_type='$netdb_name_type'
24667 netdb_net_type='$netdb_net_type'
24668 nm='$nm'
24669 nm_opt='$nm_opt'
24670 nm_so_opt='$nm_so_opt'
24671 nonxs_ext='$nonxs_ext'
24672 nroff='$nroff'
24673 nvEUformat='$nvEUformat'
24674 nvFUformat='$nvFUformat'
24675 nvGUformat='$nvGUformat'
24676 nv_overflows_integers_at='$nv_overflows_integers_at'
24677 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24678 nveformat='$nveformat'
24679 nvfformat='$nvfformat'
24680 nvgformat='$nvgformat'
24681 nvmantbits='$nvmantbits'
24682 nvsize='$nvsize'
24683 nvtype='$nvtype'
24684 o_nonblock='$o_nonblock'
24685 obj_ext='$obj_ext'
24686 old_pthread_create_joinable='$old_pthread_create_joinable'
24687 optimize='$optimize'
24688 orderlib='$orderlib'
24689 osname='$osname'
24690 osvers='$osvers'
24691 otherlibdirs='$otherlibdirs'
24692 package='$package'
24693 pager='$pager'
24694 passcat='$passcat'
24695 patchlevel='$patchlevel'
24696 path_sep='$path_sep'
24697 perl5='$perl5'
24698 perl='$perl'
24699 perl_patchlevel='$perl_patchlevel'
24700 perl_static_inline='$perl_static_inline'
24701 perladmin='$perladmin'
24702 perllibs='$perllibs'
24703 perlpath='$perlpath'
24704 pg='$pg'
24705 phostname='$phostname'
24706 pidtype='$pidtype'
24707 plibpth='$plibpth'
24708 pmake='$pmake'
24709 pr='$pr'
24710 prefix='$prefix'
24711 prefixexp='$prefixexp'
24712 privlib='$privlib'
24713 privlibexp='$privlibexp'
24714 procselfexe='$procselfexe'
24715 ptrsize='$ptrsize'
24716 quadkind='$quadkind'
24717 quadtype='$quadtype'
24718 randbits='$randbits'
24719 randfunc='$randfunc'
24720 random_r_proto='$random_r_proto'
24721 randseedtype='$randseedtype'
24722 ranlib='$ranlib'
24723 rd_nodata='$rd_nodata'
24724 readdir64_r_proto='$readdir64_r_proto'
24725 readdir_r_proto='$readdir_r_proto'
24726 revision='$revision'
24727 rm='$rm'
24728 rm_try='$rm_try'
24729 rmail='$rmail'
24730 run='$run'
24731 runnm='$runnm'
24732 sGMTIME_max='$sGMTIME_max'
24733 sGMTIME_min='$sGMTIME_min'
24734 sLOCALTIME_max='$sLOCALTIME_max'
24735 sLOCALTIME_min='$sLOCALTIME_min'
24736 sPRIEUldbl='$sPRIEUldbl'
24737 sPRIFUldbl='$sPRIFUldbl'
24738 sPRIGUldbl='$sPRIGUldbl'
24739 sPRIXU64='$sPRIXU64'
24740 sPRId64='$sPRId64'
24741 sPRIeldbl='$sPRIeldbl'
24742 sPRIfldbl='$sPRIfldbl'
24743 sPRIgldbl='$sPRIgldbl'
24744 sPRIi64='$sPRIi64'
24745 sPRIo64='$sPRIo64'
24746 sPRIu64='$sPRIu64'
24747 sPRIx64='$sPRIx64'
24748 sSCNfldbl='$sSCNfldbl'
24749 sched_yield='$sched_yield'
24750 scriptdir='$scriptdir'
24751 scriptdirexp='$scriptdirexp'
24752 sed='$sed'
24753 seedfunc='$seedfunc'
24754 selectminbits='$selectminbits'
24755 selecttype='$selecttype'
24756 sendmail='$sendmail'
24757 setgrent_r_proto='$setgrent_r_proto'
24758 sethostent_r_proto='$sethostent_r_proto'
24759 setlocale_r_proto='$setlocale_r_proto'
24760 setnetent_r_proto='$setnetent_r_proto'
24761 setprotoent_r_proto='$setprotoent_r_proto'
24762 setpwent_r_proto='$setpwent_r_proto'
24763 setservent_r_proto='$setservent_r_proto'
24764 sh='$sh'
24765 shar='$shar'
24766 sharpbang='$sharpbang'
24767 shmattype='$shmattype'
24768 shortsize='$shortsize'
24769 shrpenv='$shrpenv'
24770 shsharp='$shsharp'
24771 sig_count='$sig_count'
24772 sig_name='$sig_name'
24773 sig_name_init='$sig_name_init'
24774 sig_num='$sig_num'
24775 sig_num_init='$sig_num_init'
24776 sig_size='$sig_size'
24777 signal_t='$signal_t'
24778 sitearch='$sitearch'
24779 sitearchexp='$sitearchexp'
24780 sitebin='$sitebin'
24781 sitebinexp='$sitebinexp'
24782 sitehtml1dir='$sitehtml1dir'
24783 sitehtml1direxp='$sitehtml1direxp'
24784 sitehtml3dir='$sitehtml3dir'
24785 sitehtml3direxp='$sitehtml3direxp'
24786 sitelib='$sitelib'
24787 sitelib_stem='$sitelib_stem'
24788 sitelibexp='$sitelibexp'
24789 siteman1dir='$siteman1dir'
24790 siteman1direxp='$siteman1direxp'
24791 siteman3dir='$siteman3dir'
24792 siteman3direxp='$siteman3direxp'
24793 siteprefix='$siteprefix'
24794 siteprefixexp='$siteprefixexp'
24795 sitescript='$sitescript'
24796 sitescriptexp='$sitescriptexp'
24797 sizesize='$sizesize'
24798 sizetype='$sizetype'
24799 sleep='$sleep'
24800 smail='$smail'
24801 so='$so'
24802 sockethdr='$sockethdr'
24803 socketlib='$socketlib'
24804 socksizetype='$socksizetype'
24805 sort='$sort'
24806 spackage='$spackage'
24807 spitshell='$spitshell'
24808 srand48_r_proto='$srand48_r_proto'
24809 srandom_r_proto='$srandom_r_proto'
24810 src='$src'
24811 ssizetype='$ssizetype'
24812 st_ino_sign='$st_ino_sign'
24813 st_ino_size='$st_ino_size'
24814 startperl='$startperl'
24815 startsh='$startsh'
24816 static_ext='$static_ext'
24817 stdchar='$stdchar'
24818 stdio_base='$stdio_base'
24819 stdio_bufsiz='$stdio_bufsiz'
24820 stdio_cnt='$stdio_cnt'
24821 stdio_filbuf='$stdio_filbuf'
24822 stdio_ptr='$stdio_ptr'
24823 stdio_stream_array='$stdio_stream_array'
24824 strerror_r_proto='$strerror_r_proto'
24825 submit='$submit'
24826 subversion='$subversion'
24827 sysman='$sysman'
24828 sysroot='$sysroot'
24829 tail='$tail'
24830 tar='$tar'
24831 targetarch='$targetarch'
24832 targetdir='$targetdir'
24833 targetenv='$targetenv'
24834 targethost='$targethost'
24835 targetmkdir='$targetmkdir'
24836 targetport='$targetport'
24837 targetsh='$targetsh'
24838 tbl='$tbl'
24839 tee='$tee'
24840 test='$test'
24841 timeincl='$timeincl'
24842 timetype='$timetype'
24843 tmpnam_r_proto='$tmpnam_r_proto'
24844 to='$to'
24845 touch='$touch'
24846 tr='$tr'
24847 trnl='$trnl'
24848 troff='$troff'
24849 ttyname_r_proto='$ttyname_r_proto'
24850 u16size='$u16size'
24851 u16type='$u16type'
24852 u32size='$u32size'
24853 u32type='$u32type'
24854 u64size='$u64size'
24855 u64type='$u64type'
24856 u8size='$u8size'
24857 u8type='$u8type'
24858 uidformat='$uidformat'
24859 uidsign='$uidsign'
24860 uidsize='$uidsize'
24861 uidtype='$uidtype'
24862 uname='$uname'
24863 uniq='$uniq'
24864 uquadtype='$uquadtype'
24865 use5005threads='$use5005threads'
24866 use64bitall='$use64bitall'
24867 use64bitint='$use64bitint'
24868 usecbacktrace='$usecbacktrace'
24869 usecrosscompile='$usecrosscompile'
24870 usedevel='$usedevel'
24871 usedl='$usedl'
24872 usedtrace='$usedtrace'
24873 usefaststdio='$usefaststdio'
24874 useithreads='$useithreads'
24875 usekernprocpathname='$usekernprocpathname'
24876 uselanginfo='$uselanginfo'
24877 uselargefiles='$uselargefiles'
24878 uselongdouble='$uselongdouble'
24879 usemallocwrap='$usemallocwrap'
24880 usemorebits='$usemorebits'
24881 usemultiplicity='$usemultiplicity'
24882 usemymalloc='$usemymalloc'
24883 usenm='$usenm'
24884 usensgetexecutablepath='$usensgetexecutablepath'
24885 useopcode='$useopcode'
24886 useperlio='$useperlio'
24887 useposix='$useposix'
24888 usequadmath='$usequadmath'
24889 usereentrant='$usereentrant'
24890 userelocatableinc='$userelocatableinc'
24891 useshrplib='$useshrplib'
24892 usesitecustomize='$usesitecustomize'
24893 usesocks='$usesocks'
24894 usethreads='$usethreads'
24895 usevendorprefix='$usevendorprefix'
24896 useversionedarchname='$useversionedarchname'
24897 usevfork='$usevfork'
24898 usrinc='$usrinc'
24899 uuname='$uuname'
24900 uvXUformat='$uvXUformat'
24901 uvoformat='$uvoformat'
24902 uvsize='$uvsize'
24903 uvtype='$uvtype'
24904 uvuformat='$uvuformat'
24905 uvxformat='$uvxformat'
24906 vendorarch='$vendorarch'
24907 vendorarchexp='$vendorarchexp'
24908 vendorbin='$vendorbin'
24909 vendorbinexp='$vendorbinexp'
24910 vendorhtml1dir='$vendorhtml1dir'
24911 vendorhtml1direxp='$vendorhtml1direxp'
24912 vendorhtml3dir='$vendorhtml3dir'
24913 vendorhtml3direxp='$vendorhtml3direxp'
24914 vendorlib='$vendorlib'
24915 vendorlib_stem='$vendorlib_stem'
24916 vendorlibexp='$vendorlibexp'
24917 vendorman1dir='$vendorman1dir'
24918 vendorman1direxp='$vendorman1direxp'
24919 vendorman3dir='$vendorman3dir'
24920 vendorman3direxp='$vendorman3direxp'
24921 vendorprefix='$vendorprefix'
24922 vendorprefixexp='$vendorprefixexp'
24923 vendorscript='$vendorscript'
24924 vendorscriptexp='$vendorscriptexp'
24925 version='$version'
24926 version_patchlevel_string='$version_patchlevel_string'
24927 versiononly='$versiononly'
24928 vi='$vi'
24929 xlibpth='$xlibpth'
24930 yacc='$yacc'
24931 yaccflags='$yaccflags'
24932 zcat='$zcat'
24933 zip='$zip'
24934 EOT
24935
24936 : add special variables
24937 $test -f $src/patchlevel.h && \
24938 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24939 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24940 echo "PERL_CONFIG_SH=true" >>config.sh
24941
24942 : propagate old symbols
24943 if $test -f UU/config.sh; then
24944         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24945         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24946                 config.sh config.sh UU/oldconfig.sh |\
24947                 $sort | $uniq -u >UU/oldsyms
24948         set X `$cat UU/oldsyms`
24949         shift
24950         case $# in
24951         0) ;;
24952         *)
24953                 $cat <<EOM
24954 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24955 EOM
24956                 echo ": Variables propagated from previous config.sh file." >>config.sh
24957                 for sym in `$cat UU/oldsyms`; do
24958                         echo "    Propagating $hint variable "'$'"$sym..."
24959                         eval 'tmp="$'"${sym}"'"'
24960                         echo "$tmp" | \
24961                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24962                 done
24963                 ;;
24964         esac
24965 fi
24966
24967 : preserve RCS keywords in files with variable substitution, grrr
24968 Id='$Id'
24969
24970 : Finish up by extracting the .SH files
24971 case "$alldone" in
24972 exit)
24973         echo "Stopping at your request, leaving temporary files around."
24974         exit 0
24975         ;;
24976 cont)
24977         ;;
24978 '')
24979         dflt=''
24980         nostick=true
24981         $cat <<EOM
24982
24983 If you'd like to make any changes to the config.sh file before I begin
24984 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24985
24986 EOM
24987         rp="Press return or use a shell escape to edit config.sh:"
24988         . UU/myread
24989         nostick=''
24990         case "$ans" in
24991         '') ;;
24992         *) : in case they cannot read
24993                 sh 1>&4 -c "$ans";;
24994         esac
24995         ;;
24996 esac
24997
24998 : if this fails, just run all the .SH files by hand
24999 . ./config.sh
25000
25001 echo " "
25002 exec 1>&4
25003 pwd=`pwd`
25004 . ./UU/extract
25005 cd "$pwd"
25006
25007 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25008         dflt=y
25009         case "$silent" in
25010         true) ;;
25011         *)
25012                 $cat <<EOM
25013
25014 Now you need to generate make dependencies by running "$make depend".
25015 You might prefer to run it in background: "$make depend > makedepend.out &"
25016 It can take a while, so you might not want to run it right now.
25017
25018 EOM
25019                 ;;
25020         esac
25021         rp="Run $make depend now?"
25022         . UU/myread
25023         case "$ans" in
25024         y*)
25025                 $make depend && echo "Now you must run '$make'."
25026                 ;;
25027         *)
25028                 echo "You must run '$make depend' then '$make'."
25029                 ;;
25030         esac
25031 elif test -f [Mm]akefile; then
25032         echo " "
25033         echo "Now you must run a $make."
25034 else
25035         echo "Configure done."
25036 fi
25037
25038 if $test -f Policy.sh; then
25039     $cat <<EOM
25040
25041 If you compile $package on a different machine or from a different object
25042 directory, copy the Policy.sh file from this object directory to the
25043 new one before you run Configure -- this will help you with most of
25044 the policy defaults.
25045
25046 EOM
25047 fi
25048 if $test -f UU/config.msg; then
25049     echo "Hmm.  I also noted the following information while running:"
25050     echo " "
25051     $cat UU/config.msg >&4
25052 fi
25053 $rm -f kit*isdone ark*isdone
25054 $rm -rf UU
25055
25056 : End of Configure
25057