This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
APItest/utf8.t: Some clean up
[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 may wish to get metaconfig. Perl uses a modified version of this
17 # tool, available in the "dist" folder in the checkout of the git repo
18 #    $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
19 # The original dist package (including metaconfig) is available via SVN:
20 #    $ svn co https://svn.code.sf.net/p/dist/code/trunk/dist
21 #
22 # Though this script was generated by metaconfig from metaunits, it is
23 # OK to send patches against Configure itself. It's up to the Configure
24 # pumpkin to backport the patch to the metaunits if it is accepted.
25 # For more information on patching Configure, see pod/perlhack.pod
26 #
27 # The metaunits are also available from the public git repository:
28 #     http://perl5.git.perl.org/metaconfig.git/ or
29 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
30 #
31 # See Porting/pumpkin.pod for more information on metaconfig.
32
33 # Generated using [metaconfig 3.5 PL0]
34 # (with additional metaconfig patches by perlbug@perl.org)
35
36 cat >c1$$ <<EOF
37 ARGGGHHHH!!!!!
38
39 SCO csh still thinks true is false.  Write to SCO today and tell them that next
40 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43 we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45 [End of diatribe. We now return you to your regularly scheduled programming...]
46 EOF
47 cat >c2$$ <<EOF
48
49 OOPS!  You naughty creature!  You didn't run Configure with sh!
50 I will attempt to remedy the situation by running sh for you...
51 EOF
52
53 true || cat c1$$ c2$$
54 true || exec sh $0 $argv:q
55
56 (exit $?0) || cat c2$$
57 (exit $?0) || exec sh $0 $argv:q
58 rm -f c1$$ c2$$
59
60 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61         cat <<EOF
62 ***
63 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65 *** Please read the README.plan9 for further instructions.
66 *** Cannot continue, aborting.
67 ***
68 EOF
69         exit 1
70 fi
71
72 if test -f /sys/utilities/MultiView ; then
73         # AmigaOS, test -c for /dev/null is not useful
74         :
75 elif test ! -c /dev/null ; then
76         cat <<EOF
77 ***
78 *** I'm sorry, but /dev/null appears to be a file rather than a device.
79 *** Please consult your operating sytem's notes for making a device
80 *** in /dev.
81 *** Cannot continue, aborting.
82 ***
83 EOF
84         exit 1
85 fi
86
87 : compute my invocation name
88 me=$0
89 case "$0" in
90 */*)
91         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
92         test "$me" || me=$0
93         ;;
94 esac
95
96 : Proper separator for the PATH environment variable
97 p_=:
98 : On OS/2 this directory should exist if this is not floppy only system ":-]"
99 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
100         if test -n "$OS2_SHELL"; then
101                 p_=\;
102                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
103                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
104                 is_os2=yes
105         elif test -n "$DJGPP"; then
106                 case "X${MACHTYPE:-nonesuchmach}" in
107                 *cygwin|*msys) ;;
108                 *) p_=\; ;;
109                 esac
110         fi
111 fi
112
113 : Proper PATH setting
114 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
115 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
116 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
117 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
118 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
119 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
120 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
121 paths="$paths /sbin /usr/sbin /usr/libexec"
122 paths="$paths /system/gnu_library/bin"
123
124 for p in $paths
125 do
126         case "$p_$PATH$p_" in
127         *$p_$p$p_*) ;;
128         *) test -d $p && PATH=$PATH$p_$p ;;
129         esac
130 done
131
132 PATH=.$p_$PATH
133 export PATH
134
135 : shall we be using ksh?
136 inksh=''
137 needksh=''
138 avoidksh=''
139 newsh=/bin/ksh
140 changesh=''
141 if (PATH=.; alias -x) >/dev/null 2>&1; then
142                 inksh=true
143 fi
144 if test -f /hp-ux -a -f /bin/ksh; then
145         needksh='to avoid sh bug in "here document" expansion'
146 fi
147 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
148         if test X`/usr/bin/uname -v` = X4; then
149                 avoidksh="to avoid AIX 4's /bin/sh"
150                 newsh=/usr/bin/bsh
151         fi
152 fi
153 if test -f /osf_boot -a -f /usr/sbin/setld; then
154         if test X`/usr/bin/uname -s` = XOSF1; then
155                 avoidksh="to avoid Digital UNIX' ksh"
156                 newsh=/bin/sh
157                 unset BIN_SH
158         fi
159 fi
160 case "$inksh/$needksh" in
161 /[a-z]*)
162                 ENV=''
163                 changesh=true
164                 reason="$needksh"
165         ;;
166 esac
167 case "$inksh/$avoidksh" in
168 true/[a-z]*)
169         changesh=true
170         reason="$avoidksh"
171         ;;
172 esac
173 case "$inksh/$needksh-$avoidksh-" in
174 true/--)
175                 cat <<EOM
176 (I see you are using the Korn shell.  Some ksh's blow up on $me,
177 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
178 EOM
179         ;;
180 esac
181 case "$changesh" in
182 true)
183         export newsh
184         echo "(Feeding myself to $newsh $reason.)"
185         case "$0" in
186         Configure|*/Configure) exec $newsh $0 "$@";;
187         *) exec $newsh Configure "$@";;
188         esac
189         ;;
190 esac
191 test -x "${newsh}" || unset newsh
192
193 : if needed, set CDPATH to a harmless value that is not chatty
194 : avoid bash 2.02 problems with empty CDPATH.
195 case "$CDPATH" in
196 '')     ;;
197 *)      case "$SHELL" in
198         *bash*) CDPATH='.' ;;
199         *) CDPATH='' ;;
200         esac
201         ;;
202 esac
203
204 : Configure runs within the UU subdirectory
205 test -d UU || mkdir UU
206 cd UU && rm -f ./*
207
208 ccname=''
209 ccversion=''
210 ccsymbols=''
211 cppccsymbols=''
212 cppsymbols=''
213 from=''
214 hostgenerate=''
215 hostosname=''
216 hostperl=''
217 run=''
218 targetarch=''
219 targetdir=''
220 targetenv=''
221 targethost=''
222 targetmkdir=''
223 targetport=''
224 to=''
225 usecrosscompile=''
226 extern_C=''
227 mistrustnm=''
228 usedevel=''
229 perllibs=''
230 dynamic_ext=''
231 extensions=''
232 known_extensions=''
233 nonxs_ext=''
234 static_ext=''
235 useopcode=''
236 useposix=''
237 extras=''
238 d_bsd=''
239 d_eunice=''
240 d_xenix=''
241 eunicefix=''
242 ar=''
243 awk=''
244 bash=''
245 bison=''
246 byacc=''
247 cat=''
248 chgrp=''
249 chmod=''
250 chown=''
251 comm=''
252 compress=''
253 cp=''
254 cpio=''
255 cpp=''
256 csh=''
257 date=''
258 echo=''
259 egrep=''
260 emacs=''
261 expr=''
262 find=''
263 flex=''
264 gmake=''
265 grep=''
266 gzip=''
267 inews=''
268 ksh=''
269 less=''
270 line=''
271 lint=''
272 ln=''
273 lp=''
274 lpr=''
275 ls=''
276 mail=''
277 mailx=''
278 make=''
279 mkdir=''
280 more=''
281 mv=''
282 nm=''
283 nroff=''
284 perl=''
285 pg=''
286 pmake=''
287 pr=''
288 rm=''
289 rmail=''
290 sed=''
291 sendmail=''
292 shar=''
293 sleep=''
294 smail=''
295 sort=''
296 submit=''
297 tail=''
298 tar=''
299 tbl=''
300 tee=''
301 test=''
302 touch=''
303 tr=''
304 troff=''
305 uname=''
306 uniq=''
307 uuname=''
308 vi=''
309 zcat=''
310 zip=''
311 full_ar=''
312 full_sed=''
313 libswanted=''
314 hint=''
315 myuname=''
316 osname=''
317 osvers=''
318 Author=''
319 Date=''
320 Header=''
321 Id=''
322 Locker=''
323 Log=''
324 RCSfile=''
325 Revision=''
326 Source=''
327 State=''
328 sysroot=''
329 _a=''
330 _exe=''
331 _o=''
332 archobjs=''
333 exe_ext=''
334 firstmakefile=''
335 lib_ext=''
336 obj_ext=''
337 path_sep=''
338 rm_try=''
339 afs=''
340 afsroot=''
341 alignbytes=''
342 ansi2knr=''
343 archlib=''
344 archlibexp=''
345 d_archlib=''
346 installarchlib=''
347 archname=''
348 myarchname=''
349 useversionedarchname=''
350 d_atolf=''
351 d_atoll=''
352 baserev=''
353 bin=''
354 binexp=''
355 initialinstalllocation=''
356 installbin=''
357 userelocatableinc=''
358 byteorder=''
359 cc=''
360 ccflags=''
361 cppflags=''
362 ldflags=''
363 lkflags=''
364 locincpth=''
365 optimize=''
366 cf_email=''
367 cf_by=''
368 cf_time=''
369 charbits=''
370 charsize=''
371 contains=''
372 cpp_stuff=''
373 cpplast=''
374 cppminus=''
375 cpprun=''
376 cppstdin=''
377 d__fwalk=''
378 d_access=''
379 d_accessx=''
380 d_acosh=''
381 d_aintl=''
382 d_alarm=''
383 asctime_r_proto=''
384 d_asctime_r=''
385 d_asinh=''
386 d_atanh=''
387 d_attribute_deprecated=''
388 d_attribute_format=''
389 d_attribute_malloc=''
390 d_attribute_nonnull=''
391 d_attribute_noreturn=''
392 d_attribute_pure=''
393 d_attribute_unused=''
394 d_attribute_warn_unused_result=''
395 d_printf_format_null=''
396 d_backtrace=''
397 d_bcmp=''
398 d_bcopy=''
399 d_builtin_choose_expr=''
400 d_builtin_expect=''
401 d_bzero=''
402 d_c99_variadic_macros=''
403 d_casti32=''
404 castflags=''
405 d_castneg=''
406 d_cbrt=''
407 d_chown=''
408 d_chroot=''
409 d_chsize=''
410 d_class=''
411 d_clearenv=''
412 d_closedir=''
413 d_void_closedir=''
414 d_cmsghdr_s=''
415 d_const=''
416 d_copysign=''
417 d_copysignl=''
418 d_cplusplus=''
419 cryptlib=''
420 d_crypt=''
421 crypt_r_proto=''
422 d_crypt_r=''
423 d_csh=''
424 full_csh=''
425 d_ctermid=''
426 ctermid_r_proto=''
427 d_ctermid_r=''
428 ctime_r_proto=''
429 d_ctime_r=''
430 d_cuserid=''
431 d_dbl_dig=''
432 d_dbminitproto=''
433 d_difftime=''
434 d_dir_dd_fd=''
435 d_dirfd=''
436 d_dladdr=''
437 d_dlerror=''
438 d_dlopen=''
439 d_dlsymun=''
440 d_dosuid=''
441 d_suidsafe=''
442 d_drand48_r=''
443 drand48_r_proto=''
444 d_drand48proto=''
445 d_dup2=''
446 d_eaccess=''
447 d_endgrent=''
448 d_endgrent_r=''
449 endgrent_r_proto=''
450 d_endhent=''
451 d_endhostent_r=''
452 endhostent_r_proto=''
453 d_endnent=''
454 d_endnetent_r=''
455 endnetent_r_proto=''
456 d_endpent=''
457 d_endprotoent_r=''
458 endprotoent_r_proto=''
459 d_endpwent=''
460 d_endpwent_r=''
461 endpwent_r_proto=''
462 d_endsent=''
463 d_endservent_r=''
464 endservent_r_proto=''
465 d_erf=''
466 d_erfc=''
467 d_exp2=''
468 d_expm1=''
469 d_faststdio=''
470 d_fchdir=''
471 d_fchmod=''
472 d_fchown=''
473 d_fcntl=''
474 d_fcntl_can_lock=''
475 d_fd_macros=''
476 d_fd_set=''
477 d_fds_bits=''
478 d_fdclose=''
479 d_fdim=''
480 d_fegetround=''
481 d_fgetpos=''
482 d_finite=''
483 d_finitel=''
484 d_flexfnam=''
485 d_flock=''
486 d_flockproto=''
487 d_fma=''
488 d_fmax=''
489 d_fmin=''
490 d_fork=''
491 d_fp_class=''
492 d_fp_classl=''
493 d_fpclass=''
494 d_fp_classify=''
495 d_fpclassify=''
496 d_fpclassl=''
497 d_fpgetround=''
498 d_fpos64_t=''
499 d_frexpl=''
500 d_fs_data_s=''
501 d_fseeko=''
502 d_fsetpos=''
503 d_fstatfs=''
504 d_fsync=''
505 d_ftello=''
506 d_ftime=''
507 d_gettimeod=''
508 d_futimes=''
509 d_gai_strerror=''
510 d_Gconvert=''
511 d_getaddrinfo=''
512 d_getcwd=''
513 d_getespwnam=''
514 d_getfsstat=''
515 d_getgrent=''
516 d_getgrent_r=''
517 getgrent_r_proto=''
518 d_getgrgid_r=''
519 getgrgid_r_proto=''
520 d_getgrnam_r=''
521 getgrnam_r_proto=''
522 d_getgrps=''
523 d_gethbyaddr=''
524 d_gethbyname=''
525 d_gethent=''
526 aphostname=''
527 d_gethname=''
528 d_phostname=''
529 d_uname=''
530 d_gethostbyaddr_r=''
531 gethostbyaddr_r_proto=''
532 d_gethostbyname_r=''
533 gethostbyname_r_proto=''
534 d_gethostent_r=''
535 gethostent_r_proto=''
536 d_gethostprotos=''
537 d_getitimer=''
538 d_getlogin=''
539 d_getlogin_r=''
540 getlogin_r_proto=''
541 d_getmnt=''
542 d_getmntent=''
543 d_getnameinfo=''
544 d_getnbyaddr=''
545 d_getnbyname=''
546 d_getnent=''
547 d_getnetbyaddr_r=''
548 getnetbyaddr_r_proto=''
549 d_getnetbyname_r=''
550 getnetbyname_r_proto=''
551 d_getnetent_r=''
552 getnetent_r_proto=''
553 d_getnetprotos=''
554 d_getpagsz=''
555 d_getpent=''
556 d_getpgid=''
557 d_getpgrp2=''
558 d_bsdgetpgrp=''
559 d_getpgrp=''
560 d_getppid=''
561 d_getprior=''
562 d_getpbyname=''
563 d_getpbynumber=''
564 d_getprotobyname_r=''
565 getprotobyname_r_proto=''
566 d_getprotobynumber_r=''
567 getprotobynumber_r_proto=''
568 d_getprotoent_r=''
569 getprotoent_r_proto=''
570 d_getprotoprotos=''
571 d_getprpwnam=''
572 d_getpwent=''
573 d_getpwent_r=''
574 getpwent_r_proto=''
575 d_getpwnam_r=''
576 getpwnam_r_proto=''
577 d_getpwuid_r=''
578 getpwuid_r_proto=''
579 d_getsent=''
580 d_getservbyname_r=''
581 getservbyname_r_proto=''
582 d_getservbyport_r=''
583 getservbyport_r_proto=''
584 d_getservent_r=''
585 getservent_r_proto=''
586 d_getservprotos=''
587 d_getspnam=''
588 d_getspnam_r=''
589 getspnam_r_proto=''
590 d_getsbyname=''
591 d_getsbyport=''
592 d_gmtime_r=''
593 gmtime_r_proto=''
594 d_gnulibc=''
595 gnulibc_version=''
596 d_hasmntopt=''
597 d_htonl=''
598 d_hypot=''
599 d_ilogb=''
600 d_ilogbl=''
601 d_inetaton=''
602 d_inetntop=''
603 d_inetpton=''
604 d_int64_t=''
605 d_isascii=''
606 d_isblank=''
607 d_isfinite=''
608 d_isfinitel=''
609 d_isinf=''
610 d_isinfl=''
611 d_isless=''
612 d_isnan=''
613 d_isnanl=''
614 d_isnormal=''
615 d_j0=''
616 d_j0l=''
617 d_killpg=''
618 d_lc_monetary_2008=''
619 d_lchown=''
620 d_ldbl_dig=''
621 d_lgamma=''
622 d_lgamma_r=''
623 d_libm_lib_version=''
624 d_link=''
625 d_llrint=''
626 d_llrintl=''
627 d_llround=''
628 d_llroundl=''
629 d_localtime_r=''
630 d_localtime_r_needs_tzset=''
631 localtime_r_proto=''
632 d_locconv=''
633 d_lockf=''
634 d_log1p=''
635 d_log2=''
636 d_logb=''
637 d_ldexpl=''
638 d_longdbl=''
639 longdblkind=''
640 longdblsize=''
641 d_longlong=''
642 longlongsize=''
643 d_lrint=''
644 d_lrintl=''
645 d_lround=''
646 d_lroundl=''
647 d_lseekproto=''
648 d_lstat=''
649 d_madvise=''
650 d_malloc_good_size=''
651 d_malloc_size=''
652 d_mblen=''
653 d_mbstowcs=''
654 d_mbtowc=''
655 d_memchr=''
656 d_memcmp=''
657 d_memcpy=''
658 d_memmem=''
659 d_memmove=''
660 d_memset=''
661 d_mkdir=''
662 d_mkdtemp=''
663 d_mkfifo=''
664 d_mkstemp=''
665 d_mkstemps=''
666 d_mktime=''
667 d_mmap=''
668 mmaptype=''
669 d_modfl=''
670 d_modflproto=''
671 d_mprotect=''
672 d_msg=''
673 d_msgctl=''
674 d_msgget=''
675 d_msghdr_s=''
676 d_msgrcv=''
677 d_msgsnd=''
678 d_msync=''
679 d_munmap=''
680 d_nan=''
681 d_nearbyint=''
682 d_duplocale=''
683 d_freelocale=''
684 d_newlocale=''
685 d_querylocale=''
686 d_uselocale=''
687 i_xlocale=''
688 d_nextafter=''
689 d_nexttoward=''
690 d_nice=''
691 d_nl_langinfo=''
692 d_off64_t=''
693 d_open3=''
694 d_fpathconf=''
695 d_pathconf=''
696 d_pause=''
697 d_pipe=''
698 d_poll=''
699 d_portable=''
700 d_prctl=''
701 d_prctl_set_name=''
702 d_procselfexe=''
703 procselfexe=''
704 d_old_pthread_create_joinable=''
705 old_pthread_create_joinable=''
706 d_pthread_atfork=''
707 d_pthread_attr_setscope=''
708 d_pthread_yield=''
709 d_sched_yield=''
710 sched_yield=''
711 d_ptrdiff_t=''
712 d_qgcvt=''
713 d_random_r=''
714 random_r_proto=''
715 d_readdir64_r=''
716 readdir64_r_proto=''
717 d_readdir=''
718 d_rewinddir=''
719 d_seekdir=''
720 d_telldir=''
721 d_readdir_r=''
722 readdir_r_proto=''
723 d_readlink=''
724 d_readv=''
725 d_recvmsg=''
726 d_re_comp=''
727 d_regcmp=''
728 d_regcomp=''
729 d_remainder=''
730 d_remquo=''
731 d_rename=''
732 d_rint=''
733 d_rmdir=''
734 d_round=''
735 d_safebcpy=''
736 d_safemcpy=''
737 d_sanemcmp=''
738 d_sbrkproto=''
739 d_scalbn=''
740 d_scalbnl=''
741 d_select=''
742 d_sem=''
743 d_semctl=''
744 d_semget=''
745 d_semop=''
746 d_sendmsg=''
747 d_setegid=''
748 d_seteuid=''
749 d_setgrent=''
750 d_setgrent_r=''
751 setgrent_r_proto=''
752 d_setgrps=''
753 d_sethent=''
754 d_sethostent_r=''
755 sethostent_r_proto=''
756 d_setitimer=''
757 d_setlinebuf=''
758 d_setlocale=''
759 d_setlocale_r=''
760 setlocale_r_proto=''
761 d_setnent=''
762 d_setnetent_r=''
763 setnetent_r_proto=''
764 d_setpent=''
765 d_setpgid=''
766 d_setpgrp2=''
767 d_bsdsetpgrp=''
768 d_setpgrp=''
769 d_setprior=''
770 d_setproctitle=''
771 d_setprotoent_r=''
772 setprotoent_r_proto=''
773 d_setpwent=''
774 d_setpwent_r=''
775 setpwent_r_proto=''
776 d_setregid=''
777 d_setresgid=''
778 d_setresuid=''
779 d_setreuid=''
780 d_setrgid=''
781 d_setruid=''
782 d_setsent=''
783 d_setservent_r=''
784 setservent_r_proto=''
785 d_setsid=''
786 d_setvbuf=''
787 d_shm=''
788 d_shmat=''
789 d_shmatprototype=''
790 shmattype=''
791 d_shmctl=''
792 d_shmdt=''
793 d_shmget=''
794 d_sigaction=''
795 d_siginfo_si_addr=''
796 d_siginfo_si_band=''
797 d_siginfo_si_errno=''
798 d_siginfo_si_fd=''
799 d_siginfo_si_pid=''
800 d_siginfo_si_status=''
801 d_siginfo_si_uid=''
802 d_siginfo_si_value=''
803 d_signbit=''
804 d_sigprocmask=''
805 d_sigsetjmp=''
806 usesitecustomize=''
807 d_snprintf=''
808 d_vsnprintf=''
809 d_sockatmark=''
810 d_sockatmarkproto=''
811 d_ip_mreq=''
812 d_ip_mreq_source=''
813 d_ipv6_mreq=''
814 d_ipv6_mreq_source=''
815 d_msg_ctrunc=''
816 d_msg_dontroute=''
817 d_msg_oob=''
818 d_msg_peek=''
819 d_msg_proxy=''
820 d_oldsock=''
821 d_scm_rights=''
822 d_sin6_scope_id=''
823 d_sockaddr_in6=''
824 d_sockaddr_sa_len=''
825 d_socket=''
826 d_sockpair=''
827 sockethdr=''
828 socketlib=''
829 d_socklen_t=''
830 d_socks5_init=''
831 d_sprintf_returns_strlen=''
832 d_sqrtl=''
833 d_srand48_r=''
834 srand48_r_proto=''
835 d_srandom_r=''
836 srandom_r_proto=''
837 d_sresgproto=''
838 d_sresuproto=''
839 d_stat=''
840 d_statblks=''
841 d_statfs_f_flags=''
842 d_statfs_s=''
843 d_static_inline=''
844 perl_static_inline=''
845 d_fstatvfs=''
846 d_statvfs=''
847 d_stdio_cnt_lval=''
848 d_stdio_ptr_lval=''
849 d_stdio_ptr_lval_nochange_cnt=''
850 d_stdio_ptr_lval_sets_cnt=''
851 d_stdiobase=''
852 d_stdstdio=''
853 stdio_base=''
854 stdio_bufsiz=''
855 stdio_cnt=''
856 stdio_filbuf=''
857 stdio_ptr=''
858 d_index=''
859 d_strchr=''
860 d_strcoll=''
861 d_strctcpy=''
862 d_strerrm=''
863 d_strerror=''
864 d_sysernlst=''
865 d_syserrlst=''
866 d_strerror_l=''
867 d_strerror_r=''
868 strerror_r_proto=''
869 d_strftime=''
870 d_strlcat=''
871 d_strlcpy=''
872 d_strtod=''
873 d_strtol=''
874 d_strtold=''
875 d_strtoll=''
876 d_strtoq=''
877 d_strtoul=''
878 d_strtoull=''
879 d_strtouq=''
880 d_strxfrm=''
881 d_symlink=''
882 d_syscall=''
883 d_syscallproto=''
884 d_sysconf=''
885 d_system=''
886 d_tcgetpgrp=''
887 d_tcsetpgrp=''
888 d_telldirproto=''
889 d_tgamma=''
890 d_time=''
891 timetype=''
892 d_asctime64=''
893 d_ctime64=''
894 d_difftime64=''
895 d_gmtime64=''
896 d_localtime64=''
897 d_mktime64=''
898 d_timegm=''
899 clocktype=''
900 d_times=''
901 d_tmpnam_r=''
902 tmpnam_r_proto=''
903 d_trunc=''
904 d_truncate=''
905 d_truncl=''
906 d_ttyname_r=''
907 ttyname_r_proto=''
908 d_tzname=''
909 d_u32align=''
910 d_ualarm=''
911 d_umask=''
912 d_semctl_semid_ds=''
913 d_semctl_semun=''
914 d_union_semun=''
915 d_unordered=''
916 d_unsetenv=''
917 d_usleep=''
918 d_usleepproto=''
919 d_ustat=''
920 d_pseudofork=''
921 d_vfork=''
922 usevfork=''
923 d_voidsig=''
924 signal_t=''
925 d_volatile=''
926 d_charvspr=''
927 d_vprintf=''
928 d_wait4=''
929 d_waitpid=''
930 d_wcscmp=''
931 d_wcstombs=''
932 d_wcsxfrm=''
933 d_wctomb=''
934 d_writev=''
935 dlext=''
936 bin_ELF=''
937 cccdlflags=''
938 ccdlflags=''
939 dlsrc=''
940 ld=''
941 ld_can_script=''
942 lddlflags=''
943 usedl=''
944 doublesize=''
945 dtraceobject=''
946 ebcdic=''
947 fflushNULL=''
948 fflushall=''
949 fpossize=''
950 fpostype=''
951 gccansipedantic=''
952 gccosandvers=''
953 gccversion=''
954 gidformat=''
955 gidsign=''
956 gidsize=''
957 gidtype=''
958 groupstype=''
959 h_fcntl=''
960 h_sysfile=''
961 html1dir=''
962 html1direxp=''
963 installhtml1dir=''
964 html3dir=''
965 html3direxp=''
966 installhtml3dir=''
967 i_arpainet=''
968 i_assert=''
969 i_bfd=''
970 i_crypt=''
971 db_hashtype=''
972 db_prefixtype=''
973 db_version_major=''
974 db_version_minor=''
975 db_version_patch=''
976 i_db=''
977 i_dbm=''
978 i_rpcsvcdbm=''
979 d_dirnamlen=''
980 direntrytype=''
981 i_dirent=''
982 i_dlfcn=''
983 i_execinfo=''
984 i_fcntl=''
985 i_fenv=''
986 i_float=''
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_limits=''
997 i_locale=''
998 i_machcthr=''
999 i_malloc=''
1000 i_mallocmalloc=''
1001 i_math=''
1002 i_memory=''
1003 i_mntent=''
1004 d_gdbm_ndbm_h_uses_prototypes=''
1005 d_gdbmndbm_h_uses_prototypes=''
1006 d_ndbm=''
1007 d_ndbm_h_uses_prototypes=''
1008 i_gdbm_ndbm=''
1009 i_gdbmndbm=''
1010 i_ndbm=''
1011 i_netdb=''
1012 i_neterrno=''
1013 i_netinettcp=''
1014 i_niin=''
1015 i_sysin=''
1016 i_poll=''
1017 i_prot=''
1018 i_pthread=''
1019 d_pwage=''
1020 d_pwchange=''
1021 d_pwclass=''
1022 d_pwcomment=''
1023 d_pwexpire=''
1024 d_pwgecos=''
1025 d_pwpasswd=''
1026 d_pwquota=''
1027 i_pwd=''
1028 i_quadmath=''
1029 i_shadow=''
1030 i_socks=''
1031 i_stdbool=''
1032 i_stddef=''
1033 i_stdint=''
1034 i_stdlib=''
1035 i_string=''
1036 strings=''
1037 i_sunmath=''
1038 i_sysaccess=''
1039 i_sysdir=''
1040 i_sysfile=''
1041 d_voidtty=''
1042 i_bsdioctl=''
1043 i_sysfilio=''
1044 i_sysioctl=''
1045 i_syssockio=''
1046 i_syslog=''
1047 i_sysmman=''
1048 i_sysmode=''
1049 i_sysmount=''
1050 i_sysndir=''
1051 i_sysparam=''
1052 i_syspoll=''
1053 i_sysresrc=''
1054 i_syssecrt=''
1055 i_sysselct=''
1056 i_sysstat=''
1057 i_sysstatfs=''
1058 i_sysstatvfs=''
1059 i_systimes=''
1060 i_systypes=''
1061 i_sysuio=''
1062 i_sysun=''
1063 i_sysutsname=''
1064 i_sysvfs=''
1065 i_syswait=''
1066 i_sgtty=''
1067 i_termio=''
1068 i_termios=''
1069 d_tm_tm_gmtoff=''
1070 d_tm_tm_zone=''
1071 i_systime=''
1072 i_systimek=''
1073 i_time=''
1074 timeincl=''
1075 i_unistd=''
1076 i_ustat=''
1077 i_utime=''
1078 i_values=''
1079 i_stdarg=''
1080 i_varargs=''
1081 i_varhdr=''
1082 i_vfork=''
1083 d_inc_version_list=''
1084 inc_version_list=''
1085 inc_version_list_init=''
1086 doubleinfbytes=''
1087 doublenanbytes=''
1088 longdblinfbytes=''
1089 longdblnanbytes=''
1090 installprefix=''
1091 installprefixexp=''
1092 installstyle=''
1093 installusrbinperl=''
1094 intsize=''
1095 longsize=''
1096 shortsize=''
1097 issymlink=''
1098 libc=''
1099 ldlibpthname=''
1100 libperl=''
1101 shrpenv=''
1102 useshrplib=''
1103 glibpth=''
1104 incpth=''
1105 libpth=''
1106 loclibpth=''
1107 plibpth=''
1108 xlibpth=''
1109 ignore_versioned_solibs=''
1110 libs=''
1111 libsdirs=''
1112 libsfiles=''
1113 libsfound=''
1114 libspath=''
1115 lns=''
1116 d_PRIEUldbl=''
1117 d_PRIFUldbl=''
1118 d_PRIGUldbl=''
1119 d_PRIeldbl=''
1120 d_PRIfldbl=''
1121 d_PRIgldbl=''
1122 d_SCNfldbl=''
1123 doublekind=''
1124 sPRIEUldbl=''
1125 sPRIFUldbl=''
1126 sPRIGUldbl=''
1127 sPRIeldbl=''
1128 sPRIfldbl=''
1129 sPRIgldbl=''
1130 sSCNfldbl=''
1131 lseeksize=''
1132 lseektype=''
1133 make_set_make=''
1134 d_mymalloc=''
1135 freetype=''
1136 mallocobj=''
1137 mallocsrc=''
1138 malloctype=''
1139 usemallocwrap=''
1140 usemymalloc=''
1141 installman1dir=''
1142 man1dir=''
1143 man1direxp=''
1144 man1ext=''
1145 installman3dir=''
1146 man3dir=''
1147 man3direxp=''
1148 man3ext=''
1149 doublemantbits=''
1150 longdblmantbits=''
1151 nvmantbits=''
1152 modetype=''
1153 multiarch=''
1154 mydomain=''
1155 myhostname=''
1156 phostname=''
1157 c=''
1158 n=''
1159 d_eofnblk=''
1160 eagain=''
1161 o_nonblock=''
1162 rd_nodata=''
1163 need_va_copy=''
1164 netdb_hlen_type=''
1165 netdb_host_type=''
1166 netdb_name_type=''
1167 netdb_net_type=''
1168 groupcat=''
1169 hostcat=''
1170 passcat=''
1171 orderlib=''
1172 ranlib=''
1173 d_perl_otherlibdirs=''
1174 otherlibdirs=''
1175 package=''
1176 spackage=''
1177 pager=''
1178 api_revision=''
1179 api_subversion=''
1180 api_version=''
1181 api_versionstring=''
1182 patchlevel=''
1183 perl_patchlevel=''
1184 revision=''
1185 subversion=''
1186 version=''
1187 version_patchlevel_string=''
1188 perl5=''
1189 perladmin=''
1190 perlpath=''
1191 d_nv_preserves_uv=''
1192 d_nv_zero_is_allbits_zero=''
1193 i16size=''
1194 i16type=''
1195 i32size=''
1196 i32type=''
1197 i64size=''
1198 i64type=''
1199 i8size=''
1200 i8type=''
1201 ivsize=''
1202 ivtype=''
1203 nv_overflows_integers_at=''
1204 nv_preserves_uv_bits=''
1205 nvsize=''
1206 nvtype=''
1207 u16size=''
1208 u16type=''
1209 u32size=''
1210 u32type=''
1211 u64size=''
1212 u64type=''
1213 u8size=''
1214 u8type=''
1215 uvsize=''
1216 uvtype=''
1217 ivdformat=''
1218 nvEUformat=''
1219 nvFUformat=''
1220 nvGUformat=''
1221 nveformat=''
1222 nvfformat=''
1223 nvgformat=''
1224 uvXUformat=''
1225 uvoformat=''
1226 uvuformat=''
1227 uvxformat=''
1228 pidtype=''
1229 prefix=''
1230 prefixexp=''
1231 installprivlib=''
1232 privlib=''
1233 privlibexp=''
1234 prototype=''
1235 ptrsize=''
1236 d_PRIXU64=''
1237 d_PRId64=''
1238 d_PRIi64=''
1239 d_PRIo64=''
1240 d_PRIu64=''
1241 d_PRIx64=''
1242 sPRIXU64=''
1243 sPRId64=''
1244 sPRIi64=''
1245 sPRIo64=''
1246 sPRIu64=''
1247 sPRIx64=''
1248 d_quad=''
1249 quadkind=''
1250 quadtype=''
1251 uquadtype=''
1252 drand01=''
1253 randbits=''
1254 randfunc=''
1255 randseedtype=''
1256 seedfunc=''
1257 installscript=''
1258 scriptdir=''
1259 scriptdirexp=''
1260 selectminbits=''
1261 selecttype=''
1262 sh=''
1263 targetsh=''
1264 sig_count=''
1265 sig_name=''
1266 sig_name_init=''
1267 sig_num=''
1268 sig_num_init=''
1269 sig_size=''
1270 d_sitearch=''
1271 installsitearch=''
1272 sitearch=''
1273 sitearchexp=''
1274 installsitebin=''
1275 sitebin=''
1276 sitebinexp=''
1277 installsitehtml1dir=''
1278 sitehtml1dir=''
1279 sitehtml1direxp=''
1280 installsitehtml3dir=''
1281 sitehtml3dir=''
1282 sitehtml3direxp=''
1283 installsitelib=''
1284 sitelib=''
1285 sitelib_stem=''
1286 sitelibexp=''
1287 installsiteman1dir=''
1288 siteman1dir=''
1289 siteman1direxp=''
1290 installsiteman3dir=''
1291 siteman3dir=''
1292 siteman3direxp=''
1293 siteprefix=''
1294 siteprefixexp=''
1295 installsitescript=''
1296 sitescript=''
1297 sitescriptexp=''
1298 sizesize=''
1299 sizetype=''
1300 d_libname_unique=''
1301 so=''
1302 socksizetype=''
1303 sharpbang=''
1304 shsharp=''
1305 spitshell=''
1306 src=''
1307 ssizetype=''
1308 st_ino_sign=''
1309 st_ino_size=''
1310 startperl=''
1311 startsh=''
1312 stdchar=''
1313 d_stdio_stream_array=''
1314 stdio_stream_array=''
1315 sysman=''
1316 sGMTIME_max=''
1317 sGMTIME_min=''
1318 sLOCALTIME_max=''
1319 sLOCALTIME_min=''
1320 trnl=''
1321 uidformat=''
1322 uidsign=''
1323 uidsize=''
1324 uidtype=''
1325 archname64=''
1326 use64bitall=''
1327 use64bitint=''
1328 usecbacktrace=''
1329 dtrace=''
1330 usedtrace=''
1331 usefaststdio=''
1332 usekernprocpathname=''
1333 ccflags_uselargefiles=''
1334 ldflags_uselargefiles=''
1335 libswanted_uselargefiles=''
1336 uselargefiles=''
1337 uselongdouble=''
1338 usemorebits=''
1339 usemultiplicity=''
1340 nm_opt=''
1341 nm_so_opt=''
1342 runnm=''
1343 usenm=''
1344 usensgetexecutablepath=''
1345 useperlio=''
1346 usequadmath=''
1347 usesocks=''
1348 d_oldpthreads=''
1349 use5005threads=''
1350 useithreads=''
1351 usereentrant=''
1352 usethreads=''
1353 incpath=''
1354 mips_type=''
1355 usrinc=''
1356 vaproto=''
1357 d_vendorarch=''
1358 installvendorarch=''
1359 vendorarch=''
1360 vendorarchexp=''
1361 d_vendorbin=''
1362 installvendorbin=''
1363 vendorbin=''
1364 vendorbinexp=''
1365 installvendorhtml1dir=''
1366 vendorhtml1dir=''
1367 vendorhtml1direxp=''
1368 installvendorhtml3dir=''
1369 vendorhtml3dir=''
1370 vendorhtml3direxp=''
1371 d_vendorlib=''
1372 installvendorlib=''
1373 vendorlib=''
1374 vendorlib_stem=''
1375 vendorlibexp=''
1376 installvendorman1dir=''
1377 vendorman1dir=''
1378 vendorman1direxp=''
1379 installvendorman3dir=''
1380 vendorman3dir=''
1381 vendorman3direxp=''
1382 usevendorprefix=''
1383 vendorprefix=''
1384 vendorprefixexp=''
1385 d_vendorscript=''
1386 installvendorscript=''
1387 vendorscript=''
1388 vendorscriptexp=''
1389 versiononly=''
1390 yacc=''
1391 yaccflags=''
1392 CONFIG=''
1393
1394 : Detect odd OSs
1395 define='define'
1396 undef='undef'
1397 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1398 rmlist=''
1399
1400 : We must find out about Eunice early
1401 eunicefix=':'
1402 if test -f /etc/unixtovms; then
1403         eunicefix=/etc/unixtovms
1404 fi
1405 if test -f /etc/unixtovms.exe; then
1406         eunicefix=/etc/unixtovms.exe
1407 fi
1408
1409 : Set executable suffix now -- needed before hints available
1410 if test -f "/libs/version.library"; then
1411 : Amiga OS
1412     _exe=""
1413 elif test -f "/system/gnu_library/bin/ar.pm"; then
1414 : Stratus VOS
1415     _exe=".pm"
1416 elif test -n "$DJGPP"; then
1417 : DOS DJGPP
1418     _exe=".exe"
1419 elif test -f /kern/cookiejar; then
1420 : MiNT
1421     _exe=""
1422 elif test -d c:/. -o -n "$is_os2" ; then
1423 : OS/2 or cygwin
1424     _exe=".exe"
1425 fi
1426
1427 groupstype=''
1428 i_whoami=''
1429 : Possible local include directories to search.
1430 : Set locincpth to "" in a hint file to defeat local include searches.
1431 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1432 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1433 :
1434 : no include file wanted by default
1435 inclwanted=''
1436
1437 : Enable -DEBUGGING and -DDEBUGGING from the command line
1438 EBUGGING=''
1439 DEBUGGING=''
1440
1441 : Trailing extension.  Override this in a hint file, if needed.
1442 : Extra object files, if any, needed on this platform.
1443 archobjs=''
1444 libnames=''
1445 : change the next line if compiling for Xenix/286 on Xenix/386
1446 xlibpth='/usr/lib/386 /lib/386'
1447 : Possible local library directories to search.
1448 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1449 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1450
1451 : general looking path for locating libraries
1452 glibpth="/lib /usr/lib $xlibpth"
1453 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1454 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1455 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1456 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1457
1458 : Private path used by Configure to find libraries.  Its value
1459 : is prepended to libpth. This variable takes care of special
1460 : machines, like the mips.  Usually, it should be empty.
1461 plibpth=''
1462
1463 : default library list
1464 libswanted=''
1465 : some systems want to use only the non-versioned libso:s
1466 ignore_versioned_solibs=''
1467 ccname=''
1468 ccversion=''
1469 perllibs=''
1470 : set useposix=false in your hint file to disable the POSIX extension.
1471 useposix=true
1472 : set useopcode=false in your hint file to disable the Opcode extension.
1473 useopcode=true
1474 archname64=''
1475 ccflags_uselargefiles=''
1476 ldflags_uselargefiles=''
1477 libswanted_uselargefiles=''
1478 : set usemultiplicity on the Configure command line to enable multiplicity.
1479 : set usesocks on the Configure command line to enable socks.
1480 archname=''
1481 : set usethreads on the Configure command line to enable threads.
1482 usereentrant='undef'
1483 : List of libraries we want.
1484 : If anyone needs extra -lxxx, put those in a hint file.
1485 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1486 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1487 : We probably want to search /usr/shlib before most other libraries.
1488 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1489 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1490 glibpth="/usr/shlib $glibpth"
1491 : Do not use vfork unless overridden by a hint file.
1492 usevfork=false
1493
1494 : Find the basic shell for Bourne shell scripts
1495 case "$sh" in
1496 '')
1497         case "$SYSTYPE" in
1498         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1499         *) xxx='/bin/sh';;
1500         esac
1501         if test -f "$xxx"; then
1502                 sh="$xxx"
1503         else
1504                 : Build up a list and do a single loop so we can 'break' out.
1505                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1506                 for xxx in sh bash ksh pdksh ash; do
1507                         for p in $pth; do
1508                                 try="$try ${p}/${xxx}"
1509                         done
1510                 done
1511                 for xxx in $try; do
1512                         if test -f "$xxx"; then
1513                                 sh="$xxx";
1514                                 break
1515                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1516                                 sh="$xxx";
1517                                 break
1518                         elif test -f "$xxx.exe"; then
1519                                 sh="$xxx";
1520                                 break
1521                         fi
1522                 done
1523         fi
1524         ;;
1525 esac
1526
1527 case "$sh" in
1528 '')     cat >&2 <<EOM
1529 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1530
1531 Usually it's in /bin/sh.  How did you even get this far?
1532 Please contact me (Perl Maintainers) at perlbug@perl.org and
1533 we'll try to straighten this all out.
1534 EOM
1535         exit 1
1536         ;;
1537 esac
1538
1539 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1540 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1541 targetsh=$sh
1542
1543 : see if sh knows # comments
1544 if `$sh -c '#' >/dev/null 2>&1`; then
1545         shsharp=true
1546         spitshell=cat
1547         xcat=/bin/cat
1548         test -f $xcat$_exe || xcat=/usr/bin/cat
1549         if test ! -f $xcat$_exe; then
1550                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1551                         if test -f $p/cat$_exe; then
1552                                 xcat=$p/cat
1553                                 break
1554                         fi
1555                 done
1556                 if test ! -f $xcat$_exe; then
1557                         echo "Can't find cat anywhere!"
1558                         exit 1
1559                 fi
1560         fi
1561         echo "#!$xcat" >sharp
1562         $eunicefix sharp
1563         chmod +x sharp
1564         ./sharp > today 2>/dev/null
1565         if test -s today; then
1566                 sharpbang='#!'
1567         else
1568                 echo "#! $xcat" > sharp
1569                 $eunicefix sharp
1570                 chmod +x sharp
1571                 ./sharp > today 2>/dev/null
1572                 if test -s today; then
1573                         sharpbang='#! '
1574                 else
1575                         sharpbang=': use '
1576                 fi
1577         fi
1578 else
1579         echo " "
1580         echo "Your $sh doesn't grok # comments--I will strip them later on."
1581         shsharp=false
1582         cd ..
1583         echo "exec grep -v '^[  ]*#'" >spitshell
1584         chmod +x spitshell
1585         $eunicefix spitshell
1586         spitshell=`pwd`/spitshell
1587         cd UU
1588         echo "I presume that if # doesn't work, #! won't work either!"
1589         sharpbang=': use '
1590 fi
1591 rm -f sharp today
1592
1593 : figure out how to guarantee sh startup
1594 case "$startsh" in
1595 '') startsh=${sharpbang}${sh} ;;
1596 *)
1597 esac
1598 cat >sharp <<EOSS
1599 $startsh
1600 set abc
1601 test "$?abc" != 1
1602 EOSS
1603
1604 chmod +x sharp
1605 $eunicefix sharp
1606 if ./sharp; then
1607         : echo "Yup, it does."
1608 else
1609         echo "Hmm... '$startsh' does not guarantee sh startup..."
1610         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1611 fi
1612 rm -f sharp
1613
1614 : Save command line options in file UU/cmdline.opt for later use in
1615 : generating config.sh.
1616 cat > cmdline.opt <<EOSH
1617 : Configure command line arguments.
1618 config_arg0='$0'
1619 config_args='$*'
1620 config_argc=$#
1621 EOSH
1622 argn=1
1623 args_exp=''
1624 args_sep=''
1625 for arg in "$@"; do
1626         cat >>cmdline.opt <<EOSH
1627 config_arg$argn='$arg'
1628 EOSH
1629         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1630 $arg
1631 EOC
1632         arg_exp=`cat cmdl.opt`
1633         args_exp="$args_exp$args_sep'$arg_exp'"
1634         argn=`expr $argn + 1`
1635         args_sep=' '
1636 done
1637 rm -f cmdl.opt
1638
1639 : produce awk script to parse command line options
1640 cat >options.awk <<'EOF'
1641 BEGIN {
1642         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1643
1644         len = length(optstr);
1645         for (i = 1; i <= len; i++) {
1646                 c = substr(optstr, i, 1);
1647                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1648                 if (a == ":") {
1649                         arg[c] = 1;
1650                         i++;
1651                 }
1652                 opt[c] = 1;
1653         }
1654 }
1655 {
1656         expect = 0;
1657         str = $0;
1658         if (substr(str, 1, 1) != "-") {
1659                 printf("'%s'\n", str);
1660                 next;
1661         }
1662         len = length($0);
1663         for (i = 2; i <= len; i++) {
1664                 c = substr(str, i, 1);
1665                 if (!opt[c]) {
1666                         printf("-%s\n", substr(str, i));
1667                         next;
1668                 }
1669                 printf("-%s\n", c);
1670                 if (arg[c]) {
1671                         if (i < len)
1672                                 printf("'%s'\n", substr(str, i + 1));
1673                         else
1674                                 expect = 1;
1675                         next;
1676                 }
1677         }
1678 }
1679 END {
1680         if (expect)
1681                 print "?";
1682 }
1683 EOF
1684
1685 : process the command line options
1686 set X `for arg in "$@"; do echo "X$arg"; done |
1687         sed -e s/X// | awk -f options.awk`
1688 eval "set $*"
1689 shift
1690 rm -f options.awk
1691
1692 : set up default values
1693 fastread=''
1694 reuseval=false
1695 config_sh=''
1696 alldone=''
1697 error=''
1698 silent=''
1699 extractsh=''
1700 knowitall=''
1701 rm -f optdef.sh posthint.sh
1702 cat >optdef.sh <<EOS
1703 $startsh
1704 EOS
1705
1706
1707 : option parsing
1708 while test $# -gt 0; do
1709         case "$1" in
1710         -d) shift; fastread=yes;;
1711         -e) shift; alldone=cont;;
1712         -f)
1713                 shift
1714                 cd ..
1715                 if test -r "$1"; then
1716                         config_sh="$1"
1717                 else
1718                         echo "$me: cannot read config file $1." >&2
1719                         error=true
1720                 fi
1721                 cd UU
1722                 shift;;
1723         --help|\
1724         -h) shift; error=true;;
1725         -r) shift; reuseval=true;;
1726         -s) shift; silent=true; realsilent=true;;
1727         -E) shift; alldone=exit;;
1728         -K) shift; knowitall=true;;
1729         -O) shift;;
1730         -S) shift; silent=true; extractsh=true;;
1731         -D)
1732                 shift
1733                 case "$1" in
1734                 *=)
1735                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1736                         echo "$me: ignoring -D $1" >&2
1737                         ;;
1738                 *=*) echo "$1" | \
1739                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1740                 *) echo "$1='define'" >> optdef.sh;;
1741                 esac
1742                 shift
1743                 ;;
1744         -U)
1745                 shift
1746                 case "$1" in
1747                 *=) echo "$1" >> optdef.sh;;
1748                 *=*)
1749                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1750                         echo "$me: ignoring -U $1" >&2
1751                         ;;
1752                 *) echo "$1='undef'" >> optdef.sh;;
1753                 esac
1754                 shift
1755                 ;;
1756         -A)
1757             shift
1758             xxx=''
1759             yyy="$1"
1760             zzz=''
1761             uuu=undef
1762             case "$yyy" in
1763             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1764                  case "$zzz" in
1765                  *:*) zzz='' ;;
1766                  *)   xxx=append
1767                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1768                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1769                  esac
1770                  ;;
1771             esac
1772             case "$xxx" in
1773             '')  case "$yyy" in
1774                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1775                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1776                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1777                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1778                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1779                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1780                  esac
1781                  ;;
1782             esac
1783             case "$xxx" in
1784             append)
1785                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1786             clear)
1787                 echo "$yyy=''"                  >> posthint.sh ;;
1788             define)
1789                 case "$zzz" in
1790                 '') zzz=define ;;
1791                 esac
1792                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1793             eval)
1794                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1795             prepend)
1796                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1797             undef)
1798                 case "$zzz" in
1799                 '') zzz="$uuu" ;;
1800                 esac
1801                 echo "$yyy=$zzz"                >> posthint.sh ;;
1802             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1803             esac
1804             shift
1805             ;;
1806         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1807             exit 0;;
1808         --) break;;
1809         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1810         *) break;;
1811         esac
1812 done
1813
1814 case "$error" in
1815 true)
1816         cat >&2 <<EOM
1817 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1818                  [-U symbol] [-U symbol=] [-A command:symbol...]
1819   -d : use defaults for all answers.
1820   -e : go on without questioning past the production of config.sh.
1821   -f : specify an alternate default configuration file.
1822   -h : print this help message and exit (with an error status).
1823   -r : reuse C symbols value if possible (skips costly nm extraction).
1824   -s : silent mode, only echoes questions and essential information.
1825   -D : define symbol to have some value:
1826          -D symbol         symbol gets the value 'define'
1827          -D symbol=value   symbol gets the value 'value'
1828        common used examples (see INSTALL for more info):
1829          -Duse64bitint            use 64bit integers
1830          -Duse64bitall            use 64bit integers and pointers
1831          -Dusethreads             use thread support
1832          -Dinc_version_list=none  do not include older perl trees in @INC
1833          -DEBUGGING=none          DEBUGGING options
1834          -Dcc=gcc                 choose your compiler
1835          -Dprefix=/opt/perl5      choose your destination
1836   -E : stop at the end of questions, after having produced config.sh.
1837   -K : do not use unless you know what you are doing.
1838   -O : ignored for backward compatibility
1839   -S : perform variable substitutions on all .SH files (can mix with -f)
1840   -U : undefine symbol:
1841          -U symbol    symbol gets the value 'undef'
1842          -U symbol=   symbol gets completely empty
1843        e.g.:  -Uversiononly
1844   -A : manipulate symbol after the platform specific hints have been applied:
1845          -A append:symbol=value   append value to symbol
1846          -A symbol=value          like append:, but with a separating space
1847          -A define:symbol=value   define symbol to have value
1848          -A clear:symbol          define symbol to be ''
1849          -A define:symbol         define symbol to be 'define'
1850          -A eval:symbol=value     define symbol to be eval of value
1851          -A prepend:symbol=value  prepend value to symbol
1852          -A undef:symbol          define symbol to be 'undef'
1853          -A undef:symbol=         define symbol to be ''
1854        e.g.:  -A prepend:libswanted='cl pthread '
1855               -A ccflags=-DSOME_MACRO
1856   -V : print version number and exit (with a zero status).
1857 EOM
1858         exit 1
1859         ;;
1860 esac
1861
1862 : Sanity checks
1863 case "$fastread$alldone" in
1864 yescont|yesexit) ;;
1865 *)
1866         case "$extractsh" in
1867         true) ;;
1868         *)
1869                 if test ! -t 0; then
1870                         echo "Say 'sh Configure', not 'sh <Configure'"
1871                         exit 1
1872                 fi
1873                 ;;
1874         esac
1875         ;;
1876 esac
1877
1878 exec 4>&1
1879 case "$silent" in
1880 true) exec 1>/dev/null;;
1881 esac
1882
1883 : run the defines and the undefines, if any, but leave the file out there...
1884 touch optdef.sh
1885 grep '\\' optdef.sh >/dev/null 2>&1
1886 if test $? = 0; then
1887     echo "Configure does not support \\ in -D arguments"
1888     exit 1
1889 fi
1890 . ./optdef.sh
1891 : create the posthint manipulation script and leave the file out there...
1892 touch posthint.sh
1893
1894 : set package name
1895 package='perl5'
1896 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1897 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1898 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1899 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1900 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1901 esac
1902
1903 : Some greps do not return status, grrr.
1904 echo "grimblepritz" >grimble
1905 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1906         contains=contains
1907 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1908         contains=grep
1909 else
1910         contains=contains
1911 fi
1912 rm -f grimble
1913 : the following should work in any shell
1914 case "$contains" in
1915 contains*)
1916         echo " "
1917         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1918         cat >contains <<'EOSS'
1919 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1920 EOSS
1921 chmod +x contains
1922 esac
1923
1924 : Find the path to the source tree
1925 case "$src" in
1926 '') case "$0" in
1927     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1928          case "$src" in
1929          /*)    ;;
1930          .)     ;;
1931          *)     src=`cd ../$src && pwd` ;;
1932          esac
1933          ;;
1934     *)   src='.';;
1935     esac;;
1936 esac
1937 case "$src" in
1938 '')     src=/
1939         rsrc=/
1940         ;;
1941 /*)     rsrc="$src";;
1942 *)      rsrc="../$src";;
1943 esac
1944 if test -f $rsrc/Configure && \
1945         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1946 then
1947    : found it, so we are ok.
1948 else
1949         rsrc=''
1950         for src in . .. ../.. ../../.. ../../../..; do
1951                 if test -f ../$src/Configure && \
1952                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1953                 then
1954                         rsrc=../$src
1955                         break
1956                 fi
1957         done
1958 fi
1959 case "$rsrc" in
1960 '')
1961         cat <<EOM >&4
1962
1963 Sorry, I can't seem to locate the source dir for $package.  Please start
1964 Configure with an explicit path -- i.e. /some/path/Configure.
1965
1966 EOM
1967         exit 1
1968         ;;
1969 ../.)   rsrc='..';;
1970 *)
1971         echo " "
1972         echo "Sources for $package found in \"$src\"." >&4
1973         ;;
1974 esac
1975
1976 : script used to extract .SH files with variable substitutions
1977 cat >extract <<'EOS'
1978 PERL_CONFIG_SH=true
1979 echo "Doing variable substitutions on .SH files..."
1980 if test -f MANIFEST; then
1981         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1982 else
1983         echo "(Looking for .SH files under the source directory.)"
1984         set x `(cd "$src"; find . -name "*.SH" -print)`
1985 fi
1986 shift
1987 case $# in
1988 0) set x `(cd "$src"; echo *.SH)`; shift;;
1989 esac
1990 if test ! -f "$src/$1"; then
1991         shift
1992 fi
1993 mkdir_p='
1994 name=$1;
1995 create="";
1996 while test $name; do
1997         if test ! -d "$name"; then
1998                 create="$name $create";
1999                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2000                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2001         else
2002                 name="";
2003         fi;
2004 done;
2005 for file in $create; do
2006         mkdir $file;
2007 done
2008 '
2009 for file in $*; do
2010         case "$src" in
2011         ".")
2012                 case "$file" in
2013                 */*)
2014                         dir=`expr X$file : 'X\(.*\)/'`
2015                         file=`expr X$file : 'X.*/\(.*\)'`
2016                         (cd "$dir" && . ./$file)
2017                         ;;
2018                 *)
2019                         . ./$file
2020                         ;;
2021                 esac
2022                 ;;
2023         *)
2024                 case "$file" in
2025                 */*)
2026                         dir=`expr X$file : 'X\(.*\)/'`
2027                         file=`expr X$file : 'X.*/\(.*\)'`
2028                         (set x $dir; shift; eval $mkdir_p)
2029                         sh <"$src/$dir/$file"
2030                         ;;
2031                 *)
2032                         sh <"$src/$file"
2033                         ;;
2034                 esac
2035                 ;;
2036         esac
2037 done
2038 if test -f "$src/config_h.SH"; then
2039         if test ! -f config.h; then
2040         : oops, they left it out of MANIFEST, probably, so do it anyway.
2041         . "$src/config_h.SH"
2042         fi
2043 fi
2044 EOS
2045
2046 : extract files and exit if asked to do so
2047 case "$extractsh" in
2048 true)
2049         case "$realsilent" in
2050         true) ;;
2051         *) exec 1>&4;;
2052         esac
2053         case "$config_sh" in
2054         '') config_sh='config.sh';;
2055         esac
2056         echo " "
2057         echo "Fetching answers from $config_sh..."
2058         cd ..
2059         . $config_sh
2060         . UU/optdef.sh
2061         echo " "
2062         . UU/extract
2063         rm -rf UU
2064         echo "Extraction done."
2065         exit 0
2066         ;;
2067 esac
2068
2069 : Eunice requires " " instead of "", can you believe it
2070 echo " "
2071 : Here we go...
2072 echo "Beginning of configuration questions for $package."
2073
2074 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2075
2076 : first determine how to suppress newline on echo command
2077 echo " "
2078 echo "Checking echo to see how to suppress newlines..."
2079 (echo "hi there\c" ; echo " ") >.echotmp
2080 if $contains c .echotmp >/dev/null 2>&1 ; then
2081         echo "...using -n."
2082         n='-n'
2083         c=''
2084 else
2085         cat <<'EOM'
2086 ...using \c
2087 EOM
2088         n=''
2089         c='\c'
2090 fi
2091 echo $n "The star should be here-->$c"
2092 echo '*'
2093 rm -f .echotmp
2094
2095 : Now test for existence of everything in MANIFEST
2096 echo " "
2097 if test -f "$rsrc/MANIFEST"; then
2098         echo "First let's make sure your kit is complete.  Checking..." >&4
2099         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2100                 (split -l 50 2>/dev/null || split -50)
2101         rm -f missing
2102         tmppwd=`pwd`
2103         for filelist in x??; do
2104                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2105                         >/dev/null 2>>"$tmppwd/missing")
2106         done
2107         if test -s missing; then
2108                 cat missing >&4
2109                 cat >&4 <<'EOM'
2110
2111 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2112
2113 You have the option of continuing the configuration process, despite the
2114 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2115 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2116 and contact the author (perlbug@perl.org).
2117
2118 EOM
2119                 echo $n "Continue? [n] $c" >&4
2120                 read ans
2121                 case "$ans" in
2122                 y*)
2123                         echo "Continuing..." >&4
2124                         rm -f missing
2125                         ;;
2126                 *)
2127                         echo "ABORTING..." >&4
2128                         kill $$
2129                         ;;
2130                 esac
2131         else
2132                 echo "Looks good..."
2133         fi
2134 else
2135         echo "There is no MANIFEST file.  I hope your kit is complete !"
2136 fi
2137 rm -f missing x??
2138
2139 : Find the appropriate value for a newline for tr
2140 if test -n "$DJGPP"; then
2141        trnl='\012'
2142 fi
2143 if test X"$trnl" = X; then
2144         case "`echo foo | tr '\n' x 2>/dev/null`" in
2145         foox) trnl='\n' ;;
2146         esac
2147 fi
2148 if test X"$trnl" = X; then
2149         case "`echo foo | tr '\012' x 2>/dev/null`" in
2150         foox) trnl='\012' ;;
2151         esac
2152 fi
2153 if test X"$trnl" = X; then
2154        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2155        fooxy) trnl='\n\r' ;;
2156        esac
2157 fi
2158 if test X"$trnl" = X; then
2159         cat <<EOM >&2
2160
2161 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2162
2163 EOM
2164         exit 1
2165 fi
2166
2167 : compute the number of columns on the terminal for proper question formatting
2168 case "$COLUMNS" in
2169 '') COLUMNS='80';;
2170 esac
2171
2172 : set up the echo used in my read
2173 myecho="case \"\$xxxm\" in
2174 '') echo $n \"\$rp $c\" >&4;;
2175 *) case \"\$rp\" in
2176         '') echo $n \"[\$xxxm] $c\";;
2177         *)
2178                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2179                         echo \"\$rp\" >&4
2180                         echo $n \"[\$xxxm] $c\" >&4
2181                 else
2182                         echo $n \"\$rp [\$xxxm] $c\" >&4
2183                 fi
2184                 ;;
2185         esac;;
2186 esac"
2187
2188 : now set up to do reads with possible shell escape and default assignment
2189 cat <<EOSC >myread
2190 $startsh
2191 xxxm=\$dflt
2192 $myecho
2193 ans='!'
2194 case "\$fastread" in
2195 yes) case "\$dflt" in
2196         '') ;;
2197         *) ans='';
2198                 case "\$silent-\$rp" in
2199                 true-) ;;
2200                 *) echo " " >&4;;
2201                 esac;;
2202         esac;;
2203 *) case "\$silent" in
2204         true) case "\$rp" in
2205                 '') ans='';;
2206                 esac;;
2207         esac;;
2208 esac
2209 while expr "X\$ans" : "X!" >/dev/null; do
2210         read answ
2211         set x \$xxxm
2212         shift
2213         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2214         case  "\$answ" in
2215         "!")
2216                 sh 1>&4
2217                 echo " "
2218                 $myecho
2219                 ;;
2220         !*)
2221                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2222                 shift
2223                 sh 1>&4 -c "\$*"
2224                 echo " "
2225                 $myecho
2226                 ;;
2227         "\$ans")
2228                 case "\$ans" in
2229                 \\&*)
2230                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2231                         shift
2232                         case "\$1" in
2233                         -d)
2234                                 fastread=yes
2235                                 echo "(OK, I'll run with -d after this question.)" >&4
2236                                 ;;
2237                         -*)
2238                                 echo "*** Sorry, \$1 not supported yet." >&4
2239                                 ;;
2240                         esac
2241                         $myecho
2242                         ans=!
2243                         ;;
2244                 esac;;
2245         *)
2246                 case "\$aok" in
2247                 y)
2248                         echo "*** Substitution done -- please confirm."
2249                         xxxm="\$ans"
2250                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2251                         xxxm="\$ans"
2252                         ans=!
2253                         ;;
2254                 *)
2255                         echo "*** Error -- try again."
2256                         ans=!
2257                         ;;
2258                 esac
2259                 $myecho
2260                 ;;
2261         esac
2262         case "\$ans\$xxxm\$nostick" in
2263         '')
2264                 ans=!
2265                 $myecho
2266                 ;;
2267         esac
2268 done
2269 case "\$ans" in
2270 '') ans="\$xxxm";;
2271 esac
2272 EOSC
2273
2274 : create .config dir to save info across Configure sessions
2275 test -d ../.config || mkdir ../.config
2276 cat >../.config/README <<EOF
2277 This directory created by Configure to save information that should
2278 persist across sessions for $package.
2279
2280 You may safely delete it if you wish.
2281 EOF
2282
2283 : See if we are using a devel version and want that
2284 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2285 case "$usedevel" in
2286 $define|true|[yY]*)
2287     usedevel="$define" ;;
2288 *) case "$xversion" in
2289    *[13579])
2290         cat >&4 <<EOH
2291 *** WHOA THERE!!! ***
2292
2293     This is an UNSTABLE DEVELOPMENT release.
2294     The version of this $package distribution is $xversion, that is, odd,
2295     (as opposed to even) and that signifies a development release.
2296     If you want a maintenance release, you want an even-numbered version.
2297
2298     Do ***NOT*** install this into production use.
2299     Data corruption and crashes are possible.
2300
2301     It is most seriously suggested that you do not continue any further
2302     unless you want to help in developing and debugging Perl.
2303
2304     If you *still* want to build perl, you can answer 'y' now,
2305     or pass -Dusedevel to Configure.
2306
2307 EOH
2308         rp='Do you really want to continue?'
2309         dflt='n'
2310         . ./myread
2311         case "$ans" in
2312         [yY]) echo >&4 "Okay, continuing."
2313               usedevel="$define" ;;
2314         *) echo >&4 "Okay, bye."
2315            exit 1
2316            ;;
2317         esac
2318         ;;
2319     esac
2320     usedevel="$undef"
2321     ;;
2322 esac
2323 case "$usedevel" in
2324 $define|true|[yY]*)
2325         case "$versiononly" in
2326         '') versiononly="$define" ;;
2327         esac
2328         case "$installusrbinperl" in
2329         '') installusrbinperl="$undef" ;;
2330         esac
2331         ;;
2332 esac
2333
2334 : general instructions
2335 needman=true
2336 firsttime=true
2337 user=`(logname) 2>/dev/null`
2338 case "$user" in
2339 '') user=`whoami 2>&1`;;
2340 esac
2341 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2342         firsttime=false
2343         echo " "
2344         rp='Would you like to see the instructions?'
2345         dflt=n
2346         . ./myread
2347         case "$ans" in
2348         [yY]*) ;;
2349         *) needman=false;;
2350         esac
2351 fi
2352 if $needman; then
2353         cat <<EOH
2354
2355 This installation shell script will examine your system and ask you questions
2356 to determine how the perl5 package should be installed. If you get
2357 stuck on a question, you may use a ! shell escape to start a subshell or
2358 execute a command.  Many of the questions will have default answers in square
2359 brackets; typing carriage return will give you the default.
2360
2361 On some of the questions which ask for file or directory names you are allowed
2362 to use the ~name construct to specify the login directory belonging to "name",
2363 even if you don't have a shell which knows about that.  Questions where this is
2364 allowed will be marked "(~name ok)".
2365
2366 EOH
2367         rp=''
2368         dflt='Type carriage return to continue'
2369         . ./myread
2370         cat <<'EOH'
2371
2372 The prompter used in this script allows you to use shell variables and
2373 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2374 in the default answer, as if the default line was a set of arguments given to a
2375 script shell.  This means you may also use $* to repeat the whole default line,
2376 so you do not have to re-type everything to add something to the default.
2377
2378 Every time there is a substitution, you will have to confirm.  If there is an
2379 error (e.g. an unmatched backtick), the default answer will remain unchanged
2380 and you will be prompted again.
2381
2382 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2383 the questions and use the computed defaults (or the previous answers if there
2384 was already a config.sh file). Type 'Configure -h' for a list of options.
2385 You may also start interactively and then answer '& -d' at any prompt to turn
2386 on the non-interactive behaviour for the remainder of the execution.
2387
2388 EOH
2389         . ./myread
2390         cat <<EOH
2391
2392 Much effort has been expended to ensure that this shell script will run on any
2393 Unix system.  If despite that it blows up on yours, your best bet is to edit
2394 Configure and run it again.  If you can't run Configure for some reason,
2395 you'll have to generate a config.sh file by hand.  Whatever problems you
2396 have, let me (perlbug@perl.org) know how I blew it.
2397
2398 This installation script affects things in two ways:
2399
2400 1) it may do direct variable substitutions on some of the files included
2401    in this kit.
2402 2) it builds a config.h file for inclusion in C programs.  You may edit
2403    any of these files as the need arises after running this script.
2404
2405 If you make a mistake on a question, there is no easy way to back up to it
2406 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2407 files.  Configure will offer to let you do this before it runs the SH files.
2408
2409 EOH
2410         dflt='Type carriage return to continue'
2411         . ./myread
2412         case "$firsttime" in
2413         true) echo $user >>../.config/instruct;;
2414         esac
2415 fi
2416
2417 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2418 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2419 if test "X$sysroot" = X; then
2420     sysroot=""
2421 else
2422     case "$cc" in
2423         *gcc*|*g++*)
2424             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2425             # _sysroot is used in places where we need --sysroot=foo
2426             # but using the rest of the flags could cause issues.
2427             _sysroot="--sysroot=$sysroot";
2428             case "$ccflags" in
2429                 *sysroot*) ;;
2430                 'undef'|*)
2431                 ccflags="$ccflags $_sysroot"
2432             esac
2433             case "$ldflags" in
2434                 *sysroot*) ;;
2435                 'undef'|*)
2436                 ldflags="$ldflags $_sysroot"
2437             esac
2438             case "$cppflags" in
2439                 *sysroot*) ;;
2440                 'undef'|*)
2441                 cppflags="$cppflags $_sysroot"
2442             esac
2443             # lddlflags updated below in lddlflags section;
2444             # same with cccdlflags
2445             ;;
2446     esac
2447
2448     # Adjust some defaults to also use $sysroot
2449     for var in xlibpth loclibpth locincpth glibpth; do
2450         eval xxx=\$$var
2451         eval $var=''
2452         for path in $xxx; do
2453             eval $var=\"\$$var $sysroot$path\"
2454         done
2455     done
2456
2457 fi
2458
2459 : find out where common programs are
2460 echo " "
2461 echo "Locating common programs..." >&4
2462 cat <<EOSC >loc
2463 $startsh
2464 case \$# in
2465 0) exit 1;;
2466 esac
2467 thing=\$1
2468 shift
2469 dflt=\$1
2470 shift
2471 for dir in \$*; do
2472         case "\$thing" in
2473         .)
2474         if test -d \$dir/\$thing; then
2475                 echo \$dir
2476                 exit 0
2477         fi
2478         ;;
2479         *)
2480         for thisthing in \$dir/\$thing; do
2481                 : just loop through to pick last item
2482         done
2483         if test -f \$thisthing; then
2484                 echo \$thisthing
2485                 exit 0
2486         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2487                 echo \$thisthing
2488                 exit 0
2489         elif test -f \$dir/\$thing.exe; then
2490                 if test -n "$DJGPP"; then
2491                         echo \$dir/\$thing.exe
2492                 elif test "$eunicefix" != ":"; then
2493                         : on Eunice apparently
2494                         echo \$dir/\$thing
2495                 fi
2496                 exit 0
2497         fi
2498         ;;
2499         esac
2500 done
2501 echo \$dflt
2502 exit 1
2503 EOSC
2504 chmod +x loc
2505 $eunicefix loc
2506 loclist="
2507 awk
2508 cat
2509 chmod
2510 comm
2511 cp
2512 echo
2513 expr
2514 grep
2515 ls
2516 mkdir
2517 rm
2518 sed
2519 sort
2520 touch
2521 tr
2522 uniq
2523 "
2524 trylist="
2525 ar
2526 bison
2527 byacc
2528 cpp
2529 csh
2530 date
2531 egrep
2532 gmake
2533 gzip
2534 less
2535 ln
2536 make
2537 more
2538 nm
2539 nroff
2540 perl
2541 pg
2542 test
2543 uname
2544 zip
2545 "
2546 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2547 pth="$pth $sysroot/lib $sysroot/usr/lib"
2548 for file in $loclist; do
2549         eval xxx=\$$file
2550         case "$xxx" in
2551         /*|?:[\\/]*)
2552                 if test -f "$xxx"; then
2553                         : ok
2554                 else
2555                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2556                         xxx=`./loc $file $file $pth`
2557                 fi
2558                 ;;
2559         '') xxx=`./loc $file $file $pth`;;
2560         *) xxx=`./loc $xxx $xxx $pth`;;
2561         esac
2562         eval $file=$xxx$_exe
2563         eval _$file=$xxx
2564         case "$xxx" in
2565         /*)
2566                 echo $file is in $xxx.
2567                 ;;
2568         ?:[\\/]*)
2569                 echo $file is in $xxx.
2570                 ;;
2571         *)
2572                 echo "I don't know where '$file' is, and my life depends on it." >&4
2573                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2574                 exit 1
2575                 ;;
2576         esac
2577 done
2578 echo " "
2579 echo "Don't worry if any of the following aren't found..."
2580 say=offhand
2581 for file in $trylist; do
2582         eval xxx=\$$file
2583         case "$xxx" in
2584         /*|?:[\\/]*)
2585                 if test -f "$xxx"; then
2586                         : ok
2587                 else
2588                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2589                         xxx=`./loc $file $file $pth`
2590                 fi
2591                 ;;
2592         '') xxx=`./loc $file $file $pth`;;
2593         *) xxx=`./loc $xxx $xxx $pth`;;
2594         esac
2595         eval $file=$xxx$_exe
2596         eval _$file=$xxx
2597         case "$xxx" in
2598         /*)
2599                 echo $file is in $xxx.
2600                 ;;
2601         ?:[\\/]*)
2602                 echo $file is in $xxx.
2603                 ;;
2604         *)
2605                 echo "I don't see $file out there, $say."
2606                 say=either
2607                 ;;
2608         esac
2609 done
2610 case "$egrep" in
2611 egrep)
2612         echo "Substituting grep for egrep."
2613         egrep=$grep
2614         _egrep=$grep
2615         ;;
2616 esac
2617 case "$less" in
2618 '')     ;;
2619 *)      if $less -R </dev/null >/dev/null 2>&1; then
2620                echo "Substituting less -R for less."
2621                less="$less -R"
2622                _less=$less
2623         fi
2624         ;;
2625 esac
2626 case "$ln" in
2627 ln)
2628         echo "Substituting cp for ln."
2629         ln=$cp
2630         _ln=$cp
2631         ;;
2632 esac
2633 case "$make" in
2634 make)
2635         case "$gmake" in
2636         gmake)
2637         echo "I can't find make or gmake, and my life depends on it." >&4
2638         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2639         exit 1
2640         ;;
2641         esac
2642         ;;
2643 esac
2644 case "$gmake" in
2645 gmake)  ;;
2646 *)      # We can't have osname yet.
2647         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2648                 # Assume that gmake, if found, is definitely GNU make
2649                 # and prefer it over the system make.
2650                 echo "Substituting gmake for make."
2651                 make=$gmake
2652                 _make=$gmake
2653         fi
2654         ;;
2655 esac
2656 case "$test" in
2657 test)
2658         echo "Hopefully test is built into your sh."
2659         ;;
2660 *)
2661         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2662                 echo "Using the test built into your sh."
2663                 test=test
2664                 _test=test
2665         fi
2666         ;;
2667 esac
2668 case "$echo" in
2669 echo)
2670         echo "Hopefully echo is built into your sh."
2671         ;;
2672 '') ;;
2673 *)
2674         echo " "
2675 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2676         $echo $n "hi there$c" >foo1
2677         echo $n "hi there$c" >foo2
2678         if cmp foo1 foo2 >/dev/null 2>&1; then
2679                 echo "They are compatible.  In fact, they may be identical."
2680         else
2681                 case "$n" in
2682                 '-n') n='' c='\c';;
2683                 *) n='-n' c='';;
2684                 esac
2685                 cat <<FOO
2686 They are not compatible!  You are probably running ksh on a non-USG system.
2687 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2688 have echo built in and we may have to run some Bourne shell scripts.  That
2689 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2690
2691 FOO
2692                 $echo $n "The star should be here-->$c"
2693                 $echo "*"
2694         fi
2695         $rm -f foo1 foo2
2696         ;;
2697 esac
2698
2699 # This question was auctioned at YAPC::Europe-2007 in Vienna
2700 # I never promised you could answer it. I only auctioned the question.
2701 cat <<FOO
2702 The following message is sponsored by
2703
2704   Dresden.pm<--The stars should be here.
2705
2706 Dear Perl user, system administrator or package
2707 maintainer, the Perl community sends greetings to
2708 you. Do you (emblematical) greet back [Y/n]? n
2709
2710 FOO
2711
2712 : Check what type of C compiler we use
2713 cat <<EOS >trygcc
2714 $startsh
2715 EOS
2716 cat <<'EOSC' >>trygcc
2717 case "$cc" in
2718 '') ;;
2719 *)  $rm -f try try.*
2720     $cat >try.c <<EOM
2721 int main(int argc, char *argv[]) {
2722   return 0;
2723 }
2724 EOM
2725     if $cc -o try $ccflags $ldflags try.c; then
2726        :
2727     else
2728         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2729         despair=yes
2730         trygcc=yes
2731         case "$cc" in
2732         *gcc*) trygcc=no ;;
2733         esac
2734         # Skip this test because it gives a false match on output like:
2735         #    ./trygcc: line 23: cc: command not found
2736         # case "`$cc -v -c try.c 2>&1`" in
2737         # *gcc*) trygcc=no ;;
2738         # esac
2739         if $test X"$trygcc" = Xyes; then
2740             if gcc -o try -c try.c; then
2741                 echo " "
2742                 echo "You seem to have a working gcc, though." >&4
2743                 # Switching compilers may undo the work of hints files.
2744                 # The most common problem is -D_REENTRANT for threads.
2745                 # This heuristic catches that case, but gets false positives
2746                 # if -Dusethreads was not actually specified.  Better to
2747                 # bail out here with a useful message than fail
2748                 # mysteriously later. Should we perhaps just try to
2749                 # re-invoke Configure -Dcc=gcc config_args ?
2750                 if $test -f usethreads.cbu; then
2751                         $cat >&4 <<EOM
2752
2753 *** However, any setting of the C compiler flags (e.g. for thread support)
2754 *** will be lost.  It may be necessary for you to restart Configure and
2755 *** add -Dcc=gcc to your Configure command line.
2756
2757 EOM
2758                         rp="Would you like to go ahead and try gcc anyway?"
2759                         dflt=n
2760                 else
2761                         rp="Would you like to use it?"
2762                         dflt=y
2763                 fi
2764                 if $test -f myread; then
2765                     . ./myread
2766                 else
2767                     if $test -f UU/myread; then
2768                         . ./UU/myread
2769                     else
2770                         echo "Cannot find myread, sorry.  Aborting." >&2
2771                         exit 1
2772                     fi
2773                 fi
2774                 case "$ans" in
2775                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2776                 esac
2777             fi
2778         fi
2779     fi
2780     $rm -f try try.*
2781     ;;
2782 esac
2783 EOSC
2784
2785 cat <<EOS >checkcc
2786 $startsh
2787 EOS
2788 cat <<'EOSC' >>checkcc
2789 case "$cc" in
2790 '') ;;
2791 *)  $rm -f try try.*
2792     $cat >try.c <<EOM
2793 int main(int argc, char *argv[]) {
2794   return 0;
2795 }
2796 EOM
2797     if $cc -o try $ccflags $ldflags try.c; then
2798        :
2799     else
2800         if $test X"$despair" = Xyes; then
2801            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2802         fi
2803         $cat >&4 <<EOM
2804 You need to find a working C compiler.
2805 Either (purchase and) install the C compiler supplied by your OS vendor,
2806 or for a free C compiler try http://gcc.gnu.org/
2807 I cannot continue any further, aborting.
2808 EOM
2809         exit 1
2810     fi
2811     $rm -f try try.*
2812     ;;
2813 esac
2814 EOSC
2815
2816 : determine whether symbolic links are supported
2817 echo " "
2818 $touch blurfl
2819 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2820         echo "Symbolic links are supported." >&4
2821         lns="$ln -s"
2822 else
2823         echo "Symbolic links are NOT supported." >&4
2824         lns="$ln"
2825 fi
2826 $rm -f blurfl sym
2827
2828 : determine whether symbolic links are supported
2829 echo " "
2830 case "$lns" in
2831 *"ln"*" -s")
2832         echo "Checking how to test for symbolic links..." >&4
2833         $lns blurfl sym
2834         if $test "X$issymlink" = X; then
2835                 case "$newsh" in
2836                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2837                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2838                 esac
2839                 if test $? = 0; then
2840                         issymlink="test -h"
2841                 else
2842                         echo "Your builtin 'test -h' may be broken." >&4
2843                         case "$test" in
2844                         /*)     ;;
2845                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2846                                 for p in $pth
2847                                 do
2848                                         if test -f "$p/$test"; then
2849                                                 test="$p/$test"
2850                                                 break
2851                                         fi
2852                                 done
2853                                 ;;
2854                         esac
2855                         case "$test" in
2856                         /*)
2857                                 echo "Trying external '$test -h'." >&4
2858                                 issymlink="$test -h"
2859                                 if $test ! -h sym >/dev/null 2>&1; then
2860                                         echo "External '$test -h' is broken, too." >&4
2861                                         issymlink=''
2862                                 fi
2863                                 ;;
2864                         *)      issymlink='' ;;
2865                         esac
2866                 fi
2867         fi
2868         if $test "X$issymlink" = X; then
2869                 if $test -L sym 2>/dev/null; then
2870                         issymlink="$test -L"
2871                         echo "The builtin '$test -L' worked." >&4
2872                 fi
2873         fi
2874         if $test "X$issymlink" != X; then
2875                 echo "You can test for symbolic links with '$issymlink'." >&4
2876         else
2877                 echo "I do not know how you can test for symbolic links." >&4
2878         fi
2879         $rm -f blurfl sym
2880         ;;
2881 *)      echo "No symbolic links, so not testing for their testing..." >&4
2882         ;;
2883 esac
2884 echo " "
2885
2886 : Make symlinks util
2887 case "$mksymlinks" in
2888 $define|true|[yY]*)
2889         case "$src" in
2890         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2891                 exit 1
2892                 ;;
2893         *)      case "$lns:$issymlink" in
2894                 *"ln"*" -s:"*"test -"?)
2895                         echo "Creating the symbolic links..." >&4
2896                         cd ..
2897                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2898                         awk 'NF == 1 {
2899                                 dir=".";
2900                                 file=$1 "";
2901                              }
2902                              NF == 2 {
2903                                 dir=$1 "";
2904                                 file=$2 "";
2905                              }
2906                              {
2907                                  print "# dir = ", dir, "file = ", file
2908                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2909                              } END {
2910                                  for (d in mf) {
2911                                      if (d != ".") { print("mkdir -p "d) }
2912                                      print("ln -sf "mf[d]" "d);
2913                                  }
2914                              }' source="$src" > UU/mksymlinks.$$
2915                         sh UU/mksymlinks.$$
2916                         rm UU/mksymlinks.$$
2917                         # Sanity check 1.
2918                         if test ! -d t/base; then
2919                                 echo "Failed to create the subdirectories.  Aborting." >&4
2920                                 exit 1
2921                         fi
2922                         # Sanity check 2.
2923                         if test ! -f t/base/lex.t; then
2924                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2925                                 exit 1
2926                         fi
2927                         if test ! -f win32/win32.c; then
2928                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2929                                 exit 1
2930                         fi
2931                         cd UU
2932                         ;;
2933                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2934                         ;;
2935                 esac
2936                 ;;
2937         esac
2938         ;;
2939 esac
2940
2941 : Check for Cross-Compilation
2942 if $test "X$targethost" = "X"; then
2943     targethost=""
2944 fi
2945 if $test "X$targetenv" = "X"; then
2946     targetenv=""
2947 fi
2948 case "$usecrosscompile" in
2949 $define|true|[yY]*)
2950         $echo "Cross-compiling..."
2951         croak=''
2952         case "$cc" in
2953         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2954             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2955             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2956             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2957             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2958             # leave out ld, choosing it is more complex
2959             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2960             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2961             # We are in a weird spot. Just before us, some values
2962             # were 'saved', to be restored after the hints are
2963             # run.  This means that the changes we made to ar,
2964             # nm and ranlib will get reverted.
2965             # To avoid that, we hijack the saving mechanism and
2966             # have it save our new values.
2967             for file in ar nm ranlib; do
2968                 eval xxx=\$$file
2969                 eval $file=$xxx$_exe
2970                 eval _$file=$xxx
2971             done
2972         ;;
2973         esac
2974         case "$targetarch" in
2975         '') echo "Targetarch not defined." >&4; croak=y ;;
2976         *)  echo "Using targetarch $targetarch." >&4 ;;
2977         esac
2978         case "$targethost" in
2979         '') echo "Targethost not defined." >&4; croak=n ;;
2980         *)  echo "Using targethost $targethost." >&4
2981         esac
2982         locincpth=' '
2983         loclibpth=' '
2984         case "$croak" in
2985         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2986         esac
2987     : compile a host miniperl and generate_uudmap, unless we got passed them
2988     if $test "X$hostperl" = X; then
2989       echo "Building host miniperl and generate_uudmap binaries" >&4
2990       before_host=`pwd`
2991       cd ..
2992       cd $src
2993       src=`pwd`
2994       rm -rf $src/host
2995       mkdir $src/host
2996       cd $src/host
2997       $src/Configure -des -Dusedevel -Dmksymlinks
2998       $make miniperl
2999       case "$hostgenerate" in
3000       '') $make generate_uudmap
3001           hostgenerate=$src/host/generate_uudmap
3002           ;;
3003        "$undef") hostgenerate=''
3004           ;;
3005       esac
3006       hostperl=$src/host/miniperl
3007       cd $before_host
3008     fi
3009     hostosname=`$hostperl -le 'print $^O'`
3010     ;;
3011 *)
3012     usecrosscompile="$undef"
3013     ;;
3014 esac
3015
3016 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3017 case "$targethost" in
3018     '') echo "Checking for cross-compile" >&4
3019     case "$usecrosscompile$multiarch" in
3020        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3021          if [ -f Makefile ]; then
3022            echo " "
3023            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3024          else
3025            echo "Configure done."
3026          fi
3027        exit 0
3028        ;;
3029      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3030         run=''
3031         to=:
3032         from=:
3033         ;;
3034     esac
3035     ;;
3036     *) echo "Using targethost $targethost." >&4
3037         case "$src" in
3038         /*) run=$src/Cross/run
3039             targetmkdir=$src/Cross/mkdir
3040             to=$src/Cross/to
3041             from=$src/Cross/from
3042             ;;
3043         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3044             run=$pwd/Cross/run
3045             targetmkdir=$pwd/Cross/mkdir
3046             to=$pwd/Cross/to
3047             from=$pwd/Cross/from
3048             ;;
3049         esac
3050         case "$targetrun" in
3051         '') targetrun=ssh ;;
3052         esac
3053         case "$targetto" in
3054         '') targetto=scp ;;
3055         esac
3056         case "$targetfrom" in
3057         '') targetfrom=scp ;;
3058         esac
3059         run=$run-$targetrun
3060         to=$to-$targetto
3061         from=$from-$targetfrom
3062         case "$targetdir" in
3063         '')  targetdir=/tmp
3064              echo "Guessing targetdir $targetdir." >&4
3065              ;;
3066         esac
3067         case "$targetuser" in
3068         '')  targetuser=root
3069              echo "Guessing targetuser $targetuser." >&4
3070              ;;
3071         esac
3072         case "$targetport" in
3073         '')  targetport=22
3074              echo "Guessing targetport $targetport." >&4
3075              ;;
3076         esac
3077         case "$targetfrom" in
3078         scp)    q=-q ;;
3079         *)      q='' ;;
3080         esac
3081         case "$targetrun" in
3082         ssh|rsh)
3083             cat >$run <<EOF
3084 #!/bin/sh
3085 env=''
3086 case "\$1" in
3087 -cwd)
3088   shift
3089   cwd=\$1
3090   shift
3091   ;;
3092 esac
3093 case "\$1" in
3094 -env)
3095   shift
3096   env=\$1
3097   shift
3098   ;;
3099 esac
3100 case "\$cwd" in
3101 '') cwd=$targetdir ;;
3102 esac
3103 exe=\$1
3104 shift
3105 $to \$exe
3106 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3107 EOF
3108             ;;
3109         adb)
3110             $touch $run
3111             ;;
3112         *)  echo "Unknown targetrun '$targetrun'" >&4
3113             exit 1
3114             ;;
3115         esac
3116         case "$targetmkdir" in
3117         */Cross/mkdir)
3118             cat >$targetmkdir <<EOF
3119 #!/bin/sh
3120 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3121 EOF
3122             $chmod a+rx $targetmkdir
3123             ;;
3124         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3125             exit 1
3126             ;;
3127         esac
3128         case "$targetto" in
3129         scp|rcp)
3130             cat >$to <<EOF
3131 #!/bin/sh
3132 for f in \$@
3133 do
3134   case "\$f" in
3135   /*)
3136     $targetmkdir \`dirname \$f\`
3137     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3138     ;;
3139   *)
3140     $targetmkdir $targetdir/\`dirname \$f\`
3141     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3142     ;;
3143   esac
3144 done
3145 exit 0
3146 EOF
3147             ;;
3148         cp) cat >$to <<EOF
3149 #!/bin/sh
3150 for f in \$@
3151 do
3152   case "\$f" in
3153   /*)
3154     $mkdir -p $targetdir/\`dirname \$f\`
3155     $cp \$f $targetdir/\$f || exit 1
3156     ;;
3157   *)
3158     $targetmkdir $targetdir/\`dirname \$f\`
3159     $cp \$f $targetdir/\$f || exit 1
3160     ;;
3161   esac
3162 done
3163 exit 0
3164 EOF
3165             ;;
3166         *)  echo "Unknown targetto '$targetto'" >&4
3167             exit 1
3168             ;;
3169         esac
3170         case "$targetfrom" in
3171         scp|rcp)
3172           cat >$from <<EOF
3173 #!/bin/sh
3174 for f in \$@
3175 do
3176   $rm -f \$f
3177   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3178 done
3179 exit 0
3180 EOF
3181             ;;
3182         cp) cat >$from <<EOF
3183 #!/bin/sh
3184 for f in \$@
3185 do
3186   $rm -f \$f
3187   cp $targetdir/\$f . || exit 1
3188 done
3189 exit 0
3190 EOF
3191             ;;
3192         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3193             exit 1
3194             ;;
3195         esac
3196         if $test ! -f $run; then
3197             echo "Target 'run' script '$run' not found." >&4
3198         else
3199             $chmod a+rx $run
3200         fi
3201         if $test ! -f $to; then
3202             echo "Target 'to' script '$to' not found." >&4
3203         else
3204             $chmod a+rx $to
3205         fi
3206         if $test ! -f $from; then
3207             echo "Target 'from' script '$from' not found." >&4
3208         else
3209             $chmod a+rx $from
3210         fi
3211         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3212             exit 1
3213         fi
3214         cat >&4 <<EOF
3215 Using '$run' for remote execution,
3216 and '$from' and '$to'
3217 for remote file transfer.
3218 EOF
3219         ;;
3220 *)      run=''
3221         to=:
3222         from=:
3223         usecrosscompile="$undef"
3224         targetarch=''
3225         ;;
3226 esac
3227
3228 : see whether [:lower:] and [:upper:] are supported character classes
3229 echo " "
3230 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3231 ABYZ-abyz)
3232         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3233         up='[:upper:]'
3234         low='[:lower:]'
3235         ;;
3236 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3237         # (0xd9 and 0xe2), therefore that is a nice testing point.
3238         if test "X$up" = X -o "X$low" = X; then
3239             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3240             rs) up='[A-Z]'
3241                 low='[a-z]'
3242                 ;;
3243             esac
3244         fi
3245         if test "X$up" = X -o "X$low" = X; then
3246             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3247             rs) up='A-Z'
3248                 low='a-z'
3249                 ;;
3250             esac
3251         fi
3252         if test "X$up" = X -o "X$low" = X; then
3253             case "`echo RS | od -x 2>/dev/null`" in
3254             *D9E2*|*d9e2*)
3255                 echo "Hey, this might be EBCDIC." >&4
3256                 if test "X$up" = X -o "X$low" = X; then
3257                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3258                     rs) up='[A-IJ-RS-Z]'
3259                         low='[a-ij-rs-z]'
3260                         ;;
3261                     esac
3262                 fi
3263                 if test "X$up" = X -o "X$low" = X; then
3264                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3265                     rs) up='A-IJ-RS-Z'
3266                         low='a-ij-rs-z'
3267                         ;;
3268                     esac
3269                 fi
3270                 ;;
3271             esac
3272         fi
3273 esac
3274 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3275 rs)
3276     echo "Using $up and $low to convert case." >&4
3277     ;;
3278 *)
3279     echo "I don't know how to translate letters from upper to lower case." >&4
3280     echo "Your tr is not acting any way I know of." >&4
3281     exit 1
3282     ;;
3283 esac
3284 : set up the translation script tr, must be called with ./tr of course
3285 cat >tr <<EOSC
3286 $startsh
3287 case "\$1\$2" in
3288 '[A-Z][a-z]') exec $tr '$up' '$low';;
3289 '[a-z][A-Z]') exec $tr '$low' '$up';;
3290 esac
3291 exec $tr "\$@"
3292 EOSC
3293 chmod +x tr
3294 $eunicefix tr
3295
3296 : Try to determine whether config.sh was made on this system
3297 case "$config_sh" in
3298 '')
3299 myuname=`$uname -a 2>/dev/null`
3300 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3301 # Downcase everything to avoid ambiguity.
3302 # Remove slashes and single quotes so we can use parts of this in
3303 # directory and file names.
3304 # Remove newlines so myuname is sane to use elsewhere.
3305 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3306 # because the A-Z/a-z are not consecutive.
3307 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3308         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3309 newmyuname="$myuname"
3310 dflt=n
3311 case "$knowitall" in
3312 '')
3313         if test -f ../config.sh; then
3314                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3315                         eval "`grep myuname= ../config.sh`"
3316                 fi
3317                 if test "X$myuname" = "X$newmyuname"; then
3318                         dflt=y
3319                 fi
3320         fi
3321         ;;
3322 *) dflt=y;;
3323 esac
3324
3325 : Get old answers from old config file if Configure was run on the
3326 : same system, otherwise use the hints.
3327 hint=default
3328 cd ..
3329 if test -f config.sh; then
3330         echo " "
3331         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3332         . UU/myread
3333         case "$ans" in
3334         n*|N*) echo "OK, I'll ignore it."
3335                 mv config.sh config.sh.old
3336                 myuname="$newmyuname"
3337                 ;;
3338         *)  echo "Fetching default answers from your old config.sh file..." >&4
3339                 tmp_n="$n"
3340                 tmp_c="$c"
3341                 tmp_sh="$sh"
3342                 . ./config.sh
3343                 cp config.sh UU
3344                 n="$tmp_n"
3345                 c="$tmp_c"
3346                 : Older versions did not always set $sh.  Catch re-use of such
3347                 : an old config.sh.
3348                 case "$sh" in
3349                 '') sh="$tmp_sh" ;;
3350                 esac
3351                 hint=previous
3352                 ;;
3353         esac
3354 fi
3355 . ./UU/checkcc
3356 if test ! -f config.sh; then
3357         $cat <<EOM
3358
3359 First time through, eh?  I have some defaults handy for some systems
3360 that need some extra help getting the Configure answers right:
3361
3362 EOM
3363         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3364         dflt=''
3365         : Half the following guesses are probably wrong... If you have better
3366         : tests or hints, please send them to perlbug@perl.org
3367         : The metaconfig authors would also appreciate a copy...
3368         $test -f /irix && osname=irix
3369         $test -f /xenix && osname=sco_xenix
3370         $test -f /dynix && osname=dynix
3371         $test -f /dnix && osname=dnix
3372         $test -f /lynx.os && osname=lynxos
3373         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3374         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3375         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3376         $test -f /bin/mips && /bin/mips && osname=mips
3377         $test -d /usr/apollo/bin && osname=apollo
3378         $test -f /etc/saf/_sactab && osname=svr4
3379         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3380         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3381         $test -f /sys/utilities/MultiView && osname=amigaos
3382         if $test -d /MachTen -o -d /MachTen_Folder; then
3383                 osname=machten
3384                 if $test -x /sbin/version; then
3385                         osvers=`/sbin/version | $awk '{print $2}' |
3386                         $sed -e 's/[A-Za-z]$//'`
3387                 elif $test -x /usr/etc/version; then
3388                         osvers=`/usr/etc/version | $awk '{print $2}' |
3389                         $sed -e 's/[A-Za-z]$//'`
3390                 else
3391                         osvers="$2.$3"
3392                 fi
3393         fi
3394
3395         $test -f /sys/posix.dll &&
3396                 $test -f /usr/bin/what &&
3397                 set X `/usr/bin/what /sys/posix.dll` &&
3398                 $test "$3" = UWIN &&
3399                 osname=uwin &&
3400                 osvers="$5"
3401
3402         if $test -f $uname; then
3403                 set X $myuname
3404                 shift
3405
3406                 case "$5" in
3407                 fps*) osname=fps ;;
3408                 mips*)
3409                         case "$4" in
3410                         umips) osname=umips ;;
3411                         *) osname=mips ;;
3412                         esac;;
3413                 [23]100) osname=mips ;;
3414                 i386*)
3415                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3416                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3417                                 osname='sco'
3418                                 osvers=$tmp
3419                         elif $test -f /etc/kconfig; then
3420                                 osname=isc
3421                                 if test "$lns" = "$ln -s"; then
3422                                         osvers=4
3423                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3424                                         osvers=3
3425                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3426                                         osvers=2
3427                                 fi
3428                         fi
3429                         tmp=''
3430                         ;;
3431                 pc*)
3432                         if test -n "$DJGPP"; then
3433                                 osname=dos
3434                                 osvers=djgpp
3435                         fi
3436                         ;;
3437                 esac
3438
3439                 case "$1" in
3440                 aix) osname=aix
3441                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3442                         case "$tmp" in
3443                         # oslevel can fail with:
3444                         # oslevel: Unable to acquire lock.
3445                         *not\ found) osvers="$4"."$3" ;;
3446                         '<3240'|'<>3240') osvers=3.2.0 ;;
3447                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3448                         '=3250'|'>3250') osvers=3.2.5 ;;
3449                         *) osvers=$tmp;;
3450                         esac
3451                         ;;
3452                 bitrig) osname=bitrig
3453                         osvers="$3"
3454                         ;;
3455                 bsd386) osname=bsd386
3456                         osvers=`$uname -r`
3457                         ;;
3458                 cygwin*) osname=cygwin
3459                         osvers="$3"
3460                         ;;
3461                 *dc.osx) osname=dcosx
3462                         osvers="$3"
3463                         ;;
3464                 dnix) osname=dnix
3465                         osvers="$3"
3466                         ;;
3467                 domainos) osname=apollo
3468                         osvers="$3"
3469                         ;;
3470                 dgux)   osname=dgux
3471                         osvers="$3"
3472                         ;;
3473                 dragonfly) osname=dragonfly
3474                         osvers="$3"
3475                         ;;
3476                 dynixptx*) osname=dynixptx
3477                         osvers=`echo "$4"|sed 's/^v//'`
3478                         ;;
3479                 freebsd) osname=freebsd
3480                         osvers="$3" ;;
3481                 genix)  osname=genix ;;
3482                 gnu)    osname=gnu
3483                         osvers="$3" ;;
3484                 hp*)    osname=hpux
3485                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3486                         ;;
3487                 irix*)  osname=irix
3488                         case "$3" in
3489                         4*) osvers=4 ;;
3490                         5*) osvers=5 ;;
3491                         *)      osvers="$3" ;;
3492                         esac
3493                         ;;
3494                 linux)  osname=linux
3495                         case "$3" in
3496                         *)      osvers="$3" ;;
3497                         esac
3498                         $test -f /system/lib/libandroid.so && osname=linux-android
3499                         ;;
3500                 MiNT)   osname=mint
3501                         ;;
3502                 netbsd*) osname=netbsd
3503                         osvers="$3"
3504                         ;;
3505                 news-os) osvers="$3"
3506                         case "$3" in
3507                         4*) osname=newsos4 ;;
3508                         *) osname=newsos ;;
3509                         esac
3510                         ;;
3511                 nonstop-ux) osname=nonstopux ;;
3512                 openbsd) osname=openbsd
3513                         osvers="$3"
3514                         ;;
3515                 os2)    osname=os2
3516                         osvers="$4"
3517                         ;;
3518                 POSIX-BC | posix-bc ) osname=posix-bc
3519                         osvers="$3"
3520                         ;;
3521                 powerux | power_ux | powermax_os | powermaxos | \
3522                 powerunix | power_unix) osname=powerux
3523                         osvers="$3"
3524                         ;;
3525                 qnx) osname=qnx
3526                         osvers="$4"
3527                         ;;
3528                 solaris) osname=solaris
3529                         case "$3" in
3530                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3531                         *)      osvers="$3" ;;
3532                         esac
3533                         ;;
3534                 sunos) osname=sunos
3535                         case "$3" in
3536                         5*) osname=solaris
3537                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3538                         *)      osvers="$3" ;;
3539                         esac
3540                         ;;
3541                 titanos) osname=titanos
3542                         case "$3" in
3543                         1*) osvers=1 ;;
3544                         2*) osvers=2 ;;
3545                         3*) osvers=3 ;;
3546                         4*) osvers=4 ;;
3547                         *)      osvers="$3" ;;
3548                         esac
3549                         ;;
3550                 ultrix) osname=ultrix
3551                         osvers="$3"
3552                         ;;
3553                 osf1|mls+)      case "$5" in
3554                                 alpha)
3555                                         osname=dec_osf
3556                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3557                                         case "$osvers" in
3558                                         [1-9].[0-9]*) ;;
3559                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3560                                         esac
3561                                         ;;
3562                         hp*)    osname=hp_osf1  ;;
3563                         mips)   osname=mips_osf1 ;;
3564                         esac
3565                         ;;
3566                 # UnixWare 7.1.2 is known as Open UNIX 8
3567                 openunix|unixware) osname=svr5
3568                         osvers="$4"
3569                         ;;
3570                 uts)    osname=uts
3571                         osvers="$3"
3572                         ;;
3573                 vos) osvers="$3"
3574                         ;;
3575                 $2) case "$osname" in
3576                         *isc*) ;;
3577                         *freebsd*) ;;
3578                         svr*)
3579                                 : svr4.x or possibly later
3580                                 case "svr$3" in
3581                                 ${osname}*)
3582                                         osname=svr$3
3583                                         osvers=$4
3584                                         ;;
3585                                 esac
3586                                 case "$osname" in
3587                                 svr4.0)
3588                                         : Check for ESIX
3589                                         if test -f /stand/boot ; then
3590                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3591                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3592                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3593                                                         if test -n "$isesix"; then
3594                                                                 osname=esix4
3595                                                         fi
3596                                                 fi
3597                                         fi
3598                                         ;;
3599                                 esac
3600                                 ;;
3601                         *)      if test -f /etc/systemid; then
3602                                         osname=sco
3603                                         set `echo $3 | $sed 's/\./ /g'` $4
3604                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3605                                                 osvers=$1.$2.$3
3606                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3607                                                 osvers=$1.$2
3608                                         elif $test -f $src/hints/sco_$1.sh; then
3609                                                 osvers=$1
3610                                         fi
3611                                 else
3612                                         case "$osname" in
3613                                         '') : Still unknown.  Probably a generic Sys V.
3614                                                 osname="sysv"
3615                                                 osvers="$3"
3616                                                 ;;
3617                                         esac
3618                                 fi
3619                                 ;;
3620                         esac
3621                         ;;
3622                 *)      case "$osname" in
3623                         '') : Still unknown.  Probably a generic BSD.
3624                                 osname="$1"
3625                                 osvers="$3"
3626                                 ;;
3627                         esac
3628                         ;;
3629                 esac
3630         else
3631                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3632                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3633                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3634                                 osname=news_os
3635                         fi
3636                         $rm -f UU/kernel.what
3637                 elif test -d c:/. -o -n "$is_os2" ; then
3638                         set X $myuname
3639                         osname=os2
3640                         osvers="$5"
3641                 fi
3642         fi
3643
3644         case "$targetarch" in
3645         '') ;;
3646         *)  hostarch=$osname
3647             case "$targetarch" in
3648                 nto*|*-nto-*)
3649                     # Will load qnx.sh, which should change osname to nto
3650                     osname=qnx
3651                     osvers=''
3652                     ;;
3653                 *linux-android*)
3654                     # Catch arm-linux-androideabi, mipsel-linux-android,
3655                     # and i686-linux-android
3656                     osname=linux-android
3657                     osvers=''
3658                     ;;
3659                 *linux*)
3660                     # Something like arm-linux-gnueabihf is really just
3661                     # plain linux.
3662                     osname=linux
3663                     osvers=''
3664                     ;;
3665                 *solaris*|*sunos*)
3666                     osname=solaris
3667                     # XXX perhaps we should just assume
3668                     # osvers to be 2, or maybe take the value
3669                     # from targetarch. Using $run before the
3670                     # hints are run is somewhat icky.
3671                     set X `$run $uname -a 2>/dev/null`
3672                     shift
3673                     case "$3" in
3674                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3675                         *)  osvers="$3" ;;
3676                     esac
3677                     ;;
3678                 *)
3679                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3680                     osvers=''
3681                 ;;
3682             esac
3683             ;;
3684         esac
3685
3686         : Now look for a hint file osname_osvers, unless one has been
3687         : specified already.
3688         case "$hintfile" in
3689         ''|' ')
3690                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3691                 : Also try without trailing minor version numbers.
3692                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3693                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3694                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3695                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3696                 case "$file" in
3697                 '') dflt=none ;;
3698                 *)  case "$osvers" in
3699                         '') dflt=$file
3700                                 ;;
3701                         *)  if $test -f $src/hints/$file.sh ; then
3702                                         dflt=$file
3703                                 elif $test -f $src/hints/$xfile.sh ; then
3704                                         dflt=$xfile
3705                                 elif $test -f $src/hints/$xxfile.sh ; then
3706                                         dflt=$xxfile
3707                                 elif $test -f $src/hints/$xxxfile.sh ; then
3708                                         dflt=$xxxfile
3709                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3710                                         dflt=$xxxxfile
3711                                 elif $test -f "$src/hints/${osname}.sh" ; then
3712                                         dflt="${osname}"
3713                                 else
3714                                         dflt=none
3715                                 fi
3716                                 ;;
3717                         esac
3718                         ;;
3719                 esac
3720                 if $test -f Policy.sh ; then
3721                         case "$dflt" in
3722                         *Policy*) ;;
3723                         none) dflt="Policy" ;;
3724                         *) dflt="Policy $dflt" ;;
3725                         esac
3726                 fi
3727                 ;;
3728         *)
3729                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3730                 ;;
3731         esac
3732
3733         if $test -f Policy.sh ; then
3734                 $cat <<EOM
3735
3736 There's also a Policy hint file available, which should make the
3737 site-specific (policy) questions easier to answer.
3738 EOM
3739
3740         fi
3741
3742         $cat <<EOM
3743
3744 You may give one or more space-separated answers, or "none" if appropriate.
3745 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3746 previous run of Configure, you may specify it as well as or instead of
3747 OS-specific hints.  If hints are provided for your OS, you should use them:
3748 although Perl can probably be built without hints on many platforms, using
3749 hints often improve performance and may enable features that Configure can't
3750 set up on its own. If there are no hints that match your OS, specify "none";
3751 DO NOT give a wrong version or a wrong OS.
3752
3753 EOM
3754
3755         rp="Which of these apply, if any?"
3756         . UU/myread
3757         tans=$ans
3758         for file in $tans; do
3759                 if $test X$file = XPolicy -a -f Policy.sh; then
3760                         . Policy.sh
3761                         $cat Policy.sh >> UU/config.sh
3762                 elif $test -f $src/hints/$file.sh; then
3763                         . $src/hints/$file.sh
3764                         $cat $src/hints/$file.sh >> UU/config.sh
3765                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3766                         : nothing
3767                 else
3768                         : Give one chance to correct a possible typo.
3769                         echo "$file.sh does not exist"
3770                         dflt=$file
3771                         rp="hint to use instead?"
3772                         . UU/myread
3773                         for file in $ans; do
3774                                 if $test -f "$src/hints/$file.sh"; then
3775                                         . $src/hints/$file.sh
3776                                         $cat $src/hints/$file.sh >> UU/config.sh
3777                                 elif $test X$ans = X -o X$ans = Xnone ; then
3778                                         : nothing
3779                                 else
3780                                         echo "$file.sh does not exist -- ignored."
3781                                 fi
3782                         done
3783                 fi
3784         done
3785
3786         hint=recommended
3787         : Remember our hint file for later.
3788         if $test -f "$src/hints/$file.sh" ; then
3789                 hintfile="$file"
3790         else
3791                 hintfile=''
3792         fi
3793 fi
3794 cd UU
3795 ;;
3796 *)
3797         echo " "
3798         echo "Fetching default answers from $config_sh..." >&4
3799         tmp_n="$n"
3800         tmp_c="$c"
3801         cd ..
3802         cp $config_sh config.sh 2>/dev/null
3803         chmod +w config.sh
3804         . ./config.sh
3805         cd UU
3806         cp ../config.sh .
3807         n="$tmp_n"
3808         c="$tmp_c"
3809         hint=previous
3810         ;;
3811 esac
3812 . ./optdef.sh
3813
3814 : Restore computed paths
3815 for file in $loclist $trylist; do
3816         eval $file="\$_$file"
3817 done
3818
3819 cat << EOM
3820
3821 Configure uses the operating system name and version to set some defaults.
3822 The default value is probably right if the name rings a bell. Otherwise,
3823 since spelling matters for me, either accept the default or answer "none"
3824 to leave it blank.
3825
3826 EOM
3827 case "$osname" in
3828         ''|' ')
3829                 case "$hintfile" in
3830                 ''|' '|none) dflt=none ;;
3831                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3832                 esac
3833                 ;;
3834         *) dflt="$osname" ;;
3835 esac
3836 rp="Operating system name?"
3837 . ./myread
3838 case "$ans" in
3839 none)  osname='' ;;
3840 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3841 esac
3842 echo " "
3843 case "$osvers" in
3844         ''|' ')
3845                 case "$hintfile" in
3846                 ''|' '|none) dflt=none ;;
3847                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3848                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3849                         case "$dflt" in
3850                         ''|' ') dflt=none ;;
3851                         esac
3852                         ;;
3853                 esac
3854                 ;;
3855         *) dflt="$osvers" ;;
3856 esac
3857 rp="Operating system version?"
3858 . ./myread
3859 case "$ans" in
3860 none)  osvers='' ;;
3861 *) osvers="$ans" ;;
3862 esac
3863
3864
3865 . ./posthint.sh
3866
3867 : who configured the system
3868 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3869 case "$cf_by" in
3870 "")
3871         cf_by=`(logname) 2>/dev/null`
3872         case "$cf_by" in
3873         "")
3874                 cf_by=`(whoami) 2>/dev/null`
3875                 case "$cf_by" in
3876                 "") cf_by=unknown ;;
3877                 esac ;;
3878         esac ;;
3879 esac
3880
3881 : decide how portable to be.  Allow command line overrides.
3882 case "$d_portable" in
3883 "$undef") ;;
3884 *)      d_portable="$define" ;;
3885 esac
3886
3887 : set up shell script to do ~ expansion
3888 cat >filexp <<EOSS
3889 $startsh
3890 : expand filename
3891 case "\$1" in
3892  \~/*|\~)
3893         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3894         ;;
3895  \~*)
3896         if $test -f /bin/csh; then
3897                 /bin/csh -f -c "glob \$1"
3898                 failed=\$?
3899                 echo ""
3900                 exit \$failed
3901         else
3902                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3903                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3904                 if $test ! -d "\$dir"; then
3905                         me=\`basename \$0\`
3906                         echo "\$me: can't locate home directory for: \$name" >&2
3907                         exit 1
3908                 fi
3909                 case "\$1" in
3910                 */*)
3911                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3912                         ;;
3913                 *)
3914                         echo \$dir
3915                         ;;
3916                 esac
3917         fi
3918         ;;
3919 *)
3920         echo \$1
3921         ;;
3922 esac
3923 EOSS
3924 chmod +x filexp
3925 $eunicefix filexp
3926
3927 : now set up to get a file name
3928 cat <<EOS >getfile
3929 $startsh
3930 EOS
3931 cat <<'EOSC' >>getfile
3932 tilde=''
3933 fullpath=''
3934 already=''
3935 skip=''
3936 none_ok=''
3937 exp_file=''
3938 nopath_ok=''
3939 orig_rp="$rp"
3940 orig_dflt="$dflt"
3941 case "$gfpth" in
3942 '') gfpth='.' ;;
3943 esac
3944
3945 case "$fn" in
3946 *\(*)
3947         : getfile will accept an answer from the comma-separated list
3948         : enclosed in parentheses even if it does not meet other criteria.
3949         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3950         fn=`echo $fn | sed 's/(.*)//'`
3951         ;;
3952 esac
3953
3954 case "$fn" in
3955 *:*)
3956         loc_file=`expr $fn : '.*:\(.*\)'`
3957         fn=`expr $fn : '\(.*\):.*'`
3958         ;;
3959 esac
3960
3961 case "$fn" in
3962 *~*) tilde=true;;
3963 esac
3964 case "$fn" in
3965 */*) fullpath=true;;
3966 esac
3967 case "$fn" in
3968 *+*) skip=true;;
3969 esac
3970 case "$fn" in
3971 *n*) none_ok=true;;
3972 esac
3973 case "$fn" in
3974 *e*) exp_file=true;;
3975 esac
3976 case "$fn" in
3977 *p*) nopath_ok=true;;
3978 esac
3979
3980 case "$fn" in
3981 *f*) type='File';;
3982 *d*) type='Directory';;
3983 *l*) type='Locate';;
3984 esac
3985
3986 what="$type"
3987 case "$what" in
3988 Locate) what='File';;
3989 esac
3990
3991 case "$exp_file" in
3992 '')
3993         case "$d_portable" in
3994         "$define") ;;
3995         *) exp_file=true;;
3996         esac
3997         ;;
3998 esac
3999
4000 cd ..
4001 while test "$type"; do
4002         redo=''
4003         rp="$orig_rp"
4004         dflt="$orig_dflt"
4005         case "$tilde" in
4006         true) rp="$rp (~name ok)";;
4007         esac
4008         . UU/myread
4009         if test -f UU/getfile.ok && \
4010                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4011         then
4012                 value="$ans"
4013                 ansexp="$ans"
4014                 break
4015         fi
4016         case "$ans" in
4017         none)
4018                 value=''
4019                 ansexp=''
4020                 case "$none_ok" in
4021                 true) type='';;
4022                 esac
4023                 ;;
4024         *)
4025                 case "$tilde" in
4026                 '') value="$ans"
4027                         ansexp="$ans";;
4028                 *)
4029                         value=`UU/filexp $ans`
4030                         case $? in
4031                         0)
4032                                 if test "$ans" != "$value"; then
4033                                         echo "(That expands to $value on this system.)"
4034                                 fi
4035                                 ;;
4036                         *) value="$ans";;
4037                         esac
4038                         ansexp="$value"
4039                         case "$exp_file" in
4040                         '') value="$ans";;
4041                         esac
4042                         ;;
4043                 esac
4044                 case "$fullpath" in
4045                 true)
4046                         case "$ansexp" in
4047                         /*) value="$ansexp" ;;
4048                         [a-zA-Z]:/*) value="$ansexp" ;;
4049                         *)
4050                                 redo=true
4051                                 case "$already" in
4052                                 true)
4053                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4054                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4055                                         ;;
4056                                 *)
4057                                 echo "Please give a full path name, starting with slash." >&4
4058                                         case "$tilde" in
4059                                         true)
4060                                 echo "Note that using ~name is ok provided it expands well." >&4
4061                                                 already=true
4062                                                 ;;
4063                                         esac
4064                                 esac
4065                                 ;;
4066                         esac
4067                         ;;
4068                 esac
4069                 case "$redo" in
4070                 '')
4071                         case "$type" in
4072                         File)
4073                                 for fp in $gfpth; do
4074                                         if test "X$fp" = X.; then
4075                                             pf="$ansexp"
4076                                         else    
4077                                             pf="$fp/$ansexp"
4078                                         fi
4079                                         if test -f "$pf"; then
4080                                                 type=''
4081                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4082                                         then
4083                                                 echo "($value is not a plain file, but that's ok.)"
4084                                                 type=''
4085                                         fi
4086                                         if test X"$type" = X; then
4087                                             value="$pf"
4088                                             break
4089                                         fi
4090                                 done
4091                                 ;;
4092                         Directory)
4093                                 for fp in $gfpth; do
4094                                         if test "X$fp" = X.; then
4095                                             dir="$ans"
4096                                             direxp="$ansexp"
4097                                         else    
4098                                             dir="$fp/$ansexp"
4099                                             direxp="$fp/$ansexp"
4100                                         fi
4101                                         if test -d "$direxp"; then
4102                                                 type=''
4103                                                 value="$dir"
4104                                                 break
4105                                         fi
4106                                 done
4107                                 ;;
4108                         Locate)
4109                                 if test -d "$ansexp"; then
4110                                         echo "(Looking for $loc_file in directory $value.)"
4111                                         value="$value/$loc_file"
4112                                         ansexp="$ansexp/$loc_file"
4113                                 fi
4114                                 if test -f "$ansexp"; then
4115                                         type=''
4116                                 fi
4117                                 case "$nopath_ok" in
4118                                 true)   case "$value" in
4119                                         */*) ;;
4120                                         *)      echo "Assuming $value will be in people's path."
4121                                                 type=''
4122                                                 ;;
4123                                         esac
4124                                         ;;
4125                                 esac
4126                                 ;;
4127                         esac
4128
4129                         case "$skip" in
4130                         true) type='';
4131                         esac
4132
4133                         case "$type" in
4134                         '') ;;
4135                         *)
4136                                 if test "$fastread" = yes; then
4137                                         dflt=y
4138                                 else
4139                                         dflt=n
4140                                 fi
4141                                 rp="$what $value doesn't exist.  Use that name anyway?"
4142                                 . UU/myread
4143                                 dflt=''
4144                                 case "$ans" in
4145                                 y*) type='';;
4146                                 *) echo " ";;
4147                                 esac
4148                                 ;;
4149                         esac
4150                         ;;
4151                 esac
4152                 ;;
4153         esac
4154 done
4155 cd UU
4156 ans="$value"
4157 rp="$orig_rp"
4158 dflt="$orig_dflt"
4159 rm -f getfile.ok
4160 test "X$gfpthkeep" != Xy && gfpth=""
4161 EOSC
4162
4163 : determine root of directory hierarchy where package will be installed.
4164 case "$prefix" in
4165 '')
4166         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4167         ;;
4168 *?/)
4169         dflt=`echo "$prefix" | sed 's/.$//'`
4170         ;;
4171 *)
4172         dflt="$prefix"
4173         ;;
4174 esac
4175 $cat <<EOM
4176
4177 By default, $package will be installed in $dflt/bin, manual pages
4178 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4179 installation directories. Typically this is something like /usr/local.
4180 If you wish to have binaries under /usr/bin but other parts of the
4181 installation under /usr/local, that's ok: you will be prompted
4182 separately for each of the installation directories, the prefix being
4183 only used to set the defaults.
4184
4185 EOM
4186 fn=d~
4187 rp='Installation prefix to use?'
4188 . ./getfile
4189 oldprefix=''
4190 case "$prefix" in
4191 '') ;;
4192 *)
4193         case "$ans" in
4194         "$prefix") ;;
4195         *) oldprefix="$prefix";;
4196         esac
4197         ;;
4198 esac
4199 prefix="$ans"
4200 prefixexp="$ansexp"
4201
4202 : allow them to override the AFS root
4203 case "$afsroot" in
4204 '')     afsroot=/afs ;;
4205 *)      afsroot=$afsroot ;;
4206 esac
4207
4208 : is AFS running?
4209 echo " "
4210 case "$afs" in
4211 $define|true)   afs=true ;;
4212 $undef|false)   afs=false ;;
4213 *)      if $test -d $afsroot; then
4214                 afs=true
4215         else
4216                 afs=false
4217         fi
4218         ;;
4219 esac
4220 if $afs; then
4221         echo "AFS may be running... I'll be extra cautious then..." >&4
4222 else
4223         echo "AFS does not seem to be running..." >&4
4224 fi
4225
4226 : determine installation prefix for where package is to be installed.
4227 if $afs; then
4228 $cat <<EOM
4229
4230 Since you are running AFS, I need to distinguish the directory in which
4231 files will reside from the directory in which they are installed (and from
4232 which they are presumably copied to the former directory by occult means).
4233
4234 EOM
4235         case "$installprefix" in
4236         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4237         *) dflt="$installprefix";;
4238         esac
4239 else
4240 $cat <<EOM
4241
4242 In some special cases, particularly when building $package for distribution,
4243 it is convenient to distinguish the directory in which files should be
4244 installed from the directory ($prefix) in which they will
4245 eventually reside.  For most users, these two directories are the same.
4246
4247 EOM
4248         case "$installprefix" in
4249         '') dflt=$prefix ;;
4250         *) dflt=$installprefix;;
4251         esac
4252 fi
4253 fn=d~
4254 rp='What installation prefix should I use for installing files?'
4255 . ./getfile
4256 installprefix="$ans"
4257 installprefixexp="$ansexp"
4258
4259 : Perform the prefixexp/installprefixexp correction if necessary
4260 cat <<EOS >installprefix
4261 $startsh
4262 EOS
4263 cat <<'EOSC' >>installprefix
4264 : Change installation prefix, if necessary.
4265 if $test X"$prefix" != X"$installprefix"; then
4266     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4267 else
4268     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4269 fi
4270 EOSC
4271 chmod +x installprefix
4272 $eunicefix installprefix
4273
4274 : Set variables such as privlib and privlibexp from the output of ./getfile
4275 : performing the prefixexp/installprefixexp correction if necessary.
4276 cat <<EOS >setprefixvar
4277 $startsh
4278 EOS
4279 cat <<'EOSC' >>setprefixvar
4280 eval "${prefixvar}=\"\$ans\""
4281 eval "${prefixvar}exp=\"\$ansexp\""
4282 . ./installprefix
4283 EOSC
4284 chmod +x setprefixvar
4285 $eunicefix setprefixvar
4286
4287 : set up the script used to warn in case of inconsistency
4288 cat <<EOS >whoa
4289 $startsh
4290 EOS
4291 cat <<'EOSC' >>whoa
4292 dflt=y
4293 case "$hint" in
4294     recommended)
4295         case "$hintfile" in
4296         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4297                 ;;
4298         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4299                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4300                 ;;
4301         esac
4302         ;;
4303     *)  echo " "
4304         echo "*** WHOA THERE!!! ***" >&4
4305         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4306         ;;
4307 esac
4308 rp="    Keep the $hint value?"
4309 . ./myread
4310 case "$ans" in
4311 y) td=$was; tu=$was;;
4312 esac
4313 EOSC
4314
4315 : function used to set '$1' to '$val'
4316 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4317 case "$val$was" in
4318 $define$undef) . ./whoa; eval "$var=\$td";;
4319 $undef$define) . ./whoa; eval "$var=\$tu";;
4320 *) eval "$var=$val";;
4321 esac'
4322
4323 : get the patchlevel
4324 echo " "
4325 echo "Getting the current patchlevel..." >&4
4326 if $test -r $rsrc/patchlevel.h;then
4327         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4328         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4329         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4330         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4331         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4332         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4333         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4334 else
4335         revision=0
4336         patchlevel=0
4337         subversion=0
4338         api_revision=0
4339         api_version=0
4340         api_subversion=0
4341         perl_patchlevel=0
4342         $echo "(You do not have patchlevel.h.  Eek.)"
4343 fi
4344 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4345 version_patchlevel_string="version $patchlevel subversion $subversion"
4346 case "$perl_patchlevel" in
4347 0|'') ;;
4348 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4349     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4350     ;;
4351 esac
4352
4353 $echo "(You have $package $version_patchlevel_string.)"
4354
4355 case "$osname" in
4356 dos|vms)
4357         : XXX Should be a Configure test for double-dots in filenames.
4358         version=`echo $revision $patchlevel $subversion | \
4359                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4360         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4361                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4362         ;;
4363 *)
4364         version=`echo $revision $patchlevel $subversion | \
4365                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4366         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4367                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4368         ;;
4369 esac
4370 : Special case the 5.005_xx maintenance series, which used 5.005
4371 : without any subversion label as a subdirectory in $sitelib
4372 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4373         api_versionstring='5.005'
4374 fi
4375
4376 : Do we want threads support and if so, what type
4377 case "$usethreads" in
4378 $define|true|[yY]*)     dflt='y';;
4379 *)     # Catch case where user specified ithreads or 5005threads but
4380        # forgot -Dusethreads (A.D. 4/2002)
4381        case "$useithreads$use5005threads" in
4382        *$define*)       dflt='y';;
4383        *)               dflt='n';;
4384        esac
4385        ;;
4386 esac
4387 cat <<EOM
4388
4389 Perl can be built to offer a form of threading support on some systems
4390 To do so, Configure can be run with -Dusethreads.
4391
4392 Note that Perl built with threading support runs slightly slower
4393 and uses slightly more memory than plain Perl.
4394
4395 If this doesn't make any sense to you, just accept the default '$dflt'.
4396 EOM
4397 rp='Build a threading Perl?'
4398 . ./myread
4399 case "$ans" in
4400 y|Y)    val="$define" ;;
4401 *)      val="$undef" ;;
4402 esac
4403 set usethreads
4404 eval $setvar
4405
4406 if $test $patchlevel -lt 9; then
4407     case "$usethreads" in
4408     $define)
4409         : Default to ithreads unless overridden on command line or with
4410         : old config.sh
4411         dflt='y'
4412         case "$use5005threads" in
4413                 $define|true|[yY]*)
4414                         echo "5.005 threads are no longer supported"
4415                         exit 1
4416                 ;;
4417         esac
4418         case "$useithreads" in
4419                 $undef|false|[nN]*) dflt='n';;
4420         esac
4421         rp='Use the newer interpreter-based ithreads?'
4422         . ./myread
4423         case "$ans" in
4424         y|Y)    val="$define" ;;
4425         *)      val="$undef" ;;
4426         esac
4427         set useithreads
4428         eval $setvar
4429         : Now set use5005threads to the opposite value.
4430         case "$useithreads" in
4431         $define) val="$undef" ;;
4432         *) val="$define" ;;
4433         esac
4434         set use5005threads
4435         eval $setvar
4436         ;;
4437     *)
4438         useithreads="$undef"
4439         use5005threads="$undef"
4440         ;;
4441     esac
4442
4443     case "$useithreads$use5005threads" in
4444     "$define$define")
4445         $cat >&4 <<EOM
4446
4447 You cannot have both the ithreads and the 5.005 threads enabled
4448 at the same time.  Disabling the 5.005 threads since they are
4449 much less stable than the ithreads.
4450
4451 EOM
4452         use5005threads="$undef"
4453         ;;
4454     esac
4455
4456 else
4457 : perl-5.9.x and later
4458
4459     if test X"$usethreads" = "X$define"; then
4460         case "$use5005threads" in
4461             $define|true|[yY]*)
4462                 $cat >&4 <<EOM
4463
4464 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4465
4466 EOM
4467             ;;
4468         esac
4469     fi
4470
4471     use5005threads="$undef"
4472     useithreads="$usethreads"
4473 fi
4474
4475 case "$d_oldpthreads" in
4476 '')     : Configure tests would be welcome here.  For now, assume undef.
4477         val="$undef" ;;
4478 *)      val="$d_oldpthreads" ;;
4479 esac
4480 set d_oldpthreads
4481 eval $setvar
4482
4483
4484 : Look for a hint-file generated 'call-back-unit'.  If the
4485 : user has specified that a threading perl is to be built,
4486 : we may need to set or change some other defaults.
4487 if $test -f usethreads.cbu; then
4488     echo "Your platform has some specific hints regarding threaded builds, using them..."
4489     . ./usethreads.cbu
4490 else
4491     case "$usethreads" in
4492         "$define"|true|[yY]*)
4493                 $cat <<EOM
4494 (Your platform does not have any specific hints for threaded builds.
4495  Assuming POSIX threads, then.)
4496 EOM
4497         ;;
4498     esac
4499 fi
4500
4501 : Check if multiplicity is required
4502 cat <<EOM
4503
4504 Perl can be built so that multiple Perl interpreters can coexist
4505 within the same Perl executable.
4506 EOM
4507
4508 case "$useithreads" in
4509 $define)
4510         cat <<EOM
4511 This multiple interpreter support is required for interpreter-based threads.
4512 EOM
4513         val="$define"
4514         ;;
4515 *)      case "$usemultiplicity" in
4516         $define|true|[yY]*)     dflt='y';;
4517         *) dflt='n';;
4518         esac
4519         echo " "
4520         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4521         rp='Build Perl for multiplicity?'
4522         . ./myread
4523         case "$ans" in
4524         y|Y)    val="$define" ;;
4525         *)      val="$undef" ;;
4526         esac
4527         ;;
4528 esac
4529 set usemultiplicity
4530 eval $setvar
4531
4532 : Check if morebits is requested
4533 case "$usemorebits" in
4534 "$define"|true|[yY]*)
4535         use64bitint="$define"
4536         uselongdouble="$define"
4537         usemorebits="$define"
4538         ;;
4539 *)      usemorebits="$undef"
4540         ;;
4541 esac
4542
4543 : Determine the C compiler to be used
4544 echo " "
4545 case "$cc" in
4546 '') dflt=cc;;
4547 *) dflt="$cc";;
4548 esac
4549 rp="Use which C compiler?"
4550 . ./myread
4551 cc="$ans"
4552
4553 : See whether they have no cc but they do have gcc
4554 . ./trygcc
4555 if $test -f cc.cbu; then
4556     . ./cc.cbu
4557 fi
4558 . ./checkcc
4559
4560 : make some quick guesses about what we are up against
4561 echo " "
4562 $echo $n "Hmm...  $c"
4563 echo exit 1 >bsd
4564 echo exit 1 >usg
4565 echo exit 1 >v7
4566 echo exit 1 >osf1
4567 echo exit 1 >eunice
4568 echo exit 1 >xenix
4569 echo exit 1 >venix
4570 echo exit 1 >os2
4571 d_bsd="$undef"
4572 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4573 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4574 then
4575         echo "Looks kind of like an OSF/1 system, but we'll see..."
4576         echo exit 0 >osf1
4577 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4578         xxx=`./loc addbib blurfl $pth`
4579         if $test -f $xxx; then
4580         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4581                 echo exit 0 >bsd
4582                 echo exit 0 >usg
4583         else
4584                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4585                         echo "Looks kind of like an extended USG system, but we'll see..."
4586                 else
4587                         echo "Looks kind of like a USG system, but we'll see..."
4588                 fi
4589                 echo exit 0 >usg
4590         fi
4591 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4592         echo "Looks kind of like a BSD system, but we'll see..."
4593         d_bsd="$define"
4594         echo exit 0 >bsd
4595 else
4596         echo "Looks kind of like a Version 7 system, but we'll see..."
4597         echo exit 0 >v7
4598 fi
4599 case "$eunicefix" in
4600 *unixtovms*)
4601         $cat <<'EOI'
4602 There is, however, a strange, musty smell in the air that reminds me of
4603 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4604 EOI
4605         echo exit 0 >eunice
4606         d_eunice="$define"
4607 : it so happens the Eunice I know will not run shell scripts in Unix format
4608         ;;
4609 *)
4610         echo " "
4611         echo "Congratulations.  You aren't running Eunice."
4612         d_eunice="$undef"
4613         ;;
4614 esac
4615 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4616 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4617 : semicolon as a patch separator
4618 case "$p_" in
4619 :) ;;
4620 *)
4621         $cat <<'EOI'
4622 I have the feeling something is not exactly right, however...don't tell me...
4623 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4624 (Or you may be running DOS with DJGPP.)
4625 EOI
4626         echo exit 0 >os2
4627         ;;
4628 esac
4629 if test -f /xenix; then
4630         echo "Actually, this looks more like a XENIX system..."
4631         echo exit 0 >xenix
4632         d_xenix="$define"
4633 else
4634         echo " "
4635         echo "It's not Xenix..."
4636         d_xenix="$undef"
4637 fi
4638 chmod +x xenix
4639 $eunicefix xenix
4640 if test -f /venix; then
4641         echo "Actually, this looks more like a VENIX system..."
4642         echo exit 0 >venix
4643 else
4644         echo " "
4645         if ./xenix; then
4646                 : null
4647         else
4648                 echo "Nor is it Venix..."
4649         fi
4650 fi
4651 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4652 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4653 $rm -f foo
4654
4655 : Check if we are using GNU gcc and what its version is
4656 echo " "
4657 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4658 $cat >try.c <<EOM
4659 #include <stdio.h>
4660 int main() {
4661 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4662 #ifdef __VERSION__
4663         printf("%s\n", __VERSION__);
4664 #else
4665         printf("%s\n", "1");
4666 #endif
4667 #endif
4668         return(0);
4669 }
4670 EOM
4671 if $cc -o try $ccflags $ldflags try.c; then
4672         gccversion=`$run ./try`
4673         case "$gccversion" in
4674         '') echo "You are not using GNU cc." ;;
4675         *)  echo "You are using GNU cc $gccversion."
4676             ccname=gcc
4677             ;;
4678         esac
4679 else
4680         echo " "
4681         echo "*** WHOA THERE!!! ***" >&4
4682         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4683         case "$knowitall" in
4684         '')
4685         echo "    You'd better start hunting for one and let me know about it." >&4
4686                 exit 1
4687                 ;;
4688         esac
4689 fi
4690 $rm -f try try.*
4691 case "$gccversion" in
4692 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4693 esac
4694 case "$gccversion" in
4695 '') gccosandvers='' ;;
4696 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4697    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4698    gccshortvers=''
4699    case "$gccosandvers" in
4700    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4701    $osname$osvers) ;; # looking good
4702    $osname*) cat <<EOM >&4
4703
4704 *** WHOA THERE!!! ***
4705
4706     Your gcc has not been compiled for the exact release of
4707     your operating system ($gccosandvers versus $osname$osvers).
4708
4709     In general it is a good idea to keep gcc synchronized with
4710     the operating system because otherwise serious problems
4711     may ensue when trying to compile software, like Perl.
4712
4713     I'm trying to be optimistic here, though, and will continue.
4714     If later during the configuration and build icky compilation
4715     problems appear (headerfile conflicts being the most common
4716     manifestation), I suggest reinstalling the gcc to match
4717     your operating system release.
4718
4719 EOM
4720       ;;
4721    *) gccosandvers='' ;; # failed to parse, better be silent
4722    esac
4723    ;;
4724 esac
4725 case "$ccname" in
4726 '') ccname="$cc" ;;
4727 esac
4728
4729 # gcc 3.* complain about adding -Idirectories that they already know about,
4730 # so we will take those off from locincpth.
4731 case "$gccversion" in
4732 3*)
4733     echo "main(){}">try.c
4734     for incdir in $locincpth; do
4735        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4736              grep '^c[cp]p*[01]: warning: changing search order '`
4737        if test "X$warn" != X; then
4738            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4739        fi
4740     done
4741     $rm -f try try.*
4742 esac
4743
4744 # gcc 4.9 by default does some optimizations that break perl.
4745 # see ticket 121505.
4746 #
4747 # The -fwrapv disables those optimizations (and probably others,) so
4748 # for gcc 4.9 (and later, since the optimizations probably won't go
4749 # away), add -fwrapv unless the user requests -fno-wrapv, which
4750 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4751 # which turns the overflows -fwrapv ignores into runtime errors.
4752 case "$gccversion" in
4753 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4754     case "$ccflags" in
4755     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4756     *) ccflags="$ccflags -fwrapv" ;;
4757     esac
4758 esac
4759
4760 : What should the include directory be ?
4761 : Use sysroot if set, so findhdr looks in the right place.
4762 echo " "
4763 $echo $n "Hmm...  $c"
4764 dflt="$sysroot/usr/include"
4765 incpath=''
4766 mips_type=''
4767 if $test -f /bin/mips && /bin/mips; then
4768         echo "Looks like a MIPS system..."
4769         $cat >usr.c <<'EOCP'
4770 #ifdef SYSTYPE_BSD43
4771 /bsd43
4772 #endif
4773 EOCP
4774         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4775                 dflt='/bsd43/usr/include'
4776                 incpath='/bsd43'
4777                 mips_type='BSD 4.3'
4778         else
4779                 mips_type='System V'
4780         fi
4781         $rm -f usr.c usr.out
4782         echo "and you're compiling with the $mips_type compiler and libraries."
4783         xxx_prompt=y
4784         echo "exit 0" >mips
4785 else
4786         echo "Doesn't look like a MIPS system."
4787         xxx_prompt=n
4788         echo "exit 1" >mips
4789 fi
4790 chmod +x mips
4791 $eunicefix mips
4792 case "$usrinc" in
4793 '') ;;
4794 *) dflt="$usrinc";;
4795 esac
4796 case "$xxx_prompt" in
4797 y)      fn=d/
4798         echo " "
4799         rp='Where are the include files you want to use?'
4800         . ./getfile
4801         usrinc="$ans"
4802         ;;
4803 *)      usrinc="$dflt"
4804         ;;
4805 esac
4806
4807 : see how we invoke the C preprocessor
4808 echo " "
4809 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4810 cat <<'EOT' >testcpp.c
4811 #define ABC abc
4812 #define XYZ xyz
4813 ABC.XYZ
4814 EOT
4815 cd ..
4816 if test ! -f cppstdin; then
4817         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4818                 # AIX cc -E doesn't show the absolute headerfile
4819                 # locations but we'll cheat by using the -M flag.
4820                 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
4821         else
4822                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4823         fi
4824 else
4825         echo "Keeping your $hint cppstdin wrapper."
4826 fi
4827 chmod 755 cppstdin
4828 wrapper=`pwd`/cppstdin
4829 ok='false'
4830 cd UU
4831
4832 if $test "X$cppstdin" != "X" && \
4833         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4834         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4835 then
4836         echo "You used to use $cppstdin $cppminus so we'll use that again."
4837         case "$cpprun" in
4838         '') echo "But let's see if we can live without a wrapper..." ;;
4839         *)
4840                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4841                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4842                 then
4843                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4844                         ok='true'
4845                 else
4846                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4847                 fi
4848                 ;;
4849         esac
4850 else
4851         case "$cppstdin" in
4852         '') ;;
4853         *)
4854                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4855                 ;;
4856         esac
4857 fi
4858
4859 if $ok; then
4860         : nothing
4861 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4862         $cc -E <testcpp.c >testcpp.out 2>&1; \
4863         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4864         echo "Yup, it does."
4865         x_cpp="$cc $cppflags -E"
4866         x_minus='';
4867 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4868         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4869         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4870         echo "Yup, it does."
4871         x_cpp="$cc $cppflags -E"
4872         x_minus='-';
4873 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4874         $cc -P <testcpp.c >testcpp.out 2>&1; \
4875         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4876         echo "Yipee, that works!"
4877         x_cpp="$cc $cppflags -P"
4878         x_minus='';
4879 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4880         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4881         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4882         echo "At long last!"
4883         x_cpp="$cc $cppflags -P"
4884         x_minus='-';
4885 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4886         $cpp <testcpp.c >testcpp.out 2>&1; \
4887         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4888         echo "It works!"
4889         x_cpp="$cpp $cppflags"
4890         x_minus='';
4891 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4892         $cpp - <testcpp.c >testcpp.out 2>&1; \
4893         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4894         echo "Hooray, it works!  I was beginning to wonder."
4895         x_cpp="$cpp $cppflags"
4896         x_minus='-';
4897 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4898         $wrapper <testcpp.c >testcpp.out 2>&1; \
4899         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4900         x_cpp="$wrapper"
4901         x_minus=''
4902         echo "Eureka!"
4903 else
4904         dflt=''
4905         rp="No dice.  I can't find a C preprocessor.  Name one:"
4906         . ./myread
4907         x_cpp="$ans"
4908         x_minus=''
4909         $x_cpp <testcpp.c >testcpp.out 2>&1
4910         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4911                 echo "OK, that will do." >&4
4912         else
4913 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4914                 exit 1
4915         fi
4916 fi
4917
4918 case "$ok" in
4919 false)
4920         cppstdin="$x_cpp"
4921         cppminus="$x_minus"
4922         cpprun="$x_cpp"
4923         cpplast="$x_minus"
4924         set X $x_cpp
4925         shift
4926         case "$1" in
4927         "$cpp")
4928                 echo "Perhaps can we force $cc -E using a wrapper..."
4929                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4930                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4931                 then
4932                         echo "Yup, we can."
4933                         cppstdin="$wrapper"
4934                         cppminus='';
4935                 else
4936                         echo "Nope, we'll have to live without it..."
4937                 fi
4938                 ;;
4939         esac
4940         case "$cpprun" in
4941         "$wrapper")
4942                 cpprun=''
4943                 cpplast=''
4944                 ;;
4945         esac
4946         ;;
4947 esac
4948
4949 case "$cppstdin" in
4950 "$wrapper"|'cppstdin') ;;
4951 *) $rm -f $wrapper;;
4952 esac
4953 $rm -f testcpp.c testcpp.out
4954
4955 : Adjust cppfilter for path component separator
4956 case "$osname" in
4957 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4958 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4959 *)   cppfilter='' ;;
4960 esac
4961
4962 : Use gcc to determine libpth and incpth
4963 # If using gcc or clang, we can get better values for libpth, incpth
4964 # and usrinc directly from the compiler.
4965 # Note that ccname for clang is also gcc.
4966 case "$ccname" in
4967     gcc)
4968         $echo 'extern int foo;' > try.c
4969         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4970         shift
4971         if $test $# -gt 0; then
4972             incpth="$incpth $*"
4973             incpth="`$echo $incpth|$sed 's/^ //'`"
4974             for i in $*; do
4975                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4976                 if $test -d $j; then
4977                     libpth="$libpth $j"
4978                 fi
4979             done
4980             libpth="`$echo $libpth|$sed 's/^ //'`"
4981             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4982                 if $test -d $xxx; then
4983                     case " $libpth " in
4984                     *" $xxx "*) ;;
4985                     *) libpth="$libpth $xxx";;
4986                     esac
4987                 fi
4988             done
4989         fi
4990         $rm -f try.c
4991         case "$usrinc" in
4992         '') for i in $incpth; do
4993                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4994                     usrinc="$i"
4995                     break
4996                 fi
4997             done
4998             ;;
4999         esac
5000
5001         case "$usecrosscompile" in
5002         $define|true|[yY]*)
5003             case "$incpth" in
5004                 '') echo "Incpth not defined." >&4; croak=y ;;
5005                 *)  echo "Using incpth '$incpth'." >&4 ;;
5006             esac
5007             case "$libpth" in
5008                 '') echo "Libpth not defined." >&4; croak=y ;;
5009                 *)  echo "Using libpth '$libpth'." >&4 ;;
5010             esac
5011             case "$usrinc" in
5012                 '') echo "Usrinc not defined." >&4; croak=y ;;
5013                 *)  echo "Using usrinc $usrinc." >&4 ;;
5014             esac
5015             case "$croak" in
5016                 y)
5017                 if test "X$sysroot" = X; then
5018                     echo "Cannot continue, aborting." >&4; exit 1
5019                 else
5020                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5021                 fi
5022                 ;;
5023             esac
5024             ;;
5025         esac
5026     ;;
5027 esac
5028
5029 : Default value for incpth is just usrinc
5030 case "$incpth" in
5031 '') incpth="$usrinc";;
5032 esac
5033
5034 : Set private lib path
5035 case "$plibpth" in
5036 '') if ./mips; then
5037         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5038     fi;;
5039 esac
5040 case "$libpth" in
5041 ' ') dlist='';;
5042 '') dlist="$loclibpth $plibpth $glibpth";;
5043 *) dlist="$libpth";;
5044 esac
5045
5046 : Now check and see which directories actually exist, avoiding duplicates
5047 for xxx in $dlist
5048 do
5049     if $test -d $xxx; then
5050                 case " $libpth " in
5051                 *" $xxx "*) ;;
5052                 *) libpth="$libpth $xxx";;
5053                 esac
5054     fi
5055 done
5056 $cat <<'EOM'
5057
5058 Some systems have incompatible or broken versions of libraries.  Among
5059 the directories listed in the question below, please remove any you
5060 know not to be holding relevant libraries, and add any that are needed.
5061 Say "none" for none.
5062
5063 EOM
5064
5065 if test "X$sysroot" != X; then
5066     $cat <<EOM
5067 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5068
5069 EOM
5070 fi
5071
5072 case "$libpth" in
5073 '') dflt='none';;
5074 *)
5075         set X $libpth
5076         shift
5077         dflt=${1+"$@"}
5078         ;;
5079 esac
5080 rp="Directories to use for library searches?"
5081 . ./myread
5082 case "$ans" in
5083 none) libpth=' ';;
5084 *) libpth="$ans";;
5085 esac
5086
5087 : compute shared library extension
5088 case "$so" in
5089 '')
5090         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5091                 dflt='sl'
5092         else
5093                 dflt='so'
5094         fi
5095         ;;
5096 *) dflt="$so";;
5097 esac
5098 $cat <<EOM
5099
5100 On some systems, shared libraries may be available.  Answer 'none' if
5101 you want to suppress searching of shared libraries for the remainder
5102 of this configuration.
5103
5104 EOM
5105 rp='What is the file extension used for shared libraries?'
5106 . ./myread
5107 so="$ans"
5108
5109 : Does target system insist that shared library basenames are unique
5110 $cat << EOM
5111
5112 Some dynamic loaders assume that the *basename* of shared library filenames
5113 are globally unique.  We'll default this to undef as we assume your system
5114 is not this weird. Set to defined if you're on one of them.
5115
5116 EOM
5117
5118 dflt='n'
5119 rp='Make shared library basenames unique?'
5120 . ./myread
5121 case "$ans" in
5122 y|Y) val="$define" ;;
5123 *)   val="$undef"  ;;
5124 esac
5125 set d_libname_unique
5126 eval $setvar
5127
5128 : Define several unixisms.
5129 : Hints files or command line option can be used to override them.
5130 : The convoluted testing is in case hints files set either the old
5131 : or the new name.
5132 case "$_exe" in
5133 '')     case "$exe_ext" in
5134         '')     ;;
5135         *)      _exe="$exe_ext" ;;
5136         esac
5137         ;;
5138 esac
5139 case "$_a" in
5140 '')     case "$lib_ext" in
5141     '') _a='.a';;
5142         *)      _a="$lib_ext" ;;
5143         esac
5144         ;;
5145 esac
5146 case "$_o" in
5147 '') case "$obj_ext" in
5148         '')     _o='.o';;
5149         *)      _o="$obj_ext";;
5150         esac
5151         ;;
5152 esac
5153 case "$p_" in
5154 '') case "$path_sep" in
5155         '')     p_=':';;
5156         *)      p_="$path_sep";;
5157         esac
5158         ;;
5159 esac
5160 exe_ext=$_exe
5161 lib_ext=$_a
5162 obj_ext=$_o
5163 path_sep=$p_
5164
5165 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5166
5167 : Which makefile gets called first.  This is used by make depend.
5168 case "$firstmakefile" in
5169 '') firstmakefile='makefile';;
5170 esac
5171
5172 : Check is we will use socks
5173 case "$usesocks" in
5174 $define|true|[yY]*)     dflt='y';;
5175 *) dflt='n';;
5176 esac
5177 cat <<EOM
5178
5179 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5180 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5181 to use the PerlIO abstraction layer, this will be implicitly selected.
5182
5183 If this doesn't make any sense to you, just accept the default '$dflt'.
5184 EOM
5185 rp='Build Perl for SOCKS?'
5186 . ./myread
5187 case "$ans" in
5188 y|Y)    val="$define" ;;
5189 *)      val="$undef" ;;
5190 esac
5191 set usesocks
5192 eval $setvar
5193
5194 : Check for uselongdouble support
5195 case "$ccflags" in
5196 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5197 esac
5198
5199 case "$uselongdouble" in
5200 $define|true|[yY]*)     dflt='y';;
5201 *) dflt='n';;
5202 esac
5203 cat <<EOM
5204
5205 Perl can be built to take advantage of long doubles which
5206 (if available) may give more accuracy and range for floating point numbers.
5207
5208 If this doesn't make any sense to you, just accept the default '$dflt'.
5209 EOM
5210 rp='Try to use long doubles if available?'
5211 . ./myread
5212 case "$ans" in
5213 y|Y)    val="$define"   ;;
5214 *)      val="$undef"    ;;
5215 esac
5216 set uselongdouble
5217 eval $setvar
5218
5219 case "$uselongdouble" in
5220 true|[yY]*) uselongdouble="$define" ;;
5221 esac
5222
5223 : Look for a hint-file generated 'call-back-unit'.  If the
5224 : user has specified that long doubles should be used,
5225 : we may need to set or change some other defaults.
5226 if $test -f uselongdouble.cbu; then
5227     echo "Your platform has some specific hints regarding long doubles, using them..."
5228     . ./uselongdouble.cbu
5229 else
5230     case "$uselongdouble" in
5231         $define)
5232                 $cat <<EOM
5233 (Your platform does not have any specific hints for long doubles.)
5234 EOM
5235         ;;
5236     esac
5237 fi
5238
5239 : Check if quadmath is requested
5240 case "$usequadmath" in
5241 "$define"|true|[yY]*) usequadmath="$define" ;;
5242 *)                    usequadmath="$undef"  ;;
5243 esac
5244
5245 : Fail if both uselongdouble and usequadmath are requested
5246 case "$usequadmath:$uselongdouble" in
5247 define:define)
5248         $cat <<EOM >&4
5249
5250 *** You requested the use of the quadmath library and use
5251 *** of long doubles.
5252 ***
5253 *** Please select one or the other.
5254 EOM
5255         exit 1
5256         ;;
5257 esac
5258
5259 : Looking for optional libraries
5260 echo " "
5261 echo "Checking for optional libraries..." >&4
5262 case "$libs" in
5263 ' '|'') dflt='';;
5264 *) dflt="$libs";;
5265 esac
5266 case "$libswanted" in
5267 '') libswanted='c_s';;
5268 esac
5269 case "$usesocks" in
5270 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5271 esac
5272 case "$usecbacktrace" in
5273 "$define") libswanted="$libswanted bfd" ;;
5274 esac
5275 case "$usequadmath" in
5276 "$define") libswanted="$libswanted quadmath" ;;
5277 esac
5278 libsfound=''
5279 libsfiles=''
5280 libsdirs=''
5281 libspath=''
5282 for thisdir in $libpth $xlibpth; do
5283   test -d $thisdir && libspath="$libspath $thisdir"
5284 done
5285 for thislib in $libswanted; do
5286         for thisdir in $libspath; do
5287             xxx=''
5288             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5289                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5290                 $test -f "$xxx" && eval $libscheck
5291                 $test -f "$xxx" && libstyle=shared
5292                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5293                 $test -f "$xxx" && eval $libscheck
5294                 $test -f "$xxx" && libstyle=shared
5295             fi
5296             if test ! -f "$xxx"; then
5297                 xxx=$thisdir/lib$thislib.$so
5298                 $test -f "$xxx" && eval $libscheck
5299                 $test -f "$xxx" && libstyle=shared
5300             fi
5301             if test ! -f "$xxx"; then
5302                 xxx=$thisdir/lib$thislib$_a
5303                 $test -f "$xxx" && eval $libscheck
5304                 $test -f "$xxx" && libstyle=static
5305             fi
5306             if test ! -f "$xxx"; then
5307                 xxx=$thisdir/$thislib$_a
5308                 $test -f "$xxx" && eval $libscheck
5309                 $test -f "$xxx" && libstyle=static
5310             fi
5311             if test ! -f "$xxx"; then
5312                 xxx=$thisdir/lib${thislib}_s$_a
5313                 $test -f "$xxx" && eval $libscheck
5314                 $test -f "$xxx" && libstyle=static
5315                 $test -f "$xxx" && thislib=${thislib}_s
5316             fi
5317             if test ! -f "$xxx"; then
5318                 xxx=$thisdir/Slib$thislib$_a
5319                 $test -f "$xxx" && eval $libscheck
5320                 $test -f "$xxx" && libstyle=static
5321             fi
5322             if $test -f "$xxx"; then
5323                 case "$libstyle" in
5324                 shared) echo "Found -l$thislib (shared)." ;;
5325                 static) echo "Found -l$thislib." ;;
5326                 *)      echo "Found -l$thislib ($libstyle)." ;;
5327                 esac
5328                 case " $dflt " in
5329                 *"-l$thislib "*);;
5330                 *) dflt="$dflt -l$thislib"
5331                    libsfound="$libsfound $xxx"
5332                    yyy=`basename $xxx`
5333                    libsfiles="$libsfiles $yyy"
5334                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5335                    case " $libsdirs " in
5336                    *" $yyy "*) ;;
5337                    *) libsdirs="$libsdirs $yyy" ;;
5338                    esac
5339                    ;;
5340                 esac
5341                 break
5342             fi
5343         done
5344         if $test ! -f "$xxx"; then
5345             echo "No -l$thislib."
5346         fi
5347 done
5348 set X $dflt
5349 shift
5350 dflt="$*"
5351 case "$libs" in
5352 '') dflt="$dflt";;
5353 *) dflt="$libs";;
5354 esac
5355 case "$dflt" in
5356 ' '|'') dflt='none';;
5357 esac
5358
5359 $cat <<EOM
5360
5361 In order to compile $package on your machine, a number of libraries
5362 are usually needed.  Include any other special libraries here as well.
5363 Say "none" for none.  The default list is almost always right.
5364 EOM
5365
5366 echo " "
5367 rp="What libraries to use?"
5368 . ./myread
5369 case "$ans" in
5370 none) libs=' ';;
5371 *) libs="$ans";;
5372 esac
5373
5374 : determine optimization, if desired, or use for debug flag also
5375 case "$optimize" in
5376 ' '|$undef) dflt='none';;
5377 '') dflt='-O';;
5378 *) dflt="$optimize";;
5379 esac
5380 $cat <<EOH
5381
5382 By default, $package compiles with the -O flag to use the optimizer.
5383 Alternately, you might want to use the symbolic debugger, which uses
5384 the -g flag (on traditional Unix systems).  Either flag can be
5385 specified here.  To use neither flag, specify the word "none".
5386
5387 EOH
5388 rp="What optimizer/debugger flag should be used?"
5389 . ./myread
5390 optimize="$ans"
5391 case "$optimize" in
5392 'none') optimize=" ";;
5393 esac
5394
5395 : Check what DEBUGGING is required from the command line
5396 : -DEBUGGING      or -DDEBUGGING or
5397 : -DEBUGGING=both                       = -g + -DDEBUGGING
5398 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5399 : -DEBUGGING=none or -UDEBUGGING        =
5400 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5401 case "$EBUGGING" in
5402 '')     ;;
5403 *)      DEBUGGING=$EBUGGING ;;
5404 esac
5405
5406 case "$DEBUGGING" in
5407 -g|both|$define)
5408     case "$optimize" in
5409         *-g*) ;;
5410         *)    optimize="$optimize -g" ;;
5411     esac ;;
5412 none|$undef)
5413     case "$optimize" in
5414         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5415                 shift
5416                 optimize="$*"
5417                 ;;
5418     esac ;;
5419 esac
5420
5421 dflt=''
5422 case "$DEBUGGING" in
5423 both|$define) dflt='-DDEBUGGING'
5424 esac
5425
5426 : argument order is deliberate, as the flag will start with - which set could
5427 : think is an option
5428 checkccflag='check=$1; flag=$2; callback=$3;
5429 echo " ";
5430 echo "Checking if your compiler accepts $flag" 2>&1;
5431 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5432 echo "int main(void) { return 0; }" > gcctest.c;
5433 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5434     echo "Yes, it does." 2>&1;
5435     if $test -s gcctest.out ; then
5436         echo "But your platform does not like it:";
5437         cat gcctest.out;
5438     else
5439         case "$ccflags" in
5440         *$check*)
5441             echo "Leaving current flags $ccflags alone." 2>&1
5442             ;;
5443         *) dflt="$dflt $flag";
5444             eval $callback
5445             ;;
5446         esac
5447     fi
5448 else
5449     echo "Nope, it does not, but that is ok." 2>&1;
5450 fi
5451 '
5452
5453 : We will not override a previous value, but we might want to
5454 : augment a hint file
5455 case "$hint" in
5456 default|recommended)
5457         case "$gccversion" in
5458         1*) dflt="$dflt -fpcc-struct-return" ;;
5459         esac
5460         case "$optimize:$DEBUGGING" in
5461         *-g*:old) dflt="$dflt -DDEBUGGING";;
5462         esac
5463         case "$gccversion" in
5464         2*) if $test -d /etc/conf/kconfig.d &&
5465                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5466                 then
5467                         # Interactive Systems (ISC) POSIX mode.
5468                         dflt="$dflt -posix"
5469                 fi
5470                 ;;
5471         esac
5472         case "$gccversion" in
5473         1*) ;;
5474         2.[0-8]*) ;;
5475         ?*)     set strict-aliasing -fno-strict-aliasing
5476                 eval $checkccflag
5477                 ;;
5478         esac
5479         # For gcc, adding -pipe speeds up compilations for some, but apparently
5480         # some assemblers can't read from stdin.  (It also slows down compilations
5481         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5482         case "$gccversion" in
5483         ?*)     set pipe -pipe
5484                 eval $checkccflag
5485                 ;;
5486         esac
5487
5488         # on x86_64 (at least) we require an extra library (libssp) in the
5489         # link command line. This library is not named, so I infer that it is
5490         # an implementation detail that may change. Hence the safest approach
5491         # is to add the flag to the flags passed to the compiler at link time,
5492         # as that way the compiler can do the right implementation dependant
5493         # thing. (NWC)
5494         case "$osname" in
5495         amigaos) ;; # -fstack-protector builds but doesn't work
5496         *)      case "$gccversion" in
5497                 ?*)     set stack-protector-strong -fstack-protector-strong
5498                         eval $checkccflag
5499                         case "$dflt" in
5500                         *-fstack-protector-strong*) ;; # It got added.
5501                         *) # Try the plain/older -fstack-protector.
5502                            set stack-protector -fstack-protector
5503                            eval $checkccflag
5504                            ;;
5505                         esac
5506                         ;;
5507                 esac
5508                 ;;
5509         esac
5510         ;;
5511 esac
5512
5513 case "$mips_type" in
5514 *BSD*|'') inclwanted="$locincpth $usrinc";;
5515 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5516 esac
5517 for thisincl in $inclwanted; do
5518         if $test -d $thisincl; then
5519                 if $test x$thisincl != x$usrinc; then
5520                         case "$dflt" in
5521                         *" -I$thisincl "*);;
5522                         *) dflt="$dflt -I$thisincl ";;
5523                         esac
5524                 fi
5525         fi
5526 done
5527
5528 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5529         xxx=true;
5530 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5531         xxx=true;
5532 else
5533         xxx=false;
5534 fi;
5535 if $xxx; then
5536         case "$dflt" in
5537         *$2*);;
5538         *) dflt="$dflt -D$2";;
5539         esac;
5540 fi'
5541
5542 set signal.h LANGUAGE_C; eval $inctest
5543
5544 case "$usesocks" in
5545 $define)
5546         ccflags="$ccflags -DSOCKS"
5547         ;;
5548 esac
5549
5550 case "$hint" in
5551 default|recommended) dflt="$ccflags $dflt" ;;
5552 *) dflt="$ccflags";;
5553 esac
5554
5555 case "$dflt" in
5556 ''|' ') dflt=none;;
5557 esac
5558
5559 $cat <<EOH
5560
5561 Your C compiler may want other flags.  For this question you should include
5562 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5563 but you should NOT include libraries or ld flags like -lwhatever.  If you
5564 want $package to honor its debug switch, you should include -DDEBUGGING here.
5565 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5566
5567 To use no flags, specify the word "none".
5568
5569 EOH
5570 set X $dflt
5571 shift
5572 dflt=${1+"$@"}
5573 rp="Any additional cc flags?"
5574 . ./myread
5575 case "$ans" in
5576 none) ccflags='';;
5577 *) ccflags="$ans";;
5578 esac
5579
5580 : the following weeds options from ccflags that are of no interest to cpp
5581 case "$cppflags" in
5582 '') cppflags="$ccflags" ;;
5583 *)  set X $ccflags; shift
5584     case " $cppflags " in
5585     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5586     *) cppflags="$cppflags $ccflags" ;;
5587     esac
5588     ;;
5589 esac
5590 case "$gccversion" in
5591 1*) cppflags="$cppflags -D__GNUC__"
5592 esac
5593 case "$mips_type" in
5594 '');;
5595 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5596 esac
5597 case "$cppflags" in
5598 '');;
5599 *)
5600         echo " "
5601         echo "Let me guess what the preprocessor flags are..." >&4
5602         set X $cppflags
5603         shift
5604         cppflags=''
5605         $cat >cpp.c <<'EOM'
5606 #define BLURFL foo
5607
5608 BLURFL xx LFRULB
5609 EOM
5610         previous=''
5611         for flag in $*
5612         do
5613                 case "$flag" in
5614                 -*) ftry="$flag";;
5615                 *) ftry="$previous $flag";;
5616                 esac
5617                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5618                         >cpp1.out 2>/dev/null && \
5619                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5620                         >cpp2.out 2>/dev/null && \
5621                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5622                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5623                 then
5624                         cppflags="$cppflags $ftry"
5625                         previous=''
5626                 else
5627                         previous="$flag"
5628                 fi
5629         done
5630         set X $cppflags
5631         shift
5632         cppflags=${1+"$@"}
5633         case "$cppflags" in
5634         *-*)  echo "They appear to be: $cppflags";;
5635         esac
5636         $rm -f cpp.c cpp?.out
5637         ;;
5638 esac
5639
5640 : flags used in final linking phase
5641 case "$ldflags" in
5642 '') if ./venix; then
5643                 dflt='-i -z'
5644         else
5645                 dflt=''
5646         fi
5647         case "$ccflags" in
5648         *-posix*) dflt="$dflt -posix" ;;
5649         esac
5650         ;;
5651 *) dflt="$ldflags";;
5652 esac
5653 # See note above about -fstack-protector
5654 case "$ccflags" in
5655 *-fstack-protector-strong*)
5656         case "$dflt" in
5657         *-fstack-protector-strong*) ;; # Don't add it again
5658         *) dflt="$dflt -fstack-protector-strong" ;;
5659         esac
5660         ;;
5661 *-fstack-protector*)
5662         case "$dflt" in
5663         *-fstack-protector*) ;; # Don't add it again
5664         *) dflt="$dflt -fstack-protector" ;;
5665         esac
5666         ;;
5667 esac
5668
5669 : Try to guess additional flags to pick up local libraries.
5670 for thislibdir in $libpth; do
5671         case " $loclibpth " in
5672         *" $thislibdir "*)
5673                 case "$dflt " in
5674                 *"-L$thislibdir "*) ;;
5675                 *)  dflt="$dflt -L$thislibdir" ;;
5676                 esac
5677                 ;;
5678         esac
5679 done
5680
5681 case "$dflt" in
5682 '') dflt='none' ;;
5683 esac
5684
5685 $cat <<EOH
5686
5687 Your C linker may need flags.  For this question you should
5688 include -L/whatever and any other flags used by the C linker, but you
5689 should NOT include libraries like -lwhatever.
5690
5691 Make sure you include the appropriate -L/path flags if your C linker
5692 does not normally search all of the directories you specified above,
5693 namely
5694         $libpth
5695 To use no flags, specify the word "none".
5696
5697 EOH
5698
5699 rp="Any additional ld flags (NOT including libraries)?"
5700 . ./myread
5701 case "$ans" in
5702 none) ldflags='';;
5703 *) ldflags="$ans";;
5704 esac
5705 rmlist="$rmlist pdp11"
5706
5707 : coherency check
5708 echo " "
5709 echo "Checking your choice of C compiler and flags for coherency..." >&4
5710 $cat > try.c <<'EOF'
5711 #include <stdio.h>
5712 int main() { printf("Ok\n"); return(0); }
5713 EOF
5714 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5715 shift
5716 $cat >try.msg <<'EOM'
5717 I've tried to compile and run the following simple program:
5718
5719 EOM
5720 $cat try.c >> try.msg
5721
5722 $cat >> try.msg <<EOM
5723
5724 I used the command:
5725
5726         $*
5727         $run ./try
5728
5729 and I got the following output:
5730
5731 EOM
5732 dflt=y
5733 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5734         if $sh -c "$run ./try " >>try.msg 2>&1; then
5735                 xxx=`$run ./try`
5736                 case "$xxx" in
5737                 "Ok") dflt=n ;;
5738                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5739                 esac
5740         else
5741                 echo "The program compiled OK, but exited with status $?." >>try.msg
5742                 rp="You have a problem.  Shall I abort Configure"
5743                 dflt=y
5744         fi
5745 else
5746         echo "I can't compile the test program." >>try.msg
5747         rp="You have a BIG problem.  Shall I abort Configure"
5748         dflt=y
5749 fi
5750 case "$dflt" in
5751 y)
5752         $cat try.msg >&4
5753         case "$knowitall" in
5754         '')
5755                 echo "(The supplied flags or libraries might be incorrect.)"
5756                 ;;
5757         *) dflt=n;;
5758         esac
5759         echo " "
5760         . ./myread
5761         case "$ans" in
5762         n*|N*) ;;
5763         *)      echo "Ok.  Stopping Configure." >&4
5764                 exit 1
5765                 ;;
5766         esac
5767         ;;
5768 n) echo "OK, that should do.";;
5769 esac
5770 $rm_try gcctest gcctest.out
5771
5772 : define a shorthand compile call
5773 compile='
5774 mc_file=$1;
5775 shift;
5776 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5777 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5778 exit 1;
5779 fi;
5780 esac;
5781 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5782 : define a shorthand compile call for compilations that should be ok.
5783 compile_ok='
5784 mc_file=$1;
5785 shift;
5786 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5787
5788 : determine filename position in cpp output
5789 echo " "
5790 echo "Computing filename position in cpp output for #include directives..." >&4
5791 case "$osname" in
5792 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5793 esac
5794 case "$fieldn" in
5795 '')
5796 case "$osname" in
5797 vos) testaccess=-e ;;
5798 *)   testaccess=-r ;;
5799 esac
5800 echo '#include <stdio.h>' > foo.c
5801 $cat >fieldn <<EOF
5802 $startsh
5803 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5804 $grep '^[       ]*#.*stdio\.h' | \
5805 while read cline; do
5806         pos=1
5807         set \$cline
5808         while $test \$# -gt 0; do
5809                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5810                         echo "\$pos"
5811                         exit 0
5812                 fi
5813                 shift
5814                 pos=\`expr \$pos + 1\`
5815         done
5816 done
5817 EOF
5818 chmod +x fieldn
5819 fieldn=`./fieldn`
5820 $rm -f foo.c fieldn
5821 ;;
5822 esac
5823 case $fieldn in
5824 '') pos='???';;
5825 1) pos=first;;
5826 2) pos=second;;
5827 3) pos=third;;
5828 *) pos="${fieldn}th";;
5829 esac
5830 echo "Your cpp writes the filename in the $pos field of the line."
5831
5832 : locate header file
5833 $cat >findhdr <<EOF
5834 $startsh
5835 wanted=\$1
5836 name=''
5837 for usrincdir in $incpth
5838 do
5839         if test -f \$usrincdir/\$wanted; then
5840                 echo "\$usrincdir/\$wanted"
5841                 exit 0
5842         fi
5843 done
5844 awkprg='{ print \$$fieldn }'
5845 echo "#include <\$wanted>" > foo\$\$.c
5846 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5847 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5848 while read cline; do
5849         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5850         case "\$name" in
5851         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5852         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5853         *) exit 2;;
5854         esac;
5855 done;
5856 #
5857 # status = 0: grep returned 0 lines, case statement not executed
5858 # status = 1: headerfile found
5859 # status = 2: while loop executed, no headerfile found
5860 #
5861 status=\$?
5862 $rm -f foo\$\$.c;
5863 if test \$status -eq 1; then
5864         exit 0;
5865 fi
5866 exit 1
5867 EOF
5868 chmod +x findhdr
5869
5870 : define an alternate in-header-list? function
5871 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5872 cont=true; xxf="echo \"<\$1> found.\" >&4";
5873 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5874 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5875 esac;
5876 case $# in 4) instead=instead;; *) instead="at last";; esac;
5877 while $test "$cont"; do
5878         xxx=`./findhdr $1`
5879         var=$2; eval "was=\$$2";
5880         if $test "$xxx" && $test -r "$xxx";
5881         then eval $xxf;
5882         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5883                 cont="";
5884         else eval $xxnf;
5885         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5886         set $yyy; shift; shift; yyy=$@;
5887         case $# in 0) cont="";;
5888         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5889                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5890         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5891                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5892         esac;
5893 done;
5894 while $test "$yyy";
5895 do set $yyy; var=$2; eval "was=\$$2";
5896         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5897         set $yyy; shift; shift; yyy=$@;
5898 done'
5899
5900 : see if stdlib is available
5901 set stdlib.h i_stdlib
5902 eval $inhdr
5903
5904 : check for lengths of integral types
5905 echo " "
5906 case "$intsize" in
5907 '')
5908         echo "Checking to see how big your integers are..." >&4
5909         $cat >try.c <<EOCP
5910 #include <stdio.h>
5911 #$i_stdlib I_STDLIB
5912 #ifdef I_STDLIB
5913 #include <stdlib.h>
5914 #endif
5915 int main()
5916 {
5917         printf("intsize=%d;\n", (int)sizeof(int));
5918         printf("longsize=%d;\n", (int)sizeof(long));
5919         printf("shortsize=%d;\n", (int)sizeof(short));
5920         exit(0);
5921 }
5922 EOCP
5923         set try
5924         if eval $compile_ok && $run ./try > /dev/null; then
5925                 eval `$run ./try`
5926                 echo "Your integers are $intsize bytes long."
5927                 echo "Your long integers are $longsize bytes long."
5928                 echo "Your short integers are $shortsize bytes long."
5929         else
5930                 $cat >&4 <<EOM
5931 !
5932 Help! I can't compile and run the intsize test program: please enlighten me!
5933 (This is probably a misconfiguration in your system or libraries, and
5934 you really ought to fix it.  Still, I'll try anyway.)
5935 !
5936 EOM
5937                 dflt=4
5938                 rp="What is the size of an integer (in bytes)?"
5939                 . ./myread
5940                 intsize="$ans"
5941                 dflt=$intsize
5942                 rp="What is the size of a long integer (in bytes)?"
5943                 . ./myread
5944                 longsize="$ans"
5945                 dflt=2
5946                 rp="What is the size of a short integer (in bytes)?"
5947                 . ./myread
5948                 shortsize="$ans"
5949         fi
5950         ;;
5951 esac
5952 $rm_try
5953
5954 : check for long long
5955 echo " "
5956 echo "Checking to see if you have long long..." >&4
5957 echo 'int main() { long long x = 7; return 0; }' > try.c
5958 set try
5959 if eval $compile; then
5960         val="$define"
5961         echo "You have long long."
5962 else
5963         val="$undef"
5964         echo "You do not have long long."
5965 fi
5966 $rm_try
5967 set d_longlong
5968 eval $setvar
5969
5970 : check for length of long long
5971 case "${d_longlong}${longlongsize}" in
5972 $define)
5973         echo " "
5974         echo "Checking to see how big your long longs are..." >&4
5975         $cat >try.c <<'EOCP'
5976 #include <stdio.h>
5977 int main()
5978 {
5979     printf("%d\n", (int)sizeof(long long));
5980     return(0);
5981 }
5982 EOCP
5983         set try
5984         if eval $compile_ok; then
5985                 longlongsize=`$run ./try`
5986                 echo "Your long longs are $longlongsize bytes long."
5987         else
5988                 dflt='8'
5989                 echo " "
5990                 echo "(I can't seem to compile the test program.  Guessing...)"
5991                 rp="What is the size of a long long (in bytes)?"
5992                 . ./myread
5993                 longlongsize="$ans"
5994         fi
5995         if $test "X$longsize" = "X$longlongsize"; then
5996                 echo "(That isn't any different from an ordinary long.)"
5997         fi
5998         ;;
5999 esac
6000 $rm_try
6001
6002 : see if inttypes.h is available
6003 : we want a real compile instead of Inhdr because some systems
6004 : have an inttypes.h which includes non-existent headers
6005 echo " "
6006 $cat >try.c <<EOCP
6007 #include <inttypes.h>
6008 int main() {
6009         static int32_t foo32 = 0x12345678;
6010 }
6011 EOCP
6012 set try
6013 if eval $compile; then
6014         echo "<inttypes.h> found." >&4
6015         val="$define"
6016 else
6017         echo "<inttypes.h> NOT found." >&4
6018         val="$undef"
6019 fi
6020 $rm_try
6021 set i_inttypes
6022 eval $setvar
6023
6024 : check for int64_t
6025 echo " "
6026 echo "Checking to see if you have int64_t..." >&4
6027 $cat >try.c <<EOCP
6028 #include <sys/types.h>
6029 #$i_inttypes I_INTTYPES
6030 #ifdef I_INTTYPES
6031 #include <inttypes.h>
6032 #endif
6033 int main() { int64_t x = 7; }
6034 EOCP
6035 set try
6036 if eval $compile; then
6037         val="$define"
6038         echo "You have int64_t."
6039 else
6040         val="$undef"
6041         echo "You do not have int64_t."
6042 fi
6043 $rm_try
6044 set d_int64_t
6045 eval $setvar
6046
6047 : Check if 64bit ints have a quad type
6048 echo " "
6049 echo "Checking which 64-bit integer type we could use..." >&4
6050
6051 case "$intsize" in
6052 8) val=int
6053    set quadtype
6054    eval $setvar
6055    val='"unsigned int"'
6056    set uquadtype
6057    eval $setvar
6058    quadkind=1
6059    ;;
6060 *) case "$longsize" in
6061    8) val=long
6062       set quadtype
6063       eval $setvar
6064       val='"unsigned long"'
6065       set uquadtype
6066       eval $setvar
6067       quadkind=2
6068       ;;
6069    *) case "$d_longlong:$longlongsize" in
6070       define:8)
6071         val='"long long"'
6072         set quadtype
6073         eval $setvar
6074         val='"unsigned long long"'
6075         set uquadtype
6076         eval $setvar
6077         quadkind=3
6078         ;;
6079       *) case "$d_int64_t" in
6080          define)
6081            val=int64_t
6082            set quadtype
6083            eval $setvar
6084            val=uint64_t
6085            set uquadtype
6086            eval $setvar
6087            quadkind=4
6088            ;;
6089          esac
6090          ;;
6091       esac
6092       ;;
6093    esac
6094    ;;
6095 esac
6096
6097 case "$quadtype" in
6098 '')     echo "Alas, no 64-bit integer types in sight." >&4
6099         d_quad="$undef"
6100         ;;
6101 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6102         d_quad="$define"
6103         ;;
6104 esac
6105
6106 : Do we want 64bit support
6107 case "$uselonglong" in
6108 "$define"|true|[yY]*)
6109         cat <<EOM >&4
6110
6111 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6112 EOM
6113         use64bitint="$define"
6114         ;;
6115 esac
6116 case "$use64bits" in
6117 "$define"|true|[yY]*)
6118         cat <<EOM >&4
6119
6120 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6121 EOM
6122         use64bitint="$define"
6123         ;;
6124 esac
6125 case "$use64bitints" in
6126 "$define"|true|[yY]*)
6127         cat <<EOM >&4
6128
6129 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6130 EOM
6131         use64bitint="$define"
6132         ;;
6133 esac
6134 case "$use64bitsint" in
6135 "$define"|true|[yY]*)
6136         cat <<EOM >&4
6137
6138 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6139 EOM
6140         use64bitint="$define"
6141         ;;
6142 esac
6143 case "$uselonglongs" in
6144 "$define"|true|[yY]*)
6145         cat <<EOM >&4
6146
6147 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6148 EOM
6149         use64bitint="$define"
6150         ;;
6151 esac
6152 case "$use64bitsall" in
6153 "$define"|true|[yY]*)
6154         cat <<EOM >&4
6155
6156 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6157 EOM
6158         use64bitall="$define"
6159         ;;
6160 esac
6161
6162 case "$ccflags" in
6163 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6164 esac
6165 case "$use64bitall" in
6166 "$define"|true|[yY]*) use64bitint="$define" ;;
6167 esac
6168
6169 case "$longsize" in
6170 8) cat <<EOM
6171
6172 You have natively 64-bit long integers.
6173 EOM
6174    val="$define"
6175    ;;
6176 *) case "$use64bitint" in
6177    "$define"|true|[yY]*) dflt='y';;
6178    *) dflt='n';;
6179    esac
6180    case "$d_quad" in
6181    "$define") ;;
6182    *) dflt='n' ;;
6183    esac
6184    cat <<EOM
6185
6186 Perl can be built to take advantage of 64-bit integer types
6187 on some systems.  To do so, Configure can be run with -Duse64bitint.
6188 Choosing this option will most probably introduce binary incompatibilities.
6189
6190 If this doesn't make any sense to you, just accept the default '$dflt'.
6191 (The default has been chosen based on your configuration.)
6192 EOM
6193    rp='Try to use 64-bit integers, if available?'
6194    . ./myread
6195    case "$ans" in
6196    [yY]*) val="$define" ;;
6197    *)     val="$undef"  ;;
6198    esac
6199    ;;
6200 esac
6201 set use64bitint
6202 eval $setvar
6203
6204 case "$use64bitall" in
6205 "$define"|true|[yY]*) dflt='y' ;;
6206 *) case "$longsize" in
6207    8) dflt='y' ;;
6208    *) dflt='n' ;;
6209    esac
6210    ;;
6211 esac
6212 cat <<EOM
6213
6214 You may also choose to try maximal 64-bitness.  It means using as much
6215 64-bitness as possible on the platform.  This in turn means even more
6216 binary incompatibilities.  On the other hand, your platform may not
6217 have any more 64-bitness available than what you already have chosen.
6218
6219 If this doesn't make any sense to you, just accept the default '$dflt'.
6220 (The default has been chosen based on your configuration.)
6221 EOM
6222 rp='Try to use maximal 64-bit support, if available?'
6223 . ./myread
6224 case "$ans" in
6225 [yY]*) val="$define" ;;
6226 *)     val="$undef"  ;;
6227 esac
6228 set use64bitall
6229 eval $setvar
6230 case "$use64bitall" in
6231 "$define")
6232         case "$use64bitint" in
6233         "$undef")
6234                 cat <<EOM
6235
6236 Since you have chosen a maximally 64-bit build, I'm also turning on
6237 the use of 64-bit integers.
6238 EOM
6239                 use64bitint="$define" ;;
6240         esac
6241         ;;
6242 esac
6243
6244 : Look for a hint-file generated 'call-back-unit'.  If the
6245 : user has specified that a 64-bit perl is to be built,
6246 : we may need to set or change some other defaults.
6247 if $test -f use64bitint.cbu; then
6248         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6249         . ./use64bitint.cbu
6250 fi
6251 case "$use64bitint" in
6252 "$define"|true|[yY]*)
6253         : This test was common to all the OpenBSD forks, and seems harmless for
6254         : other platforms:
6255         echo " "
6256         echo "Checking if your C library has broken 64-bit functions..." >&4
6257         cat >try.c <<EOCP
6258 #include <stdio.h>
6259 typedef $uquadtype myULL;
6260 int main (void)
6261 {
6262     struct {
6263         double d;
6264         myULL  u;
6265     } *p, test[] = {
6266         {4294967303.15, 4294967303ULL},
6267         {4294967294.2,  4294967294ULL},
6268         {4294967295.7,  4294967295ULL},
6269         {0.0, 0ULL}
6270     };
6271     for (p = test; p->u; p++) {
6272         myULL x = (myULL)p->d;
6273         if (x != p->u) {
6274             printf("buggy\n");
6275             return 0;
6276         }
6277     }
6278     printf("ok\n");
6279     return 0;
6280 }
6281 EOCP
6282         set try
6283         if eval $compile_ok; then
6284             libcquad=`$run ./try`
6285             echo "Your C library's 64-bit functions are $libcquad."
6286         else
6287             echo "(I can't seem to compile the test program.)"
6288             echo "Assuming that your C library's 64-bit functions are ok."
6289             libcquad="ok"
6290         fi
6291         $rm_try
6292
6293         case "$libcquad" in
6294             buggy*)
6295                 cat >&4 <<EOM
6296
6297 *** You have a C library with broken 64-bit functions.
6298 *** 64-bit support does not work reliably in this configuration.
6299 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6300 *** Cannot continue, aborting.
6301
6302 EOM
6303                 exit 1
6304                 ;;
6305         esac
6306         case "$longsize" in
6307         4) case "$archname64" in
6308            '') archname64=64int ;;
6309            esac
6310            ;;
6311         esac
6312         ;;
6313 esac
6314
6315 : Look for a hint-file generated 'call-back-unit'.  If the
6316 : user has specified that a maximally 64-bit perl is to be built,
6317 : we may need to set or change some other defaults.
6318 if $test -f use64bitall.cbu; then
6319         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6320         . ./use64bitall.cbu
6321 fi
6322 case "$use64bitall" in
6323 "$define"|true|[yY]*)
6324         case "$longsize" in
6325         4) case "$archname64" in
6326            ''|64int) archname64=64all ;;
6327            esac
6328            ;;
6329         esac
6330         ;;
6331 esac
6332
6333 case "$d_quad:$use64bitint" in
6334 $undef:$define)
6335         cat >&4 <<EOF
6336
6337 *** You have chosen to use 64-bit integers,
6338 *** but none can be found.
6339 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6340 *** Cannot continue, aborting.
6341
6342 EOF
6343         exit 1
6344         ;;
6345 esac
6346
6347 : Check if we are using the GNU C library
6348 echo " "
6349 echo "Checking for GNU C Library..." >&4
6350 cat >try.c <<'EOCP'
6351 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6352    alone are insufficient to distinguish different versions, such as
6353    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6354    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6355 */
6356 #include <stdio.h>
6357 int main(void)
6358 {
6359 #ifdef __GLIBC__
6360 #   ifdef __GLIBC_MINOR__
6361 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6362 #           include <gnu/libc-version.h>
6363             printf("%s\n",  gnu_get_libc_version());
6364 #       else
6365             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6366 #       endif
6367 #   else
6368         printf("%d\n",  __GLIBC__);
6369 #   endif
6370     return 0;
6371 #else
6372     return 1;
6373 #endif
6374 }
6375 EOCP
6376 set try
6377 if eval $compile_ok && $run ./try > glibc.ver; then
6378         val="$define"
6379         gnulibc_version=`$cat glibc.ver`
6380         echo "You are using the GNU C Library version $gnulibc_version"
6381 else
6382         val="$undef"
6383         gnulibc_version=''
6384         echo "You are not using the GNU C Library"
6385 fi
6386 $rm_try glibc.ver
6387 set d_gnulibc
6388 eval $setvar
6389
6390 : see if nm is to be used to determine whether a symbol is defined or not
6391 case "$usenm" in
6392 '')
6393         dflt=''
6394         case "$d_gnulibc" in
6395         "$define")
6396                 echo " "
6397                 echo "nm probably won't work on the GNU C Library." >&4
6398                 dflt=n
6399                 ;;
6400         esac
6401         case "$dflt" in
6402         '')
6403                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6404                         echo " "
6405                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6406                         echo "'nm' won't be sufficient on this system." >&4
6407                         dflt=n
6408                 fi
6409                 ;;
6410         esac
6411         case "$dflt" in
6412         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6413                 if $test $dflt -gt 20; then
6414                         dflt=y
6415                 else
6416                         dflt=n
6417                 fi
6418                 ;;
6419         esac
6420         ;;
6421 *)
6422         case "$usenm" in
6423         true|$define) dflt=y;;
6424         *) dflt=n;;
6425         esac
6426         ;;
6427 esac
6428 $cat <<EOM
6429
6430 I can use $nm to extract the symbols from your C libraries. This
6431 is a time consuming task which may generate huge output on the disk (up
6432 to 3 megabytes) but that should make the symbols extraction faster. The
6433 alternative is to skip the 'nm' extraction part and to compile a small
6434 test program instead to determine whether each symbol is present. If
6435 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6436 this may be the best solution.
6437
6438 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6439
6440 EOM
6441 rp="Shall I use $nm to extract C symbols from the libraries?"
6442 . ./myread
6443 case "$ans" in
6444 [Nn]*) usenm=false;;
6445 *) usenm=true;;
6446 esac
6447
6448 runnm=$usenm
6449 case "$reuseval" in
6450 true) runnm=false;;
6451 esac
6452
6453 : nm options which may be necessary
6454 case "$nm_opt" in
6455 '') if $test -f /mach_boot; then
6456                 nm_opt=''       # Mach
6457         elif $test -d /usr/ccs/lib; then
6458                 nm_opt='-p'     # Solaris (and SunOS?)
6459         elif $test -f /dgux; then
6460                 nm_opt='-p'     # DG-UX
6461         elif $test -f /lib64/rld; then
6462                 nm_opt='-p'     # 64-bit Irix
6463         else
6464                 nm_opt=''
6465         fi;;
6466 esac
6467
6468 : nm options which may be necessary for shared libraries but illegal
6469 : for archive libraries.  Thank you, Linux.
6470 case "$nm_so_opt" in
6471 '')     case "$myuname" in
6472         *linux*|gnu*)
6473                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6474                         nm_so_opt='--dynamic'
6475                 fi
6476                 ;;
6477         esac
6478         ;;
6479 esac
6480
6481 : Figure out where the libc is located
6482 case "$runnm" in
6483 true)
6484 : get list of predefined functions in a handy place
6485 echo " "
6486 case "$libc" in
6487 '') libc=unknown
6488         case "$libs" in
6489         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6490         esac
6491         ;;
6492 esac
6493 case "$libs" in
6494 '') ;;
6495 *)  for thislib in $libs; do
6496         case "$thislib" in
6497         -lc|-lc_s)
6498                 : Handle C library specially below.
6499                 ;;
6500         -l*)
6501                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6502                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6503                         :
6504                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6505                         :
6506                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6507                         :
6508                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6509                         :
6510                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6511                         :
6512                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6513                         :
6514                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6515                         :
6516                 else
6517                         try=''
6518                 fi
6519                 libnames="$libnames $try"
6520                 ;;
6521         *) libnames="$libnames $thislib" ;;
6522         esac
6523         done
6524         ;;
6525 esac
6526 xxx=normal
6527 case "$libc" in
6528 unknown)
6529         set /lib/libc.$so
6530         for xxx in $libpth; do
6531                 $test -r $1 || set $xxx/libc.$so
6532                 : The messy sed command sorts on library version numbers.
6533                 $test -r $1 || \
6534                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6535                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6536                                 h
6537                                 s/[0-9][0-9]*/0000&/g
6538                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6539                                 G
6540                                 s/\n/ /' | \
6541                          $sort | $sed -e 's/^.* //'`
6542                 eval set \$$#
6543         done
6544         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6545         $test -r $1 || set $sysroot/lib/libsys_s$_a
6546         ;;
6547 *)
6548         set blurfl
6549         ;;
6550 esac
6551 if $test -r "$1"; then
6552         echo "Your (shared) C library seems to be in $1."
6553         libc="$1"
6554 elif $test -r /lib/libc && $test -r /lib/clib; then
6555         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6556         xxx=apollo
6557         libc='/lib/clib /lib/libc'
6558         if $test -r /lib/syslib; then
6559                 echo "(Your math library is in /lib/syslib.)"
6560                 libc="$libc /lib/syslib"
6561         fi
6562 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6563         echo "Your C library seems to be in $libc, as you said before."
6564 elif $test -r $incpath/usr/lib/libc$_a; then
6565         libc=$incpath/usr/lib/libc$_a;
6566         echo "Your C library seems to be in $libc.  That's fine."
6567 elif $test -r /lib/libc$_a; then
6568         libc=/lib/libc$_a;
6569         echo "Your C library seems to be in $libc.  You're normal."
6570 else
6571         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6572                 :
6573         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6574                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6575         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6576                 :
6577         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6578                 :
6579         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6580                 :
6581         else
6582                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6583         fi
6584         if $test -r "$tans"; then
6585                 echo "Your C library seems to be in $tans, of all places."
6586                 libc=$tans
6587         else
6588                 libc='blurfl'
6589         fi
6590 fi
6591 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6592         dflt="$libc"
6593         cat <<EOM
6594
6595 If the guess above is wrong (which it might be if you're using a strange
6596 compiler, or your machine supports multiple models), you can override it here.
6597
6598 EOM
6599 else
6600         dflt=''
6601         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6602         cat >&4 <<EOM
6603 I can't seem to find your C library.  I've looked in the following places:
6604
6605 EOM
6606         $sed 's/^/      /' libpath
6607         cat <<EOM
6608
6609 None of these seems to contain your C library. I need to get its name...
6610
6611 EOM
6612 fi
6613 fn=f
6614 rp='Where is your C library?'
6615 . ./getfile
6616 libc="$ans"
6617
6618 echo " "
6619 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6620 set X `cat libnames`
6621 shift
6622 xxx=files
6623 case $# in 1) xxx=file; esac
6624 echo "Extracting names from the following $xxx for later perusal:" >&4
6625 echo " "
6626 $sed 's/^/      /' libnames >&4
6627 echo " "
6628 $echo $n "This may take a while...$c" >&4
6629
6630 for file in $*; do
6631         case $file in
6632         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6633         *) $nm $nm_opt $file 2>/dev/null;;
6634         esac
6635 done >libc.tmp
6636
6637 $echo $n ".$c"
6638 $grep fprintf libc.tmp > libc.ptf
6639 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6640 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6641 xxx='[ADTSIWi]'
6642 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6643         eval $xscan;\
6644         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6645                 eval $xrun
6646 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6647         eval $xscan;\
6648         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6649                 eval $xrun
6650 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6651         eval $xscan;\
6652         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6653                 eval $xrun
6654 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6655         eval $xscan;\
6656         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6657                 eval $xrun
6658 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6659         eval $xscan;\
6660         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6661                 eval $xrun
6662 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6663         eval $xscan;\
6664         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6665                 eval $xrun
6666 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6667                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6668         eval $xscan;\
6669         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6670                 eval $xrun
6671 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6672         eval $xscan;\
6673         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6674                 eval $xrun
6675 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6676         eval $xscan;\
6677         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6678                 eval $xrun
6679 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6680         eval $xscan;\
6681         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6682                 eval $xrun
6683 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6684         eval $xscan;\
6685         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6686                 eval $xrun
6687 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6688         eval $xscan;\
6689         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6690                 eval $xrun
6691 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6692         eval $xscan;\
6693         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6694                 eval $xrun
6695 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6696         eval $xscan;\
6697         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6698                 eval $xrun
6699 else
6700         $nm -p $* 2>/dev/null >libc.tmp
6701         $grep fprintf libc.tmp > libc.ptf
6702         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6703                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6704         then
6705                 nm_opt='-p'
6706                 eval $xrun
6707         else
6708                 echo " "
6709                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6710                 com=''
6711                 if $ar t $libc > libc.tmp && \
6712                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6713                 then
6714                         for thisname in $libnames $libc; do
6715                                 $ar t $thisname >>libc.tmp
6716                         done
6717                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6718                         echo "Ok." >&4
6719                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6720                         for thisname in $libnames $libc; do
6721                                 $ar tv $thisname >>libc.tmp
6722                                 emximp -o tmp.imp $thisname \
6723                                     2>/dev/null && \
6724                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6725                                     < tmp.imp >>libc.tmp
6726                                 $rm -f tmp.imp
6727                         done
6728                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6729                         echo "Ok." >&4
6730                 else
6731                         echo "$ar didn't seem to work right." >&4
6732                         echo "Maybe this is a Cray...trying bld instead..." >&4
6733                         if  bld t $libc | \
6734                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6735                                 $test -s libc.list
6736                         then
6737                                 for thisname in $libnames; do
6738                                         bld t $libnames | \
6739                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6740                                         $ar t $thisname >>libc.tmp
6741                                 done
6742                                 echo "Ok." >&4
6743                         else
6744                                 echo "That didn't work either.  Giving up." >&4
6745                                 exit 1
6746                         fi
6747                 fi
6748         fi
6749 fi
6750 nm_extract="$com"
6751 case "$PASE" in
6752 define)
6753     echo " "
6754     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6755     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6756     ;;
6757 *)  if $test -f /lib/syscalls.exp; then
6758         echo " "
6759         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6760         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6761                 /lib/syscalls.exp >>libc.list
6762     fi
6763     ;;
6764 esac
6765 ;;
6766 esac
6767 $rm -f libnames libpath
6768
6769 : Check if we are using C++
6770 echo " "
6771 echo "Checking for C++..." >&4
6772 $cat >try.c <<'EOCP'
6773 #include <stdio.h>
6774 int main(void)
6775 {
6776 #ifdef __cplusplus
6777     return 0;
6778 #else
6779     return 1;
6780 #endif
6781 }
6782 EOCP
6783 set try
6784 if eval $compile_ok && $run ./try; then
6785         val="$define"
6786         echo "You are using a C++ compiler."
6787 else
6788         val="$undef"
6789         echo "You are not using a C++ compiler."
6790 fi
6791 $rm_try cplusplus$$
6792 set d_cplusplus
6793 eval $setvar
6794
6795 : is a C symbol defined?
6796 csym='tlook=$1;
6797 case "$3" in
6798 -v) tf=libc.tmp; tdc="";;
6799 -a) tf=libc.tmp; tdc="[]";;
6800 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6801 esac;
6802 case "$d_cplusplus" in
6803     $define)    extern_C="extern \"C\"" ;;
6804     *)          extern_C="extern"       ;;
6805 esac;
6806 tx=yes;
6807 case "$reuseval-$4" in
6808 true-) ;;
6809 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6810 esac;
6811 case "$tx" in
6812 yes)
6813         tval=false;
6814         if $test "$runnm" = true; then
6815                 if $contains $tlook $tf >/dev/null 2>&1; then
6816                         tval=true;
6817                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6818                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6819                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6820                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6821                         $rm_try;
6822                 fi;
6823         else
6824                 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;
6825                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6826                 $rm_try;
6827         fi;
6828         ;;
6829 *)
6830         case "$tval" in
6831         $define) tval=true;;
6832         *) tval=false;;
6833         esac;
6834         ;;
6835 esac;
6836 eval "$2=$tval"'
6837
6838 : define an is-in-libc? function
6839 inlibc='echo " "; td=$define; tu=$undef;
6840 sym=$1; var=$2; eval "was=\$$2";
6841 tx=yes;
6842 case "$reuseval$was" in
6843 true) ;;
6844 true*) tx=no;;
6845 esac;
6846 case "$tx" in
6847 yes)
6848         set $sym tres -f;
6849         eval $csym;
6850         case "$tres" in
6851         true)
6852                 echo "$sym() found." >&4;
6853                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6854         *)
6855                 echo "$sym() NOT found." >&4;
6856                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6857         esac;;
6858 *)
6859         case "$was" in
6860         $define) echo "$sym() found." >&4;;
6861         *) echo "$sym() NOT found." >&4;;
6862         esac;;
6863 esac'
6864
6865 : check for length of double
6866 echo " "
6867 case "$doublesize" in
6868 '')
6869         echo "Checking to see how big your double precision numbers are..." >&4
6870         $cat >try.c <<EOCP
6871 #include <stdio.h>
6872 #$i_stdlib I_STDLIB
6873 #ifdef I_STDLIB
6874 #include <stdlib.h>
6875 #endif
6876 int main()
6877 {
6878     printf("%d\n", (int)sizeof(double));
6879     exit(0);
6880 }
6881 EOCP
6882         set try
6883         if eval $compile_ok; then
6884                 doublesize=`$run ./try`
6885                 echo "Your double is $doublesize bytes long."
6886         else
6887                 dflt='8'
6888                 echo "(I can't seem to compile the test program.  Guessing...)"
6889                 rp="What is the size of a double precision number (in bytes)?"
6890                 . ./myread
6891                 doublesize="$ans"
6892         fi
6893         ;;
6894 esac
6895 $rm_try
6896
6897 : see if this is a float.h system
6898 set float.h i_float
6899 eval $inhdr
6900
6901 : check for long doubles
6902 echo " "
6903 echo "Checking to see if you have long double..." >&4
6904 echo 'int main() { long double x = 7.0; }' > try.c
6905 set try
6906 if eval $compile; then
6907         val="$define"
6908         echo "You have long double."
6909 else
6910         val="$undef"
6911         echo "You do not have long double."
6912 fi
6913 $rm_try
6914 set d_longdbl
6915 eval $setvar
6916
6917 : see if ldexpl exists
6918 set ldexpl d_ldexpl
6919 eval $inlibc
6920
6921 : check for length of long double
6922 case "${d_longdbl}${longdblsize}" in
6923 $define)
6924         echo " "
6925         echo "Checking to see how big your long doubles are..." >&4
6926         $cat >try.c <<'EOCP'
6927 #include <stdio.h>
6928 int main()
6929 {
6930         printf("%d\n", sizeof(long double));
6931 }
6932 EOCP
6933         set try
6934         set try
6935         if eval $compile; then
6936                 longdblsize=`$run ./try`
6937                 echo "Your long doubles are $longdblsize bytes long."
6938         else
6939                 dflt='8'
6940                 echo " "
6941                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6942                 rp="What is the size of a long double (in bytes)?"
6943                 . ./myread
6944                 longdblsize="$ans"
6945         fi
6946         if $test "X$doublesize" = "X$longdblsize"; then
6947                 echo "That isn't any different from an ordinary double."
6948                 echo "I'll keep your setting anyway, but you may see some"
6949                 echo "harmless compilation warnings."
6950         fi
6951         ;;
6952 esac
6953 $rm_try
6954
6955 $echo "Checking the kind of long doubles you have..." >&4
6956 case "$d_longdbl" in
6957 define)
6958 $cat <<EOP >try.c
6959 #$i_float I_FLOAT
6960 #$i_stdlib I_STDLIB
6961 #define LONGDBLSIZE $longdblsize
6962 #define DOUBLESIZE $doublesize
6963 #ifdef I_FLOAT
6964 #include <float.h>
6965 #endif
6966 #ifdef I_STDLIB
6967 #include <stdlib.h>
6968 #endif
6969 #include <stdio.h>
6970 static const long double d = -0.1L;
6971 int main() {
6972   unsigned const char* b = (unsigned const char*)(&d);
6973 #if DOUBLESIZE == LONGDBLSIZE
6974   printf("0\n"); /* if it floats like double */
6975   exit(0);
6976 #endif
6977 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6978   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6979     /* IEEE 754 128-bit little-endian */
6980     printf("1\n");
6981     exit(0);
6982   }
6983   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6984     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6985     printf("2\n");
6986     exit(0);
6987   }
6988 #endif
6989 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6990  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6991  * cannot be trusted. */
6992 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6993   if (b[0] == 0xCD && b[9] == 0xBF) {
6994     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6995      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6996      * Also known as "extended precision". */
6997     printf("3\n");
6998     exit(0);
6999   }
7000   if (b[0] == 0xBF && b[9] == 0xCD) {
7001     /* Is there ever big-endian 80-bit, really?
7002      *
7003      * The Motorola 68881 had another "extended precision" format:
7004      * sign:1 exp:15 zero:16 integer:1 mantissa:63
7005      * for total of 96 bits of bytes.  The zero bits were unused.
7006      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7007      * If it ever becomes relevant, this format should be allocated
7008      * a new doublekind code since it's quite different from the Intel x87.
7009      */
7010     printf("4\n");
7011     exit(0);
7012   }
7013 #endif
7014 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7015   /* software "double double", the 106 is 53+53.
7016    * but irix thinks it is 107. */
7017   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7018     /* double double 128-bit fully little-endian,
7019      * little-endian doubles in little-endian order,
7020      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7021     printf("5\n");
7022     exit(0);
7023   }
7024   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7025     /* double double 128-bit fully big-endian,
7026      * big-endian doubles in big-endian order,
7027      * e.g. PPC/Power and MIPS:
7028      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7029     printf("6\n");
7030     exit(0);
7031   }
7032   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7033     /* double double 128-bit mixed endian.
7034      * little-endian doubles in big-endian order,
7035      * e.g. ppc64el,
7036      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7037     printf("7\n");
7038     exit(0);
7039   }
7040   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7041     /* double double 128-bit mixed endian,
7042      * big-endian doubles in little-endian order,
7043      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7044     printf("8\n");
7045     exit(0);
7046   }
7047 #endif
7048 /* We are largely making this up because it may well be
7049  * that the VAX format H was never made available to C,
7050  * only to Fortran. */
7051 #if LONGDBLSIZE == 16 && defined(__vax__)
7052   if (b[0] == 0xFD && b[15] == 0x99) {
7053     /* VAX format H, PDP-11 mixed endian. */
7054     printf("9\n");
7055     exit(0);
7056   }
7057 #endif
7058   printf("-1\n"); /* unknown */
7059   exit(0);
7060 }
7061 EOP
7062 set try
7063 if eval $compile; then
7064     longdblkind=`$run ./try`
7065 else
7066     longdblkind=-1
7067 fi
7068 ;;
7069 *) longdblkind=0 ;;
7070 esac
7071 case "$longdblkind" in
7072 0) echo "Your long doubles are doubles." >&4 ;;
7073 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7074 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7075 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7076 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7077 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7078 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7079 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7080 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7081 9) echo "You have 128-bit PDP-style mixed-endian long doubles." >& 4 ;;
7082 *) echo "Cannot figure out your long double." >&4 ;;
7083 esac
7084 $rm_try
7085
7086 : determine the architecture name
7087 echo " "
7088 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7089         tarch=`arch`"-$osname"
7090 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7091         if uname -m > tmparch 2>&1 ; then
7092                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7093                         -e 's/$/'"-$osname/" tmparch`
7094         else
7095                 tarch="$osname"
7096         fi
7097         $rm -f tmparch
7098 else
7099         tarch="$osname"
7100 fi
7101 case "$myarchname" in
7102 ''|"$tarch") ;;
7103 *)
7104         echo "(Your architecture name used to be $myarchname.)"
7105         archname=''
7106         ;;
7107 esac
7108 case "$targetarch" in
7109 '') ;;
7110 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7111 esac
7112 myarchname="$tarch"
7113 case "$archname" in
7114 '') dflt="$tarch";;
7115 *) dflt="$archname";;
7116 esac
7117 rp='What is your architecture name'
7118 . ./myread
7119 archname="$ans"
7120
7121 : optionally add API version to the architecture for versioned archlibs
7122 case "$useversionedarchname" in
7123 $define|true|[yY]*) dflt='y';;
7124 *)                  dflt='n';;
7125 esac
7126 rp='Add the Perl API version to your archname?'
7127 . ./myread
7128 case "$ans" in
7129 y|Y)    useversionedarchname="$define" ;;
7130 *)      useversionedarchname="$undef" ;;
7131 esac
7132 case "$useversionedarchname" in
7133 $define)
7134         case "$archname" in
7135         *-$api_versionstring)
7136                 echo "...and architecture name already has -$api_versionstring" >&4
7137                 ;;
7138         *)
7139                 archname="$archname-$api_versionstring"
7140                 echo "...setting architecture name to $archname." >&4
7141                 ;;
7142         esac
7143         ;;
7144 esac
7145
7146 case "$usethreads" in
7147 $define)
7148         echo "Threads selected." >&4
7149         case "$archname" in
7150         *-thread*) echo "...and architecture name already has -thread." >&4
7151                 ;;
7152         *)      archname="$archname-thread"
7153                 echo "...setting architecture name to $archname." >&4
7154                 ;;
7155         esac
7156         ;;
7157 esac
7158 case "$usemultiplicity" in
7159 $define)
7160         echo "Multiplicity selected." >&4
7161         case "$archname" in
7162         *-multi*) echo "...and architecture name already has -multi." >&4
7163                 ;;
7164         *)      archname="$archname-multi"
7165                 echo "...setting architecture name to $archname." >&4
7166                 ;;
7167         esac
7168         ;;
7169 esac
7170 case "$use64bitint$use64bitall" in
7171 *"$define"*)
7172         case "$archname64" in
7173         '')
7174                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7175                 ;;
7176         *)
7177                 case "$use64bitint" in
7178                 "$define") echo "64 bit integers selected." >&4 ;;
7179                 esac
7180                 case "$use64bitall" in
7181                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7182                 esac
7183                 case "$archname" in
7184                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7185                         ;;
7186                 *)      archname="$archname-$archname64"
7187                         echo "...setting architecture name to $archname." >&4
7188                         ;;
7189                 esac
7190                 ;;
7191         esac
7192 esac
7193 case "$uselongdouble" in
7194 $define)
7195         echo "Long doubles selected." >&4
7196         case "$longdblsize" in
7197         $doublesize)
7198                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7199                 ;;
7200         *)
7201                 case "$archname" in
7202                 *-ld*) echo "...and architecture name already has -ld." >&4
7203                         ;;
7204                 *)      archname="$archname-ld"
7205                         echo "...setting architecture name to $archname." >&4
7206                         ;;
7207                 esac
7208                 ;;
7209         esac
7210         ;;
7211 esac
7212 case "$usequadmath" in
7213 $define)
7214         echo "quadmath selected." >&4
7215         case "$archname" in
7216         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7217                 ;;
7218         *)      archname="$archname-quadmath"
7219                 echo "...setting architecture name to $archname." >&4
7220                 ;;
7221         esac
7222         ;;
7223 esac
7224 if $test -f archname.cbu; then
7225         echo "Your platform has some specific hints for architecture name, using them..."
7226         . ./archname.cbu
7227 fi
7228
7229 : set the prefixit variable, to compute a suitable default value
7230 prefixit='case "$3" in
7231 ""|none)
7232         case "$oldprefix" in
7233         "") eval "$1=\"\$$2\"";;
7234         *)
7235                 case "$3" in
7236                 "") eval "$1=";;
7237                 none)
7238                         eval "tp=\"\$$2\"";
7239                         case "$tp" in
7240                         ""|" ") eval "$1=\"\$$2\"";;
7241                         *) eval "$1=";;
7242                         esac;;
7243                 esac;;
7244         esac;;
7245 *)
7246         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7247         case "$tp" in
7248         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7249         /*-$oldprefix/*|\~*-$oldprefix/*)
7250                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7251         *) eval "$1=\"\$$2\"";;
7252         esac;;
7253 esac'
7254
7255 : determine installation style
7256 : For now, try to deduce it from prefix unless it is already set.
7257 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7258 case "$installstyle" in
7259 '')     case "$prefix" in
7260                 *perl*) dflt='lib';;
7261                 *) dflt='lib/perl5' ;;
7262         esac
7263         ;;
7264 *)      dflt="$installstyle" ;;
7265 esac
7266 : Probably not worth prompting for this since we prompt for all
7267 : the directories individually, and the prompt would be too long and
7268 : confusing anyway.
7269 installstyle=$dflt
7270
7271 : determine where public executables go
7272 echo " "
7273 set dflt bin bin
7274 eval $prefixit
7275 fn=d~
7276 rp='Pathname where the public executables will reside?'
7277 . ./getfile
7278 if $test "X$ansexp" != "X$binexp"; then
7279         installbin=''
7280 fi
7281 prefixvar=bin
7282 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7283 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7284 :     this via initialinstalllocation
7285 . ./setprefixvar
7286
7287 case "$userelocatableinc" in
7288 $define|true|[yY]*)     dflt='y' ;;
7289 *)                      dflt='n' ;;
7290 esac
7291 cat <<EOM
7292
7293 Would you like to build Perl so that the installation is relocatable, so that
7294 library paths in @INC are determined relative to the path of the perl binary?
7295 This is not advised for system Perl installs, or if you need to run setid
7296 scripts or scripts under taint mode.
7297
7298 If this doesn't make any sense to you, just accept the default '$dflt'.
7299 EOM
7300 rp='Use relocatable @INC?'
7301 . ./myread
7302 case "$ans" in
7303 y|Y)    val="$define" ;;
7304 *)      val="$undef"  ;;
7305 esac
7306 set userelocatableinc
7307 eval $setvar
7308
7309 initialinstalllocation="$binexp"
7310 : Default prefix is now "up one level from where the binaries are"
7311 case "$userelocatableinc" in
7312 $define|true|[yY]*)
7313     bin=".../"
7314     binexp=".../"
7315     prefix=".../.."
7316     prefixexp=".../.."
7317     installprefixexp=".../.."
7318     ;;
7319 esac
7320
7321 : determine where private library files go
7322 : Usual default is /usr/local/lib/perl5/$version.
7323 : Also allow things like /opt/perl/lib/$version, since
7324 : /opt/perl/lib/perl5... would be redundant.
7325 : The default "style" setting is made in installstyle.U
7326 case "$installstyle" in
7327 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7328 *)       set dflt privlib lib/$version ;;
7329 esac
7330 eval $prefixit
7331 $cat <<EOM
7332
7333 There are some auxiliary files for $package that need to be put into a
7334 private library directory that is accessible by everyone.
7335
7336 EOM
7337 fn=$binexp
7338 fn=d~+
7339 rp='Pathname where the private library files will reside?'
7340 . ./getfile
7341 prefixvar=privlib
7342 . ./setprefixvar
7343
7344 : set the prefixup variable, to restore leading tilda escape
7345 prefixup='case "$prefixexp" in
7346 "$prefix") ;;
7347 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7348 esac'
7349
7350 : determine where public architecture dependent libraries go
7351 set archlib archlib
7352 eval $prefixit
7353 : privlib default is /usr/local/lib/$package/$version
7354 : archlib default is /usr/local/lib/$package/$version/$archname
7355 : privlib may have an optional trailing /share.
7356 tdflt=`echo $privlib | $sed 's,/share$,,'`
7357 tdflt=$tdflt/$archname
7358 case "$archlib" in
7359 '')     dflt=$tdflt
7360         ;;
7361 *)      dflt="$archlib"
7362     ;;
7363 esac
7364 $cat <<EOM
7365
7366 $spackage contains architecture-dependent library files.  If you are
7367 sharing libraries in a heterogeneous environment, you might store
7368 these files in a separate location.  Otherwise, you can just include
7369 them with the rest of the public library files.
7370
7371 EOM
7372 fn=$binexp
7373 fn=d+~
7374 rp='Where do you want to put the public architecture-dependent libraries?'
7375 . ./getfile
7376 prefixvar=archlib
7377 . ./setprefixvar
7378 if $test X"$archlib" = X"$privlib"; then
7379         d_archlib="$undef"
7380 else
7381         d_archlib="$define"
7382 fi
7383
7384 : see if setuid scripts can be secure
7385 $cat <<EOM
7386
7387 Some kernels have a bug that prevents setuid #! scripts from being
7388 secure.  Some sites have disabled setuid #! scripts because of this.
7389
7390 First let's decide if your kernel supports secure setuid #! scripts.
7391 (If setuid #! scripts would be secure but have been disabled anyway,
7392 don't say that they are secure if asked.)
7393
7394 EOM
7395
7396 val="$undef"
7397 if $test -d /dev/fd; then
7398         echo "#!$ls" >reflect
7399         chmod +x,u+s reflect
7400         ./reflect >flect 2>&1
7401         if $contains "/dev/fd" flect >/dev/null; then
7402                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7403                 val="$define"
7404         else
7405                 $cat <<EOM
7406 If you are not sure if they are secure, I can check but I'll need a
7407 username and password different from the one you are using right now.
7408 If you don't have such a username or don't want me to test, simply
7409 enter 'none'.
7410
7411 EOM
7412                 rp='Other username to test security of setuid scripts with?'
7413                 dflt='none'
7414                 . ./myread
7415                 case "$ans" in
7416                 n|none)
7417                         case "$d_suidsafe" in
7418                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7419                                 dflt=n;;
7420                         "$undef")
7421                                 echo "Well, the $hint value is *not* secure." >&4
7422                                 dflt=n;;
7423                         *)      echo "Well, the $hint value *is* secure." >&4
7424                                 dflt=y;;
7425                         esac
7426                         ;;
7427                 *)
7428                         $rm -f reflect flect
7429                         echo "#!$ls" >reflect
7430                         chmod +x,u+s reflect
7431                         echo >flect
7432                         chmod a+w flect
7433                         echo '"su" will (probably) prompt you for '"$ans's password."
7434                         su $ans -c './reflect >flect'
7435                         if $contains "/dev/fd" flect >/dev/null; then
7436                                 echo "Okay, it looks like setuid scripts are secure." >&4
7437                                 dflt=y
7438                         else
7439                                 echo "I don't think setuid scripts are secure." >&4
7440                                 dflt=n
7441                         fi
7442                         ;;
7443                 esac
7444                 rp='Does your kernel have *secure* setuid scripts?'
7445                 . ./myread
7446                 case "$ans" in
7447                 [yY]*)  val="$define";;
7448                 *)      val="$undef";;
7449                 esac
7450         fi
7451 else
7452         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7453         echo "(That's for file descriptors, not floppy disks.)"
7454         val="$undef"
7455 fi
7456 set d_suidsafe
7457 eval $setvar
7458
7459 $rm -f reflect flect
7460
7461 : now see if they want to do setuid emulation
7462 if $test $patchlevel -lt 11; then
7463 echo " "
7464 val="$undef"
7465 case "$d_suidsafe" in
7466 "$define")
7467         val="$undef"
7468         echo "No need to emulate SUID scripts since they are secure here." >&4
7469         ;;
7470 *)
7471         $cat <<EOM
7472 Some systems have disabled setuid scripts, especially systems where
7473 setuid scripts cannot be secure.  On systems where setuid scripts have
7474 been disabled, the setuid/setgid bits on scripts are currently
7475 useless.  It is possible for $package to detect those bits and emulate
7476 setuid/setgid in a secure fashion.  This emulation will only work if
7477 setuid scripts have been disabled in your kernel.
7478
7479 EOM
7480         case "$d_dosuid" in
7481         "$define") dflt=y ;;
7482         *) dflt=n ;;
7483         esac
7484         rp="Do you want to do setuid/setgid emulation?"
7485         . ./myread
7486         case "$ans" in
7487         [yY]*)  val="$define";;
7488         *)      val="$undef";;
7489         esac
7490         ;;
7491 esac
7492 set d_dosuid
7493 eval $setvar
7494 else
7495     case "$d_dosuid" in
7496         "$define")
7497         cat >&4 <<EOH
7498
7499 SUID emulation has been removed for 5.12
7500 Please re-run Configure without -Dd_dosuid
7501
7502 EOH
7503         exit 1;
7504         ;;
7505     esac
7506     d_dosuid=undef
7507 fi
7508
7509 : Find perl5.005 or later.
7510 echo "Looking for a previously installed perl5.005 or later... "
7511 case "$perl5" in
7512 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7513                 : Check if this perl is recent and can load a simple module
7514                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7515                         perl5=$tdir/perl
7516                         break;
7517                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7518                         perl5=$tdir/perl5
7519                         break;
7520                 fi
7521         done
7522         ;;
7523 *)      perl5="$perl5"
7524         ;;
7525 esac
7526 case "$perl5" in
7527 '')     echo "None found.  That's ok.";;
7528 *)      echo "Using $perl5." ;;
7529 esac
7530
7531 : Set the siteprefix variables
7532 $cat <<EOM
7533
7534 After $package is installed, you may wish to install various
7535 add-on modules and utilities.  Typically, these add-ons will
7536 be installed under $prefix with the rest
7537 of this package.  However, you may wish to install such add-ons
7538 elsewhere under a different prefix.
7539
7540 If you do not wish to put everything under a single prefix, that's
7541 ok.  You will be prompted for the individual locations; this siteprefix
7542 is only used to suggest the defaults.
7543
7544 The default should be fine for most people.
7545
7546 EOM
7547 fn=d~+
7548 rp='Installation prefix to use for add-on modules and utilities?'
7549 : XXX Here might be another good place for an installstyle setting.
7550 case "$siteprefix" in
7551 '') dflt=$prefix ;;
7552 *)  dflt=$siteprefix ;;
7553 esac
7554 . ./getfile
7555 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7556 oldsiteprefix=''
7557 case "$siteprefix" in
7558 '') ;;
7559 *)      case "$ans" in
7560         "$prefix") ;;
7561         *) oldsiteprefix="$prefix";;
7562         esac
7563         ;;
7564 esac
7565 siteprefix="$ans"
7566 siteprefixexp="$ansexp"
7567
7568 : determine where site specific libraries go.
7569 : Usual default is /usr/local/lib/perl5/site_perl/$version
7570 : The default "style" setting is made in installstyle.U
7571 : XXX No longer works with Prefixit stuff.
7572 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7573 case "$sitelib" in
7574 '') case "$installstyle" in
7575         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7576         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7577         esac
7578         ;;
7579 *)      dflt="$sitelib"
7580         ;;
7581 esac
7582 $cat <<EOM
7583
7584 The installation process will create a directory for
7585 site-specific extensions and modules.  Most users find it convenient
7586 to place all site-specific files in this directory rather than in the
7587 main distribution directory.
7588
7589 EOM
7590 fn=d~+
7591 rp='Pathname for the site-specific library files?'
7592 . ./getfile
7593 prefixvar=sitelib
7594 . ./setprefixvar
7595 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7596
7597 : Determine list of previous versions to include in @INC
7598 $cat > getverlist <<EOPL
7599 #!$perl5 -w
7600 use File::Basename;
7601 \$api_versionstring = "$api_versionstring";
7602 \$version = "$version";
7603 \$stem = "$sitelib_stem";
7604 \$archname = "$archname";
7605 EOPL
7606         $cat >> getverlist <<'EOPL'
7607 # The list found is store twice for each entry: the original name, and
7608 # the binary broken down version as pack "sss", so sorting is easy and
7609 # unambiguous. This will work for all versions that have a maximum of
7610 # three digit groups, separate by '.'s or '_'s. Names are extended with
7611 # ".0.0" to ensure at least three elements for the pack.
7612 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7613
7614 # Can't have leading @ because metaconfig interprets it as a command!
7615 ;@inc_version_list=();
7616 # XXX Redo to do opendir/readdir?
7617 if (-d $stem) {
7618     chdir($stem);
7619     ;@candidates = map {
7620         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7621     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7622 }
7623 else {
7624     ;@candidates = ();
7625 }
7626
7627 ($pversion, $aversion, $vsn5005) = map {
7628     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7629 foreach $d (@candidates) {
7630     if ($d->[1] lt $pversion) {
7631         if ($d->[1] ge $aversion) {
7632             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7633         }
7634         elsif ($d->[1] ge $vsn5005) {
7635             unshift(@inc_version_list, grep { -d } $d->[0]);
7636         }
7637     }
7638     else {
7639         # Skip newer version.  I.e. don't look in
7640         # 5.7.0 if we're installing 5.6.1.
7641     }
7642 }
7643
7644 if (@inc_version_list) {
7645     print join(' ', @inc_version_list);
7646 }
7647 else {
7648     # Blank space to preserve value for next Configure run.
7649     print " ";
7650 }
7651 EOPL
7652 chmod +x getverlist
7653 case "$inc_version_list" in
7654 '')     if test -x "$perl5$exe_ext"; then
7655                 dflt=`$perl5 getverlist`
7656         else
7657                 dflt='none'
7658         fi
7659         ;;
7660 $undef) dflt='none' ;;
7661 *)  eval dflt=\"$inc_version_list\" ;;
7662 esac
7663 case "$dflt" in
7664 ''|' ') dflt=none ;;
7665 esac
7666 case "$dflt" in
7667 5.005) dflt=none ;;
7668 esac
7669 $cat <<EOM
7670
7671 In order to ease the process of upgrading, this version of perl
7672 can be configured to use modules built and installed with earlier
7673 versions of perl that were installed under $prefix.  Specify here
7674 the list of earlier versions that this version of perl should check.
7675 If Configure detected no earlier versions of perl installed under
7676 $prefix, then the list will be empty.  Answer 'none' to tell perl
7677 to not search earlier versions.
7678
7679 The default should almost always be sensible, so if you're not sure,
7680 just accept the default.
7681 EOM
7682
7683 rp='List of earlier versions to include in @INC?'
7684 . ./myread
7685 case "$ans" in
7686 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7687 *) inc_version_list="$ans" ;;
7688 esac
7689 case "$inc_version_list" in
7690 ''|' ')
7691         inc_version_list_init='0'
7692         d_inc_version_list="$undef"
7693         ;;
7694 *)      inc_version_list_init=`echo $inc_version_list |
7695                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7696         d_inc_version_list="$define"
7697         ;;
7698 esac
7699 $rm -f getverlist
7700
7701 : see if malloc/malloc.h has to be included
7702 set malloc/malloc.h i_mallocmalloc
7703 eval $inhdr
7704
7705 : see if this is a malloc.h system
7706 : we want a real compile instead of Inhdr because some systems have a
7707 : malloc.h that just gives a compile error saying to use stdlib.h instead
7708 echo " "
7709 $cat >try.c <<EOCP
7710 #include <stdlib.h>
7711 #include <malloc.h>
7712 #$i_mallocmalloc I_MALLOCMALLOC
7713 #ifdef I_MALLOCMALLOC
7714 # include <malloc/malloc.h>
7715 #endif
7716
7717 int main () { return 0; }
7718 EOCP
7719 set try
7720 if eval $compile; then
7721     echo "<malloc.h> found." >&4
7722     val="$define"
7723 else
7724     echo "<malloc.h> NOT found." >&4
7725     val="$undef"
7726 fi
7727 $rm_try
7728 set i_malloc
7729 eval $setvar
7730
7731 : check for length of pointer
7732 echo " "
7733 case "$ptrsize" in
7734 '')
7735         echo "Checking to see how big your pointers are..." >&4
7736         $cat >try.c <<EOCP
7737 #include <stdio.h>
7738 #$i_stdlib I_STDLIB
7739 #ifdef I_STDLIB
7740 #include <stdlib.h>
7741 #endif
7742 int main()
7743 {
7744     printf("%d\n", (int)sizeof(void *));
7745     exit(0);
7746 }
7747 EOCP
7748         set try
7749         if eval $compile_ok; then
7750                 ptrsize=`$run ./try`
7751                 echo "Your pointers are $ptrsize bytes long."
7752         else
7753                 dflt='4'
7754                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7755                 rp="What is the size of a pointer (in bytes)?"
7756                 . ./myread
7757                 ptrsize="$ans"
7758         fi
7759         ;;
7760 esac
7761 $rm_try
7762 case "$use64bitall" in
7763 "$define"|true|[yY]*)
7764         case "$ptrsize" in
7765         4)      cat <<EOM >&4
7766
7767 *** You have chosen a maximally 64-bit build,
7768 *** but your pointers are only 4 bytes wide.
7769 *** Please rerun Configure without -Duse64bitall.
7770 EOM
7771                 case "$d_quad" in
7772                 define)
7773                         cat <<EOM >&4
7774 *** Since you have quads, you could possibly try with -Duse64bitint.
7775 EOM
7776                         ;;
7777                 esac
7778                 cat <<EOM >&4
7779 *** Cannot continue, aborting.
7780
7781 EOM
7782
7783                 exit 1
7784                 ;;
7785         esac
7786         ;;
7787 esac
7788
7789
7790 : determine whether to use malloc wrapping
7791 echo " "
7792 case "$usemallocwrap" in
7793 [yY]*|true|$define)     dflt='y' ;;
7794 [nN]*|false|$undef)     dflt='n' ;;
7795 *)      case "$usedevel" in
7796         [yY]*|true|$define)     dflt='y' ;;
7797         *) dflt='n' ;;
7798         esac
7799         ;;
7800 esac
7801 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7802 . ./myread
7803 usemallocwrap="$ans"
7804 case "$ans" in
7805 y*|true)
7806         usemallocwrap="$define" ;;
7807 *)
7808         usemallocwrap="$undef" ;;
7809 esac
7810
7811 : determine which malloc to compile in
7812 echo " "
7813 case "$usemymalloc" in
7814 [yY]*|true|$define)     dflt='y' ;;
7815 [nN]*|false|$undef)     dflt='n' ;;
7816 *)      case "$ptrsize" in
7817         4) dflt='y' ;;
7818         *) dflt='n' ;;
7819         esac
7820         if test "$useithreads" = "$define"; then dflt='n'; fi
7821         ;;
7822 esac
7823 rp="Do you wish to attempt to use the malloc that comes with $package?"
7824 . ./myread
7825 usemymalloc="$ans"
7826 case "$ans" in
7827 y*|true)
7828         usemymalloc='y'
7829         mallocsrc='malloc.c'
7830         mallocobj="malloc$_o"
7831         d_mymalloc="$define"
7832         case "$libs" in
7833         *-lmalloc*)
7834                 : Remove malloc from list of libraries to use
7835                 echo "Removing unneeded -lmalloc from library list" >&4
7836                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7837                 shift
7838                 libs="$*"
7839                 echo "libs = $libs" >&4
7840                 ;;
7841         esac
7842         ;;
7843 *)
7844         usemymalloc='n'
7845         mallocsrc=''
7846         mallocobj=''
7847         d_mymalloc="$undef"
7848         ;;
7849 esac
7850
7851 : compute the return types of malloc and free
7852 echo " "
7853 $cat >malloc.c <<END
7854 #$i_malloc I_MALLOC
7855 #$i_stdlib I_STDLIB
7856 #include <stdio.h>
7857 #include <sys/types.h>
7858 #ifdef I_MALLOC
7859 #include <malloc.h>
7860 #endif
7861 #ifdef I_STDLIB
7862 #include <stdlib.h>
7863 #endif
7864 #ifdef TRY_MALLOC
7865 void *malloc();
7866 #endif
7867 #ifdef TRY_FREE
7868 void free();
7869 #endif
7870 END
7871 case "$malloctype" in
7872 '')
7873         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7874                 malloctype='void *'
7875         else
7876                 malloctype='char *'
7877         fi
7878         ;;
7879 esac
7880 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7881
7882 case "$freetype" in
7883 '')
7884         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7885                 freetype='void'
7886         else
7887                 freetype='int'
7888         fi
7889         ;;
7890 esac
7891 echo "Your system uses $freetype free(), it would seem." >&4
7892 $rm -f malloc.[co]
7893 : determine where site specific architecture-dependent libraries go.
7894 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7895 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7896 : sitelib may have an optional trailing /share.
7897 case "$sitearch" in
7898 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7899         dflt="$dflt/$archname"
7900         ;;
7901 *)      dflt="$sitearch"
7902         ;;
7903 esac
7904 set sitearch sitearch none
7905 eval $prefixit
7906 $cat <<EOM
7907
7908 The installation process will also create a directory for
7909 architecture-dependent site-specific extensions and modules.
7910
7911 EOM
7912 fn=d~+
7913 rp='Pathname for the site-specific architecture-dependent library files?'
7914 . ./getfile
7915 prefixvar=sitearch
7916 . ./setprefixvar
7917 if $test X"$sitearch" = X"$sitelib"; then
7918         d_sitearch="$undef"
7919 else
7920         d_sitearch="$define"
7921 fi
7922
7923 : Set the vendorprefix variables
7924 $cat <<EOM
7925
7926 The installation process will also create a directory for
7927 vendor-supplied add-ons.  Vendors who supply perl with their system
7928 may find it convenient to place all vendor-supplied files in this
7929 directory rather than in the main distribution directory.  This will
7930 ease upgrades between binary-compatible maintenance versions of perl.
7931
7932 Of course you may also use these directories in whatever way you see
7933 fit.  For example, you might use them to access modules shared over a
7934 company-wide network.
7935
7936 The default answer should be fine for most people.
7937 This causes further questions about vendor add-ons to be skipped
7938 and no vendor-specific directories will be configured for perl.
7939
7940 EOM
7941 rp='Do you want to configure vendor-specific add-on directories?'
7942 case "$usevendorprefix" in
7943 define|true|[yY]*) dflt=y ;;
7944 *)      : User may have set vendorprefix directly on Configure command line.
7945         case "$vendorprefix" in
7946         ''|' ') dflt=n ;;
7947         *)      dflt=y ;;
7948         esac
7949         ;;
7950 esac
7951 . ./myread
7952 case "$ans" in
7953 [yY]*)  fn=d~+
7954         rp='Installation prefix to use for vendor-supplied add-ons?'
7955         case "$vendorprefix" in
7956         '') dflt="$prefix" ;;
7957         *)  dflt=$vendorprefix ;;
7958         esac
7959         . ./getfile
7960         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7961         oldvendorprefix=''
7962         case "$vendorprefix" in
7963         '') ;;
7964         *)      case "$ans" in
7965                 "$prefix") ;;
7966                 *) oldvendorprefix="$prefix";;
7967                 esac
7968                 ;;
7969         esac
7970         usevendorprefix="$define"
7971         vendorprefix="$ans"
7972         vendorprefixexp="$ansexp"
7973         ;;
7974 *)      usevendorprefix="$undef"
7975         vendorprefix=''
7976         vendorprefixexp=''
7977         ;;
7978 esac
7979
7980 : Set the vendorlib variables
7981 case "$vendorprefix" in
7982 '')     d_vendorlib="$undef"
7983         vendorlib=''
7984         vendorlibexp=''
7985         ;;
7986 *)      d_vendorlib="$define"
7987         : determine where vendor-supplied modules go.
7988         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7989         case "$vendorlib" in
7990         '')
7991                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7992                 case "$installstyle" in
7993                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7994                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7995                 esac
7996                 ;;
7997         *)      dflt="$vendorlib"
7998                 ;;
7999         esac
8000         fn=d~+
8001         rp='Pathname for the vendor-supplied library files?'
8002         . ./getfile
8003         vendorlib="$ans"
8004         vendorlibexp="$ansexp"
8005         ;;
8006 esac
8007 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8008 prefixvar=vendorlib
8009 . ./installprefix
8010
8011 : Set the vendorarch variables
8012 case "$vendorprefix" in
8013 '')     d_vendorarch="$undef"
8014         vendorarch=''
8015         vendorarchexp=''
8016         ;;
8017 *)      d_vendorarch="$define"
8018         : determine where vendor-supplied architecture-dependent libraries go.
8019         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8020         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8021         : vendorlib may have an optional trailing /share.
8022         case "$vendorarch" in
8023         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8024                 dflt="$dflt/$archname"
8025                 ;;
8026         *)      dflt="$vendorarch" ;;
8027         esac
8028         fn=d~+
8029         rp='Pathname for vendor-supplied architecture-dependent files?'
8030         . ./getfile
8031         vendorarch="$ans"
8032         vendorarchexp="$ansexp"
8033         ;;
8034 esac
8035 prefixvar=vendorarch
8036 . ./installprefix
8037 if $test X"$vendorarch" = X"$vendorlib"; then
8038         d_vendorarch="$undef"
8039 else
8040         d_vendorarch="$define"
8041 fi
8042
8043 : Final catch-all directories to search
8044 $cat <<EOM
8045
8046 Lastly, you can have perl look in other directories for extensions and
8047 modules in addition to those already specified.
8048 These directories will be searched after
8049         $sitearch
8050         $sitelib
8051 EOM
8052 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8053 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8054 echo ' '
8055 case "$otherlibdirs" in
8056 ''|' ') dflt='none' ;;
8057 *)      dflt="$otherlibdirs" ;;
8058 esac
8059 $cat <<EOM
8060 Enter a colon-separated set of extra paths to include in perl's @INC
8061 search path, or enter 'none' for no extra paths.
8062
8063 EOM
8064
8065 rp='Colon-separated list of additional directories for perl to search?'
8066 . ./myread
8067 case "$ans" in
8068 ' '|''|none)    otherlibdirs=' ' ;;
8069 *)      otherlibdirs="$ans" ;;
8070 esac
8071 case "$otherlibdirs" in
8072 ' ') val=$undef ;;
8073 *)      val=$define ;;
8074 esac
8075 set d_perl_otherlibdirs
8076 eval $setvar
8077
8078 : Cruising for prototypes
8079 echo " "
8080 echo "Checking out function prototypes..." >&4
8081 $cat >prototype.c <<EOCP
8082 #$i_stdlib I_STDLIB
8083 #ifdef I_STDLIB
8084 #include <stdlib.h>
8085 #endif
8086 int main(int argc, char *argv[]) {
8087         exit(0);}
8088 EOCP
8089 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8090         echo "Your C compiler appears to support function prototypes."
8091         val="$define"
8092 else
8093         echo "Your C compiler doesn't seem to understand function prototypes."
8094         val="$undef"
8095 fi
8096 set prototype
8097 eval $setvar
8098 $rm -f prototype*
8099
8100 : Check if ansi2knr is required
8101 case "$prototype" in
8102 "$define") ;;
8103 *)      ansi2knr='ansi2knr'
8104         echo " "
8105         cat <<EOM >&4
8106
8107 $me:  FATAL ERROR:
8108 This version of $package can only be compiled by a compiler that
8109 understands function prototypes.  Unfortunately, your C compiler
8110         $cc $ccflags
8111 doesn't seem to understand them.  Sorry about that.
8112
8113 If GNU cc is available for your system, perhaps you could try that instead.
8114
8115 Eventually, we hope to support building Perl with pre-ANSI compilers.
8116 If you would like to help in that effort, please contact <perlbug@perl.org>.
8117
8118 Aborting Configure now.
8119 EOM
8120         exit 2
8121         ;;
8122 esac
8123
8124 : DTrace support
8125 dflt_dtrace='/usr/sbin/dtrace'
8126 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8127
8128 cat <<EOM
8129
8130 Perl can be built to support DTrace on platforms that support it.
8131 DTrace is a diagnosis and performance analysis tool from Sun.
8132
8133 If this doesn't make any sense to you, just accept the default.
8134 EOM
8135
8136 while $test 1 ; do
8137         case "$usedtrace" in
8138         $define|true|[yY]*)
8139                 dflt='y'
8140                 ;;
8141         ?*)
8142                 dflt='y'
8143                 dflt_dtrace=$usedtrace
8144                 ;;
8145         *)
8146                 dflt='n'
8147                 ;;
8148         esac
8149
8150         rp='Support DTrace if available?'
8151         . ./myread
8152         case "$ans" in
8153         y|Y)    val="$define" ;;
8154         *)      val="$undef" ;;
8155         esac
8156         set usedtrace
8157         eval $setvar
8158
8159         test "X$usedtrace" != "X$define" && break
8160
8161         echo " "
8162         rp='Where is the dtrace executable?'
8163         dflt=$dflt_dtrace
8164         . ./getfile
8165         val="$ans"
8166         set dtrace
8167         eval $setvar
8168
8169         if $test -f $dtrace
8170         then
8171                 if $dtrace -h -s ../perldtrace.d \
8172                         -o perldtrace.tmp >/dev/null 2>&1 \
8173                         && rm -f perldtrace.tmp
8174                 then
8175                         echo " "
8176                         echo "Good: your $dtrace knows about the -h flag."
8177                 else
8178                         cat >&2 <<EOM
8179
8180 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8181 ***
8182 *** Your installed dtrace doesn't support the -h switch to compile a D
8183 *** program into a C header. Can't continue.
8184
8185 EOM
8186                         exit 1
8187                 fi
8188                 break;
8189         fi
8190
8191         case "$fastread" in
8192         yes)
8193                 cat >&2 <<EOM
8194
8195 *** $me:  Fatal Error:  $dtrace not found.
8196 *** Can't continue.
8197
8198 EOM
8199                 exit 1
8200                 ;;
8201         *)
8202                 echo "*** $dtrace was not found."
8203                 echo " "
8204                 ;;
8205         esac
8206 done
8207
8208 : See if we want extra modules installed
8209 echo " "
8210 case "$extras" in
8211 '') dflt='n';;
8212 *) dflt='y';;
8213 esac
8214 cat <<EOM
8215 Perl can be built with extra modules or bundles of modules which
8216 will be fetched from the CPAN and installed alongside Perl.
8217
8218 Notice that you will need access to the CPAN; either via the Internet,
8219 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8220 be asked later to configure the CPAN.pm module which will in turn do
8221 the installation of the rest of the extra modules or bundles.)
8222
8223 Notice also that if the modules require any external software such as
8224 libraries and headers (the libz library and the zlib.h header for the
8225 Compress::Zlib module, for example) you MUST have any such software
8226 already installed, this configuration process will NOT install such
8227 things for you.
8228
8229 If this doesn't make any sense to you, just accept the default '$dflt'.
8230 EOM
8231 rp='Install any extra modules (y or n)?'
8232 . ./myread
8233 case "$ans" in
8234 y|Y)
8235         cat <<EOM
8236
8237 Please list any extra modules or bundles to be installed from CPAN,
8238 with spaces between the names.  The names can be in any format the
8239 'install' command of CPAN.pm will understand.  (Answer 'none',
8240 without the quotes, to install no extra modules or bundles.)
8241 EOM
8242         rp='Extras?'
8243         dflt="$extras"
8244         . ./myread
8245         extras="$ans"
8246 esac
8247 case "$extras" in
8248 ''|'none')
8249         val=''
8250         $rm -f ../extras.lst
8251         ;;
8252 *)      echo "(Saving the list of extras for later...)"
8253         echo "$extras" > ../extras.lst
8254         val="'$extras'"
8255         ;;
8256 esac
8257 set extras
8258 eval $setvar
8259 echo " "
8260
8261 : determine where html pages for programs go
8262 set html1dir html1dir none
8263 eval $prefixit
8264 $cat <<EOM
8265
8266 If you wish to install html files for programs in $spackage, indicate
8267 the appropriate directory here.  To skip installing html files,
8268 answer "none".
8269 EOM
8270 case "$html1dir" in
8271 ''|none|$undef|' ') dflt=none ;;
8272 *) dflt=$html1dir ;;
8273 esac
8274 fn=dn+~
8275 rp="Directory for the main $spackage html pages?"
8276 . ./getfile
8277 prefixvar=html1dir
8278 . ./setprefixvar
8279 : Use ' ' for none so value is preserved next time through Configure
8280 $test X"$html1dir" = "X" && html1dir=' '
8281
8282 : determine where html pages for libraries and modules go
8283 set html3dir html3dir none
8284 eval $prefixit
8285 $cat <<EOM
8286
8287 If you wish to install html files for modules associated with $spackage,
8288 indicate the appropriate directory here.  To skip installing html files,
8289 answer "none".
8290 EOM
8291 : There is no obvious default.  If they have specified html1dir, then
8292 : try to key off that, possibly changing .../html1 into .../html3.
8293 case "$html3dir" in
8294 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8295 *) dflt=$html3dir ;;
8296 esac
8297 fn=dn+~
8298 rp="Directory for the $spackage module html pages?"
8299 . ./getfile
8300 prefixvar=html3dir
8301 . ./setprefixvar
8302 : Use ' ' for none so value is preserved next time through Configure
8303 $test X"$html3dir" = "X" && html3dir=' '
8304
8305 : determine whether to install perl also as /usr/bin/perl
8306
8307 echo " "
8308 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8309         $cat <<EOM
8310 Many scripts expect perl to be installed as /usr/bin/perl.
8311
8312 If you want to, I can install the perl you are about to compile
8313 as /usr/bin/perl (in addition to $bin/perl).
8314 EOM
8315         if test -f /usr/bin/perl; then
8316             $cat <<EOM
8317
8318 However, please note that because you already have a /usr/bin/perl,
8319 overwriting that with a new Perl would very probably cause problems.
8320 Therefore I'm assuming you don't want to do that (unless you insist).
8321
8322 EOM
8323             case "$installusrbinperl" in
8324             "$define"|[yY]*)    dflt='y';;
8325             *)                  dflt='n';;
8326             esac
8327         else
8328             $cat <<EOM
8329
8330 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8331
8332 EOM
8333             case "$installusrbinperl" in
8334             "$undef"|[nN]*)     dflt='n';;
8335             *)                  dflt='y';;
8336             esac
8337         fi
8338         rp="Do you want to install perl as /usr/bin/perl?"
8339         . ./myread
8340         case "$ans" in
8341         [yY]*)  val="$define";;
8342         *)      val="$undef" ;;
8343         esac
8344 else
8345         val="$undef"
8346 fi
8347 set installusrbinperl
8348 eval $setvar
8349
8350 : see if dlopen exists
8351 xxx_runnm="$runnm"
8352 xxx_ccflags="$ccflags"
8353 runnm=false
8354 : with g++ one needs -shared to get is-in-libc to work for dlopen
8355 case "$gccversion" in
8356 '')     ;;
8357 *Clang*)        ;;
8358 *)      case "$d_cplusplus" in
8359         "$define") ccflags="$ccflags -shared" ;;
8360         esac
8361         ;;
8362 esac
8363 set dlopen d_dlopen
8364 eval $inlibc
8365 runnm="$xxx_runnm"
8366 ccflags="$xxx_ccflags"
8367
8368 : see if this is a unistd.h system
8369 set unistd.h i_unistd
8370 eval $inhdr
8371
8372 : determine which dynamic loading, if any, to compile in
8373 echo " "
8374 dldir="ext/DynaLoader"
8375 case "$usedl" in
8376     $define|y|true)
8377         dflt='y'
8378         usedl="$define"
8379         ;;
8380     $undef|n|false)
8381         dflt='n'
8382         usedl="$undef"
8383         ;;
8384     *)
8385         dflt='n'
8386         case "$d_dlopen" in
8387             $define) dflt='y' ;;
8388         esac
8389         : Does a dl_xxx.xs file exist for this operating system
8390         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8391         ;;
8392 esac
8393 rp="Do you wish to use dynamic loading?"
8394 . ./myread
8395 usedl="$ans"
8396 bin_ELF="$undef"
8397 case "$ans" in
8398     y*) usedl="$define"
8399         case "$dlsrc" in
8400             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8401                     dflt="$dldir/dl_${osname}.xs"
8402                 elif $test "$d_dlopen" = "$define" ; then
8403                     dflt="$dldir/dl_dlopen.xs"
8404                 else
8405                     dflt=''
8406                 fi
8407                 ;;
8408             *)  dflt="$dldir/$dlsrc"
8409                 ;;
8410         esac
8411         echo "The following dynamic loading files are available:"
8412         : Can not go over to $dldir because getfile has path hard-coded in.
8413         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8414         rp="Source file to use for dynamic loading"
8415         fn="fne"
8416         gfpth="$src"
8417         . ./getfile
8418         usedl="$define"
8419         : emulate basename
8420         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8421
8422         $cat << EOM
8423
8424 Some systems may require passing special flags to $cc -c to
8425 compile modules that will be used to create a shared library.
8426 To use no flags, say "none".
8427
8428 EOM
8429         case "$cccdlflags" in
8430             '') case "$gccversion" in
8431                 '') case "$osname" in
8432                         hpux)   dflt='+z' ;;
8433                         irix*)  dflt='-KPIC' ;;
8434                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8435                         sunos)  dflt='-pic' ;;
8436                         *)      dflt='none' ;;
8437                     esac
8438                     ;;
8439                 *)  case "$osname" in
8440                         darwin) dflt='none' ;;
8441                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8442                         *)      dflt='-fpic' ;;
8443                     esac ;;
8444                 esac ;;
8445             ' ') dflt='none' ;;
8446             *)   dflt="$cccdlflags" ;;
8447         esac
8448
8449         case "$dflt" in
8450             none) dflt='' ;;
8451         esac
8452
8453         # If -Dsysroot was specified, now's the time to add it
8454         # to cccdlflags
8455         if test "X$sysroot" != X; then
8456             case "$gccversion" in
8457                 '') ;;
8458                 *)  case "$dflt" in
8459                         *sysroot*) ;;
8460                         'undef'|*)
8461                             dflt="$dflt --sysroot=$sysroot" ;;
8462                     esac
8463                     ;;
8464             esac
8465         fi
8466
8467         case "$dflt" in
8468             '') dflt='none';;
8469         esac
8470
8471         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8472         . ./myread
8473         case "$ans" in
8474             none) cccdlflags=' ' ;;
8475             *)    cccdlflags="$ans" ;;
8476         esac
8477
8478         cat << EOM
8479
8480 Some systems use ld to create libraries that can be dynamically loaded,
8481 while other systems (such as those using ELF) use $cc.
8482
8483 EOM
8484
8485 : Determine if this is ELF
8486         $cat >try.c <<EOM
8487 /* Test for whether ELF binaries are produced */
8488 #include <fcntl.h>
8489 #$i_stdlib I_STDLIB
8490 #ifdef I_STDLIB
8491 #include <stdlib.h>
8492 #endif
8493 #$i_unistd I_UNISTD
8494 #ifdef I_UNISTD
8495 #include <unistd.h>
8496 #endif
8497 int main() {
8498     char b[4];
8499     int i = open("a.out",O_RDONLY);
8500     if(i == -1)
8501         exit(1); /* fail */
8502     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8503         exit(0); /* succeed (yes, it is ELF) */
8504     exit(1); /* fail */
8505 }
8506 EOM
8507         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8508             bin_ELF="$define"
8509         fi
8510         $rm_try
8511
8512         case "$ld" in
8513             '') if $test $bin_ELF = "$define"; then
8514                     cat <<EOM
8515 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8516 EOM
8517                     dflt="$cc"
8518                 else
8519                     echo "I'll use ld to build dynamic libraries."
8520                     dflt='ld'
8521                 fi
8522                 ;;
8523             *)  dflt="$ld"
8524                 ;;
8525         esac
8526
8527         rp="What command should be used to create dynamic libraries?"
8528         . ./myread
8529         ld="$ans"
8530
8531         cat << EOM
8532
8533 Some systems may require passing special flags to $ld to create a
8534 library that can be dynamically loaded.  If your ld flags include
8535 -L/other/path options to locate libraries outside your loader's normal
8536 search path, you may need to specify those -L options here as well.  To
8537 use no flags, say "none".
8538
8539 EOM
8540         case "$lddlflags" in
8541             '') case "$osname" in
8542                     haiku) dflt='-shared' ;;
8543                     hpux) dflt='-b';
8544                           case "$gccversion" in
8545                               '') dflt="$dflt +vnocompatwarnings" ;;
8546                           esac
8547                           ;;
8548                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8549                     solaris) # See [perl #66604].
8550                             # On Solaris 11, gcc -m64 on amd64
8551                             # appears not to understand -G.  gcc versions at
8552                             # least as old as 3.4.3 support -shared, so just
8553                             # use that with Solaris 11 and later, but keep
8554                             # the old behavior for older Solaris versions.
8555                             case "$gccversion" in
8556                                 '') dflt='-G' ;;
8557                                 *)  case "$osvers" in
8558                                         2.?|2.10) dflt='-G' ;;
8559                                         *) dflt='-shared' ;;
8560                                     esac
8561                                     ;;
8562                             esac
8563                             ;;
8564                     sunos) dflt='-assert nodefinitions' ;;
8565                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8566                     *)     dflt='none' ;;
8567                 esac
8568                 ;;
8569             *) dflt="$lddlflags" ;;
8570         esac
8571
8572         : Only do this for gcc, since, for example, qcc has no concept
8573         : of --sysroot.
8574         if $test "X$sysroot" != X; then
8575             case "$gccversion" in
8576                 '') ;;
8577                 *)  dflt="$dflt --sysroot $sysroot" ;;
8578             esac
8579         fi
8580
8581         : Try to guess additional flags to pick up local libraries.
8582         : Be careful not to append to a plain 'none'
8583         case "$dflt" in
8584             none) dflt='' ;;
8585         esac
8586         for thisflag in $ldflags; do
8587             case "$thisflag" in
8588                 -L*|-R*|-Wl,-R*)
8589                     case " $dflt " in
8590                         *" $thisflag "*) ;;
8591                         *) dflt="$dflt $thisflag" ;;
8592                     esac
8593                     ;;
8594             esac
8595         done
8596
8597         case "$dflt" in
8598             ''|' ') dflt='none' ;;
8599         esac
8600
8601         case "$ldflags" in
8602             *-fstack-protector-strong*)
8603                 case "$dflt" in
8604                     *-fstack-protector-strong*) ;; # Don't add it again
8605                     *) dflt="$dflt -fstack-protector-strong" ;;
8606                 esac
8607                 ;;
8608             *-fstack-protector*)
8609                 case "$dflt" in
8610                     *-fstack-protector*) ;; # Don't add it again
8611                     *) dflt="$dflt -fstack-protector" ;;
8612                 esac
8613                 ;;
8614         esac
8615
8616         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8617         . ./myread
8618         case "$ans" in
8619             none) lddlflags=' ' ;;
8620             *) lddlflags="$ans" ;;
8621         esac
8622
8623         cat <<EOM
8624
8625 Some systems may require passing special flags to $cc to indicate that
8626 the resulting executable will use dynamic linking.  To use no flags,
8627 say "none".
8628
8629 EOM
8630         case "$ccdlflags" in
8631             '') case "$osname" in
8632                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8633                     sunos)             dflt='none'   ;;
8634                     *)                 dflt='none'   ;;
8635                 esac ;;
8636             ' ') dflt='none' ;;
8637             *)   dflt="$ccdlflags" ;;
8638         esac
8639         rp="Any special flags to pass to $cc to use dynamic linking?"
8640         . ./myread
8641         case "$ans" in
8642             none) ccdlflags=' ' ;;
8643             *)    ccdlflags="$ans" ;;
8644         esac
8645         ;;
8646
8647     *)  usedl="$undef"
8648         ld='ld'
8649         dlsrc='dl_none.xs'
8650         lddlflags=''
8651         ccdlflags=''
8652         ;;
8653 esac
8654
8655 ld_can_script="$undef"
8656 case "$bin_ELF$usedl" in
8657     $define$define)
8658         # Abuse try.h and a.out names for neat cleanup
8659         $cat >try.c <<EOM
8660 void foo() {}
8661 void bar() {}
8662 EOM
8663         $cat >try.h <<EOM
8664 LIBTEST_42 {
8665  global:
8666   foo;
8667  local: *;
8668  };
8669 EOM
8670         if $cc $cccdlflags $ccdlflags $ccflags \
8671                $ldflags $lddlflags -o a.out try.c \
8672                -Wl,--version-script=try.h >/dev/null 2>&1 \
8673            &&  $test -s a.out ; then
8674             echo "ld supports scripting" >&4
8675             ld_can_script="$define"
8676         else
8677             echo "ld does not support scripting" >&4
8678         fi
8679         $rm_try
8680         ;;
8681 esac
8682
8683 : Do we want a shared libperl?
8684 also=''
8685 case "$usedl" in
8686 $undef)
8687         # No dynamic loading being used, so don't bother even to prompt.
8688         useshrplib='false'
8689         ;;
8690 *)      case "$useshrplib" in
8691         '')     case "$osname" in
8692                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8693                         dflt=y
8694                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8695                         ;;
8696                 *)      dflt=n
8697                         ;;
8698                 esac
8699                 ;;
8700         $define|true|[Yy]*)
8701                 dflt=y
8702                 ;;
8703         *)      dflt=n
8704                 ;;
8705         esac
8706         $cat << EOM
8707
8708 The perl executable is normally obtained by linking perlmain.c with
8709 libperl${_a}, any static extensions (usually just DynaLoader), and
8710 any other libraries needed on this system (such as -lm, etc.).  Since
8711 your system supports dynamic loading, it is probably possible to build
8712 a shared libperl.$so.  If you will have more than one executable linked
8713 to libperl.$so, this will significantly reduce the size of each
8714 executable, but it may have a noticeable effect on performance.  The
8715 default is probably sensible for your system.
8716 $also
8717
8718 EOM
8719         rp="Build a shared libperl.$so (y/n)"
8720         . ./myread
8721         case "$ans" in
8722         true|$define|[Yy]*)
8723                 useshrplib='true'  ;;
8724         *)      useshrplib='false' ;;
8725         esac
8726         ;;
8727 esac
8728
8729 case "$useshrplib" in
8730 true)
8731         case "$userelocatableinc" in
8732         true|define)
8733                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8734                 echo "See INSTALL for an explanation why that won't work." >&4
8735                 exit 4
8736                 ;;
8737         esac
8738         case "$libperl" in
8739         '')
8740                 # Figure out a good name for libperl.so.  Since it gets stored in
8741                 # a version-specific architecture-dependent library, the version
8742                 # number isn't really that important, except for making cc/ld happy.
8743                 #
8744                 # A name such as libperl.so.10.1
8745                 majmin="libperl.$so.$patchlevel.$subversion"
8746                 # A name such as libperl.so.100
8747                 majonly=`echo $patchlevel $subversion |
8748                         $awk '{printf "%d%02d", $1, $2}'`
8749                 majonly=libperl.$so.$majonly
8750                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8751                 # rely on figuring it out from the naming of libc.
8752                 case "${osname}${osvers}" in
8753                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8754                         dflt=libperl.$so
8755                         ;;
8756                 cygwin*) # ld links now against the dll directly
8757                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8758                         majonly=`echo $patchlevel $subversion |
8759                                 $awk '{printf "%03d%03d", $1, $2}'`
8760                         majonly=cygperl5.$majonly.$so
8761                         dflt=$majmin
8762                         ;;
8763                 *)      # Try to guess based on whether libc has major.minor.
8764                         case "$libc" in
8765                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8766                         *libc.$so.[0-9]*) dflt=$majonly ;;
8767                         *)      dflt=libperl.$so ;;
8768                         esac
8769                         ;;
8770                 esac
8771                 ;;
8772         *)      dflt=$libperl
8773                 ;;
8774         esac
8775         cat << EOM
8776
8777 I need to select a good name for the shared libperl.  If your system uses
8778 library names with major and minor numbers, then you might want something
8779 like $majmin.  Alternatively, if your system uses a single version
8780 number for shared libraries, then you might want to use $majonly.
8781 Or, your system might be quite happy with a simple libperl.$so.
8782
8783 Since the shared libperl will get installed into a version-specific
8784 architecture-dependent directory, the version number of the shared perl
8785 library probably isn't important, so the default should be o.k.
8786
8787 EOM
8788         rp='What name do you want to give to the shared libperl?'
8789         . ./myread
8790         libperl=$ans
8791         echo "Ok, I'll use $libperl"
8792         ;;
8793 *)
8794         libperl="libperl${_a}"
8795         ;;
8796 esac
8797
8798 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8799 case "$shrpdir" in
8800 '') ;;
8801 *)      $cat >&4 <<EOM
8802 WARNING:  Use of the shrpdir variable for the installation location of
8803 the shared $libperl is not supported.  It was never documented and
8804 will not work in this version.  Let me (perlbug@perl.org)
8805 know of any problems this may cause.
8806
8807 EOM
8808         case "$shrpdir" in
8809         "$archlibexp/CORE")
8810                 $cat >&4 <<EOM
8811 But your current setting of $shrpdir is
8812 the default anyway, so it's harmless.
8813 EOM
8814                 ;;
8815         *)
8816                 $cat >&4 <<EOM
8817 Further, your current attempted setting of $shrpdir
8818 conflicts with the value of $archlibexp/CORE
8819 that installperl will use.
8820 EOM
8821                 ;;
8822         esac
8823         ;;
8824 esac
8825
8826 # How will the perl executable find the installed shared $libperl?
8827 # Add $xxx to ccdlflags.
8828 # If we can't figure out a command-line option, use $shrpenv to
8829 # set env LD_RUN_PATH.  The main perl makefile uses this.
8830 shrpdir=$archlibexp/CORE
8831 xxx=''
8832 tmp_shrpenv=''
8833 if "$useshrplib"; then
8834     case "$osname" in
8835         aix)
8836                 # We'll set it in Makefile.SH...
8837                 ;;
8838         solaris)
8839                 xxx="-R $shrpdir"
8840                 ;;
8841         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8842                 xxx="-Wl,-R$shrpdir"
8843                 ;;
8844         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8845                 xxx="-Wl,-rpath,$shrpdir"
8846                 ;;
8847         hpux*)
8848                 # hpux doesn't like the default, either.
8849                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8850                 ;;
8851         cygwin)
8852                 # cygwin needs only ldlibpth
8853                 ;;
8854         *)
8855                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8856                 ;;
8857         esac
8858         case "$xxx" in
8859         '') ;;
8860         *)
8861                 # Only add $xxx if it isn't already in ccdlflags.
8862                 case " $ccdlflags " in
8863                 *" $xxx "*)     ;;
8864                 *)      ccdlflags="$ccdlflags $xxx"
8865                         cat <<EOM >&4
8866
8867 Adding $xxx to the flags
8868 passed to $ld so that the perl executable will find the
8869 installed shared $libperl.
8870
8871 EOM
8872                         ;;
8873                 esac
8874                 ;;
8875         esac
8876 fi
8877 # Fix ccdlflags in AIX for building external extensions.
8878 # (For building Perl itself bare -bE:perl.exp is needed,
8879 #  Makefile.SH takes care of this.)
8880 case "$osname" in
8881 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8882 esac
8883 # Respect a hint or command-line value.
8884 case "$shrpenv" in
8885 '') shrpenv="$tmp_shrpenv" ;;
8886 esac
8887 case "$ldlibpthname" in
8888 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8889 none)   ldlibpthname='' ;;
8890 esac
8891
8892 : determine where manual pages are on this system
8893 echo " "
8894 case "$sysman" in
8895 '')
8896         syspath='/usr/share/man/man1 /usr/man/man1'
8897         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8898         syspath="$syspath /usr/man/u_man/man1"
8899         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8900         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8901         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8902         sysman=`./loc . /usr/man/man1 $syspath`
8903         ;;
8904 esac
8905 if $test -d "$sysman"; then
8906         echo "System manual is in $sysman." >&4
8907 else
8908         echo "Could not find manual pages in source form." >&4
8909 fi
8910
8911 : determine where manual pages go
8912 set man1dir man1dir none
8913 eval $prefixit
8914 $cat <<EOM
8915
8916 $spackage has manual pages available in source form.
8917 EOM
8918 case "$nroff" in
8919 nroff)
8920         echo "However, you don't have nroff, so they're probably useless to you."
8921         case "$man1dir" in
8922         '') man1dir="none";;
8923         esac;;
8924 esac
8925 echo "If you don't want the manual sources installed, answer 'none'."
8926 case "$man1dir" in
8927 ' ') dflt=none
8928         ;;
8929 '')
8930         lookpath="$prefixexp/share/man/man1"
8931         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8932         lookpath="$lookpath $prefixexp/man/p_man/man1"
8933         lookpath="$lookpath $prefixexp/man/u_man/man1"
8934         lookpath="$lookpath $prefixexp/man/man.1"
8935         case "$sysman" in
8936         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8937         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8938         esac
8939         set dflt
8940         eval $prefixup
8941         ;;
8942 *)  dflt="$man1dir"
8943         ;;
8944 esac
8945 echo " "
8946 fn=dn+~
8947 rp="Where do the main $spackage manual pages (source) go?"
8948 . ./getfile
8949 if $test "X$man1direxp" != "X$ansexp"; then
8950         installman1dir=''
8951 fi
8952 prefixvar=man1dir
8953 . ./setprefixvar
8954
8955 case "$man1dir" in
8956 '')     man1dir=' '
8957         installman1dir='';;
8958 esac
8959
8960 : What suffix to use on installed man pages
8961
8962 case "$man1dir" in
8963 ' ')
8964         man1ext='0'
8965         ;;
8966 *)
8967         rp="What suffix should be used for the main $spackage man pages?"
8968         case "$man1ext" in
8969         '')     case "$man1dir" in
8970                 *1)  dflt=1 ;;
8971                 *1p) dflt=1p ;;
8972                 *1pm) dflt=1pm ;;
8973                 *l) dflt=l;;
8974                 *n) dflt=n;;
8975                 *o) dflt=o;;
8976                 *p) dflt=p;;
8977                 *C) dflt=C;;
8978                 *L) dflt=L;;
8979                 *L1) dflt=L1;;
8980                 *) dflt=1;;
8981                 esac
8982                 ;;
8983         *)      dflt="$man1ext";;
8984         esac
8985         . ./myread
8986         man1ext="$ans"
8987         ;;
8988 esac
8989
8990 : see if we can have long filenames
8991 echo " "
8992 first=123456789abcdef
8993 $rm -f $first
8994 if (echo hi >$first) 2>/dev/null; then
8995         if $test -f 123456789abcde; then
8996                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8997                 val="$undef"
8998         else
8999                 echo 'You can have filenames longer than 14 characters.'>&4
9000                 val="$define"
9001         fi
9002 else
9003         $cat <<'EOM'
9004 You can't have filenames longer than 14 chars.
9005 You can't even think about them!
9006 EOM
9007         val="$undef"
9008 fi
9009 set d_flexfnam
9010 eval $setvar
9011 $rm -rf 123456789abcde*
9012
9013 : determine where library module manual pages go
9014 set man3dir man3dir none
9015 eval $prefixit
9016 $cat <<EOM
9017
9018 $spackage has manual pages for many of the library modules.
9019 EOM
9020
9021 case "$nroff" in
9022 nroff)
9023         $cat <<'EOM'
9024 However, you don't have nroff, so they're probably useless to you.
9025 EOM
9026         case "$man3dir" in
9027         '') man3dir="none";;
9028         esac;;
9029 esac
9030
9031 case "$d_flexfnam" in
9032 undef)
9033         $cat <<'EOM'
9034 However, your system can't handle the long file names like File::Basename.3.
9035 EOM
9036         case "$man3dir" in
9037         '') man3dir="none";;
9038         esac;;
9039 esac
9040
9041 echo "If you don't want the manual sources installed, answer 'none'."
9042 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9043 case "$man3dir" in
9044 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9045         if $test -d "$privlib/man/man3"; then
9046                 cat <<EOM >&4
9047
9048 WARNING:  Previous versions of perl installed man3 pages into
9049 $privlib/man/man3.  This version will suggest a
9050 new default of $dflt.
9051 EOM
9052                 tdflt=$dflt
9053                 dflt='n'
9054                 rp='Do you wish to preserve the old behavior?(y/n)'
9055                 . ./myread
9056                 case "$ans" in
9057                 y*) dflt="$privlib/man/man3" ;;
9058                 *)  dflt=$tdflt ;;
9059                 esac
9060     fi
9061         ;;
9062 *)      dflt="$man3dir" ;;
9063 esac
9064 case "$dflt" in
9065 ' ') dflt=none ;;
9066 esac
9067 echo " "
9068 fn=dn+~
9069 rp="Where do the $package library man pages (source) go?"
9070 . ./getfile
9071 prefixvar=man3dir
9072 . ./setprefixvar
9073
9074 case "$man3dir" in
9075 '')     man3dir=' '
9076         installman3dir='';;
9077 esac
9078
9079 : What suffix to use on installed man pages
9080 case "$man3dir" in
9081 ' ')
9082         man3ext='0'
9083         ;;
9084 *)
9085         rp="What suffix should be used for the $package library man pages?"
9086         case "$man3ext" in
9087         '')     case "$man3dir" in
9088                 *3)  dflt=3 ;;
9089                 *3p) dflt=3p ;;
9090                 *3pm) dflt=3pm ;;
9091                 *l) dflt=l;;
9092                 *n) dflt=n;;
9093                 *o) dflt=o;;
9094                 *p) dflt=p;;
9095                 *C) dflt=C;;
9096                 *L) dflt=L;;
9097                 *L3) dflt=L3;;
9098                 *) dflt=3;;
9099                 esac
9100                 ;;
9101         *)      dflt="$man3ext";;
9102         esac
9103         . ./myread
9104         man3ext="$ans"
9105         ;;
9106 esac
9107
9108 : see if we have to deal with yellow pages, now NIS.
9109 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9110         case "$hostcat" in
9111         nidump*) ;;
9112         *)
9113                 case "$hostcat" in
9114                 *ypcat*) dflt=y;;
9115                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9116                                 dflt=y
9117                         else
9118                                 dflt=n
9119                         fi;;
9120                 *) dflt=n;;
9121                 esac
9122                 echo " "
9123                 rp='Are you getting the hosts file via yellow pages?'
9124                 . ./myread
9125                 case "$ans" in
9126                 y*) hostcat='ypcat hosts';;
9127                 *) hostcat='cat /etc/hosts';;
9128                 esac
9129                 ;;
9130         esac
9131 fi
9132 case "$hostcat" in
9133 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9134 esac
9135 case "$groupcat" in
9136 '') test -f /etc/group && groupcat='cat /etc/group';;
9137 esac
9138 case "$passcat" in
9139 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9140 esac
9141
9142 : now get the host name
9143 echo " "
9144 echo "Figuring out host name..." >&4
9145 case "$myhostname" in
9146 '') cont=true
9147         echo 'Maybe "hostname" will work...'
9148         if tans=`sh -c hostname 2>&1` ; then
9149                 myhostname=$tans
9150                 phostname=hostname
9151                 cont=''
9152         fi
9153         ;;
9154 *) cont='';;
9155 esac
9156 if $test "$cont"; then
9157         if ./xenix; then
9158                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9159                 if tans=`cat /etc/systemid 2>&1` ; then
9160                         myhostname=$tans
9161                         phostname='cat /etc/systemid'
9162                         echo "Whadyaknow.  Xenix always was a bit strange..."
9163                         cont=''
9164                 fi
9165         elif $test -r /etc/systemid; then
9166                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9167         fi
9168 fi
9169 if $test "$cont"; then
9170         echo 'No, maybe "uuname -l" will work...'
9171         if tans=`sh -c 'uuname -l' 2>&1` ; then
9172                 myhostname=$tans
9173                 phostname='uuname -l'
9174         else
9175                 echo 'Strange.  Maybe "uname -n" will work...'
9176                 if tans=`sh -c 'uname -n' 2>&1` ; then
9177                         myhostname=$tans
9178                         phostname='uname -n'
9179                 else
9180                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9181                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9182                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9183                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9184                         else
9185                                 case "$myhostname" in
9186                                 '') echo "Does this machine have an identity crisis or something?"
9187                                         phostname='';;
9188                                 *)
9189                                         echo "Well, you said $myhostname before..."
9190                                         phostname='echo $myhostname';;
9191                                 esac
9192                         fi
9193                 fi
9194         fi
9195 fi
9196 case "$myhostname" in
9197 '') myhostname=noname ;;
9198 esac
9199 : you do not want to know about this
9200 set $myhostname
9201 myhostname=$1
9202
9203 : verify guess
9204 if $test "$myhostname" ; then
9205         dflt=y
9206         rp='Your host name appears to be "'$myhostname'".'" Right?"
9207         . ./myread
9208         case "$ans" in
9209         y*) ;;
9210         *) myhostname='';;
9211         esac
9212 fi
9213
9214 : bad guess or no guess
9215 while $test "X$myhostname" = X ; do
9216         dflt=''
9217         rp="Please type the (one word) name of your host:"
9218         . ./myread
9219         myhostname="$ans"
9220 done
9221
9222 : translate upper to lower if necessary
9223 case "$myhostname" in
9224 *[A-Z]*)
9225         echo "(Normalizing case in your host name)"
9226         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9227         ;;
9228 esac
9229
9230 case "$myhostname" in
9231 *.*)
9232         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9233         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9234         echo "(Trimming domain name from host name--host name is now $myhostname)"
9235         ;;
9236 *) case "$mydomain" in
9237         '')
9238                 {
9239                         test "X$hostcat" = "Xypcat hosts" &&
9240                         ypmatch "$myhostname" hosts 2>/dev/null |\
9241                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9242                         $test -s hosts
9243                 } || {
9244                         test "X$hostcat" != "X" &&
9245                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9246                                         /[       ]$myhostname[  . ]/p" > hosts
9247                 }
9248                 tmp_re="[       . ]"
9249                 if $test -f hosts; then
9250                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9251                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9252                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9253                                 hosts | $sort | $uniq | \
9254                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9255                         case `$echo X$dflt` in
9256                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9257                                 dflt=.
9258                                 ;;
9259                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9260                                 ;;
9261                         esac
9262                 else
9263                         echo "(I cannot locate a hosts database anywhere)"
9264                         dflt=.
9265                 fi
9266                 case "$dflt" in
9267                 .)
9268                         tans=`./loc resolv.conf X /etc /usr/etc`
9269                         if $test -f "$tans"; then
9270                                 echo "(Attempting domain name extraction from $tans)"
9271                                 dflt=.`$sed -n -e 's/   / /g' \
9272                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9273                                   -e 1q 2>/dev/null`
9274                                 case "$dflt" in
9275                                 .) dflt=.`$sed -n -e 's/        / /g' \
9276                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9277                                      -e 1q 2>/dev/null`
9278                                         ;;
9279                                 esac
9280                         fi
9281                         ;;
9282                 esac
9283                 case "$dflt" in
9284                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9285                         dflt=.`sh -c domainname 2>/dev/null`
9286                         case "$dflt" in
9287                         '') dflt='.';;
9288                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9289                         esac
9290                         ;;
9291                 esac
9292                 case "$dflt$osname" in
9293                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9294                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9295                         ;;
9296                 esac
9297                 case "$dflt" in
9298                 .) echo "(Lost all hope -- silly guess then)"
9299                         dflt='.nonet'
9300                         ;;
9301                 esac
9302                 $rm -f hosts
9303                 ;;
9304         *) dflt="$mydomain";;
9305         esac;;
9306 esac
9307 echo " "
9308 rp="What is your domain name?"
9309 . ./myread
9310 tans="$ans"
9311 case "$ans" in
9312 '') ;;
9313 .*) ;;
9314 *) tans=".$tans";;
9315 esac
9316 mydomain="$tans"
9317
9318 : translate upper to lower if necessary
9319 case "$mydomain" in
9320 *[A-Z]*)
9321         echo "(Normalizing case in your domain name)"
9322         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9323         ;;
9324 esac
9325
9326 : a little sanity check here
9327 case "$phostname" in
9328 '') ;;
9329 *)
9330         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9331         $myhostname$mydomain|$myhostname) ;;
9332         *)
9333                 case "$phostname" in
9334                 sed*)
9335                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9336                         ;;
9337                 *)
9338                         echo "(That doesn't agree with your $phostname command, by the way.)"
9339                         ;;
9340                 esac
9341         ;;
9342         esac
9343         ;;
9344 esac
9345
9346 : determine the e-mail address of the user who is running us
9347 $cat <<EOM
9348
9349 I need to get your e-mail address in Internet format if possible, i.e.
9350 something like user@host.domain. Please answer accurately since I have
9351 no easy means to double check it. The default value provided below
9352 is most probably close to reality but may not be valid from outside
9353 your organization...
9354
9355 EOM
9356 cont=x
9357 while test "$cont"; do
9358         case "$MAILDOMAIN" in
9359         '')
9360                 if $test -s /etc/mailname; then
9361                         maildomain=`$cat /etc/mailname`
9362                 else
9363                         maildomain="$myhostname$mydomain"
9364                 fi
9365                 ;;
9366         *)  maildomain="$MAILDOMAIN";;
9367         esac
9368         case "$cf_email" in
9369         '') dflt="$cf_by@$maildomain";;
9370         *)  dflt="$cf_email";;
9371         esac
9372         rp='What is your e-mail address?'
9373         . ./myread
9374         cf_email="$ans"
9375         case "$cf_email" in
9376         *@*.*) cont='' ;;
9377         *)
9378                 rp='Address does not look like an Internet one.  Use it anyway?'
9379                 case "$fastread" in
9380                 yes) dflt=y ;;
9381                 *) dflt=n ;;
9382                 esac
9383                 . ./myread
9384                 case "$ans" in
9385                 y*) cont='' ;;
9386                 *) echo " " ;;
9387                 esac
9388                 ;;
9389         esac
9390 done
9391
9392 : Ask e-mail of administrator
9393 $cat <<EOM
9394
9395 If you or somebody else will be maintaining perl at your site, please
9396 fill in the correct e-mail address here so that they may be contacted
9397 if necessary. Currently, the "perlbug" program included with perl
9398 will send mail to this address in addition to perlbug@perl.org. You may
9399 enter "none" for no administrator.
9400
9401 EOM
9402 case "$perladmin" in
9403 '') dflt="$cf_email";;
9404 *) dflt="$perladmin";;
9405 esac
9406 rp='Perl administrator e-mail address'
9407 . ./myread
9408 perladmin="$ans"
9409
9410 : determine whether to use a version number suffix for installed binaries
9411 echo " "
9412 $cat <<EOM
9413 Do you want to use a version number suffix for installed binaries? This
9414 will install 'perl$version' instead of 'perl', and likewise for other
9415 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9416 to be installed side-by-side. Unless you are a developer, you probably
9417 do *not* want to do this.
9418 EOM
9419 case "$versiononly" in
9420 "$define"|[Yy]*|true) dflt='y' ;;
9421 *) dflt='n';
9422 esac
9423 rp="Do you want to use a version number suffix for installed binaries?"
9424 . ./myread
9425 case "$ans" in
9426 [yY]*)  val="$define";;
9427 *)      val="$undef" ;;
9428 esac
9429 set versiononly
9430 eval $setvar
9431
9432 case "$versiononly" in
9433 "$define") inc_version_list=''
9434            inc_version_list_init=0
9435            ;;
9436 esac
9437
9438 : figure out how to guarantee perl startup
9439 : XXX Note that this currently takes advantage of the bug that binexp ignores
9440 :     the Configure -Dinstallprefix setting, which in turn means that under
9441 :     relocatable @INC, initialinstalllocation is what binexp started as.
9442 case "$startperl" in
9443 '')
9444         case "$sharpbang" in
9445         *!)
9446                 $cat <<EOH
9447
9448 I can use the #! construct to start perl on your system. This will
9449 make startup of perl scripts faster, but may cause problems if you
9450 want to share those scripts and perl is not in a standard place
9451 ($initialinstalllocation/perl) on all your platforms. The alternative
9452 is to force a shell by starting the script with a single ':' character.
9453
9454 EOH
9455                 case "$versiononly" in
9456                 "$define")      dflt="$initialinstalllocation/perl$version";;
9457                 *)              dflt="$initialinstalllocation/perl";;
9458                 esac
9459                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9460                 . ./myread
9461                 case "$ans" in
9462                 none)   startperl=": # use perl";;
9463                 *)      startperl="#!$ans"
9464                         if $test 30 -lt `echo "$ans" | wc -c`; then
9465                                 $cat >&4 <<EOM
9466
9467 WARNING:  Some systems limit the #! command to 32 characters.
9468 If you experience difficulty running Perl scripts with #!, try
9469 installing Perl in a directory with a shorter pathname.
9470
9471 EOM
9472                         fi ;;
9473                 esac
9474                 ;;
9475         *) startperl=": # use perl"
9476                 ;;
9477         esac
9478         ;;
9479 esac
9480 echo "I'll use $startperl to start perl scripts."
9481
9482 : figure best path for perl in scripts
9483 case "$perlpath" in
9484 '')
9485         case "$versiononly" in
9486         "$define")      perlpath="$initialinstalllocation/perl$version";;
9487         *)              perlpath="$initialinstalllocation/perl";;
9488         esac
9489         case "$startperl" in
9490         *!*) ;;
9491         *)
9492                 $cat <<EOH
9493
9494 I will use the "eval 'exec'" idiom to start Perl on your system.
9495 I can use the full path of your Perl binary for this purpose, but
9496 doing so may cause problems if you want to share those scripts and
9497 Perl is not always in a standard place ($initialinstalllocation/perl).
9498
9499 EOH
9500                 dflt="$initialinstalllocation/perl"
9501                 rp="What path shall I use in \"eval 'exec'\"?"
9502                 . ./myread
9503                 perlpath="$ans"
9504                 ;;
9505         esac
9506         ;;
9507 esac
9508 case "$startperl" in
9509 *!*)    ;;
9510 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9511 esac
9512
9513 : determine where public executable scripts go
9514 set scriptdir scriptdir
9515 eval $prefixit
9516 case "$scriptdir" in
9517 '')
9518         dflt="$bin"
9519         : guess some guesses
9520         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9521         $test -d /usr/share/bin     && dflt=/usr/share/bin
9522         $test -d /usr/local/script  && dflt=/usr/local/script
9523         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9524         $test -d $prefixexp/script  && dflt=$prefixexp/script
9525         set dflt
9526         eval $prefixup
9527         ;;
9528 *)  dflt="$scriptdir"
9529         ;;
9530 esac
9531 $cat <<EOM
9532
9533 Some installations have a separate directory just for executable scripts so
9534 that they can mount it across multiple architectures but keep the scripts in
9535 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9536 Or you might just lump your scripts in with all your other executables.
9537
9538 EOM
9539 fn=d~
9540 rp='Where do you keep publicly executable scripts?'
9541 . ./getfile
9542 if $test "X$ansexp" != "X$scriptdirexp"; then
9543         installscript=''
9544 fi
9545 installscriptdir=''
9546 prefixvar=scriptdir
9547 . ./setprefixvar
9548 : A little fix up for an irregularly named variable.
9549 installscript="$installscriptdir"
9550
9551 : determine where add-on public executables go
9552 case "$sitebin" in
9553 '')     dflt=$siteprefix/bin ;;
9554 *)      dflt=$sitebin ;;
9555 esac
9556 fn=d~
9557 rp='Pathname where the add-on public executables should be installed?'
9558 . ./getfile
9559 prefixvar=sitebin
9560 . ./setprefixvar
9561
9562 : determine where add-on html pages go
9563 : There is no standard location, so try to copy the previously-selected
9564 : directory structure for the core html pages.
9565 case "$sitehtml1dir" in
9566 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9567 *)     dflt=$sitehtml1dir ;;
9568 esac
9569 case "$dflt" in
9570 ''|' ') dflt=none ;;
9571 esac
9572 fn=dn+~
9573 rp='Pathname where the site-specific html pages should be installed?'
9574 . ./getfile
9575 prefixvar=sitehtml1dir
9576 . ./setprefixvar
9577
9578 : determine where add-on library html pages go
9579 : There is no standard location, so try to copy the previously-selected
9580 : directory structure for the core html pages.
9581 case "$sitehtml3dir" in
9582 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9583 *)     dflt=$sitehtml3dir ;;
9584 esac
9585 case "$dflt" in
9586 ''|' ') dflt=none ;;
9587 esac
9588 fn=dn+~
9589 rp='Pathname where the site-specific library html pages should be installed?'
9590 . ./getfile
9591 prefixvar=sitehtml3dir
9592 . ./setprefixvar
9593
9594 : determine where add-on manual pages go
9595 case "$siteman1dir" in
9596 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9597 *)      dflt=$siteman1dir ;;
9598 esac
9599 case "$dflt" in
9600 ''|' ') dflt=none ;;
9601 esac
9602 fn=dn+~
9603 rp='Pathname where the site-specific manual pages should be installed?'
9604 . ./getfile
9605 prefixvar=siteman1dir
9606 . ./setprefixvar
9607
9608 : determine where add-on library man pages go
9609 case "$siteman3dir" in
9610 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9611 *)      dflt=$siteman3dir ;;
9612 esac
9613 case "$dflt" in
9614 ''|' ') dflt=none ;;
9615 esac
9616 fn=dn+~
9617 rp='Pathname where the site-specific library manual pages should be installed?'
9618 . ./getfile
9619 prefixvar=siteman3dir
9620 . ./setprefixvar
9621
9622 : determine where add-on public executable scripts go
9623 case "$sitescript" in
9624 '')     dflt=$siteprefix/script
9625         $test -d $dflt || dflt=$sitebin ;;
9626 *)  dflt="$sitescript" ;;
9627 esac
9628 fn=d~+
9629 rp='Pathname where add-on public executable scripts should be installed?'
9630 . ./getfile
9631 prefixvar=sitescript
9632 . ./setprefixvar
9633
9634 : see if backtrace exists
9635 set backtrace d_backtrace
9636 eval $inlibc
9637
9638 : add flags if using c backtrace
9639 case "$usecbacktrace" in
9640   "") usecbacktrace=$undef ;;
9641   [yY]*|true|$define)
9642     case "$d_backtrace" in
9643       [yY]*|true|$define)
9644         case " $ccflags " in
9645           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9646           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9647           esac
9648         ;;
9649       *)
9650         echo "This system does not support backtrace" >&4
9651         usecbacktrace=$undef
9652         ;;
9653       esac
9654     ;;
9655   esac
9656
9657 : Check if faststdio is requested and available
9658 case "$usefaststdio" in
9659 $define|true|[yY]*|'')
9660         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9661         case "$xversion" in
9662         [68])   dflt='y' ;;
9663         *)      dflt='n' ;;
9664         esac
9665         ;;
9666 *) dflt='n';;
9667 esac
9668 cat <<EOM
9669
9670 Perl can be built to use 'fast stdio', which means using the stdio
9671 library but also directly manipulating the stdio buffers to enable
9672 faster I/O.  Using stdio is better for backward compatibility (especially
9673 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9674 interface has been preferred instead of stdio.
9675
9676 If this doesn't make any sense to you, just accept the default '$dflt'.
9677 EOM
9678 rp='Use the "fast stdio" if available?'
9679 . ./myread
9680 case "$ans" in
9681 y|Y)    val="$define" ;;
9682 *)      val="$undef" ;;
9683 esac
9684 set usefaststdio
9685 eval $setvar
9686
9687
9688 : define an is-a-typedef? function
9689 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9690 case "$inclist" in
9691 "") inclist="sys/types.h";;
9692 esac;
9693 eval "varval=\$$var";
9694 case "$varval" in
9695 "")
9696         $rm -f temp.c;
9697         for inc in $inclist; do
9698                 echo "#include <$inc>" >>temp.c;
9699         done;
9700         echo "#ifdef $type" >> temp.c;
9701         echo "printf(\"We have $type\");" >> temp.c;
9702         echo "#endif" >> temp.c;
9703         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9704         if $contains $type temp.E >/dev/null 2>&1; then
9705                 eval "$var=\$type";
9706         else
9707                 eval "$var=\$def";
9708         fi;
9709         $rm -f temp.?;;
9710 *) eval "$var=\$varval";;
9711 esac'
9712
9713 : define an is-a-typedef? function that prompts if the type is not available.
9714 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9715 case "$inclist" in
9716 "") inclist="sys/types.h";;
9717 esac;
9718 eval "varval=\$$var";
9719 case "$varval" in
9720 "")
9721         $rm -f temp.c;
9722         for inc in $inclist; do
9723                 echo "#include <$inc>" >>temp.c;
9724         done;
9725         echo "#ifdef $type" >> temp.c;
9726         echo "printf(\"We have $type\");" >> temp.c;
9727         echo "#endif" >> temp.c;
9728         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9729         echo " " ;
9730         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9731         if $contains $type temp.E >/dev/null 2>&1; then
9732                 echo "$type found." >&4;
9733                 eval "$var=\$type";
9734         else
9735                 echo "$type NOT found." >&4;
9736                 dflt="$def";
9737                 . ./myread ;
9738                 eval "$var=\$ans";
9739         fi;
9740         $rm -f temp.?;;
9741 *) eval "$var=\$varval";;
9742 esac'
9743
9744 : see what type lseek is declared as in the kernel
9745 rp="What is the type used for lseek's offset on this system?"
9746 set off_t lseektype long stdio.h sys/types.h
9747 eval $typedef_ask
9748
9749 echo " "
9750 echo "Checking to see how big your file offsets are..." >&4
9751 $cat >try.c <<EOCP
9752 #include <sys/types.h>
9753 #include <stdio.h>
9754 int main()
9755 {
9756     printf("%d\n", (int)sizeof($lseektype));
9757     return(0);
9758 }
9759 EOCP
9760 set try
9761 if eval $compile_ok; then
9762         lseeksize=`$run ./try`
9763         echo "Your file offsets are $lseeksize bytes long."
9764 else
9765         dflt=$longsize
9766         echo " "
9767         echo "(I can't seem to compile the test program.  Guessing...)"
9768         rp="What is the size of your file offsets (in bytes)?"
9769         . ./myread
9770         lseeksize="$ans"
9771 fi
9772 $rm_try
9773
9774 : see what type file positions are declared as in the library
9775 rp="What is the type for file position used by fsetpos()?"
9776 set fpos_t fpostype long stdio.h sys/types.h
9777 eval $typedef_ask
9778
9779 : Check size for Fpos_t
9780 echo " "
9781 case "$fpostype" in
9782 *_t) zzz="$fpostype"    ;;
9783 *)   zzz="fpos_t"       ;;
9784 esac
9785 echo "Checking the size of $zzz..." >&4
9786 cat > try.c <<EOCP
9787 #include <sys/types.h>
9788 #include <stdio.h>
9789 #$i_stdlib I_STDLIB
9790 #ifdef I_STDLIB
9791 #include <stdlib.h>
9792 #endif
9793 int main() {
9794     printf("%d\n", (int)sizeof($fpostype));
9795     exit(0);
9796 }
9797 EOCP
9798 set try
9799 if eval $compile_ok; then
9800         yyy=`$run ./try`
9801         case "$yyy" in
9802         '')     fpossize=4
9803                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9804                 ;;
9805         *)      fpossize=$yyy
9806                 echo "Your $zzz is $fpossize bytes long."
9807                 ;;
9808         esac
9809 else
9810         dflt="$longsize"
9811         echo " " >&4
9812         echo "(I can't compile the test program.  Guessing...)" >&4
9813         rp="What is the size of your file positions (in bytes)?"
9814         . ./myread
9815         fpossize="$ans"
9816 fi
9817
9818 : Check for large file support
9819 # Backward compatibility (uselfs is deprecated).
9820 case "$uselfs" in
9821 "$define"|true|[yY]*)
9822         cat <<EOM >&4
9823
9824 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9825 EOM
9826         uselargefiles="$define"
9827         ;;
9828 esac
9829
9830 case "$lseeksize:$fpossize" in
9831 8:8) cat <<EOM
9832
9833 You can have files larger than 2 gigabytes.
9834 EOM
9835    val="$define" ;;
9836 *)    case "$uselargefiles" in
9837    "$undef"|false|[nN]*) dflt='n' ;;
9838    *)   dflt='y' ;;
9839    esac
9840    cat <<EOM
9841
9842 Perl can be built to understand large files (files larger than 2 gigabytes)
9843 on some systems.  To do so, Configure can be run with -Duselargefiles.
9844
9845 If this doesn't make any sense to you, just accept the default '$dflt'.
9846 EOM
9847    rp='Try to understand large files, if available?'
9848    . ./myread
9849    case "$ans" in
9850    y|Y)         val="$define" ;;
9851    *)           val="$undef"  ;;
9852    esac
9853    ;;
9854 esac
9855 set uselargefiles
9856 eval $setvar
9857 : Look for a hint-file generated 'call-back-unit'.  If the
9858 : user has specified that a large files perl is to be built,
9859 : we may need to set or change some other defaults.
9860 if $test -f uselargefiles.cbu; then
9861         echo "Your platform has some specific hints regarding large file builds, using them..."
9862         . ./uselargefiles.cbu
9863 fi
9864 case "$uselargefiles" in
9865 "$define")
9866         if $test -f uselargefiles.cbu; then
9867                 echo " "
9868                 echo "Rechecking to see how big your file offsets are..." >&4
9869                 $cat >try.c <<EOCP
9870 #include <sys/types.h>
9871 #include <stdio.h>
9872 int main()
9873 {
9874     printf("%d\n", (int)sizeof($lseektype));
9875     return(0);
9876 }
9877 EOCP
9878                 set try
9879                 if eval $compile_ok; then
9880                         lseeksize=`$run ./try`
9881                         $echo "Your file offsets are now $lseeksize bytes long."
9882                 else
9883                         dflt="$lseeksize"
9884                         echo " "
9885                         echo "(I can't seem to compile the test program.  Guessing...)"
9886                         rp="What is the size of your file offsets (in bytes)?"
9887                         . ./myread
9888                         lseeksize="$ans"
9889                 fi
9890                 case "$fpostype" in
9891                 *_t) zzz="$fpostype"    ;;
9892                 *)   zzz="fpos_t"       ;;
9893                 esac
9894                 $echo $n "Rechecking the size of $zzz...$c" >&4
9895                 $cat > try.c <<EOCP
9896 #include <sys/types.h>
9897 #include <stdio.h>
9898 #$i_stdlib I_STDLIB
9899 #ifdef I_STDLIB
9900 #include <stdlib.h>
9901 #endif
9902 int main() {
9903     printf("%d\n", (int)sizeof($fpostype));
9904     return(0);
9905 }
9906 EOCP
9907                 set try
9908                 if eval $compile_ok; then
9909                         yyy=`$run ./try`
9910                         dflt="$lseeksize"
9911                         case "$yyy" in
9912                         '')     echo " "
9913                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9914                                 ;;
9915                         *)      fpossize=$yyy
9916                                 echo " $fpossize bytes." >&4
9917                                 ;;
9918                         esac
9919                 else
9920                         dflt="$fpossize"
9921                         echo " "
9922                         echo "(I can't compile the test program.  Guessing...)" >&4
9923                         rp="What is the size of your file positions (in bytes)?"
9924                         . ./myread
9925                         fpossize="$ans"
9926                 fi
9927                 $rm_try
9928         fi
9929         ;;
9930 esac
9931
9932 : Check if we want perlio
9933 useperlio="$define"
9934
9935 : Set the vendorbin variables
9936 case "$vendorprefix" in
9937 '')     d_vendorbin="$undef"
9938         vendorbin=''
9939         vendorbinexp=''
9940         ;;
9941 *)      d_vendorbin="$define"
9942         : determine where vendor-supplied executables go.
9943         case "$vendorbin" in
9944         '') dflt=$vendorprefix/bin ;;
9945         *)      dflt="$vendorbin" ;;
9946         esac
9947         fn=d~+
9948         rp='Pathname for the vendor-supplied executables directory?'
9949         . ./getfile
9950         vendorbin="$ans"
9951         vendorbinexp="$ansexp"
9952         ;;
9953 esac
9954 prefixvar=vendorbin
9955 . ./installprefix
9956
9957 : Set the vendorhtml1dir variables
9958 case "$vendorprefix" in
9959 '')     vendorhtml1dir=''
9960         vendorhtml1direxp=''
9961         ;;
9962 *)      : determine where vendor-supplied html pages go.
9963         : There is no standard location, so try to copy the previously-selected
9964         : directory structure for the core html pages.
9965         : XXX Better default suggestions would be welcome.
9966         case "$vendorhtml1dir" in
9967         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9968         *)      dflt=$vendorhtml1dir ;;
9969         esac
9970         case "$dflt" in
9971         ''|' ') dflt=none ;;
9972         esac
9973         fn=dn+~
9974         rp='Pathname for the vendor-supplied html pages?'
9975         . ./getfile
9976         vendorhtml1dir="$ans"
9977         vendorhtml1direxp="$ansexp"
9978         ;;
9979 esac
9980 : Use ' ' for none so value is preserved next time through Configure
9981 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9982 prefixvar=vendorhtml1dir
9983 . ./installprefix
9984
9985 : Set the vendorhtml3dir variables
9986 case "$vendorprefix" in
9987 '')     vendorhtml3dir=''
9988         vendorhtml3direxp=''
9989         ;;
9990 *)      : determine where vendor-supplied module html pages go.
9991         : There is no standard location, so try to copy the previously-selected
9992         : directory structure for the core html pages.
9993         : XXX Better default suggestions would be welcome.
9994         case "$vendorhtml3dir" in
9995         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9996         *)      dflt=$vendorhtml3dir ;;
9997         esac
9998         case "$dflt" in
9999         ''|' ') dflt=none ;;
10000         esac
10001         fn=dn+~
10002         rp='Pathname for the vendor-supplied html pages?'
10003         . ./getfile
10004         vendorhtml3dir="$ans"
10005         vendorhtml3direxp="$ansexp"
10006         ;;
10007 esac
10008 : Use ' ' for none so value is preserved next time through Configure
10009 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
10010 prefixvar=vendorhtml3dir
10011 . ./installprefix
10012
10013 : Set the vendorman1dir variables
10014 case "$vendorprefix" in
10015 '')     vendorman1dir=''
10016         vendorman1direxp=''
10017         ;;
10018 *)      : determine where vendor-supplied manual pages go.
10019         case "$vendorman1dir" in
10020         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10021         *)      dflt=$vendorman1dir ;;
10022         esac
10023         case "$dflt" in
10024         ''|' ') dflt=none ;;
10025         esac
10026         fn=nd~+
10027         rp='Pathname for the vendor-supplied manual section 1 pages?'
10028         . ./getfile
10029         vendorman1dir="$ans"
10030         vendorman1direxp="$ansexp"
10031         ;;
10032 esac
10033 : Use ' ' for none so value is preserved next time through Configure
10034 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10035 prefixvar=vendorman1dir
10036 . ./installprefix
10037
10038 : Set the vendorman3dir variables
10039 case "$vendorprefix" in
10040 '')     vendorman3dir=''
10041         vendorman3direxp=''
10042         ;;
10043 *)      : determine where vendor-supplied module manual pages go.
10044         case "$vendorman3dir" in
10045         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10046         *)      dflt=$vendorman3dir ;;
10047         esac
10048         case "$dflt" in
10049         ''|' ') dflt=none ;;
10050         esac
10051         fn=nd~+
10052         rp='Pathname for the vendor-supplied manual section 3 pages?'
10053         . ./getfile
10054         vendorman3dir="$ans"
10055         vendorman3direxp="$ansexp"
10056         ;;
10057 esac
10058 : Use ' ' for none so value is preserved next time through Configure
10059 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10060 prefixvar=vendorman3dir
10061 . ./installprefix
10062
10063 : Set the vendorscript variables
10064 case "$vendorprefix" in
10065 '')     d_vendorscript="$undef"
10066         vendorscript=''
10067         vendorscriptexp=''
10068         ;;
10069 *)      d_vendorscript="$define"
10070         : determine where vendor-supplied scripts go.
10071         case "$vendorscript" in
10072         '')     dflt=$vendorprefix/script
10073                 $test -d $dflt || dflt=$vendorbin ;;
10074         *)  dflt="$vendorscript" ;;
10075         esac
10076         $cat <<EOM
10077
10078 The installation process will create a directory for
10079 vendor-supplied scripts.
10080
10081 EOM
10082         fn=d~+
10083         rp='Pathname for the vendor-supplied scripts directory?'
10084         . ./getfile
10085         vendorscript="$ans"
10086         vendorscriptexp="$ansexp"
10087         ;;
10088 esac
10089 prefixvar=vendorscript
10090 . ./installprefix
10091
10092 : script used to emit important warnings
10093 cat >warn <<EOS
10094 $startsh
10095 if test \$# -gt 0; then
10096         echo "\$@" >msg
10097 else
10098         cat >msg
10099 fi
10100 echo "*** WARNING:" >&4
10101 sed -e 's/^/*** /' <msg >&4
10102 echo "*** " >&4
10103 cat msg >>config.msg
10104 echo " " >>config.msg
10105 rm -f msg
10106 EOS
10107 chmod +x warn
10108 $eunicefix warn
10109
10110 : see which of string.h or strings.h is needed
10111 echo " "
10112 strings=`./findhdr string.h`
10113 if $test "$strings" && $test -r "$strings"; then
10114         echo "Using <string.h> instead of <strings.h>." >&4
10115         val="$define"
10116 else
10117         val="$undef"
10118         strings=`./findhdr strings.h`
10119         if $test "$strings" && $test -r "$strings"; then
10120                 echo "Using <strings.h> instead of <string.h>." >&4
10121         else
10122                 ./warn "No string header found -- You'll surely have problems."
10123         fi
10124 fi
10125 set i_string
10126 eval $setvar
10127 case "$i_string" in
10128 "$undef") strings=`./findhdr strings.h`;;
10129 *)        strings=`./findhdr string.h`;;
10130 esac
10131
10132 : see if qgcvt exists
10133 set qgcvt d_qgcvt
10134 eval $inlibc
10135
10136 : Check what kind of doubles your system has
10137 $echo "Checking the kind of doubles you have..." >&4
10138 $cat >try.c <<EOP
10139 #$i_stdlib I_STDLIB
10140 #define DOUBLESIZE $doublesize
10141 #ifdef I_STDLIB
10142 #include <stdlib.h>
10143 #endif
10144 #include <stdio.h>
10145 static const double d = -0.1;
10146 int main() {
10147   unsigned const char* b = (unsigned const char*)(&d);
10148 #if DOUBLESIZE == 4
10149   if (b[0] == 0xCD && b[3] == 0xBD) {
10150     /* IEEE 754 32-bit little-endian */
10151     printf("1\n");
10152     exit(0);
10153   }
10154   if (b[0] == 0xBD && b[3] == 0xCD) {
10155     /* IEEE 754 32-bit big-endian */
10156     printf("2\n");
10157     exit(0);
10158   }
10159   if (b[0] == 0xCC && b[3] == 0xCC) {
10160     /* VAX format F, 32-bit PDP-style mixed endian. */
10161     printf("9\n");
10162     exit(0);
10163   }
10164 #endif
10165 #if DOUBLESIZE == 8
10166   if (b[0] == 0x9A && b[7] == 0xBF) {
10167     /* IEEE 754 64-bit little-endian */
10168     printf("3\n");
10169     exit(0);
10170   }
10171   if (b[0] == 0xBF && b[7] == 0x9A) {
10172     /* IEEE 754 64-bit big-endian */
10173     printf("4\n");
10174     exit(0);
10175   }
10176   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10177    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10178     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10179     * 99 99 b9 bf 9a 99 99 99 */
10180     printf("7\n");
10181     exit(0);
10182   }
10183   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10184    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10185     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10186     * 99 99 99 9a bf b9 99 99 */
10187     printf("8\n");
10188     exit(0);
10189   }
10190   if (b[0] == 0xCC && b[7] == 0xCC) {
10191    /* VAX format D, 64-bit PDP-style mixed endian. */
10192     printf("10\n");
10193     exit(0);
10194   }
10195   if (b[0] == 0xD9 && b[7] == 0x99) {
10196    /* VAX format G, 64-bit PDP-style mixed endian. */
10197     printf("11\n");
10198     exit(0);
10199   }
10200 #endif
10201 #if DOUBLESIZE == 16
10202   if (b[0] == 0x9A && b[15] == 0xBF) {
10203     /* IEEE 754 128-bit little-endian */
10204     printf("5\n");
10205     exit(0);
10206   }
10207   if (b[0] == 0xBF && b[15] == 0x9A) {
10208     /* IEEE 754 128-bit big-endian */
10209     printf("6\n");
10210     exit(0);
10211   }
10212 #endif
10213   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10214    * Whether those environments can still build Perl is debatable. */
10215   printf("-1\n"); /* unknown */
10216   exit(0);
10217 }
10218 EOP
10219 set try
10220 if eval $compile; then
10221     doublekind=`$run ./try`
10222 else
10223     doublekind=-1
10224 fi
10225 case "$doublekind" in
10226 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10227 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10228 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10229 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10230 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10231 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10232 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10233 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10234 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10235 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10236 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10237 *) echo "Cannot figure out your double.  You CRAY, or something?" >&4 ;;
10238 esac
10239 $rm_try
10240
10241 : Check print/scan long double stuff
10242 echo " "
10243
10244 if $test X"$d_longdbl" = X"$define"; then
10245
10246 echo "Checking how to print long doubles..." >&4
10247
10248 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10249         $cat >try.c <<'EOCP'
10250 #include <sys/types.h>
10251 #include <stdio.h>
10252 int main() {
10253   double d = 123.456;
10254   printf("%.3f\n", d);
10255 }
10256 EOCP
10257         set try
10258         if eval $compile; then
10259                 yyy=`$run ./try`
10260                 case "$yyy" in
10261                 123.456)
10262                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10263                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10264                         echo "We will use %f."
10265                         ;;
10266                 esac
10267         fi
10268 fi
10269
10270 if $test X"$sPRIfldbl" = X; then
10271         $cat >try.c <<'EOCP'
10272 #include <sys/types.h>
10273 #include <stdio.h>
10274 int main() {
10275   long double d = 123.456;
10276   printf("%.3Lf\n", d);
10277 }
10278 EOCP
10279         set try
10280         if eval $compile; then
10281                 yyy=`$run ./try`
10282                 case "$yyy" in
10283                 123.456)
10284                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10285                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10286                         echo "We will use %Lf."
10287                         ;;
10288                 esac
10289         fi
10290 fi
10291
10292 if $test X"$sPRIfldbl" = X; then
10293         $cat >try.c <<'EOCP'
10294 #include <sys/types.h>
10295 #include <stdio.h>
10296 int main() {
10297   long double d = 123.456;
10298   printf("%.3llf\n", d);
10299 }
10300 EOCP
10301         set try
10302         if eval $compile; then
10303                 yyy=`$run ./try`
10304                 case "$yyy" in
10305                 123.456)
10306                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10307                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10308                         echo "We will use %llf."
10309                         ;;
10310                 esac
10311         fi
10312 fi
10313
10314 if $test X"$sPRIfldbl" = X; then
10315         $cat >try.c <<'EOCP'
10316 #include <sys/types.h>
10317 #include <stdio.h>
10318 int main() {
10319   long double d = 123.456;
10320   printf("%.3lf\n", d);
10321 }
10322 EOCP
10323         set try
10324         if eval $compile; then
10325                 yyy=`$run ./try`
10326                 case "$yyy" in
10327                 123.456)
10328                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10329                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10330                         echo "We will use %lf."
10331                         ;;
10332                 esac
10333         fi
10334 fi
10335
10336 if $test X"$sPRIfldbl" = X; then
10337         echo "Cannot figure out how to print long doubles." >&4
10338 else
10339         sSCNfldbl=$sPRIfldbl    # expect consistency
10340 fi
10341
10342 $rm_try
10343
10344 fi # d_longdbl
10345
10346 case "$sPRIfldbl" in
10347 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10348         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10349         d_SCNfldbl="$undef";
10350         ;;
10351 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10352         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10353         d_SCNfldbl="$define";
10354         ;;
10355 esac
10356
10357 : Before committing on uselongdouble, see whether that looks sane.
10358 if $test "$uselongdouble" = "$define"; then
10359     message=""
10360     echo " "
10361     echo "Checking if your long double math functions work right..." >&4
10362     $cat > try.c <<EOF
10363 #include <math.h>
10364 #include <stdio.h>
10365 int main() {
10366   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10367 }
10368 EOF
10369     case "$osname:$gccversion" in
10370     aix:)       saveccflags="$ccflags"
10371                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10372     esac
10373     set try
10374     if eval $compile_ok; then
10375       yyy=`$run ./try`
10376     fi
10377     case "$yyy" in
10378     3) echo "Your long double math functions are working correctly." >&4 ;;
10379     *) echo "Your long double math functions are broken, not using long doubles." >&4
10380        uselongdouble=$undef
10381        ;;
10382     esac
10383     $rm_try
10384     case "$osname:$gccversion" in
10385     aix:)       ccflags="$saveccflags" ;; # restore
10386     esac
10387 fi
10388
10389 : Check how to convert floats to strings.
10390
10391 if test "X$d_Gconvert" = X; then
10392
10393 echo " "
10394 echo "Checking for an efficient way to convert floats to strings."
10395 echo " " > try.c
10396 case "$uselongdouble" in
10397 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10398 esac
10399 case "$d_longdbl" in
10400 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10401 esac
10402 case "$d_PRIgldbl" in
10403 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10404 esac
10405 $cat >>try.c <<EOP
10406 #ifdef TRY_gconvert
10407 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10408 char *myname = "gconvert";
10409 #endif
10410 #ifdef TRY_gcvt
10411 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10412 char *myname = "gcvt";
10413 #endif
10414 #ifdef TRY_qgcvt
10415 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10416 char *myname = "qgcvt";
10417 #define DOUBLETYPE long double
10418 #endif
10419 #ifdef TRY_sprintf
10420 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10421 #ifdef HAS_PRIgldbl
10422 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10423 #else
10424 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10425 #endif
10426 #else
10427 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10428 #endif
10429 char *myname = "sprintf";
10430 #endif
10431
10432 #ifndef DOUBLETYPE
10433 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10434 #define DOUBLETYPE long double
10435 #else
10436 #define DOUBLETYPE double
10437 #endif
10438 #endif
10439
10440 #include <stdio.h>
10441
10442 #$i_stdlib I_STDLIB
10443 #ifdef I_STDLIB
10444 #include <stdlib.h>
10445 #endif
10446 #$i_string I_STRING
10447 #ifdef I_STRING
10448 #  include <string.h>
10449 #else
10450 #  include <strings.h>
10451 #endif
10452
10453 int checkit(char *expect, char *got)
10454 {
10455     if (strcmp(expect, got)) {
10456                 printf("%s oddity:  Expected %s, got %s\n",
10457                         myname, expect, got);
10458                 exit(1);
10459         }
10460 }
10461
10462 int main()
10463 {
10464         char buf[64];
10465         buf[63] = '\0';
10466
10467         /* This must be 1st test on (which?) platform */
10468         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10469         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10470         checkit("0.1", buf);
10471
10472         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10473         checkit("0.01", buf);
10474
10475         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10476         checkit("0.001", buf);
10477
10478         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10479         checkit("0.0001", buf);
10480
10481         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10482         if (strlen(buf) > 5)
10483             checkit("9e-005", buf); /* for Microsoft ?? */
10484         else
10485             checkit("9e-05", buf);
10486
10487         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10488         checkit("1", buf);
10489
10490         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10491         checkit("1.1", buf);
10492
10493         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10494         checkit("1.01", buf);
10495
10496         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10497         checkit("1.001", buf);
10498
10499         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10500         checkit("1.0001", buf);
10501
10502         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10503         checkit("1.00001", buf);
10504
10505         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10506         checkit("1.000001", buf);
10507
10508         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10509         checkit("0", buf);
10510
10511         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10512         checkit("-1", buf);
10513
10514         /* Some Linux gcvt's give 1.e+5 here. */
10515         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10516         checkit("100000", buf);
10517
10518         /* Some Linux gcvt's give -1.e+5 here. */
10519         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10520         checkit("-100000", buf);
10521
10522         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10523         checkit("123.456", buf);
10524
10525         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10526         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10527         /* 34 should be enough to scare even long double
10528          * places into using the e notation. */
10529         if (strlen(buf) > 5)
10530             checkit("1e+034", buf); /* for Microsoft */
10531         else
10532             checkit("1e+34", buf);
10533
10534         /* For Perl, if you add additional tests here, also add them to
10535          * t/base/num.t for benefit of platforms not using Configure or
10536          * overriding d_Gconvert */
10537
10538         exit(0);
10539 }
10540 EOP
10541 : first add preferred functions to our list
10542 xxx_list=""
10543 for xxx_convert in $gconvert_preference; do
10544     case $xxx_convert in
10545     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10546     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10547     esac
10548 done
10549 : then add any others
10550 for xxx_convert in gconvert gcvt sprintf; do
10551     case "$xxx_list" in
10552     *$xxx_convert*) ;;
10553     *) xxx_list="$xxx_list $xxx_convert" ;;
10554     esac
10555 done
10556
10557 case "$d_longdbl$uselongdouble" in
10558 "$define$define")
10559     : again, add preferred functions to our list first
10560     xxx_ld_list=""
10561     for xxx_convert in $gconvert_ld_preference; do
10562         case $xxx_convert in
10563         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10564         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10565         esac
10566     done
10567     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10568     for xxx_convert in qgcvt sprintf $xxx_list; do
10569         case "$xxx_ld_list" in
10570         $xxx_convert*|*" $xxx_convert"*) ;;
10571         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10572         esac
10573     done
10574     : if sprintf cannot do long doubles, move it to the end
10575     if test "$d_PRIgldbl" != "$define"; then
10576         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10577     fi
10578     : if no qgcvt, remove it
10579     if test "$d_qgcvt" != "$define"; then
10580         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10581     fi
10582     : use the ld_list
10583     xxx_list="$xxx_ld_list"
10584     ;;
10585 esac
10586
10587 for xxx_convert in $xxx_list; do
10588         echo "Trying $xxx_convert..."
10589         $rm -f try try$_o core
10590         set try -DTRY_$xxx_convert
10591         if eval $compile; then
10592                 echo "$xxx_convert() found." >&4
10593                 if $run ./try; then
10594                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10595                         break;
10596                 else
10597                         echo "...But $xxx_convert didn't work as I expected."
10598                         xxx_convert=''
10599                 fi
10600         else
10601                 echo "$xxx_convert NOT found." >&4
10602         fi
10603 done
10604
10605 if test X$xxx_convert = X; then
10606     echo "*** WHOA THERE!!! ***" >&4
10607     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10608     xxx_convert=sprintf
10609 fi
10610
10611 case "$xxx_convert" in
10612 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10613 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10614 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10615 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10616    "$define$define$define")
10617       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10618    "$define$define$undef")
10619       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10620    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10621    esac
10622    ;;
10623 esac
10624
10625 fi
10626 $rm_try
10627
10628 : see if _fwalk exists
10629 set fwalk d__fwalk
10630 eval $inlibc
10631
10632 : Initialize h_fcntl
10633 h_fcntl=false
10634
10635 : Initialize h_sysfile
10636 h_sysfile=false
10637
10638 : access call always available on UNIX
10639 set access d_access
10640 eval $inlibc
10641
10642 : locate the flags for 'access()'
10643 case "$d_access" in
10644 "$define")
10645         echo " "
10646         $cat >access.c <<EOCP
10647 #include <sys/types.h>
10648 #ifdef I_FCNTL
10649 #include <fcntl.h>
10650 #endif
10651 #ifdef I_SYS_FILE
10652 #include <sys/file.h>
10653 #endif
10654 #ifdef I_UNISTD
10655 #include <unistd.h>
10656 #endif
10657 #$i_stdlib I_STDLIB
10658 #ifdef I_STDLIB
10659 #include <stdlib.h>
10660 #endif
10661 int main() {
10662         exit(R_OK);
10663 }
10664 EOCP
10665         : check sys/file.h first, no particular reason here
10666         if $test `./findhdr sys/file.h` && \
10667                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10668                 h_sysfile=true;
10669                 echo "<sys/file.h> defines the *_OK access constants." >&4
10670         elif $test `./findhdr fcntl.h` && \
10671                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10672                 h_fcntl=true;
10673                 echo "<fcntl.h> defines the *_OK access constants." >&4
10674         elif $test `./findhdr unistd.h` && \
10675                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10676                 echo "<unistd.h> defines the *_OK access constants." >&4
10677         else
10678                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10679         fi
10680         ;;
10681 esac
10682 $rm -f access*
10683
10684 : see if accessx exists
10685 set accessx d_accessx
10686 eval $inlibc
10687
10688 : see if acosh exists
10689 set acosh d_acosh
10690 eval $inlibc
10691
10692 : see if aintl exists
10693 set aintl d_aintl
10694 eval $inlibc
10695
10696 : see if alarm exists
10697 set alarm d_alarm
10698 eval $inlibc
10699
10700 : see if 64bit time functions exists
10701
10702 set ctime64 d_ctime64
10703 eval $inlibc
10704
10705 set localtime64 d_localtime64
10706 eval $inlibc
10707
10708 set gmtime64 d_gmtime64
10709 eval $inlibc
10710
10711 set mktime64 d_mktime64
10712 eval $inlibc
10713
10714 set difftime64 d_difftime64
10715 eval $inlibc
10716
10717 set asctime64 d_asctime64
10718 eval $inlibc
10719
10720 : see if POSIX threads are available
10721 set pthread.h i_pthread
10722 eval $inhdr
10723
10724 : define a function to check prototypes
10725 $cat > protochk <<EOSH
10726 $startsh
10727 cc="$cc"
10728 optimize="$optimize"
10729 ccflags="$ccflags"
10730 prototype="$prototype"
10731 define="$define"
10732 rm_try="$rm_try"
10733 usethreads=$usethreads
10734 i_pthread=$i_pthread
10735 pthread_h_first=$pthread_h_first
10736 EOSH
10737
10738 $cat >> protochk <<'EOSH'
10739
10740 $rm_try
10741 foo="$1"
10742 shift
10743 while test $# -ge 2; do
10744         case "$1" in
10745                 $define) echo "#include <$2>" >> try.c ;;
10746                 literal) echo "$2" >> try.c ;;
10747         esac
10748     # Extra magic for the benefit of systems that need pthread.h
10749     # to be included early to correctly detect threadsafe functions.
10750     # Such functions must guarantee themselves, though, that the usethreads
10751     # and i_pthread have been defined, before calling protochk.
10752     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10753         echo "#include <pthread.h>" >> try.c
10754         pthread_h_done=yes
10755     fi
10756     shift 2
10757 done
10758 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10759 cat >> try.c <<'EOCP'
10760 #ifdef CAN_PROTOTYPE
10761 #define _(args) args
10762 #else
10763 #define _(args) ()
10764 #endif
10765 EOCP
10766 echo "$foo" >> try.c
10767 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10768 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10769 status=$?
10770 $rm_try
10771 exit $status
10772 EOSH
10773 chmod +x protochk
10774 $eunicefix protochk
10775
10776 : Define hasproto macro for Configure internal use
10777 hasproto='varname=$1; func=$2; shift; shift;
10778 while $test $# -ge 2; do
10779         case "$1" in
10780         $define) echo "#include <$2>";;
10781         esac ;
10782     shift 2;
10783 done > try.c;
10784 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10785 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10786         echo "$func() prototype found.";
10787         val="$define";
10788 else
10789         echo "$func() prototype NOT found.";
10790         val="$undef";
10791 fi;
10792 set $varname;
10793 eval $setvar;
10794 $rm_try tryout.c'
10795
10796 : see if sys/types.h has to be included
10797 set sys/types.h i_systypes
10798 eval $inhdr
10799
10800 : see if sys/select.h has to be included
10801 set sys/select.h i_sysselct
10802 eval $inhdr
10803
10804 : Define hasfield macro for Configure internal use
10805 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10806 while $test $# -ge 2; do
10807         case "$1" in
10808         $define) echo "#include <$2>";;
10809         esac ;
10810     shift 2;
10811 done > try.c;
10812 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10813 set try;
10814 if eval $compile; then
10815         val="$define";
10816 else
10817         val="$undef";
10818 fi;
10819 set $varname;
10820 eval $setvar;
10821 $rm_try'
10822
10823 : see if we should include time.h, sys/time.h, or both
10824 echo " "
10825 if test "X$timeincl" = X; then
10826         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10827         $echo $n "I'm now running the test program...$c"
10828         $cat >try.c <<EOCP
10829 #include <sys/types.h>
10830 #ifdef I_TIME
10831 #include <time.h>
10832 #endif
10833 #ifdef I_SYSTIME
10834 #ifdef SYSTIMEKERNEL
10835 #define KERNEL
10836 #endif
10837 #include <sys/time.h>
10838 #endif
10839 #ifdef I_SYSSELECT
10840 #include <sys/select.h>
10841 #endif
10842 #$i_stdlib I_STDLIB
10843 #ifdef I_STDLIB
10844 #include <stdlib.h>
10845 #endif
10846 int main()
10847 {
10848         struct tm foo;
10849 #ifdef S_TIMEVAL
10850         struct timeval bar;
10851 #endif
10852 #ifdef S_TIMEZONE
10853         struct timezone tzp;
10854 #endif
10855         if (foo.tm_sec == foo.tm_sec)
10856                 exit(0);
10857 #ifdef S_TIMEVAL
10858         if (bar.tv_sec == bar.tv_sec)
10859                 exit(0);
10860 #endif
10861         exit(1);
10862 }
10863 EOCP
10864         flags=''
10865         for s_timezone in '-DS_TIMEZONE' ''; do
10866         sysselect=''
10867         for s_timeval in '-DS_TIMEVAL' ''; do
10868         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10869         for i_time in '' '-DI_TIME'; do
10870         for i_systime in '-DI_SYSTIME' ''; do
10871                 case "$flags" in
10872                 '') $echo $n ".$c"
10873                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10874                         if eval $compile; then
10875                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10876                                 shift
10877                                 flags="$*"
10878                                 echo " "
10879                                 $echo $n "Succeeded with $flags$c"
10880                         fi
10881                         ;;
10882                 esac
10883         done
10884         done
10885         done
10886         done
10887         done
10888         timeincl=''
10889         echo " "
10890         case "$flags" in
10891         *SYSTIMEKERNEL*) i_systimek="$define"
10892                 timeincl=`./findhdr sys/time.h`
10893                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10894         *) i_systimek="$undef";;
10895         esac
10896         case "$flags" in
10897         *I_TIME*) i_time="$define"
10898                 timeincl=`./findhdr time.h`" $timeincl"
10899                 echo "We'll include <time.h>." >&4;;
10900         *) i_time="$undef";;
10901         esac
10902         case "$flags" in
10903         *I_SYSTIME*) i_systime="$define"
10904                 timeincl=`./findhdr sys/time.h`" $timeincl"
10905                 echo "We'll include <sys/time.h>." >&4;;
10906         *) i_systime="$undef";;
10907         esac
10908         $rm_try
10909 fi
10910 : see if struct tm knows about tm_zone
10911 case "$i_systime$i_time" in
10912 *$define*)
10913         echo " "
10914         echo "Checking to see if your struct tm has tm_zone field..." >&4
10915         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10916         eval $hasfield
10917         ;;
10918 *)      val="$undef"
10919         set d_tm_tm_zone
10920         eval $setvar
10921         ;;
10922 esac
10923 case "$d_tm_tm_zone" in
10924 "$define")      echo "Yes, it does."   ;;
10925 *)              echo "No, it doesn't." ;;
10926 esac
10927 : see if struct tm knows about tm_gmtoff
10928 case "$i_systime$i_time" in
10929 *$define*)
10930         echo " "
10931         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10932         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10933         eval $hasfield
10934         ;;
10935 *)      val="$undef"
10936         set d_tm_tm_gmtoff
10937         eval $setvar
10938         ;;
10939 esac
10940 case "$d_tm_tm_gmtoff" in
10941 "$define")      echo "Yes, it does."   ;;
10942 *)              echo "No, it doesn't." ;;
10943 esac
10944
10945 : see if asctime_r exists
10946 set asctime_r d_asctime_r
10947 eval $inlibc
10948 case "$d_asctime_r" in
10949 "$define")
10950         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10951         case "$d_asctime_r_proto:$usethreads" in
10952         ":define")      d_asctime_r_proto=define
10953                 set d_asctime_r_proto asctime_r $hdrs
10954                 eval $hasproto ;;
10955         *)      ;;
10956         esac
10957         case "$d_asctime_r_proto" in
10958         define)
10959         case "$asctime_r_proto" in
10960         ''|0) try='char* asctime_r(const struct tm*, char*);'
10961         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10962         esac
10963         case "$asctime_r_proto" in
10964         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10965         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10966         esac
10967         case "$asctime_r_proto" in
10968         ''|0) try='int asctime_r(const struct tm*, char*);'
10969         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10970         esac
10971         case "$asctime_r_proto" in
10972         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10973         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10974         esac
10975         case "$asctime_r_proto" in
10976         ''|0)   d_asctime_r=undef
10977                 asctime_r_proto=0
10978                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10979         * )     case "$asctime_r_proto" in
10980                 REENTRANT_PROTO*) ;;
10981                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10982                 esac
10983                 echo "Prototype: $try" ;;
10984         esac
10985         ;;
10986         *)      case "$usethreads" in
10987                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10988                 esac
10989                 d_asctime_r=undef
10990                 asctime_r_proto=0
10991                 ;;
10992         esac
10993         ;;
10994 *)      asctime_r_proto=0
10995         ;;
10996 esac
10997
10998 : see if asinh exists
10999 set asinh d_asinh
11000 eval $inlibc
11001
11002 : see if atanh exists
11003 set atanh d_atanh
11004 eval $inlibc
11005
11006 : see if atolf exists
11007 set atolf d_atolf
11008 eval $inlibc
11009
11010 : see if atoll exists
11011 set atoll d_atoll
11012 eval $inlibc
11013
11014 : Look for GCC-style attribute format
11015 case "$d_attribute_format" in
11016 '')
11017 echo " "
11018 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11019 $cat >attrib.c <<'EOCP'
11020 #include <stdio.h>
11021 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11022 EOCP
11023 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11024         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11025                 echo "Your C compiler doesn't support __attribute__((format))."
11026                 val="$undef"
11027         else
11028                 echo "Your C compiler supports __attribute__((format))."
11029                 val="$define"
11030         fi
11031 else
11032         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11033         val="$undef"
11034 fi
11035 ;;
11036 *) val="$d_attribute_format" ;;
11037 esac
11038 set d_attribute_format
11039 eval $setvar
11040 $rm -f attrib*
11041
11042 : Look for GCC-style attribute format with null format allowed
11043 case "$d_printf_format_null" in
11044 '') case "$d_attribute_format" in
11045     $define)
11046         echo " "
11047         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11048 $cat >attrib.c <<EOCP
11049 #include <stdio.h>
11050 #$i_stdlib I_STDLIB
11051 #ifdef I_STDLIB
11052 #include <stdlib.h>
11053 #endif
11054 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11055 int null_printf (char* pat,...) { return (int)pat; }
11056 int main () { exit(null_printf(NULL)); }
11057 EOCP
11058         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11059             : run the executable in case it produces a run-time warning
11060             if $run ./attrib >>attrib.out 2>&1; then
11061                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11062                     echo "Your C compiler doesn't allow __printf__ format to be null."
11063                     val="$undef"
11064                 else
11065                     echo "Your C compiler allows __printf__ format to be null."
11066                     val="$define"
11067                 fi
11068             else
11069             echo "Your C compiler executable failed with __printf__ format null."
11070             val="$undef"
11071         fi
11072     else
11073         echo "Your C compiler fails with __printf__ format null."
11074         val="$undef"
11075     fi
11076     ;;
11077     *)  val="$undef" ;;
11078     esac
11079 ;;
11080 *)  val="$d_printf_format_null" ;;
11081 esac
11082 set d_printf_format_null
11083 eval $setvar
11084 $rm -f attrib*
11085
11086 : Look for GCC-style attribute malloc
11087 case "$d_attribute_malloc" in
11088 '')
11089 echo " "
11090 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11091 $cat >attrib.c <<'EOCP'
11092 #include <stdio.h>
11093 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11094 EOCP
11095 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11096         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11097                 echo "Your C compiler doesn't support __attribute__((malloc))."
11098                 val="$undef"
11099         else
11100                 echo "Your C compiler supports __attribute__((malloc))."
11101                 val="$define"
11102         fi
11103 else
11104         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11105         val="$undef"
11106 fi
11107 ;;
11108 *) val="$d_attribute_malloc" ;;
11109 esac
11110 set d_attribute_malloc
11111 eval $setvar
11112 $rm -f attrib*
11113
11114 : Look for GCC-style attribute nonnull
11115 case "$d_attribute_nonnull" in
11116 '')
11117 echo " "
11118 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11119 $cat >attrib.c <<'EOCP'
11120 #include <stdio.h>
11121 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11122 EOCP
11123 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11124         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11125                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11126                 val="$undef"
11127         else
11128                 echo "Your C compiler supports __attribute__((nonnull))."
11129                 val="$define"
11130         fi
11131 else
11132         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11133         val="$undef"
11134 fi
11135 ;;
11136 *) val="$d_attribute_nonnull" ;;
11137 esac
11138 set d_attribute_nonnull
11139 eval $setvar
11140 $rm -f attrib*
11141
11142 : Look for GCC-style attribute noreturn
11143 case "$d_attribute_noreturn" in
11144 '')
11145 echo " "
11146 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11147 $cat >attrib.c <<'EOCP'
11148 #include <stdio.h>
11149 void fall_over_dead( void ) __attribute__((noreturn));
11150 EOCP
11151 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11152         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11153                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11154                 val="$undef"
11155         else
11156                 echo "Your C compiler supports __attribute__((noreturn))."
11157                 val="$define"
11158         fi
11159 else
11160         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11161         val="$undef"
11162 fi
11163 ;;
11164 *) val="$d_attribute_noreturn" ;;
11165 esac
11166 set d_attribute_noreturn
11167 eval $setvar
11168 $rm -f attrib*
11169
11170 : Look for GCC-style attribute pure
11171 case "$d_attribute_pure" in
11172 '')
11173 echo " "
11174 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11175 $cat >attrib.c <<'EOCP'
11176 #include <stdio.h>
11177 int square( int n ) __attribute__((pure));
11178 EOCP
11179 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11180         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11181                 echo "Your C compiler doesn't support __attribute__((pure))."
11182                 val="$undef"
11183         else
11184                 echo "Your C compiler supports __attribute__((pure))."
11185                 val="$define"
11186         fi
11187 else
11188         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11189         val="$undef"
11190 fi
11191 ;;
11192 *) val="$d_attribute_pure" ;;
11193 esac
11194 set d_attribute_pure
11195 eval $setvar
11196 $rm -f attrib*
11197
11198 : Look for GCC-style attribute unused
11199 case "$d_attribute_unused" in
11200 '')
11201 echo " "
11202 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11203 $cat >attrib.c <<'EOCP'
11204 #include <stdio.h>
11205 int do_something( int dummy __attribute__((unused)), int n );
11206 EOCP
11207 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11208         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11209                 echo "Your C compiler doesn't support __attribute__((unused))."
11210                 val="$undef"
11211         else
11212                 echo "Your C compiler supports __attribute__((unused))."
11213                 val="$define"
11214         fi
11215 else
11216         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11217         val="$undef"
11218 fi
11219 ;;
11220 *) val="$d_attribute_unused" ;;
11221 esac
11222 set d_attribute_unused
11223 eval $setvar
11224 $rm -f attrib*
11225
11226 : Look for GCC-style attribute deprecated
11227 case "$d_attribute_deprecated" in
11228 '')
11229 echo " "
11230 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11231 $cat >attrib.c <<'EOCP'
11232 #include <stdio.h>
11233 int I_am_deprecated(void) __attribute__((deprecated));
11234 EOCP
11235 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11236         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11237                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11238                 val="$undef"
11239         else
11240                 echo "Your C compiler supports __attribute__((deprecated))."
11241                 val="$define"
11242         fi
11243 else
11244         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11245         val="$undef"
11246 fi
11247 ;;
11248 *) val="$d_attribute_deprecated" ;;
11249 esac
11250 set d_attribute_deprecated
11251 eval $setvar
11252 $rm -f attrib*
11253
11254 : Look for GCC-style attribute warn_unused_result
11255 case "$d_attribute_warn_unused_result" in
11256 '')
11257 echo " "
11258 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11259 $cat >attrib.c <<'EOCP'
11260 #include <stdio.h>
11261 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11262 EOCP
11263 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11264         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11265                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11266                 val="$undef"
11267         else
11268                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11269                 val="$define"
11270         fi
11271 else
11272         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11273         val="$undef"
11274 fi
11275 ;;
11276 *) val="$d_attribute_warn_unused_result" ;;
11277 esac
11278 set d_attribute_warn_unused_result
11279 eval $setvar
11280 $rm -f attrib*
11281
11282 : see if bcmp exists
11283 set bcmp d_bcmp
11284 eval $inlibc
11285
11286 : see if bcopy exists
11287 set bcopy d_bcopy
11288 eval $inlibc
11289
11290 : see if getpgrp exists
11291 set getpgrp d_getpgrp
11292 eval $inlibc
11293
11294 case "$d_getpgrp" in
11295 "$define")
11296         echo " "
11297         echo "Checking to see which flavor of getpgrp is in use..."
11298         $cat >try.c <<EOP
11299 #$i_unistd I_UNISTD
11300 #include <sys/types.h>
11301 #ifdef I_UNISTD
11302 #  include <unistd.h>
11303 #endif
11304 #$i_stdlib I_STDLIB
11305 #ifdef I_STDLIB
11306 #include <stdlib.h>
11307 #endif
11308 int main()
11309 {
11310         if (getuid() == 0) {
11311                 printf("(I see you are running Configure as super-user...)\n");
11312                 setuid(1);
11313         }
11314 #ifdef TRY_BSD_PGRP
11315         if (getpgrp(1) == 0)
11316                 exit(0);
11317 #else
11318         if (getpgrp() > 0)
11319                 exit(0);
11320 #endif
11321         exit(1);
11322 }
11323 EOP
11324         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11325                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11326                 val="$define"
11327         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11328                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11329                 val="$undef"
11330         else
11331                 echo "I can't seem to compile and run the test program."
11332                 if ./usg; then
11333                         xxx="a USG one, i.e. you use getpgrp()."
11334                 else
11335                         # SVR4 systems can appear rather BSD-ish.
11336                         case "$i_unistd" in
11337                         $undef)
11338                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11339                                 val="$define"
11340                                 ;;
11341                         $define)
11342                                 xxx="probably a USG one, i.e. you use getpgrp()."
11343                                 val="$undef"
11344                                 ;;
11345                         esac
11346                 fi
11347                 echo "Assuming your getpgrp is $xxx" >&4
11348         fi
11349         ;;
11350 *) val="$undef";;
11351 esac
11352 set d_bsdgetpgrp
11353 eval $setvar
11354 $rm_try
11355
11356 : see if setpgrp exists
11357 set setpgrp d_setpgrp
11358 eval $inlibc
11359
11360 case "$d_setpgrp" in
11361 "$define")
11362         echo " "
11363         echo "Checking to see which flavor of setpgrp is in use..."
11364         $cat >try.c <<EOP
11365 #$i_unistd I_UNISTD
11366 #include <sys/types.h>
11367 #ifdef I_UNISTD
11368 #  include <unistd.h>
11369 #endif
11370 #$i_stdlib I_STDLIB
11371 #ifdef I_STDLIB
11372 #include <stdlib.h>
11373 #endif
11374 int main()
11375 {
11376         if (getuid() == 0) {
11377                 printf("(I see you are running Configure as super-user...)\n");
11378                 setuid(1);
11379         }
11380 #ifdef TRY_BSD_PGRP
11381         if (-1 == setpgrp(1, 1))
11382                 exit(0);
11383 #else
11384         if (setpgrp() != -1)
11385                 exit(0);
11386 #endif
11387         exit(1);
11388 }
11389 EOP
11390         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11391                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11392                 val="$define"
11393         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11394                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11395                 val="$undef"
11396         else
11397                 echo "(I can't seem to compile and run the test program.)"
11398                 if ./usg; then
11399                         xxx="a USG one, i.e. you use setpgrp()."
11400                 else
11401                         # SVR4 systems can appear rather BSD-ish.
11402                         case "$i_unistd" in
11403                         $undef)
11404                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11405                                 val="$define"
11406                                 ;;
11407                         $define)
11408                                 xxx="probably a USG one, i.e. you use setpgrp()."
11409                                 val="$undef"
11410                                 ;;
11411                         esac
11412                 fi
11413                 echo "Assuming your setpgrp is $xxx" >&4
11414         fi
11415         ;;
11416 *) val="$undef";;
11417 esac
11418 set d_bsdsetpgrp
11419 eval $setvar
11420 $rm_try
11421
11422 : Look for GCC-style __builtin_choose_expr
11423 case "$d_builtin_choose_expr" in
11424 '')
11425     echo " "
11426     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11427     $cat >try.c <<'EOCP'
11428 #include <assert.h>
11429 #include <stdlib.h>
11430 #include <stdio.h>
11431
11432 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11433
11434 int main(void) {
11435     assert( SYRINX(1) == 2112 );
11436     assert( SYRINX(1) != 5150 );
11437     assert( SYRINX(0) == 5150 );
11438     assert( SYRINX(0) != 2112 );
11439     puts( "All good!" );
11440     exit(0);
11441 }
11442
11443 EOCP
11444     set try
11445     if eval $compile && $run ./try; then
11446         echo "Your C compiler supports __builtin_choose_expr."
11447         val="$define"
11448     else
11449         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11450         val="$undef"
11451     fi
11452 ;;
11453 *) val="$d_builtin_choose_expr" ;;
11454 esac
11455
11456 set d_builtin_choose_expr
11457 eval $setvar
11458 $rm_try
11459
11460 : Look for GCC-style __builtin_expect
11461 case "$d_builtin_expect" in
11462 '')
11463     echo " "
11464     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11465     $cat >try.c <<'EOCP'
11466 int main(void) {
11467     int n = 50;
11468     if ( __builtin_expect(n, 0) ) n = 1;
11469     /* Remember shell exit code truth is 0, C truth is non-zero */
11470     return !(n == 1);
11471 }
11472 EOCP
11473     set try
11474     if eval $compile && $run ./try; then
11475         echo "Your C compiler supports __builtin_expect."
11476         val="$define"
11477     else
11478         echo "Your C compiler doesn't seem to understand __builtin_expect."
11479         val="$undef"
11480     fi
11481     ;;
11482 *) val="$d_builtin_expect" ;;
11483 esac
11484
11485 set d_builtin_expect
11486 eval $setvar
11487 $rm_try
11488
11489 : see if bzero exists
11490 set bzero d_bzero
11491 eval $inlibc
11492
11493 : see if stdarg is available
11494 echo " "
11495 if $test `./findhdr stdarg.h`; then
11496         echo "<stdarg.h> found." >&4
11497         valstd="$define"
11498 else
11499         echo "<stdarg.h> NOT found." >&4
11500         valstd="$undef"
11501 fi
11502
11503 : see if varargs is available
11504 echo " "
11505 if $test `./findhdr varargs.h`; then
11506         echo "<varargs.h> found." >&4
11507 else
11508         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11509 fi
11510
11511 : set up the varargs testing programs
11512 $cat > varargs.c <<EOP
11513 #ifdef I_STDARG
11514 #include <stdarg.h>
11515 #endif
11516 #ifdef I_VARARGS
11517 #include <varargs.h>
11518 #endif
11519
11520 #ifdef I_STDARG
11521 int f(char *p, ...)
11522 #else
11523 int f(va_alist)
11524 va_dcl
11525 #endif
11526 {
11527         va_list ap;
11528 #ifndef I_STDARG
11529         char *p;
11530 #endif
11531 #ifdef I_STDARG
11532         va_start(ap,p);
11533 #else
11534         va_start(ap);
11535         p = va_arg(ap, char *);
11536 #endif
11537         va_end(ap);
11538         return 0;
11539 }
11540 EOP
11541 $cat > varargs <<EOP
11542 $startsh
11543 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11544         echo "true"
11545 else
11546         echo "false"
11547 fi
11548 $rm -f varargs$_o
11549 EOP
11550 chmod +x varargs
11551
11552 : now check which varargs header should be included
11553 echo " "
11554 i_varhdr=''
11555 val=''
11556 case "$valstd" in
11557 "$define")
11558         if `./varargs I_STDARG`; then
11559                 val='stdarg.h'
11560         elif `./varargs I_VARARGS`; then
11561                 val='varargs.h'
11562         fi
11563         ;;
11564 *)
11565         if `./varargs I_VARARGS`; then
11566                 val='varargs.h'
11567         fi
11568         ;;
11569 esac
11570 case "$val" in
11571 '')
11572         echo " "
11573         echo "*** WHOA THERE!!! ***" >&4
11574         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11575         case "$knowitall" in
11576         '')
11577         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11578                 exit 1
11579                 ;;
11580         esac
11581 echo "I could not find the definition for va_dcl... You have problems..." >&4
11582         val="$undef"; set i_stdarg; eval $setvar
11583         val="$undef"; set i_varargs; eval $setvar
11584         ;;
11585 *)
11586         set i_varhdr
11587         eval $setvar
11588         case "$i_varhdr" in
11589         stdarg.h)
11590                 val="$define"; set i_stdarg; eval $setvar
11591                 val="$undef"; set i_varargs; eval $setvar
11592                 ;;
11593         varargs.h)
11594                 val="$undef"; set i_stdarg; eval $setvar
11595                 val="$define"; set i_varargs; eval $setvar
11596                 ;;
11597         esac
11598         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11599 esac
11600 $rm -f varargs*
11601
11602 : see if the Compiler supports C99 variadic macros
11603 case "$i_stdarg$i_stdlib" in
11604     "$define$define")
11605     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11606     $cat >try.c <<EOCP
11607 #include <stdio.h>
11608 #include <stdarg.h>
11609
11610 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11611
11612 int main() {
11613   char buf[20];
11614   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11615   puts(buf);
11616   return 0;
11617 }
11618 EOCP
11619     set try
11620     if eval $compile && $run ./try 2>&1 >/dev/null; then
11621         case "`$run ./try`" in
11622             "123 456 789")
11623             echo "You have C99 variadic macros." >&4
11624             d_c99_variadic_macros="$define"
11625             ;;
11626             *)
11627             echo "You don't have functional C99 variadic macros." >&4
11628             d_c99_variadic_macros="$undef"
11629             ;;
11630         esac
11631     else
11632         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11633         d_c99_variadic_macros="$undef"
11634     fi
11635     $rm_try
11636     ;;
11637     *)
11638     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11639     d_c99_variadic_macros="$undef"
11640     ;;
11641 esac
11642
11643 : see if signal is declared as pointer to function returning int or void
11644 echo " "
11645 xxx=`./findhdr signal.h`
11646 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11647 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11648         echo "You have int (*signal())() instead of void." >&4
11649         val="$undef"
11650 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11651         echo "You have void (*signal())()." >&4
11652         val="$define"
11653 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11654         echo "You have int (*signal())() instead of void." >&4
11655         val="$undef"
11656 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11657         echo "You have void (*signal())()." >&4
11658         val="$define"
11659 else
11660         case "$d_voidsig" in
11661         '')
11662         echo "I can't determine whether signal handler returns void or int..." >&4
11663                 dflt=void
11664                 rp="What type does your signal handler return?"
11665                 . ./myread
11666                 case "$ans" in
11667                 v*) val="$define";;
11668                 *) val="$undef";;
11669                 esac;;
11670         "$define")
11671                 echo "As you already told me, signal handler returns void." >&4
11672                 val="$define"
11673                 ;;
11674         *)      echo "As you already told me, signal handler returns int." >&4
11675                 val="$undef"
11676                 ;;
11677         esac
11678 fi
11679 set d_voidsig
11680 eval $setvar
11681 case "$d_voidsig" in
11682 "$define") signal_t="void";;
11683 *) signal_t="int";;
11684 esac
11685 $rm -f $$.tmp
11686
11687 : check for ability to cast large floats to 32-bit ints.
11688 echo " "
11689 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11690 if $test "$intsize" -ge 4; then
11691         xxx=int
11692 else
11693         xxx=long
11694 fi
11695 $cat >try.c <<EOCP
11696 #include <stdio.h>
11697 #$i_stdlib I_STDLIB
11698 #ifdef I_STDLIB
11699 #include <stdlib.h>
11700 #endif
11701 #include <sys/types.h>
11702 #include <signal.h>
11703 $signal_t blech(int s) { exit(3); }
11704 int main()
11705 {
11706         $xxx i32;
11707         double f, g;
11708         int result = 0;
11709         char str[16];
11710         signal(SIGFPE, blech);
11711
11712         /* Don't let compiler optimize the test away.  Store the number
11713            in a writable string for gcc to pass to sscanf under HP-UX.
11714         */
11715         sprintf(str, "2147483647");
11716         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11717         g = 10 * f;
11718         i32  = ($xxx) g;
11719
11720         /* x86 processors will probably give 0x8000 0000, which is a
11721            sign change.  We don't want that.  We want to mimic SPARC
11722            behavior here, which is to preserve the sign and give
11723            back 0x7fff ffff.
11724         */
11725         if (i32 != ($xxx) f)
11726                 result |= 1;
11727         exit(result);
11728 }
11729 EOCP
11730 set try
11731 if eval $compile_ok; then
11732         $run ./try 2>/dev/null
11733         yyy=$?
11734 else
11735         echo "(I can't seem to compile the test program--assuming it can't)"
11736         yyy=1
11737 fi
11738 case "$yyy" in
11739 0)      val="$define"
11740         echo "Yup, it can."
11741         ;;
11742 *)      val="$undef"
11743         echo "Nope, it can't."
11744         ;;
11745 esac
11746 set d_casti32
11747 eval $setvar
11748 $rm_try
11749
11750 : check for ability to cast negative floats to unsigned
11751 echo " "
11752 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11753 $cat >try.c <<EOCP
11754 #include <stdio.h>
11755 #$i_stdlib I_STDLIB
11756 #ifdef I_STDLIB
11757 #include <stdlib.h>
11758 #endif
11759 #include <sys/types.h>
11760 #include <signal.h>
11761 $signal_t blech(int s) { exit(7); }
11762 $signal_t blech_in_list(int s) { exit(4); }
11763 unsigned long dummy_long(unsigned long p) { return p; }
11764 unsigned int dummy_int(unsigned int p) { return p; }
11765 unsigned short dummy_short(unsigned short p) { return p; }
11766 int main()
11767 {
11768         double f;
11769         unsigned long along;
11770         unsigned int aint;
11771         unsigned short ashort;
11772         int result = 0;
11773         char str[16];
11774
11775         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11776            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11777            optimized the whole file away
11778         */
11779         /* Store the number in a writable string for gcc to pass to
11780            sscanf under HP-UX.
11781         */
11782         sprintf(str, "-123");
11783         sscanf(str, "%lf", &f);  /* f = -123.; */
11784
11785         signal(SIGFPE, blech);
11786         along = (unsigned long)f;
11787         aint = (unsigned int)f;
11788         ashort = (unsigned short)f;
11789         if (along != (unsigned long)-123)
11790                 result |= 1;
11791         if (aint != (unsigned int)-123)
11792                 result |= 1;
11793         if (ashort != (unsigned short)-123)
11794                 result |= 1;
11795         sprintf(str, "1073741824.");
11796         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11797         f = f + f;
11798         along = 0;
11799         along = (unsigned long)f;
11800         if (along != 0x80000000)
11801                 result |= 2;
11802         f -= 1.;
11803         along = 0;
11804         along = (unsigned long)f;
11805         if (along != 0x7fffffff)
11806                 result |= 1;
11807         f += 2.;
11808         along = 0;
11809         along = (unsigned long)f;
11810         if (along != 0x80000001)
11811                 result |= 2;
11812         if (result)
11813                 exit(result);
11814         signal(SIGFPE, blech_in_list);
11815         sprintf(str, "123.");
11816         sscanf(str, "%lf", &f);  /* f = 123.; */
11817         along = dummy_long((unsigned long)f);
11818         aint = dummy_int((unsigned int)f);
11819         ashort = dummy_short((unsigned short)f);
11820         if (along != (unsigned long)123)
11821                 result |= 4;
11822         if (aint != (unsigned int)123)
11823                 result |= 4;
11824         if (ashort != (unsigned short)123)
11825                 result |= 4;
11826         exit(result);
11827
11828 }
11829 EOCP
11830 set try
11831 if eval $compile_ok; then
11832         $run ./try 2>/dev/null
11833         castflags=$?
11834 else
11835         echo "(I can't seem to compile the test program--assuming it can't)"
11836         castflags=7
11837 fi
11838 case "$castflags" in
11839 0)      val="$define"
11840         echo "Yup, it can."
11841         ;;
11842 *)      val="$undef"
11843         echo "Nope, it can't."
11844         ;;
11845 esac
11846 set d_castneg
11847 eval $setvar
11848 $rm_try
11849
11850 : see if cbrt exists
11851 set cbrt d_cbrt
11852 eval $inlibc
11853
11854 : see if vprintf exists
11855 echo " "
11856 if set vprintf val -f d_vprintf; eval $csym; $val; then
11857         echo 'vprintf() found.' >&4
11858         val="$define"
11859         $cat >try.c <<EOF
11860 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11861 #$i_varargs I_VARARGS
11862
11863 #$i_stdlib I_STDLIB
11864 #$i_unistd I_UNISTD
11865
11866 #ifdef I_STDARG
11867 #  include <stdarg.h>
11868 #else /* I_VARARGS */
11869 #  include <varargs.h>
11870 #endif
11871
11872 #ifdef I_UNISTD
11873 #  include <unistd.h>
11874 #endif
11875
11876 #ifdef I_STDLIB
11877 #  include <stdlib.h>
11878 #endif
11879
11880 #include <stdio.h> /* vsprintf prototype */
11881
11882 #ifdef I_STDARG
11883 void xxx(int n, ...)
11884 {
11885     va_list args;
11886     char buf[10];
11887     va_start(args, n);
11888     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11889 }
11890 int main() { xxx(1, "foo"); }
11891
11892 #else /* I_VARARGS */
11893
11894 xxx(va_alist)
11895 va_dcl
11896 {
11897     va_list args;
11898     char buf[10];
11899     va_start(args);
11900     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11901 }
11902 int main() { xxx("foo"); }
11903
11904 #endif
11905
11906 EOF
11907         set try
11908         if eval $compile_ok; then
11909                 if $run ./try; then
11910                         echo "Your vsprintf() returns (int)." >&4
11911                         val2="$undef"
11912                 else
11913                         echo "Your vsprintf() returns (char*)." >&4
11914                         val2="$define"
11915                 fi
11916         else
11917                 echo 'I am unable to compile the vsprintf() test program.' >&4
11918                 # We shouldn't get here.  If we do, assume the standard signature,
11919                 # not the old BSD one.
11920                 echo 'Guessing that vsprintf() returns (int).' >&4
11921                 val2="$undef"
11922         fi
11923 else
11924         echo 'vprintf() NOT found.' >&4
11925         val="$undef"
11926         val2="$undef"
11927 fi
11928 $rm_try
11929 set d_vprintf
11930 eval $setvar
11931 val=$val2
11932 set d_charvspr
11933 eval $setvar
11934
11935 : see if chown exists
11936 set chown d_chown
11937 eval $inlibc
11938
11939 : see if chroot exists
11940 set chroot d_chroot
11941 eval $inlibc
11942
11943 : see if chsize exists
11944 set chsize d_chsize
11945 eval $inlibc
11946
11947 : see if class exists
11948 set class d_class
11949 eval $inlibc
11950
11951 : see if clearenv exists
11952 set clearenv d_clearenv
11953 eval $inlibc
11954
11955 : Define hasstruct macro for Configure internal use
11956 hasstruct='varname=$1; struct=$2; shift; shift;
11957 while $test $# -ge 2; do
11958         case "$1" in
11959         $define) echo "#include <$2>";;
11960         esac ;
11961     shift 2;
11962 done > try.c;
11963 echo "int main () { struct $struct foo; }" >> try.c;
11964 set try;
11965 if eval $compile; then
11966         val="$define";
11967 else
11968         val="$undef";
11969 fi;
11970 set $varname;
11971 eval $setvar;
11972 $rm_try'
11973
11974 : see whether socket exists
11975 socketlib=''
11976 sockethdr=''
11977 echo " "
11978 $echo $n "Hmm... $c" >&4
11979 if set socket val -f d_socket; eval $csym; $val; then
11980     echo "Looks like you have Berkeley networking support." >&4
11981     d_socket="$define"
11982     if set setsockopt val -f; eval $csym; $val; then
11983         d_oldsock="$undef"
11984     else
11985         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11986         d_oldsock="$define"
11987     fi
11988 else
11989     if $contains socklib libc.list >/dev/null 2>&1; then
11990         echo "Looks like you have Berkeley networking support." >&4
11991         d_socket="$define"
11992         : we will have to assume that it supports the 4.2 BSD interface
11993         d_oldsock="$undef"
11994     else
11995         echo "You don't have Berkeley networking in libc$_a..." >&4
11996         if test "X$d_socket" = "X$define"; then
11997             echo "...but you seem to believe that you have sockets." >&4
11998         else
11999             for net in net socket
12000             do
12001                 if test -f $sysroot/usr/lib/lib$net$_a; then
12002                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
12003                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
12004                     if $contains socket libc.list >/dev/null 2>&1; then
12005                         d_socket="$define"
12006                         socketlib="-l$net"
12007                         case "$net" in
12008                         net)
12009                             echo "...but the Wollongong group seems to have hacked it in." >&4
12010                             sockethdr="-I$sysroot/usr/netinclude"
12011                             ;;
12012                         esac
12013                         echo "Found Berkeley sockets interface in lib$net." >&4
12014                         if $contains setsockopt libc.list >/dev/null 2>&1; then
12015                             d_oldsock="$undef"
12016                         else
12017                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
12018                             d_oldsock="$define"
12019                         fi
12020                         break
12021                     fi
12022                 fi
12023             done
12024             if test "X$d_socket" != "X$define"; then
12025                echo "or anywhere else I see." >&4
12026                d_socket="$undef"
12027                d_oldsock="$undef"
12028             fi
12029         fi
12030     fi
12031 fi
12032
12033 : see if socketpair exists
12034 set socketpair d_sockpair
12035 eval $inlibc
12036
12037
12038 echo " "
12039 echo "Checking the availability sa_len in the sock struct ..." >&4
12040 $cat >try.c <<EOF
12041 #include <sys/types.h>
12042 #include <sys/socket.h>
12043 int main() {
12044 struct sockaddr sa;
12045 return (sa.sa_len);
12046 }
12047 EOF
12048 val="$undef"
12049 set try; if eval $compile; then
12050     val="$define"
12051 fi
12052 set d_sockaddr_sa_len; eval $setvar
12053 $rm_try
12054
12055 echo " "
12056 echo "Checking the availability struct sockaddr_in6 ..." >&4
12057 $cat >try.c <<EOF
12058 #include <sys/types.h>
12059 #include <sys/socket.h>
12060 #include <netinet/in.h>
12061 int main() {
12062 struct sockaddr_in6 sin6;
12063 return (sin6.sin6_family);
12064 }
12065 EOF
12066 val="$undef"
12067 set try; if eval $compile; then
12068     val="$define"
12069 fi
12070 set d_sockaddr_in6; eval $setvar
12071 $rm_try
12072
12073 echo " "
12074 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12075 $cat >try.c <<EOF
12076 #include <sys/types.h>
12077 #include <sys/socket.h>
12078 #include <netinet/in.h>
12079 int main() {
12080 struct sockaddr_in6 sin6;
12081 return (sin6.sin6_scope_id);
12082 }
12083 EOF
12084 val="$undef"
12085 set try; if eval $compile; then
12086     val="$define"
12087 fi
12088 set d_sin6_scope_id; eval $setvar
12089 $rm_try
12090
12091 echo " "
12092 echo "Checking the availability struct ip_mreq ..." >&4
12093 $cat >try.c <<EOF
12094 #include <sys/types.h>
12095 #include <sys/socket.h>
12096 #include <netinet/in.h>
12097 int main() {
12098 struct ip_mreq mreq;
12099 return (mreq.imr_multiaddr.s_addr);
12100 }
12101 EOF
12102 val="$undef"
12103 set try; if eval $compile; then
12104        val="$define"
12105 fi
12106 set d_ip_mreq; eval $setvar
12107 $rm_try
12108
12109 echo " "
12110 echo "Checking the availability struct ip_mreq_source ..." >&4
12111 $cat >try.c <<EOF
12112 #include <sys/types.h>
12113 #include <sys/socket.h>
12114 #include <netinet/in.h>
12115 int main() {
12116 struct ip_mreq_source mreq;
12117 return (mreq.imr_multiaddr.s_addr);
12118 }
12119 EOF
12120 val="$undef"
12121 set try; if eval $compile; then
12122        val="$define"
12123 fi
12124 set d_ip_mreq_source; eval $setvar
12125 $rm_try
12126
12127 echo " "
12128 echo "Checking the availability struct ipv6_mreq ..." >&4
12129 $cat >try.c <<EOF
12130 #include <sys/types.h>
12131 #include <sys/socket.h>
12132 #include <netinet/in.h>
12133 int main() {
12134 struct ipv6_mreq mreq;
12135 return (mreq.ipv6mr_interface);
12136 }
12137 EOF
12138 val="$undef"
12139 set try; if eval $compile; then
12140     val="$define"
12141 fi
12142 set d_ipv6_mreq; eval $setvar
12143 $rm_try
12144
12145 echo " "
12146 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12147 $cat >try.c <<EOF
12148 #include <sys/types.h>
12149 #include <sys/socket.h>
12150 #include <netinet/in.h>
12151 int main() {
12152 struct ipv6_mreq_source mreq;
12153 return (mreq.imr_multiaddr.s_addr);
12154 }
12155 EOF
12156 val="$undef"
12157 set try; if eval $compile; then
12158        val="$define"
12159 fi
12160 set d_ipv6_mreq_source; eval $setvar
12161 $rm_try
12162
12163 echo " "
12164 echo "Checking the availability of certain socket constants..." >&4
12165 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12166     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12167     $cat >try.c <<EOF
12168 #include <sys/types.h>
12169 #include <sys/socket.h>
12170 int main() {
12171     int i = $ENUM;
12172 }
12173 EOF
12174     val="$undef"
12175     set try; if eval $compile; then
12176         val="$define"
12177     fi
12178     set d_${enum}; eval $setvar
12179     $rm_try
12180 done
12181
12182 : see if this is a sys/uio.h system
12183 set sys/uio.h i_sysuio
12184 eval $inhdr
12185
12186 : Check for cmsghdr support
12187 echo " "
12188 echo "Checking to see if your system supports struct cmsghdr..." >&4
12189 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12190 eval $hasstruct
12191 case "$d_cmsghdr_s" in
12192 "$define")      echo "Yes, it does."   ;;
12193 *)              echo "No, it doesn't." ;;
12194 esac
12195
12196
12197 : check for const keyword
12198 echo " "
12199 echo 'Checking to see if your C compiler knows about "const"...' >&4
12200 $cat >const.c <<'EOCP'
12201 typedef struct spug { int drokk; } spug;
12202 int main()
12203 {
12204         const char *foo;
12205         const spug y = { 0 };
12206 }
12207 EOCP
12208 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12209         val="$define"
12210         echo "Yup, it does."
12211 else
12212         val="$undef"
12213         echo "Nope, it doesn't."
12214 fi
12215 set d_const
12216 eval $setvar
12217
12218 : see if copysign exists
12219 set copysign d_copysign
12220 eval $inlibc
12221
12222 : see if copysignl exists
12223 set copysignl d_copysignl
12224 eval $inlibc
12225
12226 : see if crypt exists
12227 echo " "
12228 set crypt d_crypt
12229 eval $inlibc
12230 case "$d_crypt" in
12231 $define) cryptlib='' ;;
12232 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12233                 echo 'crypt() found.' >&4
12234                 val="$define"
12235                 cryptlib=''
12236         else
12237                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12238                 if $test -z "$cryptlib"; then
12239                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12240                 else
12241                         cryptlib=-lcrypt
12242                 fi
12243                 if $test -z "$cryptlib"; then
12244                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12245                 else
12246                         cryptlib=-lcrypt
12247                 fi
12248                 if $test -z "$cryptlib"; then
12249                         cryptlib=`./loc libcrypt$_a "" $libpth`
12250                 else
12251                         cryptlib=-lcrypt
12252                 fi
12253                 if $test -z "$cryptlib"; then
12254                         echo 'crypt() NOT found.' >&4
12255                         val="$undef"
12256                 else
12257                         val="$define"
12258                 fi
12259         fi
12260         set d_crypt
12261         eval $setvar
12262         ;;
12263 esac
12264
12265 : see if this is a crypt.h system
12266 set crypt.h i_crypt
12267 eval $inhdr
12268
12269 : see if crypt_r exists
12270 set crypt_r d_crypt_r
12271 eval $inlibc
12272 case "$d_crypt_r" in
12273 "$define")
12274         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12275         case "$d_crypt_r_proto:$usethreads" in
12276         ":define")      d_crypt_r_proto=define
12277                 set d_crypt_r_proto crypt_r $hdrs
12278                 eval $hasproto ;;
12279         *)      ;;
12280         esac
12281         case "$d_crypt_r_proto" in
12282         define)
12283         case "$crypt_r_proto" in
12284         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12285         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12286         esac
12287         case "$crypt_r_proto" in
12288         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12289         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12290         esac
12291         case "$crypt_r_proto" in
12292         ''|0)   d_crypt_r=undef
12293                 crypt_r_proto=0
12294                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12295         * )     case "$crypt_r_proto" in
12296                 REENTRANT_PROTO*) ;;
12297                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12298                 esac
12299                 echo "Prototype: $try" ;;
12300         esac
12301         ;;
12302         *)      case "$usethreads" in
12303                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12304                 esac
12305                 d_crypt_r=undef
12306                 crypt_r_proto=0
12307                 ;;
12308         esac
12309         ;;
12310 *)      crypt_r_proto=0
12311         ;;
12312 esac
12313
12314 : get csh whereabouts
12315 case "$csh" in
12316 'csh') val="$undef" ;;
12317 *) val="$define" ;;
12318 esac
12319 set d_csh
12320 eval $setvar
12321 : Respect a hint or command line value for full_csh.
12322 case "$full_csh" in
12323 '') full_csh=$csh ;;
12324 esac
12325
12326 : see if ctermid exists
12327 set ctermid d_ctermid
12328 eval $inlibc
12329
12330 : see if ctermid_r exists
12331 set ctermid_r d_ctermid_r
12332 eval $inlibc
12333 case "$d_ctermid_r" in
12334 "$define")
12335         hdrs="$i_systypes sys/types.h define stdio.h "
12336         case "$d_ctermid_r_proto:$usethreads" in
12337         ":define")      d_ctermid_r_proto=define
12338                 set d_ctermid_r_proto ctermid_r $hdrs
12339                 eval $hasproto ;;
12340         *)      ;;
12341         esac
12342         case "$d_ctermid_r_proto" in
12343         define)
12344         case "$ctermid_r_proto" in
12345         ''|0) try='char* ctermid_r(char*);'
12346         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12347         esac
12348         case "$ctermid_r_proto" in
12349         ''|0)   d_ctermid_r=undef
12350                 ctermid_r_proto=0
12351                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12352         * )     case "$ctermid_r_proto" in
12353                 REENTRANT_PROTO*) ;;
12354                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12355                 esac
12356                 echo "Prototype: $try" ;;
12357         esac
12358         ;;
12359         *)      case "$usethreads" in
12360                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12361                 esac
12362                 d_ctermid_r=undef
12363                 ctermid_r_proto=0
12364                 ;;
12365         esac
12366         ;;
12367 *)      ctermid_r_proto=0
12368         ;;
12369 esac
12370
12371 : see if ctime_r exists
12372 set ctime_r d_ctime_r
12373 eval $inlibc
12374 case "$d_ctime_r" in
12375 "$define")
12376         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12377         case "$d_ctime_r_proto:$usethreads" in
12378         ":define")      d_ctime_r_proto=define
12379                 set d_ctime_r_proto ctime_r $hdrs
12380                 eval $hasproto ;;
12381         *)      ;;
12382         esac
12383         case "$d_ctime_r_proto" in
12384         define)
12385         case "$ctime_r_proto" in
12386         ''|0) try='char* ctime_r(const time_t*, char*);'
12387         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12388         esac
12389         case "$ctime_r_proto" in
12390         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12391         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12392         esac
12393         case "$ctime_r_proto" in
12394         ''|0) try='int ctime_r(const time_t*, char*);'
12395         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12396         esac
12397         case "$ctime_r_proto" in
12398         ''|0) try='int ctime_r(const time_t*, char*, int);'
12399         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12400         esac
12401         case "$ctime_r_proto" in
12402         ''|0)   d_ctime_r=undef
12403                 ctime_r_proto=0
12404                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12405         * )     case "$ctime_r_proto" in
12406                 REENTRANT_PROTO*) ;;
12407                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12408                 esac
12409                 echo "Prototype: $try" ;;
12410         esac
12411         ;;
12412         *)      case "$usethreads" in
12413                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12414                 esac
12415                 d_ctime_r=undef
12416                 ctime_r_proto=0
12417                 ;;
12418         esac
12419         ;;
12420 *)      ctime_r_proto=0
12421         ;;
12422 esac
12423
12424 : see if cuserid exists
12425 set cuserid d_cuserid
12426 eval $inlibc
12427
12428 : see if this is a limits.h system
12429 set limits.h i_limits
12430 eval $inhdr
12431
12432 : See if number of significant digits in a double precision number is known
12433 echo " "
12434 $cat >dbl_dig.c <<EOM
12435 #$i_limits I_LIMITS
12436 #$i_float I_FLOAT
12437 #ifdef I_LIMITS
12438 #include <limits.h>
12439 #endif
12440 #ifdef I_FLOAT
12441 #include <float.h>
12442 #endif
12443 #ifdef DBL_DIG
12444 printf("Contains DBL_DIG");
12445 #endif
12446 EOM
12447 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12448 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12449         echo "DBL_DIG found." >&4
12450         val="$define"
12451 else
12452         echo "DBL_DIG NOT found." >&4
12453         val="$undef"
12454 fi
12455 $rm -f dbl_dig.?
12456 set d_dbl_dig
12457 eval $setvar
12458
12459 : see if dbm.h is available
12460 : see if dbmclose exists
12461 set dbmclose d_dbmclose
12462 eval $inlibc
12463
12464 case "$d_dbmclose" in
12465 $define)
12466         set dbm.h i_dbm
12467         eval $inhdr
12468         case "$i_dbm" in
12469         $define)
12470                 val="$undef"
12471                 set i_rpcsvcdbm
12472                 eval $setvar
12473                 ;;
12474         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12475                 eval $inhdr
12476                 ;;
12477         esac
12478         ;;
12479 *)      echo "We won't be including <dbm.h>"
12480         val="$undef"
12481         set i_dbm
12482         eval $setvar
12483         val="$undef"
12484         set i_rpcsvcdbm
12485         eval $setvar
12486         ;;
12487 esac
12488
12489 : see if prototype for dbminit is available
12490 echo " "
12491 set d_dbminitproto dbminit $i_dbm dbm.h
12492 eval $hasproto
12493
12494 : see if difftime exists
12495 set difftime d_difftime
12496 eval $inlibc
12497
12498 : see if this is a dirent system
12499 echo " "
12500 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12501         val="$define"
12502         echo "<dirent.h> found." >&4
12503 else
12504         val="$undef"
12505         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12506                 echo "<sys/dir.h> found." >&4
12507                 echo " "
12508         else
12509                 xinc=`./findhdr sys/ndir.h`
12510         fi
12511         echo "<dirent.h> NOT found." >&4
12512 fi
12513 set i_dirent
12514 eval $setvar
12515
12516 : Look for type of directory structure.
12517 echo " "
12518 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12519
12520 case "$direntrytype" in
12521 ''|' ')
12522         case "$i_dirent" in
12523         $define) guess1='struct dirent' ;;
12524         *) guess1='struct direct'  ;;
12525         esac
12526         ;;
12527 *)      guess1="$direntrytype"
12528         ;;
12529 esac
12530
12531 case "$guess1" in
12532 'struct dirent') guess2='struct direct' ;;
12533 *) guess2='struct dirent' ;;
12534 esac
12535
12536 if $contains "$guess1" try.c >/dev/null 2>&1; then
12537         direntrytype="$guess1"
12538         echo "Your directory entries are $direntrytype." >&4
12539 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12540         direntrytype="$guess2"
12541         echo "Your directory entries seem to be $direntrytype." >&4
12542 else
12543         echo "I don't recognize your system's directory entries." >&4
12544         rp="What type is used for directory entries on this system?"
12545         dflt="$guess1"
12546         . ./myread
12547         direntrytype="$ans"
12548 fi
12549 $rm_try
12550
12551 : see if the directory entry stores field length
12552 echo " "
12553 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12554 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12555         echo "Good, your directory entry keeps length information in d_namlen." >&4
12556         val="$define"
12557 else
12558         echo "Your directory entry does not know about the d_namlen field." >&4
12559         val="$undef"
12560 fi
12561 set d_dirnamlen
12562 eval $setvar
12563 $rm_try
12564
12565 : Look for DIR.dd_fd
12566 case "$i_dirent" in
12567 "$define")
12568     echo "Checking to see if DIR has a dd_fd member variable" >&4
12569     $cat >try.c <<EOCP
12570 #$i_stdlib I_STDLIB
12571 #ifdef I_STDLIB
12572 #include <stdlib.h>
12573 #endif
12574 #include <dirent.h>
12575
12576 int main() {
12577     DIR dir;
12578     dir.dd_fd = 1;
12579     return 0;
12580 }
12581 EOCP
12582     val=$undef
12583     set try
12584     if eval $compile; then
12585         echo "Yes, it does."
12586         val="$define"
12587     else
12588         echo "No, it does not."
12589         val="$undef"
12590     fi
12591     ;;
12592 *)
12593     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12594     val="$undef"
12595     ;;
12596 esac
12597 set d_dir_dd_fd
12598 eval $setvar
12599 $rm_try
12600
12601 : see if this is an sysdir system
12602 set sys/dir.h i_sysdir
12603 eval $inhdr
12604
12605 : see if this is an sysndir system
12606 set sys/ndir.h i_sysndir
12607 eval $inhdr
12608
12609 : Look for dirfd
12610 echo " "
12611 $cat >dirfd.c <<EOM
12612 #include <stdio.h>
12613 #$i_stdlib I_STDLIB
12614 #ifdef I_STDLIB
12615 #include <stdlib.h>
12616 #endif
12617 #$i_dirent I_DIRENT             /**/
12618 #$i_sysdir I_SYS_DIR            /**/
12619 #$i_sysndir I_SYS_NDIR          /**/
12620 #$i_systypes I_SYS_TYPES        /**/
12621 #if defined(I_SYS_TYPES)
12622 #include <sys/types.h>
12623 #endif
12624 #if defined(I_DIRENT)
12625 #include <dirent.h>
12626 #else
12627 #ifdef I_SYS_NDIR
12628 #include <sys/ndir.h>
12629 #else
12630 #ifdef I_SYS_DIR
12631 #ifdef hp9000s500
12632 #include <ndir.h>       /* may be wrong in the future */
12633 #else
12634 #include <sys/dir.h>
12635 #endif
12636 #endif
12637 #endif
12638 #endif
12639 int main() {
12640         DIR *dirp = opendir(".");
12641         if (dirfd(dirp) >= 0)
12642                 exit(0);
12643         else
12644                 exit(1);
12645 }
12646 EOM
12647 val=$undef
12648 set dirfd
12649 if eval $compile; then
12650         val="$define"
12651 fi
12652 case "$val" in
12653 $define)        echo "dirfd() found." >&4       ;;
12654 *)              echo "dirfd() NOT found." >&4   ;;
12655 esac
12656 set d_dirfd
12657 eval $setvar
12658 $rm -f dirfd*
12659
12660 : see if dladdr exists
12661 set dladdr d_dladdr
12662 eval $inlibc
12663
12664 : see if dlerror exists
12665 xxx_runnm="$runnm"
12666 runnm=false
12667 set dlerror d_dlerror
12668 eval $inlibc
12669 runnm="$xxx_runnm"
12670
12671 : see if dlfcn is available
12672 set dlfcn.h i_dlfcn
12673 eval $inhdr
12674
12675 : Check what extension to use for shared libs
12676 case "$usedl" in
12677 $define|y|true)
12678         $cat << EOM
12679
12680 On a few systems, the dynamically loaded modules that perl generates and uses
12681 will need a different extension than shared libs. The default will probably
12682 be appropriate.
12683
12684 EOM
12685         case "$dlext" in
12686         '')     dflt="$so" ;;
12687         *)      dflt="$dlext" ;;
12688         esac
12689         rp='What is the extension of dynamically loaded modules'
12690         . ./myread
12691         dlext="$ans"
12692         ;;
12693 *)
12694         dlext="none"
12695         ;;
12696 esac
12697
12698 : Check if dlsym need a leading underscore
12699 echo " "
12700 val="$undef"
12701
12702 case "$dlsrc" in
12703 dl_dlopen.xs)
12704         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12705         $cat >dyna.c <<'EOM'
12706 fred () { }
12707 EOM
12708
12709 $cat >fred.c<<EOM
12710
12711 #include <stdio.h>
12712 #$i_stdlib I_STDLIB
12713 #ifdef I_STDLIB
12714 #include <stdlib.h>
12715 #endif
12716 #$i_dlfcn I_DLFCN
12717 #ifdef I_DLFCN
12718 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12719 #else
12720 #include <sys/types.h>
12721 #include <nlist.h>
12722 #include <link.h>
12723 #endif
12724
12725 extern int fred() ;
12726
12727 int main()
12728 {
12729     void * handle ;
12730     void * symbol ;
12731 #ifndef RTLD_LAZY
12732     int mode = 1 ;
12733 #else
12734     int mode = RTLD_LAZY ;
12735 #endif
12736     handle = dlopen("./dyna.$dlext", mode) ;
12737     if (handle == NULL) {
12738         printf ("1\n") ;
12739         fflush (stdout) ;
12740         exit(0);
12741     }
12742     symbol = dlsym(handle, "fred") ;
12743     if (symbol == NULL) {
12744         /* try putting a leading underscore */
12745         symbol = dlsym(handle, "_fred") ;
12746         if (symbol == NULL) {
12747             printf ("2\n") ;
12748             fflush (stdout) ;
12749             exit(0);
12750         }
12751         printf ("3\n") ;
12752     }
12753     else
12754         printf ("4\n") ;
12755     fflush (stdout) ;
12756     exit(0);
12757 }
12758 EOM
12759         : Call the object file tmp-dyna.o in case dlext=o.
12760         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12761                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12762                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12763                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12764                 xxx=`$run ./fred`
12765                 case $xxx in
12766                 1)      echo "Test program failed using dlopen." >&4
12767                         echo "Perhaps you should not use dynamic loading." >&4;;
12768                 2)      echo "Test program failed using dlsym." >&4
12769                         echo "Perhaps you should not use dynamic loading." >&4;;
12770                 3)      echo "dlsym needs a leading underscore" >&4
12771                         val="$define" ;;
12772                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12773                 esac
12774         else
12775                 echo "I can't compile and run the test program." >&4
12776                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12777         fi
12778         ;;
12779 esac
12780
12781 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12782
12783 set d_dlsymun
12784 eval $setvar
12785
12786 : see if drand48_r exists
12787 set drand48_r d_drand48_r
12788 eval $inlibc
12789 case "$d_drand48_r" in
12790 "$define")
12791         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12792         case "$d_drand48_r_proto:$usethreads" in
12793         ":define")      d_drand48_r_proto=define
12794                 set d_drand48_r_proto drand48_r $hdrs
12795                 eval $hasproto ;;
12796         *)      ;;
12797         esac
12798         case "$d_drand48_r_proto" in
12799         define)
12800         case "$drand48_r_proto" in
12801         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12802         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12803         esac
12804         case "$drand48_r_proto" in
12805         ''|0)   d_drand48_r=undef
12806                 drand48_r_proto=0
12807                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12808         * )     case "$drand48_r_proto" in
12809                 REENTRANT_PROTO*) ;;
12810                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12811                 esac
12812                 echo "Prototype: $try" ;;
12813         esac
12814         ;;
12815         *)      case "$usethreads" in
12816                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12817                 esac
12818                 d_drand48_r=undef
12819                 drand48_r_proto=0
12820                 ;;
12821         esac
12822         ;;
12823 *)      drand48_r_proto=0
12824         ;;
12825 esac
12826
12827 : see if prototype for drand48 is available
12828 echo " "
12829 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12830 eval $hasproto
12831
12832 : see if dup2 exists
12833 set dup2 d_dup2
12834 eval $inlibc
12835
12836 : see if eaccess exists
12837 set eaccess d_eaccess
12838 eval $inlibc
12839
12840 : see if endgrent exists
12841 set endgrent d_endgrent
12842 eval $inlibc
12843
12844 : see if this is an grp system
12845 set grp.h i_grp
12846 eval $inhdr
12847
12848 case "$i_grp" in
12849 $define)
12850         xxx=`./findhdr grp.h`
12851         $cppstdin $cppflags $cppminus < $xxx >$$.h
12852
12853         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12854                 val="$define"
12855         else
12856                 val="$undef"
12857         fi
12858         set d_grpasswd
12859         eval $setvar
12860
12861         $rm -f $$.h
12862         ;;
12863 *)
12864         val="$undef";
12865         set d_grpasswd; eval $setvar
12866         ;;
12867 esac
12868
12869 : see if endgrent_r exists
12870 set endgrent_r d_endgrent_r
12871 eval $inlibc
12872 case "$d_endgrent_r" in
12873 "$define")
12874         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12875         case "$d_endgrent_r_proto:$usethreads" in
12876         ":define")      d_endgrent_r_proto=define
12877                 set d_endgrent_r_proto endgrent_r $hdrs
12878                 eval $hasproto ;;
12879         *)      ;;
12880         esac
12881         case "$d_endgrent_r_proto" in
12882         define)
12883         case "$endgrent_r_proto" in
12884         ''|0) try='int endgrent_r(FILE**);'
12885         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12886         esac
12887         case "$endgrent_r_proto" in
12888         ''|0) try='void endgrent_r(FILE**);'
12889         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12890         esac
12891         case "$endgrent_r_proto" in
12892         ''|0)   d_endgrent_r=undef
12893                 endgrent_r_proto=0
12894                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12895         * )     case "$endgrent_r_proto" in
12896                 REENTRANT_PROTO*) ;;
12897                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12898                 esac
12899                 echo "Prototype: $try" ;;
12900         esac
12901         ;;
12902         *)      case "$usethreads" in
12903                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12904                 esac
12905                 d_endgrent_r=undef
12906                 endgrent_r_proto=0
12907                 ;;
12908         esac
12909         ;;
12910 *)      endgrent_r_proto=0
12911         ;;
12912 esac
12913
12914 : see if endhostent exists
12915 set endhostent d_endhent
12916 eval $inlibc
12917
12918 : see if this is a netdb.h system
12919 set netdb.h i_netdb
12920 eval $inhdr
12921
12922 : see if endhostent_r exists
12923 set endhostent_r d_endhostent_r
12924 eval $inlibc
12925 case "$d_endhostent_r" in
12926 "$define")
12927         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12928         case "$d_endhostent_r_proto:$usethreads" in
12929         ":define")      d_endhostent_r_proto=define
12930                 set d_endhostent_r_proto endhostent_r $hdrs
12931                 eval $hasproto ;;
12932         *)      ;;
12933         esac
12934         case "$d_endhostent_r_proto" in
12935         define)
12936         case "$endhostent_r_proto" in
12937         ''|0) try='int endhostent_r(struct hostent_data*);'
12938         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12939         esac
12940         case "$endhostent_r_proto" in
12941         ''|0) try='void endhostent_r(struct hostent_data*);'
12942         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12943         esac
12944         case "$endhostent_r_proto" in
12945         ''|0)   d_endhostent_r=undef
12946                 endhostent_r_proto=0
12947                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12948         * )     case "$endhostent_r_proto" in
12949                 REENTRANT_PROTO*) ;;
12950                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12951                 esac
12952                 echo "Prototype: $try" ;;
12953         esac
12954         ;;
12955         *)      case "$usethreads" in
12956                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12957                 esac
12958                 d_endhostent_r=undef
12959                 endhostent_r_proto=0
12960                 ;;
12961         esac
12962         ;;
12963 *)      endhostent_r_proto=0
12964         ;;
12965 esac
12966
12967 : see if endnetent exists
12968 set endnetent d_endnent
12969 eval $inlibc
12970
12971 : see if endnetent_r exists
12972 set endnetent_r d_endnetent_r
12973 eval $inlibc
12974 case "$d_endnetent_r" in
12975 "$define")
12976         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12977         case "$d_endnetent_r_proto:$usethreads" in
12978         ":define")      d_endnetent_r_proto=define
12979                 set d_endnetent_r_proto endnetent_r $hdrs
12980                 eval $hasproto ;;
12981         *)      ;;
12982         esac
12983         case "$d_endnetent_r_proto" in
12984         define)
12985         case "$endnetent_r_proto" in
12986         ''|0) try='int endnetent_r(struct netent_data*);'
12987         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12988         esac
12989         case "$endnetent_r_proto" in
12990         ''|0) try='void endnetent_r(struct netent_data*);'
12991         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12992         esac
12993         case "$endnetent_r_proto" in
12994         ''|0)   d_endnetent_r=undef
12995                 endnetent_r_proto=0
12996                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12997         * )     case "$endnetent_r_proto" in
12998                 REENTRANT_PROTO*) ;;
12999                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
13000                 esac
13001                 echo "Prototype: $try" ;;
13002         esac
13003         ;;
13004         *)      case "$usethreads" in
13005                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
13006                 esac
13007                 d_endnetent_r=undef
13008                 endnetent_r_proto=0
13009                 ;;
13010         esac
13011         ;;
13012 *)      endnetent_r_proto=0
13013         ;;
13014 esac
13015
13016 : see if endprotoent exists
13017 set endprotoent d_endpent
13018 eval $inlibc
13019
13020 : see if endprotoent_r exists
13021 set endprotoent_r d_endprotoent_r
13022 eval $inlibc
13023 case "$d_endprotoent_r" in
13024 "$define")
13025         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13026         case "$d_endprotoent_r_proto:$usethreads" in
13027         ":define")      d_endprotoent_r_proto=define
13028                 set d_endprotoent_r_proto endprotoent_r $hdrs
13029                 eval $hasproto ;;
13030         *)      ;;
13031         esac
13032         case "$d_endprotoent_r_proto" in
13033         define)
13034         case "$endprotoent_r_proto" in
13035         ''|0) try='int endprotoent_r(struct protoent_data*);'
13036         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13037         esac
13038         case "$endprotoent_r_proto" in
13039         ''|0) try='void endprotoent_r(struct protoent_data*);'
13040         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13041         esac
13042         case "$endprotoent_r_proto" in
13043         ''|0)   d_endprotoent_r=undef
13044                 endprotoent_r_proto=0
13045                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13046         * )     case "$endprotoent_r_proto" in
13047                 REENTRANT_PROTO*) ;;
13048                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13049                 esac
13050                 echo "Prototype: $try" ;;
13051         esac
13052         ;;
13053         *)      case "$usethreads" in
13054                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13055                 esac
13056                 d_endprotoent_r=undef
13057                 endprotoent_r_proto=0
13058                 ;;
13059         esac
13060         ;;
13061 *)      endprotoent_r_proto=0
13062         ;;
13063 esac
13064
13065 : see if endpwent exists
13066 set endpwent d_endpwent
13067 eval $inlibc
13068
13069 : see if this is a pwd.h system
13070 set pwd.h i_pwd
13071 eval $inhdr
13072
13073 case "$i_pwd" in
13074 $define)
13075         xxx=`./findhdr pwd.h`
13076         $cppstdin $cppflags $cppminus < $xxx >$$.h
13077
13078         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13079                 val="$define"
13080         else
13081                 val="$undef"
13082         fi
13083         set d_pwquota
13084         eval $setvar
13085
13086         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13087                 val="$define"
13088         else
13089                 val="$undef"
13090         fi
13091         set d_pwage
13092         eval $setvar
13093
13094         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13095                 val="$define"
13096         else
13097                 val="$undef"
13098         fi
13099         set d_pwchange
13100         eval $setvar
13101
13102         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13103                 val="$define"
13104         else
13105                 val="$undef"
13106         fi
13107         set d_pwclass
13108         eval $setvar
13109
13110         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13111                 val="$define"
13112         else
13113                 val="$undef"
13114         fi
13115         set d_pwexpire
13116         eval $setvar
13117
13118         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13119                 val="$define"
13120         else
13121                 val="$undef"
13122         fi
13123         set d_pwcomment
13124         eval $setvar
13125
13126         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13127                 val="$define"
13128         else
13129                 val="$undef"
13130         fi
13131         set d_pwgecos
13132         eval $setvar
13133
13134         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13135                 val="$define"
13136         else
13137                 val="$undef"
13138         fi
13139         set d_pwpasswd
13140         eval $setvar
13141
13142         $rm -f $$.h
13143         ;;
13144 *)
13145         val="$undef";
13146         set d_pwquota; eval $setvar
13147         set d_pwage; eval $setvar
13148         set d_pwchange; eval $setvar
13149         set d_pwclass; eval $setvar
13150         set d_pwexpire; eval $setvar
13151         set d_pwcomment; eval $setvar
13152         set d_pwgecos; eval $setvar
13153         set d_pwpasswd; eval $setvar
13154         ;;
13155 esac
13156
13157 : see if endpwent_r exists
13158 set endpwent_r d_endpwent_r
13159 eval $inlibc
13160 case "$d_endpwent_r" in
13161 "$define")
13162         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13163         case "$d_endpwent_r_proto:$usethreads" in
13164         ":define")      d_endpwent_r_proto=define
13165                 set d_endpwent_r_proto endpwent_r $hdrs
13166                 eval $hasproto ;;
13167         *)      ;;
13168         esac
13169         case "$d_endpwent_r_proto" in
13170         define)
13171         case "$endpwent_r_proto" in
13172         ''|0) try='int endpwent_r(FILE**);'
13173         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13174         esac
13175         case "$endpwent_r_proto" in
13176         ''|0) try='void endpwent_r(FILE**);'
13177         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13178         esac
13179         case "$endpwent_r_proto" in
13180         ''|0)   d_endpwent_r=undef
13181                 endpwent_r_proto=0
13182                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13183         * )     case "$endpwent_r_proto" in
13184                 REENTRANT_PROTO*) ;;
13185                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13186                 esac
13187                 echo "Prototype: $try" ;;
13188         esac
13189         ;;
13190         *)      case "$usethreads" in
13191                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13192                 esac
13193                 d_endpwent_r=undef
13194                 endpwent_r_proto=0
13195                 ;;
13196         esac
13197         ;;
13198 *)      endpwent_r_proto=0
13199         ;;
13200 esac
13201
13202 : see if endservent exists
13203 set endservent d_endsent
13204 eval $inlibc
13205
13206 : see if endservent_r exists
13207 set endservent_r d_endservent_r
13208 eval $inlibc
13209 case "$d_endservent_r" in
13210 "$define")
13211         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13212         case "$d_endservent_r_proto:$usethreads" in
13213         ":define")      d_endservent_r_proto=define
13214                 set d_endservent_r_proto endservent_r $hdrs
13215                 eval $hasproto ;;
13216         *)      ;;
13217         esac
13218         case "$d_endservent_r_proto" in
13219         define)
13220         case "$endservent_r_proto" in
13221         ''|0) try='int endservent_r(struct servent_data*);'
13222         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13223         esac
13224         case "$endservent_r_proto" in
13225         ''|0) try='void endservent_r(struct servent_data*);'
13226         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13227         esac
13228         case "$endservent_r_proto" in
13229         ''|0)   d_endservent_r=undef
13230                 endservent_r_proto=0
13231                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13232         * )     case "$endservent_r_proto" in
13233                 REENTRANT_PROTO*) ;;
13234                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13235                 esac
13236                 echo "Prototype: $try" ;;
13237         esac
13238         ;;
13239         *)      case "$usethreads" in
13240                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13241                 esac
13242                 d_endservent_r=undef
13243                 endservent_r_proto=0
13244                 ;;
13245         esac
13246         ;;
13247 *)      endservent_r_proto=0
13248         ;;
13249 esac
13250
13251 : Locate the flags for 'open()'
13252 echo " "
13253 $cat >try.c <<EOCP
13254 #include <sys/types.h>
13255 #ifdef I_FCNTL
13256 #include <fcntl.h>
13257 #endif
13258 #ifdef I_SYS_FILE
13259 #include <sys/file.h>
13260 #endif
13261 #$i_stdlib I_STDLIB
13262 #ifdef I_STDLIB
13263 #include <stdlib.h>
13264 #endif
13265 int main() {
13266         if(O_RDONLY);
13267 #ifdef O_TRUNC
13268         exit(0);
13269 #else
13270         exit(1);
13271 #endif
13272 }
13273 EOCP
13274 : check sys/file.h first to get FREAD on Sun
13275 if $test `./findhdr sys/file.h` && \
13276                 set try -DI_SYS_FILE && eval $compile; then
13277         h_sysfile=true;
13278         echo "<sys/file.h> defines the O_* constants..." >&4
13279         if $run ./try; then
13280                 echo "and you have the 3 argument form of open()." >&4
13281                 val="$define"
13282         else
13283                 echo "but not the 3 argument form of open().  Oh, well." >&4
13284                 val="$undef"
13285         fi
13286 elif $test `./findhdr fcntl.h` && \
13287                 set try -DI_FCNTL && eval $compile; then
13288         h_fcntl=true;
13289         echo "<fcntl.h> defines the O_* constants..." >&4
13290         if $run ./try; then
13291                 echo "and you have the 3 argument form of open()." >&4
13292                 val="$define"
13293         else
13294                 echo "but not the 3 argument form of open().  Oh, well." >&4
13295                 val="$undef"
13296         fi
13297 else
13298         val="$undef"
13299         echo "I can't find the O_* constant definitions!  You got problems." >&4
13300 fi
13301 set d_open3
13302 eval $setvar
13303 $rm_try
13304
13305 : see if this is a sys/file.h system
13306 val=''
13307 set sys/file.h val
13308 eval $inhdr
13309
13310 : do we need to include sys/file.h ?
13311 case "$val" in
13312 "$define")
13313         echo " "
13314         if $h_sysfile; then
13315                 val="$define"
13316                 echo "We'll be including <sys/file.h>." >&4
13317         else
13318                 val="$undef"
13319                 echo "We won't be including <sys/file.h>." >&4
13320         fi
13321         ;;
13322 *)
13323         h_sysfile=false
13324         ;;
13325 esac
13326 set i_sysfile
13327 eval $setvar
13328
13329 : see if fcntl.h is there
13330 val=''
13331 set fcntl.h val
13332 eval $inhdr
13333
13334 : see if we can include fcntl.h
13335 case "$val" in
13336 "$define")
13337         echo " "
13338         if $h_fcntl; then
13339                 val="$define"
13340                 echo "We'll be including <fcntl.h>." >&4
13341         else
13342                 val="$undef"
13343                 if $h_sysfile; then
13344         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13345                 else
13346                         echo "We won't be including <fcntl.h>." >&4
13347                 fi
13348         fi
13349         ;;
13350 *)
13351         h_fcntl=false
13352         val="$undef"
13353         ;;
13354 esac
13355 set i_fcntl
13356 eval $setvar
13357
13358 : see if fork exists
13359 set fork d_fork
13360 eval $inlibc
13361
13362 : see if pipe exists
13363 set pipe d_pipe
13364 eval $inlibc
13365
13366 : check for non-blocking I/O stuff
13367 case "$h_sysfile" in
13368 true) echo "#include <sys/file.h>" > head.c;;
13369 *)
13370        case "$h_fcntl" in
13371        true) echo "#include <fcntl.h>" > head.c;;
13372        *) echo "#include <sys/fcntl.h>" > head.c;;
13373        esac
13374        ;;
13375 esac
13376 echo " "
13377 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13378 case "$o_nonblock" in
13379 '')
13380         $cat head.c > try.c
13381         $cat >>try.c <<EOCP
13382 #include <stdio.h>
13383 #$i_stdlib I_STDLIB
13384 #ifdef I_STDLIB
13385 #include <stdlib.h>
13386 #endif
13387 #$i_fcntl I_FCNTL
13388 #ifdef I_FCNTL
13389 #include <fcntl.h>
13390 #endif
13391 int main() {
13392 #ifdef O_NONBLOCK
13393         printf("O_NONBLOCK\n");
13394         exit(0);
13395 #endif
13396 #ifdef O_NDELAY
13397         printf("O_NDELAY\n");
13398         exit(0);
13399 #endif
13400 #ifdef FNDELAY
13401         printf("FNDELAY\n");
13402         exit(0);
13403 #endif
13404         exit(0);
13405 }
13406 EOCP
13407         set try
13408         if eval $compile_ok; then
13409                 o_nonblock=`$run ./try`
13410                 case "$o_nonblock" in
13411                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13412                 *) echo "Seems like we can use $o_nonblock.";;
13413                 esac
13414         else
13415                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13416         fi
13417         ;;
13418 *) echo "Using $hint value $o_nonblock.";;
13419 esac
13420 $rm_try
13421
13422 echo " "
13423 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13424 case "$eagain" in
13425 '')
13426         case "$d_fork:$d_pipe:$d_alarm" in
13427         define:define:define)
13428         $cat head.c > try.c
13429         $cat >>try.c <<EOCP
13430 #include <errno.h>
13431 #include <sys/types.h>
13432 #include <signal.h>
13433 #include <stdio.h>
13434 #$i_stdlib I_STDLIB
13435 #ifdef I_STDLIB
13436 #include <stdlib.h>
13437 #endif
13438 #$i_fcntl I_FCNTL
13439 #ifdef I_FCNTL
13440 #include <fcntl.h>
13441 #endif
13442 #define MY_O_NONBLOCK $o_nonblock
13443 #ifndef errno  /* XXX need better Configure test */
13444 extern int errno;
13445 #endif
13446 #$i_unistd I_UNISTD
13447 #ifdef I_UNISTD
13448 #include <unistd.h>
13449 #endif
13450 #$i_string I_STRING
13451 #ifdef I_STRING
13452 #include <string.h>
13453 #else
13454 #include <strings.h>
13455 #endif
13456 $signal_t blech(int x) { exit(3); }
13457 EOCP
13458         $cat >> try.c <<'EOCP'
13459 int main()
13460 {
13461         int pd[2];
13462         int pu[2];
13463         char buf[1];
13464         char string[100];
13465         int ret;
13466
13467         ret = pipe(pd); /* Down: child -> parent */
13468         if (ret != 0)
13469                 exit(3);
13470         ret = pipe(pu); /* Up: parent -> child */
13471         if (ret != 0)
13472                 exit(3);
13473         if (0 != fork()) {
13474                 close(pd[1]);   /* Parent reads from pd[0] */
13475                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13476 #ifdef F_SETFL
13477                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13478                         exit(1);
13479 #else
13480                 exit(4);
13481 #endif
13482                 signal(SIGALRM, blech);
13483                 alarm(5);
13484                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13485                         exit(2);
13486                 sprintf(string, "%d\n", ret);
13487                 ret = write(2, string, strlen(string));
13488                 if (ret != strlen(string))
13489                         exit(3);
13490                 alarm(0);
13491 #ifdef EAGAIN
13492                 if (errno == EAGAIN) {
13493                         printf("EAGAIN\n");
13494                         goto ok;
13495                 }
13496 #endif
13497 #ifdef EWOULDBLOCK
13498                 if (errno == EWOULDBLOCK)
13499                         printf("EWOULDBLOCK\n");
13500 #endif
13501         ok:
13502                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13503                 if (ret != 1)
13504                         exit(3);
13505                 sleep(2);                               /* Give it time to close our pipe */
13506                 alarm(5);
13507                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13508                 alarm(0);
13509                 sprintf(string, "%d\n", ret);
13510                 ret = write(4, string, strlen(string));
13511                 if (ret != strlen(string))
13512                         exit(3);
13513                 exit(0);
13514         }
13515
13516         close(pd[0]);                   /* We write to pd[1] */
13517         close(pu[1]);                   /* We read from pu[0] */
13518         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13519         if (ret != 1)
13520                 exit(3);
13521         close(pd[1]);                   /* Pipe pd is now fully closed! */
13522         exit(0);                                /* Bye bye, thank you for playing! */
13523 }
13524 EOCP
13525         set try
13526         if eval $compile_ok; then
13527                 echo "$startsh" >mtry
13528                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13529                 chmod +x mtry
13530                 $run ./mtry >/dev/null 2>&1
13531                 case $? in
13532                 0) eagain=`$cat try.out`;;
13533                 1) echo "Could not perform non-blocking setting!";;
13534                 2) echo "I did a successful read() for something that was not there!";;
13535                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13536                 4) echo "Could not find F_SETFL!";;
13537                 *) echo "Something terribly wrong happened during testing.";;
13538                 esac
13539                 rd_nodata=`$cat try.ret`
13540                 echo "A read() system call with no data present returns $rd_nodata."
13541                 case "$rd_nodata" in
13542                 0|-1) ;;
13543                 *)
13544                         echo "(That's peculiar, fixing that to be -1.)"
13545                         rd_nodata=-1
13546                         ;;
13547                 esac
13548                 case "$eagain" in
13549                 '')
13550                         echo "Forcing errno EAGAIN on read() with no data available."
13551                         eagain=EAGAIN
13552                         ;;
13553                 *)
13554                         echo "Your read() sets errno to $eagain when no data is available."
13555                         ;;
13556                 esac
13557                 status=`$cat try.err`
13558                 case "$status" in
13559                 0) echo "And it correctly returns 0 to signal EOF.";;
13560                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13561                 *) echo "However, your read() returns '$status' on EOF??";;
13562                 esac
13563                 val="$define"
13564                 if test "$status" = "$rd_nodata"; then
13565                         echo "WARNING: you can't distinguish between EOF and no data!"
13566                         val="$undef"
13567                 fi
13568         else
13569                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13570                 eagain=EAGAIN
13571         fi
13572         ;;
13573         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13574                 eagain=EAGAIN
13575                 val="$define"
13576                 ;;
13577         esac
13578         set d_eofnblk
13579         eval $setvar
13580         ;;
13581 *)
13582         echo "Using $hint value $eagain."
13583         echo "Your read() returns $rd_nodata when no data is present."
13584         case "$d_eofnblk" in
13585         "$define") echo "And you can see EOF because read() returns 0.";;
13586         "$undef") echo "But you can't see EOF status from read() returned value.";;
13587         *)
13588                 echo "(Assuming you can't see EOF status from read anyway.)"
13589                 d_eofnblk=$undef
13590                 ;;
13591         esac
13592         ;;
13593 esac
13594 $rm_try head.c mtry
13595
13596 : see if erf exists
13597 set erf d_erf
13598 eval $inlibc
13599
13600 : see if erfc exists
13601 set erfc d_erfc
13602 eval $inlibc
13603
13604 : see if exp2 exists
13605 set exp2 d_exp2
13606 eval $inlibc
13607
13608 : see if expm1 exists
13609 set expm1 d_expm1
13610 eval $inlibc
13611
13612 : see if _ptr and _cnt from stdio act std
13613 echo " "
13614
13615 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13616         echo "(Looks like you have stdio.h from BSD.)"
13617         case "$stdio_ptr" in
13618         '') stdio_ptr='((fp)->_p)'
13619                 ptr_lval=$define
13620                 ;;
13621         *)      ptr_lval=$d_stdio_ptr_lval;;
13622         esac
13623         case "$stdio_cnt" in
13624         '') stdio_cnt='((fp)->_r)'
13625                 cnt_lval=$define
13626                 ;;
13627         *)      cnt_lval=$d_stdio_cnt_lval;;
13628         esac
13629         case "$stdio_base" in
13630         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13631         esac
13632         case "$stdio_bufsiz" in
13633         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13634         esac
13635 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13636         echo "(Looks like you have stdio.h from Linux.)"
13637         case "$stdio_ptr" in
13638         '') stdio_ptr='((fp)->_IO_read_ptr)'
13639                 ptr_lval=$define
13640                 ;;
13641         *)      ptr_lval=$d_stdio_ptr_lval;;
13642         esac
13643         case "$stdio_cnt" in
13644         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13645                 cnt_lval=$undef
13646                 ;;
13647         *)      cnt_lval=$d_stdio_cnt_lval;;
13648         esac
13649         case "$stdio_base" in
13650         '') stdio_base='((fp)->_IO_read_base)';;
13651         esac
13652         case "$stdio_bufsiz" in
13653         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13654         esac
13655 else
13656         case "$stdio_ptr" in
13657         '') stdio_ptr='((fp)->_ptr)'
13658                 ptr_lval=$define
13659                 ;;
13660         *)      ptr_lval=$d_stdio_ptr_lval;;
13661         esac
13662         case "$stdio_cnt" in
13663         '') stdio_cnt='((fp)->_cnt)'
13664                 cnt_lval=$define
13665                 ;;
13666         *)      cnt_lval=$d_stdio_cnt_lval;;
13667         esac
13668         case "$stdio_base" in
13669         '') stdio_base='((fp)->_base)';;
13670         esac
13671         case "$stdio_bufsiz" in
13672         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13673         esac
13674 fi
13675
13676 : test whether _ptr and _cnt really work
13677 echo "Checking how std your stdio is..." >&4
13678 $cat >try.c <<EOP
13679 #include <stdio.h>
13680 #$i_stdlib I_STDLIB
13681 #ifdef I_STDLIB
13682 #include <stdlib.h>
13683 #endif
13684 #define FILE_ptr(fp)    $stdio_ptr
13685 #define FILE_cnt(fp)    $stdio_cnt
13686 int main() {
13687         FILE *fp = fopen("try.c", "r");
13688         char c = getc(fp);
13689         if (
13690                 18 <= FILE_cnt(fp) &&
13691                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13692         )
13693                 exit(0);
13694         exit(1);
13695 }
13696 EOP
13697 val="$undef"
13698 set try
13699 if eval $compile && $to try.c; then
13700         if $run ./try; then
13701                 echo "Your stdio acts pretty std."
13702                 val="$define"
13703         else
13704                 echo "Your stdio isn't very std."
13705         fi
13706 else
13707         echo "Your stdio doesn't appear very std."
13708 fi
13709 $rm_try
13710
13711 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13712 # direct buffer manipulation no longer works.  The Configure tests
13713 # should be changed to correctly detect this, but until then,
13714 # the following check should at least let perl compile and run.
13715 # (This quick fix should be updated before 5.8.1.)
13716 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13717 # A. Dougherty, June 3, 2002.
13718 case "$d_gnulibc" in
13719 $define)
13720         case "$gnulibc_version" in
13721         2.[01]*)  ;;
13722         2.2) ;;
13723         2.2.[0-9]) ;;
13724         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13725                 val="$undef"
13726                 ;;
13727         esac
13728         ;;
13729 esac
13730 set d_stdstdio
13731 eval $setvar
13732
13733 : Can _ptr be used as an lvalue?
13734 case "$d_stdstdio$ptr_lval" in
13735 $define$define) val=$define ;;
13736 *) val=$undef ;;
13737 esac
13738 set d_stdio_ptr_lval
13739 eval $setvar
13740
13741 : Can _cnt be used as an lvalue?
13742 case "$d_stdstdio$cnt_lval" in
13743 $define$define) val=$define ;;
13744 *) val=$undef ;;
13745 esac
13746 set d_stdio_cnt_lval
13747 eval $setvar
13748
13749
13750 : test whether setting _ptr sets _cnt as a side effect
13751 d_stdio_ptr_lval_sets_cnt="$undef"
13752 d_stdio_ptr_lval_nochange_cnt="$undef"
13753 case "$d_stdio_ptr_lval$d_stdstdio" in
13754 $define$define)
13755         echo "Checking to see what happens if we set the stdio ptr..." >&4
13756 $cat >try.c <<EOP
13757 #include <stdio.h>
13758 /* Can we scream? */
13759 /* Eat dust sed :-) */
13760 /* In the buffer space, no one can hear you scream. */
13761 #$i_stdlib I_STDLIB
13762 #ifdef I_STDLIB
13763 #include <stdlib.h>
13764 #endif
13765 #define FILE_ptr(fp)    $stdio_ptr
13766 #define FILE_cnt(fp)    $stdio_cnt
13767 #include <sys/types.h>
13768 int main() {
13769         FILE *fp = fopen("try.c", "r");
13770         int c;
13771         char *ptr;
13772         size_t cnt;
13773         if (!fp) {
13774             puts("Fail even to read");
13775             exit(1);
13776         }
13777         c = getc(fp); /* Read away the first # */
13778         if (c == EOF) {
13779             puts("Fail even to read");
13780             exit(1);
13781         }
13782         if (!(
13783                 18 <= FILE_cnt(fp) &&
13784                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13785         )) {
13786                 puts("Fail even to read");
13787                 exit (1);
13788         }
13789         ptr = (char*) FILE_ptr(fp);
13790         cnt = (size_t)FILE_cnt(fp);
13791
13792         FILE_ptr(fp) += 42;
13793
13794         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13795                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13796                 exit (1);
13797         }
13798         if (FILE_cnt(fp) <= 20) {
13799                 printf ("Fail (<20 chars to test)");
13800                 exit (1);
13801         }
13802         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13803                 puts("Fail compare");
13804                 exit (1);
13805         }
13806         if (cnt == FILE_cnt(fp)) {
13807                 puts("Pass_unchanged");
13808                 exit (0);
13809         }
13810         if (FILE_cnt(fp) == (cnt - 42)) {
13811                 puts("Pass_changed");
13812                 exit (0);
13813         }
13814         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13815         return 1;
13816
13817 }
13818 EOP
13819         set try
13820         if eval $compile && $to try.c; then
13821                 case `$run ./try` in
13822                 Pass_changed)
13823                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13824                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13825                 Pass_unchanged)
13826                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13827                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13828                 Fail*)
13829                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13830                 *)
13831                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13832         esac
13833         else
13834                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13835         fi
13836         $rm_try
13837         ;;
13838 esac
13839
13840 : see if _base is also standard
13841 val="$undef"
13842 case "$d_stdstdio" in
13843 $define)
13844         $cat >try.c <<EOP
13845 #include <stdio.h>
13846 #$i_stdlib I_STDLIB
13847 #ifdef I_STDLIB
13848 #include <stdlib.h>
13849 #endif
13850 #define FILE_base(fp)   $stdio_base
13851 #define FILE_bufsiz(fp) $stdio_bufsiz
13852 int main() {
13853         FILE *fp = fopen("try.c", "r");
13854         char c = getc(fp);
13855         if (
13856                 19 <= FILE_bufsiz(fp) &&
13857                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13858         )
13859                 exit(0);
13860         exit(1);
13861 }
13862 EOP
13863         set try
13864         if eval $compile && $to try.c; then
13865                 if $run ./try; then
13866                         echo "And its _base field acts std."
13867                         val="$define"
13868                 else
13869                         echo "But its _base field isn't std."
13870                 fi
13871         else
13872                 echo "However, it seems to be lacking the _base field."
13873         fi
13874         $rm_try
13875         ;;
13876 esac
13877 set d_stdiobase
13878 eval $setvar
13879
13880 : see if fast_stdio exists
13881 val="$undef"
13882 case "$d_stdstdio:$d_stdio_ptr_lval" in
13883 "$define:$define")
13884         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13885         *$define*)
13886                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13887                 val="$define"
13888                 ;;
13889         esac
13890         ;;
13891 esac
13892 set d_faststdio
13893 eval $setvar
13894
13895
13896
13897 : see if fchdir exists
13898 set fchdir d_fchdir
13899 eval $inlibc
13900
13901 : see if fchmod exists
13902 set fchmod d_fchmod
13903 eval $inlibc
13904
13905 : see if fchown exists
13906 set fchown d_fchown
13907 eval $inlibc
13908
13909 : see if this is an fcntl system
13910 set fcntl d_fcntl
13911 eval $inlibc
13912
13913 : See if fcntl-based locking works.
13914 echo " "
13915 $cat >try.c <<EOCP
13916 #$i_stdlib I_STDLIB
13917 #ifdef I_STDLIB
13918 #include <stdlib.h>
13919 #endif
13920 #include <unistd.h>
13921 #include <fcntl.h>
13922 #include <signal.h>
13923 $signal_t blech(int x) { exit(3); }
13924 int main() {
13925 #if defined(F_SETLK) && defined(F_SETLKW)
13926      struct flock flock;
13927      int retval, fd;
13928      fd = open("try.c", O_RDONLY);
13929      flock.l_type = F_RDLCK;
13930      flock.l_whence = SEEK_SET;
13931      flock.l_start = flock.l_len = 0;
13932      signal(SIGALRM, blech);
13933      alarm(10);
13934      retval = fcntl(fd, F_SETLK, &flock);
13935      close(fd);
13936      (retval < 0 ? exit(2) : exit(0));
13937 #else
13938      exit(2);
13939 #endif
13940 }
13941 EOCP
13942 echo "Checking if fcntl-based file locking works... "
13943 case "$d_fcntl" in
13944 "$define")
13945         set try
13946         if eval $compile_ok; then
13947                 if $run ./try; then
13948                         echo "Yes, it seems to work."
13949                         val="$define"
13950                 else
13951                         echo "Nope, it didn't work."
13952                         val="$undef"
13953                         case "$?" in
13954                         3) $cat >&4 <<EOM
13955 ***
13956 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13957 *** This is (almost) impossible.
13958 *** If your NFS lock daemons are not feeling well, something like
13959 *** this may happen, please investigate.  Cannot continue, aborting.
13960 ***
13961 EOM
13962                                 exit 1
13963                                 ;;
13964                         esac
13965                 fi
13966         else
13967                 echo "I'm unable to compile the test program, so I'll assume not."
13968                 val="$undef"
13969         fi
13970         ;;
13971 *) val="$undef";
13972         echo "Nope, since you don't even have fcntl()."
13973         ;;
13974 esac
13975 set d_fcntl_can_lock
13976 eval $setvar
13977 $rm_try
13978
13979 : check for fd_set items
13980 $cat <<EOM
13981
13982 Checking to see how well your C compiler handles fd_set and friends ...
13983 EOM
13984 $cat >try.c <<EOCP
13985 #$i_stdlib I_STDLIB
13986 #ifdef I_STDLIB
13987 #include <stdlib.h>
13988 #endif
13989 #$i_systime I_SYS_TIME
13990 #$i_sysselct I_SYS_SELECT
13991 #$d_socket HAS_SOCKET
13992 #include <sys/types.h>
13993 #ifdef HAS_SOCKET
13994 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13995 #endif
13996 #ifdef I_SYS_TIME
13997 #include <sys/time.h>
13998 #endif
13999 #ifdef I_SYS_SELECT
14000 #include <sys/select.h>
14001 #endif
14002 int main() {
14003         fd_set fds;
14004
14005 #ifdef TRYBITS
14006         if(fds.fds_bits);
14007 #endif
14008
14009 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
14010         exit(0);
14011 #else
14012         exit(1);
14013 #endif
14014 }
14015 EOCP
14016 set try -DTRYBITS
14017 if eval $compile; then
14018         d_fds_bits="$define"
14019         d_fd_set="$define"
14020         echo "Well, your system knows about the normal fd_set typedef..." >&4
14021         if $run ./try; then
14022                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14023                 d_fd_macros="$define"
14024         else
14025                 $cat >&4 <<'EOM'
14026 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
14027 EOM
14028                 d_fd_macros="$undef"
14029         fi
14030 else
14031         $cat <<'EOM'
14032 Hmm, your compiler has some difficulty with fd_set.  Checking further...
14033 EOM
14034         set try
14035         if eval $compile; then
14036                 d_fds_bits="$undef"
14037                 d_fd_set="$define"
14038                 echo "Well, your system has some sort of fd_set available..." >&4
14039                 if $run ./try; then
14040                         echo "and you have the normal fd_set macros." >&4
14041                         d_fd_macros="$define"
14042                 else
14043                         $cat <<'EOM'
14044 but not the normal fd_set macros!  Gross!  More work for me...
14045 EOM
14046                         d_fd_macros="$undef"
14047                 fi
14048         else
14049         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14050                 d_fd_set="$undef"
14051                 d_fds_bits="$undef"
14052                 d_fd_macros="$undef"
14053         fi
14054 fi
14055 $rm_try
14056
14057 : see if fdclose exists
14058 set fdclose d_fdclose
14059 eval $inlibc
14060
14061 : see if fdim exists
14062 set fdim d_fdim
14063 eval $inlibc
14064
14065 : see if fegetround exists
14066 set fegetround d_fegetround
14067 eval $inlibc
14068
14069 : see if fgetpos exists
14070 set fgetpos d_fgetpos
14071 eval $inlibc
14072
14073 : see if finite exists
14074 set finite d_finite
14075 eval $inlibc
14076
14077 : see if finitel exists
14078 set finitel d_finitel
14079 eval $inlibc
14080
14081 : see if flock exists
14082 set flock d_flock
14083 eval $inlibc
14084
14085 : see if prototype for flock is available
14086 echo " "
14087 set d_flockproto flock $i_sysfile sys/file.h
14088 eval $hasproto
14089
14090 : see if fma exists
14091 set fma d_fma
14092 eval $inlibc
14093
14094 : see if fmax exists
14095 set fmax d_fmax
14096 eval $inlibc
14097
14098 : see if fmin exists
14099 set fmin d_fmin
14100 eval $inlibc
14101
14102 : see if fp_class exists
14103 set fp_class d_fp_class
14104 eval $inlibc
14105
14106 : see if this is a math.h system
14107 set math.h i_math
14108 eval $inhdr
14109
14110 : check for fpclassify
14111 echo "Checking to see if you have fpclassify..." >&4
14112 $cat >try.c <<EOCP
14113 #$i_math I_MATH
14114 #ifdef I_MATH
14115 #include <math.h>
14116 #endif
14117 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14118 EOCP
14119 set try
14120 if eval $compile; then
14121         val="$define"
14122         echo "You have fpclassify."
14123 else
14124         val="$undef"
14125         echo "You do not have fpclassify."
14126 fi
14127 $rm_try
14128 set d_fpclassify
14129 eval $setvar
14130
14131 : see if fp_classify exists
14132 set fp_classify d_fp_classify
14133 eval $inlibc
14134
14135 : see if fp_classl exists
14136 set fp_classl d_fp_classl
14137 eval $inlibc
14138
14139 : see if pathconf exists
14140 set pathconf d_pathconf
14141 eval $inlibc
14142
14143 : see if fpathconf exists
14144 set fpathconf d_fpathconf
14145 eval $inlibc
14146
14147 : see if fpclass exists
14148 set fpclass d_fpclass
14149 eval $inlibc
14150
14151 : see if fpclassl exists
14152 set fpclassl d_fpclassl
14153 eval $inlibc
14154
14155 : see if fpgetround exists
14156 set fpgetround d_fpgetround
14157 eval $inlibc
14158
14159 : check for fpos64_t
14160 echo " "
14161 echo "Checking to see if you have fpos64_t..." >&4
14162 $cat >try.c <<EOCP
14163 #include <stdio.h>
14164 int main() { fpos64_t x = 7; }
14165 EOCP
14166 set try
14167 if eval $compile; then
14168         val="$define"
14169         echo "You have fpos64_t."
14170 else
14171         val="$undef"
14172         echo "You do not have fpos64_t."
14173         case "$fpossize" in
14174         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14175         esac
14176 fi
14177 $rm_try
14178 set d_fpos64_t
14179 eval $setvar
14180
14181 : see if this is an xlocale.h system
14182 set xlocale.h i_xlocale
14183 eval $inhdr
14184
14185 : see if newlocale exists
14186 set newlocale d_newlocale
14187 eval $inlibc
14188
14189 : see if freelocale exists
14190 set freelocale d_freelocale
14191 eval $inlibc
14192
14193 : see if uselocale exists
14194 set uselocale d_uselocale
14195 eval $inlibc
14196
14197 : see if duplocale exists
14198 set duplocale d_duplocale
14199 eval $inlibc
14200
14201 : see if querylocale exists
14202 set querylocale d_querylocale
14203 eval $inlibc
14204
14205 : see if frexpl exists
14206 set frexpl d_frexpl
14207 eval $inlibc
14208
14209 : see if this is a sys/param system
14210 set sys/param.h i_sysparam
14211 eval $inhdr
14212
14213 : see if this is a sys/mount.h system
14214 set sys/mount.h i_sysmount
14215 eval $inhdr
14216
14217 : Check for fs_data_s
14218 echo " "
14219 echo "Checking to see if your system supports struct fs_data..." >&4
14220 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14221 eval $hasstruct
14222 case "$d_fs_data_s" in
14223 "$define")      echo "Yes, it does."   ;;
14224 *)              echo "No, it doesn't." ;;
14225 esac
14226
14227 : see if fseeko exists
14228 set fseeko d_fseeko
14229 eval $inlibc
14230 case "$longsize" in
14231 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14232 esac
14233
14234 : see if fsetpos exists
14235 set fsetpos d_fsetpos
14236 eval $inlibc
14237
14238 : see if fstatfs exists
14239 set fstatfs d_fstatfs
14240 eval $inlibc
14241
14242 : see if statvfs exists
14243 set statvfs d_statvfs
14244 eval $inlibc
14245
14246 : see if fstatvfs exists
14247 set fstatvfs d_fstatvfs
14248 eval $inlibc
14249
14250
14251 : see if fsync exists
14252 set fsync d_fsync
14253 eval $inlibc
14254
14255 : see if ftello exists
14256 set ftello d_ftello
14257 eval $inlibc
14258 case "$longsize" in
14259 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14260 esac
14261
14262 : check for a working futimes
14263 d_futimes="$undef"
14264 echo " "
14265 echo "Checking if you have a working futimes()" >&4
14266 $cat >try.c <<EOCP
14267 #include <stdio.h>
14268 #include <sys/time.h>
14269 #include <errno.h>
14270 #include <fcntl.h>
14271
14272 int main ()
14273 {
14274     int fd, rv;
14275     fd = open ("try.c", O_RDWR);
14276     if (-1 == fd) exit (1);
14277     rv = futimes (fd, NULL);
14278     exit (rv == -1 ? errno : 0);
14279 }
14280 EOCP
14281 set try
14282 if eval $compile; then
14283     `$run ./try`
14284     rc=$?
14285     case "$rc" in
14286         0)  echo "Yes, you have" >&4
14287             d_futimes="$define"
14288             ;;
14289         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14290             ;;
14291     esac
14292 else
14293     echo "No, it does not (probably harmless)" >&4
14294 fi
14295 $rm_try
14296
14297 : look for gai_strerror
14298 echo " "
14299 $cat >try.c <<'EOCP'
14300 #include <sys/types.h>
14301 #include <sys/socket.h>
14302 #include <netdb.h>
14303 int main ()
14304 {
14305     return (gai_strerror (0) ? 0 : 1);
14306     }
14307 EOCP
14308 set try
14309 val="$undef"
14310 if eval $compile; then
14311     `$run ./try`
14312     case "$?" in
14313         0)  echo "A working gai_strerror() found." >&4
14314             val="$define" ;;
14315         *)  echo "gai_strerror() found, but it doesn't work" >&4
14316             ;;
14317         esac
14318 else
14319     echo "gai_strerror() NOT found." >&4
14320     fi
14321 set d_gai_strerror
14322 eval $setvar
14323 $rm_try
14324
14325 : see if ndbm.h is available
14326 set ndbm.h i_ndbm
14327 eval $inhdr
14328 : Compatibility location for RedHat 7.1
14329 set gdbm/ndbm.h i_gdbmndbm
14330 eval $inhdr
14331 : Compatibility location for Debian 4.0
14332 set gdbm-ndbm.h i_gdbm_ndbm
14333 eval $inhdr
14334
14335 val="$undef"
14336 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14337         : see if dbm_open exists
14338         set dbm_open d_dbm_open
14339         eval $inlibc
14340         case "$d_dbm_open" in
14341         $undef)
14342                 i_ndbm="$undef"
14343                 i_gdbmndbm="$undef"
14344                 i_gdbm_ndbm="$undef"
14345                 echo "We won't be including <ndbm.h>"
14346                 val="$undef"
14347                 ;;
14348         *) val="$define"
14349            ;;
14350         esac
14351 fi
14352 set d_ndbm
14353 eval $setvar
14354
14355 ndbm_hdr_protochk='name=$1; hdr=$2;
14356 eval "ihdr=\$""i_$name";
14357 val="$undef";
14358 if $test "$ihdr" = "$define"; then
14359         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14360         case "$d_cplusplus" in
14361         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14362         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14363         esac;
14364         case "$val" in
14365         $define) $echo "Your <$hdr> seems to have prototypes";;
14366         *) $echo "Your <$hdr> does not seem to have prototypes";;
14367         esac;
14368 fi;
14369 set "d_${name}_h_uses_prototypes";
14370 eval $setvar'
14371
14372 set ndbm ndbm.h
14373 eval $ndbm_hdr_protochk
14374 set gdbmndbm gdbm/ndbm.h
14375 eval $ndbm_hdr_protochk
14376 set gdbm_ndbm gdbm-ndbm.h
14377 eval $ndbm_hdr_protochk
14378
14379 : see if getaddrinfo exists
14380 set getaddrinfo d_getaddrinfo
14381 eval $inlibc
14382
14383 : see if getcwd exists
14384 set getcwd d_getcwd
14385 eval $inlibc
14386
14387 : see if getespwnam exists
14388 set getespwnam d_getespwnam
14389 eval $inlibc
14390
14391 : see if getfsstat exists
14392 set getfsstat d_getfsstat
14393 eval $inlibc
14394
14395 : see if getgrent exists
14396 set getgrent d_getgrent
14397 eval $inlibc
14398
14399 : see if getgrent_r exists
14400 set getgrent_r d_getgrent_r
14401 eval $inlibc
14402 case "$d_getgrent_r" in
14403 "$define")
14404         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14405         case "$d_getgrent_r_proto:$usethreads" in
14406         ":define")      d_getgrent_r_proto=define
14407                 set d_getgrent_r_proto getgrent_r $hdrs
14408                 eval $hasproto ;;
14409         *)      ;;
14410         esac
14411         case "$d_getgrent_r_proto" in
14412         define)
14413         case "$getgrent_r_proto" in
14414         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14415         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14416         esac
14417         case "$getgrent_r_proto" in
14418         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14419         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14420         esac
14421         case "$getgrent_r_proto" in
14422         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14423         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14424         esac
14425         case "$getgrent_r_proto" in
14426         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14427         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14428         esac
14429         case "$getgrent_r_proto" in
14430         ''|0) try='int getgrent_r(struct group*, char*, int);'
14431         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14432         esac
14433         case "$getgrent_r_proto" in
14434         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14435         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14436         esac
14437         case "$getgrent_r_proto" in
14438         ''|0)   d_getgrent_r=undef
14439                 getgrent_r_proto=0
14440                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14441         * )     case "$getgrent_r_proto" in
14442                 REENTRANT_PROTO*) ;;
14443                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14444                 esac
14445                 echo "Prototype: $try" ;;
14446         esac
14447         ;;
14448         *)      case "$usethreads" in
14449                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14450                 esac
14451                 d_getgrent_r=undef
14452                 getgrent_r_proto=0
14453                 ;;
14454         esac
14455         ;;
14456 *)      getgrent_r_proto=0
14457         ;;
14458 esac
14459
14460 : see if getgrgid_r exists
14461 set getgrgid_r d_getgrgid_r
14462 eval $inlibc
14463 case "$d_getgrgid_r" in
14464 "$define")
14465         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14466         case "$d_getgrgid_r_proto:$usethreads" in
14467         ":define")      d_getgrgid_r_proto=define
14468                 set d_getgrgid_r_proto getgrgid_r $hdrs
14469                 eval $hasproto ;;
14470         *)      ;;
14471         esac
14472         case "$d_getgrgid_r_proto" in
14473         define)
14474         case "$getgrgid_r_proto" in
14475         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14476         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14477         esac
14478         case "$getgrgid_r_proto" in
14479         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14480         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14481         esac
14482         case "$getgrgid_r_proto" in
14483         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14484         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14485         esac
14486         case "$getgrgid_r_proto" in
14487         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14488         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14489         esac
14490         case "$getgrgid_r_proto" in
14491         ''|0)   d_getgrgid_r=undef
14492                 getgrgid_r_proto=0
14493                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14494         * )     case "$getgrgid_r_proto" in
14495                 REENTRANT_PROTO*) ;;
14496                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14497                 esac
14498                 echo "Prototype: $try" ;;
14499         esac
14500         ;;
14501         *)      case "$usethreads" in
14502                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14503                 esac
14504                 d_getgrgid_r=undef
14505                 getgrgid_r_proto=0
14506                 ;;
14507         esac
14508         ;;
14509 *)      getgrgid_r_proto=0
14510         ;;
14511 esac
14512
14513 : see if getgrnam_r exists
14514 set getgrnam_r d_getgrnam_r
14515 eval $inlibc
14516 case "$d_getgrnam_r" in
14517 "$define")
14518         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14519         case "$d_getgrnam_r_proto:$usethreads" in
14520         ":define")      d_getgrnam_r_proto=define
14521                 set d_getgrnam_r_proto getgrnam_r $hdrs
14522                 eval $hasproto ;;
14523         *)      ;;
14524         esac
14525         case "$d_getgrnam_r_proto" in
14526         define)
14527         case "$getgrnam_r_proto" in
14528         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14529         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14530         esac
14531         case "$getgrnam_r_proto" in
14532         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14533         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14534         esac
14535         case "$getgrnam_r_proto" in
14536         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14537         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14538         esac
14539         case "$getgrnam_r_proto" in
14540         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14541         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14542         esac
14543         case "$getgrnam_r_proto" in
14544         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14545         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14546         esac
14547         case "$getgrnam_r_proto" in
14548         ''|0)   d_getgrnam_r=undef
14549                 getgrnam_r_proto=0
14550                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14551         * )     case "$getgrnam_r_proto" in
14552                 REENTRANT_PROTO*) ;;
14553                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14554                 esac
14555                 echo "Prototype: $try" ;;
14556         esac
14557         ;;
14558         *)      case "$usethreads" in
14559                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14560                 esac
14561                 d_getgrnam_r=undef
14562                 getgrnam_r_proto=0
14563                 ;;
14564         esac
14565         ;;
14566 *)      getgrnam_r_proto=0
14567         ;;
14568 esac
14569
14570 : see if gethostbyaddr exists
14571 set gethostbyaddr d_gethbyaddr
14572 eval $inlibc
14573
14574 : see if gethostbyname exists
14575 set gethostbyname d_gethbyname
14576 eval $inlibc
14577
14578 : see if gethostent exists
14579 set gethostent d_gethent
14580 eval $inlibc
14581
14582 : see how we will look up host name
14583 echo " "
14584 call=''
14585 if set gethostname val -f d_gethname; eval $csym; $val; then
14586         echo 'gethostname() found.' >&4
14587         d_gethname="$define"
14588         call=gethostname
14589 fi
14590 if set uname val -f d_uname; eval $csym; $val; then
14591         if ./xenix; then
14592                 $cat <<'EOM'
14593 uname() was found, but you're running xenix, and older versions of xenix
14594 have a broken uname(). If you don't really know whether your xenix is old
14595 enough to have a broken system call, use the default answer.
14596
14597 EOM
14598                 dflt=y
14599                 case "$d_uname" in
14600                 "$define") dflt=n;;
14601                 esac
14602                 rp='Is your uname() broken?'
14603                 . ./myread
14604                 case "$ans" in
14605                 n*) d_uname="$define"; call=uname;;
14606                 esac
14607         else
14608                 echo 'uname() found.' >&4
14609                 d_uname="$define"
14610                 case "$call" in
14611                 '') call=uname ;;
14612                 esac
14613         fi
14614 fi
14615 case "$d_gethname" in
14616 '') d_gethname="$undef";;
14617 esac
14618 case "$d_uname" in
14619 '') d_uname="$undef";;
14620 esac
14621 case "$d_uname$d_gethname" in
14622 *define*)
14623         dflt=n
14624         cat <<EOM
14625
14626 Every now and then someone has a $call() that lies about the hostname
14627 but can't be fixed for political or economic reasons.  If you wish, I can
14628 pretend $call() isn't there and maybe compute hostname at run-time
14629 thanks to the '$phostname' command.
14630
14631 EOM
14632         rp="Shall I ignore $call() from now on?"
14633         . ./myread
14634         case "$ans" in
14635         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14636         esac;;
14637 esac
14638 case "$phostname" in
14639 '') aphostname='';;
14640 *) case "$aphostname" in
14641         /*) ;;
14642         *) set X $phostname
14643                 shift
14644                 file=$1
14645                 shift
14646                 file=`./loc $file $file $pth`
14647                 aphostname=`echo $file $*`
14648                 ;;
14649         esac
14650         ;;
14651 esac
14652 case "$d_uname$d_gethname" in
14653 *define*) ;;
14654 *)
14655         case "$phostname" in
14656         '')
14657                 echo "There will be no way for $package to get your hostname." >&4;;
14658         *)
14659         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14660                 ;;
14661         esac;;
14662 esac
14663 case "$d_phostname" in
14664 '') d_phostname="$undef";;
14665 esac
14666
14667 : see if gethostbyaddr_r exists
14668 set gethostbyaddr_r d_gethostbyaddr_r
14669 eval $inlibc
14670 case "$d_gethostbyaddr_r" in
14671 "$define")
14672         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14673         case "$d_gethostbyaddr_r_proto:$usethreads" in
14674         ":define")      d_gethostbyaddr_r_proto=define
14675                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14676                 eval $hasproto ;;
14677         *)      ;;
14678         esac
14679         case "$d_gethostbyaddr_r_proto" in
14680         define)
14681         case "$gethostbyaddr_r_proto" in
14682         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14683         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14684         esac
14685         case "$gethostbyaddr_r_proto" in
14686         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14687         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14688         esac
14689         case "$gethostbyaddr_r_proto" in
14690         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14691         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14692         esac
14693         case "$gethostbyaddr_r_proto" in
14694         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14695         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14696         esac
14697         case "$gethostbyaddr_r_proto" in
14698         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14699         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14700         esac
14701         case "$gethostbyaddr_r_proto" in
14702         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14703         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14704         esac
14705         case "$gethostbyaddr_r_proto" in
14706         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14707         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14708         esac
14709         case "$gethostbyaddr_r_proto" in
14710         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14711         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14712         esac
14713         case "$gethostbyaddr_r_proto" in
14714         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14715         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14716         esac
14717         case "$gethostbyaddr_r_proto" in
14718         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14719         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14720         esac
14721         case "$gethostbyaddr_r_proto" in
14722         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14723         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14724         esac
14725         case "$gethostbyaddr_r_proto" in
14726         ''|0)   d_gethostbyaddr_r=undef
14727                 gethostbyaddr_r_proto=0
14728                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14729         * )     case "$gethostbyaddr_r_proto" in
14730                 REENTRANT_PROTO*) ;;
14731                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14732                 esac
14733                 echo "Prototype: $try" ;;
14734         esac
14735         ;;
14736         *)      case "$usethreads" in
14737                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14738                 esac
14739                 d_gethostbyaddr_r=undef
14740                 gethostbyaddr_r_proto=0
14741                 ;;
14742         esac
14743         ;;
14744 *)      gethostbyaddr_r_proto=0
14745         ;;
14746 esac
14747
14748 : see if gethostbyname_r exists
14749 set gethostbyname_r d_gethostbyname_r
14750 eval $inlibc
14751 case "$d_gethostbyname_r" in
14752 "$define")
14753         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14754         case "$d_gethostbyname_r_proto:$usethreads" in
14755         ":define")      d_gethostbyname_r_proto=define
14756                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14757                 eval $hasproto ;;
14758         *)      ;;
14759         esac
14760         case "$d_gethostbyname_r_proto" in
14761         define)
14762         case "$gethostbyname_r_proto" in
14763         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14764         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14765         esac
14766         case "$gethostbyname_r_proto" in
14767         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14768         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14769         esac
14770         case "$gethostbyname_r_proto" in
14771         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14772         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14773         esac
14774         case "$gethostbyname_r_proto" in
14775         ''|0)   d_gethostbyname_r=undef
14776                 gethostbyname_r_proto=0
14777                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14778         * )     case "$gethostbyname_r_proto" in
14779                 REENTRANT_PROTO*) ;;
14780                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14781                 esac
14782                 echo "Prototype: $try" ;;
14783         esac
14784         ;;
14785         *)      case "$usethreads" in
14786                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14787                 esac
14788                 d_gethostbyname_r=undef
14789                 gethostbyname_r_proto=0
14790                 ;;
14791         esac
14792         ;;
14793 *)      gethostbyname_r_proto=0
14794         ;;
14795 esac
14796
14797 : see if gethostent_r exists
14798 set gethostent_r d_gethostent_r
14799 eval $inlibc
14800 case "$d_gethostent_r" in
14801 "$define")
14802         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14803         case "$d_gethostent_r_proto:$usethreads" in
14804         ":define")      d_gethostent_r_proto=define
14805                 set d_gethostent_r_proto gethostent_r $hdrs
14806                 eval $hasproto ;;
14807         *)      ;;
14808         esac
14809         case "$d_gethostent_r_proto" in
14810         define)
14811         case "$gethostent_r_proto" in
14812         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14813         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14814         esac
14815         case "$gethostent_r_proto" in
14816         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14817         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14818         esac
14819         case "$gethostent_r_proto" in
14820         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14821         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14822         esac
14823         case "$gethostent_r_proto" in
14824         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14825         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14826         esac
14827         case "$gethostent_r_proto" in
14828         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14829         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14830         esac
14831         case "$gethostent_r_proto" in
14832         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14833         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14834         esac
14835         case "$gethostent_r_proto" in
14836         ''|0)   d_gethostent_r=undef
14837                 gethostent_r_proto=0
14838                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14839         * )     case "$gethostent_r_proto" in
14840                 REENTRANT_PROTO*) ;;
14841                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14842                 esac
14843                 echo "Prototype: $try" ;;
14844         esac
14845         ;;
14846         *)      case "$usethreads" in
14847                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14848                 esac
14849                 d_gethostent_r=undef
14850                 gethostent_r_proto=0
14851                 ;;
14852         esac
14853         ;;
14854 *)      gethostent_r_proto=0
14855         ;;
14856 esac
14857
14858 : see if prototypes for various gethostxxx netdb.h functions are available
14859 echo " "
14860 set d_gethostprotos gethostent $i_netdb netdb.h
14861 eval $hasproto
14862
14863 : see if getitimer exists
14864 set getitimer d_getitimer
14865 eval $inlibc
14866
14867 : see if getlogin exists
14868 set getlogin d_getlogin
14869 eval $inlibc
14870
14871 : see if getlogin_r exists
14872 set getlogin_r d_getlogin_r
14873 eval $inlibc
14874 case "$d_getlogin_r" in
14875 "$define")
14876         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14877         case "$d_getlogin_r_proto:$usethreads" in
14878         ":define")      d_getlogin_r_proto=define
14879                 set d_getlogin_r_proto getlogin_r $hdrs
14880                 eval $hasproto ;;
14881         *)      ;;
14882         esac
14883         case "$d_getlogin_r_proto" in
14884         define)
14885         case "$getlogin_r_proto" in
14886         ''|0) try='int getlogin_r(char*, size_t);'
14887         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14888         esac
14889         case "$getlogin_r_proto" in
14890         ''|0) try='int getlogin_r(char*, int);'
14891         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14892         esac
14893         case "$getlogin_r_proto" in
14894         ''|0) try='char* getlogin_r(char*, size_t);'
14895         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14896         esac
14897         case "$getlogin_r_proto" in
14898         ''|0) try='char* getlogin_r(char*, int);'
14899         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14900         esac
14901         case "$getlogin_r_proto" in
14902         ''|0)   d_getlogin_r=undef
14903                 getlogin_r_proto=0
14904                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14905         * )     case "$getlogin_r_proto" in
14906                 REENTRANT_PROTO*) ;;
14907                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14908                 esac
14909                 echo "Prototype: $try" ;;
14910         esac
14911         ;;
14912         *)      case "$usethreads" in
14913                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14914                 esac
14915                 d_getlogin_r=undef
14916                 getlogin_r_proto=0
14917                 ;;
14918         esac
14919         ;;
14920 *)      getlogin_r_proto=0
14921         ;;
14922 esac
14923
14924 : see if getmnt exists
14925 set getmnt d_getmnt
14926 eval $inlibc
14927
14928 : see if getmntent exists
14929 set getmntent d_getmntent
14930 eval $inlibc
14931
14932 : see if getnameinfo exists
14933 set getnameinfo d_getnameinfo
14934 eval $inlibc
14935
14936 : see if getnetbyaddr exists
14937 set getnetbyaddr d_getnbyaddr
14938 eval $inlibc
14939
14940 : see if getnetbyname exists
14941 set getnetbyname d_getnbyname
14942 eval $inlibc
14943
14944 : see if getnetent exists
14945 set getnetent d_getnent
14946 eval $inlibc
14947
14948 : see if getnetbyaddr_r exists
14949 set getnetbyaddr_r d_getnetbyaddr_r
14950 eval $inlibc
14951 case "$d_getnetbyaddr_r" in
14952 "$define")
14953         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14954         case "$d_getnetbyaddr_r_proto:$usethreads" in
14955         ":define")      d_getnetbyaddr_r_proto=define
14956                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14957                 eval $hasproto ;;
14958         *)      ;;
14959         esac
14960         case "$d_getnetbyaddr_r_proto" in
14961         define)
14962         case "$getnetbyaddr_r_proto" in
14963         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14964         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14965         esac
14966         case "$getnetbyaddr_r_proto" in
14967         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14968         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14969         esac
14970         case "$getnetbyaddr_r_proto" in
14971         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14972         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14973         esac
14974         case "$getnetbyaddr_r_proto" in
14975         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14976         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14977         esac
14978         case "$getnetbyaddr_r_proto" in
14979         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14980         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14981         esac
14982         case "$getnetbyaddr_r_proto" in
14983         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14984         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14985         esac
14986         case "$getnetbyaddr_r_proto" in
14987         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14988         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14989         esac
14990         case "$getnetbyaddr_r_proto" in
14991         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14992         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14993         esac
14994         case "$getnetbyaddr_r_proto" in
14995         ''|0)   d_getnetbyaddr_r=undef
14996                 getnetbyaddr_r_proto=0
14997                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14998         * )     case "$getnetbyaddr_r_proto" in
14999                 REENTRANT_PROTO*) ;;
15000                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
15001                 esac
15002                 echo "Prototype: $try" ;;
15003         esac
15004         ;;
15005         *)      case "$usethreads" in
15006                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
15007                 esac
15008                 d_getnetbyaddr_r=undef
15009                 getnetbyaddr_r_proto=0
15010                 ;;
15011         esac
15012         ;;
15013 *)      getnetbyaddr_r_proto=0
15014         ;;
15015 esac
15016
15017 : see if getnetbyname_r exists
15018 set getnetbyname_r d_getnetbyname_r
15019 eval $inlibc
15020 case "$d_getnetbyname_r" in
15021 "$define")
15022         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15023         case "$d_getnetbyname_r_proto:$usethreads" in
15024         ":define")      d_getnetbyname_r_proto=define
15025                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
15026                 eval $hasproto ;;
15027         *)      ;;
15028         esac
15029         case "$d_getnetbyname_r_proto" in
15030         define)
15031         case "$getnetbyname_r_proto" in
15032         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
15033         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
15034         esac
15035         case "$getnetbyname_r_proto" in
15036         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
15037         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
15038         esac
15039         case "$getnetbyname_r_proto" in
15040         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
15041         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
15042         esac
15043         case "$getnetbyname_r_proto" in
15044         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
15045         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
15046         esac
15047         case "$getnetbyname_r_proto" in
15048         ''|0)   d_getnetbyname_r=undef
15049                 getnetbyname_r_proto=0
15050                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
15051         * )     case "$getnetbyname_r_proto" in
15052                 REENTRANT_PROTO*) ;;
15053                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
15054                 esac
15055                 echo "Prototype: $try" ;;
15056         esac
15057         ;;
15058         *)      case "$usethreads" in
15059                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
15060                 esac
15061                 d_getnetbyname_r=undef
15062                 getnetbyname_r_proto=0
15063                 ;;
15064         esac
15065         ;;
15066 *)      getnetbyname_r_proto=0
15067         ;;
15068 esac
15069
15070 : see if getnetent_r exists
15071 set getnetent_r d_getnetent_r
15072 eval $inlibc
15073 case "$d_getnetent_r" in
15074 "$define")
15075         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15076         case "$d_getnetent_r_proto:$usethreads" in
15077         ":define")      d_getnetent_r_proto=define
15078                 set d_getnetent_r_proto getnetent_r $hdrs
15079                 eval $hasproto ;;
15080         *)      ;;
15081         esac
15082         case "$d_getnetent_r_proto" in
15083         define)
15084         case "$getnetent_r_proto" in
15085         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15086         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15087         esac
15088         case "$getnetent_r_proto" in
15089         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15090         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15091         esac
15092         case "$getnetent_r_proto" in
15093         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15094         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15095         esac
15096         case "$getnetent_r_proto" in
15097         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15098         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15099         esac
15100         case "$getnetent_r_proto" in
15101         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15102         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15103         esac
15104         case "$getnetent_r_proto" in
15105         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15106         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15107         esac
15108         case "$getnetent_r_proto" in
15109         ''|0)   d_getnetent_r=undef
15110                 getnetent_r_proto=0
15111                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15112         * )     case "$getnetent_r_proto" in
15113                 REENTRANT_PROTO*) ;;
15114                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15115                 esac
15116                 echo "Prototype: $try" ;;
15117         esac
15118         ;;
15119         *)      case "$usethreads" in
15120                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15121                 esac
15122                 d_getnetent_r=undef
15123                 getnetent_r_proto=0
15124                 ;;
15125         esac
15126         ;;
15127 *)      getnetent_r_proto=0
15128         ;;
15129 esac
15130
15131 : see if prototypes for various getnetxxx netdb.h functions are available
15132 echo " "
15133 set d_getnetprotos getnetent $i_netdb netdb.h
15134 eval $hasproto
15135
15136 : see if getpagesize exists
15137 set getpagesize d_getpagsz
15138 eval $inlibc
15139
15140 : Optional checks for getprotobyname and getprotobynumber
15141
15142 : see if getprotobyname exists
15143 set getprotobyname d_getpbyname
15144 eval $inlibc
15145
15146 : see if getprotobynumber exists
15147 set getprotobynumber d_getpbynumber
15148 eval $inlibc
15149
15150 : see if getprotoent exists
15151 set getprotoent d_getpent
15152 eval $inlibc
15153
15154 : see if getpgid exists
15155 set getpgid d_getpgid
15156 eval $inlibc
15157
15158 : see if getpgrp2 exists
15159 set getpgrp2 d_getpgrp2
15160 eval $inlibc
15161
15162 : see if getppid exists
15163 set getppid d_getppid
15164 eval $inlibc
15165
15166 : see if getpriority exists
15167 set getpriority d_getprior
15168 eval $inlibc
15169
15170 : see if getprotobyname_r exists
15171 set getprotobyname_r d_getprotobyname_r
15172 eval $inlibc
15173 case "$d_getprotobyname_r" in
15174 "$define")
15175         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15176         case "$d_getprotobyname_r_proto:$usethreads" in
15177         ":define")      d_getprotobyname_r_proto=define
15178                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15179                 eval $hasproto ;;
15180         *)      ;;
15181         esac
15182         case "$d_getprotobyname_r_proto" in
15183         define)
15184         case "$getprotobyname_r_proto" in
15185         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15186         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15187         esac
15188         case "$getprotobyname_r_proto" in
15189         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15190         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15191         esac
15192         case "$getprotobyname_r_proto" in
15193         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15194         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15195         esac
15196         case "$getprotobyname_r_proto" in
15197         ''|0)   d_getprotobyname_r=undef
15198                 getprotobyname_r_proto=0
15199                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15200         * )     case "$getprotobyname_r_proto" in
15201                 REENTRANT_PROTO*) ;;
15202                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15203                 esac
15204                 echo "Prototype: $try" ;;
15205         esac
15206         ;;
15207         *)      case "$usethreads" in
15208                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15209                 esac
15210                 d_getprotobyname_r=undef
15211                 getprotobyname_r_proto=0
15212                 ;;
15213         esac
15214         ;;
15215 *)      getprotobyname_r_proto=0
15216         ;;
15217 esac
15218
15219 : see if getprotobynumber_r exists
15220 set getprotobynumber_r d_getprotobynumber_r
15221 eval $inlibc
15222 case "$d_getprotobynumber_r" in
15223 "$define")
15224         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15225         case "$d_getprotobynumber_r_proto:$usethreads" in
15226         ":define")      d_getprotobynumber_r_proto=define
15227                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15228                 eval $hasproto ;;
15229         *)      ;;
15230         esac
15231         case "$d_getprotobynumber_r_proto" in
15232         define)
15233         case "$getprotobynumber_r_proto" in
15234         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15235         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15236         esac
15237         case "$getprotobynumber_r_proto" in
15238         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15239         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15240         esac
15241         case "$getprotobynumber_r_proto" in
15242         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15243         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15244         esac
15245         case "$getprotobynumber_r_proto" in
15246         ''|0)   d_getprotobynumber_r=undef
15247                 getprotobynumber_r_proto=0
15248                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15249         * )     case "$getprotobynumber_r_proto" in
15250                 REENTRANT_PROTO*) ;;
15251                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15252                 esac
15253                 echo "Prototype: $try" ;;
15254         esac
15255         ;;
15256         *)      case "$usethreads" in
15257                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15258                 esac
15259                 d_getprotobynumber_r=undef
15260                 getprotobynumber_r_proto=0
15261                 ;;
15262         esac
15263         ;;
15264 *)      getprotobynumber_r_proto=0
15265         ;;
15266 esac
15267
15268 : see if getprotoent_r exists
15269 set getprotoent_r d_getprotoent_r
15270 eval $inlibc
15271 case "$d_getprotoent_r" in
15272 "$define")
15273         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15274         case "$d_getprotoent_r_proto:$usethreads" in
15275         ":define")      d_getprotoent_r_proto=define
15276                 set d_getprotoent_r_proto getprotoent_r $hdrs
15277                 eval $hasproto ;;
15278         *)      ;;
15279         esac
15280         case "$d_getprotoent_r_proto" in
15281         define)
15282         case "$getprotoent_r_proto" in
15283         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15284         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15285         esac
15286         case "$getprotoent_r_proto" in
15287         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15288         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15289         esac
15290         case "$getprotoent_r_proto" in
15291         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15292         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15293         esac
15294         case "$getprotoent_r_proto" in
15295         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15296         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15297         esac
15298         case "$getprotoent_r_proto" in
15299         ''|0)   d_getprotoent_r=undef
15300                 getprotoent_r_proto=0
15301                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15302         * )     case "$getprotoent_r_proto" in
15303                 REENTRANT_PROTO*) ;;
15304                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15305                 esac
15306                 echo "Prototype: $try" ;;
15307         esac
15308         ;;
15309         *)      case "$usethreads" in
15310                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15311                 esac
15312                 d_getprotoent_r=undef
15313                 getprotoent_r_proto=0
15314                 ;;
15315         esac
15316         ;;
15317 *)      getprotoent_r_proto=0
15318         ;;
15319 esac
15320
15321 : see if prototypes for various getprotoxxx netdb.h functions are available
15322 echo " "
15323 set d_getprotoprotos getprotoent $i_netdb netdb.h
15324 eval $hasproto
15325
15326 : see if getprpwnam exists
15327 set getprpwnam d_getprpwnam
15328 eval $inlibc
15329
15330 : see if getpwent exists
15331 set getpwent d_getpwent
15332 eval $inlibc
15333
15334 : see if getpwent_r exists
15335 set getpwent_r d_getpwent_r
15336 eval $inlibc
15337 case "$d_getpwent_r" in
15338 "$define")
15339         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15340         case "$d_getpwent_r_proto:$usethreads" in
15341         ":define")      d_getpwent_r_proto=define
15342                 set d_getpwent_r_proto getpwent_r $hdrs
15343                 eval $hasproto ;;
15344         *)      ;;
15345         esac
15346         case "$d_getpwent_r_proto" in
15347         define)
15348         case "$getpwent_r_proto" in
15349         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15350         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15351         esac
15352         case "$getpwent_r_proto" in
15353         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15354         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15355         esac
15356         case "$getpwent_r_proto" in
15357         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15358         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15359         esac
15360         case "$getpwent_r_proto" in
15361         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15362         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15363         esac
15364         case "$getpwent_r_proto" in
15365         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15366         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15367         esac
15368         case "$getpwent_r_proto" in
15369         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15370         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15371         esac
15372         case "$getpwent_r_proto" in
15373         ''|0)   d_getpwent_r=undef
15374                 getpwent_r_proto=0
15375                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15376         * )     case "$getpwent_r_proto" in
15377                 REENTRANT_PROTO*) ;;
15378                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15379                 esac
15380                 echo "Prototype: $try" ;;
15381         esac
15382         ;;
15383         *)      case "$usethreads" in
15384                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15385                 esac
15386                 d_getpwent_r=undef
15387                 getpwent_r_proto=0
15388                 ;;
15389         esac
15390         ;;
15391 *)      getpwent_r_proto=0
15392         ;;
15393 esac
15394
15395 : see if getpwnam_r exists
15396 set getpwnam_r d_getpwnam_r
15397 eval $inlibc
15398 case "$d_getpwnam_r" in
15399 "$define")
15400         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15401         case "$d_getpwnam_r_proto:$usethreads" in
15402         ":define")      d_getpwnam_r_proto=define
15403                 set d_getpwnam_r_proto getpwnam_r $hdrs
15404                 eval $hasproto ;;
15405         *)      ;;
15406         esac
15407         case "$d_getpwnam_r_proto" in
15408         define)
15409         case "$getpwnam_r_proto" in
15410         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15411         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15412         esac
15413         case "$getpwnam_r_proto" in
15414         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15415         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15416         esac
15417         case "$getpwnam_r_proto" in
15418         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15419         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15420         esac
15421         case "$getpwnam_r_proto" in
15422         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15423         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15424         esac
15425         case "$getpwnam_r_proto" in
15426         ''|0)   d_getpwnam_r=undef
15427                 getpwnam_r_proto=0
15428                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15429         * )     case "$getpwnam_r_proto" in
15430                 REENTRANT_PROTO*) ;;
15431                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15432                 esac
15433                 echo "Prototype: $try" ;;
15434         esac
15435         ;;
15436         *)      case "$usethreads" in
15437                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15438                 esac
15439                 d_getpwnam_r=undef
15440                 getpwnam_r_proto=0
15441                 ;;
15442         esac
15443         ;;
15444 *)      getpwnam_r_proto=0
15445         ;;
15446 esac
15447
15448 : see if getpwuid_r exists
15449 set getpwuid_r d_getpwuid_r
15450 eval $inlibc
15451 case "$d_getpwuid_r" in
15452 "$define")
15453         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15454         case "$d_getpwuid_r_proto:$usethreads" in
15455         ":define")      d_getpwuid_r_proto=define
15456                 set d_getpwuid_r_proto getpwuid_r $hdrs
15457                 eval $hasproto ;;
15458         *)      ;;
15459         esac
15460         case "$d_getpwuid_r_proto" in
15461         define)
15462         case "$getpwuid_r_proto" in
15463         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15464         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15465         esac
15466         case "$getpwuid_r_proto" in
15467         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15468         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15469         esac
15470         case "$getpwuid_r_proto" in
15471         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15472         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15473         esac
15474         case "$getpwuid_r_proto" in
15475         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15476         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15477         esac
15478         case "$getpwuid_r_proto" in
15479         ''|0)   d_getpwuid_r=undef
15480                 getpwuid_r_proto=0
15481                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15482         * )     case "$getpwuid_r_proto" in
15483                 REENTRANT_PROTO*) ;;
15484                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15485                 esac
15486                 echo "Prototype: $try" ;;
15487         esac
15488         ;;
15489         *)      case "$usethreads" in
15490                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15491                 esac
15492                 d_getpwuid_r=undef
15493                 getpwuid_r_proto=0
15494                 ;;
15495         esac
15496         ;;
15497 *)      getpwuid_r_proto=0
15498         ;;
15499 esac
15500
15501 : Optional checks for getsbyname and getsbyport
15502
15503 : see if getservbyname exists
15504 set getservbyname d_getsbyname
15505 eval $inlibc
15506
15507 : see if getservbyport exists
15508 set getservbyport d_getsbyport
15509 eval $inlibc
15510
15511 : see if getservent exists
15512 set getservent d_getsent
15513 eval $inlibc
15514
15515 : see if getservbyname_r exists
15516 set getservbyname_r d_getservbyname_r
15517 eval $inlibc
15518 case "$d_getservbyname_r" in
15519 "$define")
15520         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15521         case "$d_getservbyname_r_proto:$usethreads" in
15522         ":define")      d_getservbyname_r_proto=define
15523                 set d_getservbyname_r_proto getservbyname_r $hdrs
15524                 eval $hasproto ;;
15525         *)      ;;
15526         esac
15527         case "$d_getservbyname_r_proto" in
15528         define)
15529         case "$getservbyname_r_proto" in
15530         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15531         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15532         esac
15533         case "$getservbyname_r_proto" in
15534         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15535         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15536         esac
15537         case "$getservbyname_r_proto" in
15538         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15539         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15540         esac
15541         case "$getservbyname_r_proto" in
15542         ''|0)   d_getservbyname_r=undef
15543                 getservbyname_r_proto=0
15544                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15545         * )     case "$getservbyname_r_proto" in
15546                 REENTRANT_PROTO*) ;;
15547                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15548                 esac
15549                 echo "Prototype: $try" ;;
15550         esac
15551         ;;
15552         *)      case "$usethreads" in
15553                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15554                 esac
15555                 d_getservbyname_r=undef
15556                 getservbyname_r_proto=0
15557                 ;;
15558         esac
15559         ;;
15560 *)      getservbyname_r_proto=0
15561         ;;
15562 esac
15563
15564 : see if getservbyport_r exists
15565 set getservbyport_r d_getservbyport_r
15566 eval $inlibc
15567 case "$d_getservbyport_r" in
15568 "$define")
15569         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15570         case "$d_getservbyport_r_proto:$usethreads" in
15571         ":define")      d_getservbyport_r_proto=define
15572                 set d_getservbyport_r_proto getservbyport_r $hdrs
15573                 eval $hasproto ;;
15574         *)      ;;
15575         esac
15576         case "$d_getservbyport_r_proto" in
15577         define)
15578         case "$getservbyport_r_proto" in
15579         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15580         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15581         esac
15582         case "$getservbyport_r_proto" in
15583         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15584         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15585         esac
15586         case "$getservbyport_r_proto" in
15587         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15588         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15589         esac
15590         case "$getservbyport_r_proto" in
15591         ''|0)   d_getservbyport_r=undef
15592                 getservbyport_r_proto=0
15593                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15594         * )     case "$getservbyport_r_proto" in
15595                 REENTRANT_PROTO*) ;;
15596                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15597                 esac
15598                 echo "Prototype: $try" ;;
15599         esac
15600         ;;
15601         *)      case "$usethreads" in
15602                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15603                 esac
15604                 d_getservbyport_r=undef
15605                 getservbyport_r_proto=0
15606                 ;;
15607         esac
15608         ;;
15609 *)      getservbyport_r_proto=0
15610         ;;
15611 esac
15612
15613 : see if getservent_r exists
15614 set getservent_r d_getservent_r
15615 eval $inlibc
15616 case "$d_getservent_r" in
15617 "$define")
15618         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15619         case "$d_getservent_r_proto:$usethreads" in
15620         ":define")      d_getservent_r_proto=define
15621                 set d_getservent_r_proto getservent_r $hdrs
15622                 eval $hasproto ;;
15623         *)      ;;
15624         esac
15625         case "$d_getservent_r_proto" in
15626         define)
15627         case "$getservent_r_proto" in
15628         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15629         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15630         esac
15631         case "$getservent_r_proto" in
15632         ''|0) try='int getservent_r(struct servent*, char*, int);'
15633         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15634         esac
15635         case "$getservent_r_proto" in
15636         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15637         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15638         esac
15639         case "$getservent_r_proto" in
15640         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15641         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15642         esac
15643         case "$getservent_r_proto" in
15644         ''|0)   d_getservent_r=undef
15645                 getservent_r_proto=0
15646                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15647         * )     case "$getservent_r_proto" in
15648                 REENTRANT_PROTO*) ;;
15649                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15650                 esac
15651                 echo "Prototype: $try" ;;
15652         esac
15653         ;;
15654         *)      case "$usethreads" in
15655                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15656                 esac
15657                 d_getservent_r=undef
15658                 getservent_r_proto=0
15659                 ;;
15660         esac
15661         ;;
15662 *)      getservent_r_proto=0
15663         ;;
15664 esac
15665
15666 : see if prototypes for various getservxxx netdb.h functions are available
15667 echo " "
15668 set d_getservprotos getservent $i_netdb netdb.h
15669 eval $hasproto
15670
15671 : see if getspnam exists
15672 set getspnam d_getspnam
15673 eval $inlibc
15674
15675 : see if this is a shadow.h system
15676 set shadow.h i_shadow
15677 eval $inhdr
15678
15679 : see if getspnam_r exists
15680 set getspnam_r d_getspnam_r
15681 eval $inlibc
15682 case "$d_getspnam_r" in
15683 "$define")
15684         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15685         case "$d_getspnam_r_proto:$usethreads" in
15686         ":define")      d_getspnam_r_proto=define
15687                 set d_getspnam_r_proto getspnam_r $hdrs
15688                 eval $hasproto ;;
15689         *)      ;;
15690         esac
15691         case "$d_getspnam_r_proto" in
15692         define)
15693         case "$getspnam_r_proto" in
15694         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15695         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15696         esac
15697         case "$getspnam_r_proto" in
15698         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15699         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15700         esac
15701         case "$getspnam_r_proto" in
15702         ''|0)   d_getspnam_r=undef
15703                 getspnam_r_proto=0
15704                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15705         * )     case "$getspnam_r_proto" in
15706                 REENTRANT_PROTO*) ;;
15707                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15708                 esac
15709                 echo "Prototype: $try" ;;
15710         esac
15711         ;;
15712         *)      case "$usethreads" in
15713                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15714                 esac
15715                 d_getspnam_r=undef
15716                 getspnam_r_proto=0
15717                 ;;
15718         esac
15719         ;;
15720 *)      getspnam_r_proto=0
15721         ;;
15722 esac
15723
15724 : see if gettimeofday or ftime exists
15725 set gettimeofday d_gettimeod
15726 eval $inlibc
15727 case "$d_gettimeod" in
15728 "$undef")
15729         set ftime d_ftime 
15730         eval $inlibc
15731         ;;
15732 *)
15733         val="$undef"; set d_ftime; eval $setvar
15734         ;;
15735 esac
15736 case "$d_gettimeod$d_ftime" in
15737 "$undef$undef")
15738         echo " "
15739         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15740         ;;
15741 esac
15742
15743 : see if gmtime_r exists
15744 set gmtime_r d_gmtime_r
15745 eval $inlibc
15746 case "$d_gmtime_r" in
15747 "$define")
15748         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15749         case "$d_gmtime_r_proto:$usethreads" in
15750         ":define")      d_gmtime_r_proto=define
15751                 set d_gmtime_r_proto gmtime_r $hdrs
15752                 eval $hasproto ;;
15753         *)      ;;
15754         esac
15755         case "$d_gmtime_r_proto" in
15756         define)
15757         case "$gmtime_r_proto" in
15758         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15759         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15760         esac
15761         case "$gmtime_r_proto" in
15762         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15763         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15764         esac
15765         case "$gmtime_r_proto" in
15766         ''|0)   d_gmtime_r=undef
15767                 gmtime_r_proto=0
15768                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15769         * )     case "$gmtime_r_proto" in
15770                 REENTRANT_PROTO*) ;;
15771                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15772                 esac
15773                 echo "Prototype: $try" ;;
15774         esac
15775         ;;
15776         *)      case "$usethreads" in
15777                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15778                 esac
15779                 d_gmtime_r=undef
15780                 gmtime_r_proto=0
15781                 ;;
15782         esac
15783         ;;
15784 *)      gmtime_r_proto=0
15785         ;;
15786 esac
15787
15788 : see if hasmntopt exists
15789 set hasmntopt d_hasmntopt
15790 eval $inlibc
15791
15792 : see if this is a netinet/in.h or sys/in.h system
15793 set netinet/in.h i_niin sys/in.h i_sysin
15794 eval $inhdr
15795
15796 : see if arpa/inet.h has to be included
15797 set arpa/inet.h i_arpainet
15798 eval $inhdr
15799
15800 : see if htonl --and friends-- exists
15801 val=''
15802 set htonl val
15803 eval $inlibc
15804
15805 : Maybe they are macros.
15806 case "$val" in
15807 $undef)
15808         $cat >htonl.c <<EOM
15809 #include <stdio.h>
15810 #include <sys/types.h>
15811 #$i_niin I_NETINET_IN
15812 #$i_sysin I_SYS_IN
15813 #$i_arpainet I_ARPA_INET
15814 #ifdef I_NETINET_IN
15815 #include <netinet/in.h>
15816 #endif
15817 #ifdef I_SYS_IN
15818 #include <sys/in.h>
15819 #endif
15820 #ifdef I_ARPA_INET
15821 #include <arpa/inet.h>
15822 #endif
15823 #ifdef htonl
15824 printf("Defined as a macro.");
15825 #endif
15826 EOM
15827         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15828         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15829                 val="$define"
15830                 echo "But it seems to be defined as a macro." >&4
15831         fi
15832         $rm -f htonl.?
15833         ;;
15834 esac
15835 set d_htonl
15836 eval $setvar
15837
15838 : see if hypot exists
15839 set hypot d_hypot
15840 eval $inlibc
15841
15842 : see if ilogb exists
15843 set ilogb d_ilogb
15844 eval $inlibc
15845
15846 : see if ilogbl exists
15847 set ilogbl d_ilogbl
15848 eval $inlibc
15849
15850 : index or strchr
15851 echo " "
15852 if set index val -f; eval $csym; $val; then
15853         if set strchr val -f d_strchr; eval $csym; $val; then
15854                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15855                         val="$define"
15856                         vali="$undef"
15857                         echo "strchr() found." >&4
15858                 else
15859                         val="$undef"
15860                         vali="$define"
15861                         echo "index() found." >&4
15862                 fi
15863         else
15864                 val="$undef"
15865                 vali="$define"
15866                 echo "index() found." >&4
15867         fi
15868 else
15869         if set strchr val -f d_strchr; eval $csym; $val; then
15870                 val="$define"
15871                 vali="$undef"
15872                 echo "strchr() found." >&4
15873         else
15874                 echo "No index() or strchr() found!" >&4
15875                 val="$undef"
15876                 vali="$undef"
15877         fi
15878 fi
15879 set d_strchr; eval $setvar
15880 val="$vali"
15881 set d_index; eval $setvar
15882
15883 : check whether inet_aton exists
15884 set inet_aton d_inetaton
15885 eval $inlibc
15886
15887 : see if inet_ntop exists
15888 set inet_ntop d_inetntop
15889 eval $inlibc
15890
15891 : see if inet_pton exists
15892 set inet_pton d_inetpton
15893 eval $inlibc
15894
15895 : Look for isascii
15896 echo " "
15897 $cat >isascii.c <<EOCP
15898 #include <stdio.h>
15899 #include <ctype.h>
15900 #$i_stdlib I_STDLIB
15901 #ifdef I_STDLIB
15902 #include <stdlib.h>
15903 #endif
15904 int main() {
15905         int c = 'A';
15906         if (isascii(c))
15907                 exit(0);
15908         else
15909                 exit(1);
15910 }
15911 EOCP
15912 set isascii
15913 if eval $compile; then
15914         echo "isascii() found." >&4
15915         val="$define"
15916 else
15917         echo "isascii() NOT found." >&4
15918         val="$undef"
15919 fi
15920 set d_isascii
15921 eval $setvar
15922 $rm -f isascii*
15923
15924 : Look for isblank
15925 echo " "
15926 $cat >isblank.c <<'EOCP'
15927 #include <stdio.h>
15928 #include <ctype.h>
15929 int main() {
15930         int c = ' ';
15931         if (isblank(c))
15932                 return 0 ;
15933         else
15934                 return 1 ;
15935 }
15936 EOCP
15937 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15938         echo "isblank() found." >&4
15939         val="$define"
15940 else
15941         echo "isblank() NOT found." >&4
15942         val="$undef"
15943 fi
15944 set d_isblank
15945 eval $setvar
15946 $rm -f isblank*
15947
15948 : check for isfinite
15949 echo "Checking to see if you have isfinite..." >&4
15950 $cat >try.c <<EOCP
15951 #$i_math I_MATH
15952 #ifdef I_MATH
15953 #include <math.h>
15954 #endif
15955 int main() { return isfinite(0.0); }
15956 EOCP
15957 set try
15958 if eval $compile; then
15959         val="$define"
15960         echo "You have isfinite."
15961 else
15962         val="$undef"
15963         echo "You do not have isfinite."
15964 fi
15965 $rm_try
15966 set d_isfinite
15967 eval $setvar
15968
15969 : see if isfinitel exists
15970 set isfinitel d_isfinitel
15971 eval $inlibc
15972
15973 : check for isinf
15974 echo "Checking to see if you have isinf..." >&4
15975 $cat >try.c <<EOCP
15976 #$i_math I_MATH
15977 #ifdef I_MATH
15978 #include <math.h>
15979 #endif
15980 int main() { return isinf(0.0); }
15981 EOCP
15982 set try
15983 if eval $compile; then
15984         val="$define"
15985         echo "You have isinf."
15986 else
15987         val="$undef"
15988         echo "You do not have isinf."
15989 fi
15990 $rm_try
15991 set d_isinf
15992 eval $setvar
15993
15994 : see if isinfl exists
15995 set isinfl d_isinfl
15996 eval $inlibc
15997
15998 : check for isless
15999 echo "Checking to see if you have isless..." >&4
16000 $cat >try.c <<EOCP
16001 #$i_math I_MATH
16002 #ifdef I_MATH
16003 #include <math.h>
16004 #endif
16005 int main() { return isless(0.0); }
16006 EOCP
16007 set try
16008 if eval $compile; then
16009         val="$define"
16010         echo "You have isless."
16011 else
16012         val="$undef"
16013         echo "You do not have isless."
16014 fi
16015 $rm_try
16016 set d_isless
16017 eval $setvar
16018
16019 : check for isnan
16020 echo "Checking to see if you have isnan..." >&4
16021 $cat >try.c <<EOCP
16022 #$i_math I_MATH
16023 #ifdef I_MATH
16024 #include <math.h>
16025 #endif
16026 int main() { return isnan(0.0); }
16027 EOCP
16028 set try
16029 if eval $compile; then
16030         val="$define"
16031         echo "You have isnan."
16032 else
16033         val="$undef"
16034         echo "You do not have isnan."
16035 fi
16036 $rm_try
16037 set d_isnan
16038 eval $setvar
16039
16040 : see if isnanl exists
16041 set isnanl d_isnanl
16042 eval $inlibc
16043
16044 : check for isnormal
16045 echo "Checking to see if you have isnormal..." >&4
16046 $cat >try.c <<EOCP
16047 #$i_math I_MATH
16048 #ifdef I_MATH
16049 #include <math.h>
16050 #endif
16051 int main() { return isnormal(0.0); }
16052 EOCP
16053 set try
16054 if eval $compile; then
16055         val="$define"
16056         echo "You have isnormal."
16057 else
16058         val="$undef"
16059         echo "You do not have isnormal."
16060 fi
16061 $rm_try
16062 set d_isnormal
16063 eval $setvar
16064
16065 : see if j0 exists
16066 set j0 d_j0
16067 eval $inlibc
16068
16069 : see if j0l exists
16070 set j0l d_j0l
16071 eval $inlibc
16072
16073 : see if killpg exists
16074 set killpg d_killpg
16075 eval $inlibc
16076
16077 : see if localeconv exists
16078 set localeconv d_locconv
16079 eval $inlibc
16080
16081 : see if libc has the POSIX.1-2008 currency locale rules
16082 case "$d_locconv:$d_lc_monetary_2008" in
16083 $define:)
16084         $cat >try.c <<EOCP
16085 #include <locale.h>
16086 int main() {
16087         struct lconv *lc = localeconv();
16088         char int_p_cs_precedes = lc->int_p_cs_precedes;
16089         return 0;
16090 }
16091 EOCP
16092         set try
16093         if eval $compile; then
16094                 d_lc_monetary_2008="$define"
16095         else
16096                 d_lc_monetary_2008="$undef"
16097         fi;
16098         $rm_try
16099         ;;
16100 esac
16101
16102 : see if lchown exists
16103 echo " "
16104 $cat > try.c <<'EOCP'
16105 /* System header to define __stub macros and hopefully few prototypes,
16106     which can conflict with char lchown(); below.  */
16107 #include <assert.h>
16108 /* Override any gcc2 internal prototype to avoid an error.  */
16109 /* We use char because int might match the return type of a gcc2
16110    builtin and then its argument prototype would still apply.  */
16111 char lchown();
16112 int main() {
16113     /*  The GNU C library defines this for functions which it implements
16114         to always fail with ENOSYS.  Some functions are actually named
16115         something starting with __ and the normal name is an alias.  */
16116 #if defined (__stub_lchown) || defined (__stub___lchown)
16117 choke me
16118 #else
16119 lchown();
16120 #endif
16121 ; return 0; }
16122 EOCP
16123 set try
16124 if eval $compile; then
16125     $echo "lchown() found." >&4
16126     val="$define"
16127 else
16128     $echo "lchown() NOT found." >&4
16129     val="$undef"
16130 fi
16131 set d_lchown
16132 eval $setvar
16133
16134 : See if number of significant digits in a double precision number is known
16135 echo " "
16136 $cat >ldbl_dig.c <<EOM
16137 #$i_limits I_LIMITS
16138 #$i_float I_FLOAT
16139 #ifdef I_LIMITS
16140 #include <limits.h>
16141 #endif
16142 #ifdef I_FLOAT
16143 #include <float.h>
16144 #endif
16145 #ifdef LDBL_DIG
16146 printf("Contains LDBL_DIG");
16147 #endif
16148 EOM
16149 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16150 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16151         echo "LDBL_DIG found." >&4
16152         val="$define"
16153 else
16154         echo "LDBL_DIG NOT found." >&4
16155         val="$undef"
16156 fi
16157 $rm -f ldbl_dig.?
16158 set d_ldbl_dig
16159 eval $setvar
16160
16161 : see if lgamma exists
16162 set lgamma d_lgamma
16163 eval $inlibc
16164
16165 : see if lgamma_r exists
16166 set lgamma_r d_lgamma_r
16167 eval $inlibc
16168
16169 : check to see if math.h defines _LIB_VERSION
16170 d_libm_lib_version="$undef"
16171 case $i_math in
16172     $define)
16173         echo " "
16174         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16175         $cat >try.c <<EOCP
16176 #include <unistd.h>
16177 #include <math.h>
16178 int main (int argc, char *argv[])
16179 {
16180     printf ("%d\n", _LIB_VERSION);
16181     return (0);
16182     } /* main */
16183 EOCP
16184         set try
16185         if eval $compile; then
16186             foo=`$run ./try`
16187             echo "Yes, it does ($foo)" >&4
16188             d_libm_lib_version="$define"
16189         else
16190             echo "No, it does not (probably harmless)" >&4
16191             fi
16192         $rm_try
16193         ;;
16194
16195     esac
16196
16197 : see if link exists
16198 set link d_link
16199 eval $inlibc
16200
16201 : see if llrint exists
16202 set llrint d_llrint
16203 eval $inlibc
16204
16205 : see if llrintl exists
16206 set llrintl d_llrintl
16207 eval $inlibc
16208
16209 : see if llround exists
16210 set llround d_llround
16211 eval $inlibc
16212
16213 : see if llroundl exists
16214 set llroundl d_llroundl
16215 eval $inlibc
16216
16217 : see if localtime_r exists
16218 set localtime_r d_localtime_r
16219 eval $inlibc
16220 case "$d_localtime_r" in
16221 "$define")
16222         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16223         case "$d_localtime_r_proto:$usethreads" in
16224         ":define")      d_localtime_r_proto=define
16225                 set d_localtime_r_proto localtime_r $hdrs
16226                 eval $hasproto ;;
16227         *)      ;;
16228         esac
16229         case "$d_localtime_r_proto" in
16230         define)
16231         case "$localtime_r_proto" in
16232         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16233         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16234         esac
16235         case "$localtime_r_proto" in
16236         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16237         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16238         esac
16239         case "$localtime_r_proto" in
16240         ''|0)   d_localtime_r=undef
16241                 localtime_r_proto=0
16242                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16243         * )     case "$localtime_r_proto" in
16244                 REENTRANT_PROTO*) ;;
16245                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16246                 esac
16247                 echo "Prototype: $try" ;;
16248         esac
16249         ;;
16250         *)      case "$usethreads" in
16251                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16252                 esac
16253                 d_localtime_r=undef
16254                 localtime_r_proto=0
16255                 ;;
16256         esac
16257         ;;
16258 *)      localtime_r_proto=0
16259         ;;
16260 esac
16261
16262 : see if localtime_r calls tzset
16263 case "$localtime_r_proto" in
16264 REENTRANT_PROTO*)
16265         $cat >try.c <<EOCP
16266 /*  Does our libc's localtime_r call tzset ?
16267  *  return 0 if so, 1 otherwise.
16268  */
16269 #$i_systypes    I_SYS_TYPES
16270 #$i_unistd      I_UNISTD
16271 #$i_time        I_TIME
16272 #$i_stdlib      I_STDLIB
16273 #$i_string      I_STRING
16274 #$i_malloc      I_MALLOC
16275 #ifdef I_SYS_TYPES
16276 #  include <sys/types.h>
16277 #endif
16278 #ifdef I_UNISTD
16279 #  include <unistd.h>
16280 #endif
16281 #ifdef I_TIME
16282 #  include <time.h>
16283 #endif
16284 #ifdef I_STDLIB
16285 #include <stdlib.h>
16286 #endif
16287 #ifdef I_STRING
16288 #  include <string.h>
16289 #else
16290 #  include <strings.h>
16291 #endif
16292 #ifdef I_MALLOC
16293 #  include <malloc.h>
16294 #endif
16295 int main()
16296 {
16297     time_t t = time(0L);
16298     char w_tz[]="TZ" "=GMT+5",
16299          e_tz[]="TZ" "=GMT-5",
16300         *tz_e = (char*)malloc(16),
16301         *tz_w = (char*)malloc(16);
16302     struct tm tm_e, tm_w;
16303     memset(&tm_e,'\0',sizeof(struct tm));
16304     memset(&tm_w,'\0',sizeof(struct tm));
16305     strcpy(tz_e,e_tz);
16306     strcpy(tz_w,w_tz);
16307
16308     putenv(tz_e);
16309     localtime_r(&t, &tm_e);
16310
16311     putenv(tz_w);
16312     localtime_r(&t, &tm_w);
16313
16314     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16315         return 1;
16316     return 0;
16317 }
16318 EOCP
16319         set try
16320         if eval $compile; then
16321             if $run ./try; then
16322                 d_localtime_r_needs_tzset=undef;
16323             else
16324                 d_localtime_r_needs_tzset=define;
16325             fi;
16326         else
16327             d_localtime_r_needs_tzset=undef;
16328         fi;
16329      ;;
16330   *)
16331      d_localtime_r_needs_tzset=undef;
16332      ;;
16333 esac
16334 $rm_try
16335
16336 : see if lockf exists
16337 set lockf d_lockf
16338 eval $inlibc
16339
16340 : see if log1p exists
16341 set log1p d_log1p
16342 eval $inlibc
16343
16344 : see if log2 exists
16345 set log2 d_log2
16346 eval $inlibc
16347
16348 : see if logb exists
16349 set logb d_logb
16350 eval $inlibc
16351
16352 : see if lrint exists
16353 set lrint d_lrint
16354 eval $inlibc
16355
16356 : see if lrintl exists
16357 set lrintl d_lrintl
16358 eval $inlibc
16359
16360 : see if lround exists
16361 set lround d_lround
16362 eval $inlibc
16363
16364 : see if lroundl exists
16365 set lroundl d_lroundl
16366 eval $inlibc
16367
16368 : see if prototype for lseek is available
16369 echo " "
16370 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16371 eval $hasproto
16372
16373 : see if lstat exists
16374 set lstat d_lstat
16375 eval $inlibc
16376
16377 : see if madvise exists
16378 set madvise d_madvise
16379 eval $inlibc
16380
16381 : see if malloc_size exists
16382 set malloc_size d_malloc_size
16383 eval $inlibc
16384
16385 : see if malloc_size_good exists
16386 set malloc_good_size d_malloc_good_size
16387 eval $inlibc
16388
16389 : see if mblen exists
16390 set mblen d_mblen
16391 eval $inlibc
16392
16393 : see if mbstowcs exists
16394 set mbstowcs d_mbstowcs
16395 eval $inlibc
16396
16397 : see if mbtowc exists
16398 set mbtowc d_mbtowc
16399 eval $inlibc
16400
16401 : see if memchr exists
16402 set memchr d_memchr
16403 eval $inlibc
16404
16405 : see if memcmp exists
16406 set memcmp d_memcmp
16407 eval $inlibc
16408
16409 : see if memcpy exists
16410 set memcpy d_memcpy
16411 eval $inlibc
16412
16413 : see if memmem exists
16414 set memmem d_memmem
16415 eval $inlibc
16416
16417 : see if memmove exists
16418 set memmove d_memmove
16419 eval $inlibc
16420
16421 : see if memset exists
16422 set memset d_memset
16423 eval $inlibc
16424
16425 : see if mkdir exists
16426 set mkdir d_mkdir
16427 eval $inlibc
16428
16429 : see if mkdtemp exists
16430 set mkdtemp d_mkdtemp
16431 eval $inlibc
16432
16433 : see if mkfifo exists
16434 set mkfifo d_mkfifo
16435 eval $inlibc
16436
16437 : see if mkstemp exists
16438 set mkstemp d_mkstemp
16439 eval $inlibc
16440
16441 : see if mkstemps exists
16442 set mkstemps d_mkstemps
16443 eval $inlibc
16444
16445 : see if mktime exists
16446 set mktime d_mktime
16447 eval $inlibc
16448
16449 : see if this is a sys/mman.h system
16450 set sys/mman.h i_sysmman
16451 eval $inhdr
16452
16453 : see if mmap exists
16454 set mmap d_mmap
16455 eval $inlibc
16456 : see what shmat returns
16457 : default to something harmless
16458 mmaptype='void *'
16459 case "$i_sysmman$d_mmap" in
16460 "$define$define")
16461         $cat >mmap.c <<'END'
16462 #include <sys/mman.h>
16463 void *mmap();
16464 END
16465         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16466                 mmaptype='void *'
16467         else
16468                 mmaptype='caddr_t'
16469         fi
16470         echo "and it returns ($mmaptype)." >&4
16471         ;;
16472 esac
16473
16474
16475
16476 : see if sqrtl exists
16477 set sqrtl d_sqrtl
16478 eval $inlibc
16479
16480 : see if scalbnl exists
16481 set scalbnl d_scalbnl
16482 eval $inlibc
16483
16484 : see if truncl exists
16485 set truncl d_truncl
16486 eval $inlibc
16487
16488 : see if modfl exists
16489 set modfl d_modfl
16490 eval $inlibc
16491
16492 : see if prototype for modfl is available
16493 echo " "
16494 set d_modflproto modfl $i_math math.h
16495 eval $hasproto
16496
16497 if $test "$uselongdouble" = "$define"; then
16498     message=""
16499     if $test "$d_sqrtl" != "$define"; then
16500         message="$message sqrtl"
16501     fi
16502     if $test "$d_modfl" != "$define"; then
16503         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16504             echo "You have both truncl and copysignl, so I can emulate modfl."
16505         else
16506             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16507                 echo "You have both aintl and copysignl, so I can emulate modfl."
16508             else
16509                 message="$message modfl"
16510             fi
16511         fi
16512     fi
16513     if $test "$d_frexpl" != "$define"; then
16514         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16515             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16516         else
16517             message="$message frexpl"
16518         fi
16519     fi
16520     if $test "$d_ldexpl" != "$define"; then
16521         message="$message ldexpl"
16522     fi
16523
16524     if $test "$message" != ""; then
16525         $cat <<EOM >&4
16526
16527 *** You requested the use of long doubles but you do not seem to have
16528 *** the following mathematical functions needed for long double support:
16529 ***    $message
16530 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16531 *** Cannot continue, aborting.
16532
16533 EOM
16534
16535         exit 1
16536     fi
16537 fi
16538
16539 : see if mprotect exists
16540 set mprotect d_mprotect
16541 eval $inlibc
16542
16543 : see if msgctl exists
16544 set msgctl d_msgctl
16545 eval $inlibc
16546
16547 : see if msgget exists
16548 set msgget d_msgget
16549 eval $inlibc
16550
16551 : see if msgsnd exists
16552 set msgsnd d_msgsnd
16553 eval $inlibc
16554
16555 : see if msgrcv exists
16556 set msgrcv d_msgrcv
16557 eval $inlibc
16558
16559 : see how much of the 'msg*(2)' library is present.
16560 h_msg=true
16561 echo " "
16562 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16563 *"$undef"*) h_msg=false;;
16564 esac
16565 case "$osname" in
16566 freebsd)
16567     case "`ipcs 2>&1`" in
16568     "SVID messages"*"not configured"*)
16569         echo "Your $osname does not have the msg*(2) configured." >&4
16570         h_msg=false
16571         val="$undef"
16572         set msgctl d_msgctl
16573         eval $setvar
16574         set msgget d_msgget
16575         eval $setvar
16576         set msgsnd d_msgsnd
16577         eval $setvar
16578         set msgrcv d_msgrcv
16579         eval $setvar
16580         ;;
16581     esac
16582     ;;
16583 esac
16584 : we could also check for sys/ipc.h ...
16585 if $h_msg && $test `./findhdr sys/msg.h`; then
16586         echo "You have the full msg*(2) library." >&4
16587         val="$define"
16588 else
16589         echo "You don't have the full msg*(2) library." >&4
16590         val="$undef"
16591 fi
16592 set d_msg
16593 eval $setvar
16594
16595 : Check for msghdr_s
16596 echo " "
16597 echo "Checking to see if your system supports struct msghdr..." >&4
16598 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16599 eval $hasstruct
16600 case "$d_msghdr_s" in
16601 "$define")      echo "Yes, it does."   ;;
16602 *)              echo "No, it doesn't." ;;
16603 esac
16604
16605
16606 : see if msync exists
16607 set msync d_msync
16608 eval $inlibc
16609
16610 : see if munmap exists
16611 set munmap d_munmap
16612 eval $inlibc
16613
16614 : see if nan exists
16615 set nan d_nan
16616 eval $inlibc
16617
16618 : see if nearbyint exists
16619 set nearbyint d_nearbyint
16620 eval $inlibc
16621
16622 : see if nextafter exists
16623 set nextafter d_nextafter
16624 eval $inlibc
16625
16626 : see if nexttoward exists
16627 set nexttoward d_nexttoward
16628 eval $inlibc
16629
16630 : see if nice exists
16631 set nice d_nice
16632 eval $inlibc
16633
16634 : see if this is a langinfo.h system
16635 set langinfo.h i_langinfo
16636 eval $inhdr
16637
16638 : see if nl_langinfo exists
16639 set nl_langinfo d_nl_langinfo
16640 eval $inlibc
16641
16642 : see if this is a quadmath.h system
16643 set quadmath.h i_quadmath
16644 eval $inhdr
16645
16646 : check for volatile keyword
16647 echo " "
16648 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16649 $cat >try.c <<'EOCP'
16650 int main()
16651 {
16652         typedef struct _goo_struct goo_struct;
16653         goo_struct * volatile goo = ((goo_struct *)0);
16654         struct _goo_struct {
16655                 long long_int;
16656                 int reg_int;
16657                 char char_var;
16658         };
16659         typedef unsigned short foo_t;
16660         char *volatile foo;
16661         volatile int bar;
16662         volatile foo_t blech;
16663         foo = foo;
16664 }
16665 EOCP
16666 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16667         val="$define"
16668         echo "Yup, it does."
16669 else
16670         val="$undef"
16671         echo "Nope, it doesn't."
16672 fi
16673 set d_volatile
16674 eval $setvar
16675 $rm_try
16676
16677 : Check basic sizes
16678 echo " "
16679 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16680
16681 case "$use64bitint:$d_quad:$quadtype" in
16682 define:define:?*)
16683         ivtype="$quadtype"
16684         uvtype="$uquadtype"
16685         ivsize=8
16686         uvsize=8
16687         ;;
16688 *)      ivtype="long"
16689         uvtype="unsigned long"
16690         ivsize=$longsize
16691         uvsize=$longsize
16692         ;;
16693 esac
16694
16695 case "$uselongdouble:$d_longdbl" in
16696 define:define)
16697         nvtype="long double"
16698         nvsize=$longdblsize
16699         ;;
16700 *)      nvtype=double
16701         nvsize=$doublesize
16702         ;;
16703 esac
16704
16705 case "$usequadmath:$i_quadmath" in
16706 define:define)
16707   nvtype="__float128"
16708   nvsize=16
16709   case "$libs" in
16710   *quadmath*) ;;
16711   *) $cat <<EOM >&4
16712
16713 *** You requested the use of the quadmath library, but you
16714 *** do not seem to have the quadmath library installed.
16715 *** Cannot continue, aborting.
16716 EOM
16717     exit 1
16718     ;;
16719   esac
16720   ;;
16721 define:*) $cat <<EOM >&4
16722
16723 *** You requested the use of the quadmath library, but you
16724 *** do not seem to have the required header, <quadmath.h>.
16725 EOM
16726   case "$gccversion" in
16727   [23].*|4.[0-5]*)
16728    $cat <<EOM >&4
16729 *** Your gcc looks a bit old:
16730 *** $gccversion
16731 EOM
16732     ;;
16733   '')
16734    $cat <<EOM >&4
16735 *** You are not running a gcc.
16736 EOM
16737     ;;
16738   esac
16739   $cat <<EOM >&4
16740 *** For the quadmath library you need at least gcc 4.6.
16741 *** Cannot continue, aborting.
16742 EOM
16743   exit 1
16744   ;;
16745 esac
16746
16747 $echo "(IV will be "$ivtype", $ivsize bytes)"
16748 $echo "(UV will be "$uvtype", $uvsize bytes)"
16749 $echo "(NV will be "$nvtype", $nvsize bytes)"
16750
16751 $cat >try.c <<EOCP
16752 #$i_inttypes I_INTTYPES
16753 #ifdef I_INTTYPES
16754 #include <inttypes.h>
16755 #endif
16756 #include <stdio.h>
16757 int main() {
16758 #ifdef INT8
16759    int8_t i =  INT8_MAX;
16760   uint8_t u = UINT8_MAX;
16761   printf("int8_t\n");
16762 #endif
16763 #ifdef INT16
16764    int16_t i =  INT16_MAX;
16765   uint16_t u = UINT16_MAX;
16766   printf("int16_t\n");
16767 #endif
16768 #ifdef INT32
16769    int32_t i =  INT32_MAX;
16770   uint32_t u = UINT32_MAX;
16771   printf("int32_t\n");
16772 #endif
16773 }
16774 EOCP
16775
16776 i8type="signed char"
16777 u8type="unsigned char"
16778 i8size=1
16779 u8size=1
16780
16781 case "$i16type" in
16782 '')     case "$shortsize" in
16783         2)      i16type=short
16784                 u16type="unsigned short"
16785                 i16size=$shortsize
16786                 u16size=$shortsize
16787                 ;;
16788         esac
16789         ;;
16790 esac
16791 case "$i16type" in
16792 '')     set try -DINT16
16793         if eval $compile; then
16794                 case "`$run ./try`" in
16795                 int16_t)
16796                         i16type=int16_t
16797                         u16type=uint16_t
16798                         i16size=2
16799                         u16size=2
16800                         ;;
16801                 esac
16802         fi
16803         ;;
16804 esac
16805 case "$i16type" in
16806 '')     if $test $shortsize -ge 2; then
16807                 i16type=short
16808                 u16type="unsigned short"
16809                 i16size=$shortsize
16810                 u16size=$shortsize
16811         fi
16812         ;;
16813 esac
16814
16815 case "$i32type" in
16816 '')     case "$longsize" in
16817         4)      i32type=long
16818                 u32type="unsigned long"
16819                 i32size=$longsize
16820                 u32size=$longsize
16821                 ;;
16822         *)      case "$intsize" in
16823                 4)      i32type=int
16824                         u32type="unsigned int"
16825                         i32size=$intsize
16826                         u32size=$intsize
16827                         ;;
16828                 esac
16829                 ;;
16830         esac
16831         ;;
16832 esac
16833 case "$i32type" in
16834 '')     set try -DINT32
16835         if eval $compile; then
16836                 case "`$run ./try`" in
16837                 int32_t)
16838                         i32type=int32_t
16839                         u32type=uint32_t
16840                         i32size=4
16841                         u32size=4
16842                         ;;
16843                 esac
16844         fi
16845         ;;
16846 esac
16847 case "$i32type" in
16848 '')     if $test $intsize -ge 4; then
16849                 i32type=int
16850                 u32type="unsigned int"
16851                 i32size=$intsize
16852                 u32size=$intsize
16853         fi
16854         ;;
16855 esac
16856
16857 case "$i64type" in
16858 '')     case "$d_quad:$quadtype" in
16859         define:?*)
16860                 i64type="$quadtype"
16861                 u64type="$uquadtype"
16862                 i64size=8
16863                 u64size=8
16864                 ;;
16865         esac
16866         ;;
16867 esac
16868
16869 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16870 : volatile so that the compiler has to store it out to memory.
16871 if test X"$d_volatile" = X"$define"; then
16872         volatile=volatile
16873 fi
16874 $cat <<EOP >try.c
16875 #include <stdio.h>
16876 #$i_stdlib I_STDLIB
16877 #ifdef I_STDLIB
16878 #include <stdlib.h>
16879 #endif
16880 #include <sys/types.h>
16881 #include <signal.h>
16882 #ifdef SIGFPE
16883 $volatile int bletched = 0;
16884 $signal_t blech(int s) { bletched = 1; }
16885 #endif
16886 int main() {
16887     $uvtype u = 0;
16888     $nvtype d;
16889     int     n = 8 * $uvsize;
16890     int     i;
16891 #ifdef SIGFPE
16892     signal(SIGFPE, blech);
16893 #endif
16894
16895     for (i = 0; i < n; i++) {
16896       u = u << 1 | ($uvtype)1;
16897       d = ($nvtype)u;
16898       if (($uvtype)d != u)
16899         break;
16900       if (d <= 0)
16901         break;
16902       d = ($nvtype)(u - 1);
16903       if (($uvtype)d != (u - 1))
16904         break;
16905 #ifdef SIGFPE
16906       if (bletched)
16907         break;
16908 #endif
16909     }
16910     printf("%d\n", ((i == n) ? -n : i));
16911     exit(0);
16912 }
16913 EOP
16914 set try
16915
16916 d_nv_preserves_uv="$undef"
16917 if eval $compile; then
16918         nv_preserves_uv_bits="`$run ./try`"
16919 fi
16920 case "$nv_preserves_uv_bits" in
16921 \-[1-9]*)
16922         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16923         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16924         d_nv_preserves_uv="$define"
16925         ;;
16926 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16927         d_nv_preserves_uv="$undef" ;;
16928 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16929         nv_preserves_uv_bits="0" ;;
16930 esac
16931 $rm_try
16932
16933 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16934 : volatile so that the compiler has to store it out to memory.
16935 if test X"$d_volatile" = X"$define"; then
16936         volatile=volatile
16937 fi
16938 $cat <<EOP >try.c
16939 #include <stdio.h>
16940
16941 typedef $nvtype NV;
16942
16943 int
16944 main() {
16945   NV value = 2;
16946   int count = 1;
16947
16948   while(count < 256) {
16949     $volatile NV up = value + 1.0;
16950     $volatile NV negated = -value;
16951     $volatile NV down = negated - 1.0;
16952     $volatile NV got_up = up - value;
16953     int up_good = got_up == 1.0;
16954     int got_down = down - negated;
16955     int down_good = got_down == -1.0;
16956
16957     if (down_good != up_good) {
16958       fprintf(stderr,
16959               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16960               up_good, (double) got_up, down_good, (double) got_down,
16961               count, (double) value);
16962       return 1;
16963     }
16964     if (!up_good) {
16965       while (1) {
16966         if (count > 8) {
16967           count -= 8;
16968           fputs("256.0", stdout);
16969         } else {
16970           count--;
16971           fputs("2.0", stdout);
16972         }
16973         if (!count) {
16974           puts("");
16975           return 0;
16976         }
16977         fputs("*", stdout);
16978       }
16979     }
16980     value *= 2;
16981     ++count;
16982   }
16983   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16984           count, (double) value);
16985   return 1;
16986 }
16987 EOP
16988 set try
16989
16990 nv_overflows_integers_at='0'
16991 if eval $compile; then
16992     xxx="`$run ./try`"
16993     case "$?" in
16994         0)
16995             case "$xxx" in
16996                 2*)  cat >&4 <<EOM
16997 The largest integer your NVs can preserve is equal to $xxx
16998 EOM
16999                     nv_overflows_integers_at="$xxx"
17000                     ;;
17001                 *)  cat >&4 <<EOM
17002 Cannot determine the largest integer value your NVs can hold, unexpected output
17003 '$xxx'
17004 EOM
17005                     ;;
17006             esac
17007             ;;
17008         *)  cat >&4 <<EOM
17009 Cannot determine the largest integer value your NVs can hold
17010 EOM
17011             ;;
17012     esac
17013 fi
17014 $rm_try
17015
17016 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
17017 : volatile so that the compiler has to store it out to memory.
17018 if test X"$d_volatile" = X"$define"; then
17019         volatile=volatile
17020 fi
17021 $cat <<EOP >try.c
17022 #include <stdio.h>
17023 #$i_stdlib I_STDLIB
17024 #ifdef I_STDLIB
17025 #include <stdlib.h>
17026 #endif
17027 #$i_string I_STRING
17028 #ifdef I_STRING
17029 #  include <string.h>
17030 #else
17031 #  include <strings.h>
17032 #endif
17033 #include <sys/types.h>
17034 #include <signal.h>
17035 #ifdef SIGFPE
17036 $volatile int bletched = 0;
17037 $signal_t blech(int s) { bletched = 1; }
17038 #endif
17039
17040 int checkit($nvtype d, char *where) {
17041     unsigned char *p = (char *)&d;
17042     unsigned char *end = p + sizeof(d);
17043     int fail = 0;
17044
17045     while (p < end)
17046         fail += *p++;
17047
17048     if (!fail)
17049         return 0;
17050
17051     p = (char *)&d;
17052     printf("No - %s: 0x", where);
17053     while (p < end)
17054         printf ("%02X", *p++);
17055     printf("\n");
17056     return 1;
17057 }
17058
17059 int main(int argc, char **argv) {
17060     $nvtype d = 0.0;
17061     int fail = 0;
17062     fail += checkit(d, "0.0");
17063
17064     /* The compiler shouldn't be assuming that bletched is 0  */
17065     d = bletched;
17066
17067     fail += checkit(d, "bleched");
17068
17069 #ifdef SIGFPE
17070     signal(SIGFPE, blech);
17071 #endif
17072
17073     /* Paranoia - the compiler should have no way of knowing that ANSI says
17074        that argv[argc] will always be NULL.  Actually, if it did assume this it
17075        would be buggy, as this is C and main() can be called from elsewhere in
17076        the program.  */
17077     d = argv[argc] ? 1 : 0;
17078
17079     if (d) {
17080         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17081     }
17082
17083     fail += checkit(d, "ternary");
17084
17085     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17086
17087     if (d != 0.0) {
17088         printf("No - memset doesn't give 0.0\n");
17089         /* This might just blow up:  */
17090         printf("(gives %g)\n", d);
17091         return 1;
17092     }
17093
17094 #ifdef SIGFPE
17095     if (bletched) {
17096         printf("No - something bleched\n");
17097         return 1;
17098     }
17099 #endif
17100     if (fail) {
17101       printf("No - %d fail(s)\n", fail);
17102       return 1;
17103     }
17104     printf("Yes\n");
17105     return 0;
17106 }
17107 EOP
17108 set try
17109
17110 d_nv_zero_is_allbits_zero="$undef"
17111 if eval $compile; then
17112     xxx="`$run ./try`"
17113     case "$?" in
17114         0)
17115             case "$xxx" in
17116                 Yes)  cat >&4 <<EOM
17117 0.0 is represented as all bits zero in memory
17118 EOM
17119                     d_nv_zero_is_allbits_zero="$define"
17120                     ;;
17121                 *)  cat >&4 <<EOM
17122 0.0 is not represented as all bits zero in memory
17123 EOM
17124                     d_nv_zero_is_allbits_zero="$undef"
17125                     ;;
17126             esac
17127             ;;
17128         *)  cat >&4 <<EOM
17129 0.0 is not represented as all bits zero in memory
17130 EOM
17131             d_nv_zero_is_allbits_zero="$undef"
17132             ;;
17133     esac
17134 fi
17135 $rm_try
17136
17137 : check for off64_t
17138 echo " "
17139 echo "Checking to see if you have off64_t..." >&4
17140 $cat >try.c <<EOCP
17141 #include <sys/types.h>
17142 #include <unistd.h>
17143 int main() { off64_t x = 7; }
17144 EOCP
17145 set try
17146 if eval $compile; then
17147         val="$define"
17148         echo "You have off64_t."
17149 else
17150         val="$undef"
17151         echo "You do not have off64_t."
17152         case "$lseeksize" in
17153         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17154         esac
17155 fi
17156 $rm_try
17157 set d_off64_t
17158 eval $setvar
17159
17160 : how to create joinable pthreads
17161 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17162         echo " "
17163         echo "Checking what constant to use for creating joinable pthreads..." >&4
17164         $cat >try.c <<'EOCP'
17165 #include <pthread.h>
17166 int main() {
17167     int detachstate = JOINABLE;
17168 }
17169 EOCP
17170         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17171         if eval $compile; then
17172                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17173                 val="$undef" # Yes, undef.
17174                 set d_old_pthread_create_joinable
17175                 eval $setvar
17176                 val=""
17177                 set old_pthread_create_joinable
17178                 eval $setvar
17179         else
17180                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17181                 if eval $compile; then
17182                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17183                         val="$define"
17184                         set d_old_pthread_create_joinable
17185                         eval $setvar
17186                         val=PTHREAD_CREATE_UNDETACHED
17187                         set old_pthread_create_joinable
17188                         eval $setvar
17189                 else
17190                         set try -DJOINABLE=__UNDETACHED
17191                         if eval $compile; then
17192                                 echo "You seem to use __UNDETACHED." >&4
17193                                 val="$define"
17194                                 set d_old_pthread_create_joinable
17195                                 eval $setvar
17196                                 val=__UNDETACHED
17197                                 set old_pthread_create_joinable
17198                                 eval $setvar
17199                         else
17200                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17201                                 val="$define"
17202                                 set d_old_pthread_create_joinable
17203                                 eval $setvar
17204                                 val=0
17205                                 set old_pthread_create_joinable
17206                                 eval $setvar
17207                         fi
17208                 fi
17209         fi
17210         $rm_try
17211 else
17212     d_old_pthread_create_joinable="$undef"
17213     old_pthread_create_joinable=""
17214 fi
17215
17216 : see if pause exists
17217 set pause d_pause
17218 eval $inlibc
17219
17220 : see if poll exists
17221 set poll d_poll
17222 eval $inlibc
17223
17224 : see if prctl exists
17225 set prctl d_prctl
17226 eval $inlibc
17227
17228 : see if prctl supports PR_SET_NAME
17229 d_prctl_set_name=$undef
17230 case $d_prctl in
17231     $define)
17232         $cat >try.c <<EOM
17233 #ifdef __ANDROID__
17234 #include <unistd.h>
17235 #endif
17236 #include <sys/prctl.h>
17237
17238 int main (int argc, char *argv[])
17239 {
17240     return (prctl (PR_SET_NAME, "Test"));
17241     } /* main */
17242 EOM
17243         set try
17244         if eval $compile_ok && $run ./try; then
17245             echo "Your prctl (PR_SET_NAME, ...) works"
17246             d_prctl_set_name=$define
17247             fi
17248         $rm_try
17249         ;;
17250     esac
17251
17252 : see if readlink exists
17253 set readlink d_readlink
17254 eval $inlibc
17255
17256 : Check if there is a /proc symlink to the abs path of
17257 : the executing program.  We will honor hints of d_procselfexe=$undef
17258 : or procselfexe being non-empty, otherwise will try to determine both
17259 : if we have readlink.
17260 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17261 : referenced, and AmigaOS does not have a proc filesystem anyway.
17262 echo " "
17263 val="$undef"
17264 if $test "X$d_procselfexe" = Xundef; then
17265         procselfexe=''
17266 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17267         val="$define"
17268 elif $test "X$d_readlink" = Xdefine; then
17269         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17270         : and it feels more tidy to avoid an extra level of symlink
17271         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17272         while test $# -gt 0; do
17273             type=$1; try=$2
17274             shift; shift
17275             if $issymlink $try; then
17276                 $ls -l $try > reflect
17277                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17278                     echo "You have $type-like $try."
17279                     procselfexe='"'$try'"'
17280                     val="$define"
17281                     : This will break out of the loop
17282                     set X; shift
17283                 fi
17284             fi
17285         done
17286 fi
17287 $rm -f reflect
17288 set d_procselfexe
17289 eval $setvar
17290
17291 : backward compatibility for d_hvfork
17292 if test X$d_hvfork != X; then
17293         d_vfork="$d_hvfork"
17294         d_hvfork=''
17295 fi
17296 : see if there is a vfork
17297 val=''
17298 set vfork val
17299 eval $inlibc
17300
17301 d_pseudofork=$undef
17302
17303 : Ok, but do we want to use it. vfork is reportedly unreliable in
17304 : perl on Solaris 2.x, and probably elsewhere.
17305 case "$val" in
17306 $define)
17307         echo " "
17308         case "$usevfork" in
17309         false) dflt='n';;
17310         *) dflt='y';;
17311         esac
17312         cat <<'EOM'
17313
17314 Perl can only use a vfork() that doesn't suffer from strict
17315 restrictions on calling functions or modifying global data in
17316 the child.  For example, glibc-2.1 contains such a vfork()
17317 that is unsuitable.  If your system provides a proper fork()
17318 call, chances are that you do NOT want perl to use vfork().
17319
17320 EOM
17321         rp="Do you still want to use vfork()?"
17322         . ./myread
17323         case "$ans" in
17324         y|Y) ;;
17325         *)
17326                 echo "Ok, we won't use vfork()."
17327                 val="$undef"
17328                 ;;
17329         esac
17330         ;;
17331 esac
17332 set d_vfork
17333 eval $setvar
17334 case "$d_vfork" in
17335 $define) usevfork='true';;
17336 *) usevfork='false';;
17337 esac
17338
17339 : see whether the pthread_atfork exists
17340 $cat >try.c <<EOP
17341 #include <pthread.h>
17342 #include <stdio.h>
17343 int main() {
17344 #ifdef  PTHREAD_ATFORK
17345         pthread_atfork(NULL,NULL,NULL);
17346 #endif
17347 }
17348 EOP
17349
17350 : see if pthread_atfork exists
17351 set try -DPTHREAD_ATFORK
17352 if eval $compile; then
17353     val="$define"
17354 else
17355     val="$undef"
17356 fi
17357 case "$usethreads" in
17358 $define)
17359         case "$val" in
17360         $define) echo 'pthread_atfork found.' >&4        ;;
17361         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17362         esac
17363 esac
17364 set d_pthread_atfork
17365 eval $setvar
17366
17367 : see if pthread_attr_setscope exists
17368 set pthread_attr_setscope d_pthread_attr_setscope
17369 eval $inlibc
17370
17371 : see whether the various POSIXish _yields exist
17372 $cat >try.c <<EOP
17373 #include <pthread.h>
17374 #include <stdio.h>
17375 int main() {
17376 #ifdef SCHED_YIELD
17377         sched_yield();
17378 #else
17379 #ifdef PTHREAD_YIELD
17380         pthread_yield();
17381 #else
17382 #ifdef PTHREAD_YIELD_NULL
17383         pthread_yield(NULL);
17384 #endif
17385 #endif
17386 #endif
17387 }
17388 EOP
17389 : see if sched_yield exists
17390 set try -DSCHED_YIELD
17391 if eval $compile; then
17392     val="$define"
17393     sched_yield='sched_yield()'
17394 else
17395     val="$undef"
17396 fi
17397 case "$usethreads" in
17398 $define)
17399         case "$val" in
17400         $define) echo 'sched_yield() found.' >&4        ;;
17401         *)       echo 'sched_yield() NOT found.' >&4    ;;
17402         esac
17403 esac
17404 set d_sched_yield
17405 eval $setvar
17406
17407 : see if pthread_yield exists
17408 set try -DPTHREAD_YIELD
17409 if eval $compile; then
17410     val="$define"
17411     case "$sched_yield" in
17412     '') sched_yield='pthread_yield()' ;;
17413     esac
17414 else
17415     set try -DPTHREAD_YIELD_NULL
17416     if eval $compile; then
17417         val="$define"
17418         case "$sched_yield" in
17419         '') sched_yield='pthread_yield(NULL)' ;;
17420         esac
17421     else
17422         val="$undef"
17423     fi
17424 fi
17425 case "$usethreads" in
17426 $define)
17427         case "$val" in
17428         $define) echo 'pthread_yield() found.' >&4      ;;
17429         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17430         esac
17431         ;;
17432 esac
17433 set d_pthread_yield
17434 eval $setvar
17435 case "$sched_yield" in
17436 '') sched_yield=undef ;;
17437 esac
17438 $rm_try
17439
17440 : check for ptrdiff_t
17441 echo " "
17442 echo "Checking to see if you have ptrdiff_t..." >&4
17443 $cat >try.c <<EOCP
17444 #include <stddef.h>
17445 int main() { ptrdiff_t x = 7; }
17446 EOCP
17447 set try
17448 if eval $compile; then
17449         val="$define"
17450         echo "You have ptrdiff_t."
17451 else
17452         val="$undef"
17453         echo "You do not have ptrdiff_t."
17454 fi
17455 $rm_try
17456 set d_ptrdiff_t
17457 eval $setvar
17458
17459 : see if random_r exists
17460 set random_r d_random_r
17461 eval $inlibc
17462 case "$d_random_r" in
17463 "$define")
17464         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17465         case "$d_random_r_proto:$usethreads" in
17466         ":define")      d_random_r_proto=define
17467                 set d_random_r_proto random_r $hdrs
17468                 eval $hasproto ;;
17469         *)      ;;
17470         esac
17471         case "$d_random_r_proto" in
17472         define)
17473         case "$random_r_proto" in
17474         ''|0) try='int random_r(int*, struct random_data*);'
17475         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17476         esac
17477         case "$random_r_proto" in
17478         ''|0) try='int random_r(long*, struct random_data*);'
17479         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17480         esac
17481         case "$random_r_proto" in
17482         ''|0) try='int random_r(struct random_data*, int32_t*);'
17483         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17484         esac
17485         case "$random_r_proto" in
17486         ''|0)   d_random_r=undef
17487                 random_r_proto=0
17488                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17489         * )     case "$random_r_proto" in
17490                 REENTRANT_PROTO*) ;;
17491                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17492                 esac
17493                 echo "Prototype: $try" ;;
17494         esac
17495         ;;
17496         *)      case "$usethreads" in
17497                 define) echo "random_r has no prototype, not using it." >&4 ;;
17498                 esac
17499                 d_random_r=undef
17500                 random_r_proto=0
17501                 ;;
17502         esac
17503         ;;
17504 *)      random_r_proto=0
17505         ;;
17506 esac
17507
17508 : see if readdir and friends exist
17509 set readdir d_readdir
17510 eval $inlibc
17511 set seekdir d_seekdir
17512 eval $inlibc
17513 set telldir d_telldir
17514 eval $inlibc
17515 set rewinddir d_rewinddir
17516 eval $inlibc
17517
17518 : see if readdir64_r exists
17519 set readdir64_r d_readdir64_r
17520 eval $inlibc
17521 case "$d_readdir64_r" in
17522 "$define")
17523         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17524         case "$d_readdir64_r_proto:$usethreads" in
17525         ":define")      d_readdir64_r_proto=define
17526                 set d_readdir64_r_proto readdir64_r $hdrs
17527                 eval $hasproto ;;
17528         *)      ;;
17529         esac
17530         case "$d_readdir64_r_proto" in
17531         define)
17532         case "$readdir64_r_proto" in
17533         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17534         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17535         esac
17536         case "$readdir64_r_proto" in
17537         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17538         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17539         esac
17540         case "$readdir64_r_proto" in
17541         ''|0)   d_readdir64_r=undef
17542                 readdir64_r_proto=0
17543                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17544         * )     case "$readdir64_r_proto" in
17545                 REENTRANT_PROTO*) ;;
17546                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17547                 esac
17548                 echo "Prototype: $try" ;;
17549         esac
17550         ;;
17551         *)      case "$usethreads" in
17552                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17553                 esac
17554                 d_readdir64_r=undef
17555                 readdir64_r_proto=0
17556                 ;;
17557         esac
17558         ;;
17559 *)      readdir64_r_proto=0
17560         ;;
17561 esac
17562
17563 : see if readdir_r exists
17564 set readdir_r d_readdir_r
17565 eval $inlibc
17566 case "$d_readdir_r" in
17567 "$define")
17568         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17569         case "$d_readdir_r_proto:$usethreads" in
17570         ":define")      d_readdir_r_proto=define
17571                 set d_readdir_r_proto readdir_r $hdrs
17572                 eval $hasproto ;;
17573         *)      ;;
17574         esac
17575         case "$d_readdir_r_proto" in
17576         define)
17577         case "$readdir_r_proto" in
17578         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17579         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17580         esac
17581         case "$readdir_r_proto" in
17582         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17583         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17584         esac
17585         case "$readdir_r_proto" in
17586         ''|0)   d_readdir_r=undef
17587                 readdir_r_proto=0
17588                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17589         * )     case "$readdir_r_proto" in
17590                 REENTRANT_PROTO*) ;;
17591                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17592                 esac
17593                 echo "Prototype: $try" ;;
17594         esac
17595         ;;
17596         *)      case "$usethreads" in
17597                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17598                 esac
17599                 d_readdir_r=undef
17600                 readdir_r_proto=0
17601                 ;;
17602         esac
17603         ;;
17604 *)      readdir_r_proto=0
17605         ;;
17606 esac
17607
17608 : see if readv exists
17609 set readv d_readv
17610 eval $inlibc
17611
17612 : see if recvmsg exists
17613 set recvmsg d_recvmsg
17614 eval $inlibc
17615
17616 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17617 echo " "
17618 if set regcomp val -f d_regcomp; eval $csym; $val; then
17619         echo 'regcomp() found.' >&4
17620         d_regcomp="$define"
17621         d_regcmp="$undef"
17622         d_re_comp="$undef"
17623 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17624         echo 'regcmp() found.' >&4
17625         d_regcmp="$define"
17626         d_regcomp="$undef"
17627         d_re_comp="$undef"
17628 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17629         echo 're_comp() found, assuming re_exec() also exists.' >&4
17630         d_re_comp="$define"
17631         d_regcomp="$undef"
17632         d_regcmp="$undef"
17633 else
17634         $cat >&4 <<EOM
17635 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17636 EOM
17637         d_regcmp="$undef"
17638         d_re_comp="$undef"
17639         d_regcomp="$undef"
17640 fi
17641
17642 : see if remainder exists
17643 set remainder d_remainder
17644 eval $inlibc
17645
17646 : see if remquo exists
17647 set remquo d_remquo
17648 eval $inlibc
17649
17650 : see if rename exists
17651 set rename d_rename
17652 eval $inlibc
17653
17654 : see if rint exists
17655 set rint d_rint
17656 eval $inlibc
17657
17658 : see if rmdir exists
17659 set rmdir d_rmdir
17660 eval $inlibc
17661
17662 : see if round exists
17663 set round d_round
17664 eval $inlibc
17665
17666 : see if memory.h is available.
17667 val=''
17668 set memory.h val
17669 eval $inhdr
17670
17671 : See if it conflicts with string.h
17672 case "$val" in
17673 $define)
17674         case "$strings" in
17675         '') ;;
17676         *)
17677                 $cppstdin $cppflags $cppminus < $strings > mem.h
17678                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17679                         echo " "
17680                         echo "We won't be including <memory.h>."
17681                         val="$undef"
17682                 fi
17683                 $rm -f mem.h
17684                 ;;
17685         esac
17686 esac
17687 set i_memory
17688 eval $setvar
17689
17690 : can bcopy handle overlapping blocks?
17691 echo " "
17692 val="$undef"
17693 case "$d_memmove" in
17694 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17695 *)      case "$d_bcopy" in
17696         "$define")
17697                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17698                 $cat >try.c <<EOCP
17699 #$i_memory I_MEMORY
17700 #$i_stdlib I_STDLIB
17701 #$i_string I_STRING
17702 #$i_unistd I_UNISTD
17703 EOCP
17704         $cat >>try.c <<'EOCP'
17705 #include <stdio.h>
17706 #ifdef I_MEMORY
17707 #  include <memory.h>
17708 #endif
17709 #ifdef I_STDLIB
17710 #  include <stdlib.h>
17711 #endif
17712 #ifdef I_STRING
17713 #  include <string.h>
17714 #else
17715 #  include <strings.h>
17716 #endif
17717 #ifdef I_UNISTD
17718 #  include <unistd.h>  /* Needed for NetBSD */
17719 #endif
17720 int main()
17721 {
17722 char buf[128], abc[128];
17723 char *b;
17724 int len;
17725 int off;
17726 int align;
17727
17728 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17729    try to store the string in read-only memory. */
17730 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17731
17732 for (align = 7; align >= 0; align--) {
17733         for (len = 36; len; len--) {
17734                 b = buf+align;
17735                 bcopy(abc, b, len);
17736                 for (off = 1; off <= len; off++) {
17737                         bcopy(b, b+off, len);
17738                         bcopy(b+off, b, len);
17739                         if (bcmp(b, abc, len))
17740                                 exit(1);
17741                 }
17742         }
17743 }
17744 exit(0);
17745 }
17746 EOCP
17747                 set try
17748                 if eval $compile_ok; then
17749                         if $run ./try 2>/dev/null; then
17750                                 echo "Yes, it can."
17751                                 val="$define"
17752                         else
17753                                 echo "It can't, sorry."
17754                         fi
17755                 else
17756                         echo "(I can't compile the test program, so we'll assume not...)"
17757                 fi
17758                 ;;
17759         esac
17760         $rm_try
17761         ;;
17762 esac
17763 set d_safebcpy
17764 eval $setvar
17765
17766 : can memcpy handle overlapping blocks?
17767 echo " "
17768 val="$undef"
17769 case "$d_memmove" in
17770 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17771 *)      case "$d_memcpy" in
17772         "$define")
17773                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17774                 $cat >try.c <<EOCP
17775 #$i_memory I_MEMORY
17776 #$i_stdlib I_STDLIB
17777 #$i_string I_STRING
17778 #$i_unistd I_UNISTD
17779 EOCP
17780         $cat >>try.c <<'EOCP'
17781 #include <stdio.h>
17782 #ifdef I_MEMORY
17783 #  include <memory.h>
17784 #endif
17785 #ifdef I_STDLIB
17786 #  include <stdlib.h>
17787 #endif
17788 #ifdef I_STRING
17789 #  include <string.h>
17790 #else
17791 #  include <strings.h>
17792 #endif
17793 #ifdef I_UNISTD
17794 #  include <unistd.h>  /* Needed for NetBSD */
17795 #endif
17796 int main()
17797 {
17798 char buf[128], abc[128];
17799 char *b;
17800 int len;
17801 int off;
17802 int align;
17803
17804 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17805    try to store the string in read-only memory. */
17806 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17807
17808 for (align = 7; align >= 0; align--) {
17809         for (len = 36; len; len--) {
17810                 b = buf+align;
17811                 memcpy(b, abc, len);
17812                 for (off = 1; off <= len; off++) {
17813                         memcpy(b+off, b, len);
17814                         memcpy(b, b+off, len);
17815                         if (memcmp(b, abc, len))
17816                                 exit(1);
17817                 }
17818         }
17819 }
17820 exit(0);
17821 }
17822 EOCP
17823                 set try
17824                 if eval $compile_ok; then
17825                         if $run ./try 2>/dev/null; then
17826                                 echo "Yes, it can."
17827                                 val="$define"
17828                         else
17829                                 echo "It can't, sorry."
17830                         fi
17831                 else
17832                         echo "(I can't compile the test program, so we'll assume not...)"
17833                 fi
17834                 ;;
17835         esac
17836         $rm_try
17837         ;;
17838 esac
17839 set d_safemcpy
17840 eval $setvar
17841
17842 : can memcmp be trusted to compare relative magnitude?
17843 val="$undef"
17844 case "$d_memcmp" in
17845 "$define")
17846         echo " "
17847         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17848         $cat >try.c <<EOCP
17849 #$i_memory I_MEMORY
17850 #$i_stdlib I_STDLIB
17851 #$i_string I_STRING
17852 #$i_unistd I_UNISTD
17853 EOCP
17854         $cat >>try.c <<'EOCP'
17855 #include <stdio.h>
17856 #ifdef I_MEMORY
17857 #  include <memory.h>
17858 #endif
17859 #ifdef I_STDLIB
17860 #  include <stdlib.h>
17861 #endif
17862 #ifdef I_STRING
17863 #  include <string.h>
17864 #else
17865 #  include <strings.h>
17866 #endif
17867 #ifdef I_UNISTD
17868 #  include <unistd.h>  /* Needed for NetBSD */
17869 #endif
17870 int main()
17871 {
17872 char a = -1;
17873 char b = 0;
17874 if ((a < b) && memcmp(&a, &b, 1) < 0)
17875         exit(1);
17876 exit(0);
17877 }
17878 EOCP
17879         set try
17880         if eval $compile_ok; then
17881                 if $run ./try 2>/dev/null; then
17882                         echo "Yes, it can."
17883                         val="$define"
17884                 else
17885                         echo "No, it can't (it uses signed chars)."
17886                 fi
17887         else
17888                 echo "(I can't compile the test program, so we'll assume not...)"
17889         fi
17890         ;;
17891 esac
17892 $rm_try
17893 set d_sanemcmp
17894 eval $setvar
17895
17896 : see if prototype for sbrk is available
17897 echo " "
17898 set d_sbrkproto sbrk $i_unistd unistd.h
17899 eval $hasproto
17900
17901 : see if scalbn exists
17902 set scalbn d_scalbn
17903 eval $inlibc
17904
17905 : see if select exists
17906 set select d_select
17907 eval $inlibc
17908
17909 : see if semctl exists
17910 set semctl d_semctl
17911 eval $inlibc
17912
17913 : see if semget exists
17914 set semget d_semget
17915 eval $inlibc
17916
17917 : see if semop exists
17918 set semop d_semop
17919 eval $inlibc
17920
17921 : see how much of the 'sem*(2)' library is present.
17922 h_sem=true
17923 echo " "
17924 case "$d_semctl$d_semget$d_semop" in
17925 *"$undef"*) h_sem=false;;
17926 esac
17927 case "$osname" in
17928 freebsd)
17929     case "`ipcs 2>&1`" in
17930     "SVID messages"*"not configured"*)
17931         echo "Your $osname does not have the sem*(2) configured." >&4
17932         h_sem=false
17933         val="$undef"
17934         set semctl d_semctl
17935         eval $setvar
17936         set semget d_semget
17937         eval $setvar
17938         set semop d_semop
17939         eval $setvar
17940         ;;
17941     esac
17942     ;;
17943 esac
17944 : we could also check for sys/ipc.h ...
17945 if $h_sem && $test `./findhdr sys/sem.h`; then
17946         echo "You have the full sem*(2) library." >&4
17947         val="$define"
17948 else
17949         echo "You don't have the full sem*(2) library." >&4
17950         val="$undef"
17951 fi
17952 set d_sem
17953 eval $setvar
17954
17955 : see whether sys/sem.h defines union semun
17956 echo " "
17957 $cat > try.c <<'END'
17958 #include <sys/types.h>
17959 #include <sys/ipc.h>
17960 #include <sys/sem.h>
17961 int main () { union semun semun; semun.buf = 0; }
17962 END
17963 set try
17964 if eval $compile; then
17965     echo "You have union semun in <sys/sem.h>." >&4
17966     val="$define"
17967 else
17968     echo "You do not have union semun in <sys/sem.h>." >&4
17969     val="$undef"
17970 fi
17971 $rm_try
17972 set d_union_semun
17973 eval $setvar
17974
17975 : see how to do semctl IPC_STAT
17976 case "$d_sem" in
17977 $define)
17978     echo " "
17979     $cat > tryh.h <<END
17980 #ifndef S_IRUSR
17981 #   ifdef S_IREAD
17982 #       define S_IRUSR S_IREAD
17983 #       define S_IWUSR S_IWRITE
17984 #       define S_IXUSR S_IEXEC
17985 #   else
17986 #       define S_IRUSR 0400
17987 #       define S_IWUSR 0200
17988 #       define S_IXUSR 0100
17989 #   endif
17990 #   define S_IRGRP (S_IRUSR>>3)
17991 #   define S_IWGRP (S_IWUSR>>3)
17992 #   define S_IXGRP (S_IXUSR>>3)
17993 #   define S_IROTH (S_IRUSR>>6)
17994 #   define S_IWOTH (S_IWUSR>>6)
17995 #   define S_IXOTH (S_IXUSR>>6)
17996 #endif
17997 #ifndef S_IRWXU
17998 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17999 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
18000 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
18001 #endif
18002 END
18003     : see whether semctl IPC_STAT can use union semun
18004     case "$d_semctl_semun" in
18005     '')
18006       val="$undef"
18007       $cat > try.c <<END
18008 #include <sys/types.h>
18009 #include <sys/ipc.h>
18010 #include <sys/sem.h>
18011 #include <sys/stat.h>
18012 #include <stdio.h>
18013 #include <errno.h>
18014 #include "tryh.h"
18015 #ifndef errno
18016 extern int errno;
18017 #endif
18018 #$d_union_semun HAS_UNION_SEMUN
18019 int main() {
18020     union semun
18021 #ifndef HAS_UNION_SEMUN
18022     {
18023         int val;
18024         struct semid_ds *buf;
18025         unsigned short *array;
18026     }
18027 #endif
18028     arg;
18029     int sem, st;
18030
18031 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18032     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18033     if (sem > -1) {
18034         struct semid_ds argbuf;
18035         arg.buf = &argbuf;
18036 #       ifdef IPC_STAT
18037         st = semctl(sem, 0, IPC_STAT, arg);
18038         if (st == 0)
18039             printf("semun\n");
18040         else
18041 #       endif /* IPC_STAT */
18042             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18043 #       ifdef IPC_RMID
18044         if (semctl(sem, 0, IPC_RMID, arg) != 0)
18045 #       endif /* IPC_RMID */
18046             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18047     } else
18048 #endif /* IPC_PRIVATE && ... */
18049         printf("semget failed: errno = %d\n", errno);
18050   return 0;
18051 }
18052 END
18053       set try
18054       if eval $compile; then
18055           xxx=`$run ./try`
18056           case "$xxx" in
18057           semun) val="$define" ;;
18058           esac
18059       fi
18060       $rm_try
18061       set d_semctl_semun
18062       eval $setvar
18063       ;;
18064     esac
18065     case "$d_semctl_semun" in
18066     $define)
18067         echo "You can use union semun for semctl IPC_STAT." >&4
18068         also='also'
18069         ;;
18070     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
18071         also=''
18072         ;;
18073     esac
18074
18075     : see whether semctl IPC_STAT can use struct semid_ds pointer
18076     case "$d_semctl_semid_ds" in
18077     '')
18078       val="$undef"
18079       $cat > try.c <<'END'
18080 #include <sys/types.h>
18081 #include <sys/ipc.h>
18082 #include <sys/sem.h>
18083 #include <sys/stat.h>
18084 #include "tryh.h"
18085 #include <stdio.h>
18086 #include <errno.h>
18087 #ifndef errno
18088 extern int errno;
18089 #endif
18090 int main() {
18091     struct semid_ds arg;
18092     int sem, st;
18093
18094 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18095     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18096     if (sem > -1) {
18097 #       ifdef IPC_STAT
18098         st = semctl(sem, 0, IPC_STAT, &arg);
18099         if (st == 0)
18100             printf("semid_ds\n");
18101         else
18102 #       endif /* IPC_STAT */
18103             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18104 #       ifdef IPC_RMID
18105         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18106 #       endif /* IPC_RMID */
18107             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18108     } else
18109 #endif /* IPC_PRIVATE && ... */
18110         printf("semget failed: errno = %d\n", errno);
18111
18112     return 0;
18113 }
18114 END
18115       set try
18116       if eval $compile; then
18117           xxx=`$run ./try`
18118           case "$xxx" in
18119           semid_ds) val="$define" ;;
18120           esac
18121       fi
18122       $rm_try
18123       set d_semctl_semid_ds
18124       eval $setvar
18125       ;;
18126     esac
18127     case "$d_semctl_semid_ds" in
18128     $define)
18129         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18130         ;;
18131     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18132         ;;
18133     esac
18134     ;;
18135 *)  val="$undef"
18136
18137     # We do not have the full sem*(2) library, so assume we can not
18138     # use either.
18139
18140     set d_semctl_semun
18141     eval $setvar
18142
18143     set d_semctl_semid_ds
18144     eval $setvar
18145     ;;
18146 esac
18147 $rm_try tryh.h
18148
18149 : see if sendmsg exists
18150 set sendmsg d_sendmsg
18151 eval $inlibc
18152
18153 : see if setegid exists
18154 set setegid d_setegid
18155 eval $inlibc
18156
18157 : see if seteuid exists
18158 set seteuid d_seteuid
18159 eval $inlibc
18160
18161 : see if setgrent exists
18162 set setgrent d_setgrent
18163 eval $inlibc
18164
18165 : see if setgrent_r exists
18166 set setgrent_r d_setgrent_r
18167 eval $inlibc
18168 case "$d_setgrent_r" in
18169 "$define")
18170         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18171         case "$d_setgrent_r_proto:$usethreads" in
18172         ":define")      d_setgrent_r_proto=define
18173                 set d_setgrent_r_proto setgrent_r $hdrs
18174                 eval $hasproto ;;
18175         *)      ;;
18176         esac
18177         case "$d_setgrent_r_proto" in
18178         define)
18179         case "$setgrent_r_proto" in
18180         ''|0) try='int setgrent_r(FILE**);'
18181         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18182         esac
18183         case "$setgrent_r_proto" in
18184         ''|0) try='void setgrent_r(FILE**);'
18185         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18186         esac
18187         case "$setgrent_r_proto" in
18188         ''|0)   d_setgrent_r=undef
18189                 setgrent_r_proto=0
18190                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18191         * )     case "$setgrent_r_proto" in
18192                 REENTRANT_PROTO*) ;;
18193                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18194                 esac
18195                 echo "Prototype: $try" ;;
18196         esac
18197         ;;
18198         *)      case "$usethreads" in
18199                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18200                 esac
18201                 d_setgrent_r=undef
18202                 setgrent_r_proto=0
18203                 ;;
18204         esac
18205         ;;
18206 *)      setgrent_r_proto=0
18207         ;;
18208 esac
18209
18210 : see if sethostent exists
18211 set sethostent d_sethent
18212 eval $inlibc
18213
18214 : see if sethostent_r exists
18215 set sethostent_r d_sethostent_r
18216 eval $inlibc
18217 case "$d_sethostent_r" in
18218 "$define")
18219         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18220         case "$d_sethostent_r_proto:$usethreads" in
18221         ":define")      d_sethostent_r_proto=define
18222                 set d_sethostent_r_proto sethostent_r $hdrs
18223                 eval $hasproto ;;
18224         *)      ;;
18225         esac
18226         case "$d_sethostent_r_proto" in
18227         define)
18228         case "$sethostent_r_proto" in
18229         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18230         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18231         esac
18232         case "$sethostent_r_proto" in
18233         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18234         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18235         esac
18236         case "$sethostent_r_proto" in
18237         ''|0)   d_sethostent_r=undef
18238                 sethostent_r_proto=0
18239                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18240         * )     case "$sethostent_r_proto" in
18241                 REENTRANT_PROTO*) ;;
18242                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18243                 esac
18244                 echo "Prototype: $try" ;;
18245         esac
18246         ;;
18247         *)      case "$usethreads" in
18248                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18249                 esac
18250                 d_sethostent_r=undef
18251                 sethostent_r_proto=0
18252                 ;;
18253         esac
18254         ;;
18255 *)      sethostent_r_proto=0
18256         ;;
18257 esac
18258
18259 : see if setitimer exists
18260 set setitimer d_setitimer
18261 eval $inlibc
18262
18263 : see if setlinebuf exists
18264 set setlinebuf d_setlinebuf
18265 eval $inlibc
18266
18267 : see if setlocale exists
18268 set setlocale d_setlocale
18269 eval $inlibc
18270
18271 : see if locale.h is available
18272 set locale.h i_locale
18273 eval $inhdr
18274
18275 : see if setlocale_r exists
18276 set setlocale_r d_setlocale_r
18277 eval $inlibc
18278 case "$d_setlocale_r" in
18279 "$define")
18280         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18281         case "$d_setlocale_r_proto:$usethreads" in
18282         ":define")      d_setlocale_r_proto=define
18283                 set d_setlocale_r_proto setlocale_r $hdrs
18284                 eval $hasproto ;;
18285         *)      ;;
18286         esac
18287         case "$d_setlocale_r_proto" in
18288         define)
18289         case "$setlocale_r_proto" in
18290         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18291         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18292         esac
18293         case "$setlocale_r_proto" in
18294         ''|0)   d_setlocale_r=undef
18295                 setlocale_r_proto=0
18296                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18297         * )     case "$setlocale_r_proto" in
18298                 REENTRANT_PROTO*) ;;
18299                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18300                 esac
18301                 echo "Prototype: $try" ;;
18302         esac
18303         ;;
18304         *)      case "$usethreads" in
18305                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18306                 esac
18307                 d_setlocale_r=undef
18308                 setlocale_r_proto=0
18309                 ;;
18310         esac
18311         ;;
18312 *)      setlocale_r_proto=0
18313         ;;
18314 esac
18315
18316 : see if setnetent exists
18317 set setnetent d_setnent
18318 eval $inlibc
18319
18320 : see if setnetent_r exists
18321 set setnetent_r d_setnetent_r
18322 eval $inlibc
18323 case "$d_setnetent_r" in
18324 "$define")
18325         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18326         case "$d_setnetent_r_proto:$usethreads" in
18327         ":define")      d_setnetent_r_proto=define
18328                 set d_setnetent_r_proto setnetent_r $hdrs
18329                 eval $hasproto ;;
18330         *)      ;;
18331         esac
18332         case "$d_setnetent_r_proto" in
18333         define)
18334         case "$setnetent_r_proto" in
18335         ''|0) try='int setnetent_r(int, struct netent_data*);'
18336         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18337         esac
18338         case "$setnetent_r_proto" in
18339         ''|0) try='void setnetent_r(int, struct netent_data*);'
18340         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18341         esac
18342         case "$setnetent_r_proto" in
18343         ''|0)   d_setnetent_r=undef
18344                 setnetent_r_proto=0
18345                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18346         * )     case "$setnetent_r_proto" in
18347                 REENTRANT_PROTO*) ;;
18348                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18349                 esac
18350                 echo "Prototype: $try" ;;
18351         esac
18352         ;;
18353         *)      case "$usethreads" in
18354                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18355                 esac
18356                 d_setnetent_r=undef
18357                 setnetent_r_proto=0
18358                 ;;
18359         esac
18360         ;;
18361 *)      setnetent_r_proto=0
18362         ;;
18363 esac
18364
18365 : see if setprotoent exists
18366 set setprotoent d_setpent
18367 eval $inlibc
18368
18369 : see if setpgid exists
18370 set setpgid d_setpgid
18371 eval $inlibc
18372
18373 : see if setpgrp2 exists
18374 set setpgrp2 d_setpgrp2
18375 eval $inlibc
18376
18377 : see if setpriority exists
18378 set setpriority d_setprior
18379 eval $inlibc
18380
18381 : see if setproctitle exists
18382 set setproctitle d_setproctitle
18383 eval $inlibc
18384
18385 : see if setprotoent_r exists
18386 set setprotoent_r d_setprotoent_r
18387 eval $inlibc
18388 case "$d_setprotoent_r" in
18389 "$define")
18390         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18391         case "$d_setprotoent_r_proto:$usethreads" in
18392         ":define")      d_setprotoent_r_proto=define
18393                 set d_setprotoent_r_proto setprotoent_r $hdrs
18394                 eval $hasproto ;;
18395         *)      ;;
18396         esac
18397         case "$d_setprotoent_r_proto" in
18398         define)
18399         case "$setprotoent_r_proto" in
18400         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18401         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18402         esac
18403         case "$setprotoent_r_proto" in
18404         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18405         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18406         esac
18407         case "$setprotoent_r_proto" in
18408         ''|0)   d_setprotoent_r=undef
18409                 setprotoent_r_proto=0
18410                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18411         * )     case "$setprotoent_r_proto" in
18412                 REENTRANT_PROTO*) ;;
18413                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18414                 esac
18415                 echo "Prototype: $try" ;;
18416         esac
18417         ;;
18418         *)      case "$usethreads" in
18419                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18420                 esac
18421                 d_setprotoent_r=undef
18422                 setprotoent_r_proto=0
18423                 ;;
18424         esac
18425         ;;
18426 *)      setprotoent_r_proto=0
18427         ;;
18428 esac
18429
18430 : see if setpwent exists
18431 set setpwent d_setpwent
18432 eval $inlibc
18433
18434 : see if setpwent_r exists
18435 set setpwent_r d_setpwent_r
18436 eval $inlibc
18437 case "$d_setpwent_r" in
18438 "$define")
18439         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18440         case "$d_setpwent_r_proto:$usethreads" in
18441         ":define")      d_setpwent_r_proto=define
18442                 set d_setpwent_r_proto setpwent_r $hdrs
18443                 eval $hasproto ;;
18444         *)      ;;
18445         esac
18446         case "$d_setpwent_r_proto" in
18447         define)
18448         case "$setpwent_r_proto" in
18449         ''|0) try='int setpwent_r(FILE**);'
18450         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18451         esac
18452         case "$setpwent_r_proto" in
18453         ''|0) try='void setpwent_r(FILE**);'
18454         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18455         esac
18456         case "$setpwent_r_proto" in
18457         ''|0)   d_setpwent_r=undef
18458                 setpwent_r_proto=0
18459                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18460         * )     case "$setpwent_r_proto" in
18461                 REENTRANT_PROTO*) ;;
18462                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18463                 esac
18464                 echo "Prototype: $try" ;;
18465         esac
18466         ;;
18467         *)      case "$usethreads" in
18468                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18469                 esac
18470                 d_setpwent_r=undef
18471                 setpwent_r_proto=0
18472                 ;;
18473         esac
18474         ;;
18475 *)      setpwent_r_proto=0
18476         ;;
18477 esac
18478
18479 : see if setregid exists
18480 set setregid d_setregid
18481 eval $inlibc
18482 set setresgid d_setresgid
18483 eval $inlibc
18484
18485 : see if setreuid exists
18486 set setreuid d_setreuid
18487 eval $inlibc
18488 set setresuid d_setresuid
18489 eval $inlibc
18490
18491 : see if setrgid exists
18492 set setrgid d_setrgid
18493 eval $inlibc
18494
18495 : see if setruid exists
18496 set setruid d_setruid
18497 eval $inlibc
18498
18499 : see if setservent exists
18500 set setservent d_setsent
18501 eval $inlibc
18502
18503 : see if setservent_r exists
18504 set setservent_r d_setservent_r
18505 eval $inlibc
18506 case "$d_setservent_r" in
18507 "$define")
18508         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18509         case "$d_setservent_r_proto:$usethreads" in
18510         ":define")      d_setservent_r_proto=define
18511                 set d_setservent_r_proto setservent_r $hdrs
18512                 eval $hasproto ;;
18513         *)      ;;
18514         esac
18515         case "$d_setservent_r_proto" in
18516         define)
18517         case "$setservent_r_proto" in
18518         ''|0) try='int setservent_r(int, struct servent_data*);'
18519         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18520         esac
18521         case "$setservent_r_proto" in
18522         ''|0) try='void setservent_r(int, struct servent_data*);'
18523         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18524         esac
18525         case "$setservent_r_proto" in
18526         ''|0)   d_setservent_r=undef
18527                 setservent_r_proto=0
18528                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18529         * )     case "$setservent_r_proto" in
18530                 REENTRANT_PROTO*) ;;
18531                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18532                 esac
18533                 echo "Prototype: $try" ;;
18534         esac
18535         ;;
18536         *)      case "$usethreads" in
18537                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18538                 esac
18539                 d_setservent_r=undef
18540                 setservent_r_proto=0
18541                 ;;
18542         esac
18543         ;;
18544 *)      setservent_r_proto=0
18545         ;;
18546 esac
18547
18548 : see if setsid exists
18549 set setsid d_setsid
18550 eval $inlibc
18551
18552 : see if setvbuf exists
18553 set setvbuf d_setvbuf
18554 eval $inlibc
18555
18556 : see if shmctl exists
18557 set shmctl d_shmctl
18558 eval $inlibc
18559
18560 : see if shmget exists
18561 set shmget d_shmget
18562 eval $inlibc
18563
18564 : see if shmat exists
18565 set shmat d_shmat
18566 eval $inlibc
18567 : see what shmat returns
18568 case "$d_shmat" in
18569 "$define")
18570         $cat >shmat.c <<'END'
18571 #include <sys/shm.h>
18572 void *shmat();
18573 END
18574         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18575                 shmattype='void *'
18576         else
18577                 shmattype='char *'
18578         fi
18579         echo "and it returns ($shmattype)." >&4
18580         : see if a prototype for shmat is available
18581         xxx=`./findhdr sys/shm.h`
18582         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18583         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18584                 val="$define"
18585         else
18586                 val="$undef"
18587         fi
18588         $rm -f shmat.[co]
18589         ;;
18590 *)
18591         val="$undef"
18592         ;;
18593 esac
18594 set d_shmatprototype
18595 eval $setvar
18596
18597 : see if shmdt exists
18598 set shmdt d_shmdt
18599 eval $inlibc
18600
18601 : see how much of the 'shm*(2)' library is present.
18602 h_shm=true
18603 echo " "
18604 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18605 *"$undef"*) h_shm=false;;
18606 esac
18607 case "$osname" in
18608 freebsd)
18609     case "`ipcs 2>&1`" in
18610     "SVID shared memory"*"not configured"*)
18611         echo "Your $osname does not have the shm*(2) configured." >&4
18612         h_shm=false
18613         val="$undef"
18614         set shmctl d_shmctl
18615         eval $setvar
18616         set shmget d_shmget
18617         eval $setvar
18618         set shmat d_shmat
18619         eval $setvar
18620         set shmdt d_shmdt
18621         eval $setvar
18622         ;;
18623     esac
18624     ;;
18625 esac
18626 : we could also check for sys/ipc.h ...
18627 if $h_shm && $test `./findhdr sys/shm.h`; then
18628         echo "You have the full shm*(2) library." >&4
18629         val="$define"
18630 else
18631         echo "You don't have the full shm*(2) library." >&4
18632         val="$undef"
18633 fi
18634 set d_shm
18635 eval $setvar
18636
18637 : see if we have sigaction
18638 echo " "
18639 if set sigaction val -f d_sigaction; eval $csym; $val; then
18640         echo 'sigaction() found.' >&4
18641         $cat > try.c <<EOP
18642 #include <stdio.h>
18643 #include <sys/types.h>
18644 #include <signal.h>
18645 #$i_stdlib I_STDLIB
18646 #ifdef I_STDLIB
18647 #include <stdlib.h>
18648 #endif
18649 int main()
18650 {
18651     struct sigaction act, oact;
18652     act.sa_flags = 0;
18653     oact.sa_handler = 0;
18654     /* so that act and oact are used */
18655     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18656 }
18657 EOP
18658         set try
18659         if eval $compile_ok; then
18660                 val="$define"
18661         else
18662                 echo "But you don't seem to have a usable struct sigaction." >&4
18663                 val="$undef"
18664         fi
18665 else
18666         echo 'sigaction NOT found.' >&4
18667         val="$undef"
18668 fi
18669 set d_sigaction; eval $setvar
18670 $rm_try
18671
18672 : see what type pids are declared as in the kernel
18673 rp="What is the type of process ids on this system?"
18674 set pid_t pidtype int stdio.h sys/types.h
18675 eval $typedef_ask
18676
18677 : see what type uids are declared as in the kernel
18678 echo " "
18679 echo "Looking for the type for user ids returned by getuid()."
18680 set uid_t uidtype xxx stdio.h sys/types.h
18681 eval $typedef
18682 case "$uidtype" in
18683 xxx)
18684         xxx=`./findhdr sys/user.h`
18685         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18686         case $1 in
18687         unsigned) dflt="$1 $2" ;;
18688         *) dflt="$1" ;;
18689         esac
18690         ;;
18691 *) dflt="$uidtype";;
18692 esac
18693 case "$uidtype" in
18694 uid_t)  echo "uid_t found." ;;
18695 *)      rp="What is the type for user ids returned by getuid()?"
18696         . ./myread
18697         uidtype="$ans"
18698         ;;
18699 esac
18700
18701 : Define hasfield_t macro for Configure internal use
18702 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18703 while $test $# -ge 2; do
18704     case "$1" in
18705         $define) echo "#include <$2>";;
18706     esac ;
18707     shift 2;
18708 done > try.c;
18709 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18710 set try;
18711 if eval $compile; then
18712         val="$define";
18713 else
18714         val="$undef";
18715 fi;
18716 set $varname;
18717 eval $setvar;
18718 $rm_try'
18719
18720 : see what siginfo fields we have
18721 case "$d_sigaction" in
18722 "$define")
18723         echo "Checking if your siginfo_t has si_errno field...">&4
18724         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18725         eval $hasfield_t;
18726
18727         echo "Checking if your siginfo_t has si_pid field...">&4
18728         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18729         eval $hasfield_t;
18730
18731         echo "Checking if your siginfo_t has si_uid field...">&4
18732         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18733         eval $hasfield_t;
18734
18735         echo "Checking if your siginfo_t has si_addr field...">&4
18736         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18737         eval $hasfield_t;
18738
18739         echo "Checking if your siginfo_t has si_status field...">&4
18740         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18741         eval $hasfield_t;
18742
18743         echo "Checking if your siginfo_t has si_band field...">&4
18744         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18745         eval $hasfield_t;
18746
18747         echo "Checking if your siginfo_t has si_value field...">&4
18748         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18749         eval $hasfield_t;
18750
18751         echo "Checking if your siginfo_t has si_fd field...">&4
18752         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18753         eval $hasfield_t;
18754
18755         ;;
18756 *)
18757         d_siginfo_si_errno="$undef"
18758         d_siginfo_si_pid="$undef"
18759         d_siginfo_si_uid="$undef"
18760         d_siginfo_si_addr="$undef"
18761         d_siginfo_si_status="$undef"
18762         d_siginfo_si_band="$undef"
18763         d_siginfo_si_value="$undef"
18764         d_siginfo_si_fd="$undef"
18765         ;;
18766 esac
18767
18768 : see if this is a sunmath.h system
18769 set sunmath.h i_sunmath
18770 eval $inhdr
18771
18772 : see if signbit exists
18773 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18774 $cat >try.c <<EOCP
18775 #$i_math I_MATH
18776 #$i_sunmath I_SUNMATH
18777 #ifdef I_MATH
18778 #  include <math.h>
18779 #endif
18780 #ifdef I_SUNMATH  /* Solaris special math library */
18781 #  include <sunmath.h>
18782 #endif
18783 #define NV $nvtype
18784 int main(int argc, char **argv)
18785 {
18786     NV x = 0.0;
18787     NV y = -0.0;
18788     if ((signbit(x) == 0) && (signbit(y) != 0))
18789         return 0;
18790     else
18791         return 1;
18792 }
18793 EOCP
18794 val="$undef"
18795 set try
18796 if eval $compile; then
18797     if $run ./try; then
18798         $echo "Yes." >&4
18799         val="$define"
18800     else
18801         $echo "Signbit seems to be available, but doesn't work as I expected."
18802         $echo "I won't use it." >&4
18803         val="$undef"
18804     fi
18805 else
18806     $echo "Nope." >&4
18807     dflt="$undef"
18808 fi
18809 set d_signbit
18810 eval $setvar
18811 $rm_try
18812
18813 : see if sigprocmask exists
18814 set sigprocmask d_sigprocmask
18815 eval $inlibc
18816
18817 : see if sigsetjmp exists
18818 echo " "
18819 case "$d_sigsetjmp" in
18820 '')
18821         $cat >try.c <<EOP
18822 #include <setjmp.h>
18823 #$i_stdlib I_STDLIB
18824 #ifdef I_STDLIB
18825 #include <stdlib.h>
18826 #endif
18827 sigjmp_buf env;
18828 int set = 1;
18829 int main()
18830 {
18831         if (sigsetjmp(env,1))
18832                 exit(set);
18833         set = 0;
18834         siglongjmp(env, 1);
18835         exit(1);
18836 }
18837 EOP
18838         set try
18839         if eval $compile; then
18840                 if $run ./try >/dev/null 2>&1; then
18841                         echo "POSIX sigsetjmp found." >&4
18842                         val="$define"
18843                 else
18844                         $cat >&4 <<EOM
18845 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18846 I'll ignore them.
18847 EOM
18848                         val="$undef"
18849                 fi
18850         else
18851                 echo "sigsetjmp not found." >&4
18852                 val="$undef"
18853         fi
18854         ;;
18855 *) val="$d_sigsetjmp"
18856         case "$d_sigsetjmp" in
18857         $define) echo "POSIX sigsetjmp found." >&4;;
18858         $undef) echo "sigsetjmp not found." >&4;;
18859         esac
18860         ;;
18861 esac
18862 set d_sigsetjmp
18863 eval $setvar
18864 $rm_try
18865
18866 : see if snprintf exists
18867 set snprintf d_snprintf
18868 eval $inlibc
18869
18870 : see if vsnprintf exists
18871 set vsnprintf d_vsnprintf
18872 eval $inlibc
18873
18874 case "$d_snprintf-$d_vsnprintf" in
18875 "$define-$define")
18876     $cat <<EOM
18877 Checking whether your snprintf() and vsnprintf() work okay...
18878 EOM
18879     $cat >try.c <<'EOCP'
18880 /* v?snprintf testing logic courtesy of Russ Allbery.
18881  * According to C99:
18882  * - if the buffer is too short it still must be \0-terminated
18883  * - if the buffer is too short the potentially required length
18884  *   must be returned and not -1
18885  * - if the buffer is NULL the potentially required length
18886  *   must be returned and not -1 or core dump
18887  */
18888 #include <stdio.h>
18889 #include <stdarg.h>
18890
18891 char buf[2];
18892
18893 int test (char *format, ...)
18894 {
18895     va_list args;
18896     int count;
18897
18898     va_start (args, format);
18899     count = vsnprintf (buf, sizeof buf, format, args);
18900     va_end (args);
18901     return count;
18902 }
18903
18904 int main ()
18905 {
18906     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18907              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18908 }
18909 EOCP
18910     set try
18911     if eval $compile; then
18912         `$run ./try`
18913         case "$?" in
18914         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18915         *) cat <<EOM >&4
18916 Your snprintf() and snprintf() don't seem to be working okay.
18917 EOM
18918            d_snprintf="$undef"
18919            d_vsnprintf="$undef"
18920            ;;
18921         esac
18922     else
18923         echo "(I can't seem to compile the test program--assuming they don't)"
18924         d_snprintf="$undef"
18925         d_vsnprintf="$undef"
18926     fi
18927     $rm_try
18928     ;;
18929 esac
18930
18931 : see if sockatmark exists
18932 set sockatmark d_sockatmark
18933 eval $inlibc
18934
18935 : see if prototype for sockatmark is available
18936 echo " "
18937 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18938 eval $hasproto
18939
18940 : see if socks5_init exists
18941 set socks5_init d_socks5_init
18942 eval $inlibc
18943
18944 : see if sprintf returns the length of the string in the buffer as per ANSI
18945 $echo "Checking whether sprintf returns the length of the string..." >&4
18946 $cat <<EOP >try.c
18947 #include <stdio.h>
18948 #$i_stdlib I_STDLIB
18949 #ifdef I_STDLIB
18950 #include <stdlib.h>
18951 #endif
18952 #$i_string I_STRING
18953 #ifdef I_STRING
18954 #  include <string.h>
18955 #else
18956 #  include <strings.h>
18957 #endif
18958 #$i_math I_MATH
18959 #ifdef I_MATH
18960 #include <math.h>
18961 #endif
18962
18963 char buffer[256];
18964
18965 int check (size_t expect, int test) {
18966   size_t got = strlen(buffer);
18967   if (expect == got)
18968     return 0;
18969
18970   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18971        test, buffer);
18972   exit (test);
18973 }
18974
18975 int main(int argc, char **argv) {
18976   int test = 0;
18977
18978   check(sprintf(buffer, ""), ++test);
18979   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18980   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18981
18982   return 0;
18983 }
18984 EOP
18985 set try
18986
18987 if eval $compile; then
18988     xxx="`$run ./try`"
18989     case "$?" in
18990         0) cat >&4 <<EOM
18991 sprintf returns the length of the string (as ANSI says it should)
18992 EOM
18993         d_sprintf_returns_strlen="$define"
18994         ;;
18995         *) cat >&4 <<EOM
18996 sprintf does not return the length of the string (how old is this system?)
18997 EOM
18998         d_sprintf_returns_strlen="$undef"
18999         ;;
19000     esac
19001 else
19002     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
19003     d_sprintf_returns_strlen="$undef"
19004 fi
19005 $rm_try
19006
19007 : see if srand48_r exists
19008 set srand48_r d_srand48_r
19009 eval $inlibc
19010 case "$d_srand48_r" in
19011 "$define")
19012         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19013         case "$d_srand48_r_proto:$usethreads" in
19014         ":define")      d_srand48_r_proto=define
19015                 set d_srand48_r_proto srand48_r $hdrs
19016                 eval $hasproto ;;
19017         *)      ;;
19018         esac
19019         case "$d_srand48_r_proto" in
19020         define)
19021         case "$srand48_r_proto" in
19022         ''|0) try='int srand48_r(long, struct drand48_data*);'
19023         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
19024         esac
19025         case "$srand48_r_proto" in
19026         ''|0)   d_srand48_r=undef
19027                 srand48_r_proto=0
19028                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
19029         * )     case "$srand48_r_proto" in
19030                 REENTRANT_PROTO*) ;;
19031                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
19032                 esac
19033                 echo "Prototype: $try" ;;
19034         esac
19035         ;;
19036         *)      case "$usethreads" in
19037                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
19038                 esac
19039                 d_srand48_r=undef
19040                 srand48_r_proto=0
19041                 ;;
19042         esac
19043         ;;
19044 *)      srand48_r_proto=0
19045         ;;
19046 esac
19047
19048 : see if srandom_r exists
19049 set srandom_r d_srandom_r
19050 eval $inlibc
19051 case "$d_srandom_r" in
19052 "$define")
19053         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19054         case "$d_srandom_r_proto:$usethreads" in
19055         ":define")      d_srandom_r_proto=define
19056                 set d_srandom_r_proto srandom_r $hdrs
19057                 eval $hasproto ;;
19058         *)      ;;
19059         esac
19060         case "$d_srandom_r_proto" in
19061         define)
19062         case "$srandom_r_proto" in
19063         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
19064         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
19065         esac
19066         case "$srandom_r_proto" in
19067         ''|0)   d_srandom_r=undef
19068                 srandom_r_proto=0
19069                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
19070         * )     case "$srandom_r_proto" in
19071                 REENTRANT_PROTO*) ;;
19072                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
19073                 esac
19074                 echo "Prototype: $try" ;;
19075         esac
19076         ;;
19077         *)      case "$usethreads" in
19078                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
19079                 esac
19080                 d_srandom_r=undef
19081                 srandom_r_proto=0
19082                 ;;
19083         esac
19084         ;;
19085 *)      srandom_r_proto=0
19086         ;;
19087 esac
19088
19089 : see if prototype for setresgid is available
19090 echo " "
19091 set d_sresgproto setresgid $i_unistd unistd.h
19092 eval $hasproto
19093
19094 : see if prototype for setresuid is available
19095 echo " "
19096 set d_sresuproto setresuid $i_unistd unistd.h
19097 eval $hasproto
19098
19099 : see if stat exists
19100 set stat d_stat
19101 eval $inlibc
19102
19103 : see if sys/stat.h is available
19104 set sys/stat.h i_sysstat
19105 eval $inhdr
19106
19107 : see if stat knows about block sizes
19108 echo " "
19109 echo "Checking to see if your struct stat has st_blocks field..." >&4
19110 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19111 eval $hasfield
19112
19113 : see if this is a sys/vfs.h system
19114 set sys/vfs.h i_sysvfs
19115 eval $inhdr
19116
19117 : see if this is a sys/statfs.h system
19118 set sys/statfs.h i_sysstatfs
19119 eval $inhdr
19120
19121 : Check for statfs_s
19122 echo " "
19123 echo "Checking to see if your system supports struct statfs..." >&4
19124 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
19125 eval $hasstruct
19126 case "$d_statfs_s" in
19127 "$define")      echo "Yes, it does."   ;;
19128 *)              echo "No, it doesn't." ;;
19129 esac
19130
19131
19132 : see if struct statfs knows about f_flags
19133 case "$d_statfs_s" in
19134 define)
19135         echo " "
19136         echo "Checking to see if your struct statfs has f_flags field..." >&4
19137         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
19138         eval $hasfield
19139         ;;
19140 *)      val="$undef"
19141         set d_statfs_f_flags
19142         eval $setvar
19143         ;;
19144 esac
19145 case "$d_statfs_f_flags" in
19146 "$define")      echo "Yes, it does."   ;;
19147 *)              echo "No, it doesn't." ;;
19148 esac
19149
19150 : see what flavor, if any, of static inline is supported
19151 echo " "
19152 echo "Checking to see if your system supports static inline..."
19153 $cat > try.c <<'EOCP'
19154 #include <stdlib.h>
19155 extern int f_via_a(int x);
19156 extern int f_via_b(int x);
19157 int main(int argc, char **argv)
19158 {
19159     int y;
19160
19161     y = f_via_a(0);
19162 #ifdef USE_B
19163     y = f_via_b(0);
19164 #endif
19165     if (y == 42) {
19166         return EXIT_SUCCESS;
19167     }
19168     else {
19169         return EXIT_FAILURE;
19170     }
19171 }
19172 EOCP
19173 $cat > a.c <<'EOCP'
19174 static INLINE int f(int x) {
19175     int y;
19176     y = x + 42;
19177     return y;
19178 }
19179
19180 int f_via_a(int x)
19181 {
19182     return f(x);
19183 }
19184 EOCP
19185 $cat > b.c <<'EOCP'
19186 extern int f(int x);
19187
19188 int f_via_b(int x)
19189 {
19190     return f(x);
19191 }
19192 EOCP
19193
19194 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19195 case "$perl_static_inline" in
19196 '')     # Check the various possibilities, and break out on success.
19197         # For gcc, prefer __inline__, which will still permit
19198         # cflags.SH to add in -ansi.
19199         case "$gccversion" in
19200                 '') xxx="inline __inline__ __inline _inline";;
19201                 *)  xxx="__inline__ inline __inline _inline";;
19202         esac
19203         for inline in $xxx; do
19204                 set try -DINLINE=$inline a.c
19205                 if eval $compile && $run ./try; then
19206                         # Now make sure there is no external linkage of static
19207                         # functions
19208                         set try -DINLINE=$inline -DUSE_B a.c b.c
19209                         if eval $compile && $run ./try; then
19210                                 $echo "Your compiler supports static $inline, " >&4
19211                                 $echo "but it also creates an external definition," >&4
19212                                 $echo "so I won't use it." >&4
19213                                 val=$undef
19214                         else
19215                                 $echo "Your compiler supports static $inline." >&4
19216                                 val=$define
19217                                 perl_static_inline="static $inline";
19218                                 break;
19219                         fi
19220                 else
19221                         $echo "Your compiler does NOT support static $inline." >&4
19222                         val="$undef"
19223                 fi
19224         done
19225         ;;
19226 *inline*) # Some variant of inline exists.
19227         echo "Keeping your $hint value of $perl_static_inline."
19228         val=$define
19229         ;;
19230 static)  # No inline capabilities
19231         echo "Keeping your $hint value of $perl_static_inline."
19232         val=$undef
19233         ;;
19234 *)  # Unrecognized previous value -- blindly trust the supplied
19235         # value and hope it makes sense.  Use old value for
19236         # d_static_inline, if there is one.
19237         echo "Keeping your $hint value of $perl_static_inline."
19238         case "$d_static_inline" in
19239                 '') val=$define ;;
19240                 *)  val=$d_static_inline ;;
19241         esac
19242         ;;
19243 esac
19244 # Fallback to plain 'static' if nothing worked.
19245 case "$perl_static_inline" in
19246 '')
19247         perl_static_inline="static"
19248         val=$undef
19249         ;;
19250 esac
19251 set d_static_inline
19252 eval $setvar
19253 $rm -f a.[co] b.[co]
19254 $rm_try
19255
19256 : Check stream access
19257 $cat >&4 <<EOM
19258 Checking how to access stdio streams by file descriptor number...
19259 EOM
19260 case "$stdio_stream_array" in
19261 '')     $cat >try.c <<EOCP
19262 #include <stdio.h>
19263 int main() {
19264   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19265     printf("yes\n");
19266 }
19267 EOCP
19268         for s in _iob __iob __sF
19269         do
19270                 set try -DSTDIO_STREAM_ARRAY=$s
19271                 if eval $compile; then
19272                         case "`$run ./try`" in
19273                         yes)    stdio_stream_array=$s; break ;;
19274                         esac
19275                 fi
19276         done
19277         $rm_try
19278 esac
19279 case "$stdio_stream_array" in
19280 '')     $cat >&4 <<EOM
19281 I can't figure out how to access stdio streams by file descriptor number.
19282 EOM
19283         d_stdio_stream_array="$undef"
19284         ;;
19285 *)      $cat >&4 <<EOM
19286 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19287 EOM
19288         d_stdio_stream_array="$define"
19289         ;;
19290 esac
19291
19292 : see if strcoll exists
19293 set strcoll d_strcoll
19294 eval $inlibc
19295
19296 : check for structure copying
19297 echo " "
19298 echo "Checking to see if your C compiler can copy structs..." >&4
19299 $cat >try.c <<'EOCP'
19300 int main()
19301 {
19302         struct blurfl {
19303                 int dyick;
19304         } foo, bar;
19305
19306         foo = bar;
19307 }
19308 EOCP
19309 if $cc -c try.c >/dev/null 2>&1 ; then
19310         val="$define"
19311         echo "Yup, it can."
19312 else
19313         val="$undef"
19314         echo "Nope, it can't."
19315 fi
19316 set d_strctcpy
19317 eval $setvar
19318 $rm_try
19319
19320 : see if strerror and/or sys_errlist[] exist
19321 echo " "
19322 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19323     if set strerror val -f d_strerror; eval $csym; $val; then
19324                 echo 'strerror() found.' >&4
19325                 d_strerror="$define"
19326                 d_strerrm='strerror(e)'
19327                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19328                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19329                         d_syserrlst="$define"
19330                 else
19331                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19332                         d_syserrlst="$undef"
19333                 fi
19334     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19335                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19336                 echo 'strerror() found in string header.' >&4
19337                 d_strerror="$define"
19338                 d_strerrm='strerror(e)'
19339                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19340                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19341                                 d_syserrlst="$define"
19342                 else
19343                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19344                         d_syserrlst="$undef"
19345                 fi
19346     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19347                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19348                 d_strerror="$undef"
19349                 d_syserrlst="$define"
19350                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19351     else
19352                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19353                 d_strerror="$undef"
19354                 d_syserrlst="$undef"
19355                 d_strerrm='"unknown"'
19356     fi
19357 fi
19358
19359 : see if strerror_l exists
19360 set strerror_l d_strerror_l
19361 eval $inlibc
19362
19363 : see if strerror_r exists
19364 set strerror_r d_strerror_r
19365 eval $inlibc
19366 case "$d_strerror_r" in
19367 "$define")
19368         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19369         case "$d_strerror_r_proto:$usethreads" in
19370         ":define")      d_strerror_r_proto=define
19371                 set d_strerror_r_proto strerror_r $hdrs
19372                 eval $hasproto ;;
19373         *)      ;;
19374         esac
19375         case "$d_strerror_r_proto" in
19376         define)
19377         case "$strerror_r_proto" in
19378         ''|0) try='int strerror_r(int, char*, size_t);'
19379         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19380         esac
19381         case "$strerror_r_proto" in
19382         ''|0) try='int strerror_r(int, char*, int);'
19383         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19384         esac
19385         case "$strerror_r_proto" in
19386         ''|0) try='char* strerror_r(int, char*, size_t);'
19387         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19388         esac
19389         case "$strerror_r_proto" in
19390         ''|0)   d_strerror_r=undef
19391                 strerror_r_proto=0
19392                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19393         * )     case "$strerror_r_proto" in
19394                 REENTRANT_PROTO*) ;;
19395                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19396                 esac
19397                 echo "Prototype: $try" ;;
19398         esac
19399         ;;
19400         *)      case "$usethreads" in
19401                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19402                 esac
19403                 d_strerror_r=undef
19404                 strerror_r_proto=0
19405                 ;;
19406         esac
19407         ;;
19408 *)      strerror_r_proto=0
19409         ;;
19410 esac
19411
19412 : see if strftime exists
19413 set strftime d_strftime
19414 eval $inlibc
19415
19416 : see if strlcat exists
19417 set strlcat d_strlcat
19418 eval $inlibc
19419
19420 : see if strlcpy exists
19421 set strlcpy d_strlcpy
19422 eval $inlibc
19423
19424 : see if strtod exists
19425 set strtod d_strtod
19426 eval $inlibc
19427
19428 : see if strtol exists
19429 set strtol d_strtol
19430 eval $inlibc
19431
19432 : see if strtold exists
19433 set strtold d_strtold
19434 eval $inlibc
19435
19436 : see if strtoll exists
19437 set strtoll d_strtoll
19438 eval $inlibc
19439
19440 case "$d_longlong-$d_strtoll" in
19441 "$define-$define")
19442         $cat <<EOM
19443 Checking whether your strtoll() works okay...
19444 EOM
19445         $cat >try.c <<'EOCP'
19446 #include <errno.h>
19447 #ifdef __hpux
19448 #define strtoll __strtoll
19449 #endif
19450 #ifdef __EMX__
19451 #define strtoll _strtoll
19452 #endif
19453 #include <stdio.h>
19454 extern long long int strtoll(char *s, char **, int);
19455 static int bad = 0;
19456 int check(char *s, long long ell, int een) {
19457         long long gll;
19458         errno = 0;
19459         gll = strtoll(s, 0, 10);
19460         if (!((gll == ell) && (errno == een)))
19461                 bad++;
19462 }
19463 int main() {
19464         check(" 1",                                      1LL, 0);
19465         check(" 0",                                      0LL, 0);
19466         check("-1",                                     -1LL, 0);
19467         check("-9223372036854775808", -9223372036854775808LL, 0);
19468         check("-9223372036854775808", -9223372036854775808LL, 0);
19469         check(" 9223372036854775807",  9223372036854775807LL, 0);
19470         check("-9223372036854775808", -9223372036854775808LL, 0);
19471         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19472         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19473         if (!bad)
19474                 printf("ok\n");
19475 }
19476 EOCP
19477         set try
19478         if eval $compile; then
19479                 yyy=`$run ./try`
19480                 case "$yyy" in
19481                 ok) echo "Your strtoll() seems to be working okay." ;;
19482                 *) cat <<EOM >&4
19483 Your strtoll() doesn't seem to be working okay.
19484 EOM
19485                    d_strtoll="$undef"
19486                    ;;
19487                 esac
19488         else
19489                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19490                 d_strtoll="$undef"
19491         fi
19492         ;;
19493 esac
19494
19495 : see if strtoq exists
19496 set strtoq d_strtoq
19497 eval $inlibc
19498
19499 : see if strtoul exists
19500 set strtoul d_strtoul
19501 eval $inlibc
19502
19503 case "$d_strtoul" in
19504 "$define")
19505         $cat <<EOM
19506 Checking whether your strtoul() works okay...
19507 EOM
19508         $cat >try.c <<'EOCP'
19509 #include <errno.h>
19510 #include <stdio.h>
19511 extern unsigned long int strtoul(char *s, char **, int);
19512 static int bad = 0;
19513 void check(char *s, unsigned long eul, int een) {
19514         unsigned long gul;
19515         errno = 0;
19516         gul = strtoul(s, 0, 10);
19517         if (!((gul == eul) && (errno == een)))
19518                 bad++;
19519 }
19520 int main() {
19521         check(" 1", 1L, 0);
19522         check(" 0", 0L, 0);
19523 EOCP
19524         case "$longsize" in
19525         8)
19526             $cat >>try.c <<'EOCP'
19527         check("18446744073709551615", 18446744073709551615UL, 0);
19528         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19529 #if 0 /* strtoul() for /^-/ strings is undefined. */
19530         check("-1", 18446744073709551615UL, 0);
19531         check("-18446744073709551614", 2, 0);
19532         check("-18446744073709551615", 1, 0);
19533         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19534         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19535 #endif
19536 EOCP
19537                 ;;
19538         4)
19539                     $cat >>try.c <<'EOCP'
19540         check("4294967295", 4294967295UL, 0);
19541         check("4294967296", 4294967295UL, ERANGE);
19542 #if 0 /* strtoul() for /^-/ strings is undefined. */
19543         check("-1", 4294967295UL, 0);
19544         check("-4294967294", 2, 0);
19545         check("-4294967295", 1, 0);
19546         check("-4294967296", 4294967295UL, ERANGE);
19547         check("-4294967297", 4294967295UL, ERANGE);
19548 #endif
19549 EOCP
19550                 ;;
19551         *)
19552 : Should we write these tests to be more portable by sprintf-ing
19553 : ~0 and then manipulating that char string as input for strtol?
19554                 ;;
19555         esac
19556         $cat >>try.c <<'EOCP'
19557         if (!bad)
19558                 printf("ok\n");
19559         return 0;
19560 }
19561 EOCP
19562         set try
19563         if eval $compile; then
19564                 case "`$run ./try`" in
19565                 ok) echo "Your strtoul() seems to be working okay." ;;
19566                 *) cat <<EOM >&4
19567 Your strtoul() doesn't seem to be working okay.
19568 EOM
19569                    d_strtoul="$undef"
19570                    ;;
19571                 esac
19572         else
19573                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19574                 d_strtoul="$undef"
19575         fi
19576         ;;
19577 esac
19578
19579 : see if strtoull exists
19580 set strtoull d_strtoull
19581 eval $inlibc
19582
19583 case "$d_longlong-$d_strtoull" in
19584 "$define-$define")
19585         $cat <<EOM
19586 Checking whether your strtoull() works okay...
19587 EOM
19588         $cat >try.c <<'EOCP'
19589 #include <errno.h>
19590 #ifdef __hpux
19591 #define strtoull __strtoull
19592 #endif
19593 #include <stdio.h>
19594 extern unsigned long long int strtoull(char *s, char **, int);
19595 static int bad = 0;
19596 int check(char *s, long long eull, int een) {
19597         long long gull;
19598         errno = 0;
19599         gull = strtoull(s, 0, 10);
19600         if (!((gull == eull) && (errno == een)))
19601                 bad++;
19602 }
19603 int main() {
19604         check(" 1",                                        1LL, 0);
19605         check(" 0",                                        0LL, 0);
19606         check("18446744073709551615",  18446744073709551615ULL, 0);
19607         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19608 #if 0 /* strtoull() for /^-/ strings is undefined. */
19609         check("-1",                    18446744073709551615ULL, 0);
19610         check("-18446744073709551614",                     2LL, 0);
19611         check("-18446744073709551615",                     1LL, 0);
19612         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19613         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19614 #endif
19615         if (!bad)
19616                 printf("ok\n");
19617 }
19618 EOCP
19619         set try
19620         if eval $compile; then
19621                 case "`$run ./try`" in
19622                 ok) echo "Your strtoull() seems to be working okay." ;;
19623                 *) cat <<EOM >&4
19624 Your strtoull() doesn't seem to be working okay.
19625 EOM
19626                    d_strtoull="$undef"
19627                    ;;
19628                 esac
19629         else
19630                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19631                 d_strtoull="$undef"
19632         fi
19633         ;;
19634 esac
19635
19636 : see if strtouq exists
19637 set strtouq d_strtouq
19638 eval $inlibc
19639
19640 case "$d_strtouq" in
19641 "$define")
19642         $cat <<EOM
19643 Checking whether your strtouq() works okay...
19644 EOM
19645         $cat >try.c <<'EOCP'
19646 #include <errno.h>
19647 #include <stdio.h>
19648 extern unsigned long long int strtouq(char *s, char **, int);
19649 static int bad = 0;
19650 void check(char *s, unsigned long long eull, int een) {
19651         unsigned long long gull;
19652         errno = 0;
19653         gull = strtouq(s, 0, 10);
19654         if (!((gull == eull) && (errno == een)))
19655                 bad++;
19656 }
19657 int main() {
19658         check(" 1",                                        1LL, 0);
19659         check(" 0",                                        0LL, 0);
19660         check("18446744073709551615",  18446744073709551615ULL, 0);
19661         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19662 #if 0 /* strtouq() for /^-/ strings is undefined. */
19663         check("-1",                    18446744073709551615ULL, 0);
19664         check("-18446744073709551614",                     2LL, 0);
19665         check("-18446744073709551615",                     1LL, 0);
19666         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19667         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19668 #endif
19669         if (!bad)
19670                 printf("ok\n");
19671         return 0;
19672 }
19673 EOCP
19674         set try
19675         if eval $compile; then
19676                 case "`$run ./try`" in
19677                 ok) echo "Your strtouq() seems to be working okay." ;;
19678                 *) cat <<EOM >&4
19679 Your strtouq() doesn't seem to be working okay.
19680 EOM
19681                    d_strtouq="$undef"
19682                    ;;
19683                 esac
19684         else
19685                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19686                 d_strtouq="$undef"
19687         fi
19688         ;;
19689 esac
19690
19691 : see if strxfrm exists
19692 set strxfrm d_strxfrm
19693 eval $inlibc
19694
19695 : see if symlink exists
19696 set symlink d_symlink
19697 eval $inlibc
19698
19699 : see if syscall exists
19700 set syscall d_syscall
19701 eval $inlibc
19702
19703 : see if prototype for syscall is available
19704 echo " "
19705 set d_syscallproto syscall $i_unistd unistd.h
19706 eval $hasproto
19707
19708 : see if sysconf exists
19709 set sysconf d_sysconf
19710 eval $inlibc
19711
19712 : see if system exists
19713 set system d_system
19714 eval $inlibc
19715
19716 : see if tcgetpgrp exists
19717 set tcgetpgrp d_tcgetpgrp
19718 eval $inlibc
19719
19720 : see if tcsetpgrp exists
19721 set tcsetpgrp d_tcsetpgrp
19722 eval $inlibc
19723
19724 : see if prototype for telldir is available
19725 echo " "
19726 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19727 eval $hasproto
19728
19729 : see if tgamma exists
19730 set tgamma d_tgamma
19731 eval $inlibc
19732
19733 : see if time exists
19734 echo " "
19735 if test "X$d_time" = X -o X"$timetype" = X; then
19736     if set time val -f d_time; eval $csym; $val; then
19737                 echo 'time() found.' >&4
19738                 val="$define"
19739                 rp="What is the type returned by time() on this system?"
19740                 set time_t timetype long stdio.h sys/types.h
19741                 eval $typedef_ask
19742     else
19743                 echo 'time() not found, hope that will do.' >&4
19744                 val="$undef"
19745                 timetype='int';
19746     fi
19747     set d_time
19748     eval $setvar
19749 fi
19750
19751 : see if timegm exists
19752 set timegm d_timegm
19753 eval $inlibc
19754
19755 : see if this is a sys/times.h system
19756 set sys/times.h i_systimes
19757 eval $inhdr
19758
19759 : see if times exists
19760 echo " "
19761 if set times val -f d_times; eval $csym; $val; then
19762         echo 'times() found.' >&4
19763         d_times="$define"
19764         inc=''
19765         case "$i_systimes" in
19766         "$define") inc='sys/times.h';;
19767         esac
19768         rp="What is the type returned by times() on this system?"
19769         set clock_t clocktype long stdio.h sys/types.h $inc
19770         eval $typedef_ask
19771 else
19772         echo 'times() NOT found, hope that will do.' >&4
19773         d_times="$undef"
19774         clocktype='int'
19775 fi
19776
19777 : see if tmpnam_r exists
19778 set tmpnam_r d_tmpnam_r
19779 eval $inlibc
19780 case "$d_tmpnam_r" in
19781 "$define")
19782         hdrs="$i_systypes sys/types.h define stdio.h "
19783         case "$d_tmpnam_r_proto:$usethreads" in
19784         ":define")      d_tmpnam_r_proto=define
19785                 set d_tmpnam_r_proto tmpnam_r $hdrs
19786                 eval $hasproto ;;
19787         *)      ;;
19788         esac
19789         case "$d_tmpnam_r_proto" in
19790         define)
19791         case "$tmpnam_r_proto" in
19792         ''|0) try='char* tmpnam_r(char*);'
19793         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19794         esac
19795         case "$tmpnam_r_proto" in
19796         ''|0)   d_tmpnam_r=undef
19797                 tmpnam_r_proto=0
19798                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19799         * )     case "$tmpnam_r_proto" in
19800                 REENTRANT_PROTO*) ;;
19801                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19802                 esac
19803                 echo "Prototype: $try" ;;
19804         esac
19805         ;;
19806         *)      case "$usethreads" in
19807                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19808                 esac
19809                 d_tmpnam_r=undef
19810                 tmpnam_r_proto=0
19811                 ;;
19812         esac
19813         ;;
19814 *)      tmpnam_r_proto=0
19815         ;;
19816 esac
19817
19818 : see if trunc exists
19819 set trunc d_trunc
19820 eval $inlibc
19821
19822 : see if truncate exists
19823 set truncate d_truncate
19824 eval $inlibc
19825
19826 : see if ttyname_r exists
19827 set ttyname_r d_ttyname_r
19828 eval $inlibc
19829 case "$d_ttyname_r" in
19830 "$define")
19831         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19832         case "$d_ttyname_r_proto:$usethreads" in
19833         ":define")      d_ttyname_r_proto=define
19834                 set d_ttyname_r_proto ttyname_r $hdrs
19835                 eval $hasproto ;;
19836         *)      ;;
19837         esac
19838         case "$d_ttyname_r_proto" in
19839         define)
19840         case "$ttyname_r_proto" in
19841         ''|0) try='int ttyname_r(int, char*, size_t);'
19842         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19843         esac
19844         case "$ttyname_r_proto" in
19845         ''|0) try='int ttyname_r(int, char*, int);'
19846         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19847         esac
19848         case "$ttyname_r_proto" in
19849         ''|0) try='char* ttyname_r(int, char*, int);'
19850         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19851         esac
19852         case "$ttyname_r_proto" in
19853         ''|0)   d_ttyname_r=undef
19854                 ttyname_r_proto=0
19855                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19856         * )     case "$ttyname_r_proto" in
19857                 REENTRANT_PROTO*) ;;
19858                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19859                 esac
19860                 echo "Prototype: $try" ;;
19861         esac
19862         ;;
19863         *)      case "$usethreads" in
19864                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19865                 esac
19866                 d_ttyname_r=undef
19867                 ttyname_r_proto=0
19868                 ;;
19869         esac
19870         ;;
19871 *)      ttyname_r_proto=0
19872         ;;
19873 esac
19874
19875 : see if tzname[] exists
19876 echo " "
19877 if set tzname val -a d_tzname; eval $csym; $val; then
19878         val="$define"
19879         echo 'tzname[] found.' >&4
19880 else
19881         val="$undef"
19882         echo 'tzname[] NOT found.' >&4
19883 fi
19884 set d_tzname
19885 eval $setvar
19886
19887 : Check if is a multiplatform env
19888 case "$osname" in
19889 darwin) multiarch="$define" ;;
19890 esac
19891 case "$multiarch" in
19892 ''|[nN]*) multiarch="$undef" ;;
19893 esac
19894
19895 : check for ordering of bytes in a UV
19896 echo " "
19897 case "$multiarch" in
19898 *$define*)
19899         $cat <<EOM
19900 You seem to be doing a multiarchitecture build,
19901 skipping the byteorder check.
19902
19903 EOM
19904         byteorder='ffff'
19905         ;;
19906 *)
19907         case "$byteorder" in
19908         '')
19909                 $cat <<'EOM'
19910 In the following, larger digits indicate more significance.  A big-endian
19911 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19912 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19913 machines may have weird orders like 3412.  A Cray will report 87654321,
19914 an Alpha will report 12345678. If the test program works the default is
19915 probably right.
19916 I'm now running the test program...
19917 EOM
19918                 $cat >try.c <<EOCP
19919 #include <stdio.h>
19920 #$i_stdlib I_STDLIB
19921 #ifdef I_STDLIB
19922 #include <stdlib.h>
19923 #endif
19924 #include <sys/types.h>
19925 typedef $uvtype UV;
19926 int main()
19927 {
19928         int i;
19929         union {
19930                 UV l;
19931                 char c[$uvsize];
19932         } u;
19933
19934         if ($uvsize > 4)
19935                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19936         else
19937                 u.l = (UV)0x04030201;
19938         for (i = 0; i < $uvsize; i++)
19939                 printf("%c", u.c[i]+'0');
19940         printf("\n");
19941         exit(0);
19942 }
19943 EOCP
19944                 xxx_prompt=y
19945                 set try
19946                 if eval $compile && $run ./try > /dev/null; then
19947                         dflt=`$run ./try`
19948                         case "$dflt" in
19949                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19950                                 echo "(The test program ran ok.)"
19951                                 echo "byteorder=$dflt"
19952                                 xxx_prompt=n
19953                         ;;
19954                         ????|????????) echo "(The test program ran ok.)" ;;
19955                         *) echo "(The test program didn't run right for some reason.)" ;;
19956                         esac
19957                 else
19958                         dflt='4321'
19959                         cat <<'EOM'
19960 (I can't seem to compile the test program.  Guessing big-endian...)
19961 EOM
19962                 fi
19963                 case "$xxx_prompt" in
19964                 y)
19965                         rp="What is the order of bytes in $uvtype?"
19966                         . ./myread
19967                         byteorder="$ans"
19968                         ;;
19969                 *)      byteorder=$dflt
19970                         ;;
19971                 esac
19972                 ;;
19973         esac
19974         $rm_try
19975         ;;
19976 esac
19977
19978 : Checking 32bit alignedness
19979 $cat <<EOM
19980
19981 Checking to see whether you can access character data unalignedly...
19982 EOM
19983 case "$d_u32align" in
19984 '')   $cat >try.c <<EOCP
19985 #include <stdio.h>
19986 #$i_stdlib I_STDLIB
19987 #ifdef I_STDLIB
19988 #include <stdlib.h>
19989 #endif
19990 #define U32 $u32type
19991 #define BYTEORDER 0x$byteorder
19992 #define U8 $u8type
19993 #include <signal.h>
19994 #ifdef SIGBUS
19995 $signal_t bletch(int s) { exit(4); }
19996 #endif
19997 int main() {
19998 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19999     volatile U8 buf[8];
20000     volatile U32 *up;
20001     int i;
20002
20003     if (sizeof(U32) != 4) {
20004         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
20005         exit(1);
20006     }
20007
20008     fflush(stdout);
20009
20010 #ifdef SIGBUS
20011     signal(SIGBUS, bletch);
20012 #endif
20013
20014     buf[0] = 0;
20015     buf[1] = 0;
20016     buf[2] = 0;
20017     buf[3] = 1;
20018     buf[4] = 0;
20019     buf[5] = 0;
20020     buf[6] = 0;
20021     buf[7] = 1;
20022
20023     for (i = 0; i < 4; i++) {
20024         up = (U32*)(buf + i);
20025         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
20026                (*up == 1 << (8*(3-i)))  /* little-endian */
20027               )
20028            )
20029         {
20030             printf("read failed (%x)\n", *up);
20031             exit(2);
20032         }
20033     }
20034
20035     /* write test */
20036     for (i = 0; i < 4; i++) {
20037         up = (U32*)(buf + i);
20038         *up = 0xBeef;
20039         if (*up != 0xBeef) {
20040             printf("write failed (%x)\n", *up);
20041             exit(3);
20042         }
20043     }
20044
20045     exit(0);
20046 #else
20047     printf("1\n");
20048     exit(1);
20049 #endif
20050     return 0;
20051 }
20052 EOCP
20053 set try
20054 if eval $compile_ok; then
20055         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
20056         $run ./try 2>&1 >/dev/null
20057         case "$?" in
20058         0)      cat >&4 <<EOM
20059 You can access character data pretty unalignedly.
20060 EOM
20061                 d_u32align="$undef"
20062                 ;;
20063         *)      cat >&4 <<EOM
20064 It seems that you must access character data in an aligned manner.
20065 EOM
20066                 d_u32align="$define"
20067                 ;;
20068         esac
20069 else
20070         rp='Can you access character data at unaligned addresses?'
20071         dflt='n'
20072         . ./myread
20073         case "$ans" in
20074         [yY]*)  d_u32align="$undef"  ;;
20075         *)      d_u32align="$define" ;;
20076         esac
20077 fi
20078 $rm_try
20079 ;;
20080 esac
20081
20082 : see if ualarm exists
20083 set ualarm d_ualarm
20084 eval $inlibc
20085
20086 : see if umask exists
20087 set umask d_umask
20088 eval $inlibc
20089
20090 : see if unordered exists
20091 set unordered d_unordered
20092 eval $inlibc
20093
20094 : see if unsetenv exists
20095 set unsetenv d_unsetenv
20096 eval $inlibc
20097
20098 : see if usleep exists
20099 set usleep d_usleep
20100 eval $inlibc
20101
20102 : see if prototype for usleep is available
20103 echo " "
20104 set d_usleepproto usleep $i_unistd unistd.h
20105 eval $hasproto
20106
20107 : see if ustat exists
20108 set ustat d_ustat
20109 eval $inlibc
20110
20111 : see if closedir exists
20112 set closedir d_closedir
20113 eval $inlibc
20114
20115 case "$d_closedir" in
20116 "$define")
20117         echo " "
20118         echo "Checking whether closedir() returns a status..." >&4
20119         cat > try.c <<EOM
20120 #$i_dirent I_DIRENT             /**/
20121 #$i_sysdir I_SYS_DIR            /**/
20122 #$i_sysndir I_SYS_NDIR          /**/
20123 #$i_systypes I_SYS_TYPES        /**/
20124
20125 #if defined(I_SYS_TYPES)
20126 #include <sys/types.h>
20127 #endif
20128 #if defined(I_DIRENT)
20129 #include <dirent.h>
20130 #else
20131 #ifdef I_SYS_NDIR
20132 #include <sys/ndir.h>
20133 #else
20134 #ifdef I_SYS_DIR
20135 #ifdef hp9000s500
20136 #include <ndir.h>       /* may be wrong in the future */
20137 #else
20138 #include <sys/dir.h>
20139 #endif
20140 #endif
20141 #endif
20142 #endif
20143 int main() { return closedir(opendir(".")); }
20144 EOM
20145         set try
20146         if eval $compile_ok; then
20147                 if $run ./try > /dev/null 2>&1 ; then
20148                         echo "Yes, it does."
20149                         val="$undef"
20150                 else
20151                         echo "No, it doesn't."
20152                         val="$define"
20153                 fi
20154         else
20155                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20156                 val="$define"
20157         fi
20158         ;;
20159 *)
20160         val="$undef";
20161         ;;
20162 esac
20163 set d_void_closedir
20164 eval $setvar
20165 $rm_try
20166
20167 : see if there is a wait4
20168 set wait4 d_wait4
20169 eval $inlibc
20170
20171 : see if waitpid exists
20172 set waitpid d_waitpid
20173 eval $inlibc
20174
20175 : look for wcscmp
20176 echo " "
20177 $cat >try.c <<'EOCP'
20178 #include <stdio.h>
20179 #include <wchar.h>
20180 int main ()
20181 {
20182     wchar_t *s = L" ";
20183     return (wcscmp (s, s) ? 1 : 0);
20184     }
20185 EOCP
20186 set try
20187 val="$undef"
20188 if eval $compile; then
20189     `$run ./try`
20190     case "$?" in
20191         0)  echo "A working wcscmp() found." >&4
20192             val="$define" ;;
20193         *)  echo "wcscmp() found, but it doesn't work" >&4
20194             ;;
20195         esac
20196 else
20197     echo "wcscmp() NOT found." >&4
20198     fi
20199 set d_wcscmp
20200 eval $setvar
20201 $rm_try
20202
20203 : see if wcstombs exists
20204 set wcstombs d_wcstombs
20205 eval $inlibc
20206
20207 : look for wcsxfrm
20208 echo " "
20209 $cat >try.c <<'EOCP'
20210 #include <errno.h>
20211 #include <wchar.h>
20212 int main ()
20213 {
20214     wchar_t dst[4], *src = L" ";
20215     errno = 0;
20216     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20217     }
20218 EOCP
20219 set try
20220 val="$undef"
20221 if eval $compile; then
20222     `$run ./try`
20223     case "$?" in
20224         0)  echo "A working wcsxfrm() found." >&4
20225             val="$define" ;;
20226         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20227             ;;
20228         esac
20229 else
20230     echo "wcsxfrm() NOT found." >&4
20231     fi
20232 set d_wcsxfrm
20233 eval $setvar
20234 $rm_try
20235
20236 : see if wctomb exists
20237 set wctomb d_wctomb
20238 eval $inlibc
20239
20240 : see if writev exists
20241 set writev d_writev
20242 eval $inlibc
20243
20244 : check for alignment requirements
20245 echo " "
20246 case "$alignbytes" in
20247     '') echo "Checking alignment constraints..." >&4
20248         $cat >try.c <<EOCP
20249 #include <stdio.h>
20250 struct foobar {
20251     char foo;
20252     $nvtype bar;
20253 } try_algn;
20254 int main()
20255 {
20256     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20257     return(0);
20258 }
20259 EOCP
20260         set try
20261         if eval $compile_ok; then
20262             dflt=`$run ./try`
20263         else
20264             dflt='8'
20265             echo "(I can't seem to compile the test program...)"
20266         fi
20267         case "$multiarch" in
20268             *$define*)
20269                 : The usual safe value is 8, but Darwin with -Duselongdouble
20270                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20271                 : Configure to pick a larger value if needed.
20272                 if $test "$dflt" -lt 8; then
20273                     dflt='8'
20274                     echo "Setting alignment to 8 for multiarch support.">&4
20275                 fi
20276                 ;;
20277         esac
20278         ;;
20279     *) dflt="$alignbytes"
20280         ;;
20281 esac
20282 rp="Doubles must be aligned on a how-many-byte boundary?"
20283 . ./myread
20284 alignbytes="$ans"
20285 $rm_try
20286
20287 : set the base revision
20288 baserev=5.0
20289
20290 : length of character in bytes. Is always 1, otherwise it is not C
20291 : This used to be a test using sizeof
20292 charsize=1
20293
20294 : Check for the number of bits in a character
20295 case "$charbits" in
20296 '')     echo "Checking how long a character is (in bits)..." >&4
20297         $cat >try.c <<EOCP
20298 #include <stdio.h>
20299 int main ()
20300 {
20301     int n;
20302     unsigned char c;
20303     for (c = 1, n = 0; c; c <<= 1, n++) ;
20304     printf ("%d\n", n);
20305     return (0);
20306     }
20307 EOCP
20308         set try
20309         if eval $compile_ok; then
20310                 dflt=`$run ./try`
20311         else
20312                 dflt='8'
20313                 echo "(I can't seem to compile the test program.  Guessing...)"
20314         fi
20315         ;;
20316 *)
20317         dflt="$charbits"
20318         ;;
20319 esac
20320 rp="What is the length of a character (in bits)?"
20321 . ./myread
20322 charbits="$ans"
20323 $rm_try
20324 case "$charbits" in
20325 8)      ;;
20326 *)      cat >&4 << EOM
20327 Your system has an unsigned character size of $charbits bits, which
20328 is rather unusual (normally it is 8 bits).  Perl likely will not work
20329 correctly on your system, with subtle bugs in various places.
20330 EOM
20331         rp='Do you really want to continue?'
20332         dflt='n'
20333         . ./myread
20334         case "$ans" in
20335                 [yY])   echo >&4 "Okay, continuing."    ;;
20336                 *)      exit 1                          ;;
20337         esac
20338 esac
20339
20340 : how do we concatenate cpp tokens here?
20341 echo " "
20342 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20343 $cat >cpp_stuff.c <<'EOCP'
20344 #define RCAT(a,b)a/**/b
20345 #define ACAT(a,b)a ## b
20346 RCAT(Rei,ser)
20347 ACAT(Cir,cus)
20348 EOCP
20349 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20350 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20351         echo "Oh!  Smells like ANSI's been here." >&4
20352         echo "We can catify or stringify, separately or together!"
20353         cpp_stuff=42
20354 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20355         echo "Ah, yes!  The good old days!" >&4
20356         echo "However, in the good old days we don't know how to stringify and"
20357         echo "catify at the same time."
20358         cpp_stuff=1
20359 else
20360         $cat >&4 <<EOM
20361 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20362 You're going to have to edit the values of CAT[2-5] in config.h...
20363 EOM
20364         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20365 fi
20366 $rm -f cpp_stuff.*
20367
20368 : see if this is a db.h system
20369 set db.h i_db
20370 eval $inhdr
20371
20372 case "$i_db" in
20373 $define)
20374         : Check db version.
20375         echo " "
20376         echo "Checking Berkeley DB version ..." >&4
20377         $cat >try.c <<EOCP
20378 #$d_const HASCONST
20379 #ifndef HASCONST
20380 #define const
20381 #endif
20382 #include <sys/types.h>
20383 #include <stdio.h>
20384 #$i_stdlib I_STDLIB
20385 #ifdef I_STDLIB
20386 #include <stdlib.h>
20387 #endif
20388 #include <db.h>
20389 int main(int argc, char *argv[])
20390 {
20391 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20392     int Major, Minor, Patch ;
20393     unsigned long Version ;
20394     (void)db_version(&Major, &Minor, &Patch) ;
20395     if (argc == 2) {
20396         printf("%d %d %d %d %d %d\n",
20397                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20398                Major, Minor, Patch);
20399         exit(0);
20400     }
20401     printf("You have Berkeley DB Version 2 or greater.\n");
20402
20403     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20404                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20405     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20406                 Major, Minor, Patch) ;
20407
20408     /* check that db.h & libdb are compatible */
20409     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20410         printf("db.h and libdb are incompatible.\n") ;
20411         exit(3);
20412     }
20413
20414     printf("db.h and libdb are compatible.\n") ;
20415
20416     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20417                 + DB_VERSION_PATCH ;
20418
20419     /* needs to be >= 2.3.4 */
20420     if (Version < 2003004) {
20421     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20422         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20423         exit(2);
20424     }
20425
20426     exit(0);
20427 #else
20428 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20429     if (argc == 2) {
20430         printf("1 0 0\n");
20431         exit(0);
20432     }
20433     printf("You have Berkeley DB Version 1.\n");
20434     exit(0);    /* DB version < 2: the coast is clear. */
20435 #else
20436     exit(1);    /* <db.h> not Berkeley DB? */
20437 #endif
20438 #endif
20439 }
20440 EOCP
20441         set try
20442         if eval $compile_ok && $run ./try; then
20443                 echo 'Looks OK.' >&4
20444                 set `$run ./try 1`
20445                 db_version_major=$1
20446                 db_version_minor=$2
20447                 db_version_patch=$3
20448         else
20449                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20450                 i_db=$undef
20451                 case " $libs " in
20452                 *"-ldb "*)
20453                         : Remove db from list of libraries to use
20454                         echo "Removing unusable -ldb from library list" >&4
20455                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20456                         shift
20457                         libs="$*"
20458                         echo "libs = $libs" >&4
20459                         ;;
20460                 esac
20461         fi
20462         $rm_try
20463         ;;
20464 esac
20465
20466 case "$i_db" in
20467 define)
20468         : Check the return type needed for hash
20469         echo " "
20470         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20471         $cat >try.c <<EOCP
20472 #$d_const HASCONST
20473 #ifndef HASCONST
20474 #define const
20475 #endif
20476 #include <sys/types.h>
20477 #include <db.h>
20478
20479 #ifndef DB_VERSION_MAJOR
20480 u_int32_t hash_cb (const void* ptr, size_t size)
20481 {
20482 }
20483 HASHINFO info;
20484 int main()
20485 {
20486         info.hash = hash_cb;
20487 }
20488 #endif
20489 EOCP
20490         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20491                 if $contains warning try.out >>/dev/null 2>&1 ; then
20492                         db_hashtype='int'
20493                 else
20494                         db_hashtype='u_int32_t'
20495                 fi
20496         else
20497                 : XXX Maybe we should just give up here.
20498                 db_hashtype=u_int32_t
20499                 $cat try.out >&4
20500                 echo "Help:  I can't seem to compile the db test program." >&4
20501                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20502         fi
20503         $rm_try
20504         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20505         ;;
20506 *)      db_hashtype=u_int32_t
20507         ;;
20508 esac
20509 case "$i_db" in
20510 define)
20511         : Check the return type needed for prefix
20512         echo " "
20513         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20514         cat >try.c <<EOCP
20515 #$d_const HASCONST
20516 #ifndef HASCONST
20517 #define const
20518 #endif
20519 #include <sys/types.h>
20520 #include <db.h>
20521
20522 #ifndef DB_VERSION_MAJOR
20523 size_t prefix_cb (const DBT *key1, const DBT *key2)
20524 {
20525 }
20526 BTREEINFO info;
20527 int main()
20528 {
20529         info.prefix = prefix_cb;
20530 }
20531 #endif
20532 EOCP
20533         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20534                 if $contains warning try.out >>/dev/null 2>&1 ; then
20535                         db_prefixtype='int'
20536                 else
20537                         db_prefixtype='size_t'
20538                 fi
20539         else
20540                 db_prefixtype='size_t'
20541                 : XXX Maybe we should just give up here.
20542                 $cat try.out >&4
20543                 echo "Help:  I can't seem to compile the db test program." >&4
20544                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20545         fi
20546         $rm_try
20547         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20548         ;;
20549 *)      db_prefixtype='size_t'
20550         ;;
20551 esac
20552
20553 : Check what kind of inf/nan your system has
20554 $echo "Checking the kind of infinities and nans you have..." >&4
20555 $echo "(The following tests may crash.  That's okay.)" >&4
20556 $cat >try.c <<EOP
20557 #define DOUBLESIZE $doublesize
20558 #$d_longdbl HAS_LONG_DOUBLE
20559 #ifdef HAS_LONG_DOUBLE
20560 #define LONGDBLSIZE $longdblsize
20561 #define LONGDBLKIND $longdblkind
20562 #endif
20563 #$i_math I_MATH
20564 #ifdef I_MATH
20565 #include <math.h>
20566 #endif
20567 #include <stdio.h>
20568 /* Note that whether the sign bit is on or off
20569  * for NaN depends on the CPU/FPU, and possibly
20570  * can be affected by the build toolchain.
20571  *
20572  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20573  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20574  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20575  * (respectively) as opposed to the more usual
20576  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20577  */
20578 static void bytes(unsigned char *p, unsigned int n) {
20579   int i;
20580   for (i = 0; i < n; i++) {
20581     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20582   }
20583 }
20584 int main(int argc, char *argv[]) {
20585    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20586     * because some compilers are 'smart' and not only warn but refuse to
20587     * compile such 'illegal' values. */
20588    double dinf = exp(1e9);
20589    double dnan = sqrt(-1.0);
20590 #ifdef HAS_LONG_DOUBLE
20591    long double ldinf = (long double)exp(1e9);
20592    long double ldnan = (long double)sqrt(-1.0);
20593 #endif
20594   if (argc == 2) {
20595     switch (argv[1][0]) {
20596     case '1': bytes(&dinf, sizeof(dinf)); break;
20597     case '2': bytes(&dnan, sizeof(dnan)); break;
20598 #ifdef HAS_LONG_DOUBLE
20599 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20600 /* the 80-bit long doubles might have garbage in their excess bytes */
20601     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20602 # endif
20603     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20604     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20605 #endif
20606     }
20607   }
20608   return 0;
20609 }
20610 EOP
20611 set try
20612 if eval $compile; then
20613     doubleinfbytes=`$run ./try 1`
20614     doublenanbytes=`$run ./try 2`
20615     case "$d_longdbl" in
20616     $define)
20617       longdblinfbytes=`$run ./try 3`
20618       longdblnanbytes=`$run ./try 4`
20619       ;;
20620     esac
20621 else
20622     # Defaults in case the above test program failed.
20623     case "$doublekind" in
20624     1) # IEEE 754 32-bit LE
20625        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20626        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20627        ;;
20628     2) # IEEE 754 32-bit BE
20629        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20630        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20631        ;;
20632     3) # IEEE 754 64-bit LE
20633        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20634        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20635        ;;
20636     4) # IEEE 754 64-bit BE
20637        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20638        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20639        ;;
20640     5) # IEEE 754 128-bit LE
20641        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20642        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20643        ;;
20644     6) # IEEE 754 128-bit BE
20645        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20646        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20647        ;;
20648     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20649        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20650        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20651        ;;
20652     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20653        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20654        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20655        ;;
20656     *) # No idea.
20657        doubleinfbytes=$undef
20658        doublenanbytes=$undef
20659        ;;
20660     esac
20661     case "$longdblkind" in
20662     1) # IEEE 754 128-bit LE
20663        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20664        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20665        ;;
20666     2) # IEEE 754 128-bit BE
20667        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20668        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20669        ;;
20670     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20671        case "$longdblsize" in
20672        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20673            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20674            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20675            ;;
20676        16) # x86_64
20677            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20678            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20679            ;;
20680        *)  # No idea.
20681            longdblinfbytes=$undef
20682            longdblnanbytes=$undef
20683        ;;
20684        esac
20685        ;;
20686     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20687        case "$longdblsize" in
20688        12) # 32-bit system
20689            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20690            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20691            ;;
20692        16) # 64-bit system
20693            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20694            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20695            ;;
20696        *)  # No idea.
20697            longdblinfbytes=$undef
20698            longdblnanbytes=$undef
20699        ;;
20700        esac
20701        ;;
20702     5) # 128-bit LE-LE "double double"
20703        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20704        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20705        ;;
20706     6) # 128-bit BE-BE "double double"
20707        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20708        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20709        ;;
20710     7) # 128-bit LE-BE "double double"
20711        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20712        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20713        ;;
20714     8) # 128-bit BE-LE "double double"
20715        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20716        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20717        ;;
20718     *) # No idea.
20719        longdblinfbytes=$undef
20720        longdblnanbytes=$undef
20721        ;;
20722     esac
20723 fi
20724 $rm_try
20725
20726 : Check the length of the double mantissa
20727 $echo "Checking how many mantissa bits your doubles have..." >&4
20728 $cat >try.c <<EOP
20729 #$i_float I_FLOAT
20730 #$i_sunmath I_SUNMATH
20731 #ifdef I_FLOAT
20732 # include <float.h>
20733 #endif
20734 #ifdef I_SUNMATH
20735 # include <sunmath.h>
20736 #endif
20737 #ifdef DBL_MANT_DIG
20738 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20739 #endif
20740 #include <stdio.h>
20741 int main(int argc, char *argv[]) {
20742 #ifdef BITS
20743   printf("%d\n", BITS);
20744 #endif
20745   return 0;
20746 }
20747 EOP
20748 set try
20749 if eval $compile; then
20750     doublemantbits=`$run ./try`
20751 else
20752     doublemantbits="$undef"
20753 fi
20754 $rm_try
20755
20756 : Check the length of the longdouble mantissa
20757 $echo "Checking how many mantissa bits your long doubles have..." >&4
20758 $cat >try.c <<EOP
20759 #$i_float I_FLOAT
20760 #$i_sunmath I_SUNMATH
20761 #ifdef I_FLOAT
20762 # include <float.h>
20763 #endif
20764 #ifdef I_SUNMATH
20765 # include <sunmath.h>
20766 #endif
20767 #$d_longdbl HAS_LONG_DOUBLE
20768 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20769 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20770 /* This format has no implicit bit.  Beware, however, that for
20771  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20772  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20773  * and the top bit must have been one since 387, zero is plain invalid.
20774  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20775 #  define BITS LDBL_MANT_DIG
20776 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20777 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20778  * reason e.g. Irix thinks 107.  But in any case, we want only
20779  * the number of real bits, the implicit bits are of no interest.  */
20780 #  define BITS 2 * (DBL_MANT_DIG - 1)
20781 # else
20782 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20783 # endif
20784 #endif
20785 #include <stdio.h>
20786 int main(int argc, char *argv[]) {
20787 #ifdef BITS
20788   printf("%d\n", BITS);
20789 #endif
20790   return 0;
20791 }
20792 EOP
20793 set try
20794 if eval $compile; then
20795     longdblmantbits=`$run ./try`
20796 else
20797     longdblmantbits="$undef"
20798 fi
20799 $rm_try
20800
20801 : Check the length of the NV mantissa
20802 $echo "Checking how many mantissa bits your NVs have..." >&4
20803 if test "X$usequadmath" = "X$define"; then
20804   nvmantbits=112 # 128-1-15
20805 else
20806   if test "X$nvsize" = "X$doublesize"; then
20807     nvmantbits="$doublemantbits"
20808   else
20809      if test "X$nvsize" = "X$longdblsize"; then
20810        nvmantbits="$longdblmantbits"
20811      else
20812        nvmantbits="$undef"
20813      fi
20814   fi
20815 fi
20816
20817 : How can we generate normalized random numbers ?
20818 echo " "
20819 echo "Using our internal random number implementation..." >&4
20820
20821 case "$ccflags" in
20822 *-Dmy_rand=*|*-Dmy_srand=*)
20823         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20824         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20825         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20826         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20827         ;;
20828 esac
20829
20830 randfunc=Perl_drand48
20831 drand01="Perl_drand48()"
20832 seedfunc="Perl_drand48_init"
20833 randbits=48
20834 randseedtype=U32
20835
20836 : Probe whether dtrace builds an object, as newer Illumos requires an input
20837 : object file that uses at least one of the probes defined in the .d file
20838 case "$usedtrace" in
20839 $define)
20840     case "$dtraceobject" in
20841     $define|true|[yY]*)
20842         dtraceobject=$define
20843         ;;
20844     ' '|'')
20845         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20846         $cat >try.c <<EOM
20847 #include "perldtrace.h"
20848 int main(void) {
20849     PERL_LOADED_FILE("dummy");
20850     return 0;
20851 }
20852 EOM
20853         dtraceobject=$undef
20854         if $cc -c -o try.o $optimize $ccflags try.c \
20855                     && $dtrace -G -s ../perldtrace.d try.o >/dev/null 2>&1; then
20856                 dtraceobject=$define
20857             echo "Your dtrace builds an object file"
20858         fi
20859         $rm -f try.c try.o perldtrace.o
20860         ;;
20861     *) dtraceobject=$undef ;;
20862     esac
20863 esac
20864
20865 : Determine if this is an EBCDIC system
20866 echo " "
20867 echo "Determining whether or not we are on an EBCDIC system..." >&4
20868 $cat >try.c <<'EOM'
20869 int main()
20870 {
20871   if ('M'==0xd4) return 0;
20872   return 1;
20873 }
20874 EOM
20875
20876 val=$undef
20877 set try
20878 if eval $compile_ok; then
20879         if $run ./try; then
20880                 echo "You seem to speak EBCDIC." >&4
20881                 val="$define"
20882         else
20883                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20884         fi
20885 else
20886         echo "I'm unable to compile the test program." >&4
20887         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20888 fi
20889 $rm_try
20890 set ebcdic
20891 eval $setvar
20892
20893 : Check how to flush
20894 echo " "
20895 $cat >&4 <<EOM
20896 Checking how to flush all pending stdio output...
20897 EOM
20898 # I only know how to find the first 32 possibly open files on SunOS.
20899 # See also hints/sunos_4_1.sh and util.c  --AD
20900 case "$osname" in
20901 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20902 esac
20903 $cat >>try.c <<EOCP
20904 #include <stdio.h>
20905 #$i_stdlib I_STDLIB
20906 #ifdef I_STDLIB
20907 #include <stdlib.h>
20908 #endif
20909 #$i_unistd I_UNISTD
20910 #ifdef I_UNISTD
20911 # include <unistd.h>
20912 #endif
20913 #$d_sysconf HAS_SYSCONF
20914 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20915 #ifdef HAS_STDIO_STREAM_ARRAY
20916 # define STDIO_STREAM_ARRAY $stdio_stream_array
20917 #endif
20918 int main() {
20919   FILE* p;
20920   unlink("try.out");
20921   p = fopen("try.out", "w");
20922 #ifdef TRY_FPUTC
20923   fputc('x', p);
20924 #else
20925 # ifdef TRY_FPRINTF
20926   fprintf(p, "x");
20927 # endif
20928 #endif
20929 #ifdef TRY_FFLUSH_NULL
20930   fflush(NULL);
20931 #endif
20932 #ifdef TRY_FFLUSH_ALL
20933   {
20934     long open_max = -1;
20935 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20936     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20937 # else
20938 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20939     open_max = sysconf(_SC_OPEN_MAX);
20940 #  else
20941 #   ifdef FOPEN_MAX
20942     open_max = FOPEN_MAX;
20943 #   else
20944 #    ifdef OPEN_MAX
20945     open_max = OPEN_MAX;
20946 #    else
20947 #     ifdef _NFILE
20948     open_max = _NFILE;
20949 #     endif
20950 #    endif
20951 #   endif
20952 #  endif
20953 # endif
20954 # ifdef HAS_STDIO_STREAM_ARRAY
20955     if (open_max > 0) {
20956       long i;
20957       for (i = 0; i < open_max; i++)
20958             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20959                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20960                 STDIO_STREAM_ARRAY[i]._flag)
20961                 fflush(&STDIO_STREAM_ARRAY[i]);
20962     }
20963   }
20964 # endif
20965 #endif
20966   _exit(42);
20967 }
20968 EOCP
20969 : first we have to find out how _not_ to flush
20970 $to try.c
20971 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20972     output=''
20973     set try -DTRY_FPUTC
20974     if eval $compile; then
20975             $run ./try 2>/dev/null
20976             code="$?"
20977             $from try.out
20978             if $test ! -s try.out -a "X$code" = X42; then
20979                 output=-DTRY_FPUTC
20980             fi
20981     fi
20982     case "$output" in
20983     '')
20984             set try -DTRY_FPRINTF
20985             if eval $compile; then
20986                     $run ./try 2>/dev/null
20987                     code="$?"
20988                     $from try.out
20989                     if $test ! -s try.out -a "X$code" = X42; then
20990                         output=-DTRY_FPRINTF
20991                     fi
20992             fi
20993         ;;
20994     esac
20995 fi
20996 : check for fflush NULL behavior
20997 case "$fflushNULL" in
20998 '')     set try -DTRY_FFLUSH_NULL $output
20999         if eval $compile; then
21000                 $run ./try 2>/dev/null
21001                 code="$?"
21002                 $from try.out
21003                 if $test -s try.out -a "X$code" = X42; then
21004                         fflushNULL="`$cat try.out`"
21005                 else
21006                         if $test "X$code" != X42; then
21007                                 $cat >&4 <<EOM
21008 (If this test failed, don't worry, we'll try another method shortly.)
21009 EOM
21010                         fi
21011                 fi
21012         fi
21013         $rm -f core try.core core.try.*
21014         case "$fflushNULL" in
21015         x)      $cat >&4 <<EOM
21016 Your fflush(NULL) works okay for output streams.
21017 Let's see if it clobbers input pipes...
21018 EOM
21019 # As of mid-March 2000 all versions of Solaris appear to have a stdio
21020 # bug that improperly flushes the input end of pipes.  So we avoid the
21021 # autoflush on fork/system/exec support for now. :-(
21022 $cat >tryp.c <<EOCP
21023 #include <stdio.h>
21024 int
21025 main(int argc, char **argv)
21026 {
21027     char buf[1024];
21028     int i;
21029     char *bp = buf;
21030     while (1) {
21031         while ((i = getc(stdin)) != -1
21032                && (*bp++ = i) != '\n'
21033                && bp < &buf[1024])
21034         /* DO NOTHING */ ;
21035         *bp = '\0';
21036         fprintf(stdout, "%s", buf);
21037         fflush(NULL);
21038         if (i == -1)
21039             return 0;
21040         bp = buf;
21041     }
21042 }
21043 EOCP
21044                 fflushNULL="$define"
21045                 set tryp
21046                 if eval $compile; then
21047                     $rm -f tryp.out
21048                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
21049                     if $test "X$targethost" != X; then
21050                         $to tryp.c
21051                         $to tryp
21052                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21053                     else
21054                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21055                     fi
21056                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
21057                        $cat >&4 <<EOM
21058 fflush(NULL) seems to behave okay with input streams.
21059 EOM
21060                         fflushNULL="$define"
21061                     else
21062                         $cat >&4 <<EOM
21063 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
21064 EOM
21065                         fflushNULL="$undef"
21066                     fi
21067                 fi
21068                 $rm -f core tryp.c tryp.core core.tryp.*
21069                 ;;
21070         '')     $cat >&4 <<EOM
21071 Your fflush(NULL) isn't working (contrary to ANSI C).
21072 EOM
21073                 fflushNULL="$undef"
21074                 ;;
21075         *)      $cat >&4 <<EOM
21076 Cannot figure out whether your fflush(NULL) works or not.
21077 I'm assuming it doesn't (contrary to ANSI C).
21078 EOM
21079                 fflushNULL="$undef"
21080                 ;;
21081         esac
21082         ;;
21083 $define|true|[yY]*)
21084         fflushNULL="$define"
21085         ;;
21086 *)
21087         fflushNULL="$undef"
21088         ;;
21089 esac
21090 : check explicit looping only if NULL did not work, and if the pipe
21091 : bug does not show up on an explicit flush too
21092 case "$fflushNULL" in
21093 "$undef")
21094         $cat >tryp.c <<EOCP
21095 #include <stdio.h>
21096 int
21097 main(int argc, char **argv)
21098 {
21099     char buf[1024];
21100     int i;
21101     char *bp = buf;
21102     while (1) {
21103         while ((i = getc(stdin)) != -1
21104                && (*bp++ = i) != '\n'
21105                && bp < &buf[1024])
21106         /* DO NOTHING */ ;
21107         *bp = '\0';
21108         fprintf(stdout, "%s", buf);
21109         fflush(stdin);
21110         if (i == -1)
21111             return 0;
21112         bp = buf;
21113     }
21114 }
21115 EOCP
21116         set tryp
21117         if eval $compile; then
21118             $rm -f tryp.out
21119             if $test "X$targethost" != X; then
21120                 $to tryp.c
21121                 $to tryp
21122                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21123             else
21124                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21125             fi
21126             if cmp tryp.c tryp.out >/dev/null 2>&1; then
21127                $cat >&4 <<EOM
21128 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21129 EOM
21130                 : now check for fflushall behaviour
21131                 case "$fflushall" in
21132                 '')     set try -DTRY_FFLUSH_ALL $output
21133                         if eval $compile; then
21134                                 $cat >&4 <<EOM
21135 (Now testing the other method--but note that this also may fail.)
21136 EOM
21137                                 $run ./try 2>/dev/null
21138                                 code=$?
21139                                 $from try.out
21140                                 if $test -s try.out -a "X$code" = X42; then
21141                                         fflushall="`$cat try.out`"
21142                                 fi
21143                         fi
21144                         $rm_try
21145                         case "$fflushall" in
21146                         x)      $cat >&4 <<EOM
21147 Whew. Flushing explicitly all the stdio streams works.
21148 EOM
21149                                 fflushall="$define"
21150                                 ;;
21151                         '')     $cat >&4 <<EOM
21152 Sigh. Flushing explicitly all the stdio streams doesn't work.
21153 EOM
21154                                 fflushall="$undef"
21155                                 ;;
21156                         *)      $cat >&4 <<EOM
21157 Cannot figure out whether flushing stdio streams explicitly works or not.
21158 I'm assuming it doesn't.
21159 EOM
21160                                 fflushall="$undef"
21161                                 ;;
21162                         esac
21163                         ;;
21164                 "$define"|true|[yY]*)
21165                         fflushall="$define"
21166                         ;;
21167                 *)
21168                         fflushall="$undef"
21169                         ;;
21170                 esac
21171             else
21172                 $cat >&4 <<EOM
21173 All is futile.  Even fflush(stdin) clobbers input pipes!
21174 EOM
21175                 fflushall="$undef"
21176             fi
21177         else
21178             fflushall="$undef"
21179         fi
21180         $rm -f core tryp.c tryp.core core.tryp.*
21181         ;;
21182 *)      fflushall="$undef"
21183         ;;
21184 esac
21185
21186 case "$fflushNULL$fflushall" in
21187 undefundef)
21188         $cat <<EOM
21189 OK, I give up.  I cannot figure out how to flush pending stdio output.
21190 We won't be flushing handles at all before fork/exec/popen.
21191 EOM
21192         ;;
21193 esac
21194 $rm_try tryp
21195
21196 : Store the full pathname to the ar program for use in the C program
21197 : Respect a hint or command line value for full_ar.
21198 case "$full_ar" in
21199 '') full_ar=$ar ;;
21200 esac
21201
21202 : Store the full pathname to the sed program for use in the C program
21203 full_sed=$sed
21204
21205 : see what type gids are declared as in the kernel
21206 echo " "
21207 echo "Looking for the type for group ids returned by getgid()."
21208 set gid_t gidtype xxx stdio.h sys/types.h
21209 eval $typedef
21210 case "$gidtype" in
21211 xxx)
21212         xxx=`./findhdr sys/user.h`
21213         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21214         case $1 in
21215         unsigned) dflt="$1 $2" ;;
21216         *) dflt="$1" ;;
21217         esac
21218         ;;
21219 *) dflt="$gidtype";;
21220 esac
21221 case "$gidtype" in
21222 gid_t) echo "gid_t found." ;;
21223 *)      rp="What is the type for group ids returned by getgid()?"
21224         . ./myread
21225         gidtype="$ans"
21226         ;;
21227 esac
21228
21229 : Check the size of GID
21230 echo " "
21231 case "$gidtype" in
21232 *_t) zzz="$gidtype"     ;;
21233 *)   zzz="gid"          ;;
21234 esac
21235 echo "Checking the size of $zzz..." >&4
21236 cat > try.c <<EOCP
21237 #include <sys/types.h>
21238 #include <stdio.h>
21239 #$i_stdlib I_STDLIB
21240 #ifdef I_STDLIB
21241 #include <stdlib.h>
21242 #endif
21243 int main() {
21244     printf("%d\n", (int)sizeof($gidtype));
21245     exit(0);
21246 }
21247 EOCP
21248 set try
21249 if eval $compile_ok; then
21250         yyy=`$run ./try`
21251         case "$yyy" in
21252         '')     gidsize=4
21253                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21254                 ;;
21255         *)      gidsize=$yyy
21256                 echo "Your $zzz is $gidsize bytes long."
21257                 ;;
21258         esac
21259 else
21260         gidsize=4
21261         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21262 fi
21263
21264
21265 : Check if GID is signed
21266 echo " "
21267 case "$gidtype" in
21268 *_t) zzz="$gidtype"     ;;
21269 *)   zzz="gid"          ;;
21270 esac
21271 echo "Checking the sign of $zzz..." >&4
21272 cat > try.c <<EOCP
21273 #include <sys/types.h>
21274 #include <stdio.h>
21275 int main() {
21276         $gidtype foo = -1;
21277         if (foo < 0)
21278                 printf("-1\n");
21279         else
21280                 printf("1\n");
21281 }
21282 EOCP
21283 set try
21284 if eval $compile; then
21285         yyy=`$run ./try`
21286         case "$yyy" in
21287         '')     gidsign=1
21288                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21289                 ;;
21290         *)      gidsign=$yyy
21291                 case "$gidsign" in
21292                  1) echo "Your $zzz is unsigned." ;;
21293                 -1) echo "Your $zzz is signed."   ;;
21294                 esac
21295                 ;;
21296         esac
21297 else
21298         gidsign=1
21299         echo "(I can't compile the test program--guessing unsigned.)" >&4
21300 fi
21301
21302
21303 : Check 64bit sizes
21304 echo " "
21305
21306 if $test X"$quadtype" != X; then
21307
21308 echo "Checking how to print 64-bit integers..." >&4
21309
21310 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21311         $cat >try.c <<'EOCP'
21312 #include <sys/types.h>
21313 #include <stdio.h>
21314 int main() {
21315   int q = 12345678901;
21316   printf("%ld\n", q);
21317 }
21318 EOCP
21319         set try
21320         if eval $compile; then
21321                 yyy=`$run ./try`
21322                 case "$yyy" in
21323                 12345678901)
21324                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21325                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21326                         echo "We will use %d."
21327                         ;;
21328                 esac
21329         fi
21330 fi
21331
21332 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21333         $cat >try.c <<'EOCP'
21334 #include <sys/types.h>
21335 #include <stdio.h>
21336 int main() {
21337   long q = 12345678901;
21338   printf("%ld\n", q);
21339 }
21340 EOCP
21341         set try
21342         if eval $compile; then
21343                 yyy=`$run ./try`
21344                 case "$yyy" in
21345                 12345678901)
21346                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21347                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21348                         echo "We will use %ld."
21349                         ;;
21350                 esac
21351         fi
21352 fi
21353
21354 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21355         $cat >try.c <<'EOCP'
21356 #include <sys/types.h>
21357 #include <inttypes.h>
21358 #include <stdio.h>
21359 int main() {
21360   int64_t q = 12345678901;
21361   printf("%" PRId64 "\n", q);
21362 }
21363 EOCP
21364         set try
21365         if eval $compile; then
21366                 yyy=`$run ./try`
21367                 case "$yyy" in
21368                 12345678901)
21369                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21370                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21371                         echo "We will use the C9X style."
21372                         ;;
21373                 esac
21374         fi
21375 fi
21376
21377 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21378         $cat >try.c <<EOCP
21379 #include <sys/types.h>
21380 #include <stdio.h>
21381 int main() {
21382   $quadtype q = 12345678901;
21383   printf("%Ld\n", q);
21384 }
21385 EOCP
21386         set try
21387         if eval $compile; then
21388                 yyy=`$run ./try`
21389                 case "$yyy" in
21390                 12345678901)
21391                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21392                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21393                         echo "We will use %Ld."
21394                         ;;
21395                 esac
21396         fi
21397 fi
21398
21399 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21400         $cat >try.c <<'EOCP'
21401 #include <sys/types.h>
21402 #include <stdio.h>
21403 int main() {
21404   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21405   printf("%lld\n", q);
21406 }
21407 EOCP
21408         set try
21409         if eval $compile; then
21410                 yyy=`$run ./try`
21411                 case "$yyy" in
21412                 12345678901)
21413                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21414                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21415                         echo "We will use the %lld style."
21416                         ;;
21417                 esac
21418         fi
21419 fi
21420
21421 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21422         $cat >try.c <<EOCP
21423 #include <sys/types.h>
21424 #include <stdio.h>
21425 int main() {
21426   $quadtype q = 12345678901;
21427   printf("%qd\n", q);
21428 }
21429 EOCP
21430         set try
21431         if eval $compile; then
21432                 yyy=`$run ./try`
21433                 case "$yyy" in
21434                 12345678901)
21435                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21436                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21437                         echo "We will use %qd."
21438                         ;;
21439                 esac
21440         fi
21441 fi
21442
21443 if $test X"$sPRId64" = X; then
21444         echo "Cannot figure out how to print 64-bit integers." >&4
21445 fi
21446 $rm_try
21447
21448 fi
21449
21450 case "$sPRId64" in
21451 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21452         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21453         ;;
21454 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21455         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21456         ;;
21457 esac
21458
21459 : Check format strings for internal types
21460 echo " "
21461 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21462
21463 if $test X"$ivsize" = X8; then
21464         ivdformat="$sPRId64"
21465         uvuformat="$sPRIu64"
21466         uvoformat="$sPRIo64"
21467         uvxformat="$sPRIx64"
21468         uvXUformat="$sPRIXU64"
21469 else
21470         if $test X"$ivsize" = X"$longsize"; then
21471                 ivdformat='"ld"'
21472                 uvuformat='"lu"'
21473                 uvoformat='"lo"'
21474                 uvxformat='"lx"'
21475                 uvXUformat='"lX"'
21476         else
21477                 if $test X"$ivsize" = X"$intsize"; then
21478                         ivdformat='"d"'
21479                         uvuformat='"u"'
21480                         uvoformat='"o"'
21481                         uvxformat='"x"'
21482                         uvXUformat='"X"'
21483                 else
21484                         : far out
21485                         if $test X"$ivsize" = X"$shortsize"; then
21486                                 ivdformat='"hd"'
21487                                 uvuformat='"hu"'
21488                                 uvoformat='"ho"'
21489                                 uvxformat='"hx"'
21490                                 uvXUformat='"hX"'
21491                         fi
21492                 fi
21493         fi
21494 fi
21495
21496 if $test X"$usequadmath" = X"$define"; then
21497     nveformat='"Qe"'
21498     nvfformat='"Qf"'
21499     nvgformat='"Qg"'
21500     nvEUformat='"QE"'
21501     nvFUformat='"QF"'
21502     nvGUformat='"QG"'
21503 else
21504     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21505         nveformat="$sPRIeldbl"
21506         nvfformat="$sPRIfldbl"
21507         nvgformat="$sPRIgldbl"
21508         nvEUformat="$sPRIEUldbl"
21509         nvFUformat="$sPRIFUldbl"
21510         nvGUformat="$sPRIGUldbl"
21511     else
21512         nveformat='"e"'
21513         nvfformat='"f"'
21514         nvgformat='"g"'
21515         nvEUformat='"E"'
21516         nvFUformat='"F"'
21517         nvGUformat='"G"'
21518     fi
21519 fi
21520
21521 case "$ivdformat" in
21522 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21523     exit 1
21524     ;;
21525 esac
21526
21527 : Check format string for GID
21528
21529 echo " "
21530 $echo "Checking the format string to be used for gids..." >&4
21531
21532 case "$gidsign" in
21533 -1)     if $test X"$gidsize" = X"$ivsize"; then
21534                 gidformat="$ivdformat"
21535         else
21536                 if $test X"$gidsize" = X"$longsize"; then
21537                         gidformat='"ld"'
21538                 else
21539                         if $test X"$gidsize" = X"$intsize"; then
21540                                 gidformat='"d"'
21541                         else
21542                                 if $test X"$gidsize" = X"$shortsize"; then
21543                                         gidformat='"hd"'
21544                                 fi
21545                         fi
21546                 fi
21547         fi
21548         ;;
21549 *)      if $test X"$gidsize" = X"$uvsize"; then
21550                 gidformat="$uvuformat"
21551         else
21552                 if $test X"$gidsize" = X"$longsize"; then
21553                         gidformat='"lu"'
21554                 else
21555                         if $test X"$gidsize" = X"$intsize"; then
21556                                 gidformat='"u"'
21557                         else
21558                                 if $test X"$gidsize" = X"$shortsize"; then
21559                                         gidformat='"hu"'
21560                                 fi
21561                         fi
21562                 fi
21563         fi
21564         ;;
21565 esac
21566
21567 : see if getgroups exists
21568 set getgroups d_getgrps
21569 eval $inlibc
21570
21571 : see if setgroups exists
21572 set setgroups d_setgrps
21573 eval $inlibc
21574
21575 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21576 echo " "
21577 case "$d_getgrps$d_setgrps" in
21578 *define*)
21579         case "$groupstype" in
21580         '') dflt="$gidtype" ;;
21581         *)  dflt="$groupstype" ;;
21582         esac
21583         $cat <<EOM
21584 What type of pointer is the second argument to getgroups() and setgroups()?
21585 Usually this is the same as group ids, $gidtype, but not always.
21586
21587 EOM
21588         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21589         . ./myread
21590         groupstype="$ans"
21591         ;;
21592 *)  groupstype="$gidtype";;
21593 esac
21594
21595 : check whether make sets MAKE
21596 echo " "
21597 echo "Checking if your $make program sets \$(MAKE)..." >&4
21598 case "$make_set_make" in
21599 '')
21600         $sed 's/^X //' > testmake.mak << 'EOF'
21601 Xall:
21602 X       @echo 'maketemp="$(MAKE)"'
21603 EOF
21604         case "`$make -f testmake.mak 2>/dev/null`" in
21605         *maketemp=*) make_set_make='#' ;;
21606         *)      make_set_make="MAKE=$make" ;;
21607         esac
21608         $rm -f testmake.mak
21609         ;;
21610 esac
21611 case "$make_set_make" in
21612 '#') echo "Yup, it does.";;
21613 *) echo "Nope, it doesn't.";;
21614 esac
21615
21616 : see what type is used for mode_t
21617 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21618 set mode_t modetype int stdio.h sys/types.h
21619 eval $typedef_ask
21620
21621 : see if we need va_copy
21622 echo " "
21623 case "$i_stdarg" in
21624 "$define")
21625         $cat >try.c <<EOCP
21626 #include <stdarg.h>
21627 #include <stdio.h>
21628 #$i_stdlib I_STDLIB
21629 #ifdef I_STDLIB
21630 #include <stdlib.h>
21631 #endif
21632 #include <signal.h>
21633
21634 int
21635 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21636 {
21637   return vfprintf(f, fmt, *valp);
21638 }
21639
21640 int
21641 myvfprintf(FILE *f, const  char *fmt, va_list val)
21642 {
21643   return ivfprintf(f, fmt, &val);
21644 }
21645
21646 int
21647 myprintf(char *fmt, ...)
21648 {
21649   va_list val;
21650   va_start(val, fmt);
21651   return myvfprintf(stdout, fmt, val);
21652 }
21653
21654 int
21655 main(int ac, char **av)
21656 {
21657   signal(SIGSEGV, exit);
21658
21659   myprintf("%s%cs all right, then\n", "that", '\'');
21660   exit(0);
21661 }
21662 EOCP
21663         set try
21664         if eval $compile && $run ./try 2>&1 >/dev/null; then
21665                 case "`$run ./try`" in
21666                 "that's all right, then")
21667                         okay=yes
21668                         ;;
21669                 esac
21670         fi
21671         case "$okay" in
21672         yes)    echo "It seems that you don't need va_copy()." >&4
21673                 need_va_copy="$undef"
21674                 ;;
21675         *)      echo "It seems that va_copy() or similar will be needed." >&4
21676                 need_va_copy="$define"
21677                 ;;
21678         esac
21679         $rm_try
21680         ;;
21681 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21682         need_va_copy="$undef"
21683         ;;
21684 esac
21685
21686 : see what type is used for size_t
21687 rp="What is the type used for the length parameter for string functions?"
21688 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21689 eval $typedef_ask
21690
21691 : check for type of arguments to gethostbyaddr.
21692 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21693         case "$d_gethbyaddr" in
21694         $define)
21695                 $cat <<EOM
21696
21697 Checking to see what type of arguments are accepted by gethostbyaddr().
21698 EOM
21699                 hdrs="$define sys/types.h
21700                         $d_socket sys/socket.h
21701                         $i_niin netinet/in.h
21702                         $i_netdb netdb.h
21703                         $i_unistd unistd.h"
21704                 : The first arg can 'char *' or 'void *'
21705                 : The second arg is some of integral type
21706                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21707                         for yyy in size_t long int; do
21708                                 case "$netdb_host_type" in
21709                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21710                                         if ./protochk "$try" $hdrs; then
21711                                                 echo "Your system accepts $xxx for the first arg."
21712                                                 echo "...and $yyy for the second arg."
21713                                                 netdb_host_type="$xxx"
21714                                                 netdb_hlen_type="$yyy"
21715                                         fi
21716                                         ;;
21717                                 esac
21718                         done
21719                 done
21720                 : In case none of those worked, prompt the user.
21721                 case "$netdb_host_type" in
21722                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21723                         dflt='char *'
21724                         . ./myread
21725                         netdb_host_type=$ans
21726                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21727                         dflt="$sizetype"
21728                         . ./myread
21729                         netdb_hlen_type=$ans
21730                         ;;
21731                 esac
21732                 ;;
21733         *)      : no gethostbyaddr, so pick harmless defaults
21734                 netdb_host_type='char *'
21735                 netdb_hlen_type="$sizetype"
21736                 ;;
21737         esac
21738         # Remove the "const" if needed. -- but then we'll have a
21739         # prototype clash!
21740         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21741 fi
21742
21743 : check for type of argument to gethostbyname.
21744 if test "X$netdb_name_type" = X ; then
21745         case "$d_gethbyname" in
21746         $define)
21747                 $cat <<EOM
21748
21749 Checking to see what type of argument is accepted by gethostbyname().
21750 EOM
21751                 hdrs="$define sys/types.h
21752                         $d_socket sys/socket.h
21753                         $i_niin netinet/in.h
21754                         $i_netdb netdb.h
21755                         $i_unistd unistd.h"
21756                 for xxx in "const char *" "char *"; do
21757                         case "$netdb_name_type" in
21758                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21759                                 if ./protochk "$try" $hdrs; then
21760                                         echo "Your system accepts $xxx."
21761                                         netdb_name_type="$xxx"
21762                                 fi
21763                                 ;;
21764                         esac
21765                 done
21766                 : In case none of those worked, prompt the user.
21767                 case "$netdb_name_type" in
21768                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21769                         dflt='char *'
21770                         . ./myread
21771                         netdb_name_type=$ans
21772                         ;;
21773                 esac
21774                 ;;
21775         *)      : no gethostbyname, so pick harmless default
21776                 netdb_name_type='char *'
21777                 ;;
21778         esac
21779 fi
21780
21781 : check for type of 1st argument to getnetbyaddr.
21782 if test "X$netdb_net_type" = X ; then
21783         case "$d_getnbyaddr" in
21784         $define)
21785                 $cat <<EOM
21786
21787 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21788 EOM
21789                 hdrs="$define sys/types.h
21790                         $d_socket sys/socket.h
21791                         $i_niin netinet/in.h
21792                         $i_netdb netdb.h
21793                         $i_unistd unistd.h"
21794                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21795                         case "$netdb_net_type" in
21796                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21797                                 if ./protochk "$try" $hdrs; then
21798                                         echo "Your system accepts $xxx."
21799                                         netdb_net_type="$xxx"
21800                                 fi
21801                                 ;;
21802                         esac
21803                 done
21804                 : In case none of those worked, prompt the user.
21805                 case "$netdb_net_type" in
21806                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21807                         dflt='long'
21808                         . ./myread
21809                         netdb_net_type=$ans
21810                         ;;
21811                 esac
21812                 ;;
21813         *)      : no getnetbyaddr, so pick harmless default
21814                 netdb_net_type='long'
21815                 ;;
21816         esac
21817 fi
21818 : locate the preferred pager for this system
21819 fn=f/
21820 case "$pager" in
21821 '')
21822         dflt=''
21823         case "$pg" in
21824         /*) dflt=$pg;;
21825         [a-zA-Z]:/*) dflt=$pg;;
21826         esac
21827         case "$more" in
21828         /*) dflt=$more;;
21829         [a-zA-Z]:/*) dflt=$more;;
21830         esac
21831         case "$less" in
21832         /*) dflt=$less;;
21833         [a-zA-Z]:/*) dflt=$less;;
21834         esac
21835         case "$dflt" in
21836         '') dflt=/usr/ucb/more;;
21837         esac
21838         ;;
21839 *)      dflt="$pager"
21840         ;;
21841 esac
21842 fn="f/($dflt)"
21843 echo " "
21844 rp='What pager is used on your system?'
21845 . ./getfile
21846 pager="$ans"
21847
21848 : see if ar generates random libraries by itself
21849 echo " "
21850 echo "Checking how to generate random libraries on your machine..." >&4
21851 echo 'int bar1() { return bar2(); }' > bar1.c
21852 echo 'int bar2() { return 2; }' > bar2.c
21853 $cat > foo.c <<EOP
21854 #$i_stdlib I_STDLIB
21855 #ifdef I_STDLIB
21856 #include <stdlib.h>
21857 #endif
21858 int main() { printf("%d\n", bar1()); exit(0); }
21859 EOP
21860 $cc $ccflags -c bar1.c >/dev/null 2>&1
21861 $cc $ccflags -c bar2.c >/dev/null 2>&1
21862 $cc $ccflags -c foo.c >/dev/null 2>&1
21863 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21864 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21865         $run ./foobar >/dev/null 2>&1; then
21866         echo "$ar appears to generate random libraries itself."
21867         orderlib=false
21868         if [ "X$ranlib" = "X" ]; then
21869             ranlib=":"
21870         fi
21871 elif $ar s bar$_a >/dev/null 2>&1 &&
21872         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21873         $run ./foobar >/dev/null 2>&1; then
21874                 echo "a table of contents needs to be added with '$ar s'."
21875                 orderlib=false
21876                 ranlib="$ar s"
21877 elif $ar ts bar$_a >/dev/null 2>&1 &&
21878         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21879         $run ./foobar >/dev/null 2>&1; then
21880                 echo "a table of contents needs to be added with '$ar ts'."
21881                 orderlib=false
21882                 ranlib="$ar ts"
21883 else
21884         case "$ranlib" in
21885         :) ranlib='';;
21886         '')
21887                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21888                 $test -f $ranlib || ranlib=''
21889                 ;;
21890         esac
21891         if $test -n "$ranlib"; then
21892                 echo "your system has '$ranlib'; we'll use that."
21893                 orderlib=false
21894         else
21895                 echo "your system doesn't seem to support random libraries"
21896                 echo "so we'll use lorder and tsort to order the libraries."
21897                 orderlib=true
21898                 ranlib=":"
21899         fi
21900 fi
21901 $rm -f foo* bar*
21902
21903 : see if this is a values.h system
21904 set values.h i_values
21905 eval $inhdr
21906
21907 : Check the max offset that gmtime and localtime accept
21908 echo "Checking max offsets that gmtime () accepts"
21909
21910 case $i_values in
21911     define) yyy="#include <values.h>" ;;
21912     *)      yyy="" ;;
21913     esac
21914
21915 case "$sGMTIME_min/$sGMTIME_max" in
21916     0/0|/)
21917         $cat >try.c <<EOCP
21918 #include <sys/types.h>
21919 #include <stdio.h>
21920 #include <time.h>
21921 $yyy
21922
21923 int i;
21924 struct tm *tmp;
21925 time_t pt;
21926
21927 void gm_check (time_t t, int min_year, int max_year)
21928 {
21929     tmp = gmtime (&t);
21930     if ( tmp == NULL ||
21931         /* Check tm_year overflow */
21932          tmp->tm_year < min_year || tmp->tm_year > max_year)
21933         tmp = NULL;
21934     else
21935         pt = t;
21936     } /* gm_check */
21937
21938 int check_max ()
21939 {
21940     tmp = NULL;
21941     pt  = 0;
21942 #ifdef MAXLONG
21943     gm_check (MAXLONG, 69, 0x7fffffff);
21944 #endif
21945     if (tmp == NULL || tmp->tm_year < 0) {
21946         for (i = 63; i >= 0; i--) {
21947             time_t x = pt | ((time_t)1 << i);
21948             if (x < 0 || x < pt) continue;
21949             gm_check (x, 69, 0x7fffffff);
21950             }
21951         }
21952     printf ("sGMTIME_max=%ld\n", pt);
21953     return (0);
21954     } /* check_max */
21955
21956 int check_min ()
21957 {
21958     tmp = NULL;
21959     pt  = 0;
21960 #ifdef MINLONG
21961     gm_check (MINLONG, -1900, 70);
21962 #endif
21963     if (tmp == NULL) {
21964         for (i = 36; i >= 0; i--) {
21965             time_t x = pt - ((time_t)1 << i);
21966             if (x > 0) continue;
21967             gm_check (x, -1900, 70);
21968             }
21969         }
21970     printf ("sGMTIME_min=%ld\n", pt);
21971     return (0);
21972     } /* check_min */
21973
21974 int main (int argc, char *argv[])
21975 {
21976     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21977     check_max ();
21978     check_min ();
21979     return (0);
21980     } /* main */
21981 EOCP
21982         set try
21983         if eval $compile; then
21984             eval `$run ./try 2>/dev/null`
21985         else
21986             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21987             fi
21988         $rm_try
21989         ;;
21990     esac
21991
21992 echo "Checking max offsets that localtime () accepts"
21993
21994 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21995     0/0|/)
21996         $cat >try.c <<EOCP
21997 #include <sys/types.h>
21998 #include <stdio.h>
21999 #include <time.h>
22000 $yyy
22001
22002 int i;
22003 struct tm *tmp;
22004 time_t pt;
22005
22006 void local_check (time_t t, int min_year, int max_year)
22007 {
22008     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
22009         tmp = NULL;
22010     else
22011         tmp = localtime (&t);
22012     if ( tmp == NULL ||
22013         /* Check tm_year overflow */
22014          tmp->tm_year < min_year || tmp->tm_year > max_year)
22015         tmp = NULL;
22016     else
22017         pt = t;
22018     } /* local_check */
22019
22020 int check_max ()
22021 {
22022     tmp = NULL;
22023     pt  = 0;
22024 #ifdef MAXLONG
22025     local_check (MAXLONG, 69, 0x7fffffff);
22026 #endif
22027     if (tmp == NULL || tmp->tm_year < 0) {
22028         for (i = 63; i >= 0; i--) {
22029             time_t x = pt | ((time_t)1 << i);
22030             if (x < 0 || x < pt) continue;
22031             local_check (x, 69, 0x7fffffff);
22032             }
22033         }
22034     printf ("sLOCALTIME_max=%ld\n", pt);
22035     return (0);
22036    } /* check_max */
22037
22038 int check_min ()
22039 {
22040     tmp = NULL;
22041     pt  = 0;
22042 #ifdef MINLONG
22043     local_check (MINLONG, -1900, 70);
22044 #endif
22045     if (tmp == NULL) {
22046         for (i = 36; i >= 0; i--) {
22047             time_t x = pt - ((time_t)1 << i);
22048             if (x > 0) continue;
22049             local_check (x, -1900, 70);
22050             }
22051         }
22052     printf ("sLOCALTIME_min=%ld\n", pt);
22053     return (0);
22054     } /* check_min */
22055
22056 int main (int argc, char *argv[])
22057 {
22058     check_max ();
22059     check_min ();
22060     return (0);
22061     } /* main */
22062 EOCP
22063         set try
22064         if eval $compile; then
22065             eval `$run ./try 2>/dev/null`
22066         else
22067             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
22068             fi
22069         $rm_try
22070         ;;
22071     esac
22072
22073 : check for type of arguments to select.
22074 case "$selecttype" in
22075 '') case "$d_select" in
22076         $define)
22077                 echo " "
22078                 $cat <<EOM
22079 Checking to see what type of arguments are accepted by select().
22080 EOM
22081                 hdrs="$define sys/types.h
22082                         $i_systime sys/time.h
22083                         $i_sysselct sys/select.h
22084                         $d_socket sys/socket.h"
22085                 : The first arg can be int, unsigned, or size_t
22086                 : The last arg may or may not be 'const'
22087                 val=''
22088                 : void pointer has been seen but using that
22089                 : breaks the selectminbits test
22090                 for xxx in 'fd_set *' 'int *'; do
22091                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
22092                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
22093                                         case "$val" in
22094                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
22095                                                 if ./protochk "$try" $hdrs; then
22096                                                         echo "Your system accepts $xxx."
22097                                                         val="$xxx"
22098                                                 fi
22099                                                 ;;
22100                                         esac
22101                                 done
22102                         done
22103                 done
22104                 case "$val" in
22105                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22106                         case "$d_fd_set" in
22107                                 $define) dflt="fd_set *" ;;
22108                                 *)              dflt="int *" ;;
22109                         esac
22110                         . ./myread
22111                         val=$ans
22112                         ;;
22113                 esac
22114                 selecttype="$val"
22115                 ;;
22116         *)      : no select, so pick a harmless default
22117                 selecttype='int *'
22118                 ;;
22119         esac
22120         ;;
22121 esac
22122
22123 : check for the select 'width'
22124 case "$selectminbits" in
22125 '') safebits=`expr $ptrsize \* 8`
22126     case "$d_select" in
22127         $define)
22128                 $cat <<EOM
22129
22130 Checking to see on how many bits at a time your select() operates...
22131 EOM
22132                 $cat >try.c <<EOCP
22133 #include <sys/types.h>
22134 #$i_time I_TIME
22135 #$i_systime I_SYS_TIME
22136 #$i_systimek I_SYS_TIME_KERNEL
22137 #ifdef I_TIME
22138 #   include <time.h>
22139 #endif
22140 #ifdef I_SYS_TIME
22141 #   ifdef I_SYS_TIME_KERNEL
22142 #       define KERNEL
22143 #   endif
22144 #   include <sys/time.h>
22145 #   ifdef I_SYS_TIME_KERNEL
22146 #       undef KERNEL
22147 #   endif
22148 #endif
22149 #$i_sysselct I_SYS_SELECT
22150 #ifdef I_SYS_SELECT
22151 #include <sys/select.h>
22152 #endif
22153 #$d_socket HAS_SOCKET
22154 #ifdef HAS_SOCKET
22155 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22156 #endif
22157 #include <stdio.h>
22158 #$i_stdlib I_STDLIB
22159 #ifdef I_STDLIB
22160 #include <stdlib.h>
22161 #endif
22162 $selecttype b;
22163 #define S sizeof(*(b))
22164 #define MINBITS 64
22165 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22166 #define NBITS  (NBYTES * 8)
22167 int main() {
22168     char *s = (char *)malloc(NBYTES);
22169     struct timeval t;
22170     int i;
22171     FILE* fp;
22172     int fd;
22173
22174     if (!s)
22175         exit(1);
22176     fclose(stdin);
22177     fp = fopen("try.c", "r");
22178     if (fp == 0)
22179       exit(2);
22180     fd = fileno(fp);
22181     if (fd < 0)
22182       exit(3);
22183     b = ($selecttype)s;
22184     for (i = 0; i < NBITS; i++)
22185         FD_SET(i, b);
22186     t.tv_sec  = 0;
22187     t.tv_usec = 0;
22188     select(fd + 1, b, 0, 0, &t);
22189     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22190     free(s);
22191     printf("%d\n", i + 1);
22192     return 0;
22193 }
22194 EOCP
22195                 set try
22196                 if eval $compile_ok; then
22197                         selectminbits=`$run ./try 2>/dev/null`
22198                         case "$selectminbits" in
22199                         '')     cat >&4 <<EOM
22200 Cannot figure out on how many bits at a time your select() operates.
22201 I'll play safe and guess it is $safebits bits.
22202 EOM
22203                                 selectminbits=$safebits
22204                                 bits="$safebits bits"
22205                                 ;;
22206                         1)      bits="1 bit" ;;
22207                         *)      bits="$selectminbits bits" ;;
22208                         esac
22209                         echo "Your select() operates on $bits at a time." >&4
22210                 else
22211                         rp='What is the minimum number of bits your select() operates on?'
22212                         case "$byteorder" in
22213                         12345678)       dflt=64 ;;
22214                         1234)           dflt=32 ;;
22215                         *)              dflt=1  ;;
22216                         esac
22217                         . ./myread
22218                         val=$ans
22219                         selectminbits="$val"
22220                 fi
22221                 $rm_try
22222                 ;;
22223         *)      : no select, so pick a harmless default
22224                 selectminbits=$safebits
22225                 ;;
22226         esac
22227         ;;
22228 esac
22229
22230 : Trace out the files included by signal.h, then look for SIGxxx names.
22231 case "$sig_num_init" in
22232 '')
22233 if [ "X$fieldn" = X ]; then
22234         : Just make some guesses.  We check them later.
22235         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22236 else
22237         xxx=`echo '#include <signal.h>' |
22238         $cppstdin $cppminus $cppflags 2>/dev/null |
22239         $grep '^[       ]*#.*include' |
22240         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22241                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22242 fi
22243 xxxfiles=''
22244 for xx in $xxx /dev/null ; do
22245         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22246 done
22247 case "$xxxfiles" in
22248 '')     xxxfiles=`./findhdr signal.h` ;;
22249 esac
22250 xxx=`awk '
22251 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22252         print substr($2, 4, 20)
22253 }
22254 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22255         print substr($3, 4, 20)
22256 }' $xxxfiles`
22257 : Append some common names just in case the awk scan failed.
22258 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22259 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22260 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22261 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22262 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22263
22264 : generate a few handy files for later
22265 $cat > signal.c <<EOCP
22266 #include <sys/types.h>
22267 #include <signal.h>
22268 #$i_stdlib I_STDLIB
22269 #ifdef I_STDLIB
22270 #include <stdlib.h>
22271 #endif
22272 #include <stdio.h>
22273 int main() {
22274
22275 /* Strange style to avoid deeply-nested #if/#else/#endif */
22276 #ifndef NSIG
22277 #  ifdef _NSIG
22278 #    define NSIG (_NSIG)
22279 #  endif
22280 #endif
22281
22282 #ifndef NSIG
22283 #  ifdef SIGMAX
22284 #    define NSIG (SIGMAX+1)
22285 #  endif
22286 #endif
22287
22288 #ifndef NSIG
22289 #  ifdef SIG_MAX
22290 #    define NSIG (SIG_MAX+1)
22291 #  endif
22292 #endif
22293
22294 #ifndef NSIG
22295 #  ifdef _SIG_MAX
22296 #    define NSIG (_SIG_MAX+1)
22297 #  endif
22298 #endif
22299
22300 #ifndef NSIG
22301 #  ifdef MAXSIG
22302 #    define NSIG (MAXSIG+1)
22303 #  endif
22304 #endif
22305
22306 #ifndef NSIG
22307 #  ifdef MAX_SIG
22308 #    define NSIG (MAX_SIG+1)
22309 #  endif
22310 #endif
22311
22312 #ifndef NSIG
22313 #  ifdef SIGARRAYSIZE
22314 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22315 #  endif
22316 #endif
22317
22318 #ifndef NSIG
22319 #  ifdef _sys_nsig
22320 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22321 #  endif
22322 #endif
22323
22324 /* Default to some arbitrary number that's big enough to get most
22325    of the common signals.
22326 */
22327 #ifndef NSIG
22328 #    define NSIG 50
22329 #endif
22330
22331 printf("NSIG %d\n", NSIG);
22332
22333 #ifndef JUST_NSIG
22334
22335 EOCP
22336
22337 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22338 {
22339         printf "#ifdef SIG"; printf $1; printf "\n"
22340         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22341         printf $1; printf ");\n"
22342         printf "#endif\n"
22343 }
22344 END {
22345         printf "#endif /* JUST_NSIG */\n";
22346         printf "exit(0);\n}\n";
22347 }
22348 ' >>signal.c
22349 $cat >signal.awk <<'EOP'
22350 BEGIN { ndups = 0 }
22351 $1 ~ /^NSIG$/ { nsig = $2 }
22352 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22353     if ($2 > maxsig) { maxsig = $2 }
22354     if (sig_name[$2]) {
22355         dup_name[ndups] = $1
22356         dup_num[ndups] = $2
22357         ndups++
22358     }
22359     else {
22360         sig_name[$2] = $1
22361         sig_num[$2] = $2
22362     }
22363 }
22364 END {
22365     if (nsig == 0) {
22366         nsig = maxsig + 1
22367     }
22368     printf("NSIG %d\n", nsig);
22369     for (n = 1; n < nsig; n++) {
22370         if (sig_name[n]) {
22371             printf("%s %d\n", sig_name[n], sig_num[n])
22372         }
22373         else {
22374             printf("NUM%d %d\n", n, n)
22375         }
22376     }
22377     for (n = 0; n < ndups; n++) {
22378         printf("%s %d\n", dup_name[n], dup_num[n])
22379     }
22380 }
22381 EOP
22382 $cat >signal_cmd <<EOS
22383 $startsh
22384 if $test -s signal.lst; then
22385     echo "Using your existing signal.lst file"
22386         exit 0
22387 fi
22388 xxx="$xxx"
22389 EOS
22390 $cat >>signal_cmd <<'EOS'
22391
22392 set signal
22393 if eval $compile_ok; then
22394         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22395                 $uniq | $awk -f signal.awk >signal.lst
22396 else
22397         echo "(I can't seem be able to compile the whole test program)" >&4
22398         echo "(I'll try it in little pieces.)" >&4
22399         set signal -DJUST_NSIG
22400         if eval $compile_ok; then
22401                 $run ./signal$_exe > signal.nsg
22402                 $cat signal.nsg
22403         else
22404                 echo "I can't seem to figure out how many signals you have." >&4
22405                 echo "Guessing 50." >&4
22406                 echo 'NSIG 50' > signal.nsg
22407         fi
22408         : Now look at all the signal names, one at a time.
22409         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22410                 $cat > signal.c <<EOCP
22411 #include <sys/types.h>
22412 #include <signal.h>
22413 #include <stdio.h>
22414 int main() {
22415 printf("$xx %d\n", SIG${xx});
22416 return 0;
22417 }
22418 EOCP
22419                 set signal
22420                 if eval $compile; then
22421                         echo "SIG${xx} found."
22422                         $run ./signal$_exe  >> signal.ls1
22423                 else
22424                         echo "SIG${xx} NOT found."
22425                 fi
22426         done
22427         if $test -s signal.ls1; then
22428                 $cat signal.nsg signal.ls1 |
22429                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22430         fi
22431
22432 fi
22433 if $test -s signal.lst; then
22434         :
22435 else
22436         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22437         echo 'kill -l' >signal
22438         set X `csh -f <signal`
22439         $rm -f signal
22440         shift
22441         case $# in
22442         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22443         esac
22444         echo $@ | $tr ' ' $trnl | \
22445             $awk '{ printf "%s %d\n", $1, ++s; }
22446                   END { printf "NSIG %d\n", ++s }' >signal.lst
22447 fi
22448 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22449 EOS
22450 chmod a+x signal_cmd
22451 $eunicefix signal_cmd
22452 ;;
22453 esac
22454
22455 : generate list of signal names
22456 case "$sig_num_init" in
22457 '')
22458 echo " "
22459 case "$sig_name_init" in
22460 '') doinit=yes ;;
22461 *)  case "$sig_num_init" in
22462     ''|*,*) doinit=yes ;;
22463     esac ;;
22464 esac
22465 case "$doinit" in
22466 yes)
22467         echo "Generating a list of signal names and numbers..." >&4
22468         . ./signal_cmd
22469         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22470         sig_name=`$awk 'BEGIN { printf "ZERO " }
22471                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22472         sig_num=`$awk  'BEGIN { printf "0 " }
22473                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22474         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22475                              !/^NSIG/   { printf "\"%s\", ", $1 }
22476                              END        { printf "0\n" }' signal.lst`
22477         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22478                              !/^NSIG/   { printf "%d, ", $2}
22479                              END        { printf "0\n"}' signal.lst`
22480         ;;
22481 esac
22482 echo "The following $sig_count signals are available:"
22483 echo " "
22484 echo $sig_name | $awk \
22485 'BEGIN { linelen = 0 }
22486 {
22487         for (i = 1; i <= NF; i++) {
22488                 name = "SIG" $i " "
22489                 linelen = linelen + length(name)
22490                 if (linelen > 70) {
22491                         printf "\n"
22492                         linelen = length(name)
22493                 }
22494                 printf "%s", name
22495         }
22496         printf "\n"
22497 }'
22498 sig_size=`echo $sig_name | awk '{print NF}'`
22499 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22500 ;;
22501 esac
22502
22503 : Check size of size
22504 echo " "
22505 case "$sizetype" in
22506 *_t) zzz="$sizetype"    ;;
22507 *)   zzz="filesize"     ;;
22508 esac
22509 echo "Checking the size of $zzz..." >&4
22510 cat > try.c <<EOCP
22511 #include <sys/types.h>
22512 #include <stdio.h>
22513 #$i_stdlib I_STDLIB
22514 #ifdef I_STDLIB
22515 #include <stdlib.h>
22516 #endif
22517 int main() {
22518     printf("%d\n", (int)sizeof($sizetype));
22519     exit(0);
22520 }
22521 EOCP
22522 set try
22523 if eval $compile_ok; then
22524         yyy=`$run ./try`
22525         case "$yyy" in
22526         '')     sizesize=4
22527                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22528                 ;;
22529         *)      sizesize=$yyy
22530                 echo "Your $zzz size is $sizesize bytes."
22531                 ;;
22532         esac
22533 else
22534         sizesize=4
22535         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22536 fi
22537
22538
22539 : check for socklen_t
22540 echo " "
22541 echo "Checking to see if you have socklen_t..." >&4
22542 $cat >try.c <<EOCP
22543 #include <sys/types.h>
22544 #$d_socket HAS_SOCKET
22545 #ifdef HAS_SOCKET
22546 #include <sys/socket.h>
22547 #endif
22548 int main() { socklen_t x = 16; }
22549 EOCP
22550 set try
22551 if eval $compile; then
22552         val="$define"
22553         echo "You have socklen_t."
22554 else
22555         val="$undef"
22556         echo "You do not have socklen_t."
22557         case "$sizetype" in
22558         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22559         esac
22560 fi
22561 $rm_try
22562 set d_socklen_t
22563 eval $setvar
22564
22565 : see if this is a socks.h system
22566 set socks.h i_socks
22567 eval $inhdr
22568
22569 : check for type of the size argument to socket calls
22570 case "$d_socket" in
22571 "$define")
22572         $cat <<EOM
22573
22574 Checking to see what type is the last argument of accept().
22575 EOM
22576         yyy=''
22577         case "$d_socklen_t" in
22578         "$define") yyy="$yyy socklen_t"
22579         esac
22580         yyy="$yyy $sizetype int long unsigned"
22581         for xxx in $yyy; do
22582                 case "$socksizetype" in
22583                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22584                         case "$usesocks" in
22585                         "$define")
22586                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22587                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22588                                         socksizetype="$xxx"
22589                                 fi
22590                                 ;;
22591                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22592                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22593                                         socksizetype="$xxx"
22594                                 fi
22595                                 ;;
22596                         esac
22597                         ;;
22598                 esac
22599         done
22600 : In case none of those worked, prompt the user.
22601         case "$socksizetype" in
22602         '')     rp='What is the type for socket address structure sizes?'
22603                 dflt='int'
22604                 . ./myread
22605                 socksizetype=$ans
22606                 ;;
22607         esac
22608         ;;
22609 *)      : no sockets, so pick relatively harmless default
22610         socksizetype='int'
22611         ;;
22612 esac
22613
22614 : see what type is used for signed size_t
22615 set ssize_t ssizetype int stdio.h sys/types.h
22616 eval $typedef
22617 dflt="$ssizetype"
22618 $cat > try.c <<EOM
22619 #include <stdio.h>
22620 #$i_stdlib I_STDLIB
22621 #ifdef I_STDLIB
22622 #include <stdlib.h>
22623 #endif
22624 #include <sys/types.h>
22625 #define Size_t $sizetype
22626 #define SSize_t $dflt
22627 int main()
22628 {
22629         if (sizeof(Size_t) == sizeof(SSize_t))
22630                 printf("$dflt\n");
22631         else if (sizeof(Size_t) == sizeof(int))
22632                 printf("int\n");
22633         else
22634                 printf("long\n");
22635         exit(0);
22636 }
22637 EOM
22638 echo " "
22639 set try
22640 if eval $compile_ok && $run ./try > /dev/null; then
22641         ssizetype=`$run ./try`
22642         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22643 else
22644         $cat >&4 <<EOM
22645 Help! I can't compile and run the ssize_t test program: please enlighten me!
22646 (This is probably a misconfiguration in your system or libraries, and
22647 you really ought to fix it.  Still, I'll try anyway.)
22648
22649 I need a type that is the same size as $sizetype, but is guaranteed to
22650 be signed.  Common values are ssize_t, int and long.
22651
22652 EOM
22653         rp="What signed type is the same size as $sizetype?"
22654         . ./myread
22655         ssizetype="$ans"
22656 fi
22657 $rm_try
22658
22659 : Check the size of st_ino
22660 $echo " "
22661 $echo "Checking the size of st_ino..." >&4
22662 $cat > try.c <<EOCP
22663 #include <sys/stat.h>
22664 #include <stdio.h>
22665 #$i_stdlib I_STDLIB
22666 #ifdef I_STDLIB
22667 #include <stdlib.h>
22668 #endif
22669 int main() {
22670     struct stat st;
22671     printf("%d\n", (int)sizeof(st.st_ino));
22672     exit(0);
22673 }
22674 EOCP
22675 set try
22676 if eval $compile_ok; then
22677         val=`$run ./try`
22678         case "$val" in
22679         '')     st_ino_size=4
22680                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22681                 ;;
22682         *)      st_ino_size=$val
22683                 $echo "Your st_ino is $st_ino_size bytes long."
22684                 ;;
22685         esac
22686 else
22687         st_ino_size=4
22688         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22689 fi
22690 $rm_try
22691
22692 : Check if st_ino is signed
22693 $echo " "
22694 $echo "Checking the sign of st_ino..." >&4
22695 $cat > try.c <<EOCP
22696 #include <sys/stat.h>
22697 #include <stdio.h>
22698 int main() {
22699         struct stat foo;
22700         foo.st_ino = -1;
22701         if (foo.st_ino < 0)
22702                 printf("-1\n");
22703         else
22704                 printf("1\n");
22705 }
22706 EOCP
22707 set try
22708 if eval $compile; then
22709         val=`$run ./try`
22710         case "$val" in
22711         '')     st_ino_sign=1
22712                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22713                 ;;
22714         *)      st_ino_sign=$val
22715                 case "$st_ino_sign" in
22716                  1) $echo "Your st_ino is unsigned." ;;
22717                 -1) $echo "Your st_ino is signed."   ;;
22718                 esac
22719                 ;;
22720         esac
22721 else
22722         st_ino_sign=1
22723         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22724 fi
22725 $rm_try
22726
22727 : see what type of char stdio uses.
22728 echo " "
22729 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22730 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22731         echo "Your stdio uses unsigned chars." >&4
22732         stdchar="unsigned char"
22733 else
22734         echo "Your stdio uses signed chars." >&4
22735         stdchar="char"
22736 fi
22737 $rm -f stdioh
22738
22739 : Check size of UID
22740 echo " "
22741 case "$uidtype" in
22742 *_t) zzz="$uidtype"     ;;
22743 *)   zzz="uid"          ;;
22744 esac
22745 echo "Checking the size of $zzz..." >&4
22746 cat > try.c <<EOCP
22747 #include <sys/types.h>
22748 #include <stdio.h>
22749 #$i_stdlib I_STDLIB
22750 #ifdef I_STDLIB
22751 #include <stdlib.h>
22752 #endif
22753 int main() {
22754     printf("%d\n", (int)sizeof($uidtype));
22755     exit(0);
22756 }
22757 EOCP
22758 set try
22759 if eval $compile_ok; then
22760         yyy=`$run ./try`
22761         case "$yyy" in
22762         '')     uidsize=4
22763                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22764                 ;;
22765         *)      uidsize=$yyy
22766                 echo "Your $zzz is $uidsize bytes long."
22767                 ;;
22768         esac
22769 else
22770         uidsize=4
22771         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22772 fi
22773
22774 : Check if UID is signed
22775 echo " "
22776 case "$uidtype" in
22777 *_t) zzz="$uidtype"     ;;
22778 *)   zzz="uid"          ;;
22779 esac
22780 echo "Checking the sign of $zzz..." >&4
22781 cat > try.c <<EOCP
22782 #include <sys/types.h>
22783 #include <stdio.h>
22784 int main() {
22785         $uidtype foo = -1;
22786         if (foo < 0)
22787                 printf("-1\n");
22788         else
22789                 printf("1\n");
22790 }
22791 EOCP
22792 set try
22793 if eval $compile; then
22794         yyy=`$run ./try`
22795         case "$yyy" in
22796         '')     uidsign=1
22797                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22798                 ;;
22799         *)      uidsign=$yyy
22800                 case "$uidsign" in
22801                  1) echo "Your $zzz is unsigned." ;;
22802                 -1) echo "Your $zzz is signed."   ;;
22803                 esac
22804                 ;;
22805         esac
22806 else
22807         uidsign=1
22808         echo "(I can't compile the test program--guessing unsigned.)" >&4
22809 fi
22810
22811
22812 : Check format string for UID
22813 echo " "
22814 $echo "Checking the format string to be used for uids..." >&4
22815
22816 case "$uidsign" in
22817 -1)     if $test X"$uidsize" = X"$ivsize"; then
22818                 uidformat="$ivdformat"
22819         else
22820                 if $test X"$uidsize" = X"$longsize"; then
22821                         uidformat='"ld"'
22822                 else
22823                         if $test X"$uidsize" = X"$intsize"; then
22824                                 uidformat='"d"'
22825                         else
22826                                 if $test X"$uidsize" = X"$shortsize"; then
22827                                         uidformat='"hd"'
22828                                 fi
22829                         fi
22830                 fi
22831         fi
22832         ;;
22833 *)      if $test X"$uidsize" = X"$uvsize"; then
22834                 uidformat="$uvuformat"
22835         else
22836                 if $test X"$uidsize" = X"$longsize"; then
22837                         uidformat='"lu"'
22838                 else
22839                         if $test X"$uidsize" = X"$intsize"; then
22840                                 uidformat='"u"'
22841                         else
22842                                 if $test X"$uidsize" = X"$shortsize"; then
22843                                         uidformat='"hu"'
22844                                 fi
22845                         fi
22846                 fi
22847         fi
22848         ;;
22849 esac
22850
22851 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22852 echo " "
22853 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22854 $cat >try.c <<'EOM'
22855 /* Intentionally a long probe as I'd like to sanity check that the exact
22856    approach is going to work, as thinking it will work, but only having it
22857    part working at runtime is worse than not having it.  */
22858
22859 #include <sys/types.h>
22860 #include <sys/sysctl.h>
22861 #include <sys/param.h>
22862 #include <stdio.h>
22863 #include <string.h>
22864 #include <stdlib.h>
22865 #include <unistd.h>
22866
22867 int
22868 main(int argc, char **argv) {
22869     char *buffer;
22870     char *argv_leaf = strrchr(argv[0], '/');
22871     char *buffer_leaf;
22872     size_t size = 0;
22873     int mib[4];
22874
22875     mib[0] = CTL_KERN;
22876     mib[1] = KERN_PROC;
22877     mib[2] = KERN_PROC_PATHNAME;
22878     mib[3] = -1;
22879
22880     if (!argv_leaf) {
22881         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22882         return 1;
22883     }
22884
22885     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22886         perror("sysctl");
22887         return 2;
22888     }
22889
22890     if (size < strlen(argv_leaf) + 1) {
22891         fprintf(stderr, "size %lu is too short for a path\n",
22892                 (unsigned long) size);
22893         return 3;
22894     }
22895
22896     if (size > MAXPATHLEN * MAXPATHLEN) {
22897         fprintf(stderr, "size %lu is too long for a path\n",
22898                 (unsigned long) size);
22899         return 4;
22900     }
22901
22902     buffer = malloc(size);
22903     if (!buffer) {
22904         perror("malloc");
22905         return 5;
22906     }
22907
22908     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22909         perror("sysctl");
22910         return 6;
22911     }
22912
22913     if (strlen(buffer) + 1 != size) {
22914         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22915                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22916         return 7;
22917     }
22918
22919
22920     if (*buffer != '/') {
22921         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22922         return 8;
22923     }
22924
22925     if (strstr(buffer, "/./")) {
22926         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22927         return 9;
22928     }
22929
22930     if (strstr(buffer, "/../")) {
22931         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22932         return 10;
22933     }
22934
22935     buffer_leaf = strrchr(buffer, '/');
22936     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22937         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22938         return 11;
22939     }
22940
22941     free(buffer);
22942
22943     return 0;
22944 }
22945 EOM
22946
22947 val=$undef
22948 set try
22949 if eval $compile; then
22950         if $run ./try; then
22951                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22952                 val="$define"
22953         else
22954                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22955                 val="$undef"
22956         fi
22957 else
22958         echo "I'm unable to compile the test program." >&4
22959         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22960         val="$undef"
22961 fi
22962 $rm_try
22963 set usekernprocpathname
22964 eval $setvar
22965
22966 : Determine if we can use _NSGetExecutablePath to find executing program
22967 echo " "
22968 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22969 $cat >try.c <<'EOM'
22970 /* Intentionally a long probe as I'd like to sanity check that the exact
22971    approach is going to work, as thinking it will work, but only having it
22972    part working at runtime is worse than not having it.  */
22973 #include <mach-o/dyld.h>
22974 #include <stdio.h>
22975 #include <stdlib.h>
22976 #include <sys/param.h>
22977 #include <string.h>
22978
22979 int
22980 main(int argc, char **argv) {
22981     char buf[1];
22982     uint32_t size = sizeof(buf);
22983     int result;
22984     char *buffer;
22985     char *tidied;
22986     char *argv_leaf = strrchr(argv[0], '/');
22987     char *tidied_leaf;
22988
22989     if (!argv_leaf) {
22990         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22991         return 1;
22992     }
22993
22994     _NSGetExecutablePath(buf, &size);
22995     if (size > MAXPATHLEN * MAXPATHLEN) {
22996         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22997                 (unsigned int) size);
22998         return 2;
22999     }
23000
23001     buffer = malloc(size);
23002     if (!buffer) {
23003         perror("malloc");
23004         return 3;
23005     }
23006
23007     result = _NSGetExecutablePath(buffer, &size);
23008     if (result != 0) {
23009         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
23010                 result, (unsigned int) size);
23011         return 4;
23012     }
23013
23014     tidied = realpath(buffer, NULL);
23015     if (!tidied) {
23016         perror("realpath");
23017         return 5;
23018     }
23019
23020     free(buffer);
23021
23022     if (*tidied != '/') {
23023         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
23024         return 6;
23025     }
23026
23027     if (strstr(tidied, "/./")) {
23028         fprintf(stderr, "Contains /./: '%s'\n", tidied);
23029         return 7;
23030     }
23031
23032     if (strstr(tidied, "/../")) {
23033         fprintf(stderr, "Contains /../: '%s'\n", tidied);
23034         return 8;
23035     }
23036
23037     tidied_leaf = strrchr(tidied, '/');
23038     if (strcmp(tidied_leaf, argv_leaf) != 0) {
23039         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
23040         return 9;
23041     }
23042
23043     free(tidied);
23044
23045     return 0;
23046 }
23047 EOM
23048
23049 val=$undef
23050 set try
23051 if eval $compile; then
23052         if $run ./try; then
23053                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
23054                 val="$define"
23055         else
23056                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23057         fi
23058 else
23059         echo "I'm unable to compile the test program." >&4
23060         echo "I'll assume no _NSGetExecutablePath here." >&4
23061 fi
23062 $rm_try
23063 set usensgetexecutablepath
23064 eval $setvar
23065
23066 : Check if site customization support was requested
23067 case "$usesitecustomize" in
23068     $define|true|[Yy]*)
23069         usesitecustomize="$define"
23070         ;;
23071     *)
23072         usesitecustomize="$undef"
23073         ;;
23074     esac
23075
23076 : see if prototypes support variable argument declarations
23077 echo " "
23078 case "$prototype$i_stdarg" in
23079 $define$define)
23080         echo "It appears we'll be able to prototype varargs functions." >&4
23081         val="$define"
23082         ;;
23083 *)
23084         echo "Too bad... We won't be using prototyped varargs functions..." >&4
23085         val="$undef"
23086         ;;
23087 esac
23088 set vaproto
23089 eval $setvar
23090
23091 : determine compiler compiler
23092 case "$yacc" in
23093 '')
23094         dflt=yacc;;
23095 *)
23096         dflt="$yacc";;
23097 esac
23098 echo " "
23099 comp='yacc'
23100 if $test -f "$byacc$_exe"; then
23101         dflt="$byacc"
23102         comp="byacc or $comp"
23103 fi
23104 if $test -f "$bison$_exe"; then
23105         comp="$comp or bison -y"
23106 fi
23107 rp="Which compiler compiler ($comp) shall I use?"
23108 . ./myread
23109 yacc="$ans"
23110 case "$yacc" in
23111 *bis*)
23112         case "$yacc" in
23113         *-y*) ;;
23114         *)
23115                 yacc="$yacc -y"
23116                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23117                 ;;
23118         esac
23119         ;;
23120 esac
23121
23122 : see if this is a assert.h system
23123 set assert.h i_assert
23124 eval $inhdr
23125
23126 : see if this is a bfd.h system
23127 set bfd.h i_bfd
23128 eval $inhdr
23129
23130 : see if this is an execinfo.h system
23131 set execinfo.h i_execinfo
23132 eval $inhdr
23133
23134 : see if this is a fenv.h system
23135 set fenv.h i_fenv
23136 eval $inhdr
23137
23138 : see if this is a fp.h system
23139 set fp.h i_fp
23140 eval $inhdr
23141
23142 : see if this is a fp_class.h system
23143 set fp_class.h i_fp_class
23144 eval $inhdr
23145
23146 : see if gdbm.h is available
23147 set gdbm.h t_gdbm
23148 eval $inhdr
23149 case "$t_gdbm" in
23150 $define)
23151         : see if gdbm_open exists
23152         set gdbm_open d_gdbm_open
23153         eval $inlibc
23154         case "$d_gdbm_open" in
23155         $undef)
23156                 t_gdbm="$undef"
23157                 echo "We won't be including <gdbm.h>"
23158                 ;;
23159         esac
23160         ;;
23161 esac
23162 val="$t_gdbm"
23163 set i_gdbm
23164 eval $setvar
23165
23166 : see if this is a ieeefp.h system
23167 case "$i_ieeefp" in
23168 '' ) set ieeefp.h i_ieeefp
23169      eval $inhdr
23170      ;;
23171 esac
23172
23173 : see if this is a libutil.h system
23174 set libutil.h i_libutil
23175 eval $inhdr
23176
23177 : see if mach cthreads are available
23178 if test "X$usethreads" = "X$define"; then
23179         set mach/cthreads.h i_machcthr
23180         eval $inhdr
23181 else
23182         i_machcthr="$undef"
23183 fi
23184
23185 : see if this is a mntent.h system
23186 set mntent.h i_mntent
23187 eval $inhdr
23188
23189 : see if net/errno.h is available
23190 val=''
23191 set net/errno.h val
23192 eval $inhdr
23193
23194 : Unfortunately, it causes problems on some systems.  Arrgh.
23195 case "$val" in
23196 $define)
23197         cat > try.c <<'EOM'
23198 #include <stdio.h>
23199 #include <errno.h>
23200 #include <net/errno.h>
23201 int func()
23202 {
23203         return ENOTSOCK;
23204 }
23205 EOM
23206         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23207                 echo "We'll be including <net/errno.h>." >&4
23208         else
23209                 echo "We won't be including <net/errno.h>." >&4
23210                 val="$undef"
23211         fi
23212         $rm_try
23213         ;;
23214 esac
23215 set i_neterrno
23216 eval $setvar
23217
23218 : see if netinet/tcp.h is available
23219 set netinet/tcp.h i_netinettcp
23220 eval $inhdr
23221
23222 : see if this is a poll.h system
23223 set poll.h i_poll
23224 eval $inhdr
23225
23226 : see if this is a prot.h system
23227 set prot.h i_prot
23228 eval $inhdr
23229
23230 : Preprocessor symbols
23231 echo " "
23232 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23233 $cat <<'EOSH' > Cppsym.know
23234 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23235 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23236 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23237 arch_pwr ardent ARM ARM32 atarist att386 att3b
23238 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23239 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23240 byteorder byte_order
23241 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23242 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23243 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23244 ELF encore EPI EXTENSIONS
23245 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23246 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23247 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23248 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23249 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23250 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23251 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23252 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23253 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23254 ksr1
23255 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23256 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23257 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23258 luna88k Lynx
23259 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23260 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23261 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23262 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23263 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23264 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23265 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23266 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23267 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23268 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23269 ns32000 ns32016 ns32332 ns32k nsc32000
23270 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23271 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23272 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23273 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23274 QK_USER QNX
23275 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23276 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23277 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23278 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23279 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23280 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23281 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23282 SYSV4 SYSV5 sysV68 sysV88
23283 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23284 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23285 tower32_800 tower32_850 tss
23286 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23287 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23288 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23289 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23290 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23291 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23292 uxpm uxps
23293 vax venix VMESA vms
23294 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23295 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23296 z8000 zarch
23297 EOSH
23298 # Maybe put other stuff here too.
23299 ./tr '-' '_' <<EOSH >>Cppsym.know
23300 $osname
23301 EOSH
23302 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23303 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23304 $cat Cppsym.know > Cppsym.c
23305 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23306 $rm -f Cppsym.a Cppsym.b Cppsym.c
23307 cat <<EOSH > Cppsym
23308 $startsh
23309 if $test \$# -gt 0; then
23310     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23311     if $test -s Cppsym.got; then
23312         $rm -f Cppsym.got
23313         exit 0
23314     fi
23315     $rm -f Cppsym.got
23316     exit 1
23317 else
23318     $tr " " "$trnl" | ./Cppsym.try
23319     exit 0
23320 fi
23321 EOSH
23322 chmod +x Cppsym
23323 $eunicefix Cppsym
23324 cat <<EOSH > Cppsym.try
23325 $startsh
23326 cat <<'EOCP' > try.c
23327 #include <stdio.h>
23328 #if cpp_stuff == 1
23329 #define STRINGIFY(a)    "a"
23330 #endif
23331 #if cpp_stuff == 42
23332 #define StGiFy(a)  #a
23333 #define STRINGIFY(a)    StGiFy(a)
23334 #endif
23335 #if $cpp_stuff != 1 && $cpp_stuff != 42
23336 #   include "Bletch: How does this C preprocessor stringify macros?"
23337 #endif
23338 int main() {
23339 EOCP
23340 $awk \\
23341 EOSH
23342 cat <<'EOSH' >> Cppsym.try
23343 'length($1) > 0 {
23344     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23345     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23346     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23347     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23348 }'       >> try.c
23349 echo 'return 0;}' >> try.c
23350 EOSH
23351 cat <<EOSH >> Cppsym.try
23352 ccflags="$ccflags"
23353 case "$osname-$gccversion" in
23354 irix-) ccflags="\$ccflags -woff 1178" ;;
23355 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23356 esac
23357 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23358 EOSH
23359 chmod +x Cppsym.try
23360 $eunicefix Cppsym.try
23361 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23362 : Add in any Linux cpp "predefined macros":
23363 case "$osname::$gccversion" in
23364   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23365     tHdrH=_tmpHdr
23366     rm -f $tHdrH'.h' $tHdrH
23367     touch $tHdrH'.h'
23368     # Filter out macro arguments, such as Linux's __INT8_C(c)
23369     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23370        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23371        if [ -s $tHdrH'_cppsym.real' ]; then
23372           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23373        fi
23374     fi
23375     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23376   ;;
23377 esac
23378 : now check the C compiler for additional symbols
23379 postprocess_cc_v=''
23380 case "$osname" in
23381 aix) postprocess_cc_v="|$tr , ' '" ;;
23382 esac
23383 $cat >ccsym <<EOS
23384 $startsh
23385 $cat >tmp.c <<EOF
23386 extern int foo;
23387 EOF
23388 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23389 do
23390         case "\$i" in
23391         -D*) echo "\$i" | $sed 's/^-D//';;
23392         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23393         esac
23394 done
23395 $rm_try
23396 EOS
23397 postprocess_cc_v=''
23398 chmod +x ccsym
23399 $eunicefix ccsym
23400 ./ccsym > ccsym1.raw
23401 if $test -s ccsym1.raw; then
23402     $sort ccsym1.raw | $uniq >ccsym.raw
23403 else
23404     mv ccsym1.raw ccsym.raw
23405 fi
23406
23407 $awk '/\=/ { print $0; next }
23408         { print $0"=1" }' ccsym.raw >ccsym.list
23409 $comm -13 Cppsym.true ccsym.list >ccsym.own
23410 $comm -12 Cppsym.true ccsym.list >ccsym.com
23411 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23412 also=''
23413 if $test -z ccsym.raw; then
23414         echo "Your C compiler doesn't seem to define any symbols!" >&4
23415         echo " "
23416         echo "However, your C preprocessor defines the following symbols:"
23417         $cat Cppsym.true
23418         ccsymbols=''
23419         cppsymbols=`$cat Cppsym.true`
23420         cppsymbols=`echo $cppsymbols`
23421         cppccsymbols="$cppsymbols"
23422 else
23423         if $test -s ccsym.com; then
23424                 echo "Your C compiler and pre-processor define these symbols:"
23425                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23426                 also='also '
23427                 symbols='ones'
23428                 cppccsymbols=`$cat ccsym.com`
23429                 cppccsymbols=`echo $cppccsymbols`
23430                 $test "$silent" || sleep 1
23431         fi
23432         if $test -s ccsym.cpp; then
23433                 $test "$also" && echo " "
23434                 echo "Your C pre-processor ${also}defines the following symbols:"
23435                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23436                 also='further '
23437                 cppsymbols=`$cat ccsym.cpp`
23438                 cppsymbols=`echo $cppsymbols`
23439                 $test "$silent" || sleep 1
23440         fi
23441         if $test -s ccsym.own; then
23442                 $test "$also" && echo " "
23443                 echo "Your C compiler ${also}defines the following cpp symbols:"
23444                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23445                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23446                 ccsymbols=`$cat ccsym.own`
23447                 ccsymbols=`echo $ccsymbols`
23448                 $test "$silent" || sleep 1
23449         fi
23450 fi
23451
23452 : add -D_FORTIFY_SOURCE if feasible and not already there
23453 case "$gccversion" in
23454 [45].*) case "$optimize$ccflags" in
23455         *-O*)   case "$ccflags$cppsymbols" in
23456                 *_FORTIFY_SOURCE=*) # Don't add it again.
23457                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23458                         ;;
23459                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23460                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23461                         ;;
23462                 esac
23463                 ;;
23464         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23465                 ;;
23466         esac
23467         ;;
23468 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23469         ;;
23470 esac
23471
23472 : see if this is a termio system
23473 val="$undef"
23474 val2="$undef"
23475 val3="$undef"
23476 if $test `./findhdr termios.h`; then
23477     set tcsetattr i_termios
23478     eval $inlibc
23479     val3="$i_termios"
23480 fi
23481 echo " "
23482 case "$val3" in
23483     "$define") echo "You have POSIX termios.h... good!" >&4;;
23484     *)  if ./Cppsym pyr; then
23485             case "`$run /bin/universe`" in
23486                 ucb) if $test `./findhdr sgtty.h`; then
23487                         val2="$define"
23488                         echo "<sgtty.h> found." >&4
23489                     else
23490                         echo "System is pyramid with BSD universe."
23491                         ./warn "<sgtty.h> not found--you could have problems."
23492                     fi;;
23493                 *)  if $test `./findhdr termio.h`; then
23494                         val="$define"
23495                         echo "<termio.h> found." >&4
23496                     else
23497                         echo "System is pyramid with USG universe."
23498                         ./warn "<termio.h> not found--you could have problems."
23499                     fi;;
23500             esac
23501         elif ./usg; then
23502             if $test `./findhdr termio.h`; then
23503                 echo "<termio.h> found." >&4
23504                 val="$define"
23505             elif $test `./findhdr sgtty.h`; then
23506                 echo "<sgtty.h> found." >&4
23507                 val2="$define"
23508             else
23509                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23510             fi
23511         else
23512             if $test `./findhdr sgtty.h`; then
23513                 echo "<sgtty.h> found." >&4
23514                 val2="$define"
23515             elif $test `./findhdr termio.h`; then
23516                 echo "<termio.h> found." >&4
23517                 val="$define"
23518             else
23519                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23520             fi
23521         fi;;
23522 esac
23523 set i_termio; eval $setvar
23524 val=$val2; set i_sgtty; eval $setvar
23525 val=$val3; set i_termios; eval $setvar
23526
23527 : see if stdbool is available
23528 : we want a real compile instead of Inhdr because some Solaris systems
23529 : have stdbool.h, but it can only be used if the compiler indicates it
23530 : is sufficiently c99-compliant.
23531 echo " "
23532 $cat >try.c <<EOCP
23533 #include <stdio.h>
23534 #include <stdbool.h>
23535 int func(bool x)
23536 {
23537     return x ? 1 : 0;
23538 }
23539 int main(int argc, char **argv)
23540 {
23541     return func(0);
23542 }
23543 EOCP
23544 set try
23545 if eval $compile; then
23546         echo "<stdbool.h> found." >&4
23547         val="$define"
23548 else
23549         echo "<stdbool.h> NOT found." >&4
23550         val="$undef"
23551 fi
23552 $rm_try
23553 set i_stdbool
23554 eval $setvar
23555
23556 : see if stddef is available
23557 set stddef.h i_stddef
23558 eval $inhdr
23559
23560 : see if stdint is available
23561 set stdint.h i_stdint
23562 eval $inhdr
23563
23564 : see if sys/access.h is available
23565 set sys/access.h i_sysaccess
23566 eval $inhdr
23567
23568 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23569 set sys/filio.h i_sysfilio
23570 eval $inhdr
23571 echo " "
23572 if $test `./findhdr sys/ioctl.h`; then
23573         val="$define"
23574         echo '<sys/ioctl.h> found.' >&4
23575 else
23576         val="$undef"
23577         if $test $i_sysfilio = "$define"; then
23578             echo '<sys/ioctl.h> NOT found.' >&4
23579         else
23580                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23581                 $test $i_termio = "$define" && xxx="termio.h"
23582                 $test $i_termios = "$define" && xxx="termios.h"
23583 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23584         fi
23585 fi
23586 set i_sysioctl
23587 eval $setvar
23588
23589 : see if socket ioctl defs are in sys/sockio.h
23590 echo " "
23591 xxx=`./findhdr sys/sockio.h`
23592 if $test "$xxx"; then
23593         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23594                 val="$define"
23595                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23596         else
23597                 val="$undef"
23598                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23599         fi
23600 else
23601         val="$undef"
23602         $cat <<EOM
23603 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23604 EOM
23605 fi
23606 set i_syssockio
23607 eval $setvar
23608
23609 : see if this is a syslog.h system
23610 set syslog.h i_syslog
23611 eval $inhdr
23612
23613 : see if this is a sys/mode.h system
23614 set sys/mode.h i_sysmode
23615 eval $inhdr
23616
23617 : see if there is a sys/poll.h file
23618 set sys/poll.h i_syspoll
23619 eval $inhdr
23620
23621 : see if sys/resource.h has to be included
23622 set sys/resource.h i_sysresrc
23623 eval $inhdr
23624
23625 : see if sys/security.h is available
23626 set sys/security.h i_syssecrt
23627 eval $inhdr
23628
23629 : see if this is a sys/statvfs.h system
23630 set sys/statvfs.h i_sysstatvfs
23631 eval $inhdr
23632
23633 : see if this is a sys/un.h system
23634 set sys/un.h i_sysun
23635 eval $inhdr
23636
23637 : see if this is a sys/utsname.h system
23638 set sys/utsname.h i_sysutsname
23639 eval $inhdr
23640
23641 : see if this is a syswait system
23642 set sys/wait.h i_syswait
23643 eval $inhdr
23644
23645 : see if this is a ustat.h system
23646 set ustat.h i_ustat
23647 eval $inhdr
23648
23649 : see if this is an utime system
23650 set utime.h i_utime
23651 eval $inhdr
23652
23653 : see if this is a vfork system
23654 case "$d_vfork" in
23655 "$define")
23656         set vfork.h i_vfork
23657         eval $inhdr
23658         ;;
23659 *)
23660         i_vfork="$undef"
23661         ;;
23662 esac
23663
23664 : Check extensions
23665 echo " "
23666 echo "Looking for extensions..." >&4
23667 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23668 : contain old or inaccurate or duplicate values.
23669 nonxs_extensions=''
23670 xs_extensions=''
23671 : We do not use find because it might not be available.
23672 : We do not just use MANIFEST because the user may have dropped
23673 : some additional extensions into the source tree and expect them
23674 : to be built.
23675
23676 : Function to recursively find available extensions, ignoring DynaLoader
23677 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23678 : In 5.10.1 and later, extensions are stored in directories
23679 : like File-Glob instead of the older File/Glob/.
23680 find_extensions='
23681     for xxx in *; do
23682         case "$xxx" in
23683             DynaLoader|dynaload) ;;
23684             *)
23685             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23686             case "$this_ext" in
23687                 Scalar/List/Utils) this_ext="List/Util" ;;
23688                 PathTools)         this_ext="Cwd"       ;;
23689             esac;
23690             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23691             if $contains " $this_ext " "$tdir/$$.tmp"; then
23692                 echo >&4;
23693                 echo "Duplicate directories detected for extension $xxx" >&4;
23694                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23695                 case "$knowitall" in
23696                 "") dflt=y;;
23697                 *) dflt=n;;
23698                 esac;
23699                 . ../UU/myread;
23700                 case "$ans" in
23701                 n*|N*) ;;
23702                 *) echo >&4;
23703                     echo "Ok.  Stopping Configure." >&4;
23704                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23705                     exit 1;;
23706                 esac;
23707                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23708             fi;
23709             $ls -1 "$xxx" > "$tdir/$$.tmp";
23710             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23711                 xs_extensions="$xs_extensions $this_ext";
23712             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23713                 xs_extensions="$xs_extensions $this_ext";
23714             elif $test -d "$xxx"; then
23715                 nonxs_extensions="$nonxs_extensions $this_ext";
23716             fi;
23717             $rm -f "$tdir/$$.tmp";
23718             ;;
23719         esac;
23720     done'
23721 tdir=`pwd`
23722 cd "$rsrc/cpan"
23723 set X
23724 shift
23725 eval $find_extensions
23726 cd "$rsrc/dist"
23727 set X
23728 shift
23729 eval $find_extensions
23730 cd "$rsrc/ext"
23731 set X
23732 shift
23733 eval $find_extensions
23734 set X $xs_extensions
23735 shift
23736 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23737 set X $nonxs_extensions
23738 shift
23739 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23740 cd "$tdir"
23741 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23742
23743 : Now see which are supported on this system.
23744 avail_ext=''
23745 for xxx in $xs_extensions ; do
23746         case "$xxx" in
23747         Amiga*)
23748                 case "$osname" in
23749                 amigaos) avail_ext="$avail_ext $xxx" ;;
23750                 esac
23751                 ;;
23752         DB_File|db_file)
23753                 case "$i_db" in
23754                 $define) avail_ext="$avail_ext $xxx" ;;
23755                 esac
23756                 ;;
23757         GDBM_File|gdbm_fil)
23758                 case "$i_gdbm" in
23759                 $define) avail_ext="$avail_ext $xxx" ;;
23760                 esac
23761                 ;;
23762         I18N/Langinfo|i18n_lan)
23763                 case "$i_langinfo$d_nl_langinfo" in
23764                 $define$define) avail_ext="$avail_ext $xxx" ;;
23765                 esac
23766                 ;;
23767         IPC/SysV|ipc/sysv)
23768                 : XXX Do we need a useipcsysv variable here
23769                 case "${d_msg}${d_sem}${d_shm}" in
23770                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23771                 esac
23772                 ;;
23773         NDBM_File|ndbm_fil)
23774                 case "$d_ndbm" in
23775                 $define)
23776                     case "$osname-$use64bitint" in
23777                     hpux-define)
23778                         case "$libs" in
23779                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23780                         esac
23781                         ;;
23782                     *) avail_ext="$avail_ext $xxx" ;;
23783                     esac
23784                     ;;
23785                 esac
23786                 ;;
23787         ODBM_File|odbm_fil)
23788                 case "${i_dbm}${i_rpcsvcdbm}" in
23789                 *"${define}"*)
23790                     case "$d_cplusplus" in
23791                     define) ;; # delete as a function name will not work
23792                     *)  case "$osname-$use64bitint" in
23793                         hpux-define)
23794                             case "$libs" in
23795                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23796                             esac
23797                             ;;
23798                         *) avail_ext="$avail_ext $xxx" ;;
23799                         esac
23800                         ;;
23801                     esac
23802                     ;;
23803                 esac
23804                 ;;
23805         Opcode|opcode)
23806                 case "$useopcode" in
23807                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23808                 esac
23809                 ;;
23810         POSIX|posix)
23811                 case "$useposix" in
23812                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23813                 esac
23814                 ;;
23815         Socket|socket)
23816                 case "$d_socket" in
23817                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23818                 esac
23819                 ;;
23820         Sys/Syslog|sys/syslog)
23821                 case $osname in
23822                         amigaos) ;; # not really very useful on AmigaOS
23823                         *)
23824                         : XXX syslog requires socket
23825                         case "$d_socket" in
23826                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23827                         esac
23828                         ;;
23829                 esac
23830                 ;;
23831         Thread|thread)
23832                 case "$usethreads" in
23833                 true|$define|y)
23834                         case "$use5005threads" in
23835                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23836                         esac
23837                 esac
23838                 ;;
23839         threads|threads/shared)
23840                 # threads and threads::shared are special cases.
23841                 # To stop people from asking "Perl 5.8.0 was supposed
23842                 # to have this new fancy threads implementation but my
23843                 # perl doesn't have it" and from people trying to
23844                 # (re)install the threads module using CPAN.pm and
23845                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23846                 # the threads.pm and threads/shared.pm will always be
23847                 # there, croaking informatively ("you need to rebuild
23848                 # all of Perl with threads, sorry") when threads haven't
23849                 # been compiled in.
23850                 # --jhi
23851                 avail_ext="$avail_ext $xxx"
23852                 ;;
23853         VMS*)
23854                 ;;
23855         Win32*)
23856                 case "$osname" in
23857                 cygwin) avail_ext="$avail_ext $xxx" ;;
23858                 esac
23859                 ;;
23860         XS/APItest|xs/apitest)
23861                 # This is just for testing.  Skip it unless we have dynamic loading.
23862
23863                 case "$usedl" in
23864                 $define) avail_ext="$avail_ext $xxx" ;;
23865                 esac
23866                 ;;
23867         XS/Typemap|xs/typemap)
23868                 # This is just for testing.  Skip it unless we have dynamic loading.
23869                 case "$usedl" in
23870                 $define) avail_ext="$avail_ext $xxx" ;;
23871                 esac
23872                 ;;
23873         *)      avail_ext="$avail_ext $xxx"
23874                 ;;
23875         esac
23876 done
23877
23878 set X $avail_ext
23879 shift
23880 avail_ext="$*"
23881
23882 case "$onlyextensions" in
23883 '') ;;
23884 *)  keepextensions=''
23885     echo "You have requested that only certain extensions be included..." >&4
23886     for i in $onlyextensions; do
23887         case " $avail_ext " in
23888         *" $i "*)
23889             echo "Keeping extension $i."
23890             keepextensions="$keepextensions $i"
23891             ;;
23892         *) echo "Ignoring extension $i." ;;
23893         esac
23894     done
23895     avail_ext="$keepextensions"
23896     ;;
23897 esac
23898
23899 case "$noextensions" in
23900 '') ;;
23901 *)  keepextensions=''
23902     echo "You have requested that certain extensions be ignored..." >&4
23903     for i in $avail_ext; do
23904         case " $noextensions " in
23905         *" $i "*) echo "Ignoring extension $i." ;;
23906         *) echo "Keeping extension $i.";
23907            keepextensions="$keepextensions $i"
23908            ;;
23909         esac
23910     done
23911     avail_ext="$keepextensions"
23912     ;;
23913 esac
23914
23915 : Now see which nonxs extensions are supported on this system.
23916 : For now assume all are.
23917 nonxs_ext=''
23918 for xxx in $nonxs_extensions ; do
23919         case "$xxx" in
23920         VMS*)
23921                 ;;
23922         *)      nonxs_ext="$nonxs_ext $xxx"
23923                 ;;
23924         esac
23925 done
23926
23927 set X $nonxs_ext
23928 shift
23929 nonxs_ext="$*"
23930
23931 case $usedl in
23932 $define)
23933         $cat <<EOM
23934 A number of extensions are supplied with $package.  You may choose to
23935 compile these extensions for dynamic loading (the default), compile
23936 them into the $package executable (static loading), or not include
23937 them at all.  Answer "none" to include no extensions.
23938 Note that DynaLoader is always built and need not be mentioned here.
23939
23940 EOM
23941         case "$dynamic_ext" in
23942         '')
23943                 : Exclude those listed in static_ext
23944                 dflt=''
23945                 for xxx in $avail_ext; do
23946                         case " $static_ext " in
23947                         *" $xxx "*) ;;
23948                         *) dflt="$dflt $xxx" ;;
23949                         esac
23950                 done
23951                 set X $dflt
23952                 shift
23953                 dflt="$*"
23954                 ;;
23955         *)      dflt="$dynamic_ext"
23956                 # Perhaps we are reusing an old out-of-date config.sh.
23957                 case "$hint" in
23958                 previous)
23959                         if test X"$dynamic_ext" != X"$avail_ext"; then
23960                                 $cat <<EOM
23961 NOTICE:  Your previous config.sh list may be incorrect.
23962 The extensions now available to you are
23963         ${avail_ext}
23964 but the default list from your previous config.sh is
23965         ${dynamic_ext}
23966
23967 EOM
23968                         fi
23969                         ;;
23970                 esac
23971                 ;;
23972         esac
23973         case "$dflt" in
23974         '')     dflt=none;;
23975         esac
23976         rp="What extensions do you wish to load dynamically?"
23977         . ./myread
23978         case "$ans" in
23979         none) dynamic_ext=' ' ;;
23980         *) dynamic_ext="$ans" ;;
23981         esac
23982
23983         case "$static_ext" in
23984         '')
23985                 : Exclude those already listed in dynamic linking
23986                 dflt=''
23987                 for xxx in $avail_ext; do
23988                         case " $dynamic_ext " in
23989                         *" $xxx "*) ;;
23990                         *) dflt="$dflt $xxx" ;;
23991                         esac
23992                 done
23993                 set X $dflt
23994                 shift
23995                 dflt="$*"
23996                 ;;
23997         *)  dflt="$static_ext"
23998                 ;;
23999         esac
24000
24001         case "$dflt" in
24002         '')     dflt=none;;
24003         esac
24004         rp="What extensions do you wish to load statically?"
24005         . ./myread
24006         case "$ans" in
24007         none) static_ext=' ' ;;
24008         *) static_ext="$ans" ;;
24009         esac
24010         ;;
24011 *)
24012         $cat <<EOM
24013 A number of extensions are supplied with $package.  Answer "none"
24014 to include no extensions.
24015 Note that DynaLoader is always built and need not be mentioned here.
24016
24017 EOM
24018         case "$static_ext" in
24019         '') dflt="$avail_ext" ;;
24020         *)      dflt="$static_ext"
24021                 # Perhaps we are reusing an old out-of-date config.sh.
24022                 case "$hint" in
24023                 previous)
24024                         if test X"$static_ext" != X"$avail_ext"; then
24025                                 $cat <<EOM
24026 NOTICE:  Your previous config.sh list may be incorrect.
24027 The extensions now available to you are
24028         ${avail_ext}
24029 but the default list from your previous config.sh is
24030         ${static_ext}
24031
24032 EOM
24033                         fi
24034                         ;;
24035                 esac
24036                 ;;
24037         esac
24038         : Exclude those that are not xs extensions
24039         case "$dflt" in
24040         '')     dflt=none;;
24041         esac
24042         rp="What extensions do you wish to include?"
24043         . ./myread
24044         case "$ans" in
24045         none) static_ext=' ' ;;
24046         *) static_ext="$ans" ;;
24047         esac
24048         ;;
24049 esac
24050 #
24051 # Encode is a special case.  If we are building Encode as a static
24052 # extension, we need to explicitly list its subextensions as well.
24053 # For other nested extensions, this is handled automatically by
24054 # the appropriate Makefile.PL.
24055 case " $static_ext " in
24056         *" Encode "*) # Add the subextensions of Encode
24057         cd "$rsrc/cpan"
24058         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24059                 static_ext="$static_ext Encode/$xxx"
24060                 known_extensions="$known_extensions Encode/$xxx"
24061         done
24062         cd "$tdir"
24063         ;;
24064 esac
24065
24066 set X $dynamic_ext $static_ext $nonxs_ext
24067 shift
24068 extensions="$*"
24069
24070 # Sanity check:  We require an extension suitable for use with
24071 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
24072 # should show up as failures in the test suite, but it's helpful to
24073 # catch them now.) The 'extensions' list is normally sorted
24074 # alphabetically, so we need to accept either
24075 #    DB_File ... Fcntl ... IO  ....
24076 # or something like
24077 #    Fcntl ... NDBM_File ... IO  ....
24078 case " $extensions"  in
24079 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
24080 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24081 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24082 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24083    echo "WARNING: The Perl you are building will be quite crippled." >& 4
24084    ;;
24085 esac
24086
24087 : Remove libraries needed only for extensions
24088 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24089 : The exception is SunOS 4.x, which needs them.
24090 case "${osname}X${osvers}" in
24091 sunos*X4*)
24092     perllibs="$libs"
24093     ;;
24094 *) case "$usedl" in
24095     $define|true|[yY]*)
24096             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24097             shift
24098             perllibs="$*"
24099             ;;
24100     *)  perllibs="$libs"
24101             ;;
24102     esac
24103     ;;
24104 esac
24105
24106 : Remove build directory name from cppstdin so it can be used from
24107 : either the present location or the final installed location.
24108 echo " "
24109 : Get out of the UU directory to get correct path name.
24110 cd ..
24111 case "$cppstdin" in
24112 `pwd`/cppstdin)
24113         echo "Stripping down cppstdin path name"
24114         cppstdin=cppstdin
24115         ;;
24116 esac
24117 cd UU
24118
24119 : end of configuration questions
24120 echo " "
24121 echo "End of configuration questions."
24122 echo " "
24123
24124 : back to where it started
24125 if test -d ../UU; then
24126         cd ..
24127 fi
24128
24129 : configuration may be unconditionally patched via a 'config.arch' file
24130 if $test -f config.arch; then
24131         echo "I see a config.arch file, loading it." >&4
24132         . ./config.arch
24133 fi
24134
24135 : configuration may be patched via a 'config.over' file
24136 if $test -f config.over; then
24137         echo " "
24138         dflt=y
24139         rp='I see a config.over file.  Do you wish to load it?'
24140         . UU/myread
24141         case "$ans" in
24142         n*) echo "OK, I'll ignore it.";;
24143         *)      . ./config.over
24144                 echo "Configuration override changes have been loaded."
24145                 ;;
24146         esac
24147 fi
24148
24149 : in case they want portability, strip down executable paths
24150 case "$d_portable" in
24151 "$define")
24152         echo " "
24153         echo "Stripping down executable paths..." >&4
24154         for file in $loclist $trylist; do
24155                 eval temp=\$$file
24156                 eval $file=`basename $temp`
24157         done
24158         ;;
24159 esac
24160
24161 : create config.sh file
24162 echo " "
24163 echo "Creating config.sh..." >&4
24164 $spitshell <<EOT >config.sh
24165 $startsh
24166 #
24167 # This file was produced by running the Configure script. It holds all the
24168 # definitions figured out by Configure. Should you modify one of these values,
24169 # do not forget to propagate your changes by running "Configure -der". You may
24170 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24171 #
24172
24173 # Package name      : $package
24174 # Source directory  : $src
24175 # Configuration time: $cf_time
24176 # Configured by     : $cf_by
24177 # Target system     : $myuname
24178
24179 EOT
24180 : Add in command line options if available
24181 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24182
24183 $spitshell <<EOT >>config.sh
24184
24185 Author='$Author'
24186 Date='$Date'
24187 Header='$Header'
24188 Id='$Id'
24189 Locker='$Locker'
24190 Log='$Log'
24191 RCSfile='$RCSfile'
24192 Revision='$Revision'
24193 Source='$Source'
24194 State='$State'
24195 _a='$_a'
24196 _exe='$_exe'
24197 _o='$_o'
24198 afs='$afs'
24199 afsroot='$afsroot'
24200 alignbytes='$alignbytes'
24201 ansi2knr='$ansi2knr'
24202 aphostname='$aphostname'
24203 api_revision='$api_revision'
24204 api_subversion='$api_subversion'
24205 api_version='$api_version'
24206 api_versionstring='$api_versionstring'
24207 ar='$ar'
24208 archlib='$archlib'
24209 archlibexp='$archlibexp'
24210 archname64='$archname64'
24211 archname='$archname'
24212 archobjs='$archobjs'
24213 asctime_r_proto='$asctime_r_proto'
24214 awk='$awk'
24215 baserev='$baserev'
24216 bash='$bash'
24217 bin='$bin'
24218 bin_ELF='$bin_ELF'
24219 binexp='$binexp'
24220 bison='$bison'
24221 byacc='$byacc'
24222 byteorder='$byteorder'
24223 c='$c'
24224 castflags='$castflags'
24225 cat='$cat'
24226 cc='$cc'
24227 cccdlflags='$cccdlflags'
24228 ccdlflags='$ccdlflags'
24229 ccflags='$ccflags'
24230 ccflags_uselargefiles='$ccflags_uselargefiles'
24231 ccname='$ccname'
24232 ccsymbols='$ccsymbols'
24233 ccversion='$ccversion'
24234 cf_by='$cf_by'
24235 cf_email='$cf_email'
24236 cf_time='$cf_time'
24237 charbits='$charbits'
24238 charsize='$charsize'
24239 chgrp='$chgrp'
24240 chmod='$chmod'
24241 chown='$chown'
24242 clocktype='$clocktype'
24243 comm='$comm'
24244 compress='$compress'
24245 contains='$contains'
24246 cp='$cp'
24247 cpio='$cpio'
24248 cpp='$cpp'
24249 cpp_stuff='$cpp_stuff'
24250 cppccsymbols='$cppccsymbols'
24251 cppflags='$cppflags'
24252 cpplast='$cpplast'
24253 cppminus='$cppminus'
24254 cpprun='$cpprun'
24255 cppstdin='$cppstdin'
24256 cppsymbols='$cppsymbols'
24257 crypt_r_proto='$crypt_r_proto'
24258 cryptlib='$cryptlib'
24259 csh='$csh'
24260 ctermid_r_proto='$ctermid_r_proto'
24261 ctime_r_proto='$ctime_r_proto'
24262 d_Gconvert='$d_Gconvert'
24263 d_PRIEUldbl='$d_PRIEUldbl'
24264 d_PRIFUldbl='$d_PRIFUldbl'
24265 d_PRIGUldbl='$d_PRIGUldbl'
24266 d_PRIXU64='$d_PRIXU64'
24267 d_PRId64='$d_PRId64'
24268 d_PRIeldbl='$d_PRIeldbl'
24269 d_PRIfldbl='$d_PRIfldbl'
24270 d_PRIgldbl='$d_PRIgldbl'
24271 d_PRIi64='$d_PRIi64'
24272 d_PRIo64='$d_PRIo64'
24273 d_PRIu64='$d_PRIu64'
24274 d_PRIx64='$d_PRIx64'
24275 d_SCNfldbl='$d_SCNfldbl'
24276 d__fwalk='$d__fwalk'
24277 d_access='$d_access'
24278 d_accessx='$d_accessx'
24279 d_acosh='$d_acosh'
24280 d_aintl='$d_aintl'
24281 d_alarm='$d_alarm'
24282 d_archlib='$d_archlib'
24283 d_asctime64='$d_asctime64'
24284 d_asctime_r='$d_asctime_r'
24285 d_asinh='$d_asinh'
24286 d_atanh='$d_atanh'
24287 d_atolf='$d_atolf'
24288 d_atoll='$d_atoll'
24289 d_attribute_deprecated='$d_attribute_deprecated'
24290 d_attribute_format='$d_attribute_format'
24291 d_attribute_malloc='$d_attribute_malloc'
24292 d_attribute_nonnull='$d_attribute_nonnull'
24293 d_attribute_noreturn='$d_attribute_noreturn'
24294 d_attribute_pure='$d_attribute_pure'
24295 d_attribute_unused='$d_attribute_unused'
24296 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24297 d_backtrace='$d_backtrace'
24298 d_bcmp='$d_bcmp'
24299 d_bcopy='$d_bcopy'
24300 d_bsd='$d_bsd'
24301 d_bsdgetpgrp='$d_bsdgetpgrp'
24302 d_bsdsetpgrp='$d_bsdsetpgrp'
24303 d_builtin_choose_expr='$d_builtin_choose_expr'
24304 d_builtin_expect='$d_builtin_expect'
24305 d_bzero='$d_bzero'
24306 d_c99_variadic_macros='$d_c99_variadic_macros'
24307 d_casti32='$d_casti32'
24308 d_castneg='$d_castneg'
24309 d_cbrt='$d_cbrt'
24310 d_charvspr='$d_charvspr'
24311 d_chown='$d_chown'
24312 d_chroot='$d_chroot'
24313 d_chsize='$d_chsize'
24314 d_class='$d_class'
24315 d_clearenv='$d_clearenv'
24316 d_closedir='$d_closedir'
24317 d_cmsghdr_s='$d_cmsghdr_s'
24318 d_const='$d_const'
24319 d_copysign='$d_copysign'
24320 d_copysignl='$d_copysignl'
24321 d_cplusplus='$d_cplusplus'
24322 d_crypt='$d_crypt'
24323 d_crypt_r='$d_crypt_r'
24324 d_csh='$d_csh'
24325 d_ctermid='$d_ctermid'
24326 d_ctermid_r='$d_ctermid_r'
24327 d_ctime64='$d_ctime64'
24328 d_ctime_r='$d_ctime_r'
24329 d_cuserid='$d_cuserid'
24330 d_dbl_dig='$d_dbl_dig'
24331 d_dbminitproto='$d_dbminitproto'
24332 d_difftime64='$d_difftime64'
24333 d_difftime='$d_difftime'
24334 d_dir_dd_fd='$d_dir_dd_fd'
24335 d_dirfd='$d_dirfd'
24336 d_dirnamlen='$d_dirnamlen'
24337 d_dladdr='$d_dladdr'
24338 d_dlerror='$d_dlerror'
24339 d_dlopen='$d_dlopen'
24340 d_dlsymun='$d_dlsymun'
24341 d_dosuid='$d_dosuid'
24342 d_drand48_r='$d_drand48_r'
24343 d_drand48proto='$d_drand48proto'
24344 d_dup2='$d_dup2'
24345 d_duplocale='$d_duplocale'
24346 d_eaccess='$d_eaccess'
24347 d_endgrent='$d_endgrent'
24348 d_endgrent_r='$d_endgrent_r'
24349 d_endhent='$d_endhent'
24350 d_endhostent_r='$d_endhostent_r'
24351 d_endnent='$d_endnent'
24352 d_endnetent_r='$d_endnetent_r'
24353 d_endpent='$d_endpent'
24354 d_endprotoent_r='$d_endprotoent_r'
24355 d_endpwent='$d_endpwent'
24356 d_endpwent_r='$d_endpwent_r'
24357 d_endsent='$d_endsent'
24358 d_endservent_r='$d_endservent_r'
24359 d_eofnblk='$d_eofnblk'
24360 d_erf='$d_erf'
24361 d_erfc='$d_erfc'
24362 d_eunice='$d_eunice'
24363 d_exp2='$d_exp2'
24364 d_expm1='$d_expm1'
24365 d_faststdio='$d_faststdio'
24366 d_fchdir='$d_fchdir'
24367 d_fchmod='$d_fchmod'
24368 d_fchown='$d_fchown'
24369 d_fcntl='$d_fcntl'
24370 d_fcntl_can_lock='$d_fcntl_can_lock'
24371 d_fd_macros='$d_fd_macros'
24372 d_fd_set='$d_fd_set'
24373 d_fdclose='$d_fdclose'
24374 d_fdim='$d_fdim'
24375 d_fds_bits='$d_fds_bits'
24376 d_fegetround='$d_fegetround'
24377 d_fgetpos='$d_fgetpos'
24378 d_finite='$d_finite'
24379 d_finitel='$d_finitel'
24380 d_flexfnam='$d_flexfnam'
24381 d_flock='$d_flock'
24382 d_flockproto='$d_flockproto'
24383 d_fma='$d_fma'
24384 d_fmax='$d_fmax'
24385 d_fmin='$d_fmin'
24386 d_fork='$d_fork'
24387 d_fp_class='$d_fp_class'
24388 d_fp_classify='$d_fp_classify'
24389 d_fp_classl='$d_fp_classl'
24390 d_fpathconf='$d_fpathconf'
24391 d_fpclass='$d_fpclass'
24392 d_fpclassify='$d_fpclassify'
24393 d_fpclassl='$d_fpclassl'
24394 d_fpgetround='$d_fpgetround'
24395 d_fpos64_t='$d_fpos64_t'
24396 d_freelocale='$d_freelocale'
24397 d_frexpl='$d_frexpl'
24398 d_fs_data_s='$d_fs_data_s'
24399 d_fseeko='$d_fseeko'
24400 d_fsetpos='$d_fsetpos'
24401 d_fstatfs='$d_fstatfs'
24402 d_fstatvfs='$d_fstatvfs'
24403 d_fsync='$d_fsync'
24404 d_ftello='$d_ftello'
24405 d_ftime='$d_ftime'
24406 d_futimes='$d_futimes'
24407 d_gai_strerror='$d_gai_strerror'
24408 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24409 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24410 d_getaddrinfo='$d_getaddrinfo'
24411 d_getcwd='$d_getcwd'
24412 d_getespwnam='$d_getespwnam'
24413 d_getfsstat='$d_getfsstat'
24414 d_getgrent='$d_getgrent'
24415 d_getgrent_r='$d_getgrent_r'
24416 d_getgrgid_r='$d_getgrgid_r'
24417 d_getgrnam_r='$d_getgrnam_r'
24418 d_getgrps='$d_getgrps'
24419 d_gethbyaddr='$d_gethbyaddr'
24420 d_gethbyname='$d_gethbyname'
24421 d_gethent='$d_gethent'
24422 d_gethname='$d_gethname'
24423 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24424 d_gethostbyname_r='$d_gethostbyname_r'
24425 d_gethostent_r='$d_gethostent_r'
24426 d_gethostprotos='$d_gethostprotos'
24427 d_getitimer='$d_getitimer'
24428 d_getlogin='$d_getlogin'
24429 d_getlogin_r='$d_getlogin_r'
24430 d_getmnt='$d_getmnt'
24431 d_getmntent='$d_getmntent'
24432 d_getnameinfo='$d_getnameinfo'
24433 d_getnbyaddr='$d_getnbyaddr'
24434 d_getnbyname='$d_getnbyname'
24435 d_getnent='$d_getnent'
24436 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24437 d_getnetbyname_r='$d_getnetbyname_r'
24438 d_getnetent_r='$d_getnetent_r'
24439 d_getnetprotos='$d_getnetprotos'
24440 d_getpagsz='$d_getpagsz'
24441 d_getpbyname='$d_getpbyname'
24442 d_getpbynumber='$d_getpbynumber'
24443 d_getpent='$d_getpent'
24444 d_getpgid='$d_getpgid'
24445 d_getpgrp2='$d_getpgrp2'
24446 d_getpgrp='$d_getpgrp'
24447 d_getppid='$d_getppid'
24448 d_getprior='$d_getprior'
24449 d_getprotobyname_r='$d_getprotobyname_r'
24450 d_getprotobynumber_r='$d_getprotobynumber_r'
24451 d_getprotoent_r='$d_getprotoent_r'
24452 d_getprotoprotos='$d_getprotoprotos'
24453 d_getprpwnam='$d_getprpwnam'
24454 d_getpwent='$d_getpwent'
24455 d_getpwent_r='$d_getpwent_r'
24456 d_getpwnam_r='$d_getpwnam_r'
24457 d_getpwuid_r='$d_getpwuid_r'
24458 d_getsbyname='$d_getsbyname'
24459 d_getsbyport='$d_getsbyport'
24460 d_getsent='$d_getsent'
24461 d_getservbyname_r='$d_getservbyname_r'
24462 d_getservbyport_r='$d_getservbyport_r'
24463 d_getservent_r='$d_getservent_r'
24464 d_getservprotos='$d_getservprotos'
24465 d_getspnam='$d_getspnam'
24466 d_getspnam_r='$d_getspnam_r'
24467 d_gettimeod='$d_gettimeod'
24468 d_gmtime64='$d_gmtime64'
24469 d_gmtime_r='$d_gmtime_r'
24470 d_gnulibc='$d_gnulibc'
24471 d_grpasswd='$d_grpasswd'
24472 d_hasmntopt='$d_hasmntopt'
24473 d_htonl='$d_htonl'
24474 d_hypot='$d_hypot'
24475 d_ilogb='$d_ilogb'
24476 d_ilogbl='$d_ilogbl'
24477 d_inc_version_list='$d_inc_version_list'
24478 d_index='$d_index'
24479 d_inetaton='$d_inetaton'
24480 d_inetntop='$d_inetntop'
24481 d_inetpton='$d_inetpton'
24482 d_int64_t='$d_int64_t'
24483 d_ip_mreq='$d_ip_mreq'
24484 d_ip_mreq_source='$d_ip_mreq_source'
24485 d_ipv6_mreq='$d_ipv6_mreq'
24486 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24487 d_isascii='$d_isascii'
24488 d_isblank='$d_isblank'
24489 d_isfinite='$d_isfinite'
24490 d_isfinitel='$d_isfinitel'
24491 d_isinf='$d_isinf'
24492 d_isinfl='$d_isinfl'
24493 d_isless='$d_isless'
24494 d_isnan='$d_isnan'
24495 d_isnanl='$d_isnanl'
24496 d_isnormal='$d_isnormal'
24497 d_j0='$d_j0'
24498 d_j0l='$d_j0l'
24499 d_killpg='$d_killpg'
24500 d_lc_monetary_2008='$d_lc_monetary_2008'
24501 d_lchown='$d_lchown'
24502 d_ldbl_dig='$d_ldbl_dig'
24503 d_ldexpl='$d_ldexpl'
24504 d_lgamma='$d_lgamma'
24505 d_lgamma_r='$d_lgamma_r'
24506 d_libm_lib_version='$d_libm_lib_version'
24507 d_libname_unique='$d_libname_unique'
24508 d_link='$d_link'
24509 d_llrint='$d_llrint'
24510 d_llrintl='$d_llrintl'
24511 d_llround='$d_llround'
24512 d_llroundl='$d_llroundl'
24513 d_localtime64='$d_localtime64'
24514 d_localtime_r='$d_localtime_r'
24515 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24516 d_locconv='$d_locconv'
24517 d_lockf='$d_lockf'
24518 d_log1p='$d_log1p'
24519 d_log2='$d_log2'
24520 d_logb='$d_logb'
24521 d_longdbl='$d_longdbl'
24522 d_longlong='$d_longlong'
24523 d_lrint='$d_lrint'
24524 d_lrintl='$d_lrintl'
24525 d_lround='$d_lround'
24526 d_lroundl='$d_lroundl'
24527 d_lseekproto='$d_lseekproto'
24528 d_lstat='$d_lstat'
24529 d_madvise='$d_madvise'
24530 d_malloc_good_size='$d_malloc_good_size'
24531 d_malloc_size='$d_malloc_size'
24532 d_mblen='$d_mblen'
24533 d_mbstowcs='$d_mbstowcs'
24534 d_mbtowc='$d_mbtowc'
24535 d_memchr='$d_memchr'
24536 d_memcmp='$d_memcmp'
24537 d_memcpy='$d_memcpy'
24538 d_memmem='$d_memmem'
24539 d_memmove='$d_memmove'
24540 d_memset='$d_memset'
24541 d_mkdir='$d_mkdir'
24542 d_mkdtemp='$d_mkdtemp'
24543 d_mkfifo='$d_mkfifo'
24544 d_mkstemp='$d_mkstemp'
24545 d_mkstemps='$d_mkstemps'
24546 d_mktime64='$d_mktime64'
24547 d_mktime='$d_mktime'
24548 d_mmap='$d_mmap'
24549 d_modfl='$d_modfl'
24550 d_modflproto='$d_modflproto'
24551 d_mprotect='$d_mprotect'
24552 d_msg='$d_msg'
24553 d_msg_ctrunc='$d_msg_ctrunc'
24554 d_msg_dontroute='$d_msg_dontroute'
24555 d_msg_oob='$d_msg_oob'
24556 d_msg_peek='$d_msg_peek'
24557 d_msg_proxy='$d_msg_proxy'
24558 d_msgctl='$d_msgctl'
24559 d_msgget='$d_msgget'
24560 d_msghdr_s='$d_msghdr_s'
24561 d_msgrcv='$d_msgrcv'
24562 d_msgsnd='$d_msgsnd'
24563 d_msync='$d_msync'
24564 d_munmap='$d_munmap'
24565 d_mymalloc='$d_mymalloc'
24566 d_nan='$d_nan'
24567 d_ndbm='$d_ndbm'
24568 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24569 d_nearbyint='$d_nearbyint'
24570 d_newlocale='$d_newlocale'
24571 d_nextafter='$d_nextafter'
24572 d_nexttoward='$d_nexttoward'
24573 d_nice='$d_nice'
24574 d_nl_langinfo='$d_nl_langinfo'
24575 d_nv_preserves_uv='$d_nv_preserves_uv'
24576 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24577 d_off64_t='$d_off64_t'
24578 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24579 d_oldpthreads='$d_oldpthreads'
24580 d_oldsock='$d_oldsock'
24581 d_open3='$d_open3'
24582 d_pathconf='$d_pathconf'
24583 d_pause='$d_pause'
24584 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24585 d_phostname='$d_phostname'
24586 d_pipe='$d_pipe'
24587 d_poll='$d_poll'
24588 d_portable='$d_portable'
24589 d_prctl='$d_prctl'
24590 d_prctl_set_name='$d_prctl_set_name'
24591 d_printf_format_null='$d_printf_format_null'
24592 d_procselfexe='$d_procselfexe'
24593 d_pseudofork='$d_pseudofork'
24594 d_pthread_atfork='$d_pthread_atfork'
24595 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24596 d_pthread_yield='$d_pthread_yield'
24597 d_ptrdiff_t='$d_ptrdiff_t'
24598 d_pwage='$d_pwage'
24599 d_pwchange='$d_pwchange'
24600 d_pwclass='$d_pwclass'
24601 d_pwcomment='$d_pwcomment'
24602 d_pwexpire='$d_pwexpire'
24603 d_pwgecos='$d_pwgecos'
24604 d_pwpasswd='$d_pwpasswd'
24605 d_pwquota='$d_pwquota'
24606 d_qgcvt='$d_qgcvt'
24607 d_quad='$d_quad'
24608 d_querylocale='$d_querylocale'
24609 d_random_r='$d_random_r'
24610 d_re_comp='$d_re_comp'
24611 d_readdir64_r='$d_readdir64_r'
24612 d_readdir='$d_readdir'
24613 d_readdir_r='$d_readdir_r'
24614 d_readlink='$d_readlink'
24615 d_readv='$d_readv'
24616 d_recvmsg='$d_recvmsg'
24617 d_regcmp='$d_regcmp'
24618 d_regcomp='$d_regcomp'
24619 d_remainder='$d_remainder'
24620 d_remquo='$d_remquo'
24621 d_rename='$d_rename'
24622 d_rewinddir='$d_rewinddir'
24623 d_rint='$d_rint'
24624 d_rmdir='$d_rmdir'
24625 d_round='$d_round'
24626 d_safebcpy='$d_safebcpy'
24627 d_safemcpy='$d_safemcpy'
24628 d_sanemcmp='$d_sanemcmp'
24629 d_sbrkproto='$d_sbrkproto'
24630 d_scalbn='$d_scalbn'
24631 d_scalbnl='$d_scalbnl'
24632 d_sched_yield='$d_sched_yield'
24633 d_scm_rights='$d_scm_rights'
24634 d_seekdir='$d_seekdir'
24635 d_select='$d_select'
24636 d_sem='$d_sem'
24637 d_semctl='$d_semctl'
24638 d_semctl_semid_ds='$d_semctl_semid_ds'
24639 d_semctl_semun='$d_semctl_semun'
24640 d_semget='$d_semget'
24641 d_semop='$d_semop'
24642 d_sendmsg='$d_sendmsg'
24643 d_setegid='$d_setegid'
24644 d_seteuid='$d_seteuid'
24645 d_setgrent='$d_setgrent'
24646 d_setgrent_r='$d_setgrent_r'
24647 d_setgrps='$d_setgrps'
24648 d_sethent='$d_sethent'
24649 d_sethostent_r='$d_sethostent_r'
24650 d_setitimer='$d_setitimer'
24651 d_setlinebuf='$d_setlinebuf'
24652 d_setlocale='$d_setlocale'
24653 d_setlocale_r='$d_setlocale_r'
24654 d_setnent='$d_setnent'
24655 d_setnetent_r='$d_setnetent_r'
24656 d_setpent='$d_setpent'
24657 d_setpgid='$d_setpgid'
24658 d_setpgrp2='$d_setpgrp2'
24659 d_setpgrp='$d_setpgrp'
24660 d_setprior='$d_setprior'
24661 d_setproctitle='$d_setproctitle'
24662 d_setprotoent_r='$d_setprotoent_r'
24663 d_setpwent='$d_setpwent'
24664 d_setpwent_r='$d_setpwent_r'
24665 d_setregid='$d_setregid'
24666 d_setresgid='$d_setresgid'
24667 d_setresuid='$d_setresuid'
24668 d_setreuid='$d_setreuid'
24669 d_setrgid='$d_setrgid'
24670 d_setruid='$d_setruid'
24671 d_setsent='$d_setsent'
24672 d_setservent_r='$d_setservent_r'
24673 d_setsid='$d_setsid'
24674 d_setvbuf='$d_setvbuf'
24675 d_shm='$d_shm'
24676 d_shmat='$d_shmat'
24677 d_shmatprototype='$d_shmatprototype'
24678 d_shmctl='$d_shmctl'
24679 d_shmdt='$d_shmdt'
24680 d_shmget='$d_shmget'
24681 d_sigaction='$d_sigaction'
24682 d_siginfo_si_addr='$d_siginfo_si_addr'
24683 d_siginfo_si_band='$d_siginfo_si_band'
24684 d_siginfo_si_errno='$d_siginfo_si_errno'
24685 d_siginfo_si_fd='$d_siginfo_si_fd'
24686 d_siginfo_si_pid='$d_siginfo_si_pid'
24687 d_siginfo_si_status='$d_siginfo_si_status'
24688 d_siginfo_si_uid='$d_siginfo_si_uid'
24689 d_siginfo_si_value='$d_siginfo_si_value'
24690 d_signbit='$d_signbit'
24691 d_sigprocmask='$d_sigprocmask'
24692 d_sigsetjmp='$d_sigsetjmp'
24693 d_sin6_scope_id='$d_sin6_scope_id'
24694 d_sitearch='$d_sitearch'
24695 d_snprintf='$d_snprintf'
24696 d_sockaddr_in6='$d_sockaddr_in6'
24697 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24698 d_sockatmark='$d_sockatmark'
24699 d_sockatmarkproto='$d_sockatmarkproto'
24700 d_socket='$d_socket'
24701 d_socklen_t='$d_socklen_t'
24702 d_sockpair='$d_sockpair'
24703 d_socks5_init='$d_socks5_init'
24704 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24705 d_sqrtl='$d_sqrtl'
24706 d_srand48_r='$d_srand48_r'
24707 d_srandom_r='$d_srandom_r'
24708 d_sresgproto='$d_sresgproto'
24709 d_sresuproto='$d_sresuproto'
24710 d_stat='$d_stat'
24711 d_statblks='$d_statblks'
24712 d_statfs_f_flags='$d_statfs_f_flags'
24713 d_statfs_s='$d_statfs_s'
24714 d_static_inline='$d_static_inline'
24715 d_statvfs='$d_statvfs'
24716 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24717 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24718 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24719 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24720 d_stdio_stream_array='$d_stdio_stream_array'
24721 d_stdiobase='$d_stdiobase'
24722 d_stdstdio='$d_stdstdio'
24723 d_strchr='$d_strchr'
24724 d_strcoll='$d_strcoll'
24725 d_strctcpy='$d_strctcpy'
24726 d_strerrm='$d_strerrm'
24727 d_strerror='$d_strerror'
24728 d_strerror_l='$d_strerror_l'
24729 d_strerror_r='$d_strerror_r'
24730 d_strftime='$d_strftime'
24731 d_strlcat='$d_strlcat'
24732 d_strlcpy='$d_strlcpy'
24733 d_strtod='$d_strtod'
24734 d_strtol='$d_strtol'
24735 d_strtold='$d_strtold'
24736 d_strtoll='$d_strtoll'
24737 d_strtoq='$d_strtoq'
24738 d_strtoul='$d_strtoul'
24739 d_strtoull='$d_strtoull'
24740 d_strtouq='$d_strtouq'
24741 d_strxfrm='$d_strxfrm'
24742 d_suidsafe='$d_suidsafe'
24743 d_symlink='$d_symlink'
24744 d_syscall='$d_syscall'
24745 d_syscallproto='$d_syscallproto'
24746 d_sysconf='$d_sysconf'
24747 d_sysernlst='$d_sysernlst'
24748 d_syserrlst='$d_syserrlst'
24749 d_system='$d_system'
24750 d_tcgetpgrp='$d_tcgetpgrp'
24751 d_tcsetpgrp='$d_tcsetpgrp'
24752 d_telldir='$d_telldir'
24753 d_telldirproto='$d_telldirproto'
24754 d_tgamma='$d_tgamma'
24755 d_time='$d_time'
24756 d_timegm='$d_timegm'
24757 d_times='$d_times'
24758 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24759 d_tm_tm_zone='$d_tm_tm_zone'
24760 d_tmpnam_r='$d_tmpnam_r'
24761 d_trunc='$d_trunc'
24762 d_truncate='$d_truncate'
24763 d_truncl='$d_truncl'
24764 d_ttyname_r='$d_ttyname_r'
24765 d_tzname='$d_tzname'
24766 d_u32align='$d_u32align'
24767 d_ualarm='$d_ualarm'
24768 d_umask='$d_umask'
24769 d_uname='$d_uname'
24770 d_union_semun='$d_union_semun'
24771 d_unordered='$d_unordered'
24772 d_unsetenv='$d_unsetenv'
24773 d_uselocale='$d_uselocale'
24774 d_usleep='$d_usleep'
24775 d_usleepproto='$d_usleepproto'
24776 d_ustat='$d_ustat'
24777 d_vendorarch='$d_vendorarch'
24778 d_vendorbin='$d_vendorbin'
24779 d_vendorlib='$d_vendorlib'
24780 d_vendorscript='$d_vendorscript'
24781 d_vfork='$d_vfork'
24782 d_void_closedir='$d_void_closedir'
24783 d_voidsig='$d_voidsig'
24784 d_voidtty='$d_voidtty'
24785 d_volatile='$d_volatile'
24786 d_vprintf='$d_vprintf'
24787 d_vsnprintf='$d_vsnprintf'
24788 d_wait4='$d_wait4'
24789 d_waitpid='$d_waitpid'
24790 d_wcscmp='$d_wcscmp'
24791 d_wcstombs='$d_wcstombs'
24792 d_wcsxfrm='$d_wcsxfrm'
24793 d_wctomb='$d_wctomb'
24794 d_writev='$d_writev'
24795 d_xenix='$d_xenix'
24796 date='$date'
24797 db_hashtype='$db_hashtype'
24798 db_prefixtype='$db_prefixtype'
24799 db_version_major='$db_version_major'
24800 db_version_minor='$db_version_minor'
24801 db_version_patch='$db_version_patch'
24802 direntrytype='$direntrytype'
24803 dlext='$dlext'
24804 dlsrc='$dlsrc'
24805 doubleinfbytes='$doubleinfbytes'
24806 doublekind='$doublekind'
24807 doublemantbits='$doublemantbits'
24808 doublenanbytes='$doublenanbytes'
24809 doublesize='$doublesize'
24810 drand01='$drand01'
24811 drand48_r_proto='$drand48_r_proto'
24812 dtrace='$dtrace'
24813 dtraceobject='$dtraceobject'
24814 dynamic_ext='$dynamic_ext'
24815 eagain='$eagain'
24816 ebcdic='$ebcdic'
24817 echo='$echo'
24818 egrep='$egrep'
24819 emacs='$emacs'
24820 endgrent_r_proto='$endgrent_r_proto'
24821 endhostent_r_proto='$endhostent_r_proto'
24822 endnetent_r_proto='$endnetent_r_proto'
24823 endprotoent_r_proto='$endprotoent_r_proto'
24824 endpwent_r_proto='$endpwent_r_proto'
24825 endservent_r_proto='$endservent_r_proto'
24826 eunicefix='$eunicefix'
24827 exe_ext='$exe_ext'
24828 expr='$expr'
24829 extensions='$extensions'
24830 extern_C='$extern_C'
24831 extras='$extras'
24832 fflushNULL='$fflushNULL'
24833 fflushall='$fflushall'
24834 find='$find'
24835 firstmakefile='$firstmakefile'
24836 flex='$flex'
24837 fpossize='$fpossize'
24838 fpostype='$fpostype'
24839 freetype='$freetype'
24840 from='$from'
24841 full_ar='$full_ar'
24842 full_csh='$full_csh'
24843 full_sed='$full_sed'
24844 gccansipedantic='$gccansipedantic'
24845 gccosandvers='$gccosandvers'
24846 gccversion='$gccversion'
24847 getgrent_r_proto='$getgrent_r_proto'
24848 getgrgid_r_proto='$getgrgid_r_proto'
24849 getgrnam_r_proto='$getgrnam_r_proto'
24850 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24851 gethostbyname_r_proto='$gethostbyname_r_proto'
24852 gethostent_r_proto='$gethostent_r_proto'
24853 getlogin_r_proto='$getlogin_r_proto'
24854 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24855 getnetbyname_r_proto='$getnetbyname_r_proto'
24856 getnetent_r_proto='$getnetent_r_proto'
24857 getprotobyname_r_proto='$getprotobyname_r_proto'
24858 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24859 getprotoent_r_proto='$getprotoent_r_proto'
24860 getpwent_r_proto='$getpwent_r_proto'
24861 getpwnam_r_proto='$getpwnam_r_proto'
24862 getpwuid_r_proto='$getpwuid_r_proto'
24863 getservbyname_r_proto='$getservbyname_r_proto'
24864 getservbyport_r_proto='$getservbyport_r_proto'
24865 getservent_r_proto='$getservent_r_proto'
24866 getspnam_r_proto='$getspnam_r_proto'
24867 gidformat='$gidformat'
24868 gidsign='$gidsign'
24869 gidsize='$gidsize'
24870 gidtype='$gidtype'
24871 glibpth='$glibpth'
24872 gmake='$gmake'
24873 gmtime_r_proto='$gmtime_r_proto'
24874 gnulibc_version='$gnulibc_version'
24875 grep='$grep'
24876 groupcat='$groupcat'
24877 groupstype='$groupstype'
24878 gzip='$gzip'
24879 h_fcntl='$h_fcntl'
24880 h_sysfile='$h_sysfile'
24881 hint='$hint'
24882 hostcat='$hostcat'
24883 hostgenerate='$hostgenerate'
24884 hostosname='$hostosname'
24885 hostperl='$hostperl'
24886 html1dir='$html1dir'
24887 html1direxp='$html1direxp'
24888 html3dir='$html3dir'
24889 html3direxp='$html3direxp'
24890 i16size='$i16size'
24891 i16type='$i16type'
24892 i32size='$i32size'
24893 i32type='$i32type'
24894 i64size='$i64size'
24895 i64type='$i64type'
24896 i8size='$i8size'
24897 i8type='$i8type'
24898 i_arpainet='$i_arpainet'
24899 i_assert='$i_assert'
24900 i_bfd='$i_bfd'
24901 i_bsdioctl='$i_bsdioctl'
24902 i_crypt='$i_crypt'
24903 i_db='$i_db'
24904 i_dbm='$i_dbm'
24905 i_dirent='$i_dirent'
24906 i_dlfcn='$i_dlfcn'
24907 i_execinfo='$i_execinfo'
24908 i_fcntl='$i_fcntl'
24909 i_fenv='$i_fenv'
24910 i_float='$i_float'
24911 i_fp='$i_fp'
24912 i_fp_class='$i_fp_class'
24913 i_gdbm='$i_gdbm'
24914 i_gdbm_ndbm='$i_gdbm_ndbm'
24915 i_gdbmndbm='$i_gdbmndbm'
24916 i_grp='$i_grp'
24917 i_ieeefp='$i_ieeefp'
24918 i_inttypes='$i_inttypes'
24919 i_langinfo='$i_langinfo'
24920 i_libutil='$i_libutil'
24921 i_limits='$i_limits'
24922 i_locale='$i_locale'
24923 i_machcthr='$i_machcthr'
24924 i_malloc='$i_malloc'
24925 i_mallocmalloc='$i_mallocmalloc'
24926 i_math='$i_math'
24927 i_memory='$i_memory'
24928 i_mntent='$i_mntent'
24929 i_ndbm='$i_ndbm'
24930 i_netdb='$i_netdb'
24931 i_neterrno='$i_neterrno'
24932 i_netinettcp='$i_netinettcp'
24933 i_niin='$i_niin'
24934 i_poll='$i_poll'
24935 i_prot='$i_prot'
24936 i_pthread='$i_pthread'
24937 i_pwd='$i_pwd'
24938 i_quadmath='$i_quadmath'
24939 i_rpcsvcdbm='$i_rpcsvcdbm'
24940 i_sgtty='$i_sgtty'
24941 i_shadow='$i_shadow'
24942 i_socks='$i_socks'
24943 i_stdarg='$i_stdarg'
24944 i_stdbool='$i_stdbool'
24945 i_stddef='$i_stddef'
24946 i_stdint='$i_stdint'
24947 i_stdlib='$i_stdlib'
24948 i_string='$i_string'
24949 i_sunmath='$i_sunmath'
24950 i_sysaccess='$i_sysaccess'
24951 i_sysdir='$i_sysdir'
24952 i_sysfile='$i_sysfile'
24953 i_sysfilio='$i_sysfilio'
24954 i_sysin='$i_sysin'
24955 i_sysioctl='$i_sysioctl'
24956 i_syslog='$i_syslog'
24957 i_sysmman='$i_sysmman'
24958 i_sysmode='$i_sysmode'
24959 i_sysmount='$i_sysmount'
24960 i_sysndir='$i_sysndir'
24961 i_sysparam='$i_sysparam'
24962 i_syspoll='$i_syspoll'
24963 i_sysresrc='$i_sysresrc'
24964 i_syssecrt='$i_syssecrt'
24965 i_sysselct='$i_sysselct'
24966 i_syssockio='$i_syssockio'
24967 i_sysstat='$i_sysstat'
24968 i_sysstatfs='$i_sysstatfs'
24969 i_sysstatvfs='$i_sysstatvfs'
24970 i_systime='$i_systime'
24971 i_systimek='$i_systimek'
24972 i_systimes='$i_systimes'
24973 i_systypes='$i_systypes'
24974 i_sysuio='$i_sysuio'
24975 i_sysun='$i_sysun'
24976 i_sysutsname='$i_sysutsname'
24977 i_sysvfs='$i_sysvfs'
24978 i_syswait='$i_syswait'
24979 i_termio='$i_termio'
24980 i_termios='$i_termios'
24981 i_time='$i_time'
24982 i_unistd='$i_unistd'
24983 i_ustat='$i_ustat'
24984 i_utime='$i_utime'
24985 i_values='$i_values'
24986 i_varargs='$i_varargs'
24987 i_varhdr='$i_varhdr'
24988 i_vfork='$i_vfork'
24989 i_xlocale='$i_xlocale'
24990 ignore_versioned_solibs='$ignore_versioned_solibs'
24991 inc_version_list='$inc_version_list'
24992 inc_version_list_init='$inc_version_list_init'
24993 incpath='$incpath'
24994 incpth='$incpth'
24995 inews='$inews'
24996 initialinstalllocation='$initialinstalllocation'
24997 installarchlib='$installarchlib'
24998 installbin='$installbin'
24999 installhtml1dir='$installhtml1dir'
25000 installhtml3dir='$installhtml3dir'
25001 installman1dir='$installman1dir'
25002 installman3dir='$installman3dir'
25003 installprefix='$installprefix'
25004 installprefixexp='$installprefixexp'
25005 installprivlib='$installprivlib'
25006 installscript='$installscript'
25007 installsitearch='$installsitearch'
25008 installsitebin='$installsitebin'
25009 installsitehtml1dir='$installsitehtml1dir'
25010 installsitehtml3dir='$installsitehtml3dir'
25011 installsitelib='$installsitelib'
25012 installsiteman1dir='$installsiteman1dir'
25013 installsiteman3dir='$installsiteman3dir'
25014 installsitescript='$installsitescript'
25015 installstyle='$installstyle'
25016 installusrbinperl='$installusrbinperl'
25017 installvendorarch='$installvendorarch'
25018 installvendorbin='$installvendorbin'
25019 installvendorhtml1dir='$installvendorhtml1dir'
25020 installvendorhtml3dir='$installvendorhtml3dir'
25021 installvendorlib='$installvendorlib'
25022 installvendorman1dir='$installvendorman1dir'
25023 installvendorman3dir='$installvendorman3dir'
25024 installvendorscript='$installvendorscript'
25025 intsize='$intsize'
25026 issymlink='$issymlink'
25027 ivdformat='$ivdformat'
25028 ivsize='$ivsize'
25029 ivtype='$ivtype'
25030 known_extensions='$known_extensions'
25031 ksh='$ksh'
25032 ld='$ld'
25033 ld_can_script='$ld_can_script'
25034 lddlflags='$lddlflags'
25035 ldflags='$ldflags'
25036 ldflags_uselargefiles='$ldflags_uselargefiles'
25037 ldlibpthname='$ldlibpthname'
25038 less='$less'
25039 lib_ext='$lib_ext'
25040 libc='$libc'
25041 libperl='$libperl'
25042 libpth='$libpth'
25043 libs='$libs'
25044 libsdirs='$libsdirs'
25045 libsfiles='$libsfiles'
25046 libsfound='$libsfound'
25047 libspath='$libspath'
25048 libswanted='$libswanted'
25049 libswanted_uselargefiles='$libswanted_uselargefiles'
25050 line='$line'
25051 lint='$lint'
25052 lkflags='$lkflags'
25053 ln='$ln'
25054 lns='$lns'
25055 localtime_r_proto='$localtime_r_proto'
25056 locincpth='$locincpth'
25057 loclibpth='$loclibpth'
25058 longdblinfbytes='$longdblinfbytes'
25059 longdblkind='$longdblkind'
25060 longdblmantbits='$longdblmantbits'
25061 longdblnanbytes='$longdblnanbytes'
25062 longdblsize='$longdblsize'
25063 longlongsize='$longlongsize'
25064 longsize='$longsize'
25065 lp='$lp'
25066 lpr='$lpr'
25067 ls='$ls'
25068 lseeksize='$lseeksize'
25069 lseektype='$lseektype'
25070 mail='$mail'
25071 mailx='$mailx'
25072 make='$make'
25073 make_set_make='$make_set_make'
25074 mallocobj='$mallocobj'
25075 mallocsrc='$mallocsrc'
25076 malloctype='$malloctype'
25077 man1dir='$man1dir'
25078 man1direxp='$man1direxp'
25079 man1ext='$man1ext'
25080 man3dir='$man3dir'
25081 man3direxp='$man3direxp'
25082 man3ext='$man3ext'
25083 mips_type='$mips_type'
25084 mistrustnm='$mistrustnm'
25085 mkdir='$mkdir'
25086 mmaptype='$mmaptype'
25087 modetype='$modetype'
25088 more='$more'
25089 multiarch='$multiarch'
25090 mv='$mv'
25091 myarchname='$myarchname'
25092 mydomain='$mydomain'
25093 myhostname='$myhostname'
25094 myuname='$myuname'
25095 n='$n'
25096 need_va_copy='$need_va_copy'
25097 netdb_hlen_type='$netdb_hlen_type'
25098 netdb_host_type='$netdb_host_type'
25099 netdb_name_type='$netdb_name_type'
25100 netdb_net_type='$netdb_net_type'
25101 nm='$nm'
25102 nm_opt='$nm_opt'
25103 nm_so_opt='$nm_so_opt'
25104 nonxs_ext='$nonxs_ext'
25105 nroff='$nroff'
25106 nvEUformat='$nvEUformat'
25107 nvFUformat='$nvFUformat'
25108 nvGUformat='$nvGUformat'
25109 nv_overflows_integers_at='$nv_overflows_integers_at'
25110 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25111 nveformat='$nveformat'
25112 nvfformat='$nvfformat'
25113 nvgformat='$nvgformat'
25114 nvmantbits='$nvmantbits'
25115 nvsize='$nvsize'
25116 nvtype='$nvtype'
25117 o_nonblock='$o_nonblock'
25118 obj_ext='$obj_ext'
25119 old_pthread_create_joinable='$old_pthread_create_joinable'
25120 optimize='$optimize'
25121 orderlib='$orderlib'
25122 osname='$osname'
25123 osvers='$osvers'
25124 otherlibdirs='$otherlibdirs'
25125 package='$package'
25126 pager='$pager'
25127 passcat='$passcat'
25128 patchlevel='$patchlevel'
25129 path_sep='$path_sep'
25130 perl5='$perl5'
25131 perl='$perl'
25132 perl_patchlevel='$perl_patchlevel'
25133 perl_static_inline='$perl_static_inline'
25134 perladmin='$perladmin'
25135 perllibs='$perllibs'
25136 perlpath='$perlpath'
25137 pg='$pg'
25138 phostname='$phostname'
25139 pidtype='$pidtype'
25140 plibpth='$plibpth'
25141 pmake='$pmake'
25142 pr='$pr'
25143 prefix='$prefix'
25144 prefixexp='$prefixexp'
25145 privlib='$privlib'
25146 privlibexp='$privlibexp'
25147 procselfexe='$procselfexe'
25148 prototype='$prototype'
25149 ptrsize='$ptrsize'
25150 quadkind='$quadkind'
25151 quadtype='$quadtype'
25152 randbits='$randbits'
25153 randfunc='$randfunc'
25154 random_r_proto='$random_r_proto'
25155 randseedtype='$randseedtype'
25156 ranlib='$ranlib'
25157 rd_nodata='$rd_nodata'
25158 readdir64_r_proto='$readdir64_r_proto'
25159 readdir_r_proto='$readdir_r_proto'
25160 revision='$revision'
25161 rm='$rm'
25162 rm_try='$rm_try'
25163 rmail='$rmail'
25164 run='$run'
25165 runnm='$runnm'
25166 sGMTIME_max='$sGMTIME_max'
25167 sGMTIME_min='$sGMTIME_min'
25168 sLOCALTIME_max='$sLOCALTIME_max'
25169 sLOCALTIME_min='$sLOCALTIME_min'
25170 sPRIEUldbl='$sPRIEUldbl'
25171 sPRIFUldbl='$sPRIFUldbl'
25172 sPRIGUldbl='$sPRIGUldbl'
25173 sPRIXU64='$sPRIXU64'
25174 sPRId64='$sPRId64'
25175 sPRIeldbl='$sPRIeldbl'
25176 sPRIfldbl='$sPRIfldbl'
25177 sPRIgldbl='$sPRIgldbl'
25178 sPRIi64='$sPRIi64'
25179 sPRIo64='$sPRIo64'
25180 sPRIu64='$sPRIu64'
25181 sPRIx64='$sPRIx64'
25182 sSCNfldbl='$sSCNfldbl'
25183 sched_yield='$sched_yield'
25184 scriptdir='$scriptdir'
25185 scriptdirexp='$scriptdirexp'
25186 sed='$sed'
25187 seedfunc='$seedfunc'
25188 selectminbits='$selectminbits'
25189 selecttype='$selecttype'
25190 sendmail='$sendmail'
25191 setgrent_r_proto='$setgrent_r_proto'
25192 sethostent_r_proto='$sethostent_r_proto'
25193 setlocale_r_proto='$setlocale_r_proto'
25194 setnetent_r_proto='$setnetent_r_proto'
25195 setprotoent_r_proto='$setprotoent_r_proto'
25196 setpwent_r_proto='$setpwent_r_proto'
25197 setservent_r_proto='$setservent_r_proto'
25198 sh='$sh'
25199 shar='$shar'
25200 sharpbang='$sharpbang'
25201 shmattype='$shmattype'
25202 shortsize='$shortsize'
25203 shrpenv='$shrpenv'
25204 shsharp='$shsharp'
25205 sig_count='$sig_count'
25206 sig_name='$sig_name'
25207 sig_name_init='$sig_name_init'
25208 sig_num='$sig_num'
25209 sig_num_init='$sig_num_init'
25210 sig_size='$sig_size'
25211 signal_t='$signal_t'
25212 sitearch='$sitearch'
25213 sitearchexp='$sitearchexp'
25214 sitebin='$sitebin'
25215 sitebinexp='$sitebinexp'
25216 sitehtml1dir='$sitehtml1dir'
25217 sitehtml1direxp='$sitehtml1direxp'
25218 sitehtml3dir='$sitehtml3dir'
25219 sitehtml3direxp='$sitehtml3direxp'
25220 sitelib='$sitelib'
25221 sitelib_stem='$sitelib_stem'
25222 sitelibexp='$sitelibexp'
25223 siteman1dir='$siteman1dir'
25224 siteman1direxp='$siteman1direxp'
25225 siteman3dir='$siteman3dir'
25226 siteman3direxp='$siteman3direxp'
25227 siteprefix='$siteprefix'
25228 siteprefixexp='$siteprefixexp'
25229 sitescript='$sitescript'
25230 sitescriptexp='$sitescriptexp'
25231 sizesize='$sizesize'
25232 sizetype='$sizetype'
25233 sleep='$sleep'
25234 smail='$smail'
25235 so='$so'
25236 sockethdr='$sockethdr'
25237 socketlib='$socketlib'
25238 socksizetype='$socksizetype'
25239 sort='$sort'
25240 spackage='$spackage'
25241 spitshell='$spitshell'
25242 srand48_r_proto='$srand48_r_proto'
25243 srandom_r_proto='$srandom_r_proto'
25244 src='$src'
25245 ssizetype='$ssizetype'
25246 st_ino_sign='$st_ino_sign'
25247 st_ino_size='$st_ino_size'
25248 startperl='$startperl'
25249 startsh='$startsh'
25250 static_ext='$static_ext'
25251 stdchar='$stdchar'
25252 stdio_base='$stdio_base'
25253 stdio_bufsiz='$stdio_bufsiz'
25254 stdio_cnt='$stdio_cnt'
25255 stdio_filbuf='$stdio_filbuf'
25256 stdio_ptr='$stdio_ptr'
25257 stdio_stream_array='$stdio_stream_array'
25258 strerror_r_proto='$strerror_r_proto'
25259 strings='$strings'
25260 submit='$submit'
25261 subversion='$subversion'
25262 sysman='$sysman'
25263 sysroot='$sysroot'
25264 tail='$tail'
25265 tar='$tar'
25266 targetarch='$targetarch'
25267 targetdir='$targetdir'
25268 targetenv='$targetenv'
25269 targethost='$targethost'
25270 targetmkdir='$targetmkdir'
25271 targetport='$targetport'
25272 targetsh='$targetsh'
25273 tbl='$tbl'
25274 tee='$tee'
25275 test='$test'
25276 timeincl='$timeincl'
25277 timetype='$timetype'
25278 tmpnam_r_proto='$tmpnam_r_proto'
25279 to='$to'
25280 touch='$touch'
25281 tr='$tr'
25282 trnl='$trnl'
25283 troff='$troff'
25284 ttyname_r_proto='$ttyname_r_proto'
25285 u16size='$u16size'
25286 u16type='$u16type'
25287 u32size='$u32size'
25288 u32type='$u32type'
25289 u64size='$u64size'
25290 u64type='$u64type'
25291 u8size='$u8size'
25292 u8type='$u8type'
25293 uidformat='$uidformat'
25294 uidsign='$uidsign'
25295 uidsize='$uidsize'
25296 uidtype='$uidtype'
25297 uname='$uname'
25298 uniq='$uniq'
25299 uquadtype='$uquadtype'
25300 use5005threads='$use5005threads'
25301 use64bitall='$use64bitall'
25302 use64bitint='$use64bitint'
25303 usecbacktrace='$usecbacktrace'
25304 usecrosscompile='$usecrosscompile'
25305 usedevel='$usedevel'
25306 usedl='$usedl'
25307 usedtrace='$usedtrace'
25308 usefaststdio='$usefaststdio'
25309 useithreads='$useithreads'
25310 usekernprocpathname='$usekernprocpathname'
25311 uselargefiles='$uselargefiles'
25312 uselongdouble='$uselongdouble'
25313 usemallocwrap='$usemallocwrap'
25314 usemorebits='$usemorebits'
25315 usemultiplicity='$usemultiplicity'
25316 usemymalloc='$usemymalloc'
25317 usenm='$usenm'
25318 usensgetexecutablepath='$usensgetexecutablepath'
25319 useopcode='$useopcode'
25320 useperlio='$useperlio'
25321 useposix='$useposix'
25322 usequadmath='$usequadmath'
25323 usereentrant='$usereentrant'
25324 userelocatableinc='$userelocatableinc'
25325 useshrplib='$useshrplib'
25326 usesitecustomize='$usesitecustomize'
25327 usesocks='$usesocks'
25328 usethreads='$usethreads'
25329 usevendorprefix='$usevendorprefix'
25330 useversionedarchname='$useversionedarchname'
25331 usevfork='$usevfork'
25332 usrinc='$usrinc'
25333 uuname='$uuname'
25334 uvXUformat='$uvXUformat'
25335 uvoformat='$uvoformat'
25336 uvsize='$uvsize'
25337 uvtype='$uvtype'
25338 uvuformat='$uvuformat'
25339 uvxformat='$uvxformat'
25340 vaproto='$vaproto'
25341 vendorarch='$vendorarch'
25342 vendorarchexp='$vendorarchexp'
25343 vendorbin='$vendorbin'
25344 vendorbinexp='$vendorbinexp'
25345 vendorhtml1dir='$vendorhtml1dir'
25346 vendorhtml1direxp='$vendorhtml1direxp'
25347 vendorhtml3dir='$vendorhtml3dir'
25348 vendorhtml3direxp='$vendorhtml3direxp'
25349 vendorlib='$vendorlib'
25350 vendorlib_stem='$vendorlib_stem'
25351 vendorlibexp='$vendorlibexp'
25352 vendorman1dir='$vendorman1dir'
25353 vendorman1direxp='$vendorman1direxp'
25354 vendorman3dir='$vendorman3dir'
25355 vendorman3direxp='$vendorman3direxp'
25356 vendorprefix='$vendorprefix'
25357 vendorprefixexp='$vendorprefixexp'
25358 vendorscript='$vendorscript'
25359 vendorscriptexp='$vendorscriptexp'
25360 version='$version'
25361 version_patchlevel_string='$version_patchlevel_string'
25362 versiononly='$versiononly'
25363 vi='$vi'
25364 xlibpth='$xlibpth'
25365 yacc='$yacc'
25366 yaccflags='$yaccflags'
25367 zcat='$zcat'
25368 zip='$zip'
25369 EOT
25370
25371 : add special variables
25372 $test -f $src/patchlevel.h && \
25373 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25374 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25375 echo "PERL_CONFIG_SH=true" >>config.sh
25376
25377 : propagate old symbols
25378 if $test -f UU/config.sh; then
25379         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25380         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25381                 config.sh config.sh UU/oldconfig.sh |\
25382                 $sort | $uniq -u >UU/oldsyms
25383         set X `$cat UU/oldsyms`
25384         shift
25385         case $# in
25386         0) ;;
25387         *)
25388                 $cat <<EOM
25389 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25390 EOM
25391                 echo ": Variables propagated from previous config.sh file." >>config.sh
25392                 for sym in `$cat UU/oldsyms`; do
25393                         echo "    Propagating $hint variable "'$'"$sym..."
25394                         eval 'tmp="$'"${sym}"'"'
25395                         echo "$tmp" | \
25396                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25397                 done
25398                 ;;
25399         esac
25400 fi
25401
25402 : preserve RCS keywords in files with variable substitution, grrr
25403 Id='$Id'
25404
25405 : Finish up by extracting the .SH files
25406 case "$alldone" in
25407 exit)
25408         echo "Stopping at your request, leaving temporary files around."
25409         exit 0
25410         ;;
25411 cont)
25412         ;;
25413 '')
25414         dflt=''
25415         nostick=true
25416         $cat <<EOM
25417
25418 If you'd like to make any changes to the config.sh file before I begin
25419 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25420
25421 EOM
25422         rp="Press return or use a shell escape to edit config.sh:"
25423         . UU/myread
25424         nostick=''
25425         case "$ans" in
25426         '') ;;
25427         *) : in case they cannot read
25428                 sh 1>&4 -c "$ans";;
25429         esac
25430         ;;
25431 esac
25432
25433 : if this fails, just run all the .SH files by hand
25434 . ./config.sh
25435
25436 echo " "
25437 exec 1>&4
25438 pwd=`pwd`
25439 . ./UU/extract
25440 cd "$pwd"
25441
25442 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25443         dflt=y
25444         case "$silent" in
25445         true) ;;
25446         *)
25447                 $cat <<EOM
25448
25449 Now you need to generate make dependencies by running "$make depend".
25450 You might prefer to run it in background: "$make depend > makedepend.out &"
25451 It can take a while, so you might not want to run it right now.
25452
25453 EOM
25454                 ;;
25455         esac
25456         rp="Run $make depend now?"
25457         . UU/myread
25458         case "$ans" in
25459         y*)
25460                 $make depend && echo "Now you must run '$make'."
25461                 ;;
25462         *)
25463                 echo "You must run '$make depend' then '$make'."
25464                 ;;
25465         esac
25466 elif test -f [Mm]akefile; then
25467         echo " "
25468         echo "Now you must run a $make."
25469 else
25470         echo "Configure done."
25471 fi
25472
25473 if $test -f Policy.sh; then
25474     $cat <<EOM
25475
25476 If you compile $package on a different machine or from a different object
25477 directory, copy the Policy.sh file from this object directory to the
25478 new one before you run Configure -- this will help you with most of
25479 the policy defaults.
25480
25481 EOM
25482 fi
25483 if $test -f UU/config.msg; then
25484     echo "Hmm.  I also noted the following information while running:"
25485     echo " "
25486     $cat UU/config.msg >&4
25487 fi
25488 $rm -f kit*isdone ark*isdone
25489 $rm -rf UU
25490
25491 : End of Configure
25492