This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add thread-safe locale handling
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically by the tool
15 # called "metaconfig". Rather than working with this copy of Configure,
16 # you should use metaconfig. Perl uses a modified version of this
17 # tool, and this, together with the metaconfig units, are available
18 # in the git repository:
19 #    $ git clone https://github.com/perl5-metaconfig/metaconfig metaconfig
20 # The original dist package (including metaconfig) is available on github:
21 #    $ git clone https://github.com/rmanfredi/dist.git dist-git
22 #
23 # Though this script was generated by metaconfig from metaunits, it is
24 # OK to send patches against Configure itself (but not to commit them
25 # to blead). It's up to
26 # the Configure maintainers to backport the patch to the metaunits if it
27 # is accepted. Exceptions to this rule, and more information, is in
28 # Porting/pumpkin.pod.
29
30 # Generated using [metaconfig 3.5 PL0]
31 # (with additional metaconfig patches by perlbug@perl.org)
32
33 cat >c1$$ <<EOF
34 ARGGGHHHH!!!!!
35
36 SCO csh still thinks true is false.  Write to SCO today and tell them that next
37 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
38
39 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
40 we'd have to do is go in and swap the && and || tokens, wherever they are.)
41
42 [End of diatribe. We now return you to your regularly scheduled programming...]
43 EOF
44 cat >c2$$ <<EOF
45
46 OOPS!  You naughty creature!  You didn't run Configure with sh!
47 I will attempt to remedy the situation by running sh for you...
48 EOF
49
50 true || cat c1$$ c2$$
51 true || exec sh $0 $argv:q
52
53 (exit $?0) || cat c2$$
54 (exit $?0) || exec sh $0 $argv:q
55 rm -f c1$$ c2$$
56
57 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
58         cat <<EOF
59 ***
60 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
61 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
62 *** Please read the README.plan9 for further instructions.
63 *** Cannot continue, aborting.
64 ***
65 EOF
66         exit 1
67 fi
68
69 if test -f /sys/utilities/MultiView ; then
70         # AmigaOS, test -c for /dev/null is not useful
71         :
72 elif test ! -c /dev/null ; then
73         cat <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin|*msys) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 hostgenerate=''
212 hostosname=''
213 hostperl=''
214 run=''
215 targetarch=''
216 targetdir=''
217 targetenv=''
218 targethost=''
219 targetmkdir=''
220 targetport=''
221 to=''
222 usecrosscompile=''
223 extern_C=''
224 mistrustnm=''
225 usedevel=''
226 perllibs=''
227 dynamic_ext=''
228 extensions=''
229 known_extensions=''
230 nonxs_ext=''
231 static_ext=''
232 useopcode=''
233 useposix=''
234 extras=''
235 d_bsd=''
236 d_eunice=''
237 d_xenix=''
238 eunicefix=''
239 ar=''
240 awk=''
241 bash=''
242 bison=''
243 byacc=''
244 cat=''
245 chgrp=''
246 chmod=''
247 chown=''
248 comm=''
249 compress=''
250 cp=''
251 cpio=''
252 cpp=''
253 csh=''
254 date=''
255 echo=''
256 egrep=''
257 emacs=''
258 expr=''
259 find=''
260 flex=''
261 gmake=''
262 grep=''
263 gzip=''
264 inews=''
265 ksh=''
266 less=''
267 line=''
268 lint=''
269 ln=''
270 lp=''
271 lpr=''
272 ls=''
273 mail=''
274 mailx=''
275 make=''
276 mkdir=''
277 more=''
278 mv=''
279 nm=''
280 nroff=''
281 perl=''
282 pg=''
283 pmake=''
284 pr=''
285 rm=''
286 rmail=''
287 sed=''
288 sendmail=''
289 shar=''
290 sleep=''
291 smail=''
292 sort=''
293 submit=''
294 tail=''
295 tar=''
296 tbl=''
297 tee=''
298 test=''
299 touch=''
300 tr=''
301 troff=''
302 uname=''
303 uniq=''
304 uuname=''
305 vi=''
306 zcat=''
307 zip=''
308 full_ar=''
309 full_sed=''
310 libswanted=''
311 hint=''
312 myuname=''
313 osname=''
314 osvers=''
315 Author=''
316 Date=''
317 Header=''
318 Id=''
319 Locker=''
320 Log=''
321 RCSfile=''
322 Revision=''
323 Source=''
324 State=''
325 sysroot=''
326 _a=''
327 _exe=''
328 _o=''
329 archobjs=''
330 exe_ext=''
331 firstmakefile=''
332 lib_ext=''
333 obj_ext=''
334 path_sep=''
335 rm_try=''
336 afs=''
337 afsroot=''
338 alignbytes=''
339 archlib=''
340 archlibexp=''
341 d_archlib=''
342 installarchlib=''
343 archname=''
344 myarchname=''
345 useversionedarchname=''
346 d_atolf=''
347 d_atoll=''
348 baserev=''
349 bin=''
350 binexp=''
351 initialinstalllocation=''
352 installbin=''
353 userelocatableinc=''
354 byteorder=''
355 cc=''
356 ccflags=''
357 cppflags=''
358 ldflags=''
359 lkflags=''
360 locincpth=''
361 optimize=''
362 cf_email=''
363 cf_by=''
364 cf_time=''
365 charbits=''
366 charsize=''
367 contains=''
368 cpp_stuff=''
369 cpplast=''
370 cppminus=''
371 cpprun=''
372 cppstdin=''
373 d__fwalk=''
374 d_accept4=''
375 d_access=''
376 d_accessx=''
377 d_acosh=''
378 d_aintl=''
379 d_alarm=''
380 asctime_r_proto=''
381 d_asctime_r=''
382 d_asinh=''
383 d_atanh=''
384 d_attribute_deprecated=''
385 d_attribute_format=''
386 d_attribute_malloc=''
387 d_attribute_nonnull=''
388 d_attribute_noreturn=''
389 d_attribute_pure=''
390 d_attribute_unused=''
391 d_attribute_warn_unused_result=''
392 d_printf_format_null=''
393 d_backtrace=''
394 d_builtin_choose_expr=''
395 d_builtin_expect=''
396 d_builtin_add_overflow=''
397 d_builtin_mul_overflow=''
398 d_builtin_sub_overflow=''
399 d_c99_variadic_macros=''
400 d_casti32=''
401 castflags=''
402 d_castneg=''
403 d_cbrt=''
404 d_chown=''
405 d_chroot=''
406 d_chsize=''
407 d_class=''
408 d_clearenv=''
409 d_closedir=''
410 d_void_closedir=''
411 d_cmsghdr_s=''
412 d_const=''
413 d_copysign=''
414 d_copysignl=''
415 d_cplusplus=''
416 cryptlib=''
417 d_crypt=''
418 crypt_r_proto=''
419 d_crypt_r=''
420 d_csh=''
421 full_csh=''
422 d_ctermid=''
423 ctermid_r_proto=''
424 d_ctermid_r=''
425 ctime_r_proto=''
426 d_ctime_r=''
427 d_cuserid=''
428 d_dbminitproto=''
429 d_difftime=''
430 d_dir_dd_fd=''
431 d_dirfd=''
432 d_dladdr=''
433 d_dlerror=''
434 d_dlopen=''
435 d_dlsymun=''
436 d_dosuid=''
437 d_suidsafe=''
438 d_drand48_r=''
439 drand48_r_proto=''
440 d_drand48proto=''
441 d_dup2=''
442 d_dup3=''
443 d_eaccess=''
444 d_endgrent=''
445 d_endgrent_r=''
446 endgrent_r_proto=''
447 d_endhent=''
448 d_endhostent_r=''
449 endhostent_r_proto=''
450 d_endnent=''
451 d_endnetent_r=''
452 endnetent_r_proto=''
453 d_endpent=''
454 d_endprotoent_r=''
455 endprotoent_r_proto=''
456 d_endpwent=''
457 d_endpwent_r=''
458 endpwent_r_proto=''
459 d_endsent=''
460 d_endservent_r=''
461 endservent_r_proto=''
462 d_erf=''
463 d_erfc=''
464 d_exp2=''
465 d_expm1=''
466 d_faststdio=''
467 d_fchdir=''
468 d_fchmod=''
469 d_fchown=''
470 d_fcntl=''
471 d_fcntl_can_lock=''
472 d_fd_macros=''
473 d_fd_set=''
474 d_fds_bits=''
475 d_fdclose=''
476 d_fdim=''
477 d_fegetround=''
478 d_fgetpos=''
479 d_finite=''
480 d_finitel=''
481 d_flexfnam=''
482 d_flock=''
483 d_flockproto=''
484 d_fma=''
485 d_fmax=''
486 d_fmin=''
487 d_fork=''
488 d_fp_class=''
489 d_fp_classl=''
490 d_fpclass=''
491 d_fp_classify=''
492 d_fpclassify=''
493 d_fpclassl=''
494 d_fpgetround=''
495 d_fpos64_t=''
496 d_frexpl=''
497 d_fs_data_s=''
498 d_fchmodat=''
499 d_linkat=''
500 d_openat=''
501 d_renameat=''
502 d_unlinkat=''
503 d_fseeko=''
504 d_fsetpos=''
505 d_fstatfs=''
506 d_fsync=''
507 d_ftello=''
508 d_ftime=''
509 d_gettimeod=''
510 d_futimes=''
511 d_gai_strerror=''
512 d_Gconvert=''
513 d_getaddrinfo=''
514 d_getcwd=''
515 d_getespwnam=''
516 d_getfsstat=''
517 d_getgrent=''
518 d_getgrent_r=''
519 getgrent_r_proto=''
520 d_getgrgid_r=''
521 getgrgid_r_proto=''
522 d_getgrnam_r=''
523 getgrnam_r_proto=''
524 d_getgrps=''
525 d_gethbyaddr=''
526 d_gethbyname=''
527 d_gethent=''
528 aphostname=''
529 d_gethname=''
530 d_phostname=''
531 d_uname=''
532 d_gethostbyaddr_r=''
533 gethostbyaddr_r_proto=''
534 d_gethostbyname_r=''
535 gethostbyname_r_proto=''
536 d_gethostent_r=''
537 gethostent_r_proto=''
538 d_gethostprotos=''
539 d_getitimer=''
540 d_getlogin=''
541 d_getlogin_r=''
542 getlogin_r_proto=''
543 d_getmnt=''
544 d_getmntent=''
545 d_getnameinfo=''
546 d_getnbyaddr=''
547 d_getnbyname=''
548 d_getnent=''
549 d_getnetbyaddr_r=''
550 getnetbyaddr_r_proto=''
551 d_getnetbyname_r=''
552 getnetbyname_r_proto=''
553 d_getnetent_r=''
554 getnetent_r_proto=''
555 d_getnetprotos=''
556 d_getpagsz=''
557 d_getpent=''
558 d_getpgid=''
559 d_getpgrp2=''
560 d_bsdgetpgrp=''
561 d_getpgrp=''
562 d_getppid=''
563 d_getprior=''
564 d_getpbyname=''
565 d_getpbynumber=''
566 d_getprotobyname_r=''
567 getprotobyname_r_proto=''
568 d_getprotobynumber_r=''
569 getprotobynumber_r_proto=''
570 d_getprotoent_r=''
571 getprotoent_r_proto=''
572 d_getprotoprotos=''
573 d_getprpwnam=''
574 d_getpwent=''
575 d_getpwent_r=''
576 getpwent_r_proto=''
577 d_getpwnam_r=''
578 getpwnam_r_proto=''
579 d_getpwuid_r=''
580 getpwuid_r_proto=''
581 d_getsent=''
582 d_getservbyname_r=''
583 getservbyname_r_proto=''
584 d_getservbyport_r=''
585 getservbyport_r_proto=''
586 d_getservent_r=''
587 getservent_r_proto=''
588 d_getservprotos=''
589 d_getspnam=''
590 d_getspnam_r=''
591 getspnam_r_proto=''
592 d_getsbyname=''
593 d_getsbyport=''
594 d_gmtime_r=''
595 gmtime_r_proto=''
596 d_gnulibc=''
597 gnulibc_version=''
598 d_hasmntopt=''
599 d_htonl=''
600 d_hypot=''
601 d_ilogb=''
602 d_ilogbl=''
603 d_inetaton=''
604 d_inetntop=''
605 d_inetpton=''
606 d_int64_t=''
607 d_isascii=''
608 d_isblank=''
609 d_isfinite=''
610 d_isfinitel=''
611 d_isinf=''
612 d_isinfl=''
613 d_isless=''
614 d_isnan=''
615 d_isnanl=''
616 d_isnormal=''
617 d_j0=''
618 d_j0l=''
619 d_killpg=''
620 d_lc_monetary_2008=''
621 d_lchown=''
622 d_ldbl_dig=''
623 d_lgamma=''
624 d_lgamma_r=''
625 d_libm_lib_version=''
626 d_link=''
627 d_llrint=''
628 d_llrintl=''
629 d_llround=''
630 d_llroundl=''
631 d_localeconv_l=''
632 d_localtime_r=''
633 d_localtime_r_needs_tzset=''
634 localtime_r_proto=''
635 d_locconv=''
636 d_lockf=''
637 d_log1p=''
638 d_log2=''
639 d_logb=''
640 d_ldexpl=''
641 d_long_double_style_ieee=''
642 d_long_double_style_ieee_doubledouble=''
643 d_long_double_style_ieee_extended=''
644 d_long_double_style_ieee_std=''
645 d_long_double_style_vax=''
646 d_longdbl=''
647 longdblkind=''
648 longdblsize=''
649 d_longlong=''
650 longlongsize=''
651 d_lrint=''
652 d_lrintl=''
653 d_lround=''
654 d_lroundl=''
655 d_lseekproto=''
656 d_lstat=''
657 d_madvise=''
658 d_malloc_good_size=''
659 d_malloc_size=''
660 d_mblen=''
661 d_mbrlen=''
662 d_mbrtowc=''
663 d_mbstowcs=''
664 d_mbtowc=''
665 d_memmem=''
666 d_memrchr=''
667 d_mkdir=''
668 d_mkdtemp=''
669 d_mkfifo=''
670 d_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_strtol=''
876 d_strtold=''
877 d_strtold_l=''
878 d_strtoll=''
879 d_strtoq=''
880 d_strtoul=''
881 d_strtoull=''
882 d_strtouq=''
883 d_strxfrm=''
884 d_symlink=''
885 d_syscall=''
886 d_syscallproto=''
887 d_sysconf=''
888 d_system=''
889 d_tcgetpgrp=''
890 d_tcsetpgrp=''
891 d_telldirproto=''
892 d_tgamma=''
893 d_time=''
894 timetype=''
895 d_asctime64=''
896 d_ctime64=''
897 d_difftime64=''
898 d_gmtime64=''
899 d_localtime64=''
900 d_mktime64=''
901 d_timegm=''
902 clocktype=''
903 d_times=''
904 d_tmpnam_r=''
905 tmpnam_r_proto=''
906 d_trunc=''
907 d_truncate=''
908 d_truncl=''
909 d_ttyname_r=''
910 ttyname_r_proto=''
911 d_tzname=''
912 d_u32align=''
913 d_ualarm=''
914 d_umask=''
915 d_semctl_semid_ds=''
916 d_semctl_semun=''
917 d_union_semun=''
918 d_unordered=''
919 d_unsetenv=''
920 d_usleep=''
921 d_usleepproto=''
922 d_ustat=''
923 d_pseudofork=''
924 d_vfork=''
925 usevfork=''
926 d_voidsig=''
927 signal_t=''
928 d_wait4=''
929 d_waitpid=''
930 d_wcscmp=''
931 d_wcstombs=''
932 d_wcsxfrm=''
933 d_wctomb=''
934 d_writev=''
935 default_inc_excludes_dot=''
936 dlext=''
937 bin_ELF=''
938 cccdlflags=''
939 ccdlflags=''
940 dlsrc=''
941 ld=''
942 ld_can_script=''
943 lddlflags=''
944 usedl=''
945 doublesize=''
946 dtraceobject=''
947 dtracexnolibs=''
948 ebcdic=''
949 fflushNULL=''
950 fflushall=''
951 fpossize=''
952 fpostype=''
953 gccansipedantic=''
954 gccosandvers=''
955 gccversion=''
956 gidformat=''
957 gidsign=''
958 gidsize=''
959 gidtype=''
960 groupstype=''
961 h_fcntl=''
962 h_sysfile=''
963 html1dir=''
964 html1direxp=''
965 installhtml1dir=''
966 html3dir=''
967 html3direxp=''
968 installhtml3dir=''
969 i_arpainet=''
970 i_bfd=''
971 i_crypt=''
972 db_hashtype=''
973 db_prefixtype=''
974 db_version_major=''
975 db_version_minor=''
976 db_version_patch=''
977 i_db=''
978 i_dbm=''
979 i_rpcsvcdbm=''
980 d_dirnamlen=''
981 direntrytype=''
982 i_dirent=''
983 i_dlfcn=''
984 i_execinfo=''
985 i_fcntl=''
986 i_fenv=''
987 i_fp=''
988 i_fp_class=''
989 i_gdbm=''
990 d_grpasswd=''
991 i_grp=''
992 i_ieeefp=''
993 i_inttypes=''
994 i_langinfo=''
995 i_libutil=''
996 i_locale=''
997 i_machcthr=''
998 i_malloc=''
999 i_mallocmalloc=''
1000 i_mntent=''
1001 d_gdbm_ndbm_h_uses_prototypes=''
1002 d_gdbmndbm_h_uses_prototypes=''
1003 d_ndbm=''
1004 d_ndbm_h_uses_prototypes=''
1005 i_gdbm_ndbm=''
1006 i_gdbmndbm=''
1007 i_ndbm=''
1008 i_netdb=''
1009 i_neterrno=''
1010 i_netinettcp=''
1011 i_niin=''
1012 i_sysin=''
1013 i_poll=''
1014 i_prot=''
1015 i_pthread=''
1016 d_pwage=''
1017 d_pwchange=''
1018 d_pwclass=''
1019 d_pwcomment=''
1020 d_pwexpire=''
1021 d_pwgecos=''
1022 d_pwpasswd=''
1023 d_pwquota=''
1024 i_pwd=''
1025 i_quadmath=''
1026 i_shadow=''
1027 i_socks=''
1028 i_stdbool=''
1029 i_stdint=''
1030 i_stdlib=''
1031 i_sunmath=''
1032 i_sysaccess=''
1033 i_sysdir=''
1034 i_sysfile=''
1035 d_voidtty=''
1036 i_bsdioctl=''
1037 i_sysfilio=''
1038 i_sysioctl=''
1039 i_syssockio=''
1040 i_syslog=''
1041 i_sysmman=''
1042 i_sysmode=''
1043 i_sysmount=''
1044 i_sysndir=''
1045 i_sysparam=''
1046 i_syspoll=''
1047 i_sysresrc=''
1048 i_syssecrt=''
1049 i_sysselct=''
1050 i_sysstat=''
1051 i_sysstatfs=''
1052 i_sysstatvfs=''
1053 i_systimes=''
1054 i_systypes=''
1055 i_sysuio=''
1056 i_sysun=''
1057 i_sysutsname=''
1058 i_sysvfs=''
1059 i_syswait=''
1060 i_sgtty=''
1061 i_termio=''
1062 i_termios=''
1063 d_tm_tm_gmtoff=''
1064 d_tm_tm_zone=''
1065 i_systime=''
1066 i_systimek=''
1067 i_time=''
1068 timeincl=''
1069 i_unistd=''
1070 i_ustat=''
1071 i_utime=''
1072 i_vfork=''
1073 i_wchar=''
1074 d_inc_version_list=''
1075 inc_version_list=''
1076 inc_version_list_init=''
1077 doubleinfbytes=''
1078 doublenanbytes=''
1079 longdblinfbytes=''
1080 longdblnanbytes=''
1081 installprefix=''
1082 installprefixexp=''
1083 installstyle=''
1084 installusrbinperl=''
1085 intsize=''
1086 longsize=''
1087 shortsize=''
1088 issymlink=''
1089 libc=''
1090 ldlibpthname=''
1091 libperl=''
1092 shrpenv=''
1093 useshrplib=''
1094 glibpth=''
1095 incpth=''
1096 libpth=''
1097 loclibpth=''
1098 plibpth=''
1099 xlibpth=''
1100 ignore_versioned_solibs=''
1101 libs=''
1102 libsdirs=''
1103 libsfiles=''
1104 libsfound=''
1105 libspath=''
1106 lns=''
1107 d_PRIEUldbl=''
1108 d_PRIFUldbl=''
1109 d_PRIGUldbl=''
1110 d_PRIeldbl=''
1111 d_PRIfldbl=''
1112 d_PRIgldbl=''
1113 d_SCNfldbl=''
1114 d_double_has_inf=''
1115 d_double_has_nan=''
1116 d_double_has_negative_zero=''
1117 d_double_has_subnormals=''
1118 d_double_style_cray=''
1119 d_double_style_ibm=''
1120 d_double_style_ieee=''
1121 d_double_style_vax=''
1122 doublekind=''
1123 sPRIEUldbl=''
1124 sPRIFUldbl=''
1125 sPRIGUldbl=''
1126 sPRIeldbl=''
1127 sPRIfldbl=''
1128 sPRIgldbl=''
1129 sSCNfldbl=''
1130 lseeksize=''
1131 lseektype=''
1132 make_set_make=''
1133 d_mymalloc=''
1134 freetype=''
1135 mallocobj=''
1136 mallocsrc=''
1137 malloctype=''
1138 usemallocwrap=''
1139 usemymalloc=''
1140 installman1dir=''
1141 man1dir=''
1142 man1direxp=''
1143 man1ext=''
1144 installman3dir=''
1145 man3dir=''
1146 man3direxp=''
1147 man3ext=''
1148 doublemantbits=''
1149 longdblmantbits=''
1150 nvmantbits=''
1151 modetype=''
1152 multiarch=''
1153 mydomain=''
1154 myhostname=''
1155 phostname=''
1156 c=''
1157 n=''
1158 d_eofnblk=''
1159 eagain=''
1160 o_nonblock=''
1161 rd_nodata=''
1162 need_va_copy=''
1163 netdb_hlen_type=''
1164 netdb_host_type=''
1165 netdb_name_type=''
1166 netdb_net_type=''
1167 groupcat=''
1168 hostcat=''
1169 passcat=''
1170 orderlib=''
1171 ranlib=''
1172 d_perl_otherlibdirs=''
1173 otherlibdirs=''
1174 package=''
1175 spackage=''
1176 pager=''
1177 api_revision=''
1178 api_subversion=''
1179 api_version=''
1180 api_versionstring=''
1181 patchlevel=''
1182 perl_patchlevel=''
1183 revision=''
1184 subversion=''
1185 version=''
1186 version_patchlevel_string=''
1187 perl5=''
1188 perladmin=''
1189 perlpath=''
1190 d_nv_preserves_uv=''
1191 d_nv_zero_is_allbits_zero=''
1192 i16size=''
1193 i16type=''
1194 i32size=''
1195 i32type=''
1196 i64size=''
1197 i64type=''
1198 i8size=''
1199 i8type=''
1200 ivsize=''
1201 ivtype=''
1202 nv_overflows_integers_at=''
1203 nv_preserves_uv_bits=''
1204 nvsize=''
1205 nvtype=''
1206 u16size=''
1207 u16type=''
1208 u32size=''
1209 u32type=''
1210 u64size=''
1211 u64type=''
1212 u8size=''
1213 u8type=''
1214 uvsize=''
1215 uvtype=''
1216 ivdformat=''
1217 nvEUformat=''
1218 nvFUformat=''
1219 nvGUformat=''
1220 nveformat=''
1221 nvfformat=''
1222 nvgformat=''
1223 uvXUformat=''
1224 uvoformat=''
1225 uvuformat=''
1226 uvxformat=''
1227 pidtype=''
1228 prefix=''
1229 prefixexp=''
1230 installprivlib=''
1231 privlib=''
1232 privlibexp=''
1233 ptrsize=''
1234 d_PRIXU64=''
1235 d_PRId64=''
1236 d_PRIi64=''
1237 d_PRIo64=''
1238 d_PRIu64=''
1239 d_PRIx64=''
1240 sPRIXU64=''
1241 sPRId64=''
1242 sPRIi64=''
1243 sPRIo64=''
1244 sPRIu64=''
1245 sPRIx64=''
1246 d_quad=''
1247 quadkind=''
1248 quadtype=''
1249 uquadtype=''
1250 drand01=''
1251 randbits=''
1252 randfunc=''
1253 randseedtype=''
1254 seedfunc=''
1255 installscript=''
1256 scriptdir=''
1257 scriptdirexp=''
1258 selectminbits=''
1259 selecttype=''
1260 sh=''
1261 targetsh=''
1262 sig_count=''
1263 sig_name=''
1264 sig_name_init=''
1265 sig_num=''
1266 sig_num_init=''
1267 sig_size=''
1268 d_sitearch=''
1269 installsitearch=''
1270 sitearch=''
1271 sitearchexp=''
1272 installsitebin=''
1273 sitebin=''
1274 sitebinexp=''
1275 installsitehtml1dir=''
1276 sitehtml1dir=''
1277 sitehtml1direxp=''
1278 installsitehtml3dir=''
1279 sitehtml3dir=''
1280 sitehtml3direxp=''
1281 installsitelib=''
1282 sitelib=''
1283 sitelib_stem=''
1284 sitelibexp=''
1285 installsiteman1dir=''
1286 siteman1dir=''
1287 siteman1direxp=''
1288 installsiteman3dir=''
1289 siteman3dir=''
1290 siteman3direxp=''
1291 siteprefix=''
1292 siteprefixexp=''
1293 installsitescript=''
1294 sitescript=''
1295 sitescriptexp=''
1296 sizesize=''
1297 sizetype=''
1298 d_libname_unique=''
1299 so=''
1300 socksizetype=''
1301 sharpbang=''
1302 shsharp=''
1303 spitshell=''
1304 src=''
1305 ssizetype=''
1306 st_ino_sign=''
1307 st_ino_size=''
1308 startperl=''
1309 startsh=''
1310 stdchar=''
1311 d_stdio_stream_array=''
1312 stdio_stream_array=''
1313 sysman=''
1314 sGMTIME_max=''
1315 sGMTIME_min=''
1316 sLOCALTIME_max=''
1317 sLOCALTIME_min=''
1318 trnl=''
1319 uidformat=''
1320 uidsign=''
1321 uidsize=''
1322 uidtype=''
1323 archname64=''
1324 use64bitall=''
1325 use64bitint=''
1326 usecbacktrace=''
1327 dtrace=''
1328 usedtrace=''
1329 usefaststdio=''
1330 usekernprocpathname=''
1331 ccflags_uselargefiles=''
1332 ldflags_uselargefiles=''
1333 libswanted_uselargefiles=''
1334 uselargefiles=''
1335 uselongdouble=''
1336 usemorebits=''
1337 usemultiplicity=''
1338 nm_opt=''
1339 nm_so_opt=''
1340 runnm=''
1341 usenm=''
1342 usensgetexecutablepath=''
1343 useperlio=''
1344 usequadmath=''
1345 usesocks=''
1346 d_oldpthreads=''
1347 use5005threads=''
1348 useithreads=''
1349 usereentrant=''
1350 usethreads=''
1351 incpath=''
1352 mips_type=''
1353 usrinc=''
1354 d_vendorarch=''
1355 installvendorarch=''
1356 vendorarch=''
1357 vendorarchexp=''
1358 d_vendorbin=''
1359 installvendorbin=''
1360 vendorbin=''
1361 vendorbinexp=''
1362 installvendorhtml1dir=''
1363 vendorhtml1dir=''
1364 vendorhtml1direxp=''
1365 installvendorhtml3dir=''
1366 vendorhtml3dir=''
1367 vendorhtml3direxp=''
1368 d_vendorlib=''
1369 installvendorlib=''
1370 vendorlib=''
1371 vendorlib_stem=''
1372 vendorlibexp=''
1373 installvendorman1dir=''
1374 vendorman1dir=''
1375 vendorman1direxp=''
1376 installvendorman3dir=''
1377 vendorman3dir=''
1378 vendorman3direxp=''
1379 usevendorprefix=''
1380 vendorprefix=''
1381 vendorprefixexp=''
1382 d_vendorscript=''
1383 installvendorscript=''
1384 vendorscript=''
1385 vendorscriptexp=''
1386 versiononly=''
1387 yacc=''
1388 yaccflags=''
1389 CONFIG=''
1390
1391 : Detect odd OSs
1392 define='define'
1393 undef='undef'
1394 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1395 rmlist=''
1396
1397 : We must find out about Eunice early
1398 eunicefix=':'
1399 if test -f /etc/unixtovms; then
1400         eunicefix=/etc/unixtovms
1401 fi
1402 if test -f /etc/unixtovms.exe; then
1403         eunicefix=/etc/unixtovms.exe
1404 fi
1405
1406 : Set executable suffix now -- needed before hints available
1407 if test -f "/libs/version.library"; then
1408 : Amiga OS
1409     _exe=""
1410 elif test -f "/system/gnu_library/bin/ar.pm"; then
1411 : Stratus VOS
1412     _exe=".pm"
1413 elif test -n "$DJGPP"; then
1414 : DOS DJGPP
1415     _exe=".exe"
1416 elif test -f /kern/cookiejar; then
1417 : MiNT
1418     _exe=""
1419 elif test -d c:/. -o -n "$is_os2" ; then
1420 : OS/2 or cygwin
1421     _exe=".exe"
1422 fi
1423
1424 groupstype=''
1425 i_whoami=''
1426 : Possible local include directories to search.
1427 : Set locincpth to "" in a hint file to defeat local include searches.
1428 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1429 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1430 :
1431 : no include file wanted by default
1432 inclwanted=''
1433
1434 : Enable -DEBUGGING and -DDEBUGGING from the command line
1435 EBUGGING=''
1436 DEBUGGING=''
1437
1438 : Trailing extension.  Override this in a hint file, if needed.
1439 : Extra object files, if any, needed on this platform.
1440 archobjs=''
1441 libnames=''
1442 : change the next line if compiling for Xenix/286 on Xenix/386
1443 xlibpth='/usr/lib/386 /lib/386'
1444 : Possible local library directories to search.
1445 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1446 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1447
1448 : general looking path for locating libraries
1449 glibpth="/lib /usr/lib $xlibpth"
1450 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1451 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1452 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1453 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1454
1455 : Private path used by Configure to find libraries.  Its value
1456 : is prepended to libpth. This variable takes care of special
1457 : machines, like the mips.  Usually, it should be empty.
1458 plibpth=''
1459
1460 : default library list
1461 libswanted=''
1462 : some systems want to use only the non-versioned libso:s
1463 ignore_versioned_solibs=''
1464 ccname=''
1465 ccversion=''
1466 perllibs=''
1467 : set useposix=false in your hint file to disable the POSIX extension.
1468 useposix=true
1469 : set useopcode=false in your hint file to disable the Opcode extension.
1470 useopcode=true
1471 archname64=''
1472 ccflags_uselargefiles=''
1473 ldflags_uselargefiles=''
1474 libswanted_uselargefiles=''
1475 : set usemultiplicity on the Configure command line to enable multiplicity.
1476 : set usesocks on the Configure command line to enable socks.
1477 archname=''
1478 : set usethreads on the Configure command line to enable threads.
1479 usereentrant='undef'
1480 : List of libraries we want.
1481 : If anyone needs extra -lxxx, put those in a hint file.
1482 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1483 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1484 : We probably want to search /usr/shlib before most other libraries.
1485 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1486 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1487 glibpth="/usr/shlib $glibpth"
1488 : Do not use vfork unless overridden by a hint file.
1489 usevfork=false
1490
1491 : Find the basic shell for Bourne shell scripts
1492 case "$sh" in
1493 '')
1494         case "$SYSTYPE" in
1495         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1496         *) xxx='/bin/sh';;
1497         esac
1498         if test -f "$xxx"; then
1499                 sh="$xxx"
1500         else
1501                 : Build up a list and do a single loop so we can 'break' out.
1502                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1503                 for xxx in sh bash ksh pdksh ash; do
1504                         for p in $pth; do
1505                                 try="$try ${p}/${xxx}"
1506                         done
1507                 done
1508                 for xxx in $try; do
1509                         if test -f "$xxx"; then
1510                                 sh="$xxx";
1511                                 break
1512                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1513                                 sh="$xxx";
1514                                 break
1515                         elif test -f "$xxx.exe"; then
1516                                 sh="$xxx";
1517                                 break
1518                         fi
1519                 done
1520         fi
1521         ;;
1522 esac
1523
1524 case "$sh" in
1525 '')     cat >&2 <<EOM
1526 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1527
1528 Usually it's in /bin/sh.  How did you even get this far?
1529 Please contact me (Perl Maintainers) at perlbug@perl.org and
1530 we'll try to straighten this all out.
1531 EOM
1532         exit 1
1533         ;;
1534 esac
1535
1536 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1537 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1538 targetsh=$sh
1539
1540 : see if sh knows # comments
1541 if `$sh -c '#' >/dev/null 2>&1`; then
1542         shsharp=true
1543         spitshell=cat
1544         xcat=/bin/cat
1545         test -f $xcat$_exe || xcat=/usr/bin/cat
1546         if test ! -f $xcat$_exe; then
1547                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1548                         if test -f $p/cat$_exe; then
1549                                 xcat=$p/cat
1550                                 break
1551                         fi
1552                 done
1553                 if test ! -f $xcat$_exe; then
1554                         echo "Can't find cat anywhere!"
1555                         exit 1
1556                 fi
1557         fi
1558         echo "#!$xcat" >sharp
1559         $eunicefix sharp
1560         chmod +x sharp
1561         ./sharp > today 2>/dev/null
1562         if test -s today; then
1563                 sharpbang='#!'
1564         else
1565                 echo "#! $xcat" > sharp
1566                 $eunicefix sharp
1567                 chmod +x sharp
1568                 ./sharp > today 2>/dev/null
1569                 if test -s today; then
1570                         sharpbang='#! '
1571                 else
1572                         sharpbang=': use '
1573                 fi
1574         fi
1575 else
1576         echo " "
1577         echo "Your $sh doesn't grok # comments--I will strip them later on."
1578         shsharp=false
1579         cd ..
1580         echo "exec grep -v '^[  ]*#'" >spitshell
1581         chmod +x spitshell
1582         $eunicefix spitshell
1583         spitshell=`pwd`/spitshell
1584         cd UU
1585         echo "I presume that if # doesn't work, #! won't work either!"
1586         sharpbang=': use '
1587 fi
1588 rm -f sharp today
1589
1590 : figure out how to guarantee sh startup
1591 case "$startsh" in
1592 '') startsh=${sharpbang}${sh} ;;
1593 *)
1594 esac
1595 cat >sharp <<EOSS
1596 $startsh
1597 set abc
1598 test "$?abc" != 1
1599 EOSS
1600
1601 chmod +x sharp
1602 $eunicefix sharp
1603 if ./sharp; then
1604         : echo "Yup, it does."
1605 else
1606         echo "Hmm... '$startsh' does not guarantee sh startup..."
1607         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1608 fi
1609 rm -f sharp
1610
1611 : Save command line options in file UU/cmdline.opt for later use in
1612 : generating config.sh.
1613 cat > cmdline.opt <<EOSH
1614 : Configure command line arguments.
1615 config_arg0='$0'
1616 config_args='$*'
1617 config_argc=$#
1618 EOSH
1619 argn=1
1620 args_exp=''
1621 args_sep=''
1622 for arg in "$@"; do
1623         cat >>cmdline.opt <<EOSH
1624 config_arg$argn='$arg'
1625 EOSH
1626         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1627 $arg
1628 EOC
1629         arg_exp=`cat cmdl.opt`
1630         args_exp="$args_exp$args_sep'$arg_exp'"
1631         argn=`expr $argn + 1`
1632         args_sep=' '
1633 done
1634 rm -f cmdl.opt
1635
1636 : produce awk script to parse command line options
1637 cat >options.awk <<'EOF'
1638 BEGIN {
1639         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1640
1641         len = length(optstr);
1642         for (i = 1; i <= len; i++) {
1643                 c = substr(optstr, i, 1);
1644                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1645                 if (a == ":") {
1646                         arg[c] = 1;
1647                         i++;
1648                 }
1649                 opt[c] = 1;
1650         }
1651 }
1652 {
1653         expect = 0;
1654         str = $0;
1655         if (substr(str, 1, 1) != "-") {
1656                 printf("'%s'\n", str);
1657                 next;
1658         }
1659         len = length($0);
1660         for (i = 2; i <= len; i++) {
1661                 c = substr(str, i, 1);
1662                 if (!opt[c]) {
1663                         printf("-%s\n", substr(str, i));
1664                         next;
1665                 }
1666                 printf("-%s\n", c);
1667                 if (arg[c]) {
1668                         if (i < len)
1669                                 printf("'%s'\n", substr(str, i + 1));
1670                         else
1671                                 expect = 1;
1672                         next;
1673                 }
1674         }
1675 }
1676 END {
1677         if (expect)
1678                 print "?";
1679 }
1680 EOF
1681
1682 : process the command line options
1683 set X `for arg in "$@"; do echo "X$arg"; done |
1684         sed -e s/X// | awk -f options.awk`
1685 eval "set $*"
1686 shift
1687 rm -f options.awk
1688
1689 : set up default values
1690 fastread=''
1691 reuseval=false
1692 config_sh=''
1693 alldone=''
1694 error=''
1695 silent=''
1696 extractsh=''
1697 knowitall=''
1698 rm -f optdef.sh posthint.sh
1699 cat >optdef.sh <<EOS
1700 $startsh
1701 EOS
1702
1703
1704 : option parsing
1705 while test $# -gt 0; do
1706         case "$1" in
1707         -d) shift; fastread=yes;;
1708         -e) shift; alldone=cont;;
1709         -f)
1710                 shift
1711                 cd ..
1712                 if test -r "$1"; then
1713                         config_sh="$1"
1714                 else
1715                         echo "$me: cannot read config file $1." >&2
1716                         error=true
1717                 fi
1718                 cd UU
1719                 shift;;
1720         --help|\
1721         -h) shift; error=true;;
1722         -r) shift; reuseval=true;;
1723         -s) shift; silent=true; realsilent=true;;
1724         -E) shift; alldone=exit;;
1725         -K) shift; knowitall=true;;
1726         -O) shift;;
1727         -S) shift; silent=true; extractsh=true;;
1728         -D)
1729                 shift
1730                 case "$1" in
1731                 *=)
1732                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1733                         echo "$me: ignoring -D $1" >&2
1734                         ;;
1735                 *=*) echo "$1" | \
1736                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1737                 *) echo "$1='define'" >> optdef.sh;;
1738                 esac
1739                 shift
1740                 ;;
1741         -U)
1742                 shift
1743                 case "$1" in
1744                 *=) echo "$1" >> optdef.sh;;
1745                 *=*)
1746                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1747                         echo "$me: ignoring -U $1" >&2
1748                         ;;
1749                 *) echo "$1='undef'" >> optdef.sh;;
1750                 esac
1751                 shift
1752                 ;;
1753         -A)
1754             shift
1755             xxx=''
1756             yyy="$1"
1757             zzz=''
1758             uuu=undef
1759             case "$yyy" in
1760             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1761                  case "$zzz" in
1762                  *:*) zzz='' ;;
1763                  *)   xxx=append
1764                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1765                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1766                  esac
1767                  ;;
1768             esac
1769             case "$xxx" in
1770             '')  case "$yyy" in
1771                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1772                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1773                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1774                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1775                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1776                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1777                  esac
1778                  ;;
1779             esac
1780             case "$xxx" in
1781             append)
1782                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1783             clear)
1784                 echo "$yyy=''"                  >> posthint.sh ;;
1785             define)
1786                 case "$zzz" in
1787                 '') zzz=define ;;
1788                 esac
1789                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1790             eval)
1791                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1792             prepend)
1793                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1794             undef)
1795                 case "$zzz" in
1796                 '') zzz="$uuu" ;;
1797                 esac
1798                 echo "$yyy=$zzz"                >> posthint.sh ;;
1799             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1800             esac
1801             shift
1802             ;;
1803         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1804             exit 0;;
1805         --) break;;
1806         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1807         *) break;;
1808         esac
1809 done
1810
1811 case "$error" in
1812 true)
1813         cat >&2 <<EOM
1814 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1815                  [-U symbol] [-U symbol=] [-A command:symbol...]
1816   -d : use defaults for all answers.
1817   -e : go on without questioning past the production of config.sh.
1818   -f : specify an alternate default configuration file.
1819   -h : print this help message and exit (with an error status).
1820   -r : reuse C symbols value if possible (skips costly nm extraction).
1821   -s : silent mode, only echoes questions and essential information.
1822   -D : define symbol to have some value:
1823          -D symbol         symbol gets the value 'define'
1824          -D symbol=value   symbol gets the value 'value'
1825        common used examples (see INSTALL for more info):
1826          -Duse64bitint            use 64bit integers
1827          -Duse64bitall            use 64bit integers and pointers
1828          -Dusethreads             use thread support
1829          -Dinc_version_list=none  do not include older perl trees in @INC
1830          -DEBUGGING=none          DEBUGGING options
1831          -Dcc=gcc                 choose your compiler
1832          -Dprefix=/opt/perl5      choose your destination
1833   -E : stop at the end of questions, after having produced config.sh.
1834   -K : do not use unless you know what you are doing.
1835   -O : ignored for backward compatibility
1836   -S : perform variable substitutions on all .SH files (can mix with -f)
1837   -U : undefine symbol:
1838          -U symbol    symbol gets the value 'undef'
1839          -U symbol=   symbol gets completely empty
1840        e.g.:  -Uversiononly
1841   -A : manipulate symbol after the platform specific hints have been applied:
1842          -A append:symbol=value   append value to symbol
1843          -A symbol=value          like append:, but with a separating space
1844          -A define:symbol=value   define symbol to have value
1845          -A clear:symbol          define symbol to be ''
1846          -A define:symbol         define symbol to be 'define'
1847          -A eval:symbol=value     define symbol to be eval of value
1848          -A prepend:symbol=value  prepend value to symbol
1849          -A undef:symbol          define symbol to be 'undef'
1850          -A undef:symbol=         define symbol to be ''
1851        e.g.:  -A prepend:libswanted='cl pthread '
1852               -A ccflags=-DSOME_MACRO
1853   -V : print version number and exit (with a zero status).
1854 EOM
1855         exit 1
1856         ;;
1857 esac
1858
1859 : Sanity checks
1860 case "$fastread$alldone" in
1861 yescont|yesexit) ;;
1862 *)
1863         case "$extractsh" in
1864         true) ;;
1865         *)
1866                 if test ! -t 0; then
1867                         echo "Say 'sh Configure', not 'sh <Configure'"
1868                         exit 1
1869                 fi
1870                 ;;
1871         esac
1872         ;;
1873 esac
1874
1875 exec 4>&1
1876 case "$silent" in
1877 true) exec 1>/dev/null;;
1878 esac
1879
1880 : run the defines and the undefines, if any, but leave the file out there...
1881 touch optdef.sh
1882 grep '\\' optdef.sh >/dev/null 2>&1
1883 if test $? = 0; then
1884     echo "Configure does not support \\ in -D arguments"
1885     exit 1
1886 fi
1887 . ./optdef.sh
1888 : create the posthint manipulation script and leave the file out there...
1889 touch posthint.sh
1890
1891 : set package name
1892 package='perl5'
1893 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1894 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1895 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1896 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1897 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1898 esac
1899
1900 : Some greps do not return status, grrr.
1901 echo "grimblepritz" >grimble
1902 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1903         contains=contains
1904 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1905         contains=grep
1906 else
1907         contains=contains
1908 fi
1909 rm -f grimble
1910 : the following should work in any shell
1911 case "$contains" in
1912 contains*)
1913         echo " "
1914         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1915         cat >contains <<'EOSS'
1916 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1917 EOSS
1918 chmod +x contains
1919 esac
1920
1921 : Find the path to the source tree
1922 case "$src" in
1923 '') case "$0" in
1924     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1925          case "$src" in
1926          /*)    ;;
1927          .)     ;;
1928          *)     src=`cd ../$src && pwd` ;;
1929          esac
1930          ;;
1931     *)   src='.';;
1932     esac;;
1933 esac
1934 case "$src" in
1935 '')     src=/
1936         rsrc=/
1937         ;;
1938 /*)     rsrc="$src";;
1939 *)      rsrc="../$src";;
1940 esac
1941 if test -f $rsrc/Configure && \
1942         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1943 then
1944    : found it, so we are ok.
1945 else
1946         rsrc=''
1947         for src in . .. ../.. ../../.. ../../../..; do
1948                 if test -f ../$src/Configure && \
1949                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1950                 then
1951                         rsrc=../$src
1952                         break
1953                 fi
1954         done
1955 fi
1956 case "$rsrc" in
1957 '')
1958         cat <<EOM >&4
1959
1960 Sorry, I can't seem to locate the source dir for $package.  Please start
1961 Configure with an explicit path -- i.e. /some/path/Configure.
1962
1963 EOM
1964         exit 1
1965         ;;
1966 ../.)   rsrc='..';;
1967 *)
1968         echo " "
1969         echo "Sources for $package found in \"$src\"." >&4
1970         ;;
1971 esac
1972
1973 : script used to extract .SH files with variable substitutions
1974 cat >extract <<'EOS'
1975 PERL_CONFIG_SH=true
1976 echo "Doing variable substitutions on .SH files..."
1977 if test -f MANIFEST; then
1978         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1979 else
1980         echo "(Looking for .SH files under the source directory.)"
1981         set x `(cd "$src"; find . -name "*.SH" -print)`
1982 fi
1983 shift
1984 case $# in
1985 0) set x `(cd "$src"; echo *.SH)`; shift;;
1986 esac
1987 if test ! -f "$src/$1"; then
1988         shift
1989 fi
1990 mkdir_p='
1991 name=$1;
1992 create="";
1993 while test $name; do
1994         if test ! -d "$name"; then
1995                 create="$name $create";
1996                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1997                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1998         else
1999                 name="";
2000         fi;
2001 done;
2002 for file in $create; do
2003         mkdir $file;
2004 done
2005 '
2006 for file in $*; do
2007         case "$src" in
2008         ".")
2009                 case "$file" in
2010                 */*)
2011                         dir=`expr X$file : 'X\(.*\)/'`
2012                         file=`expr X$file : 'X.*/\(.*\)'`
2013                         (cd "$dir" && . ./$file)
2014                         ;;
2015                 *)
2016                         . ./$file
2017                         ;;
2018                 esac
2019                 ;;
2020         *)
2021                 case "$file" in
2022                 */*)
2023                         dir=`expr X$file : 'X\(.*\)/'`
2024                         file=`expr X$file : 'X.*/\(.*\)'`
2025                         (set x $dir; shift; eval $mkdir_p)
2026                         sh <"$src/$dir/$file"
2027                         ;;
2028                 *)
2029                         sh <"$src/$file"
2030                         ;;
2031                 esac
2032                 ;;
2033         esac
2034 done
2035 if test -f "$src/config_h.SH"; then
2036         if test ! -f config.h; then
2037         : oops, they left it out of MANIFEST, probably, so do it anyway.
2038         . "$src/config_h.SH"
2039         fi
2040 fi
2041 EOS
2042
2043 : extract files and exit if asked to do so
2044 case "$extractsh" in
2045 true)
2046         case "$realsilent" in
2047         true) ;;
2048         *) exec 1>&4;;
2049         esac
2050         case "$config_sh" in
2051         '') config_sh='config.sh';;
2052         esac
2053         echo " "
2054         echo "Fetching answers from $config_sh..."
2055         cd ..
2056         . $config_sh
2057         . UU/optdef.sh
2058         echo " "
2059         . UU/extract
2060         rm -rf UU
2061         echo "Extraction done."
2062         exit 0
2063         ;;
2064 esac
2065
2066 : Eunice requires " " instead of "", can you believe it
2067 echo " "
2068 : Here we go...
2069 echo "Beginning of configuration questions for $package."
2070
2071 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2072
2073 : first determine how to suppress newline on echo command
2074 echo " "
2075 echo "Checking echo to see how to suppress newlines..."
2076 (echo "hi there\c" ; echo " ") >.echotmp
2077 if $contains c .echotmp >/dev/null 2>&1 ; then
2078         echo "...using -n."
2079         n='-n'
2080         c=''
2081 else
2082         cat <<'EOM'
2083 ...using \c
2084 EOM
2085         n=''
2086         c='\c'
2087 fi
2088 echo $n "The star should be here-->$c"
2089 echo '*'
2090 rm -f .echotmp
2091
2092 : Now test for existence of everything in MANIFEST
2093 echo " "
2094 if test -f "$rsrc/MANIFEST"; then
2095         echo "First let's make sure your kit is complete.  Checking..." >&4
2096         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2097                 (split -l 50 2>/dev/null || split -50)
2098         rm -f missing
2099         tmppwd=`pwd`
2100         for filelist in x??; do
2101                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2102                         >/dev/null 2>>"$tmppwd/missing")
2103         done
2104         if test -s missing; then
2105                 cat missing >&4
2106                 cat >&4 <<'EOM'
2107
2108 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2109
2110 You have the option of continuing the configuration process, despite the
2111 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2112 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2113 and contact the author (perlbug@perl.org).
2114
2115 EOM
2116                 echo $n "Continue? [n] $c" >&4
2117                 read ans
2118                 case "$ans" in
2119                 y*)
2120                         echo "Continuing..." >&4
2121                         rm -f missing
2122                         ;;
2123                 *)
2124                         echo "ABORTING..." >&4
2125                         kill $$
2126                         ;;
2127                 esac
2128         else
2129                 echo "Looks good..."
2130         fi
2131 else
2132         echo "There is no MANIFEST file.  I hope your kit is complete !"
2133 fi
2134 rm -f missing x??
2135
2136 : Find the appropriate value for a newline for tr
2137 if test -n "$DJGPP"; then
2138        trnl='\012'
2139 fi
2140 if test X"$trnl" = X; then
2141         case "`echo foo | tr '\n' x 2>/dev/null`" in
2142         foox) trnl='\n' ;;
2143         esac
2144 fi
2145 if test X"$trnl" = X; then
2146         case "`echo foo | tr '\012' x 2>/dev/null`" in
2147         foox) trnl='\012' ;;
2148         esac
2149 fi
2150 if test X"$trnl" = X; then
2151        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2152        fooxy) trnl='\n\r' ;;
2153        esac
2154 fi
2155 if test X"$trnl" = X; then
2156         cat <<EOM >&2
2157
2158 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2159
2160 EOM
2161         exit 1
2162 fi
2163
2164 : compute the number of columns on the terminal for proper question formatting
2165 case "$COLUMNS" in
2166 '') COLUMNS='80';;
2167 esac
2168
2169 : set up the echo used in my read
2170 myecho="case \"\$xxxm\" in
2171 '') echo $n \"\$rp $c\" >&4;;
2172 *) case \"\$rp\" in
2173         '') echo $n \"[\$xxxm] $c\";;
2174         *)
2175                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2176                         echo \"\$rp\" >&4
2177                         echo $n \"[\$xxxm] $c\" >&4
2178                 else
2179                         echo $n \"\$rp [\$xxxm] $c\" >&4
2180                 fi
2181                 ;;
2182         esac;;
2183 esac"
2184
2185 : now set up to do reads with possible shell escape and default assignment
2186 cat <<EOSC >myread
2187 $startsh
2188 xxxm=\$dflt
2189 $myecho
2190 ans='!'
2191 case "\$fastread" in
2192 yes) case "\$dflt" in
2193         '') ;;
2194         *) ans='';
2195                 case "\$silent-\$rp" in
2196                 true-) ;;
2197                 *) echo " " >&4;;
2198                 esac;;
2199         esac;;
2200 *) case "\$silent" in
2201         true) case "\$rp" in
2202                 '') ans='';;
2203                 esac;;
2204         esac;;
2205 esac
2206 while expr "X\$ans" : "X!" >/dev/null; do
2207         read answ
2208         set x \$xxxm
2209         shift
2210         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2211         case  "\$answ" in
2212         "!")
2213                 sh 1>&4
2214                 echo " "
2215                 $myecho
2216                 ;;
2217         !*)
2218                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2219                 shift
2220                 sh 1>&4 -c "\$*"
2221                 echo " "
2222                 $myecho
2223                 ;;
2224         "\$ans")
2225                 case "\$ans" in
2226                 \\&*)
2227                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2228                         shift
2229                         case "\$1" in
2230                         -d)
2231                                 fastread=yes
2232                                 echo "(OK, I'll run with -d after this question.)" >&4
2233                                 ;;
2234                         -*)
2235                                 echo "*** Sorry, \$1 not supported yet." >&4
2236                                 ;;
2237                         esac
2238                         $myecho
2239                         ans=!
2240                         ;;
2241                 esac;;
2242         *)
2243                 case "\$aok" in
2244                 y)
2245                         echo "*** Substitution done -- please confirm."
2246                         xxxm="\$ans"
2247                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2248                         xxxm="\$ans"
2249                         ans=!
2250                         ;;
2251                 *)
2252                         echo "*** Error -- try again."
2253                         ans=!
2254                         ;;
2255                 esac
2256                 $myecho
2257                 ;;
2258         esac
2259         case "\$ans\$xxxm\$nostick" in
2260         '')
2261                 ans=!
2262                 $myecho
2263                 ;;
2264         esac
2265 done
2266 case "\$ans" in
2267 '') ans="\$xxxm";;
2268 esac
2269 EOSC
2270
2271 : create .config dir to save info across Configure sessions
2272 test -d ../.config || mkdir ../.config
2273 cat >../.config/README <<EOF
2274 This directory created by Configure to save information that should
2275 persist across sessions for $package.
2276
2277 You may safely delete it if you wish.
2278 EOF
2279
2280 : See if we are using a devel version and want that
2281 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2282 case "$usedevel" in
2283 $define|true|[yY]*)
2284     usedevel="$define" ;;
2285 *) case "$xversion" in
2286    *[13579])
2287         cat >&4 <<EOH
2288 *** WHOA THERE!!! ***
2289
2290     This is an UNSTABLE DEVELOPMENT release.
2291     The version of this $package distribution is $xversion, that is, odd,
2292     (as opposed to even) and that signifies a development release.
2293     If you want a maintenance release, you want an even-numbered version.
2294
2295     Do ***NOT*** install this into production use.
2296     Data corruption and crashes are possible.
2297
2298     It is most seriously suggested that you do not continue any further
2299     unless you want to help in developing and debugging Perl.
2300
2301     If you *still* want to build perl, you can answer 'y' now,
2302     or pass -Dusedevel to Configure.
2303
2304 EOH
2305         rp='Do you really want to continue?'
2306         dflt='n'
2307         . ./myread
2308         case "$ans" in
2309         [yY]) echo >&4 "Okay, continuing."
2310               usedevel="$define" ;;
2311         *) echo >&4 "Okay, bye."
2312            exit 1
2313            ;;
2314         esac
2315         ;;
2316     esac
2317     usedevel="$undef"
2318     ;;
2319 esac
2320 case "$usedevel" in
2321 $define|true|[yY]*)
2322         case "$versiononly" in
2323         '') versiononly="$define" ;;
2324         esac
2325         case "$installusrbinperl" in
2326         '') installusrbinperl="$undef" ;;
2327         esac
2328         ;;
2329 esac
2330
2331 : general instructions
2332 needman=true
2333 firsttime=true
2334 user=`(logname) 2>/dev/null`
2335 case "$user" in
2336 '') user=`whoami 2>&1`;;
2337 esac
2338 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2339         firsttime=false
2340         echo " "
2341         rp='Would you like to see the instructions?'
2342         dflt=n
2343         . ./myread
2344         case "$ans" in
2345         [yY]*) ;;
2346         *) needman=false;;
2347         esac
2348 fi
2349 if $needman; then
2350         cat <<EOH
2351
2352 This installation shell script will examine your system and ask you questions
2353 to determine how the perl5 package should be installed. If you get
2354 stuck on a question, you may use a ! shell escape to start a subshell or
2355 execute a command.  Many of the questions will have default answers in square
2356 brackets; typing carriage return will give you the default.
2357
2358 On some of the questions which ask for file or directory names you are allowed
2359 to use the ~name construct to specify the login directory belonging to "name",
2360 even if you don't have a shell which knows about that.  Questions where this is
2361 allowed will be marked "(~name ok)".
2362
2363 EOH
2364         rp=''
2365         dflt='Type carriage return to continue'
2366         . ./myread
2367         cat <<'EOH'
2368
2369 The prompter used in this script allows you to use shell variables and
2370 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2371 in the default answer, as if the default line was a set of arguments given to a
2372 script shell.  This means you may also use $* to repeat the whole default line,
2373 so you do not have to re-type everything to add something to the default.
2374
2375 Every time there is a substitution, you will have to confirm.  If there is an
2376 error (e.g. an unmatched backtick), the default answer will remain unchanged
2377 and you will be prompted again.
2378
2379 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2380 the questions and use the computed defaults (or the previous answers if there
2381 was already a config.sh file). Type 'Configure -h' for a list of options.
2382 You may also start interactively and then answer '& -d' at any prompt to turn
2383 on the non-interactive behaviour for the remainder of the execution.
2384
2385 EOH
2386         . ./myread
2387         cat <<EOH
2388
2389 Much effort has been expended to ensure that this shell script will run on any
2390 Unix system.  If despite that it blows up on yours, your best bet is to edit
2391 Configure and run it again.  If you can't run Configure for some reason,
2392 you'll have to generate a config.sh file by hand.  Whatever problems you
2393 have, let me (perlbug@perl.org) know how I blew it.
2394
2395 This installation script affects things in two ways:
2396
2397 1) it may do direct variable substitutions on some of the files included
2398    in this kit.
2399 2) it builds a config.h file for inclusion in C programs.  You may edit
2400    any of these files as the need arises after running this script.
2401
2402 If you make a mistake on a question, there is no easy way to back up to it
2403 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2404 files.  Configure will offer to let you do this before it runs the SH files.
2405
2406 EOH
2407         dflt='Type carriage return to continue'
2408         . ./myread
2409         case "$firsttime" in
2410         true) echo $user >>../.config/instruct;;
2411         esac
2412 fi
2413
2414 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2415 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2416 if test "X$sysroot" = X; then
2417     sysroot=""
2418 else
2419     case "$cc" in
2420         *gcc*|*g++*)
2421             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2422             # _sysroot is used in places where we need --sysroot=foo
2423             # but using the rest of the flags could cause issues.
2424             _sysroot="--sysroot=$sysroot";
2425             case "$ccflags" in
2426                 *sysroot*) ;;
2427                 'undef'|*)
2428                 ccflags="$ccflags $_sysroot"
2429             esac
2430             case "$ldflags" in
2431                 *sysroot*) ;;
2432                 'undef'|*)
2433                 ldflags="$ldflags $_sysroot"
2434             esac
2435             case "$cppflags" in
2436                 *sysroot*) ;;
2437                 'undef'|*)
2438                 cppflags="$cppflags $_sysroot"
2439             esac
2440             # lddlflags updated below in lddlflags section;
2441             # same with cccdlflags
2442             ;;
2443     esac
2444
2445     # Adjust some defaults to also use $sysroot
2446     for var in xlibpth loclibpth locincpth glibpth; do
2447         eval xxx=\$$var
2448         eval $var=''
2449         for path in $xxx; do
2450             eval $var=\"\$$var $sysroot$path\"
2451         done
2452     done
2453
2454 fi
2455
2456 : find out where common programs are
2457 echo " "
2458 echo "Locating common programs..." >&4
2459 cat <<EOSC >loc
2460 $startsh
2461 case \$# in
2462 0) exit 1;;
2463 esac
2464 thing=\$1
2465 shift
2466 dflt=\$1
2467 shift
2468 for dir in \$*; do
2469         case "\$thing" in
2470         .)
2471         if test -d \$dir/\$thing; then
2472                 echo \$dir
2473                 exit 0
2474         fi
2475         ;;
2476         *)
2477         for thisthing in \$dir/\$thing; do
2478                 : just loop through to pick last item
2479         done
2480         if test -f \$thisthing; then
2481                 echo \$thisthing
2482                 exit 0
2483         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2484                 echo \$thisthing
2485                 exit 0
2486         elif test -f \$dir/\$thing.exe; then
2487                 if test -n "$DJGPP"; then
2488                         echo \$dir/\$thing.exe
2489                 elif test "$eunicefix" != ":"; then
2490                         : on Eunice apparently
2491                         echo \$dir/\$thing
2492                 fi
2493                 exit 0
2494         fi
2495         ;;
2496         esac
2497 done
2498 echo \$dflt
2499 exit 1
2500 EOSC
2501 chmod +x loc
2502 $eunicefix loc
2503 loclist="
2504 awk
2505 cat
2506 chmod
2507 comm
2508 cp
2509 echo
2510 expr
2511 grep
2512 ls
2513 mkdir
2514 rm
2515 sed
2516 sort
2517 touch
2518 tr
2519 uniq
2520 "
2521 trylist="
2522 ar
2523 bison
2524 byacc
2525 cpp
2526 csh
2527 date
2528 egrep
2529 gmake
2530 gzip
2531 less
2532 ln
2533 make
2534 more
2535 nm
2536 nroff
2537 perl
2538 pg
2539 test
2540 uname
2541 zip
2542 "
2543 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2544 pth="$pth $sysroot/lib $sysroot/usr/lib"
2545 for file in $loclist; do
2546         eval xxx=\$$file
2547         case "$xxx" in
2548         /*|?:[\\/]*)
2549                 if test -f "$xxx"; then
2550                         : ok
2551                 else
2552                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2553                         xxx=`./loc $file $file $pth`
2554                 fi
2555                 ;;
2556         '') xxx=`./loc $file $file $pth`;;
2557         *) xxx=`./loc $xxx $xxx $pth`;;
2558         esac
2559         eval $file=$xxx$_exe
2560         eval _$file=$xxx
2561         case "$xxx" in
2562         /*)
2563                 echo $file is in $xxx.
2564                 ;;
2565         ?:[\\/]*)
2566                 echo $file is in $xxx.
2567                 ;;
2568         *)
2569                 echo "I don't know where '$file' is, and my life depends on it." >&4
2570                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2571                 exit 1
2572                 ;;
2573         esac
2574 done
2575 echo " "
2576 echo "Don't worry if any of the following aren't found..."
2577 say=offhand
2578 for file in $trylist; do
2579         eval xxx=\$$file
2580         case "$xxx" in
2581         /*|?:[\\/]*)
2582                 if test -f "$xxx"; then
2583                         : ok
2584                 else
2585                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2586                         xxx=`./loc $file $file $pth`
2587                 fi
2588                 ;;
2589         '') xxx=`./loc $file $file $pth`;;
2590         *) xxx=`./loc $xxx $xxx $pth`;;
2591         esac
2592         eval $file=$xxx$_exe
2593         eval _$file=$xxx
2594         case "$xxx" in
2595         /*)
2596                 echo $file is in $xxx.
2597                 ;;
2598         ?:[\\/]*)
2599                 echo $file is in $xxx.
2600                 ;;
2601         *)
2602                 echo "I don't see $file out there, $say."
2603                 say=either
2604                 ;;
2605         esac
2606 done
2607 case "$egrep" in
2608 egrep)
2609         echo "Substituting grep for egrep."
2610         egrep=$grep
2611         _egrep=$grep
2612         ;;
2613 esac
2614 case "$less" in
2615 '')     ;;
2616 *)      if $less -R </dev/null >/dev/null 2>&1; then
2617                echo "Substituting less -R for less."
2618                less="$less -R"
2619                _less=$less
2620         fi
2621         ;;
2622 esac
2623 case "$ln" in
2624 ln)
2625         echo "Substituting cp for ln."
2626         ln=$cp
2627         _ln=$cp
2628         ;;
2629 esac
2630 case "$make" in
2631 make)
2632         case "$gmake" in
2633         gmake)
2634         echo "I can't find make or gmake, and my life depends on it." >&4
2635         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2636         exit 1
2637         ;;
2638         esac
2639         ;;
2640 esac
2641 case "$gmake" in
2642 gmake)  ;;
2643 *)      # We can't have osname yet.
2644         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2645                 # Assume that gmake, if found, is definitely GNU make
2646                 # and prefer it over the system make.
2647                 echo "Substituting gmake for make."
2648                 make=$gmake
2649                 _make=$gmake
2650         fi
2651         ;;
2652 esac
2653 case "$test" in
2654 test)
2655         echo "Hopefully test is built into your sh."
2656         ;;
2657 *)
2658         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2659                 echo "Using the test built into your sh."
2660                 test=test
2661                 _test=test
2662         fi
2663         ;;
2664 esac
2665 case "$echo" in
2666 echo)
2667         echo "Hopefully echo is built into your sh."
2668         ;;
2669 '') ;;
2670 *)
2671         echo " "
2672 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2673         $echo $n "hi there$c" >foo1
2674         echo $n "hi there$c" >foo2
2675         if cmp foo1 foo2 >/dev/null 2>&1; then
2676                 echo "They are compatible.  In fact, they may be identical."
2677         else
2678                 case "$n" in
2679                 '-n') n='' c='\c';;
2680                 *) n='-n' c='';;
2681                 esac
2682                 cat <<FOO
2683 They are not compatible!  You are probably running ksh on a non-USG system.
2684 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2685 have echo built in and we may have to run some Bourne shell scripts.  That
2686 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2687
2688 FOO
2689                 $echo $n "The star should be here-->$c"
2690                 $echo "*"
2691         fi
2692         $rm -f foo1 foo2
2693         ;;
2694 esac
2695
2696 # This question was auctioned at YAPC::Europe-2007 in Vienna
2697 # I never promised you could answer it. I only auctioned the question.
2698 cat <<FOO
2699 The following message is sponsored by
2700
2701   Dresden.pm<--The stars should be here.
2702
2703 Dear Perl user, system administrator or package
2704 maintainer, the Perl community sends greetings to
2705 you. Do you (emblematical) greet back [Y/n]? n
2706
2707 FOO
2708
2709 : Check what type of C compiler we use
2710 cat <<EOS >trygcc
2711 $startsh
2712 EOS
2713 cat <<'EOSC' >>trygcc
2714 case "$cc" in
2715 '') ;;
2716 *)  $rm -f try try.*
2717     $cat >try.c <<EOM
2718 int main(int argc, char *argv[]) {
2719   return 0;
2720 }
2721 EOM
2722     if $cc -o try $ccflags $ldflags try.c; then
2723        :
2724     else
2725         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2726         despair=yes
2727         trygcc=yes
2728         case "$cc" in
2729         *gcc*) trygcc=no ;;
2730         esac
2731         # Skip this test because it gives a false match on output like:
2732         #    ./trygcc: line 23: cc: command not found
2733         # case "`$cc -v -c try.c 2>&1`" in
2734         # *gcc*) trygcc=no ;;
2735         # esac
2736         if $test X"$trygcc" = Xyes; then
2737             if gcc -o try -c try.c; then
2738                 echo " "
2739                 echo "You seem to have a working gcc, though." >&4
2740                 # Switching compilers may undo the work of hints files.
2741                 # The most common problem is -D_REENTRANT for threads.
2742                 # This heuristic catches that case, but gets false positives
2743                 # if -Dusethreads was not actually specified.  Better to
2744                 # bail out here with a useful message than fail
2745                 # mysteriously later. Should we perhaps just try to
2746                 # re-invoke Configure -Dcc=gcc config_args ?
2747                 if $test -f usethreads.cbu; then
2748                         $cat >&4 <<EOM
2749
2750 *** However, any setting of the C compiler flags (e.g. for thread support)
2751 *** will be lost.  It may be necessary for you to restart Configure and
2752 *** add -Dcc=gcc to your Configure command line.
2753
2754 EOM
2755                         rp="Would you like to go ahead and try gcc anyway?"
2756                         dflt=n
2757                 else
2758                         rp="Would you like to use it?"
2759                         dflt=y
2760                 fi
2761                 if $test -f myread; then
2762                     . ./myread
2763                 else
2764                     if $test -f UU/myread; then
2765                         . ./UU/myread
2766                     else
2767                         echo "Cannot find myread, sorry.  Aborting." >&2
2768                         exit 1
2769                     fi
2770                 fi
2771                 case "$ans" in
2772                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2773                 esac
2774             fi
2775         fi
2776     fi
2777     $rm -f try try.*
2778     ;;
2779 esac
2780 EOSC
2781
2782 cat <<EOS >checkcc
2783 $startsh
2784 EOS
2785 cat <<'EOSC' >>checkcc
2786 case "$cc" in
2787 '') ;;
2788 *)  $rm -f try try.*
2789     $cat >try.c <<EOM
2790 int main(int argc, char *argv[]) {
2791   return 0;
2792 }
2793 EOM
2794     if $cc -o try $ccflags $ldflags try.c; then
2795        :
2796     else
2797         if $test X"$despair" = Xyes; then
2798            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2799         fi
2800         $cat >&4 <<EOM
2801 You need to find a working C compiler.
2802 Either (purchase and) install the C compiler supplied by your OS vendor,
2803 or for a free C compiler try http://gcc.gnu.org/
2804 I cannot continue any further, aborting.
2805 EOM
2806         exit 1
2807     fi
2808     $rm -f try try.*
2809     ;;
2810 esac
2811 EOSC
2812
2813 : determine whether symbolic links are supported
2814 echo " "
2815 $touch blurfl
2816 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2817         echo "Symbolic links are supported." >&4
2818         lns="$ln -s"
2819 else
2820         echo "Symbolic links are NOT supported." >&4
2821         lns="$ln"
2822 fi
2823 $rm -f blurfl sym
2824
2825 : determine whether symbolic links are supported
2826 echo " "
2827 case "$lns" in
2828 *"ln"*" -s")
2829         echo "Checking how to test for symbolic links..." >&4
2830         $lns blurfl sym
2831         if $test "X$issymlink" = X; then
2832                 case "$newsh" in
2833                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2834                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2835                 esac
2836                 if test $? = 0; then
2837                         issymlink="test -h"
2838                 else
2839                         echo "Your builtin 'test -h' may be broken." >&4
2840                         case "$test" in
2841                         /*)     ;;
2842                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2843                                 for p in $pth
2844                                 do
2845                                         if test -f "$p/$test"; then
2846                                                 test="$p/$test"
2847                                                 break
2848                                         fi
2849                                 done
2850                                 ;;
2851                         esac
2852                         case "$test" in
2853                         /*)
2854                                 echo "Trying external '$test -h'." >&4
2855                                 issymlink="$test -h"
2856                                 if $test ! -h sym >/dev/null 2>&1; then
2857                                         echo "External '$test -h' is broken, too." >&4
2858                                         issymlink=''
2859                                 fi
2860                                 ;;
2861                         *)      issymlink='' ;;
2862                         esac
2863                 fi
2864         fi
2865         if $test "X$issymlink" = X; then
2866                 if $test -L sym 2>/dev/null; then
2867                         issymlink="$test -L"
2868                         echo "The builtin '$test -L' worked." >&4
2869                 fi
2870         fi
2871         if $test "X$issymlink" != X; then
2872                 echo "You can test for symbolic links with '$issymlink'." >&4
2873         else
2874                 echo "I do not know how you can test for symbolic links." >&4
2875         fi
2876         $rm -f blurfl sym
2877         ;;
2878 *)      echo "No symbolic links, so not testing for their testing..." >&4
2879         ;;
2880 esac
2881
2882 : Make symlinks util
2883 case "$mksymlinks" in
2884 $define|true|[yY]*)
2885         case "$src" in
2886         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2887                 exit 1
2888                 ;;
2889         *)      case "$lns:$issymlink" in
2890                 *"ln"*" -s:"*"test -"?)
2891                         echo "Creating the symbolic links..." >&4
2892                         cd ..
2893                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2894                         awk 'NF == 1 {
2895                                 dir=".";
2896                                 file=$1 "";
2897                              }
2898                              NF == 2 {
2899                                 dir=$1 "";
2900                                 file=$2 "";
2901                              }
2902                              {
2903                                  print "# dir = ", dir, "file = ", file
2904                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2905                              } END {
2906                                  for (d in mf) {
2907                                      if (d != ".") { print("mkdir -p "d) }
2908                                      print("ln -sf "mf[d]" "d);
2909                                  }
2910                              }' source="$src" > UU/mksymlinks.$$
2911                         sh UU/mksymlinks.$$
2912                         rm UU/mksymlinks.$$
2913                         # Sanity check 1.
2914                         if test ! -d t/base; then
2915                                 echo "Failed to create the subdirectories.  Aborting." >&4
2916                                 exit 1
2917                         fi
2918                         # Sanity check 2.
2919                         if test ! -f t/base/lex.t; then
2920                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2921                                 exit 1
2922                         fi
2923                         if test ! -f win32/win32.c; then
2924                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2925                                 exit 1
2926                         fi
2927                         cd UU
2928                         ;;
2929                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2930                         ;;
2931                 esac
2932                 ;;
2933         esac
2934         ;;
2935 esac
2936
2937 : Check for Cross-Compilation
2938 if $test "X$targethost" = "X"; then
2939     targethost=""
2940 fi
2941 if $test "X$targetenv" = "X"; then
2942     targetenv=""
2943 fi
2944 case "$usecrosscompile" in
2945 $define|true|[yY]*)
2946         $echo "Cross-compiling..."
2947         croak=''
2948         case "$cc" in
2949         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2950             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2951             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2952             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2953             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2954             # leave out ld, choosing it is more complex
2955             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2956             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2957             # We are in a weird spot. Just before us, some values
2958             # were 'saved', to be restored after the hints are
2959             # run.  This means that the changes we made to ar,
2960             # nm and ranlib will get reverted.
2961             # To avoid that, we hijack the saving mechanism and
2962             # have it save our new values.
2963             for file in ar nm ranlib; do
2964                 eval xxx=\$$file
2965                 eval $file=$xxx$_exe
2966                 eval _$file=$xxx
2967             done
2968         ;;
2969         esac
2970         case "$targetarch" in
2971         '') echo "Targetarch not defined." >&4; croak=y ;;
2972         *)  echo "Using targetarch $targetarch." >&4 ;;
2973         esac
2974         case "$targethost" in
2975         '') echo "Targethost not defined." >&4; croak=n ;;
2976         *)  echo "Using targethost $targethost." >&4
2977         esac
2978         locincpth=' '
2979         loclibpth=' '
2980         case "$croak" in
2981         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2982         esac
2983     : compile a host miniperl and generate_uudmap, unless we got passed them
2984     if $test "X$hostperl" = X; then
2985       echo "Building host miniperl and generate_uudmap binaries" >&4
2986       before_host=`pwd`
2987       cd ..
2988       cd $src
2989       src=`pwd`
2990       rm -rf $src/host
2991       mkdir $src/host
2992       cd $src/host
2993       $src/Configure -des -Dusedevel -Dmksymlinks
2994       $make miniperl
2995       case "$hostgenerate" in
2996       '') $make generate_uudmap
2997           hostgenerate=$src/host/generate_uudmap
2998           ;;
2999        "$undef") hostgenerate=''
3000           ;;
3001       esac
3002       hostperl=$src/host/miniperl
3003       cd $before_host
3004     fi
3005     hostosname=`$hostperl -le 'print $^O'`
3006     ;;
3007 *)
3008     usecrosscompile="$undef"
3009     ;;
3010 esac
3011
3012 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3013 case "$targethost" in
3014     '') echo "Checking for cross-compile" >&4
3015     case "$usecrosscompile$multiarch" in
3016        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3017          if [ -f Makefile ]; then
3018            echo " "
3019            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3020          else
3021            echo "Configure done."
3022          fi
3023        exit 0
3024        ;;
3025      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3026         run=''
3027         to=:
3028         from=:
3029         ;;
3030     esac
3031     ;;
3032     *) echo "Using targethost $targethost." >&4
3033         case "$src" in
3034         /*) run=$src/Cross/run
3035             targetmkdir=$src/Cross/mkdir
3036             to=$src/Cross/to
3037             from=$src/Cross/from
3038             ;;
3039         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3040             run=$pwd/Cross/run
3041             targetmkdir=$pwd/Cross/mkdir
3042             to=$pwd/Cross/to
3043             from=$pwd/Cross/from
3044             ;;
3045         esac
3046         case "$targetrun" in
3047         '') targetrun=ssh ;;
3048         esac
3049         case "$targetto" in
3050         '') targetto=scp ;;
3051         esac
3052         case "$targetfrom" in
3053         '') targetfrom=scp ;;
3054         esac
3055         run=$run-$targetrun
3056         to=$to-$targetto
3057         from=$from-$targetfrom
3058         case "$targetdir" in
3059         '')  targetdir=/tmp
3060              echo "Guessing targetdir $targetdir." >&4
3061              ;;
3062         esac
3063         case "$targetuser" in
3064         '')  targetuser=root
3065              echo "Guessing targetuser $targetuser." >&4
3066              ;;
3067         esac
3068         case "$targetport" in
3069         '')  targetport=22
3070              echo "Guessing targetport $targetport." >&4
3071              ;;
3072         esac
3073         case "$targetfrom" in
3074         scp)    q=-q ;;
3075         *)      q='' ;;
3076         esac
3077         case "$targetrun" in
3078         ssh|rsh)
3079             cat >$run <<EOF
3080 #!/bin/sh
3081 env=''
3082 case "\$1" in
3083 -cwd)
3084   shift
3085   cwd=\$1
3086   shift
3087   ;;
3088 esac
3089 case "\$1" in
3090 -env)
3091   shift
3092   env=\$1
3093   shift
3094   ;;
3095 esac
3096 case "\$cwd" in
3097 '') cwd=$targetdir ;;
3098 esac
3099 exe=\$1
3100 shift
3101 $to \$exe
3102 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3103 EOF
3104             ;;
3105         adb)
3106             $touch $run
3107             ;;
3108         *)  echo "Unknown targetrun '$targetrun'" >&4
3109             exit 1
3110             ;;
3111         esac
3112         case "$targetmkdir" in
3113         */Cross/mkdir)
3114             cat >$targetmkdir <<EOF
3115 #!/bin/sh
3116 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3117 EOF
3118             $chmod a+rx $targetmkdir
3119             ;;
3120         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3121             exit 1
3122             ;;
3123         esac
3124         case "$targetto" in
3125         scp|rcp)
3126             cat >$to <<EOF
3127 #!/bin/sh
3128 for f in \$@
3129 do
3130   case "\$f" in
3131   /*)
3132     $targetmkdir \`dirname \$f\`
3133     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3134     ;;
3135   *)
3136     $targetmkdir $targetdir/\`dirname \$f\`
3137     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3138     ;;
3139   esac
3140 done
3141 exit 0
3142 EOF
3143             ;;
3144         cp) cat >$to <<EOF
3145 #!/bin/sh
3146 for f in \$@
3147 do
3148   case "\$f" in
3149   /*)
3150     $mkdir -p $targetdir/\`dirname \$f\`
3151     $cp \$f $targetdir/\$f || exit 1
3152     ;;
3153   *)
3154     $targetmkdir $targetdir/\`dirname \$f\`
3155     $cp \$f $targetdir/\$f || exit 1
3156     ;;
3157   esac
3158 done
3159 exit 0
3160 EOF
3161             ;;
3162         *)  echo "Unknown targetto '$targetto'" >&4
3163             exit 1
3164             ;;
3165         esac
3166         case "$targetfrom" in
3167         scp|rcp)
3168           cat >$from <<EOF
3169 #!/bin/sh
3170 for f in \$@
3171 do
3172   $rm -f \$f
3173   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3174 done
3175 exit 0
3176 EOF
3177             ;;
3178         cp) cat >$from <<EOF
3179 #!/bin/sh
3180 for f in \$@
3181 do
3182   $rm -f \$f
3183   cp $targetdir/\$f . || exit 1
3184 done
3185 exit 0
3186 EOF
3187             ;;
3188         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3189             exit 1
3190             ;;
3191         esac
3192         if $test ! -f $run; then
3193             echo "Target 'run' script '$run' not found." >&4
3194         else
3195             $chmod a+rx $run
3196         fi
3197         if $test ! -f $to; then
3198             echo "Target 'to' script '$to' not found." >&4
3199         else
3200             $chmod a+rx $to
3201         fi
3202         if $test ! -f $from; then
3203             echo "Target 'from' script '$from' not found." >&4
3204         else
3205             $chmod a+rx $from
3206         fi
3207         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3208             exit 1
3209         fi
3210         cat >&4 <<EOF
3211 Using '$run' for remote execution,
3212 and '$from' and '$to'
3213 for remote file transfer.
3214 EOF
3215         ;;
3216 *)      run=''
3217         to=:
3218         from=:
3219         usecrosscompile="$undef"
3220         targetarch=''
3221         ;;
3222 esac
3223
3224 : see whether [:lower:] and [:upper:] are supported character classes
3225 echo " "
3226 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3227 ABYZ-abyz)
3228         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3229         up='[:upper:]'
3230         low='[:lower:]'
3231         ;;
3232 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3233         # (0xd9 and 0xe2), therefore that is a nice testing point.
3234         if test "X$up" = X -o "X$low" = X; then
3235             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3236             rs) up='[A-Z]'
3237                 low='[a-z]'
3238                 ;;
3239             esac
3240         fi
3241         if test "X$up" = X -o "X$low" = X; then
3242             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3243             rs) up='A-Z'
3244                 low='a-z'
3245                 ;;
3246             esac
3247         fi
3248         if test "X$up" = X -o "X$low" = X; then
3249             case "`echo RS | od -x 2>/dev/null`" in
3250             *D9E2*|*d9e2*)
3251                 echo "Hey, this might be EBCDIC." >&4
3252                 if test "X$up" = X -o "X$low" = X; then
3253                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3254                     rs) up='[A-IJ-RS-Z]'
3255                         low='[a-ij-rs-z]'
3256                         ;;
3257                     esac
3258                 fi
3259                 if test "X$up" = X -o "X$low" = X; then
3260                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3261                     rs) up='A-IJ-RS-Z'
3262                         low='a-ij-rs-z'
3263                         ;;
3264                     esac
3265                 fi
3266                 ;;
3267             esac
3268         fi
3269 esac
3270 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3271 rs)
3272     echo "Using $up and $low to convert case." >&4
3273     ;;
3274 *)
3275     echo "I don't know how to translate letters from upper to lower case." >&4
3276     echo "Your tr is not acting any way I know of." >&4
3277     exit 1
3278     ;;
3279 esac
3280 : set up the translation script tr, must be called with ./tr of course
3281 cat >tr <<EOSC
3282 $startsh
3283 case "\$1\$2" in
3284 '[A-Z][a-z]') exec $tr '$up' '$low';;
3285 '[a-z][A-Z]') exec $tr '$low' '$up';;
3286 esac
3287 exec $tr "\$@"
3288 EOSC
3289 chmod +x tr
3290 $eunicefix tr
3291
3292 : Try to determine whether config.sh was made on this system
3293 case "$config_sh" in
3294 '')
3295 myuname=`$uname -a 2>/dev/null`
3296 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3297 # Downcase everything to avoid ambiguity.
3298 # Remove slashes and single quotes so we can use parts of this in
3299 # directory and file names.
3300 # Remove newlines so myuname is sane to use elsewhere.
3301 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3302 # because the A-Z/a-z are not consecutive.
3303 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3304         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3305 newmyuname="$myuname"
3306 dflt=n
3307 case "$knowitall" in
3308 '')
3309         if test -f ../config.sh; then
3310                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3311                         eval "`grep myuname= ../config.sh`"
3312                 fi
3313                 if test "X$myuname" = "X$newmyuname"; then
3314                         dflt=y
3315                 fi
3316         fi
3317         ;;
3318 *) dflt=y;;
3319 esac
3320
3321 : Get old answers from old config file if Configure was run on the
3322 : same system, otherwise use the hints.
3323 hint=default
3324 cd ..
3325 if test -f config.sh; then
3326         echo " "
3327         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3328         . UU/myread
3329         case "$ans" in
3330         n*|N*) echo "OK, I'll ignore it."
3331                 mv config.sh config.sh.old
3332                 myuname="$newmyuname"
3333                 ;;
3334         *)  echo "Fetching default answers from your old config.sh file..." >&4
3335                 tmp_n="$n"
3336                 tmp_c="$c"
3337                 tmp_sh="$sh"
3338                 . ./config.sh
3339                 cp config.sh UU
3340                 n="$tmp_n"
3341                 c="$tmp_c"
3342                 : Older versions did not always set $sh.  Catch re-use of such
3343                 : an old config.sh.
3344                 case "$sh" in
3345                 '') sh="$tmp_sh" ;;
3346                 esac
3347                 hint=previous
3348                 ;;
3349         esac
3350 fi
3351 . ./UU/checkcc
3352 if test ! -f config.sh; then
3353         $cat <<EOM
3354
3355 First time through, eh?  I have some defaults handy for some systems
3356 that need some extra help getting the Configure answers right:
3357
3358 EOM
3359         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3360         dflt=''
3361         : Half the following guesses are probably wrong... If you have better
3362         : tests or hints, please send them to perlbug@perl.org
3363         : The metaconfig authors would also appreciate a copy...
3364         $test -f /irix && osname=irix
3365         $test -f /xenix && osname=sco_xenix
3366         $test -f /dynix && osname=dynix
3367         $test -f /dnix && osname=dnix
3368         $test -f /lynx.os && osname=lynxos
3369         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3370         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3371         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3372         $test -f /bin/mips && /bin/mips && osname=mips
3373         $test -d /usr/apollo/bin && osname=apollo
3374         $test -f /etc/saf/_sactab && osname=svr4
3375         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3376         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3377         $test -f /sys/utilities/MultiView && osname=amigaos
3378         if $test -d /MachTen -o -d /MachTen_Folder; then
3379                 osname=machten
3380                 if $test -x /sbin/version; then
3381                         osvers=`/sbin/version | $awk '{print $2}' |
3382                         $sed -e 's/[A-Za-z]$//'`
3383                 elif $test -x /usr/etc/version; then
3384                         osvers=`/usr/etc/version | $awk '{print $2}' |
3385                         $sed -e 's/[A-Za-z]$//'`
3386                 else
3387                         osvers="$2.$3"
3388                 fi
3389         fi
3390
3391         $test -f /sys/posix.dll &&
3392                 $test -f /usr/bin/what &&
3393                 set X `/usr/bin/what /sys/posix.dll` &&
3394                 $test "$3" = UWIN &&
3395                 osname=uwin &&
3396                 osvers="$5"
3397
3398         if $test -f $uname; then
3399                 set X $myuname
3400                 shift
3401
3402                 case "$5" in
3403                 fps*) osname=fps ;;
3404                 mips*)
3405                         case "$4" in
3406                         umips) osname=umips ;;
3407                         *) osname=mips ;;
3408                         esac;;
3409                 [23]100) osname=mips ;;
3410                 i386*)
3411                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3412                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3413                                 osname='sco'
3414                                 osvers=$tmp
3415                         elif $test -f /etc/kconfig; then
3416                                 osname=isc
3417                                 if test "$lns" = "$ln -s"; then
3418                                         osvers=4
3419                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3420                                         osvers=3
3421                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3422                                         osvers=2
3423                                 fi
3424                         fi
3425                         tmp=''
3426                         ;;
3427                 pc*)
3428                         if test -n "$DJGPP"; then
3429                                 osname=dos
3430                                 osvers=djgpp
3431                         fi
3432                         ;;
3433                 esac
3434
3435                 case "$1" in
3436                 aix) osname=aix
3437                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3438                         case "$tmp" in
3439                         # oslevel can fail with:
3440                         # oslevel: Unable to acquire lock.
3441                         *not\ found) osvers="$4"."$3" ;;
3442                         '<3240'|'<>3240') osvers=3.2.0 ;;
3443                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3444                         '=3250'|'>3250') osvers=3.2.5 ;;
3445                         *) osvers=$tmp;;
3446                         esac
3447                         ;;
3448                 bitrig) osname=bitrig
3449                         osvers="$3"
3450                         ;;
3451                 bsd386) osname=bsd386
3452                         osvers=`$uname -r`
3453                         ;;
3454                 cygwin*) osname=cygwin
3455                         osvers="$3"
3456                         ;;
3457                 *dc.osx) osname=dcosx
3458                         osvers="$3"
3459                         ;;
3460                 dnix) osname=dnix
3461                         osvers="$3"
3462                         ;;
3463                 domainos) osname=apollo
3464                         osvers="$3"
3465                         ;;
3466                 dgux)   osname=dgux
3467                         osvers="$3"
3468                         ;;
3469                 dragonfly) osname=dragonfly
3470                         osvers="$3"
3471                         ;;
3472                 dynixptx*) osname=dynixptx
3473                         osvers=`echo "$4"|sed 's/^v//'`
3474                         ;;
3475                 freebsd) osname=freebsd
3476                         osvers="$3" ;;
3477                 genix)  osname=genix ;;
3478                 gnu)    osname=gnu
3479                         osvers="$3" ;;
3480                 hp*)    osname=hpux
3481                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3482                         ;;
3483                 irix*)  osname=irix
3484                         case "$3" in
3485                         4*) osvers=4 ;;
3486                         5*) osvers=5 ;;
3487                         *)      osvers="$3" ;;
3488                         esac
3489                         ;;
3490                 linux)  osname=linux
3491                         case "$3" in
3492                         *)      osvers="$3" ;;
3493                         esac
3494                         $test -f /system/lib/libandroid.so && osname=linux-android
3495                         ;;
3496                 MiNT)   osname=mint
3497                         ;;
3498                 netbsd*) osname=netbsd
3499                         osvers="$3"
3500                         ;;
3501                 news-os) osvers="$3"
3502                         case "$3" in
3503                         4*) osname=newsos4 ;;
3504                         *) osname=newsos ;;
3505                         esac
3506                         ;;
3507                 nonstop-ux) osname=nonstopux ;;
3508                 openbsd) osname=openbsd
3509                         osvers="$3"
3510                         ;;
3511                 os2)    osname=os2
3512                         osvers="$4"
3513                         ;;
3514                 POSIX-BC | posix-bc ) osname=posix-bc
3515                         osvers="$3"
3516                         ;;
3517                 powerux | power_ux | powermax_os | powermaxos | \
3518                 powerunix | power_unix) osname=powerux
3519                         osvers="$3"
3520                         ;;
3521                 qnx) osname=qnx
3522                         osvers="$4"
3523                         ;;
3524                 solaris) osname=solaris
3525                         case "$3" in
3526                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3527                         *)      osvers="$3" ;;
3528                         esac
3529                         ;;
3530                 sunos) osname=sunos
3531                         case "$3" in
3532                         5*) osname=solaris
3533                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3534                         *)      osvers="$3" ;;
3535                         esac
3536                         ;;
3537                 titanos) osname=titanos
3538                         case "$3" in
3539                         1*) osvers=1 ;;
3540                         2*) osvers=2 ;;
3541                         3*) osvers=3 ;;
3542                         4*) osvers=4 ;;
3543                         *)      osvers="$3" ;;
3544                         esac
3545                         ;;
3546                 ultrix) osname=ultrix
3547                         osvers="$3"
3548                         ;;
3549                 osf1|mls+)      case "$5" in
3550                                 alpha)
3551                                         osname=dec_osf
3552                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3553                                         case "$osvers" in
3554                                         [1-9].[0-9]*) ;;
3555                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3556                                         esac
3557                                         ;;
3558                         hp*)    osname=hp_osf1  ;;
3559                         mips)   osname=mips_osf1 ;;
3560                         esac
3561                         ;;
3562                 # UnixWare 7.1.2 is known as Open UNIX 8
3563                 openunix|unixware) osname=svr5
3564                         osvers="$4"
3565                         ;;
3566                 uts)    osname=uts
3567                         osvers="$3"
3568                         ;;
3569                 vos) osvers="$3"
3570                         ;;
3571                 $2) case "$osname" in
3572                         *isc*) ;;
3573                         *freebsd*) ;;
3574                         svr*)
3575                                 : svr4.x or possibly later
3576                                 case "svr$3" in
3577                                 ${osname}*)
3578                                         osname=svr$3
3579                                         osvers=$4
3580                                         ;;
3581                                 esac
3582                                 case "$osname" in
3583                                 svr4.0)
3584                                         : Check for ESIX
3585                                         if test -f /stand/boot ; then
3586                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3587                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3588                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3589                                                         if test -n "$isesix"; then
3590                                                                 osname=esix4
3591                                                         fi
3592                                                 fi
3593                                         fi
3594                                         ;;
3595                                 esac
3596                                 ;;
3597                         *)      if test -f /etc/systemid; then
3598                                         osname=sco
3599                                         set `echo $3 | $sed 's/\./ /g'` $4
3600                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3601                                                 osvers=$1.$2.$3
3602                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3603                                                 osvers=$1.$2
3604                                         elif $test -f $src/hints/sco_$1.sh; then
3605                                                 osvers=$1
3606                                         fi
3607                                 else
3608                                         case "$osname" in
3609                                         '') : Still unknown.  Probably a generic Sys V.
3610                                                 osname="sysv"
3611                                                 osvers="$3"
3612                                                 ;;
3613                                         esac
3614                                 fi
3615                                 ;;
3616                         esac
3617                         ;;
3618                 *)      case "$osname" in
3619                         '') : Still unknown.  Probably a generic BSD.
3620                                 osname="$1"
3621                                 osvers="$3"
3622                                 ;;
3623                         esac
3624                         ;;
3625                 esac
3626         else
3627                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3628                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3629                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3630                                 osname=news_os
3631                         fi
3632                         $rm -f UU/kernel.what
3633                 elif test -d c:/. -o -n "$is_os2" ; then
3634                         set X $myuname
3635                         osname=os2
3636                         osvers="$5"
3637                 fi
3638         fi
3639
3640         case "$targetarch" in
3641         '') ;;
3642         *)  hostarch=$osname
3643             case "$targetarch" in
3644                 nto*|*-nto-*)
3645                     # Will load qnx.sh, which should change osname to nto
3646                     osname=qnx
3647                     osvers=''
3648                     ;;
3649                 *linux-android*)
3650                     # Catch arm-linux-androideabi, mipsel-linux-android,
3651                     # and i686-linux-android
3652                     osname=linux-android
3653                     osvers=''
3654                     ;;
3655                 *linux*)
3656                     # Something like arm-linux-gnueabihf is really just
3657                     # plain linux.
3658                     osname=linux
3659                     osvers=''
3660                     ;;
3661                 *solaris*|*sunos*)
3662                     osname=solaris
3663                     # XXX perhaps we should just assume
3664                     # osvers to be 2, or maybe take the value
3665                     # from targetarch. Using $run before the
3666                     # hints are run is somewhat icky.
3667                     set X `$run $uname -a 2>/dev/null`
3668                     shift
3669                     case "$3" in
3670                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3671                         *)  osvers="$3" ;;
3672                     esac
3673                     ;;
3674                 *)
3675                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3676                     osvers=''
3677                 ;;
3678             esac
3679             ;;
3680         esac
3681
3682         : Now look for a hint file osname_osvers, unless one has been
3683         : specified already.
3684         case "$hintfile" in
3685         ''|' ')
3686                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3687                 : Also try without trailing minor version numbers.
3688                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3689                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3690                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3691                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3692                 case "$file" in
3693                 '') dflt=none ;;
3694                 *)  case "$osvers" in
3695                         '') dflt=$file
3696                                 ;;
3697                         *)  if $test -f $src/hints/$file.sh ; then
3698                                         dflt=$file
3699                                 elif $test -f $src/hints/$xfile.sh ; then
3700                                         dflt=$xfile
3701                                 elif $test -f $src/hints/$xxfile.sh ; then
3702                                         dflt=$xxfile
3703                                 elif $test -f $src/hints/$xxxfile.sh ; then
3704                                         dflt=$xxxfile
3705                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3706                                         dflt=$xxxxfile
3707                                 elif $test -f "$src/hints/${osname}.sh" ; then
3708                                         dflt="${osname}"
3709                                 else
3710                                         dflt=none
3711                                 fi
3712                                 ;;
3713                         esac
3714                         ;;
3715                 esac
3716                 if $test -f Policy.sh ; then
3717                         case "$dflt" in
3718                         *Policy*) ;;
3719                         none) dflt="Policy" ;;
3720                         *) dflt="Policy $dflt" ;;
3721                         esac
3722                 fi
3723                 ;;
3724         *)
3725                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3726                 ;;
3727         esac
3728
3729         if $test -f Policy.sh ; then
3730                 $cat <<EOM
3731
3732 There's also a Policy hint file available, which should make the
3733 site-specific (policy) questions easier to answer.
3734 EOM
3735
3736         fi
3737
3738         $cat <<EOM
3739
3740 You may give one or more space-separated answers, or "none" if appropriate.
3741 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3742 previous run of Configure, you may specify it as well as or instead of
3743 OS-specific hints.  If hints are provided for your OS, you should use them:
3744 although Perl can probably be built without hints on many platforms, using
3745 hints often improve performance and may enable features that Configure can't
3746 set up on its own. If there are no hints that match your OS, specify "none";
3747 DO NOT give a wrong version or a wrong OS.
3748
3749 EOM
3750
3751         rp="Which of these apply, if any?"
3752         . UU/myread
3753         tans=$ans
3754         for file in $tans; do
3755                 if $test X$file = XPolicy -a -f Policy.sh; then
3756                         . Policy.sh
3757                         $cat Policy.sh >> UU/config.sh
3758                 elif $test -f $src/hints/$file.sh; then
3759                         . $src/hints/$file.sh
3760                         $cat $src/hints/$file.sh >> UU/config.sh
3761                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3762                         : nothing
3763                 else
3764                         : Give one chance to correct a possible typo.
3765                         echo "$file.sh does not exist"
3766                         dflt=$file
3767                         rp="hint to use instead?"
3768                         . UU/myread
3769                         for file in $ans; do
3770                                 if $test -f "$src/hints/$file.sh"; then
3771                                         . $src/hints/$file.sh
3772                                         $cat $src/hints/$file.sh >> UU/config.sh
3773                                 elif $test X$ans = X -o X$ans = Xnone ; then
3774                                         : nothing
3775                                 else
3776                                         echo "$file.sh does not exist -- ignored."
3777                                 fi
3778                         done
3779                 fi
3780         done
3781
3782         hint=recommended
3783         : Remember our hint file for later.
3784         if $test -f "$src/hints/$file.sh" ; then
3785                 hintfile="$file"
3786         else
3787                 hintfile=''
3788         fi
3789 fi
3790 cd UU
3791 ;;
3792 *)
3793         echo " "
3794         echo "Fetching default answers from $config_sh..." >&4
3795         tmp_n="$n"
3796         tmp_c="$c"
3797         cd ..
3798         cp $config_sh config.sh 2>/dev/null
3799         chmod +w config.sh
3800         . ./config.sh
3801         cd UU
3802         cp ../config.sh .
3803         n="$tmp_n"
3804         c="$tmp_c"
3805         hint=previous
3806         ;;
3807 esac
3808 . ./optdef.sh
3809
3810 : Restore computed paths
3811 for file in $loclist $trylist; do
3812         eval $file="\$_$file"
3813 done
3814
3815 cat << EOM
3816
3817 Configure uses the operating system name and version to set some defaults.
3818 The default value is probably right if the name rings a bell. Otherwise,
3819 since spelling matters for me, either accept the default or answer "none"
3820 to leave it blank.
3821
3822 EOM
3823 case "$osname" in
3824         ''|' ')
3825                 case "$hintfile" in
3826                 ''|' '|none) dflt=none ;;
3827                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3828                 esac
3829                 ;;
3830         *) dflt="$osname" ;;
3831 esac
3832 rp="Operating system name?"
3833 . ./myread
3834 case "$ans" in
3835 none)  osname='' ;;
3836 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3837 esac
3838 echo " "
3839 case "$osvers" in
3840         ''|' ')
3841                 case "$hintfile" in
3842                 ''|' '|none) dflt=none ;;
3843                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3844                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3845                         case "$dflt" in
3846                         ''|' ') dflt=none ;;
3847                         esac
3848                         ;;
3849                 esac
3850                 ;;
3851         *) dflt="$osvers" ;;
3852 esac
3853 rp="Operating system version?"
3854 . ./myread
3855 case "$ans" in
3856 none)  osvers='' ;;
3857 *) osvers="$ans" ;;
3858 esac
3859
3860
3861 . ./posthint.sh
3862
3863 : who configured the system
3864 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3865 case "$cf_by" in
3866 "")
3867         cf_by=`(logname) 2>/dev/null`
3868         case "$cf_by" in
3869         "")
3870                 cf_by=`(whoami) 2>/dev/null`
3871                 case "$cf_by" in
3872                 "") cf_by=unknown ;;
3873                 esac ;;
3874         esac ;;
3875 esac
3876
3877 : decide how portable to be.  Allow command line overrides.
3878 case "$d_portable" in
3879 "$undef") ;;
3880 *)      d_portable="$define" ;;
3881 esac
3882
3883 : set up shell script to do ~ expansion
3884 cat >filexp <<EOSS
3885 $startsh
3886 : expand filename
3887 case "\$1" in
3888  \~/*|\~)
3889         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3890         ;;
3891  \~*)
3892         if $test -f /bin/csh; then
3893                 /bin/csh -f -c "glob \$1"
3894                 failed=\$?
3895                 echo ""
3896                 exit \$failed
3897         else
3898                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3899                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3900                 if $test ! -d "\$dir"; then
3901                         me=\`basename \$0\`
3902                         echo "\$me: can't locate home directory for: \$name" >&2
3903                         exit 1
3904                 fi
3905                 case "\$1" in
3906                 */*)
3907                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3908                         ;;
3909                 *)
3910                         echo \$dir
3911                         ;;
3912                 esac
3913         fi
3914         ;;
3915 *)
3916         echo \$1
3917         ;;
3918 esac
3919 EOSS
3920 chmod +x filexp
3921 $eunicefix filexp
3922
3923 : now set up to get a file name
3924 cat <<EOS >getfile
3925 $startsh
3926 EOS
3927 cat <<'EOSC' >>getfile
3928 tilde=''
3929 fullpath=''
3930 already=''
3931 skip=''
3932 none_ok=''
3933 exp_file=''
3934 nopath_ok=''
3935 orig_rp="$rp"
3936 orig_dflt="$dflt"
3937 case "$gfpth" in
3938 '') gfpth='.' ;;
3939 esac
3940
3941 case "$fn" in
3942 *\(*)
3943         : getfile will accept an answer from the comma-separated list
3944         : enclosed in parentheses even if it does not meet other criteria.
3945         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3946         fn=`echo $fn | sed 's/(.*)//'`
3947         ;;
3948 esac
3949
3950 case "$fn" in
3951 *:*)
3952         loc_file=`expr $fn : '.*:\(.*\)'`
3953         fn=`expr $fn : '\(.*\):.*'`
3954         ;;
3955 esac
3956
3957 case "$fn" in
3958 *~*) tilde=true;;
3959 esac
3960 case "$fn" in
3961 */*) fullpath=true;;
3962 esac
3963 case "$fn" in
3964 *+*) skip=true;;
3965 esac
3966 case "$fn" in
3967 *n*) none_ok=true;;
3968 esac
3969 case "$fn" in
3970 *e*) exp_file=true;;
3971 esac
3972 case "$fn" in
3973 *p*) nopath_ok=true;;
3974 esac
3975
3976 case "$fn" in
3977 *f*) type='File';;
3978 *d*) type='Directory';;
3979 *l*) type='Locate';;
3980 esac
3981
3982 what="$type"
3983 case "$what" in
3984 Locate) what='File';;
3985 esac
3986
3987 case "$exp_file" in
3988 '')
3989         case "$d_portable" in
3990         "$define") ;;
3991         *) exp_file=true;;
3992         esac
3993         ;;
3994 esac
3995
3996 cd ..
3997 while test "$type"; do
3998         redo=''
3999         rp="$orig_rp"
4000         dflt="$orig_dflt"
4001         case "$tilde" in
4002         true) rp="$rp (~name ok)";;
4003         esac
4004         . UU/myread
4005         if test -f UU/getfile.ok && \
4006                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4007         then
4008                 value="$ans"
4009                 ansexp="$ans"
4010                 break
4011         fi
4012         case "$ans" in
4013         none)
4014                 value=''
4015                 ansexp=''
4016                 case "$none_ok" in
4017                 true) type='';;
4018                 esac
4019                 ;;
4020         *)
4021                 case "$tilde" in
4022                 '') value="$ans"
4023                         ansexp="$ans";;
4024                 *)
4025                         value=`UU/filexp $ans`
4026                         case $? in
4027                         0)
4028                                 if test "$ans" != "$value"; then
4029                                         echo "(That expands to $value on this system.)"
4030                                 fi
4031                                 ;;
4032                         *) value="$ans";;
4033                         esac
4034                         ansexp="$value"
4035                         case "$exp_file" in
4036                         '') value="$ans";;
4037                         esac
4038                         ;;
4039                 esac
4040                 case "$fullpath" in
4041                 true)
4042                         case "$ansexp" in
4043                         /*) value="$ansexp" ;;
4044                         [a-zA-Z]:/*) value="$ansexp" ;;
4045                         *)
4046                                 redo=true
4047                                 case "$already" in
4048                                 true)
4049                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4050                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4051                                         ;;
4052                                 *)
4053                                 echo "Please give a full path name, starting with slash." >&4
4054                                         case "$tilde" in
4055                                         true)
4056                                 echo "Note that using ~name is ok provided it expands well." >&4
4057                                                 already=true
4058                                                 ;;
4059                                         esac
4060                                 esac
4061                                 ;;
4062                         esac
4063                         ;;
4064                 esac
4065                 case "$redo" in
4066                 '')
4067                         case "$type" in
4068                         File)
4069                                 for fp in $gfpth; do
4070                                         if test "X$fp" = X.; then
4071                                             pf="$ansexp"
4072                                         else    
4073                                             pf="$fp/$ansexp"
4074                                         fi
4075                                         if test -f "$pf"; then
4076                                                 type=''
4077                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4078                                         then
4079                                                 echo "($value is not a plain file, but that's ok.)"
4080                                                 type=''
4081                                         fi
4082                                         if test X"$type" = X; then
4083                                             value="$pf"
4084                                             break
4085                                         fi
4086                                 done
4087                                 ;;
4088                         Directory)
4089                                 for fp in $gfpth; do
4090                                         if test "X$fp" = X.; then
4091                                             dir="$ans"
4092                                             direxp="$ansexp"
4093                                         else    
4094                                             dir="$fp/$ansexp"
4095                                             direxp="$fp/$ansexp"
4096                                         fi
4097                                         if test -d "$direxp"; then
4098                                                 type=''
4099                                                 value="$dir"
4100                                                 break
4101                                         fi
4102                                 done
4103                                 ;;
4104                         Locate)
4105                                 if test -d "$ansexp"; then
4106                                         echo "(Looking for $loc_file in directory $value.)"
4107                                         value="$value/$loc_file"
4108                                         ansexp="$ansexp/$loc_file"
4109                                 fi
4110                                 if test -f "$ansexp"; then
4111                                         type=''
4112                                 fi
4113                                 case "$nopath_ok" in
4114                                 true)   case "$value" in
4115                                         */*) ;;
4116                                         *)      echo "Assuming $value will be in people's path."
4117                                                 type=''
4118                                                 ;;
4119                                         esac
4120                                         ;;
4121                                 esac
4122                                 ;;
4123                         esac
4124
4125                         case "$skip" in
4126                         true) type='';
4127                         esac
4128
4129                         case "$type" in
4130                         '') ;;
4131                         *)
4132                                 if test "$fastread" = yes; then
4133                                         dflt=y
4134                                 else
4135                                         dflt=n
4136                                 fi
4137                                 rp="$what $value doesn't exist.  Use that name anyway?"
4138                                 . UU/myread
4139                                 dflt=''
4140                                 case "$ans" in
4141                                 y*) type='';;
4142                                 *) echo " ";;
4143                                 esac
4144                                 ;;
4145                         esac
4146                         ;;
4147                 esac
4148                 ;;
4149         esac
4150 done
4151 cd UU
4152 ans="$value"
4153 rp="$orig_rp"
4154 dflt="$orig_dflt"
4155 rm -f getfile.ok
4156 test "X$gfpthkeep" != Xy && gfpth=""
4157 EOSC
4158
4159 : determine root of directory hierarchy where package will be installed.
4160 case "$prefix" in
4161 '')
4162         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4163         ;;
4164 *?/)
4165         dflt=`echo "$prefix" | sed 's/.$//'`
4166         ;;
4167 *)
4168         dflt="$prefix"
4169         ;;
4170 esac
4171 $cat <<EOM
4172
4173 By default, $package will be installed in $dflt/bin, manual pages
4174 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4175 installation directories. Typically this is something like /usr/local.
4176 If you wish to have binaries under /usr/bin but other parts of the
4177 installation under /usr/local, that's ok: you will be prompted
4178 separately for each of the installation directories, the prefix being
4179 only used to set the defaults.
4180
4181 EOM
4182 fn=d~
4183 rp='Installation prefix to use?'
4184 . ./getfile
4185 oldprefix=''
4186 case "$prefix" in
4187 '') ;;
4188 *)
4189         case "$ans" in
4190         "$prefix") ;;
4191         *) oldprefix="$prefix";;
4192         esac
4193         ;;
4194 esac
4195 prefix="$ans"
4196 prefixexp="$ansexp"
4197
4198 : allow them to override the AFS root
4199 case "$afsroot" in
4200 '')     afsroot=/afs ;;
4201 *)      afsroot=$afsroot ;;
4202 esac
4203
4204 : is AFS running?
4205 echo " "
4206 case "$afs" in
4207 $define|true)   afs=true ;;
4208 $undef|false)   afs=false ;;
4209 *)      if $test -d $afsroot; then
4210                 afs=true
4211         else
4212                 afs=false
4213         fi
4214         ;;
4215 esac
4216 if $afs; then
4217         echo "AFS may be running... I'll be extra cautious then..." >&4
4218 else
4219         echo "AFS does not seem to be running..." >&4
4220 fi
4221
4222 : determine installation prefix for where package is to be installed.
4223 if $afs; then
4224 $cat <<EOM
4225
4226 Since you are running AFS, I need to distinguish the directory in which
4227 files will reside from the directory in which they are installed (and from
4228 which they are presumably copied to the former directory by occult means).
4229
4230 EOM
4231         case "$installprefix" in
4232         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4233         *) dflt="$installprefix";;
4234         esac
4235 else
4236 $cat <<EOM
4237
4238 In some special cases, particularly when building $package for distribution,
4239 it is convenient to distinguish the directory in which files should be
4240 installed from the directory ($prefix) in which they will
4241 eventually reside.  For most users, these two directories are the same.
4242
4243 EOM
4244         case "$installprefix" in
4245         '') dflt=$prefix ;;
4246         *) dflt=$installprefix;;
4247         esac
4248 fi
4249 fn=d~
4250 rp='What installation prefix should I use for installing files?'
4251 . ./getfile
4252 installprefix="$ans"
4253 installprefixexp="$ansexp"
4254
4255 : Perform the prefixexp/installprefixexp correction if necessary
4256 cat <<EOS >installprefix
4257 $startsh
4258 EOS
4259 cat <<'EOSC' >>installprefix
4260 : Change installation prefix, if necessary.
4261 if $test X"$prefix" != X"$installprefix"; then
4262     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4263 else
4264     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4265 fi
4266 EOSC
4267 chmod +x installprefix
4268 $eunicefix installprefix
4269
4270 : Set variables such as privlib and privlibexp from the output of ./getfile
4271 : performing the prefixexp/installprefixexp correction if necessary.
4272 cat <<EOS >setprefixvar
4273 $startsh
4274 EOS
4275 cat <<'EOSC' >>setprefixvar
4276 eval "${prefixvar}=\"\$ans\""
4277 eval "${prefixvar}exp=\"\$ansexp\""
4278 . ./installprefix
4279 EOSC
4280 chmod +x setprefixvar
4281 $eunicefix setprefixvar
4282
4283 : set up the script used to warn in case of inconsistency
4284 cat <<EOS >whoa
4285 $startsh
4286 EOS
4287 cat <<'EOSC' >>whoa
4288 dflt=y
4289 case "$hint" in
4290     recommended)
4291         case "$hintfile" in
4292         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4293                 ;;
4294         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4295                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4296                 ;;
4297         esac
4298         ;;
4299     *)  echo " "
4300         echo "*** WHOA THERE!!! ***" >&4
4301         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4302         ;;
4303 esac
4304 rp="    Keep the $hint value?"
4305 . ./myread
4306 case "$ans" in
4307 y) td=$was; tu=$was;;
4308 esac
4309 EOSC
4310
4311 : function used to set '$1' to '$val'
4312 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4313 case "$val$was" in
4314 $define$undef) . ./whoa; eval "$var=\$td";;
4315 $undef$define) . ./whoa; eval "$var=\$tu";;
4316 *) eval "$var=$val";;
4317 esac'
4318
4319 : get the patchlevel
4320 echo " "
4321 echo "Getting the current patchlevel..." >&4
4322 if $test -r $rsrc/patchlevel.h;then
4323         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4324         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4325         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4326         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4327         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4328         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4329         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4330 else
4331         revision=0
4332         patchlevel=0
4333         subversion=0
4334         api_revision=0
4335         api_version=0
4336         api_subversion=0
4337         perl_patchlevel=0
4338         $echo "(You do not have patchlevel.h.  Eek.)"
4339 fi
4340 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4341 version_patchlevel_string="version $patchlevel subversion $subversion"
4342 case "$perl_patchlevel" in
4343 0|'') ;;
4344 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4345     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4346     ;;
4347 esac
4348
4349 $echo "(You have $package $version_patchlevel_string.)"
4350
4351 case "$osname" in
4352 dos|vms)
4353         : XXX Should be a Configure test for double-dots in filenames.
4354         version=`echo $revision $patchlevel $subversion | \
4355                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4356         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4357                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4358         ;;
4359 *)
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 esac
4366 : Special case the 5.005_xx maintenance series, which used 5.005
4367 : without any subversion label as a subdirectory in $sitelib
4368 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4369         api_versionstring='5.005'
4370 fi
4371
4372 : Do we want threads support and if so, what type
4373 case "$usethreads" in
4374 $define|true|[yY]*)     dflt='y';;
4375 *)     # Catch case where user specified ithreads or 5005threads but
4376        # forgot -Dusethreads (A.D. 4/2002)
4377        case "$useithreads$use5005threads" in
4378        *$define*)       dflt='y';;
4379        *)               dflt='n';;
4380        esac
4381        ;;
4382 esac
4383 cat <<EOM
4384
4385 Perl can be built to offer a form of threading support on some systems
4386 To do so, Configure can be run with -Dusethreads.
4387
4388 Note that Perl built with threading support runs slightly slower
4389 and uses slightly more memory than plain Perl.
4390
4391 If this doesn't make any sense to you, just accept the default '$dflt'.
4392 EOM
4393 rp='Build a threading Perl?'
4394 . ./myread
4395 case "$ans" in
4396 y|Y)    val="$define" ;;
4397 *)      val="$undef" ;;
4398 esac
4399 set usethreads
4400 eval $setvar
4401
4402 if $test $patchlevel -lt 9; then
4403     case "$usethreads" in
4404     $define)
4405         : Default to ithreads unless overridden on command line or with
4406         : old config.sh
4407         dflt='y'
4408         case "$use5005threads" in
4409                 $define|true|[yY]*)
4410                         echo "5.005 threads are no longer supported"
4411                         exit 1
4412                 ;;
4413         esac
4414         case "$useithreads" in
4415                 $undef|false|[nN]*) dflt='n';;
4416         esac
4417         rp='Use the newer interpreter-based ithreads?'
4418         . ./myread
4419         case "$ans" in
4420         y|Y)    val="$define" ;;
4421         *)      val="$undef" ;;
4422         esac
4423         set useithreads
4424         eval $setvar
4425         : Now set use5005threads to the opposite value.
4426         case "$useithreads" in
4427         $define) val="$undef" ;;
4428         *) val="$define" ;;
4429         esac
4430         set use5005threads
4431         eval $setvar
4432         ;;
4433     *)
4434         useithreads="$undef"
4435         use5005threads="$undef"
4436         ;;
4437     esac
4438
4439     case "$useithreads$use5005threads" in
4440     "$define$define")
4441         $cat >&4 <<EOM
4442
4443 You cannot have both the ithreads and the 5.005 threads enabled
4444 at the same time.  Disabling the 5.005 threads since they are
4445 much less stable than the ithreads.
4446
4447 EOM
4448         use5005threads="$undef"
4449         ;;
4450     esac
4451
4452 else
4453 : perl-5.9.x and later
4454
4455     if test X"$usethreads" = "X$define"; then
4456         case "$use5005threads" in
4457             $define|true|[yY]*)
4458                 $cat >&4 <<EOM
4459
4460 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4461
4462 EOM
4463             ;;
4464         esac
4465     fi
4466
4467     use5005threads="$undef"
4468     useithreads="$usethreads"
4469 fi
4470
4471 case "$d_oldpthreads" in
4472 '')     : Configure tests would be welcome here.  For now, assume undef.
4473         val="$undef" ;;
4474 *)      val="$d_oldpthreads" ;;
4475 esac
4476 set d_oldpthreads
4477 eval $setvar
4478
4479
4480 : Look for a hint-file generated 'call-back-unit'.  If the
4481 : user has specified that a threading perl is to be built,
4482 : we may need to set or change some other defaults.
4483 if $test -f usethreads.cbu; then
4484     echo "Your platform has some specific hints regarding threaded builds, using them..."
4485     . ./usethreads.cbu
4486 else
4487     case "$usethreads" in
4488         "$define"|true|[yY]*)
4489                 $cat <<EOM
4490 (Your platform does not have any specific hints for threaded builds.
4491  Assuming POSIX threads, then.)
4492 EOM
4493         ;;
4494     esac
4495 fi
4496
4497 : Check if multiplicity is required
4498 cat <<EOM
4499
4500 Perl can be built so that multiple Perl interpreters can coexist
4501 within the same Perl executable.
4502 EOM
4503
4504 case "$useithreads" in
4505 $define)
4506         cat <<EOM
4507 This multiple interpreter support is required for interpreter-based threads.
4508 EOM
4509         val="$define"
4510         ;;
4511 *)      case "$usemultiplicity" in
4512         $define|true|[yY]*)     dflt='y';;
4513         *) dflt='n';;
4514         esac
4515         echo " "
4516         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4517         rp='Build Perl for multiplicity?'
4518         . ./myread
4519         case "$ans" in
4520         y|Y)    val="$define" ;;
4521         *)      val="$undef" ;;
4522         esac
4523         ;;
4524 esac
4525 set usemultiplicity
4526 eval $setvar
4527
4528 : Check if morebits is requested
4529 case "$usemorebits" in
4530 "$define"|true|[yY]*)
4531         use64bitint="$define"
4532         uselongdouble="$define"
4533         usemorebits="$define"
4534         ;;
4535 *)      usemorebits="$undef"
4536         ;;
4537 esac
4538
4539 : Determine the C compiler to be used
4540 echo " "
4541 case "$cc" in
4542 '') dflt=cc;;
4543 *) dflt="$cc";;
4544 esac
4545 rp="Use which C compiler?"
4546 . ./myread
4547 cc="$ans"
4548
4549 : See whether they have no cc but they do have gcc
4550 . ./trygcc
4551 if $test -f cc.cbu; then
4552     . ./cc.cbu
4553 fi
4554 . ./checkcc
4555
4556 : make some quick guesses about what we are up against
4557 echo " "
4558 $echo $n "Hmm...  $c"
4559 echo exit 1 >bsd
4560 echo exit 1 >usg
4561 echo exit 1 >v7
4562 echo exit 1 >osf1
4563 echo exit 1 >eunice
4564 echo exit 1 >xenix
4565 echo exit 1 >venix
4566 echo exit 1 >os2
4567 d_bsd="$undef"
4568 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4569 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4570 then
4571         echo "Looks kind of like an OSF/1 system, but we'll see..."
4572         echo exit 0 >osf1
4573 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4574         xxx=`./loc addbib blurfl $pth`
4575         if $test -f $xxx; then
4576         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4577                 echo exit 0 >bsd
4578                 echo exit 0 >usg
4579         else
4580                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4581                         echo "Looks kind of like an extended USG system, but we'll see..."
4582                 else
4583                         echo "Looks kind of like a USG system, but we'll see..."
4584                 fi
4585                 echo exit 0 >usg
4586         fi
4587 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4588         echo "Looks kind of like a BSD system, but we'll see..."
4589         d_bsd="$define"
4590         echo exit 0 >bsd
4591 else
4592         echo "Looks kind of like a Version 7 system, but we'll see..."
4593         echo exit 0 >v7
4594 fi
4595 case "$eunicefix" in
4596 *unixtovms*)
4597         $cat <<'EOI'
4598 There is, however, a strange, musty smell in the air that reminds me of
4599 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4600 EOI
4601         echo exit 0 >eunice
4602         d_eunice="$define"
4603 : it so happens the Eunice I know will not run shell scripts in Unix format
4604         ;;
4605 *)
4606         echo " "
4607         echo "Congratulations.  You aren't running Eunice."
4608         d_eunice="$undef"
4609         ;;
4610 esac
4611 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4612 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4613 : semicolon as a patch separator
4614 case "$p_" in
4615 :) ;;
4616 *)
4617         $cat <<'EOI'
4618 I have the feeling something is not exactly right, however...don't tell me...
4619 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4620 (Or you may be running DOS with DJGPP.)
4621 EOI
4622         echo exit 0 >os2
4623         ;;
4624 esac
4625 if test -f /xenix; then
4626         echo "Actually, this looks more like a XENIX system..."
4627         echo exit 0 >xenix
4628         d_xenix="$define"
4629 else
4630         echo " "
4631         echo "It's not Xenix..."
4632         d_xenix="$undef"
4633 fi
4634 chmod +x xenix
4635 $eunicefix xenix
4636 if test -f /venix; then
4637         echo "Actually, this looks more like a VENIX system..."
4638         echo exit 0 >venix
4639 else
4640         echo " "
4641         if ./xenix; then
4642                 : null
4643         else
4644                 echo "Nor is it Venix..."
4645         fi
4646 fi
4647 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4648 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4649 $rm -f foo
4650
4651 : Check if we are using GNU gcc and what its version is
4652 echo " "
4653 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4654 $cat >try.c <<EOM
4655 #include <stdio.h>
4656 int main() {
4657 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4658 #ifdef __VERSION__
4659         printf("%s\n", __VERSION__);
4660 #else
4661         printf("%s\n", "1");
4662 #endif
4663 #endif
4664         return(0);
4665 }
4666 EOM
4667 if $cc -o try $ccflags $ldflags try.c; then
4668         gccversion=`$run ./try`
4669         case "$gccversion" in
4670         '') echo "You are not using GNU cc." ;;
4671         *)  echo "You are using GNU cc $gccversion."
4672             ccname=gcc
4673             ;;
4674         esac
4675 else
4676         echo " "
4677         echo "*** WHOA THERE!!! ***" >&4
4678         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4679         case "$knowitall" in
4680         '')
4681         echo "    You'd better start hunting for one and let me know about it." >&4
4682                 exit 1
4683                 ;;
4684         esac
4685 fi
4686 $rm -f try try.*
4687 case "$gccversion" in
4688 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4689 esac
4690 case "$gccversion" in
4691 '') gccosandvers='' ;;
4692 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4693    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4694    gccshortvers=''
4695    case "$gccosandvers" in
4696    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4697    $osname$osvers) ;; # looking good
4698    $osname*) cat <<EOM >&4
4699
4700 *** WHOA THERE!!! ***
4701
4702     Your gcc has not been compiled for the exact release of
4703     your operating system ($gccosandvers versus $osname$osvers).
4704
4705     In general it is a good idea to keep gcc synchronized with
4706     the operating system because otherwise serious problems
4707     may ensue when trying to compile software, like Perl.
4708
4709     I'm trying to be optimistic here, though, and will continue.
4710     If later during the configuration and build icky compilation
4711     problems appear (headerfile conflicts being the most common
4712     manifestation), I suggest reinstalling the gcc to match
4713     your operating system release.
4714
4715 EOM
4716       ;;
4717    *) gccosandvers='' ;; # failed to parse, better be silent
4718    esac
4719    ;;
4720 esac
4721 case "$ccname" in
4722 '') ccname="$cc" ;;
4723 esac
4724
4725 # gcc 3.* complain about adding -Idirectories that they already know about,
4726 # so we will take those off from locincpth.
4727 case "$gccversion" in
4728 3*)
4729     echo "main(){}">try.c
4730     for incdir in $locincpth; do
4731        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4732              grep '^c[cp]p*[01]: warning: changing search order '`
4733        if test "X$warn" != X; then
4734            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4735        fi
4736     done
4737     $rm -f try try.*
4738 esac
4739
4740 # gcc 4.9 by default does some optimizations that break perl.
4741 # see ticket 121505.
4742 #
4743 # The -fwrapv disables those optimizations (and probably others,) so
4744 # for gcc 4.9 (and later, since the optimizations probably won't go
4745 # away), add -fwrapv unless the user requests -fno-wrapv, which
4746 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4747 # which turns the overflows -fwrapv ignores into runtime errors.
4748 case "$gccversion" in
4749 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4750     case "$ccflags" in
4751     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4752     *) ccflags="$ccflags -fwrapv" ;;
4753     esac
4754 esac
4755
4756 : What should the include directory be ?
4757 : Use sysroot if set, so findhdr looks in the right place.
4758 echo " "
4759 $echo $n "Hmm...  $c"
4760 dflt="$sysroot/usr/include"
4761 incpath=''
4762 mips_type=''
4763 if $test -f /bin/mips && /bin/mips; then
4764         echo "Looks like a MIPS system..."
4765         $cat >usr.c <<'EOCP'
4766 #ifdef SYSTYPE_BSD43
4767 /bsd43
4768 #endif
4769 EOCP
4770         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4771                 dflt='/bsd43/usr/include'
4772                 incpath='/bsd43'
4773                 mips_type='BSD 4.3'
4774         else
4775                 mips_type='System V'
4776         fi
4777         $rm -f usr.c usr.out
4778         echo "and you're compiling with the $mips_type compiler and libraries."
4779         xxx_prompt=y
4780         echo "exit 0" >mips
4781 else
4782         echo "Doesn't look like a MIPS system."
4783         xxx_prompt=n
4784         echo "exit 1" >mips
4785 fi
4786 chmod +x mips
4787 $eunicefix mips
4788 case "$usrinc" in
4789 '') ;;
4790 *) dflt="$usrinc";;
4791 esac
4792 case "$xxx_prompt" in
4793 y)      fn=d/
4794         echo " "
4795         rp='Where are the include files you want to use?'
4796         . ./getfile
4797         usrinc="$ans"
4798         ;;
4799 *)      usrinc="$dflt"
4800         ;;
4801 esac
4802
4803 : see how we invoke the C preprocessor
4804 echo " "
4805 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4806 cat <<'EOT' >testcpp.c
4807 #define ABC abc
4808 #define XYZ xyz
4809 ABC.XYZ
4810 EOT
4811 cd ..
4812 if test ! -f cppstdin; then
4813         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4814                 # AIX cc -E doesn't show the absolute headerfile
4815                 # locations but we'll cheat by using the -M flag.
4816                 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
4817         else
4818                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4819         fi
4820 else
4821         echo "Keeping your $hint cppstdin wrapper."
4822 fi
4823 chmod 755 cppstdin
4824 wrapper=`pwd`/cppstdin
4825 ok='false'
4826 cd UU
4827
4828 if $test "X$cppstdin" != "X" && \
4829         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4830         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4831 then
4832         echo "You used to use $cppstdin $cppminus so we'll use that again."
4833         case "$cpprun" in
4834         '') echo "But let's see if we can live without a wrapper..." ;;
4835         *)
4836                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4837                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4838                 then
4839                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4840                         ok='true'
4841                 else
4842                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4843                 fi
4844                 ;;
4845         esac
4846 else
4847         case "$cppstdin" in
4848         '') ;;
4849         *)
4850                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4851                 ;;
4852         esac
4853 fi
4854
4855 if $ok; then
4856         : nothing
4857 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4858         $cc -E <testcpp.c >testcpp.out 2>&1; \
4859         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4860         echo "Yup, it does."
4861         x_cpp="$cc $cppflags -E"
4862         x_minus='';
4863 elif echo 'Nope...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"' -P" will work...'; \
4870         $cc -P <testcpp.c >testcpp.out 2>&1; \
4871         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4872         echo "Yipee, that works!"
4873         x_cpp="$cc $cppflags -P"
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 "At long last!"
4879         x_cpp="$cc $cppflags -P"
4880         x_minus='-';
4881 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4882         $cpp <testcpp.c >testcpp.out 2>&1; \
4883         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4884         echo "It works!"
4885         x_cpp="$cpp $cppflags"
4886         x_minus='';
4887 elif echo 'Nixed again...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 "Hooray, it works!  I was beginning to wonder."
4891         x_cpp="$cpp $cppflags"
4892         x_minus='-';
4893 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4894         $wrapper <testcpp.c >testcpp.out 2>&1; \
4895         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4896         x_cpp="$wrapper"
4897         x_minus=''
4898         echo "Eureka!"
4899 else
4900         dflt=''
4901         rp="No dice.  I can't find a C preprocessor.  Name one:"
4902         . ./myread
4903         x_cpp="$ans"
4904         x_minus=''
4905         $x_cpp <testcpp.c >testcpp.out 2>&1
4906         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4907                 echo "OK, that will do." >&4
4908         else
4909 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4910                 exit 1
4911         fi
4912 fi
4913
4914 case "$ok" in
4915 false)
4916         cppstdin="$x_cpp"
4917         cppminus="$x_minus"
4918         cpprun="$x_cpp"
4919         cpplast="$x_minus"
4920         set X $x_cpp
4921         shift
4922         case "$1" in
4923         "$cpp")
4924                 echo "Perhaps can we force $cc -E using a wrapper..."
4925                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4926                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4927                 then
4928                         echo "Yup, we can."
4929                         cppstdin="$wrapper"
4930                         cppminus='';
4931                 else
4932                         echo "Nope, we'll have to live without it..."
4933                 fi
4934                 ;;
4935         esac
4936         case "$cpprun" in
4937         "$wrapper")
4938                 cpprun=''
4939                 cpplast=''
4940                 ;;
4941         esac
4942         ;;
4943 esac
4944
4945 case "$cppstdin" in
4946 "$wrapper"|'cppstdin') ;;
4947 *) $rm -f $wrapper;;
4948 esac
4949 $rm -f testcpp.c testcpp.out
4950
4951 : Adjust cppfilter for path component separator
4952 case "$osname" in
4953 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4954 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4955 *)   cppfilter='' ;;
4956 esac
4957
4958 : Use gcc to determine libpth and incpth
4959 # If using gcc or clang, we can get better values for libpth, incpth
4960 # and usrinc directly from the compiler.
4961 # Note that ccname for clang is also gcc.
4962 case "$ccname" in
4963     gcc)
4964         $echo 'extern int foo;' > try.c
4965         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4966         shift
4967         if $test $# -gt 0; then
4968             incpth="$incpth $*"
4969             incpth="`$echo $incpth|$sed 's/^ //'`"
4970             for i in $*; do
4971                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4972                 if $test -d $j; then
4973                     libpth="$libpth $j"
4974                 fi
4975             done
4976             libpth="`$echo $libpth|$sed 's/^ //'`"
4977             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4978                 if $test -d $xxx; then
4979                     case " $libpth " in
4980                     *" $xxx "*) ;;
4981                     *) libpth="$libpth $xxx";;
4982                     esac
4983                 fi
4984             done
4985         fi
4986         $rm -f try.c
4987         case "$usrinc" in
4988         '') for i in $incpth; do
4989                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4990                     usrinc="$i"
4991                     break
4992                 fi
4993             done
4994             ;;
4995         esac
4996
4997         case "$usecrosscompile" in
4998         $define|true|[yY]*)
4999             case "$incpth" in
5000                 '') echo "Incpth not defined." >&4; croak=y ;;
5001                 *)  echo "Using incpth '$incpth'." >&4 ;;
5002             esac
5003             case "$libpth" in
5004                 '') echo "Libpth not defined." >&4; croak=y ;;
5005                 *)  echo "Using libpth '$libpth'." >&4 ;;
5006             esac
5007             case "$usrinc" in
5008                 '') echo "Usrinc not defined." >&4; croak=y ;;
5009                 *)  echo "Using usrinc $usrinc." >&4 ;;
5010             esac
5011             case "$croak" in
5012                 y)
5013                 if test "X$sysroot" = X; then
5014                     echo "Cannot continue, aborting." >&4; exit 1
5015                 else
5016                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5017                 fi
5018                 ;;
5019             esac
5020             ;;
5021         esac
5022     ;;
5023 esac
5024
5025 : Default value for incpth is just usrinc
5026 case "$incpth" in
5027 '') incpth="$usrinc";;
5028 esac
5029
5030 : Set private lib path
5031 case "$plibpth" in
5032 '') if ./mips; then
5033         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5034     fi;;
5035 esac
5036 case "$libpth" in
5037 ' ') dlist='';;
5038 '') dlist="$loclibpth $plibpth $glibpth";;
5039 *) dlist="$libpth";;
5040 esac
5041
5042 : Now check and see which directories actually exist, avoiding duplicates
5043 for xxx in $dlist
5044 do
5045     if $test -d $xxx; then
5046                 case " $libpth " in
5047                 *" $xxx "*) ;;
5048                 *) libpth="$libpth $xxx";;
5049                 esac
5050     fi
5051 done
5052 $cat <<'EOM'
5053
5054 Some systems have incompatible or broken versions of libraries.  Among
5055 the directories listed in the question below, please remove any you
5056 know not to be holding relevant libraries, and add any that are needed.
5057 Say "none" for none.
5058
5059 EOM
5060
5061 if test "X$sysroot" != X; then
5062     $cat <<EOM
5063 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5064
5065 EOM
5066 fi
5067
5068 case "$libpth" in
5069 '') dflt='none';;
5070 *)
5071         set X $libpth
5072         shift
5073         dflt=${1+"$@"}
5074         ;;
5075 esac
5076 rp="Directories to use for library searches?"
5077 . ./myread
5078 case "$ans" in
5079 none) libpth=' ';;
5080 *) libpth="$ans";;
5081 esac
5082
5083 : compute shared library extension
5084 case "$so" in
5085 '')
5086         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5087                 dflt='sl'
5088         else
5089                 dflt='so'
5090         fi
5091         ;;
5092 *) dflt="$so";;
5093 esac
5094 $cat <<EOM
5095
5096 On some systems, shared libraries may be available.  Answer 'none' if
5097 you want to suppress searching of shared libraries for the remainder
5098 of this configuration.
5099
5100 EOM
5101 rp='What is the file extension used for shared libraries?'
5102 . ./myread
5103 so="$ans"
5104
5105 : Does target system insist that shared library basenames are unique
5106 $cat << EOM
5107
5108 Some dynamic loaders assume that the *basename* of shared library filenames
5109 are globally unique.  We'll default this to undef as we assume your system
5110 is not this weird. Set to defined if you're on one of them.
5111
5112 EOM
5113
5114 dflt='n'
5115 rp='Make shared library basenames unique?'
5116 . ./myread
5117 case "$ans" in
5118 y|Y) val="$define" ;;
5119 *)   val="$undef"  ;;
5120 esac
5121 set d_libname_unique
5122 eval $setvar
5123
5124 : Define several unixisms.
5125 : Hints files or command line option can be used to override them.
5126 : The convoluted testing is in case hints files set either the old
5127 : or the new name.
5128 case "$_exe" in
5129 '')     case "$exe_ext" in
5130         '')     ;;
5131         *)      _exe="$exe_ext" ;;
5132         esac
5133         ;;
5134 esac
5135 case "$_a" in
5136 '')     case "$lib_ext" in
5137     '') _a='.a';;
5138         *)      _a="$lib_ext" ;;
5139         esac
5140         ;;
5141 esac
5142 case "$_o" in
5143 '') case "$obj_ext" in
5144         '')     _o='.o';;
5145         *)      _o="$obj_ext";;
5146         esac
5147         ;;
5148 esac
5149 case "$p_" in
5150 '') case "$path_sep" in
5151         '')     p_=':';;
5152         *)      p_="$path_sep";;
5153         esac
5154         ;;
5155 esac
5156 exe_ext=$_exe
5157 lib_ext=$_a
5158 obj_ext=$_o
5159 path_sep=$p_
5160
5161 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5162
5163 : Which makefile gets called first.  This is used by make depend.
5164 case "$firstmakefile" in
5165 '') firstmakefile='makefile';;
5166 esac
5167
5168 : Check is we will use socks
5169 case "$usesocks" in
5170 $define|true|[yY]*)     dflt='y';;
5171 *) dflt='n';;
5172 esac
5173 cat <<EOM
5174
5175 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5176 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5177 to use the PerlIO abstraction layer, this will be implicitly selected.
5178
5179 If this doesn't make any sense to you, just accept the default '$dflt'.
5180 EOM
5181 rp='Build Perl for SOCKS?'
5182 . ./myread
5183 case "$ans" in
5184 y|Y)    val="$define" ;;
5185 *)      val="$undef" ;;
5186 esac
5187 set usesocks
5188 eval $setvar
5189
5190 : Check for uselongdouble support
5191 case "$ccflags" in
5192 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5193 esac
5194
5195 case "$uselongdouble" in
5196 $define|true|[yY]*)     dflt='y';;
5197 *) dflt='n';;
5198 esac
5199 cat <<EOM
5200
5201 Perl can be built to take advantage of long doubles which
5202 (if available) may give more accuracy and range for floating point numbers.
5203
5204 If this doesn't make any sense to you, just accept the default '$dflt'.
5205 EOM
5206 rp='Try to use long doubles if available?'
5207 . ./myread
5208 case "$ans" in
5209 y|Y)    val="$define"   ;;
5210 *)      val="$undef"    ;;
5211 esac
5212 set uselongdouble
5213 eval $setvar
5214
5215 case "$uselongdouble" in
5216 true|[yY]*) uselongdouble="$define" ;;
5217 esac
5218
5219 : Look for a hint-file generated 'call-back-unit'.  If the
5220 : user has specified that long doubles should be used,
5221 : we may need to set or change some other defaults.
5222 if $test -f uselongdouble.cbu; then
5223     echo "Your platform has some specific hints regarding long doubles, using them..."
5224     . ./uselongdouble.cbu
5225 else
5226     case "$uselongdouble" in
5227         $define)
5228                 $cat <<EOM
5229 (Your platform does not have any specific hints for long doubles.)
5230 EOM
5231         ;;
5232     esac
5233 fi
5234
5235 : Check if quadmath is requested
5236 case "$usequadmath" in
5237 "$define"|true|[yY]*) usequadmath="$define" ;;
5238 *)                    usequadmath="$undef"  ;;
5239 esac
5240
5241 : Fail if both uselongdouble and usequadmath are requested
5242 case "$usequadmath:$uselongdouble" in
5243 define:define)
5244         $cat <<EOM >&4
5245
5246 *** You requested the use of the quadmath library and use
5247 *** of long doubles.
5248 ***
5249 *** Please select one or the other.
5250 EOM
5251         exit 1
5252         ;;
5253 esac
5254
5255 : Looking for optional libraries
5256 echo " "
5257 echo "Checking for optional libraries..." >&4
5258 case "$libs" in
5259 ' '|'') dflt='';;
5260 *) dflt="$libs";;
5261 esac
5262 case "$libswanted" in
5263 '') libswanted='c_s';;
5264 esac
5265 case "$usesocks" in
5266 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5267 esac
5268 case "$usecbacktrace" in
5269 "$define") libswanted="$libswanted bfd" ;;
5270 esac
5271 case "$usequadmath" in
5272 "$define") libswanted="$libswanted quadmath" ;;
5273 esac
5274 libsfound=''
5275 libsfiles=''
5276 libsdirs=''
5277 libspath=''
5278 for thisdir in $libpth $xlibpth; do
5279   test -d $thisdir && libspath="$libspath $thisdir"
5280 done
5281 for thislib in $libswanted; do
5282         for thisdir in $libspath; do
5283             xxx=''
5284             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5285                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5286                 $test -f "$xxx" && eval $libscheck
5287                 $test -f "$xxx" && libstyle=shared
5288                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5289                 $test -f "$xxx" && eval $libscheck
5290                 $test -f "$xxx" && libstyle=shared
5291             fi
5292             if test ! -f "$xxx"; then
5293                 xxx=$thisdir/lib$thislib.$so
5294                 $test -f "$xxx" && eval $libscheck
5295                 $test -f "$xxx" && libstyle=shared
5296             fi
5297             if test ! -f "$xxx"; then
5298                 xxx=$thisdir/lib$thislib$_a
5299                 $test -f "$xxx" && eval $libscheck
5300                 $test -f "$xxx" && libstyle=static
5301             fi
5302             if test ! -f "$xxx"; then
5303                 xxx=$thisdir/$thislib$_a
5304                 $test -f "$xxx" && eval $libscheck
5305                 $test -f "$xxx" && libstyle=static
5306             fi
5307             if test ! -f "$xxx"; then
5308                 xxx=$thisdir/lib${thislib}_s$_a
5309                 $test -f "$xxx" && eval $libscheck
5310                 $test -f "$xxx" && libstyle=static
5311                 $test -f "$xxx" && thislib=${thislib}_s
5312             fi
5313             if test ! -f "$xxx"; then
5314                 xxx=$thisdir/Slib$thislib$_a
5315                 $test -f "$xxx" && eval $libscheck
5316                 $test -f "$xxx" && libstyle=static
5317             fi
5318             if $test -f "$xxx"; then
5319                 case "$libstyle" in
5320                 shared) echo "Found -l$thislib (shared)." ;;
5321                 static) echo "Found -l$thislib." ;;
5322                 *)      echo "Found -l$thislib ($libstyle)." ;;
5323                 esac
5324                 case " $dflt " in
5325                 *"-l$thislib "*);;
5326                 *) dflt="$dflt -l$thislib"
5327                    libsfound="$libsfound $xxx"
5328                    yyy=`basename $xxx`
5329                    libsfiles="$libsfiles $yyy"
5330                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5331                    case " $libsdirs " in
5332                    *" $yyy "*) ;;
5333                    *) libsdirs="$libsdirs $yyy" ;;
5334                    esac
5335                    ;;
5336                 esac
5337                 break
5338             fi
5339         done
5340         if $test ! -f "$xxx"; then
5341             echo "No -l$thislib."
5342         fi
5343 done
5344 set X $dflt
5345 shift
5346 dflt="$*"
5347 case "$libs" in
5348 '') dflt="$dflt";;
5349 *) dflt="$libs";;
5350 esac
5351 case "$dflt" in
5352 ' '|'') dflt='none';;
5353 esac
5354
5355 $cat <<EOM
5356
5357 In order to compile $package on your machine, a number of libraries
5358 are usually needed.  Include any other special libraries here as well.
5359 Say "none" for none.  The default list is almost always right.
5360 EOM
5361
5362 echo " "
5363 rp="What libraries to use?"
5364 . ./myread
5365 case "$ans" in
5366 none) libs=' ';;
5367 *) libs="$ans";;
5368 esac
5369
5370 : determine optimization, if desired, or use for debug flag also
5371 case "$optimize" in
5372 ' '|$undef) dflt='none';;
5373 '') dflt='-O';;
5374 *) dflt="$optimize";;
5375 esac
5376 $cat <<EOH
5377
5378 By default, $package compiles with the -O flag to use the optimizer.
5379 Alternately, you might want to use the symbolic debugger, which uses
5380 the -g flag (on traditional Unix systems).  Either flag can be
5381 specified here.  To use neither flag, specify the word "none".
5382
5383 EOH
5384 rp="What optimizer/debugger flag should be used?"
5385 . ./myread
5386 optimize="$ans"
5387 case "$optimize" in
5388 'none') optimize=" ";;
5389 esac
5390
5391 : Check what DEBUGGING is required from the command line
5392 : -DEBUGGING      or -DDEBUGGING or
5393 : -DEBUGGING=both                       = -g + -DDEBUGGING
5394 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5395 : -DEBUGGING=none or -UDEBUGGING        =
5396 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5397 case "$EBUGGING" in
5398 '')     ;;
5399 *)      DEBUGGING=$EBUGGING ;;
5400 esac
5401
5402 case "$DEBUGGING" in
5403 -g|both|$define)
5404     case "$optimize" in
5405         *-g*) ;;
5406         *)    optimize="$optimize -g" ;;
5407     esac ;;
5408 none|$undef)
5409     case "$optimize" in
5410         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5411                 shift
5412                 optimize="$*"
5413                 ;;
5414     esac ;;
5415 esac
5416
5417 dflt=''
5418 case "$DEBUGGING" in
5419 both|$define) dflt='-DDEBUGGING'
5420 esac
5421
5422 : argument order is deliberate, as the flag will start with - which set could
5423 : think is an option
5424 checkccflag='check=$1; flag=$2; callback=$3;
5425 echo " ";
5426 echo "Checking if your compiler accepts $flag" 2>&1;
5427 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5428 echo "int main(void) { return 0; }" > gcctest.c;
5429 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5430     echo "Yes, it does." 2>&1;
5431     if $test -s gcctest.out ; then
5432         echo "But your platform does not like it:";
5433         cat gcctest.out;
5434     else
5435         case "$ccflags" in
5436         *$check*)
5437             echo "Leaving current flags $ccflags alone." 2>&1
5438             ;;
5439         *) dflt="$dflt $flag";
5440             eval $callback
5441             ;;
5442         esac
5443     fi
5444 else
5445     echo "Nope, it does not, but that is ok." 2>&1;
5446 fi
5447 '
5448
5449 : We will not override a previous value, but we might want to
5450 : augment a hint file
5451 case "$hint" in
5452 default|recommended)
5453         case "$gccversion" in
5454         1*) dflt="$dflt -fpcc-struct-return" ;;
5455         esac
5456         case "$optimize:$DEBUGGING" in
5457         *-g*:old) dflt="$dflt -DDEBUGGING";;
5458         esac
5459         case "$gccversion" in
5460         2*) if $test -d /etc/conf/kconfig.d &&
5461                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5462                 then
5463                         # Interactive Systems (ISC) POSIX mode.
5464                         dflt="$dflt -posix"
5465                 fi
5466                 ;;
5467         esac
5468         case "$gccversion" in
5469         1*) ;;
5470         2.[0-8]*) ;;
5471         ?*)     set strict-aliasing -fno-strict-aliasing
5472                 eval $checkccflag
5473                 ;;
5474         esac
5475         # For gcc, adding -pipe speeds up compilations for some, but apparently
5476         # some assemblers can't read from stdin.  (It also slows down compilations
5477         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5478         case "$gccversion" in
5479         ?*)     set pipe -pipe
5480                 eval $checkccflag
5481                 ;;
5482         esac
5483
5484         # on x86_64 (at least) we require an extra library (libssp) in the
5485         # link command line. This library is not named, so I infer that it is
5486         # an implementation detail that may change. Hence the safest approach
5487         # is to add the flag to the flags passed to the compiler at link time,
5488         # as that way the compiler can do the right implementation dependant
5489         # thing. (NWC)
5490         case "$osname" in
5491         amigaos) ;; # -fstack-protector builds but doesn't work
5492         *)      case "$gccversion" in
5493                 ?*)     set stack-protector-strong -fstack-protector-strong
5494                         eval $checkccflag
5495                         case "$dflt" in
5496                         *-fstack-protector-strong*) ;; # It got added.
5497                         *) # Try the plain/older -fstack-protector.
5498                            set stack-protector -fstack-protector
5499                            eval $checkccflag
5500                            ;;
5501                         esac
5502                         ;;
5503                 esac
5504                 ;;
5505         esac
5506         ;;
5507 esac
5508
5509 case "$mips_type" in
5510 *BSD*|'') inclwanted="$locincpth $usrinc";;
5511 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5512 esac
5513 for thisincl in $inclwanted; do
5514         if $test -d $thisincl; then
5515                 if $test x$thisincl != x$usrinc; then
5516                         case "$dflt" in
5517                         *" -I$thisincl "*);;
5518                         *) dflt="$dflt -I$thisincl ";;
5519                         esac
5520                 fi
5521         fi
5522 done
5523
5524 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5525         xxx=true;
5526 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5527         xxx=true;
5528 else
5529         xxx=false;
5530 fi;
5531 if $xxx; then
5532         case "$dflt" in
5533         *$2*);;
5534         *) dflt="$dflt -D$2";;
5535         esac;
5536 fi'
5537
5538 set signal.h LANGUAGE_C; eval $inctest
5539
5540 case "$usesocks" in
5541 $define)
5542         ccflags="$ccflags -DSOCKS"
5543         ;;
5544 esac
5545
5546 case "$hint" in
5547 default|recommended) dflt="$ccflags $dflt" ;;
5548 *) dflt="$ccflags";;
5549 esac
5550
5551 case "$dflt" in
5552 ''|' ') dflt=none;;
5553 esac
5554
5555 $cat <<EOH
5556
5557 Your C compiler may want other flags.  For this question you should include
5558 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5559 but you should NOT include libraries or ld flags like -lwhatever.  If you
5560 want $package to honor its debug switch, you should include -DDEBUGGING here.
5561 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5562
5563 To use no flags, specify the word "none".
5564
5565 EOH
5566 set X $dflt
5567 shift
5568 dflt=${1+"$@"}
5569 rp="Any additional cc flags?"
5570 . ./myread
5571 case "$ans" in
5572 none) ccflags='';;
5573 *) ccflags="$ans";;
5574 esac
5575
5576 : the following weeds options from ccflags that are of no interest to cpp
5577 case "$cppflags" in
5578 '') cppflags="$ccflags" ;;
5579 *)  set X $ccflags; shift
5580     case " $cppflags " in
5581     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5582     *) cppflags="$cppflags $ccflags" ;;
5583     esac
5584     ;;
5585 esac
5586 case "$gccversion" in
5587 1*) cppflags="$cppflags -D__GNUC__"
5588 esac
5589 case "$mips_type" in
5590 '');;
5591 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5592 esac
5593 case "$cppflags" in
5594 '');;
5595 *)
5596         echo " "
5597         echo "Let me guess what the preprocessor flags are..." >&4
5598         set X $cppflags
5599         shift
5600         cppflags=''
5601         $cat >cpp.c <<'EOM'
5602 #define BLURFL foo
5603
5604 BLURFL xx LFRULB
5605 EOM
5606         previous=''
5607         for flag in $*
5608         do
5609                 case "$flag" in
5610                 -*) ftry="$flag";;
5611                 *) ftry="$previous $flag";;
5612                 esac
5613                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5614                         >cpp1.out 2>/dev/null && \
5615                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5616                         >cpp2.out 2>/dev/null && \
5617                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5618                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5619                 then
5620                         cppflags="$cppflags $ftry"
5621                         previous=''
5622                 else
5623                         previous="$flag"
5624                 fi
5625         done
5626         set X $cppflags
5627         shift
5628         cppflags=${1+"$@"}
5629         case "$cppflags" in
5630         *-*)  echo "They appear to be: $cppflags";;
5631         esac
5632         $rm -f cpp.c cpp?.out
5633         ;;
5634 esac
5635
5636 : flags used in final linking phase
5637 case "$ldflags" in
5638 '') if ./venix; then
5639                 dflt='-i -z'
5640         else
5641                 dflt=''
5642         fi
5643         case "$ccflags" in
5644         *-posix*) dflt="$dflt -posix" ;;
5645         esac
5646         ;;
5647 *) dflt="$ldflags";;
5648 esac
5649 # See note above about -fstack-protector
5650 case "$ccflags" in
5651 *-fstack-protector-strong*)
5652         case "$dflt" in
5653         *-fstack-protector-strong*) ;; # Don't add it again
5654         *) dflt="$dflt -fstack-protector-strong" ;;
5655         esac
5656         ;;
5657 *-fstack-protector*)
5658         case "$dflt" in
5659         *-fstack-protector*) ;; # Don't add it again
5660         *) dflt="$dflt -fstack-protector" ;;
5661         esac
5662         ;;
5663 esac
5664
5665 : Try to guess additional flags to pick up local libraries.
5666 for thislibdir in $libpth; do
5667         case " $loclibpth " in
5668         *" $thislibdir "*)
5669                 case "$dflt " in
5670                 *"-L$thislibdir "*) ;;
5671                 *)  dflt="$dflt -L$thislibdir" ;;
5672                 esac
5673                 ;;
5674         esac
5675 done
5676
5677 case "$dflt" in
5678 '') dflt='none' ;;
5679 esac
5680
5681 $cat <<EOH
5682
5683 Your C linker may need flags.  For this question you should
5684 include -L/whatever and any other flags used by the C linker, but you
5685 should NOT include libraries like -lwhatever.
5686
5687 Make sure you include the appropriate -L/path flags if your C linker
5688 does not normally search all of the directories you specified above,
5689 namely
5690         $libpth
5691 To use no flags, specify the word "none".
5692
5693 EOH
5694
5695 rp="Any additional ld flags (NOT including libraries)?"
5696 . ./myread
5697 case "$ans" in
5698 none) ldflags='';;
5699 *) ldflags="$ans";;
5700 esac
5701 rmlist="$rmlist pdp11"
5702
5703 : coherency check
5704 echo " "
5705 echo "Checking your choice of C compiler and flags for coherency..." >&4
5706 $cat > try.c <<'EOF'
5707 #include <stdio.h>
5708 int main() { printf("Ok\n"); return(0); }
5709 EOF
5710 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5711 shift
5712 $cat >try.msg <<'EOM'
5713 I've tried to compile and run the following simple program:
5714
5715 EOM
5716 $cat try.c >> try.msg
5717
5718 $cat >> try.msg <<EOM
5719
5720 I used the command:
5721
5722         $*
5723         $run ./try
5724
5725 and I got the following output:
5726
5727 EOM
5728 dflt=y
5729 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5730         if $sh -c "$run ./try " >>try.msg 2>&1; then
5731                 xxx=`$run ./try`
5732                 case "$xxx" in
5733                 "Ok") dflt=n ;;
5734                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5735                 esac
5736         else
5737                 echo "The program compiled OK, but exited with status $?." >>try.msg
5738                 rp="You have a problem.  Shall I abort Configure"
5739                 dflt=y
5740         fi
5741 else
5742         echo "I can't compile the test program." >>try.msg
5743         rp="You have a BIG problem.  Shall I abort Configure"
5744         dflt=y
5745 fi
5746 case "$dflt" in
5747 y)
5748         $cat try.msg >&4
5749         case "$knowitall" in
5750         '')
5751                 echo "(The supplied flags or libraries might be incorrect.)"
5752                 ;;
5753         *) dflt=n;;
5754         esac
5755         echo " "
5756         . ./myread
5757         case "$ans" in
5758         n*|N*) ;;
5759         *)      echo "Ok.  Stopping Configure." >&4
5760                 exit 1
5761                 ;;
5762         esac
5763         ;;
5764 n) echo "OK, that should do.";;
5765 esac
5766 $rm_try gcctest gcctest.out
5767
5768 : define a shorthand compile call
5769 compile='
5770 mc_file=$1;
5771 shift;
5772 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5773 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5774 exit 1;
5775 fi;
5776 esac;
5777 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5778 : define a shorthand compile call for compilations that should be ok.
5779 compile_ok='
5780 mc_file=$1;
5781 shift;
5782 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5783
5784 : stub, used only to satisfy other units
5785 i_stdlib='define'
5786
5787 : check for lengths of integral types
5788 echo " "
5789 case "$intsize" in
5790 '')
5791         echo "Checking to see how big your integers are..." >&4
5792         $cat >try.c <<EOCP
5793 #include <stdio.h>
5794 #$i_stdlib I_STDLIB
5795 #ifdef I_STDLIB
5796 #include <stdlib.h>
5797 #endif
5798 int main()
5799 {
5800         printf("intsize=%d;\n", (int)sizeof(int));
5801         printf("longsize=%d;\n", (int)sizeof(long));
5802         printf("shortsize=%d;\n", (int)sizeof(short));
5803         exit(0);
5804 }
5805 EOCP
5806         set try
5807         if eval $compile_ok && $run ./try > /dev/null; then
5808                 eval `$run ./try`
5809                 echo "Your integers are $intsize bytes long."
5810                 echo "Your long integers are $longsize bytes long."
5811                 echo "Your short integers are $shortsize bytes long."
5812         else
5813                 $cat >&4 <<EOM
5814 !
5815 Help! I can't compile and run the intsize test program: please enlighten me!
5816 (This is probably a misconfiguration in your system or libraries, and
5817 you really ought to fix it.  Still, I'll try anyway.)
5818 !
5819 EOM
5820                 dflt=4
5821                 rp="What is the size of an integer (in bytes)?"
5822                 . ./myread
5823                 intsize="$ans"
5824                 dflt=$intsize
5825                 rp="What is the size of a long integer (in bytes)?"
5826                 . ./myread
5827                 longsize="$ans"
5828                 dflt=2
5829                 rp="What is the size of a short integer (in bytes)?"
5830                 . ./myread
5831                 shortsize="$ans"
5832         fi
5833         ;;
5834 esac
5835 $rm_try
5836
5837 : check for long long
5838 echo " "
5839 echo "Checking to see if you have long long..." >&4
5840 echo 'int main() { long long x = 7; return 0; }' > try.c
5841 set try
5842 if eval $compile; then
5843         val="$define"
5844         echo "You have long long."
5845 else
5846         val="$undef"
5847         echo "You do not have long long."
5848 fi
5849 $rm_try
5850 set d_longlong
5851 eval $setvar
5852
5853 : check for length of long long
5854 case "${d_longlong}${longlongsize}" in
5855 $define)
5856         echo " "
5857         echo "Checking to see how big your long longs are..." >&4
5858         $cat >try.c <<'EOCP'
5859 #include <stdio.h>
5860 int main()
5861 {
5862     printf("%d\n", (int)sizeof(long long));
5863     return(0);
5864 }
5865 EOCP
5866         set try
5867         if eval $compile_ok; then
5868                 longlongsize=`$run ./try`
5869                 echo "Your long longs are $longlongsize bytes long."
5870         else
5871                 dflt='8'
5872                 echo " "
5873                 echo "(I can't seem to compile the test program.  Guessing...)"
5874                 rp="What is the size of a long long (in bytes)?"
5875                 . ./myread
5876                 longlongsize="$ans"
5877         fi
5878         if $test "X$longsize" = "X$longlongsize"; then
5879                 echo "(That isn't any different from an ordinary long.)"
5880         fi
5881         ;;
5882 esac
5883 $rm_try
5884
5885 : determine filename position in cpp output
5886 echo " "
5887 echo "Computing filename position in cpp output for #include directives..." >&4
5888 case "$osname" in
5889 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5890 esac
5891 case "$fieldn" in
5892 '')
5893 case "$osname" in
5894 vos) testaccess=-e ;;
5895 *)   testaccess=-r ;;
5896 esac
5897 echo '#include <stdio.h>' > foo.c
5898 $cat >fieldn <<EOF
5899 $startsh
5900 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5901 $grep '^[       ]*#.*stdio\.h' | \
5902 while read cline; do
5903         pos=1
5904         set \$cline
5905         while $test \$# -gt 0; do
5906                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5907                         echo "\$pos"
5908                         exit 0
5909                 fi
5910                 shift
5911                 pos=\`expr \$pos + 1\`
5912         done
5913 done
5914 EOF
5915 chmod +x fieldn
5916 fieldn=`./fieldn`
5917 $rm -f foo.c fieldn
5918 ;;
5919 esac
5920 case $fieldn in
5921 '') pos='???';;
5922 1) pos=first;;
5923 2) pos=second;;
5924 3) pos=third;;
5925 *) pos="${fieldn}th";;
5926 esac
5927 echo "Your cpp writes the filename in the $pos field of the line."
5928
5929 : locate header file
5930 $cat >findhdr <<EOF
5931 $startsh
5932 wanted=\$1
5933 name=''
5934 for usrincdir in $incpth
5935 do
5936         if test -f \$usrincdir/\$wanted; then
5937                 echo "\$usrincdir/\$wanted"
5938                 exit 0
5939         fi
5940 done
5941 awkprg='{ print \$$fieldn }'
5942 echo "#include <\$wanted>" > foo\$\$.c
5943 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5944 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5945 while read cline; do
5946         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5947         case "\$name" in
5948         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5949         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5950         *) exit 2;;
5951         esac;
5952 done;
5953 #
5954 # status = 0: grep returned 0 lines, case statement not executed
5955 # status = 1: headerfile found
5956 # status = 2: while loop executed, no headerfile found
5957 #
5958 status=\$?
5959 $rm -f foo\$\$.c;
5960 if test \$status -eq 1; then
5961         exit 0;
5962 fi
5963 exit 1
5964 EOF
5965 chmod +x findhdr
5966
5967 : define an alternate in-header-list? function
5968 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5969 cont=true; xxf="echo \"<\$1> found.\" >&4";
5970 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5971 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5972 esac;
5973 case $# in 4) instead=instead;; *) instead="at last";; esac;
5974 while $test "$cont"; do
5975         xxx=`./findhdr $1`
5976         var=$2; eval "was=\$$2";
5977         if $test "$xxx" && $test -r "$xxx";
5978         then eval $xxf;
5979         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5980                 cont="";
5981         else eval $xxnf;
5982         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5983         set $yyy; shift; shift; yyy=$@;
5984         case $# in 0) cont="";;
5985         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5986                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5987         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5988                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5989         esac;
5990 done;
5991 while $test "$yyy";
5992 do set $yyy; var=$2; eval "was=\$$2";
5993         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5994         set $yyy; shift; shift; yyy=$@;
5995 done'
5996
5997 : see if inttypes.h is available
5998 : we want a real compile instead of Inhdr because some systems
5999 : have an inttypes.h which includes non-existent headers
6000 echo " "
6001 $cat >try.c <<EOCP
6002 #include <inttypes.h>
6003 int main() {
6004         static int32_t foo32 = 0x12345678;
6005 }
6006 EOCP
6007 set try
6008 if eval $compile; then
6009         echo "<inttypes.h> found." >&4
6010         val="$define"
6011 else
6012         echo "<inttypes.h> NOT found." >&4
6013         val="$undef"
6014 fi
6015 $rm_try
6016 set i_inttypes
6017 eval $setvar
6018
6019 : check for int64_t
6020 echo " "
6021 echo "Checking to see if you have int64_t..." >&4
6022 $cat >try.c <<EOCP
6023 #include <sys/types.h>
6024 #$i_inttypes I_INTTYPES
6025 #ifdef I_INTTYPES
6026 #include <inttypes.h>
6027 #endif
6028 int main() { int64_t x = 7; }
6029 EOCP
6030 set try
6031 if eval $compile; then
6032         val="$define"
6033         echo "You have int64_t."
6034 else
6035         val="$undef"
6036         echo "You do not have int64_t."
6037 fi
6038 $rm_try
6039 set d_int64_t
6040 eval $setvar
6041
6042 : Check if 64bit ints have a quad type
6043 echo " "
6044 echo "Checking which 64-bit integer type we could use..." >&4
6045
6046 case "$intsize" in
6047 8) val=int
6048    set quadtype
6049    eval $setvar
6050    val='"unsigned int"'
6051    set uquadtype
6052    eval $setvar
6053    quadkind=1
6054    ;;
6055 *) case "$longsize" in
6056    8) val=long
6057       set quadtype
6058       eval $setvar
6059       val='"unsigned long"'
6060       set uquadtype
6061       eval $setvar
6062       quadkind=2
6063       ;;
6064    *) case "$d_longlong:$longlongsize" in
6065       define:8)
6066         val='"long long"'
6067         set quadtype
6068         eval $setvar
6069         val='"unsigned long long"'
6070         set uquadtype
6071         eval $setvar
6072         quadkind=3
6073         ;;
6074       *) case "$d_int64_t" in
6075          define)
6076            val=int64_t
6077            set quadtype
6078            eval $setvar
6079            val=uint64_t
6080            set uquadtype
6081            eval $setvar
6082            quadkind=4
6083            ;;
6084          esac
6085          ;;
6086       esac
6087       ;;
6088    esac
6089    ;;
6090 esac
6091
6092 case "$quadtype" in
6093 '')     echo "Alas, no 64-bit integer types in sight." >&4
6094         d_quad="$undef"
6095         ;;
6096 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6097         d_quad="$define"
6098         ;;
6099 esac
6100
6101 : Do we want 64bit support
6102 case "$uselonglong" in
6103 "$define"|true|[yY]*)
6104         cat <<EOM >&4
6105
6106 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6107 EOM
6108         use64bitint="$define"
6109         ;;
6110 esac
6111 case "$use64bits" in
6112 "$define"|true|[yY]*)
6113         cat <<EOM >&4
6114
6115 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6116 EOM
6117         use64bitint="$define"
6118         ;;
6119 esac
6120 case "$use64bitints" in
6121 "$define"|true|[yY]*)
6122         cat <<EOM >&4
6123
6124 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6125 EOM
6126         use64bitint="$define"
6127         ;;
6128 esac
6129 case "$use64bitsint" in
6130 "$define"|true|[yY]*)
6131         cat <<EOM >&4
6132
6133 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6134 EOM
6135         use64bitint="$define"
6136         ;;
6137 esac
6138 case "$uselonglongs" in
6139 "$define"|true|[yY]*)
6140         cat <<EOM >&4
6141
6142 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6143 EOM
6144         use64bitint="$define"
6145         ;;
6146 esac
6147 case "$use64bitsall" in
6148 "$define"|true|[yY]*)
6149         cat <<EOM >&4
6150
6151 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6152 EOM
6153         use64bitall="$define"
6154         ;;
6155 esac
6156
6157 case "$ccflags" in
6158 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6159 esac
6160 case "$use64bitall" in
6161 "$define"|true|[yY]*) use64bitint="$define" ;;
6162 esac
6163
6164 case "$longsize" in
6165 8) cat <<EOM
6166
6167 You have natively 64-bit long integers.
6168 EOM
6169    val="$define"
6170    ;;
6171 *) case "$use64bitint" in
6172    "$define"|true|[yY]*) dflt='y';;
6173    *) dflt='n';;
6174    esac
6175    case "$d_quad" in
6176    "$define") ;;
6177    *) dflt='n' ;;
6178    esac
6179    cat <<EOM
6180
6181 Perl can be built to take advantage of 64-bit integer types
6182 on some systems.  To do so, Configure can be run with -Duse64bitint.
6183 Choosing this option will most probably introduce binary incompatibilities.
6184
6185 If this doesn't make any sense to you, just accept the default '$dflt'.
6186 (The default has been chosen based on your configuration.)
6187 EOM
6188    rp='Try to use 64-bit integers, if available?'
6189    . ./myread
6190    case "$ans" in
6191    [yY]*) val="$define" ;;
6192    *)     val="$undef"  ;;
6193    esac
6194    ;;
6195 esac
6196 set use64bitint
6197 eval $setvar
6198
6199 case "$use64bitall" in
6200 "$define"|true|[yY]*) dflt='y' ;;
6201 *) case "$longsize" in
6202    8) dflt='y' ;;
6203    *) dflt='n' ;;
6204    esac
6205    ;;
6206 esac
6207 cat <<EOM
6208
6209 You may also choose to try maximal 64-bitness.  It means using as much
6210 64-bitness as possible on the platform.  This in turn means even more
6211 binary incompatibilities.  On the other hand, your platform may not
6212 have any more 64-bitness available than what you already have chosen.
6213
6214 If this doesn't make any sense to you, just accept the default '$dflt'.
6215 (The default has been chosen based on your configuration.)
6216 EOM
6217 rp='Try to use maximal 64-bit support, if available?'
6218 . ./myread
6219 case "$ans" in
6220 [yY]*) val="$define" ;;
6221 *)     val="$undef"  ;;
6222 esac
6223 set use64bitall
6224 eval $setvar
6225 case "$use64bitall" in
6226 "$define")
6227         case "$use64bitint" in
6228         "$undef")
6229                 cat <<EOM
6230
6231 Since you have chosen a maximally 64-bit build, I'm also turning on
6232 the use of 64-bit integers.
6233 EOM
6234                 use64bitint="$define" ;;
6235         esac
6236         ;;
6237 esac
6238
6239 : Look for a hint-file generated 'call-back-unit'.  If the
6240 : user has specified that a 64-bit perl is to be built,
6241 : we may need to set or change some other defaults.
6242 if $test -f use64bitint.cbu; then
6243         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6244         . ./use64bitint.cbu
6245 fi
6246 case "$use64bitint" in
6247 "$define"|true|[yY]*)
6248         : This test was common to all the OpenBSD forks, and seems harmless for
6249         : other platforms:
6250         echo " "
6251         echo "Checking if your C library has broken 64-bit functions..." >&4
6252         cat >try.c <<EOCP
6253 #include <stdio.h>
6254 typedef $uquadtype myULL;
6255 int main (void)
6256 {
6257     struct {
6258         double d;
6259         myULL  u;
6260     } *p, test[] = {
6261         {4294967303.15, 4294967303ULL},
6262         {4294967294.2,  4294967294ULL},
6263         {4294967295.7,  4294967295ULL},
6264         {0.0, 0ULL}
6265     };
6266     for (p = test; p->u; p++) {
6267         myULL x = (myULL)p->d;
6268         if (x != p->u) {
6269             printf("buggy\n");
6270             return 0;
6271         }
6272     }
6273     printf("ok\n");
6274     return 0;
6275 }
6276 EOCP
6277         set try
6278         if eval $compile_ok; then
6279             libcquad=`$run ./try`
6280             echo "Your C library's 64-bit functions are $libcquad."
6281         else
6282             echo "(I can't seem to compile the test program.)"
6283             echo "Assuming that your C library's 64-bit functions are ok."
6284             libcquad="ok"
6285         fi
6286         $rm_try
6287
6288         case "$libcquad" in
6289             buggy*)
6290                 cat >&4 <<EOM
6291
6292 *** You have a C library with broken 64-bit functions.
6293 *** 64-bit support does not work reliably in this configuration.
6294 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6295 *** Cannot continue, aborting.
6296
6297 EOM
6298                 exit 1
6299                 ;;
6300         esac
6301         case "$longsize" in
6302         4) case "$archname64" in
6303            '') archname64=64int ;;
6304            esac
6305            ;;
6306         esac
6307         ;;
6308 esac
6309
6310 : Look for a hint-file generated 'call-back-unit'.  If the
6311 : user has specified that a maximally 64-bit perl is to be built,
6312 : we may need to set or change some other defaults.
6313 if $test -f use64bitall.cbu; then
6314         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6315         . ./use64bitall.cbu
6316 fi
6317 case "$use64bitall" in
6318 "$define"|true|[yY]*)
6319         case "$longsize" in
6320         4) case "$archname64" in
6321            ''|64int) archname64=64all ;;
6322            esac
6323            ;;
6324         esac
6325         ;;
6326 esac
6327
6328 case "$d_quad:$use64bitint" in
6329 $undef:$define)
6330         cat >&4 <<EOF
6331
6332 *** You have chosen to use 64-bit integers,
6333 *** but none can be found.
6334 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6335 *** Cannot continue, aborting.
6336
6337 EOF
6338         exit 1
6339         ;;
6340 esac
6341
6342 : Check if we are using the GNU C library
6343 echo " "
6344 echo "Checking for GNU C Library..." >&4
6345 cat >try.c <<'EOCP'
6346 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6347    alone are insufficient to distinguish different versions, such as
6348    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6349    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6350 */
6351 #include <stdio.h>
6352 int main(void)
6353 {
6354 #ifdef __GLIBC__
6355 #   ifdef __GLIBC_MINOR__
6356 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6357 #           include <gnu/libc-version.h>
6358             printf("%s\n",  gnu_get_libc_version());
6359 #       else
6360             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6361 #       endif
6362 #   else
6363         printf("%d\n",  __GLIBC__);
6364 #   endif
6365     return 0;
6366 #else
6367     return 1;
6368 #endif
6369 }
6370 EOCP
6371 set try
6372 if eval $compile_ok && $run ./try > glibc.ver; then
6373         val="$define"
6374         gnulibc_version=`$cat glibc.ver`
6375         echo "You are using the GNU C Library version $gnulibc_version"
6376 else
6377         val="$undef"
6378         gnulibc_version=''
6379         echo "You are not using the GNU C Library"
6380 fi
6381 $rm_try glibc.ver
6382 set d_gnulibc
6383 eval $setvar
6384
6385 : see if nm is to be used to determine whether a symbol is defined or not
6386 case "$usenm" in
6387 '')
6388         dflt=''
6389         case "$d_gnulibc" in
6390         "$define")
6391                 echo " "
6392                 echo "nm probably won't work on the GNU C Library." >&4
6393                 dflt=n
6394                 ;;
6395         esac
6396         case "$dflt" in
6397         '')
6398                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6399                         echo " "
6400                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6401                         echo "'nm' won't be sufficient on this system." >&4
6402                         dflt=n
6403                 fi
6404                 ;;
6405         esac
6406         case "$dflt" in
6407         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6408                 if $test $dflt -gt 20; then
6409                         dflt=y
6410                 else
6411                         dflt=n
6412                 fi
6413                 ;;
6414         esac
6415         ;;
6416 *)
6417         case "$usenm" in
6418         true|$define) dflt=y;;
6419         *) dflt=n;;
6420         esac
6421         ;;
6422 esac
6423 $cat <<EOM
6424
6425 I can use $nm to extract the symbols from your C libraries. This
6426 is a time consuming task which may generate huge output on the disk (up
6427 to 3 megabytes) but that should make the symbols extraction faster. The
6428 alternative is to skip the 'nm' extraction part and to compile a small
6429 test program instead to determine whether each symbol is present. If
6430 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6431 this may be the best solution.
6432
6433 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6434
6435 EOM
6436 rp="Shall I use $nm to extract C symbols from the libraries?"
6437 . ./myread
6438 case "$ans" in
6439 [Nn]*) usenm=false;;
6440 *) usenm=true;;
6441 esac
6442
6443 runnm=$usenm
6444 case "$reuseval" in
6445 true) runnm=false;;
6446 esac
6447
6448 : nm options which may be necessary
6449 case "$nm_opt" in
6450 '') if $test -f /mach_boot; then
6451                 nm_opt=''       # Mach
6452         elif $test -d /usr/ccs/lib; then
6453                 nm_opt='-p'     # Solaris (and SunOS?)
6454         elif $test -f /dgux; then
6455                 nm_opt='-p'     # DG-UX
6456         elif $test -f /lib64/rld; then
6457                 nm_opt='-p'     # 64-bit Irix
6458         else
6459                 nm_opt=''
6460         fi;;
6461 esac
6462
6463 : nm options which may be necessary for shared libraries but illegal
6464 : for archive libraries.  Thank you, Linux.
6465 case "$nm_so_opt" in
6466 '')     case "$myuname" in
6467         *linux*|gnu*)
6468                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6469                         nm_so_opt='--dynamic'
6470                 fi
6471                 ;;
6472         esac
6473         ;;
6474 esac
6475
6476 : Figure out where the libc is located
6477 case "$runnm" in
6478 true)
6479 : get list of predefined functions in a handy place
6480 echo " "
6481 case "$libc" in
6482 '') libc=unknown
6483         case "$libs" in
6484         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6485         esac
6486         ;;
6487 esac
6488 case "$libs" in
6489 '') ;;
6490 *)  for thislib in $libs; do
6491         case "$thislib" in
6492         -lc|-lc_s)
6493                 : Handle C library specially below.
6494                 ;;
6495         -l*)
6496                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6497                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6498                         :
6499                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6500                         :
6501                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6502                         :
6503                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6504                         :
6505                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6506                         :
6507                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6508                         :
6509                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6510                         :
6511                 else
6512                         try=''
6513                 fi
6514                 libnames="$libnames $try"
6515                 ;;
6516         *) libnames="$libnames $thislib" ;;
6517         esac
6518         done
6519         ;;
6520 esac
6521 xxx=normal
6522 case "$libc" in
6523 unknown)
6524         set /lib/libc.$so
6525         for xxx in $libpth; do
6526                 $test -r $1 || set $xxx/libc.$so
6527                 : The messy sed command sorts on library version numbers.
6528                 $test -r $1 || \
6529                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6530                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6531                                 h
6532                                 s/[0-9][0-9]*/0000&/g
6533                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6534                                 G
6535                                 s/\n/ /' | \
6536                          $sort | $sed -e 's/^.* //'`
6537                 eval set \$$#
6538         done
6539         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6540         $test -r $1 || set $sysroot/lib/libsys_s$_a
6541         ;;
6542 *)
6543         set blurfl
6544         ;;
6545 esac
6546 if $test -r "$1"; then
6547         echo "Your (shared) C library seems to be in $1."
6548         libc="$1"
6549 elif $test -r /lib/libc && $test -r /lib/clib; then
6550         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6551         xxx=apollo
6552         libc='/lib/clib /lib/libc'
6553         if $test -r /lib/syslib; then
6554                 echo "(Your math library is in /lib/syslib.)"
6555                 libc="$libc /lib/syslib"
6556         fi
6557 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6558         echo "Your C library seems to be in $libc, as you said before."
6559 elif $test -r $incpath/usr/lib/libc$_a; then
6560         libc=$incpath/usr/lib/libc$_a;
6561         echo "Your C library seems to be in $libc.  That's fine."
6562 elif $test -r /lib/libc$_a; then
6563         libc=/lib/libc$_a;
6564         echo "Your C library seems to be in $libc.  You're normal."
6565 else
6566         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6567                 :
6568         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6569                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6570         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6571                 :
6572         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6573                 :
6574         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6575                 :
6576         else
6577                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6578         fi
6579         if $test -r "$tans"; then
6580                 echo "Your C library seems to be in $tans, of all places."
6581                 libc=$tans
6582         else
6583                 libc='blurfl'
6584         fi
6585 fi
6586 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6587         dflt="$libc"
6588         cat <<EOM
6589
6590 If the guess above is wrong (which it might be if you're using a strange
6591 compiler, or your machine supports multiple models), you can override it here.
6592
6593 EOM
6594 else
6595         dflt=''
6596         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6597         cat >&4 <<EOM
6598 I can't seem to find your C library.  I've looked in the following places:
6599
6600 EOM
6601         $sed 's/^/      /' libpath
6602         cat <<EOM
6603
6604 None of these seems to contain your C library. I need to get its name...
6605
6606 EOM
6607 fi
6608 fn=f
6609 rp='Where is your C library?'
6610 . ./getfile
6611 libc="$ans"
6612
6613 echo " "
6614 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6615 set X `cat libnames`
6616 shift
6617 xxx=files
6618 case $# in 1) xxx=file; esac
6619 echo "Extracting names from the following $xxx for later perusal:" >&4
6620 echo " "
6621 $sed 's/^/      /' libnames >&4
6622 echo " "
6623 $echo $n "This may take a while...$c" >&4
6624
6625 for file in $*; do
6626         case $file in
6627         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6628         *) $nm $nm_opt $file 2>/dev/null;;
6629         esac
6630 done >libc.tmp
6631
6632 $echo $n ".$c"
6633 $grep fprintf libc.tmp > libc.ptf
6634 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6635 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6636 xxx='[ADTSIWi]'
6637 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6638         eval $xscan;\
6639         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6640                 eval $xrun
6641 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6642         eval $xscan;\
6643         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6644                 eval $xrun
6645 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6646         eval $xscan;\
6647         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6648                 eval $xrun
6649 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6650         eval $xscan;\
6651         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6652                 eval $xrun
6653 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6654         eval $xscan;\
6655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6656                 eval $xrun
6657 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6658         eval $xscan;\
6659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6660                 eval $xrun
6661 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6662                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6663         eval $xscan;\
6664         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6665                 eval $xrun
6666 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6667         eval $xscan;\
6668         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6669                 eval $xrun
6670 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6671         eval $xscan;\
6672         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6673                 eval $xrun
6674 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6675         eval $xscan;\
6676         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6677                 eval $xrun
6678 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6679         eval $xscan;\
6680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6681                 eval $xrun
6682 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6683         eval $xscan;\
6684         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6685                 eval $xrun
6686 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6687         eval $xscan;\
6688         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6689                 eval $xrun
6690 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6691         eval $xscan;\
6692         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6693                 eval $xrun
6694 else
6695         $nm -p $* 2>/dev/null >libc.tmp
6696         $grep fprintf libc.tmp > libc.ptf
6697         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6698                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6699         then
6700                 nm_opt='-p'
6701                 eval $xrun
6702         else
6703                 echo " "
6704                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6705                 com=''
6706                 if $ar t $libc > libc.tmp && \
6707                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6708                 then
6709                         for thisname in $libnames $libc; do
6710                                 $ar t $thisname >>libc.tmp
6711                         done
6712                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6713                         echo "Ok." >&4
6714                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6715                         for thisname in $libnames $libc; do
6716                                 $ar tv $thisname >>libc.tmp
6717                                 emximp -o tmp.imp $thisname \
6718                                     2>/dev/null && \
6719                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6720                                     < tmp.imp >>libc.tmp
6721                                 $rm -f tmp.imp
6722                         done
6723                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6724                         echo "Ok." >&4
6725                 else
6726                         echo "$ar didn't seem to work right." >&4
6727                         echo "Maybe this is a Cray...trying bld instead..." >&4
6728                         if  bld t $libc | \
6729                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6730                                 $test -s libc.list
6731                         then
6732                                 for thisname in $libnames; do
6733                                         bld t $libnames | \
6734                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6735                                         $ar t $thisname >>libc.tmp
6736                                 done
6737                                 echo "Ok." >&4
6738                         else
6739                                 echo "That didn't work either.  Giving up." >&4
6740                                 exit 1
6741                         fi
6742                 fi
6743         fi
6744 fi
6745 nm_extract="$com"
6746 case "$PASE" in
6747 define)
6748     echo " "
6749     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6750     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6751     ;;
6752 *)  if $test -f /lib/syscalls.exp; then
6753         echo " "
6754         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6755         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6756                 /lib/syscalls.exp >>libc.list
6757     fi
6758     ;;
6759 esac
6760 ;;
6761 esac
6762 $rm -f libnames libpath
6763
6764 : Check if we are using C++
6765 echo " "
6766 echo "Checking for C++..." >&4
6767 $cat >try.c <<'EOCP'
6768 #include <stdio.h>
6769 int main(void)
6770 {
6771 #ifdef __cplusplus
6772     return 0;
6773 #else
6774     return 1;
6775 #endif
6776 }
6777 EOCP
6778 set try
6779 if eval $compile_ok && $run ./try; then
6780         val="$define"
6781         echo "You are using a C++ compiler."
6782 else
6783         val="$undef"
6784         echo "You are not using a C++ compiler."
6785 fi
6786 $rm_try cplusplus$$
6787 set d_cplusplus
6788 eval $setvar
6789
6790 : is a C symbol defined?
6791 csym='tlook=$1;
6792 case "$3" in
6793 -v) tf=libc.tmp; tdc="";;
6794 -a) tf=libc.tmp; tdc="[]";;
6795 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6796 esac;
6797 case "$d_cplusplus" in
6798     $define)    extern_C="extern \"C\"" ;;
6799     *)          extern_C="extern"       ;;
6800 esac;
6801 tx=yes;
6802 case "$reuseval-$4" in
6803 true-) ;;
6804 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6805 esac;
6806 case "$tx" in
6807 yes)
6808         tval=false;
6809         if $test "$runnm" = true; then
6810                 if $contains $tlook $tf >/dev/null 2>&1; then
6811                         tval=true;
6812                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6813                         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;
6814                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6815                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6816                         $rm_try;
6817                 fi;
6818         else
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 $libs >/dev/null 2>&1 && tval=true;
6821                 $rm_try;
6822         fi;
6823         ;;
6824 *)
6825         case "$tval" in
6826         $define) tval=true;;
6827         *) tval=false;;
6828         esac;
6829         ;;
6830 esac;
6831 eval "$2=$tval"'
6832
6833 : define an is-in-libc? function
6834 inlibc='echo " "; td=$define; tu=$undef;
6835 sym=$1; var=$2; eval "was=\$$2";
6836 tx=yes;
6837 case "$reuseval$was" in
6838 true) ;;
6839 true*) tx=no;;
6840 esac;
6841 case "$tx" in
6842 yes)
6843         set $sym tres -f;
6844         eval $csym;
6845         case "$tres" in
6846         true)
6847                 echo "$sym() found." >&4;
6848                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6849         *)
6850                 echo "$sym() NOT found." >&4;
6851                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6852         esac;;
6853 *)
6854         case "$was" in
6855         $define) echo "$sym() found." >&4;;
6856         *) echo "$sym() NOT found." >&4;;
6857         esac;;
6858 esac'
6859
6860 : check for length of double
6861 echo " "
6862 case "$doublesize" in
6863 '')
6864         echo "Checking to see how big your double precision numbers are..." >&4
6865         $cat >try.c <<EOCP
6866 #include <stdio.h>
6867 #$i_stdlib I_STDLIB
6868 #ifdef I_STDLIB
6869 #include <stdlib.h>
6870 #endif
6871 int main()
6872 {
6873     printf("%d\n", (int)sizeof(double));
6874     exit(0);
6875 }
6876 EOCP
6877         set try
6878         if eval $compile_ok; then
6879                 doublesize=`$run ./try`
6880                 echo "Your double is $doublesize bytes long."
6881         else
6882                 dflt='8'
6883                 echo "(I can't seem to compile the test program.  Guessing...)"
6884                 rp="What is the size of a double precision number (in bytes)?"
6885                 . ./myread
6886                 doublesize="$ans"
6887         fi
6888         ;;
6889 esac
6890 $rm_try
6891
6892 : check for long doubles
6893 echo " "
6894 echo "Checking to see if you have long double..." >&4
6895 echo 'int main() { long double x = 7.0; }' > try.c
6896 set try
6897 if eval $compile; then
6898         val="$define"
6899         echo "You have long double."
6900 else
6901         val="$undef"
6902         echo "You do not have long double."
6903 fi
6904 $rm_try
6905 set d_longdbl
6906 eval $setvar
6907
6908 : see if ldexpl exists
6909 set ldexpl d_ldexpl
6910 eval $inlibc
6911
6912 : check for length of long double
6913 case "${d_longdbl}${longdblsize}" in
6914 $define)
6915         echo " "
6916         echo "Checking to see how big your long doubles are..." >&4
6917         $cat >try.c <<'EOCP'
6918 #include <stdio.h>
6919 int main()
6920 {
6921         printf("%d\n", sizeof(long double));
6922 }
6923 EOCP
6924         set try
6925         set try
6926         if eval $compile; then
6927                 longdblsize=`$run ./try`
6928                 echo "Your long doubles are $longdblsize bytes long."
6929         else
6930                 dflt='8'
6931                 echo " "
6932                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6933                 rp="What is the size of a long double (in bytes)?"
6934                 . ./myread
6935                 longdblsize="$ans"
6936         fi
6937         if $test "X$doublesize" = "X$longdblsize"; then
6938                 echo "That isn't any different from an ordinary double."
6939                 echo "I'll keep your setting anyway, but you may see some"
6940                 echo "harmless compilation warnings."
6941         fi
6942         ;;
6943 esac
6944 $rm_try
6945
6946 $echo "Checking the kind of long doubles you have..." >&4
6947 case "$d_longdbl" in
6948 define)
6949 $cat <<EOP >try.c
6950 #$i_stdlib I_STDLIB
6951 #define LONGDBLSIZE $longdblsize
6952 #define DOUBLESIZE $doublesize
6953 #include <float.h>
6954 #ifdef I_STDLIB
6955 #include <stdlib.h>
6956 #endif
6957 #include <stdio.h>
6958 static const long double d = -0.1L;
6959 int main() {
6960   unsigned const char* b = (unsigned const char*)(&d);
6961 #if DOUBLESIZE == LONGDBLSIZE
6962   printf("0\n"); /* if it floats like double */
6963   exit(0);
6964 #endif
6965 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6966   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6967     /* IEEE 754 128-bit little-endian */
6968     printf("1\n");
6969     exit(0);
6970   }
6971   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6972     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6973     printf("2\n");
6974     exit(0);
6975   }
6976 #endif
6977 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6978  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6979  * cannot be trusted. */
6980 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6981   if (b[0] == 0xCD && b[9] == 0xBF) {
6982     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6983      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6984      * Also known as "extended precision". */
6985     printf("3\n");
6986     exit(0);
6987   }
6988   if (b[0] == 0xBF && b[9] == 0xCD) {
6989     /* Is there ever big-endian 80-bit, really?
6990      *
6991      * The Motorola 68881 had another "extended precision" format:
6992      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6993      * for total of 96 bits of bytes.  The zero bits were unused.
6994      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
6995      * If it ever becomes relevant, this format should be allocated
6996      * a new doublekind code since it's quite different from the Intel x87.
6997      */
6998     printf("4\n");
6999     exit(0);
7000   }
7001 #endif
7002 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7003   /* software "double double", the 106 is 53+53.
7004    * but irix thinks it is 107. */
7005   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7006     /* double double 128-bit fully little-endian,
7007      * little-endian doubles in little-endian order,
7008      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7009     printf("5\n");
7010     exit(0);
7011   }
7012   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7013     /* double double 128-bit fully big-endian,
7014      * big-endian doubles in big-endian order,
7015      * e.g. PPC/Power and MIPS:
7016      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7017     printf("6\n");
7018     exit(0);
7019   }
7020   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7021     /* double double 128-bit mixed endian.
7022      * little-endian doubles in big-endian order,
7023      * e.g. ppc64el,
7024      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7025     printf("7\n");
7026     exit(0);
7027   }
7028   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7029     /* double double 128-bit mixed endian,
7030      * big-endian doubles in little-endian order,
7031      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7032     printf("8\n");
7033     exit(0);
7034   }
7035 #endif
7036 /* We are largely making this up because it may well be
7037  * that the VAX format H was never made available to C,
7038  * only to Fortran. */
7039 #if LONGDBLSIZE == 16 && defined(__vax__)
7040   if (b[0] == 0xFD && b[15] == 0x99) {
7041     /* VAX format H, PDP-11 mixed endian. */
7042     printf("9\n");
7043     exit(0);
7044   }
7045 #endif
7046   printf("-1\n"); /* unknown */
7047   exit(0);
7048 }
7049 EOP
7050 set try
7051 if eval $compile; then
7052     longdblkind=`$run ./try`
7053 else
7054     longdblkind=-1
7055 fi
7056 ;;
7057 *) longdblkind=0 ;;
7058 esac
7059 case "$longdblkind" in
7060 0) echo "Your long doubles are doubles." >&4 ;;
7061 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7062 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7063 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7064 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7065 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7066 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7067 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7068 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7069 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7070 *) echo "Cannot figure out your long double." >&4 ;;
7071 esac
7072 d_long_double_style_ieee=$undef
7073 d_long_double_style_ieee_std=$undef
7074 d_long_double_style_ieee_extended=$undef
7075 d_long_double_style_ieee_doubledouble=$undef
7076 d_long_double_style_vax=$undef
7077 case "$longdblkind" in
7078 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7079 esac
7080 case "$longdblkind" in
7081 1|2) d_long_double_style_ieee_std=$define ;;
7082 esac
7083 case "$longdblkind" in
7084 3|4) d_long_double_style_ieee_extended=$define ;;
7085 esac
7086 case "$longdblkind" in
7087 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7088 esac
7089 case "$longdblkind" in
7090 9) d_long_double_style_vax=$define ;;
7091 esac
7092 $rm_try
7093
7094 : determine the architecture name
7095 echo " "
7096 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7097         tarch=`arch`"-$osname"
7098 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7099         if uname -m > tmparch 2>&1 ; then
7100                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7101                         -e 's/$/'"-$osname/" tmparch`
7102         else
7103                 tarch="$osname"
7104         fi
7105         $rm -f tmparch
7106 else
7107         tarch="$osname"
7108 fi
7109 case "$myarchname" in
7110 ''|"$tarch") ;;
7111 *)
7112         echo "(Your architecture name used to be $myarchname.)"
7113         archname=''
7114         ;;
7115 esac
7116 case "$targetarch" in
7117 '') ;;
7118 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7119 esac
7120 myarchname="$tarch"
7121 case "$archname" in
7122 '') dflt="$tarch";;
7123 *) dflt="$archname";;
7124 esac
7125 rp='What is your architecture name'
7126 . ./myread
7127 archname="$ans"
7128
7129 : optionally add API version to the architecture for versioned archlibs
7130 case "$useversionedarchname" in
7131 $define|true|[yY]*) dflt='y';;
7132 *)                  dflt='n';;
7133 esac
7134 rp='Add the Perl API version to your archname?'
7135 . ./myread
7136 case "$ans" in
7137 y|Y)    useversionedarchname="$define" ;;
7138 *)      useversionedarchname="$undef" ;;
7139 esac
7140 case "$useversionedarchname" in
7141 $define)
7142         case "$archname" in
7143         *-$api_versionstring)
7144                 echo "...and architecture name already has -$api_versionstring" >&4
7145                 ;;
7146         *)
7147                 archname="$archname-$api_versionstring"
7148                 echo "...setting architecture name to $archname." >&4
7149                 ;;
7150         esac
7151         ;;
7152 esac
7153
7154 case "$usethreads" in
7155 $define)
7156         echo "Threads selected." >&4
7157         case "$archname" in
7158         *-thread*) echo "...and architecture name already has -thread." >&4
7159                 ;;
7160         *)      archname="$archname-thread"
7161                 echo "...setting architecture name to $archname." >&4
7162                 ;;
7163         esac
7164         ;;
7165 esac
7166 case "$usemultiplicity" in
7167 $define)
7168         echo "Multiplicity selected." >&4
7169         case "$archname" in
7170         *-multi*) echo "...and architecture name already has -multi." >&4
7171                 ;;
7172         *)      archname="$archname-multi"
7173                 echo "...setting architecture name to $archname." >&4
7174                 ;;
7175         esac
7176         ;;
7177 esac
7178 case "$use64bitint$use64bitall" in
7179 *"$define"*)
7180         case "$archname64" in
7181         '')
7182                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7183                 ;;
7184         *)
7185                 case "$use64bitint" in
7186                 "$define") echo "64 bit integers selected." >&4 ;;
7187                 esac
7188                 case "$use64bitall" in
7189                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7190                 esac
7191                 case "$archname" in
7192                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7193                         ;;
7194                 *)      archname="$archname-$archname64"
7195                         echo "...setting architecture name to $archname." >&4
7196                         ;;
7197                 esac
7198                 ;;
7199         esac
7200 esac
7201 case "$uselongdouble" in
7202 $define)
7203         echo "Long doubles selected." >&4
7204         case "$longdblsize" in
7205         $doublesize)
7206                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7207                 ;;
7208         *)
7209                 case "$archname" in
7210                 *-ld*) echo "...and architecture name already has -ld." >&4
7211                         ;;
7212                 *)      archname="$archname-ld"
7213                         echo "...setting architecture name to $archname." >&4
7214                         ;;
7215                 esac
7216                 ;;
7217         esac
7218         ;;
7219 esac
7220 case "$usequadmath" in
7221 $define)
7222         echo "quadmath selected." >&4
7223         case "$archname" in
7224         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7225                 ;;
7226         *)      archname="$archname-quadmath"
7227                 echo "...setting architecture name to $archname." >&4
7228                 ;;
7229         esac
7230         ;;
7231 esac
7232 if $test -f archname.cbu; then
7233         echo "Your platform has some specific hints for architecture name, using them..."
7234         . ./archname.cbu
7235 fi
7236
7237 : set the prefixit variable, to compute a suitable default value
7238 prefixit='case "$3" in
7239 ""|none)
7240         case "$oldprefix" in
7241         "") eval "$1=\"\$$2\"";;
7242         *)
7243                 case "$3" in
7244                 "") eval "$1=";;
7245                 none)
7246                         eval "tp=\"\$$2\"";
7247                         case "$tp" in
7248                         ""|" ") eval "$1=\"\$$2\"";;
7249                         *) eval "$1=";;
7250                         esac;;
7251                 esac;;
7252         esac;;
7253 *)
7254         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7255         case "$tp" in
7256         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7257         /*-$oldprefix/*|\~*-$oldprefix/*)
7258                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7259         *) eval "$1=\"\$$2\"";;
7260         esac;;
7261 esac'
7262
7263 : determine installation style
7264 : For now, try to deduce it from prefix unless it is already set.
7265 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7266 case "$installstyle" in
7267 '')     case "$prefix" in
7268                 *perl*) dflt='lib';;
7269                 *) dflt='lib/perl5' ;;
7270         esac
7271         ;;
7272 *)      dflt="$installstyle" ;;
7273 esac
7274 : Probably not worth prompting for this since we prompt for all
7275 : the directories individually, and the prompt would be too long and
7276 : confusing anyway.
7277 installstyle=$dflt
7278
7279 : determine where public executables go
7280 echo " "
7281 set dflt bin bin
7282 eval $prefixit
7283 fn=d~
7284 rp='Pathname where the public executables will reside?'
7285 . ./getfile
7286 if $test "X$ansexp" != "X$binexp"; then
7287         installbin=''
7288 fi
7289 prefixvar=bin
7290 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7291 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7292 :     this via initialinstalllocation
7293 . ./setprefixvar
7294
7295 case "$userelocatableinc" in
7296 $define|true|[yY]*)     dflt='y' ;;
7297 *)                      dflt='n' ;;
7298 esac
7299 cat <<EOM
7300
7301 Would you like to build Perl so that the installation is relocatable, so that
7302 library paths in @INC are determined relative to the path of the perl binary?
7303 This is not advised for system Perl installs, or if you need to run setid
7304 scripts or scripts under taint mode.
7305
7306 If this doesn't make any sense to you, just accept the default '$dflt'.
7307 EOM
7308 rp='Use relocatable @INC?'
7309 . ./myread
7310 case "$ans" in
7311 y|Y)    val="$define" ;;
7312 *)      val="$undef"  ;;
7313 esac
7314 set userelocatableinc
7315 eval $setvar
7316
7317 initialinstalllocation="$binexp"
7318 : Default prefix is now "up one level from where the binaries are"
7319 case "$userelocatableinc" in
7320 $define|true|[yY]*)
7321     bin=".../"
7322     binexp=".../"
7323     prefix=".../.."
7324     prefixexp=".../.."
7325     installprefixexp=".../.."
7326     ;;
7327 esac
7328
7329 : determine where private library files go
7330 : Usual default is /usr/local/lib/perl5/$version.
7331 : Also allow things like /opt/perl/lib/$version, since
7332 : /opt/perl/lib/perl5... would be redundant.
7333 : The default "style" setting is made in installstyle.U
7334 case "$installstyle" in
7335 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7336 *)       set dflt privlib lib/$version ;;
7337 esac
7338 eval $prefixit
7339 $cat <<EOM
7340
7341 There are some auxiliary files for $package that need to be put into a
7342 private library directory that is accessible by everyone.
7343
7344 EOM
7345 fn=$binexp
7346 fn=d~+
7347 rp='Pathname where the private library files will reside?'
7348 . ./getfile
7349 prefixvar=privlib
7350 . ./setprefixvar
7351
7352 : set the prefixup variable, to restore leading tilda escape
7353 prefixup='case "$prefixexp" in
7354 "$prefix") ;;
7355 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7356 esac'
7357
7358 : determine where public architecture dependent libraries go
7359 set archlib archlib
7360 eval $prefixit
7361 : privlib default is /usr/local/lib/$package/$version
7362 : archlib default is /usr/local/lib/$package/$version/$archname
7363 : privlib may have an optional trailing /share.
7364 tdflt=`echo $privlib | $sed 's,/share$,,'`
7365 tdflt=$tdflt/$archname
7366 case "$archlib" in
7367 '')     dflt=$tdflt
7368         ;;
7369 *)      dflt="$archlib"
7370     ;;
7371 esac
7372 $cat <<EOM
7373
7374 $spackage contains architecture-dependent library files.  If you are
7375 sharing libraries in a heterogeneous environment, you might store
7376 these files in a separate location.  Otherwise, you can just include
7377 them with the rest of the public library files.
7378
7379 EOM
7380 fn=$binexp
7381 fn=d+~
7382 rp='Where do you want to put the public architecture-dependent libraries?'
7383 . ./getfile
7384 prefixvar=archlib
7385 . ./setprefixvar
7386 if $test X"$archlib" = X"$privlib"; then
7387         d_archlib="$undef"
7388 else
7389         d_archlib="$define"
7390 fi
7391
7392 : see if setuid scripts can be secure
7393 $cat <<EOM
7394
7395 Some kernels have a bug that prevents setuid #! scripts from being
7396 secure.  Some sites have disabled setuid #! scripts because of this.
7397
7398 First let's decide if your kernel supports secure setuid #! scripts.
7399 (If setuid #! scripts would be secure but have been disabled anyway,
7400 don't say that they are secure if asked.)
7401
7402 EOM
7403
7404 val="$undef"
7405 if $test -d /dev/fd; then
7406         echo "#!$ls" >reflect
7407         chmod +x,u+s reflect
7408         ./reflect >flect 2>&1
7409         if $contains "/dev/fd" flect >/dev/null; then
7410                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7411                 val="$define"
7412         else
7413                 $cat <<EOM
7414 If you are not sure if they are secure, I can check but I'll need a
7415 username and password different from the one you are using right now.
7416 If you don't have such a username or don't want me to test, simply
7417 enter 'none'.
7418
7419 EOM
7420                 rp='Other username to test security of setuid scripts with?'
7421                 dflt='none'
7422                 . ./myread
7423                 case "$ans" in
7424                 n|none)
7425                         case "$d_suidsafe" in
7426                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7427                                 dflt=n;;
7428                         "$undef")
7429                                 echo "Well, the $hint value is *not* secure." >&4
7430                                 dflt=n;;
7431                         *)      echo "Well, the $hint value *is* secure." >&4
7432                                 dflt=y;;
7433                         esac
7434                         ;;
7435                 *)
7436                         $rm -f reflect flect
7437                         echo "#!$ls" >reflect
7438                         chmod +x,u+s reflect
7439                         echo >flect
7440                         chmod a+w flect
7441                         echo '"su" will (probably) prompt you for '"$ans's password."
7442                         su $ans -c './reflect >flect'
7443                         if $contains "/dev/fd" flect >/dev/null; then
7444                                 echo "Okay, it looks like setuid scripts are secure." >&4
7445                                 dflt=y
7446                         else
7447                                 echo "I don't think setuid scripts are secure." >&4
7448                                 dflt=n
7449                         fi
7450                         ;;
7451                 esac
7452                 rp='Does your kernel have *secure* setuid scripts?'
7453                 . ./myread
7454                 case "$ans" in
7455                 [yY]*)  val="$define";;
7456                 *)      val="$undef";;
7457                 esac
7458         fi
7459 else
7460         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7461         echo "(That's for file descriptors, not floppy disks.)"
7462         val="$undef"
7463 fi
7464 set d_suidsafe
7465 eval $setvar
7466
7467 $rm -f reflect flect
7468
7469 : now see if they want to do setuid emulation
7470 if $test $patchlevel -lt 11; then
7471 echo " "
7472 val="$undef"
7473 case "$d_suidsafe" in
7474 "$define")
7475         val="$undef"
7476         echo "No need to emulate SUID scripts since they are secure here." >&4
7477         ;;
7478 *)
7479         $cat <<EOM
7480 Some systems have disabled setuid scripts, especially systems where
7481 setuid scripts cannot be secure.  On systems where setuid scripts have
7482 been disabled, the setuid/setgid bits on scripts are currently
7483 useless.  It is possible for $package to detect those bits and emulate
7484 setuid/setgid in a secure fashion.  This emulation will only work if
7485 setuid scripts have been disabled in your kernel.
7486
7487 EOM
7488         case "$d_dosuid" in
7489         "$define") dflt=y ;;
7490         *) dflt=n ;;
7491         esac
7492         rp="Do you want to do setuid/setgid emulation?"
7493         . ./myread
7494         case "$ans" in
7495         [yY]*)  val="$define";;
7496         *)      val="$undef";;
7497         esac
7498         ;;
7499 esac
7500 set d_dosuid
7501 eval $setvar
7502 else
7503     case "$d_dosuid" in
7504         "$define")
7505         cat >&4 <<EOH
7506
7507 SUID emulation has been removed for 5.12
7508 Please re-run Configure without -Dd_dosuid
7509
7510 EOH
7511         exit 1;
7512         ;;
7513     esac
7514     d_dosuid=undef
7515 fi
7516
7517 : Find perl5.005 or later.
7518 echo "Looking for a previously installed perl5.005 or later... "
7519 case "$perl5" in
7520 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7521                 : Check if this perl is recent and can load a simple module
7522                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7523                         perl5=$tdir/perl
7524                         break;
7525                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7526                         perl5=$tdir/perl5
7527                         break;
7528                 fi
7529         done
7530         ;;
7531 *)      perl5="$perl5"
7532         ;;
7533 esac
7534 case "$perl5" in
7535 '')     echo "None found.  That's ok.";;
7536 *)      echo "Using $perl5." ;;
7537 esac
7538
7539 : Set the siteprefix variables
7540 $cat <<EOM
7541
7542 After $package is installed, you may wish to install various
7543 add-on modules and utilities.  Typically, these add-ons will
7544 be installed under $prefix with the rest
7545 of this package.  However, you may wish to install such add-ons
7546 elsewhere under a different prefix.
7547
7548 If you do not wish to put everything under a single prefix, that's
7549 ok.  You will be prompted for the individual locations; this siteprefix
7550 is only used to suggest the defaults.
7551
7552 The default should be fine for most people.
7553
7554 EOM
7555 fn=d~+
7556 rp='Installation prefix to use for add-on modules and utilities?'
7557 : XXX Here might be another good place for an installstyle setting.
7558 case "$siteprefix" in
7559 '') dflt=$prefix ;;
7560 *)  dflt=$siteprefix ;;
7561 esac
7562 . ./getfile
7563 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7564 oldsiteprefix=''
7565 case "$siteprefix" in
7566 '') ;;
7567 *)      case "$ans" in
7568         "$prefix") ;;
7569         *) oldsiteprefix="$prefix";;
7570         esac
7571         ;;
7572 esac
7573 siteprefix="$ans"
7574 siteprefixexp="$ansexp"
7575
7576 : determine where site specific libraries go.
7577 : Usual default is /usr/local/lib/perl5/site_perl/$version
7578 : The default "style" setting is made in installstyle.U
7579 : XXX No longer works with Prefixit stuff.
7580 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7581 case "$sitelib" in
7582 '') case "$installstyle" in
7583         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7584         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7585         esac
7586         ;;
7587 *)      dflt="$sitelib"
7588         ;;
7589 esac
7590 $cat <<EOM
7591
7592 The installation process will create a directory for
7593 site-specific extensions and modules.  Most users find it convenient
7594 to place all site-specific files in this directory rather than in the
7595 main distribution directory.
7596
7597 EOM
7598 fn=d~+
7599 rp='Pathname for the site-specific library files?'
7600 . ./getfile
7601 prefixvar=sitelib
7602 . ./setprefixvar
7603 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7604
7605 : Determine list of previous versions to include in @INC
7606 $cat > getverlist <<EOPL
7607 #!$perl5 -w
7608 use File::Basename;
7609 \$api_versionstring = "$api_versionstring";
7610 \$version = "$version";
7611 \$stem = "$sitelib_stem";
7612 \$archname = "$archname";
7613 EOPL
7614         $cat >> getverlist <<'EOPL'
7615 # The list found is store twice for each entry: the original name, and
7616 # the binary broken down version as pack "sss", so sorting is easy and
7617 # unambiguous. This will work for all versions that have a maximum of
7618 # three digit groups, separate by '.'s or '_'s. Names are extended with
7619 # ".0.0" to ensure at least three elements for the pack.
7620 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7621
7622 # Can't have leading @ because metaconfig interprets it as a command!
7623 ;@inc_version_list=();
7624 # XXX Redo to do opendir/readdir?
7625 if (-d $stem) {
7626     chdir($stem);
7627     ;@candidates = map {
7628         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7629     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7630 }
7631 else {
7632     ;@candidates = ();
7633 }
7634
7635 ($pversion, $aversion, $vsn5005) = map {
7636     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7637 foreach $d (@candidates) {
7638     if ($d->[1] lt $pversion) {
7639         if ($d->[1] ge $aversion) {
7640             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7641         }
7642         elsif ($d->[1] ge $vsn5005) {
7643             unshift(@inc_version_list, grep { -d } $d->[0]);
7644         }
7645     }
7646     else {
7647         # Skip newer version.  I.e. don't look in
7648         # 5.7.0 if we're installing 5.6.1.
7649     }
7650 }
7651
7652 if (@inc_version_list) {
7653     print join(' ', @inc_version_list);
7654 }
7655 else {
7656     # Blank space to preserve value for next Configure run.
7657     print " ";
7658 }
7659 EOPL
7660 chmod +x getverlist
7661 case "$inc_version_list" in
7662 '')     if test -x "$perl5$exe_ext"; then
7663                 dflt=`$perl5 getverlist`
7664         else
7665                 dflt='none'
7666         fi
7667         ;;
7668 $undef) dflt='none' ;;
7669 *)  eval dflt=\"$inc_version_list\" ;;
7670 esac
7671 case "$dflt" in
7672 ''|' ') dflt=none ;;
7673 esac
7674 case "$dflt" in
7675 5.005) dflt=none ;;
7676 esac
7677 $cat <<EOM
7678
7679 In order to ease the process of upgrading, this version of perl
7680 can be configured to use modules built and installed with earlier
7681 versions of perl that were installed under $prefix.  Specify here
7682 the list of earlier versions that this version of perl should check.
7683 If Configure detected no earlier versions of perl installed under
7684 $prefix, then the list will be empty.  Answer 'none' to tell perl
7685 to not search earlier versions.
7686
7687 The default should almost always be sensible, so if you're not sure,
7688 just accept the default.
7689 EOM
7690
7691 rp='List of earlier versions to include in @INC?'
7692 . ./myread
7693 case "$ans" in
7694 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7695 *) inc_version_list="$ans" ;;
7696 esac
7697 case "$inc_version_list" in
7698 ''|' ')
7699         inc_version_list_init='0'
7700         d_inc_version_list="$undef"
7701         ;;
7702 *)      inc_version_list_init=`echo $inc_version_list |
7703                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7704         d_inc_version_list="$define"
7705         ;;
7706 esac
7707 $rm -f getverlist
7708
7709 : see if malloc/malloc.h has to be included
7710 set malloc/malloc.h i_mallocmalloc
7711 eval $inhdr
7712
7713 : see if this is a malloc.h system
7714 : we want a real compile instead of Inhdr because some systems have a
7715 : malloc.h that just gives a compile error saying to use stdlib.h instead
7716 echo " "
7717 $cat >try.c <<EOCP
7718 #include <stdlib.h>
7719 #include <malloc.h>
7720 #$i_mallocmalloc I_MALLOCMALLOC
7721 #ifdef I_MALLOCMALLOC
7722 # include <malloc/malloc.h>
7723 #endif
7724
7725 int main () { return 0; }
7726 EOCP
7727 set try
7728 if eval $compile; then
7729     echo "<malloc.h> found." >&4
7730     val="$define"
7731 else
7732     echo "<malloc.h> NOT found." >&4
7733     val="$undef"
7734 fi
7735 $rm_try
7736 set i_malloc
7737 eval $setvar
7738
7739 : check for length of pointer
7740 echo " "
7741 case "$ptrsize" in
7742 '')
7743         echo "Checking to see how big your pointers are..." >&4
7744         $cat >try.c <<EOCP
7745 #include <stdio.h>
7746 #$i_stdlib I_STDLIB
7747 #ifdef I_STDLIB
7748 #include <stdlib.h>
7749 #endif
7750 int main()
7751 {
7752     printf("%d\n", (int)sizeof(void *));
7753     exit(0);
7754 }
7755 EOCP
7756         set try
7757         if eval $compile_ok; then
7758                 ptrsize=`$run ./try`
7759                 echo "Your pointers are $ptrsize bytes long."
7760         else
7761                 dflt='4'
7762                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7763                 rp="What is the size of a pointer (in bytes)?"
7764                 . ./myread
7765                 ptrsize="$ans"
7766         fi
7767         ;;
7768 esac
7769 $rm_try
7770 case "$use64bitall" in
7771 "$define"|true|[yY]*)
7772         case "$ptrsize" in
7773         4)      cat <<EOM >&4
7774
7775 *** You have chosen a maximally 64-bit build,
7776 *** but your pointers are only 4 bytes wide.
7777 *** Please rerun Configure without -Duse64bitall.
7778 EOM
7779                 case "$d_quad" in
7780                 define)
7781                         cat <<EOM >&4
7782 *** Since you have quads, you could possibly try with -Duse64bitint.
7783 EOM
7784                         ;;
7785                 esac
7786                 cat <<EOM >&4
7787 *** Cannot continue, aborting.
7788
7789 EOM
7790
7791                 exit 1
7792                 ;;
7793         esac
7794         ;;
7795 esac
7796
7797
7798 : determine whether to use malloc wrapping
7799 echo " "
7800 case "$usemallocwrap" in
7801 [yY]*|true|$define)     dflt='y' ;;
7802 [nN]*|false|$undef)     dflt='n' ;;
7803 *)      case "$usedevel" in
7804         [yY]*|true|$define)     dflt='y' ;;
7805         *) dflt='n' ;;
7806         esac
7807         ;;
7808 esac
7809 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7810 . ./myread
7811 usemallocwrap="$ans"
7812 case "$ans" in
7813 y*|true)
7814         usemallocwrap="$define" ;;
7815 *)
7816         usemallocwrap="$undef" ;;
7817 esac
7818
7819 : determine which malloc to compile in
7820 echo " "
7821 case "$usemymalloc" in
7822 [yY]*|true|$define)     dflt='y' ;;
7823 [nN]*|false|$undef)     dflt='n' ;;
7824 *)      case "$ptrsize" in
7825         4) dflt='y' ;;
7826         *) dflt='n' ;;
7827         esac
7828         if test "$useithreads" = "$define"; then dflt='n'; fi
7829         ;;
7830 esac
7831 rp="Do you wish to attempt to use the malloc that comes with $package?"
7832 . ./myread
7833 usemymalloc="$ans"
7834 case "$ans" in
7835 y*|true)
7836         usemymalloc='y'
7837         mallocsrc='malloc.c'
7838         mallocobj="malloc$_o"
7839         d_mymalloc="$define"
7840         case "$libs" in
7841         *-lmalloc*)
7842                 : Remove malloc from list of libraries to use
7843                 echo "Removing unneeded -lmalloc from library list" >&4
7844                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7845                 shift
7846                 libs="$*"
7847                 echo "libs = $libs" >&4
7848                 ;;
7849         esac
7850         ;;
7851 *)
7852         usemymalloc='n'
7853         mallocsrc=''
7854         mallocobj=''
7855         d_mymalloc="$undef"
7856         ;;
7857 esac
7858
7859 : compute the return types of malloc and free
7860 echo " "
7861 $cat >malloc.c <<END
7862 #$i_malloc I_MALLOC
7863 #$i_stdlib I_STDLIB
7864 #include <stdio.h>
7865 #include <sys/types.h>
7866 #ifdef I_MALLOC
7867 #include <malloc.h>
7868 #endif
7869 #ifdef I_STDLIB
7870 #include <stdlib.h>
7871 #endif
7872 #ifdef TRY_MALLOC
7873 void *malloc();
7874 #endif
7875 #ifdef TRY_FREE
7876 void free();
7877 #endif
7878 END
7879 case "$malloctype" in
7880 '')
7881         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7882                 malloctype='void *'
7883         else
7884                 malloctype='char *'
7885         fi
7886         ;;
7887 esac
7888 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7889
7890 case "$freetype" in
7891 '')
7892         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7893                 freetype='void'
7894         else
7895                 freetype='int'
7896         fi
7897         ;;
7898 esac
7899 echo "Your system uses $freetype free(), it would seem." >&4
7900 $rm -f malloc.[co]
7901 : determine where site specific architecture-dependent libraries go.
7902 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7903 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7904 : sitelib may have an optional trailing /share.
7905 case "$sitearch" in
7906 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7907         dflt="$dflt/$archname"
7908         ;;
7909 *)      dflt="$sitearch"
7910         ;;
7911 esac
7912 set sitearch sitearch none
7913 eval $prefixit
7914 $cat <<EOM
7915
7916 The installation process will also create a directory for
7917 architecture-dependent site-specific extensions and modules.
7918
7919 EOM
7920 fn=d~+
7921 rp='Pathname for the site-specific architecture-dependent library files?'
7922 . ./getfile
7923 prefixvar=sitearch
7924 . ./setprefixvar
7925 if $test X"$sitearch" = X"$sitelib"; then
7926         d_sitearch="$undef"
7927 else
7928         d_sitearch="$define"
7929 fi
7930
7931 : Set the vendorprefix variables
7932 $cat <<EOM
7933
7934 The installation process will also create a directory for
7935 vendor-supplied add-ons.  Vendors who supply perl with their system
7936 may find it convenient to place all vendor-supplied files in this
7937 directory rather than in the main distribution directory.  This will
7938 ease upgrades between binary-compatible maintenance versions of perl.
7939
7940 Of course you may also use these directories in whatever way you see
7941 fit.  For example, you might use them to access modules shared over a
7942 company-wide network.
7943
7944 The default answer should be fine for most people.
7945 This causes further questions about vendor add-ons to be skipped
7946 and no vendor-specific directories will be configured for perl.
7947
7948 EOM
7949 rp='Do you want to configure vendor-specific add-on directories?'
7950 case "$usevendorprefix" in
7951 define|true|[yY]*) dflt=y ;;
7952 *)      : User may have set vendorprefix directly on Configure command line.
7953         case "$vendorprefix" in
7954         ''|' ') dflt=n ;;
7955         *)      dflt=y ;;
7956         esac
7957         ;;
7958 esac
7959 . ./myread
7960 case "$ans" in
7961 [yY]*)  fn=d~+
7962         rp='Installation prefix to use for vendor-supplied add-ons?'
7963         case "$vendorprefix" in
7964         '') dflt="$prefix" ;;
7965         *)  dflt=$vendorprefix ;;
7966         esac
7967         . ./getfile
7968         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7969         oldvendorprefix=''
7970         case "$vendorprefix" in
7971         '') ;;
7972         *)      case "$ans" in
7973                 "$prefix") ;;
7974                 *) oldvendorprefix="$prefix";;
7975                 esac
7976                 ;;
7977         esac
7978         usevendorprefix="$define"
7979         vendorprefix="$ans"
7980         vendorprefixexp="$ansexp"
7981         ;;
7982 *)      usevendorprefix="$undef"
7983         vendorprefix=''
7984         vendorprefixexp=''
7985         ;;
7986 esac
7987
7988 : Set the vendorlib variables
7989 case "$vendorprefix" in
7990 '')     d_vendorlib="$undef"
7991         vendorlib=''
7992         vendorlibexp=''
7993         ;;
7994 *)      d_vendorlib="$define"
7995         : determine where vendor-supplied modules go.
7996         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7997         case "$vendorlib" in
7998         '')
7999                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8000                 case "$installstyle" in
8001                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8002                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8003                 esac
8004                 ;;
8005         *)      dflt="$vendorlib"
8006                 ;;
8007         esac
8008         fn=d~+
8009         rp='Pathname for the vendor-supplied library files?'
8010         . ./getfile
8011         vendorlib="$ans"
8012         vendorlibexp="$ansexp"
8013         ;;
8014 esac
8015 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8016 prefixvar=vendorlib
8017 . ./installprefix
8018
8019 : Set the vendorarch variables
8020 case "$vendorprefix" in
8021 '')     d_vendorarch="$undef"
8022         vendorarch=''
8023         vendorarchexp=''
8024         ;;
8025 *)      d_vendorarch="$define"
8026         : determine where vendor-supplied architecture-dependent libraries go.
8027         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8028         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8029         : vendorlib may have an optional trailing /share.
8030         case "$vendorarch" in
8031         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8032                 dflt="$dflt/$archname"
8033                 ;;
8034         *)      dflt="$vendorarch" ;;
8035         esac
8036         fn=d~+
8037         rp='Pathname for vendor-supplied architecture-dependent files?'
8038         . ./getfile
8039         vendorarch="$ans"
8040         vendorarchexp="$ansexp"
8041         ;;
8042 esac
8043 prefixvar=vendorarch
8044 . ./installprefix
8045 if $test X"$vendorarch" = X"$vendorlib"; then
8046         d_vendorarch="$undef"
8047 else
8048         d_vendorarch="$define"
8049 fi
8050
8051 : Final catch-all directories to search
8052 $cat <<EOM
8053
8054 Lastly, you can have perl look in other directories for extensions and
8055 modules in addition to those already specified.
8056 These directories will be searched after
8057         $sitearch
8058         $sitelib
8059 EOM
8060 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8061 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8062 echo ' '
8063 case "$otherlibdirs" in
8064 ''|' ') dflt='none' ;;
8065 *)      dflt="$otherlibdirs" ;;
8066 esac
8067 $cat <<EOM
8068 Enter a colon-separated set of extra paths to include in perl's @INC
8069 search path, or enter 'none' for no extra paths.
8070
8071 EOM
8072
8073 rp='Colon-separated list of additional directories for perl to search?'
8074 . ./myread
8075 case "$ans" in
8076 ' '|''|none)    otherlibdirs=' ' ;;
8077 *)      otherlibdirs="$ans" ;;
8078 esac
8079 case "$otherlibdirs" in
8080 ' ') val=$undef ;;
8081 *)      val=$define ;;
8082 esac
8083 set d_perl_otherlibdirs
8084 eval $setvar
8085
8086 : DTrace support
8087 dflt_dtrace='/usr/sbin/dtrace'
8088 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8089
8090 cat <<EOM
8091
8092 Perl can be built to support DTrace on platforms that support it.
8093 DTrace is a diagnosis and performance analysis tool from Sun.
8094
8095 If this doesn't make any sense to you, just accept the default.
8096 EOM
8097
8098 while $test 1 ; do
8099         case "$usedtrace" in
8100         $define|true|[yY]*)
8101                 dflt='y'
8102                 ;;
8103         ?*)
8104                 dflt='y'
8105                 dflt_dtrace=$usedtrace
8106                 ;;
8107         *)
8108                 dflt='n'
8109                 ;;
8110         esac
8111
8112         rp='Support DTrace if available?'
8113         . ./myread
8114         case "$ans" in
8115         y|Y)    val="$define" ;;
8116         *)      val="$undef" ;;
8117         esac
8118         set usedtrace
8119         eval $setvar
8120
8121         test "X$usedtrace" != "X$define" && break
8122
8123         echo " "
8124         rp='Where is the dtrace executable?'
8125         dflt=$dflt_dtrace
8126         . ./getfile
8127         val="$ans"
8128         set dtrace
8129         eval $setvar
8130
8131         if $test -f $dtrace
8132         then
8133                 if $dtrace -h -s ../perldtrace.d \
8134                         -o perldtrace.tmp >/dev/null 2>&1 \
8135                         && rm -f perldtrace.tmp
8136                 then
8137                         echo " "
8138                         echo "Good: your $dtrace knows about the -h flag."
8139                 else
8140                         cat >&2 <<EOM
8141
8142 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8143 ***
8144 *** Your installed dtrace doesn't support the -h switch to compile a D
8145 *** program into a C header. Can't continue.
8146
8147 EOM
8148                         exit 1
8149                 fi
8150                 break;
8151         fi
8152
8153         case "$fastread" in
8154         yes)
8155                 cat >&2 <<EOM
8156
8157 *** $me:  Fatal Error:  $dtrace not found.
8158 *** Can't continue.
8159
8160 EOM
8161                 exit 1
8162                 ;;
8163         *)
8164                 echo "*** $dtrace was not found."
8165                 echo " "
8166                 ;;
8167         esac
8168 done
8169
8170 : See if we want extra modules installed
8171 echo " "
8172 case "$extras" in
8173 '') dflt='n';;
8174 *) dflt='y';;
8175 esac
8176 cat <<EOM
8177 Perl can be built with extra modules or bundles of modules which
8178 will be fetched from the CPAN and installed alongside Perl.
8179
8180 Notice that you will need access to the CPAN; either via the Internet,
8181 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8182 be asked later to configure the CPAN.pm module which will in turn do
8183 the installation of the rest of the extra modules or bundles.)
8184
8185 Notice also that if the modules require any external software such as
8186 libraries and headers (the libz library and the zlib.h header for the
8187 Compress::Zlib module, for example) you MUST have any such software
8188 already installed, this configuration process will NOT install such
8189 things for you.
8190
8191 If this doesn't make any sense to you, just accept the default '$dflt'.
8192 EOM
8193 rp='Install any extra modules (y or n)?'
8194 . ./myread
8195 case "$ans" in
8196 y|Y)
8197         cat <<EOM
8198
8199 Please list any extra modules or bundles to be installed from CPAN,
8200 with spaces between the names.  The names can be in any format the
8201 'install' command of CPAN.pm will understand.  (Answer 'none',
8202 without the quotes, to install no extra modules or bundles.)
8203 EOM
8204         rp='Extras?'
8205         dflt="$extras"
8206         . ./myread
8207         extras="$ans"
8208 esac
8209 case "$extras" in
8210 ''|'none')
8211         val=''
8212         $rm -f ../extras.lst
8213         ;;
8214 *)      echo "(Saving the list of extras for later...)"
8215         echo "$extras" > ../extras.lst
8216         val="'$extras'"
8217         ;;
8218 esac
8219 set extras
8220 eval $setvar
8221 echo " "
8222
8223 : determine where html pages for programs go
8224 set html1dir html1dir none
8225 eval $prefixit
8226 $cat <<EOM
8227
8228 If you wish to install html files for programs in $spackage, indicate
8229 the appropriate directory here.  To skip installing html files,
8230 answer "none".
8231 EOM
8232 case "$html1dir" in
8233 ''|none|$undef|' ') dflt=none ;;
8234 *) dflt=$html1dir ;;
8235 esac
8236 fn=dn+~
8237 rp="Directory for the main $spackage html pages?"
8238 . ./getfile
8239 prefixvar=html1dir
8240 . ./setprefixvar
8241 : Use ' ' for none so value is preserved next time through Configure
8242 $test X"$html1dir" = "X" && html1dir=' '
8243
8244 : determine where html pages for libraries and modules go
8245 set html3dir html3dir none
8246 eval $prefixit
8247 $cat <<EOM
8248
8249 If you wish to install html files for modules associated with $spackage,
8250 indicate the appropriate directory here.  To skip installing html files,
8251 answer "none".
8252 EOM
8253 : There is no obvious default.  If they have specified html1dir, then
8254 : try to key off that, possibly changing .../html1 into .../html3.
8255 case "$html3dir" in
8256 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8257 *) dflt=$html3dir ;;
8258 esac
8259 fn=dn+~
8260 rp="Directory for the $spackage module html pages?"
8261 . ./getfile
8262 prefixvar=html3dir
8263 . ./setprefixvar
8264 : Use ' ' for none so value is preserved next time through Configure
8265 $test X"$html3dir" = "X" && html3dir=' '
8266
8267 : determine whether to install perl also as /usr/bin/perl
8268
8269 echo " "
8270 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8271         $cat <<EOM
8272 Many scripts expect perl to be installed as /usr/bin/perl.
8273
8274 If you want to, I can install the perl you are about to compile
8275 as /usr/bin/perl (in addition to $bin/perl).
8276 EOM
8277         if test -f /usr/bin/perl; then
8278             $cat <<EOM
8279
8280 However, please note that because you already have a /usr/bin/perl,
8281 overwriting that with a new Perl would very probably cause problems.
8282 Therefore I'm assuming you don't want to do that (unless you insist).
8283
8284 EOM
8285             case "$installusrbinperl" in
8286             "$define"|[yY]*)    dflt='y';;
8287             *)                  dflt='n';;
8288             esac
8289         else
8290             $cat <<EOM
8291
8292 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8293
8294 EOM
8295             case "$installusrbinperl" in
8296             "$undef"|[nN]*)     dflt='n';;
8297             *)                  dflt='y';;
8298             esac
8299         fi
8300         rp="Do you want to install perl as /usr/bin/perl?"
8301         . ./myread
8302         case "$ans" in
8303         [yY]*)  val="$define";;
8304         *)      val="$undef" ;;
8305         esac
8306 else
8307         val="$undef"
8308 fi
8309 set installusrbinperl
8310 eval $setvar
8311
8312 : see if dlopen exists
8313 xxx_runnm="$runnm"
8314 xxx_ccflags="$ccflags"
8315 runnm=false
8316 : with g++ one needs -shared to get is-in-libc to work for dlopen
8317 case "$gccversion" in
8318 '')     ;;
8319 *Clang*)        ;;
8320 *)      case "$d_cplusplus" in
8321         "$define") ccflags="$ccflags -shared" ;;
8322         esac
8323         ;;
8324 esac
8325 set dlopen d_dlopen
8326 eval $inlibc
8327 runnm="$xxx_runnm"
8328 ccflags="$xxx_ccflags"
8329
8330 : see if this is a unistd.h system
8331 set unistd.h i_unistd
8332 eval $inhdr
8333
8334 : determine which dynamic loading, if any, to compile in
8335 echo " "
8336 dldir="ext/DynaLoader"
8337 case "$usedl" in
8338     $define|y|true)
8339         dflt='y'
8340         usedl="$define"
8341         ;;
8342     $undef|n|false)
8343         dflt='n'
8344         usedl="$undef"
8345         ;;
8346     *)
8347         dflt='n'
8348         case "$d_dlopen" in
8349             $define) dflt='y' ;;
8350         esac
8351         : Does a dl_xxx.xs file exist for this operating system
8352         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8353         ;;
8354 esac
8355 rp="Do you wish to use dynamic loading?"
8356 . ./myread
8357 usedl="$ans"
8358 bin_ELF="$undef"
8359 case "$ans" in
8360     y*) usedl="$define"
8361         case "$dlsrc" in
8362             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8363                     dflt="$dldir/dl_${osname}.xs"
8364                 elif $test "$d_dlopen" = "$define" ; then
8365                     dflt="$dldir/dl_dlopen.xs"
8366                 else
8367                     dflt=''
8368                 fi
8369                 ;;
8370             *)  dflt="$dldir/$dlsrc"
8371                 ;;
8372         esac
8373         echo "The following dynamic loading files are available:"
8374         : Can not go over to $dldir because getfile has path hard-coded in.
8375         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8376         rp="Source file to use for dynamic loading"
8377         fn="fne"
8378         gfpth="$src"
8379         . ./getfile
8380         usedl="$define"
8381         : emulate basename
8382         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8383
8384         $cat << EOM
8385
8386 Some systems may require passing special flags to $cc -c to
8387 compile modules that will be used to create a shared library.
8388 To use no flags, say "none".
8389
8390 EOM
8391         case "$cccdlflags" in
8392             '') case "$gccversion" in
8393                 '') case "$osname" in
8394                         hpux)   dflt='+z' ;;
8395                         irix*)  dflt='-KPIC' ;;
8396                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8397                         sunos)  dflt='-pic' ;;
8398                         *)      dflt='none' ;;
8399                     esac
8400                     ;;
8401                 *)  case "$osname" in
8402                         darwin) dflt='none' ;;
8403                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8404                         *)      dflt='-fpic' ;;
8405                     esac ;;
8406                 esac ;;
8407             ' ') dflt='none' ;;
8408             *)   dflt="$cccdlflags" ;;
8409         esac
8410
8411         case "$dflt" in
8412             none) dflt='' ;;
8413         esac
8414
8415         # If -Dsysroot was specified, now's the time to add it
8416         # to cccdlflags
8417         if test "X$sysroot" != X; then
8418             case "$gccversion" in
8419                 '') ;;
8420                 *)  case "$dflt" in
8421                         *sysroot*) ;;
8422                         'undef'|*)
8423                             dflt="$dflt --sysroot=$sysroot" ;;
8424                     esac
8425                     ;;
8426             esac
8427         fi
8428
8429         case "$dflt" in
8430             '') dflt='none';;
8431         esac
8432
8433         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8434         . ./myread
8435         case "$ans" in
8436             none) cccdlflags=' ' ;;
8437             *)    cccdlflags="$ans" ;;
8438         esac
8439
8440         cat << EOM
8441
8442 Some systems use ld to create libraries that can be dynamically loaded,
8443 while other systems (such as those using ELF) use $cc.
8444
8445 EOM
8446
8447 : Determine if this is ELF
8448         $cat >try.c <<EOM
8449 /* Test for whether ELF binaries are produced */
8450 #include <fcntl.h>
8451 #$i_stdlib I_STDLIB
8452 #ifdef I_STDLIB
8453 #include <stdlib.h>
8454 #endif
8455 #$i_unistd I_UNISTD
8456 #ifdef I_UNISTD
8457 #include <unistd.h>
8458 #endif
8459 int main() {
8460     char b[4];
8461     int i = open("a.out",O_RDONLY);
8462     if(i == -1)
8463         exit(1); /* fail */
8464     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8465         exit(0); /* succeed (yes, it is ELF) */
8466     exit(1); /* fail */
8467 }
8468 EOM
8469         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8470             bin_ELF="$define"
8471         fi
8472         $rm_try
8473
8474         case "$ld" in
8475             '') if $test $bin_ELF = "$define"; then
8476                     cat <<EOM
8477 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8478 EOM
8479                     dflt="$cc"
8480                 else
8481                     echo "I'll use ld to build dynamic libraries."
8482                     dflt='ld'
8483                 fi
8484                 ;;
8485             *)  dflt="$ld"
8486                 ;;
8487         esac
8488
8489         rp="What command should be used to create dynamic libraries?"
8490         . ./myread
8491         ld="$ans"
8492
8493         cat << EOM
8494
8495 Some systems may require passing special flags to $ld to create a
8496 library that can be dynamically loaded.  If your ld flags include
8497 -L/other/path options to locate libraries outside your loader's normal
8498 search path, you may need to specify those -L options here as well.  To
8499 use no flags, say "none".
8500
8501 EOM
8502         case "$lddlflags" in
8503             '') case "$osname" in
8504                     haiku) dflt='-shared' ;;
8505                     hpux) dflt='-b';
8506                           case "$gccversion" in
8507                               '') dflt="$dflt +vnocompatwarnings" ;;
8508                           esac
8509                           ;;
8510                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8511                     solaris) # See [perl #66604].
8512                             # On Solaris 11, gcc -m64 on amd64
8513                             # appears not to understand -G.  gcc versions at
8514                             # least as old as 3.4.3 support -shared, so just
8515                             # use that with Solaris 11 and later, but keep
8516                             # the old behavior for older Solaris versions.
8517                             case "$gccversion" in
8518                                 '') dflt='-G' ;;
8519                                 *)  case "$osvers" in
8520                                         2.?|2.10) dflt='-G' ;;
8521                                         *) dflt='-shared' ;;
8522                                     esac
8523                                     ;;
8524                             esac
8525                             ;;
8526                     sunos) dflt='-assert nodefinitions' ;;
8527                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8528                     *)     dflt='none' ;;
8529                 esac
8530                 ;;
8531             *) dflt="$lddlflags" ;;
8532         esac
8533
8534         : Only do this for gcc, since, for example, qcc has no concept
8535         : of --sysroot.
8536         if $test "X$sysroot" != X; then
8537             case "$gccversion" in
8538                 '') ;;
8539                 *)  dflt="$dflt --sysroot $sysroot" ;;
8540             esac
8541         fi
8542
8543         : Try to guess additional flags to pick up local libraries.
8544         : Be careful not to append to a plain 'none'
8545         case "$dflt" in
8546             none) dflt='' ;;
8547         esac
8548         for thisflag in $ldflags; do
8549             case "$thisflag" in
8550                 -L*|-R*|-Wl,-R*)
8551                     case " $dflt " in
8552                         *" $thisflag "*) ;;
8553                         *) dflt="$dflt $thisflag" ;;
8554                     esac
8555                     ;;
8556             esac
8557         done
8558
8559         case "$dflt" in
8560             ''|' ') dflt='none' ;;
8561         esac
8562
8563         case "$ldflags" in
8564             *-fstack-protector-strong*)
8565                 case "$dflt" in
8566                     *-fstack-protector-strong*) ;; # Don't add it again
8567                     *) dflt="$dflt -fstack-protector-strong" ;;
8568                 esac
8569                 ;;
8570             *-fstack-protector*)
8571                 case "$dflt" in
8572                     *-fstack-protector*) ;; # Don't add it again
8573                     *) dflt="$dflt -fstack-protector" ;;
8574                 esac
8575                 ;;
8576         esac
8577
8578         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8579         . ./myread
8580         case "$ans" in
8581             none) lddlflags=' ' ;;
8582             *) lddlflags="$ans" ;;
8583         esac
8584
8585         cat <<EOM
8586
8587 Some systems may require passing special flags to $cc to indicate that
8588 the resulting executable will use dynamic linking.  To use no flags,
8589 say "none".
8590
8591 EOM
8592         case "$ccdlflags" in
8593             '') case "$osname" in
8594                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8595                     sunos)             dflt='none'   ;;
8596                     *)                 dflt='none'   ;;
8597                 esac ;;
8598             ' ') dflt='none' ;;
8599             *)   dflt="$ccdlflags" ;;
8600         esac
8601         rp="Any special flags to pass to $cc to use dynamic linking?"
8602         . ./myread
8603         case "$ans" in
8604             none) ccdlflags=' ' ;;
8605             *)    ccdlflags="$ans" ;;
8606         esac
8607         ;;
8608
8609     *)  usedl="$undef"
8610         ld='ld'
8611         dlsrc='dl_none.xs'
8612         lddlflags=''
8613         ccdlflags=''
8614         ;;
8615 esac
8616
8617 ld_can_script="$undef"
8618 case "$bin_ELF$usedl" in
8619     $define$define)
8620         # Abuse try.h and a.out names for neat cleanup
8621         $cat >try.c <<EOM
8622 void foo() {}
8623 void bar() {}
8624 EOM
8625         $cat >try.h <<EOM
8626 LIBTEST_42 {
8627  global:
8628   foo;
8629  local: *;
8630  };
8631 EOM
8632         if $cc $cccdlflags $ccdlflags $ccflags \
8633                $ldflags $lddlflags -o a.out try.c \
8634                -Wl,--version-script=try.h >/dev/null 2>&1 \
8635            &&  $test -s a.out ; then
8636             echo "ld supports scripting" >&4
8637             ld_can_script="$define"
8638         else
8639             echo "ld does not support scripting" >&4
8640         fi
8641         $rm_try
8642         ;;
8643 esac
8644
8645 : Do we want a shared libperl?
8646 also=''
8647 case "$usedl" in
8648 $undef)
8649         # No dynamic loading being used, so don't bother even to prompt.
8650         useshrplib='false'
8651         ;;
8652 *)      case "$useshrplib" in
8653         '')     case "$osname" in
8654                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8655                         dflt=y
8656                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8657                         ;;
8658                 *)      dflt=n
8659                         ;;
8660                 esac
8661                 ;;
8662         $define|true|[Yy]*)
8663                 dflt=y
8664                 ;;
8665         *)      dflt=n
8666                 ;;
8667         esac
8668         $cat << EOM
8669
8670 The perl executable is normally obtained by linking perlmain.c with
8671 libperl${_a}, any static extensions (usually just DynaLoader), and
8672 any other libraries needed on this system (such as -lm, etc.).  Since
8673 your system supports dynamic loading, it is probably possible to build
8674 a shared libperl.$so.  If you will have more than one executable linked
8675 to libperl.$so, this will significantly reduce the size of each
8676 executable, but it may have a noticeable effect on performance.  The
8677 default is probably sensible for your system.
8678 $also
8679
8680 EOM
8681         rp="Build a shared libperl.$so (y/n)"
8682         . ./myread
8683         case "$ans" in
8684         true|$define|[Yy]*)
8685                 useshrplib='true'  ;;
8686         *)      useshrplib='false' ;;
8687         esac
8688         ;;
8689 esac
8690
8691 case "$useshrplib" in
8692 true)
8693         case "$userelocatableinc" in
8694         true|define)
8695                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8696                 echo "See INSTALL for an explanation why that won't work." >&4
8697                 exit 4
8698                 ;;
8699         esac
8700         case "$libperl" in
8701         '')
8702                 # Figure out a good name for libperl.so.  Since it gets stored in
8703                 # a version-specific architecture-dependent library, the version
8704                 # number isn't really that important, except for making cc/ld happy.
8705                 #
8706                 # A name such as libperl.so.10.1
8707                 majmin="libperl.$so.$patchlevel.$subversion"
8708                 # A name such as libperl.so.100
8709                 majonly=`echo $patchlevel $subversion |
8710                         $awk '{printf "%d%02d", $1, $2}'`
8711                 majonly=libperl.$so.$majonly
8712                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8713                 # rely on figuring it out from the naming of libc.
8714                 case "${osname}${osvers}" in
8715                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8716                         dflt=libperl.$so
8717                         ;;
8718                 cygwin*) # ld links now against the dll directly
8719                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8720                         majonly=`echo $patchlevel $subversion |
8721                                 $awk '{printf "%03d%03d", $1, $2}'`
8722                         majonly=cygperl5.$majonly.$so
8723                         dflt=$majmin
8724                         ;;
8725                 *)      # Try to guess based on whether libc has major.minor.
8726                         case "$libc" in
8727                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8728                         *libc.$so.[0-9]*) dflt=$majonly ;;
8729                         *)      dflt=libperl.$so ;;
8730                         esac
8731                         ;;
8732                 esac
8733                 ;;
8734         *)      dflt=$libperl
8735                 ;;
8736         esac
8737         cat << EOM
8738
8739 I need to select a good name for the shared libperl.  If your system uses
8740 library names with major and minor numbers, then you might want something
8741 like $majmin.  Alternatively, if your system uses a single version
8742 number for shared libraries, then you might want to use $majonly.
8743 Or, your system might be quite happy with a simple libperl.$so.
8744
8745 Since the shared libperl will get installed into a version-specific
8746 architecture-dependent directory, the version number of the shared perl
8747 library probably isn't important, so the default should be o.k.
8748
8749 EOM
8750         rp='What name do you want to give to the shared libperl?'
8751         . ./myread
8752         libperl=$ans
8753         echo "Ok, I'll use $libperl"
8754         ;;
8755 *)
8756         libperl="libperl${_a}"
8757         ;;
8758 esac
8759
8760 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8761 case "$shrpdir" in
8762 '') ;;
8763 *)      $cat >&4 <<EOM
8764 WARNING:  Use of the shrpdir variable for the installation location of
8765 the shared $libperl is not supported.  It was never documented and
8766 will not work in this version.  Let me (perlbug@perl.org)
8767 know of any problems this may cause.
8768
8769 EOM
8770         case "$shrpdir" in
8771         "$archlibexp/CORE")
8772                 $cat >&4 <<EOM
8773 But your current setting of $shrpdir is
8774 the default anyway, so it's harmless.
8775 EOM
8776                 ;;
8777         *)
8778                 $cat >&4 <<EOM
8779 Further, your current attempted setting of $shrpdir
8780 conflicts with the value of $archlibexp/CORE
8781 that installperl will use.
8782 EOM
8783                 ;;
8784         esac
8785         ;;
8786 esac
8787
8788 # How will the perl executable find the installed shared $libperl?
8789 # Add $xxx to ccdlflags.
8790 # If we can't figure out a command-line option, use $shrpenv to
8791 # set env LD_RUN_PATH.  The main perl makefile uses this.
8792 shrpdir=$archlibexp/CORE
8793 xxx=''
8794 tmp_shrpenv=''
8795 if "$useshrplib"; then
8796     case "$osname" in
8797         aix)
8798                 # We'll set it in Makefile.SH...
8799                 ;;
8800         solaris)
8801                 xxx="-R $shrpdir"
8802                 ;;
8803         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8804                 xxx="-Wl,-R$shrpdir"
8805                 ;;
8806         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8807                 xxx="-Wl,-rpath,$shrpdir"
8808                 ;;
8809         hpux*)
8810                 # hpux doesn't like the default, either.
8811                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8812                 ;;
8813         cygwin)
8814                 # cygwin needs only ldlibpth
8815                 ;;
8816         *)
8817                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8818                 ;;
8819         esac
8820         case "$xxx" in
8821         '') ;;
8822         *)
8823                 # Only add $xxx if it isn't already in ccdlflags.
8824                 case " $ccdlflags " in
8825                 *" $xxx "*)     ;;
8826                 *)      ccdlflags="$ccdlflags $xxx"
8827                         cat <<EOM >&4
8828
8829 Adding $xxx to the flags
8830 passed to $ld so that the perl executable will find the
8831 installed shared $libperl.
8832
8833 EOM
8834                         ;;
8835                 esac
8836                 ;;
8837         esac
8838 fi
8839 # Fix ccdlflags in AIX for building external extensions.
8840 # (For building Perl itself bare -bE:perl.exp is needed,
8841 #  Makefile.SH takes care of this.)
8842 case "$osname" in
8843 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8844 esac
8845 # Respect a hint or command-line value.
8846 case "$shrpenv" in
8847 '') shrpenv="$tmp_shrpenv" ;;
8848 esac
8849 case "$ldlibpthname" in
8850 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8851 none)   ldlibpthname='' ;;
8852 esac
8853
8854 : determine where manual pages are on this system
8855 echo " "
8856 case "$sysman" in
8857 '')
8858         syspath='/usr/share/man/man1 /usr/man/man1'
8859         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8860         syspath="$syspath /usr/man/u_man/man1"
8861         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8862         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8863         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8864         sysman=`./loc . /usr/man/man1 $syspath`
8865         ;;
8866 esac
8867 if $test -d "$sysman"; then
8868         echo "System manual is in $sysman." >&4
8869 else
8870         echo "Could not find manual pages in source form." >&4
8871 fi
8872
8873 : determine where manual pages go
8874 set man1dir man1dir none
8875 eval $prefixit
8876 $cat <<EOM
8877
8878 $spackage has manual pages available in source form.
8879 EOM
8880 case "$nroff" in
8881 nroff)
8882         echo "However, you don't have nroff, so they're probably useless to you."
8883         case "$man1dir" in
8884         '') man1dir="none";;
8885         esac;;
8886 esac
8887 echo "If you don't want the manual sources installed, answer 'none'."
8888 case "$man1dir" in
8889 ' ') dflt=none
8890         ;;
8891 '')
8892         lookpath="$prefixexp/share/man/man1"
8893         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8894         lookpath="$lookpath $prefixexp/man/p_man/man1"
8895         lookpath="$lookpath $prefixexp/man/u_man/man1"
8896         lookpath="$lookpath $prefixexp/man/man.1"
8897         case "$sysman" in
8898         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8899         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8900         esac
8901         set dflt
8902         eval $prefixup
8903         ;;
8904 *)  dflt="$man1dir"
8905         ;;
8906 esac
8907 echo " "
8908 fn=dn+~
8909 rp="Where do the main $spackage manual pages (source) go?"
8910 . ./getfile
8911 if $test "X$man1direxp" != "X$ansexp"; then
8912         installman1dir=''
8913 fi
8914 prefixvar=man1dir
8915 . ./setprefixvar
8916
8917 case "$man1dir" in
8918 '')     man1dir=' '
8919         installman1dir='';;
8920 esac
8921
8922 : What suffix to use on installed man pages
8923
8924 case "$man1dir" in
8925 ' ')
8926         man1ext='0'
8927         ;;
8928 *)
8929         rp="What suffix should be used for the main $spackage man pages?"
8930         case "$man1ext" in
8931         '')     case "$man1dir" in
8932                 *1)  dflt=1 ;;
8933                 *1p) dflt=1p ;;
8934                 *1pm) dflt=1pm ;;
8935                 *l) dflt=l;;
8936                 *n) dflt=n;;
8937                 *o) dflt=o;;
8938                 *p) dflt=p;;
8939                 *C) dflt=C;;
8940                 *L) dflt=L;;
8941                 *L1) dflt=L1;;
8942                 *) dflt=1;;
8943                 esac
8944                 ;;
8945         *)      dflt="$man1ext";;
8946         esac
8947         . ./myread
8948         man1ext="$ans"
8949         ;;
8950 esac
8951
8952 : see if we can have long filenames
8953 echo " "
8954 first=123456789abcdef
8955 $rm -f $first
8956 if (echo hi >$first) 2>/dev/null; then
8957         if $test -f 123456789abcde; then
8958                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8959                 val="$undef"
8960         else
8961                 echo 'You can have filenames longer than 14 characters.'>&4
8962                 val="$define"
8963         fi
8964 else
8965         $cat <<'EOM'
8966 You can't have filenames longer than 14 chars.
8967 You can't even think about them!
8968 EOM
8969         val="$undef"
8970 fi
8971 set d_flexfnam
8972 eval $setvar
8973 $rm -rf 123456789abcde*
8974
8975 : determine where library module manual pages go
8976 set man3dir man3dir none
8977 eval $prefixit
8978 $cat <<EOM
8979
8980 $spackage has manual pages for many of the library modules.
8981 EOM
8982
8983 case "$nroff" in
8984 nroff)
8985         $cat <<'EOM'
8986 However, you don't have nroff, so they're probably useless to you.
8987 EOM
8988         case "$man3dir" in
8989         '') man3dir="none";;
8990         esac;;
8991 esac
8992
8993 case "$d_flexfnam" in
8994 undef)
8995         $cat <<'EOM'
8996 However, your system can't handle the long file names like File::Basename.3.
8997 EOM
8998         case "$man3dir" in
8999         '') man3dir="none";;
9000         esac;;
9001 esac
9002
9003 echo "If you don't want the manual sources installed, answer 'none'."
9004 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9005 case "$man3dir" in
9006 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9007         if $test -d "$privlib/man/man3"; then
9008                 cat <<EOM >&4
9009
9010 WARNING:  Previous versions of perl installed man3 pages into
9011 $privlib/man/man3.  This version will suggest a
9012 new default of $dflt.
9013 EOM
9014                 tdflt=$dflt
9015                 dflt='n'
9016                 rp='Do you wish to preserve the old behavior?(y/n)'
9017                 . ./myread
9018                 case "$ans" in
9019                 y*) dflt="$privlib/man/man3" ;;
9020                 *)  dflt=$tdflt ;;
9021                 esac
9022     fi
9023         ;;
9024 *)      dflt="$man3dir" ;;
9025 esac
9026 case "$dflt" in
9027 ' ') dflt=none ;;
9028 esac
9029 echo " "
9030 fn=dn+~
9031 rp="Where do the $package library man pages (source) go?"
9032 . ./getfile
9033 prefixvar=man3dir
9034 . ./setprefixvar
9035
9036 case "$man3dir" in
9037 '')     man3dir=' '
9038         installman3dir='';;
9039 esac
9040
9041 : What suffix to use on installed man pages
9042 case "$man3dir" in
9043 ' ')
9044         man3ext='0'
9045         ;;
9046 *)
9047         rp="What suffix should be used for the $package library man pages?"
9048         case "$man3ext" in
9049         '')     case "$man3dir" in
9050                 *3)  dflt=3 ;;
9051                 *3p) dflt=3p ;;
9052                 *3pm) dflt=3pm ;;
9053                 *l) dflt=l;;
9054                 *n) dflt=n;;
9055                 *o) dflt=o;;
9056                 *p) dflt=p;;
9057                 *C) dflt=C;;
9058                 *L) dflt=L;;
9059                 *L3) dflt=L3;;
9060                 *) dflt=3;;
9061                 esac
9062                 ;;
9063         *)      dflt="$man3ext";;
9064         esac
9065         . ./myread
9066         man3ext="$ans"
9067         ;;
9068 esac
9069
9070 : see if we have to deal with yellow pages, now NIS.
9071 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9072         case "$hostcat" in
9073         nidump*) ;;
9074         *)
9075                 case "$hostcat" in
9076                 *ypcat*) dflt=y;;
9077                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9078                                 dflt=y
9079                         else
9080                                 dflt=n
9081                         fi;;
9082                 *) dflt=n;;
9083                 esac
9084                 echo " "
9085                 rp='Are you getting the hosts file via yellow pages?'
9086                 . ./myread
9087                 case "$ans" in
9088                 y*) hostcat='ypcat hosts';;
9089                 *) hostcat='cat /etc/hosts';;
9090                 esac
9091                 ;;
9092         esac
9093 fi
9094 case "$hostcat" in
9095 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9096 esac
9097 case "$groupcat" in
9098 '') test -f /etc/group && groupcat='cat /etc/group';;
9099 esac
9100 case "$passcat" in
9101 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9102 esac
9103
9104 : now get the host name
9105 echo " "
9106 echo "Figuring out host name..." >&4
9107 case "$myhostname" in
9108 '') cont=true
9109         echo 'Maybe "hostname" will work...'
9110         if tans=`sh -c hostname 2>&1` ; then
9111                 myhostname=$tans
9112                 phostname=hostname
9113                 cont=''
9114         fi
9115         ;;
9116 *) cont='';;
9117 esac
9118 if $test "$cont"; then
9119         if ./xenix; then
9120                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9121                 if tans=`cat /etc/systemid 2>&1` ; then
9122                         myhostname=$tans
9123                         phostname='cat /etc/systemid'
9124                         echo "Whadyaknow.  Xenix always was a bit strange..."
9125                         cont=''
9126                 fi
9127         elif $test -r /etc/systemid; then
9128                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9129         fi
9130 fi
9131 if $test "$cont"; then
9132         echo 'No, maybe "uuname -l" will work...'
9133         if tans=`sh -c 'uuname -l' 2>&1` ; then
9134                 myhostname=$tans
9135                 phostname='uuname -l'
9136         else
9137                 echo 'Strange.  Maybe "uname -n" will work...'
9138                 if tans=`sh -c 'uname -n' 2>&1` ; then
9139                         myhostname=$tans
9140                         phostname='uname -n'
9141                 else
9142                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9143                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9144                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9145                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9146                         else
9147                                 case "$myhostname" in
9148                                 '') echo "Does this machine have an identity crisis or something?"
9149                                         phostname='';;
9150                                 *)
9151                                         echo "Well, you said $myhostname before..."
9152                                         phostname='echo $myhostname';;
9153                                 esac
9154                         fi
9155                 fi
9156         fi
9157 fi
9158 case "$myhostname" in
9159 '') myhostname=noname ;;
9160 esac
9161 : you do not want to know about this
9162 set $myhostname
9163 myhostname=$1
9164
9165 : verify guess
9166 if $test "$myhostname" ; then
9167         dflt=y
9168         rp='Your host name appears to be "'$myhostname'".'" Right?"
9169         . ./myread
9170         case "$ans" in
9171         y*) ;;
9172         *) myhostname='';;
9173         esac
9174 fi
9175
9176 : bad guess or no guess
9177 while $test "X$myhostname" = X ; do
9178         dflt=''
9179         rp="Please type the (one word) name of your host:"
9180         . ./myread
9181         myhostname="$ans"
9182 done
9183
9184 : translate upper to lower if necessary
9185 case "$myhostname" in
9186 *[A-Z]*)
9187         echo "(Normalizing case in your host name)"
9188         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9189         ;;
9190 esac
9191
9192 case "$myhostname" in
9193 *.*)
9194         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9195         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9196         echo "(Trimming domain name from host name--host name is now $myhostname)"
9197         ;;
9198 *) case "$mydomain" in
9199         '')
9200                 {
9201                         test "X$hostcat" = "Xypcat hosts" &&
9202                         ypmatch "$myhostname" hosts 2>/dev/null |\
9203                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9204                         $test -s hosts
9205                 } || {
9206                         test "X$hostcat" != "X" &&
9207                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9208                                         /[       ]$myhostname[  . ]/p" > hosts
9209                 }
9210                 tmp_re="[       . ]"
9211                 if $test -f hosts; then
9212                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9213                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9214                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9215                                 hosts | $sort | $uniq | \
9216                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9217                         case `$echo X$dflt` in
9218                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9219                                 dflt=.
9220                                 ;;
9221                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9222                                 ;;
9223                         esac
9224                 else
9225                         echo "(I cannot locate a hosts database anywhere)"
9226                         dflt=.
9227                 fi
9228                 case "$dflt" in
9229                 .)
9230                         tans=`./loc resolv.conf X /etc /usr/etc`
9231                         if $test -f "$tans"; then
9232                                 echo "(Attempting domain name extraction from $tans)"
9233                                 dflt=.`$sed -n -e 's/   / /g' \
9234                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9235                                   -e 1q 2>/dev/null`
9236                                 case "$dflt" in
9237                                 .) dflt=.`$sed -n -e 's/        / /g' \
9238                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9239                                      -e 1q 2>/dev/null`
9240                                         ;;
9241                                 esac
9242                         fi
9243                         ;;
9244                 esac
9245                 case "$dflt" in
9246                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9247                         dflt=.`sh -c domainname 2>/dev/null`
9248                         case "$dflt" in
9249                         '') dflt='.';;
9250                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9251                         esac
9252                         ;;
9253                 esac
9254                 case "$dflt$osname" in
9255                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9256                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9257                         ;;
9258                 esac
9259                 case "$dflt" in
9260                 .) echo "(Lost all hope -- silly guess then)"
9261                         dflt='.nonet'
9262                         ;;
9263                 esac
9264                 $rm -f hosts
9265                 ;;
9266         *) dflt="$mydomain";;
9267         esac;;
9268 esac
9269 echo " "
9270 rp="What is your domain name?"
9271 . ./myread
9272 tans="$ans"
9273 case "$ans" in
9274 '') ;;
9275 .*) ;;
9276 *) tans=".$tans";;
9277 esac
9278 mydomain="$tans"
9279
9280 : translate upper to lower if necessary
9281 case "$mydomain" in
9282 *[A-Z]*)
9283         echo "(Normalizing case in your domain name)"
9284         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9285         ;;
9286 esac
9287
9288 : a little sanity check here
9289 case "$phostname" in
9290 '') ;;
9291 *)
9292         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9293         $myhostname$mydomain|$myhostname) ;;
9294         *)
9295                 case "$phostname" in
9296                 sed*)
9297                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9298                         ;;
9299                 *)
9300                         echo "(That doesn't agree with your $phostname command, by the way.)"
9301                         ;;
9302                 esac
9303         ;;
9304         esac
9305         ;;
9306 esac
9307
9308 : determine the e-mail address of the user who is running us
9309 $cat <<EOM
9310
9311 I need to get your e-mail address in Internet format if possible, i.e.
9312 something like user@host.domain. Please answer accurately since I have
9313 no easy means to double check it. The default value provided below
9314 is most probably close to reality but may not be valid from outside
9315 your organization...
9316
9317 EOM
9318 cont=x
9319 while test "$cont"; do
9320         case "$MAILDOMAIN" in
9321         '')
9322                 if $test -s /etc/mailname; then
9323                         maildomain=`$cat /etc/mailname`
9324                 else
9325                         maildomain="$myhostname$mydomain"
9326                 fi
9327                 ;;
9328         *)  maildomain="$MAILDOMAIN";;
9329         esac
9330         case "$cf_email" in
9331         '') dflt="$cf_by@$maildomain";;
9332         *)  dflt="$cf_email";;
9333         esac
9334         rp='What is your e-mail address?'
9335         . ./myread
9336         cf_email="$ans"
9337         case "$cf_email" in
9338         *@*.*) cont='' ;;
9339         *)
9340                 rp='Address does not look like an Internet one.  Use it anyway?'
9341                 case "$fastread" in
9342                 yes) dflt=y ;;
9343                 *) dflt=n ;;
9344                 esac
9345                 . ./myread
9346                 case "$ans" in
9347                 y*) cont='' ;;
9348                 *) echo " " ;;
9349                 esac
9350                 ;;
9351         esac
9352 done
9353
9354 : Ask e-mail of administrator
9355 $cat <<EOM
9356
9357 If you or somebody else will be maintaining perl at your site, please
9358 fill in the correct e-mail address here so that they may be contacted
9359 if necessary. Currently, the "perlbug" program included with perl
9360 will send mail to this address in addition to perlbug@perl.org. You may
9361 enter "none" for no administrator.
9362
9363 EOM
9364 case "$perladmin" in
9365 '') dflt="$cf_email";;
9366 *) dflt="$perladmin";;
9367 esac
9368 rp='Perl administrator e-mail address'
9369 . ./myread
9370 perladmin="$ans"
9371
9372 : determine whether to use a version number suffix for installed binaries
9373 echo " "
9374 $cat <<EOM
9375 Do you want to use a version number suffix for installed binaries? This
9376 will install 'perl$version' instead of 'perl', and likewise for other
9377 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9378 to be installed side-by-side. Unless you are a developer, you probably
9379 do *not* want to do this.
9380 EOM
9381 case "$versiononly" in
9382 "$define"|[Yy]*|true) dflt='y' ;;
9383 *) dflt='n';
9384 esac
9385 rp="Do you want to use a version number suffix for installed binaries?"
9386 . ./myread
9387 case "$ans" in
9388 [yY]*)  val="$define";;
9389 *)      val="$undef" ;;
9390 esac
9391 set versiononly
9392 eval $setvar
9393
9394 case "$versiononly" in
9395 "$define") inc_version_list=''
9396            inc_version_list_init=0
9397            ;;
9398 esac
9399
9400 : figure out how to guarantee perl startup
9401 : XXX Note that this currently takes advantage of the bug that binexp ignores
9402 :     the Configure -Dinstallprefix setting, which in turn means that under
9403 :     relocatable @INC, initialinstalllocation is what binexp started as.
9404 case "$startperl" in
9405 '')
9406         case "$sharpbang" in
9407         *!)
9408                 $cat <<EOH
9409
9410 I can use the #! construct to start perl on your system. This will
9411 make startup of perl scripts faster, but may cause problems if you
9412 want to share those scripts and perl is not in a standard place
9413 ($initialinstalllocation/perl) on all your platforms. The alternative
9414 is to force a shell by starting the script with a single ':' character.
9415
9416 EOH
9417                 case "$versiononly" in
9418                 "$define")      dflt="$initialinstalllocation/perl$version";;
9419                 *)              dflt="$initialinstalllocation/perl";;
9420                 esac
9421                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9422                 . ./myread
9423                 case "$ans" in
9424                 none)   startperl=": # use perl";;
9425                 *)      startperl="#!$ans"
9426                         if $test 30 -lt `echo "$ans" | wc -c`; then
9427                                 $cat >&4 <<EOM
9428
9429 WARNING:  Some systems limit the #! command to 32 characters.
9430 If you experience difficulty running Perl scripts with #!, try
9431 installing Perl in a directory with a shorter pathname.
9432
9433 EOM
9434                         fi ;;
9435                 esac
9436                 ;;
9437         *) startperl=": # use perl"
9438                 ;;
9439         esac
9440         ;;
9441 esac
9442 echo "I'll use $startperl to start perl scripts."
9443
9444 : figure best path for perl in scripts
9445 case "$perlpath" in
9446 '')
9447         case "$versiononly" in
9448         "$define")      perlpath="$initialinstalllocation/perl$version";;
9449         *)              perlpath="$initialinstalllocation/perl";;
9450         esac
9451         case "$startperl" in
9452         *!*) ;;
9453         *)
9454                 $cat <<EOH
9455
9456 I will use the "eval 'exec'" idiom to start Perl on your system.
9457 I can use the full path of your Perl binary for this purpose, but
9458 doing so may cause problems if you want to share those scripts and
9459 Perl is not always in a standard place ($initialinstalllocation/perl).
9460
9461 EOH
9462                 dflt="$initialinstalllocation/perl"
9463                 rp="What path shall I use in \"eval 'exec'\"?"
9464                 . ./myread
9465                 perlpath="$ans"
9466                 ;;
9467         esac
9468         ;;
9469 esac
9470 case "$startperl" in
9471 *!*)    ;;
9472 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9473 esac
9474
9475 : determine where public executable scripts go
9476 set scriptdir scriptdir
9477 eval $prefixit
9478 case "$scriptdir" in
9479 '')
9480         dflt="$bin"
9481         : guess some guesses
9482         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9483         $test -d /usr/share/bin     && dflt=/usr/share/bin
9484         $test -d /usr/local/script  && dflt=/usr/local/script
9485         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9486         $test -d $prefixexp/script  && dflt=$prefixexp/script
9487         set dflt
9488         eval $prefixup
9489         ;;
9490 *)  dflt="$scriptdir"
9491         ;;
9492 esac
9493 $cat <<EOM
9494
9495 Some installations have a separate directory just for executable scripts so
9496 that they can mount it across multiple architectures but keep the scripts in
9497 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9498 Or you might just lump your scripts in with all your other executables.
9499
9500 EOM
9501 fn=d~
9502 rp='Where do you keep publicly executable scripts?'
9503 . ./getfile
9504 if $test "X$ansexp" != "X$scriptdirexp"; then
9505         installscript=''
9506 fi
9507 installscriptdir=''
9508 prefixvar=scriptdir
9509 . ./setprefixvar
9510 : A little fix up for an irregularly named variable.
9511 installscript="$installscriptdir"
9512
9513 : determine where add-on public executables go
9514 case "$sitebin" in
9515 '')     dflt=$siteprefix/bin ;;
9516 *)      dflt=$sitebin ;;
9517 esac
9518 fn=d~
9519 rp='Pathname where the add-on public executables should be installed?'
9520 . ./getfile
9521 prefixvar=sitebin
9522 . ./setprefixvar
9523
9524 : determine where add-on html pages go
9525 : There is no standard location, so try to copy the previously-selected
9526 : directory structure for the core html pages.
9527 case "$sitehtml1dir" in
9528 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9529 *)     dflt=$sitehtml1dir ;;
9530 esac
9531 case "$dflt" in
9532 ''|' ') dflt=none ;;
9533 esac
9534 fn=dn+~
9535 rp='Pathname where the site-specific html pages should be installed?'
9536 . ./getfile
9537 prefixvar=sitehtml1dir
9538 . ./setprefixvar
9539
9540 : determine where add-on library html pages go
9541 : There is no standard location, so try to copy the previously-selected
9542 : directory structure for the core html pages.
9543 case "$sitehtml3dir" in
9544 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9545 *)     dflt=$sitehtml3dir ;;
9546 esac
9547 case "$dflt" in
9548 ''|' ') dflt=none ;;
9549 esac
9550 fn=dn+~
9551 rp='Pathname where the site-specific library html pages should be installed?'
9552 . ./getfile
9553 prefixvar=sitehtml3dir
9554 . ./setprefixvar
9555
9556 : determine where add-on manual pages go
9557 case "$siteman1dir" in
9558 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9559 *)      dflt=$siteman1dir ;;
9560 esac
9561 case "$dflt" in
9562 ''|' ') dflt=none ;;
9563 esac
9564 fn=dn+~
9565 rp='Pathname where the site-specific manual pages should be installed?'
9566 . ./getfile
9567 prefixvar=siteman1dir
9568 . ./setprefixvar
9569
9570 : determine where add-on library man pages go
9571 case "$siteman3dir" in
9572 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9573 *)      dflt=$siteman3dir ;;
9574 esac
9575 case "$dflt" in
9576 ''|' ') dflt=none ;;
9577 esac
9578 fn=dn+~
9579 rp='Pathname where the site-specific library manual pages should be installed?'
9580 . ./getfile
9581 prefixvar=siteman3dir
9582 . ./setprefixvar
9583
9584 : determine where add-on public executable scripts go
9585 case "$sitescript" in
9586 '')     dflt=$siteprefix/script
9587         $test -d $dflt || dflt=$sitebin ;;
9588 *)  dflt="$sitescript" ;;
9589 esac
9590 fn=d~+
9591 rp='Pathname where add-on public executable scripts should be installed?'
9592 . ./getfile
9593 prefixvar=sitescript
9594 . ./setprefixvar
9595
9596 : see if backtrace exists
9597 set backtrace d_backtrace
9598 eval $inlibc
9599
9600 : add flags if using c backtrace
9601 case "$usecbacktrace" in
9602   "") usecbacktrace=$undef ;;
9603   [yY]*|true|$define)
9604     case "$d_backtrace" in
9605       [yY]*|true|$define)
9606         case " $ccflags " in
9607           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9608           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9609           esac
9610         ;;
9611       *)
9612         echo "This system does not support backtrace" >&4
9613         usecbacktrace=$undef
9614         ;;
9615       esac
9616     ;;
9617   esac
9618
9619 : Check if faststdio is requested and available
9620 case "$usefaststdio" in
9621 $define|true|[yY]*|'')
9622         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9623         case "$xversion" in
9624         [68])   dflt='y' ;;
9625         *)      dflt='n' ;;
9626         esac
9627         ;;
9628 *) dflt='n';;
9629 esac
9630 cat <<EOM
9631
9632 Perl can be built to use 'fast stdio', which means using the stdio
9633 library but also directly manipulating the stdio buffers to enable
9634 faster I/O.  Using stdio is better for backward compatibility (especially
9635 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9636 interface has been preferred instead of stdio.
9637
9638 If this doesn't make any sense to you, just accept the default '$dflt'.
9639 EOM
9640 rp='Use the "fast stdio" if available?'
9641 . ./myread
9642 case "$ans" in
9643 y|Y)    val="$define" ;;
9644 *)      val="$undef" ;;
9645 esac
9646 set usefaststdio
9647 eval $setvar
9648
9649
9650 : define an is-a-typedef? function
9651 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9652 case "$inclist" in
9653 "") inclist="sys/types.h";;
9654 esac;
9655 eval "varval=\$$var";
9656 case "$varval" in
9657 "")
9658         $rm -f temp.c;
9659         for inc in $inclist; do
9660                 echo "#include <$inc>" >>temp.c;
9661         done;
9662         echo "#ifdef $type" >> temp.c;
9663         echo "printf(\"We have $type\");" >> temp.c;
9664         echo "#endif" >> temp.c;
9665         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9666         if $contains $type temp.E >/dev/null 2>&1; then
9667                 eval "$var=\$type";
9668         else
9669                 eval "$var=\$def";
9670         fi;
9671         $rm -f temp.?;;
9672 *) eval "$var=\$varval";;
9673 esac'
9674
9675 : define an is-a-typedef? function that prompts if the type is not available.
9676 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9677 case "$inclist" in
9678 "") inclist="sys/types.h";;
9679 esac;
9680 eval "varval=\$$var";
9681 case "$varval" in
9682 "")
9683         $rm -f temp.c;
9684         for inc in $inclist; do
9685                 echo "#include <$inc>" >>temp.c;
9686         done;
9687         echo "#ifdef $type" >> temp.c;
9688         echo "printf(\"We have $type\");" >> temp.c;
9689         echo "#endif" >> temp.c;
9690         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9691         echo " " ;
9692         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9693         if $contains $type temp.E >/dev/null 2>&1; then
9694                 echo "$type found." >&4;
9695                 eval "$var=\$type";
9696         else
9697                 echo "$type NOT found." >&4;
9698                 dflt="$def";
9699                 . ./myread ;
9700                 eval "$var=\$ans";
9701         fi;
9702         $rm -f temp.?;;
9703 *) eval "$var=\$varval";;
9704 esac'
9705
9706 : see what type lseek is declared as in the kernel
9707 rp="What is the type used for lseek's offset on this system?"
9708 set off_t lseektype long stdio.h sys/types.h
9709 eval $typedef_ask
9710
9711 echo " "
9712 echo "Checking to see how big your file offsets are..." >&4
9713 $cat >try.c <<EOCP
9714 #include <sys/types.h>
9715 #include <stdio.h>
9716 int main()
9717 {
9718     printf("%d\n", (int)sizeof($lseektype));
9719     return(0);
9720 }
9721 EOCP
9722 set try
9723 if eval $compile_ok; then
9724         lseeksize=`$run ./try`
9725         echo "Your file offsets are $lseeksize bytes long."
9726 else
9727         dflt=$longsize
9728         echo " "
9729         echo "(I can't seem to compile the test program.  Guessing...)"
9730         rp="What is the size of your file offsets (in bytes)?"
9731         . ./myread
9732         lseeksize="$ans"
9733 fi
9734 $rm_try
9735
9736 : see what type file positions are declared as in the library
9737 rp="What is the type for file position used by fsetpos()?"
9738 set fpos_t fpostype long stdio.h sys/types.h
9739 eval $typedef_ask
9740
9741 : Check size for Fpos_t
9742 echo " "
9743 case "$fpostype" in
9744 *_t) zzz="$fpostype"    ;;
9745 *)   zzz="fpos_t"       ;;
9746 esac
9747 echo "Checking the size of $zzz..." >&4
9748 cat > try.c <<EOCP
9749 #include <sys/types.h>
9750 #include <stdio.h>
9751 #$i_stdlib I_STDLIB
9752 #ifdef I_STDLIB
9753 #include <stdlib.h>
9754 #endif
9755 int main() {
9756     printf("%d\n", (int)sizeof($fpostype));
9757     exit(0);
9758 }
9759 EOCP
9760 set try
9761 if eval $compile_ok; then
9762         yyy=`$run ./try`
9763         case "$yyy" in
9764         '')     fpossize=4
9765                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9766                 ;;
9767         *)      fpossize=$yyy
9768                 echo "Your $zzz is $fpossize bytes long."
9769                 ;;
9770         esac
9771 else
9772         dflt="$longsize"
9773         echo " " >&4
9774         echo "(I can't compile the test program.  Guessing...)" >&4
9775         rp="What is the size of your file positions (in bytes)?"
9776         . ./myread
9777         fpossize="$ans"
9778 fi
9779
9780 : Check for large file support
9781 # Backward compatibility (uselfs is deprecated).
9782 case "$uselfs" in
9783 "$define"|true|[yY]*)
9784         cat <<EOM >&4
9785
9786 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9787 EOM
9788         uselargefiles="$define"
9789         ;;
9790 esac
9791
9792 case "$lseeksize:$fpossize" in
9793 8:8) cat <<EOM
9794
9795 You can have files larger than 2 gigabytes.
9796 EOM
9797    val="$define" ;;
9798 *)    case "$uselargefiles" in
9799    "$undef"|false|[nN]*) dflt='n' ;;
9800    *)   dflt='y' ;;
9801    esac
9802    cat <<EOM
9803
9804 Perl can be built to understand large files (files larger than 2 gigabytes)
9805 on some systems.  To do so, Configure can be run with -Duselargefiles.
9806
9807 If this doesn't make any sense to you, just accept the default '$dflt'.
9808 EOM
9809    rp='Try to understand large files, if available?'
9810    . ./myread
9811    case "$ans" in
9812    y|Y)         val="$define" ;;
9813    *)           val="$undef"  ;;
9814    esac
9815    ;;
9816 esac
9817 set uselargefiles
9818 eval $setvar
9819 : Look for a hint-file generated 'call-back-unit'.  If the
9820 : user has specified that a large files perl is to be built,
9821 : we may need to set or change some other defaults.
9822 if $test -f uselargefiles.cbu; then
9823         echo "Your platform has some specific hints regarding large file builds, using them..."
9824         . ./uselargefiles.cbu
9825 fi
9826 case "$uselargefiles" in
9827 "$define")
9828         if $test -f uselargefiles.cbu; then
9829                 echo " "
9830                 echo "Rechecking to see how big your file offsets are..." >&4
9831                 $cat >try.c <<EOCP
9832 #include <sys/types.h>
9833 #include <stdio.h>
9834 int main()
9835 {
9836     printf("%d\n", (int)sizeof($lseektype));
9837     return(0);
9838 }
9839 EOCP
9840                 set try
9841                 if eval $compile_ok; then
9842                         lseeksize=`$run ./try`
9843                         $echo "Your file offsets are now $lseeksize bytes long."
9844                 else
9845                         dflt="$lseeksize"
9846                         echo " "
9847                         echo "(I can't seem to compile the test program.  Guessing...)"
9848                         rp="What is the size of your file offsets (in bytes)?"
9849                         . ./myread
9850                         lseeksize="$ans"
9851                 fi
9852                 case "$fpostype" in
9853                 *_t) zzz="$fpostype"    ;;
9854                 *)   zzz="fpos_t"       ;;
9855                 esac
9856                 $echo $n "Rechecking the size of $zzz...$c" >&4
9857                 $cat > try.c <<EOCP
9858 #include <sys/types.h>
9859 #include <stdio.h>
9860 #$i_stdlib I_STDLIB
9861 #ifdef I_STDLIB
9862 #include <stdlib.h>
9863 #endif
9864 int main() {
9865     printf("%d\n", (int)sizeof($fpostype));
9866     return(0);
9867 }
9868 EOCP
9869                 set try
9870                 if eval $compile_ok; then
9871                         yyy=`$run ./try`
9872                         dflt="$lseeksize"
9873                         case "$yyy" in
9874                         '')     echo " "
9875                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9876                                 ;;
9877                         *)      fpossize=$yyy
9878                                 echo " $fpossize bytes." >&4
9879                                 ;;
9880                         esac
9881                 else
9882                         dflt="$fpossize"
9883                         echo " "
9884                         echo "(I can't compile the test program.  Guessing...)" >&4
9885                         rp="What is the size of your file positions (in bytes)?"
9886                         . ./myread
9887                         fpossize="$ans"
9888                 fi
9889                 $rm_try
9890         fi
9891         ;;
9892 esac
9893
9894 : Check if we want perlio
9895 useperlio="$define"
9896
9897 : Set the vendorbin variables
9898 case "$vendorprefix" in
9899 '')     d_vendorbin="$undef"
9900         vendorbin=''
9901         vendorbinexp=''
9902         ;;
9903 *)      d_vendorbin="$define"
9904         : determine where vendor-supplied executables go.
9905         case "$vendorbin" in
9906         '') dflt=$vendorprefix/bin ;;
9907         *)      dflt="$vendorbin" ;;
9908         esac
9909         fn=d~+
9910         rp='Pathname for the vendor-supplied executables directory?'
9911         . ./getfile
9912         vendorbin="$ans"
9913         vendorbinexp="$ansexp"
9914         ;;
9915 esac
9916 prefixvar=vendorbin
9917 . ./installprefix
9918
9919 : Set the vendorhtml1dir variables
9920 case "$vendorprefix" in
9921 '')     vendorhtml1dir=''
9922         vendorhtml1direxp=''
9923         ;;
9924 *)      : determine where vendor-supplied html pages go.
9925         : There is no standard location, so try to copy the previously-selected
9926         : directory structure for the core html pages.
9927         : XXX Better default suggestions would be welcome.
9928         case "$vendorhtml1dir" in
9929         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9930         *)      dflt=$vendorhtml1dir ;;
9931         esac
9932         case "$dflt" in
9933         ''|' ') dflt=none ;;
9934         esac
9935         fn=dn+~
9936         rp='Pathname for the vendor-supplied html pages?'
9937         . ./getfile
9938         vendorhtml1dir="$ans"
9939         vendorhtml1direxp="$ansexp"
9940         ;;
9941 esac
9942 : Use ' ' for none so value is preserved next time through Configure
9943 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9944 prefixvar=vendorhtml1dir
9945 . ./installprefix
9946
9947 : Set the vendorhtml3dir variables
9948 case "$vendorprefix" in
9949 '')     vendorhtml3dir=''
9950         vendorhtml3direxp=''
9951         ;;
9952 *)      : determine where vendor-supplied module html pages go.
9953         : There is no standard location, so try to copy the previously-selected
9954         : directory structure for the core html pages.
9955         : XXX Better default suggestions would be welcome.
9956         case "$vendorhtml3dir" in
9957         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9958         *)      dflt=$vendorhtml3dir ;;
9959         esac
9960         case "$dflt" in
9961         ''|' ') dflt=none ;;
9962         esac
9963         fn=dn+~
9964         rp='Pathname for the vendor-supplied html pages?'
9965         . ./getfile
9966         vendorhtml3dir="$ans"
9967         vendorhtml3direxp="$ansexp"
9968         ;;
9969 esac
9970 : Use ' ' for none so value is preserved next time through Configure
9971 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9972 prefixvar=vendorhtml3dir
9973 . ./installprefix
9974
9975 : Set the vendorman1dir variables
9976 case "$vendorprefix" in
9977 '')     vendorman1dir=''
9978         vendorman1direxp=''
9979         ;;
9980 *)      : determine where vendor-supplied manual pages go.
9981         case "$vendorman1dir" in
9982         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9983         *)      dflt=$vendorman1dir ;;
9984         esac
9985         case "$dflt" in
9986         ''|' ') dflt=none ;;
9987         esac
9988         fn=nd~+
9989         rp='Pathname for the vendor-supplied manual section 1 pages?'
9990         . ./getfile
9991         vendorman1dir="$ans"
9992         vendorman1direxp="$ansexp"
9993         ;;
9994 esac
9995 : Use ' ' for none so value is preserved next time through Configure
9996 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9997 prefixvar=vendorman1dir
9998 . ./installprefix
9999
10000 : Set the vendorman3dir variables
10001 case "$vendorprefix" in
10002 '')     vendorman3dir=''
10003         vendorman3direxp=''
10004         ;;
10005 *)      : determine where vendor-supplied module manual pages go.
10006         case "$vendorman3dir" in
10007         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10008         *)      dflt=$vendorman3dir ;;
10009         esac
10010         case "$dflt" in
10011         ''|' ') dflt=none ;;
10012         esac
10013         fn=nd~+
10014         rp='Pathname for the vendor-supplied manual section 3 pages?'
10015         . ./getfile
10016         vendorman3dir="$ans"
10017         vendorman3direxp="$ansexp"
10018         ;;
10019 esac
10020 : Use ' ' for none so value is preserved next time through Configure
10021 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10022 prefixvar=vendorman3dir
10023 . ./installprefix
10024
10025 : Set the vendorscript variables
10026 case "$vendorprefix" in
10027 '')     d_vendorscript="$undef"
10028         vendorscript=''
10029         vendorscriptexp=''
10030         ;;
10031 *)      d_vendorscript="$define"
10032         : determine where vendor-supplied scripts go.
10033         case "$vendorscript" in
10034         '')     dflt=$vendorprefix/script
10035                 $test -d $dflt || dflt=$vendorbin ;;
10036         *)  dflt="$vendorscript" ;;
10037         esac
10038         $cat <<EOM
10039
10040 The installation process will create a directory for
10041 vendor-supplied scripts.
10042
10043 EOM
10044         fn=d~+
10045         rp='Pathname for the vendor-supplied scripts directory?'
10046         . ./getfile
10047         vendorscript="$ans"
10048         vendorscriptexp="$ansexp"
10049         ;;
10050 esac
10051 prefixvar=vendorscript
10052 . ./installprefix
10053
10054 : see if qgcvt exists
10055 set qgcvt d_qgcvt
10056 eval $inlibc
10057
10058 : Check what kind of doubles your system has
10059 $echo "Checking the kind of doubles you have..." >&4
10060 $cat >try.c <<EOP
10061 #$i_stdlib I_STDLIB
10062 #define DOUBLESIZE $doublesize
10063 #ifdef I_STDLIB
10064 #include <stdlib.h>
10065 #endif
10066 #include <stdio.h>
10067 static const double d = -0.1;
10068 int main() {
10069   unsigned const char* b = (unsigned const char*)(&d);
10070 #if DOUBLESIZE == 4
10071   if (b[0] == 0xCD && b[3] == 0xBD) {
10072     /* IEEE 754 32-bit little-endian */
10073     printf("1\n");
10074     exit(0);
10075   }
10076   if (b[0] == 0xBD && b[3] == 0xCD) {
10077     /* IEEE 754 32-bit big-endian */
10078     printf("2\n");
10079     exit(0);
10080   }
10081   if (b[0] == 0xCC && b[3] == 0xCC) {
10082     /* VAX format F, 32-bit PDP-style mixed endian. */
10083     printf("9\n");
10084     exit(0);
10085   }
10086   if (b[0] == 0xC0 && b[3] == 0x9A) {
10087     /* IBM single 32-bit */
10088     printf("12\n");
10089     exit(0);
10090   }
10091 #endif
10092 #if DOUBLESIZE == 8
10093   if (b[0] == 0x9A && b[7] == 0xBF) {
10094     /* IEEE 754 64-bit little-endian */
10095     printf("3\n");
10096     exit(0);
10097   }
10098   if (b[0] == 0xBF && b[7] == 0x9A) {
10099     /* IEEE 754 64-bit big-endian */
10100     printf("4\n");
10101     exit(0);
10102   }
10103   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10104    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10105     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10106     * 99 99 b9 bf 9a 99 99 99 */
10107     printf("7\n");
10108     exit(0);
10109   }
10110   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10111    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10112     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10113     * 99 99 99 9a bf b9 99 99 */
10114     printf("8\n");
10115     exit(0);
10116   }
10117   if (b[0] == 0xCC && b[7] == 0xCC) {
10118    /* VAX format D, 64-bit PDP-style mixed endian. */
10119     printf("10\n");
10120     exit(0);
10121   }
10122   if (b[0] == 0xD9 && b[7] == 0x99) {
10123    /* VAX format G, 64-bit PDP-style mixed endian. */
10124     printf("11\n");
10125     exit(0);
10126   }
10127   if (b[0] == 0xC0 && b[7] == 0x9A) {
10128     /* IBM double 64-bit */
10129     printf("13\n");
10130     exit(0);
10131   }
10132   if (b[0] == 0xBF && b[7] == 0xCD) {
10133     /* CRAY single 64-bit */
10134     printf("14\n");
10135     exit(0);
10136   }
10137 #endif
10138 #if DOUBLESIZE == 16
10139   if (b[0] == 0x9A && b[15] == 0xBF) {
10140     /* IEEE 754 128-bit little-endian */
10141     printf("5\n");
10142     exit(0);
10143   }
10144   if (b[0] == 0xBF && b[15] == 0x9A) {
10145     /* IEEE 754 128-bit big-endian */
10146     printf("6\n");
10147     exit(0);
10148   }
10149 #endif
10150   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10151    * Whether those environments can still build Perl is debatable. */
10152   printf("-1\n"); /* unknown */
10153   exit(0);
10154 }
10155 EOP
10156 set try
10157 if eval $compile; then
10158     doublekind=`$run ./try`
10159 else
10160     doublekind=-1
10161 fi
10162 case "$doublekind" in
10163 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10164 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10165 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10166 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10167 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10168 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10169 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10170 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10171 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10172 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10173 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10174 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10175 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10176 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10177 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10178 esac
10179 d_double_style_ieee=$undef
10180 d_double_style_vax=$undef
10181 d_double_style_ibm=$undef
10182 d_double_style_cray=$undef
10183 case "$doublekind" in
10184 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10185 9|10|11) d_double_style_vax=$define ;;
10186 12|13) d_double_style_ibm=$define ;;
10187 14) d_double_style_cray=$define ;;
10188 esac
10189 case "$d_double_style_ieee" in
10190 $define)
10191     d_double_has_inf=$define
10192     d_double_has_nan=$define
10193     d_double_has_negative_zero=$define
10194     d_double_has_subnormals=$define
10195     ;;
10196 *)
10197     d_double_has_inf=$undef
10198     d_double_has_nan=$undef
10199     d_double_has_negative_zero=$undef
10200     d_double_has_subnormals=$undef
10201     ;;
10202 esac
10203 $rm_try
10204
10205 : Check print/scan long double stuff
10206 echo " "
10207
10208 if $test X"$d_longdbl" = X"$define"; then
10209
10210 echo "Checking how to print long doubles..." >&4
10211
10212 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10213         $cat >try.c <<'EOCP'
10214 #include <sys/types.h>
10215 #include <stdio.h>
10216 int main() {
10217   double d = 123.456;
10218   printf("%.3f\n", d);
10219 }
10220 EOCP
10221         set try
10222         if eval $compile; then
10223                 yyy=`$run ./try`
10224                 case "$yyy" in
10225                 123.456)
10226                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10227                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10228                         echo "We will use %f."
10229                         ;;
10230                 esac
10231         fi
10232 fi
10233
10234 if $test X"$sPRIfldbl" = X; then
10235         $cat >try.c <<'EOCP'
10236 #include <sys/types.h>
10237 #include <stdio.h>
10238 int main() {
10239   long double d = 123.456;
10240   printf("%.3Lf\n", d);
10241 }
10242 EOCP
10243         set try
10244         if eval $compile; then
10245                 yyy=`$run ./try`
10246                 case "$yyy" in
10247                 123.456)
10248                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10249                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10250                         echo "We will use %Lf."
10251                         ;;
10252                 esac
10253         fi
10254 fi
10255
10256 if $test X"$sPRIfldbl" = X; then
10257         $cat >try.c <<'EOCP'
10258 #include <sys/types.h>
10259 #include <stdio.h>
10260 int main() {
10261   long double d = 123.456;
10262   printf("%.3llf\n", d);
10263 }
10264 EOCP
10265         set try
10266         if eval $compile; then
10267                 yyy=`$run ./try`
10268                 case "$yyy" in
10269                 123.456)
10270                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10271                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10272                         echo "We will use %llf."
10273                         ;;
10274                 esac
10275         fi
10276 fi
10277
10278 if $test X"$sPRIfldbl" = X; then
10279         $cat >try.c <<'EOCP'
10280 #include <sys/types.h>
10281 #include <stdio.h>
10282 int main() {
10283   long double d = 123.456;
10284   printf("%.3lf\n", d);
10285 }
10286 EOCP
10287         set try
10288         if eval $compile; then
10289                 yyy=`$run ./try`
10290                 case "$yyy" in
10291                 123.456)
10292                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10293                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10294                         echo "We will use %lf."
10295                         ;;
10296                 esac
10297         fi
10298 fi
10299
10300 if $test X"$sPRIfldbl" = X; then
10301         echo "Cannot figure out how to print long doubles." >&4
10302 else
10303         sSCNfldbl=$sPRIfldbl    # expect consistency
10304 fi
10305
10306 $rm_try
10307
10308 fi # d_longdbl
10309
10310 case "$sPRIfldbl" in
10311 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10312         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10313         d_SCNfldbl="$undef";
10314         ;;
10315 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10316         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10317         d_SCNfldbl="$define";
10318         ;;
10319 esac
10320
10321 : Before committing on uselongdouble, see whether that looks sane.
10322 if $test "$uselongdouble" = "$define"; then
10323     message=""
10324     echo " "
10325     echo "Checking if your long double math functions work right..." >&4
10326     $cat > try.c <<EOF
10327 #include <math.h>
10328 #include <stdio.h>
10329 int main() {
10330   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10331 }
10332 EOF
10333     case "$osname:$gccversion" in
10334     aix:)       saveccflags="$ccflags"
10335                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10336     esac
10337     set try
10338     if eval $compile_ok; then
10339       yyy=`$run ./try`
10340     fi
10341     case "$yyy" in
10342     3) echo "Your long double math functions are working correctly." >&4 ;;
10343     *) echo "Your long double math functions are broken, not using long doubles." >&4
10344        uselongdouble=$undef
10345        ;;
10346     esac
10347     $rm_try
10348     case "$osname:$gccversion" in
10349     aix:)       ccflags="$saveccflags" ;; # restore
10350     esac
10351 fi
10352
10353 : Check how to convert floats to strings.
10354
10355 if test "X$d_Gconvert" = X; then
10356
10357 echo " "
10358 echo "Checking for an efficient way to convert floats to strings."
10359 echo " " > try.c
10360 case "$uselongdouble" in
10361 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10362 esac
10363 case "$d_longdbl" in
10364 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10365 esac
10366 case "$d_PRIgldbl" in
10367 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10368 esac
10369 $cat >>try.c <<EOP
10370 #ifdef TRY_gconvert
10371 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10372 char *myname = "gconvert";
10373 #endif
10374 #ifdef TRY_gcvt
10375 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10376 char *myname = "gcvt";
10377 #endif
10378 #ifdef TRY_qgcvt
10379 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10380 char *myname = "qgcvt";
10381 #define DOUBLETYPE long double
10382 #endif
10383 #ifdef TRY_sprintf
10384 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10385 #ifdef HAS_PRIgldbl
10386 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10387 #else
10388 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10389 #endif
10390 #else
10391 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10392 #endif
10393 char *myname = "sprintf";
10394 #endif
10395
10396 #ifndef DOUBLETYPE
10397 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10398 #define DOUBLETYPE long double
10399 #else
10400 #define DOUBLETYPE double
10401 #endif
10402 #endif
10403
10404 #include <stdio.h>
10405
10406 #$i_stdlib I_STDLIB
10407 #ifdef I_STDLIB
10408 #include <stdlib.h>
10409 #endif
10410 #include <string.h>
10411
10412 int checkit(char *expect, char *got)
10413 {
10414     if (strcmp(expect, got)) {
10415                 printf("%s oddity:  Expected %s, got %s\n",
10416                         myname, expect, got);
10417                 exit(1);
10418         }
10419 }
10420
10421 int main()
10422 {
10423         char buf[64];
10424         buf[63] = '\0';
10425
10426         /* This must be 1st test on (which?) platform */
10427         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10428         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10429         checkit("0.1", buf);
10430
10431         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10432         checkit("0.01", buf);
10433
10434         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10435         checkit("0.001", buf);
10436
10437         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10438         checkit("0.0001", buf);
10439
10440         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10441         if (strlen(buf) > 5)
10442             checkit("9e-005", buf); /* for Microsoft ?? */
10443         else
10444             checkit("9e-05", buf);
10445
10446         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10447         checkit("1", buf);
10448
10449         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10450         checkit("1.1", buf);
10451
10452         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10453         checkit("1.01", buf);
10454
10455         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10456         checkit("1.001", buf);
10457
10458         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10459         checkit("1.0001", buf);
10460
10461         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10462         checkit("1.00001", buf);
10463
10464         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10465         checkit("1.000001", buf);
10466
10467         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10468         checkit("0", buf);
10469
10470         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10471         checkit("-1", buf);
10472
10473         /* Some Linux gcvt's give 1.e+5 here. */
10474         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10475         checkit("100000", 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         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10482         checkit("123.456", buf);
10483
10484         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10485         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10486         /* 34 should be enough to scare even long double
10487          * places into using the e notation. */
10488         if (strlen(buf) > 5)
10489             checkit("1e+034", buf); /* for Microsoft */
10490         else
10491             checkit("1e+34", buf);
10492
10493         /* For Perl, if you add additional tests here, also add them to
10494          * t/base/num.t for benefit of platforms not using Configure or
10495          * overriding d_Gconvert */
10496
10497         exit(0);
10498 }
10499 EOP
10500 : first add preferred functions to our list
10501 xxx_list=""
10502 for xxx_convert in $gconvert_preference; do
10503     case $xxx_convert in
10504     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10505     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10506     esac
10507 done
10508 : then add any others
10509 for xxx_convert in gconvert gcvt sprintf; do
10510     case "$xxx_list" in
10511     *$xxx_convert*) ;;
10512     *) xxx_list="$xxx_list $xxx_convert" ;;
10513     esac
10514 done
10515
10516 case "$d_longdbl$uselongdouble" in
10517 "$define$define")
10518     : again, add preferred functions to our list first
10519     xxx_ld_list=""
10520     for xxx_convert in $gconvert_ld_preference; do
10521         case $xxx_convert in
10522         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10523         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10524         esac
10525     done
10526     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10527     for xxx_convert in qgcvt sprintf $xxx_list; do
10528         case "$xxx_ld_list" in
10529         $xxx_convert*|*" $xxx_convert"*) ;;
10530         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10531         esac
10532     done
10533     : if sprintf cannot do long doubles, move it to the end
10534     if test "$d_PRIgldbl" != "$define"; then
10535         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10536     fi
10537     : if no qgcvt, remove it
10538     if test "$d_qgcvt" != "$define"; then
10539         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10540     fi
10541     : use the ld_list
10542     xxx_list="$xxx_ld_list"
10543     ;;
10544 esac
10545
10546 for xxx_convert in $xxx_list; do
10547         echo "Trying $xxx_convert..."
10548         $rm -f try try$_o core
10549         set try -DTRY_$xxx_convert
10550         if eval $compile; then
10551                 echo "$xxx_convert() found." >&4
10552                 if $run ./try; then
10553                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10554                         break;
10555                 else
10556                         echo "...But $xxx_convert didn't work as I expected."
10557                         xxx_convert=''
10558                 fi
10559         else
10560                 echo "$xxx_convert NOT found." >&4
10561         fi
10562 done
10563
10564 if test X$xxx_convert = X; then
10565     echo "*** WHOA THERE!!! ***" >&4
10566     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10567     xxx_convert=sprintf
10568 fi
10569
10570 case "$xxx_convert" in
10571 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10572 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10573 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10574 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10575    "$define$define$define")
10576       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10577    "$define$define$undef")
10578       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10579    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10580    esac
10581    ;;
10582 esac
10583
10584 fi
10585 $rm_try
10586
10587 : see if _fwalk exists
10588 set fwalk d__fwalk
10589 eval $inlibc
10590
10591 : see if accept4 exists
10592 set accept4 d_accept4
10593 eval $inlibc
10594
10595 : Initialize h_fcntl
10596 h_fcntl=false
10597
10598 : Initialize h_sysfile
10599 h_sysfile=false
10600
10601 : access call always available on UNIX
10602 set access d_access
10603 eval $inlibc
10604
10605 : locate the flags for 'access()'
10606 case "$d_access" in
10607 "$define")
10608         echo " "
10609         $cat >access.c <<EOCP
10610 #include <sys/types.h>
10611 #ifdef I_FCNTL
10612 #include <fcntl.h>
10613 #endif
10614 #ifdef I_SYS_FILE
10615 #include <sys/file.h>
10616 #endif
10617 #ifdef I_UNISTD
10618 #include <unistd.h>
10619 #endif
10620 #$i_stdlib I_STDLIB
10621 #ifdef I_STDLIB
10622 #include <stdlib.h>
10623 #endif
10624 int main() {
10625         exit(R_OK);
10626 }
10627 EOCP
10628         : check sys/file.h first, no particular reason here
10629         if $test `./findhdr sys/file.h` && \
10630                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10631                 h_sysfile=true;
10632                 echo "<sys/file.h> defines the *_OK access constants." >&4
10633         elif $test `./findhdr fcntl.h` && \
10634                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10635                 h_fcntl=true;
10636                 echo "<fcntl.h> defines the *_OK access constants." >&4
10637         elif $test `./findhdr unistd.h` && \
10638                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10639                 echo "<unistd.h> defines the *_OK access constants." >&4
10640         else
10641                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10642         fi
10643         ;;
10644 esac
10645 $rm -f access*
10646
10647 : see if accessx exists
10648 set accessx d_accessx
10649 eval $inlibc
10650
10651 : see if acosh exists
10652 set acosh d_acosh
10653 eval $inlibc
10654
10655 : see if aintl exists
10656 set aintl d_aintl
10657 eval $inlibc
10658
10659 : see if alarm exists
10660 set alarm d_alarm
10661 eval $inlibc
10662
10663 : see if 64bit time functions exists
10664
10665 set ctime64 d_ctime64
10666 eval $inlibc
10667
10668 set localtime64 d_localtime64
10669 eval $inlibc
10670
10671 set gmtime64 d_gmtime64
10672 eval $inlibc
10673
10674 set mktime64 d_mktime64
10675 eval $inlibc
10676
10677 set difftime64 d_difftime64
10678 eval $inlibc
10679
10680 set asctime64 d_asctime64
10681 eval $inlibc
10682
10683 : see if POSIX threads are available
10684 set pthread.h i_pthread
10685 eval $inhdr
10686
10687 : define a function to check prototypes
10688 $cat > protochk <<EOSH
10689 $startsh
10690 cc="$cc"
10691 optimize="$optimize"
10692 ccflags="$ccflags"
10693 define="$define"
10694 rm_try="$rm_try"
10695 usethreads=$usethreads
10696 i_pthread=$i_pthread
10697 pthread_h_first=$pthread_h_first
10698 EOSH
10699
10700 $cat >> protochk <<'EOSH'
10701
10702 $rm_try
10703 foo="$1"
10704 shift
10705 while test $# -ge 2; do
10706         case "$1" in
10707                 $define) echo "#include <$2>" >> try.c ;;
10708                 literal) echo "$2" >> try.c ;;
10709         esac
10710     # Extra magic for the benefit of systems that need pthread.h
10711     # to be included early to correctly detect threadsafe functions.
10712     # Such functions must guarantee themselves, though, that the usethreads
10713     # and i_pthread have been defined, before calling protochk.
10714     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10715         echo "#include <pthread.h>" >> try.c
10716         pthread_h_done=yes
10717     fi
10718     shift 2
10719 done
10720 cat >> try.c <<'EOCP'
10721 #define _(args) args
10722 EOCP
10723 echo "$foo" >> try.c
10724 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10725 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10726 status=$?
10727 $rm_try
10728 exit $status
10729 EOSH
10730 chmod +x protochk
10731 $eunicefix protochk
10732
10733 : Define hasproto macro for Configure internal use
10734 hasproto='varname=$1; func=$2; shift; shift;
10735 while $test $# -ge 2; do
10736         case "$1" in
10737         $define) echo "#include <$2>";;
10738         esac ;
10739     shift 2;
10740 done > try.c;
10741 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10742 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10743         echo "$func() prototype found.";
10744         val="$define";
10745 else
10746         echo "$func() prototype NOT found.";
10747         val="$undef";
10748 fi;
10749 set $varname;
10750 eval $setvar;
10751 $rm_try tryout.c'
10752
10753 : see if sys/types.h has to be included
10754 set sys/types.h i_systypes
10755 eval $inhdr
10756
10757 : see if sys/select.h has to be included
10758 set sys/select.h i_sysselct
10759 eval $inhdr
10760
10761 : Define hasfield macro for Configure internal use
10762 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10763 while $test $# -ge 2; do
10764         case "$1" in
10765         $define) echo "#include <$2>";;
10766         esac ;
10767     shift 2;
10768 done > try.c;
10769 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10770 set try;
10771 if eval $compile; then
10772         val="$define";
10773 else
10774         val="$undef";
10775 fi;
10776 set $varname;
10777 eval $setvar;
10778 $rm_try'
10779
10780 : see if we should include sys/time.h
10781 echo " "
10782 i_time='define'
10783 if test "X$timeincl" = X; then
10784         echo "Testing to see if we should include <sys/time.h>." >&4
10785         $echo $n "I'm now running the test program...$c"
10786         $cat >try.c <<EOCP
10787 #include <sys/types.h>
10788 #include <time.h>
10789 #ifdef I_SYSTIME
10790 #ifdef SYSTIMEKERNEL
10791 #define KERNEL
10792 #endif
10793 #include <sys/time.h>
10794 #endif
10795 #ifdef I_SYSSELECT
10796 #include <sys/select.h>
10797 #endif
10798 #$i_stdlib I_STDLIB
10799 #ifdef I_STDLIB
10800 #include <stdlib.h>
10801 #endif
10802 int main()
10803 {
10804         struct tm foo;
10805 #ifdef S_TIMEVAL
10806         struct timeval bar;
10807 #endif
10808 #ifdef S_TIMEZONE
10809         struct timezone tzp;
10810 #endif
10811         if (foo.tm_sec == foo.tm_sec)
10812                 exit(0);
10813 #ifdef S_TIMEVAL
10814         if (bar.tv_sec == bar.tv_sec)
10815                 exit(0);
10816 #endif
10817         exit(1);
10818 }
10819 EOCP
10820         flags=''
10821         for s_timezone in '-DS_TIMEZONE' ''; do
10822         sysselect=''
10823         for s_timeval in '-DS_TIMEVAL' ''; do
10824         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10825         for i_systime in '-DI_SYSTIME' ''; do
10826                 case "$flags" in
10827                 '') $echo $n ".$c"
10828                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10829                         if eval $compile; then
10830                                 set X $i_systime $i_systimek $sysselect $s_timeval
10831                                 shift
10832                                 flags="$*"
10833                                 echo " "
10834                                 $echo $n "Succeeded with $flags$c"
10835                         fi
10836                         ;;
10837                 esac
10838         done
10839         done
10840         done
10841         done
10842         timeincl=''
10843         echo " "
10844         case "$flags" in
10845         *SYSTIMEKERNEL*) i_systimek="$define"
10846                 timeincl=`./findhdr sys/time.h`
10847                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10848         *) i_systimek="$undef";;
10849         esac
10850         case "$flags" in
10851         *I_SYSTIME*) i_systime="$define"
10852                 timeincl=`./findhdr sys/time.h`" $timeincl"
10853                 echo "We'll include <sys/time.h>." >&4;;
10854         *) i_systime="$undef";;
10855         esac
10856         $rm_try
10857 fi
10858 : see if struct tm knows about tm_zone
10859 case "$i_systime$i_time" in
10860 *$define*)
10861         echo " "
10862         echo "Checking to see if your struct tm has tm_zone field..." >&4
10863         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10864         eval $hasfield
10865         ;;
10866 *)      val="$undef"
10867         set d_tm_tm_zone
10868         eval $setvar
10869         ;;
10870 esac
10871 case "$d_tm_tm_zone" in
10872 "$define")      echo "Yes, it does."   ;;
10873 *)              echo "No, it doesn't." ;;
10874 esac
10875 : see if struct tm knows about tm_gmtoff
10876 case "$i_systime$i_time" in
10877 *$define*)
10878         echo " "
10879         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10880         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10881         eval $hasfield
10882         ;;
10883 *)      val="$undef"
10884         set d_tm_tm_gmtoff
10885         eval $setvar
10886         ;;
10887 esac
10888 case "$d_tm_tm_gmtoff" in
10889 "$define")      echo "Yes, it does."   ;;
10890 *)              echo "No, it doesn't." ;;
10891 esac
10892
10893 : see if asctime_r exists
10894 set asctime_r d_asctime_r
10895 eval $inlibc
10896 case "$d_asctime_r" in
10897 "$define")
10898         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10899         case "$d_asctime_r_proto:$usethreads" in
10900         ":define")      d_asctime_r_proto=define
10901                 set d_asctime_r_proto asctime_r $hdrs
10902                 eval $hasproto ;;
10903         *)      ;;
10904         esac
10905         case "$d_asctime_r_proto" in
10906         define)
10907         case "$asctime_r_proto" in
10908         ''|0) try='char* asctime_r(const struct tm*, char*);'
10909         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10910         esac
10911         case "$asctime_r_proto" in
10912         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10913         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10914         esac
10915         case "$asctime_r_proto" in
10916         ''|0) try='int asctime_r(const struct tm*, char*);'
10917         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10918         esac
10919         case "$asctime_r_proto" in
10920         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10921         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10922         esac
10923         case "$asctime_r_proto" in
10924         ''|0)   d_asctime_r=undef
10925                 asctime_r_proto=0
10926                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10927         * )     case "$asctime_r_proto" in
10928                 REENTRANT_PROTO*) ;;
10929                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10930                 esac
10931                 echo "Prototype: $try" ;;
10932         esac
10933         ;;
10934         *)      case "$usethreads" in
10935                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10936                 esac
10937                 d_asctime_r=undef
10938                 asctime_r_proto=0
10939                 ;;
10940         esac
10941         ;;
10942 *)      asctime_r_proto=0
10943         ;;
10944 esac
10945
10946 : see if asinh exists
10947 set asinh d_asinh
10948 eval $inlibc
10949
10950 : see if atanh exists
10951 set atanh d_atanh
10952 eval $inlibc
10953
10954 : see if atolf exists
10955 set atolf d_atolf
10956 eval $inlibc
10957
10958 : see if atoll exists
10959 set atoll d_atoll
10960 eval $inlibc
10961
10962 : Look for GCC-style attribute format
10963 case "$d_attribute_format" in
10964 '')
10965 echo " "
10966 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10967 $cat >attrib.c <<'EOCP'
10968 #include <stdio.h>
10969 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10970 EOCP
10971 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10972         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10973                 echo "Your C compiler doesn't support __attribute__((format))."
10974                 val="$undef"
10975         else
10976                 echo "Your C compiler supports __attribute__((format))."
10977                 val="$define"
10978         fi
10979 else
10980         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10981         val="$undef"
10982 fi
10983 ;;
10984 *) val="$d_attribute_format" ;;
10985 esac
10986 set d_attribute_format
10987 eval $setvar
10988 $rm -f attrib*
10989
10990 : Look for GCC-style attribute format with null format allowed
10991 case "$d_printf_format_null" in
10992 '') case "$d_attribute_format" in
10993     $define)
10994         echo " "
10995         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10996 $cat >attrib.c <<EOCP
10997 #include <stdio.h>
10998 #$i_stdlib I_STDLIB
10999 #ifdef I_STDLIB
11000 #include <stdlib.h>
11001 #endif
11002 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11003 int null_printf (char* pat,...) { return (int)pat; }
11004 int main () { exit(null_printf(NULL)); }
11005 EOCP
11006         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11007             : run the executable in case it produces a run-time warning
11008             if $run ./attrib >>attrib.out 2>&1; then
11009                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11010                     echo "Your C compiler doesn't allow __printf__ format to be null."
11011                     val="$undef"
11012                 else
11013                     echo "Your C compiler allows __printf__ format to be null."
11014                     val="$define"
11015                 fi
11016             else
11017             echo "Your C compiler executable failed with __printf__ format null."
11018             val="$undef"
11019         fi
11020     else
11021         echo "Your C compiler fails with __printf__ format null."
11022         val="$undef"
11023     fi
11024     ;;
11025     *)  val="$undef" ;;
11026     esac
11027 ;;
11028 *)  val="$d_printf_format_null" ;;
11029 esac
11030 set d_printf_format_null
11031 eval $setvar
11032 $rm -f attrib*
11033
11034 : Look for GCC-style attribute malloc
11035 case "$d_attribute_malloc" in
11036 '')
11037 echo " "
11038 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11039 $cat >attrib.c <<'EOCP'
11040 #include <stdio.h>
11041 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11042 EOCP
11043 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11044         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11045                 echo "Your C compiler doesn't support __attribute__((malloc))."
11046                 val="$undef"
11047         else
11048                 echo "Your C compiler supports __attribute__((malloc))."
11049                 val="$define"
11050         fi
11051 else
11052         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11053         val="$undef"
11054 fi
11055 ;;
11056 *) val="$d_attribute_malloc" ;;
11057 esac
11058 set d_attribute_malloc
11059 eval $setvar
11060 $rm -f attrib*
11061
11062 : Look for GCC-style attribute nonnull
11063 case "$d_attribute_nonnull" in
11064 '')
11065 echo " "
11066 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11067 $cat >attrib.c <<'EOCP'
11068 #include <stdio.h>
11069 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11070 EOCP
11071 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11072         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11073                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11074                 val="$undef"
11075         else
11076                 echo "Your C compiler supports __attribute__((nonnull))."
11077                 val="$define"
11078         fi
11079 else
11080         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11081         val="$undef"
11082 fi
11083 ;;
11084 *) val="$d_attribute_nonnull" ;;
11085 esac
11086 set d_attribute_nonnull
11087 eval $setvar
11088 $rm -f attrib*
11089
11090 : Look for GCC-style attribute noreturn
11091 case "$d_attribute_noreturn" in
11092 '')
11093 echo " "
11094 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11095 $cat >attrib.c <<'EOCP'
11096 #include <stdio.h>
11097 void fall_over_dead( void ) __attribute__((noreturn));
11098 EOCP
11099 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11100         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11101                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11102                 val="$undef"
11103         else
11104                 echo "Your C compiler supports __attribute__((noreturn))."
11105                 val="$define"
11106         fi
11107 else
11108         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11109         val="$undef"
11110 fi
11111 ;;
11112 *) val="$d_attribute_noreturn" ;;
11113 esac
11114 set d_attribute_noreturn
11115 eval $setvar
11116 $rm -f attrib*
11117
11118 : Look for GCC-style attribute pure
11119 case "$d_attribute_pure" in
11120 '')
11121 echo " "
11122 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11123 $cat >attrib.c <<'EOCP'
11124 #include <stdio.h>
11125 int square( int n ) __attribute__((pure));
11126 EOCP
11127 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11128         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11129                 echo "Your C compiler doesn't support __attribute__((pure))."
11130                 val="$undef"
11131         else
11132                 echo "Your C compiler supports __attribute__((pure))."
11133                 val="$define"
11134         fi
11135 else
11136         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11137         val="$undef"
11138 fi
11139 ;;
11140 *) val="$d_attribute_pure" ;;
11141 esac
11142 set d_attribute_pure
11143 eval $setvar
11144 $rm -f attrib*
11145
11146 : Look for GCC-style attribute unused
11147 case "$d_attribute_unused" in
11148 '')
11149 echo " "
11150 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11151 $cat >attrib.c <<'EOCP'
11152 #include <stdio.h>
11153 int do_something( int dummy __attribute__((unused)), int n );
11154 EOCP
11155 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11156         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11157                 echo "Your C compiler doesn't support __attribute__((unused))."
11158                 val="$undef"
11159         else
11160                 echo "Your C compiler supports __attribute__((unused))."
11161                 val="$define"
11162         fi
11163 else
11164         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11165         val="$undef"
11166 fi
11167 ;;
11168 *) val="$d_attribute_unused" ;;
11169 esac
11170 set d_attribute_unused
11171 eval $setvar
11172 $rm -f attrib*
11173
11174 : Look for GCC-style attribute deprecated
11175 case "$d_attribute_deprecated" in
11176 '')
11177 echo " "
11178 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11179 $cat >attrib.c <<'EOCP'
11180 #include <stdio.h>
11181 int I_am_deprecated(void) __attribute__((deprecated));
11182 EOCP
11183 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11184         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11185                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11186                 val="$undef"
11187         else
11188                 echo "Your C compiler supports __attribute__((deprecated))."
11189                 val="$define"
11190         fi
11191 else
11192         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11193         val="$undef"
11194 fi
11195 ;;
11196 *) val="$d_attribute_deprecated" ;;
11197 esac
11198 set d_attribute_deprecated
11199 eval $setvar
11200 $rm -f attrib*
11201
11202 : Look for GCC-style attribute warn_unused_result
11203 case "$d_attribute_warn_unused_result" in
11204 '')
11205 echo " "
11206 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11207 $cat >attrib.c <<'EOCP'
11208 #include <stdio.h>
11209 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11210 EOCP
11211 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11212         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11213                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11214                 val="$undef"
11215         else
11216                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11217                 val="$define"
11218         fi
11219 else
11220         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11221         val="$undef"
11222 fi
11223 ;;
11224 *) val="$d_attribute_warn_unused_result" ;;
11225 esac
11226 set d_attribute_warn_unused_result
11227 eval $setvar
11228 $rm -f attrib*
11229
11230 : see if getpgrp exists
11231 set getpgrp d_getpgrp
11232 eval $inlibc
11233
11234 case "$d_getpgrp" in
11235 "$define")
11236         echo " "
11237         echo "Checking to see which flavor of getpgrp is in use..."
11238         $cat >try.c <<EOP
11239 #$i_unistd I_UNISTD
11240 #include <sys/types.h>
11241 #ifdef I_UNISTD
11242 #  include <unistd.h>
11243 #endif
11244 #$i_stdlib I_STDLIB
11245 #ifdef I_STDLIB
11246 #include <stdlib.h>
11247 #endif
11248 int main()
11249 {
11250         if (getuid() == 0) {
11251                 printf("(I see you are running Configure as super-user...)\n");
11252                 setuid(1);
11253         }
11254 #ifdef TRY_BSD_PGRP
11255         if (getpgrp(1) == 0)
11256                 exit(0);
11257 #else
11258         if (getpgrp() > 0)
11259                 exit(0);
11260 #endif
11261         exit(1);
11262 }
11263 EOP
11264         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11265                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11266                 val="$define"
11267         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11268                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11269                 val="$undef"
11270         else
11271                 echo "I can't seem to compile and run the test program."
11272                 if ./usg; then
11273                         xxx="a USG one, i.e. you use getpgrp()."
11274                 else
11275                         # SVR4 systems can appear rather BSD-ish.
11276                         case "$i_unistd" in
11277                         $undef)
11278                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11279                                 val="$define"
11280                                 ;;
11281                         $define)
11282                                 xxx="probably a USG one, i.e. you use getpgrp()."
11283                                 val="$undef"
11284                                 ;;
11285                         esac
11286                 fi
11287                 echo "Assuming your getpgrp is $xxx" >&4
11288         fi
11289         ;;
11290 *) val="$undef";;
11291 esac
11292 set d_bsdgetpgrp
11293 eval $setvar
11294 $rm_try
11295
11296 : see if setpgrp exists
11297 set setpgrp d_setpgrp
11298 eval $inlibc
11299
11300 case "$d_setpgrp" in
11301 "$define")
11302         echo " "
11303         echo "Checking to see which flavor of setpgrp is in use..."
11304         $cat >try.c <<EOP
11305 #$i_unistd I_UNISTD
11306 #include <sys/types.h>
11307 #ifdef I_UNISTD
11308 #  include <unistd.h>
11309 #endif
11310 #$i_stdlib I_STDLIB
11311 #ifdef I_STDLIB
11312 #include <stdlib.h>
11313 #endif
11314 int main()
11315 {
11316         if (getuid() == 0) {
11317                 printf("(I see you are running Configure as super-user...)\n");
11318                 setuid(1);
11319         }
11320 #ifdef TRY_BSD_PGRP
11321         if (-1 == setpgrp(1, 1))
11322                 exit(0);
11323 #else
11324         if (setpgrp() != -1)
11325                 exit(0);
11326 #endif
11327         exit(1);
11328 }
11329 EOP
11330         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11331                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11332                 val="$define"
11333         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11334                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11335                 val="$undef"
11336         else
11337                 echo "(I can't seem to compile and run the test program.)"
11338                 if ./usg; then
11339                         xxx="a USG one, i.e. you use setpgrp()."
11340                 else
11341                         # SVR4 systems can appear rather BSD-ish.
11342                         case "$i_unistd" in
11343                         $undef)
11344                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11345                                 val="$define"
11346                                 ;;
11347                         $define)
11348                                 xxx="probably a USG one, i.e. you use setpgrp()."
11349                                 val="$undef"
11350                                 ;;
11351                         esac
11352                 fi
11353                 echo "Assuming your setpgrp is $xxx" >&4
11354         fi
11355         ;;
11356 *) val="$undef";;
11357 esac
11358 set d_bsdsetpgrp
11359 eval $setvar
11360 $rm_try
11361
11362 : Look for GCC-style __builtin_add_overflow
11363 case "$d_builtin_add_overflow" in
11364 '')
11365     echo " "
11366     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11367     $cat >try.c <<'EOCP'
11368 int main(void) {
11369     const unsigned int uint_max = ~0u;
11370     int target_int = 0;
11371     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11372         return 1;
11373     }
11374     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11375         return 1;
11376     }
11377     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11378         return 1;
11379     }
11380     return 0;
11381 }
11382 EOCP
11383     set try
11384     if eval $compile && $run ./try; then
11385         echo "Your C compiler supports __builtin_add_overflow."
11386         val="$define"
11387     else
11388         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11389         val="$undef"
11390     fi
11391     ;;
11392 *) val="$d_builtin_add_overflow" ;;
11393 esac
11394
11395 set d_builtin_add_overflow
11396 eval $setvar
11397 $rm_try
11398
11399 : Look for GCC-style __builtin_sub_overflow
11400 case "$d_builtin_sub_overflow" in
11401 '')
11402     echo " "
11403     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11404     $cat >try.c <<'EOCP'
11405 int main(void) {
11406     const unsigned int uint_max = ~0u;
11407     int target_int = 0;
11408     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11409         return 1;
11410     }
11411     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11412         return 1;
11413     }
11414     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11415         return 1;
11416     }
11417     return 0;
11418 }
11419 EOCP
11420     set try
11421     if eval $compile && $run ./try; then
11422         echo "Your C compiler supports __builtin_sub_overflow."
11423         val="$define"
11424     else
11425         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11426         val="$undef"
11427     fi
11428     ;;
11429 *) val="$d_builtin_sub_overflow" ;;
11430 esac
11431
11432 set d_builtin_sub_overflow
11433 eval $setvar
11434 $rm_try
11435
11436 : Look for GCC-style __builtin_mul_overflow
11437 case "$d_builtin_mul_overflow" in
11438 '')
11439     echo " "
11440     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11441     $cat >try.c <<'EOCP'
11442 int main(void) {
11443     const unsigned int uint_max = ~0u;
11444     int target_int = 0;
11445     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11446         return 1;
11447     }
11448     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11449         return 1;
11450     }
11451     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11452         return 1;
11453     }
11454     return 0;
11455 }
11456 EOCP
11457     set try
11458     if eval $compile && $run ./try; then
11459         echo "Your C compiler supports __builtin_mul_overflow."
11460         val="$define"
11461     else
11462         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11463         val="$undef"
11464     fi
11465     ;;
11466 *) val="$d_builtin_mul_overflow" ;;
11467 esac
11468
11469 set d_builtin_mul_overflow
11470 eval $setvar
11471 $rm_try
11472
11473 : Look for GCC-style __builtin_choose_expr
11474 case "$d_builtin_choose_expr" in
11475 '')
11476     echo " "
11477     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11478     $cat >try.c <<'EOCP'
11479 #include <assert.h>
11480 #include <stdlib.h>
11481 #include <stdio.h>
11482
11483 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11484
11485 int main(void) {
11486     assert( SYRINX(1) == 2112 );
11487     assert( SYRINX(1) != 5150 );
11488     assert( SYRINX(0) == 5150 );
11489     assert( SYRINX(0) != 2112 );
11490     puts( "All good!" );
11491     exit(0);
11492 }
11493
11494 EOCP
11495     set try
11496     if eval $compile && $run ./try; then
11497         echo "Your C compiler supports __builtin_choose_expr."
11498         val="$define"
11499     else
11500         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11501         val="$undef"
11502     fi
11503 ;;
11504 *) val="$d_builtin_choose_expr" ;;
11505 esac
11506
11507 set d_builtin_choose_expr
11508 eval $setvar
11509 $rm_try
11510
11511 : Look for GCC-style __builtin_expect
11512 case "$d_builtin_expect" in
11513 '')
11514     echo " "
11515     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11516     $cat >try.c <<'EOCP'
11517 int main(void) {
11518     int n = 50;
11519     if ( __builtin_expect(n, 0) ) n = 1;
11520     /* Remember shell exit code truth is 0, C truth is non-zero */
11521     return !(n == 1);
11522 }
11523 EOCP
11524     set try
11525     if eval $compile && $run ./try; then
11526         echo "Your C compiler supports __builtin_expect."
11527         val="$define"
11528     else
11529         echo "Your C compiler doesn't seem to understand __builtin_expect."
11530         val="$undef"
11531     fi
11532     ;;
11533 *) val="$d_builtin_expect" ;;
11534 esac
11535
11536 set d_builtin_expect
11537 eval $setvar
11538 $rm_try
11539
11540 : see if the Compiler supports C99 variadic macros
11541 echo "Checking for C99 variadic macros." >&4
11542 $cat >try.c <<EOCP
11543 #include <stdio.h>
11544 #include <stdarg.h>
11545
11546 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11547
11548 int main() {
11549   char buf[20];
11550   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11551   puts(buf);
11552   return 0;
11553 }
11554 EOCP
11555 set try
11556 if eval $compile && $run ./try 2>&1 >/dev/null; then
11557     case "`$run ./try`" in
11558         "123 456 789")
11559         echo "You have C99 variadic macros." >&4
11560         d_c99_variadic_macros="$define"
11561         ;;
11562         *)
11563         echo "You don't have functional C99 variadic macros." >&4
11564         d_c99_variadic_macros="$undef"
11565         ;;
11566     esac
11567 else
11568     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11569     d_c99_variadic_macros="$undef"
11570 fi
11571 $rm_try
11572
11573 : see if signal is declared as pointer to function returning int or void
11574 echo " "
11575 xxx=`./findhdr signal.h`
11576 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11577 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11578         echo "You have int (*signal())() instead of void." >&4
11579         val="$undef"
11580 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11581         echo "You have void (*signal())()." >&4
11582         val="$define"
11583 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11584         echo "You have int (*signal())() instead of void." >&4
11585         val="$undef"
11586 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11587         echo "You have void (*signal())()." >&4
11588         val="$define"
11589 else
11590         case "$d_voidsig" in
11591         '')
11592         echo "I can't determine whether signal handler returns void or int..." >&4
11593                 dflt=void
11594                 rp="What type does your signal handler return?"
11595                 . ./myread
11596                 case "$ans" in
11597                 v*) val="$define";;
11598                 *) val="$undef";;
11599                 esac;;
11600         "$define")
11601                 echo "As you already told me, signal handler returns void." >&4
11602                 val="$define"
11603                 ;;
11604         *)      echo "As you already told me, signal handler returns int." >&4
11605                 val="$undef"
11606                 ;;
11607         esac
11608 fi
11609 set d_voidsig
11610 eval $setvar
11611 case "$d_voidsig" in
11612 "$define") signal_t="void";;
11613 *) signal_t="int";;
11614 esac
11615 $rm -f $$.tmp
11616
11617 : check for ability to cast large floats to 32-bit ints.
11618 echo " "
11619 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11620 if $test "$intsize" -ge 4; then
11621         xxx=int
11622 else
11623         xxx=long
11624 fi
11625 $cat >try.c <<EOCP
11626 #include <stdio.h>
11627 #$i_stdlib I_STDLIB
11628 #ifdef I_STDLIB
11629 #include <stdlib.h>
11630 #endif
11631 #include <sys/types.h>
11632 #include <signal.h>
11633 $signal_t blech(int s) { exit(3); }
11634 int main()
11635 {
11636         $xxx i32;
11637         double f, g;
11638         int result = 0;
11639         char str[16];
11640         signal(SIGFPE, blech);
11641
11642         /* Don't let compiler optimize the test away.  Store the number
11643            in a writable string for gcc to pass to sscanf under HP-UX.
11644         */
11645         sprintf(str, "2147483647");
11646         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11647         g = 10 * f;
11648         i32  = ($xxx) g;
11649
11650         /* x86 processors will probably give 0x8000 0000, which is a
11651            sign change.  We don't want that.  We want to mimic SPARC
11652            behavior here, which is to preserve the sign and give
11653            back 0x7fff ffff.
11654         */
11655         if (i32 != ($xxx) f)
11656                 result |= 1;
11657         exit(result);
11658 }
11659 EOCP
11660 set try
11661 if eval $compile_ok; then
11662         $run ./try 2>/dev/null
11663         yyy=$?
11664 else
11665         echo "(I can't seem to compile the test program--assuming it can't)"
11666         yyy=1
11667 fi
11668 case "$yyy" in
11669 0)      val="$define"
11670         echo "Yup, it can."
11671         ;;
11672 *)      val="$undef"
11673         echo "Nope, it can't."
11674         ;;
11675 esac
11676 set d_casti32
11677 eval $setvar
11678 $rm_try
11679
11680 : check for ability to cast negative floats to unsigned
11681 echo " "
11682 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11683 $cat >try.c <<EOCP
11684 #include <stdio.h>
11685 #$i_stdlib I_STDLIB
11686 #ifdef I_STDLIB
11687 #include <stdlib.h>
11688 #endif
11689 #include <sys/types.h>
11690 #include <signal.h>
11691 $signal_t blech(int s) { exit(7); }
11692 $signal_t blech_in_list(int s) { exit(4); }
11693 unsigned long dummy_long(unsigned long p) { return p; }
11694 unsigned int dummy_int(unsigned int p) { return p; }
11695 unsigned short dummy_short(unsigned short p) { return p; }
11696 int main()
11697 {
11698         double f;
11699         unsigned long along;
11700         unsigned int aint;
11701         unsigned short ashort;
11702         int result = 0;
11703         char str[16];
11704
11705         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11706            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11707            optimized the whole file away
11708         */
11709         /* Store the number in a writable string for gcc to pass to
11710            sscanf under HP-UX.
11711         */
11712         sprintf(str, "-123");
11713         sscanf(str, "%lf", &f);  /* f = -123.; */
11714
11715         signal(SIGFPE, blech);
11716         along = (unsigned long)f;
11717         aint = (unsigned int)f;
11718         ashort = (unsigned short)f;
11719         if (along != (unsigned long)-123)
11720                 result |= 1;
11721         if (aint != (unsigned int)-123)
11722                 result |= 1;
11723         if (ashort != (unsigned short)-123)
11724                 result |= 1;
11725         sprintf(str, "1073741824.");
11726         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11727         f = f + f;
11728         along = 0;
11729         along = (unsigned long)f;
11730         if (along != 0x80000000)
11731                 result |= 2;
11732         f -= 1.;
11733         along = 0;
11734         along = (unsigned long)f;
11735         if (along != 0x7fffffff)
11736                 result |= 1;
11737         f += 2.;
11738         along = 0;
11739         along = (unsigned long)f;
11740         if (along != 0x80000001)
11741                 result |= 2;
11742         if (result)
11743                 exit(result);
11744         signal(SIGFPE, blech_in_list);
11745         sprintf(str, "123.");
11746         sscanf(str, "%lf", &f);  /* f = 123.; */
11747         along = dummy_long((unsigned long)f);
11748         aint = dummy_int((unsigned int)f);
11749         ashort = dummy_short((unsigned short)f);
11750         if (along != (unsigned long)123)
11751                 result |= 4;
11752         if (aint != (unsigned int)123)
11753                 result |= 4;
11754         if (ashort != (unsigned short)123)
11755                 result |= 4;
11756         exit(result);
11757
11758 }
11759 EOCP
11760 set try
11761 if eval $compile_ok; then
11762         $run ./try 2>/dev/null
11763         castflags=$?
11764 else
11765         echo "(I can't seem to compile the test program--assuming it can't)"
11766         castflags=7
11767 fi
11768 case "$castflags" in
11769 0)      val="$define"
11770         echo "Yup, it can."
11771         ;;
11772 *)      val="$undef"
11773         echo "Nope, it can't."
11774         ;;
11775 esac
11776 set d_castneg
11777 eval $setvar
11778 $rm_try
11779
11780 : see if cbrt exists
11781 set cbrt d_cbrt
11782 eval $inlibc
11783
11784 : see if chown exists
11785 set chown d_chown
11786 eval $inlibc
11787
11788 : see if chroot exists
11789 set chroot d_chroot
11790 eval $inlibc
11791
11792 : see if chsize exists
11793 set chsize d_chsize
11794 eval $inlibc
11795
11796 : see if class exists
11797 set class d_class
11798 eval $inlibc
11799
11800 : see if clearenv exists
11801 set clearenv d_clearenv
11802 eval $inlibc
11803
11804 : Define hasstruct macro for Configure internal use
11805 hasstruct='varname=$1; struct=$2; shift; shift;
11806 while $test $# -ge 2; do
11807         case "$1" in
11808         $define) echo "#include <$2>";;
11809         esac ;
11810     shift 2;
11811 done > try.c;
11812 echo "int main () { struct $struct foo; }" >> try.c;
11813 set try;
11814 if eval $compile; then
11815         val="$define";
11816 else
11817         val="$undef";
11818 fi;
11819 set $varname;
11820 eval $setvar;
11821 $rm_try'
11822
11823 : see whether socket exists
11824 socketlib=''
11825 sockethdr=''
11826 echo " "
11827 $echo $n "Hmm... $c" >&4
11828 if set socket val -f d_socket; eval $csym; $val; then
11829     echo "Looks like you have Berkeley networking support." >&4
11830     d_socket="$define"
11831     if set setsockopt val -f; eval $csym; $val; then
11832         d_oldsock="$undef"
11833     else
11834         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11835         d_oldsock="$define"
11836     fi
11837 else
11838     if $contains socklib libc.list >/dev/null 2>&1; then
11839         echo "Looks like you have Berkeley networking support." >&4
11840         d_socket="$define"
11841         : we will have to assume that it supports the 4.2 BSD interface
11842         d_oldsock="$undef"
11843     else
11844         echo "You don't have Berkeley networking in libc$_a..." >&4
11845         if test "X$d_socket" = "X$define"; then
11846             echo "...but you seem to believe that you have sockets." >&4
11847         else
11848             for net in net socket
11849             do
11850                 if test -f $sysroot/usr/lib/lib$net$_a; then
11851                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11852                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11853                     if $contains socket libc.list >/dev/null 2>&1; then
11854                         d_socket="$define"
11855                         socketlib="-l$net"
11856                         case "$net" in
11857                         net)
11858                             echo "...but the Wollongong group seems to have hacked it in." >&4
11859                             sockethdr="-I$sysroot/usr/netinclude"
11860                             ;;
11861                         esac
11862                         echo "Found Berkeley sockets interface in lib$net." >&4
11863                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11864                             d_oldsock="$undef"
11865                         else
11866                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11867                             d_oldsock="$define"
11868                         fi
11869                         break
11870                     fi
11871                 fi
11872             done
11873             if test "X$d_socket" != "X$define"; then
11874                echo "or anywhere else I see." >&4
11875                d_socket="$undef"
11876                d_oldsock="$undef"
11877             fi
11878         fi
11879     fi
11880 fi
11881
11882 : see if socketpair exists
11883 set socketpair d_sockpair
11884 eval $inlibc
11885
11886
11887 echo " "
11888 echo "Checking the availability sa_len in the sock struct ..." >&4
11889 $cat >try.c <<EOF
11890 #include <sys/types.h>
11891 #include <sys/socket.h>
11892 int main() {
11893 struct sockaddr sa;
11894 return (sa.sa_len);
11895 }
11896 EOF
11897 val="$undef"
11898 set try; if eval $compile; then
11899     val="$define"
11900 fi
11901 set d_sockaddr_sa_len; eval $setvar
11902 $rm_try
11903
11904 echo " "
11905 echo "Checking the availability struct sockaddr_in6 ..." >&4
11906 $cat >try.c <<EOF
11907 #include <sys/types.h>
11908 #include <sys/socket.h>
11909 #include <netinet/in.h>
11910 int main() {
11911 struct sockaddr_in6 sin6;
11912 return (sin6.sin6_family);
11913 }
11914 EOF
11915 val="$undef"
11916 set try; if eval $compile; then
11917     val="$define"
11918 fi
11919 set d_sockaddr_in6; eval $setvar
11920 $rm_try
11921
11922 echo " "
11923 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11924 $cat >try.c <<EOF
11925 #include <sys/types.h>
11926 #include <sys/socket.h>
11927 #include <netinet/in.h>
11928 int main() {
11929 struct sockaddr_in6 sin6;
11930 return (sin6.sin6_scope_id);
11931 }
11932 EOF
11933 val="$undef"
11934 set try; if eval $compile; then
11935     val="$define"
11936 fi
11937 set d_sin6_scope_id; eval $setvar
11938 $rm_try
11939
11940 echo " "
11941 echo "Checking the availability struct ip_mreq ..." >&4
11942 $cat >try.c <<EOF
11943 #include <sys/types.h>
11944 #include <sys/socket.h>
11945 #include <netinet/in.h>
11946 int main() {
11947 struct ip_mreq mreq;
11948 return (mreq.imr_multiaddr.s_addr);
11949 }
11950 EOF
11951 val="$undef"
11952 set try; if eval $compile; then
11953        val="$define"
11954 fi
11955 set d_ip_mreq; eval $setvar
11956 $rm_try
11957
11958 echo " "
11959 echo "Checking the availability struct ip_mreq_source ..." >&4
11960 $cat >try.c <<EOF
11961 #include <sys/types.h>
11962 #include <sys/socket.h>
11963 #include <netinet/in.h>
11964 int main() {
11965 struct ip_mreq_source mreq;
11966 return (mreq.imr_multiaddr.s_addr);
11967 }
11968 EOF
11969 val="$undef"
11970 set try; if eval $compile; then
11971        val="$define"
11972 fi
11973 set d_ip_mreq_source; eval $setvar
11974 $rm_try
11975
11976 echo " "
11977 echo "Checking the availability struct ipv6_mreq ..." >&4
11978 $cat >try.c <<EOF
11979 #include <sys/types.h>
11980 #include <sys/socket.h>
11981 #include <netinet/in.h>
11982 int main() {
11983 struct ipv6_mreq mreq;
11984 return (mreq.ipv6mr_interface);
11985 }
11986 EOF
11987 val="$undef"
11988 set try; if eval $compile; then
11989     val="$define"
11990 fi
11991 set d_ipv6_mreq; eval $setvar
11992 $rm_try
11993
11994 echo " "
11995 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11996 $cat >try.c <<EOF
11997 #include <sys/types.h>
11998 #include <sys/socket.h>
11999 #include <netinet/in.h>
12000 int main() {
12001 struct ipv6_mreq_source mreq;
12002 return (mreq.imr_multiaddr.s_addr);
12003 }
12004 EOF
12005 val="$undef"
12006 set try; if eval $compile; then
12007        val="$define"
12008 fi
12009 set d_ipv6_mreq_source; eval $setvar
12010 $rm_try
12011
12012 echo " "
12013 echo "Checking the availability of certain socket constants..." >&4
12014 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12015     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12016     $cat >try.c <<EOF
12017 #include <sys/types.h>
12018 #include <sys/socket.h>
12019 int main() {
12020     int i = $ENUM;
12021 }
12022 EOF
12023     val="$undef"
12024     set try; if eval $compile; then
12025         val="$define"
12026     fi
12027     set d_${enum}; eval $setvar
12028     $rm_try
12029 done
12030
12031 : see if this is a sys/uio.h system
12032 set sys/uio.h i_sysuio
12033 eval $inhdr
12034
12035 : Check for cmsghdr support
12036 echo " "
12037 echo "Checking to see if your system supports struct cmsghdr..." >&4
12038 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12039 eval $hasstruct
12040 case "$d_cmsghdr_s" in
12041 "$define")      echo "Yes, it does."   ;;
12042 *)              echo "No, it doesn't." ;;
12043 esac
12044
12045
12046 : check for const keyword
12047 echo " "
12048 echo 'Checking to see if your C compiler knows about "const"...' >&4
12049 $cat >const.c <<'EOCP'
12050 typedef struct spug { int drokk; } spug;
12051 int main()
12052 {
12053         const char *foo;
12054         const spug y = { 0 };
12055 }
12056 EOCP
12057 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12058         val="$define"
12059         echo "Yup, it does."
12060 else
12061         val="$undef"
12062         echo "Nope, it doesn't."
12063 fi
12064 set d_const
12065 eval $setvar
12066
12067 : see if copysign exists
12068 set copysign d_copysign
12069 eval $inlibc
12070
12071 : see if copysignl exists
12072 set copysignl d_copysignl
12073 eval $inlibc
12074
12075 : see if crypt exists
12076 echo " "
12077 set crypt d_crypt
12078 eval $inlibc
12079 case "$d_crypt" in
12080 $define) cryptlib='' ;;
12081 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12082                 echo 'crypt() found.' >&4
12083                 val="$define"
12084                 cryptlib=''
12085         else
12086                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12087                 if $test -z "$cryptlib"; then
12088                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12089                 else
12090                         cryptlib=-lcrypt
12091                 fi
12092                 if $test -z "$cryptlib"; then
12093                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12094                 else
12095                         cryptlib=-lcrypt
12096                 fi
12097                 if $test -z "$cryptlib"; then
12098                         cryptlib=`./loc libcrypt$_a "" $libpth`
12099                 else
12100                         cryptlib=-lcrypt
12101                 fi
12102                 if $test -z "$cryptlib"; then
12103                         echo 'crypt() NOT found.' >&4
12104                         val="$undef"
12105                 else
12106                         val="$define"
12107                 fi
12108         fi
12109         set d_crypt
12110         eval $setvar
12111         ;;
12112 esac
12113
12114 : see if this is a crypt.h system
12115 set crypt.h i_crypt
12116 eval $inhdr
12117
12118 : see if crypt_r exists
12119 set crypt_r d_crypt_r
12120 eval $inlibc
12121 case "$d_crypt_r" in
12122 "$define")
12123         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12124         case "$d_crypt_r_proto:$usethreads" in
12125         ":define")      d_crypt_r_proto=define
12126                 set d_crypt_r_proto crypt_r $hdrs
12127                 eval $hasproto ;;
12128         *)      ;;
12129         esac
12130         case "$d_crypt_r_proto" in
12131         define)
12132         case "$crypt_r_proto" in
12133         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12134         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12135         esac
12136         case "$crypt_r_proto" in
12137         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12138         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12139         esac
12140         case "$crypt_r_proto" in
12141         ''|0)   d_crypt_r=undef
12142                 crypt_r_proto=0
12143                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12144         * )     case "$crypt_r_proto" in
12145                 REENTRANT_PROTO*) ;;
12146                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12147                 esac
12148                 echo "Prototype: $try" ;;
12149         esac
12150         ;;
12151         *)      case "$usethreads" in
12152                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12153                 esac
12154                 d_crypt_r=undef
12155                 crypt_r_proto=0
12156                 ;;
12157         esac
12158         ;;
12159 *)      crypt_r_proto=0
12160         ;;
12161 esac
12162
12163 : get csh whereabouts
12164 case "$csh" in
12165 'csh') val="$undef" ;;
12166 *) val="$define" ;;
12167 esac
12168 set d_csh
12169 eval $setvar
12170 : Respect a hint or command line value for full_csh.
12171 case "$full_csh" in
12172 '') full_csh=$csh ;;
12173 esac
12174
12175 : see if ctermid exists
12176 set ctermid d_ctermid
12177 eval $inlibc
12178
12179 : see if ctermid_r exists
12180 set ctermid_r d_ctermid_r
12181 eval $inlibc
12182 case "$d_ctermid_r" in
12183 "$define")
12184         hdrs="$i_systypes sys/types.h define stdio.h "
12185         case "$d_ctermid_r_proto:$usethreads" in
12186         ":define")      d_ctermid_r_proto=define
12187                 set d_ctermid_r_proto ctermid_r $hdrs
12188                 eval $hasproto ;;
12189         *)      ;;
12190         esac
12191         case "$d_ctermid_r_proto" in
12192         define)
12193         case "$ctermid_r_proto" in
12194         ''|0) try='char* ctermid_r(char*);'
12195         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12196         esac
12197         case "$ctermid_r_proto" in
12198         ''|0)   d_ctermid_r=undef
12199                 ctermid_r_proto=0
12200                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12201         * )     case "$ctermid_r_proto" in
12202                 REENTRANT_PROTO*) ;;
12203                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12204                 esac
12205                 echo "Prototype: $try" ;;
12206         esac
12207         ;;
12208         *)      case "$usethreads" in
12209                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12210                 esac
12211                 d_ctermid_r=undef
12212                 ctermid_r_proto=0
12213                 ;;
12214         esac
12215         ;;
12216 *)      ctermid_r_proto=0
12217         ;;
12218 esac
12219
12220 : see if ctime_r exists
12221 set ctime_r d_ctime_r
12222 eval $inlibc
12223 case "$d_ctime_r" in
12224 "$define")
12225         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12226         case "$d_ctime_r_proto:$usethreads" in
12227         ":define")      d_ctime_r_proto=define
12228                 set d_ctime_r_proto ctime_r $hdrs
12229                 eval $hasproto ;;
12230         *)      ;;
12231         esac
12232         case "$d_ctime_r_proto" in
12233         define)
12234         case "$ctime_r_proto" in
12235         ''|0) try='char* ctime_r(const time_t*, char*);'
12236         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12237         esac
12238         case "$ctime_r_proto" in
12239         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12240         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12241         esac
12242         case "$ctime_r_proto" in
12243         ''|0) try='int ctime_r(const time_t*, char*);'
12244         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12245         esac
12246         case "$ctime_r_proto" in
12247         ''|0) try='int ctime_r(const time_t*, char*, int);'
12248         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12249         esac
12250         case "$ctime_r_proto" in
12251         ''|0)   d_ctime_r=undef
12252                 ctime_r_proto=0
12253                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12254         * )     case "$ctime_r_proto" in
12255                 REENTRANT_PROTO*) ;;
12256                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12257                 esac
12258                 echo "Prototype: $try" ;;
12259         esac
12260         ;;
12261         *)      case "$usethreads" in
12262                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12263                 esac
12264                 d_ctime_r=undef
12265                 ctime_r_proto=0
12266                 ;;
12267         esac
12268         ;;
12269 *)      ctime_r_proto=0
12270         ;;
12271 esac
12272
12273 : see if cuserid exists
12274 set cuserid d_cuserid
12275 eval $inlibc
12276
12277 : see if dbm.h is available
12278 : see if dbmclose exists
12279 set dbmclose d_dbmclose
12280 eval $inlibc
12281
12282 case "$d_dbmclose" in
12283 $define)
12284         set dbm.h i_dbm
12285         eval $inhdr
12286         case "$i_dbm" in
12287         $define)
12288                 val="$undef"
12289                 set i_rpcsvcdbm
12290                 eval $setvar
12291                 ;;
12292         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12293                 eval $inhdr
12294                 ;;
12295         esac
12296         ;;
12297 *)      echo "We won't be including <dbm.h>"
12298         val="$undef"
12299         set i_dbm
12300         eval $setvar
12301         val="$undef"
12302         set i_rpcsvcdbm
12303         eval $setvar
12304         ;;
12305 esac
12306
12307 : see if prototype for dbminit is available
12308 echo " "
12309 set d_dbminitproto dbminit $i_dbm dbm.h
12310 eval $hasproto
12311
12312 : see if difftime exists
12313 set difftime d_difftime
12314 eval $inlibc
12315
12316 : see if this is a dirent system
12317 echo " "
12318 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12319         val="$define"
12320         echo "<dirent.h> found." >&4
12321 else
12322         val="$undef"
12323         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12324                 echo "<sys/dir.h> found." >&4
12325                 echo " "
12326         else
12327                 xinc=`./findhdr sys/ndir.h`
12328         fi
12329         echo "<dirent.h> NOT found." >&4
12330 fi
12331 set i_dirent
12332 eval $setvar
12333
12334 : Look for type of directory structure.
12335 echo " "
12336 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12337
12338 case "$direntrytype" in
12339 ''|' ')
12340         case "$i_dirent" in
12341         $define) guess1='struct dirent' ;;
12342         *) guess1='struct direct'  ;;
12343         esac
12344         ;;
12345 *)      guess1="$direntrytype"
12346         ;;
12347 esac
12348
12349 case "$guess1" in
12350 'struct dirent') guess2='struct direct' ;;
12351 *) guess2='struct dirent' ;;
12352 esac
12353
12354 if $contains "$guess1" try.c >/dev/null 2>&1; then
12355         direntrytype="$guess1"
12356         echo "Your directory entries are $direntrytype." >&4
12357 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12358         direntrytype="$guess2"
12359         echo "Your directory entries seem to be $direntrytype." >&4
12360 else
12361         echo "I don't recognize your system's directory entries." >&4
12362         rp="What type is used for directory entries on this system?"
12363         dflt="$guess1"
12364         . ./myread
12365         direntrytype="$ans"
12366 fi
12367 $rm_try
12368
12369 : see if the directory entry stores field length
12370 echo " "
12371 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12372 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12373         echo "Good, your directory entry keeps length information in d_namlen." >&4
12374         val="$define"
12375 else
12376         echo "Your directory entry does not know about the d_namlen field." >&4
12377         val="$undef"
12378 fi
12379 set d_dirnamlen
12380 eval $setvar
12381 $rm_try
12382
12383 : Look for DIR.dd_fd
12384 case "$i_dirent" in
12385 "$define")
12386     echo "Checking to see if DIR has a dd_fd member variable" >&4
12387     $cat >try.c <<EOCP
12388 #$i_stdlib I_STDLIB
12389 #ifdef I_STDLIB
12390 #include <stdlib.h>
12391 #endif
12392 #include <dirent.h>
12393
12394 int main() {
12395     DIR dir;
12396     dir.dd_fd = 1;
12397     return 0;
12398 }
12399 EOCP
12400     val=$undef
12401     set try
12402     if eval $compile; then
12403         echo "Yes, it does."
12404         val="$define"
12405     else
12406         echo "No, it does not."
12407         val="$undef"
12408     fi
12409     ;;
12410 *)
12411     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12412     val="$undef"
12413     ;;
12414 esac
12415 set d_dir_dd_fd
12416 eval $setvar
12417 $rm_try
12418
12419 : see if this is an sysdir system
12420 set sys/dir.h i_sysdir
12421 eval $inhdr
12422
12423 : see if this is an sysndir system
12424 set sys/ndir.h i_sysndir
12425 eval $inhdr
12426
12427 : Look for dirfd
12428 echo " "
12429 $cat >dirfd.c <<EOM
12430 #include <stdio.h>
12431 #$i_stdlib I_STDLIB
12432 #ifdef I_STDLIB
12433 #include <stdlib.h>
12434 #endif
12435 #$i_dirent I_DIRENT             /**/
12436 #$i_sysdir I_SYS_DIR            /**/
12437 #$i_sysndir I_SYS_NDIR          /**/
12438 #$i_systypes I_SYS_TYPES        /**/
12439 #if defined(I_SYS_TYPES)
12440 #include <sys/types.h>
12441 #endif
12442 #if defined(I_DIRENT)
12443 #include <dirent.h>
12444 #else
12445 #ifdef I_SYS_NDIR
12446 #include <sys/ndir.h>
12447 #else
12448 #ifdef I_SYS_DIR
12449 #include <sys/dir.h>
12450 #endif
12451 #endif
12452 #endif
12453 int main() {
12454         DIR *dirp = opendir(".");
12455         if (dirfd(dirp) >= 0)
12456                 exit(0);
12457         else
12458                 exit(1);
12459 }
12460 EOM
12461 val=$undef
12462 set dirfd
12463 if eval $compile; then
12464         val="$define"
12465 fi
12466 case "$val" in
12467 $define)        echo "dirfd() found." >&4       ;;
12468 *)              echo "dirfd() NOT found." >&4   ;;
12469 esac
12470 set d_dirfd
12471 eval $setvar
12472 $rm -f dirfd*
12473
12474 : see if dladdr exists
12475 set dladdr d_dladdr
12476 eval $inlibc
12477
12478 : see if dlerror exists
12479 xxx_runnm="$runnm"
12480 runnm=false
12481 set dlerror d_dlerror
12482 eval $inlibc
12483 runnm="$xxx_runnm"
12484
12485 : see if dlfcn is available
12486 set dlfcn.h i_dlfcn
12487 eval $inhdr
12488
12489 : Check what extension to use for shared libs
12490 case "$usedl" in
12491 $define|y|true)
12492         $cat << EOM
12493
12494 On a few systems, the dynamically loaded modules that perl generates and uses
12495 will need a different extension than shared libs. The default will probably
12496 be appropriate.
12497
12498 EOM
12499         case "$dlext" in
12500         '')     dflt="$so" ;;
12501         *)      dflt="$dlext" ;;
12502         esac
12503         rp='What is the extension of dynamically loaded modules'
12504         . ./myread
12505         dlext="$ans"
12506         ;;
12507 *)
12508         dlext="none"
12509         ;;
12510 esac
12511
12512 : Check if dlsym need a leading underscore
12513 echo " "
12514 val="$undef"
12515
12516 case "$dlsrc" in
12517 dl_dlopen.xs)
12518         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12519         $cat >dyna.c <<'EOM'
12520 fred () { }
12521 EOM
12522
12523 $cat >fred.c<<EOM
12524
12525 #include <stdio.h>
12526 #$i_stdlib I_STDLIB
12527 #ifdef I_STDLIB
12528 #include <stdlib.h>
12529 #endif
12530 #$i_dlfcn I_DLFCN
12531 #ifdef I_DLFCN
12532 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12533 #else
12534 #include <sys/types.h>
12535 #include <nlist.h>
12536 #include <link.h>
12537 #endif
12538
12539 extern int fred() ;
12540
12541 int main()
12542 {
12543     void * handle ;
12544     void * symbol ;
12545 #ifndef RTLD_LAZY
12546     int mode = 1 ;
12547 #else
12548     int mode = RTLD_LAZY ;
12549 #endif
12550     handle = dlopen("./dyna.$dlext", mode) ;
12551     if (handle == NULL) {
12552         printf ("1\n") ;
12553         fflush (stdout) ;
12554         exit(0);
12555     }
12556     symbol = dlsym(handle, "fred") ;
12557     if (symbol == NULL) {
12558         /* try putting a leading underscore */
12559         symbol = dlsym(handle, "_fred") ;
12560         if (symbol == NULL) {
12561             printf ("2\n") ;
12562             fflush (stdout) ;
12563             exit(0);
12564         }
12565         printf ("3\n") ;
12566     }
12567     else
12568         printf ("4\n") ;
12569     fflush (stdout) ;
12570     exit(0);
12571 }
12572 EOM
12573         : Call the object file tmp-dyna.o in case dlext=o.
12574         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12575                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12576                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12577                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12578                 xxx=`$run ./fred`
12579                 case $xxx in
12580                 1)      echo "Test program failed using dlopen." >&4
12581                         echo "Perhaps you should not use dynamic loading." >&4;;
12582                 2)      echo "Test program failed using dlsym." >&4
12583                         echo "Perhaps you should not use dynamic loading." >&4;;
12584                 3)      echo "dlsym needs a leading underscore" >&4
12585                         val="$define" ;;
12586                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12587                 esac
12588         else
12589                 echo "I can't compile and run the test program." >&4
12590                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12591         fi
12592         ;;
12593 esac
12594
12595 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12596
12597 set d_dlsymun
12598 eval $setvar
12599
12600 : see if drand48_r exists
12601 set drand48_r d_drand48_r
12602 eval $inlibc
12603 case "$d_drand48_r" in
12604 "$define")
12605         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12606         case "$d_drand48_r_proto:$usethreads" in
12607         ":define")      d_drand48_r_proto=define
12608                 set d_drand48_r_proto drand48_r $hdrs
12609                 eval $hasproto ;;
12610         *)      ;;
12611         esac
12612         case "$d_drand48_r_proto" in
12613         define)
12614         case "$drand48_r_proto" in
12615         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12616         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12617         esac
12618         case "$drand48_r_proto" in
12619         ''|0)   d_drand48_r=undef
12620                 drand48_r_proto=0
12621                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12622         * )     case "$drand48_r_proto" in
12623                 REENTRANT_PROTO*) ;;
12624                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12625                 esac
12626                 echo "Prototype: $try" ;;
12627         esac
12628         ;;
12629         *)      case "$usethreads" in
12630                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12631                 esac
12632                 d_drand48_r=undef
12633                 drand48_r_proto=0
12634                 ;;
12635         esac
12636         ;;
12637 *)      drand48_r_proto=0
12638         ;;
12639 esac
12640
12641 : see if prototype for drand48 is available
12642 echo " "
12643 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12644 eval $hasproto
12645
12646 : see if dup2 exists
12647 set dup2 d_dup2
12648 eval $inlibc
12649
12650 : see if dup3 exists
12651 set dup3 d_dup3
12652 eval $inlibc
12653
12654 : see if eaccess exists
12655 set eaccess d_eaccess
12656 eval $inlibc
12657
12658 : see if endgrent exists
12659 set endgrent d_endgrent
12660 eval $inlibc
12661
12662 : see if this is an grp system
12663 set grp.h i_grp
12664 eval $inhdr
12665
12666 case "$i_grp" in
12667 $define)
12668         xxx=`./findhdr grp.h`
12669         $cppstdin $cppflags $cppminus < $xxx >$$.h
12670
12671         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12672                 val="$define"
12673         else
12674                 val="$undef"
12675         fi
12676         set d_grpasswd
12677         eval $setvar
12678
12679         $rm -f $$.h
12680         ;;
12681 *)
12682         val="$undef";
12683         set d_grpasswd; eval $setvar
12684         ;;
12685 esac
12686
12687 : see if endgrent_r exists
12688 set endgrent_r d_endgrent_r
12689 eval $inlibc
12690 case "$d_endgrent_r" in
12691 "$define")
12692         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12693         case "$d_endgrent_r_proto:$usethreads" in
12694         ":define")      d_endgrent_r_proto=define
12695                 set d_endgrent_r_proto endgrent_r $hdrs
12696                 eval $hasproto ;;
12697         *)      ;;
12698         esac
12699         case "$d_endgrent_r_proto" in
12700         define)
12701         case "$endgrent_r_proto" in
12702         ''|0) try='int endgrent_r(FILE**);'
12703         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12704         esac
12705         case "$endgrent_r_proto" in
12706         ''|0) try='void endgrent_r(FILE**);'
12707         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12708         esac
12709         case "$endgrent_r_proto" in
12710         ''|0)   d_endgrent_r=undef
12711                 endgrent_r_proto=0
12712                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12713         * )     case "$endgrent_r_proto" in
12714                 REENTRANT_PROTO*) ;;
12715                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12716                 esac
12717                 echo "Prototype: $try" ;;
12718         esac
12719         ;;
12720         *)      case "$usethreads" in
12721                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12722                 esac
12723                 d_endgrent_r=undef
12724                 endgrent_r_proto=0
12725                 ;;
12726         esac
12727         ;;
12728 *)      endgrent_r_proto=0
12729         ;;
12730 esac
12731
12732 : see if endhostent exists
12733 set endhostent d_endhent
12734 eval $inlibc
12735
12736 : see if this is a netdb.h system
12737 set netdb.h i_netdb
12738 eval $inhdr
12739
12740 : see if endhostent_r exists
12741 set endhostent_r d_endhostent_r
12742 eval $inlibc
12743 case "$d_endhostent_r" in
12744 "$define")
12745         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12746         case "$d_endhostent_r_proto:$usethreads" in
12747         ":define")      d_endhostent_r_proto=define
12748                 set d_endhostent_r_proto endhostent_r $hdrs
12749                 eval $hasproto ;;
12750         *)      ;;
12751         esac
12752         case "$d_endhostent_r_proto" in
12753         define)
12754         case "$endhostent_r_proto" in
12755         ''|0) try='int endhostent_r(struct hostent_data*);'
12756         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12757         esac
12758         case "$endhostent_r_proto" in
12759         ''|0) try='void endhostent_r(struct hostent_data*);'
12760         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12761         esac
12762         case "$endhostent_r_proto" in
12763         ''|0)   d_endhostent_r=undef
12764                 endhostent_r_proto=0
12765                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12766         * )     case "$endhostent_r_proto" in
12767                 REENTRANT_PROTO*) ;;
12768                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12769                 esac
12770                 echo "Prototype: $try" ;;
12771         esac
12772         ;;
12773         *)      case "$usethreads" in
12774                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12775                 esac
12776                 d_endhostent_r=undef
12777                 endhostent_r_proto=0
12778                 ;;
12779         esac
12780         ;;
12781 *)      endhostent_r_proto=0
12782         ;;
12783 esac
12784
12785 : see if endnetent exists
12786 set endnetent d_endnent
12787 eval $inlibc
12788
12789 : see if endnetent_r exists
12790 set endnetent_r d_endnetent_r
12791 eval $inlibc
12792 case "$d_endnetent_r" in
12793 "$define")
12794         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12795         case "$d_endnetent_r_proto:$usethreads" in
12796         ":define")      d_endnetent_r_proto=define
12797                 set d_endnetent_r_proto endnetent_r $hdrs
12798                 eval $hasproto ;;
12799         *)      ;;
12800         esac
12801         case "$d_endnetent_r_proto" in
12802         define)
12803         case "$endnetent_r_proto" in
12804         ''|0) try='int endnetent_r(struct netent_data*);'
12805         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12806         esac
12807         case "$endnetent_r_proto" in
12808         ''|0) try='void endnetent_r(struct netent_data*);'
12809         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12810         esac
12811         case "$endnetent_r_proto" in
12812         ''|0)   d_endnetent_r=undef
12813                 endnetent_r_proto=0
12814                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12815         * )     case "$endnetent_r_proto" in
12816                 REENTRANT_PROTO*) ;;
12817                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12818                 esac
12819                 echo "Prototype: $try" ;;
12820         esac
12821         ;;
12822         *)      case "$usethreads" in
12823                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12824                 esac
12825                 d_endnetent_r=undef
12826                 endnetent_r_proto=0
12827                 ;;
12828         esac
12829         ;;
12830 *)      endnetent_r_proto=0
12831         ;;
12832 esac
12833
12834 : see if endprotoent exists
12835 set endprotoent d_endpent
12836 eval $inlibc
12837
12838 : see if endprotoent_r exists
12839 set endprotoent_r d_endprotoent_r
12840 eval $inlibc
12841 case "$d_endprotoent_r" in
12842 "$define")
12843         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12844         case "$d_endprotoent_r_proto:$usethreads" in
12845         ":define")      d_endprotoent_r_proto=define
12846                 set d_endprotoent_r_proto endprotoent_r $hdrs
12847                 eval $hasproto ;;
12848         *)      ;;
12849         esac
12850         case "$d_endprotoent_r_proto" in
12851         define)
12852         case "$endprotoent_r_proto" in
12853         ''|0) try='int endprotoent_r(struct protoent_data*);'
12854         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12855         esac
12856         case "$endprotoent_r_proto" in
12857         ''|0) try='void endprotoent_r(struct protoent_data*);'
12858         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12859         esac
12860         case "$endprotoent_r_proto" in
12861         ''|0)   d_endprotoent_r=undef
12862                 endprotoent_r_proto=0
12863                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12864         * )     case "$endprotoent_r_proto" in
12865                 REENTRANT_PROTO*) ;;
12866                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12867                 esac
12868                 echo "Prototype: $try" ;;
12869         esac
12870         ;;
12871         *)      case "$usethreads" in
12872                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12873                 esac
12874                 d_endprotoent_r=undef
12875                 endprotoent_r_proto=0
12876                 ;;
12877         esac
12878         ;;
12879 *)      endprotoent_r_proto=0
12880         ;;
12881 esac
12882
12883 : see if endpwent exists
12884 set endpwent d_endpwent
12885 eval $inlibc
12886
12887 : see if this is a pwd.h system
12888 set pwd.h i_pwd
12889 eval $inhdr
12890
12891 case "$i_pwd" in
12892 $define)
12893         xxx=`./findhdr pwd.h`
12894         $cppstdin $cppflags $cppminus < $xxx >$$.h
12895
12896         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12897                 val="$define"
12898         else
12899                 val="$undef"
12900         fi
12901         set d_pwquota
12902         eval $setvar
12903
12904         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12905                 val="$define"
12906         else
12907                 val="$undef"
12908         fi
12909         set d_pwage
12910         eval $setvar
12911
12912         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12913                 val="$define"
12914         else
12915                 val="$undef"
12916         fi
12917         set d_pwchange
12918         eval $setvar
12919
12920         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12921                 val="$define"
12922         else
12923                 val="$undef"
12924         fi
12925         set d_pwclass
12926         eval $setvar
12927
12928         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12929                 val="$define"
12930         else
12931                 val="$undef"
12932         fi
12933         set d_pwexpire
12934         eval $setvar
12935
12936         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12937                 val="$define"
12938         else
12939                 val="$undef"
12940         fi
12941         set d_pwcomment
12942         eval $setvar
12943
12944         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12945                 val="$define"
12946         else
12947                 val="$undef"
12948         fi
12949         set d_pwgecos
12950         eval $setvar
12951
12952         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12953                 val="$define"
12954         else
12955                 val="$undef"
12956         fi
12957         set d_pwpasswd
12958         eval $setvar
12959
12960         $rm -f $$.h
12961         ;;
12962 *)
12963         val="$undef";
12964         set d_pwquota; eval $setvar
12965         set d_pwage; eval $setvar
12966         set d_pwchange; eval $setvar
12967         set d_pwclass; eval $setvar
12968         set d_pwexpire; eval $setvar
12969         set d_pwcomment; eval $setvar
12970         set d_pwgecos; eval $setvar
12971         set d_pwpasswd; eval $setvar
12972         ;;
12973 esac
12974
12975 : see if endpwent_r exists
12976 set endpwent_r d_endpwent_r
12977 eval $inlibc
12978 case "$d_endpwent_r" in
12979 "$define")
12980         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12981         case "$d_endpwent_r_proto:$usethreads" in
12982         ":define")      d_endpwent_r_proto=define
12983                 set d_endpwent_r_proto endpwent_r $hdrs
12984                 eval $hasproto ;;
12985         *)      ;;
12986         esac
12987         case "$d_endpwent_r_proto" in
12988         define)
12989         case "$endpwent_r_proto" in
12990         ''|0) try='int endpwent_r(FILE**);'
12991         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12992         esac
12993         case "$endpwent_r_proto" in
12994         ''|0) try='void endpwent_r(FILE**);'
12995         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12996         esac
12997         case "$endpwent_r_proto" in
12998         ''|0)   d_endpwent_r=undef
12999                 endpwent_r_proto=0
13000                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13001         * )     case "$endpwent_r_proto" in
13002                 REENTRANT_PROTO*) ;;
13003                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13004                 esac
13005                 echo "Prototype: $try" ;;
13006         esac
13007         ;;
13008         *)      case "$usethreads" in
13009                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13010                 esac
13011                 d_endpwent_r=undef
13012                 endpwent_r_proto=0
13013                 ;;
13014         esac
13015         ;;
13016 *)      endpwent_r_proto=0
13017         ;;
13018 esac
13019
13020 : see if endservent exists
13021 set endservent d_endsent
13022 eval $inlibc
13023
13024 : see if endservent_r exists
13025 set endservent_r d_endservent_r
13026 eval $inlibc
13027 case "$d_endservent_r" in
13028 "$define")
13029         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13030         case "$d_endservent_r_proto:$usethreads" in
13031         ":define")      d_endservent_r_proto=define
13032                 set d_endservent_r_proto endservent_r $hdrs
13033                 eval $hasproto ;;
13034         *)      ;;
13035         esac
13036         case "$d_endservent_r_proto" in
13037         define)
13038         case "$endservent_r_proto" in
13039         ''|0) try='int endservent_r(struct servent_data*);'
13040         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13041         esac
13042         case "$endservent_r_proto" in
13043         ''|0) try='void endservent_r(struct servent_data*);'
13044         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13045         esac
13046         case "$endservent_r_proto" in
13047         ''|0)   d_endservent_r=undef
13048                 endservent_r_proto=0
13049                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13050         * )     case "$endservent_r_proto" in
13051                 REENTRANT_PROTO*) ;;
13052                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13053                 esac
13054                 echo "Prototype: $try" ;;
13055         esac
13056         ;;
13057         *)      case "$usethreads" in
13058                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13059                 esac
13060                 d_endservent_r=undef
13061                 endservent_r_proto=0
13062                 ;;
13063         esac
13064         ;;
13065 *)      endservent_r_proto=0
13066         ;;
13067 esac
13068
13069 : Locate the flags for 'open()'
13070 echo " "
13071 $cat >try.c <<EOCP
13072 #include <sys/types.h>
13073 #ifdef I_FCNTL
13074 #include <fcntl.h>
13075 #endif
13076 #ifdef I_SYS_FILE
13077 #include <sys/file.h>
13078 #endif
13079 #$i_stdlib I_STDLIB
13080 #ifdef I_STDLIB
13081 #include <stdlib.h>
13082 #endif
13083 int main() {
13084         if(O_RDONLY);
13085 #ifdef O_TRUNC
13086         exit(0);
13087 #else
13088         exit(1);
13089 #endif
13090 }
13091 EOCP
13092 : check sys/file.h first to get FREAD on Sun
13093 if $test `./findhdr sys/file.h` && \
13094                 set try -DI_SYS_FILE && eval $compile; then
13095         h_sysfile=true;
13096         echo "<sys/file.h> defines the O_* constants..." >&4
13097         if $run ./try; then
13098                 echo "and you have the 3 argument form of open()." >&4
13099                 val="$define"
13100         else
13101                 echo "but not the 3 argument form of open().  Oh, well." >&4
13102                 val="$undef"
13103         fi
13104 elif $test `./findhdr fcntl.h` && \
13105                 set try -DI_FCNTL && eval $compile; then
13106         h_fcntl=true;
13107         echo "<fcntl.h> defines the O_* constants..." >&4
13108         if $run ./try; then
13109                 echo "and you have the 3 argument form of open()." >&4
13110                 val="$define"
13111         else
13112                 echo "but not the 3 argument form of open().  Oh, well." >&4
13113                 val="$undef"
13114         fi
13115 else
13116         val="$undef"
13117         echo "I can't find the O_* constant definitions!  You got problems." >&4
13118 fi
13119 set d_open3
13120 eval $setvar
13121 $rm_try
13122
13123 : see if this is a sys/file.h system
13124 val=''
13125 set sys/file.h val
13126 eval $inhdr
13127
13128 : do we need to include sys/file.h ?
13129 case "$val" in
13130 "$define")
13131         echo " "
13132         if $h_sysfile; then
13133                 val="$define"
13134                 echo "We'll be including <sys/file.h>." >&4
13135         else
13136                 val="$undef"
13137                 echo "We won't be including <sys/file.h>." >&4
13138         fi
13139         ;;
13140 *)
13141         h_sysfile=false
13142         ;;
13143 esac
13144 set i_sysfile
13145 eval $setvar
13146
13147 : see if fcntl.h is there
13148 val=''
13149 set fcntl.h val
13150 eval $inhdr
13151
13152 : see if we can include fcntl.h
13153 case "$val" in
13154 "$define")
13155         echo " "
13156         if $h_fcntl; then
13157                 val="$define"
13158                 echo "We'll be including <fcntl.h>." >&4
13159         else
13160                 val="$undef"
13161                 if $h_sysfile; then
13162         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13163                 else
13164                         echo "We won't be including <fcntl.h>." >&4
13165                 fi
13166         fi
13167         ;;
13168 *)
13169         h_fcntl=false
13170         val="$undef"
13171         ;;
13172 esac
13173 set i_fcntl
13174 eval $setvar
13175
13176 : see if fork exists
13177 set fork d_fork
13178 eval $inlibc
13179
13180 : see if pipe exists
13181 set pipe d_pipe
13182 eval $inlibc
13183
13184 : check for non-blocking I/O stuff
13185 case "$h_sysfile" in
13186 true) echo "#include <sys/file.h>" > head.c;;
13187 *)
13188        case "$h_fcntl" in
13189        true) echo "#include <fcntl.h>" > head.c;;
13190        *) echo "#include <sys/fcntl.h>" > head.c;;
13191        esac
13192        ;;
13193 esac
13194 echo " "
13195 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13196 case "$o_nonblock" in
13197 '')
13198         $cat head.c > try.c
13199         $cat >>try.c <<EOCP
13200 #include <stdio.h>
13201 #$i_stdlib I_STDLIB
13202 #ifdef I_STDLIB
13203 #include <stdlib.h>
13204 #endif
13205 #$i_fcntl I_FCNTL
13206 #ifdef I_FCNTL
13207 #include <fcntl.h>
13208 #endif
13209 int main() {
13210 #ifdef O_NONBLOCK
13211         printf("O_NONBLOCK\n");
13212         exit(0);
13213 #endif
13214 #ifdef O_NDELAY
13215         printf("O_NDELAY\n");
13216         exit(0);
13217 #endif
13218 #ifdef FNDELAY
13219         printf("FNDELAY\n");
13220         exit(0);
13221 #endif
13222         exit(0);
13223 }
13224 EOCP
13225         set try
13226         if eval $compile_ok; then
13227                 o_nonblock=`$run ./try`
13228                 case "$o_nonblock" in
13229                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13230                 *) echo "Seems like we can use $o_nonblock.";;
13231                 esac
13232         else
13233                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13234         fi
13235         ;;
13236 *) echo "Using $hint value $o_nonblock.";;
13237 esac
13238 $rm_try
13239
13240 echo " "
13241 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13242 case "$eagain" in
13243 '')
13244         case "$d_fork:$d_pipe:$d_alarm" in
13245         define:define:define)
13246         $cat head.c > try.c
13247         $cat >>try.c <<EOCP
13248 #include <errno.h>
13249 #include <sys/types.h>
13250 #include <signal.h>
13251 #include <stdio.h>
13252 #$i_stdlib I_STDLIB
13253 #ifdef I_STDLIB
13254 #include <stdlib.h>
13255 #endif
13256 #$i_fcntl I_FCNTL
13257 #ifdef I_FCNTL
13258 #include <fcntl.h>
13259 #endif
13260 #define MY_O_NONBLOCK $o_nonblock
13261 #ifndef errno  /* XXX need better Configure test */
13262 extern int errno;
13263 #endif
13264 #$i_unistd I_UNISTD
13265 #ifdef I_UNISTD
13266 #include <unistd.h>
13267 #endif
13268 #include <string.h>
13269 $signal_t blech(int x) { exit(3); }
13270 EOCP
13271         $cat >> try.c <<'EOCP'
13272 int main()
13273 {
13274         int pd[2];
13275         int pu[2];
13276         char buf[1];
13277         char string[100];
13278         int ret;
13279
13280         ret = pipe(pd); /* Down: child -> parent */
13281         if (ret != 0)
13282                 exit(3);
13283         ret = pipe(pu); /* Up: parent -> child */
13284         if (ret != 0)
13285                 exit(3);
13286         if (0 != fork()) {
13287                 close(pd[1]);   /* Parent reads from pd[0] */
13288                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13289 #ifdef F_SETFL
13290                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13291                         exit(1);
13292 #else
13293                 exit(4);
13294 #endif
13295                 signal(SIGALRM, blech);
13296                 alarm(5);
13297                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13298                         exit(2);
13299                 sprintf(string, "%d\n", ret);
13300                 ret = write(2, string, strlen(string));
13301                 if (ret != strlen(string))
13302                         exit(3);
13303                 alarm(0);
13304 #ifdef EAGAIN
13305                 if (errno == EAGAIN) {
13306                         printf("EAGAIN\n");
13307                         goto ok;
13308                 }
13309 #endif
13310 #ifdef EWOULDBLOCK
13311                 if (errno == EWOULDBLOCK)
13312                         printf("EWOULDBLOCK\n");
13313 #endif
13314         ok:
13315                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13316                 if (ret != 1)
13317                         exit(3);
13318                 sleep(2);                               /* Give it time to close our pipe */
13319                 alarm(5);
13320                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13321                 alarm(0);
13322                 sprintf(string, "%d\n", ret);
13323                 ret = write(4, string, strlen(string));
13324                 if (ret != strlen(string))
13325                         exit(3);
13326                 exit(0);
13327         }
13328
13329         close(pd[0]);                   /* We write to pd[1] */
13330         close(pu[1]);                   /* We read from pu[0] */
13331         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13332         if (ret != 1)
13333                 exit(3);
13334         close(pd[1]);                   /* Pipe pd is now fully closed! */
13335         exit(0);                                /* Bye bye, thank you for playing! */
13336 }
13337 EOCP
13338         set try
13339         if eval $compile_ok; then
13340                 echo "$startsh" >mtry
13341                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13342                 chmod +x mtry
13343                 $run ./mtry >/dev/null 2>&1
13344                 case $? in
13345                 0) eagain=`$cat try.out`;;
13346                 1) echo "Could not perform non-blocking setting!";;
13347                 2) echo "I did a successful read() for something that was not there!";;
13348                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13349                 4) echo "Could not find F_SETFL!";;
13350                 *) echo "Something terribly wrong happened during testing.";;
13351                 esac
13352                 rd_nodata=`$cat try.ret`
13353                 echo "A read() system call with no data present returns $rd_nodata."
13354                 case "$rd_nodata" in
13355                 0|-1) ;;
13356                 *)
13357                         echo "(That's peculiar, fixing that to be -1.)"
13358                         rd_nodata=-1
13359                         ;;
13360                 esac
13361                 case "$eagain" in
13362                 '')
13363                         echo "Forcing errno EAGAIN on read() with no data available."
13364                         eagain=EAGAIN
13365                         ;;
13366                 *)
13367                         echo "Your read() sets errno to $eagain when no data is available."
13368                         ;;
13369                 esac
13370                 status=`$cat try.err`
13371                 case "$status" in
13372                 0) echo "And it correctly returns 0 to signal EOF.";;
13373                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13374                 *) echo "However, your read() returns '$status' on EOF??";;
13375                 esac
13376                 val="$define"
13377                 if test "$status" = "$rd_nodata"; then
13378                         echo "WARNING: you can't distinguish between EOF and no data!"
13379                         val="$undef"
13380                 fi
13381         else
13382                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13383                 eagain=EAGAIN
13384         fi
13385         ;;
13386         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13387                 eagain=EAGAIN
13388                 val="$define"
13389                 ;;
13390         esac
13391         set d_eofnblk
13392         eval $setvar
13393         ;;
13394 *)
13395         echo "Using $hint value $eagain."
13396         echo "Your read() returns $rd_nodata when no data is present."
13397         case "$d_eofnblk" in
13398         "$define") echo "And you can see EOF because read() returns 0.";;
13399         "$undef") echo "But you can't see EOF status from read() returned value.";;
13400         *)
13401                 echo "(Assuming you can't see EOF status from read anyway.)"
13402                 d_eofnblk=$undef
13403                 ;;
13404         esac
13405         ;;
13406 esac
13407 $rm_try head.c mtry
13408
13409 : see if erf exists
13410 set erf d_erf
13411 eval $inlibc
13412
13413 : see if erfc exists
13414 set erfc d_erfc
13415 eval $inlibc
13416
13417 : see if exp2 exists
13418 set exp2 d_exp2
13419 eval $inlibc
13420
13421 : see if expm1 exists
13422 set expm1 d_expm1
13423 eval $inlibc
13424
13425 : see if _ptr and _cnt from stdio act std
13426 echo " "
13427
13428 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13429         echo "(Looks like you have stdio.h from BSD.)"
13430         case "$stdio_ptr" in
13431         '') stdio_ptr='((fp)->_p)'
13432                 ptr_lval=$define
13433                 ;;
13434         *)      ptr_lval=$d_stdio_ptr_lval;;
13435         esac
13436         case "$stdio_cnt" in
13437         '') stdio_cnt='((fp)->_r)'
13438                 cnt_lval=$define
13439                 ;;
13440         *)      cnt_lval=$d_stdio_cnt_lval;;
13441         esac
13442         case "$stdio_base" in
13443         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13444         esac
13445         case "$stdio_bufsiz" in
13446         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13447         esac
13448 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13449         echo "(Looks like you have stdio.h from Linux.)"
13450         case "$stdio_ptr" in
13451         '') stdio_ptr='((fp)->_IO_read_ptr)'
13452                 ptr_lval=$define
13453                 ;;
13454         *)      ptr_lval=$d_stdio_ptr_lval;;
13455         esac
13456         case "$stdio_cnt" in
13457         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13458                 cnt_lval=$undef
13459                 ;;
13460         *)      cnt_lval=$d_stdio_cnt_lval;;
13461         esac
13462         case "$stdio_base" in
13463         '') stdio_base='((fp)->_IO_read_base)';;
13464         esac
13465         case "$stdio_bufsiz" in
13466         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13467         esac
13468 else
13469         case "$stdio_ptr" in
13470         '') stdio_ptr='((fp)->_ptr)'
13471                 ptr_lval=$define
13472                 ;;
13473         *)      ptr_lval=$d_stdio_ptr_lval;;
13474         esac
13475         case "$stdio_cnt" in
13476         '') stdio_cnt='((fp)->_cnt)'
13477                 cnt_lval=$define
13478                 ;;
13479         *)      cnt_lval=$d_stdio_cnt_lval;;
13480         esac
13481         case "$stdio_base" in
13482         '') stdio_base='((fp)->_base)';;
13483         esac
13484         case "$stdio_bufsiz" in
13485         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13486         esac
13487 fi
13488
13489 : test whether _ptr and _cnt really work
13490 echo "Checking how std your stdio is..." >&4
13491 $cat >try.c <<EOP
13492 #include <stdio.h>
13493 #$i_stdlib I_STDLIB
13494 #ifdef I_STDLIB
13495 #include <stdlib.h>
13496 #endif
13497 #define FILE_ptr(fp)    $stdio_ptr
13498 #define FILE_cnt(fp)    $stdio_cnt
13499 int main() {
13500         FILE *fp = fopen("try.c", "r");
13501         char c = getc(fp);
13502         if (
13503                 18 <= FILE_cnt(fp) &&
13504                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13505         )
13506                 exit(0);
13507         exit(1);
13508 }
13509 EOP
13510 val="$undef"
13511 set try
13512 if eval $compile && $to try.c; then
13513         if $run ./try; then
13514                 echo "Your stdio acts pretty std."
13515                 val="$define"
13516         else
13517                 echo "Your stdio isn't very std."
13518         fi
13519 else
13520         echo "Your stdio doesn't appear very std."
13521 fi
13522 $rm_try
13523
13524 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13525 # direct buffer manipulation no longer works.  The Configure tests
13526 # should be changed to correctly detect this, but until then,
13527 # the following check should at least let perl compile and run.
13528 # (This quick fix should be updated before 5.8.1.)
13529 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13530 # A. Dougherty, June 3, 2002.
13531 case "$d_gnulibc" in
13532 $define)
13533         case "$gnulibc_version" in
13534         2.[01]*)  ;;
13535         2.2) ;;
13536         2.2.[0-9]) ;;
13537         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13538                 val="$undef"
13539                 ;;
13540         esac
13541         ;;
13542 esac
13543 set d_stdstdio
13544 eval $setvar
13545
13546 : Can _ptr be used as an lvalue?
13547 case "$d_stdstdio$ptr_lval" in
13548 $define$define) val=$define ;;
13549 *) val=$undef ;;
13550 esac
13551 set d_stdio_ptr_lval
13552 eval $setvar
13553
13554 : Can _cnt be used as an lvalue?
13555 case "$d_stdstdio$cnt_lval" in
13556 $define$define) val=$define ;;
13557 *) val=$undef ;;
13558 esac
13559 set d_stdio_cnt_lval
13560 eval $setvar
13561
13562
13563 : test whether setting _ptr sets _cnt as a side effect
13564 d_stdio_ptr_lval_sets_cnt="$undef"
13565 d_stdio_ptr_lval_nochange_cnt="$undef"
13566 case "$d_stdio_ptr_lval$d_stdstdio" in
13567 $define$define)
13568         echo "Checking to see what happens if we set the stdio ptr..." >&4
13569 $cat >try.c <<EOP
13570 #include <stdio.h>
13571 /* Can we scream? */
13572 /* Eat dust sed :-) */
13573 /* In the buffer space, no one can hear you scream. */
13574 #$i_stdlib I_STDLIB
13575 #ifdef I_STDLIB
13576 #include <stdlib.h>
13577 #endif
13578 #define FILE_ptr(fp)    $stdio_ptr
13579 #define FILE_cnt(fp)    $stdio_cnt
13580 #include <sys/types.h>
13581 int main() {
13582         FILE *fp = fopen("try.c", "r");
13583         int c;
13584         char *ptr;
13585         size_t cnt;
13586         if (!fp) {
13587             puts("Fail even to read");
13588             exit(1);
13589         }
13590         c = getc(fp); /* Read away the first # */
13591         if (c == EOF) {
13592             puts("Fail even to read");
13593             exit(1);
13594         }
13595         if (!(
13596                 18 <= FILE_cnt(fp) &&
13597                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13598         )) {
13599                 puts("Fail even to read");
13600                 exit (1);
13601         }
13602         ptr = (char*) FILE_ptr(fp);
13603         cnt = (size_t)FILE_cnt(fp);
13604
13605         FILE_ptr(fp) += 42;
13606
13607         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13608                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13609                 exit (1);
13610         }
13611         if (FILE_cnt(fp) <= 20) {
13612                 printf ("Fail (<20 chars to test)");
13613                 exit (1);
13614         }
13615         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13616                 puts("Fail compare");
13617                 exit (1);
13618         }
13619         if (cnt == FILE_cnt(fp)) {
13620                 puts("Pass_unchanged");
13621                 exit (0);
13622         }
13623         if (FILE_cnt(fp) == (cnt - 42)) {
13624                 puts("Pass_changed");
13625                 exit (0);
13626         }
13627         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13628         return 1;
13629
13630 }
13631 EOP
13632         set try
13633         if eval $compile && $to try.c; then
13634                 case `$run ./try` in
13635                 Pass_changed)
13636                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13637                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13638                 Pass_unchanged)
13639                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13640                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13641                 Fail*)
13642                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13643                 *)
13644                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13645         esac
13646         else
13647                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13648         fi
13649         $rm_try
13650         ;;
13651 esac
13652
13653 : see if _base is also standard
13654 val="$undef"
13655 case "$d_stdstdio" in
13656 $define)
13657         $cat >try.c <<EOP
13658 #include <stdio.h>
13659 #$i_stdlib I_STDLIB
13660 #ifdef I_STDLIB
13661 #include <stdlib.h>
13662 #endif
13663 #define FILE_base(fp)   $stdio_base
13664 #define FILE_bufsiz(fp) $stdio_bufsiz
13665 int main() {
13666         FILE *fp = fopen("try.c", "r");
13667         char c = getc(fp);
13668         if (
13669                 19 <= FILE_bufsiz(fp) &&
13670                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13671         )
13672                 exit(0);
13673         exit(1);
13674 }
13675 EOP
13676         set try
13677         if eval $compile && $to try.c; then
13678                 if $run ./try; then
13679                         echo "And its _base field acts std."
13680                         val="$define"
13681                 else
13682                         echo "But its _base field isn't std."
13683                 fi
13684         else
13685                 echo "However, it seems to be lacking the _base field."
13686         fi
13687         $rm_try
13688         ;;
13689 esac
13690 set d_stdiobase
13691 eval $setvar
13692
13693 : see if fast_stdio exists
13694 val="$undef"
13695 case "$d_stdstdio:$d_stdio_ptr_lval" in
13696 "$define:$define")
13697         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13698         *$define*)
13699                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13700                 val="$define"
13701                 ;;
13702         esac
13703         ;;
13704 esac
13705 set d_faststdio
13706 eval $setvar
13707
13708
13709
13710 : see if fchdir exists
13711 set fchdir d_fchdir
13712 eval $inlibc
13713
13714 : see if fchmod exists
13715 set fchmod d_fchmod
13716 eval $inlibc
13717
13718 : check for openat, unlinkat, renameat, linkat, fchmodat
13719 set openat d_openat
13720 eval $inlibc
13721
13722 set unlinkat d_unlinkat
13723 eval $inlibc
13724
13725 set renameat d_renameat
13726 eval $inlibc
13727
13728 set linkat d_linkat
13729 eval $inlibc
13730
13731 set fchmodat d_fchmodat
13732 eval $inlibc
13733
13734 : see if fchown exists
13735 set fchown d_fchown
13736 eval $inlibc
13737
13738 : see if this is an fcntl system
13739 set fcntl d_fcntl
13740 eval $inlibc
13741
13742 : See if fcntl-based locking works.
13743 echo " "
13744 $cat >try.c <<EOCP
13745 #$i_stdlib I_STDLIB
13746 #ifdef I_STDLIB
13747 #include <stdlib.h>
13748 #endif
13749 #include <unistd.h>
13750 #include <fcntl.h>
13751 #include <signal.h>
13752 $signal_t blech(int x) { exit(3); }
13753 int main() {
13754 #if defined(F_SETLK) && defined(F_SETLKW)
13755      struct flock flock;
13756      int retval, fd;
13757      fd = open("try.c", O_RDONLY);
13758      flock.l_type = F_RDLCK;
13759      flock.l_whence = SEEK_SET;
13760      flock.l_start = flock.l_len = 0;
13761      signal(SIGALRM, blech);
13762      alarm(10);
13763      retval = fcntl(fd, F_SETLK, &flock);
13764      close(fd);
13765      (retval < 0 ? exit(2) : exit(0));
13766 #else
13767      exit(2);
13768 #endif
13769 }
13770 EOCP
13771 echo "Checking if fcntl-based file locking works... "
13772 case "$d_fcntl" in
13773 "$define")
13774         set try
13775         if eval $compile_ok; then
13776                 if $run ./try; then
13777                         echo "Yes, it seems to work."
13778                         val="$define"
13779                 else
13780                         echo "Nope, it didn't work."
13781                         val="$undef"
13782                         case "$?" in
13783                         3) $cat >&4 <<EOM
13784 ***
13785 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13786 *** This is (almost) impossible.
13787 *** If your NFS lock daemons are not feeling well, something like
13788 *** this may happen, please investigate.  Cannot continue, aborting.
13789 ***
13790 EOM
13791                                 exit 1
13792                                 ;;
13793                         esac
13794                 fi
13795         else
13796                 echo "I'm unable to compile the test program, so I'll assume not."
13797                 val="$undef"
13798         fi
13799         ;;
13800 *) val="$undef";
13801         echo "Nope, since you don't even have fcntl()."
13802         ;;
13803 esac
13804 set d_fcntl_can_lock
13805 eval $setvar
13806 $rm_try
13807
13808 : check for fd_set items
13809 $cat <<EOM
13810
13811 Checking to see how well your C compiler handles fd_set and friends ...
13812 EOM
13813 $cat >try.c <<EOCP
13814 #$i_stdlib I_STDLIB
13815 #ifdef I_STDLIB
13816 #include <stdlib.h>
13817 #endif
13818 #$i_systime I_SYS_TIME
13819 #$i_sysselct I_SYS_SELECT
13820 #$d_socket HAS_SOCKET
13821 #include <sys/types.h>
13822 #ifdef HAS_SOCKET
13823 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13824 #endif
13825 #ifdef I_SYS_TIME
13826 #include <sys/time.h>
13827 #endif
13828 #ifdef I_SYS_SELECT
13829 #include <sys/select.h>
13830 #endif
13831 int main() {
13832         fd_set fds;
13833
13834 #ifdef TRYBITS
13835         if(fds.fds_bits);
13836 #endif
13837
13838 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13839         exit(0);
13840 #else
13841         exit(1);
13842 #endif
13843 }
13844 EOCP
13845 set try -DTRYBITS
13846 if eval $compile; then
13847         d_fds_bits="$define"
13848         d_fd_set="$define"
13849         echo "Well, your system knows about the normal fd_set typedef..." >&4
13850         if $run ./try; then
13851                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13852                 d_fd_macros="$define"
13853         else
13854                 $cat >&4 <<'EOM'
13855 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13856 EOM
13857                 d_fd_macros="$undef"
13858         fi
13859 else
13860         $cat <<'EOM'
13861 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13862 EOM
13863         set try
13864         if eval $compile; then
13865                 d_fds_bits="$undef"
13866                 d_fd_set="$define"
13867                 echo "Well, your system has some sort of fd_set available..." >&4
13868                 if $run ./try; then
13869                         echo "and you have the normal fd_set macros." >&4
13870                         d_fd_macros="$define"
13871                 else
13872                         $cat <<'EOM'
13873 but not the normal fd_set macros!  Gross!  More work for me...
13874 EOM
13875                         d_fd_macros="$undef"
13876                 fi
13877         else
13878         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13879                 d_fd_set="$undef"
13880                 d_fds_bits="$undef"
13881                 d_fd_macros="$undef"
13882         fi
13883 fi
13884 $rm_try
13885
13886 : see if fdclose exists
13887 set fdclose d_fdclose
13888 eval $inlibc
13889
13890 : see if fdim exists
13891 set fdim d_fdim
13892 eval $inlibc
13893
13894 : see if fegetround exists
13895 set fegetround d_fegetround
13896 eval $inlibc
13897
13898 : see if fgetpos exists
13899 set fgetpos d_fgetpos
13900 eval $inlibc
13901
13902 : see if finite exists
13903 set finite d_finite
13904 eval $inlibc
13905
13906 : see if finitel exists
13907 set finitel d_finitel
13908 eval $inlibc
13909
13910 : see if flock exists
13911 set flock d_flock
13912 eval $inlibc
13913
13914 : see if prototype for flock is available
13915 echo " "
13916 set d_flockproto flock $i_sysfile sys/file.h
13917 eval $hasproto
13918
13919 : see if fma exists
13920 set fma d_fma
13921 eval $inlibc
13922
13923 : see if fmax exists
13924 set fmax d_fmax
13925 eval $inlibc
13926
13927 : see if fmin exists
13928 set fmin d_fmin
13929 eval $inlibc
13930
13931 : see if fp_class exists
13932 set fp_class d_fp_class
13933 eval $inlibc
13934
13935 : check for fpclassify
13936 echo "Checking to see if you have fpclassify..." >&4
13937 $cat >try.c <<EOCP
13938 #include <math.h>
13939 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13940 EOCP
13941 set try
13942 if eval $compile; then
13943         val="$define"
13944         echo "You have fpclassify."
13945 else
13946         val="$undef"
13947         echo "You do not have fpclassify."
13948 fi
13949 $rm_try
13950 set d_fpclassify
13951 eval $setvar
13952
13953 : see if fp_classify exists
13954 set fp_classify d_fp_classify
13955 eval $inlibc
13956
13957 : see if fp_classl exists
13958 set fp_classl d_fp_classl
13959 eval $inlibc
13960
13961 : see if pathconf exists
13962 set pathconf d_pathconf
13963 eval $inlibc
13964
13965 : see if fpathconf exists
13966 set fpathconf d_fpathconf
13967 eval $inlibc
13968
13969 : see if fpclass exists
13970 set fpclass d_fpclass
13971 eval $inlibc
13972
13973 : see if fpclassl exists
13974 set fpclassl d_fpclassl
13975 eval $inlibc
13976
13977 : see if fpgetround exists
13978 set fpgetround d_fpgetround
13979 eval $inlibc
13980
13981 : check for fpos64_t
13982 echo " "
13983 echo "Checking to see if you have fpos64_t..." >&4
13984 $cat >try.c <<EOCP
13985 #include <stdio.h>
13986 int main() { fpos64_t x = 7; }
13987 EOCP
13988 set try
13989 if eval $compile; then
13990         val="$define"
13991         echo "You have fpos64_t."
13992 else
13993         val="$undef"
13994         echo "You do not have fpos64_t."
13995         case "$fpossize" in
13996         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13997         esac
13998 fi
13999 $rm_try
14000 set d_fpos64_t
14001 eval $setvar
14002
14003 : see if this is an xlocale.h system
14004 set xlocale.h i_xlocale
14005 eval $inhdr
14006
14007 : see if newlocale exists
14008 set newlocale d_newlocale
14009 eval $inlibc
14010
14011 : see if freelocale exists
14012 set freelocale d_freelocale
14013 eval $inlibc
14014
14015 : see if uselocale exists
14016 set uselocale d_uselocale
14017 eval $inlibc
14018
14019 : see if duplocale exists
14020 set duplocale d_duplocale
14021 eval $inlibc
14022
14023 : see if querylocale exists
14024 set querylocale d_querylocale
14025 eval $inlibc
14026
14027 : see if frexpl exists
14028 set frexpl d_frexpl
14029 eval $inlibc
14030
14031 : see if this is a sys/param system
14032 set sys/param.h i_sysparam
14033 eval $inhdr
14034
14035 : see if this is a sys/mount.h system
14036 set sys/mount.h i_sysmount
14037 eval $inhdr
14038
14039 : Check for fs_data_s
14040 echo " "
14041 echo "Checking to see if your system supports struct fs_data..." >&4
14042 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14043 eval $hasstruct
14044 case "$d_fs_data_s" in
14045 "$define")      echo "Yes, it does."   ;;
14046 *)              echo "No, it doesn't." ;;
14047 esac
14048
14049 : see if fseeko exists
14050 set fseeko d_fseeko
14051 eval $inlibc
14052 case "$longsize" in
14053 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14054 esac
14055
14056 : see if fsetpos exists
14057 set fsetpos d_fsetpos
14058 eval $inlibc
14059
14060 : see if fstatfs exists
14061 set fstatfs d_fstatfs
14062 eval $inlibc
14063
14064 : see if statvfs exists
14065 set statvfs d_statvfs
14066 eval $inlibc
14067
14068 : see if fstatvfs exists
14069 set fstatvfs d_fstatvfs
14070 eval $inlibc
14071
14072
14073 : see if fsync exists
14074 set fsync d_fsync
14075 eval $inlibc
14076
14077 : see if ftello exists
14078 set ftello d_ftello
14079 eval $inlibc
14080 case "$longsize" in
14081 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14082 esac
14083
14084 : check for a working futimes
14085 d_futimes="$undef"
14086 echo " "
14087 echo "Checking if you have a working futimes()" >&4
14088 $cat >try.c <<EOCP
14089 #include <stdio.h>
14090 #include <sys/time.h>
14091 #include <errno.h>
14092 #include <fcntl.h>
14093
14094 int main ()
14095 {
14096     int fd, rv;
14097     fd = open ("try.c", O_RDWR);
14098     if (-1 == fd) exit (1);
14099     rv = futimes (fd, NULL);
14100     exit (rv == -1 ? errno : 0);
14101 }
14102 EOCP
14103 set try
14104 if eval $compile; then
14105     `$run ./try`
14106     rc=$?
14107     case "$rc" in
14108         0)  echo "Yes, you have" >&4
14109             d_futimes="$define"
14110             ;;
14111         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14112             ;;
14113     esac
14114 else
14115     echo "No, it does not (probably harmless)" >&4
14116 fi
14117 $rm_try
14118
14119 : look for gai_strerror
14120 echo " "
14121 $cat >try.c <<'EOCP'
14122 #include <sys/types.h>
14123 #include <sys/socket.h>
14124 #include <netdb.h>
14125 int main ()
14126 {
14127     return (gai_strerror (0) ? 0 : 1);
14128     }
14129 EOCP
14130 set try
14131 val="$undef"
14132 if eval $compile; then
14133     `$run ./try`
14134     case "$?" in
14135         0)  echo "A working gai_strerror() found." >&4
14136             val="$define" ;;
14137         *)  echo "gai_strerror() found, but it doesn't work" >&4
14138             ;;
14139         esac
14140 else
14141     echo "gai_strerror() NOT found." >&4
14142     fi
14143 set d_gai_strerror
14144 eval $setvar
14145 $rm_try
14146
14147 : see if ndbm.h is available
14148 set ndbm.h i_ndbm
14149 eval $inhdr
14150 : Compatibility location for RedHat 7.1
14151 set gdbm/ndbm.h i_gdbmndbm
14152 eval $inhdr
14153 : Compatibility location for Debian 4.0
14154 set gdbm-ndbm.h i_gdbm_ndbm
14155 eval $inhdr
14156
14157 val="$undef"
14158 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14159         : see if dbm_open exists
14160         set dbm_open d_dbm_open
14161         eval $inlibc
14162         case "$d_dbm_open" in
14163         $undef)
14164                 i_ndbm="$undef"
14165                 i_gdbmndbm="$undef"
14166                 i_gdbm_ndbm="$undef"
14167                 echo "We won't be including <ndbm.h>"
14168                 val="$undef"
14169                 ;;
14170         *) val="$define"
14171            ;;
14172         esac
14173 fi
14174 set d_ndbm
14175 eval $setvar
14176
14177 ndbm_hdr_protochk='name=$1; hdr=$2;
14178 eval "ihdr=\$""i_$name";
14179 val="$undef";
14180 if $test "$ihdr" = "$define"; then
14181         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14182         case "$d_cplusplus" in
14183         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14184         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14185         esac;
14186         case "$val" in
14187         $define) $echo "Your <$hdr> seems to have prototypes";;
14188         *) $echo "Your <$hdr> does not seem to have prototypes";;
14189         esac;
14190 fi;
14191 set "d_${name}_h_uses_prototypes";
14192 eval $setvar'
14193
14194 set ndbm ndbm.h
14195 eval $ndbm_hdr_protochk
14196 set gdbmndbm gdbm/ndbm.h
14197 eval $ndbm_hdr_protochk
14198 set gdbm_ndbm gdbm-ndbm.h
14199 eval $ndbm_hdr_protochk
14200
14201 : see if getaddrinfo exists
14202 set getaddrinfo d_getaddrinfo
14203 eval $inlibc
14204
14205 : see if getcwd exists
14206 set getcwd d_getcwd
14207 eval $inlibc
14208
14209 : see if getespwnam exists
14210 set getespwnam d_getespwnam
14211 eval $inlibc
14212
14213 : see if getfsstat exists
14214 set getfsstat d_getfsstat
14215 eval $inlibc
14216
14217 : see if getgrent exists
14218 set getgrent d_getgrent
14219 eval $inlibc
14220
14221 : see if getgrent_r exists
14222 set getgrent_r d_getgrent_r
14223 eval $inlibc
14224 case "$d_getgrent_r" in
14225 "$define")
14226         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14227         case "$d_getgrent_r_proto:$usethreads" in
14228         ":define")      d_getgrent_r_proto=define
14229                 set d_getgrent_r_proto getgrent_r $hdrs
14230                 eval $hasproto ;;
14231         *)      ;;
14232         esac
14233         case "$d_getgrent_r_proto" in
14234         define)
14235         case "$getgrent_r_proto" in
14236         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14237         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14238         esac
14239         case "$getgrent_r_proto" in
14240         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14241         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14242         esac
14243         case "$getgrent_r_proto" in
14244         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14245         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14246         esac
14247         case "$getgrent_r_proto" in
14248         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14249         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14250         esac
14251         case "$getgrent_r_proto" in
14252         ''|0) try='int getgrent_r(struct group*, char*, int);'
14253         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14254         esac
14255         case "$getgrent_r_proto" in
14256         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14257         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14258         esac
14259         case "$getgrent_r_proto" in
14260         ''|0)   d_getgrent_r=undef
14261                 getgrent_r_proto=0
14262                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14263         * )     case "$getgrent_r_proto" in
14264                 REENTRANT_PROTO*) ;;
14265                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14266                 esac
14267                 echo "Prototype: $try" ;;
14268         esac
14269         ;;
14270         *)      case "$usethreads" in
14271                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14272                 esac
14273                 d_getgrent_r=undef
14274                 getgrent_r_proto=0
14275                 ;;
14276         esac
14277         ;;
14278 *)      getgrent_r_proto=0
14279         ;;
14280 esac
14281
14282 : see if getgrgid_r exists
14283 set getgrgid_r d_getgrgid_r
14284 eval $inlibc
14285 case "$d_getgrgid_r" in
14286 "$define")
14287         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14288         case "$d_getgrgid_r_proto:$usethreads" in
14289         ":define")      d_getgrgid_r_proto=define
14290                 set d_getgrgid_r_proto getgrgid_r $hdrs
14291                 eval $hasproto ;;
14292         *)      ;;
14293         esac
14294         case "$d_getgrgid_r_proto" in
14295         define)
14296         case "$getgrgid_r_proto" in
14297         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14298         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14299         esac
14300         case "$getgrgid_r_proto" in
14301         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14302         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14303         esac
14304         case "$getgrgid_r_proto" in
14305         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14306         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14307         esac
14308         case "$getgrgid_r_proto" in
14309         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14310         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14311         esac
14312         case "$getgrgid_r_proto" in
14313         ''|0)   d_getgrgid_r=undef
14314                 getgrgid_r_proto=0
14315                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14316         * )     case "$getgrgid_r_proto" in
14317                 REENTRANT_PROTO*) ;;
14318                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14319                 esac
14320                 echo "Prototype: $try" ;;
14321         esac
14322         ;;
14323         *)      case "$usethreads" in
14324                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14325                 esac
14326                 d_getgrgid_r=undef
14327                 getgrgid_r_proto=0
14328                 ;;
14329         esac
14330         ;;
14331 *)      getgrgid_r_proto=0
14332         ;;
14333 esac
14334
14335 : see if getgrnam_r exists
14336 set getgrnam_r d_getgrnam_r
14337 eval $inlibc
14338 case "$d_getgrnam_r" in
14339 "$define")
14340         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14341         case "$d_getgrnam_r_proto:$usethreads" in
14342         ":define")      d_getgrnam_r_proto=define
14343                 set d_getgrnam_r_proto getgrnam_r $hdrs
14344                 eval $hasproto ;;
14345         *)      ;;
14346         esac
14347         case "$d_getgrnam_r_proto" in
14348         define)
14349         case "$getgrnam_r_proto" in
14350         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14351         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14352         esac
14353         case "$getgrnam_r_proto" in
14354         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14355         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14356         esac
14357         case "$getgrnam_r_proto" in
14358         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14359         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14360         esac
14361         case "$getgrnam_r_proto" in
14362         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14363         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14364         esac
14365         case "$getgrnam_r_proto" in
14366         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14367         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14368         esac
14369         case "$getgrnam_r_proto" in
14370         ''|0)   d_getgrnam_r=undef
14371                 getgrnam_r_proto=0
14372                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14373         * )     case "$getgrnam_r_proto" in
14374                 REENTRANT_PROTO*) ;;
14375                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14376                 esac
14377                 echo "Prototype: $try" ;;
14378         esac
14379         ;;
14380         *)      case "$usethreads" in
14381                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14382                 esac
14383                 d_getgrnam_r=undef
14384                 getgrnam_r_proto=0
14385                 ;;
14386         esac
14387         ;;
14388 *)      getgrnam_r_proto=0
14389         ;;
14390 esac
14391
14392 : see if gethostbyaddr exists
14393 set gethostbyaddr d_gethbyaddr
14394 eval $inlibc
14395
14396 : see if gethostbyname exists
14397 set gethostbyname d_gethbyname
14398 eval $inlibc
14399
14400 : see if gethostent exists
14401 set gethostent d_gethent
14402 eval $inlibc
14403
14404 : see how we will look up host name
14405 echo " "
14406 call=''
14407 if set gethostname val -f d_gethname; eval $csym; $val; then
14408         echo 'gethostname() found.' >&4
14409         d_gethname="$define"
14410         call=gethostname
14411 fi
14412 if set uname val -f d_uname; eval $csym; $val; then
14413         if ./xenix; then
14414                 $cat <<'EOM'
14415 uname() was found, but you're running xenix, and older versions of xenix
14416 have a broken uname(). If you don't really know whether your xenix is old
14417 enough to have a broken system call, use the default answer.
14418
14419 EOM
14420                 dflt=y
14421                 case "$d_uname" in
14422                 "$define") dflt=n;;
14423                 esac
14424                 rp='Is your uname() broken?'
14425                 . ./myread
14426                 case "$ans" in
14427                 n*) d_uname="$define"; call=uname;;
14428                 esac
14429         else
14430                 echo 'uname() found.' >&4
14431                 d_uname="$define"
14432                 case "$call" in
14433                 '') call=uname ;;
14434                 esac
14435         fi
14436 fi
14437 case "$d_gethname" in
14438 '') d_gethname="$undef";;
14439 esac
14440 case "$d_uname" in
14441 '') d_uname="$undef";;
14442 esac
14443 case "$d_uname$d_gethname" in
14444 *define*)
14445         dflt=n
14446         cat <<EOM
14447
14448 Every now and then someone has a $call() that lies about the hostname
14449 but can't be fixed for political or economic reasons.  If you wish, I can
14450 pretend $call() isn't there and maybe compute hostname at run-time
14451 thanks to the '$phostname' command.
14452
14453 EOM
14454         rp="Shall I ignore $call() from now on?"
14455         . ./myread
14456         case "$ans" in
14457         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14458         esac;;
14459 esac
14460 case "$phostname" in
14461 '') aphostname='';;
14462 *) case "$aphostname" in
14463         /*) ;;
14464         *) set X $phostname
14465                 shift
14466                 file=$1
14467                 shift
14468                 file=`./loc $file $file $pth`
14469                 aphostname=`echo $file $*`
14470                 ;;
14471         esac
14472         ;;
14473 esac
14474 case "$d_uname$d_gethname" in
14475 *define*) ;;
14476 *)
14477         case "$phostname" in
14478         '')
14479                 echo "There will be no way for $package to get your hostname." >&4;;
14480         *)
14481         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14482                 ;;
14483         esac;;
14484 esac
14485 case "$d_phostname" in
14486 '') d_phostname="$undef";;
14487 esac
14488
14489 : see if gethostbyaddr_r exists
14490 set gethostbyaddr_r d_gethostbyaddr_r
14491 eval $inlibc
14492 case "$d_gethostbyaddr_r" in
14493 "$define")
14494         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14495         case "$d_gethostbyaddr_r_proto:$usethreads" in
14496         ":define")      d_gethostbyaddr_r_proto=define
14497                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14498                 eval $hasproto ;;
14499         *)      ;;
14500         esac
14501         case "$d_gethostbyaddr_r_proto" in
14502         define)
14503         case "$gethostbyaddr_r_proto" in
14504         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14505         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14506         esac
14507         case "$gethostbyaddr_r_proto" in
14508         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14509         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14510         esac
14511         case "$gethostbyaddr_r_proto" in
14512         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14513         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14514         esac
14515         case "$gethostbyaddr_r_proto" in
14516         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14517         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14518         esac
14519         case "$gethostbyaddr_r_proto" in
14520         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14521         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14522         esac
14523         case "$gethostbyaddr_r_proto" in
14524         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14525         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14526         esac
14527         case "$gethostbyaddr_r_proto" in
14528         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14529         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14530         esac
14531         case "$gethostbyaddr_r_proto" in
14532         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14533         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14534         esac
14535         case "$gethostbyaddr_r_proto" in
14536         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14537         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14538         esac
14539         case "$gethostbyaddr_r_proto" in
14540         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14541         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14542         esac
14543         case "$gethostbyaddr_r_proto" in
14544         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14545         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14546         esac
14547         case "$gethostbyaddr_r_proto" in
14548         ''|0)   d_gethostbyaddr_r=undef
14549                 gethostbyaddr_r_proto=0
14550                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14551         * )     case "$gethostbyaddr_r_proto" in
14552                 REENTRANT_PROTO*) ;;
14553                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14554                 esac
14555                 echo "Prototype: $try" ;;
14556         esac
14557         ;;
14558         *)      case "$usethreads" in
14559                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14560                 esac
14561                 d_gethostbyaddr_r=undef
14562                 gethostbyaddr_r_proto=0
14563                 ;;
14564         esac
14565         ;;
14566 *)      gethostbyaddr_r_proto=0
14567         ;;
14568 esac
14569
14570 : see if gethostbyname_r exists
14571 set gethostbyname_r d_gethostbyname_r
14572 eval $inlibc
14573 case "$d_gethostbyname_r" in
14574 "$define")
14575         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14576         case "$d_gethostbyname_r_proto:$usethreads" in
14577         ":define")      d_gethostbyname_r_proto=define
14578                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14579                 eval $hasproto ;;
14580         *)      ;;
14581         esac
14582         case "$d_gethostbyname_r_proto" in
14583         define)
14584         case "$gethostbyname_r_proto" in
14585         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14586         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14587         esac
14588         case "$gethostbyname_r_proto" in
14589         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14590         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14591         esac
14592         case "$gethostbyname_r_proto" in
14593         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14594         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14595         esac
14596         case "$gethostbyname_r_proto" in
14597         ''|0)   d_gethostbyname_r=undef
14598                 gethostbyname_r_proto=0
14599                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14600         * )     case "$gethostbyname_r_proto" in
14601                 REENTRANT_PROTO*) ;;
14602                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14603                 esac
14604                 echo "Prototype: $try" ;;
14605         esac
14606         ;;
14607         *)      case "$usethreads" in
14608                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14609                 esac
14610                 d_gethostbyname_r=undef
14611                 gethostbyname_r_proto=0
14612                 ;;
14613         esac
14614         ;;
14615 *)      gethostbyname_r_proto=0
14616         ;;
14617 esac
14618
14619 : see if gethostent_r exists
14620 set gethostent_r d_gethostent_r
14621 eval $inlibc
14622 case "$d_gethostent_r" in
14623 "$define")
14624         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14625         case "$d_gethostent_r_proto:$usethreads" in
14626         ":define")      d_gethostent_r_proto=define
14627                 set d_gethostent_r_proto gethostent_r $hdrs
14628                 eval $hasproto ;;
14629         *)      ;;
14630         esac
14631         case "$d_gethostent_r_proto" in
14632         define)
14633         case "$gethostent_r_proto" in
14634         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14635         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14636         esac
14637         case "$gethostent_r_proto" in
14638         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14639         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14640         esac
14641         case "$gethostent_r_proto" in
14642         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14643         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14644         esac
14645         case "$gethostent_r_proto" in
14646         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14647         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14648         esac
14649         case "$gethostent_r_proto" in
14650         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14651         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14652         esac
14653         case "$gethostent_r_proto" in
14654         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14655         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14656         esac
14657         case "$gethostent_r_proto" in
14658         ''|0)   d_gethostent_r=undef
14659                 gethostent_r_proto=0
14660                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14661         * )     case "$gethostent_r_proto" in
14662                 REENTRANT_PROTO*) ;;
14663                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14664                 esac
14665                 echo "Prototype: $try" ;;
14666         esac
14667         ;;
14668         *)      case "$usethreads" in
14669                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14670                 esac
14671                 d_gethostent_r=undef
14672                 gethostent_r_proto=0
14673                 ;;
14674         esac
14675         ;;
14676 *)      gethostent_r_proto=0
14677         ;;
14678 esac
14679
14680 : see if prototypes for various gethostxxx netdb.h functions are available
14681 echo " "
14682 set d_gethostprotos gethostent $i_netdb netdb.h
14683 eval $hasproto
14684
14685 : see if getitimer exists
14686 set getitimer d_getitimer
14687 eval $inlibc
14688
14689 : see if getlogin exists
14690 set getlogin d_getlogin
14691 eval $inlibc
14692
14693 : see if getlogin_r exists
14694 set getlogin_r d_getlogin_r
14695 eval $inlibc
14696 case "$d_getlogin_r" in
14697 "$define")
14698         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14699         case "$d_getlogin_r_proto:$usethreads" in
14700         ":define")      d_getlogin_r_proto=define
14701                 set d_getlogin_r_proto getlogin_r $hdrs
14702                 eval $hasproto ;;
14703         *)      ;;
14704         esac
14705         case "$d_getlogin_r_proto" in
14706         define)
14707         case "$getlogin_r_proto" in
14708         ''|0) try='int getlogin_r(char*, size_t);'
14709         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14710         esac
14711         case "$getlogin_r_proto" in
14712         ''|0) try='int getlogin_r(char*, int);'
14713         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14714         esac
14715         case "$getlogin_r_proto" in
14716         ''|0) try='char* getlogin_r(char*, size_t);'
14717         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14718         esac
14719         case "$getlogin_r_proto" in
14720         ''|0) try='char* getlogin_r(char*, int);'
14721         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14722         esac
14723         case "$getlogin_r_proto" in
14724         ''|0)   d_getlogin_r=undef
14725                 getlogin_r_proto=0
14726                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14727         * )     case "$getlogin_r_proto" in
14728                 REENTRANT_PROTO*) ;;
14729                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14730                 esac
14731                 echo "Prototype: $try" ;;
14732         esac
14733         ;;
14734         *)      case "$usethreads" in
14735                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14736                 esac
14737                 d_getlogin_r=undef
14738                 getlogin_r_proto=0
14739                 ;;
14740         esac
14741         ;;
14742 *)      getlogin_r_proto=0
14743         ;;
14744 esac
14745
14746 : see if getmnt exists
14747 set getmnt d_getmnt
14748 eval $inlibc
14749
14750 : see if getmntent exists
14751 set getmntent d_getmntent
14752 eval $inlibc
14753
14754 : see if getnameinfo exists
14755 set getnameinfo d_getnameinfo
14756 eval $inlibc
14757
14758 : see if getnetbyaddr exists
14759 set getnetbyaddr d_getnbyaddr
14760 eval $inlibc
14761
14762 : see if getnetbyname exists
14763 set getnetbyname d_getnbyname
14764 eval $inlibc
14765
14766 : see if getnetent exists
14767 set getnetent d_getnent
14768 eval $inlibc
14769
14770 : see if getnetbyaddr_r exists
14771 set getnetbyaddr_r d_getnetbyaddr_r
14772 eval $inlibc
14773 case "$d_getnetbyaddr_r" in
14774 "$define")
14775         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14776         case "$d_getnetbyaddr_r_proto:$usethreads" in
14777         ":define")      d_getnetbyaddr_r_proto=define
14778                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14779                 eval $hasproto ;;
14780         *)      ;;
14781         esac
14782         case "$d_getnetbyaddr_r_proto" in
14783         define)
14784         case "$getnetbyaddr_r_proto" in
14785         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14786         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14787         esac
14788         case "$getnetbyaddr_r_proto" in
14789         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14790         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14791         esac
14792         case "$getnetbyaddr_r_proto" in
14793         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14794         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14795         esac
14796         case "$getnetbyaddr_r_proto" in
14797         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14798         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14799         esac
14800         case "$getnetbyaddr_r_proto" in
14801         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14802         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14803         esac
14804         case "$getnetbyaddr_r_proto" in
14805         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14806         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14807         esac
14808         case "$getnetbyaddr_r_proto" in
14809         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14810         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14811         esac
14812         case "$getnetbyaddr_r_proto" in
14813         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14814         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14815         esac
14816         case "$getnetbyaddr_r_proto" in
14817         ''|0)   d_getnetbyaddr_r=undef
14818                 getnetbyaddr_r_proto=0
14819                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14820         * )     case "$getnetbyaddr_r_proto" in
14821                 REENTRANT_PROTO*) ;;
14822                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14823                 esac
14824                 echo "Prototype: $try" ;;
14825         esac
14826         ;;
14827         *)      case "$usethreads" in
14828                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14829                 esac
14830                 d_getnetbyaddr_r=undef
14831                 getnetbyaddr_r_proto=0
14832                 ;;
14833         esac
14834         ;;
14835 *)      getnetbyaddr_r_proto=0
14836         ;;
14837 esac
14838
14839 : see if getnetbyname_r exists
14840 set getnetbyname_r d_getnetbyname_r
14841 eval $inlibc
14842 case "$d_getnetbyname_r" in
14843 "$define")
14844         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14845         case "$d_getnetbyname_r_proto:$usethreads" in
14846         ":define")      d_getnetbyname_r_proto=define
14847                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14848                 eval $hasproto ;;
14849         *)      ;;
14850         esac
14851         case "$d_getnetbyname_r_proto" in
14852         define)
14853         case "$getnetbyname_r_proto" in
14854         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14855         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14856         esac
14857         case "$getnetbyname_r_proto" in
14858         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14859         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14860         esac
14861         case "$getnetbyname_r_proto" in
14862         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14863         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14864         esac
14865         case "$getnetbyname_r_proto" in
14866         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14867         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14868         esac
14869         case "$getnetbyname_r_proto" in
14870         ''|0)   d_getnetbyname_r=undef
14871                 getnetbyname_r_proto=0
14872                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14873         * )     case "$getnetbyname_r_proto" in
14874                 REENTRANT_PROTO*) ;;
14875                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14876                 esac
14877                 echo "Prototype: $try" ;;
14878         esac
14879         ;;
14880         *)      case "$usethreads" in
14881                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14882                 esac
14883                 d_getnetbyname_r=undef
14884                 getnetbyname_r_proto=0
14885                 ;;
14886         esac
14887         ;;
14888 *)      getnetbyname_r_proto=0
14889         ;;
14890 esac
14891
14892 : see if getnetent_r exists
14893 set getnetent_r d_getnetent_r
14894 eval $inlibc
14895 case "$d_getnetent_r" in
14896 "$define")
14897         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14898         case "$d_getnetent_r_proto:$usethreads" in
14899         ":define")      d_getnetent_r_proto=define
14900                 set d_getnetent_r_proto getnetent_r $hdrs
14901                 eval $hasproto ;;
14902         *)      ;;
14903         esac
14904         case "$d_getnetent_r_proto" in
14905         define)
14906         case "$getnetent_r_proto" in
14907         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14908         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14909         esac
14910         case "$getnetent_r_proto" in
14911         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14912         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14913         esac
14914         case "$getnetent_r_proto" in
14915         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14916         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14917         esac
14918         case "$getnetent_r_proto" in
14919         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14920         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14921         esac
14922         case "$getnetent_r_proto" in
14923         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14924         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14925         esac
14926         case "$getnetent_r_proto" in
14927         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14928         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14929         esac
14930         case "$getnetent_r_proto" in
14931         ''|0)   d_getnetent_r=undef
14932                 getnetent_r_proto=0
14933                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14934         * )     case "$getnetent_r_proto" in
14935                 REENTRANT_PROTO*) ;;
14936                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14937                 esac
14938                 echo "Prototype: $try" ;;
14939         esac
14940         ;;
14941         *)      case "$usethreads" in
14942                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14943                 esac
14944                 d_getnetent_r=undef
14945                 getnetent_r_proto=0
14946                 ;;
14947         esac
14948         ;;
14949 *)      getnetent_r_proto=0
14950         ;;
14951 esac
14952
14953 : see if prototypes for various getnetxxx netdb.h functions are available
14954 echo " "
14955 set d_getnetprotos getnetent $i_netdb netdb.h
14956 eval $hasproto
14957
14958 : see if getpagesize exists
14959 set getpagesize d_getpagsz
14960 eval $inlibc
14961
14962 : Optional checks for getprotobyname and getprotobynumber
14963
14964 : see if getprotobyname exists
14965 set getprotobyname d_getpbyname
14966 eval $inlibc
14967
14968 : see if getprotobynumber exists
14969 set getprotobynumber d_getpbynumber
14970 eval $inlibc
14971
14972 : see if getprotoent exists
14973 set getprotoent d_getpent
14974 eval $inlibc
14975
14976 : see if getpgid exists
14977 set getpgid d_getpgid
14978 eval $inlibc
14979
14980 : see if getpgrp2 exists
14981 set getpgrp2 d_getpgrp2
14982 eval $inlibc
14983
14984 : see if getppid exists
14985 set getppid d_getppid
14986 eval $inlibc
14987
14988 : see if getpriority exists
14989 set getpriority d_getprior
14990 eval $inlibc
14991
14992 : see if getprotobyname_r exists
14993 set getprotobyname_r d_getprotobyname_r
14994 eval $inlibc
14995 case "$d_getprotobyname_r" in
14996 "$define")
14997         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14998         case "$d_getprotobyname_r_proto:$usethreads" in
14999         ":define")      d_getprotobyname_r_proto=define
15000                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15001                 eval $hasproto ;;
15002         *)      ;;
15003         esac
15004         case "$d_getprotobyname_r_proto" in
15005         define)
15006         case "$getprotobyname_r_proto" in
15007         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15008         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15009         esac
15010         case "$getprotobyname_r_proto" in
15011         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15012         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15013         esac
15014         case "$getprotobyname_r_proto" in
15015         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15016         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15017         esac
15018         case "$getprotobyname_r_proto" in
15019         ''|0)   d_getprotobyname_r=undef
15020                 getprotobyname_r_proto=0
15021                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15022         * )     case "$getprotobyname_r_proto" in
15023                 REENTRANT_PROTO*) ;;
15024                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15025                 esac
15026                 echo "Prototype: $try" ;;
15027         esac
15028         ;;
15029         *)      case "$usethreads" in
15030                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15031                 esac
15032                 d_getprotobyname_r=undef
15033                 getprotobyname_r_proto=0
15034                 ;;
15035         esac
15036         ;;
15037 *)      getprotobyname_r_proto=0
15038         ;;
15039 esac
15040
15041 : see if getprotobynumber_r exists
15042 set getprotobynumber_r d_getprotobynumber_r
15043 eval $inlibc
15044 case "$d_getprotobynumber_r" in
15045 "$define")
15046         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15047         case "$d_getprotobynumber_r_proto:$usethreads" in
15048         ":define")      d_getprotobynumber_r_proto=define
15049                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15050                 eval $hasproto ;;
15051         *)      ;;
15052         esac
15053         case "$d_getprotobynumber_r_proto" in
15054         define)
15055         case "$getprotobynumber_r_proto" in
15056         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15057         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15058         esac
15059         case "$getprotobynumber_r_proto" in
15060         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15061         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15062         esac
15063         case "$getprotobynumber_r_proto" in
15064         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15065         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15066         esac
15067         case "$getprotobynumber_r_proto" in
15068         ''|0)   d_getprotobynumber_r=undef
15069                 getprotobynumber_r_proto=0
15070                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15071         * )     case "$getprotobynumber_r_proto" in
15072                 REENTRANT_PROTO*) ;;
15073                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15074                 esac
15075                 echo "Prototype: $try" ;;
15076         esac
15077         ;;
15078         *)      case "$usethreads" in
15079                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15080                 esac
15081                 d_getprotobynumber_r=undef
15082                 getprotobynumber_r_proto=0
15083                 ;;
15084         esac
15085         ;;
15086 *)      getprotobynumber_r_proto=0
15087         ;;
15088 esac
15089
15090 : see if getprotoent_r exists
15091 set getprotoent_r d_getprotoent_r
15092 eval $inlibc
15093 case "$d_getprotoent_r" in
15094 "$define")
15095         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15096         case "$d_getprotoent_r_proto:$usethreads" in
15097         ":define")      d_getprotoent_r_proto=define
15098                 set d_getprotoent_r_proto getprotoent_r $hdrs
15099                 eval $hasproto ;;
15100         *)      ;;
15101         esac
15102         case "$d_getprotoent_r_proto" in
15103         define)
15104         case "$getprotoent_r_proto" in
15105         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15106         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15107         esac
15108         case "$getprotoent_r_proto" in
15109         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15110         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15111         esac
15112         case "$getprotoent_r_proto" in
15113         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15114         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15115         esac
15116         case "$getprotoent_r_proto" in
15117         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15118         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15119         esac
15120         case "$getprotoent_r_proto" in
15121         ''|0)   d_getprotoent_r=undef
15122                 getprotoent_r_proto=0
15123                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15124         * )     case "$getprotoent_r_proto" in
15125                 REENTRANT_PROTO*) ;;
15126                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15127                 esac
15128                 echo "Prototype: $try" ;;
15129         esac
15130         ;;
15131         *)      case "$usethreads" in
15132                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15133                 esac
15134                 d_getprotoent_r=undef
15135                 getprotoent_r_proto=0
15136                 ;;
15137         esac
15138         ;;
15139 *)      getprotoent_r_proto=0
15140         ;;
15141 esac
15142
15143 : see if prototypes for various getprotoxxx netdb.h functions are available
15144 echo " "
15145 set d_getprotoprotos getprotoent $i_netdb netdb.h
15146 eval $hasproto
15147
15148 : see if getprpwnam exists
15149 set getprpwnam d_getprpwnam
15150 eval $inlibc
15151
15152 : see if getpwent exists
15153 set getpwent d_getpwent
15154 eval $inlibc
15155
15156 : see if getpwent_r exists
15157 set getpwent_r d_getpwent_r
15158 eval $inlibc
15159 case "$d_getpwent_r" in
15160 "$define")
15161         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15162         case "$d_getpwent_r_proto:$usethreads" in
15163         ":define")      d_getpwent_r_proto=define
15164                 set d_getpwent_r_proto getpwent_r $hdrs
15165                 eval $hasproto ;;
15166         *)      ;;
15167         esac
15168         case "$d_getpwent_r_proto" in
15169         define)
15170         case "$getpwent_r_proto" in
15171         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15172         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15173         esac
15174         case "$getpwent_r_proto" in
15175         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15176         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15177         esac
15178         case "$getpwent_r_proto" in
15179         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15180         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15181         esac
15182         case "$getpwent_r_proto" in
15183         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15184         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15185         esac
15186         case "$getpwent_r_proto" in
15187         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15188         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15189         esac
15190         case "$getpwent_r_proto" in
15191         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15192         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15193         esac
15194         case "$getpwent_r_proto" in
15195         ''|0)   d_getpwent_r=undef
15196                 getpwent_r_proto=0
15197                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15198         * )     case "$getpwent_r_proto" in
15199                 REENTRANT_PROTO*) ;;
15200                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15201                 esac
15202                 echo "Prototype: $try" ;;
15203         esac
15204         ;;
15205         *)      case "$usethreads" in
15206                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15207                 esac
15208                 d_getpwent_r=undef
15209                 getpwent_r_proto=0
15210                 ;;
15211         esac
15212         ;;
15213 *)      getpwent_r_proto=0
15214         ;;
15215 esac
15216
15217 : see if getpwnam_r exists
15218 set getpwnam_r d_getpwnam_r
15219 eval $inlibc
15220 case "$d_getpwnam_r" in
15221 "$define")
15222         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15223         case "$d_getpwnam_r_proto:$usethreads" in
15224         ":define")      d_getpwnam_r_proto=define
15225                 set d_getpwnam_r_proto getpwnam_r $hdrs
15226                 eval $hasproto ;;
15227         *)      ;;
15228         esac
15229         case "$d_getpwnam_r_proto" in
15230         define)
15231         case "$getpwnam_r_proto" in
15232         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15233         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15234         esac
15235         case "$getpwnam_r_proto" in
15236         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15237         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15238         esac
15239         case "$getpwnam_r_proto" in
15240         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15241         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15242         esac
15243         case "$getpwnam_r_proto" in
15244         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15245         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15246         esac
15247         case "$getpwnam_r_proto" in
15248         ''|0)   d_getpwnam_r=undef
15249                 getpwnam_r_proto=0
15250                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15251         * )     case "$getpwnam_r_proto" in
15252                 REENTRANT_PROTO*) ;;
15253                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15254                 esac
15255                 echo "Prototype: $try" ;;
15256         esac
15257         ;;
15258         *)      case "$usethreads" in
15259                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15260                 esac
15261                 d_getpwnam_r=undef
15262                 getpwnam_r_proto=0
15263                 ;;
15264         esac
15265         ;;
15266 *)      getpwnam_r_proto=0
15267         ;;
15268 esac
15269
15270 : see if getpwuid_r exists
15271 set getpwuid_r d_getpwuid_r
15272 eval $inlibc
15273 case "$d_getpwuid_r" in
15274 "$define")
15275         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15276         case "$d_getpwuid_r_proto:$usethreads" in
15277         ":define")      d_getpwuid_r_proto=define
15278                 set d_getpwuid_r_proto getpwuid_r $hdrs
15279                 eval $hasproto ;;
15280         *)      ;;
15281         esac
15282         case "$d_getpwuid_r_proto" in
15283         define)
15284         case "$getpwuid_r_proto" in
15285         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15286         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15287         esac
15288         case "$getpwuid_r_proto" in
15289         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15290         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15291         esac
15292         case "$getpwuid_r_proto" in
15293         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15294         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15295         esac
15296         case "$getpwuid_r_proto" in
15297         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15298         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15299         esac
15300         case "$getpwuid_r_proto" in
15301         ''|0)   d_getpwuid_r=undef
15302                 getpwuid_r_proto=0
15303                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15304         * )     case "$getpwuid_r_proto" in
15305                 REENTRANT_PROTO*) ;;
15306                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15307                 esac
15308                 echo "Prototype: $try" ;;
15309         esac
15310         ;;
15311         *)      case "$usethreads" in
15312                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15313                 esac
15314                 d_getpwuid_r=undef
15315                 getpwuid_r_proto=0
15316                 ;;
15317         esac
15318         ;;
15319 *)      getpwuid_r_proto=0
15320         ;;
15321 esac
15322
15323 : Optional checks for getsbyname and getsbyport
15324
15325 : see if getservbyname exists
15326 set getservbyname d_getsbyname
15327 eval $inlibc
15328
15329 : see if getservbyport exists
15330 set getservbyport d_getsbyport
15331 eval $inlibc
15332
15333 : see if getservent exists
15334 set getservent d_getsent
15335 eval $inlibc
15336
15337 : see if getservbyname_r exists
15338 set getservbyname_r d_getservbyname_r
15339 eval $inlibc
15340 case "$d_getservbyname_r" in
15341 "$define")
15342         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15343         case "$d_getservbyname_r_proto:$usethreads" in
15344         ":define")      d_getservbyname_r_proto=define
15345                 set d_getservbyname_r_proto getservbyname_r $hdrs
15346                 eval $hasproto ;;
15347         *)      ;;
15348         esac
15349         case "$d_getservbyname_r_proto" in
15350         define)
15351         case "$getservbyname_r_proto" in
15352         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15353         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15354         esac
15355         case "$getservbyname_r_proto" in
15356         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15357         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15358         esac
15359         case "$getservbyname_r_proto" in
15360         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15361         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15362         esac
15363         case "$getservbyname_r_proto" in
15364         ''|0)   d_getservbyname_r=undef
15365                 getservbyname_r_proto=0
15366                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15367         * )     case "$getservbyname_r_proto" in
15368                 REENTRANT_PROTO*) ;;
15369                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15370                 esac
15371                 echo "Prototype: $try" ;;
15372         esac
15373         ;;
15374         *)      case "$usethreads" in
15375                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15376                 esac
15377                 d_getservbyname_r=undef
15378                 getservbyname_r_proto=0
15379                 ;;
15380         esac
15381         ;;
15382 *)      getservbyname_r_proto=0
15383         ;;
15384 esac
15385
15386 : see if getservbyport_r exists
15387 set getservbyport_r d_getservbyport_r
15388 eval $inlibc
15389 case "$d_getservbyport_r" in
15390 "$define")
15391         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15392         case "$d_getservbyport_r_proto:$usethreads" in
15393         ":define")      d_getservbyport_r_proto=define
15394                 set d_getservbyport_r_proto getservbyport_r $hdrs
15395                 eval $hasproto ;;
15396         *)      ;;
15397         esac
15398         case "$d_getservbyport_r_proto" in
15399         define)
15400         case "$getservbyport_r_proto" in
15401         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15402         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15403         esac
15404         case "$getservbyport_r_proto" in
15405         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15406         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15407         esac
15408         case "$getservbyport_r_proto" in
15409         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15410         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15411         esac
15412         case "$getservbyport_r_proto" in
15413         ''|0)   d_getservbyport_r=undef
15414                 getservbyport_r_proto=0
15415                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15416         * )     case "$getservbyport_r_proto" in
15417                 REENTRANT_PROTO*) ;;
15418                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15419                 esac
15420                 echo "Prototype: $try" ;;
15421         esac
15422         ;;
15423         *)      case "$usethreads" in
15424                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15425                 esac
15426                 d_getservbyport_r=undef
15427                 getservbyport_r_proto=0
15428                 ;;
15429         esac
15430         ;;
15431 *)      getservbyport_r_proto=0
15432         ;;
15433 esac
15434
15435 : see if getservent_r exists
15436 set getservent_r d_getservent_r
15437 eval $inlibc
15438 case "$d_getservent_r" in
15439 "$define")
15440         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15441         case "$d_getservent_r_proto:$usethreads" in
15442         ":define")      d_getservent_r_proto=define
15443                 set d_getservent_r_proto getservent_r $hdrs
15444                 eval $hasproto ;;
15445         *)      ;;
15446         esac
15447         case "$d_getservent_r_proto" in
15448         define)
15449         case "$getservent_r_proto" in
15450         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15451         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15452         esac
15453         case "$getservent_r_proto" in
15454         ''|0) try='int getservent_r(struct servent*, char*, int);'
15455         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15456         esac
15457         case "$getservent_r_proto" in
15458         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15459         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15460         esac
15461         case "$getservent_r_proto" in
15462         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15463         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15464         esac
15465         case "$getservent_r_proto" in
15466         ''|0)   d_getservent_r=undef
15467                 getservent_r_proto=0
15468                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15469         * )     case "$getservent_r_proto" in
15470                 REENTRANT_PROTO*) ;;
15471                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15472                 esac
15473                 echo "Prototype: $try" ;;
15474         esac
15475         ;;
15476         *)      case "$usethreads" in
15477                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15478                 esac
15479                 d_getservent_r=undef
15480                 getservent_r_proto=0
15481                 ;;
15482         esac
15483         ;;
15484 *)      getservent_r_proto=0
15485         ;;
15486 esac
15487
15488 : see if prototypes for various getservxxx netdb.h functions are available
15489 echo " "
15490 set d_getservprotos getservent $i_netdb netdb.h
15491 eval $hasproto
15492
15493 : see if getspnam exists
15494 set getspnam d_getspnam
15495 eval $inlibc
15496
15497 : see if this is a shadow.h system
15498 set shadow.h i_shadow
15499 eval $inhdr
15500
15501 : see if getspnam_r exists
15502 set getspnam_r d_getspnam_r
15503 eval $inlibc
15504 case "$d_getspnam_r" in
15505 "$define")
15506         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15507         case "$d_getspnam_r_proto:$usethreads" in
15508         ":define")      d_getspnam_r_proto=define
15509                 set d_getspnam_r_proto getspnam_r $hdrs
15510                 eval $hasproto ;;
15511         *)      ;;
15512         esac
15513         case "$d_getspnam_r_proto" in
15514         define)
15515         case "$getspnam_r_proto" in
15516         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15517         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15518         esac
15519         case "$getspnam_r_proto" in
15520         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15521         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15522         esac
15523         case "$getspnam_r_proto" in
15524         ''|0)   d_getspnam_r=undef
15525                 getspnam_r_proto=0
15526                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15527         * )     case "$getspnam_r_proto" in
15528                 REENTRANT_PROTO*) ;;
15529                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15530                 esac
15531                 echo "Prototype: $try" ;;
15532         esac
15533         ;;
15534         *)      case "$usethreads" in
15535                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15536                 esac
15537                 d_getspnam_r=undef
15538                 getspnam_r_proto=0
15539                 ;;
15540         esac
15541         ;;
15542 *)      getspnam_r_proto=0
15543         ;;
15544 esac
15545
15546 : see if gettimeofday or ftime exists
15547 set gettimeofday d_gettimeod
15548 eval $inlibc
15549 case "$d_gettimeod" in
15550 "$undef")
15551         set ftime d_ftime 
15552         eval $inlibc
15553         ;;
15554 *)
15555         val="$undef"; set d_ftime; eval $setvar
15556         ;;
15557 esac
15558 case "$d_gettimeod$d_ftime" in
15559 "$undef$undef")
15560         echo " "
15561         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15562         ;;
15563 esac
15564
15565 : see if gmtime_r exists
15566 set gmtime_r d_gmtime_r
15567 eval $inlibc
15568 case "$d_gmtime_r" in
15569 "$define")
15570         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15571         case "$d_gmtime_r_proto:$usethreads" in
15572         ":define")      d_gmtime_r_proto=define
15573                 set d_gmtime_r_proto gmtime_r $hdrs
15574                 eval $hasproto ;;
15575         *)      ;;
15576         esac
15577         case "$d_gmtime_r_proto" in
15578         define)
15579         case "$gmtime_r_proto" in
15580         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15581         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15582         esac
15583         case "$gmtime_r_proto" in
15584         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15585         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15586         esac
15587         case "$gmtime_r_proto" in
15588         ''|0)   d_gmtime_r=undef
15589                 gmtime_r_proto=0
15590                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15591         * )     case "$gmtime_r_proto" in
15592                 REENTRANT_PROTO*) ;;
15593                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15594                 esac
15595                 echo "Prototype: $try" ;;
15596         esac
15597         ;;
15598         *)      case "$usethreads" in
15599                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15600                 esac
15601                 d_gmtime_r=undef
15602                 gmtime_r_proto=0
15603                 ;;
15604         esac
15605         ;;
15606 *)      gmtime_r_proto=0
15607         ;;
15608 esac
15609
15610 : see if hasmntopt exists
15611 set hasmntopt d_hasmntopt
15612 eval $inlibc
15613
15614 : see if this is a netinet/in.h or sys/in.h system
15615 set netinet/in.h i_niin sys/in.h i_sysin
15616 eval $inhdr
15617
15618 : see if arpa/inet.h has to be included
15619 set arpa/inet.h i_arpainet
15620 eval $inhdr
15621
15622 : see if htonl --and friends-- exists
15623 val=''
15624 set htonl val
15625 eval $inlibc
15626
15627 : Maybe they are macros.
15628 case "$val" in
15629 $undef)
15630         $cat >htonl.c <<EOM
15631 #include <stdio.h>
15632 #include <sys/types.h>
15633 #$i_niin I_NETINET_IN
15634 #$i_sysin I_SYS_IN
15635 #$i_arpainet I_ARPA_INET
15636 #ifdef I_NETINET_IN
15637 #include <netinet/in.h>
15638 #endif
15639 #ifdef I_SYS_IN
15640 #include <sys/in.h>
15641 #endif
15642 #ifdef I_ARPA_INET
15643 #include <arpa/inet.h>
15644 #endif
15645 #ifdef htonl
15646 printf("Defined as a macro.");
15647 #endif
15648 EOM
15649         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15650         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15651                 val="$define"
15652                 echo "But it seems to be defined as a macro." >&4
15653         fi
15654         $rm -f htonl.?
15655         ;;
15656 esac
15657 set d_htonl
15658 eval $setvar
15659
15660 : see if hypot exists
15661 set hypot d_hypot
15662 eval $inlibc
15663
15664 : see if ilogb exists
15665 set ilogb d_ilogb
15666 eval $inlibc
15667
15668 : see if ilogbl exists
15669 set ilogbl d_ilogbl
15670 eval $inlibc
15671
15672 : check whether inet_aton exists
15673 set inet_aton d_inetaton
15674 eval $inlibc
15675
15676 : see if inet_ntop exists
15677 set inet_ntop d_inetntop
15678 eval $inlibc
15679
15680 : see if inet_pton exists
15681 set inet_pton d_inetpton
15682 eval $inlibc
15683
15684 : Look for isascii
15685 echo " "
15686 $cat >isascii.c <<EOCP
15687 #include <stdio.h>
15688 #include <ctype.h>
15689 #$i_stdlib I_STDLIB
15690 #ifdef I_STDLIB
15691 #include <stdlib.h>
15692 #endif
15693 int main() {
15694         int c = 'A';
15695         if (isascii(c))
15696                 exit(0);
15697         else
15698                 exit(1);
15699 }
15700 EOCP
15701 set isascii
15702 if eval $compile; then
15703         echo "isascii() found." >&4
15704         val="$define"
15705 else
15706         echo "isascii() NOT found." >&4
15707         val="$undef"
15708 fi
15709 set d_isascii
15710 eval $setvar
15711 $rm -f isascii*
15712
15713 : Look for isblank
15714 echo " "
15715 $cat >isblank.c <<'EOCP'
15716 #include <stdio.h>
15717 #include <ctype.h>
15718 int main() {
15719         int c = ' ';
15720         if (isblank(c))
15721                 return 0 ;
15722         else
15723                 return 1 ;
15724 }
15725 EOCP
15726 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15727         echo "isblank() found." >&4
15728         val="$define"
15729 else
15730         echo "isblank() NOT found." >&4
15731         val="$undef"
15732 fi
15733 set d_isblank
15734 eval $setvar
15735 $rm -f isblank*
15736
15737 : check for isfinite
15738 echo "Checking to see if you have isfinite..." >&4
15739 $cat >try.c <<EOCP
15740 #include <math.h>
15741 int main() { return isfinite(0.0); }
15742 EOCP
15743 set try
15744 if eval $compile; then
15745         val="$define"
15746         echo "You have isfinite."
15747 else
15748         val="$undef"
15749         echo "You do not have isfinite."
15750 fi
15751 $rm_try
15752 set d_isfinite
15753 eval $setvar
15754
15755 : see if isfinitel exists
15756 set isfinitel d_isfinitel
15757 eval $inlibc
15758
15759 : check for isinf
15760 echo "Checking to see if you have isinf..." >&4
15761 $cat >try.c <<EOCP
15762 #include <math.h>
15763 int main() { return isinf(0.0); }
15764 EOCP
15765 set try
15766 if eval $compile; then
15767         val="$define"
15768         echo "You have isinf."
15769 else
15770         val="$undef"
15771         echo "You do not have isinf."
15772 fi
15773 $rm_try
15774 set d_isinf
15775 eval $setvar
15776
15777 : see if isinfl exists
15778 set isinfl d_isinfl
15779 eval $inlibc
15780
15781 : check for isless
15782 echo "Checking to see if you have isless..." >&4
15783 $cat >try.c <<EOCP
15784 #include <math.h>
15785 int main() { return isless(0.0); }
15786 EOCP
15787 set try
15788 if eval $compile; then
15789         val="$define"
15790         echo "You have isless."
15791 else
15792         val="$undef"
15793         echo "You do not have isless."
15794 fi
15795 $rm_try
15796 set d_isless
15797 eval $setvar
15798
15799 : check for isnan
15800 echo "Checking to see if you have isnan..." >&4
15801 $cat >try.c <<EOCP
15802 #include <math.h>
15803 int main() { return isnan(0.0); }
15804 EOCP
15805 set try
15806 if eval $compile; then
15807         val="$define"
15808         echo "You have isnan."
15809 else
15810         val="$undef"
15811         echo "You do not have isnan."
15812 fi
15813 $rm_try
15814 set d_isnan
15815 eval $setvar
15816
15817 : see if isnanl exists
15818 set isnanl d_isnanl
15819 eval $inlibc
15820
15821 : check for isnormal
15822 echo "Checking to see if you have isnormal..." >&4
15823 $cat >try.c <<EOCP
15824 #include <math.h>
15825 int main() { return isnormal(0.0); }
15826 EOCP
15827 set try
15828 if eval $compile; then
15829         val="$define"
15830         echo "You have isnormal."
15831 else
15832         val="$undef"
15833         echo "You do not have isnormal."
15834 fi
15835 $rm_try
15836 set d_isnormal
15837 eval $setvar
15838
15839 : see if j0 exists
15840 set j0 d_j0
15841 eval $inlibc
15842
15843 : see if j0l exists
15844 set j0l d_j0l
15845 eval $inlibc
15846
15847 : see if killpg exists
15848 set killpg d_killpg
15849 eval $inlibc
15850
15851 : see if localeconv exists
15852 set localeconv d_locconv
15853 eval $inlibc
15854
15855 : see if libc has the POSIX.1-2008 currency locale rules
15856 case "$d_locconv:$d_lc_monetary_2008" in
15857 $define:)
15858         $cat >try.c <<EOCP
15859 #include <locale.h>
15860 int main() {
15861         struct lconv *lc = localeconv();
15862         char int_p_cs_precedes = lc->int_p_cs_precedes;
15863         return 0;
15864 }
15865 EOCP
15866         set try
15867         if eval $compile; then
15868                 d_lc_monetary_2008="$define"
15869         else
15870                 d_lc_monetary_2008="$undef"
15871         fi;
15872         $rm_try
15873         ;;
15874 esac
15875
15876 : see if lchown exists
15877 echo " "
15878 $cat > try.c <<'EOCP'
15879 /* System header to define __stub macros and hopefully few prototypes,
15880     which can conflict with char lchown(); below.  */
15881 #include <assert.h>
15882 /* Override any gcc2 internal prototype to avoid an error.  */
15883 /* We use char because int might match the return type of a gcc2
15884    builtin and then its argument prototype would still apply.  */
15885 char lchown();
15886 int main() {
15887     /*  The GNU C library defines this for functions which it implements
15888         to always fail with ENOSYS.  Some functions are actually named
15889         something starting with __ and the normal name is an alias.  */
15890 #if defined (__stub_lchown) || defined (__stub___lchown)
15891 choke me
15892 #else
15893 lchown();
15894 #endif
15895 ; return 0; }
15896 EOCP
15897 set try
15898 if eval $compile; then
15899     $echo "lchown() found." >&4
15900     val="$define"
15901 else
15902     $echo "lchown() NOT found." >&4
15903     val="$undef"
15904 fi
15905 set d_lchown
15906 eval $setvar
15907
15908 : See if number of significant digits in a double precision number is known
15909 echo " "
15910 $cat >ldbl_dig.c <<EOM
15911 #include <limits.h>
15912 #include <float.h>
15913 #ifdef LDBL_DIG
15914 printf("Contains LDBL_DIG");
15915 #endif
15916 EOM
15917 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15918 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15919         echo "LDBL_DIG found." >&4
15920         val="$define"
15921 else
15922         echo "LDBL_DIG NOT found." >&4
15923         val="$undef"
15924 fi
15925 $rm -f ldbl_dig.?
15926 set d_ldbl_dig
15927 eval $setvar
15928
15929 : see if lgamma exists
15930 set lgamma d_lgamma
15931 eval $inlibc
15932
15933 : see if lgamma_r exists
15934 set lgamma_r d_lgamma_r
15935 eval $inlibc
15936
15937 : check to see if math.h defines _LIB_VERSION
15938 d_libm_lib_version="$undef"
15939 echo " "
15940 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15941 $cat >try.c <<EOCP
15942 #include <unistd.h>
15943 #include <math.h>
15944 int main (int argc, char *argv[])
15945 {
15946     printf ("%d\n", _LIB_VERSION);
15947     return (0);
15948     } /* main */
15949 EOCP
15950 set try
15951 if eval $compile; then
15952     foo=`$run ./try`
15953     echo "Yes, it does ($foo)" >&4
15954     d_libm_lib_version="$define"
15955 else
15956     echo "No, it does not (probably harmless)" >&4
15957     fi
15958 $rm_try
15959
15960 : see if link exists
15961 set link d_link
15962 eval $inlibc
15963
15964 : see if llrint exists
15965 set llrint d_llrint
15966 eval $inlibc
15967
15968 : see if llrintl exists
15969 set llrintl d_llrintl
15970 eval $inlibc
15971
15972 : see if llround exists
15973 set llround d_llround
15974 eval $inlibc
15975
15976 : see if llroundl exists
15977 set llroundl d_llroundl
15978 eval $inlibc
15979
15980 : see if localeconv_l exists
15981 set localeconv_l d_localeconv_l
15982 eval $inlibc
15983
15984 : see if localtime_r exists
15985 set localtime_r d_localtime_r
15986 eval $inlibc
15987 case "$d_localtime_r" in
15988 "$define")
15989         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15990         case "$d_localtime_r_proto:$usethreads" in
15991         ":define")      d_localtime_r_proto=define
15992                 set d_localtime_r_proto localtime_r $hdrs
15993                 eval $hasproto ;;
15994         *)      ;;
15995         esac
15996         case "$d_localtime_r_proto" in
15997         define)
15998         case "$localtime_r_proto" in
15999         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16000         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16001         esac
16002         case "$localtime_r_proto" in
16003         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16004         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16005         esac
16006         case "$localtime_r_proto" in
16007         ''|0)   d_localtime_r=undef
16008                 localtime_r_proto=0
16009                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16010         * )     case "$localtime_r_proto" in
16011                 REENTRANT_PROTO*) ;;
16012                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16013                 esac
16014                 echo "Prototype: $try" ;;
16015         esac
16016         ;;
16017         *)      case "$usethreads" in
16018                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16019                 esac
16020                 d_localtime_r=undef
16021                 localtime_r_proto=0
16022                 ;;
16023         esac
16024         ;;
16025 *)      localtime_r_proto=0
16026         ;;
16027 esac
16028
16029 : see if localtime_r calls tzset
16030 case "$localtime_r_proto" in
16031 REENTRANT_PROTO*)
16032         $cat >try.c <<EOCP
16033 /*  Does our libc's localtime_r call tzset ?
16034  *  return 0 if so, 1 otherwise.
16035  */
16036 #$i_systypes    I_SYS_TYPES
16037 #$i_unistd      I_UNISTD
16038 #$i_time        I_TIME
16039 #$i_stdlib      I_STDLIB
16040 #$i_malloc      I_MALLOC
16041 #ifdef I_SYS_TYPES
16042 #  include <sys/types.h>
16043 #endif
16044 #ifdef I_UNISTD
16045 #  include <unistd.h>
16046 #endif
16047 #ifdef I_TIME
16048 #  include <time.h>
16049 #endif
16050 #ifdef I_STDLIB
16051 #include <stdlib.h>
16052 #endif
16053 #include <string.h>
16054 #ifdef I_MALLOC
16055 #  include <malloc.h>
16056 #endif
16057 int main()
16058 {
16059     time_t t = time(0L);
16060     char w_tz[]="TZ" "=GMT+5",
16061          e_tz[]="TZ" "=GMT-5",
16062         *tz_e = (char*)malloc(16),
16063         *tz_w = (char*)malloc(16);
16064     struct tm tm_e, tm_w;
16065     memset(&tm_e,'\0',sizeof(struct tm));
16066     memset(&tm_w,'\0',sizeof(struct tm));
16067     strcpy(tz_e,e_tz);
16068     strcpy(tz_w,w_tz);
16069
16070     putenv(tz_e);
16071     localtime_r(&t, &tm_e);
16072
16073     putenv(tz_w);
16074     localtime_r(&t, &tm_w);
16075
16076     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16077         return 1;
16078     return 0;
16079 }
16080 EOCP
16081         set try
16082         if eval $compile; then
16083             if $run ./try; then
16084                 d_localtime_r_needs_tzset=undef;
16085             else
16086                 d_localtime_r_needs_tzset=define;
16087             fi;
16088         else
16089             d_localtime_r_needs_tzset=undef;
16090         fi;
16091      ;;
16092   *)
16093      d_localtime_r_needs_tzset=undef;
16094      ;;
16095 esac
16096 $rm_try
16097
16098 : see if lockf exists
16099 set lockf d_lockf
16100 eval $inlibc
16101
16102 : see if log1p exists
16103 set log1p d_log1p
16104 eval $inlibc
16105
16106 : see if log2 exists
16107 set log2 d_log2
16108 eval $inlibc
16109
16110 : see if logb exists
16111 set logb d_logb
16112 eval $inlibc
16113
16114 : see if lrint exists
16115 set lrint d_lrint
16116 eval $inlibc
16117
16118 : see if lrintl exists
16119 set lrintl d_lrintl
16120 eval $inlibc
16121
16122 : see if lround exists
16123 set lround d_lround
16124 eval $inlibc
16125
16126 : see if lroundl exists
16127 set lroundl d_lroundl
16128 eval $inlibc
16129
16130 : see if prototype for lseek is available
16131 echo " "
16132 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16133 eval $hasproto
16134
16135 : see if lstat exists
16136 set lstat d_lstat
16137 eval $inlibc
16138
16139 : see if madvise exists
16140 set madvise d_madvise
16141 eval $inlibc
16142
16143 : see if malloc_size exists
16144 set malloc_size d_malloc_size
16145 eval $inlibc
16146
16147 : see if malloc_size_good exists
16148 set malloc_good_size d_malloc_good_size
16149 eval $inlibc
16150
16151 : see if mblen exists
16152 set mblen d_mblen
16153 eval $inlibc
16154
16155 : see if mbrlen exists
16156 set mbrlen d_mbrlen
16157 eval $inlibc
16158
16159 : see if mbrtowc exists
16160 set mbrtowc d_mbrtowc
16161 eval $inlibc
16162
16163 : see if mbstowcs exists
16164 set mbstowcs d_mbstowcs
16165 eval $inlibc
16166
16167 : see if mbtowc exists
16168 set mbtowc d_mbtowc
16169 eval $inlibc
16170
16171 : see if memmem exists
16172 set memmem d_memmem
16173 eval $inlibc
16174
16175 : see if memrchr exists
16176 set memrchr d_memrchr
16177 eval $inlibc
16178
16179 : see if mkdir exists
16180 set mkdir d_mkdir
16181 eval $inlibc
16182
16183 : see if mkdtemp exists
16184 set mkdtemp d_mkdtemp
16185 eval $inlibc
16186
16187 : see if mkfifo exists
16188 set mkfifo d_mkfifo
16189 eval $inlibc
16190
16191 : see if mkostemp exists
16192 set mkostemp d_mkostemp
16193 eval $inlibc
16194
16195 : see if mkstemp exists
16196 set mkstemp d_mkstemp
16197 eval $inlibc
16198
16199 : see if mkstemps exists
16200 set mkstemps d_mkstemps
16201 eval $inlibc
16202
16203 : see if mktime exists
16204 set mktime d_mktime
16205 eval $inlibc
16206
16207 : see if sys/mman.h has to be included
16208 set sys/mman.h i_sysmman
16209 eval $inhdr
16210
16211 : see if mmap exists
16212 set mmap d_mmap
16213 eval $inlibc
16214 : see what shmat returns
16215 : default to something harmless
16216 mmaptype='void *'
16217 case "$i_sysmman$d_mmap" in
16218 "$define$define")
16219         $cat >mmap.c <<'END'
16220 #include <sys/mman.h>
16221 void *mmap();
16222 END
16223         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16224                 mmaptype='void *'
16225         else
16226                 mmaptype='caddr_t'
16227         fi
16228         echo "and it returns ($mmaptype)." >&4
16229         ;;
16230 esac
16231
16232
16233
16234 : see if sqrtl exists
16235 set sqrtl d_sqrtl
16236 eval $inlibc
16237
16238 : see if scalbnl exists
16239 set scalbnl d_scalbnl
16240 eval $inlibc
16241
16242 : see if truncl exists
16243 set truncl d_truncl
16244 eval $inlibc
16245
16246 : see if modfl exists
16247 set modfl d_modfl
16248 eval $inlibc
16249
16250 : see if prototype for modfl is available
16251 echo " "
16252 set d_modflproto modfl define math.h
16253 eval $hasproto
16254
16255 if $test "$uselongdouble" = "$define"; then
16256     message=""
16257     if $test "$d_sqrtl" != "$define"; then
16258         message="$message sqrtl"
16259     fi
16260     if $test "$d_modfl" != "$define"; then
16261         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16262             echo "You have both truncl and copysignl, so I can emulate modfl."
16263         else
16264             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16265                 echo "You have both aintl and copysignl, so I can emulate modfl."
16266             else
16267                 message="$message modfl"
16268             fi
16269         fi
16270     fi
16271     if $test "$d_frexpl" != "$define"; then
16272         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16273             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16274         else
16275             message="$message frexpl"
16276         fi
16277     fi
16278     if $test "$d_ldexpl" != "$define"; then
16279         message="$message ldexpl"
16280     fi
16281
16282     if $test "$message" != ""; then
16283         $cat <<EOM >&4
16284
16285 *** You requested the use of long doubles but you do not seem to have
16286 *** the following mathematical functions needed for long double support:
16287 ***    $message
16288 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16289 *** Cannot continue, aborting.
16290
16291 EOM
16292
16293         exit 1
16294     fi
16295 fi
16296
16297 : see if mprotect exists
16298 set mprotect d_mprotect
16299 eval $inlibc
16300
16301 : see if msgctl exists
16302 set msgctl d_msgctl
16303 eval $inlibc
16304
16305 : see if msgget exists
16306 set msgget d_msgget
16307 eval $inlibc
16308
16309 : see if msgsnd exists
16310 set msgsnd d_msgsnd
16311 eval $inlibc
16312
16313 : see if msgrcv exists
16314 set msgrcv d_msgrcv
16315 eval $inlibc
16316
16317 : see how much of the 'msg*(2)' library is present.
16318 h_msg=true
16319 echo " "
16320 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16321 *"$undef"*) h_msg=false;;
16322 esac
16323 case "$osname" in
16324 freebsd)
16325     case "`ipcs 2>&1`" in
16326     "SVID messages"*"not configured"*)
16327         echo "Your $osname does not have the msg*(2) configured." >&4
16328         h_msg=false
16329         val="$undef"
16330         set msgctl d_msgctl
16331         eval $setvar
16332         set msgget d_msgget
16333         eval $setvar
16334         set msgsnd d_msgsnd
16335         eval $setvar
16336         set msgrcv d_msgrcv
16337         eval $setvar
16338         ;;
16339     esac
16340     ;;
16341 esac
16342 : we could also check for sys/ipc.h ...
16343 if $h_msg && $test `./findhdr sys/msg.h`; then
16344         echo "You have the full msg*(2) library." >&4
16345         val="$define"
16346 else
16347         echo "You don't have the full msg*(2) library." >&4
16348         val="$undef"
16349 fi
16350 set d_msg
16351 eval $setvar
16352
16353 : Check for msghdr_s
16354 echo " "
16355 echo "Checking to see if your system supports struct msghdr..." >&4
16356 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16357 eval $hasstruct
16358 case "$d_msghdr_s" in
16359 "$define")      echo "Yes, it does."   ;;
16360 *)              echo "No, it doesn't." ;;
16361 esac
16362
16363
16364 : see if msync exists
16365 set msync d_msync
16366 eval $inlibc
16367
16368 : see if munmap exists
16369 set munmap d_munmap
16370 eval $inlibc
16371
16372 : see if nan exists
16373 set nan d_nan
16374 eval $inlibc
16375
16376 : see if nanosleep exists
16377 set nanosleep d_nanosleep
16378 eval $inlibc
16379
16380 : see if nearbyint exists
16381 set nearbyint d_nearbyint
16382 eval $inlibc
16383
16384 : see if nextafter exists
16385 set nextafter d_nextafter
16386 eval $inlibc
16387
16388 : see if nexttoward exists
16389 set nexttoward d_nexttoward
16390 eval $inlibc
16391
16392 : see if nice exists
16393 set nice d_nice
16394 eval $inlibc
16395
16396 : see if this is a langinfo.h system
16397 set langinfo.h i_langinfo
16398 eval $inhdr
16399
16400 : see if nl_langinfo exists
16401 set nl_langinfo d_nl_langinfo
16402 eval $inlibc
16403
16404 : see if this is a quadmath.h system
16405 set quadmath.h i_quadmath
16406 eval $inhdr
16407
16408 : Check basic sizes
16409 echo " "
16410 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16411
16412 case "$use64bitint:$d_quad:$quadtype" in
16413 define:define:?*)
16414         ivtype="$quadtype"
16415         uvtype="$uquadtype"
16416         ivsize=8
16417         uvsize=8
16418         ;;
16419 *)      ivtype="long"
16420         uvtype="unsigned long"
16421         ivsize=$longsize
16422         uvsize=$longsize
16423         ;;
16424 esac
16425
16426 case "$uselongdouble:$d_longdbl" in
16427 define:define)
16428         nvtype="long double"
16429         nvsize=$longdblsize
16430         ;;
16431 *)      nvtype=double
16432         nvsize=$doublesize
16433         ;;
16434 esac
16435
16436 case "$usequadmath:$i_quadmath" in
16437 define:define)
16438   nvtype="__float128"
16439   nvsize=16
16440   case "$libs" in
16441   *quadmath*) ;;
16442   *) $cat <<EOM >&4
16443
16444 *** You requested the use of the quadmath library, but you
16445 *** do not seem to have the quadmath library installed.
16446 *** Cannot continue, aborting.
16447 EOM
16448     exit 1
16449     ;;
16450   esac
16451   ;;
16452 define:*) $cat <<EOM >&4
16453
16454 *** You requested the use of the quadmath library, but you
16455 *** do not seem to have the required header, <quadmath.h>.
16456 EOM
16457   case "$gccversion" in
16458   [23].*|4.[0-5]*)
16459    $cat <<EOM >&4
16460 *** Your gcc looks a bit old:
16461 *** $gccversion
16462 EOM
16463     ;;
16464   '')
16465    $cat <<EOM >&4
16466 *** You are not running a gcc.
16467 EOM
16468     ;;
16469   esac
16470   $cat <<EOM >&4
16471 *** For the quadmath library you need at least gcc 4.6.
16472 *** Cannot continue, aborting.
16473 EOM
16474   exit 1
16475   ;;
16476 esac
16477
16478 $echo "(IV will be "$ivtype", $ivsize bytes)"
16479 $echo "(UV will be "$uvtype", $uvsize bytes)"
16480 $echo "(NV will be "$nvtype", $nvsize bytes)"
16481
16482 $cat >try.c <<EOCP
16483 #$i_inttypes I_INTTYPES
16484 #ifdef I_INTTYPES
16485 #include <inttypes.h>
16486 #endif
16487 #include <stdio.h>
16488 int main() {
16489 #ifdef INT8
16490    int8_t i =  INT8_MAX;
16491   uint8_t u = UINT8_MAX;
16492   printf("int8_t\n");
16493 #endif
16494 #ifdef INT16
16495    int16_t i =  INT16_MAX;
16496   uint16_t u = UINT16_MAX;
16497   printf("int16_t\n");
16498 #endif
16499 #ifdef INT32
16500    int32_t i =  INT32_MAX;
16501   uint32_t u = UINT32_MAX;
16502   printf("int32_t\n");
16503 #endif
16504 }
16505 EOCP
16506
16507 i8type="signed char"
16508 u8type="unsigned char"
16509 i8size=1
16510 u8size=1
16511
16512 case "$i16type" in
16513 '')     case "$shortsize" in
16514         2)      i16type=short
16515                 u16type="unsigned short"
16516                 i16size=$shortsize
16517                 u16size=$shortsize
16518                 ;;
16519         esac
16520         ;;
16521 esac
16522 case "$i16type" in
16523 '')     set try -DINT16
16524         if eval $compile; then
16525                 case "`$run ./try`" in
16526                 int16_t)
16527                         i16type=int16_t
16528                         u16type=uint16_t
16529                         i16size=2
16530                         u16size=2
16531                         ;;
16532                 esac
16533         fi
16534         ;;
16535 esac
16536 case "$i16type" in
16537 '')     if $test $shortsize -ge 2; then
16538                 i16type=short
16539                 u16type="unsigned short"
16540                 i16size=$shortsize
16541                 u16size=$shortsize
16542         fi
16543         ;;
16544 esac
16545
16546 case "$i32type" in
16547 '')     case "$longsize" in
16548         4)      i32type=long
16549                 u32type="unsigned long"
16550                 i32size=$longsize
16551                 u32size=$longsize
16552                 ;;
16553         *)      case "$intsize" in
16554                 4)      i32type=int
16555                         u32type="unsigned int"
16556                         i32size=$intsize
16557                         u32size=$intsize
16558                         ;;
16559                 esac
16560                 ;;
16561         esac
16562         ;;
16563 esac
16564 case "$i32type" in
16565 '')     set try -DINT32
16566         if eval $compile; then
16567                 case "`$run ./try`" in
16568                 int32_t)
16569                         i32type=int32_t
16570                         u32type=uint32_t
16571                         i32size=4
16572                         u32size=4
16573                         ;;
16574                 esac
16575         fi
16576         ;;
16577 esac
16578 case "$i32type" in
16579 '')     if $test $intsize -ge 4; then
16580                 i32type=int
16581                 u32type="unsigned int"
16582                 i32size=$intsize
16583                 u32size=$intsize
16584         fi
16585         ;;
16586 esac
16587
16588 case "$i64type" in
16589 '')     case "$d_quad:$quadtype" in
16590         define:?*)
16591                 i64type="$quadtype"
16592                 u64type="$uquadtype"
16593                 i64size=8
16594                 u64size=8
16595                 ;;
16596         esac
16597         ;;
16598 esac
16599
16600 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16601 $cat <<EOP >try.c
16602 #include <stdio.h>
16603 #$i_stdlib I_STDLIB
16604 #ifdef I_STDLIB
16605 #include <stdlib.h>
16606 #endif
16607 #include <sys/types.h>
16608 #include <signal.h>
16609 #ifdef SIGFPE
16610 /* volatile so that the compiler has to store it out to memory */
16611 volatile int bletched = 0;
16612 $signal_t blech(int s) { bletched = 1; }
16613 #endif
16614 int main() {
16615     $uvtype u = 0;
16616     $nvtype d;
16617     int     n = 8 * $uvsize;
16618     int     i;
16619 #ifdef SIGFPE
16620     signal(SIGFPE, blech);
16621 #endif
16622
16623     for (i = 0; i < n; i++) {
16624       u = u << 1 | ($uvtype)1;
16625       d = ($nvtype)u;
16626       if (($uvtype)d != u)
16627         break;
16628       if (d <= 0)
16629         break;
16630       d = ($nvtype)(u - 1);
16631       if (($uvtype)d != (u - 1))
16632         break;
16633 #ifdef SIGFPE
16634       if (bletched)
16635         break;
16636 #endif
16637     }
16638     printf("%d\n", ((i == n) ? -n : i));
16639     exit(0);
16640 }
16641 EOP
16642 set try
16643
16644 d_nv_preserves_uv="$undef"
16645 if eval $compile; then
16646         nv_preserves_uv_bits="`$run ./try`"
16647 fi
16648 case "$nv_preserves_uv_bits" in
16649 \-[1-9]*)
16650         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16651         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16652         d_nv_preserves_uv="$define"
16653         ;;
16654 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16655         d_nv_preserves_uv="$undef" ;;
16656 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16657         nv_preserves_uv_bits="0" ;;
16658 esac
16659 $rm_try
16660
16661 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16662 $cat <<EOP >try.c
16663 #include <stdio.h>
16664
16665 typedef $nvtype NV;
16666
16667 int
16668 main() {
16669   NV value = 2;
16670   int count = 1;
16671
16672   while(count < 256) {
16673     /* volatile so that the compiler has to store it out to memory */
16674     volatile NV up = value + 1.0;
16675     volatile NV negated = -value;
16676     volatile NV down = negated - 1.0;
16677     volatile NV got_up = up - value;
16678     int up_good = got_up == 1.0;
16679     int got_down = down - negated;
16680     int down_good = got_down == -1.0;
16681
16682     if (down_good != up_good) {
16683       fprintf(stderr,
16684               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16685               up_good, (double) got_up, down_good, (double) got_down,
16686               count, (double) value);
16687       return 1;
16688     }
16689     if (!up_good) {
16690       while (1) {
16691         if (count > 8) {
16692           count -= 8;
16693           fputs("256.0", stdout);
16694         } else {
16695           count--;
16696           fputs("2.0", stdout);
16697         }
16698         if (!count) {
16699           puts("");
16700           return 0;
16701         }
16702         fputs("*", stdout);
16703       }
16704     }
16705     value *= 2;
16706     ++count;
16707   }
16708   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16709           count, (double) value);
16710   return 1;
16711 }
16712 EOP
16713 set try
16714
16715 nv_overflows_integers_at='0'
16716 if eval $compile; then
16717     xxx="`$run ./try`"
16718     case "$?" in
16719         0)
16720             case "$xxx" in
16721                 2*)  cat >&4 <<EOM
16722 The largest integer your NVs can preserve is equal to $xxx
16723 EOM
16724                     nv_overflows_integers_at="$xxx"
16725                     ;;
16726                 *)  cat >&4 <<EOM
16727 Cannot determine the largest integer value your NVs can hold, unexpected output
16728 '$xxx'
16729 EOM
16730                     ;;
16731             esac
16732             ;;
16733         *)  cat >&4 <<EOM
16734 Cannot determine the largest integer value your NVs can hold
16735 EOM
16736             ;;
16737     esac
16738 fi
16739 $rm_try
16740
16741 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16742 $cat <<EOP >try.c
16743 #include <stdio.h>
16744 #$i_stdlib I_STDLIB
16745 #ifdef I_STDLIB
16746 #include <stdlib.h>
16747 #endif
16748 #include <string.h>
16749 #include <sys/types.h>
16750 #include <signal.h>
16751 #ifdef SIGFPE
16752 /* volatile so that the compiler has to store it out to memory */
16753 volatile int bletched = 0;
16754 $signal_t blech(int s) { bletched = 1; }
16755 #endif
16756
16757 int checkit($nvtype d, const char *where) {
16758     void *v = &d;
16759     unsigned char *p = (unsigned char *)v;
16760     unsigned char *end = p + sizeof(d);
16761     int fail = 0;
16762
16763     while (p < end)
16764         fail += *p++;
16765
16766     if (!fail)
16767         return 0;
16768
16769     p = (unsigned char *)v;
16770     printf("No - %s: 0x", where);
16771     while (p < end)
16772         printf ("%02X", *p++);
16773     printf("\n");
16774     return 1;
16775 }
16776
16777 int main(int argc, char **argv) {
16778     $nvtype d = 0.0;
16779     int fail = 0;
16780     fail += checkit(d, "0.0");
16781
16782     /* The compiler shouldn't be assuming that bletched is 0  */
16783     d = bletched;
16784
16785     fail += checkit(d, "bleched");
16786
16787 #ifdef SIGFPE
16788     signal(SIGFPE, blech);
16789 #endif
16790
16791     /* Paranoia - the compiler should have no way of knowing that ANSI says
16792        that argv[argc] will always be NULL.  Actually, if it did assume this it
16793        would be buggy, as this is C and main() can be called from elsewhere in
16794        the program.  */
16795     d = argv[argc] ? 1 : 0;
16796
16797     if (d) {
16798         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16799     }
16800
16801     fail += checkit(d, "ternary");
16802
16803     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16804
16805     if (d != 0.0) {
16806         printf("No - memset doesn't give 0.0\n");
16807         /* This might just blow up:  */
16808         printf("(gives %g)\n", d);
16809         return 1;
16810     }
16811
16812 #ifdef SIGFPE
16813     if (bletched) {
16814         printf("No - something bleched\n");
16815         return 1;
16816     }
16817 #endif
16818     if (fail) {
16819       printf("No - %d fail(s)\n", fail);
16820       return 1;
16821     }
16822     printf("Yes\n");
16823     return 0;
16824 }
16825 EOP
16826 set try
16827
16828 d_nv_zero_is_allbits_zero="$undef"
16829 if eval $compile; then
16830     xxx="`$run ./try`"
16831     case "$?" in
16832         0)
16833             case "$xxx" in
16834                 Yes)  cat >&4 <<EOM
16835 0.0 is represented as all bits zero in memory
16836 EOM
16837                     d_nv_zero_is_allbits_zero="$define"
16838                     ;;
16839                 *)  cat >&4 <<EOM
16840 0.0 is not represented as all bits zero in memory
16841 EOM
16842                     d_nv_zero_is_allbits_zero="$undef"
16843                     ;;
16844             esac
16845             ;;
16846         *)  cat >&4 <<EOM
16847 0.0 is not represented as all bits zero in memory
16848 EOM
16849             d_nv_zero_is_allbits_zero="$undef"
16850             ;;
16851     esac
16852 fi
16853 $rm_try
16854
16855 : check for off64_t
16856 echo " "
16857 echo "Checking to see if you have off64_t..." >&4
16858 $cat >try.c <<EOCP
16859 #include <sys/types.h>
16860 #include <unistd.h>
16861 int main() { off64_t x = 7; }
16862 EOCP
16863 set try
16864 if eval $compile; then
16865         val="$define"
16866         echo "You have off64_t."
16867 else
16868         val="$undef"
16869         echo "You do not have off64_t."
16870         case "$lseeksize" in
16871         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16872         esac
16873 fi
16874 $rm_try
16875 set d_off64_t
16876 eval $setvar
16877
16878 : how to create joinable pthreads
16879 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16880         echo " "
16881         echo "Checking what constant to use for creating joinable pthreads..." >&4
16882         $cat >try.c <<'EOCP'
16883 #include <pthread.h>
16884 int main() {
16885     int detachstate = JOINABLE;
16886 }
16887 EOCP
16888         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16889         if eval $compile; then
16890                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16891                 val="$undef" # Yes, undef.
16892                 set d_old_pthread_create_joinable
16893                 eval $setvar
16894                 val=""
16895                 set old_pthread_create_joinable
16896                 eval $setvar
16897         else
16898                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16899                 if eval $compile; then
16900                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16901                         val="$define"
16902                         set d_old_pthread_create_joinable
16903                         eval $setvar
16904                         val=PTHREAD_CREATE_UNDETACHED
16905                         set old_pthread_create_joinable
16906                         eval $setvar
16907                 else
16908                         set try -DJOINABLE=__UNDETACHED
16909                         if eval $compile; then
16910                                 echo "You seem to use __UNDETACHED." >&4
16911                                 val="$define"
16912                                 set d_old_pthread_create_joinable
16913                                 eval $setvar
16914                                 val=__UNDETACHED
16915                                 set old_pthread_create_joinable
16916                                 eval $setvar
16917                         else
16918                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16919                                 val="$define"
16920                                 set d_old_pthread_create_joinable
16921                                 eval $setvar
16922                                 val=0
16923                                 set old_pthread_create_joinable
16924                                 eval $setvar
16925                         fi
16926                 fi
16927         fi
16928         $rm_try
16929 else
16930     d_old_pthread_create_joinable="$undef"
16931     old_pthread_create_joinable=""
16932 fi
16933
16934 : see if pause exists
16935 set pause d_pause
16936 eval $inlibc
16937
16938 : see if pipe2 exists
16939 set pipe2 d_pipe2
16940 eval $inlibc
16941
16942 : see if poll exists
16943 set poll d_poll
16944 eval $inlibc
16945
16946 : see if prctl exists
16947 set prctl d_prctl
16948 eval $inlibc
16949
16950 : see if prctl supports PR_SET_NAME
16951 d_prctl_set_name=$undef
16952 case $d_prctl in
16953     $define)
16954         $cat >try.c <<EOM
16955 #ifdef __ANDROID__
16956 #include <unistd.h>
16957 #endif
16958 #include <sys/prctl.h>
16959
16960 int main (int argc, char *argv[])
16961 {
16962     return (prctl (PR_SET_NAME, "Test"));
16963     } /* main */
16964 EOM
16965         set try
16966         if eval $compile_ok && $run ./try; then
16967             echo "Your prctl (PR_SET_NAME, ...) works"
16968             d_prctl_set_name=$define
16969             fi
16970         $rm_try
16971         ;;
16972     esac
16973
16974 : see if readlink exists
16975 set readlink d_readlink
16976 eval $inlibc
16977
16978 : Check if there is a /proc symlink to the abs path of
16979 : the executing program.  We will honor hints of d_procselfexe=$undef
16980 : or procselfexe being non-empty, otherwise will try to determine both
16981 : if we have readlink.
16982 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
16983 : referenced, and AmigaOS does not have a proc filesystem anyway.
16984 echo " "
16985 val="$undef"
16986 if $test "X$d_procselfexe" = Xundef; then
16987         procselfexe=''
16988 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
16989         val="$define"
16990 elif $test "X$d_readlink" = Xdefine; then
16991         : NetBSD first as /proc/self is a symlink to /proc/curproc,
16992         : and it feels more tidy to avoid an extra level of symlink
16993         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16994         while test $# -gt 0; do
16995             type=$1; try=$2
16996             shift; shift
16997             if $issymlink $try; then
16998                 $ls -l $try > reflect
16999                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17000                     echo "You have $type-like $try."
17001                     procselfexe='"'$try'"'
17002                     val="$define"
17003                     : This will break out of the loop
17004                     set X; shift
17005                 fi
17006             fi
17007         done
17008 fi
17009 $rm -f reflect
17010 set d_procselfexe
17011 eval $setvar
17012
17013 : backward compatibility for d_hvfork
17014 if test X$d_hvfork != X; then
17015         d_vfork="$d_hvfork"
17016         d_hvfork=''
17017 fi
17018 : see if there is a vfork
17019 val=''
17020 set vfork val
17021 eval $inlibc
17022
17023 d_pseudofork=$undef
17024
17025 : Ok, but do we want to use it. vfork is reportedly unreliable in
17026 : perl on Solaris 2.x, and probably elsewhere.
17027 case "$val" in
17028 $define)
17029         echo " "
17030         case "$usevfork" in
17031         false) dflt='n';;
17032         *) dflt='y';;
17033         esac
17034         cat <<'EOM'
17035
17036 Perl can only use a vfork() that doesn't suffer from strict
17037 restrictions on calling functions or modifying global data in
17038 the child.  For example, glibc-2.1 contains such a vfork()
17039 that is unsuitable.  If your system provides a proper fork()
17040 call, chances are that you do NOT want perl to use vfork().
17041
17042 EOM
17043         rp="Do you still want to use vfork()?"
17044         . ./myread
17045         case "$ans" in
17046         y|Y) ;;
17047         *)
17048                 echo "Ok, we won't use vfork()."
17049                 val="$undef"
17050                 ;;
17051         esac
17052         ;;
17053 esac
17054 set d_vfork
17055 eval $setvar
17056 case "$d_vfork" in
17057 $define) usevfork='true';;
17058 *) usevfork='false';;
17059 esac
17060
17061 : see whether the pthread_atfork exists
17062 $cat >try.c <<EOP
17063 #include <pthread.h>
17064 #include <stdio.h>
17065 int main() {
17066 #ifdef  PTHREAD_ATFORK
17067         pthread_atfork(NULL,NULL,NULL);
17068 #endif
17069 }
17070 EOP
17071
17072 : see if pthread_atfork exists
17073 set try -DPTHREAD_ATFORK
17074 if eval $compile; then
17075     val="$define"
17076 else
17077     val="$undef"
17078 fi
17079 case "$usethreads" in
17080 $define)
17081         case "$val" in
17082         $define) echo 'pthread_atfork found.' >&4        ;;
17083         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17084         esac
17085 esac
17086 set d_pthread_atfork
17087 eval $setvar
17088
17089 : see if pthread_attr_setscope exists
17090 set pthread_attr_setscope d_pthread_attr_setscope
17091 eval $inlibc
17092
17093 : see whether the various POSIXish _yields exist
17094 $cat >try.c <<EOP
17095 #include <pthread.h>
17096 #include <stdio.h>
17097 int main() {
17098 #ifdef SCHED_YIELD
17099         sched_yield();
17100 #else
17101 #ifdef PTHREAD_YIELD
17102         pthread_yield();
17103 #else
17104 #ifdef PTHREAD_YIELD_NULL
17105         pthread_yield(NULL);
17106 #endif
17107 #endif
17108 #endif
17109 }
17110 EOP
17111 : see if sched_yield exists
17112 set try -DSCHED_YIELD
17113 if eval $compile; then
17114     val="$define"
17115     sched_yield='sched_yield()'
17116 else
17117     val="$undef"
17118 fi
17119 case "$usethreads" in
17120 $define)
17121         case "$val" in
17122         $define) echo 'sched_yield() found.' >&4        ;;
17123         *)       echo 'sched_yield() NOT found.' >&4    ;;
17124         esac
17125 esac
17126 set d_sched_yield
17127 eval $setvar
17128
17129 : see if pthread_yield exists
17130 set try -DPTHREAD_YIELD
17131 if eval $compile; then
17132     val="$define"
17133     case "$sched_yield" in
17134     '') sched_yield='pthread_yield()' ;;
17135     esac
17136 else
17137     set try -DPTHREAD_YIELD_NULL
17138     if eval $compile; then
17139         val="$define"
17140         case "$sched_yield" in
17141         '') sched_yield='pthread_yield(NULL)' ;;
17142         esac
17143     else
17144         val="$undef"
17145     fi
17146 fi
17147 case "$usethreads" in
17148 $define)
17149         case "$val" in
17150         $define) echo 'pthread_yield() found.' >&4      ;;
17151         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17152         esac
17153         ;;
17154 esac
17155 set d_pthread_yield
17156 eval $setvar
17157 case "$sched_yield" in
17158 '') sched_yield=undef ;;
17159 esac
17160 $rm_try
17161
17162 : check for ptrdiff_t
17163 echo " "
17164 echo "Checking to see if you have ptrdiff_t..." >&4
17165 $cat >try.c <<EOCP
17166 #include <stddef.h>
17167 int main() { ptrdiff_t x = 7; }
17168 EOCP
17169 set try
17170 if eval $compile; then
17171         val="$define"
17172         echo "You have ptrdiff_t."
17173 else
17174         val="$undef"
17175         echo "You do not have ptrdiff_t."
17176 fi
17177 $rm_try
17178 set d_ptrdiff_t
17179 eval $setvar
17180
17181 : see if random_r exists
17182 set random_r d_random_r
17183 eval $inlibc
17184 case "$d_random_r" in
17185 "$define")
17186         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17187         case "$d_random_r_proto:$usethreads" in
17188         ":define")      d_random_r_proto=define
17189                 set d_random_r_proto random_r $hdrs
17190                 eval $hasproto ;;
17191         *)      ;;
17192         esac
17193         case "$d_random_r_proto" in
17194         define)
17195         case "$random_r_proto" in
17196         ''|0) try='int random_r(int*, struct random_data*);'
17197         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17198         esac
17199         case "$random_r_proto" in
17200         ''|0) try='int random_r(long*, struct random_data*);'
17201         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17202         esac
17203         case "$random_r_proto" in
17204         ''|0) try='int random_r(struct random_data*, int32_t*);'
17205         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17206         esac
17207         case "$random_r_proto" in
17208         ''|0)   d_random_r=undef
17209                 random_r_proto=0
17210                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17211         * )     case "$random_r_proto" in
17212                 REENTRANT_PROTO*) ;;
17213                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17214                 esac
17215                 echo "Prototype: $try" ;;
17216         esac
17217         ;;
17218         *)      case "$usethreads" in
17219                 define) echo "random_r has no prototype, not using it." >&4 ;;
17220                 esac
17221                 d_random_r=undef
17222                 random_r_proto=0
17223                 ;;
17224         esac
17225         ;;
17226 *)      random_r_proto=0
17227         ;;
17228 esac
17229
17230 : see if readdir and friends exist
17231 set readdir d_readdir
17232 eval $inlibc
17233 set seekdir d_seekdir
17234 eval $inlibc
17235 set telldir d_telldir
17236 eval $inlibc
17237 set rewinddir d_rewinddir
17238 eval $inlibc
17239
17240 : see if readdir64_r exists
17241 set readdir64_r d_readdir64_r
17242 eval $inlibc
17243 case "$d_readdir64_r" in
17244 "$define")
17245         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17246         case "$d_readdir64_r_proto:$usethreads" in
17247         ":define")      d_readdir64_r_proto=define
17248                 set d_readdir64_r_proto readdir64_r $hdrs
17249                 eval $hasproto ;;
17250         *)      ;;
17251         esac
17252         case "$d_readdir64_r_proto" in
17253         define)
17254         case "$readdir64_r_proto" in
17255         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17256         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17257         esac
17258         case "$readdir64_r_proto" in
17259         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17260         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17261         esac
17262         case "$readdir64_r_proto" in
17263         ''|0)   d_readdir64_r=undef
17264                 readdir64_r_proto=0
17265                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17266         * )     case "$readdir64_r_proto" in
17267                 REENTRANT_PROTO*) ;;
17268                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17269                 esac
17270                 echo "Prototype: $try" ;;
17271         esac
17272         ;;
17273         *)      case "$usethreads" in
17274                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17275                 esac
17276                 d_readdir64_r=undef
17277                 readdir64_r_proto=0
17278                 ;;
17279         esac
17280         ;;
17281 *)      readdir64_r_proto=0
17282         ;;
17283 esac
17284
17285 : see if readdir_r exists
17286 set readdir_r d_readdir_r
17287 eval $inlibc
17288 case "$d_readdir_r" in
17289 "$define")
17290         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17291         case "$d_readdir_r_proto:$usethreads" in
17292         ":define")      d_readdir_r_proto=define
17293                 set d_readdir_r_proto readdir_r $hdrs
17294                 eval $hasproto ;;
17295         *)      ;;
17296         esac
17297         case "$d_readdir_r_proto" in
17298         define)
17299         case "$readdir_r_proto" in
17300         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17301         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17302         esac
17303         case "$readdir_r_proto" in
17304         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17305         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17306         esac
17307         case "$readdir_r_proto" in
17308         ''|0)   d_readdir_r=undef
17309                 readdir_r_proto=0
17310                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17311         * )     case "$readdir_r_proto" in
17312                 REENTRANT_PROTO*) ;;
17313                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17314                 esac
17315                 echo "Prototype: $try" ;;
17316         esac
17317         ;;
17318         *)      case "$usethreads" in
17319                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17320                 esac
17321                 d_readdir_r=undef
17322                 readdir_r_proto=0
17323                 ;;
17324         esac
17325         ;;
17326 *)      readdir_r_proto=0
17327         ;;
17328 esac
17329
17330 : see if readv exists
17331 set readv d_readv
17332 eval $inlibc
17333
17334 : see if recvmsg exists
17335 set recvmsg d_recvmsg
17336 eval $inlibc
17337
17338 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17339 echo " "
17340 if set regcomp val -f d_regcomp; eval $csym; $val; then
17341         echo 'regcomp() found.' >&4
17342         d_regcomp="$define"
17343         d_regcmp="$undef"
17344         d_re_comp="$undef"
17345 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17346         echo 'regcmp() found.' >&4
17347         d_regcmp="$define"
17348         d_regcomp="$undef"
17349         d_re_comp="$undef"
17350 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17351         echo 're_comp() found, assuming re_exec() also exists.' >&4
17352         d_re_comp="$define"
17353         d_regcomp="$undef"
17354         d_regcmp="$undef"
17355 else
17356         $cat >&4 <<EOM
17357 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17358 EOM
17359         d_regcmp="$undef"
17360         d_re_comp="$undef"
17361         d_regcomp="$undef"
17362 fi
17363
17364 : see if remainder exists
17365 set remainder d_remainder
17366 eval $inlibc
17367
17368 : see if remquo exists
17369 set remquo d_remquo
17370 eval $inlibc
17371
17372 : see if rename exists
17373 set rename d_rename
17374 eval $inlibc
17375
17376 : see if rint exists
17377 set rint d_rint
17378 eval $inlibc
17379
17380 : see if rmdir exists
17381 set rmdir d_rmdir
17382 eval $inlibc
17383
17384 : see if round exists
17385 set round d_round
17386 eval $inlibc
17387
17388 : see if prototype for sbrk is available
17389 echo " "
17390 set d_sbrkproto sbrk $i_unistd unistd.h
17391 eval $hasproto
17392
17393 : see if scalbn exists
17394 set scalbn d_scalbn
17395 eval $inlibc
17396
17397 : see if select exists
17398 set select d_select
17399 eval $inlibc
17400
17401 : see if semctl exists
17402 set semctl d_semctl
17403 eval $inlibc
17404
17405 : see if semget exists
17406 set semget d_semget
17407 eval $inlibc
17408
17409 : see if semop exists
17410 set semop d_semop
17411 eval $inlibc
17412
17413 : see how much of the 'sem*(2)' library is present.
17414 h_sem=true
17415 echo " "
17416 case "$d_semctl$d_semget$d_semop" in
17417 *"$undef"*) h_sem=false;;
17418 esac
17419 case "$osname" in
17420 freebsd)
17421     case "`ipcs 2>&1`" in
17422     "SVID messages"*"not configured"*)
17423         echo "Your $osname does not have the sem*(2) configured." >&4
17424         h_sem=false
17425         val="$undef"
17426         set semctl d_semctl
17427         eval $setvar
17428         set semget d_semget
17429         eval $setvar
17430         set semop d_semop
17431         eval $setvar
17432         ;;
17433     esac
17434     ;;
17435 esac
17436 : we could also check for sys/ipc.h ...
17437 if $h_sem && $test `./findhdr sys/sem.h`; then
17438         echo "You have the full sem*(2) library." >&4
17439         val="$define"
17440 else
17441         echo "You don't have the full sem*(2) library." >&4
17442         val="$undef"
17443 fi
17444 set d_sem
17445 eval $setvar
17446
17447 : see whether sys/sem.h defines union semun
17448 echo " "
17449 $cat > try.c <<'END'
17450 #include <sys/types.h>
17451 #include <sys/ipc.h>
17452 #include <sys/sem.h>
17453 int main () { union semun semun; semun.buf = 0; }
17454 END
17455 set try
17456 if eval $compile; then
17457     echo "You have union semun in <sys/sem.h>." >&4
17458     val="$define"
17459 else
17460     echo "You do not have union semun in <sys/sem.h>." >&4
17461     val="$undef"
17462 fi
17463 $rm_try
17464 set d_union_semun
17465 eval $setvar
17466
17467 : see how to do semctl IPC_STAT
17468 case "$d_sem" in
17469 $define)
17470     echo " "
17471     $cat > tryh.h <<END
17472 #ifndef S_IRUSR
17473 #   ifdef S_IREAD
17474 #       define S_IRUSR S_IREAD
17475 #       define S_IWUSR S_IWRITE
17476 #       define S_IXUSR S_IEXEC
17477 #   else
17478 #       define S_IRUSR 0400
17479 #       define S_IWUSR 0200
17480 #       define S_IXUSR 0100
17481 #   endif
17482 #   define S_IRGRP (S_IRUSR>>3)
17483 #   define S_IWGRP (S_IWUSR>>3)
17484 #   define S_IXGRP (S_IXUSR>>3)
17485 #   define S_IROTH (S_IRUSR>>6)
17486 #   define S_IWOTH (S_IWUSR>>6)
17487 #   define S_IXOTH (S_IXUSR>>6)
17488 #endif
17489 #ifndef S_IRWXU
17490 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17491 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17492 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17493 #endif
17494 END
17495     : see whether semctl IPC_STAT can use union semun
17496     case "$d_semctl_semun" in
17497     '')
17498       val="$undef"
17499       $cat > try.c <<END
17500 #include <sys/types.h>
17501 #include <sys/ipc.h>
17502 #include <sys/sem.h>
17503 #include <sys/stat.h>
17504 #include <stdio.h>
17505 #include <errno.h>
17506 #include "tryh.h"
17507 #ifndef errno
17508 extern int errno;
17509 #endif
17510 #$d_union_semun HAS_UNION_SEMUN
17511 int main() {
17512     union semun
17513 #ifndef HAS_UNION_SEMUN
17514     {
17515         int val;
17516         struct semid_ds *buf;
17517         unsigned short *array;
17518     }
17519 #endif
17520     arg;
17521     int sem, st;
17522
17523 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17524     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17525     if (sem > -1) {
17526         struct semid_ds argbuf;
17527         arg.buf = &argbuf;
17528 #       ifdef IPC_STAT
17529         st = semctl(sem, 0, IPC_STAT, arg);
17530         if (st == 0)
17531             printf("semun\n");
17532         else
17533 #       endif /* IPC_STAT */
17534             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17535 #       ifdef IPC_RMID
17536         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17537 #       endif /* IPC_RMID */
17538             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17539     } else
17540 #endif /* IPC_PRIVATE && ... */
17541         printf("semget failed: errno = %d\n", errno);
17542   return 0;
17543 }
17544 END
17545       set try
17546       if eval $compile; then
17547           xxx=`$run ./try`
17548           case "$xxx" in
17549           semun) val="$define" ;;
17550           esac
17551       fi
17552       $rm_try
17553       set d_semctl_semun
17554       eval $setvar
17555       ;;
17556     esac
17557     case "$d_semctl_semun" in
17558     $define)
17559         echo "You can use union semun for semctl IPC_STAT." >&4
17560         also='also'
17561         ;;
17562     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17563         also=''
17564         ;;
17565     esac
17566
17567     : see whether semctl IPC_STAT can use struct semid_ds pointer
17568     case "$d_semctl_semid_ds" in
17569     '')
17570       val="$undef"
17571       $cat > try.c <<'END'
17572 #include <sys/types.h>
17573 #include <sys/ipc.h>
17574 #include <sys/sem.h>
17575 #include <sys/stat.h>
17576 #include "tryh.h"
17577 #include <stdio.h>
17578 #include <errno.h>
17579 #ifndef errno
17580 extern int errno;
17581 #endif
17582 int main() {
17583     struct semid_ds arg;
17584     int sem, st;
17585
17586 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17587     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17588     if (sem > -1) {
17589 #       ifdef IPC_STAT
17590         st = semctl(sem, 0, IPC_STAT, &arg);
17591         if (st == 0)
17592             printf("semid_ds\n");
17593         else
17594 #       endif /* IPC_STAT */
17595             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17596 #       ifdef IPC_RMID
17597         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17598 #       endif /* IPC_RMID */
17599             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17600     } else
17601 #endif /* IPC_PRIVATE && ... */
17602         printf("semget failed: errno = %d\n", errno);
17603
17604     return 0;
17605 }
17606 END
17607       set try
17608       if eval $compile; then
17609           xxx=`$run ./try`
17610           case "$xxx" in
17611           semid_ds) val="$define" ;;
17612           esac
17613       fi
17614       $rm_try
17615       set d_semctl_semid_ds
17616       eval $setvar
17617       ;;
17618     esac
17619     case "$d_semctl_semid_ds" in
17620     $define)
17621         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17622         ;;
17623     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17624         ;;
17625     esac
17626     ;;
17627 *)  val="$undef"
17628
17629     # We do not have the full sem*(2) library, so assume we can not
17630     # use either.
17631
17632     set d_semctl_semun
17633     eval $setvar
17634
17635     set d_semctl_semid_ds
17636     eval $setvar
17637     ;;
17638 esac
17639 $rm_try tryh.h
17640
17641 : see if sendmsg exists
17642 set sendmsg d_sendmsg
17643 eval $inlibc
17644
17645 : see if setegid exists
17646 set setegid d_setegid
17647 eval $inlibc
17648
17649 : see if seteuid exists
17650 set seteuid d_seteuid
17651 eval $inlibc
17652
17653 : see if setgrent exists
17654 set setgrent d_setgrent
17655 eval $inlibc
17656
17657 : see if setgrent_r exists
17658 set setgrent_r d_setgrent_r
17659 eval $inlibc
17660 case "$d_setgrent_r" in
17661 "$define")
17662         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17663         case "$d_setgrent_r_proto:$usethreads" in
17664         ":define")      d_setgrent_r_proto=define
17665                 set d_setgrent_r_proto setgrent_r $hdrs
17666                 eval $hasproto ;;
17667         *)      ;;
17668         esac
17669         case "$d_setgrent_r_proto" in
17670         define)
17671         case "$setgrent_r_proto" in
17672         ''|0) try='int setgrent_r(FILE**);'
17673         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17674         esac
17675         case "$setgrent_r_proto" in
17676         ''|0) try='void setgrent_r(FILE**);'
17677         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17678         esac
17679         case "$setgrent_r_proto" in
17680         ''|0)   d_setgrent_r=undef
17681                 setgrent_r_proto=0
17682                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17683         * )     case "$setgrent_r_proto" in
17684                 REENTRANT_PROTO*) ;;
17685                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17686                 esac
17687                 echo "Prototype: $try" ;;
17688         esac
17689         ;;
17690         *)      case "$usethreads" in
17691                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17692                 esac
17693                 d_setgrent_r=undef
17694                 setgrent_r_proto=0
17695                 ;;
17696         esac
17697         ;;
17698 *)      setgrent_r_proto=0
17699         ;;
17700 esac
17701
17702 : see if sethostent exists
17703 set sethostent d_sethent
17704 eval $inlibc
17705
17706 : see if sethostent_r exists
17707 set sethostent_r d_sethostent_r
17708 eval $inlibc
17709 case "$d_sethostent_r" in
17710 "$define")
17711         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17712         case "$d_sethostent_r_proto:$usethreads" in
17713         ":define")      d_sethostent_r_proto=define
17714                 set d_sethostent_r_proto sethostent_r $hdrs
17715                 eval $hasproto ;;
17716         *)      ;;
17717         esac
17718         case "$d_sethostent_r_proto" in
17719         define)
17720         case "$sethostent_r_proto" in
17721         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17722         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17723         esac
17724         case "$sethostent_r_proto" in
17725         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17726         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17727         esac
17728         case "$sethostent_r_proto" in
17729         ''|0)   d_sethostent_r=undef
17730                 sethostent_r_proto=0
17731                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17732         * )     case "$sethostent_r_proto" in
17733                 REENTRANT_PROTO*) ;;
17734                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17735                 esac
17736                 echo "Prototype: $try" ;;
17737         esac
17738         ;;
17739         *)      case "$usethreads" in
17740                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17741                 esac
17742                 d_sethostent_r=undef
17743                 sethostent_r_proto=0
17744                 ;;
17745         esac
17746         ;;
17747 *)      sethostent_r_proto=0
17748         ;;
17749 esac
17750
17751 : see if setitimer exists
17752 set setitimer d_setitimer
17753 eval $inlibc
17754
17755 : see if setlinebuf exists
17756 set setlinebuf d_setlinebuf
17757 eval $inlibc
17758
17759 : see if setlocale exists
17760 set setlocale d_setlocale
17761 eval $inlibc
17762
17763 : see if locale.h is available
17764 set locale.h i_locale
17765 eval $inhdr
17766
17767 : see if setlocale_r exists
17768 set setlocale_r d_setlocale_r
17769 eval $inlibc
17770 case "$d_setlocale_r" in
17771 "$define")
17772         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17773         case "$d_setlocale_r_proto:$usethreads" in
17774         ":define")      d_setlocale_r_proto=define
17775                 set d_setlocale_r_proto setlocale_r $hdrs
17776                 eval $hasproto ;;
17777         *)      ;;
17778         esac
17779         case "$d_setlocale_r_proto" in
17780         define)
17781         case "$setlocale_r_proto" in
17782         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17783         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17784         esac
17785         case "$setlocale_r_proto" in
17786         ''|0)   d_setlocale_r=undef
17787                 setlocale_r_proto=0
17788                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17789         * )     case "$setlocale_r_proto" in
17790                 REENTRANT_PROTO*) ;;
17791                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17792                 esac
17793                 echo "Prototype: $try" ;;
17794         esac
17795         ;;
17796         *)      case "$usethreads" in
17797                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17798                 esac
17799                 d_setlocale_r=undef
17800                 setlocale_r_proto=0
17801                 ;;
17802         esac
17803         ;;
17804 *)      setlocale_r_proto=0
17805         ;;
17806 esac
17807
17808 : see if setnetent exists
17809 set setnetent d_setnent
17810 eval $inlibc
17811
17812 : see if setnetent_r exists
17813 set setnetent_r d_setnetent_r
17814 eval $inlibc
17815 case "$d_setnetent_r" in
17816 "$define")
17817         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17818         case "$d_setnetent_r_proto:$usethreads" in
17819         ":define")      d_setnetent_r_proto=define
17820                 set d_setnetent_r_proto setnetent_r $hdrs
17821                 eval $hasproto ;;
17822         *)      ;;
17823         esac
17824         case "$d_setnetent_r_proto" in
17825         define)
17826         case "$setnetent_r_proto" in
17827         ''|0) try='int setnetent_r(int, struct netent_data*);'
17828         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17829         esac
17830         case "$setnetent_r_proto" in
17831         ''|0) try='void setnetent_r(int, struct netent_data*);'
17832         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17833         esac
17834         case "$setnetent_r_proto" in
17835         ''|0)   d_setnetent_r=undef
17836                 setnetent_r_proto=0
17837                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17838         * )     case "$setnetent_r_proto" in
17839                 REENTRANT_PROTO*) ;;
17840                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17841                 esac
17842                 echo "Prototype: $try" ;;
17843         esac
17844         ;;
17845         *)      case "$usethreads" in
17846                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17847                 esac
17848                 d_setnetent_r=undef
17849                 setnetent_r_proto=0
17850                 ;;
17851         esac
17852         ;;
17853 *)      setnetent_r_proto=0
17854         ;;
17855 esac
17856
17857 : see if setprotoent exists
17858 set setprotoent d_setpent
17859 eval $inlibc
17860
17861 : see if setpgid exists
17862 set setpgid d_setpgid
17863 eval $inlibc
17864
17865 : see if setpgrp2 exists
17866 set setpgrp2 d_setpgrp2
17867 eval $inlibc
17868
17869 : see if setpriority exists
17870 set setpriority d_setprior
17871 eval $inlibc
17872
17873 : see if setproctitle exists
17874 set setproctitle d_setproctitle
17875 eval $inlibc
17876
17877 : see if setprotoent_r exists
17878 set setprotoent_r d_setprotoent_r
17879 eval $inlibc
17880 case "$d_setprotoent_r" in
17881 "$define")
17882         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17883         case "$d_setprotoent_r_proto:$usethreads" in
17884         ":define")      d_setprotoent_r_proto=define
17885                 set d_setprotoent_r_proto setprotoent_r $hdrs
17886                 eval $hasproto ;;
17887         *)      ;;
17888         esac
17889         case "$d_setprotoent_r_proto" in
17890         define)
17891         case "$setprotoent_r_proto" in
17892         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17893         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17894         esac
17895         case "$setprotoent_r_proto" in
17896         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17897         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17898         esac
17899         case "$setprotoent_r_proto" in
17900         ''|0)   d_setprotoent_r=undef
17901                 setprotoent_r_proto=0
17902                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17903         * )     case "$setprotoent_r_proto" in
17904                 REENTRANT_PROTO*) ;;
17905                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17906                 esac
17907                 echo "Prototype: $try" ;;
17908         esac
17909         ;;
17910         *)      case "$usethreads" in
17911                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17912                 esac
17913                 d_setprotoent_r=undef
17914                 setprotoent_r_proto=0
17915                 ;;
17916         esac
17917         ;;
17918 *)      setprotoent_r_proto=0
17919         ;;
17920 esac
17921
17922 : see if setpwent exists
17923 set setpwent d_setpwent
17924 eval $inlibc
17925
17926 : see if setpwent_r exists
17927 set setpwent_r d_setpwent_r
17928 eval $inlibc
17929 case "$d_setpwent_r" in
17930 "$define")
17931         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17932         case "$d_setpwent_r_proto:$usethreads" in
17933         ":define")      d_setpwent_r_proto=define
17934                 set d_setpwent_r_proto setpwent_r $hdrs
17935                 eval $hasproto ;;
17936         *)      ;;
17937         esac
17938         case "$d_setpwent_r_proto" in
17939         define)
17940         case "$setpwent_r_proto" in
17941         ''|0) try='int setpwent_r(FILE**);'
17942         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17943         esac
17944         case "$setpwent_r_proto" in
17945         ''|0) try='void setpwent_r(FILE**);'
17946         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17947         esac
17948         case "$setpwent_r_proto" in
17949         ''|0)   d_setpwent_r=undef
17950                 setpwent_r_proto=0
17951                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17952         * )     case "$setpwent_r_proto" in
17953                 REENTRANT_PROTO*) ;;
17954                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17955                 esac
17956                 echo "Prototype: $try" ;;
17957         esac
17958         ;;
17959         *)      case "$usethreads" in
17960                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17961                 esac
17962                 d_setpwent_r=undef
17963                 setpwent_r_proto=0
17964                 ;;
17965         esac
17966         ;;
17967 *)      setpwent_r_proto=0
17968         ;;
17969 esac
17970
17971 : see if setregid exists
17972 set setregid d_setregid
17973 eval $inlibc
17974 set setresgid d_setresgid
17975 eval $inlibc
17976
17977 : see if setreuid exists
17978 set setreuid d_setreuid
17979 eval $inlibc
17980 set setresuid d_setresuid
17981 eval $inlibc
17982
17983 : see if setrgid exists
17984 set setrgid d_setrgid
17985 eval $inlibc
17986
17987 : see if setruid exists
17988 set setruid d_setruid
17989 eval $inlibc
17990
17991 : see if setservent exists
17992 set setservent d_setsent
17993 eval $inlibc
17994
17995 : see if setservent_r exists
17996 set setservent_r d_setservent_r
17997 eval $inlibc
17998 case "$d_setservent_r" in
17999 "$define")
18000         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18001         case "$d_setservent_r_proto:$usethreads" in
18002         ":define")      d_setservent_r_proto=define
18003                 set d_setservent_r_proto setservent_r $hdrs
18004                 eval $hasproto ;;
18005         *)      ;;
18006         esac
18007         case "$d_setservent_r_proto" in
18008         define)
18009         case "$setservent_r_proto" in
18010         ''|0) try='int setservent_r(int, struct servent_data*);'
18011         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18012         esac
18013         case "$setservent_r_proto" in
18014         ''|0) try='void setservent_r(int, struct servent_data*);'
18015         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18016         esac
18017         case "$setservent_r_proto" in
18018         ''|0)   d_setservent_r=undef
18019                 setservent_r_proto=0
18020                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18021         * )     case "$setservent_r_proto" in
18022                 REENTRANT_PROTO*) ;;
18023                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18024                 esac
18025                 echo "Prototype: $try" ;;
18026         esac
18027         ;;
18028         *)      case "$usethreads" in
18029                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18030                 esac
18031                 d_setservent_r=undef
18032                 setservent_r_proto=0
18033                 ;;
18034         esac
18035         ;;
18036 *)      setservent_r_proto=0
18037         ;;
18038 esac
18039
18040 : see if setsid exists
18041 set setsid d_setsid
18042 eval $inlibc
18043
18044 : see if setvbuf exists
18045 set setvbuf d_setvbuf
18046 eval $inlibc
18047
18048 : see if shmctl exists
18049 set shmctl d_shmctl
18050 eval $inlibc
18051
18052 : see if shmget exists
18053 set shmget d_shmget
18054 eval $inlibc
18055
18056 : see if shmat exists
18057 set shmat d_shmat
18058 eval $inlibc
18059 : see what shmat returns
18060 case "$d_shmat" in
18061 "$define")
18062         $cat >shmat.c <<'END'
18063 #include <sys/shm.h>
18064 void *shmat();
18065 END
18066         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18067                 shmattype='void *'
18068         else
18069                 shmattype='char *'
18070         fi
18071         echo "and it returns ($shmattype)." >&4
18072         : see if a prototype for shmat is available
18073         xxx=`./findhdr sys/shm.h`
18074         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18075         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18076                 val="$define"
18077         else
18078                 val="$undef"
18079         fi
18080         $rm -f shmat.[co]
18081         ;;
18082 *)
18083         val="$undef"
18084         ;;
18085 esac
18086 set d_shmatprototype
18087 eval $setvar
18088
18089 : see if shmdt exists
18090 set shmdt d_shmdt
18091 eval $inlibc
18092
18093 : see how much of the 'shm*(2)' library is present.
18094 h_shm=true
18095 echo " "
18096 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18097 *"$undef"*) h_shm=false;;
18098 esac
18099 case "$osname" in
18100 freebsd)
18101     case "`ipcs 2>&1`" in
18102     "SVID shared memory"*"not configured"*)
18103         echo "Your $osname does not have the shm*(2) configured." >&4
18104         h_shm=false
18105         val="$undef"
18106         set shmctl d_shmctl
18107         eval $setvar
18108         set shmget d_shmget
18109         eval $setvar
18110         set shmat d_shmat
18111         eval $setvar
18112         set shmdt d_shmdt
18113         eval $setvar
18114         ;;
18115     esac
18116     ;;
18117 esac
18118 : we could also check for sys/ipc.h ...
18119 if $h_shm && $test `./findhdr sys/shm.h`; then
18120         echo "You have the full shm*(2) library." >&4
18121         val="$define"
18122 else
18123         echo "You don't have the full shm*(2) library." >&4
18124         val="$undef"
18125 fi
18126 set d_shm
18127 eval $setvar
18128
18129 : see if we have sigaction
18130 echo " "
18131 if set sigaction val -f d_sigaction; eval $csym; $val; then
18132         echo 'sigaction() found.' >&4
18133         $cat > try.c <<EOP
18134 #include <stdio.h>
18135 #include <sys/types.h>
18136 #include <signal.h>
18137 #$i_stdlib I_STDLIB
18138 #ifdef I_STDLIB
18139 #include <stdlib.h>
18140 #endif
18141 int main()
18142 {
18143     struct sigaction act, oact;
18144     act.sa_flags = 0;
18145     oact.sa_handler = 0;
18146     /* so that act and oact are used */
18147     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18148 }
18149 EOP
18150         set try
18151         if eval $compile_ok; then
18152                 val="$define"
18153         else
18154                 echo "But you don't seem to have a usable struct sigaction." >&4
18155                 val="$undef"
18156         fi
18157 else
18158         echo 'sigaction NOT found.' >&4
18159         val="$undef"
18160 fi
18161 set d_sigaction; eval $setvar
18162 $rm_try
18163
18164 : see what type pids are declared as in the kernel
18165 rp="What is the type of process ids on this system?"
18166 set pid_t pidtype int stdio.h sys/types.h
18167 eval $typedef_ask
18168
18169 : see what type uids are declared as in the kernel
18170 echo " "
18171 echo "Looking for the type for user ids returned by getuid()."
18172 set uid_t uidtype xxx stdio.h sys/types.h
18173 eval $typedef
18174 case "$uidtype" in
18175 xxx)
18176         xxx=`./findhdr sys/user.h`
18177         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18178         case $1 in
18179         unsigned) dflt="$1 $2" ;;
18180         *) dflt="$1" ;;
18181         esac
18182         ;;
18183 *) dflt="$uidtype";;
18184 esac
18185 case "$uidtype" in
18186 uid_t)  echo "uid_t found." ;;
18187 *)      rp="What is the type for user ids returned by getuid()?"
18188         . ./myread
18189         uidtype="$ans"
18190         ;;
18191 esac
18192
18193 : Define hasfield_t macro for Configure internal use
18194 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18195 while $test $# -ge 2; do
18196     case "$1" in
18197         $define) echo "#include <$2>";;
18198     esac ;
18199     shift 2;
18200 done > try.c;
18201 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18202 set try;
18203 if eval $compile; then
18204         val="$define";
18205 else
18206         val="$undef";
18207 fi;
18208 set $varname;
18209 eval $setvar;
18210 $rm_try'
18211
18212 : see what siginfo fields we have
18213 case "$d_sigaction" in
18214 "$define")
18215         echo "Checking if your siginfo_t has si_errno field...">&4
18216         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18217         eval $hasfield_t;
18218
18219         echo "Checking if your siginfo_t has si_pid field...">&4
18220         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18221         eval $hasfield_t;
18222
18223         echo "Checking if your siginfo_t has si_uid field...">&4
18224         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18225         eval $hasfield_t;
18226
18227         echo "Checking if your siginfo_t has si_addr field...">&4
18228         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18229         eval $hasfield_t;
18230
18231         echo "Checking if your siginfo_t has si_status field...">&4
18232         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18233         eval $hasfield_t;
18234
18235         echo "Checking if your siginfo_t has si_band field...">&4
18236         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18237         eval $hasfield_t;
18238
18239         echo "Checking if your siginfo_t has si_value field...">&4
18240         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18241         eval $hasfield_t;
18242
18243         echo "Checking if your siginfo_t has si_fd field...">&4
18244         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18245         eval $hasfield_t;
18246
18247         ;;
18248 *)
18249         d_siginfo_si_errno="$undef"
18250         d_siginfo_si_pid="$undef"
18251         d_siginfo_si_uid="$undef"
18252         d_siginfo_si_addr="$undef"
18253         d_siginfo_si_status="$undef"
18254         d_siginfo_si_band="$undef"
18255         d_siginfo_si_value="$undef"
18256         d_siginfo_si_fd="$undef"
18257         ;;
18258 esac
18259
18260 : see if this is a sunmath.h system
18261 set sunmath.h i_sunmath
18262 eval $inhdr
18263
18264 : see if signbit exists
18265 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18266 $cat >try.c <<EOCP
18267 #$i_sunmath I_SUNMATH
18268 #include <math.h>
18269 #ifdef I_SUNMATH  /* Solaris special math library */
18270 #  include <sunmath.h>
18271 #endif
18272 #define NV $nvtype
18273 int main(int argc, char **argv)
18274 {
18275     NV x = 0.0;
18276     NV y = -1.0;
18277     if ((signbit(x) == 0) && (signbit(y) != 0))
18278         return 0;
18279     else
18280         return 1;
18281 }
18282 EOCP
18283 val="$undef"
18284 set try
18285 if eval $compile; then
18286     if $run ./try; then
18287         $echo "Yes." >&4
18288         val="$define"
18289     else
18290         $echo "Signbit seems to be available, but doesn't work as I expected."
18291         $echo "I won't use it." >&4
18292         val="$undef"
18293     fi
18294 else
18295     $echo "Nope." >&4
18296     dflt="$undef"
18297 fi
18298 set d_signbit
18299 eval $setvar
18300 $rm_try
18301
18302 : see if sigprocmask exists
18303 set sigprocmask d_sigprocmask
18304 eval $inlibc
18305
18306 : see if sigsetjmp exists
18307 echo " "
18308 case "$d_sigsetjmp" in
18309 '')
18310         $cat >try.c <<EOP
18311 #include <setjmp.h>
18312 #$i_stdlib I_STDLIB
18313 #ifdef I_STDLIB
18314 #include <stdlib.h>
18315 #endif
18316 sigjmp_buf env;
18317 int set = 1;
18318 int main()
18319 {
18320         if (sigsetjmp(env,1))
18321                 exit(set);
18322         set = 0;
18323         siglongjmp(env, 1);
18324         exit(1);
18325 }
18326 EOP
18327         set try
18328         if eval $compile; then
18329                 if $run ./try >/dev/null 2>&1; then
18330                         echo "POSIX sigsetjmp found." >&4
18331                         val="$define"
18332                 else
18333                         $cat >&4 <<EOM
18334 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18335 I'll ignore them.
18336 EOM
18337                         val="$undef"
18338                 fi
18339         else
18340                 echo "sigsetjmp not found." >&4
18341                 val="$undef"
18342         fi
18343         ;;
18344 *) val="$d_sigsetjmp"
18345         case "$d_sigsetjmp" in
18346         $define) echo "POSIX sigsetjmp found." >&4;;
18347         $undef) echo "sigsetjmp not found." >&4;;
18348         esac
18349         ;;
18350 esac
18351 set d_sigsetjmp
18352 eval $setvar
18353 $rm_try
18354
18355 : see if snprintf exists
18356 set snprintf d_snprintf
18357 eval $inlibc
18358
18359 : see if vsnprintf exists
18360 set vsnprintf d_vsnprintf
18361 eval $inlibc
18362
18363 case "$d_snprintf-$d_vsnprintf" in
18364 "$define-$define")
18365     $cat <<EOM
18366 Checking whether your snprintf() and vsnprintf() work okay...
18367 EOM
18368     $cat >try.c <<'EOCP'
18369 /* v?snprintf testing logic courtesy of Russ Allbery.
18370  * According to C99:
18371  * - if the buffer is too short it still must be \0-terminated
18372  * - if the buffer is too short the potentially required length
18373  *   must be returned and not -1
18374  * - if the buffer is NULL the potentially required length
18375  *   must be returned and not -1 or core dump
18376  */
18377 #include <stdio.h>
18378 #include <stdarg.h>
18379
18380 char buf[2];
18381
18382 int test (char *format, ...)
18383 {
18384     va_list args;
18385     int count;
18386
18387     va_start (args, format);
18388     count = vsnprintf (buf, sizeof buf, format, args);
18389     va_end (args);
18390     return count;
18391 }
18392
18393 int main ()
18394 {
18395     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18396              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18397 }
18398 EOCP
18399     set try
18400     if eval $compile; then
18401         `$run ./try`
18402         case "$?" in
18403         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18404         *) cat <<EOM >&4
18405 Your snprintf() and snprintf() don't seem to be working okay.
18406 EOM
18407            d_snprintf="$undef"
18408            d_vsnprintf="$undef"
18409            ;;
18410         esac
18411     else
18412         echo "(I can't seem to compile the test program--assuming they don't)"
18413         d_snprintf="$undef"
18414         d_vsnprintf="$undef"
18415     fi
18416     $rm_try
18417     ;;
18418 esac
18419
18420 : see if sockatmark exists
18421 set sockatmark d_sockatmark
18422 eval $inlibc
18423
18424 : see if prototype for sockatmark is available
18425 echo " "
18426 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18427 eval $hasproto
18428
18429 : see if socks5_init exists
18430 set socks5_init d_socks5_init
18431 eval $inlibc
18432
18433 : see if srand48_r exists
18434 set srand48_r d_srand48_r
18435 eval $inlibc
18436 case "$d_srand48_r" in
18437 "$define")
18438         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18439         case "$d_srand48_r_proto:$usethreads" in
18440         ":define")      d_srand48_r_proto=define
18441                 set d_srand48_r_proto srand48_r $hdrs
18442                 eval $hasproto ;;
18443         *)      ;;
18444         esac
18445         case "$d_srand48_r_proto" in
18446         define)
18447         case "$srand48_r_proto" in
18448         ''|0) try='int srand48_r(long, struct drand48_data*);'
18449         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18450         esac
18451         case "$srand48_r_proto" in
18452         ''|0)   d_srand48_r=undef
18453                 srand48_r_proto=0
18454                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18455         * )     case "$srand48_r_proto" in
18456                 REENTRANT_PROTO*) ;;
18457                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18458                 esac
18459                 echo "Prototype: $try" ;;
18460         esac
18461         ;;
18462         *)      case "$usethreads" in
18463                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18464                 esac
18465                 d_srand48_r=undef
18466                 srand48_r_proto=0
18467                 ;;
18468         esac
18469         ;;
18470 *)      srand48_r_proto=0
18471         ;;
18472 esac
18473
18474 : see if srandom_r exists
18475 set srandom_r d_srandom_r
18476 eval $inlibc
18477 case "$d_srandom_r" in
18478 "$define")
18479         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18480         case "$d_srandom_r_proto:$usethreads" in
18481         ":define")      d_srandom_r_proto=define
18482                 set d_srandom_r_proto srandom_r $hdrs
18483                 eval $hasproto ;;
18484         *)      ;;
18485         esac
18486         case "$d_srandom_r_proto" in
18487         define)
18488         case "$srandom_r_proto" in
18489         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18490         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18491         esac
18492         case "$srandom_r_proto" in
18493         ''|0)   d_srandom_r=undef
18494                 srandom_r_proto=0
18495                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18496         * )     case "$srandom_r_proto" in
18497                 REENTRANT_PROTO*) ;;
18498                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18499                 esac
18500                 echo "Prototype: $try" ;;
18501         esac
18502         ;;
18503         *)      case "$usethreads" in
18504                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18505                 esac
18506                 d_srandom_r=undef
18507                 srandom_r_proto=0
18508                 ;;
18509         esac
18510         ;;
18511 *)      srandom_r_proto=0
18512         ;;
18513 esac
18514
18515 : see if prototype for setresgid is available
18516 echo " "
18517 set d_sresgproto setresgid $i_unistd unistd.h
18518 eval $hasproto
18519
18520 : see if prototype for setresuid is available
18521 echo " "
18522 set d_sresuproto setresuid $i_unistd unistd.h
18523 eval $hasproto
18524
18525 : see if stat exists
18526 set stat d_stat
18527 eval $inlibc
18528
18529 : see if sys/stat.h is available
18530 set sys/stat.h i_sysstat
18531 eval $inhdr
18532
18533 : see if stat knows about block sizes
18534 echo " "
18535 echo "Checking to see if your struct stat has st_blocks field..." >&4
18536 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18537 eval $hasfield
18538
18539 : see if this is a sys/vfs.h system
18540 set sys/vfs.h i_sysvfs
18541 eval $inhdr
18542
18543 : see if this is a sys/statfs.h system
18544 set sys/statfs.h i_sysstatfs
18545 eval $inhdr
18546
18547 : Check for statfs_s
18548 echo " "
18549 echo "Checking to see if your system supports struct statfs..." >&4
18550 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
18551 eval $hasstruct
18552 case "$d_statfs_s" in
18553 "$define")      echo "Yes, it does."   ;;
18554 *)              echo "No, it doesn't." ;;
18555 esac
18556
18557
18558 : see if struct statfs knows about f_flags
18559 case "$d_statfs_s" in
18560 define)
18561         echo " "
18562         echo "Checking to see if your struct statfs has f_flags field..." >&4
18563         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
18564         eval $hasfield
18565         ;;
18566 *)      val="$undef"
18567         set d_statfs_f_flags
18568         eval $setvar
18569         ;;
18570 esac
18571 case "$d_statfs_f_flags" in
18572 "$define")      echo "Yes, it does."   ;;
18573 *)              echo "No, it doesn't." ;;
18574 esac
18575
18576 : see what flavor, if any, of static inline is supported
18577 echo " "
18578 echo "Checking to see if your system supports static inline..."
18579 $cat > try.c <<'EOCP'
18580 #include <stdlib.h>
18581 extern int f_via_a(int x);
18582 extern int f_via_b(int x);
18583 int main(int argc, char **argv)
18584 {
18585     int y;
18586
18587     y = f_via_a(0);
18588 #ifdef USE_B
18589     y = f_via_b(0);
18590 #endif
18591     if (y == 42) {
18592         return EXIT_SUCCESS;
18593     }
18594     else {
18595         return EXIT_FAILURE;
18596     }
18597 }
18598 EOCP
18599 $cat > a.c <<'EOCP'
18600 static INLINE int f(int x) {
18601     int y;
18602     y = x + 42;
18603     return y;
18604 }
18605
18606 int f_via_a(int x)
18607 {
18608     return f(x);
18609 }
18610 EOCP
18611 $cat > b.c <<'EOCP'
18612 extern int f(int x);
18613
18614 int f_via_b(int x)
18615 {
18616     return f(x);
18617 }
18618 EOCP
18619
18620 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18621 case "$perl_static_inline" in
18622 '')     # Check the various possibilities, and break out on success.
18623         # For gcc, prefer __inline__, which will still permit
18624         # cflags.SH to add in -ansi.
18625         case "$gccversion" in
18626                 '') xxx="inline __inline__ __inline _inline";;
18627                 *)  xxx="__inline__ inline __inline _inline";;
18628         esac
18629         for inline in $xxx; do
18630                 set try -DINLINE=$inline a.c
18631                 if eval $compile && $run ./try; then
18632                         # Now make sure there is no external linkage of static
18633                         # functions
18634                         set try -DINLINE=$inline -DUSE_B a.c b.c
18635                         if eval $compile && $run ./try; then
18636                                 $echo "Your compiler supports static $inline, " >&4
18637                                 $echo "but it also creates an external definition," >&4
18638                                 $echo "so I won't use it." >&4
18639                                 val=$undef
18640                         else
18641                                 $echo "Your compiler supports static $inline." >&4
18642                                 val=$define
18643                                 perl_static_inline="static $inline";
18644                                 break;
18645                         fi
18646                 else
18647                         $echo "Your compiler does NOT support static $inline." >&4
18648                         val="$undef"
18649                 fi
18650         done
18651         ;;
18652 *inline*) # Some variant of inline exists.
18653         echo "Keeping your $hint value of $perl_static_inline."
18654         val=$define
18655         ;;
18656 static)  # No inline capabilities
18657         echo "Keeping your $hint value of $perl_static_inline."
18658         val=$undef
18659         ;;
18660 *)  # Unrecognized previous value -- blindly trust the supplied
18661         # value and hope it makes sense.  Use old value for
18662         # d_static_inline, if there is one.
18663         echo "Keeping your $hint value of $perl_static_inline."
18664         case "$d_static_inline" in
18665                 '') val=$define ;;
18666                 *)  val=$d_static_inline ;;
18667         esac
18668         ;;
18669 esac
18670 # Fallback to plain 'static' if nothing worked.
18671 case "$perl_static_inline" in
18672 '')
18673         perl_static_inline="static"
18674         val=$undef
18675         ;;
18676 esac
18677 set d_static_inline
18678 eval $setvar
18679 $rm -f a.[co] b.[co]
18680 $rm_try
18681
18682 : Check stream access
18683 $cat >&4 <<EOM
18684 Checking how to access stdio streams by file descriptor number...
18685 EOM
18686 case "$stdio_stream_array" in
18687 '')     $cat >try.c <<EOCP
18688 #include <stdio.h>
18689 int main() {
18690   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18691     printf("yes\n");
18692 }
18693 EOCP
18694         for s in _iob __iob __sF
18695         do
18696                 set try -DSTDIO_STREAM_ARRAY=$s
18697                 if eval $compile; then
18698                         case "`$run ./try`" in
18699                         yes)    stdio_stream_array=$s; break ;;
18700                         esac
18701                 fi
18702         done
18703         $rm_try
18704 esac
18705 case "$stdio_stream_array" in
18706 '')     $cat >&4 <<EOM
18707 I can't figure out how to access stdio streams by file descriptor number.
18708 EOM
18709         d_stdio_stream_array="$undef"
18710         ;;
18711 *)      $cat >&4 <<EOM
18712 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18713 EOM
18714         d_stdio_stream_array="$define"
18715         ;;
18716 esac
18717
18718 : see if strcoll exists
18719 set strcoll d_strcoll
18720 eval $inlibc
18721
18722 : see if strerror_l exists
18723 set strerror_l d_strerror_l
18724 eval $inlibc
18725
18726 : see if strerror_r exists
18727 set strerror_r d_strerror_r
18728 eval $inlibc
18729 case "$d_strerror_r" in
18730 "$define")
18731         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18732         case "$d_strerror_r_proto:$usethreads" in
18733         ":define")      d_strerror_r_proto=define
18734                 set d_strerror_r_proto strerror_r $hdrs
18735                 eval $hasproto ;;
18736         *)      ;;
18737         esac
18738         case "$d_strerror_r_proto" in
18739         define)
18740         case "$strerror_r_proto" in
18741         ''|0) try='int strerror_r(int, char*, size_t);'
18742         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18743         esac
18744         case "$strerror_r_proto" in
18745         ''|0) try='int strerror_r(int, char*, int);'
18746         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18747         esac
18748         case "$strerror_r_proto" in
18749         ''|0) try='char* strerror_r(int, char*, size_t);'
18750         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18751         esac
18752         case "$strerror_r_proto" in
18753         ''|0)   d_strerror_r=undef
18754                 strerror_r_proto=0
18755                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18756         * )     case "$strerror_r_proto" in
18757                 REENTRANT_PROTO*) ;;
18758                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18759                 esac
18760                 echo "Prototype: $try" ;;
18761         esac
18762         ;;
18763         *)      case "$usethreads" in
18764                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18765                 esac
18766                 d_strerror_r=undef
18767                 strerror_r_proto=0
18768                 ;;
18769         esac
18770         ;;
18771 *)      strerror_r_proto=0
18772         ;;
18773 esac
18774
18775 : see if strftime exists
18776 set strftime d_strftime
18777 eval $inlibc
18778
18779 : see if strlcat exists
18780 set strlcat d_strlcat
18781 eval $inlibc
18782
18783 : see if strlcpy exists
18784 set strlcpy d_strlcpy
18785 eval $inlibc
18786
18787 : see if strnlen exists
18788 set strnlen d_strnlen
18789 eval $inlibc
18790
18791 : see if strtod exists
18792 set strtod d_strtod
18793 eval $inlibc
18794
18795 : see if strtol exists
18796 set strtol d_strtol
18797 eval $inlibc
18798
18799 : see if strtold exists
18800 set strtold d_strtold
18801 eval $inlibc
18802
18803 : see if strtold_l exists
18804 set strtold_l d_strtold_l
18805 eval $inlibc
18806
18807 : see if strtoll exists
18808 set strtoll d_strtoll
18809 eval $inlibc
18810
18811 case "$d_longlong-$d_strtoll" in
18812 "$define-$define")
18813         $cat <<EOM
18814 Checking whether your strtoll() works okay...
18815 EOM
18816         $cat >try.c <<'EOCP'
18817 #include <errno.h>
18818 #ifdef __hpux
18819 #define strtoll __strtoll
18820 #endif
18821 #ifdef __EMX__
18822 #define strtoll _strtoll
18823 #endif
18824 #include <stdio.h>
18825 extern long long int strtoll(char *s, char **, int);
18826 static int bad = 0;
18827 int check(char *s, long long ell, int een) {
18828         long long gll;
18829         errno = 0;
18830         gll = strtoll(s, 0, 10);
18831         if (!((gll == ell) && (errno == een)))
18832                 bad++;
18833 }
18834 int main() {
18835         check(" 1",                                      1LL, 0);
18836         check(" 0",                                      0LL, 0);
18837         check("-1",                                     -1LL, 0);
18838         check("-9223372036854775808", -9223372036854775808LL, 0);
18839         check("-9223372036854775808", -9223372036854775808LL, 0);
18840         check(" 9223372036854775807",  9223372036854775807LL, 0);
18841         check("-9223372036854775808", -9223372036854775808LL, 0);
18842         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18843         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18844         if (!bad)
18845                 printf("ok\n");
18846 }
18847 EOCP
18848         set try
18849         if eval $compile; then
18850                 yyy=`$run ./try`
18851                 case "$yyy" in
18852                 ok) echo "Your strtoll() seems to be working okay." ;;
18853                 *) cat <<EOM >&4
18854 Your strtoll() doesn't seem to be working okay.
18855 EOM
18856                    d_strtoll="$undef"
18857                    ;;
18858                 esac
18859         else
18860                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18861                 d_strtoll="$undef"
18862         fi
18863         ;;
18864 esac
18865
18866 : see if strtoq exists
18867 set strtoq d_strtoq
18868 eval $inlibc
18869
18870 : see if strtoul exists
18871 set strtoul d_strtoul
18872 eval $inlibc
18873
18874 case "$d_strtoul" in
18875 "$define")
18876         $cat <<EOM
18877 Checking whether your strtoul() works okay...
18878 EOM
18879         $cat >try.c <<'EOCP'
18880 #include <errno.h>
18881 #include <stdio.h>
18882 extern unsigned long int strtoul(char *s, char **, int);
18883 static int bad = 0;
18884 void check(char *s, unsigned long eul, int een) {
18885         unsigned long gul;
18886         errno = 0;
18887         gul = strtoul(s, 0, 10);
18888         if (!((gul == eul) && (errno == een)))
18889                 bad++;
18890 }
18891 int main() {
18892         check(" 1", 1L, 0);
18893         check(" 0", 0L, 0);
18894 EOCP
18895         case "$longsize" in
18896         8)
18897             $cat >>try.c <<'EOCP'
18898         check("18446744073709551615", 18446744073709551615UL, 0);
18899         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18900 #if 0 /* strtoul() for /^-/ strings is undefined. */
18901         check("-1", 18446744073709551615UL, 0);
18902         check("-18446744073709551614", 2, 0);
18903         check("-18446744073709551615", 1, 0);
18904         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18905         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18906 #endif
18907 EOCP
18908                 ;;
18909         4)
18910                     $cat >>try.c <<'EOCP'
18911         check("4294967295", 4294967295UL, 0);
18912         check("4294967296", 4294967295UL, ERANGE);
18913 #if 0 /* strtoul() for /^-/ strings is undefined. */
18914         check("-1", 4294967295UL, 0);
18915         check("-4294967294", 2, 0);
18916         check("-4294967295", 1, 0);
18917         check("-4294967296", 4294967295UL, ERANGE);
18918         check("-4294967297", 4294967295UL, ERANGE);
18919 #endif
18920 EOCP
18921                 ;;
18922         *)
18923 : Should we write these tests to be more portable by sprintf-ing
18924 : ~0 and then manipulating that char string as input for strtol?
18925                 ;;
18926         esac
18927         $cat >>try.c <<'EOCP'
18928         if (!bad)
18929                 printf("ok\n");
18930         return 0;
18931 }
18932 EOCP
18933         set try
18934         if eval $compile; then
18935                 case "`$run ./try`" in
18936                 ok) echo "Your strtoul() seems to be working okay." ;;
18937                 *) cat <<EOM >&4
18938 Your strtoul() doesn't seem to be working okay.
18939 EOM
18940                    d_strtoul="$undef"
18941                    ;;
18942                 esac
18943         else
18944                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18945                 d_strtoul="$undef"
18946         fi
18947         ;;
18948 esac
18949
18950 : see if strtoull exists
18951 set strtoull d_strtoull
18952 eval $inlibc
18953
18954 case "$d_longlong-$d_strtoull" in
18955 "$define-$define")
18956         $cat <<EOM
18957 Checking whether your strtoull() works okay...
18958 EOM
18959         $cat >try.c <<'EOCP'
18960 #include <errno.h>
18961 #ifdef __hpux
18962 #define strtoull __strtoull
18963 #endif
18964 #include <stdio.h>
18965 extern unsigned long long int strtoull(char *s, char **, int);
18966 static int bad = 0;
18967 int check(char *s, long long eull, int een) {
18968         long long gull;
18969         errno = 0;
18970         gull = strtoull(s, 0, 10);
18971         if (!((gull == eull) && (errno == een)))
18972                 bad++;
18973 }
18974 int main() {
18975         check(" 1",                                        1LL, 0);
18976         check(" 0",                                        0LL, 0);
18977         check("18446744073709551615",  18446744073709551615ULL, 0);
18978         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18979 #if 0 /* strtoull() for /^-/ strings is undefined. */
18980         check("-1",                    18446744073709551615ULL, 0);
18981         check("-18446744073709551614",                     2LL, 0);
18982         check("-18446744073709551615",                     1LL, 0);
18983         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18984         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18985 #endif
18986         if (!bad)
18987                 printf("ok\n");
18988 }
18989 EOCP
18990         set try
18991         if eval $compile; then
18992                 case "`$run ./try`" in
18993                 ok) echo "Your strtoull() seems to be working okay." ;;
18994                 *) cat <<EOM >&4
18995 Your strtoull() doesn't seem to be working okay.
18996 EOM
18997                    d_strtoull="$undef"
18998                    ;;
18999                 esac
19000         else
19001                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19002                 d_strtoull="$undef"
19003         fi
19004         ;;
19005 esac
19006
19007 : see if strtouq exists
19008 set strtouq d_strtouq
19009 eval $inlibc
19010
19011 case "$d_strtouq" in
19012 "$define")
19013         $cat <<EOM
19014 Checking whether your strtouq() works okay...
19015 EOM
19016         $cat >try.c <<'EOCP'
19017 #include <errno.h>
19018 #include <stdio.h>
19019 extern unsigned long long int strtouq(char *s, char **, int);
19020 static int bad = 0;
19021 void check(char *s, unsigned long long eull, int een) {
19022         unsigned long long gull;
19023         errno = 0;
19024         gull = strtouq(s, 0, 10);
19025         if (!((gull == eull) && (errno == een)))
19026                 bad++;
19027 }
19028 int main() {
19029         check(" 1",                                        1LL, 0);
19030         check(" 0",                                        0LL, 0);
19031         check("18446744073709551615",  18446744073709551615ULL, 0);
19032         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19033 #if 0 /* strtouq() for /^-/ strings is undefined. */
19034         check("-1",                    18446744073709551615ULL, 0);
19035         check("-18446744073709551614",                     2LL, 0);
19036         check("-18446744073709551615",                     1LL, 0);
19037         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19038         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19039 #endif
19040         if (!bad)
19041                 printf("ok\n");
19042         return 0;
19043 }
19044 EOCP
19045         set try
19046         if eval $compile; then
19047                 case "`$run ./try`" in
19048                 ok) echo "Your strtouq() seems to be working okay." ;;
19049                 *) cat <<EOM >&4
19050 Your strtouq() doesn't seem to be working okay.
19051 EOM
19052                    d_strtouq="$undef"
19053                    ;;
19054                 esac
19055         else
19056                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19057                 d_strtouq="$undef"
19058         fi
19059         ;;
19060 esac
19061
19062 : see if strxfrm exists
19063 set strxfrm d_strxfrm
19064 eval $inlibc
19065
19066 : see if symlink exists
19067 set symlink d_symlink
19068 eval $inlibc
19069
19070 : see if syscall exists
19071 set syscall d_syscall
19072 eval $inlibc
19073
19074 : see if prototype for syscall is available
19075 echo " "
19076 set d_syscallproto syscall $i_unistd unistd.h
19077 eval $hasproto
19078
19079 : see if sysconf exists
19080 set sysconf d_sysconf
19081 eval $inlibc
19082
19083 : see if sys_errlist[] exists
19084 echo " "
19085 if test "X$d_syserrlst" = X; then
19086         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19087                 echo "You have sys_errlist[], so we could roll our own strerror."
19088                 d_syserrlst="$define"
19089         else
19090                 echo "You don't have sys_errlist[], so strerror() is welcome."
19091                 d_syserrlst="$undef"
19092         fi
19093 fi
19094
19095 : see if system exists
19096 set system d_system
19097 eval $inlibc
19098
19099 : see if tcgetpgrp exists
19100 set tcgetpgrp d_tcgetpgrp
19101 eval $inlibc
19102
19103 : see if tcsetpgrp exists
19104 set tcsetpgrp d_tcsetpgrp
19105 eval $inlibc
19106
19107 : see if prototype for telldir is available
19108 echo " "
19109 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19110 eval $hasproto
19111
19112 : see if tgamma exists
19113 set tgamma d_tgamma
19114 eval $inlibc
19115
19116 : check for thread_safe_nl_langinfo_l item
19117 $cat <<EOM
19118
19119 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19120 EOM
19121 $cat >try.c <<EOCP
19122 #$i_stdlib I_STDLIB
19123 #ifdef I_STDLIB
19124 #  include <stdlib.h>
19125 #endif
19126 #include <string.h>
19127 #$i_langinfo I_LANGINFO
19128 #ifdef I_LANGINFO
19129 #  include <langinfo.h>
19130 #endif
19131 #$i_pthread I_PTHREAD
19132 #ifdef I_PTHREAD
19133 #  include <pthread.h>
19134 #endif
19135 #$i_locale I_LOCALE
19136 #ifdef I_LOCALE
19137 #  include <locale.h>
19138 #endif
19139
19140 void *
19141 thread_start(void * arg)
19142 {
19143     nl_langinfo(RADIXCHAR);
19144 }
19145
19146 int main() {
19147     char * main_buffer;
19148     char save_main_buffer[1000];
19149     pthread_t subthread;
19150     pthread_attr_t attr;
19151
19152     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19153
19154     /* If too large for our generous allowance, just assume we don't have
19155      * it. */
19156     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19157         exit(1);
19158     }
19159
19160     strcpy(save_main_buffer, main_buffer);
19161
19162     if (pthread_attr_init(&attr) != 0) {
19163         exit(1);
19164     }
19165
19166     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19167         exit(1);
19168     }
19169
19170     if (pthread_join(subthread, NULL) != 0) {
19171         exit(1);
19172     }
19173
19174     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19175 }
19176 EOCP
19177 case "$usethreads" in
19178     define)
19179         set try
19180         if eval $compile; then
19181             echo "Your system has nl_langinfo_l()..." >&4
19182             if $run ./try; then
19183                 echo "and it is thread-safe (just as I'd hoped)." >&4
19184                 d_thread_safe_nl_langinfo_l="$define"
19185                 echo "$d_thread_safe_nl_langinfo_l" >&4
19186             else
19187                 echo "but it isn't thread-safe, so we won't use it." >&4
19188             fi
19189         else
19190             echo "your system does not have nl_langinfo_l()" >&4
19191         fi
19192         ;;
19193     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19194 esac
19195 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19196         d_thread_safe_nl_langinfo_l="$undef"
19197 fi
19198 $rm_try
19199
19200 : see if time exists
19201 echo " "
19202 if test "X$d_time" = X -o X"$timetype" = X; then
19203     if set time val -f d_time; eval $csym; $val; then
19204                 echo 'time() found.' >&4
19205                 val="$define"
19206                 rp="What is the type returned by time() on this system?"
19207                 set time_t timetype long stdio.h sys/types.h
19208                 eval $typedef_ask
19209     else
19210                 echo 'time() not found, hope that will do.' >&4
19211                 val="$undef"
19212                 timetype='int';
19213     fi
19214     set d_time
19215     eval $setvar
19216 fi
19217
19218 : see if timegm exists
19219 set timegm d_timegm
19220 eval $inlibc
19221
19222 : see if this is a sys/times.h system
19223 set sys/times.h i_systimes
19224 eval $inhdr
19225
19226 : see if times exists
19227 echo " "
19228 if set times val -f d_times; eval $csym; $val; then
19229         echo 'times() found.' >&4
19230         d_times="$define"
19231         inc=''
19232         case "$i_systimes" in
19233         "$define") inc='sys/times.h';;
19234         esac
19235         rp="What is the type returned by times() on this system?"
19236         set clock_t clocktype long stdio.h sys/types.h $inc
19237         eval $typedef_ask
19238 else
19239         echo 'times() NOT found, hope that will do.' >&4
19240         d_times="$undef"
19241         clocktype='int'
19242 fi
19243
19244 : see if tmpnam_r exists
19245 set tmpnam_r d_tmpnam_r
19246 eval $inlibc
19247 case "$d_tmpnam_r" in
19248 "$define")
19249         hdrs="$i_systypes sys/types.h define stdio.h "
19250         case "$d_tmpnam_r_proto:$usethreads" in
19251         ":define")      d_tmpnam_r_proto=define
19252                 set d_tmpnam_r_proto tmpnam_r $hdrs
19253                 eval $hasproto ;;
19254         *)      ;;
19255         esac
19256         case "$d_tmpnam_r_proto" in
19257         define)
19258         case "$tmpnam_r_proto" in
19259         ''|0) try='char* tmpnam_r(char*);'
19260         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19261         esac
19262         case "$tmpnam_r_proto" in
19263         ''|0)   d_tmpnam_r=undef
19264                 tmpnam_r_proto=0
19265                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19266         * )     case "$tmpnam_r_proto" in
19267                 REENTRANT_PROTO*) ;;
19268                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19269                 esac
19270                 echo "Prototype: $try" ;;
19271         esac
19272         ;;
19273         *)      case "$usethreads" in
19274                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19275                 esac
19276                 d_tmpnam_r=undef
19277                 tmpnam_r_proto=0
19278                 ;;
19279         esac
19280         ;;
19281 *)      tmpnam_r_proto=0
19282         ;;
19283 esac
19284
19285 : see if trunc exists
19286 set trunc d_trunc
19287 eval $inlibc
19288
19289 : see if truncate exists
19290 set truncate d_truncate
19291 eval $inlibc
19292
19293 : see if ttyname_r exists
19294 set ttyname_r d_ttyname_r
19295 eval $inlibc
19296 case "$d_ttyname_r" in
19297 "$define")
19298         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19299         case "$d_ttyname_r_proto:$usethreads" in
19300         ":define")      d_ttyname_r_proto=define
19301                 set d_ttyname_r_proto ttyname_r $hdrs
19302                 eval $hasproto ;;
19303         *)      ;;
19304         esac
19305         case "$d_ttyname_r_proto" in
19306         define)
19307         case "$ttyname_r_proto" in
19308         ''|0) try='int ttyname_r(int, char*, size_t);'
19309         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19310         esac
19311         case "$ttyname_r_proto" in
19312         ''|0) try='int ttyname_r(int, char*, int);'
19313         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19314         esac
19315         case "$ttyname_r_proto" in
19316         ''|0) try='char* ttyname_r(int, char*, int);'
19317         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19318         esac
19319         case "$ttyname_r_proto" in
19320         ''|0)   d_ttyname_r=undef
19321                 ttyname_r_proto=0
19322                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19323         * )     case "$ttyname_r_proto" in
19324                 REENTRANT_PROTO*) ;;
19325                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19326                 esac
19327                 echo "Prototype: $try" ;;
19328         esac
19329         ;;
19330         *)      case "$usethreads" in
19331                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19332                 esac
19333                 d_ttyname_r=undef
19334                 ttyname_r_proto=0
19335                 ;;
19336         esac
19337         ;;
19338 *)      ttyname_r_proto=0
19339         ;;
19340 esac
19341
19342 : see if tzname[] exists
19343 echo " "
19344 if set tzname val -a d_tzname; eval $csym; $val; then
19345         val="$define"
19346         echo 'tzname[] found.' >&4
19347 else
19348         val="$undef"
19349         echo 'tzname[] NOT found.' >&4
19350 fi
19351 set d_tzname
19352 eval $setvar
19353
19354 : Check if is a multiplatform env
19355 case "$osname" in
19356 darwin) multiarch="$define" ;;
19357 esac
19358 case "$multiarch" in
19359 ''|[nN]*) multiarch="$undef" ;;
19360 esac
19361
19362 : check for ordering of bytes in a UV
19363 echo " "
19364 case "$multiarch" in
19365 *$define*)
19366         $cat <<EOM
19367 You seem to be doing a multiarchitecture build,
19368 skipping the byteorder check.
19369
19370 EOM
19371         byteorder='ffff'
19372         ;;
19373 *)
19374         case "$byteorder" in
19375         '')
19376                 $cat <<'EOM'
19377 In the following, larger digits indicate more significance.  A big-endian
19378 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19379 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19380 machines may have weird orders like 3412.  A Cray will report 87654321,
19381 an Alpha will report 12345678. If the test program works the default is
19382 probably right.
19383 I'm now running the test program...
19384 EOM
19385                 $cat >try.c <<EOCP
19386 #include <stdio.h>
19387 #$i_stdlib I_STDLIB
19388 #ifdef I_STDLIB
19389 #include <stdlib.h>
19390 #endif
19391 #include <sys/types.h>
19392 typedef $uvtype UV;
19393 int main()
19394 {
19395         int i;
19396         union {
19397                 UV l;
19398                 char c[$uvsize];
19399         } u;
19400
19401         if ($uvsize > 4)
19402                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19403         else
19404                 u.l = (UV)0x04030201;
19405         for (i = 0; i < $uvsize; i++)
19406                 printf("%c", u.c[i]+'0');
19407         printf("\n");
19408         exit(0);
19409 }
19410 EOCP
19411                 xxx_prompt=y
19412                 set try
19413                 if eval $compile && $run ./try > /dev/null; then
19414                         dflt=`$run ./try`
19415                         case "$dflt" in
19416                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19417                                 echo "(The test program ran ok.)"
19418                                 echo "byteorder=$dflt"
19419                                 xxx_prompt=n
19420                         ;;
19421                         ????|????????) echo "(The test program ran ok.)" ;;
19422                         *) echo "(The test program didn't run right for some reason.)" ;;
19423                         esac
19424                 else
19425                         dflt='4321'
19426                         cat <<'EOM'
19427 (I can't seem to compile the test program.  Guessing big-endian...)
19428 EOM
19429                 fi
19430                 case "$xxx_prompt" in
19431                 y)
19432                         rp="What is the order of bytes in $uvtype?"
19433                         . ./myread
19434                         byteorder="$ans"
19435                         ;;
19436                 *)      byteorder=$dflt
19437                         ;;
19438                 esac
19439                 ;;
19440         esac
19441         $rm_try
19442         ;;
19443 esac
19444
19445 : Checking 32bit alignedness
19446 $cat <<EOM
19447
19448 Checking to see whether you can access character data unalignedly...
19449 EOM
19450 case "$d_u32align" in
19451 '')   $cat >try.c <<EOCP
19452 #include <stdio.h>
19453 #$i_stdlib I_STDLIB
19454 #ifdef I_STDLIB
19455 #include <stdlib.h>
19456 #endif
19457 #define U32 $u32type
19458 #define BYTEORDER 0x$byteorder
19459 #define U8 $u8type
19460 #include <signal.h>
19461 #ifdef SIGBUS
19462 $signal_t bletch(int s) { exit(4); }
19463 #endif
19464 int main() {
19465 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19466     volatile U8 buf[8];
19467     volatile U32 *up;
19468     int i;
19469
19470     if (sizeof(U32) != 4) {
19471         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19472         exit(1);
19473     }
19474
19475     fflush(stdout);
19476
19477 #ifdef SIGBUS
19478     signal(SIGBUS, bletch);
19479 #endif
19480
19481     buf[0] = 0;
19482     buf[1] = 0;
19483     buf[2] = 0;
19484     buf[3] = 1;
19485     buf[4] = 0;
19486     buf[5] = 0;
19487     buf[6] = 0;
19488     buf[7] = 1;
19489
19490     for (i = 0; i < 4; i++) {
19491         up = (U32*)(buf + i);
19492         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19493                (*up == 1 << (8*(3-i)))  /* little-endian */
19494               )
19495            )
19496         {
19497             printf("read failed (%x)\n", *up);
19498             exit(2);
19499         }
19500     }
19501
19502     /* write test */
19503     for (i = 0; i < 4; i++) {
19504         up = (U32*)(buf + i);
19505         *up = 0xBeef;
19506         if (*up != 0xBeef) {
19507             printf("write failed (%x)\n", *up);
19508             exit(3);
19509         }
19510     }
19511
19512     exit(0);
19513 #else
19514     printf("1\n");
19515     exit(1);
19516 #endif
19517     return 0;
19518 }
19519 EOCP
19520 set try
19521 if eval $compile_ok; then
19522         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19523         $run ./try 2>&1 >/dev/null
19524         case "$?" in
19525         0)      cat >&4 <<EOM
19526 You can access character data pretty unalignedly.
19527 EOM
19528                 d_u32align="$undef"
19529                 ;;
19530         *)      cat >&4 <<EOM
19531 It seems that you must access character data in an aligned manner.
19532 EOM
19533                 d_u32align="$define"
19534                 ;;
19535         esac
19536 else
19537         rp='Can you access character data at unaligned addresses?'
19538         dflt='n'
19539         . ./myread
19540         case "$ans" in
19541         [yY]*)  d_u32align="$undef"  ;;
19542         *)      d_u32align="$define" ;;
19543         esac
19544 fi
19545 $rm_try
19546 ;;
19547 esac
19548
19549 : see if ualarm exists
19550 set ualarm d_ualarm
19551 eval $inlibc
19552
19553 : see if umask exists
19554 set umask d_umask
19555 eval $inlibc
19556
19557 : see if unordered exists
19558 set unordered d_unordered
19559 eval $inlibc
19560
19561 : see if unsetenv exists
19562 set unsetenv d_unsetenv
19563 eval $inlibc
19564
19565 : see if usleep exists
19566 set usleep d_usleep
19567 eval $inlibc
19568
19569 : see if prototype for usleep is available
19570 echo " "
19571 set d_usleepproto usleep $i_unistd unistd.h
19572 eval $hasproto
19573
19574 : see if ustat exists
19575 set ustat d_ustat
19576 eval $inlibc
19577
19578 : see if closedir exists
19579 set closedir d_closedir
19580 eval $inlibc
19581
19582 case "$d_closedir" in
19583 "$define")
19584         echo " "
19585         echo "Checking whether closedir() returns a status..." >&4
19586         cat > try.c <<EOM
19587 #$i_dirent I_DIRENT             /**/
19588 #$i_sysdir I_SYS_DIR            /**/
19589 #$i_sysndir I_SYS_NDIR          /**/
19590 #$i_systypes I_SYS_TYPES        /**/
19591
19592 #if defined(I_SYS_TYPES)
19593 #include <sys/types.h>
19594 #endif
19595 #if defined(I_DIRENT)
19596 #include <dirent.h>
19597 #else
19598 #ifdef I_SYS_NDIR
19599 #include <sys/ndir.h>
19600 #else
19601 #ifdef I_SYS_DIR
19602 #include <sys/dir.h>
19603 #endif
19604 #endif
19605 #endif
19606 int main() { return closedir(opendir(".")); }
19607 EOM
19608         set try
19609         if eval $compile_ok; then
19610                 if $run ./try > /dev/null 2>&1 ; then
19611                         echo "Yes, it does."
19612                         val="$undef"
19613                 else
19614                         echo "No, it doesn't."
19615                         val="$define"
19616                 fi
19617         else
19618                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19619                 val="$define"
19620         fi
19621         ;;
19622 *)
19623         val="$undef";
19624         ;;
19625 esac
19626 set d_void_closedir
19627 eval $setvar
19628 $rm_try
19629
19630 : see if there is a wait4
19631 set wait4 d_wait4
19632 eval $inlibc
19633
19634 : see if waitpid exists
19635 set waitpid d_waitpid
19636 eval $inlibc
19637
19638 : look for wcscmp
19639 echo " "
19640 $cat >try.c <<'EOCP'
19641 #include <stdio.h>
19642 #include <wchar.h>
19643 int main ()
19644 {
19645     wchar_t *s = L" ";
19646     return (wcscmp (s, s) ? 1 : 0);
19647     }
19648 EOCP
19649 set try
19650 val="$undef"
19651 if eval $compile; then
19652     `$run ./try`
19653     case "$?" in
19654         0)  echo "A working wcscmp() found." >&4
19655             val="$define" ;;
19656         *)  echo "wcscmp() found, but it doesn't work" >&4
19657             ;;
19658         esac
19659 else
19660     echo "wcscmp() NOT found." >&4
19661     fi
19662 set d_wcscmp
19663 eval $setvar
19664 $rm_try
19665
19666 : see if wcstombs exists
19667 set wcstombs d_wcstombs
19668 eval $inlibc
19669
19670 : look for wcsxfrm
19671 echo " "
19672 $cat >try.c <<'EOCP'
19673 #include <errno.h>
19674 #include <wchar.h>
19675 int main ()
19676 {
19677     wchar_t dst[4], *src = L" ";
19678     errno = 0;
19679     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19680     }
19681 EOCP
19682 set try
19683 val="$undef"
19684 if eval $compile; then
19685     `$run ./try`
19686     case "$?" in
19687         0)  echo "A working wcsxfrm() found." >&4
19688             val="$define" ;;
19689         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19690             ;;
19691         esac
19692 else
19693     echo "wcsxfrm() NOT found." >&4
19694     fi
19695 set d_wcsxfrm
19696 eval $setvar
19697 $rm_try
19698
19699 : see if wctomb exists
19700 set wctomb d_wctomb
19701 eval $inlibc
19702
19703 : see if writev exists
19704 set writev d_writev
19705 eval $inlibc
19706
19707 : check for alignment requirements
19708 echo " "
19709 case "$alignbytes" in
19710     '') echo "Checking alignment constraints..." >&4
19711         $cat >try.c <<EOCP
19712 #include <stdio.h>
19713 struct foobar {
19714     char foo;
19715     $nvtype bar;
19716 } try_algn;
19717 int main()
19718 {
19719     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19720     return(0);
19721 }
19722 EOCP
19723         set try
19724         if eval $compile_ok; then
19725             dflt=`$run ./try`
19726         else
19727             dflt='8'
19728             echo "(I can't seem to compile the test program...)"
19729         fi
19730         case "$multiarch" in
19731             *$define*)
19732                 : The usual safe value is 8, but Darwin with -Duselongdouble
19733                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19734                 : Configure to pick a larger value if needed.
19735                 if $test "$dflt" -lt 8; then
19736                     dflt='8'
19737                     echo "Setting alignment to 8 for multiarch support.">&4
19738                 fi
19739                 ;;
19740         esac
19741         ;;
19742     *) dflt="$alignbytes"
19743         ;;
19744 esac
19745 rp="Doubles must be aligned on a how-many-byte boundary?"
19746 . ./myread
19747 alignbytes="$ans"
19748 $rm_try
19749
19750 : set the base revision
19751 baserev=5.0
19752
19753 : length of character in bytes. Is always 1, otherwise it is not C
19754 : This used to be a test using sizeof
19755 charsize=1
19756
19757 : Check for the number of bits in a character
19758 case "$charbits" in
19759 '')     echo "Checking how long a character is (in bits)..." >&4
19760         $cat >try.c <<EOCP
19761 #include <stdio.h>
19762 int main ()
19763 {
19764     int n;
19765     unsigned char c;
19766     for (c = 1, n = 0; c; c <<= 1, n++) ;
19767     printf ("%d\n", n);
19768     return (0);
19769     }
19770 EOCP
19771         set try
19772         if eval $compile_ok; then
19773                 dflt=`$run ./try`
19774         else
19775                 dflt='8'
19776                 echo "(I can't seem to compile the test program.  Guessing...)"
19777         fi
19778         ;;
19779 *)
19780         dflt="$charbits"
19781         ;;
19782 esac
19783 rp="What is the length of a character (in bits)?"
19784 . ./myread
19785 charbits="$ans"
19786 $rm_try
19787 case "$charbits" in
19788 8)      ;;
19789 *)      cat >&4 << EOM
19790 Your system has an unsigned character size of $charbits bits, which
19791 is rather unusual (normally it is 8 bits).  Perl likely will not work
19792 correctly on your system, with subtle bugs in various places.
19793 EOM
19794         rp='Do you really want to continue?'
19795         dflt='n'
19796         . ./myread
19797         case "$ans" in
19798                 [yY])   echo >&4 "Okay, continuing."    ;;
19799                 *)      exit 1                          ;;
19800         esac
19801 esac
19802
19803 : how do we concatenate cpp tokens here?
19804 echo " "
19805 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19806 $cat >cpp_stuff.c <<'EOCP'
19807 #define RCAT(a,b)a/**/b
19808 #define ACAT(a,b)a ## b
19809 RCAT(Rei,ser)
19810 ACAT(Cir,cus)
19811 EOCP
19812 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19813 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19814         echo "Oh!  Smells like ANSI's been here." >&4
19815         echo "We can catify or stringify, separately or together!"
19816         cpp_stuff=42
19817 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19818         echo "Ah, yes!  The good old days!" >&4
19819         echo "However, in the good old days we don't know how to stringify and"
19820         echo "catify at the same time."
19821         cpp_stuff=1
19822 else
19823         $cat >&4 <<EOM
19824 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19825 You're going to have to edit the values of CAT[2-5] in config.h...
19826 EOM
19827         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19828 fi
19829 $rm -f cpp_stuff.*
19830
19831 : see if this is a db.h system
19832 set db.h i_db
19833 eval $inhdr
19834
19835 case "$i_db" in
19836 $define)
19837         : Check db version.
19838         echo " "
19839         echo "Checking Berkeley DB version ..." >&4
19840         $cat >try.c <<EOCP
19841 #$d_const HASCONST
19842 #ifndef HASCONST
19843 #define const
19844 #endif
19845 #include <sys/types.h>
19846 #include <stdio.h>
19847 #$i_stdlib I_STDLIB
19848 #ifdef I_STDLIB
19849 #include <stdlib.h>
19850 #endif
19851 #include <db.h>
19852 int main(int argc, char *argv[])
19853 {
19854 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19855     int Major, Minor, Patch ;
19856     unsigned long Version ;
19857     (void)db_version(&Major, &Minor, &Patch) ;
19858     if (argc == 2) {
19859         printf("%d %d %d %d %d %d\n",
19860                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19861                Major, Minor, Patch);
19862         exit(0);
19863     }
19864     printf("You have Berkeley DB Version 2 or greater.\n");
19865
19866     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19867                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19868     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19869                 Major, Minor, Patch) ;
19870
19871     /* check that db.h & libdb are compatible */
19872     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19873         printf("db.h and libdb are incompatible.\n") ;
19874         exit(3);
19875     }
19876
19877     printf("db.h and libdb are compatible.\n") ;
19878
19879     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19880                 + DB_VERSION_PATCH ;
19881
19882     /* needs to be >= 2.3.4 */
19883     if (Version < 2003004) {
19884     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19885         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19886         exit(2);
19887     }
19888
19889     exit(0);
19890 #else
19891 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19892     if (argc == 2) {
19893         printf("1 0 0\n");
19894         exit(0);
19895     }
19896     printf("You have Berkeley DB Version 1.\n");
19897     exit(0);    /* DB version < 2: the coast is clear. */
19898 #else
19899     exit(1);    /* <db.h> not Berkeley DB? */
19900 #endif
19901 #endif
19902 }
19903 EOCP
19904         set try
19905         if eval $compile_ok && $run ./try; then
19906                 echo 'Looks OK.' >&4
19907                 set `$run ./try 1`
19908                 db_version_major=$1
19909                 db_version_minor=$2
19910                 db_version_patch=$3
19911         else
19912                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19913                 i_db=$undef
19914                 case " $libs " in
19915                 *"-ldb "*)
19916                         : Remove db from list of libraries to use
19917                         echo "Removing unusable -ldb from library list" >&4
19918                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19919                         shift
19920                         libs="$*"
19921                         echo "libs = $libs" >&4
19922                         ;;
19923                 esac
19924         fi
19925         $rm_try
19926         ;;
19927 esac
19928
19929 case "$i_db" in
19930 define)
19931         : Check the return type needed for hash
19932         echo " "
19933         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19934         $cat >try.c <<EOCP
19935 #$d_const HASCONST
19936 #ifndef HASCONST
19937 #define const
19938 #endif
19939 #include <sys/types.h>
19940 #include <db.h>
19941
19942 #ifndef DB_VERSION_MAJOR
19943 u_int32_t hash_cb (const void* ptr, size_t size)
19944 {
19945 }
19946 HASHINFO info;
19947 int main()
19948 {
19949         info.hash = hash_cb;
19950 }
19951 #endif
19952 EOCP
19953         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19954                 if $contains warning try.out >>/dev/null 2>&1 ; then
19955                         db_hashtype='int'
19956                 else
19957                         db_hashtype='u_int32_t'
19958                 fi
19959         else
19960                 : XXX Maybe we should just give up here.
19961                 db_hashtype=u_int32_t
19962                 $cat try.out >&4
19963                 echo "Help:  I can't seem to compile the db test program." >&4
19964                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19965         fi
19966         $rm_try
19967         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19968         ;;
19969 *)      db_hashtype=u_int32_t
19970         ;;
19971 esac
19972 case "$i_db" in
19973 define)
19974         : Check the return type needed for prefix
19975         echo " "
19976         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19977         cat >try.c <<EOCP
19978 #$d_const HASCONST
19979 #ifndef HASCONST
19980 #define const
19981 #endif
19982 #include <sys/types.h>
19983 #include <db.h>
19984
19985 #ifndef DB_VERSION_MAJOR
19986 size_t prefix_cb (const DBT *key1, const DBT *key2)
19987 {
19988 }
19989 BTREEINFO info;
19990 int main()
19991 {
19992         info.prefix = prefix_cb;
19993 }
19994 #endif
19995 EOCP
19996         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19997                 if $contains warning try.out >>/dev/null 2>&1 ; then
19998                         db_prefixtype='int'
19999                 else
20000                         db_prefixtype='size_t'
20001                 fi
20002         else
20003                 db_prefixtype='size_t'
20004                 : XXX Maybe we should just give up here.
20005                 $cat try.out >&4
20006                 echo "Help:  I can't seem to compile the db test program." >&4
20007                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20008         fi
20009         $rm_try
20010         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20011         ;;
20012 *)      db_prefixtype='size_t'
20013         ;;
20014 esac
20015
20016 : Include . in @INC
20017 $cat <<EOM
20018
20019 Historically Perl has provided a final fallback of the current working
20020 directory '.' when searching for a library. This, however, can lead to
20021 problems when a Perl program which loads optional modules is called from
20022 a shared directory. This can lead to executing unexpected code.
20023
20024 EOM
20025
20026 # When changing to exclude by default:
20027 case "$default_inc_excludes_dot" in
20028     $undef|false|[nN]*) dflt="n" ;;
20029     *)                  dflt="y" ;;
20030 esac
20031 # To turn exclude off by default:
20032 #case "$default_inc_excludes_dot" in
20033 #    $define|true|[yY]*) dflt="y" ;;
20034 #    *)                  dflt="n" ;;
20035 #esac
20036
20037 rp='Exclude '.' from @INC by default? '
20038 . ./myread
20039 case "$ans" in
20040     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20041     *)          default_inc_excludes_dot="$define" ;;
20042 esac
20043
20044 : Check what kind of inf/nan your system has
20045 $echo "Checking the kind of infinities and nans you have..." >&4
20046 $echo "(The following tests may crash.  That's okay.)" >&4
20047 $cat >try.c <<EOP
20048 #define DOUBLESIZE $doublesize
20049 #$d_longdbl HAS_LONG_DOUBLE
20050 #ifdef HAS_LONG_DOUBLE
20051 #define LONG_DOUBLESIZE $longdblsize
20052 #define LONG_DOUBLEKIND $longdblkind
20053 #endif
20054 #include <math.h>
20055 #include <string.h>
20056 #include <stdio.h>
20057 /* Note that whether the sign bit is on or off
20058  * for NaN depends on the CPU/FPU, and possibly
20059  * can be affected by the build toolchain.
20060  *
20061  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20062  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20063  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20064  * (respectively) as opposed to the more usual
20065  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20066  *
20067  * Pre-IEEE-754 floating point format do not even have inf/nan support
20068  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20069  * to even mention, causing immediate SIGFPE or equivalent: this is
20070  * the case with VAX floating point, for example.
20071  */
20072 static void bytes(void *v, unsigned int n) {
20073   unsigned char *p = (unsigned char *)v;
20074   int i;
20075   for (i = 0; i < n; i++) {
20076     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20077   }
20078 }
20079 int main(int argc, char *argv[]) {
20080    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20081     * because some compilers are 'smart' and not only warn but refuse to
20082     * compile such 'illegal' values. */
20083    double dinf = exp(1e9);
20084    double dnan = sqrt(-1.0);
20085 #ifdef HAS_LONG_DOUBLE
20086    long double ldinf = (long double)exp(1e9);
20087    long double ldnan = (long double)sqrt(-1.0);
20088 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20089 /* the 80-bit long doubles might have garbage in their excess bytes */
20090     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20091     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20092 # endif
20093   if (argc == 2) {
20094     switch (argv[1][0]) {
20095     case '1': bytes(&dinf, sizeof(dinf)); break;
20096     case '2': bytes(&dnan, sizeof(dnan)); break;
20097     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20098     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20099 #endif
20100     }
20101   }
20102   return 0;
20103 }
20104 EOP
20105 set try
20106 if eval $compile; then
20107     doubleinfbytes=`$run ./try 1`
20108     doublenanbytes=`$run ./try 2`
20109     case "$d_longdbl" in
20110     $define)
20111       longdblinfbytes=`$run ./try 3`
20112       longdblnanbytes=`$run ./try 4`
20113       ;;
20114     esac
20115 else
20116     # Defaults in case the above test program failed.
20117     case "$doublekind" in
20118     1) # IEEE 754 32-bit LE
20119        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20120        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20121        ;;
20122     2) # IEEE 754 32-bit BE
20123        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20124        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20125        ;;
20126     3) # IEEE 754 64-bit LE
20127        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20128        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20129        ;;
20130     4) # IEEE 754 64-bit BE
20131        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20132        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20133        ;;
20134     5) # IEEE 754 128-bit LE
20135        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20136        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20137        ;;
20138     6) # IEEE 754 128-bit BE
20139        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20140        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20141        ;;
20142     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20143        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20144        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20145        ;;
20146     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20147        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20148        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20149        ;;
20150     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20151        doubleinfbytes=$undef
20152        doublenanbytes=$undef
20153        ;;
20154     *) # No idea.
20155        doubleinfbytes=$undef
20156        doublenanbytes=$undef
20157        ;;
20158     esac
20159     case "$longdblkind" in
20160     1) # IEEE 754 128-bit LE
20161        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20162        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20163        ;;
20164     2) # IEEE 754 128-bit BE
20165        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20166        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20167        ;;
20168     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20169        case "$longdblsize" in
20170        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20171            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20172            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20173            ;;
20174        16) # x86_64
20175            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20176            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20177            ;;
20178        *)  # No idea.
20179            longdblinfbytes=$undef
20180            longdblnanbytes=$undef
20181        ;;
20182        esac
20183        ;;
20184     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20185        case "$longdblsize" in
20186        12) # 32-bit system
20187            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20188            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20189            ;;
20190        16) # 64-bit system
20191            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20192            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20193            ;;
20194        *)  # No idea.
20195            longdblinfbytes=$undef
20196            longdblnanbytes=$undef
20197        ;;
20198        esac
20199        ;;
20200     5) # 128-bit LE-LE "double double"
20201        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20202        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20203        ;;
20204     6) # 128-bit BE-BE "double double"
20205        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20206        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20207        ;;
20208     7) # 128-bit LE-BE "double double"
20209        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20210        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20211        ;;
20212     8) # 128-bit BE-LE "double double"
20213        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20214        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20215        ;;
20216     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20217        longdblinfbytes=$undef
20218        longdblnanbytes=$undef
20219        ;;
20220     *) # No idea.
20221        longdblinfbytes=$undef
20222        longdblnanbytes=$undef
20223        ;;
20224     esac
20225 fi
20226 # In case the program crashed the values are empty, turn them undef.
20227 case "$doubleinfbytes" in
20228 '') doubleinfbytes=$undef ;;
20229 esac
20230 case "$doublenanbytes" in
20231 '') doublenanbytes=$undef ;;
20232 esac
20233 case "$longdblinfbytes" in
20234 '') longdblinfbytes=$undef ;;
20235 esac
20236 case "$longdblnanbytes" in
20237 '') longdblnanbytes=$undef ;;
20238 esac
20239 $rm_try
20240
20241 : Check the length of the double mantissa
20242 $echo "Checking how many mantissa bits your doubles have..." >&4
20243 $cat >try.c <<EOP
20244 #$i_sunmath I_SUNMATH
20245 #include <float.h>
20246 #ifdef I_SUNMATH
20247 # include <sunmath.h>
20248 #endif
20249 #ifdef DBL_MANT_DIG
20250 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20251 #endif
20252 #include <stdio.h>
20253 int main(int argc, char *argv[]) {
20254 #ifdef BITS
20255   printf("%d\n", BITS);
20256 #endif
20257   return 0;
20258 }
20259 EOP
20260 set try
20261 if eval $compile; then
20262     doublemantbits=`$run ./try`
20263 else
20264     doublemantbits="$undef"
20265 fi
20266 $rm_try
20267
20268 : Check the length of the longdouble mantissa
20269 $echo "Checking how many mantissa bits your long doubles have..." >&4
20270 $cat >try.c <<EOP
20271 #$i_sunmath I_SUNMATH
20272 #include <float.h>
20273 #ifdef I_SUNMATH
20274 # include <sunmath.h>
20275 #endif
20276 #$d_longdbl HAS_LONG_DOUBLE
20277 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20278 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20279 /* This format has no implicit bit.  Beware, however, that for
20280  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20281  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20282  * and the top bit must have been one since 387, zero is plain invalid.
20283  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20284 #  define BITS LDBL_MANT_DIG
20285 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20286 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20287  * reason e.g. Irix thinks 107.  But in any case, we want only
20288  * the number of real bits, the implicit bits are of no interest.  */
20289 #  define BITS 2 * (DBL_MANT_DIG - 1)
20290 # else
20291 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20292 # endif
20293 #endif
20294 #include <stdio.h>
20295 int main(int argc, char *argv[]) {
20296 #ifdef BITS
20297   printf("%d\n", BITS);
20298 #endif
20299   return 0;
20300 }
20301 EOP
20302 set try
20303 if eval $compile; then
20304     longdblmantbits=`$run ./try`
20305 else
20306     longdblmantbits="$undef"
20307 fi
20308 $rm_try
20309
20310 : Check the length of the NV mantissa
20311 $echo "Checking how many mantissa bits your NVs have..." >&4
20312 if test "X$usequadmath" = "X$define"; then
20313   nvmantbits=112 # 128-1-15
20314 else
20315   if test "X$nvsize" = "X$doublesize"; then
20316     nvmantbits="$doublemantbits"
20317   else
20318      if test "X$nvsize" = "X$longdblsize"; then
20319        nvmantbits="$longdblmantbits"
20320      else
20321        nvmantbits="$undef"
20322      fi
20323   fi
20324 fi
20325
20326 : How can we generate normalized random numbers ?
20327 echo " "
20328 echo "Using our internal random number implementation..." >&4
20329
20330 case "$ccflags" in
20331 *-Dmy_rand=*|*-Dmy_srand=*)
20332         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20333         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20334         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20335         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20336         ;;
20337 esac
20338
20339 randfunc=Perl_drand48
20340 drand01="Perl_drand48()"
20341 seedfunc="Perl_drand48_init"
20342 randbits=48
20343 randseedtype=U32
20344
20345 : Probe whether dtrace builds an object, as newer Illumos requires an input
20346 : object file that uses at least one of the probes defined in the .d file
20347 case "$usedtrace" in
20348 $define)
20349     case "$dtracexnolibs" in
20350     $define|true|[yY]*)
20351         dtracexnolibs=$define
20352         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20353         ;;
20354     ' '|'')
20355         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20356              dtracexnolibs=$define
20357              echo "Your dtrace accepts -xnolibs"
20358         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20359              dtracexnolibs=$undef
20360              echo "Your dtrace doesn't accept -xnolibs"
20361         else
20362              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20363              exit 1
20364         fi
20365         ;;
20366     *)
20367         dtracexnolibs=$undef
20368         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20369         ;;
20370     esac
20371     case $dtracexnolibs in
20372     $define) xnolibs=-xnolibs ;;
20373     *) xnolibs= ;;
20374     esac
20375
20376     case "$dtraceobject" in
20377     $define|true|[yY]*)
20378         dtraceobject=$define
20379         ;;
20380     ' '|'')
20381         $cat >try.c <<EOM
20382 #include "perldtrace.h"
20383 int main(void) {
20384     PERL_LOADED_FILE("dummy");
20385     return 0;
20386 }
20387 EOM
20388         dtraceobject=$undef
20389         if $cc -c -o try.o $optimize $ccflags try.c \
20390                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20391                 dtraceobject=$define
20392             echo "Your dtrace builds an object file"
20393         fi
20394         ;;
20395     *) dtraceobject=$undef ;;
20396     esac
20397     $rm_try perldtrace.o perldtrace.h
20398 esac
20399
20400 : Determine if this is an EBCDIC system
20401 echo " "
20402 echo "Determining whether or not we are on an EBCDIC system..." >&4
20403 $cat >try.c <<'EOM'
20404 int main()
20405 {
20406   if ('M'==0xd4) return 0;
20407   return 1;
20408 }
20409 EOM
20410
20411 val=$undef
20412 set try
20413 if eval $compile_ok; then
20414         if $run ./try; then
20415                 echo "You seem to speak EBCDIC." >&4
20416                 val="$define"
20417         else
20418                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20419         fi
20420 else
20421         echo "I'm unable to compile the test program." >&4
20422         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20423 fi
20424 $rm_try
20425 set ebcdic
20426 eval $setvar
20427
20428 : Check how to flush
20429 echo " "
20430 $cat >&4 <<EOM
20431 Checking how to flush all pending stdio output...
20432 EOM
20433 # I only know how to find the first 32 possibly open files on SunOS.
20434 # See also hints/sunos_4_1.sh and util.c  --AD
20435 case "$osname" in
20436 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20437 esac
20438 $cat >>try.c <<EOCP
20439 #include <stdio.h>
20440 #$i_stdlib I_STDLIB
20441 #ifdef I_STDLIB
20442 #include <stdlib.h>
20443 #endif
20444 #$i_unistd I_UNISTD
20445 #ifdef I_UNISTD
20446 # include <unistd.h>
20447 #endif
20448 #$d_sysconf HAS_SYSCONF
20449 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20450 #ifdef HAS_STDIO_STREAM_ARRAY
20451 # define STDIO_STREAM_ARRAY $stdio_stream_array
20452 #endif
20453 int main() {
20454   FILE* p;
20455   unlink("try.out");
20456   p = fopen("try.out", "w");
20457 #ifdef TRY_FPUTC
20458   fputc('x', p);
20459 #else
20460 # ifdef TRY_FPRINTF
20461   fprintf(p, "x");
20462 # endif
20463 #endif
20464 #ifdef TRY_FFLUSH_NULL
20465   fflush(NULL);
20466 #endif
20467 #ifdef TRY_FFLUSH_ALL
20468   {
20469     long open_max = -1;
20470 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20471     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20472 # else
20473 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20474     open_max = sysconf(_SC_OPEN_MAX);
20475 #  else
20476 #   ifdef FOPEN_MAX
20477     open_max = FOPEN_MAX;
20478 #   else
20479 #    ifdef OPEN_MAX
20480     open_max = OPEN_MAX;
20481 #    else
20482 #     ifdef _NFILE
20483     open_max = _NFILE;
20484 #     endif
20485 #    endif
20486 #   endif
20487 #  endif
20488 # endif
20489 # ifdef HAS_STDIO_STREAM_ARRAY
20490     if (open_max > 0) {
20491       long i;
20492       for (i = 0; i < open_max; i++)
20493             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20494                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20495                 STDIO_STREAM_ARRAY[i]._flag)
20496                 fflush(&STDIO_STREAM_ARRAY[i]);
20497     }
20498   }
20499 # endif
20500 #endif
20501   _exit(42);
20502 }
20503 EOCP
20504 : first we have to find out how _not_ to flush
20505 $to try.c
20506 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20507     output=''
20508     set try -DTRY_FPUTC
20509     if eval $compile; then
20510             $run ./try 2>/dev/null
20511             code="$?"
20512             $from try.out
20513             if $test ! -s try.out -a "X$code" = X42; then
20514                 output=-DTRY_FPUTC
20515             fi
20516     fi
20517     case "$output" in
20518     '')
20519             set try -DTRY_FPRINTF
20520             if eval $compile; then
20521                     $run ./try 2>/dev/null
20522                     code="$?"
20523                     $from try.out
20524                     if $test ! -s try.out -a "X$code" = X42; then
20525                         output=-DTRY_FPRINTF
20526                     fi
20527             fi
20528         ;;
20529     esac
20530 fi
20531 : check for fflush NULL behavior
20532 case "$fflushNULL" in
20533 '')     set try -DTRY_FFLUSH_NULL $output
20534         if eval $compile; then
20535                 $run ./try 2>/dev/null
20536                 code="$?"
20537                 $from try.out
20538                 if $test -s try.out -a "X$code" = X42; then
20539                         fflushNULL="`$cat try.out`"
20540                 else
20541                         if $test "X$code" != X42; then
20542                                 $cat >&4 <<EOM
20543 (If this test failed, don't worry, we'll try another method shortly.)
20544 EOM
20545                         fi
20546                 fi
20547         fi
20548         $rm -f core try.core core.try.*
20549         case "$fflushNULL" in
20550         x)      $cat >&4 <<EOM
20551 Your fflush(NULL) works okay for output streams.
20552 Let's see if it clobbers input pipes...
20553 EOM
20554 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20555 # bug that improperly flushes the input end of pipes.  So we avoid the
20556 # autoflush on fork/system/exec support for now. :-(
20557 $cat >tryp.c <<EOCP
20558 #include <stdio.h>
20559 int
20560 main(int argc, char **argv)
20561 {
20562     char buf[1024];
20563     int i;
20564     char *bp = buf;
20565     while (1) {
20566         while ((i = getc(stdin)) != -1
20567                && (*bp++ = i) != '\n'
20568                && bp < &buf[1024])
20569         /* DO NOTHING */ ;
20570         *bp = '\0';
20571         fprintf(stdout, "%s", buf);
20572         fflush(NULL);
20573         if (i == -1)
20574             return 0;
20575         bp = buf;
20576     }
20577 }
20578 EOCP
20579                 fflushNULL="$define"
20580                 set tryp
20581                 if eval $compile; then
20582                     $rm -f tryp.out
20583                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20584                     if $test "X$targethost" != X; then
20585                         $to tryp.c
20586                         $to tryp
20587                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20588                     else
20589                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20590                     fi
20591                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20592                        $cat >&4 <<EOM
20593 fflush(NULL) seems to behave okay with input streams.
20594 EOM
20595                         fflushNULL="$define"
20596                     else
20597                         $cat >&4 <<EOM
20598 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20599 EOM
20600                         fflushNULL="$undef"
20601                     fi
20602                 fi
20603                 $rm -f core tryp.c tryp.core core.tryp.*
20604                 ;;
20605         '')     $cat >&4 <<EOM
20606 Your fflush(NULL) isn't working (contrary to ANSI C).
20607 EOM
20608                 fflushNULL="$undef"
20609                 ;;
20610         *)      $cat >&4 <<EOM
20611 Cannot figure out whether your fflush(NULL) works or not.
20612 I'm assuming it doesn't (contrary to ANSI C).
20613 EOM
20614                 fflushNULL="$undef"
20615                 ;;
20616         esac
20617         ;;
20618 $define|true|[yY]*)
20619         fflushNULL="$define"
20620         ;;
20621 *)
20622         fflushNULL="$undef"
20623         ;;
20624 esac
20625 : check explicit looping only if NULL did not work, and if the pipe
20626 : bug does not show up on an explicit flush too
20627 case "$fflushNULL" in
20628 "$undef")
20629         $cat >tryp.c <<EOCP
20630 #include <stdio.h>
20631 int
20632 main(int argc, char **argv)
20633 {
20634     char buf[1024];
20635     int i;
20636     char *bp = buf;
20637     while (1) {
20638         while ((i = getc(stdin)) != -1
20639                && (*bp++ = i) != '\n'
20640                && bp < &buf[1024])
20641         /* DO NOTHING */ ;
20642         *bp = '\0';
20643         fprintf(stdout, "%s", buf);
20644         fflush(stdin);
20645         if (i == -1)
20646             return 0;
20647         bp = buf;
20648     }
20649 }
20650 EOCP
20651         set tryp
20652         if eval $compile; then
20653             $rm -f tryp.out
20654             if $test "X$targethost" != X; then
20655                 $to tryp.c
20656                 $to tryp
20657                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20658             else
20659                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20660             fi
20661             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20662                $cat >&4 <<EOM
20663 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20664 EOM
20665                 : now check for fflushall behaviour
20666                 case "$fflushall" in
20667                 '')     set try -DTRY_FFLUSH_ALL $output
20668                         if eval $compile; then
20669                                 $cat >&4 <<EOM
20670 (Now testing the other method--but note that this also may fail.)
20671 EOM
20672                                 $run ./try 2>/dev/null
20673                                 code=$?
20674                                 $from try.out
20675                                 if $test -s try.out -a "X$code" = X42; then
20676                                         fflushall="`$cat try.out`"
20677                                 fi
20678                         fi
20679                         $rm_try
20680                         case "$fflushall" in
20681                         x)      $cat >&4 <<EOM
20682 Whew. Flushing explicitly all the stdio streams works.
20683 EOM
20684                                 fflushall="$define"
20685                                 ;;
20686                         '')     $cat >&4 <<EOM
20687 Sigh. Flushing explicitly all the stdio streams doesn't work.
20688 EOM
20689                                 fflushall="$undef"
20690                                 ;;
20691                         *)      $cat >&4 <<EOM
20692 Cannot figure out whether flushing stdio streams explicitly works or not.
20693 I'm assuming it doesn't.
20694 EOM
20695                                 fflushall="$undef"
20696                                 ;;
20697                         esac
20698                         ;;
20699                 "$define"|true|[yY]*)
20700                         fflushall="$define"
20701                         ;;
20702                 *)
20703                         fflushall="$undef"
20704                         ;;
20705                 esac
20706             else
20707                 $cat >&4 <<EOM
20708 All is futile.  Even fflush(stdin) clobbers input pipes!
20709 EOM
20710                 fflushall="$undef"
20711             fi
20712         else
20713             fflushall="$undef"
20714         fi
20715         $rm -f core tryp.c tryp.core core.tryp.*
20716         ;;
20717 *)      fflushall="$undef"
20718         ;;
20719 esac
20720
20721 case "$fflushNULL$fflushall" in
20722 undefundef)
20723         $cat <<EOM
20724 OK, I give up.  I cannot figure out how to flush pending stdio output.
20725 We won't be flushing handles at all before fork/exec/popen.
20726 EOM
20727         ;;
20728 esac
20729 $rm_try tryp
20730
20731 : Store the full pathname to the ar program for use in the C program
20732 : Respect a hint or command line value for full_ar.
20733 case "$full_ar" in
20734 '') full_ar=$ar ;;
20735 esac
20736
20737 : Store the full pathname to the sed program for use in the C program
20738 full_sed=$sed
20739
20740 : see what type gids are declared as in the kernel
20741 echo " "
20742 echo "Looking for the type for group ids returned by getgid()."
20743 set gid_t gidtype xxx stdio.h sys/types.h
20744 eval $typedef
20745 case "$gidtype" in
20746 xxx)
20747         xxx=`./findhdr sys/user.h`
20748         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20749         case $1 in
20750         unsigned) dflt="$1 $2" ;;
20751         *) dflt="$1" ;;
20752         esac
20753         ;;
20754 *) dflt="$gidtype";;
20755 esac
20756 case "$gidtype" in
20757 gid_t) echo "gid_t found." ;;
20758 *)      rp="What is the type for group ids returned by getgid()?"
20759         . ./myread
20760         gidtype="$ans"
20761         ;;
20762 esac
20763
20764 : Check the size of GID
20765 echo " "
20766 case "$gidtype" in
20767 *_t) zzz="$gidtype"     ;;
20768 *)   zzz="gid"          ;;
20769 esac
20770 echo "Checking the size of $zzz..." >&4
20771 cat > try.c <<EOCP
20772 #include <sys/types.h>
20773 #include <stdio.h>
20774 #$i_stdlib I_STDLIB
20775 #ifdef I_STDLIB
20776 #include <stdlib.h>
20777 #endif
20778 int main() {
20779     printf("%d\n", (int)sizeof($gidtype));
20780     exit(0);
20781 }
20782 EOCP
20783 set try
20784 if eval $compile_ok; then
20785         yyy=`$run ./try`
20786         case "$yyy" in
20787         '')     gidsize=4
20788                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20789                 ;;
20790         *)      gidsize=$yyy
20791                 echo "Your $zzz is $gidsize bytes long."
20792                 ;;
20793         esac
20794 else
20795         gidsize=4
20796         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20797 fi
20798
20799
20800 : Check if GID is signed
20801 echo " "
20802 case "$gidtype" in
20803 *_t) zzz="$gidtype"     ;;
20804 *)   zzz="gid"          ;;
20805 esac
20806 echo "Checking the sign of $zzz..." >&4
20807 cat > try.c <<EOCP
20808 #include <sys/types.h>
20809 #include <stdio.h>
20810 int main() {
20811         $gidtype foo = -1;
20812         if (foo < 0)
20813                 printf("-1\n");
20814         else
20815                 printf("1\n");
20816 }
20817 EOCP
20818 set try
20819 if eval $compile; then
20820         yyy=`$run ./try`
20821         case "$yyy" in
20822         '')     gidsign=1
20823                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20824                 ;;
20825         *)      gidsign=$yyy
20826                 case "$gidsign" in
20827                  1) echo "Your $zzz is unsigned." ;;
20828                 -1) echo "Your $zzz is signed."   ;;
20829                 esac
20830                 ;;
20831         esac
20832 else
20833         gidsign=1
20834         echo "(I can't compile the test program--guessing unsigned.)" >&4
20835 fi
20836
20837
20838 : Check 64bit sizes
20839 echo " "
20840
20841 if $test X"$quadtype" != X; then
20842
20843 echo "Checking how to print 64-bit integers..." >&4
20844
20845 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20846         $cat >try.c <<'EOCP'
20847 #include <sys/types.h>
20848 #include <stdio.h>
20849 int main() {
20850   int q = 12345678901;
20851   printf("%ld\n", q);
20852 }
20853 EOCP
20854         set try
20855         if eval $compile; then
20856                 yyy=`$run ./try`
20857                 case "$yyy" in
20858                 12345678901)
20859                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20860                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20861                         echo "We will use %d."
20862                         ;;
20863                 esac
20864         fi
20865 fi
20866
20867 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20868         $cat >try.c <<'EOCP'
20869 #include <sys/types.h>
20870 #include <stdio.h>
20871 int main() {
20872   long q = 12345678901;
20873   printf("%ld\n", q);
20874 }
20875 EOCP
20876         set try
20877         if eval $compile; then
20878                 yyy=`$run ./try`
20879                 case "$yyy" in
20880                 12345678901)
20881                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20882                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20883                         echo "We will use %ld."
20884                         ;;
20885                 esac
20886         fi
20887 fi
20888
20889 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20890         $cat >try.c <<'EOCP'
20891 #include <sys/types.h>
20892 #include <inttypes.h>
20893 #include <stdio.h>
20894 int main() {
20895   int64_t q = 12345678901;
20896   printf("%" PRId64 "\n", q);
20897 }
20898 EOCP
20899         set try
20900         if eval $compile; then
20901                 yyy=`$run ./try`
20902                 case "$yyy" in
20903                 12345678901)
20904                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20905                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20906                         echo "We will use the C9X style."
20907                         ;;
20908                 esac
20909         fi
20910 fi
20911
20912 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20913         $cat >try.c <<EOCP
20914 #include <sys/types.h>
20915 #include <stdio.h>
20916 int main() {
20917   $quadtype q = 12345678901;
20918   printf("%Ld\n", q);
20919 }
20920 EOCP
20921         set try
20922         if eval $compile; then
20923                 yyy=`$run ./try`
20924                 case "$yyy" in
20925                 12345678901)
20926                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20927                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20928                         echo "We will use %Ld."
20929                         ;;
20930                 esac
20931         fi
20932 fi
20933
20934 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20935         $cat >try.c <<'EOCP'
20936 #include <sys/types.h>
20937 #include <stdio.h>
20938 int main() {
20939   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20940   printf("%lld\n", q);
20941 }
20942 EOCP
20943         set try
20944         if eval $compile; then
20945                 yyy=`$run ./try`
20946                 case "$yyy" in
20947                 12345678901)
20948                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20949                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20950                         echo "We will use the %lld style."
20951                         ;;
20952                 esac
20953         fi
20954 fi
20955
20956 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20957         $cat >try.c <<EOCP
20958 #include <sys/types.h>
20959 #include <stdio.h>
20960 int main() {
20961   $quadtype q = 12345678901;
20962   printf("%qd\n", q);
20963 }
20964 EOCP
20965         set try
20966         if eval $compile; then
20967                 yyy=`$run ./try`
20968                 case "$yyy" in
20969                 12345678901)
20970                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20971                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20972                         echo "We will use %qd."
20973                         ;;
20974                 esac
20975         fi
20976 fi
20977
20978 if $test X"$sPRId64" = X; then
20979         echo "Cannot figure out how to print 64-bit integers." >&4
20980 fi
20981 $rm_try
20982
20983 fi
20984
20985 case "$sPRId64" in
20986 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20987         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20988         ;;
20989 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20990         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20991         ;;
20992 esac
20993
20994 : Check format strings for internal types
20995 echo " "
20996 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20997
20998 if $test X"$ivsize" = X8; then
20999         ivdformat="$sPRId64"
21000         uvuformat="$sPRIu64"
21001         uvoformat="$sPRIo64"
21002         uvxformat="$sPRIx64"
21003         uvXUformat="$sPRIXU64"
21004 else
21005         if $test X"$ivsize" = X"$longsize"; then
21006                 ivdformat='"ld"'
21007                 uvuformat='"lu"'
21008                 uvoformat='"lo"'
21009                 uvxformat='"lx"'
21010                 uvXUformat='"lX"'
21011         else
21012                 if $test X"$ivsize" = X"$intsize"; then
21013                         ivdformat='"d"'
21014                         uvuformat='"u"'
21015                         uvoformat='"o"'
21016                         uvxformat='"x"'
21017                         uvXUformat='"X"'
21018                 else
21019                         : far out
21020                         if $test X"$ivsize" = X"$shortsize"; then
21021                                 ivdformat='"hd"'
21022                                 uvuformat='"hu"'
21023                                 uvoformat='"ho"'
21024                                 uvxformat='"hx"'
21025                                 uvXUformat='"hX"'
21026                         fi
21027                 fi
21028         fi
21029 fi
21030
21031 if $test X"$usequadmath" = X"$define"; then
21032     nveformat='"Qe"'
21033     nvfformat='"Qf"'
21034     nvgformat='"Qg"'
21035     nvEUformat='"QE"'
21036     nvFUformat='"QF"'
21037     nvGUformat='"QG"'
21038 else
21039     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21040         nveformat="$sPRIeldbl"
21041         nvfformat="$sPRIfldbl"
21042         nvgformat="$sPRIgldbl"
21043         nvEUformat="$sPRIEUldbl"
21044         nvFUformat="$sPRIFUldbl"
21045         nvGUformat="$sPRIGUldbl"
21046     else
21047         nveformat='"e"'
21048         nvfformat='"f"'
21049         nvgformat='"g"'
21050         nvEUformat='"E"'
21051         nvFUformat='"F"'
21052         nvGUformat='"G"'
21053     fi
21054 fi
21055
21056 case "$ivdformat" in
21057 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21058     exit 1
21059     ;;
21060 esac
21061
21062 : Check format string for GID
21063
21064 echo " "
21065 $echo "Checking the format string to be used for gids..." >&4
21066
21067 case "$gidsign" in
21068 -1)     if $test X"$gidsize" = X"$ivsize"; then
21069                 gidformat="$ivdformat"
21070         else
21071                 if $test X"$gidsize" = X"$longsize"; then
21072                         gidformat='"ld"'
21073                 else
21074                         if $test X"$gidsize" = X"$intsize"; then
21075                                 gidformat='"d"'
21076                         else
21077                                 if $test X"$gidsize" = X"$shortsize"; then
21078                                         gidformat='"hd"'
21079                                 fi
21080                         fi
21081                 fi
21082         fi
21083         ;;
21084 *)      if $test X"$gidsize" = X"$uvsize"; then
21085                 gidformat="$uvuformat"
21086         else
21087                 if $test X"$gidsize" = X"$longsize"; then
21088                         gidformat='"lu"'
21089                 else
21090                         if $test X"$gidsize" = X"$intsize"; then
21091                                 gidformat='"u"'
21092                         else
21093                                 if $test X"$gidsize" = X"$shortsize"; then
21094                                         gidformat='"hu"'
21095                                 fi
21096                         fi
21097                 fi
21098         fi
21099         ;;
21100 esac
21101
21102 : see if getgroups exists
21103 set getgroups d_getgrps
21104 eval $inlibc
21105
21106 : see if setgroups exists
21107 set setgroups d_setgrps
21108 eval $inlibc
21109
21110 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21111 echo " "
21112 case "$d_getgrps$d_setgrps" in
21113 *define*)
21114         case "$groupstype" in
21115         '') dflt="$gidtype" ;;
21116         *)  dflt="$groupstype" ;;
21117         esac
21118         $cat <<EOM
21119 What type of pointer is the second argument to getgroups() and setgroups()?
21120 Usually this is the same as group ids, $gidtype, but not always.
21121
21122 EOM
21123         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21124         . ./myread
21125         groupstype="$ans"
21126         ;;
21127 *)  groupstype="$gidtype";;
21128 esac
21129
21130 : check whether make sets MAKE
21131 echo " "
21132 echo "Checking if your $make program sets \$(MAKE)..." >&4
21133 case "$make_set_make" in
21134 '')
21135         $sed 's/^X //' > testmake.mak << 'EOF'
21136 Xall:
21137 X       @echo 'maketemp="$(MAKE)"'
21138 EOF
21139         case "`$make -f testmake.mak 2>/dev/null`" in
21140         *maketemp=*) make_set_make='#' ;;
21141         *)      make_set_make="MAKE=$make" ;;
21142         esac
21143         $rm -f testmake.mak
21144         ;;
21145 esac
21146 case "$make_set_make" in
21147 '#') echo "Yup, it does.";;
21148 *) echo "Nope, it doesn't.";;
21149 esac
21150
21151 : see what type is used for mode_t
21152 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21153 set mode_t modetype int stdio.h sys/types.h
21154 eval $typedef_ask
21155
21156 : see if we need va_copy
21157 echo " "
21158 $cat >try.c <<EOCP
21159 #include <stdarg.h>
21160 #include <stdio.h>
21161 #include <stdlib.h>
21162 #include <signal.h>
21163
21164 int
21165 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21166 {
21167   return vfprintf(f, fmt, *valp);
21168 }
21169
21170 int
21171 myvfprintf(FILE *f, const  char *fmt, va_list val)
21172 {
21173   return ivfprintf(f, fmt, &val);
21174 }
21175
21176 int
21177 myprintf(char *fmt, ...)
21178 {
21179   va_list val;
21180   va_start(val, fmt);
21181   return myvfprintf(stdout, fmt, val);
21182 }
21183
21184 int
21185 main(int ac, char **av)
21186 {
21187   signal(SIGSEGV, exit);
21188
21189   myprintf("%s%cs all right, then\n", "that", '\'');
21190   exit(0);
21191 }
21192 EOCP
21193 set try
21194 if eval $compile && $run ./try 2>&1 >/dev/null; then
21195         case "`$run ./try`" in
21196         "that's all right, then")
21197                 okay=yes
21198                 ;;
21199         esac
21200 fi
21201 case "$okay" in
21202 yes)    echo "It seems that you don't need va_copy()." >&4
21203         need_va_copy="$undef"
21204         ;;
21205 *)      echo "It seems that va_copy() or similar will be needed." >&4
21206         need_va_copy="$define"
21207         ;;
21208 esac
21209 $rm_try
21210
21211 : see what type is used for size_t
21212 rp="What is the type used for the length parameter for string functions?"
21213 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21214 eval $typedef_ask
21215
21216 : check for type of arguments to gethostbyaddr.
21217 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21218         case "$d_gethbyaddr" in
21219         $define)
21220                 $cat <<EOM
21221
21222 Checking to see what type of arguments are accepted by gethostbyaddr().
21223 EOM
21224                 hdrs="$define sys/types.h
21225                         $d_socket sys/socket.h
21226                         $i_niin netinet/in.h
21227                         $i_netdb netdb.h
21228                         $i_unistd unistd.h"
21229                 : The first arg can 'char *' or 'void *'
21230                 : The second arg is some of integral type
21231                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21232                         for yyy in size_t long int; do
21233                                 case "$netdb_host_type" in
21234                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21235                                         if ./protochk "$try" $hdrs; then
21236                                                 echo "Your system accepts $xxx for the first arg."
21237                                                 echo "...and $yyy for the second arg."
21238                                                 netdb_host_type="$xxx"
21239                                                 netdb_hlen_type="$yyy"
21240                                         fi
21241                                         ;;
21242                                 esac
21243                         done
21244                 done
21245                 : In case none of those worked, prompt the user.
21246                 case "$netdb_host_type" in
21247                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21248                         dflt='char *'
21249                         . ./myread
21250                         netdb_host_type=$ans
21251                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21252                         dflt="$sizetype"
21253                         . ./myread
21254                         netdb_hlen_type=$ans
21255                         ;;
21256                 esac
21257                 ;;
21258         *)      : no gethostbyaddr, so pick harmless defaults
21259                 netdb_host_type='char *'
21260                 netdb_hlen_type="$sizetype"
21261                 ;;
21262         esac
21263         # Remove the "const" if needed. -- but then we'll have a
21264         # prototype clash!
21265         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21266 fi
21267
21268 : check for type of argument to gethostbyname.
21269 if test "X$netdb_name_type" = X ; then
21270         case "$d_gethbyname" in
21271         $define)
21272                 $cat <<EOM
21273
21274 Checking to see what type of argument is accepted by gethostbyname().
21275 EOM
21276                 hdrs="$define sys/types.h
21277                         $d_socket sys/socket.h
21278                         $i_niin netinet/in.h
21279                         $i_netdb netdb.h
21280                         $i_unistd unistd.h"
21281                 for xxx in "const char *" "char *"; do
21282                         case "$netdb_name_type" in
21283                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21284                                 if ./protochk "$try" $hdrs; then
21285                                         echo "Your system accepts $xxx."
21286                                         netdb_name_type="$xxx"
21287                                 fi
21288                                 ;;
21289                         esac
21290                 done
21291                 : In case none of those worked, prompt the user.
21292                 case "$netdb_name_type" in
21293                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21294                         dflt='char *'
21295                         . ./myread
21296                         netdb_name_type=$ans
21297                         ;;
21298                 esac
21299                 ;;
21300         *)      : no gethostbyname, so pick harmless default
21301                 netdb_name_type='char *'
21302                 ;;
21303         esac
21304 fi
21305
21306 : check for type of 1st argument to getnetbyaddr.
21307 if test "X$netdb_net_type" = X ; then
21308         case "$d_getnbyaddr" in
21309         $define)
21310                 $cat <<EOM
21311
21312 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21313 EOM
21314                 hdrs="$define sys/types.h
21315                         $d_socket sys/socket.h
21316                         $i_niin netinet/in.h
21317                         $i_netdb netdb.h
21318                         $i_unistd unistd.h"
21319                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21320                         case "$netdb_net_type" in
21321                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21322                                 if ./protochk "$try" $hdrs; then
21323                                         echo "Your system accepts $xxx."
21324                                         netdb_net_type="$xxx"
21325                                 fi
21326                                 ;;
21327                         esac
21328                 done
21329                 : In case none of those worked, prompt the user.
21330                 case "$netdb_net_type" in
21331                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21332                         dflt='long'
21333                         . ./myread
21334                         netdb_net_type=$ans
21335                         ;;
21336                 esac
21337                 ;;
21338         *)      : no getnetbyaddr, so pick harmless default
21339                 netdb_net_type='long'
21340                 ;;
21341         esac
21342 fi
21343 : locate the preferred pager for this system
21344 fn=f/
21345 case "$pager" in
21346 '')
21347         dflt=''
21348         case "$pg" in
21349         /*) dflt=$pg;;
21350         [a-zA-Z]:/*) dflt=$pg;;
21351         esac
21352         case "$more" in
21353         /*) dflt=$more;;
21354         [a-zA-Z]:/*) dflt=$more;;
21355         esac
21356         case "$less" in
21357         /*) dflt=$less;;
21358         [a-zA-Z]:/*) dflt=$less;;
21359         esac
21360         case "$dflt" in
21361         '') dflt=/usr/ucb/more;;
21362         esac
21363         ;;
21364 *)      dflt="$pager"
21365         ;;
21366 esac
21367 fn="f/($dflt)"
21368 echo " "
21369 rp='What pager is used on your system?'
21370 . ./getfile
21371 pager="$ans"
21372
21373 : see if ar generates random libraries by itself
21374 echo " "
21375 echo "Checking how to generate random libraries on your machine..." >&4
21376 echo 'int bar1() { return bar2(); }' > bar1.c
21377 echo 'int bar2() { return 2; }' > bar2.c
21378 $cat > foo.c <<EOP
21379 #$i_stdlib I_STDLIB
21380 #ifdef I_STDLIB
21381 #include <stdlib.h>
21382 #endif
21383 int main() { printf("%d\n", bar1()); exit(0); }
21384 EOP
21385 $cc $ccflags -c bar1.c >/dev/null 2>&1
21386 $cc $ccflags -c bar2.c >/dev/null 2>&1
21387 $cc $ccflags -c foo.c >/dev/null 2>&1
21388 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21389 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21390         $run ./foobar >/dev/null 2>&1; then
21391         echo "$ar appears to generate random libraries itself."
21392         orderlib=false
21393         if [ "X$ranlib" = "X" ]; then
21394             ranlib=":"
21395         fi
21396 elif $ar s bar$_a >/dev/null 2>&1 &&
21397         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21398         $run ./foobar >/dev/null 2>&1; then
21399                 echo "a table of contents needs to be added with '$ar s'."
21400                 orderlib=false
21401                 ranlib="$ar s"
21402 elif $ar ts bar$_a >/dev/null 2>&1 &&
21403         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21404         $run ./foobar >/dev/null 2>&1; then
21405                 echo "a table of contents needs to be added with '$ar ts'."
21406                 orderlib=false
21407                 ranlib="$ar ts"
21408 else
21409         case "$ranlib" in
21410         :) ranlib='';;
21411         '')
21412                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21413                 $test -f $ranlib || ranlib=''
21414                 ;;
21415         esac
21416         if $test -n "$ranlib"; then
21417                 echo "your system has '$ranlib'; we'll use that."
21418                 orderlib=false
21419         else
21420                 echo "your system doesn't seem to support random libraries"
21421                 echo "so we'll use lorder and tsort to order the libraries."
21422                 orderlib=true
21423                 ranlib=":"
21424         fi
21425 fi
21426 $rm -f foo* bar*
21427
21428 : Check the max offset that gmtime and localtime accept
21429 echo "Checking max offsets that gmtime () accepts"
21430
21431 case "$sGMTIME_min/$sGMTIME_max" in
21432     0/0|/)
21433         $cat >try.c <<EOCP
21434 #include <sys/types.h>
21435 #include <stdio.h>
21436 #include <time.h>
21437
21438 int i;
21439 struct tm *tmp;
21440 time_t pt;
21441
21442 void gm_check (time_t t, int min_year, int max_year)
21443 {
21444     tmp = gmtime (&t);
21445     if ( tmp == NULL ||
21446         /* Check tm_year overflow */
21447          tmp->tm_year < min_year || tmp->tm_year > max_year)
21448         tmp = NULL;
21449     else
21450         pt = t;
21451     } /* gm_check */
21452
21453 int check_max ()
21454 {
21455     tmp = NULL;
21456     pt  = 0;
21457 #ifdef MAXLONG
21458     gm_check (MAXLONG, 69, 0x7fffffff);
21459 #endif
21460     if (tmp == NULL || tmp->tm_year < 0) {
21461         for (i = 63; i >= 0; i--) {
21462             time_t x = pt | ((time_t)1 << i);
21463             if (x < 0 || x < pt) continue;
21464             gm_check (x, 69, 0x7fffffff);
21465             }
21466         }
21467     printf ("sGMTIME_max=%ld\n", pt);
21468     return (0);
21469     } /* check_max */
21470
21471 int check_min ()
21472 {
21473     tmp = NULL;
21474     pt  = 0;
21475 #ifdef MINLONG
21476     gm_check (MINLONG, -1900, 70);
21477 #endif
21478     if (tmp == NULL) {
21479         for (i = 36; i >= 0; i--) {
21480             time_t x = pt - ((time_t)1 << i);
21481             if (x > 0) continue;
21482             gm_check (x, -1900, 70);
21483             }
21484         }
21485     printf ("sGMTIME_min=%ld\n", pt);
21486     return (0);
21487     } /* check_min */
21488
21489 int main (int argc, char *argv[])
21490 {
21491     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21492     check_max ();
21493     check_min ();
21494     return (0);
21495     } /* main */
21496 EOCP
21497         set try
21498         if eval $compile; then
21499             eval `$run ./try 2>/dev/null`
21500         else
21501             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21502             fi
21503         $rm_try
21504         ;;
21505     esac
21506
21507 echo "Checking max offsets that localtime () accepts"
21508
21509 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21510     0/0|/)
21511         $cat >try.c <<EOCP
21512 #include <sys/types.h>
21513 #include <stdio.h>
21514 #include <time.h>
21515
21516 int i;
21517 struct tm *tmp;
21518 time_t pt;
21519
21520 void local_check (time_t t, int min_year, int max_year)
21521 {
21522     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21523         tmp = NULL;
21524     else
21525         tmp = localtime (&t);
21526     if ( tmp == NULL ||
21527         /* Check tm_year overflow */
21528          tmp->tm_year < min_year || tmp->tm_year > max_year)
21529         tmp = NULL;
21530     else
21531         pt = t;
21532     } /* local_check */
21533
21534 int check_max ()
21535 {
21536     tmp = NULL;
21537     pt  = 0;
21538 #ifdef MAXLONG
21539     local_check (MAXLONG, 69, 0x7fffffff);
21540 #endif
21541     if (tmp == NULL || tmp->tm_year < 0) {
21542         for (i = 63; i >= 0; i--) {
21543             time_t x = pt | ((time_t)1 << i);
21544             if (x < 0 || x < pt) continue;
21545             local_check (x, 69, 0x7fffffff);
21546             }
21547         }
21548     printf ("sLOCALTIME_max=%ld\n", pt);
21549     return (0);
21550    } /* check_max */
21551
21552 int check_min ()
21553 {
21554     tmp = NULL;
21555     pt  = 0;
21556 #ifdef MINLONG
21557     local_check (MINLONG, -1900, 70);
21558 #endif
21559     if (tmp == NULL) {
21560         for (i = 36; i >= 0; i--) {
21561             time_t x = pt - ((time_t)1 << i);
21562             if (x > 0) continue;
21563             local_check (x, -1900, 70);
21564             }
21565         }
21566     printf ("sLOCALTIME_min=%ld\n", pt);
21567     return (0);
21568     } /* check_min */
21569
21570 int main (int argc, char *argv[])
21571 {
21572     check_max ();
21573     check_min ();
21574     return (0);
21575     } /* main */
21576 EOCP
21577         set try
21578         if eval $compile; then
21579             eval `$run ./try 2>/dev/null`
21580         else
21581             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21582             fi
21583         $rm_try
21584         ;;
21585     esac
21586
21587 : check for type of arguments to select.
21588 case "$selecttype" in
21589 '') case "$d_select" in
21590         $define)
21591                 echo " "
21592                 $cat <<EOM
21593 Checking to see what type of arguments are accepted by select().
21594 EOM
21595                 hdrs="$define sys/types.h
21596                         $i_systime sys/time.h
21597                         $i_sysselct sys/select.h
21598                         $d_socket sys/socket.h"
21599                 : The first arg can be int, unsigned, or size_t
21600                 : The last arg may or may not be 'const'
21601                 val=''
21602                 : void pointer has been seen but using that
21603                 : breaks the selectminbits test
21604                 for xxx in 'fd_set *' 'int *'; do
21605                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21606                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21607                                         case "$val" in
21608                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21609                                                 if ./protochk "$try" $hdrs; then
21610                                                         echo "Your system accepts $xxx."
21611                                                         val="$xxx"
21612                                                 fi
21613                                                 ;;
21614                                         esac
21615                                 done
21616                         done
21617                 done
21618                 case "$val" in
21619                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21620                         case "$d_fd_set" in
21621                                 $define) dflt="fd_set *" ;;
21622                                 *)              dflt="int *" ;;
21623                         esac
21624                         . ./myread
21625                         val=$ans
21626                         ;;
21627                 esac
21628                 selecttype="$val"
21629                 ;;
21630         *)      : no select, so pick a harmless default
21631                 selecttype='int *'
21632                 ;;
21633         esac
21634         ;;
21635 esac
21636
21637 : check for the select 'width'
21638 case "$selectminbits" in
21639 '') safebits=`expr $ptrsize \* 8`
21640     case "$d_select" in
21641         $define)
21642                 $cat <<EOM
21643
21644 Checking to see on how many bits at a time your select() operates...
21645 EOM
21646                 $cat >try.c <<EOCP
21647 #include <sys/types.h>
21648 #$i_time I_TIME
21649 #$i_systime I_SYS_TIME
21650 #$i_systimek I_SYS_TIME_KERNEL
21651 #ifdef I_TIME
21652 #   include <time.h>
21653 #endif
21654 #ifdef I_SYS_TIME
21655 #   ifdef I_SYS_TIME_KERNEL
21656 #       define KERNEL
21657 #   endif
21658 #   include <sys/time.h>
21659 #   ifdef I_SYS_TIME_KERNEL
21660 #       undef KERNEL
21661 #   endif
21662 #endif
21663 #$i_sysselct I_SYS_SELECT
21664 #ifdef I_SYS_SELECT
21665 #include <sys/select.h>
21666 #endif
21667 #$d_socket HAS_SOCKET
21668 #ifdef HAS_SOCKET
21669 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21670 #endif
21671 #include <stdio.h>
21672 #$i_stdlib I_STDLIB
21673 #ifdef I_STDLIB
21674 #include <stdlib.h>
21675 #endif
21676 $selecttype b;
21677 #define S sizeof(*(b))
21678 #define MINBITS 64
21679 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21680 #define NBITS  (NBYTES * 8)
21681 int main() {
21682     char *s = (char *)malloc(NBYTES);
21683     struct timeval t;
21684     int i;
21685     FILE* fp;
21686     int fd;
21687
21688     if (!s)
21689         exit(1);
21690     fclose(stdin);
21691     fp = fopen("try.c", "r");
21692     if (fp == 0)
21693       exit(2);
21694     fd = fileno(fp);
21695     if (fd < 0)
21696       exit(3);
21697     b = ($selecttype)s;
21698     for (i = 0; i < NBITS; i++)
21699         FD_SET(i, b);
21700     t.tv_sec  = 0;
21701     t.tv_usec = 0;
21702     select(fd + 1, b, 0, 0, &t);
21703     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21704     free(s);
21705     printf("%d\n", i + 1);
21706     return 0;
21707 }
21708 EOCP
21709                 set try
21710                 if eval $compile_ok; then
21711                         selectminbits=`$run ./try 2>/dev/null`
21712                         case "$selectminbits" in
21713                         '')     cat >&4 <<EOM
21714 Cannot figure out on how many bits at a time your select() operates.
21715 I'll play safe and guess it is $safebits bits.
21716 EOM
21717                                 selectminbits=$safebits
21718                                 bits="$safebits bits"
21719                                 ;;
21720                         1)      bits="1 bit" ;;
21721                         *)      bits="$selectminbits bits" ;;
21722                         esac
21723                         echo "Your select() operates on $bits at a time." >&4
21724                 else
21725                         rp='What is the minimum number of bits your select() operates on?'
21726                         case "$byteorder" in
21727                         12345678)       dflt=64 ;;
21728                         1234)           dflt=32 ;;
21729                         *)              dflt=1  ;;
21730                         esac
21731                         . ./myread
21732                         val=$ans
21733                         selectminbits="$val"
21734                 fi
21735                 $rm_try
21736                 ;;
21737         *)      : no select, so pick a harmless default
21738                 selectminbits=$safebits
21739                 ;;
21740         esac
21741         ;;
21742 esac
21743
21744 : Trace out the files included by signal.h, then look for SIGxxx names.
21745 case "$sig_num_init" in
21746 '')
21747 if [ "X$fieldn" = X ]; then
21748         : Just make some guesses.  We check them later.
21749         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21750 else
21751         xxx=`echo '#include <signal.h>' |
21752         $cppstdin $cppminus $cppflags 2>/dev/null |
21753         $grep '^[       ]*#.*include' |
21754         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21755                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21756 fi
21757 xxxfiles=''
21758 for xx in $xxx /dev/null ; do
21759         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21760 done
21761 case "$xxxfiles" in
21762 '')     xxxfiles=`./findhdr signal.h` ;;
21763 esac
21764 xxx=`awk '
21765 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21766         print substr($2, 4, 20)
21767 }
21768 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21769         print substr($3, 4, 20)
21770 }' $xxxfiles`
21771 : Append some common names just in case the awk scan failed.
21772 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21773 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21774 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21775 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21776 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21777
21778 : generate a few handy files for later
21779 $cat > signal.c <<EOCP
21780 #include <sys/types.h>
21781 #include <signal.h>
21782 #$i_stdlib I_STDLIB
21783 #ifdef I_STDLIB
21784 #include <stdlib.h>
21785 #endif
21786 #include <stdio.h>
21787 int main() {
21788
21789 /* Strange style to avoid deeply-nested #if/#else/#endif */
21790 #ifndef NSIG
21791 #  ifdef _NSIG
21792 #    define NSIG (_NSIG)
21793 #  endif
21794 #endif
21795
21796 #ifndef NSIG
21797 #  ifdef SIGMAX
21798 #    define NSIG (SIGMAX+1)
21799 #  endif
21800 #endif
21801
21802 #ifndef NSIG
21803 #  ifdef SIG_MAX
21804 #    define NSIG (SIG_MAX+1)
21805 #  endif
21806 #endif
21807
21808 #ifndef NSIG
21809 #  ifdef _SIG_MAX
21810 #    define NSIG (_SIG_MAX+1)
21811 #  endif
21812 #endif
21813
21814 #ifndef NSIG
21815 #  ifdef MAXSIG
21816 #    define NSIG (MAXSIG+1)
21817 #  endif
21818 #endif
21819
21820 #ifndef NSIG
21821 #  ifdef MAX_SIG
21822 #    define NSIG (MAX_SIG+1)
21823 #  endif
21824 #endif
21825
21826 #ifndef NSIG
21827 #  ifdef SIGARRAYSIZE
21828 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21829 #  endif
21830 #endif
21831
21832 #ifndef NSIG
21833 #  ifdef _sys_nsig
21834 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21835 #  endif
21836 #endif
21837
21838 /* Default to some arbitrary number that's big enough to get most
21839    of the common signals.
21840 */
21841 #ifndef NSIG
21842 #    define NSIG 50
21843 #endif
21844
21845 printf("NSIG %d\n", NSIG);
21846
21847 #ifndef JUST_NSIG
21848
21849 EOCP
21850
21851 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21852 {
21853         printf "#ifdef SIG"; printf $1; printf "\n"
21854         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21855         printf $1; printf ");\n"
21856         printf "#endif\n"
21857 }
21858 END {
21859         printf "#endif /* JUST_NSIG */\n";
21860         printf "exit(0);\n}\n";
21861 }
21862 ' >>signal.c
21863 $cat >signal.awk <<'EOP'
21864 BEGIN { ndups = 0 }
21865 $1 ~ /^NSIG$/ { nsig = $2 }
21866 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21867     if ($2 > maxsig) { maxsig = $2 }
21868     if (sig_name[$2]) {
21869         dup_name[ndups] = $1
21870         dup_num[ndups] = $2
21871         ndups++
21872     }
21873     else {
21874         sig_name[$2] = $1
21875         sig_num[$2] = $2
21876     }
21877 }
21878 END {
21879     if (nsig == 0) {
21880         nsig = maxsig + 1
21881     }
21882     printf("NSIG %d\n", nsig);
21883     for (n = 1; n < nsig; n++) {
21884         if (sig_name[n]) {
21885             printf("%s %d\n", sig_name[n], sig_num[n])
21886         }
21887         else {
21888             printf("NUM%d %d\n", n, n)
21889         }
21890     }
21891     for (n = 0; n < ndups; n++) {
21892         printf("%s %d\n", dup_name[n], dup_num[n])
21893     }
21894 }
21895 EOP
21896 $cat >signal_cmd <<EOS
21897 $startsh
21898 if $test -s signal.lst; then
21899     echo "Using your existing signal.lst file"
21900         exit 0
21901 fi
21902 xxx="$xxx"
21903 EOS
21904 $cat >>signal_cmd <<'EOS'
21905
21906 set signal
21907 if eval $compile_ok; then
21908         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21909                 $uniq | $awk -f signal.awk >signal.lst
21910 else
21911         echo "(I can't seem be able to compile the whole test program)" >&4
21912         echo "(I'll try it in little pieces.)" >&4
21913         set signal -DJUST_NSIG
21914         if eval $compile_ok; then
21915                 $run ./signal$_exe > signal.nsg
21916                 $cat signal.nsg
21917         else
21918                 echo "I can't seem to figure out how many signals you have." >&4
21919                 echo "Guessing 50." >&4
21920                 echo 'NSIG 50' > signal.nsg
21921         fi
21922         : Now look at all the signal names, one at a time.
21923         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21924                 $cat > signal.c <<EOCP
21925 #include <sys/types.h>
21926 #include <signal.h>
21927 #include <stdio.h>
21928 int main() {
21929 printf("$xx %d\n", SIG${xx});
21930 return 0;
21931 }
21932 EOCP
21933                 set signal
21934                 if eval $compile; then
21935                         echo "SIG${xx} found."
21936                         $run ./signal$_exe  >> signal.ls1
21937                 else
21938                         echo "SIG${xx} NOT found."
21939                 fi
21940         done
21941         if $test -s signal.ls1; then
21942                 $cat signal.nsg signal.ls1 |
21943                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21944         fi
21945
21946 fi
21947 if $test -s signal.lst; then
21948         :
21949 else
21950         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21951         echo 'kill -l' >signal
21952         set X `csh -f <signal`
21953         $rm -f signal
21954         shift
21955         case $# in
21956         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21957         esac
21958         echo $@ | $tr ' ' $trnl | \
21959             $awk '{ printf "%s %d\n", $1, ++s; }
21960                   END { printf "NSIG %d\n", ++s }' >signal.lst
21961 fi
21962 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21963 EOS
21964 chmod a+x signal_cmd
21965 $eunicefix signal_cmd
21966 ;;
21967 esac
21968
21969 : generate list of signal names
21970 case "$sig_num_init" in
21971 '')
21972 echo " "
21973 case "$sig_name_init" in
21974 '') doinit=yes ;;
21975 *)  case "$sig_num_init" in
21976     ''|*,*) doinit=yes ;;
21977     esac ;;
21978 esac
21979 case "$doinit" in
21980 yes)
21981         echo "Generating a list of signal names and numbers..." >&4
21982         . ./signal_cmd
21983         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21984         sig_name=`$awk 'BEGIN { printf "ZERO " }
21985                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21986         sig_num=`$awk  'BEGIN { printf "0 " }
21987                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21988         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21989                              !/^NSIG/   { printf "\"%s\", ", $1 }
21990                              END        { printf "0\n" }' signal.lst`
21991         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21992                              !/^NSIG/   { printf "%d, ", $2}
21993                              END        { printf "0\n"}' signal.lst`
21994         ;;
21995 esac
21996 echo "The following $sig_count signals are available:"
21997 echo " "
21998 echo $sig_name | $awk \
21999 'BEGIN { linelen = 0 }
22000 {
22001         for (i = 1; i <= NF; i++) {
22002                 name = "SIG" $i " "
22003                 linelen = linelen + length(name)
22004                 if (linelen > 70) {
22005                         printf "\n"
22006                         linelen = length(name)
22007                 }
22008                 printf "%s", name
22009         }
22010         printf "\n"
22011 }'
22012 sig_size=`echo $sig_name | awk '{print NF}'`
22013 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22014 ;;
22015 esac
22016
22017 : Check size of size
22018 echo " "
22019 case "$sizetype" in
22020 *_t) zzz="$sizetype"    ;;
22021 *)   zzz="filesize"     ;;
22022 esac
22023 echo "Checking the size of $zzz..." >&4
22024 cat > try.c <<EOCP
22025 #include <sys/types.h>
22026 #include <stdio.h>
22027 #$i_stdlib I_STDLIB
22028 #ifdef I_STDLIB
22029 #include <stdlib.h>
22030 #endif
22031 int main() {
22032     printf("%d\n", (int)sizeof($sizetype));
22033     exit(0);
22034 }
22035 EOCP
22036 set try
22037 if eval $compile_ok; then
22038         yyy=`$run ./try`
22039         case "$yyy" in
22040         '')     sizesize=4
22041                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22042                 ;;
22043         *)      sizesize=$yyy
22044                 echo "Your $zzz size is $sizesize bytes."
22045                 ;;
22046         esac
22047 else
22048         sizesize=4
22049         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22050 fi
22051
22052
22053 : check for socklen_t
22054 echo " "
22055 echo "Checking to see if you have socklen_t..." >&4
22056 $cat >try.c <<EOCP
22057 #include <sys/types.h>
22058 #$d_socket HAS_SOCKET
22059 #ifdef HAS_SOCKET
22060 #include <sys/socket.h>
22061 #endif
22062 int main() { socklen_t x = 16; }
22063 EOCP
22064 set try
22065 if eval $compile; then
22066         val="$define"
22067         echo "You have socklen_t."
22068 else
22069         val="$undef"
22070         echo "You do not have socklen_t."
22071         case "$sizetype" in
22072         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22073         esac
22074 fi
22075 $rm_try
22076 set d_socklen_t
22077 eval $setvar
22078
22079 : see if this is a socks.h system
22080 set socks.h i_socks
22081 eval $inhdr
22082
22083 : check for type of the size argument to socket calls
22084 case "$d_socket" in
22085 "$define")
22086         $cat <<EOM
22087
22088 Checking to see what type is the last argument of accept().
22089 EOM
22090         yyy=''
22091         case "$d_socklen_t" in
22092         "$define") yyy="$yyy socklen_t"
22093         esac
22094         yyy="$yyy $sizetype int long unsigned"
22095         for xxx in $yyy; do
22096                 case "$socksizetype" in
22097                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22098                         case "$usesocks" in
22099                         "$define")
22100                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22101                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22102                                         socksizetype="$xxx"
22103                                 fi
22104                                 ;;
22105                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22106                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22107                                         socksizetype="$xxx"
22108                                 fi
22109                                 ;;
22110                         esac
22111                         ;;
22112                 esac
22113         done
22114 : In case none of those worked, prompt the user.
22115         case "$socksizetype" in
22116         '')     rp='What is the type for socket address structure sizes?'
22117                 dflt='int'
22118                 . ./myread
22119                 socksizetype=$ans
22120                 ;;
22121         esac
22122         ;;
22123 *)      : no sockets, so pick relatively harmless default
22124         socksizetype='int'
22125         ;;
22126 esac
22127
22128 : see what type is used for signed size_t
22129 set ssize_t ssizetype int stdio.h sys/types.h
22130 eval $typedef
22131 dflt="$ssizetype"
22132 $cat > try.c <<EOM
22133 #include <stdio.h>
22134 #$i_stdlib I_STDLIB
22135 #ifdef I_STDLIB
22136 #include <stdlib.h>
22137 #endif
22138 #include <sys/types.h>
22139 #define Size_t $sizetype
22140 #define SSize_t $dflt
22141 int main()
22142 {
22143         if (sizeof(Size_t) == sizeof(SSize_t))
22144                 printf("$dflt\n");
22145         else if (sizeof(Size_t) == sizeof(int))
22146                 printf("int\n");
22147         else
22148                 printf("long\n");
22149         exit(0);
22150 }
22151 EOM
22152 echo " "
22153 set try
22154 if eval $compile_ok && $run ./try > /dev/null; then
22155         ssizetype=`$run ./try`
22156         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22157 else
22158         $cat >&4 <<EOM
22159 Help! I can't compile and run the ssize_t test program: please enlighten me!
22160 (This is probably a misconfiguration in your system or libraries, and
22161 you really ought to fix it.  Still, I'll try anyway.)
22162
22163 I need a type that is the same size as $sizetype, but is guaranteed to
22164 be signed.  Common values are ssize_t, int and long.
22165
22166 EOM
22167         rp="What signed type is the same size as $sizetype?"
22168         . ./myread
22169         ssizetype="$ans"
22170 fi
22171 $rm_try
22172
22173 : Check the size of st_ino
22174 $echo " "
22175 $echo "Checking the size of st_ino..." >&4
22176 $cat > try.c <<EOCP
22177 #include <sys/stat.h>
22178 #include <stdio.h>
22179 #$i_stdlib I_STDLIB
22180 #ifdef I_STDLIB
22181 #include <stdlib.h>
22182 #endif
22183 int main() {
22184     struct stat st;
22185     printf("%d\n", (int)sizeof(st.st_ino));
22186     exit(0);
22187 }
22188 EOCP
22189 set try
22190 if eval $compile_ok; then
22191         val=`$run ./try`
22192         case "$val" in
22193         '')     st_ino_size=4
22194                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22195                 ;;
22196         *)      st_ino_size=$val
22197                 $echo "Your st_ino is $st_ino_size bytes long."
22198                 ;;
22199         esac
22200 else
22201         st_ino_size=4
22202         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22203 fi
22204 $rm_try
22205
22206 : Check if st_ino is signed
22207 $echo " "
22208 $echo "Checking the sign of st_ino..." >&4
22209 $cat > try.c <<EOCP
22210 #include <sys/stat.h>
22211 #include <stdio.h>
22212 int main() {
22213         struct stat foo;
22214         foo.st_ino = -1;
22215         if (foo.st_ino < 0)
22216                 printf("-1\n");
22217         else
22218                 printf("1\n");
22219 }
22220 EOCP
22221 set try
22222 if eval $compile; then
22223         val=`$run ./try`
22224         case "$val" in
22225         '')     st_ino_sign=1
22226                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22227                 ;;
22228         *)      st_ino_sign=$val
22229                 case "$st_ino_sign" in
22230                  1) $echo "Your st_ino is unsigned." ;;
22231                 -1) $echo "Your st_ino is signed."   ;;
22232                 esac
22233                 ;;
22234         esac
22235 else
22236         st_ino_sign=1
22237         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22238 fi
22239 $rm_try
22240
22241 : see what type of char stdio uses.
22242 echo " "
22243 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22244 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22245         echo "Your stdio uses unsigned chars." >&4
22246         stdchar="unsigned char"
22247 else
22248         echo "Your stdio uses signed chars." >&4
22249         stdchar="char"
22250 fi
22251 $rm -f stdioh
22252
22253 : Check size of UID
22254 echo " "
22255 case "$uidtype" in
22256 *_t) zzz="$uidtype"     ;;
22257 *)   zzz="uid"          ;;
22258 esac
22259 echo "Checking the size of $zzz..." >&4
22260 cat > try.c <<EOCP
22261 #include <sys/types.h>
22262 #include <stdio.h>
22263 #$i_stdlib I_STDLIB
22264 #ifdef I_STDLIB
22265 #include <stdlib.h>
22266 #endif
22267 int main() {
22268     printf("%d\n", (int)sizeof($uidtype));
22269     exit(0);
22270 }
22271 EOCP
22272 set try
22273 if eval $compile_ok; then
22274         yyy=`$run ./try`
22275         case "$yyy" in
22276         '')     uidsize=4
22277                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22278                 ;;
22279         *)      uidsize=$yyy
22280                 echo "Your $zzz is $uidsize bytes long."
22281                 ;;
22282         esac
22283 else
22284         uidsize=4
22285         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22286 fi
22287
22288 : Check if UID is signed
22289 echo " "
22290 case "$uidtype" in
22291 *_t) zzz="$uidtype"     ;;
22292 *)   zzz="uid"          ;;
22293 esac
22294 echo "Checking the sign of $zzz..." >&4
22295 cat > try.c <<EOCP
22296 #include <sys/types.h>
22297 #include <stdio.h>
22298 int main() {
22299         $uidtype foo = -1;
22300         if (foo < 0)
22301                 printf("-1\n");
22302         else
22303                 printf("1\n");
22304 }
22305 EOCP
22306 set try
22307 if eval $compile; then
22308         yyy=`$run ./try`
22309         case "$yyy" in
22310         '')     uidsign=1
22311                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22312                 ;;
22313         *)      uidsign=$yyy
22314                 case "$uidsign" in
22315                  1) echo "Your $zzz is unsigned." ;;
22316                 -1) echo "Your $zzz is signed."   ;;
22317                 esac
22318                 ;;
22319         esac
22320 else
22321         uidsign=1
22322         echo "(I can't compile the test program--guessing unsigned.)" >&4
22323 fi
22324
22325
22326 : Check format string for UID
22327 echo " "
22328 $echo "Checking the format string to be used for uids..." >&4
22329
22330 case "$uidsign" in
22331 -1)     if $test X"$uidsize" = X"$ivsize"; then
22332                 uidformat="$ivdformat"
22333         else
22334                 if $test X"$uidsize" = X"$longsize"; then
22335                         uidformat='"ld"'
22336                 else
22337                         if $test X"$uidsize" = X"$intsize"; then
22338                                 uidformat='"d"'
22339                         else
22340                                 if $test X"$uidsize" = X"$shortsize"; then
22341                                         uidformat='"hd"'
22342                                 fi
22343                         fi
22344                 fi
22345         fi
22346         ;;
22347 *)      if $test X"$uidsize" = X"$uvsize"; then
22348                 uidformat="$uvuformat"
22349         else
22350                 if $test X"$uidsize" = X"$longsize"; then
22351                         uidformat='"lu"'
22352                 else
22353                         if $test X"$uidsize" = X"$intsize"; then
22354                                 uidformat='"u"'
22355                         else
22356                                 if $test X"$uidsize" = X"$shortsize"; then
22357                                         uidformat='"hu"'
22358                                 fi
22359                         fi
22360                 fi
22361         fi
22362         ;;
22363 esac
22364
22365 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22366 echo " "
22367 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22368 $cat >try.c <<'EOM'
22369 /* Intentionally a long probe as I'd like to sanity check that the exact
22370    approach is going to work, as thinking it will work, but only having it
22371    part working at runtime is worse than not having it.  */
22372
22373 #include <sys/types.h>
22374 #include <sys/sysctl.h>
22375 #include <sys/param.h>
22376 #include <stdio.h>
22377 #include <string.h>
22378 #include <stdlib.h>
22379 #include <unistd.h>
22380
22381 int
22382 main(int argc, char **argv) {
22383     char *buffer;
22384     char *argv_leaf = strrchr(argv[0], '/');
22385     char *buffer_leaf;
22386     size_t size = 0;
22387     int mib[4];
22388
22389     mib[0] = CTL_KERN;
22390     mib[1] = KERN_PROC;
22391     mib[2] = KERN_PROC_PATHNAME;
22392     mib[3] = -1;
22393
22394     if (!argv_leaf) {
22395         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22396         return 1;
22397     }
22398
22399     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22400         perror("sysctl");
22401         return 2;
22402     }
22403
22404     if (size < strlen(argv_leaf) + 1) {
22405         fprintf(stderr, "size %lu is too short for a path\n",
22406                 (unsigned long) size);
22407         return 3;
22408     }
22409
22410     if (size > MAXPATHLEN * MAXPATHLEN) {
22411         fprintf(stderr, "size %lu is too long for a path\n",
22412                 (unsigned long) size);
22413         return 4;
22414     }
22415
22416     buffer = (char *)malloc(size);
22417     if (!buffer) {
22418         perror("malloc");
22419         return 5;
22420     }
22421
22422     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22423         perror("sysctl");
22424         return 6;
22425     }
22426
22427     if (strlen(buffer) + 1 != size) {
22428         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22429                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22430         return 7;
22431     }
22432
22433
22434     if (*buffer != '/') {
22435         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22436         return 8;
22437     }
22438
22439     if (strstr(buffer, "/./")) {
22440         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22441         return 9;
22442     }
22443
22444     if (strstr(buffer, "/../")) {
22445         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22446         return 10;
22447     }
22448
22449     buffer_leaf = strrchr(buffer, '/');
22450     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22451         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22452         return 11;
22453     }
22454
22455     free(buffer);
22456
22457     return 0;
22458 }
22459 EOM
22460
22461 val=$undef
22462 set try
22463 if eval $compile; then
22464         if $run ./try; then
22465                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22466                 val="$define"
22467         else
22468                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22469                 val="$undef"
22470         fi
22471 else
22472         echo "I'm unable to compile the test program." >&4
22473         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22474         val="$undef"
22475 fi
22476 $rm_try
22477 set usekernprocpathname
22478 eval $setvar
22479
22480 : Determine if we can use _NSGetExecutablePath to find executing program
22481 echo " "
22482 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22483 $cat >try.c <<'EOM'
22484 /* Intentionally a long probe as I'd like to sanity check that the exact
22485    approach is going to work, as thinking it will work, but only having it
22486    part working at runtime is worse than not having it.  */
22487 #include <mach-o/dyld.h>
22488 #include <stdio.h>
22489 #include <stdlib.h>
22490 #include <sys/param.h>
22491 #include <string.h>
22492
22493 int
22494 main(int argc, char **argv) {
22495     char buf[1];
22496     uint32_t size = sizeof(buf);
22497     int result;
22498     char *buffer;
22499     char *tidied;
22500     char *argv_leaf = strrchr(argv[0], '/');
22501     char *tidied_leaf;
22502
22503     if (!argv_leaf) {
22504         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22505         return 1;
22506     }
22507
22508     _NSGetExecutablePath(buf, &size);
22509     if (size > MAXPATHLEN * MAXPATHLEN) {
22510         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22511                 (unsigned int) size);
22512         return 2;
22513     }
22514
22515     buffer = (char *)malloc(size);
22516     if (!buffer) {
22517         perror("malloc");
22518         return 3;
22519     }
22520
22521     result = _NSGetExecutablePath(buffer, &size);
22522     if (result != 0) {
22523         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22524                 result, (unsigned int) size);
22525         return 4;
22526     }
22527
22528     tidied = realpath(buffer, NULL);
22529     if (!tidied) {
22530         perror("realpath");
22531         return 5;
22532     }
22533
22534     free(buffer);
22535
22536     if (*tidied != '/') {
22537         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22538         return 6;
22539     }
22540
22541     if (strstr(tidied, "/./")) {
22542         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22543         return 7;
22544     }
22545
22546     if (strstr(tidied, "/../")) {
22547         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22548         return 8;
22549     }
22550
22551     tidied_leaf = strrchr(tidied, '/');
22552     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22553         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22554         return 9;
22555     }
22556
22557     free(tidied);
22558
22559     return 0;
22560 }
22561 EOM
22562
22563 val=$undef
22564 set try
22565 if eval $compile; then
22566         if $run ./try; then
22567                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22568                 val="$define"
22569         else
22570                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22571         fi
22572 else
22573         echo "I'm unable to compile the test program." >&4
22574         echo "I'll assume no _NSGetExecutablePath here." >&4
22575 fi
22576 $rm_try
22577 set usensgetexecutablepath
22578 eval $setvar
22579
22580 : Check if site customization support was requested
22581 case "$usesitecustomize" in
22582     $define|true|[Yy]*)
22583         usesitecustomize="$define"
22584         ;;
22585     *)
22586         usesitecustomize="$undef"
22587         ;;
22588     esac
22589
22590 : determine compiler compiler
22591 case "$yacc" in
22592 '')
22593         dflt=yacc;;
22594 *)
22595         dflt="$yacc";;
22596 esac
22597 echo " "
22598 comp='yacc'
22599 if $test -f "$byacc$_exe"; then
22600         dflt="$byacc"
22601         comp="byacc or $comp"
22602 fi
22603 if $test -f "$bison$_exe"; then
22604         comp="$comp or bison -y"
22605 fi
22606 rp="Which compiler compiler ($comp) shall I use?"
22607 . ./myread
22608 yacc="$ans"
22609 case "$yacc" in
22610 *bis*)
22611         case "$yacc" in
22612         *-y*) ;;
22613         *)
22614                 yacc="$yacc -y"
22615                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22616                 ;;
22617         esac
22618         ;;
22619 esac
22620
22621 : see if this is a bfd.h system
22622 set bfd.h i_bfd
22623 eval $inhdr
22624
22625 : see if this is an execinfo.h system
22626 set execinfo.h i_execinfo
22627 eval $inhdr
22628
22629 : see if this is a fenv.h system
22630 set fenv.h i_fenv
22631 eval $inhdr
22632
22633 : see if this is a fp.h system
22634 set fp.h i_fp
22635 eval $inhdr
22636
22637 : see if this is a fp_class.h system
22638 set fp_class.h i_fp_class
22639 eval $inhdr
22640
22641 : see if gdbm.h is available
22642 set gdbm.h t_gdbm
22643 eval $inhdr
22644 case "$t_gdbm" in
22645 $define)
22646         : see if gdbm_open exists
22647         set gdbm_open d_gdbm_open
22648         eval $inlibc
22649         case "$d_gdbm_open" in
22650         $undef)
22651                 t_gdbm="$undef"
22652                 echo "We won't be including <gdbm.h>"
22653                 ;;
22654         esac
22655         ;;
22656 esac
22657 val="$t_gdbm"
22658 set i_gdbm
22659 eval $setvar
22660
22661 : see if this is a ieeefp.h system
22662 case "$i_ieeefp" in
22663 '' ) set ieeefp.h i_ieeefp
22664      eval $inhdr
22665      ;;
22666 esac
22667
22668 : see if this is a libutil.h system
22669 set libutil.h i_libutil
22670 eval $inhdr
22671
22672 : see if mach cthreads are available
22673 if test "X$usethreads" = "X$define"; then
22674         set mach/cthreads.h i_machcthr
22675         eval $inhdr
22676 else
22677         i_machcthr="$undef"
22678 fi
22679
22680 : see if this is a mntent.h system
22681 set mntent.h i_mntent
22682 eval $inhdr
22683
22684 : see if net/errno.h is available
22685 val=''
22686 set net/errno.h val
22687 eval $inhdr
22688
22689 : Unfortunately, it causes problems on some systems.  Arrgh.
22690 case "$val" in
22691 $define)
22692         cat > try.c <<'EOM'
22693 #include <stdio.h>
22694 #include <errno.h>
22695 #include <net/errno.h>
22696 int func()
22697 {
22698         return ENOTSOCK;
22699 }
22700 EOM
22701         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22702                 echo "We'll be including <net/errno.h>." >&4
22703         else
22704                 echo "We won't be including <net/errno.h>." >&4
22705                 val="$undef"
22706         fi
22707         $rm_try
22708         ;;
22709 esac
22710 set i_neterrno
22711 eval $setvar
22712
22713 : see if netinet/tcp.h is available
22714 set netinet/tcp.h i_netinettcp
22715 eval $inhdr
22716
22717 : see if this is a poll.h system
22718 set poll.h i_poll
22719 eval $inhdr
22720
22721 : see if this is a prot.h system
22722 set prot.h i_prot
22723 eval $inhdr
22724
22725 : Preprocessor symbols
22726 echo " "
22727 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22728 $cat <<'EOSH' > Cppsym.know
22729 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22730 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22731 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22732 arch_pwr ardent ARM ARM32 atarist att386 att3b
22733 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22734 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22735 byteorder byte_order
22736 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22737 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22738 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22739 ELF encore EPI EXTENSIONS
22740 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22741 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22742 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22743 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22744 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
22745 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22746 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22747 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22748 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22749 ksr1
22750 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22751 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22752 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22753 luna88k Lynx
22754 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22755 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22756 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22757 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22758 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22759 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22760 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22761 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22762 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22763 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22764 ns32000 ns32016 ns32332 ns32k nsc32000
22765 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22766 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22767 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22768 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22769 QK_USER QNX
22770 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22771 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22772 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22773 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22774 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22775 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22776 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22777 SYSV4 SYSV5 sysV68 sysV88
22778 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22779 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22780 tower32_800 tower32_850 tss
22781 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22782 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22783 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22784 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22785 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22786 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22787 uxpm uxps
22788 vax venix VMESA vms
22789 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22790 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22791 z8000 zarch
22792 EOSH
22793 # Maybe put other stuff here too.
22794 ./tr '-' '_' <<EOSH >>Cppsym.know
22795 $osname
22796 EOSH
22797 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22798 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22799 $cat Cppsym.know > Cppsym.c
22800 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22801 $rm -f Cppsym.a Cppsym.b Cppsym.c
22802 cat <<EOSH > Cppsym
22803 $startsh
22804 if $test \$# -gt 0; then
22805     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22806     if $test -s Cppsym.got; then
22807         $rm -f Cppsym.got
22808         exit 0
22809     fi
22810     $rm -f Cppsym.got
22811     exit 1
22812 else
22813     $tr " " "$trnl" | ./Cppsym.try
22814     exit 0
22815 fi
22816 EOSH
22817 chmod +x Cppsym
22818 $eunicefix Cppsym
22819 cat <<EOSH > Cppsym.try
22820 $startsh
22821 cat <<'EOCP' > try.c
22822 #include <stdio.h>
22823 #if cpp_stuff == 1
22824 #define STRINGIFY(a)    "a"
22825 #endif
22826 #if cpp_stuff == 42
22827 #define StGiFy(a)  #a
22828 #define STRINGIFY(a)    StGiFy(a)
22829 #endif
22830 #if $cpp_stuff != 1 && $cpp_stuff != 42
22831 #   include "Bletch: How does this C preprocessor stringify macros?"
22832 #endif
22833 int main() {
22834 EOCP
22835 $awk \\
22836 EOSH
22837 cat <<'EOSH' >> Cppsym.try
22838 'length($1) > 0 {
22839     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22840     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22841     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22842     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22843 }'       >> try.c
22844 echo 'return 0;}' >> try.c
22845 EOSH
22846 cat <<EOSH >> Cppsym.try
22847 ccflags="$ccflags"
22848 case "$osname-$gccversion" in
22849 irix-) ccflags="\$ccflags -woff 1178" ;;
22850 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22851 esac
22852 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
22853 EOSH
22854 chmod +x Cppsym.try
22855 $eunicefix Cppsym.try
22856 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22857 : Add in any Linux cpp "predefined macros":
22858 case "$osname::$gccversion" in
22859   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22860     tHdrH=_tmpHdr
22861     rm -f $tHdrH'.h' $tHdrH
22862     touch $tHdrH'.h'
22863     # Filter out macro arguments, such as Linux's __INT8_C(c)
22864     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22865        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22866        if [ -s $tHdrH'_cppsym.real' ]; then
22867           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22868        fi
22869     fi
22870     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22871   ;;
22872 esac
22873 : now check the C compiler for additional symbols
22874 postprocess_cc_v=''
22875 case "$osname" in
22876 aix) postprocess_cc_v="|$tr , ' '" ;;
22877 esac
22878 $cat >ccsym <<EOS
22879 $startsh
22880 $cat >tmp.c <<EOF
22881 extern int foo;
22882 EOF
22883 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22884 do
22885         case "\$i" in
22886         -D*) echo "\$i" | $sed 's/^-D//';;
22887         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22888         esac
22889 done
22890 $rm_try
22891 EOS
22892 postprocess_cc_v=''
22893 chmod +x ccsym
22894 $eunicefix ccsym
22895 ./ccsym > ccsym1.raw
22896 if $test -s ccsym1.raw; then
22897     $sort ccsym1.raw | $uniq >ccsym.raw
22898 else
22899     mv ccsym1.raw ccsym.raw
22900 fi
22901
22902 $awk '/\=/ { print $0; next }
22903         { print $0"=1" }' ccsym.raw >ccsym.list
22904 $comm -13 Cppsym.true ccsym.list >ccsym.own
22905 $comm -12 Cppsym.true ccsym.list >ccsym.com
22906 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22907 also=''
22908 if $test -z ccsym.raw; then
22909         echo "Your C compiler doesn't seem to define any symbols!" >&4
22910         echo " "
22911         echo "However, your C preprocessor defines the following symbols:"
22912         $cat Cppsym.true
22913         ccsymbols=''
22914         cppsymbols=`$cat Cppsym.true`
22915         cppsymbols=`echo $cppsymbols`
22916         cppccsymbols="$cppsymbols"
22917 else
22918         if $test -s ccsym.com; then
22919                 echo "Your C compiler and pre-processor define these symbols:"
22920                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22921                 also='also '
22922                 symbols='ones'
22923                 cppccsymbols=`$cat ccsym.com`
22924                 cppccsymbols=`echo $cppccsymbols`
22925                 $test "$silent" || sleep 1
22926         fi
22927         if $test -s ccsym.cpp; then
22928                 $test "$also" && echo " "
22929                 echo "Your C pre-processor ${also}defines the following symbols:"
22930                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22931                 also='further '
22932                 cppsymbols=`$cat ccsym.cpp`
22933                 cppsymbols=`echo $cppsymbols`
22934                 $test "$silent" || sleep 1
22935         fi
22936         if $test -s ccsym.own; then
22937                 $test "$also" && echo " "
22938                 echo "Your C compiler ${also}defines the following cpp symbols:"
22939                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22940                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22941                 ccsymbols=`$cat ccsym.own`
22942                 ccsymbols=`echo $ccsymbols`
22943                 $test "$silent" || sleep 1
22944         fi
22945 fi
22946
22947 : add -D_FORTIFY_SOURCE if feasible and not already there
22948 case "$gccversion" in
22949 [4567].*)       case "$optimize$ccflags" in
22950         *-O*)   case "$ccflags$cppsymbols" in
22951                 *_FORTIFY_SOURCE=*) # Don't add it again.
22952                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22953                         ;;
22954                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22955                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22956                         ;;
22957                 esac
22958                 ;;
22959         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22960                 ;;
22961         esac
22962         ;;
22963 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
22964         ;;
22965 esac
22966
22967 : script used to emit important warnings
22968 cat >warn <<EOS
22969 $startsh
22970 if test \$# -gt 0; then
22971         echo "\$@" >msg
22972 else
22973         cat >msg
22974 fi
22975 echo "*** WARNING:" >&4
22976 sed -e 's/^/*** /' <msg >&4
22977 echo "*** " >&4
22978 cat msg >>config.msg
22979 echo " " >>config.msg
22980 rm -f msg
22981 EOS
22982 chmod +x warn
22983 $eunicefix warn
22984
22985 : see if this is a termio system
22986 val="$undef"
22987 val2="$undef"
22988 val3="$undef"
22989 if $test `./findhdr termios.h`; then
22990     set tcsetattr i_termios
22991     eval $inlibc
22992     val3="$i_termios"
22993 fi
22994 echo " "
22995 case "$val3" in
22996     "$define") echo "You have POSIX termios.h... good!" >&4;;
22997     *)  if ./Cppsym pyr; then
22998             case "`$run /bin/universe`" in
22999                 ucb) if $test `./findhdr sgtty.h`; then
23000                         val2="$define"
23001                         echo "<sgtty.h> found." >&4
23002                     else
23003                         echo "System is pyramid with BSD universe."
23004                         ./warn "<sgtty.h> not found--you could have problems."
23005                     fi;;
23006                 *)  if $test `./findhdr termio.h`; then
23007                         val="$define"
23008                         echo "<termio.h> found." >&4
23009                     else
23010                         echo "System is pyramid with USG universe."
23011                         ./warn "<termio.h> not found--you could have problems."
23012                     fi;;
23013             esac
23014         elif ./usg; then
23015             if $test `./findhdr termio.h`; then
23016                 echo "<termio.h> found." >&4
23017                 val="$define"
23018             elif $test `./findhdr sgtty.h`; then
23019                 echo "<sgtty.h> found." >&4
23020                 val2="$define"
23021             else
23022                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23023             fi
23024         else
23025             if $test `./findhdr sgtty.h`; then
23026                 echo "<sgtty.h> found." >&4
23027                 val2="$define"
23028             elif $test `./findhdr termio.h`; then
23029                 echo "<termio.h> found." >&4
23030                 val="$define"
23031             else
23032                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23033             fi
23034         fi;;
23035 esac
23036 set i_termio; eval $setvar
23037 val=$val2; set i_sgtty; eval $setvar
23038 val=$val3; set i_termios; eval $setvar
23039
23040 : see if stdbool is available
23041 : we want a real compile instead of Inhdr because some Solaris systems
23042 : have stdbool.h, but it can only be used if the compiler indicates it
23043 : is sufficiently c99-compliant.
23044 echo " "
23045 $cat >try.c <<EOCP
23046 #include <stdio.h>
23047 #include <stdbool.h>
23048 int func(bool x)
23049 {
23050     return x ? 1 : 0;
23051 }
23052 int main(int argc, char **argv)
23053 {
23054     return func(0);
23055 }
23056 EOCP
23057 set try
23058 if eval $compile; then
23059         echo "<stdbool.h> found." >&4
23060         val="$define"
23061 else
23062         echo "<stdbool.h> NOT found." >&4
23063         val="$undef"
23064 fi
23065 $rm_try
23066 set i_stdbool
23067 eval $setvar
23068
23069 : see if stdint is available
23070 set stdint.h i_stdint
23071 eval $inhdr
23072
23073 : see if sys/access.h is available
23074 set sys/access.h i_sysaccess
23075 eval $inhdr
23076
23077 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23078 set sys/filio.h i_sysfilio
23079 eval $inhdr
23080 echo " "
23081 if $test `./findhdr sys/ioctl.h`; then
23082         val="$define"
23083         echo '<sys/ioctl.h> found.' >&4
23084 else
23085         val="$undef"
23086         if $test $i_sysfilio = "$define"; then
23087             echo '<sys/ioctl.h> NOT found.' >&4
23088         else
23089                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23090                 $test $i_termio = "$define" && xxx="termio.h"
23091                 $test $i_termios = "$define" && xxx="termios.h"
23092 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23093         fi
23094 fi
23095 set i_sysioctl
23096 eval $setvar
23097
23098 : see if socket ioctl defs are in sys/sockio.h
23099 echo " "
23100 xxx=`./findhdr sys/sockio.h`
23101 if $test "$xxx"; then
23102         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23103                 val="$define"
23104                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23105         else
23106                 val="$undef"
23107                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23108         fi
23109 else
23110         val="$undef"
23111         $cat <<EOM
23112 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23113 EOM
23114 fi
23115 set i_syssockio
23116 eval $setvar
23117
23118 : see if this is a syslog.h system
23119 set syslog.h i_syslog
23120 eval $inhdr
23121
23122 : see if this is a sys/mode.h system
23123 set sys/mode.h i_sysmode
23124 eval $inhdr
23125
23126 : see if there is a sys/poll.h file
23127 set sys/poll.h i_syspoll
23128 eval $inhdr
23129
23130 : see if sys/resource.h has to be included
23131 set sys/resource.h i_sysresrc
23132 eval $inhdr
23133
23134 : see if sys/security.h is available
23135 set sys/security.h i_syssecrt
23136 eval $inhdr
23137
23138 : see if this is a sys/statvfs.h system
23139 set sys/statvfs.h i_sysstatvfs
23140 eval $inhdr
23141
23142 : see if this is a sys/un.h system
23143 set sys/un.h i_sysun
23144 eval $inhdr
23145
23146 : see if this is a sys/utsname.h system
23147 set sys/utsname.h i_sysutsname
23148 eval $inhdr
23149
23150 : see if this is a syswait system
23151 set sys/wait.h i_syswait
23152 eval $inhdr
23153
23154 : see if this is a ustat.h system
23155 set ustat.h i_ustat
23156 eval $inhdr
23157
23158 : see if this is an utime system
23159 set utime.h i_utime
23160 eval $inhdr
23161
23162 : see if this is a vfork system
23163 case "$d_vfork" in
23164 "$define")
23165         set vfork.h i_vfork
23166         eval $inhdr
23167         ;;
23168 *)
23169         i_vfork="$undef"
23170         ;;
23171 esac
23172
23173 : see if wchar.h is present
23174 set wchar.h i_wchar
23175 eval $inhdr
23176
23177 : Check extensions
23178 echo " "
23179 echo "Looking for extensions..." >&4
23180 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23181 : contain old or inaccurate or duplicate values.
23182 nonxs_extensions=''
23183 xs_extensions=''
23184 : We do not use find because it might not be available.
23185 : We do not just use MANIFEST because the user may have dropped
23186 : some additional extensions into the source tree and expect them
23187 : to be built.
23188
23189 : Function to recursively find available extensions, ignoring DynaLoader
23190 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23191 : In 5.10.1 and later, extensions are stored in directories
23192 : like File-Glob instead of the older File/Glob/.
23193 find_extensions='
23194     for xxx in *; do
23195         case "$xxx" in
23196             DynaLoader|dynaload) ;;
23197             *)
23198             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23199             case "$this_ext" in
23200                 Scalar/List/Utils) this_ext="List/Util" ;;
23201                 PathTools)         this_ext="Cwd"       ;;
23202             esac;
23203             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23204             if $contains " $this_ext " "$tdir/$$.tmp"; then
23205                 echo >&4;
23206                 echo "Duplicate directories detected for extension $xxx" >&4;
23207                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23208                 case "$knowitall" in
23209                 "") dflt=y;;
23210                 *) dflt=n;;
23211                 esac;
23212                 . ../UU/myread;
23213                 case "$ans" in
23214                 n*|N*) ;;
23215                 *) echo >&4;
23216                     echo "Ok.  Stopping Configure." >&4;
23217                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23218                     exit 1;;
23219                 esac;
23220                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23221             fi;
23222             $ls -1 "$xxx" > "$tdir/$$.tmp";
23223             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23224                 xs_extensions="$xs_extensions $this_ext";
23225             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23226                 xs_extensions="$xs_extensions $this_ext";
23227             elif $test -d "$xxx"; then
23228                 nonxs_extensions="$nonxs_extensions $this_ext";
23229             fi;
23230             $rm -f "$tdir/$$.tmp";
23231             ;;
23232         esac;
23233     done'
23234 tdir=`pwd`
23235 cd "$rsrc/cpan"
23236 set X
23237 shift
23238 eval $find_extensions
23239 cd "$rsrc/dist"
23240 set X
23241 shift
23242 eval $find_extensions
23243 cd "$rsrc/ext"
23244 set X
23245 shift
23246 eval $find_extensions
23247 set X $xs_extensions
23248 shift
23249 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23250 set X $nonxs_extensions
23251 shift
23252 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23253 cd "$tdir"
23254 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23255
23256 : Now see which are supported on this system.
23257 avail_ext=''
23258 for xxx in $xs_extensions ; do
23259         case "$xxx" in
23260         Amiga*)
23261                 case "$osname" in
23262                 amigaos) avail_ext="$avail_ext $xxx" ;;
23263                 esac
23264                 ;;
23265         DB_File|db_file)
23266                 case "$i_db" in
23267                 $define) avail_ext="$avail_ext $xxx" ;;
23268                 esac
23269                 ;;
23270         GDBM_File|gdbm_fil)
23271                 case "$i_gdbm" in
23272                 $define) avail_ext="$avail_ext $xxx" ;;
23273                 esac
23274                 ;;
23275         I18N/Langinfo|i18n_lan)
23276                 case "$i_langinfo$d_nl_langinfo" in
23277                 $define$define) avail_ext="$avail_ext $xxx" ;;
23278                 esac
23279                 ;;
23280         IPC/SysV|ipc/sysv)
23281                 : XXX Do we need a useipcsysv variable here
23282                 case "${d_msg}${d_sem}${d_shm}" in
23283                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23284                 esac
23285                 ;;
23286         NDBM_File|ndbm_fil)
23287                 case "$d_ndbm" in
23288                 $define)
23289                     case "$osname-$use64bitint" in
23290                     hpux-define)
23291                         case "$libs" in
23292                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23293                         esac
23294                         ;;
23295                     *) avail_ext="$avail_ext $xxx" ;;
23296                     esac
23297                     ;;
23298                 esac
23299                 ;;
23300         ODBM_File|odbm_fil)
23301                 case "${i_dbm}${i_rpcsvcdbm}" in
23302                 *"${define}"*)
23303                     case "$d_cplusplus" in
23304                     define) ;; # delete as a function name will not work
23305                     *)  case "$osname-$use64bitint" in
23306                         hpux-define)
23307                             case "$libs" in
23308                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23309                             esac
23310                             ;;
23311                         *) avail_ext="$avail_ext $xxx" ;;
23312                         esac
23313                         ;;
23314                     esac
23315                     ;;
23316                 esac
23317                 ;;
23318         Opcode|opcode)
23319                 case "$useopcode" in
23320                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23321                 esac
23322                 ;;
23323         POSIX|posix)
23324                 case "$useposix" in
23325                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23326                 esac
23327                 ;;
23328         Socket|socket)
23329                 case "$d_socket" in
23330                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23331                 esac
23332                 ;;
23333         Sys/Syslog|sys/syslog)
23334                 case $osname in
23335                         amigaos) ;; # not really very useful on AmigaOS
23336                         *)
23337                         : XXX syslog requires socket
23338                         case "$d_socket" in
23339                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23340                         esac
23341                         ;;
23342                 esac
23343                 ;;
23344         Thread|thread)
23345                 case "$usethreads" in
23346                 true|$define|y)
23347                         case "$use5005threads" in
23348                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23349                         esac
23350                 esac
23351                 ;;
23352         threads|threads/shared)
23353                 # threads and threads::shared are special cases.
23354                 # To stop people from asking "Perl 5.8.0 was supposed
23355                 # to have this new fancy threads implementation but my
23356                 # perl doesn't have it" and from people trying to
23357                 # (re)install the threads module using CPAN.pm and
23358                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23359                 # the threads.pm and threads/shared.pm will always be
23360                 # there, croaking informatively ("you need to rebuild
23361                 # all of Perl with threads, sorry") when threads haven't
23362                 # been compiled in.
23363                 # --jhi
23364                 avail_ext="$avail_ext $xxx"
23365                 ;;
23366         VMS*)
23367                 ;;
23368         Win32*)
23369                 case "$osname" in
23370                 cygwin) avail_ext="$avail_ext $xxx" ;;
23371                 esac
23372                 ;;
23373         XS/APItest|xs/apitest)
23374                 # This is just for testing.  Skip it unless we have dynamic loading.
23375
23376                 case "$usedl" in
23377                 $define) avail_ext="$avail_ext $xxx" ;;
23378                 esac
23379                 ;;
23380         XS/Typemap|xs/typemap)
23381                 # This is just for testing.  Skip it unless we have dynamic loading.
23382                 case "$usedl" in
23383                 $define) avail_ext="$avail_ext $xxx" ;;
23384                 esac
23385                 ;;
23386         *)      avail_ext="$avail_ext $xxx"
23387                 ;;
23388         esac
23389 done
23390
23391 set X $avail_ext
23392 shift
23393 avail_ext="$*"
23394
23395 case "$onlyextensions" in
23396 '') ;;
23397 *)  keepextensions=''
23398     echo "You have requested that only certain extensions be included..." >&4
23399     for i in $onlyextensions; do
23400         case " $avail_ext " in
23401         *" $i "*)
23402             echo "Keeping extension $i."
23403             keepextensions="$keepextensions $i"
23404             ;;
23405         *) echo "Ignoring extension $i." ;;
23406         esac
23407     done
23408     avail_ext="$keepextensions"
23409     ;;
23410 esac
23411
23412 case "$noextensions" in
23413 '') ;;
23414 *)  keepextensions=''
23415     echo "You have requested that certain extensions be ignored..." >&4
23416     for i in $avail_ext; do
23417         case " $noextensions " in
23418         *" $i "*) echo "Ignoring extension $i." ;;
23419         *) echo "Keeping extension $i.";
23420            keepextensions="$keepextensions $i"
23421            ;;
23422         esac
23423     done
23424     avail_ext="$keepextensions"
23425     ;;
23426 esac
23427
23428 : Now see which nonxs extensions are supported on this system.
23429 : For now assume all are.
23430 nonxs_ext=''
23431 for xxx in $nonxs_extensions ; do
23432         case "$xxx" in
23433         VMS*)
23434                 ;;
23435         *)      nonxs_ext="$nonxs_ext $xxx"
23436                 ;;
23437         esac
23438 done
23439
23440 set X $nonxs_ext
23441 shift
23442 nonxs_ext="$*"
23443
23444 case $usedl in
23445 $define)
23446         $cat <<EOM
23447 A number of extensions are supplied with $package.  You may choose to
23448 compile these extensions for dynamic loading (the default), compile
23449 them into the $package executable (static loading), or not include
23450 them at all.  Answer "none" to include no extensions.
23451 Note that DynaLoader is always built and need not be mentioned here.
23452
23453 EOM
23454         case "$dynamic_ext" in
23455         '')
23456                 : Exclude those listed in static_ext
23457                 dflt=''
23458                 for xxx in $avail_ext; do
23459                         case " $static_ext " in
23460                         *" $xxx "*) ;;
23461                         *) dflt="$dflt $xxx" ;;
23462                         esac
23463                 done
23464                 set X $dflt
23465                 shift
23466                 dflt="$*"
23467                 ;;
23468         *)      dflt="$dynamic_ext"
23469                 # Perhaps we are reusing an old out-of-date config.sh.
23470                 case "$hint" in
23471                 previous)
23472                         if test X"$dynamic_ext" != X"$avail_ext"; then
23473                                 $cat <<EOM
23474 NOTICE:  Your previous config.sh list may be incorrect.
23475 The extensions now available to you are
23476         ${avail_ext}
23477 but the default list from your previous config.sh is
23478         ${dynamic_ext}
23479
23480 EOM
23481                         fi
23482                         ;;
23483                 esac
23484                 ;;
23485         esac
23486         case "$dflt" in
23487         '')     dflt=none;;
23488         esac
23489         rp="What extensions do you wish to load dynamically?"
23490         . ./myread
23491         case "$ans" in
23492         none) dynamic_ext=' ' ;;
23493         *) dynamic_ext="$ans" ;;
23494         esac
23495
23496         case "$static_ext" in
23497         '')
23498                 : Exclude those already listed in dynamic linking
23499                 dflt=''
23500                 for xxx in $avail_ext; do
23501                         case " $dynamic_ext " in
23502                         *" $xxx "*) ;;
23503                         *) dflt="$dflt $xxx" ;;
23504                         esac
23505                 done
23506                 set X $dflt
23507                 shift
23508                 dflt="$*"
23509                 ;;
23510         *)  dflt="$static_ext"
23511                 ;;
23512         esac
23513
23514         case "$dflt" in
23515         '')     dflt=none;;
23516         esac
23517         rp="What extensions do you wish to load statically?"
23518         . ./myread
23519         case "$ans" in
23520         none) static_ext=' ' ;;
23521         *) static_ext="$ans" ;;
23522         esac
23523         ;;
23524 *)
23525         $cat <<EOM
23526 A number of extensions are supplied with $package.  Answer "none"
23527 to include no extensions.
23528 Note that DynaLoader is always built and need not be mentioned here.
23529
23530 EOM
23531         case "$static_ext" in
23532         '') dflt="$avail_ext" ;;
23533         *)      dflt="$static_ext"
23534                 # Perhaps we are reusing an old out-of-date config.sh.
23535                 case "$hint" in
23536                 previous)
23537                         if test X"$static_ext" != X"$avail_ext"; then
23538                                 $cat <<EOM
23539 NOTICE:  Your previous config.sh list may be incorrect.
23540 The extensions now available to you are
23541         ${avail_ext}
23542 but the default list from your previous config.sh is
23543         ${static_ext}
23544
23545 EOM
23546                         fi
23547                         ;;
23548                 esac
23549                 ;;
23550         esac
23551         : Exclude those that are not xs extensions
23552         case "$dflt" in
23553         '')     dflt=none;;
23554         esac
23555         rp="What extensions do you wish to include?"
23556         . ./myread
23557         case "$ans" in
23558         none) static_ext=' ' ;;
23559         *) static_ext="$ans" ;;
23560         esac
23561         ;;
23562 esac
23563 #
23564 # Encode is a special case.  If we are building Encode as a static
23565 # extension, we need to explicitly list its subextensions as well.
23566 # For other nested extensions, this is handled automatically by
23567 # the appropriate Makefile.PL.
23568 case " $static_ext " in
23569         *" Encode "*) # Add the subextensions of Encode
23570         cd "$rsrc/cpan"
23571         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23572                 static_ext="$static_ext Encode/$xxx"
23573                 known_extensions="$known_extensions Encode/$xxx"
23574         done
23575         cd "$tdir"
23576         ;;
23577 esac
23578
23579 set X $dynamic_ext $static_ext $nonxs_ext
23580 shift
23581 extensions="$*"
23582
23583 # Sanity check:  We require an extension suitable for use with
23584 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23585 # should show up as failures in the test suite, but it's helpful to
23586 # catch them now.) The 'extensions' list is normally sorted
23587 # alphabetically, so we need to accept either
23588 #    DB_File ... Fcntl ... IO  ....
23589 # or something like
23590 #    Fcntl ... NDBM_File ... IO  ....
23591 case " $extensions"  in
23592 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23593 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23594 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23595 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23596    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23597    ;;
23598 esac
23599
23600 : Remove libraries needed only for extensions
23601 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23602 : The exception is SunOS 4.x, which needs them.
23603 case "${osname}X${osvers}" in
23604 sunos*X4*)
23605     perllibs="$libs"
23606     ;;
23607 *) case "$usedl" in
23608     $define|true|[yY]*)
23609             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23610             shift
23611             perllibs="$*"
23612             ;;
23613     *)  perllibs="$libs"
23614             ;;
23615     esac
23616     ;;
23617 esac
23618
23619 : Remove build directory name from cppstdin so it can be used from
23620 : either the present location or the final installed location.
23621 echo " "
23622 : Get out of the UU directory to get correct path name.
23623 cd ..
23624 case "$cppstdin" in
23625 `pwd`/cppstdin)
23626         echo "Stripping down cppstdin path name"
23627         cppstdin=cppstdin
23628         ;;
23629 esac
23630 cd UU
23631
23632 : end of configuration questions
23633 echo " "
23634 echo "End of configuration questions."
23635 echo " "
23636
23637 : back to where it started
23638 if test -d ../UU; then
23639         cd ..
23640 fi
23641
23642 : configuration may be unconditionally patched via a 'config.arch' file
23643 if $test -f config.arch; then
23644         echo "I see a config.arch file, loading it." >&4
23645         . ./config.arch
23646 fi
23647
23648 : configuration may be patched via a 'config.over' file
23649 if $test -f config.over; then
23650         echo " "
23651         dflt=y
23652         rp='I see a config.over file.  Do you wish to load it?'
23653         . UU/myread
23654         case "$ans" in
23655         n*) echo "OK, I'll ignore it.";;
23656         *)      . ./config.over
23657                 echo "Configuration override changes have been loaded."
23658                 ;;
23659         esac
23660 fi
23661
23662 : in case they want portability, strip down executable paths
23663 case "$d_portable" in
23664 "$define")
23665         echo " "
23666         echo "Stripping down executable paths..." >&4
23667         for file in $loclist $trylist; do
23668                 eval temp=\$$file
23669                 eval $file=`basename $temp`
23670         done
23671         ;;
23672 esac
23673
23674 : create config.sh file
23675 echo " "
23676 echo "Creating config.sh..." >&4
23677 $spitshell <<EOT >config.sh
23678 $startsh
23679 #
23680 # This file was produced by running the Configure script. It holds all the
23681 # definitions figured out by Configure. Should you modify one of these values,
23682 # do not forget to propagate your changes by running "Configure -der". You may
23683 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23684 #
23685
23686 # Package name      : $package
23687 # Source directory  : $src
23688 # Configuration time: $cf_time
23689 # Configured by     : $cf_by
23690 # Target system     : $myuname
23691
23692 EOT
23693 : Add in command line options if available
23694 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23695
23696 $spitshell <<EOT >>config.sh
23697
23698 Author='$Author'
23699 Date='$Date'
23700 Header='$Header'
23701 Id='$Id'
23702 Locker='$Locker'
23703 Log='$Log'
23704 RCSfile='$RCSfile'
23705 Revision='$Revision'
23706 Source='$Source'
23707 State='$State'
23708 _a='$_a'
23709 _exe='$_exe'
23710 _o='$_o'
23711 afs='$afs'
23712 afsroot='$afsroot'
23713 alignbytes='$alignbytes'
23714 aphostname='$aphostname'
23715 api_revision='$api_revision'
23716 api_subversion='$api_subversion'
23717 api_version='$api_version'
23718 api_versionstring='$api_versionstring'
23719 ar='$ar'
23720 archlib='$archlib'
23721 archlibexp='$archlibexp'
23722 archname64='$archname64'
23723 archname='$archname'
23724 archobjs='$archobjs'
23725 asctime_r_proto='$asctime_r_proto'
23726 awk='$awk'
23727 baserev='$baserev'
23728 bash='$bash'
23729 bin='$bin'
23730 bin_ELF='$bin_ELF'
23731 binexp='$binexp'
23732 bison='$bison'
23733 byacc='$byacc'
23734 byteorder='$byteorder'
23735 c='$c'
23736 castflags='$castflags'
23737 cat='$cat'
23738 cc='$cc'
23739 cccdlflags='$cccdlflags'
23740 ccdlflags='$ccdlflags'
23741 ccflags='$ccflags'
23742 ccflags_uselargefiles='$ccflags_uselargefiles'
23743 ccname='$ccname'
23744 ccsymbols='$ccsymbols'
23745 ccversion='$ccversion'
23746 cf_by='$cf_by'
23747 cf_email='$cf_email'
23748 cf_time='$cf_time'
23749 charbits='$charbits'
23750 charsize='$charsize'
23751 chgrp='$chgrp'
23752 chmod='$chmod'
23753 chown='$chown'
23754 clocktype='$clocktype'
23755 comm='$comm'
23756 compress='$compress'
23757 contains='$contains'
23758 cp='$cp'
23759 cpio='$cpio'
23760 cpp='$cpp'
23761 cpp_stuff='$cpp_stuff'
23762 cppccsymbols='$cppccsymbols'
23763 cppflags='$cppflags'
23764 cpplast='$cpplast'
23765 cppminus='$cppminus'
23766 cpprun='$cpprun'
23767 cppstdin='$cppstdin'
23768 cppsymbols='$cppsymbols'
23769 crypt_r_proto='$crypt_r_proto'
23770 cryptlib='$cryptlib'
23771 csh='$csh'
23772 ctermid_r_proto='$ctermid_r_proto'
23773 ctime_r_proto='$ctime_r_proto'
23774 d_Gconvert='$d_Gconvert'
23775 d_PRIEUldbl='$d_PRIEUldbl'
23776 d_PRIFUldbl='$d_PRIFUldbl'
23777 d_PRIGUldbl='$d_PRIGUldbl'
23778 d_PRIXU64='$d_PRIXU64'
23779 d_PRId64='$d_PRId64'
23780 d_PRIeldbl='$d_PRIeldbl'
23781 d_PRIfldbl='$d_PRIfldbl'
23782 d_PRIgldbl='$d_PRIgldbl'
23783 d_PRIi64='$d_PRIi64'
23784 d_PRIo64='$d_PRIo64'
23785 d_PRIu64='$d_PRIu64'
23786 d_PRIx64='$d_PRIx64'
23787 d_SCNfldbl='$d_SCNfldbl'
23788 d__fwalk='$d__fwalk'
23789 d_accept4='$d_accept4'
23790 d_access='$d_access'
23791 d_accessx='$d_accessx'
23792 d_acosh='$d_acosh'
23793 d_aintl='$d_aintl'
23794 d_alarm='$d_alarm'
23795 d_archlib='$d_archlib'
23796 d_asctime64='$d_asctime64'
23797 d_asctime_r='$d_asctime_r'
23798 d_asinh='$d_asinh'
23799 d_atanh='$d_atanh'
23800 d_atolf='$d_atolf'
23801 d_atoll='$d_atoll'
23802 d_attribute_deprecated='$d_attribute_deprecated'
23803 d_attribute_format='$d_attribute_format'
23804 d_attribute_malloc='$d_attribute_malloc'
23805 d_attribute_nonnull='$d_attribute_nonnull'
23806 d_attribute_noreturn='$d_attribute_noreturn'
23807 d_attribute_pure='$d_attribute_pure'
23808 d_attribute_unused='$d_attribute_unused'
23809 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23810 d_backtrace='$d_backtrace'
23811 d_bsd='$d_bsd'
23812 d_bsdgetpgrp='$d_bsdgetpgrp'
23813 d_bsdsetpgrp='$d_bsdsetpgrp'
23814 d_builtin_add_overflow='$d_builtin_add_overflow'
23815 d_builtin_choose_expr='$d_builtin_choose_expr'
23816 d_builtin_expect='$d_builtin_expect'
23817 d_builtin_mul_overflow='$d_builtin_mul_overflow'
23818 d_builtin_sub_overflow='$d_builtin_sub_overflow'
23819 d_c99_variadic_macros='$d_c99_variadic_macros'
23820 d_casti32='$d_casti32'
23821 d_castneg='$d_castneg'
23822 d_cbrt='$d_cbrt'
23823 d_chown='$d_chown'
23824 d_chroot='$d_chroot'
23825 d_chsize='$d_chsize'
23826 d_class='$d_class'
23827 d_clearenv='$d_clearenv'
23828 d_closedir='$d_closedir'
23829 d_cmsghdr_s='$d_cmsghdr_s'
23830 d_const='$d_const'
23831 d_copysign='$d_copysign'
23832 d_copysignl='$d_copysignl'
23833 d_cplusplus='$d_cplusplus'
23834 d_crypt='$d_crypt'
23835 d_crypt_r='$d_crypt_r'
23836 d_csh='$d_csh'
23837 d_ctermid='$d_ctermid'
23838 d_ctermid_r='$d_ctermid_r'
23839 d_ctime64='$d_ctime64'
23840 d_ctime_r='$d_ctime_r'
23841 d_cuserid='$d_cuserid'
23842 d_dbminitproto='$d_dbminitproto'
23843 d_difftime64='$d_difftime64'
23844 d_difftime='$d_difftime'
23845 d_dir_dd_fd='$d_dir_dd_fd'
23846 d_dirfd='$d_dirfd'
23847 d_dirnamlen='$d_dirnamlen'
23848 d_dladdr='$d_dladdr'
23849 d_dlerror='$d_dlerror'
23850 d_dlopen='$d_dlopen'
23851 d_dlsymun='$d_dlsymun'
23852 d_dosuid='$d_dosuid'
23853 d_double_has_inf='$d_double_has_inf'
23854 d_double_has_nan='$d_double_has_nan'
23855 d_double_has_negative_zero='$d_double_has_negative_zero'
23856 d_double_has_subnormals='$d_double_has_subnormals'
23857 d_double_style_cray='$d_double_style_cray'
23858 d_double_style_ibm='$d_double_style_ibm'
23859 d_double_style_ieee='$d_double_style_ieee'
23860 d_double_style_vax='$d_double_style_vax'
23861 d_drand48_r='$d_drand48_r'
23862 d_drand48proto='$d_drand48proto'
23863 d_dup2='$d_dup2'
23864 d_dup3='$d_dup3'
23865 d_duplocale='$d_duplocale'
23866 d_eaccess='$d_eaccess'
23867 d_endgrent='$d_endgrent'
23868 d_endgrent_r='$d_endgrent_r'
23869 d_endhent='$d_endhent'
23870 d_endhostent_r='$d_endhostent_r'
23871 d_endnent='$d_endnent'
23872 d_endnetent_r='$d_endnetent_r'
23873 d_endpent='$d_endpent'
23874 d_endprotoent_r='$d_endprotoent_r'
23875 d_endpwent='$d_endpwent'
23876 d_endpwent_r='$d_endpwent_r'
23877 d_endsent='$d_endsent'
23878 d_endservent_r='$d_endservent_r'
23879 d_eofnblk='$d_eofnblk'
23880 d_erf='$d_erf'
23881 d_erfc='$d_erfc'
23882 d_eunice='$d_eunice'
23883 d_exp2='$d_exp2'
23884 d_expm1='$d_expm1'
23885 d_faststdio='$d_faststdio'
23886 d_fchdir='$d_fchdir'
23887 d_fchmod='$d_fchmod'
23888 d_fchmodat='$d_fchmodat'
23889 d_fchown='$d_fchown'
23890 d_fcntl='$d_fcntl'
23891 d_fcntl_can_lock='$d_fcntl_can_lock'
23892 d_fd_macros='$d_fd_macros'
23893 d_fd_set='$d_fd_set'
23894 d_fdclose='$d_fdclose'
23895 d_fdim='$d_fdim'
23896 d_fds_bits='$d_fds_bits'
23897 d_fegetround='$d_fegetround'
23898 d_fgetpos='$d_fgetpos'
23899 d_finite='$d_finite'
23900 d_finitel='$d_finitel'
23901 d_flexfnam='$d_flexfnam'
23902 d_flock='$d_flock'
23903 d_flockproto='$d_flockproto'
23904 d_fma='$d_fma'
23905 d_fmax='$d_fmax'
23906 d_fmin='$d_fmin'
23907 d_fork='$d_fork'
23908 d_fp_class='$d_fp_class'
23909 d_fp_classify='$d_fp_classify'
23910 d_fp_classl='$d_fp_classl'
23911 d_fpathconf='$d_fpathconf'
23912 d_fpclass='$d_fpclass'
23913 d_fpclassify='$d_fpclassify'
23914 d_fpclassl='$d_fpclassl'
23915 d_fpgetround='$d_fpgetround'
23916 d_fpos64_t='$d_fpos64_t'
23917 d_freelocale='$d_freelocale'
23918 d_frexpl='$d_frexpl'
23919 d_fs_data_s='$d_fs_data_s'
23920 d_fseeko='$d_fseeko'
23921 d_fsetpos='$d_fsetpos'
23922 d_fstatfs='$d_fstatfs'
23923 d_fstatvfs='$d_fstatvfs'
23924 d_fsync='$d_fsync'
23925 d_ftello='$d_ftello'
23926 d_ftime='$d_ftime'
23927 d_futimes='$d_futimes'
23928 d_gai_strerror='$d_gai_strerror'
23929 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23930 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23931 d_getaddrinfo='$d_getaddrinfo'
23932 d_getcwd='$d_getcwd'
23933 d_getespwnam='$d_getespwnam'
23934 d_getfsstat='$d_getfsstat'
23935 d_getgrent='$d_getgrent'
23936 d_getgrent_r='$d_getgrent_r'
23937 d_getgrgid_r='$d_getgrgid_r'
23938 d_getgrnam_r='$d_getgrnam_r'
23939 d_getgrps='$d_getgrps'
23940 d_gethbyaddr='$d_gethbyaddr'
23941 d_gethbyname='$d_gethbyname'
23942 d_gethent='$d_gethent'
23943 d_gethname='$d_gethname'
23944 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23945 d_gethostbyname_r='$d_gethostbyname_r'
23946 d_gethostent_r='$d_gethostent_r'
23947 d_gethostprotos='$d_gethostprotos'
23948 d_getitimer='$d_getitimer'
23949 d_getlogin='$d_getlogin'
23950 d_getlogin_r='$d_getlogin_r'
23951 d_getmnt='$d_getmnt'
23952 d_getmntent='$d_getmntent'
23953 d_getnameinfo='$d_getnameinfo'
23954 d_getnbyaddr='$d_getnbyaddr'
23955 d_getnbyname='$d_getnbyname'
23956 d_getnent='$d_getnent'
23957 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23958 d_getnetbyname_r='$d_getnetbyname_r'
23959 d_getnetent_r='$d_getnetent_r'
23960 d_getnetprotos='$d_getnetprotos'
23961 d_getpagsz='$d_getpagsz'
23962 d_getpbyname='$d_getpbyname'
23963 d_getpbynumber='$d_getpbynumber'
23964 d_getpent='$d_getpent'
23965 d_getpgid='$d_getpgid'
23966 d_getpgrp2='$d_getpgrp2'
23967 d_getpgrp='$d_getpgrp'
23968 d_getppid='$d_getppid'
23969 d_getprior='$d_getprior'
23970 d_getprotobyname_r='$d_getprotobyname_r'
23971 d_getprotobynumber_r='$d_getprotobynumber_r'
23972 d_getprotoent_r='$d_getprotoent_r'
23973 d_getprotoprotos='$d_getprotoprotos'
23974 d_getprpwnam='$d_getprpwnam'
23975 d_getpwent='$d_getpwent'
23976 d_getpwent_r='$d_getpwent_r'
23977 d_getpwnam_r='$d_getpwnam_r'
23978 d_getpwuid_r='$d_getpwuid_r'
23979 d_getsbyname='$d_getsbyname'
23980 d_getsbyport='$d_getsbyport'
23981 d_getsent='$d_getsent'
23982 d_getservbyname_r='$d_getservbyname_r'
23983 d_getservbyport_r='$d_getservbyport_r'
23984 d_getservent_r='$d_getservent_r'
23985 d_getservprotos='$d_getservprotos'
23986 d_getspnam='$d_getspnam'
23987 d_getspnam_r='$d_getspnam_r'
23988 d_gettimeod='$d_gettimeod'
23989 d_gmtime64='$d_gmtime64'
23990 d_gmtime_r='$d_gmtime_r'
23991 d_gnulibc='$d_gnulibc'
23992 d_grpasswd='$d_grpasswd'
23993 d_hasmntopt='$d_hasmntopt'
23994 d_htonl='$d_htonl'
23995 d_hypot='$d_hypot'
23996 d_ilogb='$d_ilogb'
23997 d_ilogbl='$d_ilogbl'
23998 d_inc_version_list='$d_inc_version_list'
23999 d_inetaton='$d_inetaton'
24000 d_inetntop='$d_inetntop'
24001 d_inetpton='$d_inetpton'
24002 d_int64_t='$d_int64_t'
24003 d_ip_mreq='$d_ip_mreq'
24004 d_ip_mreq_source='$d_ip_mreq_source'
24005 d_ipv6_mreq='$d_ipv6_mreq'
24006 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24007 d_isascii='$d_isascii'
24008 d_isblank='$d_isblank'
24009 d_isfinite='$d_isfinite'
24010 d_isfinitel='$d_isfinitel'
24011 d_isinf='$d_isinf'
24012 d_isinfl='$d_isinfl'
24013 d_isless='$d_isless'
24014 d_isnan='$d_isnan'
24015 d_isnanl='$d_isnanl'
24016 d_isnormal='$d_isnormal'
24017 d_j0='$d_j0'
24018 d_j0l='$d_j0l'
24019 d_killpg='$d_killpg'
24020 d_lc_monetary_2008='$d_lc_monetary_2008'
24021 d_lchown='$d_lchown'
24022 d_ldbl_dig='$d_ldbl_dig'
24023 d_ldexpl='$d_ldexpl'
24024 d_lgamma='$d_lgamma'
24025 d_lgamma_r='$d_lgamma_r'
24026 d_libm_lib_version='$d_libm_lib_version'
24027 d_libname_unique='$d_libname_unique'
24028 d_link='$d_link'
24029 d_linkat='$d_linkat'
24030 d_llrint='$d_llrint'
24031 d_llrintl='$d_llrintl'
24032 d_llround='$d_llround'
24033 d_llroundl='$d_llroundl'
24034 d_localeconv_l='$d_localeconv_l'
24035 d_localtime64='$d_localtime64'
24036 d_localtime_r='$d_localtime_r'
24037 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24038 d_locconv='$d_locconv'
24039 d_lockf='$d_lockf'
24040 d_log1p='$d_log1p'
24041 d_log2='$d_log2'
24042 d_logb='$d_logb'
24043 d_long_double_style_ieee='$d_long_double_style_ieee'
24044 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24045 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24046 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24047 d_long_double_style_vax='$d_long_double_style_vax'
24048 d_longdbl='$d_longdbl'
24049 d_longlong='$d_longlong'
24050 d_lrint='$d_lrint'
24051 d_lrintl='$d_lrintl'
24052 d_lround='$d_lround'
24053 d_lroundl='$d_lroundl'
24054 d_lseekproto='$d_lseekproto'
24055 d_lstat='$d_lstat'
24056 d_madvise='$d_madvise'
24057 d_malloc_good_size='$d_malloc_good_size'
24058 d_malloc_size='$d_malloc_size'
24059 d_mblen='$d_mblen'
24060 d_mbrlen='$d_mbrlen'
24061 d_mbrtowc='$d_mbrtowc'
24062 d_mbstowcs='$d_mbstowcs'
24063 d_mbtowc='$d_mbtowc'
24064 d_memmem='$d_memmem'
24065 d_memrchr='$d_memrchr'
24066 d_mkdir='$d_mkdir'
24067 d_mkdtemp='$d_mkdtemp'
24068 d_mkfifo='$d_mkfifo'
24069 d_mkostemp='$d_mkostemp'
24070 d_mkstemp='$d_mkstemp'
24071 d_mkstemps='$d_mkstemps'
24072 d_mktime64='$d_mktime64'
24073 d_mktime='$d_mktime'
24074 d_mmap='$d_mmap'
24075 d_modfl='$d_modfl'
24076 d_modflproto='$d_modflproto'
24077 d_mprotect='$d_mprotect'
24078 d_msg='$d_msg'
24079 d_msg_ctrunc='$d_msg_ctrunc'
24080 d_msg_dontroute='$d_msg_dontroute'
24081 d_msg_oob='$d_msg_oob'
24082 d_msg_peek='$d_msg_peek'
24083 d_msg_proxy='$d_msg_proxy'
24084 d_msgctl='$d_msgctl'
24085 d_msgget='$d_msgget'
24086 d_msghdr_s='$d_msghdr_s'
24087 d_msgrcv='$d_msgrcv'
24088 d_msgsnd='$d_msgsnd'
24089 d_msync='$d_msync'
24090 d_munmap='$d_munmap'
24091 d_mymalloc='$d_mymalloc'
24092 d_nan='$d_nan'
24093 d_nanosleep='$d_nanosleep'
24094 d_ndbm='$d_ndbm'
24095 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24096 d_nearbyint='$d_nearbyint'
24097 d_newlocale='$d_newlocale'
24098 d_nextafter='$d_nextafter'
24099 d_nexttoward='$d_nexttoward'
24100 d_nice='$d_nice'
24101 d_nl_langinfo='$d_nl_langinfo'
24102 d_nv_preserves_uv='$d_nv_preserves_uv'
24103 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24104 d_off64_t='$d_off64_t'
24105 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24106 d_oldpthreads='$d_oldpthreads'
24107 d_oldsock='$d_oldsock'
24108 d_open3='$d_open3'
24109 d_openat='$d_openat'
24110 d_pathconf='$d_pathconf'
24111 d_pause='$d_pause'
24112 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24113 d_phostname='$d_phostname'
24114 d_pipe2='$d_pipe2'
24115 d_pipe='$d_pipe'
24116 d_poll='$d_poll'
24117 d_portable='$d_portable'
24118 d_prctl='$d_prctl'
24119 d_prctl_set_name='$d_prctl_set_name'
24120 d_printf_format_null='$d_printf_format_null'
24121 d_procselfexe='$d_procselfexe'
24122 d_pseudofork='$d_pseudofork'
24123 d_pthread_atfork='$d_pthread_atfork'
24124 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24125 d_pthread_yield='$d_pthread_yield'
24126 d_ptrdiff_t='$d_ptrdiff_t'
24127 d_pwage='$d_pwage'
24128 d_pwchange='$d_pwchange'
24129 d_pwclass='$d_pwclass'
24130 d_pwcomment='$d_pwcomment'
24131 d_pwexpire='$d_pwexpire'
24132 d_pwgecos='$d_pwgecos'
24133 d_pwpasswd='$d_pwpasswd'
24134 d_pwquota='$d_pwquota'
24135 d_qgcvt='$d_qgcvt'
24136 d_quad='$d_quad'
24137 d_querylocale='$d_querylocale'
24138 d_random_r='$d_random_r'
24139 d_re_comp='$d_re_comp'
24140 d_readdir64_r='$d_readdir64_r'
24141 d_readdir='$d_readdir'
24142 d_readdir_r='$d_readdir_r'
24143 d_readlink='$d_readlink'
24144 d_readv='$d_readv'
24145 d_recvmsg='$d_recvmsg'
24146 d_regcmp='$d_regcmp'
24147 d_regcomp='$d_regcomp'
24148 d_remainder='$d_remainder'
24149 d_remquo='$d_remquo'
24150 d_rename='$d_rename'
24151 d_renameat='$d_renameat'
24152 d_rewinddir='$d_rewinddir'
24153 d_rint='$d_rint'
24154 d_rmdir='$d_rmdir'
24155 d_round='$d_round'
24156 d_sbrkproto='$d_sbrkproto'
24157 d_scalbn='$d_scalbn'
24158 d_scalbnl='$d_scalbnl'
24159 d_sched_yield='$d_sched_yield'
24160 d_scm_rights='$d_scm_rights'
24161 d_seekdir='$d_seekdir'
24162 d_select='$d_select'
24163 d_sem='$d_sem'
24164 d_semctl='$d_semctl'
24165 d_semctl_semid_ds='$d_semctl_semid_ds'
24166 d_semctl_semun='$d_semctl_semun'
24167 d_semget='$d_semget'
24168 d_semop='$d_semop'
24169 d_sendmsg='$d_sendmsg'
24170 d_setegid='$d_setegid'
24171 d_seteuid='$d_seteuid'
24172 d_setgrent='$d_setgrent'
24173 d_setgrent_r='$d_setgrent_r'
24174 d_setgrps='$d_setgrps'
24175 d_sethent='$d_sethent'
24176 d_sethostent_r='$d_sethostent_r'
24177 d_setitimer='$d_setitimer'
24178 d_setlinebuf='$d_setlinebuf'
24179 d_setlocale='$d_setlocale'
24180 d_setlocale_r='$d_setlocale_r'
24181 d_setnent='$d_setnent'
24182 d_setnetent_r='$d_setnetent_r'
24183 d_setpent='$d_setpent'
24184 d_setpgid='$d_setpgid'
24185 d_setpgrp2='$d_setpgrp2'
24186 d_setpgrp='$d_setpgrp'
24187 d_setprior='$d_setprior'
24188 d_setproctitle='$d_setproctitle'
24189 d_setprotoent_r='$d_setprotoent_r'
24190 d_setpwent='$d_setpwent'
24191 d_setpwent_r='$d_setpwent_r'
24192 d_setregid='$d_setregid'
24193 d_setresgid='$d_setresgid'
24194 d_setresuid='$d_setresuid'
24195 d_setreuid='$d_setreuid'
24196 d_setrgid='$d_setrgid'
24197 d_setruid='$d_setruid'
24198 d_setsent='$d_setsent'
24199 d_setservent_r='$d_setservent_r'
24200 d_setsid='$d_setsid'
24201 d_setvbuf='$d_setvbuf'
24202 d_shm='$d_shm'
24203 d_shmat='$d_shmat'
24204 d_shmatprototype='$d_shmatprototype'
24205 d_shmctl='$d_shmctl'
24206 d_shmdt='$d_shmdt'
24207 d_shmget='$d_shmget'
24208 d_sigaction='$d_sigaction'
24209 d_siginfo_si_addr='$d_siginfo_si_addr'
24210 d_siginfo_si_band='$d_siginfo_si_band'
24211 d_siginfo_si_errno='$d_siginfo_si_errno'
24212 d_siginfo_si_fd='$d_siginfo_si_fd'
24213 d_siginfo_si_pid='$d_siginfo_si_pid'
24214 d_siginfo_si_status='$d_siginfo_si_status'
24215 d_siginfo_si_uid='$d_siginfo_si_uid'
24216 d_siginfo_si_value='$d_siginfo_si_value'
24217 d_signbit='$d_signbit'
24218 d_sigprocmask='$d_sigprocmask'
24219 d_sigsetjmp='$d_sigsetjmp'
24220 d_sin6_scope_id='$d_sin6_scope_id'
24221 d_sitearch='$d_sitearch'
24222 d_snprintf='$d_snprintf'
24223 d_sockaddr_in6='$d_sockaddr_in6'
24224 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24225 d_sockatmark='$d_sockatmark'
24226 d_sockatmarkproto='$d_sockatmarkproto'
24227 d_socket='$d_socket'
24228 d_socklen_t='$d_socklen_t'
24229 d_sockpair='$d_sockpair'
24230 d_socks5_init='$d_socks5_init'
24231 d_sqrtl='$d_sqrtl'
24232 d_srand48_r='$d_srand48_r'
24233 d_srandom_r='$d_srandom_r'
24234 d_sresgproto='$d_sresgproto'
24235 d_sresuproto='$d_sresuproto'
24236 d_stat='$d_stat'
24237 d_statblks='$d_statblks'
24238 d_statfs_f_flags='$d_statfs_f_flags'
24239 d_statfs_s='$d_statfs_s'
24240 d_static_inline='$d_static_inline'
24241 d_statvfs='$d_statvfs'
24242 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24243 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24244 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24245 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24246 d_stdio_stream_array='$d_stdio_stream_array'
24247 d_stdiobase='$d_stdiobase'
24248 d_stdstdio='$d_stdstdio'
24249 d_strcoll='$d_strcoll'
24250 d_strerror_l='$d_strerror_l'
24251 d_strerror_r='$d_strerror_r'
24252 d_strftime='$d_strftime'
24253 d_strlcat='$d_strlcat'
24254 d_strlcpy='$d_strlcpy'
24255 d_strnlen='$d_strnlen'
24256 d_strtod='$d_strtod'
24257 d_strtol='$d_strtol'
24258 d_strtold='$d_strtold'
24259 d_strtold_l='$d_strtold_l'
24260 d_strtoll='$d_strtoll'
24261 d_strtoq='$d_strtoq'
24262 d_strtoul='$d_strtoul'
24263 d_strtoull='$d_strtoull'
24264 d_strtouq='$d_strtouq'
24265 d_strxfrm='$d_strxfrm'
24266 d_suidsafe='$d_suidsafe'
24267 d_symlink='$d_symlink'
24268 d_syscall='$d_syscall'
24269 d_syscallproto='$d_syscallproto'
24270 d_sysconf='$d_sysconf'
24271 d_sysernlst='$d_sysernlst'
24272 d_syserrlst='$d_syserrlst'
24273 d_system='$d_system'
24274 d_tcgetpgrp='$d_tcgetpgrp'
24275 d_tcsetpgrp='$d_tcsetpgrp'
24276 d_telldir='$d_telldir'
24277 d_telldirproto='$d_telldirproto'
24278 d_tgamma='$d_tgamma'
24279 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24280 d_time='$d_time'
24281 d_timegm='$d_timegm'
24282 d_times='$d_times'
24283 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24284 d_tm_tm_zone='$d_tm_tm_zone'
24285 d_tmpnam_r='$d_tmpnam_r'
24286 d_trunc='$d_trunc'
24287 d_truncate='$d_truncate'
24288 d_truncl='$d_truncl'
24289 d_ttyname_r='$d_ttyname_r'
24290 d_tzname='$d_tzname'
24291 d_u32align='$d_u32align'
24292 d_ualarm='$d_ualarm'
24293 d_umask='$d_umask'
24294 d_uname='$d_uname'
24295 d_union_semun='$d_union_semun'
24296 d_unlinkat='$d_unlinkat'
24297 d_unordered='$d_unordered'
24298 d_unsetenv='$d_unsetenv'
24299 d_uselocale='$d_uselocale'
24300 d_usleep='$d_usleep'
24301 d_usleepproto='$d_usleepproto'
24302 d_ustat='$d_ustat'
24303 d_vendorarch='$d_vendorarch'
24304 d_vendorbin='$d_vendorbin'
24305 d_vendorlib='$d_vendorlib'
24306 d_vendorscript='$d_vendorscript'
24307 d_vfork='$d_vfork'
24308 d_void_closedir='$d_void_closedir'
24309 d_voidsig='$d_voidsig'
24310 d_voidtty='$d_voidtty'
24311 d_vsnprintf='$d_vsnprintf'
24312 d_wait4='$d_wait4'
24313 d_waitpid='$d_waitpid'
24314 d_wcscmp='$d_wcscmp'
24315 d_wcstombs='$d_wcstombs'
24316 d_wcsxfrm='$d_wcsxfrm'
24317 d_wctomb='$d_wctomb'
24318 d_writev='$d_writev'
24319 d_xenix='$d_xenix'
24320 date='$date'
24321 db_hashtype='$db_hashtype'
24322 db_prefixtype='$db_prefixtype'
24323 db_version_major='$db_version_major'
24324 db_version_minor='$db_version_minor'
24325 db_version_patch='$db_version_patch'
24326 default_inc_excludes_dot='$default_inc_excludes_dot'
24327 direntrytype='$direntrytype'
24328 dlext='$dlext'
24329 dlsrc='$dlsrc'
24330 doubleinfbytes='$doubleinfbytes'
24331 doublekind='$doublekind'
24332 doublemantbits='$doublemantbits'
24333 doublenanbytes='$doublenanbytes'
24334 doublesize='$doublesize'
24335 drand01='$drand01'
24336 drand48_r_proto='$drand48_r_proto'
24337 dtrace='$dtrace'
24338 dtraceobject='$dtraceobject'
24339 dtracexnolibs='$dtracexnolibs'
24340 dynamic_ext='$dynamic_ext'
24341 eagain='$eagain'
24342 ebcdic='$ebcdic'
24343 echo='$echo'
24344 egrep='$egrep'
24345 emacs='$emacs'
24346 endgrent_r_proto='$endgrent_r_proto'
24347 endhostent_r_proto='$endhostent_r_proto'
24348 endnetent_r_proto='$endnetent_r_proto'
24349 endprotoent_r_proto='$endprotoent_r_proto'
24350 endpwent_r_proto='$endpwent_r_proto'
24351 endservent_r_proto='$endservent_r_proto'
24352 eunicefix='$eunicefix'
24353 exe_ext='$exe_ext'
24354 expr='$expr'
24355 extensions='$extensions'
24356 extern_C='$extern_C'
24357 extras='$extras'
24358 fflushNULL='$fflushNULL'
24359 fflushall='$fflushall'
24360 find='$find'
24361 firstmakefile='$firstmakefile'
24362 flex='$flex'
24363 fpossize='$fpossize'
24364 fpostype='$fpostype'
24365 freetype='$freetype'
24366 from='$from'
24367 full_ar='$full_ar'
24368 full_csh='$full_csh'
24369 full_sed='$full_sed'
24370 gccansipedantic='$gccansipedantic'
24371 gccosandvers='$gccosandvers'
24372 gccversion='$gccversion'
24373 getgrent_r_proto='$getgrent_r_proto'
24374 getgrgid_r_proto='$getgrgid_r_proto'
24375 getgrnam_r_proto='$getgrnam_r_proto'
24376 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24377 gethostbyname_r_proto='$gethostbyname_r_proto'
24378 gethostent_r_proto='$gethostent_r_proto'
24379 getlogin_r_proto='$getlogin_r_proto'
24380 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24381 getnetbyname_r_proto='$getnetbyname_r_proto'
24382 getnetent_r_proto='$getnetent_r_proto'
24383 getprotobyname_r_proto='$getprotobyname_r_proto'
24384 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24385 getprotoent_r_proto='$getprotoent_r_proto'
24386 getpwent_r_proto='$getpwent_r_proto'
24387 getpwnam_r_proto='$getpwnam_r_proto'
24388 getpwuid_r_proto='$getpwuid_r_proto'
24389 getservbyname_r_proto='$getservbyname_r_proto'
24390 getservbyport_r_proto='$getservbyport_r_proto'
24391 getservent_r_proto='$getservent_r_proto'
24392 getspnam_r_proto='$getspnam_r_proto'
24393 gidformat='$gidformat'
24394 gidsign='$gidsign'
24395 gidsize='$gidsize'
24396 gidtype='$gidtype'
24397 glibpth='$glibpth'
24398 gmake='$gmake'
24399 gmtime_r_proto='$gmtime_r_proto'
24400 gnulibc_version='$gnulibc_version'
24401 grep='$grep'
24402 groupcat='$groupcat'
24403 groupstype='$groupstype'
24404 gzip='$gzip'
24405 h_fcntl='$h_fcntl'
24406 h_sysfile='$h_sysfile'
24407 hint='$hint'
24408 hostcat='$hostcat'
24409 hostgenerate='$hostgenerate'
24410 hostosname='$hostosname'
24411 hostperl='$hostperl'
24412 html1dir='$html1dir'
24413 html1direxp='$html1direxp'
24414 html3dir='$html3dir'
24415 html3direxp='$html3direxp'
24416 i16size='$i16size'
24417 i16type='$i16type'
24418 i32size='$i32size'
24419 i32type='$i32type'
24420 i64size='$i64size'
24421 i64type='$i64type'
24422 i8size='$i8size'
24423 i8type='$i8type'
24424 i_arpainet='$i_arpainet'
24425 i_bfd='$i_bfd'
24426 i_bsdioctl='$i_bsdioctl'
24427 i_crypt='$i_crypt'
24428 i_db='$i_db'
24429 i_dbm='$i_dbm'
24430 i_dirent='$i_dirent'
24431 i_dlfcn='$i_dlfcn'
24432 i_execinfo='$i_execinfo'
24433 i_fcntl='$i_fcntl'
24434 i_fenv='$i_fenv'
24435 i_fp='$i_fp'
24436 i_fp_class='$i_fp_class'
24437 i_gdbm='$i_gdbm'
24438 i_gdbm_ndbm='$i_gdbm_ndbm'
24439 i_gdbmndbm='$i_gdbmndbm'
24440 i_grp='$i_grp'
24441 i_ieeefp='$i_ieeefp'
24442 i_inttypes='$i_inttypes'
24443 i_langinfo='$i_langinfo'
24444 i_libutil='$i_libutil'
24445 i_locale='$i_locale'
24446 i_machcthr='$i_machcthr'
24447 i_malloc='$i_malloc'
24448 i_mallocmalloc='$i_mallocmalloc'
24449 i_mntent='$i_mntent'
24450 i_ndbm='$i_ndbm'
24451 i_netdb='$i_netdb'
24452 i_neterrno='$i_neterrno'
24453 i_netinettcp='$i_netinettcp'
24454 i_niin='$i_niin'
24455 i_poll='$i_poll'
24456 i_prot='$i_prot'
24457 i_pthread='$i_pthread'
24458 i_pwd='$i_pwd'
24459 i_quadmath='$i_quadmath'
24460 i_rpcsvcdbm='$i_rpcsvcdbm'
24461 i_sgtty='$i_sgtty'
24462 i_shadow='$i_shadow'
24463 i_socks='$i_socks'
24464 i_stdbool='$i_stdbool'
24465 i_stdint='$i_stdint'
24466 i_stdlib='$i_stdlib'
24467 i_sunmath='$i_sunmath'
24468 i_sysaccess='$i_sysaccess'
24469 i_sysdir='$i_sysdir'
24470 i_sysfile='$i_sysfile'
24471 i_sysfilio='$i_sysfilio'
24472 i_sysin='$i_sysin'
24473 i_sysioctl='$i_sysioctl'
24474 i_syslog='$i_syslog'
24475 i_sysmman='$i_sysmman'
24476 i_sysmode='$i_sysmode'
24477 i_sysmount='$i_sysmount'
24478 i_sysndir='$i_sysndir'
24479 i_sysparam='$i_sysparam'
24480 i_syspoll='$i_syspoll'
24481 i_sysresrc='$i_sysresrc'
24482 i_syssecrt='$i_syssecrt'
24483 i_sysselct='$i_sysselct'
24484 i_syssockio='$i_syssockio'
24485 i_sysstat='$i_sysstat'
24486 i_sysstatfs='$i_sysstatfs'
24487 i_sysstatvfs='$i_sysstatvfs'
24488 i_systime='$i_systime'
24489 i_systimek='$i_systimek'
24490 i_systimes='$i_systimes'
24491 i_systypes='$i_systypes'
24492 i_sysuio='$i_sysuio'
24493 i_sysun='$i_sysun'
24494 i_sysutsname='$i_sysutsname'
24495 i_sysvfs='$i_sysvfs'
24496 i_syswait='$i_syswait'
24497 i_termio='$i_termio'
24498 i_termios='$i_termios'
24499 i_time='$i_time'
24500 i_unistd='$i_unistd'
24501 i_ustat='$i_ustat'
24502 i_utime='$i_utime'
24503 i_vfork='$i_vfork'
24504 i_wchar='$i_wchar'
24505 i_xlocale='$i_xlocale'
24506 ignore_versioned_solibs='$ignore_versioned_solibs'
24507 inc_version_list='$inc_version_list'
24508 inc_version_list_init='$inc_version_list_init'
24509 incpath='$incpath'
24510 incpth='$incpth'
24511 inews='$inews'
24512 initialinstalllocation='$initialinstalllocation'
24513 installarchlib='$installarchlib'
24514 installbin='$installbin'
24515 installhtml1dir='$installhtml1dir'
24516 installhtml3dir='$installhtml3dir'
24517 installman1dir='$installman1dir'
24518 installman3dir='$installman3dir'
24519 installprefix='$installprefix'
24520 installprefixexp='$installprefixexp'
24521 installprivlib='$installprivlib'
24522 installscript='$installscript'
24523 installsitearch='$installsitearch'
24524 installsitebin='$installsitebin'
24525 installsitehtml1dir='$installsitehtml1dir'
24526 installsitehtml3dir='$installsitehtml3dir'
24527 installsitelib='$installsitelib'
24528 installsiteman1dir='$installsiteman1dir'
24529 installsiteman3dir='$installsiteman3dir'
24530 installsitescript='$installsitescript'
24531 installstyle='$installstyle'
24532 installusrbinperl='$installusrbinperl'
24533 installvendorarch='$installvendorarch'
24534 installvendorbin='$installvendorbin'
24535 installvendorhtml1dir='$installvendorhtml1dir'
24536 installvendorhtml3dir='$installvendorhtml3dir'
24537 installvendorlib='$installvendorlib'
24538 installvendorman1dir='$installvendorman1dir'
24539 installvendorman3dir='$installvendorman3dir'
24540 installvendorscript='$installvendorscript'
24541 intsize='$intsize'
24542 issymlink='$issymlink'
24543 ivdformat='$ivdformat'
24544 ivsize='$ivsize'
24545 ivtype='$ivtype'
24546 known_extensions='$known_extensions'
24547 ksh='$ksh'
24548 ld='$ld'
24549 ld_can_script='$ld_can_script'
24550 lddlflags='$lddlflags'
24551 ldflags='$ldflags'
24552 ldflags_uselargefiles='$ldflags_uselargefiles'
24553 ldlibpthname='$ldlibpthname'
24554 less='$less'
24555 lib_ext='$lib_ext'
24556 libc='$libc'
24557 libperl='$libperl'
24558 libpth='$libpth'
24559 libs='$libs'
24560 libsdirs='$libsdirs'
24561 libsfiles='$libsfiles'
24562 libsfound='$libsfound'
24563 libspath='$libspath'
24564 libswanted='$libswanted'
24565 libswanted_uselargefiles='$libswanted_uselargefiles'
24566 line='$line'
24567 lint='$lint'
24568 lkflags='$lkflags'
24569 ln='$ln'
24570 lns='$lns'
24571 localtime_r_proto='$localtime_r_proto'
24572 locincpth='$locincpth'
24573 loclibpth='$loclibpth'
24574 longdblinfbytes='$longdblinfbytes'
24575 longdblkind='$longdblkind'
24576 longdblmantbits='$longdblmantbits'
24577 longdblnanbytes='$longdblnanbytes'
24578 longdblsize='$longdblsize'
24579 longlongsize='$longlongsize'
24580 longsize='$longsize'
24581 lp='$lp'
24582 lpr='$lpr'
24583 ls='$ls'
24584 lseeksize='$lseeksize'
24585 lseektype='$lseektype'
24586 mail='$mail'
24587 mailx='$mailx'
24588 make='$make'
24589 make_set_make='$make_set_make'
24590 mallocobj='$mallocobj'
24591 mallocsrc='$mallocsrc'
24592 malloctype='$malloctype'
24593 man1dir='$man1dir'
24594 man1direxp='$man1direxp'
24595 man1ext='$man1ext'
24596 man3dir='$man3dir'
24597 man3direxp='$man3direxp'
24598 man3ext='$man3ext'
24599 mips_type='$mips_type'
24600 mistrustnm='$mistrustnm'
24601 mkdir='$mkdir'
24602 mmaptype='$mmaptype'
24603 modetype='$modetype'
24604 more='$more'
24605 multiarch='$multiarch'
24606 mv='$mv'
24607 myarchname='$myarchname'
24608 mydomain='$mydomain'
24609 myhostname='$myhostname'
24610 myuname='$myuname'
24611 n='$n'
24612 need_va_copy='$need_va_copy'
24613 netdb_hlen_type='$netdb_hlen_type'
24614 netdb_host_type='$netdb_host_type'
24615 netdb_name_type='$netdb_name_type'
24616 netdb_net_type='$netdb_net_type'
24617 nm='$nm'
24618 nm_opt='$nm_opt'
24619 nm_so_opt='$nm_so_opt'
24620 nonxs_ext='$nonxs_ext'
24621 nroff='$nroff'
24622 nvEUformat='$nvEUformat'
24623 nvFUformat='$nvFUformat'
24624 nvGUformat='$nvGUformat'
24625 nv_overflows_integers_at='$nv_overflows_integers_at'
24626 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24627 nveformat='$nveformat'
24628 nvfformat='$nvfformat'
24629 nvgformat='$nvgformat'
24630 nvmantbits='$nvmantbits'
24631 nvsize='$nvsize'
24632 nvtype='$nvtype'
24633 o_nonblock='$o_nonblock'
24634 obj_ext='$obj_ext'
24635 old_pthread_create_joinable='$old_pthread_create_joinable'
24636 optimize='$optimize'
24637 orderlib='$orderlib'
24638 osname='$osname'
24639 osvers='$osvers'
24640 otherlibdirs='$otherlibdirs'
24641 package='$package'
24642 pager='$pager'
24643 passcat='$passcat'
24644 patchlevel='$patchlevel'
24645 path_sep='$path_sep'
24646 perl5='$perl5'
24647 perl='$perl'
24648 perl_patchlevel='$perl_patchlevel'
24649 perl_static_inline='$perl_static_inline'
24650 perladmin='$perladmin'
24651 perllibs='$perllibs'
24652 perlpath='$perlpath'
24653 pg='$pg'
24654 phostname='$phostname'
24655 pidtype='$pidtype'
24656 plibpth='$plibpth'
24657 pmake='$pmake'
24658 pr='$pr'
24659 prefix='$prefix'
24660 prefixexp='$prefixexp'
24661 privlib='$privlib'
24662 privlibexp='$privlibexp'
24663 procselfexe='$procselfexe'
24664 ptrsize='$ptrsize'
24665 quadkind='$quadkind'
24666 quadtype='$quadtype'
24667 randbits='$randbits'
24668 randfunc='$randfunc'
24669 random_r_proto='$random_r_proto'
24670 randseedtype='$randseedtype'
24671 ranlib='$ranlib'
24672 rd_nodata='$rd_nodata'
24673 readdir64_r_proto='$readdir64_r_proto'
24674 readdir_r_proto='$readdir_r_proto'
24675 revision='$revision'
24676 rm='$rm'
24677 rm_try='$rm_try'
24678 rmail='$rmail'
24679 run='$run'
24680 runnm='$runnm'
24681 sGMTIME_max='$sGMTIME_max'
24682 sGMTIME_min='$sGMTIME_min'
24683 sLOCALTIME_max='$sLOCALTIME_max'
24684 sLOCALTIME_min='$sLOCALTIME_min'
24685 sPRIEUldbl='$sPRIEUldbl'
24686 sPRIFUldbl='$sPRIFUldbl'
24687 sPRIGUldbl='$sPRIGUldbl'
24688 sPRIXU64='$sPRIXU64'
24689 sPRId64='$sPRId64'
24690 sPRIeldbl='$sPRIeldbl'
24691 sPRIfldbl='$sPRIfldbl'
24692 sPRIgldbl='$sPRIgldbl'
24693 sPRIi64='$sPRIi64'
24694 sPRIo64='$sPRIo64'
24695 sPRIu64='$sPRIu64'
24696 sPRIx64='$sPRIx64'
24697 sSCNfldbl='$sSCNfldbl'
24698 sched_yield='$sched_yield'
24699 scriptdir='$scriptdir'
24700 scriptdirexp='$scriptdirexp'
24701 sed='$sed'
24702 seedfunc='$seedfunc'
24703 selectminbits='$selectminbits'
24704 selecttype='$selecttype'
24705 sendmail='$sendmail'
24706 setgrent_r_proto='$setgrent_r_proto'
24707 sethostent_r_proto='$sethostent_r_proto'
24708 setlocale_r_proto='$setlocale_r_proto'
24709 setnetent_r_proto='$setnetent_r_proto'
24710 setprotoent_r_proto='$setprotoent_r_proto'
24711 setpwent_r_proto='$setpwent_r_proto'
24712 setservent_r_proto='$setservent_r_proto'
24713 sh='$sh'
24714 shar='$shar'
24715 sharpbang='$sharpbang'
24716 shmattype='$shmattype'
24717 shortsize='$shortsize'
24718 shrpenv='$shrpenv'
24719 shsharp='$shsharp'
24720 sig_count='$sig_count'
24721 sig_name='$sig_name'
24722 sig_name_init='$sig_name_init'
24723 sig_num='$sig_num'
24724 sig_num_init='$sig_num_init'
24725 sig_size='$sig_size'
24726 signal_t='$signal_t'
24727 sitearch='$sitearch'
24728 sitearchexp='$sitearchexp'
24729 sitebin='$sitebin'
24730 sitebinexp='$sitebinexp'
24731 sitehtml1dir='$sitehtml1dir'
24732 sitehtml1direxp='$sitehtml1direxp'
24733 sitehtml3dir='$sitehtml3dir'
24734 sitehtml3direxp='$sitehtml3direxp'
24735 sitelib='$sitelib'
24736 sitelib_stem='$sitelib_stem'
24737 sitelibexp='$sitelibexp'
24738 siteman1dir='$siteman1dir'
24739 siteman1direxp='$siteman1direxp'
24740 siteman3dir='$siteman3dir'
24741 siteman3direxp='$siteman3direxp'
24742 siteprefix='$siteprefix'
24743 siteprefixexp='$siteprefixexp'
24744 sitescript='$sitescript'
24745 sitescriptexp='$sitescriptexp'
24746 sizesize='$sizesize'
24747 sizetype='$sizetype'
24748 sleep='$sleep'
24749 smail='$smail'
24750 so='$so'
24751 sockethdr='$sockethdr'
24752 socketlib='$socketlib'
24753 socksizetype='$socksizetype'
24754 sort='$sort'
24755 spackage='$spackage'
24756 spitshell='$spitshell'
24757 srand48_r_proto='$srand48_r_proto'
24758 srandom_r_proto='$srandom_r_proto'
24759 src='$src'
24760 ssizetype='$ssizetype'
24761 st_ino_sign='$st_ino_sign'
24762 st_ino_size='$st_ino_size'
24763 startperl='$startperl'
24764 startsh='$startsh'
24765 static_ext='$static_ext'
24766 stdchar='$stdchar'
24767 stdio_base='$stdio_base'
24768 stdio_bufsiz='$stdio_bufsiz'
24769 stdio_cnt='$stdio_cnt'
24770 stdio_filbuf='$stdio_filbuf'
24771 stdio_ptr='$stdio_ptr'
24772 stdio_stream_array='$stdio_stream_array'
24773 strerror_r_proto='$strerror_r_proto'
24774 submit='$submit'
24775 subversion='$subversion'
24776 sysman='$sysman'
24777 sysroot='$sysroot'
24778 tail='$tail'
24779 tar='$tar'
24780 targetarch='$targetarch'
24781 targetdir='$targetdir'
24782 targetenv='$targetenv'
24783 targethost='$targethost'
24784 targetmkdir='$targetmkdir'
24785 targetport='$targetport'
24786 targetsh='$targetsh'
24787 tbl='$tbl'
24788 tee='$tee'
24789 test='$test'
24790 timeincl='$timeincl'
24791 timetype='$timetype'
24792 tmpnam_r_proto='$tmpnam_r_proto'
24793 to='$to'
24794 touch='$touch'
24795 tr='$tr'
24796 trnl='$trnl'
24797 troff='$troff'
24798 ttyname_r_proto='$ttyname_r_proto'
24799 u16size='$u16size'
24800 u16type='$u16type'
24801 u32size='$u32size'
24802 u32type='$u32type'
24803 u64size='$u64size'
24804 u64type='$u64type'
24805 u8size='$u8size'
24806 u8type='$u8type'
24807 uidformat='$uidformat'
24808 uidsign='$uidsign'
24809 uidsize='$uidsize'
24810 uidtype='$uidtype'
24811 uname='$uname'
24812 uniq='$uniq'
24813 uquadtype='$uquadtype'
24814 use5005threads='$use5005threads'
24815 use64bitall='$use64bitall'
24816 use64bitint='$use64bitint'
24817 usecbacktrace='$usecbacktrace'
24818 usecrosscompile='$usecrosscompile'
24819 usedevel='$usedevel'
24820 usedl='$usedl'
24821 usedtrace='$usedtrace'
24822 usefaststdio='$usefaststdio'
24823 useithreads='$useithreads'
24824 usekernprocpathname='$usekernprocpathname'
24825 uselargefiles='$uselargefiles'
24826 uselongdouble='$uselongdouble'
24827 usemallocwrap='$usemallocwrap'
24828 usemorebits='$usemorebits'
24829 usemultiplicity='$usemultiplicity'
24830 usemymalloc='$usemymalloc'
24831 usenm='$usenm'
24832 usensgetexecutablepath='$usensgetexecutablepath'
24833 useopcode='$useopcode'
24834 useperlio='$useperlio'
24835 useposix='$useposix'
24836 usequadmath='$usequadmath'
24837 usereentrant='$usereentrant'
24838 userelocatableinc='$userelocatableinc'
24839 useshrplib='$useshrplib'
24840 usesitecustomize='$usesitecustomize'
24841 usesocks='$usesocks'
24842 usethreads='$usethreads'
24843 usevendorprefix='$usevendorprefix'
24844 useversionedarchname='$useversionedarchname'
24845 usevfork='$usevfork'
24846 usrinc='$usrinc'
24847 uuname='$uuname'
24848 uvXUformat='$uvXUformat'
24849 uvoformat='$uvoformat'
24850 uvsize='$uvsize'
24851 uvtype='$uvtype'
24852 uvuformat='$uvuformat'
24853 uvxformat='$uvxformat'
24854 vendorarch='$vendorarch'
24855 vendorarchexp='$vendorarchexp'
24856 vendorbin='$vendorbin'
24857 vendorbinexp='$vendorbinexp'
24858 vendorhtml1dir='$vendorhtml1dir'
24859 vendorhtml1direxp='$vendorhtml1direxp'
24860 vendorhtml3dir='$vendorhtml3dir'
24861 vendorhtml3direxp='$vendorhtml3direxp'
24862 vendorlib='$vendorlib'
24863 vendorlib_stem='$vendorlib_stem'
24864 vendorlibexp='$vendorlibexp'
24865 vendorman1dir='$vendorman1dir'
24866 vendorman1direxp='$vendorman1direxp'
24867 vendorman3dir='$vendorman3dir'
24868 vendorman3direxp='$vendorman3direxp'
24869 vendorprefix='$vendorprefix'
24870 vendorprefixexp='$vendorprefixexp'
24871 vendorscript='$vendorscript'
24872 vendorscriptexp='$vendorscriptexp'
24873 version='$version'
24874 version_patchlevel_string='$version_patchlevel_string'
24875 versiononly='$versiononly'
24876 vi='$vi'
24877 xlibpth='$xlibpth'
24878 yacc='$yacc'
24879 yaccflags='$yaccflags'
24880 zcat='$zcat'
24881 zip='$zip'
24882 EOT
24883
24884 : add special variables
24885 $test -f $src/patchlevel.h && \
24886 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24887 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24888 echo "PERL_CONFIG_SH=true" >>config.sh
24889
24890 : propagate old symbols
24891 if $test -f UU/config.sh; then
24892         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24893         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24894                 config.sh config.sh UU/oldconfig.sh |\
24895                 $sort | $uniq -u >UU/oldsyms
24896         set X `$cat UU/oldsyms`
24897         shift
24898         case $# in
24899         0) ;;
24900         *)
24901                 $cat <<EOM
24902 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24903 EOM
24904                 echo ": Variables propagated from previous config.sh file." >>config.sh
24905                 for sym in `$cat UU/oldsyms`; do
24906                         echo "    Propagating $hint variable "'$'"$sym..."
24907                         eval 'tmp="$'"${sym}"'"'
24908                         echo "$tmp" | \
24909                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24910                 done
24911                 ;;
24912         esac
24913 fi
24914
24915 : preserve RCS keywords in files with variable substitution, grrr
24916 Id='$Id'
24917
24918 : Finish up by extracting the .SH files
24919 case "$alldone" in
24920 exit)
24921         echo "Stopping at your request, leaving temporary files around."
24922         exit 0
24923         ;;
24924 cont)
24925         ;;
24926 '')
24927         dflt=''
24928         nostick=true
24929         $cat <<EOM
24930
24931 If you'd like to make any changes to the config.sh file before I begin
24932 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24933
24934 EOM
24935         rp="Press return or use a shell escape to edit config.sh:"
24936         . UU/myread
24937         nostick=''
24938         case "$ans" in
24939         '') ;;
24940         *) : in case they cannot read
24941                 sh 1>&4 -c "$ans";;
24942         esac
24943         ;;
24944 esac
24945
24946 : if this fails, just run all the .SH files by hand
24947 . ./config.sh
24948
24949 echo " "
24950 exec 1>&4
24951 pwd=`pwd`
24952 . ./UU/extract
24953 cd "$pwd"
24954
24955 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24956         dflt=y
24957         case "$silent" in
24958         true) ;;
24959         *)
24960                 $cat <<EOM
24961
24962 Now you need to generate make dependencies by running "$make depend".
24963 You might prefer to run it in background: "$make depend > makedepend.out &"
24964 It can take a while, so you might not want to run it right now.
24965
24966 EOM
24967                 ;;
24968         esac
24969         rp="Run $make depend now?"
24970         . UU/myread
24971         case "$ans" in
24972         y*)
24973                 $make depend && echo "Now you must run '$make'."
24974                 ;;
24975         *)
24976                 echo "You must run '$make depend' then '$make'."
24977                 ;;
24978         esac
24979 elif test -f [Mm]akefile; then
24980         echo " "
24981         echo "Now you must run a $make."
24982 else
24983         echo "Configure done."
24984 fi
24985
24986 if $test -f Policy.sh; then
24987     $cat <<EOM
24988
24989 If you compile $package on a different machine or from a different object
24990 directory, copy the Policy.sh file from this object directory to the
24991 new one before you run Configure -- this will help you with most of
24992 the policy defaults.
24993
24994 EOM
24995 fi
24996 if $test -f UU/config.msg; then
24997     echo "Hmm.  I also noted the following information while running:"
24998     echo " "
24999     $cat UU/config.msg >&4
25000 fi
25001 $rm -f kit*isdone ark*isdone
25002 $rm -rf UU
25003
25004 : End of Configure
25005