This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
5.25.3 is released
[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_Gconvert=''
510 d_getaddrinfo=''
511 d_getcwd=''
512 d_getespwnam=''
513 d_getfsstat=''
514 d_getgrent=''
515 d_getgrent_r=''
516 getgrent_r_proto=''
517 d_getgrgid_r=''
518 getgrgid_r_proto=''
519 d_getgrnam_r=''
520 getgrnam_r_proto=''
521 d_getgrps=''
522 d_gethbyaddr=''
523 d_gethbyname=''
524 d_gethent=''
525 aphostname=''
526 d_gethname=''
527 d_phostname=''
528 d_uname=''
529 d_gethostbyaddr_r=''
530 gethostbyaddr_r_proto=''
531 d_gethostbyname_r=''
532 gethostbyname_r_proto=''
533 d_gethostent_r=''
534 gethostent_r_proto=''
535 d_gethostprotos=''
536 d_getitimer=''
537 d_getlogin=''
538 d_getlogin_r=''
539 getlogin_r_proto=''
540 d_getmnt=''
541 d_getmntent=''
542 d_getnameinfo=''
543 d_getnbyaddr=''
544 d_getnbyname=''
545 d_getnent=''
546 d_getnetbyaddr_r=''
547 getnetbyaddr_r_proto=''
548 d_getnetbyname_r=''
549 getnetbyname_r_proto=''
550 d_getnetent_r=''
551 getnetent_r_proto=''
552 d_getnetprotos=''
553 d_getpagsz=''
554 d_getpent=''
555 d_getpgid=''
556 d_getpgrp2=''
557 d_bsdgetpgrp=''
558 d_getpgrp=''
559 d_getppid=''
560 d_getprior=''
561 d_getpbyname=''
562 d_getpbynumber=''
563 d_getprotobyname_r=''
564 getprotobyname_r_proto=''
565 d_getprotobynumber_r=''
566 getprotobynumber_r_proto=''
567 d_getprotoent_r=''
568 getprotoent_r_proto=''
569 d_getprotoprotos=''
570 d_getprpwnam=''
571 d_getpwent=''
572 d_getpwent_r=''
573 getpwent_r_proto=''
574 d_getpwnam_r=''
575 getpwnam_r_proto=''
576 d_getpwuid_r=''
577 getpwuid_r_proto=''
578 d_getsent=''
579 d_getservbyname_r=''
580 getservbyname_r_proto=''
581 d_getservbyport_r=''
582 getservbyport_r_proto=''
583 d_getservent_r=''
584 getservent_r_proto=''
585 d_getservprotos=''
586 d_getspnam=''
587 d_getspnam_r=''
588 getspnam_r_proto=''
589 d_getsbyname=''
590 d_getsbyport=''
591 d_gmtime_r=''
592 gmtime_r_proto=''
593 d_gnulibc=''
594 gnulibc_version=''
595 d_hasmntopt=''
596 d_htonl=''
597 d_hypot=''
598 d_ilogb=''
599 d_ilogbl=''
600 d_inetaton=''
601 d_inetntop=''
602 d_inetpton=''
603 d_int64_t=''
604 d_isascii=''
605 d_isblank=''
606 d_isfinite=''
607 d_isfinitel=''
608 d_isinf=''
609 d_isinfl=''
610 d_isless=''
611 d_isnan=''
612 d_isnanl=''
613 d_isnormal=''
614 d_j0=''
615 d_j0l=''
616 d_killpg=''
617 d_lc_monetary_2008=''
618 d_lchown=''
619 d_ldbl_dig=''
620 d_lgamma=''
621 d_lgamma_r=''
622 d_libm_lib_version=''
623 d_link=''
624 d_llrint=''
625 d_llrintl=''
626 d_llround=''
627 d_llroundl=''
628 d_localtime_r=''
629 d_localtime_r_needs_tzset=''
630 localtime_r_proto=''
631 d_locconv=''
632 d_lockf=''
633 d_log1p=''
634 d_log2=''
635 d_logb=''
636 d_ldexpl=''
637 d_longdbl=''
638 longdblkind=''
639 longdblsize=''
640 d_longlong=''
641 longlongsize=''
642 d_lrint=''
643 d_lrintl=''
644 d_lround=''
645 d_lroundl=''
646 d_lseekproto=''
647 d_lstat=''
648 d_madvise=''
649 d_malloc_good_size=''
650 d_malloc_size=''
651 d_mblen=''
652 d_mbstowcs=''
653 d_mbtowc=''
654 d_memchr=''
655 d_memcmp=''
656 d_memcpy=''
657 d_memmem=''
658 d_memmove=''
659 d_memset=''
660 d_mkdir=''
661 d_mkdtemp=''
662 d_mkfifo=''
663 d_mkstemp=''
664 d_mkstemps=''
665 d_mktime=''
666 d_mmap=''
667 mmaptype=''
668 d_modfl=''
669 d_modflproto=''
670 d_mprotect=''
671 d_msg=''
672 d_msgctl=''
673 d_msgget=''
674 d_msghdr_s=''
675 d_msgrcv=''
676 d_msgsnd=''
677 d_msync=''
678 d_munmap=''
679 d_nan=''
680 d_nearbyint=''
681 d_duplocale=''
682 d_freelocale=''
683 d_newlocale=''
684 d_querylocale=''
685 d_uselocale=''
686 i_xlocale=''
687 d_nextafter=''
688 d_nexttoward=''
689 d_nice=''
690 d_nl_langinfo=''
691 d_off64_t=''
692 d_open3=''
693 d_fpathconf=''
694 d_pathconf=''
695 d_pause=''
696 d_pipe=''
697 d_poll=''
698 d_portable=''
699 d_prctl=''
700 d_prctl_set_name=''
701 d_procselfexe=''
702 procselfexe=''
703 d_old_pthread_create_joinable=''
704 old_pthread_create_joinable=''
705 d_pthread_atfork=''
706 d_pthread_attr_setscope=''
707 d_pthread_yield=''
708 d_sched_yield=''
709 sched_yield=''
710 d_ptrdiff_t=''
711 d_qgcvt=''
712 d_random_r=''
713 random_r_proto=''
714 d_readdir64_r=''
715 readdir64_r_proto=''
716 d_readdir=''
717 d_rewinddir=''
718 d_seekdir=''
719 d_telldir=''
720 d_readdir_r=''
721 readdir_r_proto=''
722 d_readlink=''
723 d_readv=''
724 d_recvmsg=''
725 d_re_comp=''
726 d_regcmp=''
727 d_regcomp=''
728 d_remainder=''
729 d_remquo=''
730 d_rename=''
731 d_rint=''
732 d_rmdir=''
733 d_round=''
734 d_safebcpy=''
735 d_safemcpy=''
736 d_sanemcmp=''
737 d_sbrkproto=''
738 d_scalbn=''
739 d_scalbnl=''
740 d_select=''
741 d_sem=''
742 d_semctl=''
743 d_semget=''
744 d_semop=''
745 d_sendmsg=''
746 d_setegid=''
747 d_seteuid=''
748 d_setgrent=''
749 d_setgrent_r=''
750 setgrent_r_proto=''
751 d_setgrps=''
752 d_sethent=''
753 d_sethostent_r=''
754 sethostent_r_proto=''
755 d_setitimer=''
756 d_setlinebuf=''
757 d_setlocale=''
758 d_setlocale_r=''
759 setlocale_r_proto=''
760 d_setnent=''
761 d_setnetent_r=''
762 setnetent_r_proto=''
763 d_setpent=''
764 d_setpgid=''
765 d_setpgrp2=''
766 d_bsdsetpgrp=''
767 d_setpgrp=''
768 d_setprior=''
769 d_setproctitle=''
770 d_setprotoent_r=''
771 setprotoent_r_proto=''
772 d_setpwent=''
773 d_setpwent_r=''
774 setpwent_r_proto=''
775 d_setregid=''
776 d_setresgid=''
777 d_setresuid=''
778 d_setreuid=''
779 d_setrgid=''
780 d_setruid=''
781 d_setsent=''
782 d_setservent_r=''
783 setservent_r_proto=''
784 d_setsid=''
785 d_setvbuf=''
786 d_shm=''
787 d_shmat=''
788 d_shmatprototype=''
789 shmattype=''
790 d_shmctl=''
791 d_shmdt=''
792 d_shmget=''
793 d_sigaction=''
794 d_siginfo_si_addr=''
795 d_siginfo_si_band=''
796 d_siginfo_si_errno=''
797 d_siginfo_si_fd=''
798 d_siginfo_si_pid=''
799 d_siginfo_si_status=''
800 d_siginfo_si_uid=''
801 d_siginfo_si_value=''
802 d_signbit=''
803 d_sigprocmask=''
804 d_sigsetjmp=''
805 usesitecustomize=''
806 d_snprintf=''
807 d_vsnprintf=''
808 d_sockatmark=''
809 d_sockatmarkproto=''
810 d_ip_mreq=''
811 d_ip_mreq_source=''
812 d_ipv6_mreq=''
813 d_ipv6_mreq_source=''
814 d_msg_ctrunc=''
815 d_msg_dontroute=''
816 d_msg_oob=''
817 d_msg_peek=''
818 d_msg_proxy=''
819 d_oldsock=''
820 d_scm_rights=''
821 d_sin6_scope_id=''
822 d_sockaddr_in6=''
823 d_sockaddr_sa_len=''
824 d_socket=''
825 d_sockpair=''
826 sockethdr=''
827 socketlib=''
828 d_socklen_t=''
829 d_socks5_init=''
830 d_sprintf_returns_strlen=''
831 d_sqrtl=''
832 d_srand48_r=''
833 srand48_r_proto=''
834 d_srandom_r=''
835 srandom_r_proto=''
836 d_sresgproto=''
837 d_sresuproto=''
838 d_stat=''
839 d_statblks=''
840 d_statfs_f_flags=''
841 d_statfs_s=''
842 d_static_inline=''
843 perl_static_inline=''
844 d_fstatvfs=''
845 d_statvfs=''
846 d_stdio_cnt_lval=''
847 d_stdio_ptr_lval=''
848 d_stdio_ptr_lval_nochange_cnt=''
849 d_stdio_ptr_lval_sets_cnt=''
850 d_stdiobase=''
851 d_stdstdio=''
852 stdio_base=''
853 stdio_bufsiz=''
854 stdio_cnt=''
855 stdio_filbuf=''
856 stdio_ptr=''
857 d_index=''
858 d_strchr=''
859 d_strcoll=''
860 d_strctcpy=''
861 d_strerrm=''
862 d_strerror=''
863 d_sysernlst=''
864 d_syserrlst=''
865 d_strerror_l=''
866 d_strerror_r=''
867 strerror_r_proto=''
868 d_strftime=''
869 d_strlcat=''
870 d_strlcpy=''
871 d_strtod=''
872 d_strtol=''
873 d_strtold=''
874 d_strtoll=''
875 d_strtoq=''
876 d_strtoul=''
877 d_strtoull=''
878 d_strtouq=''
879 d_strxfrm=''
880 d_symlink=''
881 d_syscall=''
882 d_syscallproto=''
883 d_sysconf=''
884 d_system=''
885 d_tcgetpgrp=''
886 d_tcsetpgrp=''
887 d_telldirproto=''
888 d_tgamma=''
889 d_time=''
890 timetype=''
891 d_asctime64=''
892 d_ctime64=''
893 d_difftime64=''
894 d_gmtime64=''
895 d_localtime64=''
896 d_mktime64=''
897 d_timegm=''
898 clocktype=''
899 d_times=''
900 d_tmpnam_r=''
901 tmpnam_r_proto=''
902 d_trunc=''
903 d_truncate=''
904 d_truncl=''
905 d_ttyname_r=''
906 ttyname_r_proto=''
907 d_tzname=''
908 d_u32align=''
909 d_ualarm=''
910 d_umask=''
911 d_semctl_semid_ds=''
912 d_semctl_semun=''
913 d_union_semun=''
914 d_unordered=''
915 d_unsetenv=''
916 d_usleep=''
917 d_usleepproto=''
918 d_ustat=''
919 d_pseudofork=''
920 d_vfork=''
921 usevfork=''
922 d_voidsig=''
923 signal_t=''
924 d_volatile=''
925 d_charvspr=''
926 d_vprintf=''
927 d_wait4=''
928 d_waitpid=''
929 d_wcscmp=''
930 d_wcstombs=''
931 d_wcsxfrm=''
932 d_wctomb=''
933 d_writev=''
934 dlext=''
935 bin_ELF=''
936 cccdlflags=''
937 ccdlflags=''
938 dlsrc=''
939 ld=''
940 ld_can_script=''
941 lddlflags=''
942 usedl=''
943 doublesize=''
944 dtraceobject=''
945 ebcdic=''
946 fflushNULL=''
947 fflushall=''
948 fpossize=''
949 fpostype=''
950 gccansipedantic=''
951 gccosandvers=''
952 gccversion=''
953 gidformat=''
954 gidsign=''
955 gidsize=''
956 gidtype=''
957 groupstype=''
958 h_fcntl=''
959 h_sysfile=''
960 html1dir=''
961 html1direxp=''
962 installhtml1dir=''
963 html3dir=''
964 html3direxp=''
965 installhtml3dir=''
966 i_arpainet=''
967 i_assert=''
968 i_bfd=''
969 i_crypt=''
970 db_hashtype=''
971 db_prefixtype=''
972 db_version_major=''
973 db_version_minor=''
974 db_version_patch=''
975 i_db=''
976 i_dbm=''
977 i_rpcsvcdbm=''
978 d_dirnamlen=''
979 direntrytype=''
980 i_dirent=''
981 i_dlfcn=''
982 i_execinfo=''
983 i_fcntl=''
984 i_fenv=''
985 i_float=''
986 i_fp=''
987 i_fp_class=''
988 i_gdbm=''
989 d_grpasswd=''
990 i_grp=''
991 i_ieeefp=''
992 i_inttypes=''
993 i_langinfo=''
994 i_libutil=''
995 i_limits=''
996 i_locale=''
997 i_machcthr=''
998 i_malloc=''
999 i_mallocmalloc=''
1000 i_math=''
1001 i_memory=''
1002 i_mntent=''
1003 d_gdbm_ndbm_h_uses_prototypes=''
1004 d_gdbmndbm_h_uses_prototypes=''
1005 d_ndbm=''
1006 d_ndbm_h_uses_prototypes=''
1007 i_gdbm_ndbm=''
1008 i_gdbmndbm=''
1009 i_ndbm=''
1010 i_netdb=''
1011 i_neterrno=''
1012 i_netinettcp=''
1013 i_niin=''
1014 i_sysin=''
1015 i_poll=''
1016 i_prot=''
1017 i_pthread=''
1018 d_pwage=''
1019 d_pwchange=''
1020 d_pwclass=''
1021 d_pwcomment=''
1022 d_pwexpire=''
1023 d_pwgecos=''
1024 d_pwpasswd=''
1025 d_pwquota=''
1026 i_pwd=''
1027 i_quadmath=''
1028 i_shadow=''
1029 i_socks=''
1030 i_stdbool=''
1031 i_stddef=''
1032 i_stdint=''
1033 i_stdlib=''
1034 i_string=''
1035 strings=''
1036 i_sunmath=''
1037 i_sysaccess=''
1038 i_sysdir=''
1039 i_sysfile=''
1040 d_voidtty=''
1041 i_bsdioctl=''
1042 i_sysfilio=''
1043 i_sysioctl=''
1044 i_syssockio=''
1045 i_syslog=''
1046 i_sysmman=''
1047 i_sysmode=''
1048 i_sysmount=''
1049 i_sysndir=''
1050 i_sysparam=''
1051 i_syspoll=''
1052 i_sysresrc=''
1053 i_syssecrt=''
1054 i_sysselct=''
1055 i_sysstat=''
1056 i_sysstatfs=''
1057 i_sysstatvfs=''
1058 i_systimes=''
1059 i_systypes=''
1060 i_sysuio=''
1061 i_sysun=''
1062 i_sysutsname=''
1063 i_sysvfs=''
1064 i_syswait=''
1065 i_sgtty=''
1066 i_termio=''
1067 i_termios=''
1068 d_tm_tm_gmtoff=''
1069 d_tm_tm_zone=''
1070 i_systime=''
1071 i_systimek=''
1072 i_time=''
1073 timeincl=''
1074 i_unistd=''
1075 i_ustat=''
1076 i_utime=''
1077 i_values=''
1078 i_stdarg=''
1079 i_varargs=''
1080 i_varhdr=''
1081 i_vfork=''
1082 d_inc_version_list=''
1083 inc_version_list=''
1084 inc_version_list_init=''
1085 doubleinfbytes=''
1086 doublenanbytes=''
1087 longdblinfbytes=''
1088 longdblnanbytes=''
1089 installprefix=''
1090 installprefixexp=''
1091 installstyle=''
1092 installusrbinperl=''
1093 intsize=''
1094 longsize=''
1095 shortsize=''
1096 issymlink=''
1097 libc=''
1098 ldlibpthname=''
1099 libperl=''
1100 shrpenv=''
1101 useshrplib=''
1102 glibpth=''
1103 incpth=''
1104 libpth=''
1105 loclibpth=''
1106 plibpth=''
1107 xlibpth=''
1108 ignore_versioned_solibs=''
1109 libs=''
1110 libsdirs=''
1111 libsfiles=''
1112 libsfound=''
1113 libspath=''
1114 lns=''
1115 d_PRIEUldbl=''
1116 d_PRIFUldbl=''
1117 d_PRIGUldbl=''
1118 d_PRIeldbl=''
1119 d_PRIfldbl=''
1120 d_PRIgldbl=''
1121 d_SCNfldbl=''
1122 doublekind=''
1123 sPRIEUldbl=''
1124 sPRIFUldbl=''
1125 sPRIGUldbl=''
1126 sPRIeldbl=''
1127 sPRIfldbl=''
1128 sPRIgldbl=''
1129 sSCNfldbl=''
1130 lseeksize=''
1131 lseektype=''
1132 make_set_make=''
1133 d_mymalloc=''
1134 freetype=''
1135 mallocobj=''
1136 mallocsrc=''
1137 malloctype=''
1138 usemallocwrap=''
1139 usemymalloc=''
1140 installman1dir=''
1141 man1dir=''
1142 man1direxp=''
1143 man1ext=''
1144 installman3dir=''
1145 man3dir=''
1146 man3direxp=''
1147 man3ext=''
1148 doublemantbits=''
1149 longdblmantbits=''
1150 nvmantbits=''
1151 modetype=''
1152 multiarch=''
1153 mydomain=''
1154 myhostname=''
1155 phostname=''
1156 c=''
1157 n=''
1158 d_eofnblk=''
1159 eagain=''
1160 o_nonblock=''
1161 rd_nodata=''
1162 need_va_copy=''
1163 netdb_hlen_type=''
1164 netdb_host_type=''
1165 netdb_name_type=''
1166 netdb_net_type=''
1167 groupcat=''
1168 hostcat=''
1169 passcat=''
1170 orderlib=''
1171 ranlib=''
1172 d_perl_otherlibdirs=''
1173 otherlibdirs=''
1174 package=''
1175 spackage=''
1176 pager=''
1177 api_revision=''
1178 api_subversion=''
1179 api_version=''
1180 api_versionstring=''
1181 patchlevel=''
1182 perl_patchlevel=''
1183 revision=''
1184 subversion=''
1185 version=''
1186 version_patchlevel_string=''
1187 perl5=''
1188 perladmin=''
1189 perlpath=''
1190 d_nv_preserves_uv=''
1191 d_nv_zero_is_allbits_zero=''
1192 i16size=''
1193 i16type=''
1194 i32size=''
1195 i32type=''
1196 i64size=''
1197 i64type=''
1198 i8size=''
1199 i8type=''
1200 ivsize=''
1201 ivtype=''
1202 nv_overflows_integers_at=''
1203 nv_preserves_uv_bits=''
1204 nvsize=''
1205 nvtype=''
1206 u16size=''
1207 u16type=''
1208 u32size=''
1209 u32type=''
1210 u64size=''
1211 u64type=''
1212 u8size=''
1213 u8type=''
1214 uvsize=''
1215 uvtype=''
1216 ivdformat=''
1217 nvEUformat=''
1218 nvFUformat=''
1219 nvGUformat=''
1220 nveformat=''
1221 nvfformat=''
1222 nvgformat=''
1223 uvXUformat=''
1224 uvoformat=''
1225 uvuformat=''
1226 uvxformat=''
1227 pidtype=''
1228 prefix=''
1229 prefixexp=''
1230 installprivlib=''
1231 privlib=''
1232 privlibexp=''
1233 prototype=''
1234 ptrsize=''
1235 d_PRIXU64=''
1236 d_PRId64=''
1237 d_PRIi64=''
1238 d_PRIo64=''
1239 d_PRIu64=''
1240 d_PRIx64=''
1241 sPRIXU64=''
1242 sPRId64=''
1243 sPRIi64=''
1244 sPRIo64=''
1245 sPRIu64=''
1246 sPRIx64=''
1247 d_quad=''
1248 quadkind=''
1249 quadtype=''
1250 uquadtype=''
1251 drand01=''
1252 randbits=''
1253 randfunc=''
1254 randseedtype=''
1255 seedfunc=''
1256 installscript=''
1257 scriptdir=''
1258 scriptdirexp=''
1259 selectminbits=''
1260 selecttype=''
1261 sh=''
1262 targetsh=''
1263 sig_count=''
1264 sig_name=''
1265 sig_name_init=''
1266 sig_num=''
1267 sig_num_init=''
1268 sig_size=''
1269 d_sitearch=''
1270 installsitearch=''
1271 sitearch=''
1272 sitearchexp=''
1273 installsitebin=''
1274 sitebin=''
1275 sitebinexp=''
1276 installsitehtml1dir=''
1277 sitehtml1dir=''
1278 sitehtml1direxp=''
1279 installsitehtml3dir=''
1280 sitehtml3dir=''
1281 sitehtml3direxp=''
1282 installsitelib=''
1283 sitelib=''
1284 sitelib_stem=''
1285 sitelibexp=''
1286 installsiteman1dir=''
1287 siteman1dir=''
1288 siteman1direxp=''
1289 installsiteman3dir=''
1290 siteman3dir=''
1291 siteman3direxp=''
1292 siteprefix=''
1293 siteprefixexp=''
1294 installsitescript=''
1295 sitescript=''
1296 sitescriptexp=''
1297 sizesize=''
1298 sizetype=''
1299 d_libname_unique=''
1300 so=''
1301 socksizetype=''
1302 sharpbang=''
1303 shsharp=''
1304 spitshell=''
1305 src=''
1306 ssizetype=''
1307 st_ino_sign=''
1308 st_ino_size=''
1309 startperl=''
1310 startsh=''
1311 stdchar=''
1312 d_stdio_stream_array=''
1313 stdio_stream_array=''
1314 sysman=''
1315 sGMTIME_max=''
1316 sGMTIME_min=''
1317 sLOCALTIME_max=''
1318 sLOCALTIME_min=''
1319 trnl=''
1320 uidformat=''
1321 uidsign=''
1322 uidsize=''
1323 uidtype=''
1324 archname64=''
1325 use64bitall=''
1326 use64bitint=''
1327 usecbacktrace=''
1328 dtrace=''
1329 usedtrace=''
1330 usefaststdio=''
1331 usekernprocpathname=''
1332 ccflags_uselargefiles=''
1333 ldflags_uselargefiles=''
1334 libswanted_uselargefiles=''
1335 uselargefiles=''
1336 uselongdouble=''
1337 usemorebits=''
1338 usemultiplicity=''
1339 nm_opt=''
1340 nm_so_opt=''
1341 runnm=''
1342 usenm=''
1343 usensgetexecutablepath=''
1344 useperlio=''
1345 usequadmath=''
1346 usesocks=''
1347 d_oldpthreads=''
1348 use5005threads=''
1349 useithreads=''
1350 usereentrant=''
1351 usethreads=''
1352 incpath=''
1353 mips_type=''
1354 usrinc=''
1355 vaproto=''
1356 d_vendorarch=''
1357 installvendorarch=''
1358 vendorarch=''
1359 vendorarchexp=''
1360 d_vendorbin=''
1361 installvendorbin=''
1362 vendorbin=''
1363 vendorbinexp=''
1364 installvendorhtml1dir=''
1365 vendorhtml1dir=''
1366 vendorhtml1direxp=''
1367 installvendorhtml3dir=''
1368 vendorhtml3dir=''
1369 vendorhtml3direxp=''
1370 d_vendorlib=''
1371 installvendorlib=''
1372 vendorlib=''
1373 vendorlib_stem=''
1374 vendorlibexp=''
1375 installvendorman1dir=''
1376 vendorman1dir=''
1377 vendorman1direxp=''
1378 installvendorman3dir=''
1379 vendorman3dir=''
1380 vendorman3direxp=''
1381 usevendorprefix=''
1382 vendorprefix=''
1383 vendorprefixexp=''
1384 d_vendorscript=''
1385 installvendorscript=''
1386 vendorscript=''
1387 vendorscriptexp=''
1388 versiononly=''
1389 yacc=''
1390 yaccflags=''
1391 CONFIG=''
1392
1393 : Detect odd OSs
1394 define='define'
1395 undef='undef'
1396 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1397 rmlist=''
1398
1399 : We must find out about Eunice early
1400 eunicefix=':'
1401 if test -f /etc/unixtovms; then
1402         eunicefix=/etc/unixtovms
1403 fi
1404 if test -f /etc/unixtovms.exe; then
1405         eunicefix=/etc/unixtovms.exe
1406 fi
1407
1408 : Set executable suffix now -- needed before hints available
1409 if test -f "/libs/version.library"; then
1410 : Amiga OS
1411     _exe=""
1412 elif test -f "/system/gnu_library/bin/ar.pm"; then
1413 : Stratus VOS
1414     _exe=".pm"
1415 elif test -n "$DJGPP"; then
1416 : DOS DJGPP
1417     _exe=".exe"
1418 elif test -f /kern/cookiejar; then
1419 : MiNT
1420     _exe=""
1421 elif test -d c:/. -o -n "$is_os2" ; then
1422 : OS/2 or cygwin
1423     _exe=".exe"
1424 fi
1425
1426 groupstype=''
1427 i_whoami=''
1428 : Possible local include directories to search.
1429 : Set locincpth to "" in a hint file to defeat local include searches.
1430 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1431 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1432 :
1433 : no include file wanted by default
1434 inclwanted=''
1435
1436 : Enable -DEBUGGING and -DDEBUGGING from the command line
1437 EBUGGING=''
1438 DEBUGGING=''
1439
1440 : Trailing extension.  Override this in a hint file, if needed.
1441 : Extra object files, if any, needed on this platform.
1442 archobjs=''
1443 libnames=''
1444 : change the next line if compiling for Xenix/286 on Xenix/386
1445 xlibpth='/usr/lib/386 /lib/386'
1446 : Possible local library directories to search.
1447 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1448 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1449
1450 : general looking path for locating libraries
1451 glibpth="/lib /usr/lib $xlibpth"
1452 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1453 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1454 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1455 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1456
1457 : Private path used by Configure to find libraries.  Its value
1458 : is prepended to libpth. This variable takes care of special
1459 : machines, like the mips.  Usually, it should be empty.
1460 plibpth=''
1461
1462 : default library list
1463 libswanted=''
1464 : some systems want to use only the non-versioned libso:s
1465 ignore_versioned_solibs=''
1466 ccname=''
1467 ccversion=''
1468 perllibs=''
1469 : set useposix=false in your hint file to disable the POSIX extension.
1470 useposix=true
1471 : set useopcode=false in your hint file to disable the Opcode extension.
1472 useopcode=true
1473 archname64=''
1474 ccflags_uselargefiles=''
1475 ldflags_uselargefiles=''
1476 libswanted_uselargefiles=''
1477 : set usemultiplicity on the Configure command line to enable multiplicity.
1478 : set usesocks on the Configure command line to enable socks.
1479 archname=''
1480 : set usethreads on the Configure command line to enable threads.
1481 usereentrant='undef'
1482 : List of libraries we want.
1483 : If anyone needs extra -lxxx, put those in a hint file.
1484 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1485 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1486 : We probably want to search /usr/shlib before most other libraries.
1487 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1488 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1489 glibpth="/usr/shlib $glibpth"
1490 : Do not use vfork unless overridden by a hint file.
1491 usevfork=false
1492
1493 : Find the basic shell for Bourne shell scripts
1494 case "$sh" in
1495 '')
1496         case "$SYSTYPE" in
1497         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1498         *) xxx='/bin/sh';;
1499         esac
1500         if test -f "$xxx"; then
1501                 sh="$xxx"
1502         else
1503                 : Build up a list and do a single loop so we can 'break' out.
1504                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1505                 for xxx in sh bash ksh pdksh ash; do
1506                         for p in $pth; do
1507                                 try="$try ${p}/${xxx}"
1508                         done
1509                 done
1510                 for xxx in $try; do
1511                         if test -f "$xxx"; then
1512                                 sh="$xxx";
1513                                 break
1514                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1515                                 sh="$xxx";
1516                                 break
1517                         elif test -f "$xxx.exe"; then
1518                                 sh="$xxx";
1519                                 break
1520                         fi
1521                 done
1522         fi
1523         ;;
1524 esac
1525
1526 case "$sh" in
1527 '')     cat >&2 <<EOM
1528 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1529
1530 Usually it's in /bin/sh.  How did you even get this far?
1531 Please contact me (Perl Maintainers) at perlbug@perl.org and
1532 we'll try to straighten this all out.
1533 EOM
1534         exit 1
1535         ;;
1536 esac
1537
1538 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1539 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1540 targetsh=$sh
1541
1542 : see if sh knows # comments
1543 if `$sh -c '#' >/dev/null 2>&1`; then
1544         shsharp=true
1545         spitshell=cat
1546         xcat=/bin/cat
1547         test -f $xcat$_exe || xcat=/usr/bin/cat
1548         if test ! -f $xcat$_exe; then
1549                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1550                         if test -f $p/cat$_exe; then
1551                                 xcat=$p/cat
1552                                 break
1553                         fi
1554                 done
1555                 if test ! -f $xcat$_exe; then
1556                         echo "Can't find cat anywhere!"
1557                         exit 1
1558                 fi
1559         fi
1560         echo "#!$xcat" >sharp
1561         $eunicefix sharp
1562         chmod +x sharp
1563         ./sharp > today 2>/dev/null
1564         if test -s today; then
1565                 sharpbang='#!'
1566         else
1567                 echo "#! $xcat" > sharp
1568                 $eunicefix sharp
1569                 chmod +x sharp
1570                 ./sharp > today 2>/dev/null
1571                 if test -s today; then
1572                         sharpbang='#! '
1573                 else
1574                         sharpbang=': use '
1575                 fi
1576         fi
1577 else
1578         echo " "
1579         echo "Your $sh doesn't grok # comments--I will strip them later on."
1580         shsharp=false
1581         cd ..
1582         echo "exec grep -v '^[  ]*#'" >spitshell
1583         chmod +x spitshell
1584         $eunicefix spitshell
1585         spitshell=`pwd`/spitshell
1586         cd UU
1587         echo "I presume that if # doesn't work, #! won't work either!"
1588         sharpbang=': use '
1589 fi
1590 rm -f sharp today
1591
1592 : figure out how to guarantee sh startup
1593 case "$startsh" in
1594 '') startsh=${sharpbang}${sh} ;;
1595 *)
1596 esac
1597 cat >sharp <<EOSS
1598 $startsh
1599 set abc
1600 test "$?abc" != 1
1601 EOSS
1602
1603 chmod +x sharp
1604 $eunicefix sharp
1605 if ./sharp; then
1606         : echo "Yup, it does."
1607 else
1608         echo "Hmm... '$startsh' does not guarantee sh startup..."
1609         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1610 fi
1611 rm -f sharp
1612
1613 : Save command line options in file UU/cmdline.opt for later use in
1614 : generating config.sh.
1615 cat > cmdline.opt <<EOSH
1616 : Configure command line arguments.
1617 config_arg0='$0'
1618 config_args='$*'
1619 config_argc=$#
1620 EOSH
1621 argn=1
1622 args_exp=''
1623 args_sep=''
1624 for arg in "$@"; do
1625         cat >>cmdline.opt <<EOSH
1626 config_arg$argn='$arg'
1627 EOSH
1628         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1629 $arg
1630 EOC
1631         arg_exp=`cat cmdl.opt`
1632         args_exp="$args_exp$args_sep'$arg_exp'"
1633         argn=`expr $argn + 1`
1634         args_sep=' '
1635 done
1636 rm -f cmdl.opt
1637
1638 : produce awk script to parse command line options
1639 cat >options.awk <<'EOF'
1640 BEGIN {
1641         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1642
1643         len = length(optstr);
1644         for (i = 1; i <= len; i++) {
1645                 c = substr(optstr, i, 1);
1646                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1647                 if (a == ":") {
1648                         arg[c] = 1;
1649                         i++;
1650                 }
1651                 opt[c] = 1;
1652         }
1653 }
1654 {
1655         expect = 0;
1656         str = $0;
1657         if (substr(str, 1, 1) != "-") {
1658                 printf("'%s'\n", str);
1659                 next;
1660         }
1661         len = length($0);
1662         for (i = 2; i <= len; i++) {
1663                 c = substr(str, i, 1);
1664                 if (!opt[c]) {
1665                         printf("-%s\n", substr(str, i));
1666                         next;
1667                 }
1668                 printf("-%s\n", c);
1669                 if (arg[c]) {
1670                         if (i < len)
1671                                 printf("'%s'\n", substr(str, i + 1));
1672                         else
1673                                 expect = 1;
1674                         next;
1675                 }
1676         }
1677 }
1678 END {
1679         if (expect)
1680                 print "?";
1681 }
1682 EOF
1683
1684 : process the command line options
1685 set X `for arg in "$@"; do echo "X$arg"; done |
1686         sed -e s/X// | awk -f options.awk`
1687 eval "set $*"
1688 shift
1689 rm -f options.awk
1690
1691 : set up default values
1692 fastread=''
1693 reuseval=false
1694 config_sh=''
1695 alldone=''
1696 error=''
1697 silent=''
1698 extractsh=''
1699 knowitall=''
1700 rm -f optdef.sh posthint.sh
1701 cat >optdef.sh <<EOS
1702 $startsh
1703 EOS
1704
1705
1706 : option parsing
1707 while test $# -gt 0; do
1708         case "$1" in
1709         -d) shift; fastread=yes;;
1710         -e) shift; alldone=cont;;
1711         -f)
1712                 shift
1713                 cd ..
1714                 if test -r "$1"; then
1715                         config_sh="$1"
1716                 else
1717                         echo "$me: cannot read config file $1." >&2
1718                         error=true
1719                 fi
1720                 cd UU
1721                 shift;;
1722         --help|\
1723         -h) shift; error=true;;
1724         -r) shift; reuseval=true;;
1725         -s) shift; silent=true; realsilent=true;;
1726         -E) shift; alldone=exit;;
1727         -K) shift; knowitall=true;;
1728         -O) shift;;
1729         -S) shift; silent=true; extractsh=true;;
1730         -D)
1731                 shift
1732                 case "$1" in
1733                 *=)
1734                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1735                         echo "$me: ignoring -D $1" >&2
1736                         ;;
1737                 *=*) echo "$1" | \
1738                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1739                 *) echo "$1='define'" >> optdef.sh;;
1740                 esac
1741                 shift
1742                 ;;
1743         -U)
1744                 shift
1745                 case "$1" in
1746                 *=) echo "$1" >> optdef.sh;;
1747                 *=*)
1748                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1749                         echo "$me: ignoring -U $1" >&2
1750                         ;;
1751                 *) echo "$1='undef'" >> optdef.sh;;
1752                 esac
1753                 shift
1754                 ;;
1755         -A)
1756             shift
1757             xxx=''
1758             yyy="$1"
1759             zzz=''
1760             uuu=undef
1761             case "$yyy" in
1762             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1763                  case "$zzz" in
1764                  *:*) zzz='' ;;
1765                  *)   xxx=append
1766                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1767                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1768                  esac
1769                  ;;
1770             esac
1771             case "$xxx" in
1772             '')  case "$yyy" in
1773                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1774                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1775                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1776                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1777                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1778                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1779                  esac
1780                  ;;
1781             esac
1782             case "$xxx" in
1783             append)
1784                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1785             clear)
1786                 echo "$yyy=''"                  >> posthint.sh ;;
1787             define)
1788                 case "$zzz" in
1789                 '') zzz=define ;;
1790                 esac
1791                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1792             eval)
1793                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1794             prepend)
1795                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1796             undef)
1797                 case "$zzz" in
1798                 '') zzz="$uuu" ;;
1799                 esac
1800                 echo "$yyy=$zzz"                >> posthint.sh ;;
1801             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1802             esac
1803             shift
1804             ;;
1805         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1806             exit 0;;
1807         --) break;;
1808         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1809         *) break;;
1810         esac
1811 done
1812
1813 case "$error" in
1814 true)
1815         cat >&2 <<EOM
1816 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1817                  [-U symbol] [-U symbol=] [-A command:symbol...]
1818   -d : use defaults for all answers.
1819   -e : go on without questioning past the production of config.sh.
1820   -f : specify an alternate default configuration file.
1821   -h : print this help message and exit (with an error status).
1822   -r : reuse C symbols value if possible (skips costly nm extraction).
1823   -s : silent mode, only echoes questions and essential information.
1824   -D : define symbol to have some value:
1825          -D symbol         symbol gets the value 'define'
1826          -D symbol=value   symbol gets the value 'value'
1827        common used examples (see INSTALL for more info):
1828          -Duse64bitint            use 64bit integers
1829          -Duse64bitall            use 64bit integers and pointers
1830          -Dusethreads             use thread support
1831          -Dinc_version_list=none  do not include older perl trees in @INC
1832          -DEBUGGING=none          DEBUGGING options
1833          -Dcc=gcc                 choose your compiler
1834          -Dprefix=/opt/perl5      choose your destination
1835   -E : stop at the end of questions, after having produced config.sh.
1836   -K : do not use unless you know what you are doing.
1837   -O : ignored for backward compatibility
1838   -S : perform variable substitutions on all .SH files (can mix with -f)
1839   -U : undefine symbol:
1840          -U symbol    symbol gets the value 'undef'
1841          -U symbol=   symbol gets completely empty
1842        e.g.:  -Uversiononly
1843   -A : manipulate symbol after the platform specific hints have been applied:
1844          -A append:symbol=value   append value to symbol
1845          -A symbol=value          like append:, but with a separating space
1846          -A define:symbol=value   define symbol to have value
1847          -A clear:symbol          define symbol to be ''
1848          -A define:symbol         define symbol to be 'define'
1849          -A eval:symbol=value     define symbol to be eval of value
1850          -A prepend:symbol=value  prepend value to symbol
1851          -A undef:symbol          define symbol to be 'undef'
1852          -A undef:symbol=         define symbol to be ''
1853        e.g.:  -A prepend:libswanted='cl pthread '
1854               -A ccflags=-DSOME_MACRO
1855   -V : print version number and exit (with a zero status).
1856 EOM
1857         exit 1
1858         ;;
1859 esac
1860
1861 : Sanity checks
1862 case "$fastread$alldone" in
1863 yescont|yesexit) ;;
1864 *)
1865         case "$extractsh" in
1866         true) ;;
1867         *)
1868                 if test ! -t 0; then
1869                         echo "Say 'sh Configure', not 'sh <Configure'"
1870                         exit 1
1871                 fi
1872                 ;;
1873         esac
1874         ;;
1875 esac
1876
1877 exec 4>&1
1878 case "$silent" in
1879 true) exec 1>/dev/null;;
1880 esac
1881
1882 : run the defines and the undefines, if any, but leave the file out there...
1883 touch optdef.sh
1884 grep '\\' optdef.sh >/dev/null 2>&1
1885 if test $? = 0; then
1886     echo "Configure does not support \\ in -D arguments"
1887     exit 1
1888 fi
1889 . ./optdef.sh
1890 : create the posthint manipulation script and leave the file out there...
1891 touch posthint.sh
1892
1893 : set package name
1894 package='perl5'
1895 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1896 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1897 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1898 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1899 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1900 esac
1901
1902 : Some greps do not return status, grrr.
1903 echo "grimblepritz" >grimble
1904 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1905         contains=contains
1906 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1907         contains=grep
1908 else
1909         contains=contains
1910 fi
1911 rm -f grimble
1912 : the following should work in any shell
1913 case "$contains" in
1914 contains*)
1915         echo " "
1916         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1917         cat >contains <<'EOSS'
1918 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1919 EOSS
1920 chmod +x contains
1921 esac
1922
1923 : Find the path to the source tree
1924 case "$src" in
1925 '') case "$0" in
1926     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1927          case "$src" in
1928          /*)    ;;
1929          .)     ;;
1930          *)     src=`cd ../$src && pwd` ;;
1931          esac
1932          ;;
1933     *)   src='.';;
1934     esac;;
1935 esac
1936 case "$src" in
1937 '')     src=/
1938         rsrc=/
1939         ;;
1940 /*)     rsrc="$src";;
1941 *)      rsrc="../$src";;
1942 esac
1943 if test -f $rsrc/Configure && \
1944         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1945 then
1946    : found it, so we are ok.
1947 else
1948         rsrc=''
1949         for src in . .. ../.. ../../.. ../../../..; do
1950                 if test -f ../$src/Configure && \
1951                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1952                 then
1953                         rsrc=../$src
1954                         break
1955                 fi
1956         done
1957 fi
1958 case "$rsrc" in
1959 '')
1960         cat <<EOM >&4
1961
1962 Sorry, I can't seem to locate the source dir for $package.  Please start
1963 Configure with an explicit path -- i.e. /some/path/Configure.
1964
1965 EOM
1966         exit 1
1967         ;;
1968 ../.)   rsrc='..';;
1969 *)
1970         echo " "
1971         echo "Sources for $package found in \"$src\"." >&4
1972         ;;
1973 esac
1974
1975 : script used to extract .SH files with variable substitutions
1976 cat >extract <<'EOS'
1977 PERL_CONFIG_SH=true
1978 echo "Doing variable substitutions on .SH files..."
1979 if test -f MANIFEST; then
1980         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1981 else
1982         echo "(Looking for .SH files under the source directory.)"
1983         set x `(cd "$src"; find . -name "*.SH" -print)`
1984 fi
1985 shift
1986 case $# in
1987 0) set x `(cd "$src"; echo *.SH)`; shift;;
1988 esac
1989 if test ! -f "$src/$1"; then
1990         shift
1991 fi
1992 mkdir_p='
1993 name=$1;
1994 create="";
1995 while test $name; do
1996         if test ! -d "$name"; then
1997                 create="$name $create";
1998                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1999                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2000         else
2001                 name="";
2002         fi;
2003 done;
2004 for file in $create; do
2005         mkdir $file;
2006 done
2007 '
2008 for file in $*; do
2009         case "$src" in
2010         ".")
2011                 case "$file" in
2012                 */*)
2013                         dir=`expr X$file : 'X\(.*\)/'`
2014                         file=`expr X$file : 'X.*/\(.*\)'`
2015                         (cd "$dir" && . ./$file)
2016                         ;;
2017                 *)
2018                         . ./$file
2019                         ;;
2020                 esac
2021                 ;;
2022         *)
2023                 case "$file" in
2024                 */*)
2025                         dir=`expr X$file : 'X\(.*\)/'`
2026                         file=`expr X$file : 'X.*/\(.*\)'`
2027                         (set x $dir; shift; eval $mkdir_p)
2028                         sh <"$src/$dir/$file"
2029                         ;;
2030                 *)
2031                         sh <"$src/$file"
2032                         ;;
2033                 esac
2034                 ;;
2035         esac
2036 done
2037 if test -f "$src/config_h.SH"; then
2038         if test ! -f config.h; then
2039         : oops, they left it out of MANIFEST, probably, so do it anyway.
2040         . "$src/config_h.SH"
2041         fi
2042 fi
2043 EOS
2044
2045 : extract files and exit if asked to do so
2046 case "$extractsh" in
2047 true)
2048         case "$realsilent" in
2049         true) ;;
2050         *) exec 1>&4;;
2051         esac
2052         case "$config_sh" in
2053         '') config_sh='config.sh';;
2054         esac
2055         echo " "
2056         echo "Fetching answers from $config_sh..."
2057         cd ..
2058         . $config_sh
2059         . UU/optdef.sh
2060         echo " "
2061         . UU/extract
2062         rm -rf UU
2063         echo "Extraction done."
2064         exit 0
2065         ;;
2066 esac
2067
2068 : Eunice requires " " instead of "", can you believe it
2069 echo " "
2070 : Here we go...
2071 echo "Beginning of configuration questions for $package."
2072
2073 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2074
2075 : first determine how to suppress newline on echo command
2076 echo " "
2077 echo "Checking echo to see how to suppress newlines..."
2078 (echo "hi there\c" ; echo " ") >.echotmp
2079 if $contains c .echotmp >/dev/null 2>&1 ; then
2080         echo "...using -n."
2081         n='-n'
2082         c=''
2083 else
2084         cat <<'EOM'
2085 ...using \c
2086 EOM
2087         n=''
2088         c='\c'
2089 fi
2090 echo $n "The star should be here-->$c"
2091 echo '*'
2092 rm -f .echotmp
2093
2094 : Now test for existence of everything in MANIFEST
2095 echo " "
2096 if test -f "$rsrc/MANIFEST"; then
2097         echo "First let's make sure your kit is complete.  Checking..." >&4
2098         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2099                 (split -l 50 2>/dev/null || split -50)
2100         rm -f missing
2101         tmppwd=`pwd`
2102         for filelist in x??; do
2103                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2104                         >/dev/null 2>>"$tmppwd/missing")
2105         done
2106         if test -s missing; then
2107                 cat missing >&4
2108                 cat >&4 <<'EOM'
2109
2110 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2111
2112 You have the option of continuing the configuration process, despite the
2113 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2114 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2115 and contact the author (perlbug@perl.org).
2116
2117 EOM
2118                 echo $n "Continue? [n] $c" >&4
2119                 read ans
2120                 case "$ans" in
2121                 y*)
2122                         echo "Continuing..." >&4
2123                         rm -f missing
2124                         ;;
2125                 *)
2126                         echo "ABORTING..." >&4
2127                         kill $$
2128                         ;;
2129                 esac
2130         else
2131                 echo "Looks good..."
2132         fi
2133 else
2134         echo "There is no MANIFEST file.  I hope your kit is complete !"
2135 fi
2136 rm -f missing x??
2137
2138 : Find the appropriate value for a newline for tr
2139 if test -n "$DJGPP"; then
2140        trnl='\012'
2141 fi
2142 if test X"$trnl" = X; then
2143         case "`echo foo | tr '\n' x 2>/dev/null`" in
2144         foox) trnl='\n' ;;
2145         esac
2146 fi
2147 if test X"$trnl" = X; then
2148         case "`echo foo | tr '\012' x 2>/dev/null`" in
2149         foox) trnl='\012' ;;
2150         esac
2151 fi
2152 if test X"$trnl" = X; then
2153        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2154        fooxy) trnl='\n\r' ;;
2155        esac
2156 fi
2157 if test X"$trnl" = X; then
2158         cat <<EOM >&2
2159
2160 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2161
2162 EOM
2163         exit 1
2164 fi
2165
2166 : compute the number of columns on the terminal for proper question formatting
2167 case "$COLUMNS" in
2168 '') COLUMNS='80';;
2169 esac
2170
2171 : set up the echo used in my read
2172 myecho="case \"\$xxxm\" in
2173 '') echo $n \"\$rp $c\" >&4;;
2174 *) case \"\$rp\" in
2175         '') echo $n \"[\$xxxm] $c\";;
2176         *)
2177                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2178                         echo \"\$rp\" >&4
2179                         echo $n \"[\$xxxm] $c\" >&4
2180                 else
2181                         echo $n \"\$rp [\$xxxm] $c\" >&4
2182                 fi
2183                 ;;
2184         esac;;
2185 esac"
2186
2187 : now set up to do reads with possible shell escape and default assignment
2188 cat <<EOSC >myread
2189 $startsh
2190 xxxm=\$dflt
2191 $myecho
2192 ans='!'
2193 case "\$fastread" in
2194 yes) case "\$dflt" in
2195         '') ;;
2196         *) ans='';
2197                 case "\$silent-\$rp" in
2198                 true-) ;;
2199                 *) echo " " >&4;;
2200                 esac;;
2201         esac;;
2202 *) case "\$silent" in
2203         true) case "\$rp" in
2204                 '') ans='';;
2205                 esac;;
2206         esac;;
2207 esac
2208 while expr "X\$ans" : "X!" >/dev/null; do
2209         read answ
2210         set x \$xxxm
2211         shift
2212         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2213         case  "\$answ" in
2214         "!")
2215                 sh 1>&4
2216                 echo " "
2217                 $myecho
2218                 ;;
2219         !*)
2220                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2221                 shift
2222                 sh 1>&4 -c "\$*"
2223                 echo " "
2224                 $myecho
2225                 ;;
2226         "\$ans")
2227                 case "\$ans" in
2228                 \\&*)
2229                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2230                         shift
2231                         case "\$1" in
2232                         -d)
2233                                 fastread=yes
2234                                 echo "(OK, I'll run with -d after this question.)" >&4
2235                                 ;;
2236                         -*)
2237                                 echo "*** Sorry, \$1 not supported yet." >&4
2238                                 ;;
2239                         esac
2240                         $myecho
2241                         ans=!
2242                         ;;
2243                 esac;;
2244         *)
2245                 case "\$aok" in
2246                 y)
2247                         echo "*** Substitution done -- please confirm."
2248                         xxxm="\$ans"
2249                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2250                         xxxm="\$ans"
2251                         ans=!
2252                         ;;
2253                 *)
2254                         echo "*** Error -- try again."
2255                         ans=!
2256                         ;;
2257                 esac
2258                 $myecho
2259                 ;;
2260         esac
2261         case "\$ans\$xxxm\$nostick" in
2262         '')
2263                 ans=!
2264                 $myecho
2265                 ;;
2266         esac
2267 done
2268 case "\$ans" in
2269 '') ans="\$xxxm";;
2270 esac
2271 EOSC
2272
2273 : create .config dir to save info across Configure sessions
2274 test -d ../.config || mkdir ../.config
2275 cat >../.config/README <<EOF
2276 This directory created by Configure to save information that should
2277 persist across sessions for $package.
2278
2279 You may safely delete it if you wish.
2280 EOF
2281
2282 : See if we are using a devel version and want that
2283 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2284 case "$usedevel" in
2285 $define|true|[yY]*)
2286     usedevel="$define" ;;
2287 *) case "$xversion" in
2288    *[13579])
2289         cat >&4 <<EOH
2290 *** WHOA THERE!!! ***
2291
2292     This is an UNSTABLE DEVELOPMENT release.
2293     The version of this $package distribution is $xversion, that is, odd,
2294     (as opposed to even) and that signifies a development release.
2295     If you want a maintenance release, you want an even-numbered version.
2296
2297     Do ***NOT*** install this into production use.
2298     Data corruption and crashes are possible.
2299
2300     It is most seriously suggested that you do not continue any further
2301     unless you want to help in developing and debugging Perl.
2302
2303     If you *still* want to build perl, you can answer 'y' now,
2304     or pass -Dusedevel to Configure.
2305
2306 EOH
2307         rp='Do you really want to continue?'
2308         dflt='n'
2309         . ./myread
2310         case "$ans" in
2311         [yY]) echo >&4 "Okay, continuing."
2312               usedevel="$define" ;;
2313         *) echo >&4 "Okay, bye."
2314            exit 1
2315            ;;
2316         esac
2317         ;;
2318     esac
2319     usedevel="$undef"
2320     ;;
2321 esac
2322 case "$usedevel" in
2323 $define|true|[yY]*)
2324         case "$versiononly" in
2325         '') versiononly="$define" ;;
2326         esac
2327         case "$installusrbinperl" in
2328         '') installusrbinperl="$undef" ;;
2329         esac
2330         ;;
2331 esac
2332
2333 : general instructions
2334 needman=true
2335 firsttime=true
2336 user=`(logname) 2>/dev/null`
2337 case "$user" in
2338 '') user=`whoami 2>&1`;;
2339 esac
2340 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2341         firsttime=false
2342         echo " "
2343         rp='Would you like to see the instructions?'
2344         dflt=n
2345         . ./myread
2346         case "$ans" in
2347         [yY]*) ;;
2348         *) needman=false;;
2349         esac
2350 fi
2351 if $needman; then
2352         cat <<EOH
2353
2354 This installation shell script will examine your system and ask you questions
2355 to determine how the perl5 package should be installed. If you get
2356 stuck on a question, you may use a ! shell escape to start a subshell or
2357 execute a command.  Many of the questions will have default answers in square
2358 brackets; typing carriage return will give you the default.
2359
2360 On some of the questions which ask for file or directory names you are allowed
2361 to use the ~name construct to specify the login directory belonging to "name",
2362 even if you don't have a shell which knows about that.  Questions where this is
2363 allowed will be marked "(~name ok)".
2364
2365 EOH
2366         rp=''
2367         dflt='Type carriage return to continue'
2368         . ./myread
2369         cat <<'EOH'
2370
2371 The prompter used in this script allows you to use shell variables and
2372 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2373 in the default answer, as if the default line was a set of arguments given to a
2374 script shell.  This means you may also use $* to repeat the whole default line,
2375 so you do not have to re-type everything to add something to the default.
2376
2377 Every time there is a substitution, you will have to confirm.  If there is an
2378 error (e.g. an unmatched backtick), the default answer will remain unchanged
2379 and you will be prompted again.
2380
2381 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2382 the questions and use the computed defaults (or the previous answers if there
2383 was already a config.sh file). Type 'Configure -h' for a list of options.
2384 You may also start interactively and then answer '& -d' at any prompt to turn
2385 on the non-interactive behaviour for the remainder of the execution.
2386
2387 EOH
2388         . ./myread
2389         cat <<EOH
2390
2391 Much effort has been expended to ensure that this shell script will run on any
2392 Unix system.  If despite that it blows up on yours, your best bet is to edit
2393 Configure and run it again.  If you can't run Configure for some reason,
2394 you'll have to generate a config.sh file by hand.  Whatever problems you
2395 have, let me (perlbug@perl.org) know how I blew it.
2396
2397 This installation script affects things in two ways:
2398
2399 1) it may do direct variable substitutions on some of the files included
2400    in this kit.
2401 2) it builds a config.h file for inclusion in C programs.  You may edit
2402    any of these files as the need arises after running this script.
2403
2404 If you make a mistake on a question, there is no easy way to back up to it
2405 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2406 files.  Configure will offer to let you do this before it runs the SH files.
2407
2408 EOH
2409         dflt='Type carriage return to continue'
2410         . ./myread
2411         case "$firsttime" in
2412         true) echo $user >>../.config/instruct;;
2413         esac
2414 fi
2415
2416 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2417 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2418 if test "X$sysroot" = X; then
2419     sysroot=""
2420 else
2421     case "$cc" in
2422         *gcc*|*g++*)
2423             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2424             # _sysroot is used in places where we need --sysroot=foo
2425             # but using the rest of the flags could cause issues.
2426             _sysroot="--sysroot=$sysroot";
2427             case "$ccflags" in
2428                 *sysroot*) ;;
2429                 'undef'|*)
2430                 ccflags="$ccflags $_sysroot"
2431             esac
2432             case "$ldflags" in
2433                 *sysroot*) ;;
2434                 'undef'|*)
2435                 ldflags="$ldflags $_sysroot"
2436             esac
2437             case "$cppflags" in
2438                 *sysroot*) ;;
2439                 'undef'|*)
2440                 cppflags="$cppflags $_sysroot"
2441             esac
2442             # lddlflags updated below in lddlflags section;
2443             # same with cccdlflags
2444             ;;
2445     esac
2446
2447     # Adjust some defaults to also use $sysroot
2448     for var in xlibpth loclibpth locincpth glibpth; do
2449         eval xxx=\$$var
2450         eval $var=''
2451         for path in $xxx; do
2452             eval $var=\"\$$var $sysroot$path\"
2453         done
2454     done
2455
2456 fi
2457
2458 : find out where common programs are
2459 echo " "
2460 echo "Locating common programs..." >&4
2461 cat <<EOSC >loc
2462 $startsh
2463 case \$# in
2464 0) exit 1;;
2465 esac
2466 thing=\$1
2467 shift
2468 dflt=\$1
2469 shift
2470 for dir in \$*; do
2471         case "\$thing" in
2472         .)
2473         if test -d \$dir/\$thing; then
2474                 echo \$dir
2475                 exit 0
2476         fi
2477         ;;
2478         *)
2479         for thisthing in \$dir/\$thing; do
2480                 : just loop through to pick last item
2481         done
2482         if test -f \$thisthing; then
2483                 echo \$thisthing
2484                 exit 0
2485         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2486                 echo \$thisthing
2487                 exit 0
2488         elif test -f \$dir/\$thing.exe; then
2489                 if test -n "$DJGPP"; then
2490                         echo \$dir/\$thing.exe
2491                 elif test "$eunicefix" != ":"; then
2492                         : on Eunice apparently
2493                         echo \$dir/\$thing
2494                 fi
2495                 exit 0
2496         fi
2497         ;;
2498         esac
2499 done
2500 echo \$dflt
2501 exit 1
2502 EOSC
2503 chmod +x loc
2504 $eunicefix loc
2505 loclist="
2506 awk
2507 cat
2508 chmod
2509 comm
2510 cp
2511 echo
2512 expr
2513 grep
2514 ls
2515 mkdir
2516 rm
2517 sed
2518 sort
2519 touch
2520 tr
2521 uniq
2522 "
2523 trylist="
2524 ar
2525 bison
2526 byacc
2527 cpp
2528 csh
2529 date
2530 egrep
2531 gmake
2532 gzip
2533 less
2534 ln
2535 make
2536 more
2537 nm
2538 nroff
2539 perl
2540 pg
2541 test
2542 uname
2543 zip
2544 "
2545 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2546 pth="$pth $sysroot/lib $sysroot/usr/lib"
2547 for file in $loclist; do
2548         eval xxx=\$$file
2549         case "$xxx" in
2550         /*|?:[\\/]*)
2551                 if test -f "$xxx"; then
2552                         : ok
2553                 else
2554                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2555                         xxx=`./loc $file $file $pth`
2556                 fi
2557                 ;;
2558         '') xxx=`./loc $file $file $pth`;;
2559         *) xxx=`./loc $xxx $xxx $pth`;;
2560         esac
2561         eval $file=$xxx$_exe
2562         eval _$file=$xxx
2563         case "$xxx" in
2564         /*)
2565                 echo $file is in $xxx.
2566                 ;;
2567         ?:[\\/]*)
2568                 echo $file is in $xxx.
2569                 ;;
2570         *)
2571                 echo "I don't know where '$file' is, and my life depends on it." >&4
2572                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2573                 exit 1
2574                 ;;
2575         esac
2576 done
2577 echo " "
2578 echo "Don't worry if any of the following aren't found..."
2579 say=offhand
2580 for file in $trylist; do
2581         eval xxx=\$$file
2582         case "$xxx" in
2583         /*|?:[\\/]*)
2584                 if test -f "$xxx"; then
2585                         : ok
2586                 else
2587                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2588                         xxx=`./loc $file $file $pth`
2589                 fi
2590                 ;;
2591         '') xxx=`./loc $file $file $pth`;;
2592         *) xxx=`./loc $xxx $xxx $pth`;;
2593         esac
2594         eval $file=$xxx$_exe
2595         eval _$file=$xxx
2596         case "$xxx" in
2597         /*)
2598                 echo $file is in $xxx.
2599                 ;;
2600         ?:[\\/]*)
2601                 echo $file is in $xxx.
2602                 ;;
2603         *)
2604                 echo "I don't see $file out there, $say."
2605                 say=either
2606                 ;;
2607         esac
2608 done
2609 case "$egrep" in
2610 egrep)
2611         echo "Substituting grep for egrep."
2612         egrep=$grep
2613         _egrep=$grep
2614         ;;
2615 esac
2616 case "$less" in
2617 '')     ;;
2618 *)      if $less -R </dev/null >/dev/null 2>&1; then
2619                echo "Substituting less -R for less."
2620                less="$less -R"
2621                _less=$less
2622         fi
2623         ;;
2624 esac
2625 case "$ln" in
2626 ln)
2627         echo "Substituting cp for ln."
2628         ln=$cp
2629         _ln=$cp
2630         ;;
2631 esac
2632 case "$make" in
2633 make)
2634         case "$gmake" in
2635         gmake)
2636         echo "I can't find make or gmake, and my life depends on it." >&4
2637         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2638         exit 1
2639         ;;
2640         esac
2641         ;;
2642 esac
2643 case "$gmake" in
2644 gmake)  ;;
2645 *)      # We can't have osname yet.
2646         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2647                 # Assume that gmake, if found, is definitely GNU make
2648                 # and prefer it over the system make.
2649                 echo "Substituting gmake for make."
2650                 make=$gmake
2651                 _make=$gmake
2652         fi
2653         ;;
2654 esac
2655 case "$test" in
2656 test)
2657         echo "Hopefully test is built into your sh."
2658         ;;
2659 *)
2660         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2661                 echo "Using the test built into your sh."
2662                 test=test
2663                 _test=test
2664         fi
2665         ;;
2666 esac
2667 case "$echo" in
2668 echo)
2669         echo "Hopefully echo is built into your sh."
2670         ;;
2671 '') ;;
2672 *)
2673         echo " "
2674 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2675         $echo $n "hi there$c" >foo1
2676         echo $n "hi there$c" >foo2
2677         if cmp foo1 foo2 >/dev/null 2>&1; then
2678                 echo "They are compatible.  In fact, they may be identical."
2679         else
2680                 case "$n" in
2681                 '-n') n='' c='\c';;
2682                 *) n='-n' c='';;
2683                 esac
2684                 cat <<FOO
2685 They are not compatible!  You are probably running ksh on a non-USG system.
2686 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2687 have echo built in and we may have to run some Bourne shell scripts.  That
2688 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2689
2690 FOO
2691                 $echo $n "The star should be here-->$c"
2692                 $echo "*"
2693         fi
2694         $rm -f foo1 foo2
2695         ;;
2696 esac
2697
2698 # This question was auctioned at YAPC::Europe-2007 in Vienna
2699 # I never promised you could answer it. I only auctioned the question.
2700 cat <<FOO
2701 The following message is sponsored by
2702
2703   Dresden.pm<--The stars should be here.
2704
2705 Dear Perl user, system administrator or package
2706 maintainer, the Perl community sends greetings to
2707 you. Do you (emblematical) greet back [Y/n]? n
2708
2709 FOO
2710
2711 : Check what type of C compiler we use
2712 cat <<EOS >trygcc
2713 $startsh
2714 EOS
2715 cat <<'EOSC' >>trygcc
2716 case "$cc" in
2717 '') ;;
2718 *)  $rm -f try try.*
2719     $cat >try.c <<EOM
2720 int main(int argc, char *argv[]) {
2721   return 0;
2722 }
2723 EOM
2724     if $cc -o try $ccflags $ldflags try.c; then
2725        :
2726     else
2727         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2728         despair=yes
2729         trygcc=yes
2730         case "$cc" in
2731         *gcc*) trygcc=no ;;
2732         esac
2733         # Skip this test because it gives a false match on output like:
2734         #    ./trygcc: line 23: cc: command not found
2735         # case "`$cc -v -c try.c 2>&1`" in
2736         # *gcc*) trygcc=no ;;
2737         # esac
2738         if $test X"$trygcc" = Xyes; then
2739             if gcc -o try -c try.c; then
2740                 echo " "
2741                 echo "You seem to have a working gcc, though." >&4
2742                 # Switching compilers may undo the work of hints files.
2743                 # The most common problem is -D_REENTRANT for threads.
2744                 # This heuristic catches that case, but gets false positives
2745                 # if -Dusethreads was not actually specified.  Better to
2746                 # bail out here with a useful message than fail
2747                 # mysteriously later. Should we perhaps just try to
2748                 # re-invoke Configure -Dcc=gcc config_args ?
2749                 if $test -f usethreads.cbu; then
2750                         $cat >&4 <<EOM
2751
2752 *** However, any setting of the C compiler flags (e.g. for thread support)
2753 *** will be lost.  It may be necessary for you to restart Configure and
2754 *** add -Dcc=gcc to your Configure command line.
2755
2756 EOM
2757                         rp="Would you like to go ahead and try gcc anyway?"
2758                         dflt=n
2759                 else
2760                         rp="Would you like to use it?"
2761                         dflt=y
2762                 fi
2763                 if $test -f myread; then
2764                     . ./myread
2765                 else
2766                     if $test -f UU/myread; then
2767                         . ./UU/myread
2768                     else
2769                         echo "Cannot find myread, sorry.  Aborting." >&2
2770                         exit 1
2771                     fi
2772                 fi
2773                 case "$ans" in
2774                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2775                 esac
2776             fi
2777         fi
2778     fi
2779     $rm -f try try.*
2780     ;;
2781 esac
2782 EOSC
2783
2784 cat <<EOS >checkcc
2785 $startsh
2786 EOS
2787 cat <<'EOSC' >>checkcc
2788 case "$cc" in
2789 '') ;;
2790 *)  $rm -f try try.*
2791     $cat >try.c <<EOM
2792 int main(int argc, char *argv[]) {
2793   return 0;
2794 }
2795 EOM
2796     if $cc -o try $ccflags $ldflags try.c; then
2797        :
2798     else
2799         if $test X"$despair" = Xyes; then
2800            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2801         fi
2802         $cat >&4 <<EOM
2803 You need to find a working C compiler.
2804 Either (purchase and) install the C compiler supplied by your OS vendor,
2805 or for a free C compiler try http://gcc.gnu.org/
2806 I cannot continue any further, aborting.
2807 EOM
2808         exit 1
2809     fi
2810     $rm -f try try.*
2811     ;;
2812 esac
2813 EOSC
2814
2815 : determine whether symbolic links are supported
2816 echo " "
2817 $touch blurfl
2818 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2819         echo "Symbolic links are supported." >&4
2820         lns="$ln -s"
2821 else
2822         echo "Symbolic links are NOT supported." >&4
2823         lns="$ln"
2824 fi
2825 $rm -f blurfl sym
2826
2827 : determine whether symbolic links are supported
2828 echo " "
2829 case "$lns" in
2830 *"ln"*" -s")
2831         echo "Checking how to test for symbolic links..." >&4
2832         $lns blurfl sym
2833         if $test "X$issymlink" = X; then
2834                 case "$newsh" in
2835                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2836                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2837                 esac
2838                 if test $? = 0; then
2839                         issymlink="test -h"
2840                 else
2841                         echo "Your builtin 'test -h' may be broken." >&4
2842                         case "$test" in
2843                         /*)     ;;
2844                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2845                                 for p in $pth
2846                                 do
2847                                         if test -f "$p/$test"; then
2848                                                 test="$p/$test"
2849                                                 break
2850                                         fi
2851                                 done
2852                                 ;;
2853                         esac
2854                         case "$test" in
2855                         /*)
2856                                 echo "Trying external '$test -h'." >&4
2857                                 issymlink="$test -h"
2858                                 if $test ! -h sym >/dev/null 2>&1; then
2859                                         echo "External '$test -h' is broken, too." >&4
2860                                         issymlink=''
2861                                 fi
2862                                 ;;
2863                         *)      issymlink='' ;;
2864                         esac
2865                 fi
2866         fi
2867         if $test "X$issymlink" = X; then
2868                 if $test -L sym 2>/dev/null; then
2869                         issymlink="$test -L"
2870                         echo "The builtin '$test -L' worked." >&4
2871                 fi
2872         fi
2873         if $test "X$issymlink" != X; then
2874                 echo "You can test for symbolic links with '$issymlink'." >&4
2875         else
2876                 echo "I do not know how you can test for symbolic links." >&4
2877         fi
2878         $rm -f blurfl sym
2879         ;;
2880 *)      echo "No symbolic links, so not testing for their testing..." >&4
2881         ;;
2882 esac
2883 echo " "
2884
2885 : Make symlinks util
2886 case "$mksymlinks" in
2887 $define|true|[yY]*)
2888         case "$src" in
2889         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2890                 exit 1
2891                 ;;
2892         *)      case "$lns:$issymlink" in
2893                 *"ln"*" -s:"*"test -"?)
2894                         echo "Creating the symbolic links..." >&4
2895                         cd ..
2896                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2897                         awk 'NF == 1 {
2898                                 dir=".";
2899                                 file=$1 "";
2900                              }
2901                              NF == 2 {
2902                                 dir=$1 "";
2903                                 file=$2 "";
2904                              }
2905                              {
2906                                  print "# dir = ", dir, "file = ", file
2907                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2908                              } END {
2909                                  for (d in mf) {
2910                                      if (d != ".") { print("mkdir -p "d) }
2911                                      print("ln -sf "mf[d]" "d);
2912                                  }
2913                              }' source="$src" > UU/mksymlinks.$$
2914                         sh UU/mksymlinks.$$
2915                         rm UU/mksymlinks.$$
2916                         # Sanity check 1.
2917                         if test ! -d t/base; then
2918                                 echo "Failed to create the subdirectories.  Aborting." >&4
2919                                 exit 1
2920                         fi
2921                         # Sanity check 2.
2922                         if test ! -f t/base/lex.t; then
2923                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2924                                 exit 1
2925                         fi
2926                         if test ! -f win32/win32.c; then
2927                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2928                                 exit 1
2929                         fi
2930                         cd UU
2931                         ;;
2932                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2933                         ;;
2934                 esac
2935                 ;;
2936         esac
2937         ;;
2938 esac
2939
2940 : Check for Cross-Compilation
2941 if $test "X$targethost" = "X"; then
2942     targethost=""
2943 fi
2944 if $test "X$targetenv" = "X"; then
2945     targetenv=""
2946 fi
2947 case "$usecrosscompile" in
2948 $define|true|[yY]*)
2949         $echo "Cross-compiling..."
2950         croak=''
2951         case "$cc" in
2952         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2953             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2954             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2955             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2956             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2957             # leave out ld, choosing it is more complex
2958             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2959             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2960             # We are in a weird spot. Just before us, some values
2961             # were 'saved', to be restored after the hints are
2962             # run.  This means that the changes we made to ar,
2963             # nm and ranlib will get reverted.
2964             # To avoid that, we hijack the saving mechanism and
2965             # have it save our new values.
2966             for file in ar nm ranlib; do
2967                 eval xxx=\$$file
2968                 eval $file=$xxx$_exe
2969                 eval _$file=$xxx
2970             done
2971         ;;
2972         esac
2973         case "$targetarch" in
2974         '') echo "Targetarch not defined." >&4; croak=y ;;
2975         *)  echo "Using targetarch $targetarch." >&4 ;;
2976         esac
2977         case "$targethost" in
2978         '') echo "Targethost not defined." >&4; croak=n ;;
2979         *)  echo "Using targethost $targethost." >&4
2980         esac
2981         locincpth=' '
2982         loclibpth=' '
2983         case "$croak" in
2984         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2985         esac
2986     : compile a host miniperl and generate_uudmap, unless we got passed them
2987     if $test "X$hostperl" = X; then
2988       echo "Building host miniperl and generate_uudmap binaries" >&4
2989       before_host=`pwd`
2990       cd ..
2991       cd $src
2992       src=`pwd`
2993       rm -rf $src/host
2994       mkdir $src/host
2995       cd $src/host
2996       $src/Configure -des -Dusedevel -Dmksymlinks
2997       $make miniperl
2998       case "$hostgenerate" in
2999       '') $make generate_uudmap
3000           hostgenerate=$src/host/generate_uudmap
3001           ;;
3002        "$undef") hostgenerate=''
3003           ;;
3004       esac
3005       hostperl=$src/host/miniperl
3006       cd $before_host
3007     fi
3008     hostosname=`$hostperl -le 'print $^O'`
3009     ;;
3010 *)
3011     usecrosscompile="$undef"
3012     ;;
3013 esac
3014
3015 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3016 case "$targethost" in
3017     '') echo "Checking for cross-compile" >&4
3018     case "$usecrosscompile$multiarch" in
3019        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3020          if [ -f Makefile ]; then
3021            echo " "
3022            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3023          else
3024            echo "Configure done."
3025          fi
3026        exit 0
3027        ;;
3028      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3029         run=''
3030         to=:
3031         from=:
3032         ;;
3033     esac
3034     ;;
3035     *) echo "Using targethost $targethost." >&4
3036         case "$src" in
3037         /*) run=$src/Cross/run
3038             targetmkdir=$src/Cross/mkdir
3039             to=$src/Cross/to
3040             from=$src/Cross/from
3041             ;;
3042         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3043             run=$pwd/Cross/run
3044             targetmkdir=$pwd/Cross/mkdir
3045             to=$pwd/Cross/to
3046             from=$pwd/Cross/from
3047             ;;
3048         esac
3049         case "$targetrun" in
3050         '') targetrun=ssh ;;
3051         esac
3052         case "$targetto" in
3053         '') targetto=scp ;;
3054         esac
3055         case "$targetfrom" in
3056         '') targetfrom=scp ;;
3057         esac
3058         run=$run-$targetrun
3059         to=$to-$targetto
3060         from=$from-$targetfrom
3061         case "$targetdir" in
3062         '')  targetdir=/tmp
3063              echo "Guessing targetdir $targetdir." >&4
3064              ;;
3065         esac
3066         case "$targetuser" in
3067         '')  targetuser=root
3068              echo "Guessing targetuser $targetuser." >&4
3069              ;;
3070         esac
3071         case "$targetport" in
3072         '')  targetport=22
3073              echo "Guessing targetport $targetport." >&4
3074              ;;
3075         esac
3076         case "$targetfrom" in
3077         scp)    q=-q ;;
3078         *)      q='' ;;
3079         esac
3080         case "$targetrun" in
3081         ssh|rsh)
3082             cat >$run <<EOF
3083 #!/bin/sh
3084 env=''
3085 case "\$1" in
3086 -cwd)
3087   shift
3088   cwd=\$1
3089   shift
3090   ;;
3091 esac
3092 case "\$1" in
3093 -env)
3094   shift
3095   env=\$1
3096   shift
3097   ;;
3098 esac
3099 case "\$cwd" in
3100 '') cwd=$targetdir ;;
3101 esac
3102 exe=\$1
3103 shift
3104 $to \$exe
3105 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3106 EOF
3107             ;;
3108         adb)
3109             $touch $run
3110             ;;
3111         *)  echo "Unknown targetrun '$targetrun'" >&4
3112             exit 1
3113             ;;
3114         esac
3115         case "$targetmkdir" in
3116         */Cross/mkdir)
3117             cat >$targetmkdir <<EOF
3118 #!/bin/sh
3119 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3120 EOF
3121             $chmod a+rx $targetmkdir
3122             ;;
3123         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3124             exit 1
3125             ;;
3126         esac
3127         case "$targetto" in
3128         scp|rcp)
3129             cat >$to <<EOF
3130 #!/bin/sh
3131 for f in \$@
3132 do
3133   case "\$f" in
3134   /*)
3135     $targetmkdir \`dirname \$f\`
3136     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3137     ;;
3138   *)
3139     $targetmkdir $targetdir/\`dirname \$f\`
3140     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3141     ;;
3142   esac
3143 done
3144 exit 0
3145 EOF
3146             ;;
3147         cp) cat >$to <<EOF
3148 #!/bin/sh
3149 for f in \$@
3150 do
3151   case "\$f" in
3152   /*)
3153     $mkdir -p $targetdir/\`dirname \$f\`
3154     $cp \$f $targetdir/\$f || exit 1
3155     ;;
3156   *)
3157     $targetmkdir $targetdir/\`dirname \$f\`
3158     $cp \$f $targetdir/\$f || exit 1
3159     ;;
3160   esac
3161 done
3162 exit 0
3163 EOF
3164             ;;
3165         *)  echo "Unknown targetto '$targetto'" >&4
3166             exit 1
3167             ;;
3168         esac
3169         case "$targetfrom" in
3170         scp|rcp)
3171           cat >$from <<EOF
3172 #!/bin/sh
3173 for f in \$@
3174 do
3175   $rm -f \$f
3176   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3177 done
3178 exit 0
3179 EOF
3180             ;;
3181         cp) cat >$from <<EOF
3182 #!/bin/sh
3183 for f in \$@
3184 do
3185   $rm -f \$f
3186   cp $targetdir/\$f . || exit 1
3187 done
3188 exit 0
3189 EOF
3190             ;;
3191         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3192             exit 1
3193             ;;
3194         esac
3195         if $test ! -f $run; then
3196             echo "Target 'run' script '$run' not found." >&4
3197         else
3198             $chmod a+rx $run
3199         fi
3200         if $test ! -f $to; then
3201             echo "Target 'to' script '$to' not found." >&4
3202         else
3203             $chmod a+rx $to
3204         fi
3205         if $test ! -f $from; then
3206             echo "Target 'from' script '$from' not found." >&4
3207         else
3208             $chmod a+rx $from
3209         fi
3210         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3211             exit 1
3212         fi
3213         cat >&4 <<EOF
3214 Using '$run' for remote execution,
3215 and '$from' and '$to'
3216 for remote file transfer.
3217 EOF
3218         ;;
3219 *)      run=''
3220         to=:
3221         from=:
3222         usecrosscompile="$undef"
3223         targetarch=''
3224         ;;
3225 esac
3226
3227 : see whether [:lower:] and [:upper:] are supported character classes
3228 echo " "
3229 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3230 ABYZ-abyz)
3231         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3232         up='[:upper:]'
3233         low='[:lower:]'
3234         ;;
3235 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3236         # (0xd9 and 0xe2), therefore that is a nice testing point.
3237         if test "X$up" = X -o "X$low" = X; then
3238             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3239             rs) up='[A-Z]'
3240                 low='[a-z]'
3241                 ;;
3242             esac
3243         fi
3244         if test "X$up" = X -o "X$low" = X; then
3245             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3246             rs) up='A-Z'
3247                 low='a-z'
3248                 ;;
3249             esac
3250         fi
3251         if test "X$up" = X -o "X$low" = X; then
3252             case "`echo RS | od -x 2>/dev/null`" in
3253             *D9E2*|*d9e2*)
3254                 echo "Hey, this might be EBCDIC." >&4
3255                 if test "X$up" = X -o "X$low" = X; then
3256                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3257                     rs) up='[A-IJ-RS-Z]'
3258                         low='[a-ij-rs-z]'
3259                         ;;
3260                     esac
3261                 fi
3262                 if test "X$up" = X -o "X$low" = X; then
3263                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3264                     rs) up='A-IJ-RS-Z'
3265                         low='a-ij-rs-z'
3266                         ;;
3267                     esac
3268                 fi
3269                 ;;
3270             esac
3271         fi
3272 esac
3273 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3274 rs)
3275     echo "Using $up and $low to convert case." >&4
3276     ;;
3277 *)
3278     echo "I don't know how to translate letters from upper to lower case." >&4
3279     echo "Your tr is not acting any way I know of." >&4
3280     exit 1
3281     ;;
3282 esac
3283 : set up the translation script tr, must be called with ./tr of course
3284 cat >tr <<EOSC
3285 $startsh
3286 case "\$1\$2" in
3287 '[A-Z][a-z]') exec $tr '$up' '$low';;
3288 '[a-z][A-Z]') exec $tr '$low' '$up';;
3289 esac
3290 exec $tr "\$@"
3291 EOSC
3292 chmod +x tr
3293 $eunicefix tr
3294
3295 : Try to determine whether config.sh was made on this system
3296 case "$config_sh" in
3297 '')
3298 myuname=`$uname -a 2>/dev/null`
3299 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3300 # Downcase everything to avoid ambiguity.
3301 # Remove slashes and single quotes so we can use parts of this in
3302 # directory and file names.
3303 # Remove newlines so myuname is sane to use elsewhere.
3304 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3305 # because the A-Z/a-z are not consecutive.
3306 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3307         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3308 newmyuname="$myuname"
3309 dflt=n
3310 case "$knowitall" in
3311 '')
3312         if test -f ../config.sh; then
3313                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3314                         eval "`grep myuname= ../config.sh`"
3315                 fi
3316                 if test "X$myuname" = "X$newmyuname"; then
3317                         dflt=y
3318                 fi
3319         fi
3320         ;;
3321 *) dflt=y;;
3322 esac
3323
3324 : Get old answers from old config file if Configure was run on the
3325 : same system, otherwise use the hints.
3326 hint=default
3327 cd ..
3328 if test -f config.sh; then
3329         echo " "
3330         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3331         . UU/myread
3332         case "$ans" in
3333         n*|N*) echo "OK, I'll ignore it."
3334                 mv config.sh config.sh.old
3335                 myuname="$newmyuname"
3336                 ;;
3337         *)  echo "Fetching default answers from your old config.sh file..." >&4
3338                 tmp_n="$n"
3339                 tmp_c="$c"
3340                 tmp_sh="$sh"
3341                 . ./config.sh
3342                 cp config.sh UU
3343                 n="$tmp_n"
3344                 c="$tmp_c"
3345                 : Older versions did not always set $sh.  Catch re-use of such
3346                 : an old config.sh.
3347                 case "$sh" in
3348                 '') sh="$tmp_sh" ;;
3349                 esac
3350                 hint=previous
3351                 ;;
3352         esac
3353 fi
3354 . ./UU/checkcc
3355 if test ! -f config.sh; then
3356         $cat <<EOM
3357
3358 First time through, eh?  I have some defaults handy for some systems
3359 that need some extra help getting the Configure answers right:
3360
3361 EOM
3362         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3363         dflt=''
3364         : Half the following guesses are probably wrong... If you have better
3365         : tests or hints, please send them to perlbug@perl.org
3366         : The metaconfig authors would also appreciate a copy...
3367         $test -f /irix && osname=irix
3368         $test -f /xenix && osname=sco_xenix
3369         $test -f /dynix && osname=dynix
3370         $test -f /dnix && osname=dnix
3371         $test -f /lynx.os && osname=lynxos
3372         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3373         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3374         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3375         $test -f /bin/mips && /bin/mips && osname=mips
3376         $test -d /usr/apollo/bin && osname=apollo
3377         $test -f /etc/saf/_sactab && osname=svr4
3378         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3379         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3380         $test -f /sys/utilities/MultiView && osname=amigaos
3381         if $test -d /MachTen -o -d /MachTen_Folder; then
3382                 osname=machten
3383                 if $test -x /sbin/version; then
3384                         osvers=`/sbin/version | $awk '{print $2}' |
3385                         $sed -e 's/[A-Za-z]$//'`
3386                 elif $test -x /usr/etc/version; then
3387                         osvers=`/usr/etc/version | $awk '{print $2}' |
3388                         $sed -e 's/[A-Za-z]$//'`
3389                 else
3390                         osvers="$2.$3"
3391                 fi
3392         fi
3393
3394         $test -f /sys/posix.dll &&
3395                 $test -f /usr/bin/what &&
3396                 set X `/usr/bin/what /sys/posix.dll` &&
3397                 $test "$3" = UWIN &&
3398                 osname=uwin &&
3399                 osvers="$5"
3400
3401         if $test -f $uname; then
3402                 set X $myuname
3403                 shift
3404
3405                 case "$5" in
3406                 fps*) osname=fps ;;
3407                 mips*)
3408                         case "$4" in
3409                         umips) osname=umips ;;
3410                         *) osname=mips ;;
3411                         esac;;
3412                 [23]100) osname=mips ;;
3413                 i386*)
3414                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3415                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3416                                 osname='sco'
3417                                 osvers=$tmp
3418                         elif $test -f /etc/kconfig; then
3419                                 osname=isc
3420                                 if test "$lns" = "$ln -s"; then
3421                                         osvers=4
3422                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3423                                         osvers=3
3424                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3425                                         osvers=2
3426                                 fi
3427                         fi
3428                         tmp=''
3429                         ;;
3430                 pc*)
3431                         if test -n "$DJGPP"; then
3432                                 osname=dos
3433                                 osvers=djgpp
3434                         fi
3435                         ;;
3436                 esac
3437
3438                 case "$1" in
3439                 aix) osname=aix
3440                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3441                         case "$tmp" in
3442                         # oslevel can fail with:
3443                         # oslevel: Unable to acquire lock.
3444                         *not\ found) osvers="$4"."$3" ;;
3445                         '<3240'|'<>3240') osvers=3.2.0 ;;
3446                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3447                         '=3250'|'>3250') osvers=3.2.5 ;;
3448                         *) osvers=$tmp;;
3449                         esac
3450                         ;;
3451                 bitrig) osname=bitrig
3452                         osvers="$3"
3453                         ;;
3454                 bsd386) osname=bsd386
3455                         osvers=`$uname -r`
3456                         ;;
3457                 cygwin*) osname=cygwin
3458                         osvers="$3"
3459                         ;;
3460                 *dc.osx) osname=dcosx
3461                         osvers="$3"
3462                         ;;
3463                 dnix) osname=dnix
3464                         osvers="$3"
3465                         ;;
3466                 domainos) osname=apollo
3467                         osvers="$3"
3468                         ;;
3469                 dgux)   osname=dgux
3470                         osvers="$3"
3471                         ;;
3472                 dragonfly) osname=dragonfly
3473                         osvers="$3"
3474                         ;;
3475                 dynixptx*) osname=dynixptx
3476                         osvers=`echo "$4"|sed 's/^v//'`
3477                         ;;
3478                 freebsd) osname=freebsd
3479                         osvers="$3" ;;
3480                 genix)  osname=genix ;;
3481                 gnu)    osname=gnu
3482                         osvers="$3" ;;
3483                 hp*)    osname=hpux
3484                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3485                         ;;
3486                 irix*)  osname=irix
3487                         case "$3" in
3488                         4*) osvers=4 ;;
3489                         5*) osvers=5 ;;
3490                         *)      osvers="$3" ;;
3491                         esac
3492                         ;;
3493                 linux)  osname=linux
3494                         case "$3" in
3495                         *)      osvers="$3" ;;
3496                         esac
3497                         $test -f /system/lib/libandroid.so && osname=linux-android
3498                         ;;
3499                 MiNT)   osname=mint
3500                         ;;
3501                 netbsd*) osname=netbsd
3502                         osvers="$3"
3503                         ;;
3504                 news-os) osvers="$3"
3505                         case "$3" in
3506                         4*) osname=newsos4 ;;
3507                         *) osname=newsos ;;
3508                         esac
3509                         ;;
3510                 nonstop-ux) osname=nonstopux ;;
3511                 openbsd) osname=openbsd
3512                         osvers="$3"
3513                         ;;
3514                 os2)    osname=os2
3515                         osvers="$4"
3516                         ;;
3517                 POSIX-BC | posix-bc ) osname=posix-bc
3518                         osvers="$3"
3519                         ;;
3520                 powerux | power_ux | powermax_os | powermaxos | \
3521                 powerunix | power_unix) osname=powerux
3522                         osvers="$3"
3523                         ;;
3524                 qnx) osname=qnx
3525                         osvers="$4"
3526                         ;;
3527                 solaris) osname=solaris
3528                         case "$3" in
3529                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3530                         *)      osvers="$3" ;;
3531                         esac
3532                         ;;
3533                 sunos) osname=sunos
3534                         case "$3" in
3535                         5*) osname=solaris
3536                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3537                         *)      osvers="$3" ;;
3538                         esac
3539                         ;;
3540                 titanos) osname=titanos
3541                         case "$3" in
3542                         1*) osvers=1 ;;
3543                         2*) osvers=2 ;;
3544                         3*) osvers=3 ;;
3545                         4*) osvers=4 ;;
3546                         *)      osvers="$3" ;;
3547                         esac
3548                         ;;
3549                 ultrix) osname=ultrix
3550                         osvers="$3"
3551                         ;;
3552                 osf1|mls+)      case "$5" in
3553                                 alpha)
3554                                         osname=dec_osf
3555                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3556                                         case "$osvers" in
3557                                         [1-9].[0-9]*) ;;
3558                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3559                                         esac
3560                                         ;;
3561                         hp*)    osname=hp_osf1  ;;
3562                         mips)   osname=mips_osf1 ;;
3563                         esac
3564                         ;;
3565                 # UnixWare 7.1.2 is known as Open UNIX 8
3566                 openunix|unixware) osname=svr5
3567                         osvers="$4"
3568                         ;;
3569                 uts)    osname=uts
3570                         osvers="$3"
3571                         ;;
3572                 vos) osvers="$3"
3573                         ;;
3574                 $2) case "$osname" in
3575                         *isc*) ;;
3576                         *freebsd*) ;;
3577                         svr*)
3578                                 : svr4.x or possibly later
3579                                 case "svr$3" in
3580                                 ${osname}*)
3581                                         osname=svr$3
3582                                         osvers=$4
3583                                         ;;
3584                                 esac
3585                                 case "$osname" in
3586                                 svr4.0)
3587                                         : Check for ESIX
3588                                         if test -f /stand/boot ; then
3589                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3590                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3591                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3592                                                         if test -n "$isesix"; then
3593                                                                 osname=esix4
3594                                                         fi
3595                                                 fi
3596                                         fi
3597                                         ;;
3598                                 esac
3599                                 ;;
3600                         *)      if test -f /etc/systemid; then
3601                                         osname=sco
3602                                         set `echo $3 | $sed 's/\./ /g'` $4
3603                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3604                                                 osvers=$1.$2.$3
3605                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3606                                                 osvers=$1.$2
3607                                         elif $test -f $src/hints/sco_$1.sh; then
3608                                                 osvers=$1
3609                                         fi
3610                                 else
3611                                         case "$osname" in
3612                                         '') : Still unknown.  Probably a generic Sys V.
3613                                                 osname="sysv"
3614                                                 osvers="$3"
3615                                                 ;;
3616                                         esac
3617                                 fi
3618                                 ;;
3619                         esac
3620                         ;;
3621                 *)      case "$osname" in
3622                         '') : Still unknown.  Probably a generic BSD.
3623                                 osname="$1"
3624                                 osvers="$3"
3625                                 ;;
3626                         esac
3627                         ;;
3628                 esac
3629         else
3630                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3631                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3632                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3633                                 osname=news_os
3634                         fi
3635                         $rm -f UU/kernel.what
3636                 elif test -d c:/. -o -n "$is_os2" ; then
3637                         set X $myuname
3638                         osname=os2
3639                         osvers="$5"
3640                 fi
3641         fi
3642
3643         case "$targetarch" in
3644         '') ;;
3645         *)  hostarch=$osname
3646             case "$targetarch" in
3647                 nto*|*-nto-*)
3648                     # Will load qnx.sh, which should change osname to nto
3649                     osname=qnx
3650                     osvers=''
3651                     ;;
3652                 *linux-android*)
3653                     # Catch arm-linux-androideabi, mipsel-linux-android,
3654                     # and i686-linux-android
3655                     osname=linux-android
3656                     osvers=''
3657                     ;;
3658                 *linux*)
3659                     # Something like arm-linux-gnueabihf is really just
3660                     # plain linux.
3661                     osname=linux
3662                     osvers=''
3663                     ;;
3664                 *solaris*|*sunos*)
3665                     osname=solaris
3666                     # XXX perhaps we should just assume
3667                     # osvers to be 2, or maybe take the value
3668                     # from targetarch. Using $run before the
3669                     # hints are run is somewhat icky.
3670                     set X `$run $uname -a 2>/dev/null`
3671                     shift
3672                     case "$3" in
3673                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3674                         *)  osvers="$3" ;;
3675                     esac
3676                     ;;
3677                 *)
3678                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3679                     osvers=''
3680                 ;;
3681             esac
3682             ;;
3683         esac
3684
3685         : Now look for a hint file osname_osvers, unless one has been
3686         : specified already.
3687         case "$hintfile" in
3688         ''|' ')
3689                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3690                 : Also try without trailing minor version numbers.
3691                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3692                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3693                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3694                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3695                 case "$file" in
3696                 '') dflt=none ;;
3697                 *)  case "$osvers" in
3698                         '') dflt=$file
3699                                 ;;
3700                         *)  if $test -f $src/hints/$file.sh ; then
3701                                         dflt=$file
3702                                 elif $test -f $src/hints/$xfile.sh ; then
3703                                         dflt=$xfile
3704                                 elif $test -f $src/hints/$xxfile.sh ; then
3705                                         dflt=$xxfile
3706                                 elif $test -f $src/hints/$xxxfile.sh ; then
3707                                         dflt=$xxxfile
3708                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3709                                         dflt=$xxxxfile
3710                                 elif $test -f "$src/hints/${osname}.sh" ; then
3711                                         dflt="${osname}"
3712                                 else
3713                                         dflt=none
3714                                 fi
3715                                 ;;
3716                         esac
3717                         ;;
3718                 esac
3719                 if $test -f Policy.sh ; then
3720                         case "$dflt" in
3721                         *Policy*) ;;
3722                         none) dflt="Policy" ;;
3723                         *) dflt="Policy $dflt" ;;
3724                         esac
3725                 fi
3726                 ;;
3727         *)
3728                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3729                 ;;
3730         esac
3731
3732         if $test -f Policy.sh ; then
3733                 $cat <<EOM
3734
3735 There's also a Policy hint file available, which should make the
3736 site-specific (policy) questions easier to answer.
3737 EOM
3738
3739         fi
3740
3741         $cat <<EOM
3742
3743 You may give one or more space-separated answers, or "none" if appropriate.
3744 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3745 previous run of Configure, you may specify it as well as or instead of
3746 OS-specific hints.  If hints are provided for your OS, you should use them:
3747 although Perl can probably be built without hints on many platforms, using
3748 hints often improve performance and may enable features that Configure can't
3749 set up on its own. If there are no hints that match your OS, specify "none";
3750 DO NOT give a wrong version or a wrong OS.
3751
3752 EOM
3753
3754         rp="Which of these apply, if any?"
3755         . UU/myread
3756         tans=$ans
3757         for file in $tans; do
3758                 if $test X$file = XPolicy -a -f Policy.sh; then
3759                         . Policy.sh
3760                         $cat Policy.sh >> UU/config.sh
3761                 elif $test -f $src/hints/$file.sh; then
3762                         . $src/hints/$file.sh
3763                         $cat $src/hints/$file.sh >> UU/config.sh
3764                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3765                         : nothing
3766                 else
3767                         : Give one chance to correct a possible typo.
3768                         echo "$file.sh does not exist"
3769                         dflt=$file
3770                         rp="hint to use instead?"
3771                         . UU/myread
3772                         for file in $ans; do
3773                                 if $test -f "$src/hints/$file.sh"; then
3774                                         . $src/hints/$file.sh
3775                                         $cat $src/hints/$file.sh >> UU/config.sh
3776                                 elif $test X$ans = X -o X$ans = Xnone ; then
3777                                         : nothing
3778                                 else
3779                                         echo "$file.sh does not exist -- ignored."
3780                                 fi
3781                         done
3782                 fi
3783         done
3784
3785         hint=recommended
3786         : Remember our hint file for later.
3787         if $test -f "$src/hints/$file.sh" ; then
3788                 hintfile="$file"
3789         else
3790                 hintfile=''
3791         fi
3792 fi
3793 cd UU
3794 ;;
3795 *)
3796         echo " "
3797         echo "Fetching default answers from $config_sh..." >&4
3798         tmp_n="$n"
3799         tmp_c="$c"
3800         cd ..
3801         cp $config_sh config.sh 2>/dev/null
3802         chmod +w config.sh
3803         . ./config.sh
3804         cd UU
3805         cp ../config.sh .
3806         n="$tmp_n"
3807         c="$tmp_c"
3808         hint=previous
3809         ;;
3810 esac
3811 . ./optdef.sh
3812
3813 : Restore computed paths
3814 for file in $loclist $trylist; do
3815         eval $file="\$_$file"
3816 done
3817
3818 cat << EOM
3819
3820 Configure uses the operating system name and version to set some defaults.
3821 The default value is probably right if the name rings a bell. Otherwise,
3822 since spelling matters for me, either accept the default or answer "none"
3823 to leave it blank.
3824
3825 EOM
3826 case "$osname" in
3827         ''|' ')
3828                 case "$hintfile" in
3829                 ''|' '|none) dflt=none ;;
3830                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3831                 esac
3832                 ;;
3833         *) dflt="$osname" ;;
3834 esac
3835 rp="Operating system name?"
3836 . ./myread
3837 case "$ans" in
3838 none)  osname='' ;;
3839 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3840 esac
3841 echo " "
3842 case "$osvers" in
3843         ''|' ')
3844                 case "$hintfile" in
3845                 ''|' '|none) dflt=none ;;
3846                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3847                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3848                         case "$dflt" in
3849                         ''|' ') dflt=none ;;
3850                         esac
3851                         ;;
3852                 esac
3853                 ;;
3854         *) dflt="$osvers" ;;
3855 esac
3856 rp="Operating system version?"
3857 . ./myread
3858 case "$ans" in
3859 none)  osvers='' ;;
3860 *) osvers="$ans" ;;
3861 esac
3862
3863
3864 . ./posthint.sh
3865
3866 : who configured the system
3867 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3868 case "$cf_by" in
3869 "")
3870         cf_by=`(logname) 2>/dev/null`
3871         case "$cf_by" in
3872         "")
3873                 cf_by=`(whoami) 2>/dev/null`
3874                 case "$cf_by" in
3875                 "") cf_by=unknown ;;
3876                 esac ;;
3877         esac ;;
3878 esac
3879
3880 : decide how portable to be.  Allow command line overrides.
3881 case "$d_portable" in
3882 "$undef") ;;
3883 *)      d_portable="$define" ;;
3884 esac
3885
3886 : set up shell script to do ~ expansion
3887 cat >filexp <<EOSS
3888 $startsh
3889 : expand filename
3890 case "\$1" in
3891  \~/*|\~)
3892         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3893         ;;
3894  \~*)
3895         if $test -f /bin/csh; then
3896                 /bin/csh -f -c "glob \$1"
3897                 failed=\$?
3898                 echo ""
3899                 exit \$failed
3900         else
3901                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3902                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3903                 if $test ! -d "\$dir"; then
3904                         me=\`basename \$0\`
3905                         echo "\$me: can't locate home directory for: \$name" >&2
3906                         exit 1
3907                 fi
3908                 case "\$1" in
3909                 */*)
3910                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3911                         ;;
3912                 *)
3913                         echo \$dir
3914                         ;;
3915                 esac
3916         fi
3917         ;;
3918 *)
3919         echo \$1
3920         ;;
3921 esac
3922 EOSS
3923 chmod +x filexp
3924 $eunicefix filexp
3925
3926 : now set up to get a file name
3927 cat <<EOS >getfile
3928 $startsh
3929 EOS
3930 cat <<'EOSC' >>getfile
3931 tilde=''
3932 fullpath=''
3933 already=''
3934 skip=''
3935 none_ok=''
3936 exp_file=''
3937 nopath_ok=''
3938 orig_rp="$rp"
3939 orig_dflt="$dflt"
3940 case "$gfpth" in
3941 '') gfpth='.' ;;
3942 esac
3943
3944 case "$fn" in
3945 *\(*)
3946         : getfile will accept an answer from the comma-separated list
3947         : enclosed in parentheses even if it does not meet other criteria.
3948         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3949         fn=`echo $fn | sed 's/(.*)//'`
3950         ;;
3951 esac
3952
3953 case "$fn" in
3954 *:*)
3955         loc_file=`expr $fn : '.*:\(.*\)'`
3956         fn=`expr $fn : '\(.*\):.*'`
3957         ;;
3958 esac
3959
3960 case "$fn" in
3961 *~*) tilde=true;;
3962 esac
3963 case "$fn" in
3964 */*) fullpath=true;;
3965 esac
3966 case "$fn" in
3967 *+*) skip=true;;
3968 esac
3969 case "$fn" in
3970 *n*) none_ok=true;;
3971 esac
3972 case "$fn" in
3973 *e*) exp_file=true;;
3974 esac
3975 case "$fn" in
3976 *p*) nopath_ok=true;;
3977 esac
3978
3979 case "$fn" in
3980 *f*) type='File';;
3981 *d*) type='Directory';;
3982 *l*) type='Locate';;
3983 esac
3984
3985 what="$type"
3986 case "$what" in
3987 Locate) what='File';;
3988 esac
3989
3990 case "$exp_file" in
3991 '')
3992         case "$d_portable" in
3993         "$define") ;;
3994         *) exp_file=true;;
3995         esac
3996         ;;
3997 esac
3998
3999 cd ..
4000 while test "$type"; do
4001         redo=''
4002         rp="$orig_rp"
4003         dflt="$orig_dflt"
4004         case "$tilde" in
4005         true) rp="$rp (~name ok)";;
4006         esac
4007         . UU/myread
4008         if test -f UU/getfile.ok && \
4009                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4010         then
4011                 value="$ans"
4012                 ansexp="$ans"
4013                 break
4014         fi
4015         case "$ans" in
4016         none)
4017                 value=''
4018                 ansexp=''
4019                 case "$none_ok" in
4020                 true) type='';;
4021                 esac
4022                 ;;
4023         *)
4024                 case "$tilde" in
4025                 '') value="$ans"
4026                         ansexp="$ans";;
4027                 *)
4028                         value=`UU/filexp $ans`
4029                         case $? in
4030                         0)
4031                                 if test "$ans" != "$value"; then
4032                                         echo "(That expands to $value on this system.)"
4033                                 fi
4034                                 ;;
4035                         *) value="$ans";;
4036                         esac
4037                         ansexp="$value"
4038                         case "$exp_file" in
4039                         '') value="$ans";;
4040                         esac
4041                         ;;
4042                 esac
4043                 case "$fullpath" in
4044                 true)
4045                         case "$ansexp" in
4046                         /*) value="$ansexp" ;;
4047                         [a-zA-Z]:/*) value="$ansexp" ;;
4048                         *)
4049                                 redo=true
4050                                 case "$already" in
4051                                 true)
4052                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4053                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4054                                         ;;
4055                                 *)
4056                                 echo "Please give a full path name, starting with slash." >&4
4057                                         case "$tilde" in
4058                                         true)
4059                                 echo "Note that using ~name is ok provided it expands well." >&4
4060                                                 already=true
4061                                                 ;;
4062                                         esac
4063                                 esac
4064                                 ;;
4065                         esac
4066                         ;;
4067                 esac
4068                 case "$redo" in
4069                 '')
4070                         case "$type" in
4071                         File)
4072                                 for fp in $gfpth; do
4073                                         if test "X$fp" = X.; then
4074                                             pf="$ansexp"
4075                                         else    
4076                                             pf="$fp/$ansexp"
4077                                         fi
4078                                         if test -f "$pf"; then
4079                                                 type=''
4080                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4081                                         then
4082                                                 echo "($value is not a plain file, but that's ok.)"
4083                                                 type=''
4084                                         fi
4085                                         if test X"$type" = X; then
4086                                             value="$pf"
4087                                             break
4088                                         fi
4089                                 done
4090                                 ;;
4091                         Directory)
4092                                 for fp in $gfpth; do
4093                                         if test "X$fp" = X.; then
4094                                             dir="$ans"
4095                                             direxp="$ansexp"
4096                                         else    
4097                                             dir="$fp/$ansexp"
4098                                             direxp="$fp/$ansexp"
4099                                         fi
4100                                         if test -d "$direxp"; then
4101                                                 type=''
4102                                                 value="$dir"
4103                                                 break
4104                                         fi
4105                                 done
4106                                 ;;
4107                         Locate)
4108                                 if test -d "$ansexp"; then
4109                                         echo "(Looking for $loc_file in directory $value.)"
4110                                         value="$value/$loc_file"
4111                                         ansexp="$ansexp/$loc_file"
4112                                 fi
4113                                 if test -f "$ansexp"; then
4114                                         type=''
4115                                 fi
4116                                 case "$nopath_ok" in
4117                                 true)   case "$value" in
4118                                         */*) ;;
4119                                         *)      echo "Assuming $value will be in people's path."
4120                                                 type=''
4121                                                 ;;
4122                                         esac
4123                                         ;;
4124                                 esac
4125                                 ;;
4126                         esac
4127
4128                         case "$skip" in
4129                         true) type='';
4130                         esac
4131
4132                         case "$type" in
4133                         '') ;;
4134                         *)
4135                                 if test "$fastread" = yes; then
4136                                         dflt=y
4137                                 else
4138                                         dflt=n
4139                                 fi
4140                                 rp="$what $value doesn't exist.  Use that name anyway?"
4141                                 . UU/myread
4142                                 dflt=''
4143                                 case "$ans" in
4144                                 y*) type='';;
4145                                 *) echo " ";;
4146                                 esac
4147                                 ;;
4148                         esac
4149                         ;;
4150                 esac
4151                 ;;
4152         esac
4153 done
4154 cd UU
4155 ans="$value"
4156 rp="$orig_rp"
4157 dflt="$orig_dflt"
4158 rm -f getfile.ok
4159 test "X$gfpthkeep" != Xy && gfpth=""
4160 EOSC
4161
4162 : determine root of directory hierarchy where package will be installed.
4163 case "$prefix" in
4164 '')
4165         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4166         ;;
4167 *?/)
4168         dflt=`echo "$prefix" | sed 's/.$//'`
4169         ;;
4170 *)
4171         dflt="$prefix"
4172         ;;
4173 esac
4174 $cat <<EOM
4175
4176 By default, $package will be installed in $dflt/bin, manual pages
4177 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4178 installation directories. Typically this is something like /usr/local.
4179 If you wish to have binaries under /usr/bin but other parts of the
4180 installation under /usr/local, that's ok: you will be prompted
4181 separately for each of the installation directories, the prefix being
4182 only used to set the defaults.
4183
4184 EOM
4185 fn=d~
4186 rp='Installation prefix to use?'
4187 . ./getfile
4188 oldprefix=''
4189 case "$prefix" in
4190 '') ;;
4191 *)
4192         case "$ans" in
4193         "$prefix") ;;
4194         *) oldprefix="$prefix";;
4195         esac
4196         ;;
4197 esac
4198 prefix="$ans"
4199 prefixexp="$ansexp"
4200
4201 : allow them to override the AFS root
4202 case "$afsroot" in
4203 '')     afsroot=/afs ;;
4204 *)      afsroot=$afsroot ;;
4205 esac
4206
4207 : is AFS running?
4208 echo " "
4209 case "$afs" in
4210 $define|true)   afs=true ;;
4211 $undef|false)   afs=false ;;
4212 *)      if $test -d $afsroot; then
4213                 afs=true
4214         else
4215                 afs=false
4216         fi
4217         ;;
4218 esac
4219 if $afs; then
4220         echo "AFS may be running... I'll be extra cautious then..." >&4
4221 else
4222         echo "AFS does not seem to be running..." >&4
4223 fi
4224
4225 : determine installation prefix for where package is to be installed.
4226 if $afs; then
4227 $cat <<EOM
4228
4229 Since you are running AFS, I need to distinguish the directory in which
4230 files will reside from the directory in which they are installed (and from
4231 which they are presumably copied to the former directory by occult means).
4232
4233 EOM
4234         case "$installprefix" in
4235         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4236         *) dflt="$installprefix";;
4237         esac
4238 else
4239 $cat <<EOM
4240
4241 In some special cases, particularly when building $package for distribution,
4242 it is convenient to distinguish the directory in which files should be
4243 installed from the directory ($prefix) in which they will
4244 eventually reside.  For most users, these two directories are the same.
4245
4246 EOM
4247         case "$installprefix" in
4248         '') dflt=$prefix ;;
4249         *) dflt=$installprefix;;
4250         esac
4251 fi
4252 fn=d~
4253 rp='What installation prefix should I use for installing files?'
4254 . ./getfile
4255 installprefix="$ans"
4256 installprefixexp="$ansexp"
4257
4258 : Perform the prefixexp/installprefixexp correction if necessary
4259 cat <<EOS >installprefix
4260 $startsh
4261 EOS
4262 cat <<'EOSC' >>installprefix
4263 : Change installation prefix, if necessary.
4264 if $test X"$prefix" != X"$installprefix"; then
4265     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4266 else
4267     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4268 fi
4269 EOSC
4270 chmod +x installprefix
4271 $eunicefix installprefix
4272
4273 : Set variables such as privlib and privlibexp from the output of ./getfile
4274 : performing the prefixexp/installprefixexp correction if necessary.
4275 cat <<EOS >setprefixvar
4276 $startsh
4277 EOS
4278 cat <<'EOSC' >>setprefixvar
4279 eval "${prefixvar}=\"\$ans\""
4280 eval "${prefixvar}exp=\"\$ansexp\""
4281 . ./installprefix
4282 EOSC
4283 chmod +x setprefixvar
4284 $eunicefix setprefixvar
4285
4286 : set up the script used to warn in case of inconsistency
4287 cat <<EOS >whoa
4288 $startsh
4289 EOS
4290 cat <<'EOSC' >>whoa
4291 dflt=y
4292 case "$hint" in
4293     recommended)
4294         case "$hintfile" in
4295         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4296                 ;;
4297         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4298                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4299                 ;;
4300         esac
4301         ;;
4302     *)  echo " "
4303         echo "*** WHOA THERE!!! ***" >&4
4304         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4305         ;;
4306 esac
4307 rp="    Keep the $hint value?"
4308 . ./myread
4309 case "$ans" in
4310 y) td=$was; tu=$was;;
4311 esac
4312 EOSC
4313
4314 : function used to set '$1' to '$val'
4315 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4316 case "$val$was" in
4317 $define$undef) . ./whoa; eval "$var=\$td";;
4318 $undef$define) . ./whoa; eval "$var=\$tu";;
4319 *) eval "$var=$val";;
4320 esac'
4321
4322 : get the patchlevel
4323 echo " "
4324 echo "Getting the current patchlevel..." >&4
4325 if $test -r $rsrc/patchlevel.h;then
4326         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4327         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4328         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4329         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4330         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4331         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4332         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4333 else
4334         revision=0
4335         patchlevel=0
4336         subversion=0
4337         api_revision=0
4338         api_version=0
4339         api_subversion=0
4340         perl_patchlevel=0
4341         $echo "(You do not have patchlevel.h.  Eek.)"
4342 fi
4343 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4344 version_patchlevel_string="version $patchlevel subversion $subversion"
4345 case "$perl_patchlevel" in
4346 0|'') ;;
4347 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4348     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4349     ;;
4350 esac
4351
4352 $echo "(You have $package $version_patchlevel_string.)"
4353
4354 case "$osname" in
4355 dos|vms)
4356         : XXX Should be a Configure test for double-dots in filenames.
4357         version=`echo $revision $patchlevel $subversion | \
4358                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4359         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4360                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4361         ;;
4362 *)
4363         version=`echo $revision $patchlevel $subversion | \
4364                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4365         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4366                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4367         ;;
4368 esac
4369 : Special case the 5.005_xx maintenance series, which used 5.005
4370 : without any subversion label as a subdirectory in $sitelib
4371 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4372         api_versionstring='5.005'
4373 fi
4374
4375 : Do we want threads support and if so, what type
4376 case "$usethreads" in
4377 $define|true|[yY]*)     dflt='y';;
4378 *)     # Catch case where user specified ithreads or 5005threads but
4379        # forgot -Dusethreads (A.D. 4/2002)
4380        case "$useithreads$use5005threads" in
4381        *$define*)       dflt='y';;
4382        *)               dflt='n';;
4383        esac
4384        ;;
4385 esac
4386 cat <<EOM
4387
4388 Perl can be built to offer a form of threading support on some systems
4389 To do so, Configure can be run with -Dusethreads.
4390
4391 Note that Perl built with threading support runs slightly slower
4392 and uses slightly more memory than plain Perl.
4393
4394 If this doesn't make any sense to you, just accept the default '$dflt'.
4395 EOM
4396 rp='Build a threading Perl?'
4397 . ./myread
4398 case "$ans" in
4399 y|Y)    val="$define" ;;
4400 *)      val="$undef" ;;
4401 esac
4402 set usethreads
4403 eval $setvar
4404
4405 if $test $patchlevel -lt 9; then
4406     case "$usethreads" in
4407     $define)
4408         : Default to ithreads unless overridden on command line or with
4409         : old config.sh
4410         dflt='y'
4411         case "$use5005threads" in
4412                 $define|true|[yY]*)
4413                         echo "5.005 threads are no longer supported"
4414                         exit 1
4415                 ;;
4416         esac
4417         case "$useithreads" in
4418                 $undef|false|[nN]*) dflt='n';;
4419         esac
4420         rp='Use the newer interpreter-based ithreads?'
4421         . ./myread
4422         case "$ans" in
4423         y|Y)    val="$define" ;;
4424         *)      val="$undef" ;;
4425         esac
4426         set useithreads
4427         eval $setvar
4428         : Now set use5005threads to the opposite value.
4429         case "$useithreads" in
4430         $define) val="$undef" ;;
4431         *) val="$define" ;;
4432         esac
4433         set use5005threads
4434         eval $setvar
4435         ;;
4436     *)
4437         useithreads="$undef"
4438         use5005threads="$undef"
4439         ;;
4440     esac
4441
4442     case "$useithreads$use5005threads" in
4443     "$define$define")
4444         $cat >&4 <<EOM
4445
4446 You cannot have both the ithreads and the 5.005 threads enabled
4447 at the same time.  Disabling the 5.005 threads since they are
4448 much less stable than the ithreads.
4449
4450 EOM
4451         use5005threads="$undef"
4452         ;;
4453     esac
4454
4455 else
4456 : perl-5.9.x and later
4457
4458     if test X"$usethreads" = "X$define"; then
4459         case "$use5005threads" in
4460             $define|true|[yY]*)
4461                 $cat >&4 <<EOM
4462
4463 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4464
4465 EOM
4466             ;;
4467         esac
4468     fi
4469
4470     use5005threads="$undef"
4471     useithreads="$usethreads"
4472 fi
4473
4474 case "$d_oldpthreads" in
4475 '')     : Configure tests would be welcome here.  For now, assume undef.
4476         val="$undef" ;;
4477 *)      val="$d_oldpthreads" ;;
4478 esac
4479 set d_oldpthreads
4480 eval $setvar
4481
4482
4483 : Look for a hint-file generated 'call-back-unit'.  If the
4484 : user has specified that a threading perl is to be built,
4485 : we may need to set or change some other defaults.
4486 if $test -f usethreads.cbu; then
4487     echo "Your platform has some specific hints regarding threaded builds, using them..."
4488     . ./usethreads.cbu
4489 else
4490     case "$usethreads" in
4491         "$define"|true|[yY]*)
4492                 $cat <<EOM
4493 (Your platform does not have any specific hints for threaded builds.
4494  Assuming POSIX threads, then.)
4495 EOM
4496         ;;
4497     esac
4498 fi
4499
4500 : Check if multiplicity is required
4501 cat <<EOM
4502
4503 Perl can be built so that multiple Perl interpreters can coexist
4504 within the same Perl executable.
4505 EOM
4506
4507 case "$useithreads" in
4508 $define)
4509         cat <<EOM
4510 This multiple interpreter support is required for interpreter-based threads.
4511 EOM
4512         val="$define"
4513         ;;
4514 *)      case "$usemultiplicity" in
4515         $define|true|[yY]*)     dflt='y';;
4516         *) dflt='n';;
4517         esac
4518         echo " "
4519         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4520         rp='Build Perl for multiplicity?'
4521         . ./myread
4522         case "$ans" in
4523         y|Y)    val="$define" ;;
4524         *)      val="$undef" ;;
4525         esac
4526         ;;
4527 esac
4528 set usemultiplicity
4529 eval $setvar
4530
4531 : Check if morebits is requested
4532 case "$usemorebits" in
4533 "$define"|true|[yY]*)
4534         use64bitint="$define"
4535         uselongdouble="$define"
4536         usemorebits="$define"
4537         ;;
4538 *)      usemorebits="$undef"
4539         ;;
4540 esac
4541
4542 : Determine the C compiler to be used
4543 echo " "
4544 case "$cc" in
4545 '') dflt=cc;;
4546 *) dflt="$cc";;
4547 esac
4548 rp="Use which C compiler?"
4549 . ./myread
4550 cc="$ans"
4551
4552 : See whether they have no cc but they do have gcc
4553 . ./trygcc
4554 if $test -f cc.cbu; then
4555     . ./cc.cbu
4556 fi
4557 . ./checkcc
4558
4559 : make some quick guesses about what we are up against
4560 echo " "
4561 $echo $n "Hmm...  $c"
4562 echo exit 1 >bsd
4563 echo exit 1 >usg
4564 echo exit 1 >v7
4565 echo exit 1 >osf1
4566 echo exit 1 >eunice
4567 echo exit 1 >xenix
4568 echo exit 1 >venix
4569 echo exit 1 >os2
4570 d_bsd="$undef"
4571 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4572 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4573 then
4574         echo "Looks kind of like an OSF/1 system, but we'll see..."
4575         echo exit 0 >osf1
4576 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4577         xxx=`./loc addbib blurfl $pth`
4578         if $test -f $xxx; then
4579         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4580                 echo exit 0 >bsd
4581                 echo exit 0 >usg
4582         else
4583                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4584                         echo "Looks kind of like an extended USG system, but we'll see..."
4585                 else
4586                         echo "Looks kind of like a USG system, but we'll see..."
4587                 fi
4588                 echo exit 0 >usg
4589         fi
4590 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4591         echo "Looks kind of like a BSD system, but we'll see..."
4592         d_bsd="$define"
4593         echo exit 0 >bsd
4594 else
4595         echo "Looks kind of like a Version 7 system, but we'll see..."
4596         echo exit 0 >v7
4597 fi
4598 case "$eunicefix" in
4599 *unixtovms*)
4600         $cat <<'EOI'
4601 There is, however, a strange, musty smell in the air that reminds me of
4602 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4603 EOI
4604         echo exit 0 >eunice
4605         d_eunice="$define"
4606 : it so happens the Eunice I know will not run shell scripts in Unix format
4607         ;;
4608 *)
4609         echo " "
4610         echo "Congratulations.  You aren't running Eunice."
4611         d_eunice="$undef"
4612         ;;
4613 esac
4614 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4615 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4616 : semicolon as a patch separator
4617 case "$p_" in
4618 :) ;;
4619 *)
4620         $cat <<'EOI'
4621 I have the feeling something is not exactly right, however...don't tell me...
4622 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4623 (Or you may be running DOS with DJGPP.)
4624 EOI
4625         echo exit 0 >os2
4626         ;;
4627 esac
4628 if test -f /xenix; then
4629         echo "Actually, this looks more like a XENIX system..."
4630         echo exit 0 >xenix
4631         d_xenix="$define"
4632 else
4633         echo " "
4634         echo "It's not Xenix..."
4635         d_xenix="$undef"
4636 fi
4637 chmod +x xenix
4638 $eunicefix xenix
4639 if test -f /venix; then
4640         echo "Actually, this looks more like a VENIX system..."
4641         echo exit 0 >venix
4642 else
4643         echo " "
4644         if ./xenix; then
4645                 : null
4646         else
4647                 echo "Nor is it Venix..."
4648         fi
4649 fi
4650 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4651 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4652 $rm -f foo
4653
4654 : Check if we are using GNU gcc and what its version is
4655 echo " "
4656 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4657 $cat >try.c <<EOM
4658 #include <stdio.h>
4659 int main() {
4660 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4661 #ifdef __VERSION__
4662         printf("%s\n", __VERSION__);
4663 #else
4664         printf("%s\n", "1");
4665 #endif
4666 #endif
4667         return(0);
4668 }
4669 EOM
4670 if $cc -o try $ccflags $ldflags try.c; then
4671         gccversion=`$run ./try`
4672         case "$gccversion" in
4673         '') echo "You are not using GNU cc." ;;
4674         *)  echo "You are using GNU cc $gccversion."
4675             ccname=gcc
4676             ;;
4677         esac
4678 else
4679         echo " "
4680         echo "*** WHOA THERE!!! ***" >&4
4681         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4682         case "$knowitall" in
4683         '')
4684         echo "    You'd better start hunting for one and let me know about it." >&4
4685                 exit 1
4686                 ;;
4687         esac
4688 fi
4689 $rm -f try try.*
4690 case "$gccversion" in
4691 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4692 esac
4693 case "$gccversion" in
4694 '') gccosandvers='' ;;
4695 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4696    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4697    gccshortvers=''
4698    case "$gccosandvers" in
4699    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4700    $osname$osvers) ;; # looking good
4701    $osname*) cat <<EOM >&4
4702
4703 *** WHOA THERE!!! ***
4704
4705     Your gcc has not been compiled for the exact release of
4706     your operating system ($gccosandvers versus $osname$osvers).
4707
4708     In general it is a good idea to keep gcc synchronized with
4709     the operating system because otherwise serious problems
4710     may ensue when trying to compile software, like Perl.
4711
4712     I'm trying to be optimistic here, though, and will continue.
4713     If later during the configuration and build icky compilation
4714     problems appear (headerfile conflicts being the most common
4715     manifestation), I suggest reinstalling the gcc to match
4716     your operating system release.
4717
4718 EOM
4719       ;;
4720    *) gccosandvers='' ;; # failed to parse, better be silent
4721    esac
4722    ;;
4723 esac
4724 case "$ccname" in
4725 '') ccname="$cc" ;;
4726 esac
4727
4728 # gcc 3.* complain about adding -Idirectories that they already know about,
4729 # so we will take those off from locincpth.
4730 case "$gccversion" in
4731 3*)
4732     echo "main(){}">try.c
4733     for incdir in $locincpth; do
4734        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4735              grep '^c[cp]p*[01]: warning: changing search order '`
4736        if test "X$warn" != X; then
4737            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4738        fi
4739     done
4740     $rm -f try try.*
4741 esac
4742
4743 # gcc 4.9 by default does some optimizations that break perl.
4744 # see ticket 121505.
4745 #
4746 # The -fwrapv disables those optimizations (and probably others,) so
4747 # for gcc 4.9 (and later, since the optimizations probably won't go
4748 # away), add -fwrapv unless the user requests -fno-wrapv, which
4749 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4750 # which turns the overflows -fwrapv ignores into runtime errors.
4751 case "$gccversion" in
4752 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4753     case "$ccflags" in
4754     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4755     *) ccflags="$ccflags -fwrapv" ;;
4756     esac
4757 esac
4758
4759 : What should the include directory be ?
4760 : Use sysroot if set, so findhdr looks in the right place.
4761 echo " "
4762 $echo $n "Hmm...  $c"
4763 dflt="$sysroot/usr/include"
4764 incpath=''
4765 mips_type=''
4766 if $test -f /bin/mips && /bin/mips; then
4767         echo "Looks like a MIPS system..."
4768         $cat >usr.c <<'EOCP'
4769 #ifdef SYSTYPE_BSD43
4770 /bsd43
4771 #endif
4772 EOCP
4773         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4774                 dflt='/bsd43/usr/include'
4775                 incpath='/bsd43'
4776                 mips_type='BSD 4.3'
4777         else
4778                 mips_type='System V'
4779         fi
4780         $rm -f usr.c usr.out
4781         echo "and you're compiling with the $mips_type compiler and libraries."
4782         xxx_prompt=y
4783         echo "exit 0" >mips
4784 else
4785         echo "Doesn't look like a MIPS system."
4786         xxx_prompt=n
4787         echo "exit 1" >mips
4788 fi
4789 chmod +x mips
4790 $eunicefix mips
4791 case "$usrinc" in
4792 '') ;;
4793 *) dflt="$usrinc";;
4794 esac
4795 case "$xxx_prompt" in
4796 y)      fn=d/
4797         echo " "
4798         rp='Where are the include files you want to use?'
4799         . ./getfile
4800         usrinc="$ans"
4801         ;;
4802 *)      usrinc="$dflt"
4803         ;;
4804 esac
4805
4806 : see how we invoke the C preprocessor
4807 echo " "
4808 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4809 cat <<'EOT' >testcpp.c
4810 #define ABC abc
4811 #define XYZ xyz
4812 ABC.XYZ
4813 EOT
4814 cd ..
4815 if test ! -f cppstdin; then
4816         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4817                 # AIX cc -E doesn't show the absolute headerfile
4818                 # locations but we'll cheat by using the -M flag.
4819                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4820         else
4821                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4822         fi
4823 else
4824         echo "Keeping your $hint cppstdin wrapper."
4825 fi
4826 chmod 755 cppstdin
4827 wrapper=`pwd`/cppstdin
4828 ok='false'
4829 cd UU
4830
4831 if $test "X$cppstdin" != "X" && \
4832         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4833         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4834 then
4835         echo "You used to use $cppstdin $cppminus so we'll use that again."
4836         case "$cpprun" in
4837         '') echo "But let's see if we can live without a wrapper..." ;;
4838         *)
4839                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4840                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4841                 then
4842                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4843                         ok='true'
4844                 else
4845                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4846                 fi
4847                 ;;
4848         esac
4849 else
4850         case "$cppstdin" in
4851         '') ;;
4852         *)
4853                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4854                 ;;
4855         esac
4856 fi
4857
4858 if $ok; then
4859         : nothing
4860 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4861         $cc -E <testcpp.c >testcpp.out 2>&1; \
4862         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4863         echo "Yup, it does."
4864         x_cpp="$cc $cppflags -E"
4865         x_minus='';
4866 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4867         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4868         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4869         echo "Yup, it does."
4870         x_cpp="$cc $cppflags -E"
4871         x_minus='-';
4872 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4873         $cc -P <testcpp.c >testcpp.out 2>&1; \
4874         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4875         echo "Yipee, that works!"
4876         x_cpp="$cc $cppflags -P"
4877         x_minus='';
4878 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4879         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4880         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4881         echo "At long last!"
4882         x_cpp="$cc $cppflags -P"
4883         x_minus='-';
4884 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4885         $cpp <testcpp.c >testcpp.out 2>&1; \
4886         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4887         echo "It works!"
4888         x_cpp="$cpp $cppflags"
4889         x_minus='';
4890 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4891         $cpp - <testcpp.c >testcpp.out 2>&1; \
4892         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4893         echo "Hooray, it works!  I was beginning to wonder."
4894         x_cpp="$cpp $cppflags"
4895         x_minus='-';
4896 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4897         $wrapper <testcpp.c >testcpp.out 2>&1; \
4898         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4899         x_cpp="$wrapper"
4900         x_minus=''
4901         echo "Eureka!"
4902 else
4903         dflt=''
4904         rp="No dice.  I can't find a C preprocessor.  Name one:"
4905         . ./myread
4906         x_cpp="$ans"
4907         x_minus=''
4908         $x_cpp <testcpp.c >testcpp.out 2>&1
4909         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4910                 echo "OK, that will do." >&4
4911         else
4912 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4913                 exit 1
4914         fi
4915 fi
4916
4917 case "$ok" in
4918 false)
4919         cppstdin="$x_cpp"
4920         cppminus="$x_minus"
4921         cpprun="$x_cpp"
4922         cpplast="$x_minus"
4923         set X $x_cpp
4924         shift
4925         case "$1" in
4926         "$cpp")
4927                 echo "Perhaps can we force $cc -E using a wrapper..."
4928                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4929                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4930                 then
4931                         echo "Yup, we can."
4932                         cppstdin="$wrapper"
4933                         cppminus='';
4934                 else
4935                         echo "Nope, we'll have to live without it..."
4936                 fi
4937                 ;;
4938         esac
4939         case "$cpprun" in
4940         "$wrapper")
4941                 cpprun=''
4942                 cpplast=''
4943                 ;;
4944         esac
4945         ;;
4946 esac
4947
4948 case "$cppstdin" in
4949 "$wrapper"|'cppstdin') ;;
4950 *) $rm -f $wrapper;;
4951 esac
4952 $rm -f testcpp.c testcpp.out
4953
4954 : Adjust cppfilter for path component separator
4955 case "$osname" in
4956 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4957 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4958 *)   cppfilter='' ;;
4959 esac
4960
4961 : Use gcc to determine libpth and incpth
4962 # If using gcc or clang, we can get better values for libpth, incpth
4963 # and usrinc directly from the compiler.
4964 # Note that ccname for clang is also gcc.
4965 case "$ccname" in
4966     gcc)
4967         $echo 'extern int foo;' > try.c
4968         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4969         shift
4970         if $test $# -gt 0; then
4971             incpth="$incpth $*"
4972             incpth="`$echo $incpth|$sed 's/^ //'`"
4973             for i in $*; do
4974                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4975                 if $test -d $j; then
4976                     libpth="$libpth $j"
4977                 fi
4978             done
4979             libpth="`$echo $libpth|$sed 's/^ //'`"
4980             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4981                 if $test -d $xxx; then
4982                     case " $libpth " in
4983                     *" $xxx "*) ;;
4984                     *) libpth="$libpth $xxx";;
4985                     esac
4986                 fi
4987             done
4988         fi
4989         $rm -f try.c
4990         case "$usrinc" in
4991         '') for i in $incpth; do
4992                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4993                     usrinc="$i"
4994                     break
4995                 fi
4996             done
4997             ;;
4998         esac
4999
5000         case "$usecrosscompile" in
5001         $define|true|[yY]*)
5002             case "$incpth" in
5003                 '') echo "Incpth not defined." >&4; croak=y ;;
5004                 *)  echo "Using incpth '$incpth'." >&4 ;;
5005             esac
5006             case "$libpth" in
5007                 '') echo "Libpth not defined." >&4; croak=y ;;
5008                 *)  echo "Using libpth '$libpth'." >&4 ;;
5009             esac
5010             case "$usrinc" in
5011                 '') echo "Usrinc not defined." >&4; croak=y ;;
5012                 *)  echo "Using usrinc $usrinc." >&4 ;;
5013             esac
5014             case "$croak" in
5015                 y)
5016                 if test "X$sysroot" = X; then
5017                     echo "Cannot continue, aborting." >&4; exit 1
5018                 else
5019                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5020                 fi
5021                 ;;
5022             esac
5023             ;;
5024         esac
5025     ;;
5026 esac
5027
5028 : Default value for incpth is just usrinc
5029 case "$incpth" in
5030 '') incpth="$usrinc";;
5031 esac
5032
5033 : Set private lib path
5034 case "$plibpth" in
5035 '') if ./mips; then
5036         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5037     fi;;
5038 esac
5039 case "$libpth" in
5040 ' ') dlist='';;
5041 '') dlist="$loclibpth $plibpth $glibpth";;
5042 *) dlist="$libpth";;
5043 esac
5044
5045 : Now check and see which directories actually exist, avoiding duplicates
5046 for xxx in $dlist
5047 do
5048     if $test -d $xxx; then
5049                 case " $libpth " in
5050                 *" $xxx "*) ;;
5051                 *) libpth="$libpth $xxx";;
5052                 esac
5053     fi
5054 done
5055 $cat <<'EOM'
5056
5057 Some systems have incompatible or broken versions of libraries.  Among
5058 the directories listed in the question below, please remove any you
5059 know not to be holding relevant libraries, and add any that are needed.
5060 Say "none" for none.
5061
5062 EOM
5063
5064 if test "X$sysroot" != X; then
5065     $cat <<EOM
5066 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5067
5068 EOM
5069 fi
5070
5071 case "$libpth" in
5072 '') dflt='none';;
5073 *)
5074         set X $libpth
5075         shift
5076         dflt=${1+"$@"}
5077         ;;
5078 esac
5079 rp="Directories to use for library searches?"
5080 . ./myread
5081 case "$ans" in
5082 none) libpth=' ';;
5083 *) libpth="$ans";;
5084 esac
5085
5086 : compute shared library extension
5087 case "$so" in
5088 '')
5089         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5090                 dflt='sl'
5091         else
5092                 dflt='so'
5093         fi
5094         ;;
5095 *) dflt="$so";;
5096 esac
5097 $cat <<EOM
5098
5099 On some systems, shared libraries may be available.  Answer 'none' if
5100 you want to suppress searching of shared libraries for the remainder
5101 of this configuration.
5102
5103 EOM
5104 rp='What is the file extension used for shared libraries?'
5105 . ./myread
5106 so="$ans"
5107
5108 : Does target system insist that shared library basenames are unique
5109 $cat << EOM
5110
5111 Some dynamic loaders assume that the *basename* of shared library filenames
5112 are globally unique.  We'll default this to undef as we assume your system
5113 is not this weird. Set to defined if you're on one of them.
5114
5115 EOM
5116
5117 dflt='n'
5118 rp='Make shared library basenames unique?'
5119 . ./myread
5120 case "$ans" in
5121 y|Y) val="$define" ;;
5122 *)   val="$undef"  ;;
5123 esac
5124 set d_libname_unique
5125 eval $setvar
5126
5127 : Define several unixisms.
5128 : Hints files or command line option can be used to override them.
5129 : The convoluted testing is in case hints files set either the old
5130 : or the new name.
5131 case "$_exe" in
5132 '')     case "$exe_ext" in
5133         '')     ;;
5134         *)      _exe="$exe_ext" ;;
5135         esac
5136         ;;
5137 esac
5138 case "$_a" in
5139 '')     case "$lib_ext" in
5140     '') _a='.a';;
5141         *)      _a="$lib_ext" ;;
5142         esac
5143         ;;
5144 esac
5145 case "$_o" in
5146 '') case "$obj_ext" in
5147         '')     _o='.o';;
5148         *)      _o="$obj_ext";;
5149         esac
5150         ;;
5151 esac
5152 case "$p_" in
5153 '') case "$path_sep" in
5154         '')     p_=':';;
5155         *)      p_="$path_sep";;
5156         esac
5157         ;;
5158 esac
5159 exe_ext=$_exe
5160 lib_ext=$_a
5161 obj_ext=$_o
5162 path_sep=$p_
5163
5164 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5165
5166 : Which makefile gets called first.  This is used by make depend.
5167 case "$firstmakefile" in
5168 '') firstmakefile='makefile';;
5169 esac
5170
5171 : Check is we will use socks
5172 case "$usesocks" in
5173 $define|true|[yY]*)     dflt='y';;
5174 *) dflt='n';;
5175 esac
5176 cat <<EOM
5177
5178 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5179 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5180 to use the PerlIO abstraction layer, this will be implicitly selected.
5181
5182 If this doesn't make any sense to you, just accept the default '$dflt'.
5183 EOM
5184 rp='Build Perl for SOCKS?'
5185 . ./myread
5186 case "$ans" in
5187 y|Y)    val="$define" ;;
5188 *)      val="$undef" ;;
5189 esac
5190 set usesocks
5191 eval $setvar
5192
5193 : Check for uselongdouble support
5194 case "$ccflags" in
5195 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5196 esac
5197
5198 case "$uselongdouble" in
5199 $define|true|[yY]*)     dflt='y';;
5200 *) dflt='n';;
5201 esac
5202 cat <<EOM
5203
5204 Perl can be built to take advantage of long doubles which
5205 (if available) may give more accuracy and range for floating point numbers.
5206
5207 If this doesn't make any sense to you, just accept the default '$dflt'.
5208 EOM
5209 rp='Try to use long doubles if available?'
5210 . ./myread
5211 case "$ans" in
5212 y|Y)    val="$define"   ;;
5213 *)      val="$undef"    ;;
5214 esac
5215 set uselongdouble
5216 eval $setvar
5217
5218 case "$uselongdouble" in
5219 true|[yY]*) uselongdouble="$define" ;;
5220 esac
5221
5222 : Look for a hint-file generated 'call-back-unit'.  If the
5223 : user has specified that long doubles should be used,
5224 : we may need to set or change some other defaults.
5225 if $test -f uselongdouble.cbu; then
5226     echo "Your platform has some specific hints regarding long doubles, using them..."
5227     . ./uselongdouble.cbu
5228 else
5229     case "$uselongdouble" in
5230         $define)
5231                 $cat <<EOM
5232 (Your platform does not have any specific hints for long doubles.)
5233 EOM
5234         ;;
5235     esac
5236 fi
5237
5238 : Check if quadmath is requested
5239 case "$usequadmath" in
5240 "$define"|true|[yY]*) usequadmath="$define" ;;
5241 *)                    usequadmath="$undef"  ;;
5242 esac
5243
5244 : Fail if both uselongdouble and usequadmath are requested
5245 case "$usequadmath:$uselongdouble" in
5246 define:define)
5247         $cat <<EOM >&4
5248
5249 *** You requested the use of the quadmath library and use
5250 *** of long doubles.
5251 ***
5252 *** Please select one or the other.
5253 EOM
5254         exit 1
5255         ;;
5256 esac
5257
5258 : Looking for optional libraries
5259 echo " "
5260 echo "Checking for optional libraries..." >&4
5261 case "$libs" in
5262 ' '|'') dflt='';;
5263 *) dflt="$libs";;
5264 esac
5265 case "$libswanted" in
5266 '') libswanted='c_s';;
5267 esac
5268 case "$usesocks" in
5269 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5270 esac
5271 case "$usecbacktrace" in
5272 "$define") libswanted="$libswanted bfd" ;;
5273 esac
5274 case "$usequadmath" in
5275 "$define") libswanted="$libswanted quadmath" ;;
5276 esac
5277 libsfound=''
5278 libsfiles=''
5279 libsdirs=''
5280 libspath=''
5281 for thisdir in $libpth $xlibpth; do
5282   test -d $thisdir && libspath="$libspath $thisdir"
5283 done
5284 for thislib in $libswanted; do
5285         for thisdir in $libspath; do
5286             xxx=''
5287             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5288                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5289                 $test -f "$xxx" && eval $libscheck
5290                 $test -f "$xxx" && libstyle=shared
5291                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5292                 $test -f "$xxx" && eval $libscheck
5293                 $test -f "$xxx" && libstyle=shared
5294             fi
5295             if test ! -f "$xxx"; then
5296                 xxx=$thisdir/lib$thislib.$so
5297                 $test -f "$xxx" && eval $libscheck
5298                 $test -f "$xxx" && libstyle=shared
5299             fi
5300             if test ! -f "$xxx"; then
5301                 xxx=$thisdir/lib$thislib$_a
5302                 $test -f "$xxx" && eval $libscheck
5303                 $test -f "$xxx" && libstyle=static
5304             fi
5305             if test ! -f "$xxx"; then
5306                 xxx=$thisdir/$thislib$_a
5307                 $test -f "$xxx" && eval $libscheck
5308                 $test -f "$xxx" && libstyle=static
5309             fi
5310             if test ! -f "$xxx"; then
5311                 xxx=$thisdir/lib${thislib}_s$_a
5312                 $test -f "$xxx" && eval $libscheck
5313                 $test -f "$xxx" && libstyle=static
5314                 $test -f "$xxx" && thislib=${thislib}_s
5315             fi
5316             if test ! -f "$xxx"; then
5317                 xxx=$thisdir/Slib$thislib$_a
5318                 $test -f "$xxx" && eval $libscheck
5319                 $test -f "$xxx" && libstyle=static
5320             fi
5321             if $test -f "$xxx"; then
5322                 case "$libstyle" in
5323                 shared) echo "Found -l$thislib (shared)." ;;
5324                 static) echo "Found -l$thislib." ;;
5325                 *)      echo "Found -l$thislib ($libstyle)." ;;
5326                 esac
5327                 case " $dflt " in
5328                 *"-l$thislib "*);;
5329                 *) dflt="$dflt -l$thislib"
5330                    libsfound="$libsfound $xxx"
5331                    yyy=`basename $xxx`
5332                    libsfiles="$libsfiles $yyy"
5333                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5334                    case " $libsdirs " in
5335                    *" $yyy "*) ;;
5336                    *) libsdirs="$libsdirs $yyy" ;;
5337                    esac
5338                    ;;
5339                 esac
5340                 break
5341             fi
5342         done
5343         if $test ! -f "$xxx"; then
5344             echo "No -l$thislib."
5345         fi
5346 done
5347 set X $dflt
5348 shift
5349 dflt="$*"
5350 case "$libs" in
5351 '') dflt="$dflt";;
5352 *) dflt="$libs";;
5353 esac
5354 case "$dflt" in
5355 ' '|'') dflt='none';;
5356 esac
5357
5358 $cat <<EOM
5359
5360 In order to compile $package on your machine, a number of libraries
5361 are usually needed.  Include any other special libraries here as well.
5362 Say "none" for none.  The default list is almost always right.
5363 EOM
5364
5365 echo " "
5366 rp="What libraries to use?"
5367 . ./myread
5368 case "$ans" in
5369 none) libs=' ';;
5370 *) libs="$ans";;
5371 esac
5372
5373 : determine optimization, if desired, or use for debug flag also
5374 case "$optimize" in
5375 ' '|$undef) dflt='none';;
5376 '') dflt='-O';;
5377 *) dflt="$optimize";;
5378 esac
5379 $cat <<EOH
5380
5381 By default, $package compiles with the -O flag to use the optimizer.
5382 Alternately, you might want to use the symbolic debugger, which uses
5383 the -g flag (on traditional Unix systems).  Either flag can be
5384 specified here.  To use neither flag, specify the word "none".
5385
5386 EOH
5387 rp="What optimizer/debugger flag should be used?"
5388 . ./myread
5389 optimize="$ans"
5390 case "$optimize" in
5391 'none') optimize=" ";;
5392 esac
5393
5394 : Check what DEBUGGING is required from the command line
5395 : -DEBUGGING      or -DDEBUGGING or
5396 : -DEBUGGING=both                       = -g + -DDEBUGGING
5397 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5398 : -DEBUGGING=none or -UDEBUGGING        =
5399 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5400 case "$EBUGGING" in
5401 '')     ;;
5402 *)      DEBUGGING=$EBUGGING ;;
5403 esac
5404
5405 case "$DEBUGGING" in
5406 -g|both|$define)
5407     case "$optimize" in
5408         *-g*) ;;
5409         *)    optimize="$optimize -g" ;;
5410     esac ;;
5411 none|$undef)
5412     case "$optimize" in
5413         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5414                 shift
5415                 optimize="$*"
5416                 ;;
5417     esac ;;
5418 esac
5419
5420 dflt=''
5421 case "$DEBUGGING" in
5422 both|$define) dflt='-DDEBUGGING'
5423 esac
5424
5425 : argument order is deliberate, as the flag will start with - which set could
5426 : think is an option
5427 checkccflag='check=$1; flag=$2; callback=$3;
5428 echo " ";
5429 echo "Checking if your compiler accepts $flag" 2>&1;
5430 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5431 echo "int main(void) { return 0; }" > gcctest.c;
5432 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5433     echo "Yes, it does." 2>&1;
5434     if $test -s gcctest.out ; then
5435         echo "But your platform does not like it:";
5436         cat gcctest.out;
5437     else
5438         case "$ccflags" in
5439         *$check*)
5440             echo "Leaving current flags $ccflags alone." 2>&1
5441             ;;
5442         *) dflt="$dflt $flag";
5443             eval $callback
5444             ;;
5445         esac
5446     fi
5447 else
5448     echo "Nope, it does not, but that is ok." 2>&1;
5449 fi
5450 '
5451
5452 : We will not override a previous value, but we might want to
5453 : augment a hint file
5454 case "$hint" in
5455 default|recommended)
5456         case "$gccversion" in
5457         1*) dflt="$dflt -fpcc-struct-return" ;;
5458         esac
5459         case "$optimize:$DEBUGGING" in
5460         *-g*:old) dflt="$dflt -DDEBUGGING";;
5461         esac
5462         case "$gccversion" in
5463         2*) if $test -d /etc/conf/kconfig.d &&
5464                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5465                 then
5466                         # Interactive Systems (ISC) POSIX mode.
5467                         dflt="$dflt -posix"
5468                 fi
5469                 ;;
5470         esac
5471         case "$gccversion" in
5472         1*) ;;
5473         2.[0-8]*) ;;
5474         ?*)     set strict-aliasing -fno-strict-aliasing
5475                 eval $checkccflag
5476                 ;;
5477         esac
5478         # For gcc, adding -pipe speeds up compilations for some, but apparently
5479         # some assemblers can't read from stdin.  (It also slows down compilations
5480         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5481         case "$gccversion" in
5482         ?*)     set pipe -pipe
5483                 eval $checkccflag
5484                 ;;
5485         esac
5486
5487         # on x86_64 (at least) we require an extra library (libssp) in the
5488         # link command line. This library is not named, so I infer that it is
5489         # an implementation detail that may change. Hence the safest approach
5490         # is to add the flag to the flags passed to the compiler at link time,
5491         # as that way the compiler can do the right implementation dependant
5492         # thing. (NWC)
5493         case "$osname" in
5494         amigaos) ;; # -fstack-protector builds but doesn't work
5495         *)      case "$gccversion" in
5496                 ?*)     set stack-protector-strong -fstack-protector-strong
5497                         eval $checkccflag
5498                         case "$dflt" in
5499                         *-fstack-protector-strong*) ;; # It got added.
5500                         *) # Try the plain/older -fstack-protector.
5501                            set stack-protector -fstack-protector
5502                            eval $checkccflag
5503                            ;;
5504                         esac
5505                         ;;
5506                 esac
5507                 ;;
5508         esac
5509         ;;
5510 esac
5511
5512 case "$mips_type" in
5513 *BSD*|'') inclwanted="$locincpth $usrinc";;
5514 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5515 esac
5516 for thisincl in $inclwanted; do
5517         if $test -d $thisincl; then
5518                 if $test x$thisincl != x$usrinc; then
5519                         case "$dflt" in
5520                         *" -I$thisincl "*);;
5521                         *) dflt="$dflt -I$thisincl ";;
5522                         esac
5523                 fi
5524         fi
5525 done
5526
5527 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5528         xxx=true;
5529 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5530         xxx=true;
5531 else
5532         xxx=false;
5533 fi;
5534 if $xxx; then
5535         case "$dflt" in
5536         *$2*);;
5537         *) dflt="$dflt -D$2";;
5538         esac;
5539 fi'
5540
5541 set signal.h LANGUAGE_C; eval $inctest
5542
5543 case "$usesocks" in
5544 $define)
5545         ccflags="$ccflags -DSOCKS"
5546         ;;
5547 esac
5548
5549 case "$hint" in
5550 default|recommended) dflt="$ccflags $dflt" ;;
5551 *) dflt="$ccflags";;
5552 esac
5553
5554 case "$dflt" in
5555 ''|' ') dflt=none;;
5556 esac
5557
5558 $cat <<EOH
5559
5560 Your C compiler may want other flags.  For this question you should include
5561 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5562 but you should NOT include libraries or ld flags like -lwhatever.  If you
5563 want $package to honor its debug switch, you should include -DDEBUGGING here.
5564 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5565
5566 To use no flags, specify the word "none".
5567
5568 EOH
5569 set X $dflt
5570 shift
5571 dflt=${1+"$@"}
5572 rp="Any additional cc flags?"
5573 . ./myread
5574 case "$ans" in
5575 none) ccflags='';;
5576 *) ccflags="$ans";;
5577 esac
5578
5579 : the following weeds options from ccflags that are of no interest to cpp
5580 case "$cppflags" in
5581 '') cppflags="$ccflags" ;;
5582 *)  set X $ccflags; shift
5583     case " $cppflags " in
5584     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5585     *) cppflags="$cppflags $ccflags" ;;
5586     esac
5587     ;;
5588 esac
5589 case "$gccversion" in
5590 1*) cppflags="$cppflags -D__GNUC__"
5591 esac
5592 case "$mips_type" in
5593 '');;
5594 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5595 esac
5596 case "$cppflags" in
5597 '');;
5598 *)
5599         echo " "
5600         echo "Let me guess what the preprocessor flags are..." >&4
5601         set X $cppflags
5602         shift
5603         cppflags=''
5604         $cat >cpp.c <<'EOM'
5605 #define BLURFL foo
5606
5607 BLURFL xx LFRULB
5608 EOM
5609         previous=''
5610         for flag in $*
5611         do
5612                 case "$flag" in
5613                 -*) ftry="$flag";;
5614                 *) ftry="$previous $flag";;
5615                 esac
5616                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5617                         >cpp1.out 2>/dev/null && \
5618                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5619                         >cpp2.out 2>/dev/null && \
5620                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5621                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5622                 then
5623                         cppflags="$cppflags $ftry"
5624                         previous=''
5625                 else
5626                         previous="$flag"
5627                 fi
5628         done
5629         set X $cppflags
5630         shift
5631         cppflags=${1+"$@"}
5632         case "$cppflags" in
5633         *-*)  echo "They appear to be: $cppflags";;
5634         esac
5635         $rm -f cpp.c cpp?.out
5636         ;;
5637 esac
5638
5639 : flags used in final linking phase
5640 case "$ldflags" in
5641 '') if ./venix; then
5642                 dflt='-i -z'
5643         else
5644                 dflt=''
5645         fi
5646         case "$ccflags" in
5647         *-posix*) dflt="$dflt -posix" ;;
5648         esac
5649         ;;
5650 *) dflt="$ldflags";;
5651 esac
5652 # See note above about -fstack-protector
5653 case "$ccflags" in
5654 *-fstack-protector-strong*)
5655         case "$dflt" in
5656         *-fstack-protector-strong*) ;; # Don't add it again
5657         *) dflt="$dflt -fstack-protector-strong" ;;
5658         esac
5659         ;;
5660 *-fstack-protector*)
5661         case "$dflt" in
5662         *-fstack-protector*) ;; # Don't add it again
5663         *) dflt="$dflt -fstack-protector" ;;
5664         esac
5665         ;;
5666 esac
5667
5668 : Try to guess additional flags to pick up local libraries.
5669 for thislibdir in $libpth; do
5670         case " $loclibpth " in
5671         *" $thislibdir "*)
5672                 case "$dflt " in
5673                 *"-L$thislibdir "*) ;;
5674                 *)  dflt="$dflt -L$thislibdir" ;;
5675                 esac
5676                 ;;
5677         esac
5678 done
5679
5680 case "$dflt" in
5681 '') dflt='none' ;;
5682 esac
5683
5684 $cat <<EOH
5685
5686 Your C linker may need flags.  For this question you should
5687 include -L/whatever and any other flags used by the C linker, but you
5688 should NOT include libraries like -lwhatever.
5689
5690 Make sure you include the appropriate -L/path flags if your C linker
5691 does not normally search all of the directories you specified above,
5692 namely
5693         $libpth
5694 To use no flags, specify the word "none".
5695
5696 EOH
5697
5698 rp="Any additional ld flags (NOT including libraries)?"
5699 . ./myread
5700 case "$ans" in
5701 none) ldflags='';;
5702 *) ldflags="$ans";;
5703 esac
5704 rmlist="$rmlist pdp11"
5705
5706 : coherency check
5707 echo " "
5708 echo "Checking your choice of C compiler and flags for coherency..." >&4
5709 $cat > try.c <<'EOF'
5710 #include <stdio.h>
5711 int main() { printf("Ok\n"); return(0); }
5712 EOF
5713 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5714 shift
5715 $cat >try.msg <<'EOM'
5716 I've tried to compile and run the following simple program:
5717
5718 EOM
5719 $cat try.c >> try.msg
5720
5721 $cat >> try.msg <<EOM
5722
5723 I used the command:
5724
5725         $*
5726         $run ./try
5727
5728 and I got the following output:
5729
5730 EOM
5731 dflt=y
5732 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5733         if $sh -c "$run ./try " >>try.msg 2>&1; then
5734                 xxx=`$run ./try`
5735                 case "$xxx" in
5736                 "Ok") dflt=n ;;
5737                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5738                 esac
5739         else
5740                 echo "The program compiled OK, but exited with status $?." >>try.msg
5741                 rp="You have a problem.  Shall I abort Configure"
5742                 dflt=y
5743         fi
5744 else
5745         echo "I can't compile the test program." >>try.msg
5746         rp="You have a BIG problem.  Shall I abort Configure"
5747         dflt=y
5748 fi
5749 case "$dflt" in
5750 y)
5751         $cat try.msg >&4
5752         case "$knowitall" in
5753         '')
5754                 echo "(The supplied flags or libraries might be incorrect.)"
5755                 ;;
5756         *) dflt=n;;
5757         esac
5758         echo " "
5759         . ./myread
5760         case "$ans" in
5761         n*|N*) ;;
5762         *)      echo "Ok.  Stopping Configure." >&4
5763                 exit 1
5764                 ;;
5765         esac
5766         ;;
5767 n) echo "OK, that should do.";;
5768 esac
5769 $rm_try gcctest gcctest.out
5770
5771 : define a shorthand compile call
5772 compile='
5773 mc_file=$1;
5774 shift;
5775 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5776 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5777 exit 1;
5778 fi;
5779 esac;
5780 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5781 : define a shorthand compile call for compilations that should be ok.
5782 compile_ok='
5783 mc_file=$1;
5784 shift;
5785 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5786
5787 : determine filename position in cpp output
5788 echo " "
5789 echo "Computing filename position in cpp output for #include directives..." >&4
5790 case "$osname" in
5791 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5792 esac
5793 case "$fieldn" in
5794 '')
5795 case "$osname" in
5796 vos) testaccess=-e ;;
5797 *)   testaccess=-r ;;
5798 esac
5799 echo '#include <stdio.h>' > foo.c
5800 $cat >fieldn <<EOF
5801 $startsh
5802 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5803 $grep '^[       ]*#.*stdio\.h' | \
5804 while read cline; do
5805         pos=1
5806         set \$cline
5807         while $test \$# -gt 0; do
5808                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5809                         echo "\$pos"
5810                         exit 0
5811                 fi
5812                 shift
5813                 pos=\`expr \$pos + 1\`
5814         done
5815 done
5816 EOF
5817 chmod +x fieldn
5818 fieldn=`./fieldn`
5819 $rm -f foo.c fieldn
5820 ;;
5821 esac
5822 case $fieldn in
5823 '') pos='???';;
5824 1) pos=first;;
5825 2) pos=second;;
5826 3) pos=third;;
5827 *) pos="${fieldn}th";;
5828 esac
5829 echo "Your cpp writes the filename in the $pos field of the line."
5830
5831 : locate header file
5832 $cat >findhdr <<EOF
5833 $startsh
5834 wanted=\$1
5835 name=''
5836 for usrincdir in $incpth
5837 do
5838         if test -f \$usrincdir/\$wanted; then
5839                 echo "\$usrincdir/\$wanted"
5840                 exit 0
5841         fi
5842 done
5843 awkprg='{ print \$$fieldn }'
5844 echo "#include <\$wanted>" > foo\$\$.c
5845 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5846 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5847 while read cline; do
5848         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5849         case "\$name" in
5850         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5851         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5852         *) exit 2;;
5853         esac;
5854 done;
5855 #
5856 # status = 0: grep returned 0 lines, case statement not executed
5857 # status = 1: headerfile found
5858 # status = 2: while loop executed, no headerfile found
5859 #
5860 status=\$?
5861 $rm -f foo\$\$.c;
5862 if test \$status -eq 1; then
5863         exit 0;
5864 fi
5865 exit 1
5866 EOF
5867 chmod +x findhdr
5868
5869 : define an alternate in-header-list? function
5870 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5871 cont=true; xxf="echo \"<\$1> found.\" >&4";
5872 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5873 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5874 esac;
5875 case $# in 4) instead=instead;; *) instead="at last";; esac;
5876 while $test "$cont"; do
5877         xxx=`./findhdr $1`
5878         var=$2; eval "was=\$$2";
5879         if $test "$xxx" && $test -r "$xxx";
5880         then eval $xxf;
5881         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5882                 cont="";
5883         else eval $xxnf;
5884         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5885         set $yyy; shift; shift; yyy=$@;
5886         case $# in 0) cont="";;
5887         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5888                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5889         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5890                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5891         esac;
5892 done;
5893 while $test "$yyy";
5894 do set $yyy; var=$2; eval "was=\$$2";
5895         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5896         set $yyy; shift; shift; yyy=$@;
5897 done'
5898
5899 : see if stdlib is available
5900 set stdlib.h i_stdlib
5901 eval $inhdr
5902
5903 : check for lengths of integral types
5904 echo " "
5905 case "$intsize" in
5906 '')
5907         echo "Checking to see how big your integers are..." >&4
5908         $cat >try.c <<EOCP
5909 #include <stdio.h>
5910 #$i_stdlib I_STDLIB
5911 #ifdef I_STDLIB
5912 #include <stdlib.h>
5913 #endif
5914 int main()
5915 {
5916         printf("intsize=%d;\n", (int)sizeof(int));
5917         printf("longsize=%d;\n", (int)sizeof(long));
5918         printf("shortsize=%d;\n", (int)sizeof(short));
5919         exit(0);
5920 }
5921 EOCP
5922         set try
5923         if eval $compile_ok && $run ./try > /dev/null; then
5924                 eval `$run ./try`
5925                 echo "Your integers are $intsize bytes long."
5926                 echo "Your long integers are $longsize bytes long."
5927                 echo "Your short integers are $shortsize bytes long."
5928         else
5929                 $cat >&4 <<EOM
5930 !
5931 Help! I can't compile and run the intsize test program: please enlighten me!
5932 (This is probably a misconfiguration in your system or libraries, and
5933 you really ought to fix it.  Still, I'll try anyway.)
5934 !
5935 EOM
5936                 dflt=4
5937                 rp="What is the size of an integer (in bytes)?"
5938                 . ./myread
5939                 intsize="$ans"
5940                 dflt=$intsize
5941                 rp="What is the size of a long integer (in bytes)?"
5942                 . ./myread
5943                 longsize="$ans"
5944                 dflt=2
5945                 rp="What is the size of a short integer (in bytes)?"
5946                 . ./myread
5947                 shortsize="$ans"
5948         fi
5949         ;;
5950 esac
5951 $rm_try
5952
5953 : check for long long
5954 echo " "
5955 echo "Checking to see if you have long long..." >&4
5956 echo 'int main() { long long x = 7; return 0; }' > try.c
5957 set try
5958 if eval $compile; then
5959         val="$define"
5960         echo "You have long long."
5961 else
5962         val="$undef"
5963         echo "You do not have long long."
5964 fi
5965 $rm_try
5966 set d_longlong
5967 eval $setvar
5968
5969 : check for length of long long
5970 case "${d_longlong}${longlongsize}" in
5971 $define)
5972         echo " "
5973         echo "Checking to see how big your long longs are..." >&4
5974         $cat >try.c <<'EOCP'
5975 #include <stdio.h>
5976 int main()
5977 {
5978     printf("%d\n", (int)sizeof(long long));
5979     return(0);
5980 }
5981 EOCP
5982         set try
5983         if eval $compile_ok; then
5984                 longlongsize=`$run ./try`
5985                 echo "Your long longs are $longlongsize bytes long."
5986         else
5987                 dflt='8'
5988                 echo " "
5989                 echo "(I can't seem to compile the test program.  Guessing...)"
5990                 rp="What is the size of a long long (in bytes)?"
5991                 . ./myread
5992                 longlongsize="$ans"
5993         fi
5994         if $test "X$longsize" = "X$longlongsize"; then
5995                 echo "(That isn't any different from an ordinary long.)"
5996         fi
5997         ;;
5998 esac
5999 $rm_try
6000
6001 : see if inttypes.h is available
6002 : we want a real compile instead of Inhdr because some systems
6003 : have an inttypes.h which includes non-existent headers
6004 echo " "
6005 $cat >try.c <<EOCP
6006 #include <inttypes.h>
6007 int main() {
6008         static int32_t foo32 = 0x12345678;
6009 }
6010 EOCP
6011 set try
6012 if eval $compile; then
6013         echo "<inttypes.h> found." >&4
6014         val="$define"
6015 else
6016         echo "<inttypes.h> NOT found." >&4
6017         val="$undef"
6018 fi
6019 $rm_try
6020 set i_inttypes
6021 eval $setvar
6022
6023 : check for int64_t
6024 echo " "
6025 echo "Checking to see if you have int64_t..." >&4
6026 $cat >try.c <<EOCP
6027 #include <sys/types.h>
6028 #$i_inttypes I_INTTYPES
6029 #ifdef I_INTTYPES
6030 #include <inttypes.h>
6031 #endif
6032 int main() { int64_t x = 7; }
6033 EOCP
6034 set try
6035 if eval $compile; then
6036         val="$define"
6037         echo "You have int64_t."
6038 else
6039         val="$undef"
6040         echo "You do not have int64_t."
6041 fi
6042 $rm_try
6043 set d_int64_t
6044 eval $setvar
6045
6046 : Check if 64bit ints have a quad type
6047 echo " "
6048 echo "Checking which 64-bit integer type we could use..." >&4
6049
6050 case "$intsize" in
6051 8) val=int
6052    set quadtype
6053    eval $setvar
6054    val='"unsigned int"'
6055    set uquadtype
6056    eval $setvar
6057    quadkind=1
6058    ;;
6059 *) case "$longsize" in
6060    8) val=long
6061       set quadtype
6062       eval $setvar
6063       val='"unsigned long"'
6064       set uquadtype
6065       eval $setvar
6066       quadkind=2
6067       ;;
6068    *) case "$d_longlong:$longlongsize" in
6069       define:8)
6070         val='"long long"'
6071         set quadtype
6072         eval $setvar
6073         val='"unsigned long long"'
6074         set uquadtype
6075         eval $setvar
6076         quadkind=3
6077         ;;
6078       *) case "$d_int64_t" in
6079          define)
6080            val=int64_t
6081            set quadtype
6082            eval $setvar
6083            val=uint64_t
6084            set uquadtype
6085            eval $setvar
6086            quadkind=4
6087            ;;
6088          esac
6089          ;;
6090       esac
6091       ;;
6092    esac
6093    ;;
6094 esac
6095
6096 case "$quadtype" in
6097 '')     echo "Alas, no 64-bit integer types in sight." >&4
6098         d_quad="$undef"
6099         ;;
6100 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6101         d_quad="$define"
6102         ;;
6103 esac
6104
6105 : Do we want 64bit support
6106 case "$uselonglong" in
6107 "$define"|true|[yY]*)
6108         cat <<EOM >&4
6109
6110 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6111 EOM
6112         use64bitint="$define"
6113         ;;
6114 esac
6115 case "$use64bits" in
6116 "$define"|true|[yY]*)
6117         cat <<EOM >&4
6118
6119 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6120 EOM
6121         use64bitint="$define"
6122         ;;
6123 esac
6124 case "$use64bitints" in
6125 "$define"|true|[yY]*)
6126         cat <<EOM >&4
6127
6128 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6129 EOM
6130         use64bitint="$define"
6131         ;;
6132 esac
6133 case "$use64bitsint" in
6134 "$define"|true|[yY]*)
6135         cat <<EOM >&4
6136
6137 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6138 EOM
6139         use64bitint="$define"
6140         ;;
6141 esac
6142 case "$uselonglongs" in
6143 "$define"|true|[yY]*)
6144         cat <<EOM >&4
6145
6146 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6147 EOM
6148         use64bitint="$define"
6149         ;;
6150 esac
6151 case "$use64bitsall" in
6152 "$define"|true|[yY]*)
6153         cat <<EOM >&4
6154
6155 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6156 EOM
6157         use64bitall="$define"
6158         ;;
6159 esac
6160
6161 case "$ccflags" in
6162 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6163 esac
6164 case "$use64bitall" in
6165 "$define"|true|[yY]*) use64bitint="$define" ;;
6166 esac
6167
6168 case "$longsize" in
6169 8) cat <<EOM
6170
6171 You have natively 64-bit long integers.
6172 EOM
6173    val="$define"
6174    ;;
6175 *) case "$use64bitint" in
6176    "$define"|true|[yY]*) dflt='y';;
6177    *) dflt='n';;
6178    esac
6179    case "$d_quad" in
6180    "$define") ;;
6181    *) dflt='n' ;;
6182    esac
6183    cat <<EOM
6184
6185 Perl can be built to take advantage of 64-bit integer types
6186 on some systems.  To do so, Configure can be run with -Duse64bitint.
6187 Choosing this option will most probably introduce binary incompatibilities.
6188
6189 If this doesn't make any sense to you, just accept the default '$dflt'.
6190 (The default has been chosen based on your configuration.)
6191 EOM
6192    rp='Try to use 64-bit integers, if available?'
6193    . ./myread
6194    case "$ans" in
6195    [yY]*) val="$define" ;;
6196    *)     val="$undef"  ;;
6197    esac
6198    ;;
6199 esac
6200 set use64bitint
6201 eval $setvar
6202
6203 case "$use64bitall" in
6204 "$define"|true|[yY]*) dflt='y' ;;
6205 *) case "$longsize" in
6206    8) dflt='y' ;;
6207    *) dflt='n' ;;
6208    esac
6209    ;;
6210 esac
6211 cat <<EOM
6212
6213 You may also choose to try maximal 64-bitness.  It means using as much
6214 64-bitness as possible on the platform.  This in turn means even more
6215 binary incompatibilities.  On the other hand, your platform may not
6216 have any more 64-bitness available than what you already have chosen.
6217
6218 If this doesn't make any sense to you, just accept the default '$dflt'.
6219 (The default has been chosen based on your configuration.)
6220 EOM
6221 rp='Try to use maximal 64-bit support, if available?'
6222 . ./myread
6223 case "$ans" in
6224 [yY]*) val="$define" ;;
6225 *)     val="$undef"  ;;
6226 esac
6227 set use64bitall
6228 eval $setvar
6229 case "$use64bitall" in
6230 "$define")
6231         case "$use64bitint" in
6232         "$undef")
6233                 cat <<EOM
6234
6235 Since you have chosen a maximally 64-bit build, I'm also turning on
6236 the use of 64-bit integers.
6237 EOM
6238                 use64bitint="$define" ;;
6239         esac
6240         ;;
6241 esac
6242
6243 : Look for a hint-file generated 'call-back-unit'.  If the
6244 : user has specified that a 64-bit perl is to be built,
6245 : we may need to set or change some other defaults.
6246 if $test -f use64bitint.cbu; then
6247         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6248         . ./use64bitint.cbu
6249 fi
6250 case "$use64bitint" in
6251 "$define"|true|[yY]*)
6252         : This test was common to all the OpenBSD forks, and seems harmless for
6253         : other platforms:
6254         echo " "
6255         echo "Checking if your C library has broken 64-bit functions..." >&4
6256         cat >try.c <<EOCP
6257 #include <stdio.h>
6258 typedef $uquadtype myULL;
6259 int main (void)
6260 {
6261     struct {
6262         double d;
6263         myULL  u;
6264     } *p, test[] = {
6265         {4294967303.15, 4294967303ULL},
6266         {4294967294.2,  4294967294ULL},
6267         {4294967295.7,  4294967295ULL},
6268         {0.0, 0ULL}
6269     };
6270     for (p = test; p->u; p++) {
6271         myULL x = (myULL)p->d;
6272         if (x != p->u) {
6273             printf("buggy\n");
6274             return 0;
6275         }
6276     }
6277     printf("ok\n");
6278     return 0;
6279 }
6280 EOCP
6281         set try
6282         if eval $compile_ok; then
6283             libcquad=`$run ./try`
6284             echo "Your C library's 64-bit functions are $libcquad."
6285         else
6286             echo "(I can't seem to compile the test program.)"
6287             echo "Assuming that your C library's 64-bit functions are ok."
6288             libcquad="ok"
6289         fi
6290         $rm_try
6291
6292         case "$libcquad" in
6293             buggy*)
6294                 cat >&4 <<EOM
6295
6296 *** You have a C library with broken 64-bit functions.
6297 *** 64-bit support does not work reliably in this configuration.
6298 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6299 *** Cannot continue, aborting.
6300
6301 EOM
6302                 exit 1
6303                 ;;
6304         esac
6305         case "$longsize" in
6306         4) case "$archname64" in
6307            '') archname64=64int ;;
6308            esac
6309            ;;
6310         esac
6311         ;;
6312 esac
6313
6314 : Look for a hint-file generated 'call-back-unit'.  If the
6315 : user has specified that a maximally 64-bit perl is to be built,
6316 : we may need to set or change some other defaults.
6317 if $test -f use64bitall.cbu; then
6318         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6319         . ./use64bitall.cbu
6320 fi
6321 case "$use64bitall" in
6322 "$define"|true|[yY]*)
6323         case "$longsize" in
6324         4) case "$archname64" in
6325            ''|64int) archname64=64all ;;
6326            esac
6327            ;;
6328         esac
6329         ;;
6330 esac
6331
6332 case "$d_quad:$use64bitint" in
6333 $undef:$define)
6334         cat >&4 <<EOF
6335
6336 *** You have chosen to use 64-bit integers,
6337 *** but none can be found.
6338 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6339 *** Cannot continue, aborting.
6340
6341 EOF
6342         exit 1
6343         ;;
6344 esac
6345
6346 : Check if we are using the GNU C library
6347 echo " "
6348 echo "Checking for GNU C Library..." >&4
6349 cat >try.c <<'EOCP'
6350 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6351    alone are insufficient to distinguish different versions, such as
6352    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6353    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6354 */
6355 #include <stdio.h>
6356 int main(void)
6357 {
6358 #ifdef __GLIBC__
6359 #   ifdef __GLIBC_MINOR__
6360 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6361 #           include <gnu/libc-version.h>
6362             printf("%s\n",  gnu_get_libc_version());
6363 #       else
6364             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6365 #       endif
6366 #   else
6367         printf("%d\n",  __GLIBC__);
6368 #   endif
6369     return 0;
6370 #else
6371     return 1;
6372 #endif
6373 }
6374 EOCP
6375 set try
6376 if eval $compile_ok && $run ./try > glibc.ver; then
6377         val="$define"
6378         gnulibc_version=`$cat glibc.ver`
6379         echo "You are using the GNU C Library version $gnulibc_version"
6380 else
6381         val="$undef"
6382         gnulibc_version=''
6383         echo "You are not using the GNU C Library"
6384 fi
6385 $rm_try glibc.ver
6386 set d_gnulibc
6387 eval $setvar
6388
6389 : see if nm is to be used to determine whether a symbol is defined or not
6390 case "$usenm" in
6391 '')
6392         dflt=''
6393         case "$d_gnulibc" in
6394         "$define")
6395                 echo " "
6396                 echo "nm probably won't work on the GNU C Library." >&4
6397                 dflt=n
6398                 ;;
6399         esac
6400         case "$dflt" in
6401         '')
6402                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6403                         echo " "
6404                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6405                         echo "'nm' won't be sufficient on this system." >&4
6406                         dflt=n
6407                 fi
6408                 ;;
6409         esac
6410         case "$dflt" in
6411         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6412                 if $test $dflt -gt 20; then
6413                         dflt=y
6414                 else
6415                         dflt=n
6416                 fi
6417                 ;;
6418         esac
6419         ;;
6420 *)
6421         case "$usenm" in
6422         true|$define) dflt=y;;
6423         *) dflt=n;;
6424         esac
6425         ;;
6426 esac
6427 $cat <<EOM
6428
6429 I can use $nm to extract the symbols from your C libraries. This
6430 is a time consuming task which may generate huge output on the disk (up
6431 to 3 megabytes) but that should make the symbols extraction faster. The
6432 alternative is to skip the 'nm' extraction part and to compile a small
6433 test program instead to determine whether each symbol is present. If
6434 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6435 this may be the best solution.
6436
6437 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6438
6439 EOM
6440 rp="Shall I use $nm to extract C symbols from the libraries?"
6441 . ./myread
6442 case "$ans" in
6443 [Nn]*) usenm=false;;
6444 *) usenm=true;;
6445 esac
6446
6447 runnm=$usenm
6448 case "$reuseval" in
6449 true) runnm=false;;
6450 esac
6451
6452 : nm options which may be necessary
6453 case "$nm_opt" in
6454 '') if $test -f /mach_boot; then
6455                 nm_opt=''       # Mach
6456         elif $test -d /usr/ccs/lib; then
6457                 nm_opt='-p'     # Solaris (and SunOS?)
6458         elif $test -f /dgux; then
6459                 nm_opt='-p'     # DG-UX
6460         elif $test -f /lib64/rld; then
6461                 nm_opt='-p'     # 64-bit Irix
6462         else
6463                 nm_opt=''
6464         fi;;
6465 esac
6466
6467 : nm options which may be necessary for shared libraries but illegal
6468 : for archive libraries.  Thank you, Linux.
6469 case "$nm_so_opt" in
6470 '')     case "$myuname" in
6471         *linux*|gnu*)
6472                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6473                         nm_so_opt='--dynamic'
6474                 fi
6475                 ;;
6476         esac
6477         ;;
6478 esac
6479
6480 : Figure out where the libc is located
6481 case "$runnm" in
6482 true)
6483 : get list of predefined functions in a handy place
6484 echo " "
6485 case "$libc" in
6486 '') libc=unknown
6487         case "$libs" in
6488         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6489         esac
6490         ;;
6491 esac
6492 case "$libs" in
6493 '') ;;
6494 *)  for thislib in $libs; do
6495         case "$thislib" in
6496         -lc|-lc_s)
6497                 : Handle C library specially below.
6498                 ;;
6499         -l*)
6500                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6501                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6502                         :
6503                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6504                         :
6505                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6506                         :
6507                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6508                         :
6509                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6510                         :
6511                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6512                         :
6513                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6514                         :
6515                 else
6516                         try=''
6517                 fi
6518                 libnames="$libnames $try"
6519                 ;;
6520         *) libnames="$libnames $thislib" ;;
6521         esac
6522         done
6523         ;;
6524 esac
6525 xxx=normal
6526 case "$libc" in
6527 unknown)
6528         set /lib/libc.$so
6529         for xxx in $libpth; do
6530                 $test -r $1 || set $xxx/libc.$so
6531                 : The messy sed command sorts on library version numbers.
6532                 $test -r $1 || \
6533                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6534                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6535                                 h
6536                                 s/[0-9][0-9]*/0000&/g
6537                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6538                                 G
6539                                 s/\n/ /' | \
6540                          $sort | $sed -e 's/^.* //'`
6541                 eval set \$$#
6542         done
6543         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6544         $test -r $1 || set $sysroot/lib/libsys_s$_a
6545         ;;
6546 *)
6547         set blurfl
6548         ;;
6549 esac
6550 if $test -r "$1"; then
6551         echo "Your (shared) C library seems to be in $1."
6552         libc="$1"
6553 elif $test -r /lib/libc && $test -r /lib/clib; then
6554         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6555         xxx=apollo
6556         libc='/lib/clib /lib/libc'
6557         if $test -r /lib/syslib; then
6558                 echo "(Your math library is in /lib/syslib.)"
6559                 libc="$libc /lib/syslib"
6560         fi
6561 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6562         echo "Your C library seems to be in $libc, as you said before."
6563 elif $test -r $incpath/usr/lib/libc$_a; then
6564         libc=$incpath/usr/lib/libc$_a;
6565         echo "Your C library seems to be in $libc.  That's fine."
6566 elif $test -r /lib/libc$_a; then
6567         libc=/lib/libc$_a;
6568         echo "Your C library seems to be in $libc.  You're normal."
6569 else
6570         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6571                 :
6572         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6573                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6574         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6575                 :
6576         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6577                 :
6578         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6579                 :
6580         else
6581                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6582         fi
6583         if $test -r "$tans"; then
6584                 echo "Your C library seems to be in $tans, of all places."
6585                 libc=$tans
6586         else
6587                 libc='blurfl'
6588         fi
6589 fi
6590 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6591         dflt="$libc"
6592         cat <<EOM
6593
6594 If the guess above is wrong (which it might be if you're using a strange
6595 compiler, or your machine supports multiple models), you can override it here.
6596
6597 EOM
6598 else
6599         dflt=''
6600         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6601         cat >&4 <<EOM
6602 I can't seem to find your C library.  I've looked in the following places:
6603
6604 EOM
6605         $sed 's/^/      /' libpath
6606         cat <<EOM
6607
6608 None of these seems to contain your C library. I need to get its name...
6609
6610 EOM
6611 fi
6612 fn=f
6613 rp='Where is your C library?'
6614 . ./getfile
6615 libc="$ans"
6616
6617 echo " "
6618 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6619 set X `cat libnames`
6620 shift
6621 xxx=files
6622 case $# in 1) xxx=file; esac
6623 echo "Extracting names from the following $xxx for later perusal:" >&4
6624 echo " "
6625 $sed 's/^/      /' libnames >&4
6626 echo " "
6627 $echo $n "This may take a while...$c" >&4
6628
6629 for file in $*; do
6630         case $file in
6631         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6632         *) $nm $nm_opt $file 2>/dev/null;;
6633         esac
6634 done >libc.tmp
6635
6636 $echo $n ".$c"
6637 $grep fprintf libc.tmp > libc.ptf
6638 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6639 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6640 xxx='[ADTSIWi]'
6641 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6642         eval $xscan;\
6643         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6644                 eval $xrun
6645 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6646         eval $xscan;\
6647         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6648                 eval $xrun
6649 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6650         eval $xscan;\
6651         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6652                 eval $xrun
6653 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6654         eval $xscan;\
6655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6656                 eval $xrun
6657 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6658         eval $xscan;\
6659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6660                 eval $xrun
6661 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6662         eval $xscan;\
6663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6664                 eval $xrun
6665 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6666                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6667         eval $xscan;\
6668         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6669                 eval $xrun
6670 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6671         eval $xscan;\
6672         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6673                 eval $xrun
6674 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6675         eval $xscan;\
6676         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6677                 eval $xrun
6678 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6679         eval $xscan;\
6680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6681                 eval $xrun
6682 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6683         eval $xscan;\
6684         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6685                 eval $xrun
6686 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6687         eval $xscan;\
6688         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6689                 eval $xrun
6690 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6691         eval $xscan;\
6692         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6693                 eval $xrun
6694 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6695         eval $xscan;\
6696         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6697                 eval $xrun
6698 else
6699         $nm -p $* 2>/dev/null >libc.tmp
6700         $grep fprintf libc.tmp > libc.ptf
6701         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6702                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6703         then
6704                 nm_opt='-p'
6705                 eval $xrun
6706         else
6707                 echo " "
6708                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6709                 com=''
6710                 if $ar t $libc > libc.tmp && \
6711                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6712                 then
6713                         for thisname in $libnames $libc; do
6714                                 $ar t $thisname >>libc.tmp
6715                         done
6716                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6717                         echo "Ok." >&4
6718                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6719                         for thisname in $libnames $libc; do
6720                                 $ar tv $thisname >>libc.tmp
6721                                 emximp -o tmp.imp $thisname \
6722                                     2>/dev/null && \
6723                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6724                                     < tmp.imp >>libc.tmp
6725                                 $rm -f tmp.imp
6726                         done
6727                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6728                         echo "Ok." >&4
6729                 else
6730                         echo "$ar didn't seem to work right." >&4
6731                         echo "Maybe this is a Cray...trying bld instead..." >&4
6732                         if  bld t $libc | \
6733                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6734                                 $test -s libc.list
6735                         then
6736                                 for thisname in $libnames; do
6737                                         bld t $libnames | \
6738                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6739                                         $ar t $thisname >>libc.tmp
6740                                 done
6741                                 echo "Ok." >&4
6742                         else
6743                                 echo "That didn't work either.  Giving up." >&4
6744                                 exit 1
6745                         fi
6746                 fi
6747         fi
6748 fi
6749 nm_extract="$com"
6750 case "$PASE" in
6751 define)
6752     echo " "
6753     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6754     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6755     ;;
6756 *)  if $test -f /lib/syscalls.exp; then
6757         echo " "
6758         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6759         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6760                 /lib/syscalls.exp >>libc.list
6761     fi
6762     ;;
6763 esac
6764 ;;
6765 esac
6766 $rm -f libnames libpath
6767
6768 : Check if we are using C++
6769 echo " "
6770 echo "Checking for C++..." >&4
6771 $cat >try.c <<'EOCP'
6772 #include <stdio.h>
6773 int main(void)
6774 {
6775 #ifdef __cplusplus
6776     return 0;
6777 #else
6778     return 1;
6779 #endif
6780 }
6781 EOCP
6782 set try
6783 if eval $compile_ok && $run ./try; then
6784         val="$define"
6785         echo "You are using a C++ compiler."
6786 else
6787         val="$undef"
6788         echo "You are not using a C++ compiler."
6789 fi
6790 $rm_try cplusplus$$
6791 set d_cplusplus
6792 eval $setvar
6793
6794 : is a C symbol defined?
6795 csym='tlook=$1;
6796 case "$3" in
6797 -v) tf=libc.tmp; tdc="";;
6798 -a) tf=libc.tmp; tdc="[]";;
6799 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6800 esac;
6801 case "$d_cplusplus" in
6802     $define)    extern_C="extern \"C\"" ;;
6803     *)          extern_C="extern"       ;;
6804 esac;
6805 tx=yes;
6806 case "$reuseval-$4" in
6807 true-) ;;
6808 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6809 esac;
6810 case "$tx" in
6811 yes)
6812         tval=false;
6813         if $test "$runnm" = true; then
6814                 if $contains $tlook $tf >/dev/null 2>&1; then
6815                         tval=true;
6816                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6817                         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;
6818                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6819                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6820                         $rm_try;
6821                 fi;
6822         else
6823                 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;
6824                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6825                 $rm_try;
6826         fi;
6827         ;;
6828 *)
6829         case "$tval" in
6830         $define) tval=true;;
6831         *) tval=false;;
6832         esac;
6833         ;;
6834 esac;
6835 eval "$2=$tval"'
6836
6837 : define an is-in-libc? function
6838 inlibc='echo " "; td=$define; tu=$undef;
6839 sym=$1; var=$2; eval "was=\$$2";
6840 tx=yes;
6841 case "$reuseval$was" in
6842 true) ;;
6843 true*) tx=no;;
6844 esac;
6845 case "$tx" in
6846 yes)
6847         set $sym tres -f;
6848         eval $csym;
6849         case "$tres" in
6850         true)
6851                 echo "$sym() found." >&4;
6852                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6853         *)
6854                 echo "$sym() NOT found." >&4;
6855                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6856         esac;;
6857 *)
6858         case "$was" in
6859         $define) echo "$sym() found." >&4;;
6860         *) echo "$sym() NOT found." >&4;;
6861         esac;;
6862 esac'
6863
6864 : check for length of double
6865 echo " "
6866 case "$doublesize" in
6867 '')
6868         echo "Checking to see how big your double precision numbers are..." >&4
6869         $cat >try.c <<EOCP
6870 #include <stdio.h>
6871 #$i_stdlib I_STDLIB
6872 #ifdef I_STDLIB
6873 #include <stdlib.h>
6874 #endif
6875 int main()
6876 {
6877     printf("%d\n", (int)sizeof(double));
6878     exit(0);
6879 }
6880 EOCP
6881         set try
6882         if eval $compile_ok; then
6883                 doublesize=`$run ./try`
6884                 echo "Your double is $doublesize bytes long."
6885         else
6886                 dflt='8'
6887                 echo "(I can't seem to compile the test program.  Guessing...)"
6888                 rp="What is the size of a double precision number (in bytes)?"
6889                 . ./myread
6890                 doublesize="$ans"
6891         fi
6892         ;;
6893 esac
6894 $rm_try
6895
6896 : see if this is a float.h system
6897 set float.h i_float
6898 eval $inhdr
6899
6900 : check for long doubles
6901 echo " "
6902 echo "Checking to see if you have long double..." >&4
6903 echo 'int main() { long double x = 7.0; }' > try.c
6904 set try
6905 if eval $compile; then
6906         val="$define"
6907         echo "You have long double."
6908 else
6909         val="$undef"
6910         echo "You do not have long double."
6911 fi
6912 $rm_try
6913 set d_longdbl
6914 eval $setvar
6915
6916 : see if ldexpl exists
6917 set ldexpl d_ldexpl
6918 eval $inlibc
6919
6920 : check for length of long double
6921 case "${d_longdbl}${longdblsize}" in
6922 $define)
6923         echo " "
6924         echo "Checking to see how big your long doubles are..." >&4
6925         $cat >try.c <<'EOCP'
6926 #include <stdio.h>
6927 int main()
6928 {
6929         printf("%d\n", sizeof(long double));
6930 }
6931 EOCP
6932         set try
6933         set try
6934         if eval $compile; then
6935                 longdblsize=`$run ./try`
6936                 echo "Your long doubles are $longdblsize bytes long."
6937         else
6938                 dflt='8'
6939                 echo " "
6940                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6941                 rp="What is the size of a long double (in bytes)?"
6942                 . ./myread
6943                 longdblsize="$ans"
6944         fi
6945         if $test "X$doublesize" = "X$longdblsize"; then
6946                 echo "That isn't any different from an ordinary double."
6947                 echo "I'll keep your setting anyway, but you may see some"
6948                 echo "harmless compilation warnings."
6949         fi
6950         ;;
6951 esac
6952 $rm_try
6953
6954 $echo "Checking the kind of long doubles you have..." >&4
6955 case "$d_longdbl" in
6956 define)
6957 $cat <<EOP >try.c
6958 #$i_float I_FLOAT
6959 #$i_stdlib I_STDLIB
6960 #define LONGDBLSIZE $longdblsize
6961 #define DOUBLESIZE $doublesize
6962 #ifdef I_FLOAT
6963 #include <float.h>
6964 #endif
6965 #ifdef I_STDLIB
6966 #include <stdlib.h>
6967 #endif
6968 #include <stdio.h>
6969 static const long double d = -0.1L;
6970 int main() {
6971   unsigned const char* b = (unsigned const char*)(&d);
6972 #if DOUBLESIZE == LONGDBLSIZE
6973   printf("0\n"); /* if it floats like double */
6974   exit(0);
6975 #endif
6976 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6977   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6978     /* IEEE 754 128-bit little-endian */
6979     printf("1\n");
6980     exit(0);
6981   }
6982   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6983     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6984     printf("2\n");
6985     exit(0);
6986   }
6987 #endif
6988 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6989  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6990  * cannot be trusted. */
6991 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6992   if (b[0] == 0xCD && b[9] == 0xBF) {
6993     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6994      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6995      * Also known as "extended precision". */
6996     printf("3\n");
6997     exit(0);
6998   }
6999   if (b[0] == 0xBF && b[9] == 0xCD) {
7000     /* Is there ever big-endian 80-bit, really?
7001      *
7002      * The Motorola 68881 had another "extended precision" format:
7003      * sign:1 exp:15 zero:16 integer:1 mantissa:63
7004      * for total of 96 bits of bytes.  The zero bits were unused.
7005      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7006      * If it ever becomes relevant, this format should be allocated
7007      * a new doublekind code since it's quite different from the Intel x87.
7008      */
7009     printf("4\n");
7010     exit(0);
7011   }
7012 #endif
7013 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7014   /* software "double double", the 106 is 53+53.
7015    * but irix thinks it is 107. */
7016   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7017     /* double double 128-bit fully little-endian,
7018      * little-endian doubles in little-endian order,
7019      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7020     printf("5\n");
7021     exit(0);
7022   }
7023   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7024     /* double double 128-bit fully big-endian,
7025      * big-endian doubles in big-endian order,
7026      * e.g. PPC/Power and MIPS:
7027      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7028     printf("6\n");
7029     exit(0);
7030   }
7031   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7032     /* double double 128-bit mixed endian.
7033      * little-endian doubles in big-endian order,
7034      * e.g. ppc64el,
7035      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7036     printf("7\n");
7037     exit(0);
7038   }
7039   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7040     /* double double 128-bit mixed endian,
7041      * big-endian doubles in little-endian order,
7042      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7043     printf("8\n");
7044     exit(0);
7045   }
7046 #endif
7047   printf("-1\n"); /* unknown */
7048   exit(0);
7049 }
7050 EOP
7051 set try
7052 if eval $compile; then
7053     longdblkind=`$run ./try`
7054 else
7055     longdblkind=-1
7056 fi
7057 ;;
7058 *) longdblkind=0 ;;
7059 esac
7060 case "$longdblkind" in
7061 0) echo "Your long doubles are doubles." >&4 ;;
7062 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7063 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7064 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7065 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7066 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7067 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7068 7) echo "You have 128-bit mixed double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7069 8) echo "You have 128-bit mixed double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7070 *) echo "Cannot figure out your long double." >&4 ;;
7071 esac
7072 $rm_try
7073
7074 : determine the architecture name
7075 echo " "
7076 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7077         tarch=`arch`"-$osname"
7078 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7079         if uname -m > tmparch 2>&1 ; then
7080                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7081                         -e 's/$/'"-$osname/" tmparch`
7082         else
7083                 tarch="$osname"
7084         fi
7085         $rm -f tmparch
7086 else
7087         tarch="$osname"
7088 fi
7089 case "$myarchname" in
7090 ''|"$tarch") ;;
7091 *)
7092         echo "(Your architecture name used to be $myarchname.)"
7093         archname=''
7094         ;;
7095 esac
7096 case "$targetarch" in
7097 '') ;;
7098 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7099 esac
7100 myarchname="$tarch"
7101 case "$archname" in
7102 '') dflt="$tarch";;
7103 *) dflt="$archname";;
7104 esac
7105 rp='What is your architecture name'
7106 . ./myread
7107 archname="$ans"
7108
7109 : optionally add API version to the architecture for versioned archlibs
7110 case "$useversionedarchname" in
7111 $define|true|[yY]*) dflt='y';;
7112 *)                  dflt='n';;
7113 esac
7114 rp='Add the Perl API version to your archname?'
7115 . ./myread
7116 case "$ans" in
7117 y|Y)    useversionedarchname="$define" ;;
7118 *)      useversionedarchname="$undef" ;;
7119 esac
7120 case "$useversionedarchname" in
7121 $define)
7122         case "$archname" in
7123         *-$api_versionstring)
7124                 echo "...and architecture name already has -$api_versionstring" >&4
7125                 ;;
7126         *)
7127                 archname="$archname-$api_versionstring"
7128                 echo "...setting architecture name to $archname." >&4
7129                 ;;
7130         esac
7131         ;;
7132 esac
7133
7134 case "$usethreads" in
7135 $define)
7136         echo "Threads selected." >&4
7137         case "$archname" in
7138         *-thread*) echo "...and architecture name already has -thread." >&4
7139                 ;;
7140         *)      archname="$archname-thread"
7141                 echo "...setting architecture name to $archname." >&4
7142                 ;;
7143         esac
7144         ;;
7145 esac
7146 case "$usemultiplicity" in
7147 $define)
7148         echo "Multiplicity selected." >&4
7149         case "$archname" in
7150         *-multi*) echo "...and architecture name already has -multi." >&4
7151                 ;;
7152         *)      archname="$archname-multi"
7153                 echo "...setting architecture name to $archname." >&4
7154                 ;;
7155         esac
7156         ;;
7157 esac
7158 case "$use64bitint$use64bitall" in
7159 *"$define"*)
7160         case "$archname64" in
7161         '')
7162                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7163                 ;;
7164         *)
7165                 case "$use64bitint" in
7166                 "$define") echo "64 bit integers selected." >&4 ;;
7167                 esac
7168                 case "$use64bitall" in
7169                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7170                 esac
7171                 case "$archname" in
7172                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7173                         ;;
7174                 *)      archname="$archname-$archname64"
7175                         echo "...setting architecture name to $archname." >&4
7176                         ;;
7177                 esac
7178                 ;;
7179         esac
7180 esac
7181 case "$uselongdouble" in
7182 $define)
7183         echo "Long doubles selected." >&4
7184         case "$longdblsize" in
7185         $doublesize)
7186                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7187                 ;;
7188         *)
7189                 case "$archname" in
7190                 *-ld*) echo "...and architecture name already has -ld." >&4
7191                         ;;
7192                 *)      archname="$archname-ld"
7193                         echo "...setting architecture name to $archname." >&4
7194                         ;;
7195                 esac
7196                 ;;
7197         esac
7198         ;;
7199 esac
7200 case "$usequadmath" in
7201 $define)
7202         echo "quadmath selected." >&4
7203         case "$archname" in
7204         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7205                 ;;
7206         *)      archname="$archname-quadmath"
7207                 echo "...setting architecture name to $archname." >&4
7208                 ;;
7209         esac
7210         ;;
7211 esac
7212 if $test -f archname.cbu; then
7213         echo "Your platform has some specific hints for architecture name, using them..."
7214         . ./archname.cbu
7215 fi
7216
7217 : set the prefixit variable, to compute a suitable default value
7218 prefixit='case "$3" in
7219 ""|none)
7220         case "$oldprefix" in
7221         "") eval "$1=\"\$$2\"";;
7222         *)
7223                 case "$3" in
7224                 "") eval "$1=";;
7225                 none)
7226                         eval "tp=\"\$$2\"";
7227                         case "$tp" in
7228                         ""|" ") eval "$1=\"\$$2\"";;
7229                         *) eval "$1=";;
7230                         esac;;
7231                 esac;;
7232         esac;;
7233 *)
7234         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7235         case "$tp" in
7236         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7237         /*-$oldprefix/*|\~*-$oldprefix/*)
7238                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7239         *) eval "$1=\"\$$2\"";;
7240         esac;;
7241 esac'
7242
7243 : determine installation style
7244 : For now, try to deduce it from prefix unless it is already set.
7245 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7246 case "$installstyle" in
7247 '')     case "$prefix" in
7248                 *perl*) dflt='lib';;
7249                 *) dflt='lib/perl5' ;;
7250         esac
7251         ;;
7252 *)      dflt="$installstyle" ;;
7253 esac
7254 : Probably not worth prompting for this since we prompt for all
7255 : the directories individually, and the prompt would be too long and
7256 : confusing anyway.
7257 installstyle=$dflt
7258
7259 : determine where public executables go
7260 echo " "
7261 set dflt bin bin
7262 eval $prefixit
7263 fn=d~
7264 rp='Pathname where the public executables will reside?'
7265 . ./getfile
7266 if $test "X$ansexp" != "X$binexp"; then
7267         installbin=''
7268 fi
7269 prefixvar=bin
7270 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7271 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7272 :     this via initialinstalllocation
7273 . ./setprefixvar
7274
7275 case "$userelocatableinc" in
7276 $define|true|[yY]*)     dflt='y' ;;
7277 *)                      dflt='n' ;;
7278 esac
7279 cat <<EOM
7280
7281 Would you like to build Perl so that the installation is relocatable, so that
7282 library paths in @INC are determined relative to the path of the perl binary?
7283 This is not advised for system Perl installs, or if you need to run setid
7284 scripts or scripts under taint mode.
7285
7286 If this doesn't make any sense to you, just accept the default '$dflt'.
7287 EOM
7288 rp='Use relocatable @INC?'
7289 . ./myread
7290 case "$ans" in
7291 y|Y)    val="$define" ;;
7292 *)      val="$undef"  ;;
7293 esac
7294 set userelocatableinc
7295 eval $setvar
7296
7297 initialinstalllocation="$binexp"
7298 : Default prefix is now "up one level from where the binaries are"
7299 case "$userelocatableinc" in
7300 $define|true|[yY]*)
7301     bin=".../"
7302     binexp=".../"
7303     prefix=".../.."
7304     prefixexp=".../.."
7305     installprefixexp=".../.."
7306     ;;
7307 esac
7308
7309 : determine where private library files go
7310 : Usual default is /usr/local/lib/perl5/$version.
7311 : Also allow things like /opt/perl/lib/$version, since
7312 : /opt/perl/lib/perl5... would be redundant.
7313 : The default "style" setting is made in installstyle.U
7314 case "$installstyle" in
7315 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7316 *)       set dflt privlib lib/$version ;;
7317 esac
7318 eval $prefixit
7319 $cat <<EOM
7320
7321 There are some auxiliary files for $package that need to be put into a
7322 private library directory that is accessible by everyone.
7323
7324 EOM
7325 fn=$binexp
7326 fn=d~+
7327 rp='Pathname where the private library files will reside?'
7328 . ./getfile
7329 prefixvar=privlib
7330 . ./setprefixvar
7331
7332 : set the prefixup variable, to restore leading tilda escape
7333 prefixup='case "$prefixexp" in
7334 "$prefix") ;;
7335 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7336 esac'
7337
7338 : determine where public architecture dependent libraries go
7339 set archlib archlib
7340 eval $prefixit
7341 : privlib default is /usr/local/lib/$package/$version
7342 : archlib default is /usr/local/lib/$package/$version/$archname
7343 : privlib may have an optional trailing /share.
7344 tdflt=`echo $privlib | $sed 's,/share$,,'`
7345 tdflt=$tdflt/$archname
7346 case "$archlib" in
7347 '')     dflt=$tdflt
7348         ;;
7349 *)      dflt="$archlib"
7350     ;;
7351 esac
7352 $cat <<EOM
7353
7354 $spackage contains architecture-dependent library files.  If you are
7355 sharing libraries in a heterogeneous environment, you might store
7356 these files in a separate location.  Otherwise, you can just include
7357 them with the rest of the public library files.
7358
7359 EOM
7360 fn=$binexp
7361 fn=d+~
7362 rp='Where do you want to put the public architecture-dependent libraries?'
7363 . ./getfile
7364 prefixvar=archlib
7365 . ./setprefixvar
7366 if $test X"$archlib" = X"$privlib"; then
7367         d_archlib="$undef"
7368 else
7369         d_archlib="$define"
7370 fi
7371
7372 : see if setuid scripts can be secure
7373 $cat <<EOM
7374
7375 Some kernels have a bug that prevents setuid #! scripts from being
7376 secure.  Some sites have disabled setuid #! scripts because of this.
7377
7378 First let's decide if your kernel supports secure setuid #! scripts.
7379 (If setuid #! scripts would be secure but have been disabled anyway,
7380 don't say that they are secure if asked.)
7381
7382 EOM
7383
7384 val="$undef"
7385 if $test -d /dev/fd; then
7386         echo "#!$ls" >reflect
7387         chmod +x,u+s reflect
7388         ./reflect >flect 2>&1
7389         if $contains "/dev/fd" flect >/dev/null; then
7390                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7391                 val="$define"
7392         else
7393                 $cat <<EOM
7394 If you are not sure if they are secure, I can check but I'll need a
7395 username and password different from the one you are using right now.
7396 If you don't have such a username or don't want me to test, simply
7397 enter 'none'.
7398
7399 EOM
7400                 rp='Other username to test security of setuid scripts with?'
7401                 dflt='none'
7402                 . ./myread
7403                 case "$ans" in
7404                 n|none)
7405                         case "$d_suidsafe" in
7406                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7407                                 dflt=n;;
7408                         "$undef")
7409                                 echo "Well, the $hint value is *not* secure." >&4
7410                                 dflt=n;;
7411                         *)      echo "Well, the $hint value *is* secure." >&4
7412                                 dflt=y;;
7413                         esac
7414                         ;;
7415                 *)
7416                         $rm -f reflect flect
7417                         echo "#!$ls" >reflect
7418                         chmod +x,u+s reflect
7419                         echo >flect
7420                         chmod a+w flect
7421                         echo '"su" will (probably) prompt you for '"$ans's password."
7422                         su $ans -c './reflect >flect'
7423                         if $contains "/dev/fd" flect >/dev/null; then
7424                                 echo "Okay, it looks like setuid scripts are secure." >&4
7425                                 dflt=y
7426                         else
7427                                 echo "I don't think setuid scripts are secure." >&4
7428                                 dflt=n
7429                         fi
7430                         ;;
7431                 esac
7432                 rp='Does your kernel have *secure* setuid scripts?'
7433                 . ./myread
7434                 case "$ans" in
7435                 [yY]*)  val="$define";;
7436                 *)      val="$undef";;
7437                 esac
7438         fi
7439 else
7440         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7441         echo "(That's for file descriptors, not floppy disks.)"
7442         val="$undef"
7443 fi
7444 set d_suidsafe
7445 eval $setvar
7446
7447 $rm -f reflect flect
7448
7449 : now see if they want to do setuid emulation
7450 if $test $patchlevel -lt 11; then
7451 echo " "
7452 val="$undef"
7453 case "$d_suidsafe" in
7454 "$define")
7455         val="$undef"
7456         echo "No need to emulate SUID scripts since they are secure here." >&4
7457         ;;
7458 *)
7459         $cat <<EOM
7460 Some systems have disabled setuid scripts, especially systems where
7461 setuid scripts cannot be secure.  On systems where setuid scripts have
7462 been disabled, the setuid/setgid bits on scripts are currently
7463 useless.  It is possible for $package to detect those bits and emulate
7464 setuid/setgid in a secure fashion.  This emulation will only work if
7465 setuid scripts have been disabled in your kernel.
7466
7467 EOM
7468         case "$d_dosuid" in
7469         "$define") dflt=y ;;
7470         *) dflt=n ;;
7471         esac
7472         rp="Do you want to do setuid/setgid emulation?"
7473         . ./myread
7474         case "$ans" in
7475         [yY]*)  val="$define";;
7476         *)      val="$undef";;
7477         esac
7478         ;;
7479 esac
7480 set d_dosuid
7481 eval $setvar
7482 else
7483     case "$d_dosuid" in
7484         "$define")
7485         cat >&4 <<EOH
7486
7487 SUID emulation has been removed for 5.12
7488 Please re-run Configure without -Dd_dosuid
7489
7490 EOH
7491         exit 1;
7492         ;;
7493     esac
7494     d_dosuid=undef
7495 fi
7496
7497 : Find perl5.005 or later.
7498 echo "Looking for a previously installed perl5.005 or later... "
7499 case "$perl5" in
7500 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7501                 : Check if this perl is recent and can load a simple module
7502                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7503                         perl5=$tdir/perl
7504                         break;
7505                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7506                         perl5=$tdir/perl5
7507                         break;
7508                 fi
7509         done
7510         ;;
7511 *)      perl5="$perl5"
7512         ;;
7513 esac
7514 case "$perl5" in
7515 '')     echo "None found.  That's ok.";;
7516 *)      echo "Using $perl5." ;;
7517 esac
7518
7519 : Set the siteprefix variables
7520 $cat <<EOM
7521
7522 After $package is installed, you may wish to install various
7523 add-on modules and utilities.  Typically, these add-ons will
7524 be installed under $prefix with the rest
7525 of this package.  However, you may wish to install such add-ons
7526 elsewhere under a different prefix.
7527
7528 If you do not wish to put everything under a single prefix, that's
7529 ok.  You will be prompted for the individual locations; this siteprefix
7530 is only used to suggest the defaults.
7531
7532 The default should be fine for most people.
7533
7534 EOM
7535 fn=d~+
7536 rp='Installation prefix to use for add-on modules and utilities?'
7537 : XXX Here might be another good place for an installstyle setting.
7538 case "$siteprefix" in
7539 '') dflt=$prefix ;;
7540 *)  dflt=$siteprefix ;;
7541 esac
7542 . ./getfile
7543 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7544 oldsiteprefix=''
7545 case "$siteprefix" in
7546 '') ;;
7547 *)      case "$ans" in
7548         "$prefix") ;;
7549         *) oldsiteprefix="$prefix";;
7550         esac
7551         ;;
7552 esac
7553 siteprefix="$ans"
7554 siteprefixexp="$ansexp"
7555
7556 : determine where site specific libraries go.
7557 : Usual default is /usr/local/lib/perl5/site_perl/$version
7558 : The default "style" setting is made in installstyle.U
7559 : XXX No longer works with Prefixit stuff.
7560 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7561 case "$sitelib" in
7562 '') case "$installstyle" in
7563         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7564         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7565         esac
7566         ;;
7567 *)      dflt="$sitelib"
7568         ;;
7569 esac
7570 $cat <<EOM
7571
7572 The installation process will create a directory for
7573 site-specific extensions and modules.  Most users find it convenient
7574 to place all site-specific files in this directory rather than in the
7575 main distribution directory.
7576
7577 EOM
7578 fn=d~+
7579 rp='Pathname for the site-specific library files?'
7580 . ./getfile
7581 prefixvar=sitelib
7582 . ./setprefixvar
7583 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7584
7585 : Determine list of previous versions to include in @INC
7586 $cat > getverlist <<EOPL
7587 #!$perl5 -w
7588 use File::Basename;
7589 \$api_versionstring = "$api_versionstring";
7590 \$version = "$version";
7591 \$stem = "$sitelib_stem";
7592 \$archname = "$archname";
7593 EOPL
7594         $cat >> getverlist <<'EOPL'
7595 # The list found is store twice for each entry: the original name, and
7596 # the binary broken down version as pack "sss", so sorting is easy and
7597 # unambiguous. This will work for all versions that have a maximum of
7598 # three digit groups, separate by '.'s or '_'s. Names are extended with
7599 # ".0.0" to ensure at least three elements for the pack.
7600 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7601
7602 # Can't have leading @ because metaconfig interprets it as a command!
7603 ;@inc_version_list=();
7604 # XXX Redo to do opendir/readdir?
7605 if (-d $stem) {
7606     chdir($stem);
7607     ;@candidates = map {
7608         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7609     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7610 }
7611 else {
7612     ;@candidates = ();
7613 }
7614
7615 ($pversion, $aversion, $vsn5005) = map {
7616     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7617 foreach $d (@candidates) {
7618     if ($d->[1] lt $pversion) {
7619         if ($d->[1] ge $aversion) {
7620             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7621         }
7622         elsif ($d->[1] ge $vsn5005) {
7623             unshift(@inc_version_list, grep { -d } $d->[0]);
7624         }
7625     }
7626     else {
7627         # Skip newer version.  I.e. don't look in
7628         # 5.7.0 if we're installing 5.6.1.
7629     }
7630 }
7631
7632 if (@inc_version_list) {
7633     print join(' ', @inc_version_list);
7634 }
7635 else {
7636     # Blank space to preserve value for next Configure run.
7637     print " ";
7638 }
7639 EOPL
7640 chmod +x getverlist
7641 case "$inc_version_list" in
7642 '')     if test -x "$perl5$exe_ext"; then
7643                 dflt=`$perl5 getverlist`
7644         else
7645                 dflt='none'
7646         fi
7647         ;;
7648 $undef) dflt='none' ;;
7649 *)  eval dflt=\"$inc_version_list\" ;;
7650 esac
7651 case "$dflt" in
7652 ''|' ') dflt=none ;;
7653 esac
7654 case "$dflt" in
7655 5.005) dflt=none ;;
7656 esac
7657 $cat <<EOM
7658
7659 In order to ease the process of upgrading, this version of perl
7660 can be configured to use modules built and installed with earlier
7661 versions of perl that were installed under $prefix.  Specify here
7662 the list of earlier versions that this version of perl should check.
7663 If Configure detected no earlier versions of perl installed under
7664 $prefix, then the list will be empty.  Answer 'none' to tell perl
7665 to not search earlier versions.
7666
7667 The default should almost always be sensible, so if you're not sure,
7668 just accept the default.
7669 EOM
7670
7671 rp='List of earlier versions to include in @INC?'
7672 . ./myread
7673 case "$ans" in
7674 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7675 *) inc_version_list="$ans" ;;
7676 esac
7677 case "$inc_version_list" in
7678 ''|' ')
7679         inc_version_list_init='0'
7680         d_inc_version_list="$undef"
7681         ;;
7682 *)      inc_version_list_init=`echo $inc_version_list |
7683                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7684         d_inc_version_list="$define"
7685         ;;
7686 esac
7687 $rm -f getverlist
7688
7689 : see if malloc/malloc.h has to be included
7690 set malloc/malloc.h i_mallocmalloc
7691 eval $inhdr
7692
7693 : see if this is a malloc.h system
7694 : we want a real compile instead of Inhdr because some systems have a
7695 : malloc.h that just gives a compile error saying to use stdlib.h instead
7696 echo " "
7697 $cat >try.c <<EOCP
7698 #include <stdlib.h>
7699 #include <malloc.h>
7700 #$i_mallocmalloc I_MALLOCMALLOC
7701 #ifdef I_MALLOCMALLOC
7702 # include <malloc/malloc.h>
7703 #endif
7704
7705 int main () { return 0; }
7706 EOCP
7707 set try
7708 if eval $compile; then
7709     echo "<malloc.h> found." >&4
7710     val="$define"
7711 else
7712     echo "<malloc.h> NOT found." >&4
7713     val="$undef"
7714 fi
7715 $rm_try
7716 set i_malloc
7717 eval $setvar
7718
7719 : check for length of pointer
7720 echo " "
7721 case "$ptrsize" in
7722 '')
7723         echo "Checking to see how big your pointers are..." >&4
7724         $cat >try.c <<EOCP
7725 #include <stdio.h>
7726 #$i_stdlib I_STDLIB
7727 #ifdef I_STDLIB
7728 #include <stdlib.h>
7729 #endif
7730 int main()
7731 {
7732     printf("%d\n", (int)sizeof(void *));
7733     exit(0);
7734 }
7735 EOCP
7736         set try
7737         if eval $compile_ok; then
7738                 ptrsize=`$run ./try`
7739                 echo "Your pointers are $ptrsize bytes long."
7740         else
7741                 dflt='4'
7742                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7743                 rp="What is the size of a pointer (in bytes)?"
7744                 . ./myread
7745                 ptrsize="$ans"
7746         fi
7747         ;;
7748 esac
7749 $rm_try
7750 case "$use64bitall" in
7751 "$define"|true|[yY]*)
7752         case "$ptrsize" in
7753         4)      cat <<EOM >&4
7754
7755 *** You have chosen a maximally 64-bit build,
7756 *** but your pointers are only 4 bytes wide.
7757 *** Please rerun Configure without -Duse64bitall.
7758 EOM
7759                 case "$d_quad" in
7760                 define)
7761                         cat <<EOM >&4
7762 *** Since you have quads, you could possibly try with -Duse64bitint.
7763 EOM
7764                         ;;
7765                 esac
7766                 cat <<EOM >&4
7767 *** Cannot continue, aborting.
7768
7769 EOM
7770
7771                 exit 1
7772                 ;;
7773         esac
7774         ;;
7775 esac
7776
7777
7778 : determine whether to use malloc wrapping
7779 echo " "
7780 case "$usemallocwrap" in
7781 [yY]*|true|$define)     dflt='y' ;;
7782 [nN]*|false|$undef)     dflt='n' ;;
7783 *)      case "$usedevel" in
7784         [yY]*|true|$define)     dflt='y' ;;
7785         *) dflt='n' ;;
7786         esac
7787         ;;
7788 esac
7789 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7790 . ./myread
7791 usemallocwrap="$ans"
7792 case "$ans" in
7793 y*|true)
7794         usemallocwrap="$define" ;;
7795 *)
7796         usemallocwrap="$undef" ;;
7797 esac
7798
7799 : determine which malloc to compile in
7800 echo " "
7801 case "$usemymalloc" in
7802 [yY]*|true|$define)     dflt='y' ;;
7803 [nN]*|false|$undef)     dflt='n' ;;
7804 *)      case "$ptrsize" in
7805         4) dflt='y' ;;
7806         *) dflt='n' ;;
7807         esac
7808         if test "$useithreads" = "$define"; then dflt='n'; fi
7809         ;;
7810 esac
7811 rp="Do you wish to attempt to use the malloc that comes with $package?"
7812 . ./myread
7813 usemymalloc="$ans"
7814 case "$ans" in
7815 y*|true)
7816         usemymalloc='y'
7817         mallocsrc='malloc.c'
7818         mallocobj="malloc$_o"
7819         d_mymalloc="$define"
7820         case "$libs" in
7821         *-lmalloc*)
7822                 : Remove malloc from list of libraries to use
7823                 echo "Removing unneeded -lmalloc from library list" >&4
7824                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7825                 shift
7826                 libs="$*"
7827                 echo "libs = $libs" >&4
7828                 ;;
7829         esac
7830         ;;
7831 *)
7832         usemymalloc='n'
7833         mallocsrc=''
7834         mallocobj=''
7835         d_mymalloc="$undef"
7836         ;;
7837 esac
7838
7839 : compute the return types of malloc and free
7840 echo " "
7841 $cat >malloc.c <<END
7842 #$i_malloc I_MALLOC
7843 #$i_stdlib I_STDLIB
7844 #include <stdio.h>
7845 #include <sys/types.h>
7846 #ifdef I_MALLOC
7847 #include <malloc.h>
7848 #endif
7849 #ifdef I_STDLIB
7850 #include <stdlib.h>
7851 #endif
7852 #ifdef TRY_MALLOC
7853 void *malloc();
7854 #endif
7855 #ifdef TRY_FREE
7856 void free();
7857 #endif
7858 END
7859 case "$malloctype" in
7860 '')
7861         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7862                 malloctype='void *'
7863         else
7864                 malloctype='char *'
7865         fi
7866         ;;
7867 esac
7868 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7869
7870 case "$freetype" in
7871 '')
7872         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7873                 freetype='void'
7874         else
7875                 freetype='int'
7876         fi
7877         ;;
7878 esac
7879 echo "Your system uses $freetype free(), it would seem." >&4
7880 $rm -f malloc.[co]
7881 : determine where site specific architecture-dependent libraries go.
7882 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7883 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7884 : sitelib may have an optional trailing /share.
7885 case "$sitearch" in
7886 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7887         dflt="$dflt/$archname"
7888         ;;
7889 *)      dflt="$sitearch"
7890         ;;
7891 esac
7892 set sitearch sitearch none
7893 eval $prefixit
7894 $cat <<EOM
7895
7896 The installation process will also create a directory for
7897 architecture-dependent site-specific extensions and modules.
7898
7899 EOM
7900 fn=d~+
7901 rp='Pathname for the site-specific architecture-dependent library files?'
7902 . ./getfile
7903 prefixvar=sitearch
7904 . ./setprefixvar
7905 if $test X"$sitearch" = X"$sitelib"; then
7906         d_sitearch="$undef"
7907 else
7908         d_sitearch="$define"
7909 fi
7910
7911 : Set the vendorprefix variables
7912 $cat <<EOM
7913
7914 The installation process will also create a directory for
7915 vendor-supplied add-ons.  Vendors who supply perl with their system
7916 may find it convenient to place all vendor-supplied files in this
7917 directory rather than in the main distribution directory.  This will
7918 ease upgrades between binary-compatible maintenance versions of perl.
7919
7920 Of course you may also use these directories in whatever way you see
7921 fit.  For example, you might use them to access modules shared over a
7922 company-wide network.
7923
7924 The default answer should be fine for most people.
7925 This causes further questions about vendor add-ons to be skipped
7926 and no vendor-specific directories will be configured for perl.
7927
7928 EOM
7929 rp='Do you want to configure vendor-specific add-on directories?'
7930 case "$usevendorprefix" in
7931 define|true|[yY]*) dflt=y ;;
7932 *)      : User may have set vendorprefix directly on Configure command line.
7933         case "$vendorprefix" in
7934         ''|' ') dflt=n ;;
7935         *)      dflt=y ;;
7936         esac
7937         ;;
7938 esac
7939 . ./myread
7940 case "$ans" in
7941 [yY]*)  fn=d~+
7942         rp='Installation prefix to use for vendor-supplied add-ons?'
7943         case "$vendorprefix" in
7944         '') dflt="$prefix" ;;
7945         *)  dflt=$vendorprefix ;;
7946         esac
7947         . ./getfile
7948         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7949         oldvendorprefix=''
7950         case "$vendorprefix" in
7951         '') ;;
7952         *)      case "$ans" in
7953                 "$prefix") ;;
7954                 *) oldvendorprefix="$prefix";;
7955                 esac
7956                 ;;
7957         esac
7958         usevendorprefix="$define"
7959         vendorprefix="$ans"
7960         vendorprefixexp="$ansexp"
7961         ;;
7962 *)      usevendorprefix="$undef"
7963         vendorprefix=''
7964         vendorprefixexp=''
7965         ;;
7966 esac
7967
7968 : Set the vendorlib variables
7969 case "$vendorprefix" in
7970 '')     d_vendorlib="$undef"
7971         vendorlib=''
7972         vendorlibexp=''
7973         ;;
7974 *)      d_vendorlib="$define"
7975         : determine where vendor-supplied modules go.
7976         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7977         case "$vendorlib" in
7978         '')
7979                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7980                 case "$installstyle" in
7981                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7982                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7983                 esac
7984                 ;;
7985         *)      dflt="$vendorlib"
7986                 ;;
7987         esac
7988         fn=d~+
7989         rp='Pathname for the vendor-supplied library files?'
7990         . ./getfile
7991         vendorlib="$ans"
7992         vendorlibexp="$ansexp"
7993         ;;
7994 esac
7995 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7996 prefixvar=vendorlib
7997 . ./installprefix
7998
7999 : Set the vendorarch variables
8000 case "$vendorprefix" in
8001 '')     d_vendorarch="$undef"
8002         vendorarch=''
8003         vendorarchexp=''
8004         ;;
8005 *)      d_vendorarch="$define"
8006         : determine where vendor-supplied architecture-dependent libraries go.
8007         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8008         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8009         : vendorlib may have an optional trailing /share.
8010         case "$vendorarch" in
8011         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8012                 dflt="$dflt/$archname"
8013                 ;;
8014         *)      dflt="$vendorarch" ;;
8015         esac
8016         fn=d~+
8017         rp='Pathname for vendor-supplied architecture-dependent files?'
8018         . ./getfile
8019         vendorarch="$ans"
8020         vendorarchexp="$ansexp"
8021         ;;
8022 esac
8023 prefixvar=vendorarch
8024 . ./installprefix
8025 if $test X"$vendorarch" = X"$vendorlib"; then
8026         d_vendorarch="$undef"
8027 else
8028         d_vendorarch="$define"
8029 fi
8030
8031 : Final catch-all directories to search
8032 $cat <<EOM
8033
8034 Lastly, you can have perl look in other directories for extensions and
8035 modules in addition to those already specified.
8036 These directories will be searched after
8037         $sitearch
8038         $sitelib
8039 EOM
8040 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8041 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8042 echo ' '
8043 case "$otherlibdirs" in
8044 ''|' ') dflt='none' ;;
8045 *)      dflt="$otherlibdirs" ;;
8046 esac
8047 $cat <<EOM
8048 Enter a colon-separated set of extra paths to include in perl's @INC
8049 search path, or enter 'none' for no extra paths.
8050
8051 EOM
8052
8053 rp='Colon-separated list of additional directories for perl to search?'
8054 . ./myread
8055 case "$ans" in
8056 ' '|''|none)    otherlibdirs=' ' ;;
8057 *)      otherlibdirs="$ans" ;;
8058 esac
8059 case "$otherlibdirs" in
8060 ' ') val=$undef ;;
8061 *)      val=$define ;;
8062 esac
8063 set d_perl_otherlibdirs
8064 eval $setvar
8065
8066 : Cruising for prototypes
8067 echo " "
8068 echo "Checking out function prototypes..." >&4
8069 $cat >prototype.c <<EOCP
8070 #$i_stdlib I_STDLIB
8071 #ifdef I_STDLIB
8072 #include <stdlib.h>
8073 #endif
8074 int main(int argc, char *argv[]) {
8075         exit(0);}
8076 EOCP
8077 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8078         echo "Your C compiler appears to support function prototypes."
8079         val="$define"
8080 else
8081         echo "Your C compiler doesn't seem to understand function prototypes."
8082         val="$undef"
8083 fi
8084 set prototype
8085 eval $setvar
8086 $rm -f prototype*
8087
8088 : Check if ansi2knr is required
8089 case "$prototype" in
8090 "$define") ;;
8091 *)      ansi2knr='ansi2knr'
8092         echo " "
8093         cat <<EOM >&4
8094
8095 $me:  FATAL ERROR:
8096 This version of $package can only be compiled by a compiler that
8097 understands function prototypes.  Unfortunately, your C compiler
8098         $cc $ccflags
8099 doesn't seem to understand them.  Sorry about that.
8100
8101 If GNU cc is available for your system, perhaps you could try that instead.
8102
8103 Eventually, we hope to support building Perl with pre-ANSI compilers.
8104 If you would like to help in that effort, please contact <perlbug@perl.org>.
8105
8106 Aborting Configure now.
8107 EOM
8108         exit 2
8109         ;;
8110 esac
8111
8112 : DTrace support
8113 dflt_dtrace='/usr/sbin/dtrace'
8114 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8115
8116 cat <<EOM
8117
8118 Perl can be built to support DTrace on platforms that support it.
8119 DTrace is a diagnosis and performance analysis tool from Sun.
8120
8121 If this doesn't make any sense to you, just accept the default.
8122 EOM
8123
8124 while $test 1 ; do
8125         case "$usedtrace" in
8126         $define|true|[yY]*)
8127                 dflt='y'
8128                 ;;
8129         ?*)
8130                 dflt='y'
8131                 dflt_dtrace=$usedtrace
8132                 ;;
8133         *)
8134                 dflt='n'
8135                 ;;
8136         esac
8137
8138         rp='Support DTrace if available?'
8139         . ./myread
8140         case "$ans" in
8141         y|Y)    val="$define" ;;
8142         *)      val="$undef" ;;
8143         esac
8144         set usedtrace
8145         eval $setvar
8146
8147         test "X$usedtrace" != "X$define" && break
8148
8149         echo " "
8150         rp='Where is the dtrace executable?'
8151         dflt=$dflt_dtrace
8152         . ./getfile
8153         val="$ans"
8154         set dtrace
8155         eval $setvar
8156
8157         if $test -f $dtrace
8158         then
8159                 if $dtrace -h -s ../perldtrace.d \
8160                         -o perldtrace.tmp >/dev/null 2>&1 \
8161                         && rm -f perldtrace.tmp
8162                 then
8163                         echo " "
8164                         echo "Good: your $dtrace knows about the -h flag."
8165                 else
8166                         cat >&2 <<EOM
8167
8168 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8169 ***
8170 *** Your installed dtrace doesn't support the -h switch to compile a D
8171 *** program into a C header. Can't continue.
8172
8173 EOM
8174                         exit 1
8175                 fi
8176                 break;
8177         fi
8178
8179         case "$fastread" in
8180         yes)
8181                 cat >&2 <<EOM
8182
8183 *** $me:  Fatal Error:  $dtrace not found.
8184 *** Can't continue.
8185
8186 EOM
8187                 exit 1
8188                 ;;
8189         *)
8190                 echo "*** $dtrace was not found."
8191                 echo " "
8192                 ;;
8193         esac
8194 done
8195
8196 : See if we want extra modules installed
8197 echo " "
8198 case "$extras" in
8199 '') dflt='n';;
8200 *) dflt='y';;
8201 esac
8202 cat <<EOM
8203 Perl can be built with extra modules or bundles of modules which
8204 will be fetched from the CPAN and installed alongside Perl.
8205
8206 Notice that you will need access to the CPAN; either via the Internet,
8207 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8208 be asked later to configure the CPAN.pm module which will in turn do
8209 the installation of the rest of the extra modules or bundles.)
8210
8211 Notice also that if the modules require any external software such as
8212 libraries and headers (the libz library and the zlib.h header for the
8213 Compress::Zlib module, for example) you MUST have any such software
8214 already installed, this configuration process will NOT install such
8215 things for you.
8216
8217 If this doesn't make any sense to you, just accept the default '$dflt'.
8218 EOM
8219 rp='Install any extra modules (y or n)?'
8220 . ./myread
8221 case "$ans" in
8222 y|Y)
8223         cat <<EOM
8224
8225 Please list any extra modules or bundles to be installed from CPAN,
8226 with spaces between the names.  The names can be in any format the
8227 'install' command of CPAN.pm will understand.  (Answer 'none',
8228 without the quotes, to install no extra modules or bundles.)
8229 EOM
8230         rp='Extras?'
8231         dflt="$extras"
8232         . ./myread
8233         extras="$ans"
8234 esac
8235 case "$extras" in
8236 ''|'none')
8237         val=''
8238         $rm -f ../extras.lst
8239         ;;
8240 *)      echo "(Saving the list of extras for later...)"
8241         echo "$extras" > ../extras.lst
8242         val="'$extras'"
8243         ;;
8244 esac
8245 set extras
8246 eval $setvar
8247 echo " "
8248
8249 : determine where html pages for programs go
8250 set html1dir html1dir none
8251 eval $prefixit
8252 $cat <<EOM
8253
8254 If you wish to install html files for programs in $spackage, indicate
8255 the appropriate directory here.  To skip installing html files,
8256 answer "none".
8257 EOM
8258 case "$html1dir" in
8259 ''|none|$undef|' ') dflt=none ;;
8260 *) dflt=$html1dir ;;
8261 esac
8262 fn=dn+~
8263 rp="Directory for the main $spackage html pages?"
8264 . ./getfile
8265 prefixvar=html1dir
8266 . ./setprefixvar
8267 : Use ' ' for none so value is preserved next time through Configure
8268 $test X"$html1dir" = "X" && html1dir=' '
8269
8270 : determine where html pages for libraries and modules go
8271 set html3dir html3dir none
8272 eval $prefixit
8273 $cat <<EOM
8274
8275 If you wish to install html files for modules associated with $spackage,
8276 indicate the appropriate directory here.  To skip installing html files,
8277 answer "none".
8278 EOM
8279 : There is no obvious default.  If they have specified html1dir, then
8280 : try to key off that, possibly changing .../html1 into .../html3.
8281 case "$html3dir" in
8282 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8283 *) dflt=$html3dir ;;
8284 esac
8285 fn=dn+~
8286 rp="Directory for the $spackage module html pages?"
8287 . ./getfile
8288 prefixvar=html3dir
8289 . ./setprefixvar
8290 : Use ' ' for none so value is preserved next time through Configure
8291 $test X"$html3dir" = "X" && html3dir=' '
8292
8293 : determine whether to install perl also as /usr/bin/perl
8294
8295 echo " "
8296 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8297         $cat <<EOM
8298 Many scripts expect perl to be installed as /usr/bin/perl.
8299
8300 If you want to, I can install the perl you are about to compile
8301 as /usr/bin/perl (in addition to $bin/perl).
8302 EOM
8303         if test -f /usr/bin/perl; then
8304             $cat <<EOM
8305
8306 However, please note that because you already have a /usr/bin/perl,
8307 overwriting that with a new Perl would very probably cause problems.
8308 Therefore I'm assuming you don't want to do that (unless you insist).
8309
8310 EOM
8311             case "$installusrbinperl" in
8312             "$define"|[yY]*)    dflt='y';;
8313             *)                  dflt='n';;
8314             esac
8315         else
8316             $cat <<EOM
8317
8318 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8319
8320 EOM
8321             case "$installusrbinperl" in
8322             "$undef"|[nN]*)     dflt='n';;
8323             *)                  dflt='y';;
8324             esac
8325         fi
8326         rp="Do you want to install perl as /usr/bin/perl?"
8327         . ./myread
8328         case "$ans" in
8329         [yY]*)  val="$define";;
8330         *)      val="$undef" ;;
8331         esac
8332 else
8333         val="$undef"
8334 fi
8335 set installusrbinperl
8336 eval $setvar
8337
8338 : see if dlopen exists
8339 xxx_runnm="$runnm"
8340 xxx_ccflags="$ccflags"
8341 runnm=false
8342 : with g++ one needs -shared to get is-in-libc to work for dlopen
8343 case "$gccversion" in
8344 '')     ;;
8345 *Clang*)        ;;
8346 *)      case "$d_cplusplus" in
8347         "$define") ccflags="$ccflags -shared" ;;
8348         esac
8349         ;;
8350 esac
8351 set dlopen d_dlopen
8352 eval $inlibc
8353 runnm="$xxx_runnm"
8354 ccflags="$xxx_ccflags"
8355
8356 : see if this is a unistd.h system
8357 set unistd.h i_unistd
8358 eval $inhdr
8359
8360 : determine which dynamic loading, if any, to compile in
8361 echo " "
8362 dldir="ext/DynaLoader"
8363 case "$usedl" in
8364     $define|y|true)
8365         dflt='y'
8366         usedl="$define"
8367         ;;
8368     $undef|n|false)
8369         dflt='n'
8370         usedl="$undef"
8371         ;;
8372     *)
8373         dflt='n'
8374         case "$d_dlopen" in
8375             $define) dflt='y' ;;
8376         esac
8377         : Does a dl_xxx.xs file exist for this operating system
8378         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8379         ;;
8380 esac
8381 rp="Do you wish to use dynamic loading?"
8382 . ./myread
8383 usedl="$ans"
8384 bin_ELF="$undef"
8385 case "$ans" in
8386     y*) usedl="$define"
8387         case "$dlsrc" in
8388             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8389                     dflt="$dldir/dl_${osname}.xs"
8390                 elif $test "$d_dlopen" = "$define" ; then
8391                     dflt="$dldir/dl_dlopen.xs"
8392                 else
8393                     dflt=''
8394                 fi
8395                 ;;
8396             *)  dflt="$dldir/$dlsrc"
8397                 ;;
8398         esac
8399         echo "The following dynamic loading files are available:"
8400         : Can not go over to $dldir because getfile has path hard-coded in.
8401         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8402         rp="Source file to use for dynamic loading"
8403         fn="fne"
8404         gfpth="$src"
8405         . ./getfile
8406         usedl="$define"
8407         : emulate basename
8408         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8409
8410         $cat << EOM
8411
8412 Some systems may require passing special flags to $cc -c to
8413 compile modules that will be used to create a shared library.
8414 To use no flags, say "none".
8415
8416 EOM
8417         case "$cccdlflags" in
8418             '') case "$gccversion" in
8419                 '') case "$osname" in
8420                         hpux)   dflt='+z' ;;
8421                         irix*)  dflt='-KPIC' ;;
8422                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8423                         sunos)  dflt='-pic' ;;
8424                         *)      dflt='none' ;;
8425                     esac
8426                     ;;
8427                 *)  case "$osname" in
8428                         darwin) dflt='none' ;;
8429                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8430                         *)      dflt='-fpic' ;;
8431                     esac ;;
8432                 esac ;;
8433             ' ') dflt='none' ;;
8434             *)   dflt="$cccdlflags" ;;
8435         esac
8436
8437         case "$dflt" in
8438             none) dflt='' ;;
8439         esac
8440
8441         # If -Dsysroot was specified, now's the time to add it
8442         # to cccdlflags
8443         if test "X$sysroot" != X; then
8444             case "$gccversion" in
8445                 '') ;;
8446                 *)  case "$dflt" in
8447                         *sysroot*) ;;
8448                         'undef'|*)
8449                             dflt="$dflt --sysroot=$sysroot" ;;
8450                     esac
8451                     ;;
8452             esac
8453         fi
8454
8455         case "$dflt" in
8456             '') dflt='none';;
8457         esac
8458
8459         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8460         . ./myread
8461         case "$ans" in
8462             none) cccdlflags=' ' ;;
8463             *)    cccdlflags="$ans" ;;
8464         esac
8465
8466         cat << EOM
8467
8468 Some systems use ld to create libraries that can be dynamically loaded,
8469 while other systems (such as those using ELF) use $cc.
8470
8471 EOM
8472
8473 : Determine if this is ELF
8474         $cat >try.c <<EOM
8475 /* Test for whether ELF binaries are produced */
8476 #include <fcntl.h>
8477 #$i_stdlib I_STDLIB
8478 #ifdef I_STDLIB
8479 #include <stdlib.h>
8480 #endif
8481 #$i_unistd I_UNISTD
8482 #ifdef I_UNISTD
8483 #include <unistd.h>
8484 #endif
8485 int main() {
8486     char b[4];
8487     int i = open("a.out",O_RDONLY);
8488     if(i == -1)
8489         exit(1); /* fail */
8490     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8491         exit(0); /* succeed (yes, it is ELF) */
8492     exit(1); /* fail */
8493 }
8494 EOM
8495         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8496             bin_ELF="$define"
8497         fi
8498         $rm_try
8499
8500         case "$ld" in
8501             '') if $test $bin_ELF = "$define"; then
8502                     cat <<EOM
8503 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8504 EOM
8505                     dflt="$cc"
8506                 else
8507                     echo "I'll use ld to build dynamic libraries."
8508                     dflt='ld'
8509                 fi
8510                 ;;
8511             *)  dflt="$ld"
8512                 ;;
8513         esac
8514
8515         rp="What command should be used to create dynamic libraries?"
8516         . ./myread
8517         ld="$ans"
8518
8519         cat << EOM
8520
8521 Some systems may require passing special flags to $ld to create a
8522 library that can be dynamically loaded.  If your ld flags include
8523 -L/other/path options to locate libraries outside your loader's normal
8524 search path, you may need to specify those -L options here as well.  To
8525 use no flags, say "none".
8526
8527 EOM
8528         case "$lddlflags" in
8529             '') case "$osname" in
8530                     haiku) dflt='-shared' ;;
8531                     hpux) dflt='-b';
8532                           case "$gccversion" in
8533                               '') dflt="$dflt +vnocompatwarnings" ;;
8534                           esac
8535                           ;;
8536                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8537                     solaris) # See [perl #66604].
8538                             # On Solaris 11, gcc -m64 on amd64
8539                             # appears not to understand -G.  gcc versions at
8540                             # least as old as 3.4.3 support -shared, so just
8541                             # use that with Solaris 11 and later, but keep
8542                             # the old behavior for older Solaris versions.
8543                             case "$gccversion" in
8544                                 '') dflt='-G' ;;
8545                                 *)  case "$osvers" in
8546                                         2.?|2.10) dflt='-G' ;;
8547                                         *) dflt='-shared' ;;
8548                                     esac
8549                                     ;;
8550                             esac
8551                             ;;
8552                     sunos) dflt='-assert nodefinitions' ;;
8553                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8554                     *)     dflt='none' ;;
8555                 esac
8556                 ;;
8557             *) dflt="$lddlflags" ;;
8558         esac
8559
8560         : Only do this for gcc, since, for example, qcc has no concept
8561         : of --sysroot.
8562         if $test "X$sysroot" != X; then
8563             case "$gccversion" in
8564                 '') ;;
8565                 *)  dflt="$dflt --sysroot $sysroot" ;;
8566             esac
8567         fi
8568
8569         : Try to guess additional flags to pick up local libraries.
8570         : Be careful not to append to a plain 'none'
8571         case "$dflt" in
8572             none) dflt='' ;;
8573         esac
8574         for thisflag in $ldflags; do
8575             case "$thisflag" in
8576                 -L*|-R*|-Wl,-R*)
8577                     case " $dflt " in
8578                         *" $thisflag "*) ;;
8579                         *) dflt="$dflt $thisflag" ;;
8580                     esac
8581                     ;;
8582             esac
8583         done
8584
8585         case "$dflt" in
8586             ''|' ') dflt='none' ;;
8587         esac
8588
8589         case "$ldflags" in
8590             *-fstack-protector-strong*)
8591                 case "$dflt" in
8592                     *-fstack-protector-strong*) ;; # Don't add it again
8593                     *) dflt="$dflt -fstack-protector-strong" ;;
8594                 esac
8595                 ;;
8596             *-fstack-protector*)
8597                 case "$dflt" in
8598                     *-fstack-protector*) ;; # Don't add it again
8599                     *) dflt="$dflt -fstack-protector" ;;
8600                 esac
8601                 ;;
8602         esac
8603
8604         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8605         . ./myread
8606         case "$ans" in
8607             none) lddlflags=' ' ;;
8608             *) lddlflags="$ans" ;;
8609         esac
8610
8611         cat <<EOM
8612
8613 Some systems may require passing special flags to $cc to indicate that
8614 the resulting executable will use dynamic linking.  To use no flags,
8615 say "none".
8616
8617 EOM
8618         case "$ccdlflags" in
8619             '') case "$osname" in
8620                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8621                     sunos)             dflt='none'   ;;
8622                     *)                 dflt='none'   ;;
8623                 esac ;;
8624             ' ') dflt='none' ;;
8625             *)   dflt="$ccdlflags" ;;
8626         esac
8627         rp="Any special flags to pass to $cc to use dynamic linking?"
8628         . ./myread
8629         case "$ans" in
8630             none) ccdlflags=' ' ;;
8631             *)    ccdlflags="$ans" ;;
8632         esac
8633         ;;
8634
8635     *)  usedl="$undef"
8636         ld='ld'
8637         dlsrc='dl_none.xs'
8638         lddlflags=''
8639         ccdlflags=''
8640         ;;
8641 esac
8642
8643 ld_can_script="$undef"
8644 case "$bin_ELF$usedl" in
8645     $define$define)
8646         # Abuse try.h and a.out names for neat cleanup
8647         $cat >try.c <<EOM
8648 void foo() {}
8649 void bar() {}
8650 EOM
8651         $cat >try.h <<EOM
8652 LIBTEST_42 {
8653  global:
8654   foo;
8655  local: *;
8656  };
8657 EOM
8658         if $cc $cccdlflags $ccdlflags $ccflags \
8659                $ldflags $lddlflags -o a.out try.c \
8660                -Wl,--version-script=try.h >/dev/null 2>&1 \
8661            &&  $test -s a.out ; then
8662             echo "ld supports scripting" >&4
8663             ld_can_script="$define"
8664         else
8665             echo "ld does not support scripting" >&4
8666         fi
8667         $rm_try
8668         ;;
8669 esac
8670
8671 : Do we want a shared libperl?
8672 also=''
8673 case "$usedl" in
8674 $undef)
8675         # No dynamic loading being used, so don't bother even to prompt.
8676         useshrplib='false'
8677         ;;
8678 *)      case "$useshrplib" in
8679         '')     case "$osname" in
8680                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8681                         dflt=y
8682                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8683                         ;;
8684                 *)      dflt=n
8685                         ;;
8686                 esac
8687                 ;;
8688         $define|true|[Yy]*)
8689                 dflt=y
8690                 ;;
8691         *)      dflt=n
8692                 ;;
8693         esac
8694         $cat << EOM
8695
8696 The perl executable is normally obtained by linking perlmain.c with
8697 libperl${_a}, any static extensions (usually just DynaLoader), and
8698 any other libraries needed on this system (such as -lm, etc.).  Since
8699 your system supports dynamic loading, it is probably possible to build
8700 a shared libperl.$so.  If you will have more than one executable linked
8701 to libperl.$so, this will significantly reduce the size of each
8702 executable, but it may have a noticeable effect on performance.  The
8703 default is probably sensible for your system.
8704 $also
8705
8706 EOM
8707         rp="Build a shared libperl.$so (y/n)"
8708         . ./myread
8709         case "$ans" in
8710         true|$define|[Yy]*)
8711                 useshrplib='true'  ;;
8712         *)      useshrplib='false' ;;
8713         esac
8714         ;;
8715 esac
8716
8717 case "$useshrplib" in
8718 true)
8719         case "$userelocatableinc" in
8720         true|define)
8721                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8722                 echo "See INSTALL for an explanation why that won't work." >&4
8723                 exit 4
8724                 ;;
8725         esac
8726         case "$libperl" in
8727         '')
8728                 # Figure out a good name for libperl.so.  Since it gets stored in
8729                 # a version-specific architecture-dependent library, the version
8730                 # number isn't really that important, except for making cc/ld happy.
8731                 #
8732                 # A name such as libperl.so.10.1
8733                 majmin="libperl.$so.$patchlevel.$subversion"
8734                 # A name such as libperl.so.100
8735                 majonly=`echo $patchlevel $subversion |
8736                         $awk '{printf "%d%02d", $1, $2}'`
8737                 majonly=libperl.$so.$majonly
8738                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8739                 # rely on figuring it out from the naming of libc.
8740                 case "${osname}${osvers}" in
8741                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8742                         dflt=libperl.$so
8743                         ;;
8744                 cygwin*) # ld links now against the dll directly
8745                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8746                         majonly=`echo $patchlevel $subversion |
8747                                 $awk '{printf "%03d%03d", $1, $2}'`
8748                         majonly=cygperl5.$majonly.$so
8749                         dflt=$majmin
8750                         ;;
8751                 *)      # Try to guess based on whether libc has major.minor.
8752                         case "$libc" in
8753                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8754                         *libc.$so.[0-9]*) dflt=$majonly ;;
8755                         *)      dflt=libperl.$so ;;
8756                         esac
8757                         ;;
8758                 esac
8759                 ;;
8760         *)      dflt=$libperl
8761                 ;;
8762         esac
8763         cat << EOM
8764
8765 I need to select a good name for the shared libperl.  If your system uses
8766 library names with major and minor numbers, then you might want something
8767 like $majmin.  Alternatively, if your system uses a single version
8768 number for shared libraries, then you might want to use $majonly.
8769 Or, your system might be quite happy with a simple libperl.$so.
8770
8771 Since the shared libperl will get installed into a version-specific
8772 architecture-dependent directory, the version number of the shared perl
8773 library probably isn't important, so the default should be o.k.
8774
8775 EOM
8776         rp='What name do you want to give to the shared libperl?'
8777         . ./myread
8778         libperl=$ans
8779         echo "Ok, I'll use $libperl"
8780         ;;
8781 *)
8782         libperl="libperl${_a}"
8783         ;;
8784 esac
8785
8786 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8787 case "$shrpdir" in
8788 '') ;;
8789 *)      $cat >&4 <<EOM
8790 WARNING:  Use of the shrpdir variable for the installation location of
8791 the shared $libperl is not supported.  It was never documented and
8792 will not work in this version.  Let me (perlbug@perl.org)
8793 know of any problems this may cause.
8794
8795 EOM
8796         case "$shrpdir" in
8797         "$archlibexp/CORE")
8798                 $cat >&4 <<EOM
8799 But your current setting of $shrpdir is
8800 the default anyway, so it's harmless.
8801 EOM
8802                 ;;
8803         *)
8804                 $cat >&4 <<EOM
8805 Further, your current attempted setting of $shrpdir
8806 conflicts with the value of $archlibexp/CORE
8807 that installperl will use.
8808 EOM
8809                 ;;
8810         esac
8811         ;;
8812 esac
8813
8814 # How will the perl executable find the installed shared $libperl?
8815 # Add $xxx to ccdlflags.
8816 # If we can't figure out a command-line option, use $shrpenv to
8817 # set env LD_RUN_PATH.  The main perl makefile uses this.
8818 shrpdir=$archlibexp/CORE
8819 xxx=''
8820 tmp_shrpenv=''
8821 if "$useshrplib"; then
8822     case "$osname" in
8823         aix)
8824                 # We'll set it in Makefile.SH...
8825                 ;;
8826         solaris)
8827                 xxx="-R $shrpdir"
8828                 ;;
8829         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8830                 xxx="-Wl,-R$shrpdir"
8831                 ;;
8832         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8833                 xxx="-Wl,-rpath,$shrpdir"
8834                 ;;
8835         hpux*)
8836                 # hpux doesn't like the default, either.
8837                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8838                 ;;
8839         cygwin)
8840                 # cygwin needs only ldlibpth
8841                 ;;
8842         *)
8843                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8844                 ;;
8845         esac
8846         case "$xxx" in
8847         '') ;;
8848         *)
8849                 # Only add $xxx if it isn't already in ccdlflags.
8850                 case " $ccdlflags " in
8851                 *" $xxx "*)     ;;
8852                 *)      ccdlflags="$ccdlflags $xxx"
8853                         cat <<EOM >&4
8854
8855 Adding $xxx to the flags
8856 passed to $ld so that the perl executable will find the
8857 installed shared $libperl.
8858
8859 EOM
8860                         ;;
8861                 esac
8862                 ;;
8863         esac
8864 fi
8865 # Fix ccdlflags in AIX for building external extensions.
8866 # (For building Perl itself bare -bE:perl.exp is needed,
8867 #  Makefile.SH takes care of this.)
8868 case "$osname" in
8869 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8870 esac
8871 # Respect a hint or command-line value.
8872 case "$shrpenv" in
8873 '') shrpenv="$tmp_shrpenv" ;;
8874 esac
8875 case "$ldlibpthname" in
8876 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8877 none)   ldlibpthname='' ;;
8878 esac
8879
8880 : determine where manual pages are on this system
8881 echo " "
8882 case "$sysman" in
8883 '')
8884         syspath='/usr/share/man/man1 /usr/man/man1'
8885         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8886         syspath="$syspath /usr/man/u_man/man1"
8887         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8888         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8889         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8890         sysman=`./loc . /usr/man/man1 $syspath`
8891         ;;
8892 esac
8893 if $test -d "$sysman"; then
8894         echo "System manual is in $sysman." >&4
8895 else
8896         echo "Could not find manual pages in source form." >&4
8897 fi
8898
8899 : determine where manual pages go
8900 set man1dir man1dir none
8901 eval $prefixit
8902 $cat <<EOM
8903
8904 $spackage has manual pages available in source form.
8905 EOM
8906 case "$nroff" in
8907 nroff)
8908         echo "However, you don't have nroff, so they're probably useless to you."
8909         case "$man1dir" in
8910         '') man1dir="none";;
8911         esac;;
8912 esac
8913 echo "If you don't want the manual sources installed, answer 'none'."
8914 case "$man1dir" in
8915 ' ') dflt=none
8916         ;;
8917 '')
8918         lookpath="$prefixexp/share/man/man1"
8919         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8920         lookpath="$lookpath $prefixexp/man/p_man/man1"
8921         lookpath="$lookpath $prefixexp/man/u_man/man1"
8922         lookpath="$lookpath $prefixexp/man/man.1"
8923         case "$sysman" in
8924         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8925         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8926         esac
8927         set dflt
8928         eval $prefixup
8929         ;;
8930 *)  dflt="$man1dir"
8931         ;;
8932 esac
8933 echo " "
8934 fn=dn+~
8935 rp="Where do the main $spackage manual pages (source) go?"
8936 . ./getfile
8937 if $test "X$man1direxp" != "X$ansexp"; then
8938         installman1dir=''
8939 fi
8940 prefixvar=man1dir
8941 . ./setprefixvar
8942
8943 case "$man1dir" in
8944 '')     man1dir=' '
8945         installman1dir='';;
8946 esac
8947
8948 : What suffix to use on installed man pages
8949
8950 case "$man1dir" in
8951 ' ')
8952         man1ext='0'
8953         ;;
8954 *)
8955         rp="What suffix should be used for the main $spackage man pages?"
8956         case "$man1ext" in
8957         '')     case "$man1dir" in
8958                 *1)  dflt=1 ;;
8959                 *1p) dflt=1p ;;
8960                 *1pm) dflt=1pm ;;
8961                 *l) dflt=l;;
8962                 *n) dflt=n;;
8963                 *o) dflt=o;;
8964                 *p) dflt=p;;
8965                 *C) dflt=C;;
8966                 *L) dflt=L;;
8967                 *L1) dflt=L1;;
8968                 *) dflt=1;;
8969                 esac
8970                 ;;
8971         *)      dflt="$man1ext";;
8972         esac
8973         . ./myread
8974         man1ext="$ans"
8975         ;;
8976 esac
8977
8978 : see if we can have long filenames
8979 echo " "
8980 first=123456789abcdef
8981 $rm -f $first
8982 if (echo hi >$first) 2>/dev/null; then
8983         if $test -f 123456789abcde; then
8984                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8985                 val="$undef"
8986         else
8987                 echo 'You can have filenames longer than 14 characters.'>&4
8988                 val="$define"
8989         fi
8990 else
8991         $cat <<'EOM'
8992 You can't have filenames longer than 14 chars.
8993 You can't even think about them!
8994 EOM
8995         val="$undef"
8996 fi
8997 set d_flexfnam
8998 eval $setvar
8999 $rm -rf 123456789abcde*
9000
9001 : determine where library module manual pages go
9002 set man3dir man3dir none
9003 eval $prefixit
9004 $cat <<EOM
9005
9006 $spackage has manual pages for many of the library modules.
9007 EOM
9008
9009 case "$nroff" in
9010 nroff)
9011         $cat <<'EOM'
9012 However, you don't have nroff, so they're probably useless to you.
9013 EOM
9014         case "$man3dir" in
9015         '') man3dir="none";;
9016         esac;;
9017 esac
9018
9019 case "$d_flexfnam" in
9020 undef)
9021         $cat <<'EOM'
9022 However, your system can't handle the long file names like File::Basename.3.
9023 EOM
9024         case "$man3dir" in
9025         '') man3dir="none";;
9026         esac;;
9027 esac
9028
9029 echo "If you don't want the manual sources installed, answer 'none'."
9030 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9031 case "$man3dir" in
9032 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9033         if $test -d "$privlib/man/man3"; then
9034                 cat <<EOM >&4
9035
9036 WARNING:  Previous versions of perl installed man3 pages into
9037 $privlib/man/man3.  This version will suggest a
9038 new default of $dflt.
9039 EOM
9040                 tdflt=$dflt
9041                 dflt='n'
9042                 rp='Do you wish to preserve the old behavior?(y/n)'
9043                 . ./myread
9044                 case "$ans" in
9045                 y*) dflt="$privlib/man/man3" ;;
9046                 *)  dflt=$tdflt ;;
9047                 esac
9048     fi
9049         ;;
9050 *)      dflt="$man3dir" ;;
9051 esac
9052 case "$dflt" in
9053 ' ') dflt=none ;;
9054 esac
9055 echo " "
9056 fn=dn+~
9057 rp="Where do the $package library man pages (source) go?"
9058 . ./getfile
9059 prefixvar=man3dir
9060 . ./setprefixvar
9061
9062 case "$man3dir" in
9063 '')     man3dir=' '
9064         installman3dir='';;
9065 esac
9066
9067 : What suffix to use on installed man pages
9068 case "$man3dir" in
9069 ' ')
9070         man3ext='0'
9071         ;;
9072 *)
9073         rp="What suffix should be used for the $package library man pages?"
9074         case "$man3ext" in
9075         '')     case "$man3dir" in
9076                 *3)  dflt=3 ;;
9077                 *3p) dflt=3p ;;
9078                 *3pm) dflt=3pm ;;
9079                 *l) dflt=l;;
9080                 *n) dflt=n;;
9081                 *o) dflt=o;;
9082                 *p) dflt=p;;
9083                 *C) dflt=C;;
9084                 *L) dflt=L;;
9085                 *L3) dflt=L3;;
9086                 *) dflt=3;;
9087                 esac
9088                 ;;
9089         *)      dflt="$man3ext";;
9090         esac
9091         . ./myread
9092         man3ext="$ans"
9093         ;;
9094 esac
9095
9096 : see if we have to deal with yellow pages, now NIS.
9097 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9098         case "$hostcat" in
9099         nidump*) ;;
9100         *)
9101                 case "$hostcat" in
9102                 *ypcat*) dflt=y;;
9103                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9104                                 dflt=y
9105                         else
9106                                 dflt=n
9107                         fi;;
9108                 *) dflt=n;;
9109                 esac
9110                 echo " "
9111                 rp='Are you getting the hosts file via yellow pages?'
9112                 . ./myread
9113                 case "$ans" in
9114                 y*) hostcat='ypcat hosts';;
9115                 *) hostcat='cat /etc/hosts';;
9116                 esac
9117                 ;;
9118         esac
9119 fi
9120 case "$hostcat" in
9121 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9122 esac
9123 case "$groupcat" in
9124 '') test -f /etc/group && groupcat='cat /etc/group';;
9125 esac
9126 case "$passcat" in
9127 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9128 esac
9129
9130 : now get the host name
9131 echo " "
9132 echo "Figuring out host name..." >&4
9133 case "$myhostname" in
9134 '') cont=true
9135         echo 'Maybe "hostname" will work...'
9136         if tans=`sh -c hostname 2>&1` ; then
9137                 myhostname=$tans
9138                 phostname=hostname
9139                 cont=''
9140         fi
9141         ;;
9142 *) cont='';;
9143 esac
9144 if $test "$cont"; then
9145         if ./xenix; then
9146                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9147                 if tans=`cat /etc/systemid 2>&1` ; then
9148                         myhostname=$tans
9149                         phostname='cat /etc/systemid'
9150                         echo "Whadyaknow.  Xenix always was a bit strange..."
9151                         cont=''
9152                 fi
9153         elif $test -r /etc/systemid; then
9154                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9155         fi
9156 fi
9157 if $test "$cont"; then
9158         echo 'No, maybe "uuname -l" will work...'
9159         if tans=`sh -c 'uuname -l' 2>&1` ; then
9160                 myhostname=$tans
9161                 phostname='uuname -l'
9162         else
9163                 echo 'Strange.  Maybe "uname -n" will work...'
9164                 if tans=`sh -c 'uname -n' 2>&1` ; then
9165                         myhostname=$tans
9166                         phostname='uname -n'
9167                 else
9168                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9169                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9170                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9171                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9172                         else
9173                                 case "$myhostname" in
9174                                 '') echo "Does this machine have an identity crisis or something?"
9175                                         phostname='';;
9176                                 *)
9177                                         echo "Well, you said $myhostname before..."
9178                                         phostname='echo $myhostname';;
9179                                 esac
9180                         fi
9181                 fi
9182         fi
9183 fi
9184 case "$myhostname" in
9185 '') myhostname=noname ;;
9186 esac
9187 : you do not want to know about this
9188 set $myhostname
9189 myhostname=$1
9190
9191 : verify guess
9192 if $test "$myhostname" ; then
9193         dflt=y
9194         rp='Your host name appears to be "'$myhostname'".'" Right?"
9195         . ./myread
9196         case "$ans" in
9197         y*) ;;
9198         *) myhostname='';;
9199         esac
9200 fi
9201
9202 : bad guess or no guess
9203 while $test "X$myhostname" = X ; do
9204         dflt=''
9205         rp="Please type the (one word) name of your host:"
9206         . ./myread
9207         myhostname="$ans"
9208 done
9209
9210 : translate upper to lower if necessary
9211 case "$myhostname" in
9212 *[A-Z]*)
9213         echo "(Normalizing case in your host name)"
9214         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9215         ;;
9216 esac
9217
9218 case "$myhostname" in
9219 *.*)
9220         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9221         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9222         echo "(Trimming domain name from host name--host name is now $myhostname)"
9223         ;;
9224 *) case "$mydomain" in
9225         '')
9226                 {
9227                         test "X$hostcat" = "Xypcat hosts" &&
9228                         ypmatch "$myhostname" hosts 2>/dev/null |\
9229                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9230                         $test -s hosts
9231                 } || {
9232                         test "X$hostcat" != "X" &&
9233                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9234                                         /[       ]$myhostname[  . ]/p" > hosts
9235                 }
9236                 tmp_re="[       . ]"
9237                 if $test -f hosts; then
9238                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9239                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9240                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9241                                 hosts | $sort | $uniq | \
9242                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9243                         case `$echo X$dflt` in
9244                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9245                                 dflt=.
9246                                 ;;
9247                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9248                                 ;;
9249                         esac
9250                 else
9251                         echo "(I cannot locate a hosts database anywhere)"
9252                         dflt=.
9253                 fi
9254                 case "$dflt" in
9255                 .)
9256                         tans=`./loc resolv.conf X /etc /usr/etc`
9257                         if $test -f "$tans"; then
9258                                 echo "(Attempting domain name extraction from $tans)"
9259                                 dflt=.`$sed -n -e 's/   / /g' \
9260                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9261                                   -e 1q 2>/dev/null`
9262                                 case "$dflt" in
9263                                 .) dflt=.`$sed -n -e 's/        / /g' \
9264                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9265                                      -e 1q 2>/dev/null`
9266                                         ;;
9267                                 esac
9268                         fi
9269                         ;;
9270                 esac
9271                 case "$dflt" in
9272                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9273                         dflt=.`sh -c domainname 2>/dev/null`
9274                         case "$dflt" in
9275                         '') dflt='.';;
9276                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9277                         esac
9278                         ;;
9279                 esac
9280                 case "$dflt$osname" in
9281                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9282                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9283                         ;;
9284                 esac
9285                 case "$dflt" in
9286                 .) echo "(Lost all hope -- silly guess then)"
9287                         dflt='.nonet'
9288                         ;;
9289                 esac
9290                 $rm -f hosts
9291                 ;;
9292         *) dflt="$mydomain";;
9293         esac;;
9294 esac
9295 echo " "
9296 rp="What is your domain name?"
9297 . ./myread
9298 tans="$ans"
9299 case "$ans" in
9300 '') ;;
9301 .*) ;;
9302 *) tans=".$tans";;
9303 esac
9304 mydomain="$tans"
9305
9306 : translate upper to lower if necessary
9307 case "$mydomain" in
9308 *[A-Z]*)
9309         echo "(Normalizing case in your domain name)"
9310         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9311         ;;
9312 esac
9313
9314 : a little sanity check here
9315 case "$phostname" in
9316 '') ;;
9317 *)
9318         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9319         $myhostname$mydomain|$myhostname) ;;
9320         *)
9321                 case "$phostname" in
9322                 sed*)
9323                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9324                         ;;
9325                 *)
9326                         echo "(That doesn't agree with your $phostname command, by the way.)"
9327                         ;;
9328                 esac
9329         ;;
9330         esac
9331         ;;
9332 esac
9333
9334 : determine the e-mail address of the user who is running us
9335 $cat <<EOM
9336
9337 I need to get your e-mail address in Internet format if possible, i.e.
9338 something like user@host.domain. Please answer accurately since I have
9339 no easy means to double check it. The default value provided below
9340 is most probably close to reality but may not be valid from outside
9341 your organization...
9342
9343 EOM
9344 cont=x
9345 while test "$cont"; do
9346         case "$MAILDOMAIN" in
9347         '')
9348                 if $test -s /etc/mailname; then
9349                         maildomain=`$cat /etc/mailname`
9350                 else
9351                         maildomain="$myhostname$mydomain"
9352                 fi
9353                 ;;
9354         *)  maildomain="$MAILDOMAIN";;
9355         esac
9356         case "$cf_email" in
9357         '') dflt="$cf_by@$maildomain";;
9358         *)  dflt="$cf_email";;
9359         esac
9360         rp='What is your e-mail address?'
9361         . ./myread
9362         cf_email="$ans"
9363         case "$cf_email" in
9364         *@*.*) cont='' ;;
9365         *)
9366                 rp='Address does not look like an Internet one.  Use it anyway?'
9367                 case "$fastread" in
9368                 yes) dflt=y ;;
9369                 *) dflt=n ;;
9370                 esac
9371                 . ./myread
9372                 case "$ans" in
9373                 y*) cont='' ;;
9374                 *) echo " " ;;
9375                 esac
9376                 ;;
9377         esac
9378 done
9379
9380 : Ask e-mail of administrator
9381 $cat <<EOM
9382
9383 If you or somebody else will be maintaining perl at your site, please
9384 fill in the correct e-mail address here so that they may be contacted
9385 if necessary. Currently, the "perlbug" program included with perl
9386 will send mail to this address in addition to perlbug@perl.org. You may
9387 enter "none" for no administrator.
9388
9389 EOM
9390 case "$perladmin" in
9391 '') dflt="$cf_email";;
9392 *) dflt="$perladmin";;
9393 esac
9394 rp='Perl administrator e-mail address'
9395 . ./myread
9396 perladmin="$ans"
9397
9398 : determine whether to use a version number suffix for installed binaries
9399 echo " "
9400 $cat <<EOM
9401 Do you want to use a version number suffix for installed binaries? This
9402 will install 'perl$version' instead of 'perl', and likewise for other
9403 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9404 to be installed side-by-side. Unless you are a developer, you probably
9405 do *not* want to do this.
9406 EOM
9407 case "$versiononly" in
9408 "$define"|[Yy]*|true) dflt='y' ;;
9409 *) dflt='n';
9410 esac
9411 rp="Do you want to use a version number suffix for installed binaries?"
9412 . ./myread
9413 case "$ans" in
9414 [yY]*)  val="$define";;
9415 *)      val="$undef" ;;
9416 esac
9417 set versiononly
9418 eval $setvar
9419
9420 case "$versiononly" in
9421 "$define") inc_version_list=''
9422            inc_version_list_init=0
9423            ;;
9424 esac
9425
9426 : figure out how to guarantee perl startup
9427 : XXX Note that this currently takes advantage of the bug that binexp ignores
9428 :     the Configure -Dinstallprefix setting, which in turn means that under
9429 :     relocatable @INC, initialinstalllocation is what binexp started as.
9430 case "$startperl" in
9431 '')
9432         case "$sharpbang" in
9433         *!)
9434                 $cat <<EOH
9435
9436 I can use the #! construct to start perl on your system. This will
9437 make startup of perl scripts faster, but may cause problems if you
9438 want to share those scripts and perl is not in a standard place
9439 ($initialinstalllocation/perl) on all your platforms. The alternative
9440 is to force a shell by starting the script with a single ':' character.
9441
9442 EOH
9443                 case "$versiononly" in
9444                 "$define")      dflt="$initialinstalllocation/perl$version";;
9445                 *)              dflt="$initialinstalllocation/perl";;
9446                 esac
9447                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9448                 . ./myread
9449                 case "$ans" in
9450                 none)   startperl=": # use perl";;
9451                 *)      startperl="#!$ans"
9452                         if $test 30 -lt `echo "$ans" | wc -c`; then
9453                                 $cat >&4 <<EOM
9454
9455 WARNING:  Some systems limit the #! command to 32 characters.
9456 If you experience difficulty running Perl scripts with #!, try
9457 installing Perl in a directory with a shorter pathname.
9458
9459 EOM
9460                         fi ;;
9461                 esac
9462                 ;;
9463         *) startperl=": # use perl"
9464                 ;;
9465         esac
9466         ;;
9467 esac
9468 echo "I'll use $startperl to start perl scripts."
9469
9470 : figure best path for perl in scripts
9471 case "$perlpath" in
9472 '')
9473         case "$versiononly" in
9474         "$define")      perlpath="$initialinstalllocation/perl$version";;
9475         *)              perlpath="$initialinstalllocation/perl";;
9476         esac
9477         case "$startperl" in
9478         *!*) ;;
9479         *)
9480                 $cat <<EOH
9481
9482 I will use the "eval 'exec'" idiom to start Perl on your system.
9483 I can use the full path of your Perl binary for this purpose, but
9484 doing so may cause problems if you want to share those scripts and
9485 Perl is not always in a standard place ($initialinstalllocation/perl).
9486
9487 EOH
9488                 dflt="$initialinstalllocation/perl"
9489                 rp="What path shall I use in \"eval 'exec'\"?"
9490                 . ./myread
9491                 perlpath="$ans"
9492                 ;;
9493         esac
9494         ;;
9495 esac
9496 case "$startperl" in
9497 *!*)    ;;
9498 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9499 esac
9500
9501 : determine where public executable scripts go
9502 set scriptdir scriptdir
9503 eval $prefixit
9504 case "$scriptdir" in
9505 '')
9506         dflt="$bin"
9507         : guess some guesses
9508         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9509         $test -d /usr/share/bin     && dflt=/usr/share/bin
9510         $test -d /usr/local/script  && dflt=/usr/local/script
9511         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9512         $test -d $prefixexp/script  && dflt=$prefixexp/script
9513         set dflt
9514         eval $prefixup
9515         ;;
9516 *)  dflt="$scriptdir"
9517         ;;
9518 esac
9519 $cat <<EOM
9520
9521 Some installations have a separate directory just for executable scripts so
9522 that they can mount it across multiple architectures but keep the scripts in
9523 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9524 Or you might just lump your scripts in with all your other executables.
9525
9526 EOM
9527 fn=d~
9528 rp='Where do you keep publicly executable scripts?'
9529 . ./getfile
9530 if $test "X$ansexp" != "X$scriptdirexp"; then
9531         installscript=''
9532 fi
9533 installscriptdir=''
9534 prefixvar=scriptdir
9535 . ./setprefixvar
9536 : A little fix up for an irregularly named variable.
9537 installscript="$installscriptdir"
9538
9539 : determine where add-on public executables go
9540 case "$sitebin" in
9541 '')     dflt=$siteprefix/bin ;;
9542 *)      dflt=$sitebin ;;
9543 esac
9544 fn=d~
9545 rp='Pathname where the add-on public executables should be installed?'
9546 . ./getfile
9547 prefixvar=sitebin
9548 . ./setprefixvar
9549
9550 : determine where add-on html pages go
9551 : There is no standard location, so try to copy the previously-selected
9552 : directory structure for the core html pages.
9553 case "$sitehtml1dir" in
9554 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9555 *)     dflt=$sitehtml1dir ;;
9556 esac
9557 case "$dflt" in
9558 ''|' ') dflt=none ;;
9559 esac
9560 fn=dn+~
9561 rp='Pathname where the site-specific html pages should be installed?'
9562 . ./getfile
9563 prefixvar=sitehtml1dir
9564 . ./setprefixvar
9565
9566 : determine where add-on library html pages go
9567 : There is no standard location, so try to copy the previously-selected
9568 : directory structure for the core html pages.
9569 case "$sitehtml3dir" in
9570 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9571 *)     dflt=$sitehtml3dir ;;
9572 esac
9573 case "$dflt" in
9574 ''|' ') dflt=none ;;
9575 esac
9576 fn=dn+~
9577 rp='Pathname where the site-specific library html pages should be installed?'
9578 . ./getfile
9579 prefixvar=sitehtml3dir
9580 . ./setprefixvar
9581
9582 : determine where add-on manual pages go
9583 case "$siteman1dir" in
9584 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9585 *)      dflt=$siteman1dir ;;
9586 esac
9587 case "$dflt" in
9588 ''|' ') dflt=none ;;
9589 esac
9590 fn=dn+~
9591 rp='Pathname where the site-specific manual pages should be installed?'
9592 . ./getfile
9593 prefixvar=siteman1dir
9594 . ./setprefixvar
9595
9596 : determine where add-on library man pages go
9597 case "$siteman3dir" in
9598 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9599 *)      dflt=$siteman3dir ;;
9600 esac
9601 case "$dflt" in
9602 ''|' ') dflt=none ;;
9603 esac
9604 fn=dn+~
9605 rp='Pathname where the site-specific library manual pages should be installed?'
9606 . ./getfile
9607 prefixvar=siteman3dir
9608 . ./setprefixvar
9609
9610 : determine where add-on public executable scripts go
9611 case "$sitescript" in
9612 '')     dflt=$siteprefix/script
9613         $test -d $dflt || dflt=$sitebin ;;
9614 *)  dflt="$sitescript" ;;
9615 esac
9616 fn=d~+
9617 rp='Pathname where add-on public executable scripts should be installed?'
9618 . ./getfile
9619 prefixvar=sitescript
9620 . ./setprefixvar
9621
9622 : see if backtrace exists
9623 set backtrace d_backtrace
9624 eval $inlibc
9625
9626 : add flags if using c backtrace
9627 case "$usecbacktrace" in
9628   "") usecbacktrace=$undef ;;
9629   [yY]*|true|$define)
9630     case "$d_backtrace" in
9631       [yY]*|true|$define)
9632         case " $ccflags " in
9633           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9634           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9635           esac
9636         ;;
9637       *)
9638         echo "This system does not support backtrace" >&4
9639         usecbacktrace=$undef
9640         ;;
9641       esac
9642     ;;
9643   esac
9644
9645 : Check if faststdio is requested and available
9646 case "$usefaststdio" in
9647 $define|true|[yY]*|'')
9648         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9649         case "$xversion" in
9650         [68])   dflt='y' ;;
9651         *)      dflt='n' ;;
9652         esac
9653         ;;
9654 *) dflt='n';;
9655 esac
9656 cat <<EOM
9657
9658 Perl can be built to use 'fast stdio', which means using the stdio
9659 library but also directly manipulating the stdio buffers to enable
9660 faster I/O.  Using stdio is better for backward compatibility (especially
9661 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9662 interface has been preferred instead of stdio.
9663
9664 If this doesn't make any sense to you, just accept the default '$dflt'.
9665 EOM
9666 rp='Use the "fast stdio" if available?'
9667 . ./myread
9668 case "$ans" in
9669 y|Y)    val="$define" ;;
9670 *)      val="$undef" ;;
9671 esac
9672 set usefaststdio
9673 eval $setvar
9674
9675
9676 : define an is-a-typedef? function
9677 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9678 case "$inclist" in
9679 "") inclist="sys/types.h";;
9680 esac;
9681 eval "varval=\$$var";
9682 case "$varval" in
9683 "")
9684         $rm -f temp.c;
9685         for inc in $inclist; do
9686                 echo "#include <$inc>" >>temp.c;
9687         done;
9688         echo "#ifdef $type" >> temp.c;
9689         echo "printf(\"We have $type\");" >> temp.c;
9690         echo "#endif" >> temp.c;
9691         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9692         if $contains $type temp.E >/dev/null 2>&1; then
9693                 eval "$var=\$type";
9694         else
9695                 eval "$var=\$def";
9696         fi;
9697         $rm -f temp.?;;
9698 *) eval "$var=\$varval";;
9699 esac'
9700
9701 : define an is-a-typedef? function that prompts if the type is not available.
9702 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9703 case "$inclist" in
9704 "") inclist="sys/types.h";;
9705 esac;
9706 eval "varval=\$$var";
9707 case "$varval" in
9708 "")
9709         $rm -f temp.c;
9710         for inc in $inclist; do
9711                 echo "#include <$inc>" >>temp.c;
9712         done;
9713         echo "#ifdef $type" >> temp.c;
9714         echo "printf(\"We have $type\");" >> temp.c;
9715         echo "#endif" >> temp.c;
9716         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9717         echo " " ;
9718         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9719         if $contains $type temp.E >/dev/null 2>&1; then
9720                 echo "$type found." >&4;
9721                 eval "$var=\$type";
9722         else
9723                 echo "$type NOT found." >&4;
9724                 dflt="$def";
9725                 . ./myread ;
9726                 eval "$var=\$ans";
9727         fi;
9728         $rm -f temp.?;;
9729 *) eval "$var=\$varval";;
9730 esac'
9731
9732 : see what type lseek is declared as in the kernel
9733 rp="What is the type used for lseek's offset on this system?"
9734 set off_t lseektype long stdio.h sys/types.h
9735 eval $typedef_ask
9736
9737 echo " "
9738 echo "Checking to see how big your file offsets are..." >&4
9739 $cat >try.c <<EOCP
9740 #include <sys/types.h>
9741 #include <stdio.h>
9742 int main()
9743 {
9744     printf("%d\n", (int)sizeof($lseektype));
9745     return(0);
9746 }
9747 EOCP
9748 set try
9749 if eval $compile_ok; then
9750         lseeksize=`$run ./try`
9751         echo "Your file offsets are $lseeksize bytes long."
9752 else
9753         dflt=$longsize
9754         echo " "
9755         echo "(I can't seem to compile the test program.  Guessing...)"
9756         rp="What is the size of your file offsets (in bytes)?"
9757         . ./myread
9758         lseeksize="$ans"
9759 fi
9760 $rm_try
9761
9762 : see what type file positions are declared as in the library
9763 rp="What is the type for file position used by fsetpos()?"
9764 set fpos_t fpostype long stdio.h sys/types.h
9765 eval $typedef_ask
9766
9767 : Check size for Fpos_t
9768 echo " "
9769 case "$fpostype" in
9770 *_t) zzz="$fpostype"    ;;
9771 *)   zzz="fpos_t"       ;;
9772 esac
9773 echo "Checking the size of $zzz..." >&4
9774 cat > try.c <<EOCP
9775 #include <sys/types.h>
9776 #include <stdio.h>
9777 #$i_stdlib I_STDLIB
9778 #ifdef I_STDLIB
9779 #include <stdlib.h>
9780 #endif
9781 int main() {
9782     printf("%d\n", (int)sizeof($fpostype));
9783     exit(0);
9784 }
9785 EOCP
9786 set try
9787 if eval $compile_ok; then
9788         yyy=`$run ./try`
9789         case "$yyy" in
9790         '')     fpossize=4
9791                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9792                 ;;
9793         *)      fpossize=$yyy
9794                 echo "Your $zzz is $fpossize bytes long."
9795                 ;;
9796         esac
9797 else
9798         dflt="$longsize"
9799         echo " " >&4
9800         echo "(I can't compile the test program.  Guessing...)" >&4
9801         rp="What is the size of your file positions (in bytes)?"
9802         . ./myread
9803         fpossize="$ans"
9804 fi
9805
9806 : Check for large file support
9807 # Backward compatibility (uselfs is deprecated).
9808 case "$uselfs" in
9809 "$define"|true|[yY]*)
9810         cat <<EOM >&4
9811
9812 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9813 EOM
9814         uselargefiles="$define"
9815         ;;
9816 esac
9817
9818 case "$lseeksize:$fpossize" in
9819 8:8) cat <<EOM
9820
9821 You can have files larger than 2 gigabytes.
9822 EOM
9823    val="$define" ;;
9824 *)    case "$uselargefiles" in
9825    "$undef"|false|[nN]*) dflt='n' ;;
9826    *)   dflt='y' ;;
9827    esac
9828    cat <<EOM
9829
9830 Perl can be built to understand large files (files larger than 2 gigabytes)
9831 on some systems.  To do so, Configure can be run with -Duselargefiles.
9832
9833 If this doesn't make any sense to you, just accept the default '$dflt'.
9834 EOM
9835    rp='Try to understand large files, if available?'
9836    . ./myread
9837    case "$ans" in
9838    y|Y)         val="$define" ;;
9839    *)           val="$undef"  ;;
9840    esac
9841    ;;
9842 esac
9843 set uselargefiles
9844 eval $setvar
9845 : Look for a hint-file generated 'call-back-unit'.  If the
9846 : user has specified that a large files perl is to be built,
9847 : we may need to set or change some other defaults.
9848 if $test -f uselargefiles.cbu; then
9849         echo "Your platform has some specific hints regarding large file builds, using them..."
9850         . ./uselargefiles.cbu
9851 fi
9852 case "$uselargefiles" in
9853 "$define")
9854         if $test -f uselargefiles.cbu; then
9855                 echo " "
9856                 echo "Rechecking to see how big your file offsets are..." >&4
9857                 $cat >try.c <<EOCP
9858 #include <sys/types.h>
9859 #include <stdio.h>
9860 int main()
9861 {
9862     printf("%d\n", (int)sizeof($lseektype));
9863     return(0);
9864 }
9865 EOCP
9866                 set try
9867                 if eval $compile_ok; then
9868                         lseeksize=`$run ./try`
9869                         $echo "Your file offsets are now $lseeksize bytes long."
9870                 else
9871                         dflt="$lseeksize"
9872                         echo " "
9873                         echo "(I can't seem to compile the test program.  Guessing...)"
9874                         rp="What is the size of your file offsets (in bytes)?"
9875                         . ./myread
9876                         lseeksize="$ans"
9877                 fi
9878                 case "$fpostype" in
9879                 *_t) zzz="$fpostype"    ;;
9880                 *)   zzz="fpos_t"       ;;
9881                 esac
9882                 $echo $n "Rechecking the size of $zzz...$c" >&4
9883                 $cat > try.c <<EOCP
9884 #include <sys/types.h>
9885 #include <stdio.h>
9886 #$i_stdlib I_STDLIB
9887 #ifdef I_STDLIB
9888 #include <stdlib.h>
9889 #endif
9890 int main() {
9891     printf("%d\n", (int)sizeof($fpostype));
9892     return(0);
9893 }
9894 EOCP
9895                 set try
9896                 if eval $compile_ok; then
9897                         yyy=`$run ./try`
9898                         dflt="$lseeksize"
9899                         case "$yyy" in
9900                         '')     echo " "
9901                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9902                                 ;;
9903                         *)      fpossize=$yyy
9904                                 echo " $fpossize bytes." >&4
9905                                 ;;
9906                         esac
9907                 else
9908                         dflt="$fpossize"
9909                         echo " "
9910                         echo "(I can't compile the test program.  Guessing...)" >&4
9911                         rp="What is the size of your file positions (in bytes)?"
9912                         . ./myread
9913                         fpossize="$ans"
9914                 fi
9915                 $rm_try
9916         fi
9917         ;;
9918 esac
9919
9920 : Check if we want perlio
9921 useperlio="$define"
9922
9923 : Set the vendorbin variables
9924 case "$vendorprefix" in
9925 '')     d_vendorbin="$undef"
9926         vendorbin=''
9927         vendorbinexp=''
9928         ;;
9929 *)      d_vendorbin="$define"
9930         : determine where vendor-supplied executables go.
9931         case "$vendorbin" in
9932         '') dflt=$vendorprefix/bin ;;
9933         *)      dflt="$vendorbin" ;;
9934         esac
9935         fn=d~+
9936         rp='Pathname for the vendor-supplied executables directory?'
9937         . ./getfile
9938         vendorbin="$ans"
9939         vendorbinexp="$ansexp"
9940         ;;
9941 esac
9942 prefixvar=vendorbin
9943 . ./installprefix
9944
9945 : Set the vendorhtml1dir variables
9946 case "$vendorprefix" in
9947 '')     vendorhtml1dir=''
9948         vendorhtml1direxp=''
9949         ;;
9950 *)      : determine where vendor-supplied html pages go.
9951         : There is no standard location, so try to copy the previously-selected
9952         : directory structure for the core html pages.
9953         : XXX Better default suggestions would be welcome.
9954         case "$vendorhtml1dir" in
9955         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9956         *)      dflt=$vendorhtml1dir ;;
9957         esac
9958         case "$dflt" in
9959         ''|' ') dflt=none ;;
9960         esac
9961         fn=dn+~
9962         rp='Pathname for the vendor-supplied html pages?'
9963         . ./getfile
9964         vendorhtml1dir="$ans"
9965         vendorhtml1direxp="$ansexp"
9966         ;;
9967 esac
9968 : Use ' ' for none so value is preserved next time through Configure
9969 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9970 prefixvar=vendorhtml1dir
9971 . ./installprefix
9972
9973 : Set the vendorhtml3dir variables
9974 case "$vendorprefix" in
9975 '')     vendorhtml3dir=''
9976         vendorhtml3direxp=''
9977         ;;
9978 *)      : determine where vendor-supplied module html pages go.
9979         : There is no standard location, so try to copy the previously-selected
9980         : directory structure for the core html pages.
9981         : XXX Better default suggestions would be welcome.
9982         case "$vendorhtml3dir" in
9983         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9984         *)      dflt=$vendorhtml3dir ;;
9985         esac
9986         case "$dflt" in
9987         ''|' ') dflt=none ;;
9988         esac
9989         fn=dn+~
9990         rp='Pathname for the vendor-supplied html pages?'
9991         . ./getfile
9992         vendorhtml3dir="$ans"
9993         vendorhtml3direxp="$ansexp"
9994         ;;
9995 esac
9996 : Use ' ' for none so value is preserved next time through Configure
9997 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9998 prefixvar=vendorhtml3dir
9999 . ./installprefix
10000
10001 : Set the vendorman1dir variables
10002 case "$vendorprefix" in
10003 '')     vendorman1dir=''
10004         vendorman1direxp=''
10005         ;;
10006 *)      : determine where vendor-supplied manual pages go.
10007         case "$vendorman1dir" in
10008         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10009         *)      dflt=$vendorman1dir ;;
10010         esac
10011         case "$dflt" in
10012         ''|' ') dflt=none ;;
10013         esac
10014         fn=nd~+
10015         rp='Pathname for the vendor-supplied manual section 1 pages?'
10016         . ./getfile
10017         vendorman1dir="$ans"
10018         vendorman1direxp="$ansexp"
10019         ;;
10020 esac
10021 : Use ' ' for none so value is preserved next time through Configure
10022 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10023 prefixvar=vendorman1dir
10024 . ./installprefix
10025
10026 : Set the vendorman3dir variables
10027 case "$vendorprefix" in
10028 '')     vendorman3dir=''
10029         vendorman3direxp=''
10030         ;;
10031 *)      : determine where vendor-supplied module manual pages go.
10032         case "$vendorman3dir" in
10033         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10034         *)      dflt=$vendorman3dir ;;
10035         esac
10036         case "$dflt" in
10037         ''|' ') dflt=none ;;
10038         esac
10039         fn=nd~+
10040         rp='Pathname for the vendor-supplied manual section 3 pages?'
10041         . ./getfile
10042         vendorman3dir="$ans"
10043         vendorman3direxp="$ansexp"
10044         ;;
10045 esac
10046 : Use ' ' for none so value is preserved next time through Configure
10047 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10048 prefixvar=vendorman3dir
10049 . ./installprefix
10050
10051 : Set the vendorscript variables
10052 case "$vendorprefix" in
10053 '')     d_vendorscript="$undef"
10054         vendorscript=''
10055         vendorscriptexp=''
10056         ;;
10057 *)      d_vendorscript="$define"
10058         : determine where vendor-supplied scripts go.
10059         case "$vendorscript" in
10060         '')     dflt=$vendorprefix/script
10061                 $test -d $dflt || dflt=$vendorbin ;;
10062         *)  dflt="$vendorscript" ;;
10063         esac
10064         $cat <<EOM
10065
10066 The installation process will create a directory for
10067 vendor-supplied scripts.
10068
10069 EOM
10070         fn=d~+
10071         rp='Pathname for the vendor-supplied scripts directory?'
10072         . ./getfile
10073         vendorscript="$ans"
10074         vendorscriptexp="$ansexp"
10075         ;;
10076 esac
10077 prefixvar=vendorscript
10078 . ./installprefix
10079
10080 : script used to emit important warnings
10081 cat >warn <<EOS
10082 $startsh
10083 if test \$# -gt 0; then
10084         echo "\$@" >msg
10085 else
10086         cat >msg
10087 fi
10088 echo "*** WARNING:" >&4
10089 sed -e 's/^/*** /' <msg >&4
10090 echo "*** " >&4
10091 cat msg >>config.msg
10092 echo " " >>config.msg
10093 rm -f msg
10094 EOS
10095 chmod +x warn
10096 $eunicefix warn
10097
10098 : see which of string.h or strings.h is needed
10099 echo " "
10100 strings=`./findhdr string.h`
10101 if $test "$strings" && $test -r "$strings"; then
10102         echo "Using <string.h> instead of <strings.h>." >&4
10103         val="$define"
10104 else
10105         val="$undef"
10106         strings=`./findhdr strings.h`
10107         if $test "$strings" && $test -r "$strings"; then
10108                 echo "Using <strings.h> instead of <string.h>." >&4
10109         else
10110                 ./warn "No string header found -- You'll surely have problems."
10111         fi
10112 fi
10113 set i_string
10114 eval $setvar
10115 case "$i_string" in
10116 "$undef") strings=`./findhdr strings.h`;;
10117 *)        strings=`./findhdr string.h`;;
10118 esac
10119
10120 : see if qgcvt exists
10121 set qgcvt d_qgcvt
10122 eval $inlibc
10123
10124 : Check what kind of doubles your system has
10125 $echo "Checking the kind of doubles you have..." >&4
10126 $cat >try.c <<EOP
10127 #$i_stdlib I_STDLIB
10128 #define DOUBLESIZE $doublesize
10129 #ifdef I_STDLIB
10130 #include <stdlib.h>
10131 #endif
10132 #include <stdio.h>
10133 static const double d = -0.1;
10134 int main() {
10135   unsigned const char* b = (unsigned const char*)(&d);
10136 #if DOUBLESIZE == 4
10137   if (b[0] == 0xCD && b[3] == 0xBD) {
10138     /* IEEE 754 32-bit little-endian */
10139     printf("1\n");
10140     exit(0);
10141   }
10142   if (b[0] == 0xBD && b[3] == 0xCD) {
10143     /* IEEE 754 32-bit big-endian */
10144     printf("2\n");
10145     exit(0);
10146   }
10147   if (b[0] == 0xCC && b[3] == 0xCC) {
10148     /* VAX format F, 32-bit PDP-style mixed endian. */
10149     printf("9\n");
10150     exit(0);
10151   }
10152 #endif
10153 #if DOUBLESIZE == 8
10154   if (b[0] == 0x9A && b[7] == 0xBF) {
10155     /* IEEE 754 64-bit little-endian */
10156     printf("3\n");
10157     exit(0);
10158   }
10159   if (b[0] == 0xBF && b[7] == 0x9A) {
10160     /* IEEE 754 64-bit big-endian */
10161     printf("4\n");
10162     exit(0);
10163   }
10164   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10165    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10166     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10167     * 99 99 b9 bf 9a 99 99 99 */
10168     printf("7\n");
10169     exit(0);
10170   }
10171   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10172    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10173     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10174     * 99 99 99 9a bf b9 99 99 */
10175     printf("8\n");
10176     exit(0);
10177   }
10178   if (b[0] == 0xCC && b[7] == 0xCC) {
10179    /* VAX format D, 64-bit PDP-style mixed endian. */
10180     printf("10\n");
10181     exit(0);
10182   }
10183   if (b[0] == 0xD9 && b[7] == 0x99) {
10184    /* VAX format G, 64-bit PDP-style mixed endian. */
10185     printf("11\n");
10186     exit(0);
10187   }
10188 #endif
10189 #if DOUBLESIZE == 16
10190   if (b[0] == 0x9A && b[15] == 0xBF) {
10191     /* IEEE 754 128-bit little-endian */
10192     printf("5\n");
10193     exit(0);
10194   }
10195   if (b[0] == 0xBF && b[15] == 0x9A) {
10196     /* IEEE 754 128-bit big-endian */
10197     printf("6\n");
10198     exit(0);
10199   }
10200 #endif
10201   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10202    * Whether those environments can still build Perl is debatable. */
10203   printf("-1\n"); /* unknown */
10204   exit(0);
10205 }
10206 EOP
10207 set try
10208 if eval $compile; then
10209     doublekind=`$run ./try`
10210 else
10211     doublekind=-1
10212 fi
10213 case "$doublekind" in
10214 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10215 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10216 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10217 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10218 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10219 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10220 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10221 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10222 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10223 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10224 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10225 *) echo "Cannot figure out your double.  You CRAY, or something?" >&4 ;;
10226 esac
10227 $rm_try
10228
10229 : Check print/scan long double stuff
10230 echo " "
10231
10232 if $test X"$d_longdbl" = X"$define"; then
10233
10234 echo "Checking how to print long doubles..." >&4
10235
10236 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10237         $cat >try.c <<'EOCP'
10238 #include <sys/types.h>
10239 #include <stdio.h>
10240 int main() {
10241   double d = 123.456;
10242   printf("%.3f\n", d);
10243 }
10244 EOCP
10245         set try
10246         if eval $compile; then
10247                 yyy=`$run ./try`
10248                 case "$yyy" in
10249                 123.456)
10250                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10251                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10252                         echo "We will use %f."
10253                         ;;
10254                 esac
10255         fi
10256 fi
10257
10258 if $test X"$sPRIfldbl" = X; then
10259         $cat >try.c <<'EOCP'
10260 #include <sys/types.h>
10261 #include <stdio.h>
10262 int main() {
10263   long double d = 123.456;
10264   printf("%.3Lf\n", d);
10265 }
10266 EOCP
10267         set try
10268         if eval $compile; then
10269                 yyy=`$run ./try`
10270                 case "$yyy" in
10271                 123.456)
10272                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10273                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10274                         echo "We will use %Lf."
10275                         ;;
10276                 esac
10277         fi
10278 fi
10279
10280 if $test X"$sPRIfldbl" = X; then
10281         $cat >try.c <<'EOCP'
10282 #include <sys/types.h>
10283 #include <stdio.h>
10284 int main() {
10285   long double d = 123.456;
10286   printf("%.3llf\n", d);
10287 }
10288 EOCP
10289         set try
10290         if eval $compile; then
10291                 yyy=`$run ./try`
10292                 case "$yyy" in
10293                 123.456)
10294                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10295                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10296                         echo "We will use %llf."
10297                         ;;
10298                 esac
10299         fi
10300 fi
10301
10302 if $test X"$sPRIfldbl" = X; then
10303         $cat >try.c <<'EOCP'
10304 #include <sys/types.h>
10305 #include <stdio.h>
10306 int main() {
10307   long double d = 123.456;
10308   printf("%.3lf\n", d);
10309 }
10310 EOCP
10311         set try
10312         if eval $compile; then
10313                 yyy=`$run ./try`
10314                 case "$yyy" in
10315                 123.456)
10316                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10317                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10318                         echo "We will use %lf."
10319                         ;;
10320                 esac
10321         fi
10322 fi
10323
10324 if $test X"$sPRIfldbl" = X; then
10325         echo "Cannot figure out how to print long doubles." >&4
10326 else
10327         sSCNfldbl=$sPRIfldbl    # expect consistency
10328 fi
10329
10330 $rm_try
10331
10332 fi # d_longdbl
10333
10334 case "$sPRIfldbl" in
10335 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10336         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10337         d_SCNfldbl="$undef";
10338         ;;
10339 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10340         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10341         d_SCNfldbl="$define";
10342         ;;
10343 esac
10344
10345 : Before committing on uselongdouble, see whether that looks sane.
10346 if $test "$uselongdouble" = "$define"; then
10347     message=""
10348     echo " "
10349     echo "Checking if your long double math functions work right..." >&4
10350     $cat > try.c <<EOF
10351 #include <math.h>
10352 #include <stdio.h>
10353 int main() {
10354   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10355 }
10356 EOF
10357     case "$osname:$gccversion" in
10358     aix:)       saveccflags="$ccflags"
10359                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10360     esac
10361     set try
10362     if eval $compile_ok; then
10363       yyy=`$run ./try`
10364     fi
10365     case "$yyy" in
10366     3) echo "Your long double math functions are working correctly." >&4 ;;
10367     *) echo "Your long double math functions are broken, not using long doubles." >&4
10368        uselongdouble=$undef
10369        ;;
10370     esac
10371     $rm_try
10372     case "$osname:$gccversion" in
10373     aix:)       ccflags="$saveccflags" ;; # restore
10374     esac
10375 fi
10376
10377 : Check how to convert floats to strings.
10378
10379 if test "X$d_Gconvert" = X; then
10380
10381 echo " "
10382 echo "Checking for an efficient way to convert floats to strings."
10383 echo " " > try.c
10384 case "$uselongdouble" in
10385 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10386 esac
10387 case "$d_longdbl" in
10388 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10389 esac
10390 case "$d_PRIgldbl" in
10391 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10392 esac
10393 $cat >>try.c <<EOP
10394 #ifdef TRY_gconvert
10395 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10396 char *myname = "gconvert";
10397 #endif
10398 #ifdef TRY_gcvt
10399 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10400 char *myname = "gcvt";
10401 #endif
10402 #ifdef TRY_qgcvt
10403 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10404 char *myname = "qgcvt";
10405 #define DOUBLETYPE long double
10406 #endif
10407 #ifdef TRY_sprintf
10408 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10409 #ifdef HAS_PRIgldbl
10410 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10411 #else
10412 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10413 #endif
10414 #else
10415 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10416 #endif
10417 char *myname = "sprintf";
10418 #endif
10419
10420 #ifndef DOUBLETYPE
10421 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10422 #define DOUBLETYPE long double
10423 #else
10424 #define DOUBLETYPE double
10425 #endif
10426 #endif
10427
10428 #include <stdio.h>
10429
10430 #$i_stdlib I_STDLIB
10431 #ifdef I_STDLIB
10432 #include <stdlib.h>
10433 #endif
10434 #$i_string I_STRING
10435 #ifdef I_STRING
10436 #  include <string.h>
10437 #else
10438 #  include <strings.h>
10439 #endif
10440
10441 int checkit(char *expect, char *got)
10442 {
10443     if (strcmp(expect, got)) {
10444                 printf("%s oddity:  Expected %s, got %s\n",
10445                         myname, expect, got);
10446                 exit(1);
10447         }
10448 }
10449
10450 int main()
10451 {
10452         char buf[64];
10453         buf[63] = '\0';
10454
10455         /* This must be 1st test on (which?) platform */
10456         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10457         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10458         checkit("0.1", buf);
10459
10460         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10461         checkit("0.01", buf);
10462
10463         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10464         checkit("0.001", buf);
10465
10466         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10467         checkit("0.0001", buf);
10468
10469         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10470         if (strlen(buf) > 5)
10471             checkit("9e-005", buf); /* for Microsoft ?? */
10472         else
10473             checkit("9e-05", buf);
10474
10475         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10476         checkit("1", buf);
10477
10478         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10479         checkit("1.1", buf);
10480
10481         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10482         checkit("1.01", buf);
10483
10484         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10485         checkit("1.001", buf);
10486
10487         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10488         checkit("1.0001", buf);
10489
10490         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10491         checkit("1.00001", buf);
10492
10493         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10494         checkit("1.000001", buf);
10495
10496         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10497         checkit("0", buf);
10498
10499         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10500         checkit("-1", buf);
10501
10502         /* Some Linux gcvt's give 1.e+5 here. */
10503         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10504         checkit("100000", buf);
10505
10506         /* Some Linux gcvt's give -1.e+5 here. */
10507         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10508         checkit("-100000", buf);
10509
10510         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10511         checkit("123.456", buf);
10512
10513         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10514         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10515         /* 34 should be enough to scare even long double
10516          * places into using the e notation. */
10517         if (strlen(buf) > 5)
10518             checkit("1e+034", buf); /* for Microsoft */
10519         else
10520             checkit("1e+34", buf);
10521
10522         /* For Perl, if you add additional tests here, also add them to
10523          * t/base/num.t for benefit of platforms not using Configure or
10524          * overriding d_Gconvert */
10525
10526         exit(0);
10527 }
10528 EOP
10529 : first add preferred functions to our list
10530 xxx_list=""
10531 for xxx_convert in $gconvert_preference; do
10532     case $xxx_convert in
10533     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10534     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10535     esac
10536 done
10537 : then add any others
10538 for xxx_convert in gconvert gcvt sprintf; do
10539     case "$xxx_list" in
10540     *$xxx_convert*) ;;
10541     *) xxx_list="$xxx_list $xxx_convert" ;;
10542     esac
10543 done
10544
10545 case "$d_longdbl$uselongdouble" in
10546 "$define$define")
10547     : again, add preferred functions to our list first
10548     xxx_ld_list=""
10549     for xxx_convert in $gconvert_ld_preference; do
10550         case $xxx_convert in
10551         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10552         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10553         esac
10554     done
10555     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10556     for xxx_convert in qgcvt sprintf $xxx_list; do
10557         case "$xxx_ld_list" in
10558         $xxx_convert*|*" $xxx_convert"*) ;;
10559         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10560         esac
10561     done
10562     : if sprintf cannot do long doubles, move it to the end
10563     if test "$d_PRIgldbl" != "$define"; then
10564         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10565     fi
10566     : if no qgcvt, remove it
10567     if test "$d_qgcvt" != "$define"; then
10568         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10569     fi
10570     : use the ld_list
10571     xxx_list="$xxx_ld_list"
10572     ;;
10573 esac
10574
10575 for xxx_convert in $xxx_list; do
10576         echo "Trying $xxx_convert..."
10577         $rm -f try try$_o core
10578         set try -DTRY_$xxx_convert
10579         if eval $compile; then
10580                 echo "$xxx_convert() found." >&4
10581                 if $run ./try; then
10582                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10583                         break;
10584                 else
10585                         echo "...But $xxx_convert didn't work as I expected."
10586                         xxx_convert=''
10587                 fi
10588         else
10589                 echo "$xxx_convert NOT found." >&4
10590         fi
10591 done
10592
10593 if test X$xxx_convert = X; then
10594     echo "*** WHOA THERE!!! ***" >&4
10595     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10596     xxx_convert=sprintf
10597 fi
10598
10599 case "$xxx_convert" in
10600 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10601 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10602 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10603 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10604    "$define$define$define")
10605       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10606    "$define$define$undef")
10607       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10608    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10609    esac
10610    ;;
10611 esac
10612
10613 fi
10614 $rm_try
10615
10616 : see if _fwalk exists
10617 set fwalk d__fwalk
10618 eval $inlibc
10619
10620 : Initialize h_fcntl
10621 h_fcntl=false
10622
10623 : Initialize h_sysfile
10624 h_sysfile=false
10625
10626 : access call always available on UNIX
10627 set access d_access
10628 eval $inlibc
10629
10630 : locate the flags for 'access()'
10631 case "$d_access" in
10632 "$define")
10633         echo " "
10634         $cat >access.c <<EOCP
10635 #include <sys/types.h>
10636 #ifdef I_FCNTL
10637 #include <fcntl.h>
10638 #endif
10639 #ifdef I_SYS_FILE
10640 #include <sys/file.h>
10641 #endif
10642 #ifdef I_UNISTD
10643 #include <unistd.h>
10644 #endif
10645 #$i_stdlib I_STDLIB
10646 #ifdef I_STDLIB
10647 #include <stdlib.h>
10648 #endif
10649 int main() {
10650         exit(R_OK);
10651 }
10652 EOCP
10653         : check sys/file.h first, no particular reason here
10654         if $test `./findhdr sys/file.h` && \
10655                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10656                 h_sysfile=true;
10657                 echo "<sys/file.h> defines the *_OK access constants." >&4
10658         elif $test `./findhdr fcntl.h` && \
10659                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10660                 h_fcntl=true;
10661                 echo "<fcntl.h> defines the *_OK access constants." >&4
10662         elif $test `./findhdr unistd.h` && \
10663                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10664                 echo "<unistd.h> defines the *_OK access constants." >&4
10665         else
10666                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10667         fi
10668         ;;
10669 esac
10670 $rm -f access*
10671
10672 : see if accessx exists
10673 set accessx d_accessx
10674 eval $inlibc
10675
10676 : see if acosh exists
10677 set acosh d_acosh
10678 eval $inlibc
10679
10680 : see if aintl exists
10681 set aintl d_aintl
10682 eval $inlibc
10683
10684 : see if alarm exists
10685 set alarm d_alarm
10686 eval $inlibc
10687
10688 : see if 64bit time functions exists
10689
10690 set ctime64 d_ctime64
10691 eval $inlibc
10692
10693 set localtime64 d_localtime64
10694 eval $inlibc
10695
10696 set gmtime64 d_gmtime64
10697 eval $inlibc
10698
10699 set mktime64 d_mktime64
10700 eval $inlibc
10701
10702 set difftime64 d_difftime64
10703 eval $inlibc
10704
10705 set asctime64 d_asctime64
10706 eval $inlibc
10707
10708 : see if POSIX threads are available
10709 set pthread.h i_pthread
10710 eval $inhdr
10711
10712 : define a function to check prototypes
10713 $cat > protochk <<EOSH
10714 $startsh
10715 cc="$cc"
10716 optimize="$optimize"
10717 ccflags="$ccflags"
10718 prototype="$prototype"
10719 define="$define"
10720 rm_try="$rm_try"
10721 usethreads=$usethreads
10722 i_pthread=$i_pthread
10723 pthread_h_first=$pthread_h_first
10724 EOSH
10725
10726 $cat >> protochk <<'EOSH'
10727
10728 $rm_try
10729 foo="$1"
10730 shift
10731 while test $# -ge 2; do
10732         case "$1" in
10733                 $define) echo "#include <$2>" >> try.c ;;
10734                 literal) echo "$2" >> try.c ;;
10735         esac
10736     # Extra magic for the benefit of systems that need pthread.h
10737     # to be included early to correctly detect threadsafe functions.
10738     # Such functions must guarantee themselves, though, that the usethreads
10739     # and i_pthread have been defined, before calling protochk.
10740     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10741         echo "#include <pthread.h>" >> try.c
10742         pthread_h_done=yes
10743     fi
10744     shift 2
10745 done
10746 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10747 cat >> try.c <<'EOCP'
10748 #ifdef CAN_PROTOTYPE
10749 #define _(args) args
10750 #else
10751 #define _(args) ()
10752 #endif
10753 EOCP
10754 echo "$foo" >> try.c
10755 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10756 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10757 status=$?
10758 $rm_try
10759 exit $status
10760 EOSH
10761 chmod +x protochk
10762 $eunicefix protochk
10763
10764 : Define hasproto macro for Configure internal use
10765 hasproto='varname=$1; func=$2; shift; shift;
10766 while $test $# -ge 2; do
10767         case "$1" in
10768         $define) echo "#include <$2>";;
10769         esac ;
10770     shift 2;
10771 done > try.c;
10772 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10773 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10774         echo "$func() prototype found.";
10775         val="$define";
10776 else
10777         echo "$func() prototype NOT found.";
10778         val="$undef";
10779 fi;
10780 set $varname;
10781 eval $setvar;
10782 $rm_try tryout.c'
10783
10784 : see if sys/types.h has to be included
10785 set sys/types.h i_systypes
10786 eval $inhdr
10787
10788 : see if sys/select.h has to be included
10789 set sys/select.h i_sysselct
10790 eval $inhdr
10791
10792 : Define hasfield macro for Configure internal use
10793 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10794 while $test $# -ge 2; do
10795         case "$1" in
10796         $define) echo "#include <$2>";;
10797         esac ;
10798     shift 2;
10799 done > try.c;
10800 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10801 set try;
10802 if eval $compile; then
10803         val="$define";
10804 else
10805         val="$undef";
10806 fi;
10807 set $varname;
10808 eval $setvar;
10809 $rm_try'
10810
10811 : see if we should include time.h, sys/time.h, or both
10812 echo " "
10813 if test "X$timeincl" = X; then
10814         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10815         $echo $n "I'm now running the test program...$c"
10816         $cat >try.c <<EOCP
10817 #include <sys/types.h>
10818 #ifdef I_TIME
10819 #include <time.h>
10820 #endif
10821 #ifdef I_SYSTIME
10822 #ifdef SYSTIMEKERNEL
10823 #define KERNEL
10824 #endif
10825 #include <sys/time.h>
10826 #endif
10827 #ifdef I_SYSSELECT
10828 #include <sys/select.h>
10829 #endif
10830 #$i_stdlib I_STDLIB
10831 #ifdef I_STDLIB
10832 #include <stdlib.h>
10833 #endif
10834 int main()
10835 {
10836         struct tm foo;
10837 #ifdef S_TIMEVAL
10838         struct timeval bar;
10839 #endif
10840 #ifdef S_TIMEZONE
10841         struct timezone tzp;
10842 #endif
10843         if (foo.tm_sec == foo.tm_sec)
10844                 exit(0);
10845 #ifdef S_TIMEVAL
10846         if (bar.tv_sec == bar.tv_sec)
10847                 exit(0);
10848 #endif
10849         exit(1);
10850 }
10851 EOCP
10852         flags=''
10853         for s_timezone in '-DS_TIMEZONE' ''; do
10854         sysselect=''
10855         for s_timeval in '-DS_TIMEVAL' ''; do
10856         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10857         for i_time in '' '-DI_TIME'; do
10858         for i_systime in '-DI_SYSTIME' ''; do
10859                 case "$flags" in
10860                 '') $echo $n ".$c"
10861                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10862                         if eval $compile; then
10863                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10864                                 shift
10865                                 flags="$*"
10866                                 echo " "
10867                                 $echo $n "Succeeded with $flags$c"
10868                         fi
10869                         ;;
10870                 esac
10871         done
10872         done
10873         done
10874         done
10875         done
10876         timeincl=''
10877         echo " "
10878         case "$flags" in
10879         *SYSTIMEKERNEL*) i_systimek="$define"
10880                 timeincl=`./findhdr sys/time.h`
10881                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10882         *) i_systimek="$undef";;
10883         esac
10884         case "$flags" in
10885         *I_TIME*) i_time="$define"
10886                 timeincl=`./findhdr time.h`" $timeincl"
10887                 echo "We'll include <time.h>." >&4;;
10888         *) i_time="$undef";;
10889         esac
10890         case "$flags" in
10891         *I_SYSTIME*) i_systime="$define"
10892                 timeincl=`./findhdr sys/time.h`" $timeincl"
10893                 echo "We'll include <sys/time.h>." >&4;;
10894         *) i_systime="$undef";;
10895         esac
10896         $rm_try
10897 fi
10898 : see if struct tm knows about tm_zone
10899 case "$i_systime$i_time" in
10900 *$define*)
10901         echo " "
10902         echo "Checking to see if your struct tm has tm_zone field..." >&4
10903         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10904         eval $hasfield
10905         ;;
10906 *)      val="$undef"
10907         set d_tm_tm_zone
10908         eval $setvar
10909         ;;
10910 esac
10911 case "$d_tm_tm_zone" in
10912 "$define")      echo "Yes, it does."   ;;
10913 *)              echo "No, it doesn't." ;;
10914 esac
10915 : see if struct tm knows about tm_gmtoff
10916 case "$i_systime$i_time" in
10917 *$define*)
10918         echo " "
10919         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10920         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10921         eval $hasfield
10922         ;;
10923 *)      val="$undef"
10924         set d_tm_tm_gmtoff
10925         eval $setvar
10926         ;;
10927 esac
10928 case "$d_tm_tm_gmtoff" in
10929 "$define")      echo "Yes, it does."   ;;
10930 *)              echo "No, it doesn't." ;;
10931 esac
10932
10933 : see if asctime_r exists
10934 set asctime_r d_asctime_r
10935 eval $inlibc
10936 case "$d_asctime_r" in
10937 "$define")
10938         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10939         case "$d_asctime_r_proto:$usethreads" in
10940         ":define")      d_asctime_r_proto=define
10941                 set d_asctime_r_proto asctime_r $hdrs
10942                 eval $hasproto ;;
10943         *)      ;;
10944         esac
10945         case "$d_asctime_r_proto" in
10946         define)
10947         case "$asctime_r_proto" in
10948         ''|0) try='char* asctime_r(const struct tm*, char*);'
10949         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10950         esac
10951         case "$asctime_r_proto" in
10952         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10953         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10954         esac
10955         case "$asctime_r_proto" in
10956         ''|0) try='int asctime_r(const struct tm*, char*);'
10957         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10958         esac
10959         case "$asctime_r_proto" in
10960         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10961         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10962         esac
10963         case "$asctime_r_proto" in
10964         ''|0)   d_asctime_r=undef
10965                 asctime_r_proto=0
10966                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10967         * )     case "$asctime_r_proto" in
10968                 REENTRANT_PROTO*) ;;
10969                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10970                 esac
10971                 echo "Prototype: $try" ;;
10972         esac
10973         ;;
10974         *)      case "$usethreads" in
10975                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10976                 esac
10977                 d_asctime_r=undef
10978                 asctime_r_proto=0
10979                 ;;
10980         esac
10981         ;;
10982 *)      asctime_r_proto=0
10983         ;;
10984 esac
10985
10986 : see if asinh exists
10987 set asinh d_asinh
10988 eval $inlibc
10989
10990 : see if atanh exists
10991 set atanh d_atanh
10992 eval $inlibc
10993
10994 : see if atolf exists
10995 set atolf d_atolf
10996 eval $inlibc
10997
10998 : see if atoll exists
10999 set atoll d_atoll
11000 eval $inlibc
11001
11002 : Look for GCC-style attribute format
11003 case "$d_attribute_format" in
11004 '')
11005 echo " "
11006 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11007 $cat >attrib.c <<'EOCP'
11008 #include <stdio.h>
11009 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11010 EOCP
11011 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11012         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11013                 echo "Your C compiler doesn't support __attribute__((format))."
11014                 val="$undef"
11015         else
11016                 echo "Your C compiler supports __attribute__((format))."
11017                 val="$define"
11018         fi
11019 else
11020         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11021         val="$undef"
11022 fi
11023 ;;
11024 *) val="$d_attribute_format" ;;
11025 esac
11026 set d_attribute_format
11027 eval $setvar
11028 $rm -f attrib*
11029
11030 : Look for GCC-style attribute format with null format allowed
11031 case "$d_printf_format_null" in
11032 '') case "$d_attribute_format" in
11033     $define)
11034         echo " "
11035         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11036 $cat >attrib.c <<EOCP
11037 #include <stdio.h>
11038 #$i_stdlib I_STDLIB
11039 #ifdef I_STDLIB
11040 #include <stdlib.h>
11041 #endif
11042 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11043 int null_printf (char* pat,...) { return (int)pat; }
11044 int main () { exit(null_printf(NULL)); }
11045 EOCP
11046         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11047             : run the executable in case it produces a run-time warning
11048             if $run ./attrib >>attrib.out 2>&1; then
11049                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11050                     echo "Your C compiler doesn't allow __printf__ format to be null."
11051                     val="$undef"
11052                 else
11053                     echo "Your C compiler allows __printf__ format to be null."
11054                     val="$define"
11055                 fi
11056             else
11057             echo "Your C compiler executable failed with __printf__ format null."
11058             val="$undef"
11059         fi
11060     else
11061         echo "Your C compiler fails with __printf__ format null."
11062         val="$undef"
11063     fi
11064     ;;
11065     *)  val="$undef" ;;
11066     esac
11067 ;;
11068 *)  val="$d_printf_format_null" ;;
11069 esac
11070 set d_printf_format_null
11071 eval $setvar
11072 $rm -f attrib*
11073
11074 : Look for GCC-style attribute malloc
11075 case "$d_attribute_malloc" in
11076 '')
11077 echo " "
11078 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11079 $cat >attrib.c <<'EOCP'
11080 #include <stdio.h>
11081 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11082 EOCP
11083 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11084         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11085                 echo "Your C compiler doesn't support __attribute__((malloc))."
11086                 val="$undef"
11087         else
11088                 echo "Your C compiler supports __attribute__((malloc))."
11089                 val="$define"
11090         fi
11091 else
11092         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11093         val="$undef"
11094 fi
11095 ;;
11096 *) val="$d_attribute_malloc" ;;
11097 esac
11098 set d_attribute_malloc
11099 eval $setvar
11100 $rm -f attrib*
11101
11102 : Look for GCC-style attribute nonnull
11103 case "$d_attribute_nonnull" in
11104 '')
11105 echo " "
11106 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11107 $cat >attrib.c <<'EOCP'
11108 #include <stdio.h>
11109 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11110 EOCP
11111 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11112         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11113                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11114                 val="$undef"
11115         else
11116                 echo "Your C compiler supports __attribute__((nonnull))."
11117                 val="$define"
11118         fi
11119 else
11120         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11121         val="$undef"
11122 fi
11123 ;;
11124 *) val="$d_attribute_nonnull" ;;
11125 esac
11126 set d_attribute_nonnull
11127 eval $setvar
11128 $rm -f attrib*
11129
11130 : Look for GCC-style attribute noreturn
11131 case "$d_attribute_noreturn" in
11132 '')
11133 echo " "
11134 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11135 $cat >attrib.c <<'EOCP'
11136 #include <stdio.h>
11137 void fall_over_dead( void ) __attribute__((noreturn));
11138 EOCP
11139 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11140         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11141                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11142                 val="$undef"
11143         else
11144                 echo "Your C compiler supports __attribute__((noreturn))."
11145                 val="$define"
11146         fi
11147 else
11148         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11149         val="$undef"
11150 fi
11151 ;;
11152 *) val="$d_attribute_noreturn" ;;
11153 esac
11154 set d_attribute_noreturn
11155 eval $setvar
11156 $rm -f attrib*
11157
11158 : Look for GCC-style attribute pure
11159 case "$d_attribute_pure" in
11160 '')
11161 echo " "
11162 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11163 $cat >attrib.c <<'EOCP'
11164 #include <stdio.h>
11165 int square( int n ) __attribute__((pure));
11166 EOCP
11167 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11168         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11169                 echo "Your C compiler doesn't support __attribute__((pure))."
11170                 val="$undef"
11171         else
11172                 echo "Your C compiler supports __attribute__((pure))."
11173                 val="$define"
11174         fi
11175 else
11176         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11177         val="$undef"
11178 fi
11179 ;;
11180 *) val="$d_attribute_pure" ;;
11181 esac
11182 set d_attribute_pure
11183 eval $setvar
11184 $rm -f attrib*
11185
11186 : Look for GCC-style attribute unused
11187 case "$d_attribute_unused" in
11188 '')
11189 echo " "
11190 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11191 $cat >attrib.c <<'EOCP'
11192 #include <stdio.h>
11193 int do_something( int dummy __attribute__((unused)), int n );
11194 EOCP
11195 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11196         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11197                 echo "Your C compiler doesn't support __attribute__((unused))."
11198                 val="$undef"
11199         else
11200                 echo "Your C compiler supports __attribute__((unused))."
11201                 val="$define"
11202         fi
11203 else
11204         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11205         val="$undef"
11206 fi
11207 ;;
11208 *) val="$d_attribute_unused" ;;
11209 esac
11210 set d_attribute_unused
11211 eval $setvar
11212 $rm -f attrib*
11213
11214 : Look for GCC-style attribute deprecated
11215 case "$d_attribute_deprecated" in
11216 '')
11217 echo " "
11218 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11219 $cat >attrib.c <<'EOCP'
11220 #include <stdio.h>
11221 int I_am_deprecated(void) __attribute__((deprecated));
11222 EOCP
11223 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11224         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11225                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11226                 val="$undef"
11227         else
11228                 echo "Your C compiler supports __attribute__((deprecated))."
11229                 val="$define"
11230         fi
11231 else
11232         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11233         val="$undef"
11234 fi
11235 ;;
11236 *) val="$d_attribute_deprecated" ;;
11237 esac
11238 set d_attribute_deprecated
11239 eval $setvar
11240 $rm -f attrib*
11241
11242 : Look for GCC-style attribute warn_unused_result
11243 case "$d_attribute_warn_unused_result" in
11244 '')
11245 echo " "
11246 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11247 $cat >attrib.c <<'EOCP'
11248 #include <stdio.h>
11249 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11250 EOCP
11251 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11252         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11253                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11254                 val="$undef"
11255         else
11256                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11257                 val="$define"
11258         fi
11259 else
11260         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11261         val="$undef"
11262 fi
11263 ;;
11264 *) val="$d_attribute_warn_unused_result" ;;
11265 esac
11266 set d_attribute_warn_unused_result
11267 eval $setvar
11268 $rm -f attrib*
11269
11270 : see if bcmp exists
11271 set bcmp d_bcmp
11272 eval $inlibc
11273
11274 : see if bcopy exists
11275 set bcopy d_bcopy
11276 eval $inlibc
11277
11278 : see if getpgrp exists
11279 set getpgrp d_getpgrp
11280 eval $inlibc
11281
11282 case "$d_getpgrp" in
11283 "$define")
11284         echo " "
11285         echo "Checking to see which flavor of getpgrp is in use..."
11286         $cat >try.c <<EOP
11287 #$i_unistd I_UNISTD
11288 #include <sys/types.h>
11289 #ifdef I_UNISTD
11290 #  include <unistd.h>
11291 #endif
11292 #$i_stdlib I_STDLIB
11293 #ifdef I_STDLIB
11294 #include <stdlib.h>
11295 #endif
11296 int main()
11297 {
11298         if (getuid() == 0) {
11299                 printf("(I see you are running Configure as super-user...)\n");
11300                 setuid(1);
11301         }
11302 #ifdef TRY_BSD_PGRP
11303         if (getpgrp(1) == 0)
11304                 exit(0);
11305 #else
11306         if (getpgrp() > 0)
11307                 exit(0);
11308 #endif
11309         exit(1);
11310 }
11311 EOP
11312         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11313                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11314                 val="$define"
11315         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11316                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11317                 val="$undef"
11318         else
11319                 echo "I can't seem to compile and run the test program."
11320                 if ./usg; then
11321                         xxx="a USG one, i.e. you use getpgrp()."
11322                 else
11323                         # SVR4 systems can appear rather BSD-ish.
11324                         case "$i_unistd" in
11325                         $undef)
11326                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11327                                 val="$define"
11328                                 ;;
11329                         $define)
11330                                 xxx="probably a USG one, i.e. you use getpgrp()."
11331                                 val="$undef"
11332                                 ;;
11333                         esac
11334                 fi
11335                 echo "Assuming your getpgrp is $xxx" >&4
11336         fi
11337         ;;
11338 *) val="$undef";;
11339 esac
11340 set d_bsdgetpgrp
11341 eval $setvar
11342 $rm_try
11343
11344 : see if setpgrp exists
11345 set setpgrp d_setpgrp
11346 eval $inlibc
11347
11348 case "$d_setpgrp" in
11349 "$define")
11350         echo " "
11351         echo "Checking to see which flavor of setpgrp is in use..."
11352         $cat >try.c <<EOP
11353 #$i_unistd I_UNISTD
11354 #include <sys/types.h>
11355 #ifdef I_UNISTD
11356 #  include <unistd.h>
11357 #endif
11358 #$i_stdlib I_STDLIB
11359 #ifdef I_STDLIB
11360 #include <stdlib.h>
11361 #endif
11362 int main()
11363 {
11364         if (getuid() == 0) {
11365                 printf("(I see you are running Configure as super-user...)\n");
11366                 setuid(1);
11367         }
11368 #ifdef TRY_BSD_PGRP
11369         if (-1 == setpgrp(1, 1))
11370                 exit(0);
11371 #else
11372         if (setpgrp() != -1)
11373                 exit(0);
11374 #endif
11375         exit(1);
11376 }
11377 EOP
11378         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11379                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11380                 val="$define"
11381         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11382                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11383                 val="$undef"
11384         else
11385                 echo "(I can't seem to compile and run the test program.)"
11386                 if ./usg; then
11387                         xxx="a USG one, i.e. you use setpgrp()."
11388                 else
11389                         # SVR4 systems can appear rather BSD-ish.
11390                         case "$i_unistd" in
11391                         $undef)
11392                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11393                                 val="$define"
11394                                 ;;
11395                         $define)
11396                                 xxx="probably a USG one, i.e. you use setpgrp()."
11397                                 val="$undef"
11398                                 ;;
11399                         esac
11400                 fi
11401                 echo "Assuming your setpgrp is $xxx" >&4
11402         fi
11403         ;;
11404 *) val="$undef";;
11405 esac
11406 set d_bsdsetpgrp
11407 eval $setvar
11408 $rm_try
11409
11410 : Look for GCC-style __builtin_choose_expr
11411 case "$d_builtin_choose_expr" in
11412 '')
11413     echo " "
11414     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11415     $cat >try.c <<'EOCP'
11416 #include <assert.h>
11417 #include <stdlib.h>
11418 #include <stdio.h>
11419
11420 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11421
11422 int main(void) {
11423     assert( SYRINX(1) == 2112 );
11424     assert( SYRINX(1) != 5150 );
11425     assert( SYRINX(0) == 5150 );
11426     assert( SYRINX(0) != 2112 );
11427     puts( "All good!" );
11428     exit(0);
11429 }
11430
11431 EOCP
11432     set try
11433     if eval $compile && $run ./try; then
11434         echo "Your C compiler supports __builtin_choose_expr."
11435         val="$define"
11436     else
11437         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11438         val="$undef"
11439     fi
11440 ;;
11441 *) val="$d_builtin_choose_expr" ;;
11442 esac
11443
11444 set d_builtin_choose_expr
11445 eval $setvar
11446 $rm_try
11447
11448 : Look for GCC-style __builtin_expect
11449 case "$d_builtin_expect" in
11450 '')
11451     echo " "
11452     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11453     $cat >try.c <<'EOCP'
11454 int main(void) {
11455     int n = 50;
11456     if ( __builtin_expect(n, 0) ) n = 1;
11457     /* Remember shell exit code truth is 0, C truth is non-zero */
11458     return !(n == 1);
11459 }
11460 EOCP
11461     set try
11462     if eval $compile && $run ./try; then
11463         echo "Your C compiler supports __builtin_expect."
11464         val="$define"
11465     else
11466         echo "Your C compiler doesn't seem to understand __builtin_expect."
11467         val="$undef"
11468     fi
11469     ;;
11470 *) val="$d_builtin_expect" ;;
11471 esac
11472
11473 set d_builtin_expect
11474 eval $setvar
11475 $rm_try
11476
11477 : see if bzero exists
11478 set bzero d_bzero
11479 eval $inlibc
11480
11481 : see if stdarg is available
11482 echo " "
11483 if $test `./findhdr stdarg.h`; then
11484         echo "<stdarg.h> found." >&4
11485         valstd="$define"
11486 else
11487         echo "<stdarg.h> NOT found." >&4
11488         valstd="$undef"
11489 fi
11490
11491 : see if varargs is available
11492 echo " "
11493 if $test `./findhdr varargs.h`; then
11494         echo "<varargs.h> found." >&4
11495 else
11496         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11497 fi
11498
11499 : set up the varargs testing programs
11500 $cat > varargs.c <<EOP
11501 #ifdef I_STDARG
11502 #include <stdarg.h>
11503 #endif
11504 #ifdef I_VARARGS
11505 #include <varargs.h>
11506 #endif
11507
11508 #ifdef I_STDARG
11509 int f(char *p, ...)
11510 #else
11511 int f(va_alist)
11512 va_dcl
11513 #endif
11514 {
11515         va_list ap;
11516 #ifndef I_STDARG
11517         char *p;
11518 #endif
11519 #ifdef I_STDARG
11520         va_start(ap,p);
11521 #else
11522         va_start(ap);
11523         p = va_arg(ap, char *);
11524 #endif
11525         va_end(ap);
11526         return 0;
11527 }
11528 EOP
11529 $cat > varargs <<EOP
11530 $startsh
11531 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11532         echo "true"
11533 else
11534         echo "false"
11535 fi
11536 $rm -f varargs$_o
11537 EOP
11538 chmod +x varargs
11539
11540 : now check which varargs header should be included
11541 echo " "
11542 i_varhdr=''
11543 val=''
11544 case "$valstd" in
11545 "$define")
11546         if `./varargs I_STDARG`; then
11547                 val='stdarg.h'
11548         elif `./varargs I_VARARGS`; then
11549                 val='varargs.h'
11550         fi
11551         ;;
11552 *)
11553         if `./varargs I_VARARGS`; then
11554                 val='varargs.h'
11555         fi
11556         ;;
11557 esac
11558 case "$val" in
11559 '')
11560         echo " "
11561         echo "*** WHOA THERE!!! ***" >&4
11562         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11563         case "$knowitall" in
11564         '')
11565         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11566                 exit 1
11567                 ;;
11568         esac
11569 echo "I could not find the definition for va_dcl... You have problems..." >&4
11570         val="$undef"; set i_stdarg; eval $setvar
11571         val="$undef"; set i_varargs; eval $setvar
11572         ;;
11573 *)
11574         set i_varhdr
11575         eval $setvar
11576         case "$i_varhdr" in
11577         stdarg.h)
11578                 val="$define"; set i_stdarg; eval $setvar
11579                 val="$undef"; set i_varargs; eval $setvar
11580                 ;;
11581         varargs.h)
11582                 val="$undef"; set i_stdarg; eval $setvar
11583                 val="$define"; set i_varargs; eval $setvar
11584                 ;;
11585         esac
11586         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11587 esac
11588 $rm -f varargs*
11589
11590 : see if the Compiler supports C99 variadic macros
11591 case "$i_stdarg$i_stdlib" in
11592     "$define$define")
11593     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11594     $cat >try.c <<EOCP
11595 #include <stdio.h>
11596 #include <stdarg.h>
11597
11598 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11599
11600 int main() {
11601   char buf[20];
11602   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11603   puts(buf);
11604   return 0;
11605 }
11606 EOCP
11607     set try
11608     if eval $compile && $run ./try 2>&1 >/dev/null; then
11609         case "`$run ./try`" in
11610             "123 456 789")
11611             echo "You have C99 variadic macros." >&4
11612             d_c99_variadic_macros="$define"
11613             ;;
11614             *)
11615             echo "You don't have functional C99 variadic macros." >&4
11616             d_c99_variadic_macros="$undef"
11617             ;;
11618         esac
11619     else
11620         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11621         d_c99_variadic_macros="$undef"
11622     fi
11623     $rm_try
11624     ;;
11625     *)
11626     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11627     d_c99_variadic_macros="$undef"
11628     ;;
11629 esac
11630
11631 : see if signal is declared as pointer to function returning int or void
11632 echo " "
11633 xxx=`./findhdr signal.h`
11634 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11635 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11636         echo "You have int (*signal())() instead of void." >&4
11637         val="$undef"
11638 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11639         echo "You have void (*signal())()." >&4
11640         val="$define"
11641 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11642         echo "You have int (*signal())() instead of void." >&4
11643         val="$undef"
11644 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11645         echo "You have void (*signal())()." >&4
11646         val="$define"
11647 else
11648         case "$d_voidsig" in
11649         '')
11650         echo "I can't determine whether signal handler returns void or int..." >&4
11651                 dflt=void
11652                 rp="What type does your signal handler return?"
11653                 . ./myread
11654                 case "$ans" in
11655                 v*) val="$define";;
11656                 *) val="$undef";;
11657                 esac;;
11658         "$define")
11659                 echo "As you already told me, signal handler returns void." >&4
11660                 val="$define"
11661                 ;;
11662         *)      echo "As you already told me, signal handler returns int." >&4
11663                 val="$undef"
11664                 ;;
11665         esac
11666 fi
11667 set d_voidsig
11668 eval $setvar
11669 case "$d_voidsig" in
11670 "$define") signal_t="void";;
11671 *) signal_t="int";;
11672 esac
11673 $rm -f $$.tmp
11674
11675 : check for ability to cast large floats to 32-bit ints.
11676 echo " "
11677 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11678 if $test "$intsize" -ge 4; then
11679         xxx=int
11680 else
11681         xxx=long
11682 fi
11683 $cat >try.c <<EOCP
11684 #include <stdio.h>
11685 #$i_stdlib I_STDLIB
11686 #ifdef I_STDLIB
11687 #include <stdlib.h>
11688 #endif
11689 #include <sys/types.h>
11690 #include <signal.h>
11691 $signal_t blech(int s) { exit(3); }
11692 int main()
11693 {
11694         $xxx i32;
11695         double f, g;
11696         int result = 0;
11697         char str[16];
11698         signal(SIGFPE, blech);
11699
11700         /* Don't let compiler optimize the test away.  Store the number
11701            in a writable string for gcc to pass to sscanf under HP-UX.
11702         */
11703         sprintf(str, "2147483647");
11704         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11705         g = 10 * f;
11706         i32  = ($xxx) g;
11707
11708         /* x86 processors will probably give 0x8000 0000, which is a
11709            sign change.  We don't want that.  We want to mimic SPARC
11710            behavior here, which is to preserve the sign and give
11711            back 0x7fff ffff.
11712         */
11713         if (i32 != ($xxx) f)
11714                 result |= 1;
11715         exit(result);
11716 }
11717 EOCP
11718 set try
11719 if eval $compile_ok; then
11720         $run ./try 2>/dev/null
11721         yyy=$?
11722 else
11723         echo "(I can't seem to compile the test program--assuming it can't)"
11724         yyy=1
11725 fi
11726 case "$yyy" in
11727 0)      val="$define"
11728         echo "Yup, it can."
11729         ;;
11730 *)      val="$undef"
11731         echo "Nope, it can't."
11732         ;;
11733 esac
11734 set d_casti32
11735 eval $setvar
11736 $rm_try
11737
11738 : check for ability to cast negative floats to unsigned
11739 echo " "
11740 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11741 $cat >try.c <<EOCP
11742 #include <stdio.h>
11743 #$i_stdlib I_STDLIB
11744 #ifdef I_STDLIB
11745 #include <stdlib.h>
11746 #endif
11747 #include <sys/types.h>
11748 #include <signal.h>
11749 $signal_t blech(int s) { exit(7); }
11750 $signal_t blech_in_list(int s) { exit(4); }
11751 unsigned long dummy_long(unsigned long p) { return p; }
11752 unsigned int dummy_int(unsigned int p) { return p; }
11753 unsigned short dummy_short(unsigned short p) { return p; }
11754 int main()
11755 {
11756         double f;
11757         unsigned long along;
11758         unsigned int aint;
11759         unsigned short ashort;
11760         int result = 0;
11761         char str[16];
11762
11763         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11764            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11765            optimized the whole file away
11766         */
11767         /* Store the number in a writable string for gcc to pass to
11768            sscanf under HP-UX.
11769         */
11770         sprintf(str, "-123");
11771         sscanf(str, "%lf", &f);  /* f = -123.; */
11772
11773         signal(SIGFPE, blech);
11774         along = (unsigned long)f;
11775         aint = (unsigned int)f;
11776         ashort = (unsigned short)f;
11777         if (along != (unsigned long)-123)
11778                 result |= 1;
11779         if (aint != (unsigned int)-123)
11780                 result |= 1;
11781         if (ashort != (unsigned short)-123)
11782                 result |= 1;
11783         sprintf(str, "1073741824.");
11784         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11785         f = f + f;
11786         along = 0;
11787         along = (unsigned long)f;
11788         if (along != 0x80000000)
11789                 result |= 2;
11790         f -= 1.;
11791         along = 0;
11792         along = (unsigned long)f;
11793         if (along != 0x7fffffff)
11794                 result |= 1;
11795         f += 2.;
11796         along = 0;
11797         along = (unsigned long)f;
11798         if (along != 0x80000001)
11799                 result |= 2;
11800         if (result)
11801                 exit(result);
11802         signal(SIGFPE, blech_in_list);
11803         sprintf(str, "123.");
11804         sscanf(str, "%lf", &f);  /* f = 123.; */
11805         along = dummy_long((unsigned long)f);
11806         aint = dummy_int((unsigned int)f);
11807         ashort = dummy_short((unsigned short)f);
11808         if (along != (unsigned long)123)
11809                 result |= 4;
11810         if (aint != (unsigned int)123)
11811                 result |= 4;
11812         if (ashort != (unsigned short)123)
11813                 result |= 4;
11814         exit(result);
11815
11816 }
11817 EOCP
11818 set try
11819 if eval $compile_ok; then
11820         $run ./try 2>/dev/null
11821         castflags=$?
11822 else
11823         echo "(I can't seem to compile the test program--assuming it can't)"
11824         castflags=7
11825 fi
11826 case "$castflags" in
11827 0)      val="$define"
11828         echo "Yup, it can."
11829         ;;
11830 *)      val="$undef"
11831         echo "Nope, it can't."
11832         ;;
11833 esac
11834 set d_castneg
11835 eval $setvar
11836 $rm_try
11837
11838 : see if cbrt exists
11839 set cbrt d_cbrt
11840 eval $inlibc
11841
11842 : see if vprintf exists
11843 echo " "
11844 if set vprintf val -f d_vprintf; eval $csym; $val; then
11845         echo 'vprintf() found.' >&4
11846         val="$define"
11847         $cat >try.c <<EOF
11848 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11849 #$i_varargs I_VARARGS
11850
11851 #$i_stdlib I_STDLIB
11852 #$i_unistd I_UNISTD
11853
11854 #ifdef I_STDARG
11855 #  include <stdarg.h>
11856 #else /* I_VARARGS */
11857 #  include <varargs.h>
11858 #endif
11859
11860 #ifdef I_UNISTD
11861 #  include <unistd.h>
11862 #endif
11863
11864 #ifdef I_STDLIB
11865 #  include <stdlib.h>
11866 #endif
11867
11868 #include <stdio.h> /* vsprintf prototype */
11869
11870 #ifdef I_STDARG
11871 void xxx(int n, ...)
11872 {
11873     va_list args;
11874     char buf[10];
11875     va_start(args, n);
11876     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11877 }
11878 int main() { xxx(1, "foo"); }
11879
11880 #else /* I_VARARGS */
11881
11882 xxx(va_alist)
11883 va_dcl
11884 {
11885     va_list args;
11886     char buf[10];
11887     va_start(args);
11888     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11889 }
11890 int main() { xxx("foo"); }
11891
11892 #endif
11893
11894 EOF
11895         set try
11896         if eval $compile_ok; then
11897                 if $run ./try; then
11898                         echo "Your vsprintf() returns (int)." >&4
11899                         val2="$undef"
11900                 else
11901                         echo "Your vsprintf() returns (char*)." >&4
11902                         val2="$define"
11903                 fi
11904         else
11905                 echo 'I am unable to compile the vsprintf() test program.' >&4
11906                 # We shouldn't get here.  If we do, assume the standard signature,
11907                 # not the old BSD one.
11908                 echo 'Guessing that vsprintf() returns (int).' >&4
11909                 val2="$undef"
11910         fi
11911 else
11912         echo 'vprintf() NOT found.' >&4
11913         val="$undef"
11914         val2="$undef"
11915 fi
11916 $rm_try
11917 set d_vprintf
11918 eval $setvar
11919 val=$val2
11920 set d_charvspr
11921 eval $setvar
11922
11923 : see if chown exists
11924 set chown d_chown
11925 eval $inlibc
11926
11927 : see if chroot exists
11928 set chroot d_chroot
11929 eval $inlibc
11930
11931 : see if chsize exists
11932 set chsize d_chsize
11933 eval $inlibc
11934
11935 : see if class exists
11936 set class d_class
11937 eval $inlibc
11938
11939 : see if clearenv exists
11940 set clearenv d_clearenv
11941 eval $inlibc
11942
11943 : Define hasstruct macro for Configure internal use
11944 hasstruct='varname=$1; struct=$2; shift; shift;
11945 while $test $# -ge 2; do
11946         case "$1" in
11947         $define) echo "#include <$2>";;
11948         esac ;
11949     shift 2;
11950 done > try.c;
11951 echo "int main () { struct $struct foo; }" >> try.c;
11952 set try;
11953 if eval $compile; then
11954         val="$define";
11955 else
11956         val="$undef";
11957 fi;
11958 set $varname;
11959 eval $setvar;
11960 $rm_try'
11961
11962 : see whether socket exists
11963 socketlib=''
11964 sockethdr=''
11965 echo " "
11966 $echo $n "Hmm... $c" >&4
11967 if set socket val -f d_socket; eval $csym; $val; then
11968     echo "Looks like you have Berkeley networking support." >&4
11969     d_socket="$define"
11970     if set setsockopt val -f; eval $csym; $val; then
11971         d_oldsock="$undef"
11972     else
11973         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11974         d_oldsock="$define"
11975     fi
11976 else
11977     if $contains socklib libc.list >/dev/null 2>&1; then
11978         echo "Looks like you have Berkeley networking support." >&4
11979         d_socket="$define"
11980         : we will have to assume that it supports the 4.2 BSD interface
11981         d_oldsock="$undef"
11982     else
11983         echo "You don't have Berkeley networking in libc$_a..." >&4
11984         if test "X$d_socket" = "X$define"; then
11985             echo "...but you seem to believe that you have sockets." >&4
11986         else
11987             for net in net socket
11988             do
11989                 if test -f $sysroot/usr/lib/lib$net$_a; then
11990                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11991                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11992                     if $contains socket libc.list >/dev/null 2>&1; then
11993                         d_socket="$define"
11994                         socketlib="-l$net"
11995                         case "$net" in
11996                         net)
11997                             echo "...but the Wollongong group seems to have hacked it in." >&4
11998                             sockethdr="-I$sysroot/usr/netinclude"
11999                             ;;
12000                         esac
12001                         echo "Found Berkeley sockets interface in lib$net." >&4
12002                         if $contains setsockopt libc.list >/dev/null 2>&1; then
12003                             d_oldsock="$undef"
12004                         else
12005                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
12006                             d_oldsock="$define"
12007                         fi
12008                         break
12009                     fi
12010                 fi
12011             done
12012             if test "X$d_socket" != "X$define"; then
12013                echo "or anywhere else I see." >&4
12014                d_socket="$undef"
12015                d_oldsock="$undef"
12016             fi
12017         fi
12018     fi
12019 fi
12020
12021 : see if socketpair exists
12022 set socketpair d_sockpair
12023 eval $inlibc
12024
12025
12026 echo " "
12027 echo "Checking the availability sa_len in the sock struct ..." >&4
12028 $cat >try.c <<EOF
12029 #include <sys/types.h>
12030 #include <sys/socket.h>
12031 int main() {
12032 struct sockaddr sa;
12033 return (sa.sa_len);
12034 }
12035 EOF
12036 val="$undef"
12037 set try; if eval $compile; then
12038     val="$define"
12039 fi
12040 set d_sockaddr_sa_len; eval $setvar
12041 $rm_try
12042
12043 echo " "
12044 echo "Checking the availability struct sockaddr_in6 ..." >&4
12045 $cat >try.c <<EOF
12046 #include <sys/types.h>
12047 #include <sys/socket.h>
12048 #include <netinet/in.h>
12049 int main() {
12050 struct sockaddr_in6 sin6;
12051 return (sin6.sin6_family);
12052 }
12053 EOF
12054 val="$undef"
12055 set try; if eval $compile; then
12056     val="$define"
12057 fi
12058 set d_sockaddr_in6; eval $setvar
12059 $rm_try
12060
12061 echo " "
12062 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12063 $cat >try.c <<EOF
12064 #include <sys/types.h>
12065 #include <sys/socket.h>
12066 #include <netinet/in.h>
12067 int main() {
12068 struct sockaddr_in6 sin6;
12069 return (sin6.sin6_scope_id);
12070 }
12071 EOF
12072 val="$undef"
12073 set try; if eval $compile; then
12074     val="$define"
12075 fi
12076 set d_sin6_scope_id; eval $setvar
12077 $rm_try
12078
12079 echo " "
12080 echo "Checking the availability struct ip_mreq ..." >&4
12081 $cat >try.c <<EOF
12082 #include <sys/types.h>
12083 #include <sys/socket.h>
12084 #include <netinet/in.h>
12085 int main() {
12086 struct ip_mreq mreq;
12087 return (mreq.imr_multiaddr.s_addr);
12088 }
12089 EOF
12090 val="$undef"
12091 set try; if eval $compile; then
12092        val="$define"
12093 fi
12094 set d_ip_mreq; eval $setvar
12095 $rm_try
12096
12097 echo " "
12098 echo "Checking the availability struct ip_mreq_source ..." >&4
12099 $cat >try.c <<EOF
12100 #include <sys/types.h>
12101 #include <sys/socket.h>
12102 #include <netinet/in.h>
12103 int main() {
12104 struct ip_mreq_source mreq;
12105 return (mreq.imr_multiaddr.s_addr);
12106 }
12107 EOF
12108 val="$undef"
12109 set try; if eval $compile; then
12110        val="$define"
12111 fi
12112 set d_ip_mreq_source; eval $setvar
12113 $rm_try
12114
12115 echo " "
12116 echo "Checking the availability struct ipv6_mreq ..." >&4
12117 $cat >try.c <<EOF
12118 #include <sys/types.h>
12119 #include <sys/socket.h>
12120 #include <netinet/in.h>
12121 int main() {
12122 struct ipv6_mreq mreq;
12123 return (mreq.ipv6mr_interface);
12124 }
12125 EOF
12126 val="$undef"
12127 set try; if eval $compile; then
12128     val="$define"
12129 fi
12130 set d_ipv6_mreq; eval $setvar
12131 $rm_try
12132
12133 echo " "
12134 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12135 $cat >try.c <<EOF
12136 #include <sys/types.h>
12137 #include <sys/socket.h>
12138 #include <netinet/in.h>
12139 int main() {
12140 struct ipv6_mreq_source mreq;
12141 return (mreq.imr_multiaddr.s_addr);
12142 }
12143 EOF
12144 val="$undef"
12145 set try; if eval $compile; then
12146        val="$define"
12147 fi
12148 set d_ipv6_mreq_source; eval $setvar
12149 $rm_try
12150
12151 echo " "
12152 echo "Checking the availability of certain socket constants..." >&4
12153 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12154     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12155     $cat >try.c <<EOF
12156 #include <sys/types.h>
12157 #include <sys/socket.h>
12158 int main() {
12159     int i = $ENUM;
12160 }
12161 EOF
12162     val="$undef"
12163     set try; if eval $compile; then
12164         val="$define"
12165     fi
12166     set d_${enum}; eval $setvar
12167     $rm_try
12168 done
12169
12170 : see if this is a sys/uio.h system
12171 set sys/uio.h i_sysuio
12172 eval $inhdr
12173
12174 : Check for cmsghdr support
12175 echo " "
12176 echo "Checking to see if your system supports struct cmsghdr..." >&4
12177 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12178 eval $hasstruct
12179 case "$d_cmsghdr_s" in
12180 "$define")      echo "Yes, it does."   ;;
12181 *)              echo "No, it doesn't." ;;
12182 esac
12183
12184
12185 : check for const keyword
12186 echo " "
12187 echo 'Checking to see if your C compiler knows about "const"...' >&4
12188 $cat >const.c <<'EOCP'
12189 typedef struct spug { int drokk; } spug;
12190 int main()
12191 {
12192         const char *foo;
12193         const spug y = { 0 };
12194 }
12195 EOCP
12196 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12197         val="$define"
12198         echo "Yup, it does."
12199 else
12200         val="$undef"
12201         echo "Nope, it doesn't."
12202 fi
12203 set d_const
12204 eval $setvar
12205
12206 : see if copysign exists
12207 set copysign d_copysign
12208 eval $inlibc
12209
12210 : see if copysignl exists
12211 set copysignl d_copysignl
12212 eval $inlibc
12213
12214 : see if crypt exists
12215 echo " "
12216 set crypt d_crypt
12217 eval $inlibc
12218 case "$d_crypt" in
12219 $define) cryptlib='' ;;
12220 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12221                 echo 'crypt() found.' >&4
12222                 val="$define"
12223                 cryptlib=''
12224         else
12225                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12226                 if $test -z "$cryptlib"; then
12227                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12228                 else
12229                         cryptlib=-lcrypt
12230                 fi
12231                 if $test -z "$cryptlib"; then
12232                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12233                 else
12234                         cryptlib=-lcrypt
12235                 fi
12236                 if $test -z "$cryptlib"; then
12237                         cryptlib=`./loc libcrypt$_a "" $libpth`
12238                 else
12239                         cryptlib=-lcrypt
12240                 fi
12241                 if $test -z "$cryptlib"; then
12242                         echo 'crypt() NOT found.' >&4
12243                         val="$undef"
12244                 else
12245                         val="$define"
12246                 fi
12247         fi
12248         set d_crypt
12249         eval $setvar
12250         ;;
12251 esac
12252
12253 : see if this is a crypt.h system
12254 set crypt.h i_crypt
12255 eval $inhdr
12256
12257 : see if crypt_r exists
12258 set crypt_r d_crypt_r
12259 eval $inlibc
12260 case "$d_crypt_r" in
12261 "$define")
12262         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12263         case "$d_crypt_r_proto:$usethreads" in
12264         ":define")      d_crypt_r_proto=define
12265                 set d_crypt_r_proto crypt_r $hdrs
12266                 eval $hasproto ;;
12267         *)      ;;
12268         esac
12269         case "$d_crypt_r_proto" in
12270         define)
12271         case "$crypt_r_proto" in
12272         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12273         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12274         esac
12275         case "$crypt_r_proto" in
12276         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12277         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12278         esac
12279         case "$crypt_r_proto" in
12280         ''|0)   d_crypt_r=undef
12281                 crypt_r_proto=0
12282                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12283         * )     case "$crypt_r_proto" in
12284                 REENTRANT_PROTO*) ;;
12285                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12286                 esac
12287                 echo "Prototype: $try" ;;
12288         esac
12289         ;;
12290         *)      case "$usethreads" in
12291                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12292                 esac
12293                 d_crypt_r=undef
12294                 crypt_r_proto=0
12295                 ;;
12296         esac
12297         ;;
12298 *)      crypt_r_proto=0
12299         ;;
12300 esac
12301
12302 : get csh whereabouts
12303 case "$csh" in
12304 'csh') val="$undef" ;;
12305 *) val="$define" ;;
12306 esac
12307 set d_csh
12308 eval $setvar
12309 : Respect a hint or command line value for full_csh.
12310 case "$full_csh" in
12311 '') full_csh=$csh ;;
12312 esac
12313
12314 : see if ctermid exists
12315 set ctermid d_ctermid
12316 eval $inlibc
12317
12318 : see if ctermid_r exists
12319 set ctermid_r d_ctermid_r
12320 eval $inlibc
12321 case "$d_ctermid_r" in
12322 "$define")
12323         hdrs="$i_systypes sys/types.h define stdio.h "
12324         case "$d_ctermid_r_proto:$usethreads" in
12325         ":define")      d_ctermid_r_proto=define
12326                 set d_ctermid_r_proto ctermid_r $hdrs
12327                 eval $hasproto ;;
12328         *)      ;;
12329         esac
12330         case "$d_ctermid_r_proto" in
12331         define)
12332         case "$ctermid_r_proto" in
12333         ''|0) try='char* ctermid_r(char*);'
12334         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12335         esac
12336         case "$ctermid_r_proto" in
12337         ''|0)   d_ctermid_r=undef
12338                 ctermid_r_proto=0
12339                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12340         * )     case "$ctermid_r_proto" in
12341                 REENTRANT_PROTO*) ;;
12342                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12343                 esac
12344                 echo "Prototype: $try" ;;
12345         esac
12346         ;;
12347         *)      case "$usethreads" in
12348                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12349                 esac
12350                 d_ctermid_r=undef
12351                 ctermid_r_proto=0
12352                 ;;
12353         esac
12354         ;;
12355 *)      ctermid_r_proto=0
12356         ;;
12357 esac
12358
12359 : see if ctime_r exists
12360 set ctime_r d_ctime_r
12361 eval $inlibc
12362 case "$d_ctime_r" in
12363 "$define")
12364         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12365         case "$d_ctime_r_proto:$usethreads" in
12366         ":define")      d_ctime_r_proto=define
12367                 set d_ctime_r_proto ctime_r $hdrs
12368                 eval $hasproto ;;
12369         *)      ;;
12370         esac
12371         case "$d_ctime_r_proto" in
12372         define)
12373         case "$ctime_r_proto" in
12374         ''|0) try='char* ctime_r(const time_t*, char*);'
12375         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12376         esac
12377         case "$ctime_r_proto" in
12378         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12379         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12380         esac
12381         case "$ctime_r_proto" in
12382         ''|0) try='int ctime_r(const time_t*, char*);'
12383         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12384         esac
12385         case "$ctime_r_proto" in
12386         ''|0) try='int ctime_r(const time_t*, char*, int);'
12387         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12388         esac
12389         case "$ctime_r_proto" in
12390         ''|0)   d_ctime_r=undef
12391                 ctime_r_proto=0
12392                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12393         * )     case "$ctime_r_proto" in
12394                 REENTRANT_PROTO*) ;;
12395                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12396                 esac
12397                 echo "Prototype: $try" ;;
12398         esac
12399         ;;
12400         *)      case "$usethreads" in
12401                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12402                 esac
12403                 d_ctime_r=undef
12404                 ctime_r_proto=0
12405                 ;;
12406         esac
12407         ;;
12408 *)      ctime_r_proto=0
12409         ;;
12410 esac
12411
12412 : see if cuserid exists
12413 set cuserid d_cuserid
12414 eval $inlibc
12415
12416 : see if this is a limits.h system
12417 set limits.h i_limits
12418 eval $inhdr
12419
12420 : See if number of significant digits in a double precision number is known
12421 echo " "
12422 $cat >dbl_dig.c <<EOM
12423 #$i_limits I_LIMITS
12424 #$i_float I_FLOAT
12425 #ifdef I_LIMITS
12426 #include <limits.h>
12427 #endif
12428 #ifdef I_FLOAT
12429 #include <float.h>
12430 #endif
12431 #ifdef DBL_DIG
12432 printf("Contains DBL_DIG");
12433 #endif
12434 EOM
12435 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12436 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12437         echo "DBL_DIG found." >&4
12438         val="$define"
12439 else
12440         echo "DBL_DIG NOT found." >&4
12441         val="$undef"
12442 fi
12443 $rm -f dbl_dig.?
12444 set d_dbl_dig
12445 eval $setvar
12446
12447 : see if dbm.h is available
12448 : see if dbmclose exists
12449 set dbmclose d_dbmclose
12450 eval $inlibc
12451
12452 case "$d_dbmclose" in
12453 $define)
12454         set dbm.h i_dbm
12455         eval $inhdr
12456         case "$i_dbm" in
12457         $define)
12458                 val="$undef"
12459                 set i_rpcsvcdbm
12460                 eval $setvar
12461                 ;;
12462         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12463                 eval $inhdr
12464                 ;;
12465         esac
12466         ;;
12467 *)      echo "We won't be including <dbm.h>"
12468         val="$undef"
12469         set i_dbm
12470         eval $setvar
12471         val="$undef"
12472         set i_rpcsvcdbm
12473         eval $setvar
12474         ;;
12475 esac
12476
12477 : see if prototype for dbminit is available
12478 echo " "
12479 set d_dbminitproto dbminit $i_dbm dbm.h
12480 eval $hasproto
12481
12482 : see if difftime exists
12483 set difftime d_difftime
12484 eval $inlibc
12485
12486 : see if this is a dirent system
12487 echo " "
12488 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12489         val="$define"
12490         echo "<dirent.h> found." >&4
12491 else
12492         val="$undef"
12493         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12494                 echo "<sys/dir.h> found." >&4
12495                 echo " "
12496         else
12497                 xinc=`./findhdr sys/ndir.h`
12498         fi
12499         echo "<dirent.h> NOT found." >&4
12500 fi
12501 set i_dirent
12502 eval $setvar
12503
12504 : Look for type of directory structure.
12505 echo " "
12506 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12507
12508 case "$direntrytype" in
12509 ''|' ')
12510         case "$i_dirent" in
12511         $define) guess1='struct dirent' ;;
12512         *) guess1='struct direct'  ;;
12513         esac
12514         ;;
12515 *)      guess1="$direntrytype"
12516         ;;
12517 esac
12518
12519 case "$guess1" in
12520 'struct dirent') guess2='struct direct' ;;
12521 *) guess2='struct dirent' ;;
12522 esac
12523
12524 if $contains "$guess1" try.c >/dev/null 2>&1; then
12525         direntrytype="$guess1"
12526         echo "Your directory entries are $direntrytype." >&4
12527 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12528         direntrytype="$guess2"
12529         echo "Your directory entries seem to be $direntrytype." >&4
12530 else
12531         echo "I don't recognize your system's directory entries." >&4
12532         rp="What type is used for directory entries on this system?"
12533         dflt="$guess1"
12534         . ./myread
12535         direntrytype="$ans"
12536 fi
12537 $rm_try
12538
12539 : see if the directory entry stores field length
12540 echo " "
12541 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12542 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12543         echo "Good, your directory entry keeps length information in d_namlen." >&4
12544         val="$define"
12545 else
12546         echo "Your directory entry does not know about the d_namlen field." >&4
12547         val="$undef"
12548 fi
12549 set d_dirnamlen
12550 eval $setvar
12551 $rm_try
12552
12553 : Look for DIR.dd_fd
12554 case "$i_dirent" in
12555 "$define")
12556     echo "Checking to see if DIR has a dd_fd member variable" >&4
12557     $cat >try.c <<EOCP
12558 #$i_stdlib I_STDLIB
12559 #ifdef I_STDLIB
12560 #include <stdlib.h>
12561 #endif
12562 #include <dirent.h>
12563
12564 int main() {
12565     DIR dir;
12566     dir.dd_fd = 1;
12567     return 0;
12568 }
12569 EOCP
12570     val=$undef
12571     set try
12572     if eval $compile; then
12573         echo "Yes, it does."
12574         val="$define"
12575     else
12576         echo "No, it does not."
12577         val="$undef"
12578     fi
12579     ;;
12580 *)
12581     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12582     val="$undef"
12583     ;;
12584 esac
12585 set d_dir_dd_fd
12586 eval $setvar
12587 $rm_try
12588
12589 : see if this is an sysdir system
12590 set sys/dir.h i_sysdir
12591 eval $inhdr
12592
12593 : see if this is an sysndir system
12594 set sys/ndir.h i_sysndir
12595 eval $inhdr
12596
12597 : Look for dirfd
12598 echo " "
12599 $cat >dirfd.c <<EOM
12600 #include <stdio.h>
12601 #$i_stdlib I_STDLIB
12602 #ifdef I_STDLIB
12603 #include <stdlib.h>
12604 #endif
12605 #$i_dirent I_DIRENT             /**/
12606 #$i_sysdir I_SYS_DIR            /**/
12607 #$i_sysndir I_SYS_NDIR          /**/
12608 #$i_systypes I_SYS_TYPES        /**/
12609 #if defined(I_SYS_TYPES)
12610 #include <sys/types.h>
12611 #endif
12612 #if defined(I_DIRENT)
12613 #include <dirent.h>
12614 #else
12615 #ifdef I_SYS_NDIR
12616 #include <sys/ndir.h>
12617 #else
12618 #ifdef I_SYS_DIR
12619 #ifdef hp9000s500
12620 #include <ndir.h>       /* may be wrong in the future */
12621 #else
12622 #include <sys/dir.h>
12623 #endif
12624 #endif
12625 #endif
12626 #endif
12627 int main() {
12628         DIR *dirp = opendir(".");
12629         if (dirfd(dirp) >= 0)
12630                 exit(0);
12631         else
12632                 exit(1);
12633 }
12634 EOM
12635 val=$undef
12636 set dirfd
12637 if eval $compile; then
12638         val="$define"
12639 fi
12640 case "$val" in
12641 $define)        echo "dirfd() found." >&4       ;;
12642 *)              echo "dirfd() NOT found." >&4   ;;
12643 esac
12644 set d_dirfd
12645 eval $setvar
12646 $rm -f dirfd*
12647
12648 : see if dladdr exists
12649 set dladdr d_dladdr
12650 eval $inlibc
12651
12652 : see if dlerror exists
12653 xxx_runnm="$runnm"
12654 runnm=false
12655 set dlerror d_dlerror
12656 eval $inlibc
12657 runnm="$xxx_runnm"
12658
12659 : see if dlfcn is available
12660 set dlfcn.h i_dlfcn
12661 eval $inhdr
12662
12663 : Check what extension to use for shared libs
12664 case "$usedl" in
12665 $define|y|true)
12666         $cat << EOM
12667
12668 On a few systems, the dynamically loaded modules that perl generates and uses
12669 will need a different extension than shared libs. The default will probably
12670 be appropriate.
12671
12672 EOM
12673         case "$dlext" in
12674         '')     dflt="$so" ;;
12675         *)      dflt="$dlext" ;;
12676         esac
12677         rp='What is the extension of dynamically loaded modules'
12678         . ./myread
12679         dlext="$ans"
12680         ;;
12681 *)
12682         dlext="none"
12683         ;;
12684 esac
12685
12686 : Check if dlsym need a leading underscore
12687 echo " "
12688 val="$undef"
12689
12690 case "$dlsrc" in
12691 dl_dlopen.xs)
12692         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12693         $cat >dyna.c <<'EOM'
12694 fred () { }
12695 EOM
12696
12697 $cat >fred.c<<EOM
12698
12699 #include <stdio.h>
12700 #$i_stdlib I_STDLIB
12701 #ifdef I_STDLIB
12702 #include <stdlib.h>
12703 #endif
12704 #$i_dlfcn I_DLFCN
12705 #ifdef I_DLFCN
12706 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12707 #else
12708 #include <sys/types.h>
12709 #include <nlist.h>
12710 #include <link.h>
12711 #endif
12712
12713 extern int fred() ;
12714
12715 int main()
12716 {
12717     void * handle ;
12718     void * symbol ;
12719 #ifndef RTLD_LAZY
12720     int mode = 1 ;
12721 #else
12722     int mode = RTLD_LAZY ;
12723 #endif
12724     handle = dlopen("./dyna.$dlext", mode) ;
12725     if (handle == NULL) {
12726         printf ("1\n") ;
12727         fflush (stdout) ;
12728         exit(0);
12729     }
12730     symbol = dlsym(handle, "fred") ;
12731     if (symbol == NULL) {
12732         /* try putting a leading underscore */
12733         symbol = dlsym(handle, "_fred") ;
12734         if (symbol == NULL) {
12735             printf ("2\n") ;
12736             fflush (stdout) ;
12737             exit(0);
12738         }
12739         printf ("3\n") ;
12740     }
12741     else
12742         printf ("4\n") ;
12743     fflush (stdout) ;
12744     exit(0);
12745 }
12746 EOM
12747         : Call the object file tmp-dyna.o in case dlext=o.
12748         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12749                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12750                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12751                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12752                 xxx=`$run ./fred`
12753                 case $xxx in
12754                 1)      echo "Test program failed using dlopen." >&4
12755                         echo "Perhaps you should not use dynamic loading." >&4;;
12756                 2)      echo "Test program failed using dlsym." >&4
12757                         echo "Perhaps you should not use dynamic loading." >&4;;
12758                 3)      echo "dlsym needs a leading underscore" >&4
12759                         val="$define" ;;
12760                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12761                 esac
12762         else
12763                 echo "I can't compile and run the test program." >&4
12764                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12765         fi
12766         ;;
12767 esac
12768
12769 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12770
12771 set d_dlsymun
12772 eval $setvar
12773
12774 : see if drand48_r exists
12775 set drand48_r d_drand48_r
12776 eval $inlibc
12777 case "$d_drand48_r" in
12778 "$define")
12779         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12780         case "$d_drand48_r_proto:$usethreads" in
12781         ":define")      d_drand48_r_proto=define
12782                 set d_drand48_r_proto drand48_r $hdrs
12783                 eval $hasproto ;;
12784         *)      ;;
12785         esac
12786         case "$d_drand48_r_proto" in
12787         define)
12788         case "$drand48_r_proto" in
12789         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12790         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12791         esac
12792         case "$drand48_r_proto" in
12793         ''|0)   d_drand48_r=undef
12794                 drand48_r_proto=0
12795                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12796         * )     case "$drand48_r_proto" in
12797                 REENTRANT_PROTO*) ;;
12798                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12799                 esac
12800                 echo "Prototype: $try" ;;
12801         esac
12802         ;;
12803         *)      case "$usethreads" in
12804                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12805                 esac
12806                 d_drand48_r=undef
12807                 drand48_r_proto=0
12808                 ;;
12809         esac
12810         ;;
12811 *)      drand48_r_proto=0
12812         ;;
12813 esac
12814
12815 : see if prototype for drand48 is available
12816 echo " "
12817 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12818 eval $hasproto
12819
12820 : see if dup2 exists
12821 set dup2 d_dup2
12822 eval $inlibc
12823
12824 : see if eaccess exists
12825 set eaccess d_eaccess
12826 eval $inlibc
12827
12828 : see if endgrent exists
12829 set endgrent d_endgrent
12830 eval $inlibc
12831
12832 : see if this is an grp system
12833 set grp.h i_grp
12834 eval $inhdr
12835
12836 case "$i_grp" in
12837 $define)
12838         xxx=`./findhdr grp.h`
12839         $cppstdin $cppflags $cppminus < $xxx >$$.h
12840
12841         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12842                 val="$define"
12843         else
12844                 val="$undef"
12845         fi
12846         set d_grpasswd
12847         eval $setvar
12848
12849         $rm -f $$.h
12850         ;;
12851 *)
12852         val="$undef";
12853         set d_grpasswd; eval $setvar
12854         ;;
12855 esac
12856
12857 : see if endgrent_r exists
12858 set endgrent_r d_endgrent_r
12859 eval $inlibc
12860 case "$d_endgrent_r" in
12861 "$define")
12862         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12863         case "$d_endgrent_r_proto:$usethreads" in
12864         ":define")      d_endgrent_r_proto=define
12865                 set d_endgrent_r_proto endgrent_r $hdrs
12866                 eval $hasproto ;;
12867         *)      ;;
12868         esac
12869         case "$d_endgrent_r_proto" in
12870         define)
12871         case "$endgrent_r_proto" in
12872         ''|0) try='int endgrent_r(FILE**);'
12873         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12874         esac
12875         case "$endgrent_r_proto" in
12876         ''|0) try='void endgrent_r(FILE**);'
12877         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12878         esac
12879         case "$endgrent_r_proto" in
12880         ''|0)   d_endgrent_r=undef
12881                 endgrent_r_proto=0
12882                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12883         * )     case "$endgrent_r_proto" in
12884                 REENTRANT_PROTO*) ;;
12885                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12886                 esac
12887                 echo "Prototype: $try" ;;
12888         esac
12889         ;;
12890         *)      case "$usethreads" in
12891                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12892                 esac
12893                 d_endgrent_r=undef
12894                 endgrent_r_proto=0
12895                 ;;
12896         esac
12897         ;;
12898 *)      endgrent_r_proto=0
12899         ;;
12900 esac
12901
12902 : see if endhostent exists
12903 set endhostent d_endhent
12904 eval $inlibc
12905
12906 : see if this is a netdb.h system
12907 set netdb.h i_netdb
12908 eval $inhdr
12909
12910 : see if endhostent_r exists
12911 set endhostent_r d_endhostent_r
12912 eval $inlibc
12913 case "$d_endhostent_r" in
12914 "$define")
12915         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12916         case "$d_endhostent_r_proto:$usethreads" in
12917         ":define")      d_endhostent_r_proto=define
12918                 set d_endhostent_r_proto endhostent_r $hdrs
12919                 eval $hasproto ;;
12920         *)      ;;
12921         esac
12922         case "$d_endhostent_r_proto" in
12923         define)
12924         case "$endhostent_r_proto" in
12925         ''|0) try='int endhostent_r(struct hostent_data*);'
12926         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12927         esac
12928         case "$endhostent_r_proto" in
12929         ''|0) try='void endhostent_r(struct hostent_data*);'
12930         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12931         esac
12932         case "$endhostent_r_proto" in
12933         ''|0)   d_endhostent_r=undef
12934                 endhostent_r_proto=0
12935                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12936         * )     case "$endhostent_r_proto" in
12937                 REENTRANT_PROTO*) ;;
12938                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12939                 esac
12940                 echo "Prototype: $try" ;;
12941         esac
12942         ;;
12943         *)      case "$usethreads" in
12944                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12945                 esac
12946                 d_endhostent_r=undef
12947                 endhostent_r_proto=0
12948                 ;;
12949         esac
12950         ;;
12951 *)      endhostent_r_proto=0
12952         ;;
12953 esac
12954
12955 : see if endnetent exists
12956 set endnetent d_endnent
12957 eval $inlibc
12958
12959 : see if endnetent_r exists
12960 set endnetent_r d_endnetent_r
12961 eval $inlibc
12962 case "$d_endnetent_r" in
12963 "$define")
12964         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12965         case "$d_endnetent_r_proto:$usethreads" in
12966         ":define")      d_endnetent_r_proto=define
12967                 set d_endnetent_r_proto endnetent_r $hdrs
12968                 eval $hasproto ;;
12969         *)      ;;
12970         esac
12971         case "$d_endnetent_r_proto" in
12972         define)
12973         case "$endnetent_r_proto" in
12974         ''|0) try='int endnetent_r(struct netent_data*);'
12975         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12976         esac
12977         case "$endnetent_r_proto" in
12978         ''|0) try='void endnetent_r(struct netent_data*);'
12979         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12980         esac
12981         case "$endnetent_r_proto" in
12982         ''|0)   d_endnetent_r=undef
12983                 endnetent_r_proto=0
12984                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12985         * )     case "$endnetent_r_proto" in
12986                 REENTRANT_PROTO*) ;;
12987                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12988                 esac
12989                 echo "Prototype: $try" ;;
12990         esac
12991         ;;
12992         *)      case "$usethreads" in
12993                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12994                 esac
12995                 d_endnetent_r=undef
12996                 endnetent_r_proto=0
12997                 ;;
12998         esac
12999         ;;
13000 *)      endnetent_r_proto=0
13001         ;;
13002 esac
13003
13004 : see if endprotoent exists
13005 set endprotoent d_endpent
13006 eval $inlibc
13007
13008 : see if endprotoent_r exists
13009 set endprotoent_r d_endprotoent_r
13010 eval $inlibc
13011 case "$d_endprotoent_r" in
13012 "$define")
13013         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13014         case "$d_endprotoent_r_proto:$usethreads" in
13015         ":define")      d_endprotoent_r_proto=define
13016                 set d_endprotoent_r_proto endprotoent_r $hdrs
13017                 eval $hasproto ;;
13018         *)      ;;
13019         esac
13020         case "$d_endprotoent_r_proto" in
13021         define)
13022         case "$endprotoent_r_proto" in
13023         ''|0) try='int endprotoent_r(struct protoent_data*);'
13024         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13025         esac
13026         case "$endprotoent_r_proto" in
13027         ''|0) try='void endprotoent_r(struct protoent_data*);'
13028         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13029         esac
13030         case "$endprotoent_r_proto" in
13031         ''|0)   d_endprotoent_r=undef
13032                 endprotoent_r_proto=0
13033                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13034         * )     case "$endprotoent_r_proto" in
13035                 REENTRANT_PROTO*) ;;
13036                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13037                 esac
13038                 echo "Prototype: $try" ;;
13039         esac
13040         ;;
13041         *)      case "$usethreads" in
13042                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13043                 esac
13044                 d_endprotoent_r=undef
13045                 endprotoent_r_proto=0
13046                 ;;
13047         esac
13048         ;;
13049 *)      endprotoent_r_proto=0
13050         ;;
13051 esac
13052
13053 : see if endpwent exists
13054 set endpwent d_endpwent
13055 eval $inlibc
13056
13057 : see if this is a pwd.h system
13058 set pwd.h i_pwd
13059 eval $inhdr
13060
13061 case "$i_pwd" in
13062 $define)
13063         xxx=`./findhdr pwd.h`
13064         $cppstdin $cppflags $cppminus < $xxx >$$.h
13065
13066         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13067                 val="$define"
13068         else
13069                 val="$undef"
13070         fi
13071         set d_pwquota
13072         eval $setvar
13073
13074         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13075                 val="$define"
13076         else
13077                 val="$undef"
13078         fi
13079         set d_pwage
13080         eval $setvar
13081
13082         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13083                 val="$define"
13084         else
13085                 val="$undef"
13086         fi
13087         set d_pwchange
13088         eval $setvar
13089
13090         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13091                 val="$define"
13092         else
13093                 val="$undef"
13094         fi
13095         set d_pwclass
13096         eval $setvar
13097
13098         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13099                 val="$define"
13100         else
13101                 val="$undef"
13102         fi
13103         set d_pwexpire
13104         eval $setvar
13105
13106         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13107                 val="$define"
13108         else
13109                 val="$undef"
13110         fi
13111         set d_pwcomment
13112         eval $setvar
13113
13114         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13115                 val="$define"
13116         else
13117                 val="$undef"
13118         fi
13119         set d_pwgecos
13120         eval $setvar
13121
13122         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13123                 val="$define"
13124         else
13125                 val="$undef"
13126         fi
13127         set d_pwpasswd
13128         eval $setvar
13129
13130         $rm -f $$.h
13131         ;;
13132 *)
13133         val="$undef";
13134         set d_pwquota; eval $setvar
13135         set d_pwage; eval $setvar
13136         set d_pwchange; eval $setvar
13137         set d_pwclass; eval $setvar
13138         set d_pwexpire; eval $setvar
13139         set d_pwcomment; eval $setvar
13140         set d_pwgecos; eval $setvar
13141         set d_pwpasswd; eval $setvar
13142         ;;
13143 esac
13144
13145 : see if endpwent_r exists
13146 set endpwent_r d_endpwent_r
13147 eval $inlibc
13148 case "$d_endpwent_r" in
13149 "$define")
13150         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13151         case "$d_endpwent_r_proto:$usethreads" in
13152         ":define")      d_endpwent_r_proto=define
13153                 set d_endpwent_r_proto endpwent_r $hdrs
13154                 eval $hasproto ;;
13155         *)      ;;
13156         esac
13157         case "$d_endpwent_r_proto" in
13158         define)
13159         case "$endpwent_r_proto" in
13160         ''|0) try='int endpwent_r(FILE**);'
13161         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13162         esac
13163         case "$endpwent_r_proto" in
13164         ''|0) try='void endpwent_r(FILE**);'
13165         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13166         esac
13167         case "$endpwent_r_proto" in
13168         ''|0)   d_endpwent_r=undef
13169                 endpwent_r_proto=0
13170                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13171         * )     case "$endpwent_r_proto" in
13172                 REENTRANT_PROTO*) ;;
13173                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13174                 esac
13175                 echo "Prototype: $try" ;;
13176         esac
13177         ;;
13178         *)      case "$usethreads" in
13179                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13180                 esac
13181                 d_endpwent_r=undef
13182                 endpwent_r_proto=0
13183                 ;;
13184         esac
13185         ;;
13186 *)      endpwent_r_proto=0
13187         ;;
13188 esac
13189
13190 : see if endservent exists
13191 set endservent d_endsent
13192 eval $inlibc
13193
13194 : see if endservent_r exists
13195 set endservent_r d_endservent_r
13196 eval $inlibc
13197 case "$d_endservent_r" in
13198 "$define")
13199         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13200         case "$d_endservent_r_proto:$usethreads" in
13201         ":define")      d_endservent_r_proto=define
13202                 set d_endservent_r_proto endservent_r $hdrs
13203                 eval $hasproto ;;
13204         *)      ;;
13205         esac
13206         case "$d_endservent_r_proto" in
13207         define)
13208         case "$endservent_r_proto" in
13209         ''|0) try='int endservent_r(struct servent_data*);'
13210         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13211         esac
13212         case "$endservent_r_proto" in
13213         ''|0) try='void endservent_r(struct servent_data*);'
13214         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13215         esac
13216         case "$endservent_r_proto" in
13217         ''|0)   d_endservent_r=undef
13218                 endservent_r_proto=0
13219                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13220         * )     case "$endservent_r_proto" in
13221                 REENTRANT_PROTO*) ;;
13222                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13223                 esac
13224                 echo "Prototype: $try" ;;
13225         esac
13226         ;;
13227         *)      case "$usethreads" in
13228                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13229                 esac
13230                 d_endservent_r=undef
13231                 endservent_r_proto=0
13232                 ;;
13233         esac
13234         ;;
13235 *)      endservent_r_proto=0
13236         ;;
13237 esac
13238
13239 : Locate the flags for 'open()'
13240 echo " "
13241 $cat >try.c <<EOCP
13242 #include <sys/types.h>
13243 #ifdef I_FCNTL
13244 #include <fcntl.h>
13245 #endif
13246 #ifdef I_SYS_FILE
13247 #include <sys/file.h>
13248 #endif
13249 #$i_stdlib I_STDLIB
13250 #ifdef I_STDLIB
13251 #include <stdlib.h>
13252 #endif
13253 int main() {
13254         if(O_RDONLY);
13255 #ifdef O_TRUNC
13256         exit(0);
13257 #else
13258         exit(1);
13259 #endif
13260 }
13261 EOCP
13262 : check sys/file.h first to get FREAD on Sun
13263 if $test `./findhdr sys/file.h` && \
13264                 set try -DI_SYS_FILE && eval $compile; then
13265         h_sysfile=true;
13266         echo "<sys/file.h> defines the O_* constants..." >&4
13267         if $run ./try; then
13268                 echo "and you have the 3 argument form of open()." >&4
13269                 val="$define"
13270         else
13271                 echo "but not the 3 argument form of open().  Oh, well." >&4
13272                 val="$undef"
13273         fi
13274 elif $test `./findhdr fcntl.h` && \
13275                 set try -DI_FCNTL && eval $compile; then
13276         h_fcntl=true;
13277         echo "<fcntl.h> defines the O_* constants..." >&4
13278         if $run ./try; then
13279                 echo "and you have the 3 argument form of open()." >&4
13280                 val="$define"
13281         else
13282                 echo "but not the 3 argument form of open().  Oh, well." >&4
13283                 val="$undef"
13284         fi
13285 else
13286         val="$undef"
13287         echo "I can't find the O_* constant definitions!  You got problems." >&4
13288 fi
13289 set d_open3
13290 eval $setvar
13291 $rm_try
13292
13293 : see if this is a sys/file.h system
13294 val=''
13295 set sys/file.h val
13296 eval $inhdr
13297
13298 : do we need to include sys/file.h ?
13299 case "$val" in
13300 "$define")
13301         echo " "
13302         if $h_sysfile; then
13303                 val="$define"
13304                 echo "We'll be including <sys/file.h>." >&4
13305         else
13306                 val="$undef"
13307                 echo "We won't be including <sys/file.h>." >&4
13308         fi
13309         ;;
13310 *)
13311         h_sysfile=false
13312         ;;
13313 esac
13314 set i_sysfile
13315 eval $setvar
13316
13317 : see if fcntl.h is there
13318 val=''
13319 set fcntl.h val
13320 eval $inhdr
13321
13322 : see if we can include fcntl.h
13323 case "$val" in
13324 "$define")
13325         echo " "
13326         if $h_fcntl; then
13327                 val="$define"
13328                 echo "We'll be including <fcntl.h>." >&4
13329         else
13330                 val="$undef"
13331                 if $h_sysfile; then
13332         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13333                 else
13334                         echo "We won't be including <fcntl.h>." >&4
13335                 fi
13336         fi
13337         ;;
13338 *)
13339         h_fcntl=false
13340         val="$undef"
13341         ;;
13342 esac
13343 set i_fcntl
13344 eval $setvar
13345
13346 : see if fork exists
13347 set fork d_fork
13348 eval $inlibc
13349
13350 : see if pipe exists
13351 set pipe d_pipe
13352 eval $inlibc
13353
13354 : check for non-blocking I/O stuff
13355 case "$h_sysfile" in
13356 true) echo "#include <sys/file.h>" > head.c;;
13357 *)
13358        case "$h_fcntl" in
13359        true) echo "#include <fcntl.h>" > head.c;;
13360        *) echo "#include <sys/fcntl.h>" > head.c;;
13361        esac
13362        ;;
13363 esac
13364 echo " "
13365 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13366 case "$o_nonblock" in
13367 '')
13368         $cat head.c > try.c
13369         $cat >>try.c <<EOCP
13370 #include <stdio.h>
13371 #$i_stdlib I_STDLIB
13372 #ifdef I_STDLIB
13373 #include <stdlib.h>
13374 #endif
13375 #$i_fcntl I_FCNTL
13376 #ifdef I_FCNTL
13377 #include <fcntl.h>
13378 #endif
13379 int main() {
13380 #ifdef O_NONBLOCK
13381         printf("O_NONBLOCK\n");
13382         exit(0);
13383 #endif
13384 #ifdef O_NDELAY
13385         printf("O_NDELAY\n");
13386         exit(0);
13387 #endif
13388 #ifdef FNDELAY
13389         printf("FNDELAY\n");
13390         exit(0);
13391 #endif
13392         exit(0);
13393 }
13394 EOCP
13395         set try
13396         if eval $compile_ok; then
13397                 o_nonblock=`$run ./try`
13398                 case "$o_nonblock" in
13399                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13400                 *) echo "Seems like we can use $o_nonblock.";;
13401                 esac
13402         else
13403                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13404         fi
13405         ;;
13406 *) echo "Using $hint value $o_nonblock.";;
13407 esac
13408 $rm_try
13409
13410 echo " "
13411 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13412 case "$eagain" in
13413 '')
13414         case "$d_fork:$d_pipe:$d_alarm" in
13415         define:define:define)
13416         $cat head.c > try.c
13417         $cat >>try.c <<EOCP
13418 #include <errno.h>
13419 #include <sys/types.h>
13420 #include <signal.h>
13421 #include <stdio.h>
13422 #$i_stdlib I_STDLIB
13423 #ifdef I_STDLIB
13424 #include <stdlib.h>
13425 #endif
13426 #$i_fcntl I_FCNTL
13427 #ifdef I_FCNTL
13428 #include <fcntl.h>
13429 #endif
13430 #define MY_O_NONBLOCK $o_nonblock
13431 #ifndef errno  /* XXX need better Configure test */
13432 extern int errno;
13433 #endif
13434 #$i_unistd I_UNISTD
13435 #ifdef I_UNISTD
13436 #include <unistd.h>
13437 #endif
13438 #$i_string I_STRING
13439 #ifdef I_STRING
13440 #include <string.h>
13441 #else
13442 #include <strings.h>
13443 #endif
13444 $signal_t blech(int x) { exit(3); }
13445 EOCP
13446         $cat >> try.c <<'EOCP'
13447 int main()
13448 {
13449         int pd[2];
13450         int pu[2];
13451         char buf[1];
13452         char string[100];
13453         int ret;
13454
13455         ret = pipe(pd); /* Down: child -> parent */
13456         if (ret != 0)
13457                 exit(3);
13458         ret = pipe(pu); /* Up: parent -> child */
13459         if (ret != 0)
13460                 exit(3);
13461         if (0 != fork()) {
13462                 close(pd[1]);   /* Parent reads from pd[0] */
13463                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13464 #ifdef F_SETFL
13465                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13466                         exit(1);
13467 #else
13468                 exit(4);
13469 #endif
13470                 signal(SIGALRM, blech);
13471                 alarm(5);
13472                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13473                         exit(2);
13474                 sprintf(string, "%d\n", ret);
13475                 ret = write(2, string, strlen(string));
13476                 if (ret != strlen(string))
13477                         exit(3);
13478                 alarm(0);
13479 #ifdef EAGAIN
13480                 if (errno == EAGAIN) {
13481                         printf("EAGAIN\n");
13482                         goto ok;
13483                 }
13484 #endif
13485 #ifdef EWOULDBLOCK
13486                 if (errno == EWOULDBLOCK)
13487                         printf("EWOULDBLOCK\n");
13488 #endif
13489         ok:
13490                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13491                 if (ret != 1)
13492                         exit(3);
13493                 sleep(2);                               /* Give it time to close our pipe */
13494                 alarm(5);
13495                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13496                 alarm(0);
13497                 sprintf(string, "%d\n", ret);
13498                 ret = write(4, string, strlen(string));
13499                 if (ret != strlen(string))
13500                         exit(3);
13501                 exit(0);
13502         }
13503
13504         close(pd[0]);                   /* We write to pd[1] */
13505         close(pu[1]);                   /* We read from pu[0] */
13506         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13507         if (ret != 1)
13508                 exit(3);
13509         close(pd[1]);                   /* Pipe pd is now fully closed! */
13510         exit(0);                                /* Bye bye, thank you for playing! */
13511 }
13512 EOCP
13513         set try
13514         if eval $compile_ok; then
13515                 echo "$startsh" >mtry
13516                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13517                 chmod +x mtry
13518                 $run ./mtry >/dev/null 2>&1
13519                 case $? in
13520                 0) eagain=`$cat try.out`;;
13521                 1) echo "Could not perform non-blocking setting!";;
13522                 2) echo "I did a successful read() for something that was not there!";;
13523                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13524                 4) echo "Could not find F_SETFL!";;
13525                 *) echo "Something terribly wrong happened during testing.";;
13526                 esac
13527                 rd_nodata=`$cat try.ret`
13528                 echo "A read() system call with no data present returns $rd_nodata."
13529                 case "$rd_nodata" in
13530                 0|-1) ;;
13531                 *)
13532                         echo "(That's peculiar, fixing that to be -1.)"
13533                         rd_nodata=-1
13534                         ;;
13535                 esac
13536                 case "$eagain" in
13537                 '')
13538                         echo "Forcing errno EAGAIN on read() with no data available."
13539                         eagain=EAGAIN
13540                         ;;
13541                 *)
13542                         echo "Your read() sets errno to $eagain when no data is available."
13543                         ;;
13544                 esac
13545                 status=`$cat try.err`
13546                 case "$status" in
13547                 0) echo "And it correctly returns 0 to signal EOF.";;
13548                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13549                 *) echo "However, your read() returns '$status' on EOF??";;
13550                 esac
13551                 val="$define"
13552                 if test "$status" = "$rd_nodata"; then
13553                         echo "WARNING: you can't distinguish between EOF and no data!"
13554                         val="$undef"
13555                 fi
13556         else
13557                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13558                 eagain=EAGAIN
13559         fi
13560         ;;
13561         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13562                 eagain=EAGAIN
13563                 val="$define"
13564                 ;;
13565         esac
13566         set d_eofnblk
13567         eval $setvar
13568         ;;
13569 *)
13570         echo "Using $hint value $eagain."
13571         echo "Your read() returns $rd_nodata when no data is present."
13572         case "$d_eofnblk" in
13573         "$define") echo "And you can see EOF because read() returns 0.";;
13574         "$undef") echo "But you can't see EOF status from read() returned value.";;
13575         *)
13576                 echo "(Assuming you can't see EOF status from read anyway.)"
13577                 d_eofnblk=$undef
13578                 ;;
13579         esac
13580         ;;
13581 esac
13582 $rm_try head.c mtry
13583
13584 : see if erf exists
13585 set erf d_erf
13586 eval $inlibc
13587
13588 : see if erfc exists
13589 set erfc d_erfc
13590 eval $inlibc
13591
13592 : see if exp2 exists
13593 set exp2 d_exp2
13594 eval $inlibc
13595
13596 : see if expm1 exists
13597 set expm1 d_expm1
13598 eval $inlibc
13599
13600 : see if _ptr and _cnt from stdio act std
13601 echo " "
13602
13603 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13604         echo "(Looks like you have stdio.h from BSD.)"
13605         case "$stdio_ptr" in
13606         '') stdio_ptr='((fp)->_p)'
13607                 ptr_lval=$define
13608                 ;;
13609         *)      ptr_lval=$d_stdio_ptr_lval;;
13610         esac
13611         case "$stdio_cnt" in
13612         '') stdio_cnt='((fp)->_r)'
13613                 cnt_lval=$define
13614                 ;;
13615         *)      cnt_lval=$d_stdio_cnt_lval;;
13616         esac
13617         case "$stdio_base" in
13618         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13619         esac
13620         case "$stdio_bufsiz" in
13621         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13622         esac
13623 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13624         echo "(Looks like you have stdio.h from Linux.)"
13625         case "$stdio_ptr" in
13626         '') stdio_ptr='((fp)->_IO_read_ptr)'
13627                 ptr_lval=$define
13628                 ;;
13629         *)      ptr_lval=$d_stdio_ptr_lval;;
13630         esac
13631         case "$stdio_cnt" in
13632         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13633                 cnt_lval=$undef
13634                 ;;
13635         *)      cnt_lval=$d_stdio_cnt_lval;;
13636         esac
13637         case "$stdio_base" in
13638         '') stdio_base='((fp)->_IO_read_base)';;
13639         esac
13640         case "$stdio_bufsiz" in
13641         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13642         esac
13643 else
13644         case "$stdio_ptr" in
13645         '') stdio_ptr='((fp)->_ptr)'
13646                 ptr_lval=$define
13647                 ;;
13648         *)      ptr_lval=$d_stdio_ptr_lval;;
13649         esac
13650         case "$stdio_cnt" in
13651         '') stdio_cnt='((fp)->_cnt)'
13652                 cnt_lval=$define
13653                 ;;
13654         *)      cnt_lval=$d_stdio_cnt_lval;;
13655         esac
13656         case "$stdio_base" in
13657         '') stdio_base='((fp)->_base)';;
13658         esac
13659         case "$stdio_bufsiz" in
13660         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13661         esac
13662 fi
13663
13664 : test whether _ptr and _cnt really work
13665 echo "Checking how std your stdio is..." >&4
13666 $cat >try.c <<EOP
13667 #include <stdio.h>
13668 #$i_stdlib I_STDLIB
13669 #ifdef I_STDLIB
13670 #include <stdlib.h>
13671 #endif
13672 #define FILE_ptr(fp)    $stdio_ptr
13673 #define FILE_cnt(fp)    $stdio_cnt
13674 int main() {
13675         FILE *fp = fopen("try.c", "r");
13676         char c = getc(fp);
13677         if (
13678                 18 <= FILE_cnt(fp) &&
13679                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13680         )
13681                 exit(0);
13682         exit(1);
13683 }
13684 EOP
13685 val="$undef"
13686 set try
13687 if eval $compile && $to try.c; then
13688         if $run ./try; then
13689                 echo "Your stdio acts pretty std."
13690                 val="$define"
13691         else
13692                 echo "Your stdio isn't very std."
13693         fi
13694 else
13695         echo "Your stdio doesn't appear very std."
13696 fi
13697 $rm_try
13698
13699 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13700 # direct buffer manipulation no longer works.  The Configure tests
13701 # should be changed to correctly detect this, but until then,
13702 # the following check should at least let perl compile and run.
13703 # (This quick fix should be updated before 5.8.1.)
13704 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13705 # A. Dougherty, June 3, 2002.
13706 case "$d_gnulibc" in
13707 $define)
13708         case "$gnulibc_version" in
13709         2.[01]*)  ;;
13710         2.2) ;;
13711         2.2.[0-9]) ;;
13712         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13713                 val="$undef"
13714                 ;;
13715         esac
13716         ;;
13717 esac
13718 set d_stdstdio
13719 eval $setvar
13720
13721 : Can _ptr be used as an lvalue?
13722 case "$d_stdstdio$ptr_lval" in
13723 $define$define) val=$define ;;
13724 *) val=$undef ;;
13725 esac
13726 set d_stdio_ptr_lval
13727 eval $setvar
13728
13729 : Can _cnt be used as an lvalue?
13730 case "$d_stdstdio$cnt_lval" in
13731 $define$define) val=$define ;;
13732 *) val=$undef ;;
13733 esac
13734 set d_stdio_cnt_lval
13735 eval $setvar
13736
13737
13738 : test whether setting _ptr sets _cnt as a side effect
13739 d_stdio_ptr_lval_sets_cnt="$undef"
13740 d_stdio_ptr_lval_nochange_cnt="$undef"
13741 case "$d_stdio_ptr_lval$d_stdstdio" in
13742 $define$define)
13743         echo "Checking to see what happens if we set the stdio ptr..." >&4
13744 $cat >try.c <<EOP
13745 #include <stdio.h>
13746 /* Can we scream? */
13747 /* Eat dust sed :-) */
13748 /* In the buffer space, no one can hear you scream. */
13749 #$i_stdlib I_STDLIB
13750 #ifdef I_STDLIB
13751 #include <stdlib.h>
13752 #endif
13753 #define FILE_ptr(fp)    $stdio_ptr
13754 #define FILE_cnt(fp)    $stdio_cnt
13755 #include <sys/types.h>
13756 int main() {
13757         FILE *fp = fopen("try.c", "r");
13758         int c;
13759         char *ptr;
13760         size_t cnt;
13761         if (!fp) {
13762             puts("Fail even to read");
13763             exit(1);
13764         }
13765         c = getc(fp); /* Read away the first # */
13766         if (c == EOF) {
13767             puts("Fail even to read");
13768             exit(1);
13769         }
13770         if (!(
13771                 18 <= FILE_cnt(fp) &&
13772                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13773         )) {
13774                 puts("Fail even to read");
13775                 exit (1);
13776         }
13777         ptr = (char*) FILE_ptr(fp);
13778         cnt = (size_t)FILE_cnt(fp);
13779
13780         FILE_ptr(fp) += 42;
13781
13782         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13783                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13784                 exit (1);
13785         }
13786         if (FILE_cnt(fp) <= 20) {
13787                 printf ("Fail (<20 chars to test)");
13788                 exit (1);
13789         }
13790         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13791                 puts("Fail compare");
13792                 exit (1);
13793         }
13794         if (cnt == FILE_cnt(fp)) {
13795                 puts("Pass_unchanged");
13796                 exit (0);
13797         }
13798         if (FILE_cnt(fp) == (cnt - 42)) {
13799                 puts("Pass_changed");
13800                 exit (0);
13801         }
13802         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13803         return 1;
13804
13805 }
13806 EOP
13807         set try
13808         if eval $compile && $to try.c; then
13809                 case `$run ./try` in
13810                 Pass_changed)
13811                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13812                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13813                 Pass_unchanged)
13814                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13815                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13816                 Fail*)
13817                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13818                 *)
13819                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13820         esac
13821         else
13822                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13823         fi
13824         $rm_try
13825         ;;
13826 esac
13827
13828 : see if _base is also standard
13829 val="$undef"
13830 case "$d_stdstdio" in
13831 $define)
13832         $cat >try.c <<EOP
13833 #include <stdio.h>
13834 #$i_stdlib I_STDLIB
13835 #ifdef I_STDLIB
13836 #include <stdlib.h>
13837 #endif
13838 #define FILE_base(fp)   $stdio_base
13839 #define FILE_bufsiz(fp) $stdio_bufsiz
13840 int main() {
13841         FILE *fp = fopen("try.c", "r");
13842         char c = getc(fp);
13843         if (
13844                 19 <= FILE_bufsiz(fp) &&
13845                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13846         )
13847                 exit(0);
13848         exit(1);
13849 }
13850 EOP
13851         set try
13852         if eval $compile && $to try.c; then
13853                 if $run ./try; then
13854                         echo "And its _base field acts std."
13855                         val="$define"
13856                 else
13857                         echo "But its _base field isn't std."
13858                 fi
13859         else
13860                 echo "However, it seems to be lacking the _base field."
13861         fi
13862         $rm_try
13863         ;;
13864 esac
13865 set d_stdiobase
13866 eval $setvar
13867
13868 : see if fast_stdio exists
13869 val="$undef"
13870 case "$d_stdstdio:$d_stdio_ptr_lval" in
13871 "$define:$define")
13872         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13873         *$define*)
13874                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13875                 val="$define"
13876                 ;;
13877         esac
13878         ;;
13879 esac
13880 set d_faststdio
13881 eval $setvar
13882
13883
13884
13885 : see if fchdir exists
13886 set fchdir d_fchdir
13887 eval $inlibc
13888
13889 : see if fchmod exists
13890 set fchmod d_fchmod
13891 eval $inlibc
13892
13893 : see if fchown exists
13894 set fchown d_fchown
13895 eval $inlibc
13896
13897 : see if this is an fcntl system
13898 set fcntl d_fcntl
13899 eval $inlibc
13900
13901 : See if fcntl-based locking works.
13902 echo " "
13903 $cat >try.c <<EOCP
13904 #$i_stdlib I_STDLIB
13905 #ifdef I_STDLIB
13906 #include <stdlib.h>
13907 #endif
13908 #include <unistd.h>
13909 #include <fcntl.h>
13910 #include <signal.h>
13911 $signal_t blech(int x) { exit(3); }
13912 int main() {
13913 #if defined(F_SETLK) && defined(F_SETLKW)
13914      struct flock flock;
13915      int retval, fd;
13916      fd = open("try.c", O_RDONLY);
13917      flock.l_type = F_RDLCK;
13918      flock.l_whence = SEEK_SET;
13919      flock.l_start = flock.l_len = 0;
13920      signal(SIGALRM, blech);
13921      alarm(10);
13922      retval = fcntl(fd, F_SETLK, &flock);
13923      close(fd);
13924      (retval < 0 ? exit(2) : exit(0));
13925 #else
13926      exit(2);
13927 #endif
13928 }
13929 EOCP
13930 echo "Checking if fcntl-based file locking works... "
13931 case "$d_fcntl" in
13932 "$define")
13933         set try
13934         if eval $compile_ok; then
13935                 if $run ./try; then
13936                         echo "Yes, it seems to work."
13937                         val="$define"
13938                 else
13939                         echo "Nope, it didn't work."
13940                         val="$undef"
13941                         case "$?" in
13942                         3) $cat >&4 <<EOM
13943 ***
13944 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13945 *** This is (almost) impossible.
13946 *** If your NFS lock daemons are not feeling well, something like
13947 *** this may happen, please investigate.  Cannot continue, aborting.
13948 ***
13949 EOM
13950                                 exit 1
13951                                 ;;
13952                         esac
13953                 fi
13954         else
13955                 echo "I'm unable to compile the test program, so I'll assume not."
13956                 val="$undef"
13957         fi
13958         ;;
13959 *) val="$undef";
13960         echo "Nope, since you don't even have fcntl()."
13961         ;;
13962 esac
13963 set d_fcntl_can_lock
13964 eval $setvar
13965 $rm_try
13966
13967 : check for fd_set items
13968 $cat <<EOM
13969
13970 Checking to see how well your C compiler handles fd_set and friends ...
13971 EOM
13972 $cat >try.c <<EOCP
13973 #$i_stdlib I_STDLIB
13974 #ifdef I_STDLIB
13975 #include <stdlib.h>
13976 #endif
13977 #$i_systime I_SYS_TIME
13978 #$i_sysselct I_SYS_SELECT
13979 #$d_socket HAS_SOCKET
13980 #include <sys/types.h>
13981 #ifdef HAS_SOCKET
13982 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13983 #endif
13984 #ifdef I_SYS_TIME
13985 #include <sys/time.h>
13986 #endif
13987 #ifdef I_SYS_SELECT
13988 #include <sys/select.h>
13989 #endif
13990 int main() {
13991         fd_set fds;
13992
13993 #ifdef TRYBITS
13994         if(fds.fds_bits);
13995 #endif
13996
13997 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13998         exit(0);
13999 #else
14000         exit(1);
14001 #endif
14002 }
14003 EOCP
14004 set try -DTRYBITS
14005 if eval $compile; then
14006         d_fds_bits="$define"
14007         d_fd_set="$define"
14008         echo "Well, your system knows about the normal fd_set typedef..." >&4
14009         if $run ./try; then
14010                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14011                 d_fd_macros="$define"
14012         else
14013                 $cat >&4 <<'EOM'
14014 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
14015 EOM
14016                 d_fd_macros="$undef"
14017         fi
14018 else
14019         $cat <<'EOM'
14020 Hmm, your compiler has some difficulty with fd_set.  Checking further...
14021 EOM
14022         set try
14023         if eval $compile; then
14024                 d_fds_bits="$undef"
14025                 d_fd_set="$define"
14026                 echo "Well, your system has some sort of fd_set available..." >&4
14027                 if $run ./try; then
14028                         echo "and you have the normal fd_set macros." >&4
14029                         d_fd_macros="$define"
14030                 else
14031                         $cat <<'EOM'
14032 but not the normal fd_set macros!  Gross!  More work for me...
14033 EOM
14034                         d_fd_macros="$undef"
14035                 fi
14036         else
14037         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14038                 d_fd_set="$undef"
14039                 d_fds_bits="$undef"
14040                 d_fd_macros="$undef"
14041         fi
14042 fi
14043 $rm_try
14044
14045 : see if fdclose exists
14046 set fdclose d_fdclose
14047 eval $inlibc
14048
14049 : see if fdim exists
14050 set fdim d_fdim
14051 eval $inlibc
14052
14053 : see if fegetround exists
14054 set fegetround d_fegetround
14055 eval $inlibc
14056
14057 : see if fgetpos exists
14058 set fgetpos d_fgetpos
14059 eval $inlibc
14060
14061 : see if finite exists
14062 set finite d_finite
14063 eval $inlibc
14064
14065 : see if finitel exists
14066 set finitel d_finitel
14067 eval $inlibc
14068
14069 : see if flock exists
14070 set flock d_flock
14071 eval $inlibc
14072
14073 : see if prototype for flock is available
14074 echo " "
14075 set d_flockproto flock $i_sysfile sys/file.h
14076 eval $hasproto
14077
14078 : see if fma exists
14079 set fma d_fma
14080 eval $inlibc
14081
14082 : see if fmax exists
14083 set fmax d_fmax
14084 eval $inlibc
14085
14086 : see if fmin exists
14087 set fmin d_fmin
14088 eval $inlibc
14089
14090 : see if fp_class exists
14091 set fp_class d_fp_class
14092 eval $inlibc
14093
14094 : see if this is a math.h system
14095 set math.h i_math
14096 eval $inhdr
14097
14098 : check for fpclassify
14099 echo "Checking to see if you have fpclassify..." >&4
14100 $cat >try.c <<EOCP
14101 #$i_math I_MATH
14102 #ifdef I_MATH
14103 #include <math.h>
14104 #endif
14105 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14106 EOCP
14107 set try
14108 if eval $compile; then
14109         val="$define"
14110         echo "You have fpclassify."
14111 else
14112         val="$undef"
14113         echo "You do not have fpclassify."
14114 fi
14115 $rm_try
14116 set d_fpclassify
14117 eval $setvar
14118
14119 : see if fp_classify exists
14120 set fp_classify d_fp_classify
14121 eval $inlibc
14122
14123 : see if fp_classl exists
14124 set fp_classl d_fp_classl
14125 eval $inlibc
14126
14127 : see if pathconf exists
14128 set pathconf d_pathconf
14129 eval $inlibc
14130
14131 : see if fpathconf exists
14132 set fpathconf d_fpathconf
14133 eval $inlibc
14134
14135 : see if fpclass exists
14136 set fpclass d_fpclass
14137 eval $inlibc
14138
14139 : see if fpclassl exists
14140 set fpclassl d_fpclassl
14141 eval $inlibc
14142
14143 : see if fpgetround exists
14144 set fpgetround d_fpgetround
14145 eval $inlibc
14146
14147 : check for fpos64_t
14148 echo " "
14149 echo "Checking to see if you have fpos64_t..." >&4
14150 $cat >try.c <<EOCP
14151 #include <stdio.h>
14152 int main() { fpos64_t x = 7; }
14153 EOCP
14154 set try
14155 if eval $compile; then
14156         val="$define"
14157         echo "You have fpos64_t."
14158 else
14159         val="$undef"
14160         echo "You do not have fpos64_t."
14161         case "$fpossize" in
14162         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14163         esac
14164 fi
14165 $rm_try
14166 set d_fpos64_t
14167 eval $setvar
14168
14169 : see if this is an xlocale.h system
14170 set xlocale.h i_xlocale
14171 eval $inhdr
14172
14173 : see if newlocale exists
14174 set newlocale d_newlocale
14175 eval $inlibc
14176
14177 : see if freelocale exists
14178 set freelocale d_freelocale
14179 eval $inlibc
14180
14181 : see if uselocale exists
14182 set uselocale d_uselocale
14183 eval $inlibc
14184
14185 : see if duplocale exists
14186 set duplocale d_duplocale
14187 eval $inlibc
14188
14189 : see if querylocale exists
14190 set querylocale d_querylocale
14191 eval $inlibc
14192
14193 : see if frexpl exists
14194 set frexpl d_frexpl
14195 eval $inlibc
14196
14197 : see if this is a sys/param system
14198 set sys/param.h i_sysparam
14199 eval $inhdr
14200
14201 : see if this is a sys/mount.h system
14202 set sys/mount.h i_sysmount
14203 eval $inhdr
14204
14205 : Check for fs_data_s
14206 echo " "
14207 echo "Checking to see if your system supports struct fs_data..." >&4
14208 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14209 eval $hasstruct
14210 case "$d_fs_data_s" in
14211 "$define")      echo "Yes, it does."   ;;
14212 *)              echo "No, it doesn't." ;;
14213 esac
14214
14215 : see if fseeko exists
14216 set fseeko d_fseeko
14217 eval $inlibc
14218 case "$longsize" in
14219 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14220 esac
14221
14222 : see if fsetpos exists
14223 set fsetpos d_fsetpos
14224 eval $inlibc
14225
14226 : see if fstatfs exists
14227 set fstatfs d_fstatfs
14228 eval $inlibc
14229
14230 : see if statvfs exists
14231 set statvfs d_statvfs
14232 eval $inlibc
14233
14234 : see if fstatvfs exists
14235 set fstatvfs d_fstatvfs
14236 eval $inlibc
14237
14238
14239 : see if fsync exists
14240 set fsync d_fsync
14241 eval $inlibc
14242
14243 : see if ftello exists
14244 set ftello d_ftello
14245 eval $inlibc
14246 case "$longsize" in
14247 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14248 esac
14249
14250 : check for a working futimes
14251 d_futimes="$undef"
14252 echo " "
14253 echo "Checking if you have a working futimes()" >&4
14254 $cat >try.c <<EOCP
14255 #include <stdio.h>
14256 #include <sys/time.h>
14257 #include <errno.h>
14258 #include <fcntl.h>
14259
14260 int main ()
14261 {
14262     int fd, rv;
14263     fd = open ("try.c", O_RDWR);
14264     if (-1 == fd) exit (1);
14265     rv = futimes (fd, NULL);
14266     exit (rv == -1 ? errno : 0);
14267 }
14268 EOCP
14269 set try
14270 if eval $compile; then
14271     `$run ./try`
14272     rc=$?
14273     case "$rc" in
14274         0)  echo "Yes, you have" >&4
14275             d_futimes="$define"
14276             ;;
14277         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14278             ;;
14279     esac
14280 else
14281     echo "No, it does not (probably harmless)" >&4
14282 fi
14283 $rm_try
14284
14285 : see if ndbm.h is available
14286 set ndbm.h i_ndbm
14287 eval $inhdr
14288 : Compatibility location for RedHat 7.1
14289 set gdbm/ndbm.h i_gdbmndbm
14290 eval $inhdr
14291 : Compatibility location for Debian 4.0
14292 set gdbm-ndbm.h i_gdbm_ndbm
14293 eval $inhdr
14294
14295 val="$undef"
14296 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14297         : see if dbm_open exists
14298         set dbm_open d_dbm_open
14299         eval $inlibc
14300         case "$d_dbm_open" in
14301         $undef)
14302                 i_ndbm="$undef"
14303                 i_gdbmndbm="$undef"
14304                 i_gdbm_ndbm="$undef"
14305                 echo "We won't be including <ndbm.h>"
14306                 val="$undef"
14307                 ;;
14308         *) val="$define"
14309            ;;
14310         esac
14311 fi
14312 set d_ndbm
14313 eval $setvar
14314
14315 ndbm_hdr_protochk='name=$1; hdr=$2;
14316 eval "ihdr=\$""i_$name";
14317 val="$undef";
14318 if $test "$ihdr" = "$define"; then
14319         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14320         case "$d_cplusplus" in
14321         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14322         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14323         esac;
14324         case "$val" in
14325         $define) $echo "Your <$hdr> seems to have prototypes";;
14326         *) $echo "Your <$hdr> does not seem to have prototypes";;
14327         esac;
14328 fi;
14329 set "d_${name}_h_uses_prototypes";
14330 eval $setvar'
14331
14332 set ndbm ndbm.h
14333 eval $ndbm_hdr_protochk
14334 set gdbmndbm gdbm/ndbm.h
14335 eval $ndbm_hdr_protochk
14336 set gdbm_ndbm gdbm-ndbm.h
14337 eval $ndbm_hdr_protochk
14338
14339 : see if getaddrinfo exists
14340 set getaddrinfo d_getaddrinfo
14341 eval $inlibc
14342
14343 : see if getcwd exists
14344 set getcwd d_getcwd
14345 eval $inlibc
14346
14347 : see if getespwnam exists
14348 set getespwnam d_getespwnam
14349 eval $inlibc
14350
14351 : see if getfsstat exists
14352 set getfsstat d_getfsstat
14353 eval $inlibc
14354
14355 : see if getgrent exists
14356 set getgrent d_getgrent
14357 eval $inlibc
14358
14359 : see if getgrent_r exists
14360 set getgrent_r d_getgrent_r
14361 eval $inlibc
14362 case "$d_getgrent_r" in
14363 "$define")
14364         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14365         case "$d_getgrent_r_proto:$usethreads" in
14366         ":define")      d_getgrent_r_proto=define
14367                 set d_getgrent_r_proto getgrent_r $hdrs
14368                 eval $hasproto ;;
14369         *)      ;;
14370         esac
14371         case "$d_getgrent_r_proto" in
14372         define)
14373         case "$getgrent_r_proto" in
14374         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14375         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14376         esac
14377         case "$getgrent_r_proto" in
14378         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14379         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14380         esac
14381         case "$getgrent_r_proto" in
14382         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14383         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14384         esac
14385         case "$getgrent_r_proto" in
14386         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14387         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14388         esac
14389         case "$getgrent_r_proto" in
14390         ''|0) try='int getgrent_r(struct group*, char*, int);'
14391         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14392         esac
14393         case "$getgrent_r_proto" in
14394         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14395         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14396         esac
14397         case "$getgrent_r_proto" in
14398         ''|0)   d_getgrent_r=undef
14399                 getgrent_r_proto=0
14400                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14401         * )     case "$getgrent_r_proto" in
14402                 REENTRANT_PROTO*) ;;
14403                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14404                 esac
14405                 echo "Prototype: $try" ;;
14406         esac
14407         ;;
14408         *)      case "$usethreads" in
14409                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14410                 esac
14411                 d_getgrent_r=undef
14412                 getgrent_r_proto=0
14413                 ;;
14414         esac
14415         ;;
14416 *)      getgrent_r_proto=0
14417         ;;
14418 esac
14419
14420 : see if getgrgid_r exists
14421 set getgrgid_r d_getgrgid_r
14422 eval $inlibc
14423 case "$d_getgrgid_r" in
14424 "$define")
14425         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14426         case "$d_getgrgid_r_proto:$usethreads" in
14427         ":define")      d_getgrgid_r_proto=define
14428                 set d_getgrgid_r_proto getgrgid_r $hdrs
14429                 eval $hasproto ;;
14430         *)      ;;
14431         esac
14432         case "$d_getgrgid_r_proto" in
14433         define)
14434         case "$getgrgid_r_proto" in
14435         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14436         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14437         esac
14438         case "$getgrgid_r_proto" in
14439         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14440         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14441         esac
14442         case "$getgrgid_r_proto" in
14443         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14444         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14445         esac
14446         case "$getgrgid_r_proto" in
14447         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14448         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14449         esac
14450         case "$getgrgid_r_proto" in
14451         ''|0)   d_getgrgid_r=undef
14452                 getgrgid_r_proto=0
14453                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14454         * )     case "$getgrgid_r_proto" in
14455                 REENTRANT_PROTO*) ;;
14456                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14457                 esac
14458                 echo "Prototype: $try" ;;
14459         esac
14460         ;;
14461         *)      case "$usethreads" in
14462                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14463                 esac
14464                 d_getgrgid_r=undef
14465                 getgrgid_r_proto=0
14466                 ;;
14467         esac
14468         ;;
14469 *)      getgrgid_r_proto=0
14470         ;;
14471 esac
14472
14473 : see if getgrnam_r exists
14474 set getgrnam_r d_getgrnam_r
14475 eval $inlibc
14476 case "$d_getgrnam_r" in
14477 "$define")
14478         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14479         case "$d_getgrnam_r_proto:$usethreads" in
14480         ":define")      d_getgrnam_r_proto=define
14481                 set d_getgrnam_r_proto getgrnam_r $hdrs
14482                 eval $hasproto ;;
14483         *)      ;;
14484         esac
14485         case "$d_getgrnam_r_proto" in
14486         define)
14487         case "$getgrnam_r_proto" in
14488         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14489         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14490         esac
14491         case "$getgrnam_r_proto" in
14492         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14493         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14494         esac
14495         case "$getgrnam_r_proto" in
14496         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14497         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14498         esac
14499         case "$getgrnam_r_proto" in
14500         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14501         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14502         esac
14503         case "$getgrnam_r_proto" in
14504         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14505         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14506         esac
14507         case "$getgrnam_r_proto" in
14508         ''|0)   d_getgrnam_r=undef
14509                 getgrnam_r_proto=0
14510                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14511         * )     case "$getgrnam_r_proto" in
14512                 REENTRANT_PROTO*) ;;
14513                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14514                 esac
14515                 echo "Prototype: $try" ;;
14516         esac
14517         ;;
14518         *)      case "$usethreads" in
14519                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14520                 esac
14521                 d_getgrnam_r=undef
14522                 getgrnam_r_proto=0
14523                 ;;
14524         esac
14525         ;;
14526 *)      getgrnam_r_proto=0
14527         ;;
14528 esac
14529
14530 : see if gethostbyaddr exists
14531 set gethostbyaddr d_gethbyaddr
14532 eval $inlibc
14533
14534 : see if gethostbyname exists
14535 set gethostbyname d_gethbyname
14536 eval $inlibc
14537
14538 : see if gethostent exists
14539 set gethostent d_gethent
14540 eval $inlibc
14541
14542 : see how we will look up host name
14543 echo " "
14544 call=''
14545 if set gethostname val -f d_gethname; eval $csym; $val; then
14546         echo 'gethostname() found.' >&4
14547         d_gethname="$define"
14548         call=gethostname
14549 fi
14550 if set uname val -f d_uname; eval $csym; $val; then
14551         if ./xenix; then
14552                 $cat <<'EOM'
14553 uname() was found, but you're running xenix, and older versions of xenix
14554 have a broken uname(). If you don't really know whether your xenix is old
14555 enough to have a broken system call, use the default answer.
14556
14557 EOM
14558                 dflt=y
14559                 case "$d_uname" in
14560                 "$define") dflt=n;;
14561                 esac
14562                 rp='Is your uname() broken?'
14563                 . ./myread
14564                 case "$ans" in
14565                 n*) d_uname="$define"; call=uname;;
14566                 esac
14567         else
14568                 echo 'uname() found.' >&4
14569                 d_uname="$define"
14570                 case "$call" in
14571                 '') call=uname ;;
14572                 esac
14573         fi
14574 fi
14575 case "$d_gethname" in
14576 '') d_gethname="$undef";;
14577 esac
14578 case "$d_uname" in
14579 '') d_uname="$undef";;
14580 esac
14581 case "$d_uname$d_gethname" in
14582 *define*)
14583         dflt=n
14584         cat <<EOM
14585
14586 Every now and then someone has a $call() that lies about the hostname
14587 but can't be fixed for political or economic reasons.  If you wish, I can
14588 pretend $call() isn't there and maybe compute hostname at run-time
14589 thanks to the '$phostname' command.
14590
14591 EOM
14592         rp="Shall I ignore $call() from now on?"
14593         . ./myread
14594         case "$ans" in
14595         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14596         esac;;
14597 esac
14598 case "$phostname" in
14599 '') aphostname='';;
14600 *) case "$aphostname" in
14601         /*) ;;
14602         *) set X $phostname
14603                 shift
14604                 file=$1
14605                 shift
14606                 file=`./loc $file $file $pth`
14607                 aphostname=`echo $file $*`
14608                 ;;
14609         esac
14610         ;;
14611 esac
14612 case "$d_uname$d_gethname" in
14613 *define*) ;;
14614 *)
14615         case "$phostname" in
14616         '')
14617                 echo "There will be no way for $package to get your hostname." >&4;;
14618         *)
14619         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14620                 ;;
14621         esac;;
14622 esac
14623 case "$d_phostname" in
14624 '') d_phostname="$undef";;
14625 esac
14626
14627 : see if gethostbyaddr_r exists
14628 set gethostbyaddr_r d_gethostbyaddr_r
14629 eval $inlibc
14630 case "$d_gethostbyaddr_r" in
14631 "$define")
14632         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14633         case "$d_gethostbyaddr_r_proto:$usethreads" in
14634         ":define")      d_gethostbyaddr_r_proto=define
14635                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14636                 eval $hasproto ;;
14637         *)      ;;
14638         esac
14639         case "$d_gethostbyaddr_r_proto" in
14640         define)
14641         case "$gethostbyaddr_r_proto" in
14642         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14643         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14644         esac
14645         case "$gethostbyaddr_r_proto" in
14646         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14647         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14648         esac
14649         case "$gethostbyaddr_r_proto" in
14650         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14651         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14652         esac
14653         case "$gethostbyaddr_r_proto" in
14654         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14655         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14656         esac
14657         case "$gethostbyaddr_r_proto" in
14658         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14659         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14660         esac
14661         case "$gethostbyaddr_r_proto" in
14662         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14663         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14664         esac
14665         case "$gethostbyaddr_r_proto" in
14666         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14667         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14668         esac
14669         case "$gethostbyaddr_r_proto" in
14670         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14671         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14672         esac
14673         case "$gethostbyaddr_r_proto" in
14674         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14675         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14676         esac
14677         case "$gethostbyaddr_r_proto" in
14678         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14679         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14680         esac
14681         case "$gethostbyaddr_r_proto" in
14682         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14683         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14684         esac
14685         case "$gethostbyaddr_r_proto" in
14686         ''|0)   d_gethostbyaddr_r=undef
14687                 gethostbyaddr_r_proto=0
14688                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14689         * )     case "$gethostbyaddr_r_proto" in
14690                 REENTRANT_PROTO*) ;;
14691                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14692                 esac
14693                 echo "Prototype: $try" ;;
14694         esac
14695         ;;
14696         *)      case "$usethreads" in
14697                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14698                 esac
14699                 d_gethostbyaddr_r=undef
14700                 gethostbyaddr_r_proto=0
14701                 ;;
14702         esac
14703         ;;
14704 *)      gethostbyaddr_r_proto=0
14705         ;;
14706 esac
14707
14708 : see if gethostbyname_r exists
14709 set gethostbyname_r d_gethostbyname_r
14710 eval $inlibc
14711 case "$d_gethostbyname_r" in
14712 "$define")
14713         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14714         case "$d_gethostbyname_r_proto:$usethreads" in
14715         ":define")      d_gethostbyname_r_proto=define
14716                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14717                 eval $hasproto ;;
14718         *)      ;;
14719         esac
14720         case "$d_gethostbyname_r_proto" in
14721         define)
14722         case "$gethostbyname_r_proto" in
14723         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14724         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14725         esac
14726         case "$gethostbyname_r_proto" in
14727         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14728         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14729         esac
14730         case "$gethostbyname_r_proto" in
14731         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14732         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14733         esac
14734         case "$gethostbyname_r_proto" in
14735         ''|0)   d_gethostbyname_r=undef
14736                 gethostbyname_r_proto=0
14737                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14738         * )     case "$gethostbyname_r_proto" in
14739                 REENTRANT_PROTO*) ;;
14740                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14741                 esac
14742                 echo "Prototype: $try" ;;
14743         esac
14744         ;;
14745         *)      case "$usethreads" in
14746                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14747                 esac
14748                 d_gethostbyname_r=undef
14749                 gethostbyname_r_proto=0
14750                 ;;
14751         esac
14752         ;;
14753 *)      gethostbyname_r_proto=0
14754         ;;
14755 esac
14756
14757 : see if gethostent_r exists
14758 set gethostent_r d_gethostent_r
14759 eval $inlibc
14760 case "$d_gethostent_r" in
14761 "$define")
14762         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14763         case "$d_gethostent_r_proto:$usethreads" in
14764         ":define")      d_gethostent_r_proto=define
14765                 set d_gethostent_r_proto gethostent_r $hdrs
14766                 eval $hasproto ;;
14767         *)      ;;
14768         esac
14769         case "$d_gethostent_r_proto" in
14770         define)
14771         case "$gethostent_r_proto" in
14772         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14773         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14774         esac
14775         case "$gethostent_r_proto" in
14776         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14777         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14778         esac
14779         case "$gethostent_r_proto" in
14780         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14781         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14782         esac
14783         case "$gethostent_r_proto" in
14784         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14785         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14786         esac
14787         case "$gethostent_r_proto" in
14788         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14789         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14790         esac
14791         case "$gethostent_r_proto" in
14792         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14793         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14794         esac
14795         case "$gethostent_r_proto" in
14796         ''|0)   d_gethostent_r=undef
14797                 gethostent_r_proto=0
14798                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14799         * )     case "$gethostent_r_proto" in
14800                 REENTRANT_PROTO*) ;;
14801                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14802                 esac
14803                 echo "Prototype: $try" ;;
14804         esac
14805         ;;
14806         *)      case "$usethreads" in
14807                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14808                 esac
14809                 d_gethostent_r=undef
14810                 gethostent_r_proto=0
14811                 ;;
14812         esac
14813         ;;
14814 *)      gethostent_r_proto=0
14815         ;;
14816 esac
14817
14818 : see if prototypes for various gethostxxx netdb.h functions are available
14819 echo " "
14820 set d_gethostprotos gethostent $i_netdb netdb.h
14821 eval $hasproto
14822
14823 : see if getitimer exists
14824 set getitimer d_getitimer
14825 eval $inlibc
14826
14827 : see if getlogin exists
14828 set getlogin d_getlogin
14829 eval $inlibc
14830
14831 : see if getlogin_r exists
14832 set getlogin_r d_getlogin_r
14833 eval $inlibc
14834 case "$d_getlogin_r" in
14835 "$define")
14836         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14837         case "$d_getlogin_r_proto:$usethreads" in
14838         ":define")      d_getlogin_r_proto=define
14839                 set d_getlogin_r_proto getlogin_r $hdrs
14840                 eval $hasproto ;;
14841         *)      ;;
14842         esac
14843         case "$d_getlogin_r_proto" in
14844         define)
14845         case "$getlogin_r_proto" in
14846         ''|0) try='int getlogin_r(char*, size_t);'
14847         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14848         esac
14849         case "$getlogin_r_proto" in
14850         ''|0) try='int getlogin_r(char*, int);'
14851         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14852         esac
14853         case "$getlogin_r_proto" in
14854         ''|0) try='char* getlogin_r(char*, size_t);'
14855         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14856         esac
14857         case "$getlogin_r_proto" in
14858         ''|0) try='char* getlogin_r(char*, int);'
14859         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14860         esac
14861         case "$getlogin_r_proto" in
14862         ''|0)   d_getlogin_r=undef
14863                 getlogin_r_proto=0
14864                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14865         * )     case "$getlogin_r_proto" in
14866                 REENTRANT_PROTO*) ;;
14867                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14868                 esac
14869                 echo "Prototype: $try" ;;
14870         esac
14871         ;;
14872         *)      case "$usethreads" in
14873                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14874                 esac
14875                 d_getlogin_r=undef
14876                 getlogin_r_proto=0
14877                 ;;
14878         esac
14879         ;;
14880 *)      getlogin_r_proto=0
14881         ;;
14882 esac
14883
14884 : see if getmnt exists
14885 set getmnt d_getmnt
14886 eval $inlibc
14887
14888 : see if getmntent exists
14889 set getmntent d_getmntent
14890 eval $inlibc
14891
14892 : see if getnameinfo exists
14893 set getnameinfo d_getnameinfo
14894 eval $inlibc
14895
14896 : see if getnetbyaddr exists
14897 set getnetbyaddr d_getnbyaddr
14898 eval $inlibc
14899
14900 : see if getnetbyname exists
14901 set getnetbyname d_getnbyname
14902 eval $inlibc
14903
14904 : see if getnetent exists
14905 set getnetent d_getnent
14906 eval $inlibc
14907
14908 : see if getnetbyaddr_r exists
14909 set getnetbyaddr_r d_getnetbyaddr_r
14910 eval $inlibc
14911 case "$d_getnetbyaddr_r" in
14912 "$define")
14913         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14914         case "$d_getnetbyaddr_r_proto:$usethreads" in
14915         ":define")      d_getnetbyaddr_r_proto=define
14916                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14917                 eval $hasproto ;;
14918         *)      ;;
14919         esac
14920         case "$d_getnetbyaddr_r_proto" in
14921         define)
14922         case "$getnetbyaddr_r_proto" in
14923         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14924         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14925         esac
14926         case "$getnetbyaddr_r_proto" in
14927         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14928         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14929         esac
14930         case "$getnetbyaddr_r_proto" in
14931         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14932         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14933         esac
14934         case "$getnetbyaddr_r_proto" in
14935         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14936         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14937         esac
14938         case "$getnetbyaddr_r_proto" in
14939         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14940         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14941         esac
14942         case "$getnetbyaddr_r_proto" in
14943         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14944         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14945         esac
14946         case "$getnetbyaddr_r_proto" in
14947         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14948         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14949         esac
14950         case "$getnetbyaddr_r_proto" in
14951         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14952         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14953         esac
14954         case "$getnetbyaddr_r_proto" in
14955         ''|0)   d_getnetbyaddr_r=undef
14956                 getnetbyaddr_r_proto=0
14957                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14958         * )     case "$getnetbyaddr_r_proto" in
14959                 REENTRANT_PROTO*) ;;
14960                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14961                 esac
14962                 echo "Prototype: $try" ;;
14963         esac
14964         ;;
14965         *)      case "$usethreads" in
14966                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14967                 esac
14968                 d_getnetbyaddr_r=undef
14969                 getnetbyaddr_r_proto=0
14970                 ;;
14971         esac
14972         ;;
14973 *)      getnetbyaddr_r_proto=0
14974         ;;
14975 esac
14976
14977 : see if getnetbyname_r exists
14978 set getnetbyname_r d_getnetbyname_r
14979 eval $inlibc
14980 case "$d_getnetbyname_r" in
14981 "$define")
14982         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14983         case "$d_getnetbyname_r_proto:$usethreads" in
14984         ":define")      d_getnetbyname_r_proto=define
14985                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14986                 eval $hasproto ;;
14987         *)      ;;
14988         esac
14989         case "$d_getnetbyname_r_proto" in
14990         define)
14991         case "$getnetbyname_r_proto" in
14992         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14993         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14994         esac
14995         case "$getnetbyname_r_proto" in
14996         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14997         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14998         esac
14999         case "$getnetbyname_r_proto" in
15000         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
15001         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
15002         esac
15003         case "$getnetbyname_r_proto" in
15004         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
15005         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
15006         esac
15007         case "$getnetbyname_r_proto" in
15008         ''|0)   d_getnetbyname_r=undef
15009                 getnetbyname_r_proto=0
15010                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
15011         * )     case "$getnetbyname_r_proto" in
15012                 REENTRANT_PROTO*) ;;
15013                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
15014                 esac
15015                 echo "Prototype: $try" ;;
15016         esac
15017         ;;
15018         *)      case "$usethreads" in
15019                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
15020                 esac
15021                 d_getnetbyname_r=undef
15022                 getnetbyname_r_proto=0
15023                 ;;
15024         esac
15025         ;;
15026 *)      getnetbyname_r_proto=0
15027         ;;
15028 esac
15029
15030 : see if getnetent_r exists
15031 set getnetent_r d_getnetent_r
15032 eval $inlibc
15033 case "$d_getnetent_r" in
15034 "$define")
15035         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15036         case "$d_getnetent_r_proto:$usethreads" in
15037         ":define")      d_getnetent_r_proto=define
15038                 set d_getnetent_r_proto getnetent_r $hdrs
15039                 eval $hasproto ;;
15040         *)      ;;
15041         esac
15042         case "$d_getnetent_r_proto" in
15043         define)
15044         case "$getnetent_r_proto" in
15045         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15046         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15047         esac
15048         case "$getnetent_r_proto" in
15049         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15050         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15051         esac
15052         case "$getnetent_r_proto" in
15053         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15054         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15055         esac
15056         case "$getnetent_r_proto" in
15057         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15058         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15059         esac
15060         case "$getnetent_r_proto" in
15061         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15062         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15063         esac
15064         case "$getnetent_r_proto" in
15065         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15066         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15067         esac
15068         case "$getnetent_r_proto" in
15069         ''|0)   d_getnetent_r=undef
15070                 getnetent_r_proto=0
15071                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15072         * )     case "$getnetent_r_proto" in
15073                 REENTRANT_PROTO*) ;;
15074                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15075                 esac
15076                 echo "Prototype: $try" ;;
15077         esac
15078         ;;
15079         *)      case "$usethreads" in
15080                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15081                 esac
15082                 d_getnetent_r=undef
15083                 getnetent_r_proto=0
15084                 ;;
15085         esac
15086         ;;
15087 *)      getnetent_r_proto=0
15088         ;;
15089 esac
15090
15091 : see if prototypes for various getnetxxx netdb.h functions are available
15092 echo " "
15093 set d_getnetprotos getnetent $i_netdb netdb.h
15094 eval $hasproto
15095
15096 : see if getpagesize exists
15097 set getpagesize d_getpagsz
15098 eval $inlibc
15099
15100 : Optional checks for getprotobyname and getprotobynumber
15101
15102 : see if getprotobyname exists
15103 set getprotobyname d_getpbyname
15104 eval $inlibc
15105
15106 : see if getprotobynumber exists
15107 set getprotobynumber d_getpbynumber
15108 eval $inlibc
15109
15110 : see if getprotoent exists
15111 set getprotoent d_getpent
15112 eval $inlibc
15113
15114 : see if getpgid exists
15115 set getpgid d_getpgid
15116 eval $inlibc
15117
15118 : see if getpgrp2 exists
15119 set getpgrp2 d_getpgrp2
15120 eval $inlibc
15121
15122 : see if getppid exists
15123 set getppid d_getppid
15124 eval $inlibc
15125
15126 : see if getpriority exists
15127 set getpriority d_getprior
15128 eval $inlibc
15129
15130 : see if getprotobyname_r exists
15131 set getprotobyname_r d_getprotobyname_r
15132 eval $inlibc
15133 case "$d_getprotobyname_r" in
15134 "$define")
15135         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15136         case "$d_getprotobyname_r_proto:$usethreads" in
15137         ":define")      d_getprotobyname_r_proto=define
15138                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15139                 eval $hasproto ;;
15140         *)      ;;
15141         esac
15142         case "$d_getprotobyname_r_proto" in
15143         define)
15144         case "$getprotobyname_r_proto" in
15145         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15146         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15147         esac
15148         case "$getprotobyname_r_proto" in
15149         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15150         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15151         esac
15152         case "$getprotobyname_r_proto" in
15153         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15154         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15155         esac
15156         case "$getprotobyname_r_proto" in
15157         ''|0)   d_getprotobyname_r=undef
15158                 getprotobyname_r_proto=0
15159                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15160         * )     case "$getprotobyname_r_proto" in
15161                 REENTRANT_PROTO*) ;;
15162                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15163                 esac
15164                 echo "Prototype: $try" ;;
15165         esac
15166         ;;
15167         *)      case "$usethreads" in
15168                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15169                 esac
15170                 d_getprotobyname_r=undef
15171                 getprotobyname_r_proto=0
15172                 ;;
15173         esac
15174         ;;
15175 *)      getprotobyname_r_proto=0
15176         ;;
15177 esac
15178
15179 : see if getprotobynumber_r exists
15180 set getprotobynumber_r d_getprotobynumber_r
15181 eval $inlibc
15182 case "$d_getprotobynumber_r" in
15183 "$define")
15184         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15185         case "$d_getprotobynumber_r_proto:$usethreads" in
15186         ":define")      d_getprotobynumber_r_proto=define
15187                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15188                 eval $hasproto ;;
15189         *)      ;;
15190         esac
15191         case "$d_getprotobynumber_r_proto" in
15192         define)
15193         case "$getprotobynumber_r_proto" in
15194         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15195         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15196         esac
15197         case "$getprotobynumber_r_proto" in
15198         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15199         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15200         esac
15201         case "$getprotobynumber_r_proto" in
15202         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15203         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15204         esac
15205         case "$getprotobynumber_r_proto" in
15206         ''|0)   d_getprotobynumber_r=undef
15207                 getprotobynumber_r_proto=0
15208                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15209         * )     case "$getprotobynumber_r_proto" in
15210                 REENTRANT_PROTO*) ;;
15211                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15212                 esac
15213                 echo "Prototype: $try" ;;
15214         esac
15215         ;;
15216         *)      case "$usethreads" in
15217                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15218                 esac
15219                 d_getprotobynumber_r=undef
15220                 getprotobynumber_r_proto=0
15221                 ;;
15222         esac
15223         ;;
15224 *)      getprotobynumber_r_proto=0
15225         ;;
15226 esac
15227
15228 : see if getprotoent_r exists
15229 set getprotoent_r d_getprotoent_r
15230 eval $inlibc
15231 case "$d_getprotoent_r" in
15232 "$define")
15233         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15234         case "$d_getprotoent_r_proto:$usethreads" in
15235         ":define")      d_getprotoent_r_proto=define
15236                 set d_getprotoent_r_proto getprotoent_r $hdrs
15237                 eval $hasproto ;;
15238         *)      ;;
15239         esac
15240         case "$d_getprotoent_r_proto" in
15241         define)
15242         case "$getprotoent_r_proto" in
15243         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15244         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15245         esac
15246         case "$getprotoent_r_proto" in
15247         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15248         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15249         esac
15250         case "$getprotoent_r_proto" in
15251         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15252         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15253         esac
15254         case "$getprotoent_r_proto" in
15255         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15256         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15257         esac
15258         case "$getprotoent_r_proto" in
15259         ''|0)   d_getprotoent_r=undef
15260                 getprotoent_r_proto=0
15261                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15262         * )     case "$getprotoent_r_proto" in
15263                 REENTRANT_PROTO*) ;;
15264                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15265                 esac
15266                 echo "Prototype: $try" ;;
15267         esac
15268         ;;
15269         *)      case "$usethreads" in
15270                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15271                 esac
15272                 d_getprotoent_r=undef
15273                 getprotoent_r_proto=0
15274                 ;;
15275         esac
15276         ;;
15277 *)      getprotoent_r_proto=0
15278         ;;
15279 esac
15280
15281 : see if prototypes for various getprotoxxx netdb.h functions are available
15282 echo " "
15283 set d_getprotoprotos getprotoent $i_netdb netdb.h
15284 eval $hasproto
15285
15286 : see if getprpwnam exists
15287 set getprpwnam d_getprpwnam
15288 eval $inlibc
15289
15290 : see if getpwent exists
15291 set getpwent d_getpwent
15292 eval $inlibc
15293
15294 : see if getpwent_r exists
15295 set getpwent_r d_getpwent_r
15296 eval $inlibc
15297 case "$d_getpwent_r" in
15298 "$define")
15299         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15300         case "$d_getpwent_r_proto:$usethreads" in
15301         ":define")      d_getpwent_r_proto=define
15302                 set d_getpwent_r_proto getpwent_r $hdrs
15303                 eval $hasproto ;;
15304         *)      ;;
15305         esac
15306         case "$d_getpwent_r_proto" in
15307         define)
15308         case "$getpwent_r_proto" in
15309         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15310         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15311         esac
15312         case "$getpwent_r_proto" in
15313         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15314         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15315         esac
15316         case "$getpwent_r_proto" in
15317         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15318         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15319         esac
15320         case "$getpwent_r_proto" in
15321         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15322         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15323         esac
15324         case "$getpwent_r_proto" in
15325         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15326         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15327         esac
15328         case "$getpwent_r_proto" in
15329         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15330         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15331         esac
15332         case "$getpwent_r_proto" in
15333         ''|0)   d_getpwent_r=undef
15334                 getpwent_r_proto=0
15335                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15336         * )     case "$getpwent_r_proto" in
15337                 REENTRANT_PROTO*) ;;
15338                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15339                 esac
15340                 echo "Prototype: $try" ;;
15341         esac
15342         ;;
15343         *)      case "$usethreads" in
15344                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15345                 esac
15346                 d_getpwent_r=undef
15347                 getpwent_r_proto=0
15348                 ;;
15349         esac
15350         ;;
15351 *)      getpwent_r_proto=0
15352         ;;
15353 esac
15354
15355 : see if getpwnam_r exists
15356 set getpwnam_r d_getpwnam_r
15357 eval $inlibc
15358 case "$d_getpwnam_r" in
15359 "$define")
15360         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15361         case "$d_getpwnam_r_proto:$usethreads" in
15362         ":define")      d_getpwnam_r_proto=define
15363                 set d_getpwnam_r_proto getpwnam_r $hdrs
15364                 eval $hasproto ;;
15365         *)      ;;
15366         esac
15367         case "$d_getpwnam_r_proto" in
15368         define)
15369         case "$getpwnam_r_proto" in
15370         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15371         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15372         esac
15373         case "$getpwnam_r_proto" in
15374         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15375         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15376         esac
15377         case "$getpwnam_r_proto" in
15378         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15379         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15380         esac
15381         case "$getpwnam_r_proto" in
15382         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15383         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15384         esac
15385         case "$getpwnam_r_proto" in
15386         ''|0)   d_getpwnam_r=undef
15387                 getpwnam_r_proto=0
15388                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15389         * )     case "$getpwnam_r_proto" in
15390                 REENTRANT_PROTO*) ;;
15391                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15392                 esac
15393                 echo "Prototype: $try" ;;
15394         esac
15395         ;;
15396         *)      case "$usethreads" in
15397                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15398                 esac
15399                 d_getpwnam_r=undef
15400                 getpwnam_r_proto=0
15401                 ;;
15402         esac
15403         ;;
15404 *)      getpwnam_r_proto=0
15405         ;;
15406 esac
15407
15408 : see if getpwuid_r exists
15409 set getpwuid_r d_getpwuid_r
15410 eval $inlibc
15411 case "$d_getpwuid_r" in
15412 "$define")
15413         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15414         case "$d_getpwuid_r_proto:$usethreads" in
15415         ":define")      d_getpwuid_r_proto=define
15416                 set d_getpwuid_r_proto getpwuid_r $hdrs
15417                 eval $hasproto ;;
15418         *)      ;;
15419         esac
15420         case "$d_getpwuid_r_proto" in
15421         define)
15422         case "$getpwuid_r_proto" in
15423         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15424         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15425         esac
15426         case "$getpwuid_r_proto" in
15427         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15428         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15429         esac
15430         case "$getpwuid_r_proto" in
15431         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15432         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15433         esac
15434         case "$getpwuid_r_proto" in
15435         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15436         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15437         esac
15438         case "$getpwuid_r_proto" in
15439         ''|0)   d_getpwuid_r=undef
15440                 getpwuid_r_proto=0
15441                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15442         * )     case "$getpwuid_r_proto" in
15443                 REENTRANT_PROTO*) ;;
15444                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15445                 esac
15446                 echo "Prototype: $try" ;;
15447         esac
15448         ;;
15449         *)      case "$usethreads" in
15450                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15451                 esac
15452                 d_getpwuid_r=undef
15453                 getpwuid_r_proto=0
15454                 ;;
15455         esac
15456         ;;
15457 *)      getpwuid_r_proto=0
15458         ;;
15459 esac
15460
15461 : Optional checks for getsbyname and getsbyport
15462
15463 : see if getservbyname exists
15464 set getservbyname d_getsbyname
15465 eval $inlibc
15466
15467 : see if getservbyport exists
15468 set getservbyport d_getsbyport
15469 eval $inlibc
15470
15471 : see if getservent exists
15472 set getservent d_getsent
15473 eval $inlibc
15474
15475 : see if getservbyname_r exists
15476 set getservbyname_r d_getservbyname_r
15477 eval $inlibc
15478 case "$d_getservbyname_r" in
15479 "$define")
15480         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15481         case "$d_getservbyname_r_proto:$usethreads" in
15482         ":define")      d_getservbyname_r_proto=define
15483                 set d_getservbyname_r_proto getservbyname_r $hdrs
15484                 eval $hasproto ;;
15485         *)      ;;
15486         esac
15487         case "$d_getservbyname_r_proto" in
15488         define)
15489         case "$getservbyname_r_proto" in
15490         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15491         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15492         esac
15493         case "$getservbyname_r_proto" in
15494         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15495         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15496         esac
15497         case "$getservbyname_r_proto" in
15498         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15499         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15500         esac
15501         case "$getservbyname_r_proto" in
15502         ''|0)   d_getservbyname_r=undef
15503                 getservbyname_r_proto=0
15504                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15505         * )     case "$getservbyname_r_proto" in
15506                 REENTRANT_PROTO*) ;;
15507                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15508                 esac
15509                 echo "Prototype: $try" ;;
15510         esac
15511         ;;
15512         *)      case "$usethreads" in
15513                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15514                 esac
15515                 d_getservbyname_r=undef
15516                 getservbyname_r_proto=0
15517                 ;;
15518         esac
15519         ;;
15520 *)      getservbyname_r_proto=0
15521         ;;
15522 esac
15523
15524 : see if getservbyport_r exists
15525 set getservbyport_r d_getservbyport_r
15526 eval $inlibc
15527 case "$d_getservbyport_r" in
15528 "$define")
15529         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15530         case "$d_getservbyport_r_proto:$usethreads" in
15531         ":define")      d_getservbyport_r_proto=define
15532                 set d_getservbyport_r_proto getservbyport_r $hdrs
15533                 eval $hasproto ;;
15534         *)      ;;
15535         esac
15536         case "$d_getservbyport_r_proto" in
15537         define)
15538         case "$getservbyport_r_proto" in
15539         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15540         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15541         esac
15542         case "$getservbyport_r_proto" in
15543         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15544         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15545         esac
15546         case "$getservbyport_r_proto" in
15547         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15548         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15549         esac
15550         case "$getservbyport_r_proto" in
15551         ''|0)   d_getservbyport_r=undef
15552                 getservbyport_r_proto=0
15553                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15554         * )     case "$getservbyport_r_proto" in
15555                 REENTRANT_PROTO*) ;;
15556                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15557                 esac
15558                 echo "Prototype: $try" ;;
15559         esac
15560         ;;
15561         *)      case "$usethreads" in
15562                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15563                 esac
15564                 d_getservbyport_r=undef
15565                 getservbyport_r_proto=0
15566                 ;;
15567         esac
15568         ;;
15569 *)      getservbyport_r_proto=0
15570         ;;
15571 esac
15572
15573 : see if getservent_r exists
15574 set getservent_r d_getservent_r
15575 eval $inlibc
15576 case "$d_getservent_r" in
15577 "$define")
15578         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15579         case "$d_getservent_r_proto:$usethreads" in
15580         ":define")      d_getservent_r_proto=define
15581                 set d_getservent_r_proto getservent_r $hdrs
15582                 eval $hasproto ;;
15583         *)      ;;
15584         esac
15585         case "$d_getservent_r_proto" in
15586         define)
15587         case "$getservent_r_proto" in
15588         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15589         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15590         esac
15591         case "$getservent_r_proto" in
15592         ''|0) try='int getservent_r(struct servent*, char*, int);'
15593         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15594         esac
15595         case "$getservent_r_proto" in
15596         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15597         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15598         esac
15599         case "$getservent_r_proto" in
15600         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15601         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15602         esac
15603         case "$getservent_r_proto" in
15604         ''|0)   d_getservent_r=undef
15605                 getservent_r_proto=0
15606                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15607         * )     case "$getservent_r_proto" in
15608                 REENTRANT_PROTO*) ;;
15609                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15610                 esac
15611                 echo "Prototype: $try" ;;
15612         esac
15613         ;;
15614         *)      case "$usethreads" in
15615                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15616                 esac
15617                 d_getservent_r=undef
15618                 getservent_r_proto=0
15619                 ;;
15620         esac
15621         ;;
15622 *)      getservent_r_proto=0
15623         ;;
15624 esac
15625
15626 : see if prototypes for various getservxxx netdb.h functions are available
15627 echo " "
15628 set d_getservprotos getservent $i_netdb netdb.h
15629 eval $hasproto
15630
15631 : see if getspnam exists
15632 set getspnam d_getspnam
15633 eval $inlibc
15634
15635 : see if this is a shadow.h system
15636 set shadow.h i_shadow
15637 eval $inhdr
15638
15639 : see if getspnam_r exists
15640 set getspnam_r d_getspnam_r
15641 eval $inlibc
15642 case "$d_getspnam_r" in
15643 "$define")
15644         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15645         case "$d_getspnam_r_proto:$usethreads" in
15646         ":define")      d_getspnam_r_proto=define
15647                 set d_getspnam_r_proto getspnam_r $hdrs
15648                 eval $hasproto ;;
15649         *)      ;;
15650         esac
15651         case "$d_getspnam_r_proto" in
15652         define)
15653         case "$getspnam_r_proto" in
15654         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15655         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15656         esac
15657         case "$getspnam_r_proto" in
15658         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15659         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15660         esac
15661         case "$getspnam_r_proto" in
15662         ''|0)   d_getspnam_r=undef
15663                 getspnam_r_proto=0
15664                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15665         * )     case "$getspnam_r_proto" in
15666                 REENTRANT_PROTO*) ;;
15667                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15668                 esac
15669                 echo "Prototype: $try" ;;
15670         esac
15671         ;;
15672         *)      case "$usethreads" in
15673                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15674                 esac
15675                 d_getspnam_r=undef
15676                 getspnam_r_proto=0
15677                 ;;
15678         esac
15679         ;;
15680 *)      getspnam_r_proto=0
15681         ;;
15682 esac
15683
15684 : see if gettimeofday or ftime exists
15685 set gettimeofday d_gettimeod
15686 eval $inlibc
15687 case "$d_gettimeod" in
15688 "$undef")
15689         set ftime d_ftime 
15690         eval $inlibc
15691         ;;
15692 *)
15693         val="$undef"; set d_ftime; eval $setvar
15694         ;;
15695 esac
15696 case "$d_gettimeod$d_ftime" in
15697 "$undef$undef")
15698         echo " "
15699         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15700         ;;
15701 esac
15702
15703 : see if gmtime_r exists
15704 set gmtime_r d_gmtime_r
15705 eval $inlibc
15706 case "$d_gmtime_r" in
15707 "$define")
15708         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15709         case "$d_gmtime_r_proto:$usethreads" in
15710         ":define")      d_gmtime_r_proto=define
15711                 set d_gmtime_r_proto gmtime_r $hdrs
15712                 eval $hasproto ;;
15713         *)      ;;
15714         esac
15715         case "$d_gmtime_r_proto" in
15716         define)
15717         case "$gmtime_r_proto" in
15718         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15719         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15720         esac
15721         case "$gmtime_r_proto" in
15722         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15723         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15724         esac
15725         case "$gmtime_r_proto" in
15726         ''|0)   d_gmtime_r=undef
15727                 gmtime_r_proto=0
15728                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15729         * )     case "$gmtime_r_proto" in
15730                 REENTRANT_PROTO*) ;;
15731                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15732                 esac
15733                 echo "Prototype: $try" ;;
15734         esac
15735         ;;
15736         *)      case "$usethreads" in
15737                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15738                 esac
15739                 d_gmtime_r=undef
15740                 gmtime_r_proto=0
15741                 ;;
15742         esac
15743         ;;
15744 *)      gmtime_r_proto=0
15745         ;;
15746 esac
15747
15748 : see if hasmntopt exists
15749 set hasmntopt d_hasmntopt
15750 eval $inlibc
15751
15752 : see if this is a netinet/in.h or sys/in.h system
15753 set netinet/in.h i_niin sys/in.h i_sysin
15754 eval $inhdr
15755
15756 : see if arpa/inet.h has to be included
15757 set arpa/inet.h i_arpainet
15758 eval $inhdr
15759
15760 : see if htonl --and friends-- exists
15761 val=''
15762 set htonl val
15763 eval $inlibc
15764
15765 : Maybe they are macros.
15766 case "$val" in
15767 $undef)
15768         $cat >htonl.c <<EOM
15769 #include <stdio.h>
15770 #include <sys/types.h>
15771 #$i_niin I_NETINET_IN
15772 #$i_sysin I_SYS_IN
15773 #$i_arpainet I_ARPA_INET
15774 #ifdef I_NETINET_IN
15775 #include <netinet/in.h>
15776 #endif
15777 #ifdef I_SYS_IN
15778 #include <sys/in.h>
15779 #endif
15780 #ifdef I_ARPA_INET
15781 #include <arpa/inet.h>
15782 #endif
15783 #ifdef htonl
15784 printf("Defined as a macro.");
15785 #endif
15786 EOM
15787         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15788         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15789                 val="$define"
15790                 echo "But it seems to be defined as a macro." >&4
15791         fi
15792         $rm -f htonl.?
15793         ;;
15794 esac
15795 set d_htonl
15796 eval $setvar
15797
15798 : see if hypot exists
15799 set hypot d_hypot
15800 eval $inlibc
15801
15802 : see if ilogb exists
15803 set ilogb d_ilogb
15804 eval $inlibc
15805
15806 : see if ilogbl exists
15807 set ilogbl d_ilogbl
15808 eval $inlibc
15809
15810 : index or strchr
15811 echo " "
15812 if set index val -f; eval $csym; $val; then
15813         if set strchr val -f d_strchr; eval $csym; $val; then
15814                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15815                         val="$define"
15816                         vali="$undef"
15817                         echo "strchr() found." >&4
15818                 else
15819                         val="$undef"
15820                         vali="$define"
15821                         echo "index() found." >&4
15822                 fi
15823         else
15824                 val="$undef"
15825                 vali="$define"
15826                 echo "index() found." >&4
15827         fi
15828 else
15829         if set strchr val -f d_strchr; eval $csym; $val; then
15830                 val="$define"
15831                 vali="$undef"
15832                 echo "strchr() found." >&4
15833         else
15834                 echo "No index() or strchr() found!" >&4
15835                 val="$undef"
15836                 vali="$undef"
15837         fi
15838 fi
15839 set d_strchr; eval $setvar
15840 val="$vali"
15841 set d_index; eval $setvar
15842
15843 : check whether inet_aton exists
15844 set inet_aton d_inetaton
15845 eval $inlibc
15846
15847 : see if inet_ntop exists
15848 set inet_ntop d_inetntop
15849 eval $inlibc
15850
15851 : see if inet_pton exists
15852 set inet_pton d_inetpton
15853 eval $inlibc
15854
15855 : Look for isascii
15856 echo " "
15857 $cat >isascii.c <<EOCP
15858 #include <stdio.h>
15859 #include <ctype.h>
15860 #$i_stdlib I_STDLIB
15861 #ifdef I_STDLIB
15862 #include <stdlib.h>
15863 #endif
15864 int main() {
15865         int c = 'A';
15866         if (isascii(c))
15867                 exit(0);
15868         else
15869                 exit(1);
15870 }
15871 EOCP
15872 set isascii
15873 if eval $compile; then
15874         echo "isascii() found." >&4
15875         val="$define"
15876 else
15877         echo "isascii() NOT found." >&4
15878         val="$undef"
15879 fi
15880 set d_isascii
15881 eval $setvar
15882 $rm -f isascii*
15883
15884 : Look for isblank
15885 echo " "
15886 $cat >isblank.c <<'EOCP'
15887 #include <stdio.h>
15888 #include <ctype.h>
15889 int main() {
15890         int c = ' ';
15891         if (isblank(c))
15892                 return 0 ;
15893         else
15894                 return 1 ;
15895 }
15896 EOCP
15897 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15898         echo "isblank() found." >&4
15899         val="$define"
15900 else
15901         echo "isblank() NOT found." >&4
15902         val="$undef"
15903 fi
15904 set d_isblank
15905 eval $setvar
15906 $rm -f isblank*
15907
15908 : check for isfinite
15909 echo "Checking to see if you have isfinite..." >&4
15910 $cat >try.c <<EOCP
15911 #$i_math I_MATH
15912 #ifdef I_MATH
15913 #include <math.h>
15914 #endif
15915 int main() { return isfinite(0.0); }
15916 EOCP
15917 set try
15918 if eval $compile; then
15919         val="$define"
15920         echo "You have isfinite."
15921 else
15922         val="$undef"
15923         echo "You do not have isfinite."
15924 fi
15925 $rm_try
15926 set d_isfinite
15927 eval $setvar
15928
15929 : see if isfinitel exists
15930 set isfinitel d_isfinitel
15931 eval $inlibc
15932
15933 : check for isinf
15934 echo "Checking to see if you have isinf..." >&4
15935 $cat >try.c <<EOCP
15936 #$i_math I_MATH
15937 #ifdef I_MATH
15938 #include <math.h>
15939 #endif
15940 int main() { return isinf(0.0); }
15941 EOCP
15942 set try
15943 if eval $compile; then
15944         val="$define"
15945         echo "You have isinf."
15946 else
15947         val="$undef"
15948         echo "You do not have isinf."
15949 fi
15950 $rm_try
15951 set d_isinf
15952 eval $setvar
15953
15954 : see if isinfl exists
15955 set isinfl d_isinfl
15956 eval $inlibc
15957
15958 : check for isless
15959 echo "Checking to see if you have isless..." >&4
15960 $cat >try.c <<EOCP
15961 #$i_math I_MATH
15962 #ifdef I_MATH
15963 #include <math.h>
15964 #endif
15965 int main() { return isless(0.0); }
15966 EOCP
15967 set try
15968 if eval $compile; then
15969         val="$define"
15970         echo "You have isless."
15971 else
15972         val="$undef"
15973         echo "You do not have isless."
15974 fi
15975 $rm_try
15976 set d_isless
15977 eval $setvar
15978
15979 : check for isnan
15980 echo "Checking to see if you have isnan..." >&4
15981 $cat >try.c <<EOCP
15982 #$i_math I_MATH
15983 #ifdef I_MATH
15984 #include <math.h>
15985 #endif
15986 int main() { return isnan(0.0); }
15987 EOCP
15988 set try
15989 if eval $compile; then
15990         val="$define"
15991         echo "You have isnan."
15992 else
15993         val="$undef"
15994         echo "You do not have isnan."
15995 fi
15996 $rm_try
15997 set d_isnan
15998 eval $setvar
15999
16000 : see if isnanl exists
16001 set isnanl d_isnanl
16002 eval $inlibc
16003
16004 : check for isnormal
16005 echo "Checking to see if you have isnormal..." >&4
16006 $cat >try.c <<EOCP
16007 #$i_math I_MATH
16008 #ifdef I_MATH
16009 #include <math.h>
16010 #endif
16011 int main() { return isnormal(0.0); }
16012 EOCP
16013 set try
16014 if eval $compile; then
16015         val="$define"
16016         echo "You have isnormal."
16017 else
16018         val="$undef"
16019         echo "You do not have isnormal."
16020 fi
16021 $rm_try
16022 set d_isnormal
16023 eval $setvar
16024
16025 : see if j0 exists
16026 set j0 d_j0
16027 eval $inlibc
16028
16029 : see if j0l exists
16030 set j0l d_j0l
16031 eval $inlibc
16032
16033 : see if killpg exists
16034 set killpg d_killpg
16035 eval $inlibc
16036
16037 : see if localeconv exists
16038 set localeconv d_locconv
16039 eval $inlibc
16040
16041 : see if libc has the POSIX.1-2008 currency locale rules
16042 case "$d_locconv:$d_lc_monetary_2008" in
16043 $define:)
16044         $cat >try.c <<EOCP
16045 #include <locale.h>
16046 int main() {
16047         struct lconv *lc = localeconv();
16048         char int_p_cs_precedes = lc->int_p_cs_precedes;
16049         return 0;
16050 }
16051 EOCP
16052         set try
16053         if eval $compile; then
16054                 d_lc_monetary_2008="$define"
16055         else
16056                 d_lc_monetary_2008="$undef"
16057         fi;
16058         $rm_try
16059         ;;
16060 esac
16061
16062 : see if lchown exists
16063 echo " "
16064 $cat > try.c <<'EOCP'
16065 /* System header to define __stub macros and hopefully few prototypes,
16066     which can conflict with char lchown(); below.  */
16067 #include <assert.h>
16068 /* Override any gcc2 internal prototype to avoid an error.  */
16069 /* We use char because int might match the return type of a gcc2
16070    builtin and then its argument prototype would still apply.  */
16071 char lchown();
16072 int main() {
16073     /*  The GNU C library defines this for functions which it implements
16074         to always fail with ENOSYS.  Some functions are actually named
16075         something starting with __ and the normal name is an alias.  */
16076 #if defined (__stub_lchown) || defined (__stub___lchown)
16077 choke me
16078 #else
16079 lchown();
16080 #endif
16081 ; return 0; }
16082 EOCP
16083 set try
16084 if eval $compile; then
16085     $echo "lchown() found." >&4
16086     val="$define"
16087 else
16088     $echo "lchown() NOT found." >&4
16089     val="$undef"
16090 fi
16091 set d_lchown
16092 eval $setvar
16093
16094 : See if number of significant digits in a double precision number is known
16095 echo " "
16096 $cat >ldbl_dig.c <<EOM
16097 #$i_limits I_LIMITS
16098 #$i_float I_FLOAT
16099 #ifdef I_LIMITS
16100 #include <limits.h>
16101 #endif
16102 #ifdef I_FLOAT
16103 #include <float.h>
16104 #endif
16105 #ifdef LDBL_DIG
16106 printf("Contains LDBL_DIG");
16107 #endif
16108 EOM
16109 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16110 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16111         echo "LDBL_DIG found." >&4
16112         val="$define"
16113 else
16114         echo "LDBL_DIG NOT found." >&4
16115         val="$undef"
16116 fi
16117 $rm -f ldbl_dig.?
16118 set d_ldbl_dig
16119 eval $setvar
16120
16121 : see if lgamma exists
16122 set lgamma d_lgamma
16123 eval $inlibc
16124
16125 : see if lgamma_r exists
16126 set lgamma_r d_lgamma_r
16127 eval $inlibc
16128
16129 : check to see if math.h defines _LIB_VERSION
16130 d_libm_lib_version="$undef"
16131 case $i_math in
16132     $define)
16133         echo " "
16134         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16135         $cat >try.c <<EOCP
16136 #include <unistd.h>
16137 #include <math.h>
16138 int main (int argc, char *argv[])
16139 {
16140     printf ("%d\n", _LIB_VERSION);
16141     return (0);
16142     } /* main */
16143 EOCP
16144         set try
16145         if eval $compile; then
16146             foo=`$run ./try`
16147             echo "Yes, it does ($foo)" >&4
16148             d_libm_lib_version="$define"
16149         else
16150             echo "No, it does not (probably harmless)" >&4
16151             fi
16152         $rm_try
16153         ;;
16154
16155     esac
16156
16157 : see if link exists
16158 set link d_link
16159 eval $inlibc
16160
16161 : see if llrint exists
16162 set llrint d_llrint
16163 eval $inlibc
16164
16165 : see if llrintl exists
16166 set llrintl d_llrintl
16167 eval $inlibc
16168
16169 : see if llround exists
16170 set llround d_llround
16171 eval $inlibc
16172
16173 : see if llroundl exists
16174 set llroundl d_llroundl
16175 eval $inlibc
16176
16177 : see if localtime_r exists
16178 set localtime_r d_localtime_r
16179 eval $inlibc
16180 case "$d_localtime_r" in
16181 "$define")
16182         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16183         case "$d_localtime_r_proto:$usethreads" in
16184         ":define")      d_localtime_r_proto=define
16185                 set d_localtime_r_proto localtime_r $hdrs
16186                 eval $hasproto ;;
16187         *)      ;;
16188         esac
16189         case "$d_localtime_r_proto" in
16190         define)
16191         case "$localtime_r_proto" in
16192         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16193         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16194         esac
16195         case "$localtime_r_proto" in
16196         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16197         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16198         esac
16199         case "$localtime_r_proto" in
16200         ''|0)   d_localtime_r=undef
16201                 localtime_r_proto=0
16202                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16203         * )     case "$localtime_r_proto" in
16204                 REENTRANT_PROTO*) ;;
16205                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16206                 esac
16207                 echo "Prototype: $try" ;;
16208         esac
16209         ;;
16210         *)      case "$usethreads" in
16211                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16212                 esac
16213                 d_localtime_r=undef
16214                 localtime_r_proto=0
16215                 ;;
16216         esac
16217         ;;
16218 *)      localtime_r_proto=0
16219         ;;
16220 esac
16221
16222 : see if localtime_r calls tzset
16223 case "$localtime_r_proto" in
16224 REENTRANT_PROTO*)
16225         $cat >try.c <<EOCP
16226 /*  Does our libc's localtime_r call tzset ?
16227  *  return 0 if so, 1 otherwise.
16228  */
16229 #$i_systypes    I_SYS_TYPES
16230 #$i_unistd      I_UNISTD
16231 #$i_time        I_TIME
16232 #$i_stdlib      I_STDLIB
16233 #$i_string      I_STRING
16234 #$i_malloc      I_MALLOC
16235 #ifdef I_SYS_TYPES
16236 #  include <sys/types.h>
16237 #endif
16238 #ifdef I_UNISTD
16239 #  include <unistd.h>
16240 #endif
16241 #ifdef I_TIME
16242 #  include <time.h>
16243 #endif
16244 #ifdef I_STDLIB
16245 #include <stdlib.h>
16246 #endif
16247 #ifdef I_STRING
16248 #  include <string.h>
16249 #else
16250 #  include <strings.h>
16251 #endif
16252 #ifdef I_MALLOC
16253 #  include <malloc.h>
16254 #endif
16255 int main()
16256 {
16257     time_t t = time(0L);
16258     char w_tz[]="TZ" "=GMT+5",
16259          e_tz[]="TZ" "=GMT-5",
16260         *tz_e = (char*)malloc(16),
16261         *tz_w = (char*)malloc(16);
16262     struct tm tm_e, tm_w;
16263     memset(&tm_e,'\0',sizeof(struct tm));
16264     memset(&tm_w,'\0',sizeof(struct tm));
16265     strcpy(tz_e,e_tz);
16266     strcpy(tz_w,w_tz);
16267
16268     putenv(tz_e);
16269     localtime_r(&t, &tm_e);
16270
16271     putenv(tz_w);
16272     localtime_r(&t, &tm_w);
16273
16274     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16275         return 1;
16276     return 0;
16277 }
16278 EOCP
16279         set try
16280         if eval $compile; then
16281             if $run ./try; then
16282                 d_localtime_r_needs_tzset=undef;
16283             else
16284                 d_localtime_r_needs_tzset=define;
16285             fi;
16286         else
16287             d_localtime_r_needs_tzset=undef;
16288         fi;
16289      ;;
16290   *)
16291      d_localtime_r_needs_tzset=undef;
16292      ;;
16293 esac
16294 $rm_try
16295
16296 : see if lockf exists
16297 set lockf d_lockf
16298 eval $inlibc
16299
16300 : see if log1p exists
16301 set log1p d_log1p
16302 eval $inlibc
16303
16304 : see if log2 exists
16305 set log2 d_log2
16306 eval $inlibc
16307
16308 : see if logb exists
16309 set logb d_logb
16310 eval $inlibc
16311
16312 : see if lrint exists
16313 set lrint d_lrint
16314 eval $inlibc
16315
16316 : see if lrintl exists
16317 set lrintl d_lrintl
16318 eval $inlibc
16319
16320 : see if lround exists
16321 set lround d_lround
16322 eval $inlibc
16323
16324 : see if lroundl exists
16325 set lroundl d_lroundl
16326 eval $inlibc
16327
16328 : see if prototype for lseek is available
16329 echo " "
16330 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16331 eval $hasproto
16332
16333 : see if lstat exists
16334 set lstat d_lstat
16335 eval $inlibc
16336
16337 : see if madvise exists
16338 set madvise d_madvise
16339 eval $inlibc
16340
16341 : see if malloc_size exists
16342 set malloc_size d_malloc_size
16343 eval $inlibc
16344
16345 : see if malloc_size_good exists
16346 set malloc_good_size d_malloc_good_size
16347 eval $inlibc
16348
16349 : see if mblen exists
16350 set mblen d_mblen
16351 eval $inlibc
16352
16353 : see if mbstowcs exists
16354 set mbstowcs d_mbstowcs
16355 eval $inlibc
16356
16357 : see if mbtowc exists
16358 set mbtowc d_mbtowc
16359 eval $inlibc
16360
16361 : see if memchr exists
16362 set memchr d_memchr
16363 eval $inlibc
16364
16365 : see if memcmp exists
16366 set memcmp d_memcmp
16367 eval $inlibc
16368
16369 : see if memcpy exists
16370 set memcpy d_memcpy
16371 eval $inlibc
16372
16373 : see if memmem exists
16374 set memmem d_memmem
16375 eval $inlibc
16376
16377 : see if memmove exists
16378 set memmove d_memmove
16379 eval $inlibc
16380
16381 : see if memset exists
16382 set memset d_memset
16383 eval $inlibc
16384
16385 : see if mkdir exists
16386 set mkdir d_mkdir
16387 eval $inlibc
16388
16389 : see if mkdtemp exists
16390 set mkdtemp d_mkdtemp
16391 eval $inlibc
16392
16393 : see if mkfifo exists
16394 set mkfifo d_mkfifo
16395 eval $inlibc
16396
16397 : see if mkstemp exists
16398 set mkstemp d_mkstemp
16399 eval $inlibc
16400
16401 : see if mkstemps exists
16402 set mkstemps d_mkstemps
16403 eval $inlibc
16404
16405 : see if mktime exists
16406 set mktime d_mktime
16407 eval $inlibc
16408
16409 : see if this is a sys/mman.h system
16410 set sys/mman.h i_sysmman
16411 eval $inhdr
16412
16413 : see if mmap exists
16414 set mmap d_mmap
16415 eval $inlibc
16416 : see what shmat returns
16417 : default to something harmless
16418 mmaptype='void *'
16419 case "$i_sysmman$d_mmap" in
16420 "$define$define")
16421         $cat >mmap.c <<'END'
16422 #include <sys/mman.h>
16423 void *mmap();
16424 END
16425         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16426                 mmaptype='void *'
16427         else
16428                 mmaptype='caddr_t'
16429         fi
16430         echo "and it returns ($mmaptype)." >&4
16431         ;;
16432 esac
16433
16434
16435
16436 : see if sqrtl exists
16437 set sqrtl d_sqrtl
16438 eval $inlibc
16439
16440 : see if scalbnl exists
16441 set scalbnl d_scalbnl
16442 eval $inlibc
16443
16444 : see if truncl exists
16445 set truncl d_truncl
16446 eval $inlibc
16447
16448 : see if modfl exists
16449 set modfl d_modfl
16450 eval $inlibc
16451
16452 : see if prototype for modfl is available
16453 echo " "
16454 set d_modflproto modfl $i_math math.h
16455 eval $hasproto
16456
16457 if $test "$uselongdouble" = "$define"; then
16458     message=""
16459     if $test "$d_sqrtl" != "$define"; then
16460         message="$message sqrtl"
16461     fi
16462     if $test "$d_modfl" != "$define"; then
16463         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16464             echo "You have both truncl and copysignl, so I can emulate modfl."
16465         else
16466             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16467                 echo "You have both aintl and copysignl, so I can emulate modfl."
16468             else
16469                 message="$message modfl"
16470             fi
16471         fi
16472     fi
16473     if $test "$d_frexpl" != "$define"; then
16474         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16475             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16476         else
16477             message="$message frexpl"
16478         fi
16479     fi
16480     if $test "$d_ldexpl" != "$define"; then
16481         message="$message ldexpl"
16482     fi
16483
16484     if $test "$message" != ""; then
16485         $cat <<EOM >&4
16486
16487 *** You requested the use of long doubles but you do not seem to have
16488 *** the following mathematical functions needed for long double support:
16489 ***    $message
16490 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16491 *** Cannot continue, aborting.
16492
16493 EOM
16494
16495         exit 1
16496     fi
16497 fi
16498
16499 : see if mprotect exists
16500 set mprotect d_mprotect
16501 eval $inlibc
16502
16503 : see if msgctl exists
16504 set msgctl d_msgctl
16505 eval $inlibc
16506
16507 : see if msgget exists
16508 set msgget d_msgget
16509 eval $inlibc
16510
16511 : see if msgsnd exists
16512 set msgsnd d_msgsnd
16513 eval $inlibc
16514
16515 : see if msgrcv exists
16516 set msgrcv d_msgrcv
16517 eval $inlibc
16518
16519 : see how much of the 'msg*(2)' library is present.
16520 h_msg=true
16521 echo " "
16522 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16523 *"$undef"*) h_msg=false;;
16524 esac
16525 case "$osname" in
16526 freebsd)
16527     case "`ipcs 2>&1`" in
16528     "SVID messages"*"not configured"*)
16529         echo "Your $osname does not have the msg*(2) configured." >&4
16530         h_msg=false
16531         val="$undef"
16532         set msgctl d_msgctl
16533         eval $setvar
16534         set msgget d_msgget
16535         eval $setvar
16536         set msgsnd d_msgsnd
16537         eval $setvar
16538         set msgrcv d_msgrcv
16539         eval $setvar
16540         ;;
16541     esac
16542     ;;
16543 esac
16544 : we could also check for sys/ipc.h ...
16545 if $h_msg && $test `./findhdr sys/msg.h`; then
16546         echo "You have the full msg*(2) library." >&4
16547         val="$define"
16548 else
16549         echo "You don't have the full msg*(2) library." >&4
16550         val="$undef"
16551 fi
16552 set d_msg
16553 eval $setvar
16554
16555 : Check for msghdr_s
16556 echo " "
16557 echo "Checking to see if your system supports struct msghdr..." >&4
16558 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16559 eval $hasstruct
16560 case "$d_msghdr_s" in
16561 "$define")      echo "Yes, it does."   ;;
16562 *)              echo "No, it doesn't." ;;
16563 esac
16564
16565
16566 : see if msync exists
16567 set msync d_msync
16568 eval $inlibc
16569
16570 : see if munmap exists
16571 set munmap d_munmap
16572 eval $inlibc
16573
16574 : see if nan exists
16575 set nan d_nan
16576 eval $inlibc
16577
16578 : see if nearbyint exists
16579 set nearbyint d_nearbyint
16580 eval $inlibc
16581
16582 : see if nextafter exists
16583 set nextafter d_nextafter
16584 eval $inlibc
16585
16586 : see if nexttoward exists
16587 set nexttoward d_nexttoward
16588 eval $inlibc
16589
16590 : see if nice exists
16591 set nice d_nice
16592 eval $inlibc
16593
16594 : see if this is a langinfo.h system
16595 set langinfo.h i_langinfo
16596 eval $inhdr
16597
16598 : see if nl_langinfo exists
16599 set nl_langinfo d_nl_langinfo
16600 eval $inlibc
16601
16602 : see if this is a quadmath.h system
16603 set quadmath.h i_quadmath
16604 eval $inhdr
16605
16606 : check for volatile keyword
16607 echo " "
16608 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16609 $cat >try.c <<'EOCP'
16610 int main()
16611 {
16612         typedef struct _goo_struct goo_struct;
16613         goo_struct * volatile goo = ((goo_struct *)0);
16614         struct _goo_struct {
16615                 long long_int;
16616                 int reg_int;
16617                 char char_var;
16618         };
16619         typedef unsigned short foo_t;
16620         char *volatile foo;
16621         volatile int bar;
16622         volatile foo_t blech;
16623         foo = foo;
16624 }
16625 EOCP
16626 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16627         val="$define"
16628         echo "Yup, it does."
16629 else
16630         val="$undef"
16631         echo "Nope, it doesn't."
16632 fi
16633 set d_volatile
16634 eval $setvar
16635 $rm_try
16636
16637 : Check basic sizes
16638 echo " "
16639 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16640
16641 case "$use64bitint:$d_quad:$quadtype" in
16642 define:define:?*)
16643         ivtype="$quadtype"
16644         uvtype="$uquadtype"
16645         ivsize=8
16646         uvsize=8
16647         ;;
16648 *)      ivtype="long"
16649         uvtype="unsigned long"
16650         ivsize=$longsize
16651         uvsize=$longsize
16652         ;;
16653 esac
16654
16655 case "$uselongdouble:$d_longdbl" in
16656 define:define)
16657         nvtype="long double"
16658         nvsize=$longdblsize
16659         ;;
16660 *)      nvtype=double
16661         nvsize=$doublesize
16662         ;;
16663 esac
16664
16665 case "$usequadmath:$i_quadmath" in
16666 define:define)
16667   nvtype="__float128"
16668   nvsize=16
16669   case "$libs" in
16670   *quadmath*) ;;
16671   *) $cat <<EOM >&4
16672
16673 *** You requested the use of the quadmath library, but you
16674 *** do not seem to have the quadmath library installed.
16675 *** Cannot continue, aborting.
16676 EOM
16677     exit 1
16678     ;;
16679   esac
16680   ;;
16681 define:*) $cat <<EOM >&4
16682
16683 *** You requested the use of the quadmath library, but you
16684 *** do not seem to have the required header, <quadmath.h>.
16685 EOM
16686   case "$gccversion" in
16687   [23].*|4.[0-5]*)
16688    $cat <<EOM >&4
16689 *** Your gcc looks a bit old:
16690 *** $gccversion
16691 EOM
16692     ;;
16693   '')
16694    $cat <<EOM >&4
16695 *** You are not running a gcc.
16696 EOM
16697     ;;
16698   esac
16699   $cat <<EOM >&4
16700 *** For the quadmath library you need at least gcc 4.6.
16701 *** Cannot continue, aborting.
16702 EOM
16703   exit 1
16704   ;;
16705 esac
16706
16707 $echo "(IV will be "$ivtype", $ivsize bytes)"
16708 $echo "(UV will be "$uvtype", $uvsize bytes)"
16709 $echo "(NV will be "$nvtype", $nvsize bytes)"
16710
16711 $cat >try.c <<EOCP
16712 #$i_inttypes I_INTTYPES
16713 #ifdef I_INTTYPES
16714 #include <inttypes.h>
16715 #endif
16716 #include <stdio.h>
16717 int main() {
16718 #ifdef INT8
16719    int8_t i =  INT8_MAX;
16720   uint8_t u = UINT8_MAX;
16721   printf("int8_t\n");
16722 #endif
16723 #ifdef INT16
16724    int16_t i =  INT16_MAX;
16725   uint16_t u = UINT16_MAX;
16726   printf("int16_t\n");
16727 #endif
16728 #ifdef INT32
16729    int32_t i =  INT32_MAX;
16730   uint32_t u = UINT32_MAX;
16731   printf("int32_t\n");
16732 #endif
16733 }
16734 EOCP
16735
16736 i8type="signed char"
16737 u8type="unsigned char"
16738 i8size=1
16739 u8size=1
16740
16741 case "$i16type" in
16742 '')     case "$shortsize" in
16743         2)      i16type=short
16744                 u16type="unsigned short"
16745                 i16size=$shortsize
16746                 u16size=$shortsize
16747                 ;;
16748         esac
16749         ;;
16750 esac
16751 case "$i16type" in
16752 '')     set try -DINT16
16753         if eval $compile; then
16754                 case "`$run ./try`" in
16755                 int16_t)
16756                         i16type=int16_t
16757                         u16type=uint16_t
16758                         i16size=2
16759                         u16size=2
16760                         ;;
16761                 esac
16762         fi
16763         ;;
16764 esac
16765 case "$i16type" in
16766 '')     if $test $shortsize -ge 2; then
16767                 i16type=short
16768                 u16type="unsigned short"
16769                 i16size=$shortsize
16770                 u16size=$shortsize
16771         fi
16772         ;;
16773 esac
16774
16775 case "$i32type" in
16776 '')     case "$longsize" in
16777         4)      i32type=long
16778                 u32type="unsigned long"
16779                 i32size=$longsize
16780                 u32size=$longsize
16781                 ;;
16782         *)      case "$intsize" in
16783                 4)      i32type=int
16784                         u32type="unsigned int"
16785                         i32size=$intsize
16786                         u32size=$intsize
16787                         ;;
16788                 esac
16789                 ;;
16790         esac
16791         ;;
16792 esac
16793 case "$i32type" in
16794 '')     set try -DINT32
16795         if eval $compile; then
16796                 case "`$run ./try`" in
16797                 int32_t)
16798                         i32type=int32_t
16799                         u32type=uint32_t
16800                         i32size=4
16801                         u32size=4
16802                         ;;
16803                 esac
16804         fi
16805         ;;
16806 esac
16807 case "$i32type" in
16808 '')     if $test $intsize -ge 4; then
16809                 i32type=int
16810                 u32type="unsigned int"
16811                 i32size=$intsize
16812                 u32size=$intsize
16813         fi
16814         ;;
16815 esac
16816
16817 case "$i64type" in
16818 '')     case "$d_quad:$quadtype" in
16819         define:?*)
16820                 i64type="$quadtype"
16821                 u64type="$uquadtype"
16822                 i64size=8
16823                 u64size=8
16824                 ;;
16825         esac
16826         ;;
16827 esac
16828
16829 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16830 : volatile so that the compiler has to store it out to memory.
16831 if test X"$d_volatile" = X"$define"; then
16832         volatile=volatile
16833 fi
16834 $cat <<EOP >try.c
16835 #include <stdio.h>
16836 #$i_stdlib I_STDLIB
16837 #ifdef I_STDLIB
16838 #include <stdlib.h>
16839 #endif
16840 #include <sys/types.h>
16841 #include <signal.h>
16842 #ifdef SIGFPE
16843 $volatile int bletched = 0;
16844 $signal_t blech(int s) { bletched = 1; }
16845 #endif
16846 int main() {
16847     $uvtype u = 0;
16848     $nvtype d;
16849     int     n = 8 * $uvsize;
16850     int     i;
16851 #ifdef SIGFPE
16852     signal(SIGFPE, blech);
16853 #endif
16854
16855     for (i = 0; i < n; i++) {
16856       u = u << 1 | ($uvtype)1;
16857       d = ($nvtype)u;
16858       if (($uvtype)d != u)
16859         break;
16860       if (d <= 0)
16861         break;
16862       d = ($nvtype)(u - 1);
16863       if (($uvtype)d != (u - 1))
16864         break;
16865 #ifdef SIGFPE
16866       if (bletched)
16867         break;
16868 #endif
16869     }
16870     printf("%d\n", ((i == n) ? -n : i));
16871     exit(0);
16872 }
16873 EOP
16874 set try
16875
16876 d_nv_preserves_uv="$undef"
16877 if eval $compile; then
16878         nv_preserves_uv_bits="`$run ./try`"
16879 fi
16880 case "$nv_preserves_uv_bits" in
16881 \-[1-9]*)
16882         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16883         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16884         d_nv_preserves_uv="$define"
16885         ;;
16886 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16887         d_nv_preserves_uv="$undef" ;;
16888 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16889         nv_preserves_uv_bits="0" ;;
16890 esac
16891 $rm_try
16892
16893 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16894 : volatile so that the compiler has to store it out to memory.
16895 if test X"$d_volatile" = X"$define"; then
16896         volatile=volatile
16897 fi
16898 $cat <<EOP >try.c
16899 #include <stdio.h>
16900
16901 typedef $nvtype NV;
16902
16903 int
16904 main() {
16905   NV value = 2;
16906   int count = 1;
16907
16908   while(count < 256) {
16909     $volatile NV up = value + 1.0;
16910     $volatile NV negated = -value;
16911     $volatile NV down = negated - 1.0;
16912     $volatile NV got_up = up - value;
16913     int up_good = got_up == 1.0;
16914     int got_down = down - negated;
16915     int down_good = got_down == -1.0;
16916
16917     if (down_good != up_good) {
16918       fprintf(stderr,
16919               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16920               up_good, (double) got_up, down_good, (double) got_down,
16921               count, (double) value);
16922       return 1;
16923     }
16924     if (!up_good) {
16925       while (1) {
16926         if (count > 8) {
16927           count -= 8;
16928           fputs("256.0", stdout);
16929         } else {
16930           count--;
16931           fputs("2.0", stdout);
16932         }
16933         if (!count) {
16934           puts("");
16935           return 0;
16936         }
16937         fputs("*", stdout);
16938       }
16939     }
16940     value *= 2;
16941     ++count;
16942   }
16943   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16944           count, (double) value);
16945   return 1;
16946 }
16947 EOP
16948 set try
16949
16950 nv_overflows_integers_at='0'
16951 if eval $compile; then
16952     xxx="`$run ./try`"
16953     case "$?" in
16954         0)
16955             case "$xxx" in
16956                 2*)  cat >&4 <<EOM
16957 The largest integer your NVs can preserve is equal to $xxx
16958 EOM
16959                     nv_overflows_integers_at="$xxx"
16960                     ;;
16961                 *)  cat >&4 <<EOM
16962 Cannot determine the largest integer value your NVs can hold, unexpected output
16963 '$xxx'
16964 EOM
16965                     ;;
16966             esac
16967             ;;
16968         *)  cat >&4 <<EOM
16969 Cannot determine the largest integer value your NVs can hold
16970 EOM
16971             ;;
16972     esac
16973 fi
16974 $rm_try
16975
16976 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16977 : volatile so that the compiler has to store it out to memory.
16978 if test X"$d_volatile" = X"$define"; then
16979         volatile=volatile
16980 fi
16981 $cat <<EOP >try.c
16982 #include <stdio.h>
16983 #$i_stdlib I_STDLIB
16984 #ifdef I_STDLIB
16985 #include <stdlib.h>
16986 #endif
16987 #$i_string I_STRING
16988 #ifdef I_STRING
16989 #  include <string.h>
16990 #else
16991 #  include <strings.h>
16992 #endif
16993 #include <sys/types.h>
16994 #include <signal.h>
16995 #ifdef SIGFPE
16996 $volatile int bletched = 0;
16997 $signal_t blech(int s) { bletched = 1; }
16998 #endif
16999
17000 int checkit($nvtype d, char *where) {
17001     unsigned char *p = (char *)&d;
17002     unsigned char *end = p + sizeof(d);
17003     int fail = 0;
17004
17005     while (p < end)
17006         fail += *p++;
17007
17008     if (!fail)
17009         return 0;
17010
17011     p = (char *)&d;
17012     printf("No - %s: 0x", where);
17013     while (p < end)
17014         printf ("%02X", *p++);
17015     printf("\n");
17016     return 1;
17017 }
17018
17019 int main(int argc, char **argv) {
17020     $nvtype d = 0.0;
17021     int fail = 0;
17022     fail += checkit(d, "0.0");
17023
17024     /* The compiler shouldn't be assuming that bletched is 0  */
17025     d = bletched;
17026
17027     fail += checkit(d, "bleched");
17028
17029 #ifdef SIGFPE
17030     signal(SIGFPE, blech);
17031 #endif
17032
17033     /* Paranoia - the compiler should have no way of knowing that ANSI says
17034        that argv[argc] will always be NULL.  Actually, if it did assume this it
17035        would be buggy, as this is C and main() can be called from elsewhere in
17036        the program.  */
17037     d = argv[argc] ? 1 : 0;
17038
17039     if (d) {
17040         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17041     }
17042
17043     fail += checkit(d, "ternary");
17044
17045     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17046
17047     if (d != 0.0) {
17048         printf("No - memset doesn't give 0.0\n");
17049         /* This might just blow up:  */
17050         printf("(gives %g)\n", d);
17051         return 1;
17052     }
17053
17054 #ifdef SIGFPE
17055     if (bletched) {
17056         printf("No - something bleched\n");
17057         return 1;
17058     }
17059 #endif
17060     if (fail) {
17061       printf("No - %d fail(s)\n", fail);
17062       return 1;
17063     }
17064     printf("Yes\n");
17065     return 0;
17066 }
17067 EOP
17068 set try
17069
17070 d_nv_zero_is_allbits_zero="$undef"
17071 if eval $compile; then
17072     xxx="`$run ./try`"
17073     case "$?" in
17074         0)
17075             case "$xxx" in
17076                 Yes)  cat >&4 <<EOM
17077 0.0 is represented as all bits zero in memory
17078 EOM
17079                     d_nv_zero_is_allbits_zero="$define"
17080                     ;;
17081                 *)  cat >&4 <<EOM
17082 0.0 is not represented as all bits zero in memory
17083 EOM
17084                     d_nv_zero_is_allbits_zero="$undef"
17085                     ;;
17086             esac
17087             ;;
17088         *)  cat >&4 <<EOM
17089 0.0 is not represented as all bits zero in memory
17090 EOM
17091             d_nv_zero_is_allbits_zero="$undef"
17092             ;;
17093     esac
17094 fi
17095 $rm_try
17096
17097 : check for off64_t
17098 echo " "
17099 echo "Checking to see if you have off64_t..." >&4
17100 $cat >try.c <<EOCP
17101 #include <sys/types.h>
17102 #include <unistd.h>
17103 int main() { off64_t x = 7; }
17104 EOCP
17105 set try
17106 if eval $compile; then
17107         val="$define"
17108         echo "You have off64_t."
17109 else
17110         val="$undef"
17111         echo "You do not have off64_t."
17112         case "$lseeksize" in
17113         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17114         esac
17115 fi
17116 $rm_try
17117 set d_off64_t
17118 eval $setvar
17119
17120 : how to create joinable pthreads
17121 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17122         echo " "
17123         echo "Checking what constant to use for creating joinable pthreads..." >&4
17124         $cat >try.c <<'EOCP'
17125 #include <pthread.h>
17126 int main() {
17127     int detachstate = JOINABLE;
17128 }
17129 EOCP
17130         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17131         if eval $compile; then
17132                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17133                 val="$undef" # Yes, undef.
17134                 set d_old_pthread_create_joinable
17135                 eval $setvar
17136                 val=""
17137                 set old_pthread_create_joinable
17138                 eval $setvar
17139         else
17140                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17141                 if eval $compile; then
17142                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17143                         val="$define"
17144                         set d_old_pthread_create_joinable
17145                         eval $setvar
17146                         val=PTHREAD_CREATE_UNDETACHED
17147                         set old_pthread_create_joinable
17148                         eval $setvar
17149                 else
17150                         set try -DJOINABLE=__UNDETACHED
17151                         if eval $compile; then
17152                                 echo "You seem to use __UNDETACHED." >&4
17153                                 val="$define"
17154                                 set d_old_pthread_create_joinable
17155                                 eval $setvar
17156                                 val=__UNDETACHED
17157                                 set old_pthread_create_joinable
17158                                 eval $setvar
17159                         else
17160                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17161                                 val="$define"
17162                                 set d_old_pthread_create_joinable
17163                                 eval $setvar
17164                                 val=0
17165                                 set old_pthread_create_joinable
17166                                 eval $setvar
17167                         fi
17168                 fi
17169         fi
17170         $rm_try
17171 else
17172     d_old_pthread_create_joinable="$undef"
17173     old_pthread_create_joinable=""
17174 fi
17175
17176 : see if pause exists
17177 set pause d_pause
17178 eval $inlibc
17179
17180 : see if poll exists
17181 set poll d_poll
17182 eval $inlibc
17183
17184 : see if prctl exists
17185 set prctl d_prctl
17186 eval $inlibc
17187
17188 : see if prctl supports PR_SET_NAME
17189 d_prctl_set_name=$undef
17190 case $d_prctl in
17191     $define)
17192         $cat >try.c <<EOM
17193 #ifdef __ANDROID__
17194 #include <unistd.h>
17195 #endif
17196 #include <sys/prctl.h>
17197
17198 int main (int argc, char *argv[])
17199 {
17200     return (prctl (PR_SET_NAME, "Test"));
17201     } /* main */
17202 EOM
17203         set try
17204         if eval $compile_ok && $run ./try; then
17205             echo "Your prctl (PR_SET_NAME, ...) works"
17206             d_prctl_set_name=$define
17207             fi
17208         $rm_try
17209         ;;
17210     esac
17211
17212 : see if readlink exists
17213 set readlink d_readlink
17214 eval $inlibc
17215
17216 : Check if there is a /proc symlink to the abs path of
17217 : the executing program.  We will honor hints of d_procselfexe=$undef
17218 : or procselfexe being non-empty, otherwise will try to determine both
17219 : if we have readlink.
17220 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17221 : referenced, and AmigaOS does not have a proc filesystem anyway.
17222 echo " "
17223 val="$undef"
17224 if $test "X$d_procselfexe" = Xundef; then
17225         procselfexe=''
17226 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17227         val="$define"
17228 elif $test "X$d_readlink" = Xdefine; then
17229         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17230         : and it feels more tidy to avoid an extra level of symlink
17231         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17232         while test $# -gt 0; do
17233             type=$1; try=$2
17234             shift; shift
17235             if $issymlink $try; then
17236                 $ls -l $try > reflect
17237                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17238                     echo "You have $type-like $try."
17239                     procselfexe='"'$try'"'
17240                     val="$define"
17241                     : This will break out of the loop
17242                     set X; shift
17243                 fi
17244             fi
17245         done
17246 fi
17247 $rm -f reflect
17248 set d_procselfexe
17249 eval $setvar
17250
17251 : backward compatibility for d_hvfork
17252 if test X$d_hvfork != X; then
17253         d_vfork="$d_hvfork"
17254         d_hvfork=''
17255 fi
17256 : see if there is a vfork
17257 val=''
17258 set vfork val
17259 eval $inlibc
17260
17261 d_pseudofork=$undef
17262
17263 : Ok, but do we want to use it. vfork is reportedly unreliable in
17264 : perl on Solaris 2.x, and probably elsewhere.
17265 case "$val" in
17266 $define)
17267         echo " "
17268         case "$usevfork" in
17269         false) dflt='n';;
17270         *) dflt='y';;
17271         esac
17272         cat <<'EOM'
17273
17274 Perl can only use a vfork() that doesn't suffer from strict
17275 restrictions on calling functions or modifying global data in
17276 the child.  For example, glibc-2.1 contains such a vfork()
17277 that is unsuitable.  If your system provides a proper fork()
17278 call, chances are that you do NOT want perl to use vfork().
17279
17280 EOM
17281         rp="Do you still want to use vfork()?"
17282         . ./myread
17283         case "$ans" in
17284         y|Y) ;;
17285         *)
17286                 echo "Ok, we won't use vfork()."
17287                 val="$undef"
17288                 ;;
17289         esac
17290         ;;
17291 esac
17292 set d_vfork
17293 eval $setvar
17294 case "$d_vfork" in
17295 $define) usevfork='true';;
17296 *) usevfork='false';;
17297 esac
17298
17299 : see whether the pthread_atfork exists
17300 $cat >try.c <<EOP
17301 #include <pthread.h>
17302 #include <stdio.h>
17303 int main() {
17304 #ifdef  PTHREAD_ATFORK
17305         pthread_atfork(NULL,NULL,NULL);
17306 #endif
17307 }
17308 EOP
17309
17310 : see if pthread_atfork exists
17311 set try -DPTHREAD_ATFORK
17312 if eval $compile; then
17313     val="$define"
17314 else
17315     val="$undef"
17316 fi
17317 case "$usethreads" in
17318 $define)
17319         case "$val" in
17320         $define) echo 'pthread_atfork found.' >&4        ;;
17321         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17322         esac
17323 esac
17324 set d_pthread_atfork
17325 eval $setvar
17326
17327 : see if pthread_attr_setscope exists
17328 set pthread_attr_setscope d_pthread_attr_setscope
17329 eval $inlibc
17330
17331 : see whether the various POSIXish _yields exist
17332 $cat >try.c <<EOP
17333 #include <pthread.h>
17334 #include <stdio.h>
17335 int main() {
17336 #ifdef SCHED_YIELD
17337         sched_yield();
17338 #else
17339 #ifdef PTHREAD_YIELD
17340         pthread_yield();
17341 #else
17342 #ifdef PTHREAD_YIELD_NULL
17343         pthread_yield(NULL);
17344 #endif
17345 #endif
17346 #endif
17347 }
17348 EOP
17349 : see if sched_yield exists
17350 set try -DSCHED_YIELD
17351 if eval $compile; then
17352     val="$define"
17353     sched_yield='sched_yield()'
17354 else
17355     val="$undef"
17356 fi
17357 case "$usethreads" in
17358 $define)
17359         case "$val" in
17360         $define) echo 'sched_yield() found.' >&4        ;;
17361         *)       echo 'sched_yield() NOT found.' >&4    ;;
17362         esac
17363 esac
17364 set d_sched_yield
17365 eval $setvar
17366
17367 : see if pthread_yield exists
17368 set try -DPTHREAD_YIELD
17369 if eval $compile; then
17370     val="$define"
17371     case "$sched_yield" in
17372     '') sched_yield='pthread_yield()' ;;
17373     esac
17374 else
17375     set try -DPTHREAD_YIELD_NULL
17376     if eval $compile; then
17377         val="$define"
17378         case "$sched_yield" in
17379         '') sched_yield='pthread_yield(NULL)' ;;
17380         esac
17381     else
17382         val="$undef"
17383     fi
17384 fi
17385 case "$usethreads" in
17386 $define)
17387         case "$val" in
17388         $define) echo 'pthread_yield() found.' >&4      ;;
17389         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17390         esac
17391         ;;
17392 esac
17393 set d_pthread_yield
17394 eval $setvar
17395 case "$sched_yield" in
17396 '') sched_yield=undef ;;
17397 esac
17398 $rm_try
17399
17400 : check for ptrdiff_t
17401 echo " "
17402 echo "Checking to see if you have ptrdiff_t..." >&4
17403 $cat >try.c <<EOCP
17404 #include <stddef.h>
17405 int main() { ptrdiff_t x = 7; }
17406 EOCP
17407 set try
17408 if eval $compile; then
17409         val="$define"
17410         echo "You have ptrdiff_t."
17411 else
17412         val="$undef"
17413         echo "You do not have ptrdiff_t."
17414 fi
17415 $rm_try
17416 set d_ptrdiff_t
17417 eval $setvar
17418
17419 : see if random_r exists
17420 set random_r d_random_r
17421 eval $inlibc
17422 case "$d_random_r" in
17423 "$define")
17424         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17425         case "$d_random_r_proto:$usethreads" in
17426         ":define")      d_random_r_proto=define
17427                 set d_random_r_proto random_r $hdrs
17428                 eval $hasproto ;;
17429         *)      ;;
17430         esac
17431         case "$d_random_r_proto" in
17432         define)
17433         case "$random_r_proto" in
17434         ''|0) try='int random_r(int*, struct random_data*);'
17435         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17436         esac
17437         case "$random_r_proto" in
17438         ''|0) try='int random_r(long*, struct random_data*);'
17439         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17440         esac
17441         case "$random_r_proto" in
17442         ''|0) try='int random_r(struct random_data*, int32_t*);'
17443         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17444         esac
17445         case "$random_r_proto" in
17446         ''|0)   d_random_r=undef
17447                 random_r_proto=0
17448                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17449         * )     case "$random_r_proto" in
17450                 REENTRANT_PROTO*) ;;
17451                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17452                 esac
17453                 echo "Prototype: $try" ;;
17454         esac
17455         ;;
17456         *)      case "$usethreads" in
17457                 define) echo "random_r has no prototype, not using it." >&4 ;;
17458                 esac
17459                 d_random_r=undef
17460                 random_r_proto=0
17461                 ;;
17462         esac
17463         ;;
17464 *)      random_r_proto=0
17465         ;;
17466 esac
17467
17468 : see if readdir and friends exist
17469 set readdir d_readdir
17470 eval $inlibc
17471 set seekdir d_seekdir
17472 eval $inlibc
17473 set telldir d_telldir
17474 eval $inlibc
17475 set rewinddir d_rewinddir
17476 eval $inlibc
17477
17478 : see if readdir64_r exists
17479 set readdir64_r d_readdir64_r
17480 eval $inlibc
17481 case "$d_readdir64_r" in
17482 "$define")
17483         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17484         case "$d_readdir64_r_proto:$usethreads" in
17485         ":define")      d_readdir64_r_proto=define
17486                 set d_readdir64_r_proto readdir64_r $hdrs
17487                 eval $hasproto ;;
17488         *)      ;;
17489         esac
17490         case "$d_readdir64_r_proto" in
17491         define)
17492         case "$readdir64_r_proto" in
17493         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17494         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17495         esac
17496         case "$readdir64_r_proto" in
17497         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17498         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17499         esac
17500         case "$readdir64_r_proto" in
17501         ''|0)   d_readdir64_r=undef
17502                 readdir64_r_proto=0
17503                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17504         * )     case "$readdir64_r_proto" in
17505                 REENTRANT_PROTO*) ;;
17506                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17507                 esac
17508                 echo "Prototype: $try" ;;
17509         esac
17510         ;;
17511         *)      case "$usethreads" in
17512                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17513                 esac
17514                 d_readdir64_r=undef
17515                 readdir64_r_proto=0
17516                 ;;
17517         esac
17518         ;;
17519 *)      readdir64_r_proto=0
17520         ;;
17521 esac
17522
17523 : see if readdir_r exists
17524 set readdir_r d_readdir_r
17525 eval $inlibc
17526 case "$d_readdir_r" in
17527 "$define")
17528         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17529         case "$d_readdir_r_proto:$usethreads" in
17530         ":define")      d_readdir_r_proto=define
17531                 set d_readdir_r_proto readdir_r $hdrs
17532                 eval $hasproto ;;
17533         *)      ;;
17534         esac
17535         case "$d_readdir_r_proto" in
17536         define)
17537         case "$readdir_r_proto" in
17538         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17539         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17540         esac
17541         case "$readdir_r_proto" in
17542         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17543         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17544         esac
17545         case "$readdir_r_proto" in
17546         ''|0)   d_readdir_r=undef
17547                 readdir_r_proto=0
17548                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17549         * )     case "$readdir_r_proto" in
17550                 REENTRANT_PROTO*) ;;
17551                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17552                 esac
17553                 echo "Prototype: $try" ;;
17554         esac
17555         ;;
17556         *)      case "$usethreads" in
17557                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17558                 esac
17559                 d_readdir_r=undef
17560                 readdir_r_proto=0
17561                 ;;
17562         esac
17563         ;;
17564 *)      readdir_r_proto=0
17565         ;;
17566 esac
17567
17568 : see if readv exists
17569 set readv d_readv
17570 eval $inlibc
17571
17572 : see if recvmsg exists
17573 set recvmsg d_recvmsg
17574 eval $inlibc
17575
17576 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17577 echo " "
17578 if set regcomp val -f d_regcomp; eval $csym; $val; then
17579         echo 'regcomp() found.' >&4
17580         d_regcomp="$define"
17581         d_regcmp="$undef"
17582         d_re_comp="$undef"
17583 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17584         echo 'regcmp() found.' >&4
17585         d_regcmp="$define"
17586         d_regcomp="$undef"
17587         d_re_comp="$undef"
17588 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17589         echo 're_comp() found, assuming re_exec() also exists.' >&4
17590         d_re_comp="$define"
17591         d_regcomp="$undef"
17592         d_regcmp="$undef"
17593 else
17594         $cat >&4 <<EOM
17595 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17596 EOM
17597         d_regcmp="$undef"
17598         d_re_comp="$undef"
17599         d_regcomp="$undef"
17600 fi
17601
17602 : see if remainder exists
17603 set remainder d_remainder
17604 eval $inlibc
17605
17606 : see if remquo exists
17607 set remquo d_remquo
17608 eval $inlibc
17609
17610 : see if rename exists
17611 set rename d_rename
17612 eval $inlibc
17613
17614 : see if rint exists
17615 set rint d_rint
17616 eval $inlibc
17617
17618 : see if rmdir exists
17619 set rmdir d_rmdir
17620 eval $inlibc
17621
17622 : see if round exists
17623 set round d_round
17624 eval $inlibc
17625
17626 : see if memory.h is available.
17627 val=''
17628 set memory.h val
17629 eval $inhdr
17630
17631 : See if it conflicts with string.h
17632 case "$val" in
17633 $define)
17634         case "$strings" in
17635         '') ;;
17636         *)
17637                 $cppstdin $cppflags $cppminus < $strings > mem.h
17638                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17639                         echo " "
17640                         echo "We won't be including <memory.h>."
17641                         val="$undef"
17642                 fi
17643                 $rm -f mem.h
17644                 ;;
17645         esac
17646 esac
17647 set i_memory
17648 eval $setvar
17649
17650 : can bcopy handle overlapping blocks?
17651 echo " "
17652 val="$undef"
17653 case "$d_memmove" in
17654 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17655 *)      case "$d_bcopy" in
17656         "$define")
17657                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17658                 $cat >try.c <<EOCP
17659 #$i_memory I_MEMORY
17660 #$i_stdlib I_STDLIB
17661 #$i_string I_STRING
17662 #$i_unistd I_UNISTD
17663 EOCP
17664         $cat >>try.c <<'EOCP'
17665 #include <stdio.h>
17666 #ifdef I_MEMORY
17667 #  include <memory.h>
17668 #endif
17669 #ifdef I_STDLIB
17670 #  include <stdlib.h>
17671 #endif
17672 #ifdef I_STRING
17673 #  include <string.h>
17674 #else
17675 #  include <strings.h>
17676 #endif
17677 #ifdef I_UNISTD
17678 #  include <unistd.h>  /* Needed for NetBSD */
17679 #endif
17680 int main()
17681 {
17682 char buf[128], abc[128];
17683 char *b;
17684 int len;
17685 int off;
17686 int align;
17687
17688 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17689    try to store the string in read-only memory. */
17690 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17691
17692 for (align = 7; align >= 0; align--) {
17693         for (len = 36; len; len--) {
17694                 b = buf+align;
17695                 bcopy(abc, b, len);
17696                 for (off = 1; off <= len; off++) {
17697                         bcopy(b, b+off, len);
17698                         bcopy(b+off, b, len);
17699                         if (bcmp(b, abc, len))
17700                                 exit(1);
17701                 }
17702         }
17703 }
17704 exit(0);
17705 }
17706 EOCP
17707                 set try
17708                 if eval $compile_ok; then
17709                         if $run ./try 2>/dev/null; then
17710                                 echo "Yes, it can."
17711                                 val="$define"
17712                         else
17713                                 echo "It can't, sorry."
17714                         fi
17715                 else
17716                         echo "(I can't compile the test program, so we'll assume not...)"
17717                 fi
17718                 ;;
17719         esac
17720         $rm_try
17721         ;;
17722 esac
17723 set d_safebcpy
17724 eval $setvar
17725
17726 : can memcpy handle overlapping blocks?
17727 echo " "
17728 val="$undef"
17729 case "$d_memmove" in
17730 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17731 *)      case "$d_memcpy" in
17732         "$define")
17733                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17734                 $cat >try.c <<EOCP
17735 #$i_memory I_MEMORY
17736 #$i_stdlib I_STDLIB
17737 #$i_string I_STRING
17738 #$i_unistd I_UNISTD
17739 EOCP
17740         $cat >>try.c <<'EOCP'
17741 #include <stdio.h>
17742 #ifdef I_MEMORY
17743 #  include <memory.h>
17744 #endif
17745 #ifdef I_STDLIB
17746 #  include <stdlib.h>
17747 #endif
17748 #ifdef I_STRING
17749 #  include <string.h>
17750 #else
17751 #  include <strings.h>
17752 #endif
17753 #ifdef I_UNISTD
17754 #  include <unistd.h>  /* Needed for NetBSD */
17755 #endif
17756 int main()
17757 {
17758 char buf[128], abc[128];
17759 char *b;
17760 int len;
17761 int off;
17762 int align;
17763
17764 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17765    try to store the string in read-only memory. */
17766 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17767
17768 for (align = 7; align >= 0; align--) {
17769         for (len = 36; len; len--) {
17770                 b = buf+align;
17771                 memcpy(b, abc, len);
17772                 for (off = 1; off <= len; off++) {
17773                         memcpy(b+off, b, len);
17774                         memcpy(b, b+off, len);
17775                         if (memcmp(b, abc, len))
17776                                 exit(1);
17777                 }
17778         }
17779 }
17780 exit(0);
17781 }
17782 EOCP
17783                 set try
17784                 if eval $compile_ok; then
17785                         if $run ./try 2>/dev/null; then
17786                                 echo "Yes, it can."
17787                                 val="$define"
17788                         else
17789                                 echo "It can't, sorry."
17790                         fi
17791                 else
17792                         echo "(I can't compile the test program, so we'll assume not...)"
17793                 fi
17794                 ;;
17795         esac
17796         $rm_try
17797         ;;
17798 esac
17799 set d_safemcpy
17800 eval $setvar
17801
17802 : can memcmp be trusted to compare relative magnitude?
17803 val="$undef"
17804 case "$d_memcmp" in
17805 "$define")
17806         echo " "
17807         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17808         $cat >try.c <<EOCP
17809 #$i_memory I_MEMORY
17810 #$i_stdlib I_STDLIB
17811 #$i_string I_STRING
17812 #$i_unistd I_UNISTD
17813 EOCP
17814         $cat >>try.c <<'EOCP'
17815 #include <stdio.h>
17816 #ifdef I_MEMORY
17817 #  include <memory.h>
17818 #endif
17819 #ifdef I_STDLIB
17820 #  include <stdlib.h>
17821 #endif
17822 #ifdef I_STRING
17823 #  include <string.h>
17824 #else
17825 #  include <strings.h>
17826 #endif
17827 #ifdef I_UNISTD
17828 #  include <unistd.h>  /* Needed for NetBSD */
17829 #endif
17830 int main()
17831 {
17832 char a = -1;
17833 char b = 0;
17834 if ((a < b) && memcmp(&a, &b, 1) < 0)
17835         exit(1);
17836 exit(0);
17837 }
17838 EOCP
17839         set try
17840         if eval $compile_ok; then
17841                 if $run ./try 2>/dev/null; then
17842                         echo "Yes, it can."
17843                         val="$define"
17844                 else
17845                         echo "No, it can't (it uses signed chars)."
17846                 fi
17847         else
17848                 echo "(I can't compile the test program, so we'll assume not...)"
17849         fi
17850         ;;
17851 esac
17852 $rm_try
17853 set d_sanemcmp
17854 eval $setvar
17855
17856 : see if prototype for sbrk is available
17857 echo " "
17858 set d_sbrkproto sbrk $i_unistd unistd.h
17859 eval $hasproto
17860
17861 : see if scalbn exists
17862 set scalbn d_scalbn
17863 eval $inlibc
17864
17865 : see if select exists
17866 set select d_select
17867 eval $inlibc
17868
17869 : see if semctl exists
17870 set semctl d_semctl
17871 eval $inlibc
17872
17873 : see if semget exists
17874 set semget d_semget
17875 eval $inlibc
17876
17877 : see if semop exists
17878 set semop d_semop
17879 eval $inlibc
17880
17881 : see how much of the 'sem*(2)' library is present.
17882 h_sem=true
17883 echo " "
17884 case "$d_semctl$d_semget$d_semop" in
17885 *"$undef"*) h_sem=false;;
17886 esac
17887 case "$osname" in
17888 freebsd)
17889     case "`ipcs 2>&1`" in
17890     "SVID messages"*"not configured"*)
17891         echo "Your $osname does not have the sem*(2) configured." >&4
17892         h_sem=false
17893         val="$undef"
17894         set semctl d_semctl
17895         eval $setvar
17896         set semget d_semget
17897         eval $setvar
17898         set semop d_semop
17899         eval $setvar
17900         ;;
17901     esac
17902     ;;
17903 esac
17904 : we could also check for sys/ipc.h ...
17905 if $h_sem && $test `./findhdr sys/sem.h`; then
17906         echo "You have the full sem*(2) library." >&4
17907         val="$define"
17908 else
17909         echo "You don't have the full sem*(2) library." >&4
17910         val="$undef"
17911 fi
17912 set d_sem
17913 eval $setvar
17914
17915 : see whether sys/sem.h defines union semun
17916 echo " "
17917 $cat > try.c <<'END'
17918 #include <sys/types.h>
17919 #include <sys/ipc.h>
17920 #include <sys/sem.h>
17921 int main () { union semun semun; semun.buf = 0; }
17922 END
17923 set try
17924 if eval $compile; then
17925     echo "You have union semun in <sys/sem.h>." >&4
17926     val="$define"
17927 else
17928     echo "You do not have union semun in <sys/sem.h>." >&4
17929     val="$undef"
17930 fi
17931 $rm_try
17932 set d_union_semun
17933 eval $setvar
17934
17935 : see how to do semctl IPC_STAT
17936 case "$d_sem" in
17937 $define)
17938     echo " "
17939     $cat > tryh.h <<END
17940 #ifndef S_IRUSR
17941 #   ifdef S_IREAD
17942 #       define S_IRUSR S_IREAD
17943 #       define S_IWUSR S_IWRITE
17944 #       define S_IXUSR S_IEXEC
17945 #   else
17946 #       define S_IRUSR 0400
17947 #       define S_IWUSR 0200
17948 #       define S_IXUSR 0100
17949 #   endif
17950 #   define S_IRGRP (S_IRUSR>>3)
17951 #   define S_IWGRP (S_IWUSR>>3)
17952 #   define S_IXGRP (S_IXUSR>>3)
17953 #   define S_IROTH (S_IRUSR>>6)
17954 #   define S_IWOTH (S_IWUSR>>6)
17955 #   define S_IXOTH (S_IXUSR>>6)
17956 #endif
17957 #ifndef S_IRWXU
17958 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17959 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17960 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17961 #endif
17962 END
17963     : see whether semctl IPC_STAT can use union semun
17964     case "$d_semctl_semun" in
17965     '')
17966       val="$undef"
17967       $cat > try.c <<END
17968 #include <sys/types.h>
17969 #include <sys/ipc.h>
17970 #include <sys/sem.h>
17971 #include <sys/stat.h>
17972 #include <stdio.h>
17973 #include <errno.h>
17974 #include "tryh.h"
17975 #ifndef errno
17976 extern int errno;
17977 #endif
17978 #$d_union_semun HAS_UNION_SEMUN
17979 int main() {
17980     union semun
17981 #ifndef HAS_UNION_SEMUN
17982     {
17983         int val;
17984         struct semid_ds *buf;
17985         unsigned short *array;
17986     }
17987 #endif
17988     arg;
17989     int sem, st;
17990
17991 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17992     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17993     if (sem > -1) {
17994         struct semid_ds argbuf;
17995         arg.buf = &argbuf;
17996 #       ifdef IPC_STAT
17997         st = semctl(sem, 0, IPC_STAT, arg);
17998         if (st == 0)
17999             printf("semun\n");
18000         else
18001 #       endif /* IPC_STAT */
18002             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18003 #       ifdef IPC_RMID
18004         if (semctl(sem, 0, IPC_RMID, arg) != 0)
18005 #       endif /* IPC_RMID */
18006             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18007     } else
18008 #endif /* IPC_PRIVATE && ... */
18009         printf("semget failed: errno = %d\n", errno);
18010   return 0;
18011 }
18012 END
18013       set try
18014       if eval $compile; then
18015           xxx=`$run ./try`
18016           case "$xxx" in
18017           semun) val="$define" ;;
18018           esac
18019       fi
18020       $rm_try
18021       set d_semctl_semun
18022       eval $setvar
18023       ;;
18024     esac
18025     case "$d_semctl_semun" in
18026     $define)
18027         echo "You can use union semun for semctl IPC_STAT." >&4
18028         also='also'
18029         ;;
18030     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
18031         also=''
18032         ;;
18033     esac
18034
18035     : see whether semctl IPC_STAT can use struct semid_ds pointer
18036     case "$d_semctl_semid_ds" in
18037     '')
18038       val="$undef"
18039       $cat > try.c <<'END'
18040 #include <sys/types.h>
18041 #include <sys/ipc.h>
18042 #include <sys/sem.h>
18043 #include <sys/stat.h>
18044 #include "tryh.h"
18045 #include <stdio.h>
18046 #include <errno.h>
18047 #ifndef errno
18048 extern int errno;
18049 #endif
18050 int main() {
18051     struct semid_ds arg;
18052     int sem, st;
18053
18054 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18055     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18056     if (sem > -1) {
18057 #       ifdef IPC_STAT
18058         st = semctl(sem, 0, IPC_STAT, &arg);
18059         if (st == 0)
18060             printf("semid_ds\n");
18061         else
18062 #       endif /* IPC_STAT */
18063             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18064 #       ifdef IPC_RMID
18065         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18066 #       endif /* IPC_RMID */
18067             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18068     } else
18069 #endif /* IPC_PRIVATE && ... */
18070         printf("semget failed: errno = %d\n", errno);
18071
18072     return 0;
18073 }
18074 END
18075       set try
18076       if eval $compile; then
18077           xxx=`$run ./try`
18078           case "$xxx" in
18079           semid_ds) val="$define" ;;
18080           esac
18081       fi
18082       $rm_try
18083       set d_semctl_semid_ds
18084       eval $setvar
18085       ;;
18086     esac
18087     case "$d_semctl_semid_ds" in
18088     $define)
18089         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18090         ;;
18091     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18092         ;;
18093     esac
18094     ;;
18095 *)  val="$undef"
18096
18097     # We do not have the full sem*(2) library, so assume we can not
18098     # use either.
18099
18100     set d_semctl_semun
18101     eval $setvar
18102
18103     set d_semctl_semid_ds
18104     eval $setvar
18105     ;;
18106 esac
18107 $rm_try tryh.h
18108
18109 : see if sendmsg exists
18110 set sendmsg d_sendmsg
18111 eval $inlibc
18112
18113 : see if setegid exists
18114 set setegid d_setegid
18115 eval $inlibc
18116
18117 : see if seteuid exists
18118 set seteuid d_seteuid
18119 eval $inlibc
18120
18121 : see if setgrent exists
18122 set setgrent d_setgrent
18123 eval $inlibc
18124
18125 : see if setgrent_r exists
18126 set setgrent_r d_setgrent_r
18127 eval $inlibc
18128 case "$d_setgrent_r" in
18129 "$define")
18130         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18131         case "$d_setgrent_r_proto:$usethreads" in
18132         ":define")      d_setgrent_r_proto=define
18133                 set d_setgrent_r_proto setgrent_r $hdrs
18134                 eval $hasproto ;;
18135         *)      ;;
18136         esac
18137         case "$d_setgrent_r_proto" in
18138         define)
18139         case "$setgrent_r_proto" in
18140         ''|0) try='int setgrent_r(FILE**);'
18141         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18142         esac
18143         case "$setgrent_r_proto" in
18144         ''|0) try='void setgrent_r(FILE**);'
18145         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18146         esac
18147         case "$setgrent_r_proto" in
18148         ''|0)   d_setgrent_r=undef
18149                 setgrent_r_proto=0
18150                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18151         * )     case "$setgrent_r_proto" in
18152                 REENTRANT_PROTO*) ;;
18153                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18154                 esac
18155                 echo "Prototype: $try" ;;
18156         esac
18157         ;;
18158         *)      case "$usethreads" in
18159                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18160                 esac
18161                 d_setgrent_r=undef
18162                 setgrent_r_proto=0
18163                 ;;
18164         esac
18165         ;;
18166 *)      setgrent_r_proto=0
18167         ;;
18168 esac
18169
18170 : see if sethostent exists
18171 set sethostent d_sethent
18172 eval $inlibc
18173
18174 : see if sethostent_r exists
18175 set sethostent_r d_sethostent_r
18176 eval $inlibc
18177 case "$d_sethostent_r" in
18178 "$define")
18179         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18180         case "$d_sethostent_r_proto:$usethreads" in
18181         ":define")      d_sethostent_r_proto=define
18182                 set d_sethostent_r_proto sethostent_r $hdrs
18183                 eval $hasproto ;;
18184         *)      ;;
18185         esac
18186         case "$d_sethostent_r_proto" in
18187         define)
18188         case "$sethostent_r_proto" in
18189         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18190         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18191         esac
18192         case "$sethostent_r_proto" in
18193         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18194         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18195         esac
18196         case "$sethostent_r_proto" in
18197         ''|0)   d_sethostent_r=undef
18198                 sethostent_r_proto=0
18199                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18200         * )     case "$sethostent_r_proto" in
18201                 REENTRANT_PROTO*) ;;
18202                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18203                 esac
18204                 echo "Prototype: $try" ;;
18205         esac
18206         ;;
18207         *)      case "$usethreads" in
18208                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18209                 esac
18210                 d_sethostent_r=undef
18211                 sethostent_r_proto=0
18212                 ;;
18213         esac
18214         ;;
18215 *)      sethostent_r_proto=0
18216         ;;
18217 esac
18218
18219 : see if setitimer exists
18220 set setitimer d_setitimer
18221 eval $inlibc
18222
18223 : see if setlinebuf exists
18224 set setlinebuf d_setlinebuf
18225 eval $inlibc
18226
18227 : see if setlocale exists
18228 set setlocale d_setlocale
18229 eval $inlibc
18230
18231 : see if locale.h is available
18232 set locale.h i_locale
18233 eval $inhdr
18234
18235 : see if setlocale_r exists
18236 set setlocale_r d_setlocale_r
18237 eval $inlibc
18238 case "$d_setlocale_r" in
18239 "$define")
18240         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18241         case "$d_setlocale_r_proto:$usethreads" in
18242         ":define")      d_setlocale_r_proto=define
18243                 set d_setlocale_r_proto setlocale_r $hdrs
18244                 eval $hasproto ;;
18245         *)      ;;
18246         esac
18247         case "$d_setlocale_r_proto" in
18248         define)
18249         case "$setlocale_r_proto" in
18250         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18251         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18252         esac
18253         case "$setlocale_r_proto" in
18254         ''|0)   d_setlocale_r=undef
18255                 setlocale_r_proto=0
18256                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18257         * )     case "$setlocale_r_proto" in
18258                 REENTRANT_PROTO*) ;;
18259                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18260                 esac
18261                 echo "Prototype: $try" ;;
18262         esac
18263         ;;
18264         *)      case "$usethreads" in
18265                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18266                 esac
18267                 d_setlocale_r=undef
18268                 setlocale_r_proto=0
18269                 ;;
18270         esac
18271         ;;
18272 *)      setlocale_r_proto=0
18273         ;;
18274 esac
18275
18276 : see if setnetent exists
18277 set setnetent d_setnent
18278 eval $inlibc
18279
18280 : see if setnetent_r exists
18281 set setnetent_r d_setnetent_r
18282 eval $inlibc
18283 case "$d_setnetent_r" in
18284 "$define")
18285         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18286         case "$d_setnetent_r_proto:$usethreads" in
18287         ":define")      d_setnetent_r_proto=define
18288                 set d_setnetent_r_proto setnetent_r $hdrs
18289                 eval $hasproto ;;
18290         *)      ;;
18291         esac
18292         case "$d_setnetent_r_proto" in
18293         define)
18294         case "$setnetent_r_proto" in
18295         ''|0) try='int setnetent_r(int, struct netent_data*);'
18296         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18297         esac
18298         case "$setnetent_r_proto" in
18299         ''|0) try='void setnetent_r(int, struct netent_data*);'
18300         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18301         esac
18302         case "$setnetent_r_proto" in
18303         ''|0)   d_setnetent_r=undef
18304                 setnetent_r_proto=0
18305                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18306         * )     case "$setnetent_r_proto" in
18307                 REENTRANT_PROTO*) ;;
18308                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18309                 esac
18310                 echo "Prototype: $try" ;;
18311         esac
18312         ;;
18313         *)      case "$usethreads" in
18314                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18315                 esac
18316                 d_setnetent_r=undef
18317                 setnetent_r_proto=0
18318                 ;;
18319         esac
18320         ;;
18321 *)      setnetent_r_proto=0
18322         ;;
18323 esac
18324
18325 : see if setprotoent exists
18326 set setprotoent d_setpent
18327 eval $inlibc
18328
18329 : see if setpgid exists
18330 set setpgid d_setpgid
18331 eval $inlibc
18332
18333 : see if setpgrp2 exists
18334 set setpgrp2 d_setpgrp2
18335 eval $inlibc
18336
18337 : see if setpriority exists
18338 set setpriority d_setprior
18339 eval $inlibc
18340
18341 : see if setproctitle exists
18342 set setproctitle d_setproctitle
18343 eval $inlibc
18344
18345 : see if setprotoent_r exists
18346 set setprotoent_r d_setprotoent_r
18347 eval $inlibc
18348 case "$d_setprotoent_r" in
18349 "$define")
18350         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18351         case "$d_setprotoent_r_proto:$usethreads" in
18352         ":define")      d_setprotoent_r_proto=define
18353                 set d_setprotoent_r_proto setprotoent_r $hdrs
18354                 eval $hasproto ;;
18355         *)      ;;
18356         esac
18357         case "$d_setprotoent_r_proto" in
18358         define)
18359         case "$setprotoent_r_proto" in
18360         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18361         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18362         esac
18363         case "$setprotoent_r_proto" in
18364         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18365         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18366         esac
18367         case "$setprotoent_r_proto" in
18368         ''|0)   d_setprotoent_r=undef
18369                 setprotoent_r_proto=0
18370                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18371         * )     case "$setprotoent_r_proto" in
18372                 REENTRANT_PROTO*) ;;
18373                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18374                 esac
18375                 echo "Prototype: $try" ;;
18376         esac
18377         ;;
18378         *)      case "$usethreads" in
18379                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18380                 esac
18381                 d_setprotoent_r=undef
18382                 setprotoent_r_proto=0
18383                 ;;
18384         esac
18385         ;;
18386 *)      setprotoent_r_proto=0
18387         ;;
18388 esac
18389
18390 : see if setpwent exists
18391 set setpwent d_setpwent
18392 eval $inlibc
18393
18394 : see if setpwent_r exists
18395 set setpwent_r d_setpwent_r
18396 eval $inlibc
18397 case "$d_setpwent_r" in
18398 "$define")
18399         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18400         case "$d_setpwent_r_proto:$usethreads" in
18401         ":define")      d_setpwent_r_proto=define
18402                 set d_setpwent_r_proto setpwent_r $hdrs
18403                 eval $hasproto ;;
18404         *)      ;;
18405         esac
18406         case "$d_setpwent_r_proto" in
18407         define)
18408         case "$setpwent_r_proto" in
18409         ''|0) try='int setpwent_r(FILE**);'
18410         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18411         esac
18412         case "$setpwent_r_proto" in
18413         ''|0) try='void setpwent_r(FILE**);'
18414         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18415         esac
18416         case "$setpwent_r_proto" in
18417         ''|0)   d_setpwent_r=undef
18418                 setpwent_r_proto=0
18419                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18420         * )     case "$setpwent_r_proto" in
18421                 REENTRANT_PROTO*) ;;
18422                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18423                 esac
18424                 echo "Prototype: $try" ;;
18425         esac
18426         ;;
18427         *)      case "$usethreads" in
18428                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18429                 esac
18430                 d_setpwent_r=undef
18431                 setpwent_r_proto=0
18432                 ;;
18433         esac
18434         ;;
18435 *)      setpwent_r_proto=0
18436         ;;
18437 esac
18438
18439 : see if setregid exists
18440 set setregid d_setregid
18441 eval $inlibc
18442 set setresgid d_setresgid
18443 eval $inlibc
18444
18445 : see if setreuid exists
18446 set setreuid d_setreuid
18447 eval $inlibc
18448 set setresuid d_setresuid
18449 eval $inlibc
18450
18451 : see if setrgid exists
18452 set setrgid d_setrgid
18453 eval $inlibc
18454
18455 : see if setruid exists
18456 set setruid d_setruid
18457 eval $inlibc
18458
18459 : see if setservent exists
18460 set setservent d_setsent
18461 eval $inlibc
18462
18463 : see if setservent_r exists
18464 set setservent_r d_setservent_r
18465 eval $inlibc
18466 case "$d_setservent_r" in
18467 "$define")
18468         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18469         case "$d_setservent_r_proto:$usethreads" in
18470         ":define")      d_setservent_r_proto=define
18471                 set d_setservent_r_proto setservent_r $hdrs
18472                 eval $hasproto ;;
18473         *)      ;;
18474         esac
18475         case "$d_setservent_r_proto" in
18476         define)
18477         case "$setservent_r_proto" in
18478         ''|0) try='int setservent_r(int, struct servent_data*);'
18479         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18480         esac
18481         case "$setservent_r_proto" in
18482         ''|0) try='void setservent_r(int, struct servent_data*);'
18483         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18484         esac
18485         case "$setservent_r_proto" in
18486         ''|0)   d_setservent_r=undef
18487                 setservent_r_proto=0
18488                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18489         * )     case "$setservent_r_proto" in
18490                 REENTRANT_PROTO*) ;;
18491                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18492                 esac
18493                 echo "Prototype: $try" ;;
18494         esac
18495         ;;
18496         *)      case "$usethreads" in
18497                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18498                 esac
18499                 d_setservent_r=undef
18500                 setservent_r_proto=0
18501                 ;;
18502         esac
18503         ;;
18504 *)      setservent_r_proto=0
18505         ;;
18506 esac
18507
18508 : see if setsid exists
18509 set setsid d_setsid
18510 eval $inlibc
18511
18512 : see if setvbuf exists
18513 set setvbuf d_setvbuf
18514 eval $inlibc
18515
18516 : see if shmctl exists
18517 set shmctl d_shmctl
18518 eval $inlibc
18519
18520 : see if shmget exists
18521 set shmget d_shmget
18522 eval $inlibc
18523
18524 : see if shmat exists
18525 set shmat d_shmat
18526 eval $inlibc
18527 : see what shmat returns
18528 case "$d_shmat" in
18529 "$define")
18530         $cat >shmat.c <<'END'
18531 #include <sys/shm.h>
18532 void *shmat();
18533 END
18534         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18535                 shmattype='void *'
18536         else
18537                 shmattype='char *'
18538         fi
18539         echo "and it returns ($shmattype)." >&4
18540         : see if a prototype for shmat is available
18541         xxx=`./findhdr sys/shm.h`
18542         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18543         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18544                 val="$define"
18545         else
18546                 val="$undef"
18547         fi
18548         $rm -f shmat.[co]
18549         ;;
18550 *)
18551         val="$undef"
18552         ;;
18553 esac
18554 set d_shmatprototype
18555 eval $setvar
18556
18557 : see if shmdt exists
18558 set shmdt d_shmdt
18559 eval $inlibc
18560
18561 : see how much of the 'shm*(2)' library is present.
18562 h_shm=true
18563 echo " "
18564 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18565 *"$undef"*) h_shm=false;;
18566 esac
18567 case "$osname" in
18568 freebsd)
18569     case "`ipcs 2>&1`" in
18570     "SVID shared memory"*"not configured"*)
18571         echo "Your $osname does not have the shm*(2) configured." >&4
18572         h_shm=false
18573         val="$undef"
18574         set shmctl d_shmctl
18575         eval $setvar
18576         set shmget d_shmget
18577         eval $setvar
18578         set shmat d_shmat
18579         eval $setvar
18580         set shmdt d_shmdt
18581         eval $setvar
18582         ;;
18583     esac
18584     ;;
18585 esac
18586 : we could also check for sys/ipc.h ...
18587 if $h_shm && $test `./findhdr sys/shm.h`; then
18588         echo "You have the full shm*(2) library." >&4
18589         val="$define"
18590 else
18591         echo "You don't have the full shm*(2) library." >&4
18592         val="$undef"
18593 fi
18594 set d_shm
18595 eval $setvar
18596
18597 : see if we have sigaction
18598 echo " "
18599 if set sigaction val -f d_sigaction; eval $csym; $val; then
18600         echo 'sigaction() found.' >&4
18601         $cat > try.c <<EOP
18602 #include <stdio.h>
18603 #include <sys/types.h>
18604 #include <signal.h>
18605 #$i_stdlib I_STDLIB
18606 #ifdef I_STDLIB
18607 #include <stdlib.h>
18608 #endif
18609 int main()
18610 {
18611     struct sigaction act, oact;
18612     act.sa_flags = 0;
18613     oact.sa_handler = 0;
18614     /* so that act and oact are used */
18615     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18616 }
18617 EOP
18618         set try
18619         if eval $compile_ok; then
18620                 val="$define"
18621         else
18622                 echo "But you don't seem to have a usable struct sigaction." >&4
18623                 val="$undef"
18624         fi
18625 else
18626         echo 'sigaction NOT found.' >&4
18627         val="$undef"
18628 fi
18629 set d_sigaction; eval $setvar
18630 $rm_try
18631
18632 : see what type pids are declared as in the kernel
18633 rp="What is the type of process ids on this system?"
18634 set pid_t pidtype int stdio.h sys/types.h
18635 eval $typedef_ask
18636
18637 : see what type uids are declared as in the kernel
18638 echo " "
18639 echo "Looking for the type for user ids returned by getuid()."
18640 set uid_t uidtype xxx stdio.h sys/types.h
18641 eval $typedef
18642 case "$uidtype" in
18643 xxx)
18644         xxx=`./findhdr sys/user.h`
18645         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18646         case $1 in
18647         unsigned) dflt="$1 $2" ;;
18648         *) dflt="$1" ;;
18649         esac
18650         ;;
18651 *) dflt="$uidtype";;
18652 esac
18653 case "$uidtype" in
18654 uid_t)  echo "uid_t found." ;;
18655 *)      rp="What is the type for user ids returned by getuid()?"
18656         . ./myread
18657         uidtype="$ans"
18658         ;;
18659 esac
18660
18661 : Define hasfield_t macro for Configure internal use
18662 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18663 while $test $# -ge 2; do
18664     case "$1" in
18665         $define) echo "#include <$2>";;
18666     esac ;
18667     shift 2;
18668 done > try.c;
18669 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18670 set try;
18671 if eval $compile; then
18672         val="$define";
18673 else
18674         val="$undef";
18675 fi;
18676 set $varname;
18677 eval $setvar;
18678 $rm_try'
18679
18680 : see what siginfo fields we have
18681 case "$d_sigaction" in
18682 "$define")
18683         echo "Checking if your siginfo_t has si_errno field...">&4
18684         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18685         eval $hasfield_t;
18686
18687         echo "Checking if your siginfo_t has si_pid field...">&4
18688         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18689         eval $hasfield_t;
18690
18691         echo "Checking if your siginfo_t has si_uid field...">&4
18692         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18693         eval $hasfield_t;
18694
18695         echo "Checking if your siginfo_t has si_addr field...">&4
18696         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18697         eval $hasfield_t;
18698
18699         echo "Checking if your siginfo_t has si_status field...">&4
18700         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18701         eval $hasfield_t;
18702
18703         echo "Checking if your siginfo_t has si_band field...">&4
18704         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18705         eval $hasfield_t;
18706
18707         echo "Checking if your siginfo_t has si_value field...">&4
18708         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18709         eval $hasfield_t;
18710
18711         echo "Checking if your siginfo_t has si_fd field...">&4
18712         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18713         eval $hasfield_t;
18714
18715         ;;
18716 *)
18717         d_siginfo_si_errno="$undef"
18718         d_siginfo_si_pid="$undef"
18719         d_siginfo_si_uid="$undef"
18720         d_siginfo_si_addr="$undef"
18721         d_siginfo_si_status="$undef"
18722         d_siginfo_si_band="$undef"
18723         d_siginfo_si_value="$undef"
18724         d_siginfo_si_fd="$undef"
18725         ;;
18726 esac
18727
18728 : see if this is a sunmath.h system
18729 set sunmath.h i_sunmath
18730 eval $inhdr
18731
18732 : see if signbit exists
18733 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18734 $cat >try.c <<EOCP
18735 #$i_math I_MATH
18736 #$i_sunmath I_SUNMATH
18737 #ifdef I_MATH
18738 #  include <math.h>
18739 #endif
18740 #ifdef I_SUNMATH  /* Solaris special math library */
18741 #  include <sunmath.h>
18742 #endif
18743 #define NV $nvtype
18744 int main(int argc, char **argv)
18745 {
18746     NV x = 0.0;
18747     NV y = -0.0;
18748     if ((signbit(x) == 0) && (signbit(y) != 0))
18749         return 0;
18750     else
18751         return 1;
18752 }
18753 EOCP
18754 val="$undef"
18755 set try
18756 if eval $compile; then
18757     if $run ./try; then
18758         $echo "Yes." >&4
18759         val="$define"
18760     else
18761         $echo "Signbit seems to be available, but doesn't work as I expected."
18762         $echo "I won't use it." >&4
18763         val="$undef"
18764     fi
18765 else
18766     $echo "Nope." >&4
18767     dflt="$undef"
18768 fi
18769 set d_signbit
18770 eval $setvar
18771 $rm_try
18772
18773 : see if sigprocmask exists
18774 set sigprocmask d_sigprocmask
18775 eval $inlibc
18776
18777 : see if sigsetjmp exists
18778 echo " "
18779 case "$d_sigsetjmp" in
18780 '')
18781         $cat >try.c <<EOP
18782 #include <setjmp.h>
18783 #$i_stdlib I_STDLIB
18784 #ifdef I_STDLIB
18785 #include <stdlib.h>
18786 #endif
18787 sigjmp_buf env;
18788 int set = 1;
18789 int main()
18790 {
18791         if (sigsetjmp(env,1))
18792                 exit(set);
18793         set = 0;
18794         siglongjmp(env, 1);
18795         exit(1);
18796 }
18797 EOP
18798         set try
18799         if eval $compile; then
18800                 if $run ./try >/dev/null 2>&1; then
18801                         echo "POSIX sigsetjmp found." >&4
18802                         val="$define"
18803                 else
18804                         $cat >&4 <<EOM
18805 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18806 I'll ignore them.
18807 EOM
18808                         val="$undef"
18809                 fi
18810         else
18811                 echo "sigsetjmp not found." >&4
18812                 val="$undef"
18813         fi
18814         ;;
18815 *) val="$d_sigsetjmp"
18816         case "$d_sigsetjmp" in
18817         $define) echo "POSIX sigsetjmp found." >&4;;
18818         $undef) echo "sigsetjmp not found." >&4;;
18819         esac
18820         ;;
18821 esac
18822 set d_sigsetjmp
18823 eval $setvar
18824 $rm_try
18825
18826 : see if snprintf exists
18827 set snprintf d_snprintf
18828 eval $inlibc
18829
18830 : see if vsnprintf exists
18831 set vsnprintf d_vsnprintf
18832 eval $inlibc
18833
18834 case "$d_snprintf-$d_vsnprintf" in
18835 "$define-$define")
18836     $cat <<EOM
18837 Checking whether your snprintf() and vsnprintf() work okay...
18838 EOM
18839     $cat >try.c <<'EOCP'
18840 /* v?snprintf testing logic courtesy of Russ Allbery.
18841  * According to C99:
18842  * - if the buffer is too short it still must be \0-terminated
18843  * - if the buffer is too short the potentially required length
18844  *   must be returned and not -1
18845  * - if the buffer is NULL the potentially required length
18846  *   must be returned and not -1 or core dump
18847  */
18848 #include <stdio.h>
18849 #include <stdarg.h>
18850
18851 char buf[2];
18852
18853 int test (char *format, ...)
18854 {
18855     va_list args;
18856     int count;
18857
18858     va_start (args, format);
18859     count = vsnprintf (buf, sizeof buf, format, args);
18860     va_end (args);
18861     return count;
18862 }
18863
18864 int main ()
18865 {
18866     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18867              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18868 }
18869 EOCP
18870     set try
18871     if eval $compile; then
18872         `$run ./try`
18873         case "$?" in
18874         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18875         *) cat <<EOM >&4
18876 Your snprintf() and snprintf() don't seem to be working okay.
18877 EOM
18878            d_snprintf="$undef"
18879            d_vsnprintf="$undef"
18880            ;;
18881         esac
18882     else
18883         echo "(I can't seem to compile the test program--assuming they don't)"
18884         d_snprintf="$undef"
18885         d_vsnprintf="$undef"
18886     fi
18887     $rm_try
18888     ;;
18889 esac
18890
18891 : see if sockatmark exists
18892 set sockatmark d_sockatmark
18893 eval $inlibc
18894
18895 : see if prototype for sockatmark is available
18896 echo " "
18897 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18898 eval $hasproto
18899
18900 : see if socks5_init exists
18901 set socks5_init d_socks5_init
18902 eval $inlibc
18903
18904 : see if sprintf returns the length of the string in the buffer as per ANSI
18905 $echo "Checking whether sprintf returns the length of the string..." >&4
18906 $cat <<EOP >try.c
18907 #include <stdio.h>
18908 #$i_stdlib I_STDLIB
18909 #ifdef I_STDLIB
18910 #include <stdlib.h>
18911 #endif
18912 #$i_string I_STRING
18913 #ifdef I_STRING
18914 #  include <string.h>
18915 #else
18916 #  include <strings.h>
18917 #endif
18918 #$i_math I_MATH
18919 #ifdef I_MATH
18920 #include <math.h>
18921 #endif
18922
18923 char buffer[256];
18924
18925 int check (size_t expect, int test) {
18926   size_t got = strlen(buffer);
18927   if (expect == got)
18928     return 0;
18929
18930   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18931        test, buffer);
18932   exit (test);
18933 }
18934
18935 int main(int argc, char **argv) {
18936   int test = 0;
18937
18938   check(sprintf(buffer, ""), ++test);
18939   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18940   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18941
18942   return 0;
18943 }
18944 EOP
18945 set try
18946
18947 if eval $compile; then
18948     xxx="`$run ./try`"
18949     case "$?" in
18950         0) cat >&4 <<EOM
18951 sprintf returns the length of the string (as ANSI says it should)
18952 EOM
18953         d_sprintf_returns_strlen="$define"
18954         ;;
18955         *) cat >&4 <<EOM
18956 sprintf does not return the length of the string (how old is this system?)
18957 EOM
18958         d_sprintf_returns_strlen="$undef"
18959         ;;
18960     esac
18961 else
18962     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18963     d_sprintf_returns_strlen="$undef"
18964 fi
18965 $rm_try
18966
18967 : see if srand48_r exists
18968 set srand48_r d_srand48_r
18969 eval $inlibc
18970 case "$d_srand48_r" in
18971 "$define")
18972         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18973         case "$d_srand48_r_proto:$usethreads" in
18974         ":define")      d_srand48_r_proto=define
18975                 set d_srand48_r_proto srand48_r $hdrs
18976                 eval $hasproto ;;
18977         *)      ;;
18978         esac
18979         case "$d_srand48_r_proto" in
18980         define)
18981         case "$srand48_r_proto" in
18982         ''|0) try='int srand48_r(long, struct drand48_data*);'
18983         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18984         esac
18985         case "$srand48_r_proto" in
18986         ''|0)   d_srand48_r=undef
18987                 srand48_r_proto=0
18988                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18989         * )     case "$srand48_r_proto" in
18990                 REENTRANT_PROTO*) ;;
18991                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18992                 esac
18993                 echo "Prototype: $try" ;;
18994         esac
18995         ;;
18996         *)      case "$usethreads" in
18997                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18998                 esac
18999                 d_srand48_r=undef
19000                 srand48_r_proto=0
19001                 ;;
19002         esac
19003         ;;
19004 *)      srand48_r_proto=0
19005         ;;
19006 esac
19007
19008 : see if srandom_r exists
19009 set srandom_r d_srandom_r
19010 eval $inlibc
19011 case "$d_srandom_r" in
19012 "$define")
19013         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19014         case "$d_srandom_r_proto:$usethreads" in
19015         ":define")      d_srandom_r_proto=define
19016                 set d_srandom_r_proto srandom_r $hdrs
19017                 eval $hasproto ;;
19018         *)      ;;
19019         esac
19020         case "$d_srandom_r_proto" in
19021         define)
19022         case "$srandom_r_proto" in
19023         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
19024         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
19025         esac
19026         case "$srandom_r_proto" in
19027         ''|0)   d_srandom_r=undef
19028                 srandom_r_proto=0
19029                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
19030         * )     case "$srandom_r_proto" in
19031                 REENTRANT_PROTO*) ;;
19032                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
19033                 esac
19034                 echo "Prototype: $try" ;;
19035         esac
19036         ;;
19037         *)      case "$usethreads" in
19038                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
19039                 esac
19040                 d_srandom_r=undef
19041                 srandom_r_proto=0
19042                 ;;
19043         esac
19044         ;;
19045 *)      srandom_r_proto=0
19046         ;;
19047 esac
19048
19049 : see if prototype for setresgid is available
19050 echo " "
19051 set d_sresgproto setresgid $i_unistd unistd.h
19052 eval $hasproto
19053
19054 : see if prototype for setresuid is available
19055 echo " "
19056 set d_sresuproto setresuid $i_unistd unistd.h
19057 eval $hasproto
19058
19059 : see if stat exists
19060 set stat d_stat
19061 eval $inlibc
19062
19063 : see if sys/stat.h is available
19064 set sys/stat.h i_sysstat
19065 eval $inhdr
19066
19067 : see if stat knows about block sizes
19068 echo " "
19069 echo "Checking to see if your struct stat has st_blocks field..." >&4
19070 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19071 eval $hasfield
19072
19073 : see if this is a sys/vfs.h system
19074 set sys/vfs.h i_sysvfs
19075 eval $inhdr
19076
19077 : see if this is a sys/statfs.h system
19078 set sys/statfs.h i_sysstatfs
19079 eval $inhdr
19080
19081 : Check for statfs_s
19082 echo " "
19083 echo "Checking to see if your system supports struct statfs..." >&4
19084 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
19085 eval $hasstruct
19086 case "$d_statfs_s" in
19087 "$define")      echo "Yes, it does."   ;;
19088 *)              echo "No, it doesn't." ;;
19089 esac
19090
19091
19092 : see if struct statfs knows about f_flags
19093 case "$d_statfs_s" in
19094 define)
19095         echo " "
19096         echo "Checking to see if your struct statfs has f_flags field..." >&4
19097         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
19098         eval $hasfield
19099         ;;
19100 *)      val="$undef"
19101         set d_statfs_f_flags
19102         eval $setvar
19103         ;;
19104 esac
19105 case "$d_statfs_f_flags" in
19106 "$define")      echo "Yes, it does."   ;;
19107 *)              echo "No, it doesn't." ;;
19108 esac
19109
19110 : see what flavor, if any, of static inline is supported
19111 echo " "
19112 echo "Checking to see if your system supports static inline..."
19113 $cat > try.c <<'EOCP'
19114 #include <stdlib.h>
19115 extern int f_via_a(int x);
19116 extern int f_via_b(int x);
19117 int main(int argc, char **argv)
19118 {
19119     int y;
19120
19121     y = f_via_a(0);
19122 #ifdef USE_B
19123     y = f_via_b(0);
19124 #endif
19125     if (y == 42) {
19126         return EXIT_SUCCESS;
19127     }
19128     else {
19129         return EXIT_FAILURE;
19130     }
19131 }
19132 EOCP
19133 $cat > a.c <<'EOCP'
19134 static INLINE int f(int x) {
19135     int y;
19136     y = x + 42;
19137     return y;
19138 }
19139
19140 int f_via_a(int x)
19141 {
19142     return f(x);
19143 }
19144 EOCP
19145 $cat > b.c <<'EOCP'
19146 extern int f(int x);
19147
19148 int f_via_b(int x)
19149 {
19150     return f(x);
19151 }
19152 EOCP
19153
19154 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19155 case "$perl_static_inline" in
19156 '')     # Check the various possibilities, and break out on success.
19157         # For gcc, prefer __inline__, which will still permit
19158         # cflags.SH to add in -ansi.
19159         case "$gccversion" in
19160                 '') xxx="inline __inline__ __inline _inline";;
19161                 *)  xxx="__inline__ inline __inline _inline";;
19162         esac
19163         for inline in $xxx; do
19164                 set try -DINLINE=$inline a.c
19165                 if eval $compile && $run ./try; then
19166                         # Now make sure there is no external linkage of static
19167                         # functions
19168                         set try -DINLINE=$inline -DUSE_B a.c b.c
19169                         if eval $compile && $run ./try; then
19170                                 $echo "Your compiler supports static $inline, " >&4
19171                                 $echo "but it also creates an external definition," >&4
19172                                 $echo "so I won't use it." >&4
19173                                 val=$undef
19174                         else
19175                                 $echo "Your compiler supports static $inline." >&4
19176                                 val=$define
19177                                 perl_static_inline="static $inline";
19178                                 break;
19179                         fi
19180                 else
19181                         $echo "Your compiler does NOT support static $inline." >&4
19182                         val="$undef"
19183                 fi
19184         done
19185         ;;
19186 *inline*) # Some variant of inline exists.
19187         echo "Keeping your $hint value of $perl_static_inline."
19188         val=$define
19189         ;;
19190 static)  # No inline capabilities
19191         echo "Keeping your $hint value of $perl_static_inline."
19192         val=$undef
19193         ;;
19194 *)  # Unrecognized previous value -- blindly trust the supplied
19195         # value and hope it makes sense.  Use old value for
19196         # d_static_inline, if there is one.
19197         echo "Keeping your $hint value of $perl_static_inline."
19198         case "$d_static_inline" in
19199                 '') val=$define ;;
19200                 *)  val=$d_static_inline ;;
19201         esac
19202         ;;
19203 esac
19204 # Fallback to plain 'static' if nothing worked.
19205 case "$perl_static_inline" in
19206 '')
19207         perl_static_inline="static"
19208         val=$undef
19209         ;;
19210 esac
19211 set d_static_inline
19212 eval $setvar
19213 $rm -f a.[co] b.[co]
19214 $rm_try
19215
19216 : Check stream access
19217 $cat >&4 <<EOM
19218 Checking how to access stdio streams by file descriptor number...
19219 EOM
19220 case "$stdio_stream_array" in
19221 '')     $cat >try.c <<EOCP
19222 #include <stdio.h>
19223 int main() {
19224   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19225     printf("yes\n");
19226 }
19227 EOCP
19228         for s in _iob __iob __sF
19229         do
19230                 set try -DSTDIO_STREAM_ARRAY=$s
19231                 if eval $compile; then
19232                         case "`$run ./try`" in
19233                         yes)    stdio_stream_array=$s; break ;;
19234                         esac
19235                 fi
19236         done
19237         $rm_try
19238 esac
19239 case "$stdio_stream_array" in
19240 '')     $cat >&4 <<EOM
19241 I can't figure out how to access stdio streams by file descriptor number.
19242 EOM
19243         d_stdio_stream_array="$undef"
19244         ;;
19245 *)      $cat >&4 <<EOM
19246 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19247 EOM
19248         d_stdio_stream_array="$define"
19249         ;;
19250 esac
19251
19252 : see if strcoll exists
19253 set strcoll d_strcoll
19254 eval $inlibc
19255
19256 : check for structure copying
19257 echo " "
19258 echo "Checking to see if your C compiler can copy structs..." >&4
19259 $cat >try.c <<'EOCP'
19260 int main()
19261 {
19262         struct blurfl {
19263                 int dyick;
19264         } foo, bar;
19265
19266         foo = bar;
19267 }
19268 EOCP
19269 if $cc -c try.c >/dev/null 2>&1 ; then
19270         val="$define"
19271         echo "Yup, it can."
19272 else
19273         val="$undef"
19274         echo "Nope, it can't."
19275 fi
19276 set d_strctcpy
19277 eval $setvar
19278 $rm_try
19279
19280 : see if strerror and/or sys_errlist[] exist
19281 echo " "
19282 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19283     if set strerror val -f d_strerror; eval $csym; $val; then
19284                 echo 'strerror() found.' >&4
19285                 d_strerror="$define"
19286                 d_strerrm='strerror(e)'
19287                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19288                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19289                         d_syserrlst="$define"
19290                 else
19291                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19292                         d_syserrlst="$undef"
19293                 fi
19294     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19295                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19296                 echo 'strerror() found in string header.' >&4
19297                 d_strerror="$define"
19298                 d_strerrm='strerror(e)'
19299                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19300                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19301                                 d_syserrlst="$define"
19302                 else
19303                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19304                         d_syserrlst="$undef"
19305                 fi
19306     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19307                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19308                 d_strerror="$undef"
19309                 d_syserrlst="$define"
19310                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19311     else
19312                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19313                 d_strerror="$undef"
19314                 d_syserrlst="$undef"
19315                 d_strerrm='"unknown"'
19316     fi
19317 fi
19318
19319 : see if strerror_l exists
19320 set strerror_l d_strerror_l
19321 eval $inlibc
19322
19323 : see if strerror_r exists
19324 set strerror_r d_strerror_r
19325 eval $inlibc
19326 case "$d_strerror_r" in
19327 "$define")
19328         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19329         case "$d_strerror_r_proto:$usethreads" in
19330         ":define")      d_strerror_r_proto=define
19331                 set d_strerror_r_proto strerror_r $hdrs
19332                 eval $hasproto ;;
19333         *)      ;;
19334         esac
19335         case "$d_strerror_r_proto" in
19336         define)
19337         case "$strerror_r_proto" in
19338         ''|0) try='int strerror_r(int, char*, size_t);'
19339         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19340         esac
19341         case "$strerror_r_proto" in
19342         ''|0) try='int strerror_r(int, char*, int);'
19343         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19344         esac
19345         case "$strerror_r_proto" in
19346         ''|0) try='char* strerror_r(int, char*, size_t);'
19347         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19348         esac
19349         case "$strerror_r_proto" in
19350         ''|0)   d_strerror_r=undef
19351                 strerror_r_proto=0
19352                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19353         * )     case "$strerror_r_proto" in
19354                 REENTRANT_PROTO*) ;;
19355                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19356                 esac
19357                 echo "Prototype: $try" ;;
19358         esac
19359         ;;
19360         *)      case "$usethreads" in
19361                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19362                 esac
19363                 d_strerror_r=undef
19364                 strerror_r_proto=0
19365                 ;;
19366         esac
19367         ;;
19368 *)      strerror_r_proto=0
19369         ;;
19370 esac
19371
19372 : see if strftime exists
19373 set strftime d_strftime
19374 eval $inlibc
19375
19376 : see if strlcat exists
19377 set strlcat d_strlcat
19378 eval $inlibc
19379
19380 : see if strlcpy exists
19381 set strlcpy d_strlcpy
19382 eval $inlibc
19383
19384 : see if strtod exists
19385 set strtod d_strtod
19386 eval $inlibc
19387
19388 : see if strtol exists
19389 set strtol d_strtol
19390 eval $inlibc
19391
19392 : see if strtold exists
19393 set strtold d_strtold
19394 eval $inlibc
19395
19396 : see if strtoll exists
19397 set strtoll d_strtoll
19398 eval $inlibc
19399
19400 case "$d_longlong-$d_strtoll" in
19401 "$define-$define")
19402         $cat <<EOM
19403 Checking whether your strtoll() works okay...
19404 EOM
19405         $cat >try.c <<'EOCP'
19406 #include <errno.h>
19407 #ifdef __hpux
19408 #define strtoll __strtoll
19409 #endif
19410 #ifdef __EMX__
19411 #define strtoll _strtoll
19412 #endif
19413 #include <stdio.h>
19414 extern long long int strtoll(char *s, char **, int);
19415 static int bad = 0;
19416 int check(char *s, long long ell, int een) {
19417         long long gll;
19418         errno = 0;
19419         gll = strtoll(s, 0, 10);
19420         if (!((gll == ell) && (errno == een)))
19421                 bad++;
19422 }
19423 int main() {
19424         check(" 1",                                      1LL, 0);
19425         check(" 0",                                      0LL, 0);
19426         check("-1",                                     -1LL, 0);
19427         check("-9223372036854775808", -9223372036854775808LL, 0);
19428         check("-9223372036854775808", -9223372036854775808LL, 0);
19429         check(" 9223372036854775807",  9223372036854775807LL, 0);
19430         check("-9223372036854775808", -9223372036854775808LL, 0);
19431         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19432         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19433         if (!bad)
19434                 printf("ok\n");
19435 }
19436 EOCP
19437         set try
19438         if eval $compile; then
19439                 yyy=`$run ./try`
19440                 case "$yyy" in
19441                 ok) echo "Your strtoll() seems to be working okay." ;;
19442                 *) cat <<EOM >&4
19443 Your strtoll() doesn't seem to be working okay.
19444 EOM
19445                    d_strtoll="$undef"
19446                    ;;
19447                 esac
19448         else
19449                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19450                 d_strtoll="$undef"
19451         fi
19452         ;;
19453 esac
19454
19455 : see if strtoq exists
19456 set strtoq d_strtoq
19457 eval $inlibc
19458
19459 : see if strtoul exists
19460 set strtoul d_strtoul
19461 eval $inlibc
19462
19463 case "$d_strtoul" in
19464 "$define")
19465         $cat <<EOM
19466 Checking whether your strtoul() works okay...
19467 EOM
19468         $cat >try.c <<'EOCP'
19469 #include <errno.h>
19470 #include <stdio.h>
19471 extern unsigned long int strtoul(char *s, char **, int);
19472 static int bad = 0;
19473 void check(char *s, unsigned long eul, int een) {
19474         unsigned long gul;
19475         errno = 0;
19476         gul = strtoul(s, 0, 10);
19477         if (!((gul == eul) && (errno == een)))
19478                 bad++;
19479 }
19480 int main() {
19481         check(" 1", 1L, 0);
19482         check(" 0", 0L, 0);
19483 EOCP
19484         case "$longsize" in
19485         8)
19486             $cat >>try.c <<'EOCP'
19487         check("18446744073709551615", 18446744073709551615UL, 0);
19488         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19489 #if 0 /* strtoul() for /^-/ strings is undefined. */
19490         check("-1", 18446744073709551615UL, 0);
19491         check("-18446744073709551614", 2, 0);
19492         check("-18446744073709551615", 1, 0);
19493         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19494         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19495 #endif
19496 EOCP
19497                 ;;
19498         4)
19499                     $cat >>try.c <<'EOCP'
19500         check("4294967295", 4294967295UL, 0);
19501         check("4294967296", 4294967295UL, ERANGE);
19502 #if 0 /* strtoul() for /^-/ strings is undefined. */
19503         check("-1", 4294967295UL, 0);
19504         check("-4294967294", 2, 0);
19505         check("-4294967295", 1, 0);
19506         check("-4294967296", 4294967295UL, ERANGE);
19507         check("-4294967297", 4294967295UL, ERANGE);
19508 #endif
19509 EOCP
19510                 ;;
19511         *)
19512 : Should we write these tests to be more portable by sprintf-ing
19513 : ~0 and then manipulating that char string as input for strtol?
19514                 ;;
19515         esac
19516         $cat >>try.c <<'EOCP'
19517         if (!bad)
19518                 printf("ok\n");
19519         return 0;
19520 }
19521 EOCP
19522         set try
19523         if eval $compile; then
19524                 case "`$run ./try`" in
19525                 ok) echo "Your strtoul() seems to be working okay." ;;
19526                 *) cat <<EOM >&4
19527 Your strtoul() doesn't seem to be working okay.
19528 EOM
19529                    d_strtoul="$undef"
19530                    ;;
19531                 esac
19532         else
19533                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19534                 d_strtoul="$undef"
19535         fi
19536         ;;
19537 esac
19538
19539 : see if strtoull exists
19540 set strtoull d_strtoull
19541 eval $inlibc
19542
19543 case "$d_longlong-$d_strtoull" in
19544 "$define-$define")
19545         $cat <<EOM
19546 Checking whether your strtoull() works okay...
19547 EOM
19548         $cat >try.c <<'EOCP'
19549 #include <errno.h>
19550 #ifdef __hpux
19551 #define strtoull __strtoull
19552 #endif
19553 #include <stdio.h>
19554 extern unsigned long long int strtoull(char *s, char **, int);
19555 static int bad = 0;
19556 int check(char *s, long long eull, int een) {
19557         long long gull;
19558         errno = 0;
19559         gull = strtoull(s, 0, 10);
19560         if (!((gull == eull) && (errno == een)))
19561                 bad++;
19562 }
19563 int main() {
19564         check(" 1",                                        1LL, 0);
19565         check(" 0",                                        0LL, 0);
19566         check("18446744073709551615",  18446744073709551615ULL, 0);
19567         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19568 #if 0 /* strtoull() for /^-/ strings is undefined. */
19569         check("-1",                    18446744073709551615ULL, 0);
19570         check("-18446744073709551614",                     2LL, 0);
19571         check("-18446744073709551615",                     1LL, 0);
19572         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19573         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19574 #endif
19575         if (!bad)
19576                 printf("ok\n");
19577 }
19578 EOCP
19579         set try
19580         if eval $compile; then
19581                 case "`$run ./try`" in
19582                 ok) echo "Your strtoull() seems to be working okay." ;;
19583                 *) cat <<EOM >&4
19584 Your strtoull() doesn't seem to be working okay.
19585 EOM
19586                    d_strtoull="$undef"
19587                    ;;
19588                 esac
19589         else
19590                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19591                 d_strtoull="$undef"
19592         fi
19593         ;;
19594 esac
19595
19596 : see if strtouq exists
19597 set strtouq d_strtouq
19598 eval $inlibc
19599
19600 case "$d_strtouq" in
19601 "$define")
19602         $cat <<EOM
19603 Checking whether your strtouq() works okay...
19604 EOM
19605         $cat >try.c <<'EOCP'
19606 #include <errno.h>
19607 #include <stdio.h>
19608 extern unsigned long long int strtouq(char *s, char **, int);
19609 static int bad = 0;
19610 void check(char *s, unsigned long long eull, int een) {
19611         unsigned long long gull;
19612         errno = 0;
19613         gull = strtouq(s, 0, 10);
19614         if (!((gull == eull) && (errno == een)))
19615                 bad++;
19616 }
19617 int main() {
19618         check(" 1",                                        1LL, 0);
19619         check(" 0",                                        0LL, 0);
19620         check("18446744073709551615",  18446744073709551615ULL, 0);
19621         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19622 #if 0 /* strtouq() for /^-/ strings is undefined. */
19623         check("-1",                    18446744073709551615ULL, 0);
19624         check("-18446744073709551614",                     2LL, 0);
19625         check("-18446744073709551615",                     1LL, 0);
19626         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19627         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19628 #endif
19629         if (!bad)
19630                 printf("ok\n");
19631         return 0;
19632 }
19633 EOCP
19634         set try
19635         if eval $compile; then
19636                 case "`$run ./try`" in
19637                 ok) echo "Your strtouq() seems to be working okay." ;;
19638                 *) cat <<EOM >&4
19639 Your strtouq() doesn't seem to be working okay.
19640 EOM
19641                    d_strtouq="$undef"
19642                    ;;
19643                 esac
19644         else
19645                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19646                 d_strtouq="$undef"
19647         fi
19648         ;;
19649 esac
19650
19651 : see if strxfrm exists
19652 set strxfrm d_strxfrm
19653 eval $inlibc
19654
19655 : see if symlink exists
19656 set symlink d_symlink
19657 eval $inlibc
19658
19659 : see if syscall exists
19660 set syscall d_syscall
19661 eval $inlibc
19662
19663 : see if prototype for syscall is available
19664 echo " "
19665 set d_syscallproto syscall $i_unistd unistd.h
19666 eval $hasproto
19667
19668 : see if sysconf exists
19669 set sysconf d_sysconf
19670 eval $inlibc
19671
19672 : see if system exists
19673 set system d_system
19674 eval $inlibc
19675
19676 : see if tcgetpgrp exists
19677 set tcgetpgrp d_tcgetpgrp
19678 eval $inlibc
19679
19680 : see if tcsetpgrp exists
19681 set tcsetpgrp d_tcsetpgrp
19682 eval $inlibc
19683
19684 : see if prototype for telldir is available
19685 echo " "
19686 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19687 eval $hasproto
19688
19689 : see if tgamma exists
19690 set tgamma d_tgamma
19691 eval $inlibc
19692
19693 : see if time exists
19694 echo " "
19695 if test "X$d_time" = X -o X"$timetype" = X; then
19696     if set time val -f d_time; eval $csym; $val; then
19697                 echo 'time() found.' >&4
19698                 val="$define"
19699                 rp="What is the type returned by time() on this system?"
19700                 set time_t timetype long stdio.h sys/types.h
19701                 eval $typedef_ask
19702     else
19703                 echo 'time() not found, hope that will do.' >&4
19704                 val="$undef"
19705                 timetype='int';
19706     fi
19707     set d_time
19708     eval $setvar
19709 fi
19710
19711 : see if timegm exists
19712 set timegm d_timegm
19713 eval $inlibc
19714
19715 : see if this is a sys/times.h system
19716 set sys/times.h i_systimes
19717 eval $inhdr
19718
19719 : see if times exists
19720 echo " "
19721 if set times val -f d_times; eval $csym; $val; then
19722         echo 'times() found.' >&4
19723         d_times="$define"
19724         inc=''
19725         case "$i_systimes" in
19726         "$define") inc='sys/times.h';;
19727         esac
19728         rp="What is the type returned by times() on this system?"
19729         set clock_t clocktype long stdio.h sys/types.h $inc
19730         eval $typedef_ask
19731 else
19732         echo 'times() NOT found, hope that will do.' >&4
19733         d_times="$undef"
19734         clocktype='int'
19735 fi
19736
19737 : see if tmpnam_r exists
19738 set tmpnam_r d_tmpnam_r
19739 eval $inlibc
19740 case "$d_tmpnam_r" in
19741 "$define")
19742         hdrs="$i_systypes sys/types.h define stdio.h "
19743         case "$d_tmpnam_r_proto:$usethreads" in
19744         ":define")      d_tmpnam_r_proto=define
19745                 set d_tmpnam_r_proto tmpnam_r $hdrs
19746                 eval $hasproto ;;
19747         *)      ;;
19748         esac
19749         case "$d_tmpnam_r_proto" in
19750         define)
19751         case "$tmpnam_r_proto" in
19752         ''|0) try='char* tmpnam_r(char*);'
19753         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19754         esac
19755         case "$tmpnam_r_proto" in
19756         ''|0)   d_tmpnam_r=undef
19757                 tmpnam_r_proto=0
19758                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19759         * )     case "$tmpnam_r_proto" in
19760                 REENTRANT_PROTO*) ;;
19761                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19762                 esac
19763                 echo "Prototype: $try" ;;
19764         esac
19765         ;;
19766         *)      case "$usethreads" in
19767                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19768                 esac
19769                 d_tmpnam_r=undef
19770                 tmpnam_r_proto=0
19771                 ;;
19772         esac
19773         ;;
19774 *)      tmpnam_r_proto=0
19775         ;;
19776 esac
19777
19778 : see if trunc exists
19779 set trunc d_trunc
19780 eval $inlibc
19781
19782 : see if truncate exists
19783 set truncate d_truncate
19784 eval $inlibc
19785
19786 : see if ttyname_r exists
19787 set ttyname_r d_ttyname_r
19788 eval $inlibc
19789 case "$d_ttyname_r" in
19790 "$define")
19791         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19792         case "$d_ttyname_r_proto:$usethreads" in
19793         ":define")      d_ttyname_r_proto=define
19794                 set d_ttyname_r_proto ttyname_r $hdrs
19795                 eval $hasproto ;;
19796         *)      ;;
19797         esac
19798         case "$d_ttyname_r_proto" in
19799         define)
19800         case "$ttyname_r_proto" in
19801         ''|0) try='int ttyname_r(int, char*, size_t);'
19802         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19803         esac
19804         case "$ttyname_r_proto" in
19805         ''|0) try='int ttyname_r(int, char*, int);'
19806         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19807         esac
19808         case "$ttyname_r_proto" in
19809         ''|0) try='char* ttyname_r(int, char*, int);'
19810         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19811         esac
19812         case "$ttyname_r_proto" in
19813         ''|0)   d_ttyname_r=undef
19814                 ttyname_r_proto=0
19815                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19816         * )     case "$ttyname_r_proto" in
19817                 REENTRANT_PROTO*) ;;
19818                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19819                 esac
19820                 echo "Prototype: $try" ;;
19821         esac
19822         ;;
19823         *)      case "$usethreads" in
19824                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19825                 esac
19826                 d_ttyname_r=undef
19827                 ttyname_r_proto=0
19828                 ;;
19829         esac
19830         ;;
19831 *)      ttyname_r_proto=0
19832         ;;
19833 esac
19834
19835 : see if tzname[] exists
19836 echo " "
19837 if set tzname val -a d_tzname; eval $csym; $val; then
19838         val="$define"
19839         echo 'tzname[] found.' >&4
19840 else
19841         val="$undef"
19842         echo 'tzname[] NOT found.' >&4
19843 fi
19844 set d_tzname
19845 eval $setvar
19846
19847 : Check if is a multiplatform env
19848 case "$osname" in
19849 darwin) multiarch="$define" ;;
19850 esac
19851 case "$multiarch" in
19852 ''|[nN]*) multiarch="$undef" ;;
19853 esac
19854
19855 : check for ordering of bytes in a UV
19856 echo " "
19857 case "$multiarch" in
19858 *$define*)
19859         $cat <<EOM
19860 You seem to be doing a multiarchitecture build,
19861 skipping the byteorder check.
19862
19863 EOM
19864         byteorder='ffff'
19865         ;;
19866 *)
19867         case "$byteorder" in
19868         '')
19869                 $cat <<'EOM'
19870 In the following, larger digits indicate more significance.  A big-endian
19871 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19872 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19873 machines may have weird orders like 3412.  A Cray will report 87654321,
19874 an Alpha will report 12345678. If the test program works the default is
19875 probably right.
19876 I'm now running the test program...
19877 EOM
19878                 $cat >try.c <<EOCP
19879 #include <stdio.h>
19880 #$i_stdlib I_STDLIB
19881 #ifdef I_STDLIB
19882 #include <stdlib.h>
19883 #endif
19884 #include <sys/types.h>
19885 typedef $uvtype UV;
19886 int main()
19887 {
19888         int i;
19889         union {
19890                 UV l;
19891                 char c[$uvsize];
19892         } u;
19893
19894         if ($uvsize > 4)
19895                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19896         else
19897                 u.l = (UV)0x04030201;
19898         for (i = 0; i < $uvsize; i++)
19899                 printf("%c", u.c[i]+'0');
19900         printf("\n");
19901         exit(0);
19902 }
19903 EOCP
19904                 xxx_prompt=y
19905                 set try
19906                 if eval $compile && $run ./try > /dev/null; then
19907                         dflt=`$run ./try`
19908                         case "$dflt" in
19909                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19910                                 echo "(The test program ran ok.)"
19911                                 echo "byteorder=$dflt"
19912                                 xxx_prompt=n
19913                         ;;
19914                         ????|????????) echo "(The test program ran ok.)" ;;
19915                         *) echo "(The test program didn't run right for some reason.)" ;;
19916                         esac
19917                 else
19918                         dflt='4321'
19919                         cat <<'EOM'
19920 (I can't seem to compile the test program.  Guessing big-endian...)
19921 EOM
19922                 fi
19923                 case "$xxx_prompt" in
19924                 y)
19925                         rp="What is the order of bytes in $uvtype?"
19926                         . ./myread
19927                         byteorder="$ans"
19928                         ;;
19929                 *)      byteorder=$dflt
19930                         ;;
19931                 esac
19932                 ;;
19933         esac
19934         $rm_try
19935         ;;
19936 esac
19937
19938 : Checking 32bit alignedness
19939 $cat <<EOM
19940
19941 Checking to see whether you can access character data unalignedly...
19942 EOM
19943 case "$d_u32align" in
19944 '')   $cat >try.c <<EOCP
19945 #include <stdio.h>
19946 #$i_stdlib I_STDLIB
19947 #ifdef I_STDLIB
19948 #include <stdlib.h>
19949 #endif
19950 #define U32 $u32type
19951 #define BYTEORDER 0x$byteorder
19952 #define U8 $u8type
19953 #include <signal.h>
19954 #ifdef SIGBUS
19955 $signal_t bletch(int s) { exit(4); }
19956 #endif
19957 int main() {
19958 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19959     volatile U8 buf[8];
19960     volatile U32 *up;
19961     int i;
19962
19963     if (sizeof(U32) != 4) {
19964         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19965         exit(1);
19966     }
19967
19968     fflush(stdout);
19969
19970 #ifdef SIGBUS
19971     signal(SIGBUS, bletch);
19972 #endif
19973
19974     buf[0] = 0;
19975     buf[1] = 0;
19976     buf[2] = 0;
19977     buf[3] = 1;
19978     buf[4] = 0;
19979     buf[5] = 0;
19980     buf[6] = 0;
19981     buf[7] = 1;
19982
19983     for (i = 0; i < 4; i++) {
19984         up = (U32*)(buf + i);
19985         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19986                (*up == 1 << (8*(3-i)))  /* little-endian */
19987               )
19988            )
19989         {
19990             printf("read failed (%x)\n", *up);
19991             exit(2);
19992         }
19993     }
19994
19995     /* write test */
19996     for (i = 0; i < 4; i++) {
19997         up = (U32*)(buf + i);
19998         *up = 0xBeef;
19999         if (*up != 0xBeef) {
20000             printf("write failed (%x)\n", *up);
20001             exit(3);
20002         }
20003     }
20004
20005     exit(0);
20006 #else
20007     printf("1\n");
20008     exit(1);
20009 #endif
20010     return 0;
20011 }
20012 EOCP
20013 set try
20014 if eval $compile_ok; then
20015         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
20016         $run ./try 2>&1 >/dev/null
20017         case "$?" in
20018         0)      cat >&4 <<EOM
20019 You can access character data pretty unalignedly.
20020 EOM
20021                 d_u32align="$undef"
20022                 ;;
20023         *)      cat >&4 <<EOM
20024 It seems that you must access character data in an aligned manner.
20025 EOM
20026                 d_u32align="$define"
20027                 ;;
20028         esac
20029 else
20030         rp='Can you access character data at unaligned addresses?'
20031         dflt='n'
20032         . ./myread
20033         case "$ans" in
20034         [yY]*)  d_u32align="$undef"  ;;
20035         *)      d_u32align="$define" ;;
20036         esac
20037 fi
20038 $rm_try
20039 ;;
20040 esac
20041
20042 : see if ualarm exists
20043 set ualarm d_ualarm
20044 eval $inlibc
20045
20046 : see if umask exists
20047 set umask d_umask
20048 eval $inlibc
20049
20050 : see if unordered exists
20051 set unordered d_unordered
20052 eval $inlibc
20053
20054 : see if unsetenv exists
20055 set unsetenv d_unsetenv
20056 eval $inlibc
20057
20058 : see if usleep exists
20059 set usleep d_usleep
20060 eval $inlibc
20061
20062 : see if prototype for usleep is available
20063 echo " "
20064 set d_usleepproto usleep $i_unistd unistd.h
20065 eval $hasproto
20066
20067 : see if ustat exists
20068 set ustat d_ustat
20069 eval $inlibc
20070
20071 : see if closedir exists
20072 set closedir d_closedir
20073 eval $inlibc
20074
20075 case "$d_closedir" in
20076 "$define")
20077         echo " "
20078         echo "Checking whether closedir() returns a status..." >&4
20079         cat > try.c <<EOM
20080 #$i_dirent I_DIRENT             /**/
20081 #$i_sysdir I_SYS_DIR            /**/
20082 #$i_sysndir I_SYS_NDIR          /**/
20083 #$i_systypes I_SYS_TYPES        /**/
20084
20085 #if defined(I_SYS_TYPES)
20086 #include <sys/types.h>
20087 #endif
20088 #if defined(I_DIRENT)
20089 #include <dirent.h>
20090 #else
20091 #ifdef I_SYS_NDIR
20092 #include <sys/ndir.h>
20093 #else
20094 #ifdef I_SYS_DIR
20095 #ifdef hp9000s500
20096 #include <ndir.h>       /* may be wrong in the future */
20097 #else
20098 #include <sys/dir.h>
20099 #endif
20100 #endif
20101 #endif
20102 #endif
20103 int main() { return closedir(opendir(".")); }
20104 EOM
20105         set try
20106         if eval $compile_ok; then
20107                 if $run ./try > /dev/null 2>&1 ; then
20108                         echo "Yes, it does."
20109                         val="$undef"
20110                 else
20111                         echo "No, it doesn't."
20112                         val="$define"
20113                 fi
20114         else
20115                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20116                 val="$define"
20117         fi
20118         ;;
20119 *)
20120         val="$undef";
20121         ;;
20122 esac
20123 set d_void_closedir
20124 eval $setvar
20125 $rm_try
20126
20127 : see if there is a wait4
20128 set wait4 d_wait4
20129 eval $inlibc
20130
20131 : see if waitpid exists
20132 set waitpid d_waitpid
20133 eval $inlibc
20134
20135 : look for wcscmp
20136 echo " "
20137 $cat >try.c <<'EOCP'
20138 #include <stdio.h>
20139 #include <wchar.h>
20140 int main ()
20141 {
20142     wchar_t *s = L" ";
20143     return (wcscmp (s, s) ? 1 : 0);
20144     }
20145 EOCP
20146 set try
20147 val="$undef"
20148 if eval $compile; then
20149     `$run ./try`
20150     case "$?" in
20151         0)  echo "A working wcscmp() found." >&4
20152             val="$define" ;;
20153         *)  echo "wcscmp() found, but it doesn't work" >&4
20154             ;;
20155         esac
20156 else
20157     echo "wcscmp() NOT found." >&4
20158     fi
20159 set d_wcscmp
20160 eval $setvar
20161 $rm_try
20162
20163 : see if wcstombs exists
20164 set wcstombs d_wcstombs
20165 eval $inlibc
20166
20167 : look for wcsxfrm
20168 echo " "
20169 $cat >try.c <<'EOCP'
20170 #include <errno.h>
20171 #include <wchar.h>
20172 int main ()
20173 {
20174     wchar_t dst[4], *src = L" ";
20175     errno = 0;
20176     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20177     }
20178 EOCP
20179 set try
20180 val="$undef"
20181 if eval $compile; then
20182     `$run ./try`
20183     case "$?" in
20184         0)  echo "A working wcsxfrm() found." >&4
20185             val="$define" ;;
20186         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20187             ;;
20188         esac
20189 else
20190     echo "wcsxfrm() NOT found." >&4
20191     fi
20192 set d_wcsxfrm
20193 eval $setvar
20194 $rm_try
20195
20196 : see if wctomb exists
20197 set wctomb d_wctomb
20198 eval $inlibc
20199
20200 : see if writev exists
20201 set writev d_writev
20202 eval $inlibc
20203
20204 : check for alignment requirements
20205 echo " "
20206 case "$alignbytes" in
20207     '') echo "Checking alignment constraints..." >&4
20208         $cat >try.c <<EOCP
20209 #include <stdio.h>
20210 struct foobar {
20211     char foo;
20212     $nvtype bar;
20213 } try_algn;
20214 int main()
20215 {
20216     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20217     return(0);
20218 }
20219 EOCP
20220         set try
20221         if eval $compile_ok; then
20222             dflt=`$run ./try`
20223         else
20224             dflt='8'
20225             echo "(I can't seem to compile the test program...)"
20226         fi
20227         case "$multiarch" in
20228             *$define*)
20229                 : The usual safe value is 8, but Darwin with -Duselongdouble
20230                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20231                 : Configure to pick a larger value if needed.
20232                 if $test "$dflt" -lt 8; then
20233                     dflt='8'
20234                     echo "Setting alignment to 8 for multiarch support.">&4
20235                 fi
20236                 ;;
20237         esac
20238         ;;
20239     *) dflt="$alignbytes"
20240         ;;
20241 esac
20242 rp="Doubles must be aligned on a how-many-byte boundary?"
20243 . ./myread
20244 alignbytes="$ans"
20245 $rm_try
20246
20247 : set the base revision
20248 baserev=5.0
20249
20250 : length of character in bytes. Is always 1, otherwise it is not C
20251 : This used to be a test using sizeof
20252 charsize=1
20253
20254 : Check for the number of bits in a character
20255 case "$charbits" in
20256 '')     echo "Checking how long a character is (in bits)..." >&4
20257         $cat >try.c <<EOCP
20258 #include <stdio.h>
20259 int main ()
20260 {
20261     int n;
20262     unsigned char c;
20263     for (c = 1, n = 0; c; c <<= 1, n++) ;
20264     printf ("%d\n", n);
20265     return (0);
20266     }
20267 EOCP
20268         set try
20269         if eval $compile_ok; then
20270                 dflt=`$run ./try`
20271         else
20272                 dflt='8'
20273                 echo "(I can't seem to compile the test program.  Guessing...)"
20274         fi
20275         ;;
20276 *)
20277         dflt="$charbits"
20278         ;;
20279 esac
20280 rp="What is the length of a character (in bits)?"
20281 . ./myread
20282 charbits="$ans"
20283 $rm_try
20284 case "$charbits" in
20285 8)      ;;
20286 *)      cat >&4 << EOM
20287 Your system has an unsigned character size of $charbits bits, which
20288 is rather unusual (normally it is 8 bits).  Perl likely will not work
20289 correctly on your system, with subtle bugs in various places.
20290 EOM
20291         rp='Do you really want to continue?'
20292         dflt='n'
20293         . ./myread
20294         case "$ans" in
20295                 [yY])   echo >&4 "Okay, continuing."    ;;
20296                 *)      exit 1                          ;;
20297         esac
20298 esac
20299
20300 : how do we concatenate cpp tokens here?
20301 echo " "
20302 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20303 $cat >cpp_stuff.c <<'EOCP'
20304 #define RCAT(a,b)a/**/b
20305 #define ACAT(a,b)a ## b
20306 RCAT(Rei,ser)
20307 ACAT(Cir,cus)
20308 EOCP
20309 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20310 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20311         echo "Oh!  Smells like ANSI's been here." >&4
20312         echo "We can catify or stringify, separately or together!"
20313         cpp_stuff=42
20314 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20315         echo "Ah, yes!  The good old days!" >&4
20316         echo "However, in the good old days we don't know how to stringify and"
20317         echo "catify at the same time."
20318         cpp_stuff=1
20319 else
20320         $cat >&4 <<EOM
20321 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20322 You're going to have to edit the values of CAT[2-5] in config.h...
20323 EOM
20324         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20325 fi
20326 $rm -f cpp_stuff.*
20327
20328 : see if this is a db.h system
20329 set db.h i_db
20330 eval $inhdr
20331
20332 case "$i_db" in
20333 $define)
20334         : Check db version.
20335         echo " "
20336         echo "Checking Berkeley DB version ..." >&4
20337         $cat >try.c <<EOCP
20338 #$d_const HASCONST
20339 #ifndef HASCONST
20340 #define const
20341 #endif
20342 #include <sys/types.h>
20343 #include <stdio.h>
20344 #$i_stdlib I_STDLIB
20345 #ifdef I_STDLIB
20346 #include <stdlib.h>
20347 #endif
20348 #include <db.h>
20349 int main(int argc, char *argv[])
20350 {
20351 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20352     int Major, Minor, Patch ;
20353     unsigned long Version ;
20354     (void)db_version(&Major, &Minor, &Patch) ;
20355     if (argc == 2) {
20356         printf("%d %d %d %d %d %d\n",
20357                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20358                Major, Minor, Patch);
20359         exit(0);
20360     }
20361     printf("You have Berkeley DB Version 2 or greater.\n");
20362
20363     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20364                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20365     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20366                 Major, Minor, Patch) ;
20367
20368     /* check that db.h & libdb are compatible */
20369     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20370         printf("db.h and libdb are incompatible.\n") ;
20371         exit(3);
20372     }
20373
20374     printf("db.h and libdb are compatible.\n") ;
20375
20376     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20377                 + DB_VERSION_PATCH ;
20378
20379     /* needs to be >= 2.3.4 */
20380     if (Version < 2003004) {
20381     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20382         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20383         exit(2);
20384     }
20385
20386     exit(0);
20387 #else
20388 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20389     if (argc == 2) {
20390         printf("1 0 0\n");
20391         exit(0);
20392     }
20393     printf("You have Berkeley DB Version 1.\n");
20394     exit(0);    /* DB version < 2: the coast is clear. */
20395 #else
20396     exit(1);    /* <db.h> not Berkeley DB? */
20397 #endif
20398 #endif
20399 }
20400 EOCP
20401         set try
20402         if eval $compile_ok && $run ./try; then
20403                 echo 'Looks OK.' >&4
20404                 set `$run ./try 1`
20405                 db_version_major=$1
20406                 db_version_minor=$2
20407                 db_version_patch=$3
20408         else
20409                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20410                 i_db=$undef
20411                 case " $libs " in
20412                 *"-ldb "*)
20413                         : Remove db from list of libraries to use
20414                         echo "Removing unusable -ldb from library list" >&4
20415                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20416                         shift
20417                         libs="$*"
20418                         echo "libs = $libs" >&4
20419                         ;;
20420                 esac
20421         fi
20422         $rm_try
20423         ;;
20424 esac
20425
20426 case "$i_db" in
20427 define)
20428         : Check the return type needed for hash
20429         echo " "
20430         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20431         $cat >try.c <<EOCP
20432 #$d_const HASCONST
20433 #ifndef HASCONST
20434 #define const
20435 #endif
20436 #include <sys/types.h>
20437 #include <db.h>
20438
20439 #ifndef DB_VERSION_MAJOR
20440 u_int32_t hash_cb (const void* ptr, size_t size)
20441 {
20442 }
20443 HASHINFO info;
20444 int main()
20445 {
20446         info.hash = hash_cb;
20447 }
20448 #endif
20449 EOCP
20450         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20451                 if $contains warning try.out >>/dev/null 2>&1 ; then
20452                         db_hashtype='int'
20453                 else
20454                         db_hashtype='u_int32_t'
20455                 fi
20456         else
20457                 : XXX Maybe we should just give up here.
20458                 db_hashtype=u_int32_t
20459                 $cat try.out >&4
20460                 echo "Help:  I can't seem to compile the db test program." >&4
20461                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20462         fi
20463         $rm_try
20464         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20465         ;;
20466 *)      db_hashtype=u_int32_t
20467         ;;
20468 esac
20469 case "$i_db" in
20470 define)
20471         : Check the return type needed for prefix
20472         echo " "
20473         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20474         cat >try.c <<EOCP
20475 #$d_const HASCONST
20476 #ifndef HASCONST
20477 #define const
20478 #endif
20479 #include <sys/types.h>
20480 #include <db.h>
20481
20482 #ifndef DB_VERSION_MAJOR
20483 size_t prefix_cb (const DBT *key1, const DBT *key2)
20484 {
20485 }
20486 BTREEINFO info;
20487 int main()
20488 {
20489         info.prefix = prefix_cb;
20490 }
20491 #endif
20492 EOCP
20493         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20494                 if $contains warning try.out >>/dev/null 2>&1 ; then
20495                         db_prefixtype='int'
20496                 else
20497                         db_prefixtype='size_t'
20498                 fi
20499         else
20500                 db_prefixtype='size_t'
20501                 : XXX Maybe we should just give up here.
20502                 $cat try.out >&4
20503                 echo "Help:  I can't seem to compile the db test program." >&4
20504                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20505         fi
20506         $rm_try
20507         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20508         ;;
20509 *)      db_prefixtype='size_t'
20510         ;;
20511 esac
20512
20513 : Check what kind of inf/nan your system has
20514 $echo "Checking the kind of infinities and nans you have..." >&4
20515 $cat >try.c <<EOP
20516 #define DOUBLESIZE $doublesize
20517 #$d_longdbl HAS_LONG_DOUBLE
20518 #ifdef HAS_LONG_DOUBLE
20519 #define LONGDBLSIZE $longdblsize
20520 #define LONGDBLKIND $longdblkind
20521 #endif
20522 #$i_math I_MATH
20523 #ifdef I_MATH
20524 #include <math.h>
20525 #endif
20526 #include <stdio.h>
20527 /* Note that whether the sign bit is on or off
20528  * for NaN depends on the CPU/FPU, and possibly
20529  * can be affected by the build toolchain.
20530  *
20531  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20532  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20533  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20534  * (respectively) as opposed to the more usual
20535  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20536  */
20537 static void bytes(unsigned char *p, unsigned int n) {
20538   int i;
20539   for (i = 0; i < n; i++) {
20540     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20541   }
20542 }
20543 int main(int argc, char *argv[]) {
20544    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20545     * because some compilers are 'smart' and not only warn but refuse to
20546     * compile such 'illegal' values. */
20547    double dinf = exp(1e9);
20548    double dnan = sqrt(-1.0);
20549 #ifdef HAS_LONG_DOUBLE
20550    long double ldinf = (long double)exp(1e9);
20551    long double ldnan = (long double)sqrt(-1.0);
20552 #endif
20553   if (argc == 2) {
20554     switch (argv[1][0]) {
20555     case '1': bytes(&dinf, sizeof(dinf)); break;
20556     case '2': bytes(&dnan, sizeof(dnan)); break;
20557 #ifdef HAS_LONG_DOUBLE
20558 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20559 /* the 80-bit long doubles might have garbage in their excess bytes */
20560     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20561 # endif
20562     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20563     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20564 #endif
20565     }
20566   }
20567   return 0;
20568 }
20569 EOP
20570 set try
20571 if eval $compile; then
20572     doubleinfbytes=`$run ./try 1`
20573     doublenanbytes=`$run ./try 2`
20574     case "$d_longdbl" in
20575     $define)
20576       longdblinfbytes=`$run ./try 3`
20577       longdblnanbytes=`$run ./try 4`
20578       ;;
20579     esac
20580 else
20581     # Defaults in case the above test program failed.
20582     case "$doublekind" in
20583     1) # IEEE 754 32-bit LE
20584        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20585        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20586        ;;
20587     2) # IEEE 754 32-bit BE
20588        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20589        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20590        ;;
20591     3) # IEEE 754 64-bit LE
20592        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20593        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20594        ;;
20595     4) # IEEE 754 64-bit BE
20596        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20597        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20598        ;;
20599     5) # IEEE 754 128-bit LE
20600        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20601        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20602        ;;
20603     6) # IEEE 754 128-bit BE
20604        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20605        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20606        ;;
20607     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20608        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20609        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20610        ;;
20611     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20612        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20613        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20614        ;;
20615     *) # No idea.
20616        doubleinfbytes=$undef
20617        doublenanbytes=$undef
20618        ;;
20619     esac
20620     case "$longdblkind" in
20621     1) # IEEE 754 128-bit LE
20622        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20623        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20624        ;;
20625     2) # IEEE 754 128-bit BE
20626        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20627        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20628        ;;
20629     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20630        case "$longdblsize" in
20631        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20632            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20633            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20634            ;;
20635        16) # x86_64
20636            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20637            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20638            ;;
20639        *)  # No idea.
20640            longdblinfbytes=$undef
20641            longdblnanbytes=$undef
20642        ;;
20643        esac
20644        ;;
20645     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20646        case "$longdblsize" in
20647        12) # 32-bit system
20648            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20649            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20650            ;;
20651        16) # 64-bit system
20652            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20653            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20654            ;;
20655        *)  # No idea.
20656            longdblinfbytes=$undef
20657            longdblnanbytes=$undef
20658        ;;
20659        esac
20660        ;;
20661     5) # 128-bit LE-LE "double double"
20662        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20663        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20664        ;;
20665     6) # 128-bit BE-BE "double double"
20666        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20667        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20668        ;;
20669     7) # 128-bit LE-BE "double double"
20670        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20671        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20672        ;;
20673     8) # 128-bit BE-LE "double double"
20674        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20675        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20676        ;;
20677     *) # No idea.
20678        longdblinfbytes=$undef
20679        longdblnanbytes=$undef
20680        ;;
20681     esac
20682 fi
20683 $rm_try
20684
20685 : Check the length of the double mantissa
20686 $echo "Checking how many mantissa bits your doubles have..." >&4
20687 $cat >try.c <<EOP
20688 #$i_float I_FLOAT
20689 #$i_sunmath I_SUNMATH
20690 #ifdef I_FLOAT
20691 # include <float.h>
20692 #endif
20693 #ifdef I_SUNMATH
20694 # include <sunmath.h>
20695 #endif
20696 #ifdef DBL_MANT_DIG
20697 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20698 #endif
20699 #include <stdio.h>
20700 int main(int argc, char *argv[]) {
20701 #ifdef BITS
20702   printf("%d\n", BITS);
20703 #endif
20704   return 0;
20705 }
20706 EOP
20707 set try
20708 if eval $compile; then
20709     doublemantbits=`$run ./try`
20710 else
20711     doublemantbits="$undef"
20712 fi
20713 $rm_try
20714
20715 : Check the length of the longdouble mantissa
20716 $echo "Checking how many mantissa bits your long doubles have..." >&4
20717 $cat >try.c <<EOP
20718 #$i_float I_FLOAT
20719 #$i_sunmath I_SUNMATH
20720 #ifdef I_FLOAT
20721 # include <float.h>
20722 #endif
20723 #ifdef I_SUNMATH
20724 # include <sunmath.h>
20725 #endif
20726 #$d_longdbl HAS_LONG_DOUBLE
20727 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20728 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20729 /* This format has no implicit bit.  Beware, however, that for
20730  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20731  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20732  * and the top bit must have been one since 387, zero is plain invalid.
20733  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20734 #  define BITS LDBL_MANT_DIG
20735 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20736 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20737  * reason e.g. Irix thinks 107.  But in any case, we want only
20738  * the number of real bits, the implicit bits are of no interest.  */
20739 #  define BITS 2 * (DBL_MANT_DIG - 1)
20740 # else
20741 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20742 # endif
20743 #endif
20744 #include <stdio.h>
20745 int main(int argc, char *argv[]) {
20746 #ifdef BITS
20747   printf("%d\n", BITS);
20748 #endif
20749   return 0;
20750 }
20751 EOP
20752 set try
20753 if eval $compile; then
20754     longdblmantbits=`$run ./try`
20755 else
20756     longdblmantbits="$undef"
20757 fi
20758 $rm_try
20759
20760 : Check the length of the NV mantissa
20761 $echo "Checking how many mantissa bits your NVs have..." >&4
20762 if test "X$usequadmath" = "X$define"; then
20763   nvmantbits=112 # 128-1-15
20764 else
20765   if test "X$nvsize" = "X$doublesize"; then
20766     nvmantbits="$doublemantbits"
20767   else
20768      if test "X$nvsize" = "X$longdblsize"; then
20769        nvmantbits="$longdblmantbits"
20770      else
20771        nvmantbits="$undef"
20772      fi
20773   fi
20774 fi
20775
20776 : How can we generate normalized random numbers ?
20777 echo " "
20778 echo "Using our internal random number implementation..." >&4
20779
20780 case "$ccflags" in
20781 *-Dmy_rand=*|*-Dmy_srand=*)
20782         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20783         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20784         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20785         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20786         ;;
20787 esac
20788
20789 randfunc=Perl_drand48
20790 drand01="Perl_drand48()"
20791 seedfunc="Perl_drand48_init"
20792 randbits=48
20793 randseedtype=U32
20794
20795 : Probe whether dtrace builds an object, as newer Illumos requires an input
20796 : object file that uses at least one of the probes defined in the .d file
20797 case "$usedtrace" in
20798 $define)
20799     case "$dtraceobject" in
20800     $define|true|[yY]*)
20801         dtraceobject=$define
20802         ;;
20803     ' '|'')
20804         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20805         $cat >try.c <<EOM
20806 #include "perldtrace.h"
20807 int main(void) {
20808     PERL_LOADED_FILE("dummy");
20809     return 0;
20810 }
20811 EOM
20812         dtraceobject=$undef
20813         if $cc -c -o try.o $optimize $ccflags try.c \
20814                     && $dtrace -G -s ../perldtrace.d try.o >/dev/null 2>&1; then
20815                 dtraceobject=$define
20816             echo "Your dtrace builds an object file"
20817         fi
20818         $rm -f try.c try.o perldtrace.o
20819         ;;
20820     *) dtraceobject=$undef ;;
20821     esac
20822 esac
20823
20824 : Determine if this is an EBCDIC system
20825 echo " "
20826 echo "Determining whether or not we are on an EBCDIC system..." >&4
20827 $cat >try.c <<'EOM'
20828 int main()
20829 {
20830   if ('M'==0xd4) return 0;
20831   return 1;
20832 }
20833 EOM
20834
20835 val=$undef
20836 set try
20837 if eval $compile_ok; then
20838         if $run ./try; then
20839                 echo "You seem to speak EBCDIC." >&4
20840                 val="$define"
20841         else
20842                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20843         fi
20844 else
20845         echo "I'm unable to compile the test program." >&4
20846         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20847 fi
20848 $rm_try
20849 set ebcdic
20850 eval $setvar
20851
20852 : Check how to flush
20853 echo " "
20854 $cat >&4 <<EOM
20855 Checking how to flush all pending stdio output...
20856 EOM
20857 # I only know how to find the first 32 possibly open files on SunOS.
20858 # See also hints/sunos_4_1.sh and util.c  --AD
20859 case "$osname" in
20860 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20861 esac
20862 $cat >>try.c <<EOCP
20863 #include <stdio.h>
20864 #$i_stdlib I_STDLIB
20865 #ifdef I_STDLIB
20866 #include <stdlib.h>
20867 #endif
20868 #$i_unistd I_UNISTD
20869 #ifdef I_UNISTD
20870 # include <unistd.h>
20871 #endif
20872 #$d_sysconf HAS_SYSCONF
20873 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20874 #ifdef HAS_STDIO_STREAM_ARRAY
20875 # define STDIO_STREAM_ARRAY $stdio_stream_array
20876 #endif
20877 int main() {
20878   FILE* p;
20879   unlink("try.out");
20880   p = fopen("try.out", "w");
20881 #ifdef TRY_FPUTC
20882   fputc('x', p);
20883 #else
20884 # ifdef TRY_FPRINTF
20885   fprintf(p, "x");
20886 # endif
20887 #endif
20888 #ifdef TRY_FFLUSH_NULL
20889   fflush(NULL);
20890 #endif
20891 #ifdef TRY_FFLUSH_ALL
20892   {
20893     long open_max = -1;
20894 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20895     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20896 # else
20897 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20898     open_max = sysconf(_SC_OPEN_MAX);
20899 #  else
20900 #   ifdef FOPEN_MAX
20901     open_max = FOPEN_MAX;
20902 #   else
20903 #    ifdef OPEN_MAX
20904     open_max = OPEN_MAX;
20905 #    else
20906 #     ifdef _NFILE
20907     open_max = _NFILE;
20908 #     endif
20909 #    endif
20910 #   endif
20911 #  endif
20912 # endif
20913 # ifdef HAS_STDIO_STREAM_ARRAY
20914     if (open_max > 0) {
20915       long i;
20916       for (i = 0; i < open_max; i++)
20917             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20918                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20919                 STDIO_STREAM_ARRAY[i]._flag)
20920                 fflush(&STDIO_STREAM_ARRAY[i]);
20921     }
20922   }
20923 # endif
20924 #endif
20925   _exit(42);
20926 }
20927 EOCP
20928 : first we have to find out how _not_ to flush
20929 $to try.c
20930 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20931     output=''
20932     set try -DTRY_FPUTC
20933     if eval $compile; then
20934             $run ./try 2>/dev/null
20935             code="$?"
20936             $from try.out
20937             if $test ! -s try.out -a "X$code" = X42; then
20938                 output=-DTRY_FPUTC
20939             fi
20940     fi
20941     case "$output" in
20942     '')
20943             set try -DTRY_FPRINTF
20944             if eval $compile; then
20945                     $run ./try 2>/dev/null
20946                     code="$?"
20947                     $from try.out
20948                     if $test ! -s try.out -a "X$code" = X42; then
20949                         output=-DTRY_FPRINTF
20950                     fi
20951             fi
20952         ;;
20953     esac
20954 fi
20955 : check for fflush NULL behavior
20956 case "$fflushNULL" in
20957 '')     set try -DTRY_FFLUSH_NULL $output
20958         if eval $compile; then
20959                 $run ./try 2>/dev/null
20960                 code="$?"
20961                 $from try.out
20962                 if $test -s try.out -a "X$code" = X42; then
20963                         fflushNULL="`$cat try.out`"
20964                 else
20965                         if $test "X$code" != X42; then
20966                                 $cat >&4 <<EOM
20967 (If this test failed, don't worry, we'll try another method shortly.)
20968 EOM
20969                         fi
20970                 fi
20971         fi
20972         $rm -f core try.core core.try.*
20973         case "$fflushNULL" in
20974         x)      $cat >&4 <<EOM
20975 Your fflush(NULL) works okay for output streams.
20976 Let's see if it clobbers input pipes...
20977 EOM
20978 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20979 # bug that improperly flushes the input end of pipes.  So we avoid the
20980 # autoflush on fork/system/exec support for now. :-(
20981 $cat >tryp.c <<EOCP
20982 #include <stdio.h>
20983 int
20984 main(int argc, char **argv)
20985 {
20986     char buf[1024];
20987     int i;
20988     char *bp = buf;
20989     while (1) {
20990         while ((i = getc(stdin)) != -1
20991                && (*bp++ = i) != '\n'
20992                && bp < &buf[1024])
20993         /* DO NOTHING */ ;
20994         *bp = '\0';
20995         fprintf(stdout, "%s", buf);
20996         fflush(NULL);
20997         if (i == -1)
20998             return 0;
20999         bp = buf;
21000     }
21001 }
21002 EOCP
21003                 fflushNULL="$define"
21004                 set tryp
21005                 if eval $compile; then
21006                     $rm -f tryp.out
21007                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
21008                     if $test "X$targethost" != X; then
21009                         $to tryp.c
21010                         $to tryp
21011                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21012                     else
21013                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21014                     fi
21015                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
21016                        $cat >&4 <<EOM
21017 fflush(NULL) seems to behave okay with input streams.
21018 EOM
21019                         fflushNULL="$define"
21020                     else
21021                         $cat >&4 <<EOM
21022 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
21023 EOM
21024                         fflushNULL="$undef"
21025                     fi
21026                 fi
21027                 $rm -f core tryp.c tryp.core core.tryp.*
21028                 ;;
21029         '')     $cat >&4 <<EOM
21030 Your fflush(NULL) isn't working (contrary to ANSI C).
21031 EOM
21032                 fflushNULL="$undef"
21033                 ;;
21034         *)      $cat >&4 <<EOM
21035 Cannot figure out whether your fflush(NULL) works or not.
21036 I'm assuming it doesn't (contrary to ANSI C).
21037 EOM
21038                 fflushNULL="$undef"
21039                 ;;
21040         esac
21041         ;;
21042 $define|true|[yY]*)
21043         fflushNULL="$define"
21044         ;;
21045 *)
21046         fflushNULL="$undef"
21047         ;;
21048 esac
21049 : check explicit looping only if NULL did not work, and if the pipe
21050 : bug does not show up on an explicit flush too
21051 case "$fflushNULL" in
21052 "$undef")
21053         $cat >tryp.c <<EOCP
21054 #include <stdio.h>
21055 int
21056 main(int argc, char **argv)
21057 {
21058     char buf[1024];
21059     int i;
21060     char *bp = buf;
21061     while (1) {
21062         while ((i = getc(stdin)) != -1
21063                && (*bp++ = i) != '\n'
21064                && bp < &buf[1024])
21065         /* DO NOTHING */ ;
21066         *bp = '\0';
21067         fprintf(stdout, "%s", buf);
21068         fflush(stdin);
21069         if (i == -1)
21070             return 0;
21071         bp = buf;
21072     }
21073 }
21074 EOCP
21075         set tryp
21076         if eval $compile; then
21077             $rm -f tryp.out
21078             if $test "X$targethost" != X; then
21079                 $to tryp.c
21080                 $to tryp
21081                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21082             else
21083                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21084             fi
21085             if cmp tryp.c tryp.out >/dev/null 2>&1; then
21086                $cat >&4 <<EOM
21087 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21088 EOM
21089                 : now check for fflushall behaviour
21090                 case "$fflushall" in
21091                 '')     set try -DTRY_FFLUSH_ALL $output
21092                         if eval $compile; then
21093                                 $cat >&4 <<EOM
21094 (Now testing the other method--but note that this also may fail.)
21095 EOM
21096                                 $run ./try 2>/dev/null
21097                                 code=$?
21098                                 $from try.out
21099                                 if $test -s try.out -a "X$code" = X42; then
21100                                         fflushall="`$cat try.out`"
21101                                 fi
21102                         fi
21103                         $rm_try
21104                         case "$fflushall" in
21105                         x)      $cat >&4 <<EOM
21106 Whew. Flushing explicitly all the stdio streams works.
21107 EOM
21108                                 fflushall="$define"
21109                                 ;;
21110                         '')     $cat >&4 <<EOM
21111 Sigh. Flushing explicitly all the stdio streams doesn't work.
21112 EOM
21113                                 fflushall="$undef"
21114                                 ;;
21115                         *)      $cat >&4 <<EOM
21116 Cannot figure out whether flushing stdio streams explicitly works or not.
21117 I'm assuming it doesn't.
21118 EOM
21119                                 fflushall="$undef"
21120                                 ;;
21121                         esac
21122                         ;;
21123                 "$define"|true|[yY]*)
21124                         fflushall="$define"
21125                         ;;
21126                 *)
21127                         fflushall="$undef"
21128                         ;;
21129                 esac
21130             else
21131                 $cat >&4 <<EOM
21132 All is futile.  Even fflush(stdin) clobbers input pipes!
21133 EOM
21134                 fflushall="$undef"
21135             fi
21136         else
21137             fflushall="$undef"
21138         fi
21139         $rm -f core tryp.c tryp.core core.tryp.*
21140         ;;
21141 *)      fflushall="$undef"
21142         ;;
21143 esac
21144
21145 case "$fflushNULL$fflushall" in
21146 undefundef)
21147         $cat <<EOM
21148 OK, I give up.  I cannot figure out how to flush pending stdio output.
21149 We won't be flushing handles at all before fork/exec/popen.
21150 EOM
21151         ;;
21152 esac
21153 $rm_try tryp
21154
21155 : Store the full pathname to the ar program for use in the C program
21156 : Respect a hint or command line value for full_ar.
21157 case "$full_ar" in
21158 '') full_ar=$ar ;;
21159 esac
21160
21161 : Store the full pathname to the sed program for use in the C program
21162 full_sed=$sed
21163
21164 : see what type gids are declared as in the kernel
21165 echo " "
21166 echo "Looking for the type for group ids returned by getgid()."
21167 set gid_t gidtype xxx stdio.h sys/types.h
21168 eval $typedef
21169 case "$gidtype" in
21170 xxx)
21171         xxx=`./findhdr sys/user.h`
21172         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21173         case $1 in
21174         unsigned) dflt="$1 $2" ;;
21175         *) dflt="$1" ;;
21176         esac
21177         ;;
21178 *) dflt="$gidtype";;
21179 esac
21180 case "$gidtype" in
21181 gid_t) echo "gid_t found." ;;
21182 *)      rp="What is the type for group ids returned by getgid()?"
21183         . ./myread
21184         gidtype="$ans"
21185         ;;
21186 esac
21187
21188 : Check the size of GID
21189 echo " "
21190 case "$gidtype" in
21191 *_t) zzz="$gidtype"     ;;
21192 *)   zzz="gid"          ;;
21193 esac
21194 echo "Checking the size of $zzz..." >&4
21195 cat > try.c <<EOCP
21196 #include <sys/types.h>
21197 #include <stdio.h>
21198 #$i_stdlib I_STDLIB
21199 #ifdef I_STDLIB
21200 #include <stdlib.h>
21201 #endif
21202 int main() {
21203     printf("%d\n", (int)sizeof($gidtype));
21204     exit(0);
21205 }
21206 EOCP
21207 set try
21208 if eval $compile_ok; then
21209         yyy=`$run ./try`
21210         case "$yyy" in
21211         '')     gidsize=4
21212                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21213                 ;;
21214         *)      gidsize=$yyy
21215                 echo "Your $zzz is $gidsize bytes long."
21216                 ;;
21217         esac
21218 else
21219         gidsize=4
21220         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21221 fi
21222
21223
21224 : Check if GID is signed
21225 echo " "
21226 case "$gidtype" in
21227 *_t) zzz="$gidtype"     ;;
21228 *)   zzz="gid"          ;;
21229 esac
21230 echo "Checking the sign of $zzz..." >&4
21231 cat > try.c <<EOCP
21232 #include <sys/types.h>
21233 #include <stdio.h>
21234 int main() {
21235         $gidtype foo = -1;
21236         if (foo < 0)
21237                 printf("-1\n");
21238         else
21239                 printf("1\n");
21240 }
21241 EOCP
21242 set try
21243 if eval $compile; then
21244         yyy=`$run ./try`
21245         case "$yyy" in
21246         '')     gidsign=1
21247                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21248                 ;;
21249         *)      gidsign=$yyy
21250                 case "$gidsign" in
21251                  1) echo "Your $zzz is unsigned." ;;
21252                 -1) echo "Your $zzz is signed."   ;;
21253                 esac
21254                 ;;
21255         esac
21256 else
21257         gidsign=1
21258         echo "(I can't compile the test program--guessing unsigned.)" >&4
21259 fi
21260
21261
21262 : Check 64bit sizes
21263 echo " "
21264
21265 if $test X"$quadtype" != X; then
21266
21267 echo "Checking how to print 64-bit integers..." >&4
21268
21269 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21270         $cat >try.c <<'EOCP'
21271 #include <sys/types.h>
21272 #include <stdio.h>
21273 int main() {
21274   int q = 12345678901;
21275   printf("%ld\n", q);
21276 }
21277 EOCP
21278         set try
21279         if eval $compile; then
21280                 yyy=`$run ./try`
21281                 case "$yyy" in
21282                 12345678901)
21283                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21284                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21285                         echo "We will use %d."
21286                         ;;
21287                 esac
21288         fi
21289 fi
21290
21291 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21292         $cat >try.c <<'EOCP'
21293 #include <sys/types.h>
21294 #include <stdio.h>
21295 int main() {
21296   long q = 12345678901;
21297   printf("%ld\n", q);
21298 }
21299 EOCP
21300         set try
21301         if eval $compile; then
21302                 yyy=`$run ./try`
21303                 case "$yyy" in
21304                 12345678901)
21305                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21306                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21307                         echo "We will use %ld."
21308                         ;;
21309                 esac
21310         fi
21311 fi
21312
21313 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21314         $cat >try.c <<'EOCP'
21315 #include <sys/types.h>
21316 #include <inttypes.h>
21317 #include <stdio.h>
21318 int main() {
21319   int64_t q = 12345678901;
21320   printf("%" PRId64 "\n", q);
21321 }
21322 EOCP
21323         set try
21324         if eval $compile; then
21325                 yyy=`$run ./try`
21326                 case "$yyy" in
21327                 12345678901)
21328                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21329                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21330                         echo "We will use the C9X style."
21331                         ;;
21332                 esac
21333         fi
21334 fi
21335
21336 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21337         $cat >try.c <<EOCP
21338 #include <sys/types.h>
21339 #include <stdio.h>
21340 int main() {
21341   $quadtype q = 12345678901;
21342   printf("%Ld\n", q);
21343 }
21344 EOCP
21345         set try
21346         if eval $compile; then
21347                 yyy=`$run ./try`
21348                 case "$yyy" in
21349                 12345678901)
21350                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21351                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21352                         echo "We will use %Ld."
21353                         ;;
21354                 esac
21355         fi
21356 fi
21357
21358 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21359         $cat >try.c <<'EOCP'
21360 #include <sys/types.h>
21361 #include <stdio.h>
21362 int main() {
21363   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21364   printf("%lld\n", q);
21365 }
21366 EOCP
21367         set try
21368         if eval $compile; then
21369                 yyy=`$run ./try`
21370                 case "$yyy" in
21371                 12345678901)
21372                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21373                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21374                         echo "We will use the %lld style."
21375                         ;;
21376                 esac
21377         fi
21378 fi
21379
21380 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21381         $cat >try.c <<EOCP
21382 #include <sys/types.h>
21383 #include <stdio.h>
21384 int main() {
21385   $quadtype q = 12345678901;
21386   printf("%qd\n", q);
21387 }
21388 EOCP
21389         set try
21390         if eval $compile; then
21391                 yyy=`$run ./try`
21392                 case "$yyy" in
21393                 12345678901)
21394                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21395                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21396                         echo "We will use %qd."
21397                         ;;
21398                 esac
21399         fi
21400 fi
21401
21402 if $test X"$sPRId64" = X; then
21403         echo "Cannot figure out how to print 64-bit integers." >&4
21404 fi
21405 $rm_try
21406
21407 fi
21408
21409 case "$sPRId64" in
21410 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21411         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21412         ;;
21413 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21414         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21415         ;;
21416 esac
21417
21418 : Check format strings for internal types
21419 echo " "
21420 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21421
21422 if $test X"$ivsize" = X8; then
21423         ivdformat="$sPRId64"
21424         uvuformat="$sPRIu64"
21425         uvoformat="$sPRIo64"
21426         uvxformat="$sPRIx64"
21427         uvXUformat="$sPRIXU64"
21428 else
21429         if $test X"$ivsize" = X"$longsize"; then
21430                 ivdformat='"ld"'
21431                 uvuformat='"lu"'
21432                 uvoformat='"lo"'
21433                 uvxformat='"lx"'
21434                 uvXUformat='"lX"'
21435         else
21436                 if $test X"$ivsize" = X"$intsize"; then
21437                         ivdformat='"d"'
21438                         uvuformat='"u"'
21439                         uvoformat='"o"'
21440                         uvxformat='"x"'
21441                         uvXUformat='"X"'
21442                 else
21443                         : far out
21444                         if $test X"$ivsize" = X"$shortsize"; then
21445                                 ivdformat='"hd"'
21446                                 uvuformat='"hu"'
21447                                 uvoformat='"ho"'
21448                                 uvxformat='"hx"'
21449                                 uvXUformat='"hX"'
21450                         fi
21451                 fi
21452         fi
21453 fi
21454
21455 if $test X"$usequadmath" = X"$define"; then
21456     nveformat='"Qe"'
21457     nvfformat='"Qf"'
21458     nvgformat='"Qg"'
21459     nvEUformat='"QE"'
21460     nvFUformat='"QF"'
21461     nvGUformat='"QG"'
21462 else
21463     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21464         nveformat="$sPRIeldbl"
21465         nvfformat="$sPRIfldbl"
21466         nvgformat="$sPRIgldbl"
21467         nvEUformat="$sPRIEUldbl"
21468         nvFUformat="$sPRIFUldbl"
21469         nvGUformat="$sPRIGUldbl"
21470     else
21471         nveformat='"e"'
21472         nvfformat='"f"'
21473         nvgformat='"g"'
21474         nvEUformat='"E"'
21475         nvFUformat='"F"'
21476         nvGUformat='"G"'
21477     fi
21478 fi
21479
21480 case "$ivdformat" in
21481 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21482     exit 1
21483     ;;
21484 esac
21485
21486 : Check format string for GID
21487
21488 echo " "
21489 $echo "Checking the format string to be used for gids..." >&4
21490
21491 case "$gidsign" in
21492 -1)     if $test X"$gidsize" = X"$ivsize"; then
21493                 gidformat="$ivdformat"
21494         else
21495                 if $test X"$gidsize" = X"$longsize"; then
21496                         gidformat='"ld"'
21497                 else
21498                         if $test X"$gidsize" = X"$intsize"; then
21499                                 gidformat='"d"'
21500                         else
21501                                 if $test X"$gidsize" = X"$shortsize"; then
21502                                         gidformat='"hd"'
21503                                 fi
21504                         fi
21505                 fi
21506         fi
21507         ;;
21508 *)      if $test X"$gidsize" = X"$uvsize"; then
21509                 gidformat="$uvuformat"
21510         else
21511                 if $test X"$gidsize" = X"$longsize"; then
21512                         gidformat='"lu"'
21513                 else
21514                         if $test X"$gidsize" = X"$intsize"; then
21515                                 gidformat='"u"'
21516                         else
21517                                 if $test X"$gidsize" = X"$shortsize"; then
21518                                         gidformat='"hu"'
21519                                 fi
21520                         fi
21521                 fi
21522         fi
21523         ;;
21524 esac
21525
21526 : see if getgroups exists
21527 set getgroups d_getgrps
21528 eval $inlibc
21529
21530 : see if setgroups exists
21531 set setgroups d_setgrps
21532 eval $inlibc
21533
21534 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21535 echo " "
21536 case "$d_getgrps$d_setgrps" in
21537 *define*)
21538         case "$groupstype" in
21539         '') dflt="$gidtype" ;;
21540         *)  dflt="$groupstype" ;;
21541         esac
21542         $cat <<EOM
21543 What type of pointer is the second argument to getgroups() and setgroups()?
21544 Usually this is the same as group ids, $gidtype, but not always.
21545
21546 EOM
21547         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21548         . ./myread
21549         groupstype="$ans"
21550         ;;
21551 *)  groupstype="$gidtype";;
21552 esac
21553
21554 : check whether make sets MAKE
21555 echo " "
21556 echo "Checking if your $make program sets \$(MAKE)..." >&4
21557 case "$make_set_make" in
21558 '')
21559         $sed 's/^X //' > testmake.mak << 'EOF'
21560 Xall:
21561 X       @echo 'maketemp="$(MAKE)"'
21562 EOF
21563         case "`$make -f testmake.mak 2>/dev/null`" in
21564         *maketemp=*) make_set_make='#' ;;
21565         *)      make_set_make="MAKE=$make" ;;
21566         esac
21567         $rm -f testmake.mak
21568         ;;
21569 esac
21570 case "$make_set_make" in
21571 '#') echo "Yup, it does.";;
21572 *) echo "Nope, it doesn't.";;
21573 esac
21574
21575 : see what type is used for mode_t
21576 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21577 set mode_t modetype int stdio.h sys/types.h
21578 eval $typedef_ask
21579
21580 : see if we need va_copy
21581 echo " "
21582 case "$i_stdarg" in
21583 "$define")
21584         $cat >try.c <<EOCP
21585 #include <stdarg.h>
21586 #include <stdio.h>
21587 #$i_stdlib I_STDLIB
21588 #ifdef I_STDLIB
21589 #include <stdlib.h>
21590 #endif
21591 #include <signal.h>
21592
21593 int
21594 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21595 {
21596   return vfprintf(f, fmt, *valp);
21597 }
21598
21599 int
21600 myvfprintf(FILE *f, const  char *fmt, va_list val)
21601 {
21602   return ivfprintf(f, fmt, &val);
21603 }
21604
21605 int
21606 myprintf(char *fmt, ...)
21607 {
21608   va_list val;
21609   va_start(val, fmt);
21610   return myvfprintf(stdout, fmt, val);
21611 }
21612
21613 int
21614 main(int ac, char **av)
21615 {
21616   signal(SIGSEGV, exit);
21617
21618   myprintf("%s%cs all right, then\n", "that", '\'');
21619   exit(0);
21620 }
21621 EOCP
21622         set try
21623         if eval $compile && $run ./try 2>&1 >/dev/null; then
21624                 case "`$run ./try`" in
21625                 "that's all right, then")
21626                         okay=yes
21627                         ;;
21628                 esac
21629         fi
21630         case "$okay" in
21631         yes)    echo "It seems that you don't need va_copy()." >&4
21632                 need_va_copy="$undef"
21633                 ;;
21634         *)      echo "It seems that va_copy() or similar will be needed." >&4
21635                 need_va_copy="$define"
21636                 ;;
21637         esac
21638         $rm_try
21639         ;;
21640 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21641         need_va_copy="$undef"
21642         ;;
21643 esac
21644
21645 : see what type is used for size_t
21646 rp="What is the type used for the length parameter for string functions?"
21647 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21648 eval $typedef_ask
21649
21650 : check for type of arguments to gethostbyaddr.
21651 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21652         case "$d_gethbyaddr" in
21653         $define)
21654                 $cat <<EOM
21655
21656 Checking to see what type of arguments are accepted by gethostbyaddr().
21657 EOM
21658                 hdrs="$define sys/types.h
21659                         $d_socket sys/socket.h
21660                         $i_niin netinet/in.h
21661                         $i_netdb netdb.h
21662                         $i_unistd unistd.h"
21663                 : The first arg can 'char *' or 'void *'
21664                 : The second arg is some of integral type
21665                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21666                         for yyy in size_t long int; do
21667                                 case "$netdb_host_type" in
21668                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21669                                         if ./protochk "$try" $hdrs; then
21670                                                 echo "Your system accepts $xxx for the first arg."
21671                                                 echo "...and $yyy for the second arg."
21672                                                 netdb_host_type="$xxx"
21673                                                 netdb_hlen_type="$yyy"
21674                                         fi
21675                                         ;;
21676                                 esac
21677                         done
21678                 done
21679                 : In case none of those worked, prompt the user.
21680                 case "$netdb_host_type" in
21681                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21682                         dflt='char *'
21683                         . ./myread
21684                         netdb_host_type=$ans
21685                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21686                         dflt="$sizetype"
21687                         . ./myread
21688                         netdb_hlen_type=$ans
21689                         ;;
21690                 esac
21691                 ;;
21692         *)      : no gethostbyaddr, so pick harmless defaults
21693                 netdb_host_type='char *'
21694                 netdb_hlen_type="$sizetype"
21695                 ;;
21696         esac
21697         # Remove the "const" if needed. -- but then we'll have a
21698         # prototype clash!
21699         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21700 fi
21701
21702 : check for type of argument to gethostbyname.
21703 if test "X$netdb_name_type" = X ; then
21704         case "$d_gethbyname" in
21705         $define)
21706                 $cat <<EOM
21707
21708 Checking to see what type of argument is accepted by gethostbyname().
21709 EOM
21710                 hdrs="$define sys/types.h
21711                         $d_socket sys/socket.h
21712                         $i_niin netinet/in.h
21713                         $i_netdb netdb.h
21714                         $i_unistd unistd.h"
21715                 for xxx in "const char *" "char *"; do
21716                         case "$netdb_name_type" in
21717                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21718                                 if ./protochk "$try" $hdrs; then
21719                                         echo "Your system accepts $xxx."
21720                                         netdb_name_type="$xxx"
21721                                 fi
21722                                 ;;
21723                         esac
21724                 done
21725                 : In case none of those worked, prompt the user.
21726                 case "$netdb_name_type" in
21727                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21728                         dflt='char *'
21729                         . ./myread
21730                         netdb_name_type=$ans
21731                         ;;
21732                 esac
21733                 ;;
21734         *)      : no gethostbyname, so pick harmless default
21735                 netdb_name_type='char *'
21736                 ;;
21737         esac
21738 fi
21739
21740 : check for type of 1st argument to getnetbyaddr.
21741 if test "X$netdb_net_type" = X ; then
21742         case "$d_getnbyaddr" in
21743         $define)
21744                 $cat <<EOM
21745
21746 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21747 EOM
21748                 hdrs="$define sys/types.h
21749                         $d_socket sys/socket.h
21750                         $i_niin netinet/in.h
21751                         $i_netdb netdb.h
21752                         $i_unistd unistd.h"
21753                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21754                         case "$netdb_net_type" in
21755                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21756                                 if ./protochk "$try" $hdrs; then
21757                                         echo "Your system accepts $xxx."
21758                                         netdb_net_type="$xxx"
21759                                 fi
21760                                 ;;
21761                         esac
21762                 done
21763                 : In case none of those worked, prompt the user.
21764                 case "$netdb_net_type" in
21765                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21766                         dflt='long'
21767                         . ./myread
21768                         netdb_net_type=$ans
21769                         ;;
21770                 esac
21771                 ;;
21772         *)      : no getnetbyaddr, so pick harmless default
21773                 netdb_net_type='long'
21774                 ;;
21775         esac
21776 fi
21777 : locate the preferred pager for this system
21778 fn=f/
21779 case "$pager" in
21780 '')
21781         dflt=''
21782         case "$pg" in
21783         /*) dflt=$pg;;
21784         [a-zA-Z]:/*) dflt=$pg;;
21785         esac
21786         case "$more" in
21787         /*) dflt=$more;;
21788         [a-zA-Z]:/*) dflt=$more;;
21789         esac
21790         case "$less" in
21791         /*) dflt=$less;;
21792         [a-zA-Z]:/*) dflt=$less;;
21793         esac
21794         case "$dflt" in
21795         '') dflt=/usr/ucb/more;;
21796         esac
21797         ;;
21798 *)      dflt="$pager"
21799         ;;
21800 esac
21801 fn="f/($dflt)"
21802 echo " "
21803 rp='What pager is used on your system?'
21804 . ./getfile
21805 pager="$ans"
21806
21807 : see if ar generates random libraries by itself
21808 echo " "
21809 echo "Checking how to generate random libraries on your machine..." >&4
21810 echo 'int bar1() { return bar2(); }' > bar1.c
21811 echo 'int bar2() { return 2; }' > bar2.c
21812 $cat > foo.c <<EOP
21813 #$i_stdlib I_STDLIB
21814 #ifdef I_STDLIB
21815 #include <stdlib.h>
21816 #endif
21817 int main() { printf("%d\n", bar1()); exit(0); }
21818 EOP
21819 $cc $ccflags -c bar1.c >/dev/null 2>&1
21820 $cc $ccflags -c bar2.c >/dev/null 2>&1
21821 $cc $ccflags -c foo.c >/dev/null 2>&1
21822 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21823 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21824         $run ./foobar >/dev/null 2>&1; then
21825         echo "$ar appears to generate random libraries itself."
21826         orderlib=false
21827         if [ "X$ranlib" = "X" ]; then
21828             ranlib=":"
21829         fi
21830 elif $ar s bar$_a >/dev/null 2>&1 &&
21831         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21832         $run ./foobar >/dev/null 2>&1; then
21833                 echo "a table of contents needs to be added with '$ar s'."
21834                 orderlib=false
21835                 ranlib="$ar s"
21836 elif $ar ts bar$_a >/dev/null 2>&1 &&
21837         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21838         $run ./foobar >/dev/null 2>&1; then
21839                 echo "a table of contents needs to be added with '$ar ts'."
21840                 orderlib=false
21841                 ranlib="$ar ts"
21842 else
21843         case "$ranlib" in
21844         :) ranlib='';;
21845         '')
21846                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21847                 $test -f $ranlib || ranlib=''
21848                 ;;
21849         esac
21850         if $test -n "$ranlib"; then
21851                 echo "your system has '$ranlib'; we'll use that."
21852                 orderlib=false
21853         else
21854                 echo "your system doesn't seem to support random libraries"
21855                 echo "so we'll use lorder and tsort to order the libraries."
21856                 orderlib=true
21857                 ranlib=":"
21858         fi
21859 fi
21860 $rm -f foo* bar*
21861
21862 : see if this is a values.h system
21863 set values.h i_values
21864 eval $inhdr
21865
21866 : Check the max offset that gmtime and localtime accept
21867 echo "Checking max offsets that gmtime () accepts"
21868
21869 case $i_values in
21870     define) yyy="#include <values.h>" ;;
21871     *)      yyy="" ;;
21872     esac
21873
21874 case "$sGMTIME_min/$sGMTIME_max" in
21875     0/0|/)
21876         $cat >try.c <<EOCP
21877 #include <sys/types.h>
21878 #include <stdio.h>
21879 #include <time.h>
21880 $yyy
21881
21882 int i;
21883 struct tm *tmp;
21884 time_t pt;
21885
21886 void gm_check (time_t t, int min_year, int max_year)
21887 {
21888     tmp = gmtime (&t);
21889     if ( tmp == NULL ||
21890         /* Check tm_year overflow */
21891          tmp->tm_year < min_year || tmp->tm_year > max_year)
21892         tmp = NULL;
21893     else
21894         pt = t;
21895     } /* gm_check */
21896
21897 int check_max ()
21898 {
21899     tmp = NULL;
21900     pt  = 0;
21901 #ifdef MAXLONG
21902     gm_check (MAXLONG, 69, 0x7fffffff);
21903 #endif
21904     if (tmp == NULL || tmp->tm_year < 0) {
21905         for (i = 63; i >= 0; i--) {
21906             time_t x = pt | ((time_t)1 << i);
21907             if (x < 0 || x < pt) continue;
21908             gm_check (x, 69, 0x7fffffff);
21909             }
21910         }
21911     printf ("sGMTIME_max=%ld\n", pt);
21912     return (0);
21913     } /* check_max */
21914
21915 int check_min ()
21916 {
21917     tmp = NULL;
21918     pt  = 0;
21919 #ifdef MINLONG
21920     gm_check (MINLONG, -1900, 70);
21921 #endif
21922     if (tmp == NULL) {
21923         for (i = 36; i >= 0; i--) {
21924             time_t x = pt - ((time_t)1 << i);
21925             if (x > 0) continue;
21926             gm_check (x, -1900, 70);
21927             }
21928         }
21929     printf ("sGMTIME_min=%ld\n", pt);
21930     return (0);
21931     } /* check_min */
21932
21933 int main (int argc, char *argv[])
21934 {
21935     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21936     check_max ();
21937     check_min ();
21938     return (0);
21939     } /* main */
21940 EOCP
21941         set try
21942         if eval $compile; then
21943             eval `$run ./try 2>/dev/null`
21944         else
21945             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21946             fi
21947         $rm_try
21948         ;;
21949     esac
21950
21951 echo "Checking max offsets that localtime () accepts"
21952
21953 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21954     0/0|/)
21955         $cat >try.c <<EOCP
21956 #include <sys/types.h>
21957 #include <stdio.h>
21958 #include <time.h>
21959 $yyy
21960
21961 int i;
21962 struct tm *tmp;
21963 time_t pt;
21964
21965 void local_check (time_t t, int min_year, int max_year)
21966 {
21967     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21968         tmp = NULL;
21969     else
21970         tmp = localtime (&t);
21971     if ( tmp == NULL ||
21972         /* Check tm_year overflow */
21973          tmp->tm_year < min_year || tmp->tm_year > max_year)
21974         tmp = NULL;
21975     else
21976         pt = t;
21977     } /* local_check */
21978
21979 int check_max ()
21980 {
21981     tmp = NULL;
21982     pt  = 0;
21983 #ifdef MAXLONG
21984     local_check (MAXLONG, 69, 0x7fffffff);
21985 #endif
21986     if (tmp == NULL || tmp->tm_year < 0) {
21987         for (i = 63; i >= 0; i--) {
21988             time_t x = pt | ((time_t)1 << i);
21989             if (x < 0 || x < pt) continue;
21990             local_check (x, 69, 0x7fffffff);
21991             }
21992         }
21993     printf ("sLOCALTIME_max=%ld\n", pt);
21994     return (0);
21995    } /* check_max */
21996
21997 int check_min ()
21998 {
21999     tmp = NULL;
22000     pt  = 0;
22001 #ifdef MINLONG
22002     local_check (MINLONG, -1900, 70);
22003 #endif
22004     if (tmp == NULL) {
22005         for (i = 36; i >= 0; i--) {
22006             time_t x = pt - ((time_t)1 << i);
22007             if (x > 0) continue;
22008             local_check (x, -1900, 70);
22009             }
22010         }
22011     printf ("sLOCALTIME_min=%ld\n", pt);
22012     return (0);
22013     } /* check_min */
22014
22015 int main (int argc, char *argv[])
22016 {
22017     check_max ();
22018     check_min ();
22019     return (0);
22020     } /* main */
22021 EOCP
22022         set try
22023         if eval $compile; then
22024             eval `$run ./try 2>/dev/null`
22025         else
22026             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
22027             fi
22028         $rm_try
22029         ;;
22030     esac
22031
22032 : check for type of arguments to select.
22033 case "$selecttype" in
22034 '') case "$d_select" in
22035         $define)
22036                 echo " "
22037                 $cat <<EOM
22038 Checking to see what type of arguments are accepted by select().
22039 EOM
22040                 hdrs="$define sys/types.h
22041                         $i_systime sys/time.h
22042                         $i_sysselct sys/select.h
22043                         $d_socket sys/socket.h"
22044                 : The first arg can be int, unsigned, or size_t
22045                 : The last arg may or may not be 'const'
22046                 val=''
22047                 : void pointer has been seen but using that
22048                 : breaks the selectminbits test
22049                 for xxx in 'fd_set *' 'int *'; do
22050                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
22051                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
22052                                         case "$val" in
22053                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
22054                                                 if ./protochk "$try" $hdrs; then
22055                                                         echo "Your system accepts $xxx."
22056                                                         val="$xxx"
22057                                                 fi
22058                                                 ;;
22059                                         esac
22060                                 done
22061                         done
22062                 done
22063                 case "$val" in
22064                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22065                         case "$d_fd_set" in
22066                                 $define) dflt="fd_set *" ;;
22067                                 *)              dflt="int *" ;;
22068                         esac
22069                         . ./myread
22070                         val=$ans
22071                         ;;
22072                 esac
22073                 selecttype="$val"
22074                 ;;
22075         *)      : no select, so pick a harmless default
22076                 selecttype='int *'
22077                 ;;
22078         esac
22079         ;;
22080 esac
22081
22082 : check for the select 'width'
22083 case "$selectminbits" in
22084 '') safebits=`expr $ptrsize \* 8`
22085     case "$d_select" in
22086         $define)
22087                 $cat <<EOM
22088
22089 Checking to see on how many bits at a time your select() operates...
22090 EOM
22091                 $cat >try.c <<EOCP
22092 #include <sys/types.h>
22093 #$i_time I_TIME
22094 #$i_systime I_SYS_TIME
22095 #$i_systimek I_SYS_TIME_KERNEL
22096 #ifdef I_TIME
22097 #   include <time.h>
22098 #endif
22099 #ifdef I_SYS_TIME
22100 #   ifdef I_SYS_TIME_KERNEL
22101 #       define KERNEL
22102 #   endif
22103 #   include <sys/time.h>
22104 #   ifdef I_SYS_TIME_KERNEL
22105 #       undef KERNEL
22106 #   endif
22107 #endif
22108 #$i_sysselct I_SYS_SELECT
22109 #ifdef I_SYS_SELECT
22110 #include <sys/select.h>
22111 #endif
22112 #$d_socket HAS_SOCKET
22113 #ifdef HAS_SOCKET
22114 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22115 #endif
22116 #include <stdio.h>
22117 #$i_stdlib I_STDLIB
22118 #ifdef I_STDLIB
22119 #include <stdlib.h>
22120 #endif
22121 $selecttype b;
22122 #define S sizeof(*(b))
22123 #define MINBITS 64
22124 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22125 #define NBITS  (NBYTES * 8)
22126 int main() {
22127     char *s = (char *)malloc(NBYTES);
22128     struct timeval t;
22129     int i;
22130     FILE* fp;
22131     int fd;
22132
22133     if (!s)
22134         exit(1);
22135     fclose(stdin);
22136     fp = fopen("try.c", "r");
22137     if (fp == 0)
22138       exit(2);
22139     fd = fileno(fp);
22140     if (fd < 0)
22141       exit(3);
22142     b = ($selecttype)s;
22143     for (i = 0; i < NBITS; i++)
22144         FD_SET(i, b);
22145     t.tv_sec  = 0;
22146     t.tv_usec = 0;
22147     select(fd + 1, b, 0, 0, &t);
22148     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22149     free(s);
22150     printf("%d\n", i + 1);
22151     return 0;
22152 }
22153 EOCP
22154                 set try
22155                 if eval $compile_ok; then
22156                         selectminbits=`$run ./try 2>/dev/null`
22157                         case "$selectminbits" in
22158                         '')     cat >&4 <<EOM
22159 Cannot figure out on how many bits at a time your select() operates.
22160 I'll play safe and guess it is $safebits bits.
22161 EOM
22162                                 selectminbits=$safebits
22163                                 bits="$safebits bits"
22164                                 ;;
22165                         1)      bits="1 bit" ;;
22166                         *)      bits="$selectminbits bits" ;;
22167                         esac
22168                         echo "Your select() operates on $bits at a time." >&4
22169                 else
22170                         rp='What is the minimum number of bits your select() operates on?'
22171                         case "$byteorder" in
22172                         12345678)       dflt=64 ;;
22173                         1234)           dflt=32 ;;
22174                         *)              dflt=1  ;;
22175                         esac
22176                         . ./myread
22177                         val=$ans
22178                         selectminbits="$val"
22179                 fi
22180                 $rm_try
22181                 ;;
22182         *)      : no select, so pick a harmless default
22183                 selectminbits=$safebits
22184                 ;;
22185         esac
22186         ;;
22187 esac
22188
22189 : Trace out the files included by signal.h, then look for SIGxxx names.
22190 case "$sig_num_init" in
22191 '')
22192 if [ "X$fieldn" = X ]; then
22193         : Just make some guesses.  We check them later.
22194         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22195 else
22196         xxx=`echo '#include <signal.h>' |
22197         $cppstdin $cppminus $cppflags 2>/dev/null |
22198         $grep '^[       ]*#.*include' |
22199         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22200                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22201 fi
22202 xxxfiles=''
22203 for xx in $xxx /dev/null ; do
22204         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22205 done
22206 case "$xxxfiles" in
22207 '')     xxxfiles=`./findhdr signal.h` ;;
22208 esac
22209 xxx=`awk '
22210 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22211         print substr($2, 4, 20)
22212 }
22213 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22214         print substr($3, 4, 20)
22215 }' $xxxfiles`
22216 : Append some common names just in case the awk scan failed.
22217 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22218 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22219 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22220 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22221 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22222
22223 : generate a few handy files for later
22224 $cat > signal.c <<EOCP
22225 #include <sys/types.h>
22226 #include <signal.h>
22227 #$i_stdlib I_STDLIB
22228 #ifdef I_STDLIB
22229 #include <stdlib.h>
22230 #endif
22231 #include <stdio.h>
22232 int main() {
22233
22234 /* Strange style to avoid deeply-nested #if/#else/#endif */
22235 #ifndef NSIG
22236 #  ifdef _NSIG
22237 #    define NSIG (_NSIG)
22238 #  endif
22239 #endif
22240
22241 #ifndef NSIG
22242 #  ifdef SIGMAX
22243 #    define NSIG (SIGMAX+1)
22244 #  endif
22245 #endif
22246
22247 #ifndef NSIG
22248 #  ifdef SIG_MAX
22249 #    define NSIG (SIG_MAX+1)
22250 #  endif
22251 #endif
22252
22253 #ifndef NSIG
22254 #  ifdef _SIG_MAX
22255 #    define NSIG (_SIG_MAX+1)
22256 #  endif
22257 #endif
22258
22259 #ifndef NSIG
22260 #  ifdef MAXSIG
22261 #    define NSIG (MAXSIG+1)
22262 #  endif
22263 #endif
22264
22265 #ifndef NSIG
22266 #  ifdef MAX_SIG
22267 #    define NSIG (MAX_SIG+1)
22268 #  endif
22269 #endif
22270
22271 #ifndef NSIG
22272 #  ifdef SIGARRAYSIZE
22273 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22274 #  endif
22275 #endif
22276
22277 #ifndef NSIG
22278 #  ifdef _sys_nsig
22279 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22280 #  endif
22281 #endif
22282
22283 /* Default to some arbitrary number that's big enough to get most
22284    of the common signals.
22285 */
22286 #ifndef NSIG
22287 #    define NSIG 50
22288 #endif
22289
22290 printf("NSIG %d\n", NSIG);
22291
22292 #ifndef JUST_NSIG
22293
22294 EOCP
22295
22296 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22297 {
22298         printf "#ifdef SIG"; printf $1; printf "\n"
22299         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22300         printf $1; printf ");\n"
22301         printf "#endif\n"
22302 }
22303 END {
22304         printf "#endif /* JUST_NSIG */\n";
22305         printf "exit(0);\n}\n";
22306 }
22307 ' >>signal.c
22308 $cat >signal.awk <<'EOP'
22309 BEGIN { ndups = 0 }
22310 $1 ~ /^NSIG$/ { nsig = $2 }
22311 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22312     if ($2 > maxsig) { maxsig = $2 }
22313     if (sig_name[$2]) {
22314         dup_name[ndups] = $1
22315         dup_num[ndups] = $2
22316         ndups++
22317     }
22318     else {
22319         sig_name[$2] = $1
22320         sig_num[$2] = $2
22321     }
22322 }
22323 END {
22324     if (nsig == 0) {
22325         nsig = maxsig + 1
22326     }
22327     printf("NSIG %d\n", nsig);
22328     for (n = 1; n < nsig; n++) {
22329         if (sig_name[n]) {
22330             printf("%s %d\n", sig_name[n], sig_num[n])
22331         }
22332         else {
22333             printf("NUM%d %d\n", n, n)
22334         }
22335     }
22336     for (n = 0; n < ndups; n++) {
22337         printf("%s %d\n", dup_name[n], dup_num[n])
22338     }
22339 }
22340 EOP
22341 $cat >signal_cmd <<EOS
22342 $startsh
22343 if $test -s signal.lst; then
22344     echo "Using your existing signal.lst file"
22345         exit 0
22346 fi
22347 xxx="$xxx"
22348 EOS
22349 $cat >>signal_cmd <<'EOS'
22350
22351 set signal
22352 if eval $compile_ok; then
22353         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22354                 $uniq | $awk -f signal.awk >signal.lst
22355 else
22356         echo "(I can't seem be able to compile the whole test program)" >&4
22357         echo "(I'll try it in little pieces.)" >&4
22358         set signal -DJUST_NSIG
22359         if eval $compile_ok; then
22360                 $run ./signal$_exe > signal.nsg
22361                 $cat signal.nsg
22362         else
22363                 echo "I can't seem to figure out how many signals you have." >&4
22364                 echo "Guessing 50." >&4
22365                 echo 'NSIG 50' > signal.nsg
22366         fi
22367         : Now look at all the signal names, one at a time.
22368         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22369                 $cat > signal.c <<EOCP
22370 #include <sys/types.h>
22371 #include <signal.h>
22372 #include <stdio.h>
22373 int main() {
22374 printf("$xx %d\n", SIG${xx});
22375 return 0;
22376 }
22377 EOCP
22378                 set signal
22379                 if eval $compile; then
22380                         echo "SIG${xx} found."
22381                         $run ./signal$_exe  >> signal.ls1
22382                 else
22383                         echo "SIG${xx} NOT found."
22384                 fi
22385         done
22386         if $test -s signal.ls1; then
22387                 $cat signal.nsg signal.ls1 |
22388                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22389         fi
22390
22391 fi
22392 if $test -s signal.lst; then
22393         :
22394 else
22395         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22396         echo 'kill -l' >signal
22397         set X `csh -f <signal`
22398         $rm -f signal
22399         shift
22400         case $# in
22401         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22402         esac
22403         echo $@ | $tr ' ' $trnl | \
22404             $awk '{ printf "%s %d\n", $1, ++s; }
22405                   END { printf "NSIG %d\n", ++s }' >signal.lst
22406 fi
22407 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22408 EOS
22409 chmod a+x signal_cmd
22410 $eunicefix signal_cmd
22411 ;;
22412 esac
22413
22414 : generate list of signal names
22415 case "$sig_num_init" in
22416 '')
22417 echo " "
22418 case "$sig_name_init" in
22419 '') doinit=yes ;;
22420 *)  case "$sig_num_init" in
22421     ''|*,*) doinit=yes ;;
22422     esac ;;
22423 esac
22424 case "$doinit" in
22425 yes)
22426         echo "Generating a list of signal names and numbers..." >&4
22427         . ./signal_cmd
22428         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22429         sig_name=`$awk 'BEGIN { printf "ZERO " }
22430                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22431         sig_num=`$awk  'BEGIN { printf "0 " }
22432                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22433         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22434                              !/^NSIG/   { printf "\"%s\", ", $1 }
22435                              END        { printf "0\n" }' signal.lst`
22436         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22437                              !/^NSIG/   { printf "%d, ", $2}
22438                              END        { printf "0\n"}' signal.lst`
22439         ;;
22440 esac
22441 echo "The following $sig_count signals are available:"
22442 echo " "
22443 echo $sig_name | $awk \
22444 'BEGIN { linelen = 0 }
22445 {
22446         for (i = 1; i <= NF; i++) {
22447                 name = "SIG" $i " "
22448                 linelen = linelen + length(name)
22449                 if (linelen > 70) {
22450                         printf "\n"
22451                         linelen = length(name)
22452                 }
22453                 printf "%s", name
22454         }
22455         printf "\n"
22456 }'
22457 sig_size=`echo $sig_name | awk '{print NF}'`
22458 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22459 ;;
22460 esac
22461
22462 : Check size of size
22463 echo " "
22464 case "$sizetype" in
22465 *_t) zzz="$sizetype"    ;;
22466 *)   zzz="filesize"     ;;
22467 esac
22468 echo "Checking the size of $zzz..." >&4
22469 cat > try.c <<EOCP
22470 #include <sys/types.h>
22471 #include <stdio.h>
22472 #$i_stdlib I_STDLIB
22473 #ifdef I_STDLIB
22474 #include <stdlib.h>
22475 #endif
22476 int main() {
22477     printf("%d\n", (int)sizeof($sizetype));
22478     exit(0);
22479 }
22480 EOCP
22481 set try
22482 if eval $compile_ok; then
22483         yyy=`$run ./try`
22484         case "$yyy" in
22485         '')     sizesize=4
22486                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22487                 ;;
22488         *)      sizesize=$yyy
22489                 echo "Your $zzz size is $sizesize bytes."
22490                 ;;
22491         esac
22492 else
22493         sizesize=4
22494         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22495 fi
22496
22497
22498 : check for socklen_t
22499 echo " "
22500 echo "Checking to see if you have socklen_t..." >&4
22501 $cat >try.c <<EOCP
22502 #include <sys/types.h>
22503 #$d_socket HAS_SOCKET
22504 #ifdef HAS_SOCKET
22505 #include <sys/socket.h>
22506 #endif
22507 int main() { socklen_t x = 16; }
22508 EOCP
22509 set try
22510 if eval $compile; then
22511         val="$define"
22512         echo "You have socklen_t."
22513 else
22514         val="$undef"
22515         echo "You do not have socklen_t."
22516         case "$sizetype" in
22517         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22518         esac
22519 fi
22520 $rm_try
22521 set d_socklen_t
22522 eval $setvar
22523
22524 : see if this is a socks.h system
22525 set socks.h i_socks
22526 eval $inhdr
22527
22528 : check for type of the size argument to socket calls
22529 case "$d_socket" in
22530 "$define")
22531         $cat <<EOM
22532
22533 Checking to see what type is the last argument of accept().
22534 EOM
22535         yyy=''
22536         case "$d_socklen_t" in
22537         "$define") yyy="$yyy socklen_t"
22538         esac
22539         yyy="$yyy $sizetype int long unsigned"
22540         for xxx in $yyy; do
22541                 case "$socksizetype" in
22542                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22543                         case "$usesocks" in
22544                         "$define")
22545                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22546                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22547                                         socksizetype="$xxx"
22548                                 fi
22549                                 ;;
22550                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22551                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22552                                         socksizetype="$xxx"
22553                                 fi
22554                                 ;;
22555                         esac
22556                         ;;
22557                 esac
22558         done
22559 : In case none of those worked, prompt the user.
22560         case "$socksizetype" in
22561         '')     rp='What is the type for socket address structure sizes?'
22562                 dflt='int'
22563                 . ./myread
22564                 socksizetype=$ans
22565                 ;;
22566         esac
22567         ;;
22568 *)      : no sockets, so pick relatively harmless default
22569         socksizetype='int'
22570         ;;
22571 esac
22572
22573 : see what type is used for signed size_t
22574 set ssize_t ssizetype int stdio.h sys/types.h
22575 eval $typedef
22576 dflt="$ssizetype"
22577 $cat > try.c <<EOM
22578 #include <stdio.h>
22579 #$i_stdlib I_STDLIB
22580 #ifdef I_STDLIB
22581 #include <stdlib.h>
22582 #endif
22583 #include <sys/types.h>
22584 #define Size_t $sizetype
22585 #define SSize_t $dflt
22586 int main()
22587 {
22588         if (sizeof(Size_t) == sizeof(SSize_t))
22589                 printf("$dflt\n");
22590         else if (sizeof(Size_t) == sizeof(int))
22591                 printf("int\n");
22592         else
22593                 printf("long\n");
22594         exit(0);
22595 }
22596 EOM
22597 echo " "
22598 set try
22599 if eval $compile_ok && $run ./try > /dev/null; then
22600         ssizetype=`$run ./try`
22601         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22602 else
22603         $cat >&4 <<EOM
22604 Help! I can't compile and run the ssize_t test program: please enlighten me!
22605 (This is probably a misconfiguration in your system or libraries, and
22606 you really ought to fix it.  Still, I'll try anyway.)
22607
22608 I need a type that is the same size as $sizetype, but is guaranteed to
22609 be signed.  Common values are ssize_t, int and long.
22610
22611 EOM
22612         rp="What signed type is the same size as $sizetype?"
22613         . ./myread
22614         ssizetype="$ans"
22615 fi
22616 $rm_try
22617
22618 : Check the size of st_ino
22619 $echo " "
22620 $echo "Checking the size of st_ino..." >&4
22621 $cat > try.c <<EOCP
22622 #include <sys/stat.h>
22623 #include <stdio.h>
22624 #$i_stdlib I_STDLIB
22625 #ifdef I_STDLIB
22626 #include <stdlib.h>
22627 #endif
22628 int main() {
22629     struct stat st;
22630     printf("%d\n", (int)sizeof(st.st_ino));
22631     exit(0);
22632 }
22633 EOCP
22634 set try
22635 if eval $compile_ok; then
22636         val=`$run ./try`
22637         case "$val" in
22638         '')     st_ino_size=4
22639                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22640                 ;;
22641         *)      st_ino_size=$val
22642                 $echo "Your st_ino is $st_ino_size bytes long."
22643                 ;;
22644         esac
22645 else
22646         st_ino_size=4
22647         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22648 fi
22649 $rm_try
22650
22651 : Check if st_ino is signed
22652 $echo " "
22653 $echo "Checking the sign of st_ino..." >&4
22654 $cat > try.c <<EOCP
22655 #include <sys/stat.h>
22656 #include <stdio.h>
22657 int main() {
22658         struct stat foo;
22659         foo.st_ino = -1;
22660         if (foo.st_ino < 0)
22661                 printf("-1\n");
22662         else
22663                 printf("1\n");
22664 }
22665 EOCP
22666 set try
22667 if eval $compile; then
22668         val=`$run ./try`
22669         case "$val" in
22670         '')     st_ino_sign=1
22671                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22672                 ;;
22673         *)      st_ino_sign=$val
22674                 case "$st_ino_sign" in
22675                  1) $echo "Your st_ino is unsigned." ;;
22676                 -1) $echo "Your st_ino is signed."   ;;
22677                 esac
22678                 ;;
22679         esac
22680 else
22681         st_ino_sign=1
22682         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22683 fi
22684 $rm_try
22685
22686 : see what type of char stdio uses.
22687 echo " "
22688 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22689 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22690         echo "Your stdio uses unsigned chars." >&4
22691         stdchar="unsigned char"
22692 else
22693         echo "Your stdio uses signed chars." >&4
22694         stdchar="char"
22695 fi
22696 $rm -f stdioh
22697
22698 : Check size of UID
22699 echo " "
22700 case "$uidtype" in
22701 *_t) zzz="$uidtype"     ;;
22702 *)   zzz="uid"          ;;
22703 esac
22704 echo "Checking the size of $zzz..." >&4
22705 cat > try.c <<EOCP
22706 #include <sys/types.h>
22707 #include <stdio.h>
22708 #$i_stdlib I_STDLIB
22709 #ifdef I_STDLIB
22710 #include <stdlib.h>
22711 #endif
22712 int main() {
22713     printf("%d\n", (int)sizeof($uidtype));
22714     exit(0);
22715 }
22716 EOCP
22717 set try
22718 if eval $compile_ok; then
22719         yyy=`$run ./try`
22720         case "$yyy" in
22721         '')     uidsize=4
22722                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22723                 ;;
22724         *)      uidsize=$yyy
22725                 echo "Your $zzz is $uidsize bytes long."
22726                 ;;
22727         esac
22728 else
22729         uidsize=4
22730         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22731 fi
22732
22733 : Check if UID is signed
22734 echo " "
22735 case "$uidtype" in
22736 *_t) zzz="$uidtype"     ;;
22737 *)   zzz="uid"          ;;
22738 esac
22739 echo "Checking the sign of $zzz..." >&4
22740 cat > try.c <<EOCP
22741 #include <sys/types.h>
22742 #include <stdio.h>
22743 int main() {
22744         $uidtype foo = -1;
22745         if (foo < 0)
22746                 printf("-1\n");
22747         else
22748                 printf("1\n");
22749 }
22750 EOCP
22751 set try
22752 if eval $compile; then
22753         yyy=`$run ./try`
22754         case "$yyy" in
22755         '')     uidsign=1
22756                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22757                 ;;
22758         *)      uidsign=$yyy
22759                 case "$uidsign" in
22760                  1) echo "Your $zzz is unsigned." ;;
22761                 -1) echo "Your $zzz is signed."   ;;
22762                 esac
22763                 ;;
22764         esac
22765 else
22766         uidsign=1
22767         echo "(I can't compile the test program--guessing unsigned.)" >&4
22768 fi
22769
22770
22771 : Check format string for UID
22772 echo " "
22773 $echo "Checking the format string to be used for uids..." >&4
22774
22775 case "$uidsign" in
22776 -1)     if $test X"$uidsize" = X"$ivsize"; then
22777                 uidformat="$ivdformat"
22778         else
22779                 if $test X"$uidsize" = X"$longsize"; then
22780                         uidformat='"ld"'
22781                 else
22782                         if $test X"$uidsize" = X"$intsize"; then
22783                                 uidformat='"d"'
22784                         else
22785                                 if $test X"$uidsize" = X"$shortsize"; then
22786                                         uidformat='"hd"'
22787                                 fi
22788                         fi
22789                 fi
22790         fi
22791         ;;
22792 *)      if $test X"$uidsize" = X"$uvsize"; then
22793                 uidformat="$uvuformat"
22794         else
22795                 if $test X"$uidsize" = X"$longsize"; then
22796                         uidformat='"lu"'
22797                 else
22798                         if $test X"$uidsize" = X"$intsize"; then
22799                                 uidformat='"u"'
22800                         else
22801                                 if $test X"$uidsize" = X"$shortsize"; then
22802                                         uidformat='"hu"'
22803                                 fi
22804                         fi
22805                 fi
22806         fi
22807         ;;
22808 esac
22809
22810 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22811 echo " "
22812 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22813 $cat >try.c <<'EOM'
22814 /* Intentionally a long probe as I'd like to sanity check that the exact
22815    approach is going to work, as thinking it will work, but only having it
22816    part working at runtime is worse than not having it.  */
22817
22818 #include <sys/types.h>
22819 #include <sys/sysctl.h>
22820 #include <sys/param.h>
22821 #include <stdio.h>
22822 #include <string.h>
22823 #include <stdlib.h>
22824 #include <unistd.h>
22825
22826 int
22827 main(int argc, char **argv) {
22828     char *buffer;
22829     char *argv_leaf = strrchr(argv[0], '/');
22830     char *buffer_leaf;
22831     size_t size = 0;
22832     int mib[4];
22833
22834     mib[0] = CTL_KERN;
22835     mib[1] = KERN_PROC;
22836     mib[2] = KERN_PROC_PATHNAME;
22837     mib[3] = -1;
22838
22839     if (!argv_leaf) {
22840         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22841         return 1;
22842     }
22843
22844     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22845         perror("sysctl");
22846         return 2;
22847     }
22848
22849     if (size < strlen(argv_leaf) + 1) {
22850         fprintf(stderr, "size %lu is too short for a path\n",
22851                 (unsigned long) size);
22852         return 3;
22853     }
22854
22855     if (size > MAXPATHLEN * MAXPATHLEN) {
22856         fprintf(stderr, "size %lu is too long for a path\n",
22857                 (unsigned long) size);
22858         return 4;
22859     }
22860
22861     buffer = malloc(size);
22862     if (!buffer) {
22863         perror("malloc");
22864         return 5;
22865     }
22866
22867     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22868         perror("sysctl");
22869         return 6;
22870     }
22871
22872     if (strlen(buffer) + 1 != size) {
22873         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22874                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22875         return 7;
22876     }
22877
22878
22879     if (*buffer != '/') {
22880         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22881         return 8;
22882     }
22883
22884     if (strstr(buffer, "/./")) {
22885         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22886         return 9;
22887     }
22888
22889     if (strstr(buffer, "/../")) {
22890         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22891         return 10;
22892     }
22893
22894     buffer_leaf = strrchr(buffer, '/');
22895     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22896         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22897         return 11;
22898     }
22899
22900     free(buffer);
22901
22902     return 0;
22903 }
22904 EOM
22905
22906 val=$undef
22907 set try
22908 if eval $compile; then
22909         if $run ./try; then
22910                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22911                 val="$define"
22912         else
22913                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22914                 val="$undef"
22915         fi
22916 else
22917         echo "I'm unable to compile the test program." >&4
22918         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22919         val="$undef"
22920 fi
22921 $rm_try
22922 set usekernprocpathname
22923 eval $setvar
22924
22925 : Determine if we can use _NSGetExecutablePath to find executing program
22926 echo " "
22927 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22928 $cat >try.c <<'EOM'
22929 /* Intentionally a long probe as I'd like to sanity check that the exact
22930    approach is going to work, as thinking it will work, but only having it
22931    part working at runtime is worse than not having it.  */
22932 #include <mach-o/dyld.h>
22933 #include <stdio.h>
22934 #include <stdlib.h>
22935 #include <sys/param.h>
22936 #include <string.h>
22937
22938 int
22939 main(int argc, char **argv) {
22940     char buf[1];
22941     uint32_t size = sizeof(buf);
22942     int result;
22943     char *buffer;
22944     char *tidied;
22945     char *argv_leaf = strrchr(argv[0], '/');
22946     char *tidied_leaf;
22947
22948     if (!argv_leaf) {
22949         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22950         return 1;
22951     }
22952
22953     _NSGetExecutablePath(buf, &size);
22954     if (size > MAXPATHLEN * MAXPATHLEN) {
22955         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22956                 (unsigned int) size);
22957         return 2;
22958     }
22959
22960     buffer = malloc(size);
22961     if (!buffer) {
22962         perror("malloc");
22963         return 3;
22964     }
22965
22966     result = _NSGetExecutablePath(buffer, &size);
22967     if (result != 0) {
22968         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22969                 result, (unsigned int) size);
22970         return 4;
22971     }
22972
22973     tidied = realpath(buffer, NULL);
22974     if (!tidied) {
22975         perror("realpath");
22976         return 5;
22977     }
22978
22979     free(buffer);
22980
22981     if (*tidied != '/') {
22982         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22983         return 6;
22984     }
22985
22986     if (strstr(tidied, "/./")) {
22987         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22988         return 7;
22989     }
22990
22991     if (strstr(tidied, "/../")) {
22992         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22993         return 8;
22994     }
22995
22996     tidied_leaf = strrchr(tidied, '/');
22997     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22998         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22999         return 9;
23000     }
23001
23002     free(tidied);
23003
23004     return 0;
23005 }
23006 EOM
23007
23008 val=$undef
23009 set try
23010 if eval $compile; then
23011         if $run ./try; then
23012                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
23013                 val="$define"
23014         else
23015                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23016         fi
23017 else
23018         echo "I'm unable to compile the test program." >&4
23019         echo "I'll assume no _NSGetExecutablePath here." >&4
23020 fi
23021 $rm_try
23022 set usensgetexecutablepath
23023 eval $setvar
23024
23025 : Check if site customization support was requested
23026 case "$usesitecustomize" in
23027     $define|true|[Yy]*)
23028         usesitecustomize="$define"
23029         ;;
23030     *)
23031         usesitecustomize="$undef"
23032         ;;
23033     esac
23034
23035 : see if prototypes support variable argument declarations
23036 echo " "
23037 case "$prototype$i_stdarg" in
23038 $define$define)
23039         echo "It appears we'll be able to prototype varargs functions." >&4
23040         val="$define"
23041         ;;
23042 *)
23043         echo "Too bad... We won't be using prototyped varargs functions..." >&4
23044         val="$undef"
23045         ;;
23046 esac
23047 set vaproto
23048 eval $setvar
23049
23050 : determine compiler compiler
23051 case "$yacc" in
23052 '')
23053         dflt=yacc;;
23054 *)
23055         dflt="$yacc";;
23056 esac
23057 echo " "
23058 comp='yacc'
23059 if $test -f "$byacc$_exe"; then
23060         dflt="$byacc"
23061         comp="byacc or $comp"
23062 fi
23063 if $test -f "$bison$_exe"; then
23064         comp="$comp or bison -y"
23065 fi
23066 rp="Which compiler compiler ($comp) shall I use?"
23067 . ./myread
23068 yacc="$ans"
23069 case "$yacc" in
23070 *bis*)
23071         case "$yacc" in
23072         *-y*) ;;
23073         *)
23074                 yacc="$yacc -y"
23075                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23076                 ;;
23077         esac
23078         ;;
23079 esac
23080
23081 : see if this is a assert.h system
23082 set assert.h i_assert
23083 eval $inhdr
23084
23085 : see if this is a bfd.h system
23086 set bfd.h i_bfd
23087 eval $inhdr
23088
23089 : see if this is an execinfo.h system
23090 set execinfo.h i_execinfo
23091 eval $inhdr
23092
23093 : see if this is a fenv.h system
23094 set fenv.h i_fenv
23095 eval $inhdr
23096
23097 : see if this is a fp.h system
23098 set fp.h i_fp
23099 eval $inhdr
23100
23101 : see if this is a fp_class.h system
23102 set fp_class.h i_fp_class
23103 eval $inhdr
23104
23105 : see if gdbm.h is available
23106 set gdbm.h t_gdbm
23107 eval $inhdr
23108 case "$t_gdbm" in
23109 $define)
23110         : see if gdbm_open exists
23111         set gdbm_open d_gdbm_open
23112         eval $inlibc
23113         case "$d_gdbm_open" in
23114         $undef)
23115                 t_gdbm="$undef"
23116                 echo "We won't be including <gdbm.h>"
23117                 ;;
23118         esac
23119         ;;
23120 esac
23121 val="$t_gdbm"
23122 set i_gdbm
23123 eval $setvar
23124
23125 : see if this is a ieeefp.h system
23126 case "$i_ieeefp" in
23127 '' ) set ieeefp.h i_ieeefp
23128      eval $inhdr
23129      ;;
23130 esac
23131
23132 : see if this is a libutil.h system
23133 set libutil.h i_libutil
23134 eval $inhdr
23135
23136 : see if mach cthreads are available
23137 if test "X$usethreads" = "X$define"; then
23138         set mach/cthreads.h i_machcthr
23139         eval $inhdr
23140 else
23141         i_machcthr="$undef"
23142 fi
23143
23144 : see if this is a mntent.h system
23145 set mntent.h i_mntent
23146 eval $inhdr
23147
23148 : see if net/errno.h is available
23149 val=''
23150 set net/errno.h val
23151 eval $inhdr
23152
23153 : Unfortunately, it causes problems on some systems.  Arrgh.
23154 case "$val" in
23155 $define)
23156         cat > try.c <<'EOM'
23157 #include <stdio.h>
23158 #include <errno.h>
23159 #include <net/errno.h>
23160 int func()
23161 {
23162         return ENOTSOCK;
23163 }
23164 EOM
23165         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23166                 echo "We'll be including <net/errno.h>." >&4
23167         else
23168                 echo "We won't be including <net/errno.h>." >&4
23169                 val="$undef"
23170         fi
23171         $rm_try
23172         ;;
23173 esac
23174 set i_neterrno
23175 eval $setvar
23176
23177 : see if netinet/tcp.h is available
23178 set netinet/tcp.h i_netinettcp
23179 eval $inhdr
23180
23181 : see if this is a poll.h system
23182 set poll.h i_poll
23183 eval $inhdr
23184
23185 : see if this is a prot.h system
23186 set prot.h i_prot
23187 eval $inhdr
23188
23189 : Preprocessor symbols
23190 echo " "
23191 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23192 $cat <<'EOSH' > Cppsym.know
23193 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23194 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23195 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23196 arch_pwr ardent ARM ARM32 atarist att386 att3b
23197 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23198 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23199 byteorder byte_order
23200 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23201 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23202 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23203 ELF encore EPI EXTENSIONS
23204 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23205 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23206 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23207 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23208 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23209 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23210 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23211 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23212 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23213 ksr1
23214 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23215 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23216 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23217 luna88k Lynx
23218 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23219 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23220 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23221 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23222 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23223 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23224 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23225 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23226 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23227 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23228 ns32000 ns32016 ns32332 ns32k nsc32000
23229 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23230 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23231 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23232 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23233 QK_USER QNX
23234 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23235 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23236 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23237 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23238 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23239 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23240 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23241 SYSV4 SYSV5 sysV68 sysV88
23242 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23243 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23244 tower32_800 tower32_850 tss
23245 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23246 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23247 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23248 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23249 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23250 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23251 uxpm uxps
23252 vax venix VMESA vms
23253 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23254 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23255 z8000 zarch
23256 EOSH
23257 # Maybe put other stuff here too.
23258 ./tr '-' '_' <<EOSH >>Cppsym.know
23259 $osname
23260 EOSH
23261 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23262 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23263 $cat Cppsym.know > Cppsym.c
23264 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23265 $rm -f Cppsym.a Cppsym.b Cppsym.c
23266 cat <<EOSH > Cppsym
23267 $startsh
23268 if $test \$# -gt 0; then
23269     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23270     if $test -s Cppsym.got; then
23271         $rm -f Cppsym.got
23272         exit 0
23273     fi
23274     $rm -f Cppsym.got
23275     exit 1
23276 else
23277     $tr " " "$trnl" | ./Cppsym.try
23278     exit 0
23279 fi
23280 EOSH
23281 chmod +x Cppsym
23282 $eunicefix Cppsym
23283 cat <<EOSH > Cppsym.try
23284 $startsh
23285 cat <<'EOCP' > try.c
23286 #include <stdio.h>
23287 #if cpp_stuff == 1
23288 #define STRINGIFY(a)    "a"
23289 #endif
23290 #if cpp_stuff == 42
23291 #define StGiFy(a)  #a
23292 #define STRINGIFY(a)    StGiFy(a)
23293 #endif
23294 #if $cpp_stuff != 1 && $cpp_stuff != 42
23295 #   include "Bletch: How does this C preprocessor stringify macros?"
23296 #endif
23297 int main() {
23298 EOCP
23299 $awk \\
23300 EOSH
23301 cat <<'EOSH' >> Cppsym.try
23302 'length($1) > 0 {
23303     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23304     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23305     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23306     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23307 }'       >> try.c
23308 echo 'return 0;}' >> try.c
23309 EOSH
23310 cat <<EOSH >> Cppsym.try
23311 ccflags="$ccflags"
23312 case "$osname-$gccversion" in
23313 irix-) ccflags="\$ccflags -woff 1178" ;;
23314 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23315 esac
23316 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23317 EOSH
23318 chmod +x Cppsym.try
23319 $eunicefix Cppsym.try
23320 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23321 : Add in any Linux cpp "predefined macros":
23322 case "$osname::$gccversion" in
23323   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23324     tHdrH=_tmpHdr
23325     rm -f $tHdrH'.h' $tHdrH
23326     touch $tHdrH'.h'
23327     # Filter out macro arguments, such as Linux's __INT8_C(c)
23328     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23329        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23330        if [ -s $tHdrH'_cppsym.real' ]; then
23331           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23332        fi
23333     fi
23334     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23335   ;;
23336 esac
23337 : now check the C compiler for additional symbols
23338 postprocess_cc_v=''
23339 case "$osname" in
23340 aix) postprocess_cc_v="|$tr , ' '" ;;
23341 esac
23342 $cat >ccsym <<EOS
23343 $startsh
23344 $cat >tmp.c <<EOF
23345 extern int foo;
23346 EOF
23347 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23348 do
23349         case "\$i" in
23350         -D*) echo "\$i" | $sed 's/^-D//';;
23351         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23352         esac
23353 done
23354 $rm_try
23355 EOS
23356 postprocess_cc_v=''
23357 chmod +x ccsym
23358 $eunicefix ccsym
23359 ./ccsym > ccsym1.raw
23360 if $test -s ccsym1.raw; then
23361     $sort ccsym1.raw | $uniq >ccsym.raw
23362 else
23363     mv ccsym1.raw ccsym.raw
23364 fi
23365
23366 $awk '/\=/ { print $0; next }
23367         { print $0"=1" }' ccsym.raw >ccsym.list
23368 $comm -13 Cppsym.true ccsym.list >ccsym.own
23369 $comm -12 Cppsym.true ccsym.list >ccsym.com
23370 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23371 also=''
23372 if $test -z ccsym.raw; then
23373         echo "Your C compiler doesn't seem to define any symbols!" >&4
23374         echo " "
23375         echo "However, your C preprocessor defines the following symbols:"
23376         $cat Cppsym.true
23377         ccsymbols=''
23378         cppsymbols=`$cat Cppsym.true`
23379         cppsymbols=`echo $cppsymbols`
23380         cppccsymbols="$cppsymbols"
23381 else
23382         if $test -s ccsym.com; then
23383                 echo "Your C compiler and pre-processor define these symbols:"
23384                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23385                 also='also '
23386                 symbols='ones'
23387                 cppccsymbols=`$cat ccsym.com`
23388                 cppccsymbols=`echo $cppccsymbols`
23389                 $test "$silent" || sleep 1
23390         fi
23391         if $test -s ccsym.cpp; then
23392                 $test "$also" && echo " "
23393                 echo "Your C pre-processor ${also}defines the following symbols:"
23394                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23395                 also='further '
23396                 cppsymbols=`$cat ccsym.cpp`
23397                 cppsymbols=`echo $cppsymbols`
23398                 $test "$silent" || sleep 1
23399         fi
23400         if $test -s ccsym.own; then
23401                 $test "$also" && echo " "
23402                 echo "Your C compiler ${also}defines the following cpp symbols:"
23403                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23404                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23405                 ccsymbols=`$cat ccsym.own`
23406                 ccsymbols=`echo $ccsymbols`
23407                 $test "$silent" || sleep 1
23408         fi
23409 fi
23410
23411 : add -D_FORTIFY_SOURCE if feasible and not already there
23412 case "$gccversion" in
23413 [45].*) case "$optimize$ccflags" in
23414         *-O*)   case "$ccflags$cppsymbols" in
23415                 *_FORTIFY_SOURCE=*) # Don't add it again.
23416                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23417                         ;;
23418                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23419                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23420                         ;;
23421                 esac
23422                 ;;
23423         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23424                 ;;
23425         esac
23426         ;;
23427 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23428         ;;
23429 esac
23430
23431 : see if this is a termio system
23432 val="$undef"
23433 val2="$undef"
23434 val3="$undef"
23435 if $test `./findhdr termios.h`; then
23436     set tcsetattr i_termios
23437     eval $inlibc
23438     val3="$i_termios"
23439 fi
23440 echo " "
23441 case "$val3" in
23442     "$define") echo "You have POSIX termios.h... good!" >&4;;
23443     *)  if ./Cppsym pyr; then
23444             case "`$run /bin/universe`" in
23445                 ucb) if $test `./findhdr sgtty.h`; then
23446                         val2="$define"
23447                         echo "<sgtty.h> found." >&4
23448                     else
23449                         echo "System is pyramid with BSD universe."
23450                         ./warn "<sgtty.h> not found--you could have problems."
23451                     fi;;
23452                 *)  if $test `./findhdr termio.h`; then
23453                         val="$define"
23454                         echo "<termio.h> found." >&4
23455                     else
23456                         echo "System is pyramid with USG universe."
23457                         ./warn "<termio.h> not found--you could have problems."
23458                     fi;;
23459             esac
23460         elif ./usg; then
23461             if $test `./findhdr termio.h`; then
23462                 echo "<termio.h> found." >&4
23463                 val="$define"
23464             elif $test `./findhdr sgtty.h`; then
23465                 echo "<sgtty.h> found." >&4
23466                 val2="$define"
23467             else
23468                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23469             fi
23470         else
23471             if $test `./findhdr sgtty.h`; then
23472                 echo "<sgtty.h> found." >&4
23473                 val2="$define"
23474             elif $test `./findhdr termio.h`; then
23475                 echo "<termio.h> found." >&4
23476                 val="$define"
23477             else
23478                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23479             fi
23480         fi;;
23481 esac
23482 set i_termio; eval $setvar
23483 val=$val2; set i_sgtty; eval $setvar
23484 val=$val3; set i_termios; eval $setvar
23485
23486 : see if stdbool is available
23487 : we want a real compile instead of Inhdr because some Solaris systems
23488 : have stdbool.h, but it can only be used if the compiler indicates it
23489 : is sufficiently c99-compliant.
23490 echo " "
23491 $cat >try.c <<EOCP
23492 #include <stdio.h>
23493 #include <stdbool.h>
23494 int func(bool x)
23495 {
23496     return x ? 1 : 0;
23497 }
23498 int main(int argc, char **argv)
23499 {
23500     return func(0);
23501 }
23502 EOCP
23503 set try
23504 if eval $compile; then
23505         echo "<stdbool.h> found." >&4
23506         val="$define"
23507 else
23508         echo "<stdbool.h> NOT found." >&4
23509         val="$undef"
23510 fi
23511 $rm_try
23512 set i_stdbool
23513 eval $setvar
23514
23515 : see if stddef is available
23516 set stddef.h i_stddef
23517 eval $inhdr
23518
23519 : see if stdint is available
23520 set stdint.h i_stdint
23521 eval $inhdr
23522
23523 : see if sys/access.h is available
23524 set sys/access.h i_sysaccess
23525 eval $inhdr
23526
23527 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23528 set sys/filio.h i_sysfilio
23529 eval $inhdr
23530 echo " "
23531 if $test `./findhdr sys/ioctl.h`; then
23532         val="$define"
23533         echo '<sys/ioctl.h> found.' >&4
23534 else
23535         val="$undef"
23536         if $test $i_sysfilio = "$define"; then
23537             echo '<sys/ioctl.h> NOT found.' >&4
23538         else
23539                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23540                 $test $i_termio = "$define" && xxx="termio.h"
23541                 $test $i_termios = "$define" && xxx="termios.h"
23542 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23543         fi
23544 fi
23545 set i_sysioctl
23546 eval $setvar
23547
23548 : see if socket ioctl defs are in sys/sockio.h
23549 echo " "
23550 xxx=`./findhdr sys/sockio.h`
23551 if $test "$xxx"; then
23552         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23553                 val="$define"
23554                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23555         else
23556                 val="$undef"
23557                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23558         fi
23559 else
23560         val="$undef"
23561         $cat <<EOM
23562 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23563 EOM
23564 fi
23565 set i_syssockio
23566 eval $setvar
23567
23568 : see if this is a syslog.h system
23569 set syslog.h i_syslog
23570 eval $inhdr
23571
23572 : see if this is a sys/mode.h system
23573 set sys/mode.h i_sysmode
23574 eval $inhdr
23575
23576 : see if there is a sys/poll.h file
23577 set sys/poll.h i_syspoll
23578 eval $inhdr
23579
23580 : see if sys/resource.h has to be included
23581 set sys/resource.h i_sysresrc
23582 eval $inhdr
23583
23584 : see if sys/security.h is available
23585 set sys/security.h i_syssecrt
23586 eval $inhdr
23587
23588 : see if this is a sys/statvfs.h system
23589 set sys/statvfs.h i_sysstatvfs
23590 eval $inhdr
23591
23592 : see if this is a sys/un.h system
23593 set sys/un.h i_sysun
23594 eval $inhdr
23595
23596 : see if this is a sys/utsname.h system
23597 set sys/utsname.h i_sysutsname
23598 eval $inhdr
23599
23600 : see if this is a syswait system
23601 set sys/wait.h i_syswait
23602 eval $inhdr
23603
23604 : see if this is a ustat.h system
23605 set ustat.h i_ustat
23606 eval $inhdr
23607
23608 : see if this is an utime system
23609 set utime.h i_utime
23610 eval $inhdr
23611
23612 : see if this is a vfork system
23613 case "$d_vfork" in
23614 "$define")
23615         set vfork.h i_vfork
23616         eval $inhdr
23617         ;;
23618 *)
23619         i_vfork="$undef"
23620         ;;
23621 esac
23622
23623 : Check extensions
23624 echo " "
23625 echo "Looking for extensions..." >&4
23626 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23627 : contain old or inaccurate or duplicate values.
23628 nonxs_extensions=''
23629 xs_extensions=''
23630 : We do not use find because it might not be available.
23631 : We do not just use MANIFEST because the user may have dropped
23632 : some additional extensions into the source tree and expect them
23633 : to be built.
23634
23635 : Function to recursively find available extensions, ignoring DynaLoader
23636 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23637 : In 5.10.1 and later, extensions are stored in directories
23638 : like File-Glob instead of the older File/Glob/.
23639 find_extensions='
23640     for xxx in *; do
23641         case "$xxx" in
23642             DynaLoader|dynaload) ;;
23643             *)
23644             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23645             case "$this_ext" in
23646                 Scalar/List/Utils) this_ext="List/Util" ;;
23647                 PathTools)         this_ext="Cwd"       ;;
23648             esac;
23649             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23650             if $contains " $this_ext " "$tdir/$$.tmp"; then
23651                 echo >&4;
23652                 echo "Duplicate directories detected for extension $xxx" >&4;
23653                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23654                 case "$knowitall" in
23655                 "") dflt=y;;
23656                 *) dflt=n;;
23657                 esac;
23658                 . ../UU/myread;
23659                 case "$ans" in
23660                 n*|N*) ;;
23661                 *) echo >&4;
23662                     echo "Ok.  Stopping Configure." >&4;
23663                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23664                     exit 1;;
23665                 esac;
23666                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23667             fi;
23668             $ls -1 "$xxx" > "$tdir/$$.tmp";
23669             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23670                 xs_extensions="$xs_extensions $this_ext";
23671             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23672                 xs_extensions="$xs_extensions $this_ext";
23673             elif $test -d "$xxx"; then
23674                 nonxs_extensions="$nonxs_extensions $this_ext";
23675             fi;
23676             $rm -f "$tdir/$$.tmp";
23677             ;;
23678         esac;
23679     done'
23680 tdir=`pwd`
23681 cd "$rsrc/cpan"
23682 set X
23683 shift
23684 eval $find_extensions
23685 cd "$rsrc/dist"
23686 set X
23687 shift
23688 eval $find_extensions
23689 cd "$rsrc/ext"
23690 set X
23691 shift
23692 eval $find_extensions
23693 set X $xs_extensions
23694 shift
23695 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23696 set X $nonxs_extensions
23697 shift
23698 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23699 cd "$tdir"
23700 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23701
23702 : Now see which are supported on this system.
23703 avail_ext=''
23704 for xxx in $xs_extensions ; do
23705         case "$xxx" in
23706         Amiga*)
23707                 case "$osname" in
23708                 amigaos) avail_ext="$avail_ext $xxx" ;;
23709                 esac
23710                 ;;
23711         DB_File|db_file)
23712                 case "$i_db" in
23713                 $define) avail_ext="$avail_ext $xxx" ;;
23714                 esac
23715                 ;;
23716         GDBM_File|gdbm_fil)
23717                 case "$i_gdbm" in
23718                 $define) avail_ext="$avail_ext $xxx" ;;
23719                 esac
23720                 ;;
23721         I18N/Langinfo|i18n_lan)
23722                 case "$i_langinfo$d_nl_langinfo" in
23723                 $define$define) avail_ext="$avail_ext $xxx" ;;
23724                 esac
23725                 ;;
23726         IPC/SysV|ipc/sysv)
23727                 : XXX Do we need a useipcsysv variable here
23728                 case "${d_msg}${d_sem}${d_shm}" in
23729                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23730                 esac
23731                 ;;
23732         NDBM_File|ndbm_fil)
23733                 case "$d_ndbm" in
23734                 $define)
23735                     case "$osname-$use64bitint" in
23736                     hpux-define)
23737                         case "$libs" in
23738                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23739                         esac
23740                         ;;
23741                     *) avail_ext="$avail_ext $xxx" ;;
23742                     esac
23743                     ;;
23744                 esac
23745                 ;;
23746         ODBM_File|odbm_fil)
23747                 case "${i_dbm}${i_rpcsvcdbm}" in
23748                 *"${define}"*)
23749                     case "$d_cplusplus" in
23750                     define) ;; # delete as a function name will not work
23751                     *)  case "$osname-$use64bitint" in
23752                         hpux-define)
23753                             case "$libs" in
23754                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23755                             esac
23756                             ;;
23757                         *) avail_ext="$avail_ext $xxx" ;;
23758                         esac
23759                         ;;
23760                     esac
23761                     ;;
23762                 esac
23763                 ;;
23764         Opcode|opcode)
23765                 case "$useopcode" in
23766                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23767                 esac
23768                 ;;
23769         POSIX|posix)
23770                 case "$useposix" in
23771                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23772                 esac
23773                 ;;
23774         Socket|socket)
23775                 case "$d_socket" in
23776                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23777                 esac
23778                 ;;
23779         Sys/Syslog|sys/syslog)
23780                 case $osname in
23781                         amigaos) ;; # not really very useful on AmigaOS
23782                         *)
23783                         : XXX syslog requires socket
23784                         case "$d_socket" in
23785                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23786                         esac
23787                         ;;
23788                 esac
23789                 ;;
23790         Thread|thread)
23791                 case "$usethreads" in
23792                 true|$define|y)
23793                         case "$use5005threads" in
23794                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23795                         esac
23796                 esac
23797                 ;;
23798         threads|threads/shared)
23799                 # threads and threads::shared are special cases.
23800                 # To stop people from asking "Perl 5.8.0 was supposed
23801                 # to have this new fancy threads implementation but my
23802                 # perl doesn't have it" and from people trying to
23803                 # (re)install the threads module using CPAN.pm and
23804                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23805                 # the threads.pm and threads/shared.pm will always be
23806                 # there, croaking informatively ("you need to rebuild
23807                 # all of Perl with threads, sorry") when threads haven't
23808                 # been compiled in.
23809                 # --jhi
23810                 avail_ext="$avail_ext $xxx"
23811                 ;;
23812         VMS*)
23813                 ;;
23814         Win32*)
23815                 case "$osname" in
23816                 cygwin) avail_ext="$avail_ext $xxx" ;;
23817                 esac
23818                 ;;
23819         XS/APItest|xs/apitest)
23820                 # This is just for testing.  Skip it unless we have dynamic loading.
23821
23822                 case "$usedl" in
23823                 $define) avail_ext="$avail_ext $xxx" ;;
23824                 esac
23825                 ;;
23826         XS/Typemap|xs/typemap)
23827                 # This is just for testing.  Skip it unless we have dynamic loading.
23828                 case "$usedl" in
23829                 $define) avail_ext="$avail_ext $xxx" ;;
23830                 esac
23831                 ;;
23832         *)      avail_ext="$avail_ext $xxx"
23833                 ;;
23834         esac
23835 done
23836
23837 set X $avail_ext
23838 shift
23839 avail_ext="$*"
23840
23841 case "$onlyextensions" in
23842 '') ;;
23843 *)  keepextensions=''
23844     echo "You have requested that only certain extensions be included..." >&4
23845     for i in $onlyextensions; do
23846         case " $avail_ext " in
23847         *" $i "*)
23848             echo "Keeping extension $i."
23849             keepextensions="$keepextensions $i"
23850             ;;
23851         *) echo "Ignoring extension $i." ;;
23852         esac
23853     done
23854     avail_ext="$keepextensions"
23855     ;;
23856 esac
23857
23858 case "$noextensions" in
23859 '') ;;
23860 *)  keepextensions=''
23861     echo "You have requested that certain extensions be ignored..." >&4
23862     for i in $avail_ext; do
23863         case " $noextensions " in
23864         *" $i "*) echo "Ignoring extension $i." ;;
23865         *) echo "Keeping extension $i.";
23866            keepextensions="$keepextensions $i"
23867            ;;
23868         esac
23869     done
23870     avail_ext="$keepextensions"
23871     ;;
23872 esac
23873
23874 : Now see which nonxs extensions are supported on this system.
23875 : For now assume all are.
23876 nonxs_ext=''
23877 for xxx in $nonxs_extensions ; do
23878         case "$xxx" in
23879         VMS*)
23880                 ;;
23881         *)      nonxs_ext="$nonxs_ext $xxx"
23882                 ;;
23883         esac
23884 done
23885
23886 set X $nonxs_ext
23887 shift
23888 nonxs_ext="$*"
23889
23890 case $usedl in
23891 $define)
23892         $cat <<EOM
23893 A number of extensions are supplied with $package.  You may choose to
23894 compile these extensions for dynamic loading (the default), compile
23895 them into the $package executable (static loading), or not include
23896 them at all.  Answer "none" to include no extensions.
23897 Note that DynaLoader is always built and need not be mentioned here.
23898
23899 EOM
23900         case "$dynamic_ext" in
23901         '')
23902                 : Exclude those listed in static_ext
23903                 dflt=''
23904                 for xxx in $avail_ext; do
23905                         case " $static_ext " in
23906                         *" $xxx "*) ;;
23907                         *) dflt="$dflt $xxx" ;;
23908                         esac
23909                 done
23910                 set X $dflt
23911                 shift
23912                 dflt="$*"
23913                 ;;
23914         *)      dflt="$dynamic_ext"
23915                 # Perhaps we are reusing an old out-of-date config.sh.
23916                 case "$hint" in
23917                 previous)
23918                         if test X"$dynamic_ext" != X"$avail_ext"; then
23919                                 $cat <<EOM
23920 NOTICE:  Your previous config.sh list may be incorrect.
23921 The extensions now available to you are
23922         ${avail_ext}
23923 but the default list from your previous config.sh is
23924         ${dynamic_ext}
23925
23926 EOM
23927                         fi
23928                         ;;
23929                 esac
23930                 ;;
23931         esac
23932         case "$dflt" in
23933         '')     dflt=none;;
23934         esac
23935         rp="What extensions do you wish to load dynamically?"
23936         . ./myread
23937         case "$ans" in
23938         none) dynamic_ext=' ' ;;
23939         *) dynamic_ext="$ans" ;;
23940         esac
23941
23942         case "$static_ext" in
23943         '')
23944                 : Exclude those already listed in dynamic linking
23945                 dflt=''
23946                 for xxx in $avail_ext; do
23947                         case " $dynamic_ext " in
23948                         *" $xxx "*) ;;
23949                         *) dflt="$dflt $xxx" ;;
23950                         esac
23951                 done
23952                 set X $dflt
23953                 shift
23954                 dflt="$*"
23955                 ;;
23956         *)  dflt="$static_ext"
23957                 ;;
23958         esac
23959
23960         case "$dflt" in
23961         '')     dflt=none;;
23962         esac
23963         rp="What extensions do you wish to load statically?"
23964         . ./myread
23965         case "$ans" in
23966         none) static_ext=' ' ;;
23967         *) static_ext="$ans" ;;
23968         esac
23969         ;;
23970 *)
23971         $cat <<EOM
23972 A number of extensions are supplied with $package.  Answer "none"
23973 to include no extensions.
23974 Note that DynaLoader is always built and need not be mentioned here.
23975
23976 EOM
23977         case "$static_ext" in
23978         '') dflt="$avail_ext" ;;
23979         *)      dflt="$static_ext"
23980                 # Perhaps we are reusing an old out-of-date config.sh.
23981                 case "$hint" in
23982                 previous)
23983                         if test X"$static_ext" != X"$avail_ext"; then
23984                                 $cat <<EOM
23985 NOTICE:  Your previous config.sh list may be incorrect.
23986 The extensions now available to you are
23987         ${avail_ext}
23988 but the default list from your previous config.sh is
23989         ${static_ext}
23990
23991 EOM
23992                         fi
23993                         ;;
23994                 esac
23995                 ;;
23996         esac
23997         : Exclude those that are not xs extensions
23998         case "$dflt" in
23999         '')     dflt=none;;
24000         esac
24001         rp="What extensions do you wish to include?"
24002         . ./myread
24003         case "$ans" in
24004         none) static_ext=' ' ;;
24005         *) static_ext="$ans" ;;
24006         esac
24007         ;;
24008 esac
24009 #
24010 # Encode is a special case.  If we are building Encode as a static
24011 # extension, we need to explicitly list its subextensions as well.
24012 # For other nested extensions, this is handled automatically by
24013 # the appropriate Makefile.PL.
24014 case " $static_ext " in
24015         *" Encode "*) # Add the subextensions of Encode
24016         cd "$rsrc/cpan"
24017         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24018                 static_ext="$static_ext Encode/$xxx"
24019                 known_extensions="$known_extensions Encode/$xxx"
24020         done
24021         cd "$tdir"
24022         ;;
24023 esac
24024
24025 set X $dynamic_ext $static_ext $nonxs_ext
24026 shift
24027 extensions="$*"
24028
24029 # Sanity check:  We require an extension suitable for use with
24030 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
24031 # should show up as failures in the test suite, but it's helpful to
24032 # catch them now.) The 'extensions' list is normally sorted
24033 # alphabetically, so we need to accept either
24034 #    DB_File ... Fcntl ... IO  ....
24035 # or something like
24036 #    Fcntl ... NDBM_File ... IO  ....
24037 case " $extensions"  in
24038 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
24039 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24040 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24041 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24042    echo "WARNING: The Perl you are building will be quite crippled." >& 4
24043    ;;
24044 esac
24045
24046 : Remove libraries needed only for extensions
24047 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24048 : The exception is SunOS 4.x, which needs them.
24049 case "${osname}X${osvers}" in
24050 sunos*X4*)
24051     perllibs="$libs"
24052     ;;
24053 *) case "$usedl" in
24054     $define|true|[yY]*)
24055             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24056             shift
24057             perllibs="$*"
24058             ;;
24059     *)  perllibs="$libs"
24060             ;;
24061     esac
24062     ;;
24063 esac
24064
24065 : Remove build directory name from cppstdin so it can be used from
24066 : either the present location or the final installed location.
24067 echo " "
24068 : Get out of the UU directory to get correct path name.
24069 cd ..
24070 case "$cppstdin" in
24071 `pwd`/cppstdin)
24072         echo "Stripping down cppstdin path name"
24073         cppstdin=cppstdin
24074         ;;
24075 esac
24076 cd UU
24077
24078 : end of configuration questions
24079 echo " "
24080 echo "End of configuration questions."
24081 echo " "
24082
24083 : back to where it started
24084 if test -d ../UU; then
24085         cd ..
24086 fi
24087
24088 : configuration may be unconditionally patched via a 'config.arch' file
24089 if $test -f config.arch; then
24090         echo "I see a config.arch file, loading it." >&4
24091         . ./config.arch
24092 fi
24093
24094 : configuration may be patched via a 'config.over' file
24095 if $test -f config.over; then
24096         echo " "
24097         dflt=y
24098         rp='I see a config.over file.  Do you wish to load it?'
24099         . UU/myread
24100         case "$ans" in
24101         n*) echo "OK, I'll ignore it.";;
24102         *)      . ./config.over
24103                 echo "Configuration override changes have been loaded."
24104                 ;;
24105         esac
24106 fi
24107
24108 : in case they want portability, strip down executable paths
24109 case "$d_portable" in
24110 "$define")
24111         echo " "
24112         echo "Stripping down executable paths..." >&4
24113         for file in $loclist $trylist; do
24114                 eval temp=\$$file
24115                 eval $file=`basename $temp`
24116         done
24117         ;;
24118 esac
24119
24120 : create config.sh file
24121 echo " "
24122 echo "Creating config.sh..." >&4
24123 $spitshell <<EOT >config.sh
24124 $startsh
24125 #
24126 # This file was produced by running the Configure script. It holds all the
24127 # definitions figured out by Configure. Should you modify one of these values,
24128 # do not forget to propagate your changes by running "Configure -der". You may
24129 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24130 #
24131
24132 # Package name      : $package
24133 # Source directory  : $src
24134 # Configuration time: $cf_time
24135 # Configured by     : $cf_by
24136 # Target system     : $myuname
24137
24138 EOT
24139 : Add in command line options if available
24140 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24141
24142 $spitshell <<EOT >>config.sh
24143
24144 Author='$Author'
24145 Date='$Date'
24146 Header='$Header'
24147 Id='$Id'
24148 Locker='$Locker'
24149 Log='$Log'
24150 RCSfile='$RCSfile'
24151 Revision='$Revision'
24152 Source='$Source'
24153 State='$State'
24154 _a='$_a'
24155 _exe='$_exe'
24156 _o='$_o'
24157 afs='$afs'
24158 afsroot='$afsroot'
24159 alignbytes='$alignbytes'
24160 ansi2knr='$ansi2knr'
24161 aphostname='$aphostname'
24162 api_revision='$api_revision'
24163 api_subversion='$api_subversion'
24164 api_version='$api_version'
24165 api_versionstring='$api_versionstring'
24166 ar='$ar'
24167 archlib='$archlib'
24168 archlibexp='$archlibexp'
24169 archname64='$archname64'
24170 archname='$archname'
24171 archobjs='$archobjs'
24172 asctime_r_proto='$asctime_r_proto'
24173 awk='$awk'
24174 baserev='$baserev'
24175 bash='$bash'
24176 bin='$bin'
24177 bin_ELF='$bin_ELF'
24178 binexp='$binexp'
24179 bison='$bison'
24180 byacc='$byacc'
24181 byteorder='$byteorder'
24182 c='$c'
24183 castflags='$castflags'
24184 cat='$cat'
24185 cc='$cc'
24186 cccdlflags='$cccdlflags'
24187 ccdlflags='$ccdlflags'
24188 ccflags='$ccflags'
24189 ccflags_uselargefiles='$ccflags_uselargefiles'
24190 ccname='$ccname'
24191 ccsymbols='$ccsymbols'
24192 ccversion='$ccversion'
24193 cf_by='$cf_by'
24194 cf_email='$cf_email'
24195 cf_time='$cf_time'
24196 charbits='$charbits'
24197 charsize='$charsize'
24198 chgrp='$chgrp'
24199 chmod='$chmod'
24200 chown='$chown'
24201 clocktype='$clocktype'
24202 comm='$comm'
24203 compress='$compress'
24204 contains='$contains'
24205 cp='$cp'
24206 cpio='$cpio'
24207 cpp='$cpp'
24208 cpp_stuff='$cpp_stuff'
24209 cppccsymbols='$cppccsymbols'
24210 cppflags='$cppflags'
24211 cpplast='$cpplast'
24212 cppminus='$cppminus'
24213 cpprun='$cpprun'
24214 cppstdin='$cppstdin'
24215 cppsymbols='$cppsymbols'
24216 crypt_r_proto='$crypt_r_proto'
24217 cryptlib='$cryptlib'
24218 csh='$csh'
24219 ctermid_r_proto='$ctermid_r_proto'
24220 ctime_r_proto='$ctime_r_proto'
24221 d_Gconvert='$d_Gconvert'
24222 d_PRIEUldbl='$d_PRIEUldbl'
24223 d_PRIFUldbl='$d_PRIFUldbl'
24224 d_PRIGUldbl='$d_PRIGUldbl'
24225 d_PRIXU64='$d_PRIXU64'
24226 d_PRId64='$d_PRId64'
24227 d_PRIeldbl='$d_PRIeldbl'
24228 d_PRIfldbl='$d_PRIfldbl'
24229 d_PRIgldbl='$d_PRIgldbl'
24230 d_PRIi64='$d_PRIi64'
24231 d_PRIo64='$d_PRIo64'
24232 d_PRIu64='$d_PRIu64'
24233 d_PRIx64='$d_PRIx64'
24234 d_SCNfldbl='$d_SCNfldbl'
24235 d__fwalk='$d__fwalk'
24236 d_access='$d_access'
24237 d_accessx='$d_accessx'
24238 d_acosh='$d_acosh'
24239 d_aintl='$d_aintl'
24240 d_alarm='$d_alarm'
24241 d_archlib='$d_archlib'
24242 d_asctime64='$d_asctime64'
24243 d_asctime_r='$d_asctime_r'
24244 d_asinh='$d_asinh'
24245 d_atanh='$d_atanh'
24246 d_atolf='$d_atolf'
24247 d_atoll='$d_atoll'
24248 d_attribute_deprecated='$d_attribute_deprecated'
24249 d_attribute_format='$d_attribute_format'
24250 d_attribute_malloc='$d_attribute_malloc'
24251 d_attribute_nonnull='$d_attribute_nonnull'
24252 d_attribute_noreturn='$d_attribute_noreturn'
24253 d_attribute_pure='$d_attribute_pure'
24254 d_attribute_unused='$d_attribute_unused'
24255 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24256 d_backtrace='$d_backtrace'
24257 d_bcmp='$d_bcmp'
24258 d_bcopy='$d_bcopy'
24259 d_bsd='$d_bsd'
24260 d_bsdgetpgrp='$d_bsdgetpgrp'
24261 d_bsdsetpgrp='$d_bsdsetpgrp'
24262 d_builtin_choose_expr='$d_builtin_choose_expr'
24263 d_builtin_expect='$d_builtin_expect'
24264 d_bzero='$d_bzero'
24265 d_c99_variadic_macros='$d_c99_variadic_macros'
24266 d_casti32='$d_casti32'
24267 d_castneg='$d_castneg'
24268 d_cbrt='$d_cbrt'
24269 d_charvspr='$d_charvspr'
24270 d_chown='$d_chown'
24271 d_chroot='$d_chroot'
24272 d_chsize='$d_chsize'
24273 d_class='$d_class'
24274 d_clearenv='$d_clearenv'
24275 d_closedir='$d_closedir'
24276 d_cmsghdr_s='$d_cmsghdr_s'
24277 d_const='$d_const'
24278 d_copysign='$d_copysign'
24279 d_copysignl='$d_copysignl'
24280 d_cplusplus='$d_cplusplus'
24281 d_crypt='$d_crypt'
24282 d_crypt_r='$d_crypt_r'
24283 d_csh='$d_csh'
24284 d_ctermid='$d_ctermid'
24285 d_ctermid_r='$d_ctermid_r'
24286 d_ctime64='$d_ctime64'
24287 d_ctime_r='$d_ctime_r'
24288 d_cuserid='$d_cuserid'
24289 d_dbl_dig='$d_dbl_dig'
24290 d_dbminitproto='$d_dbminitproto'
24291 d_difftime64='$d_difftime64'
24292 d_difftime='$d_difftime'
24293 d_dir_dd_fd='$d_dir_dd_fd'
24294 d_dirfd='$d_dirfd'
24295 d_dirnamlen='$d_dirnamlen'
24296 d_dladdr='$d_dladdr'
24297 d_dlerror='$d_dlerror'
24298 d_dlopen='$d_dlopen'
24299 d_dlsymun='$d_dlsymun'
24300 d_dosuid='$d_dosuid'
24301 d_drand48_r='$d_drand48_r'
24302 d_drand48proto='$d_drand48proto'
24303 d_dup2='$d_dup2'
24304 d_duplocale='$d_duplocale'
24305 d_eaccess='$d_eaccess'
24306 d_endgrent='$d_endgrent'
24307 d_endgrent_r='$d_endgrent_r'
24308 d_endhent='$d_endhent'
24309 d_endhostent_r='$d_endhostent_r'
24310 d_endnent='$d_endnent'
24311 d_endnetent_r='$d_endnetent_r'
24312 d_endpent='$d_endpent'
24313 d_endprotoent_r='$d_endprotoent_r'
24314 d_endpwent='$d_endpwent'
24315 d_endpwent_r='$d_endpwent_r'
24316 d_endsent='$d_endsent'
24317 d_endservent_r='$d_endservent_r'
24318 d_eofnblk='$d_eofnblk'
24319 d_erf='$d_erf'
24320 d_erfc='$d_erfc'
24321 d_eunice='$d_eunice'
24322 d_exp2='$d_exp2'
24323 d_expm1='$d_expm1'
24324 d_faststdio='$d_faststdio'
24325 d_fchdir='$d_fchdir'
24326 d_fchmod='$d_fchmod'
24327 d_fchown='$d_fchown'
24328 d_fcntl='$d_fcntl'
24329 d_fcntl_can_lock='$d_fcntl_can_lock'
24330 d_fd_macros='$d_fd_macros'
24331 d_fd_set='$d_fd_set'
24332 d_fdclose='$d_fdclose'
24333 d_fdim='$d_fdim'
24334 d_fds_bits='$d_fds_bits'
24335 d_fegetround='$d_fegetround'
24336 d_fgetpos='$d_fgetpos'
24337 d_finite='$d_finite'
24338 d_finitel='$d_finitel'
24339 d_flexfnam='$d_flexfnam'
24340 d_flock='$d_flock'
24341 d_flockproto='$d_flockproto'
24342 d_fma='$d_fma'
24343 d_fmax='$d_fmax'
24344 d_fmin='$d_fmin'
24345 d_fork='$d_fork'
24346 d_fp_class='$d_fp_class'
24347 d_fp_classify='$d_fp_classify'
24348 d_fp_classl='$d_fp_classl'
24349 d_fpathconf='$d_fpathconf'
24350 d_fpclass='$d_fpclass'
24351 d_fpclassify='$d_fpclassify'
24352 d_fpclassl='$d_fpclassl'
24353 d_fpgetround='$d_fpgetround'
24354 d_fpos64_t='$d_fpos64_t'
24355 d_freelocale='$d_freelocale'
24356 d_frexpl='$d_frexpl'
24357 d_fs_data_s='$d_fs_data_s'
24358 d_fseeko='$d_fseeko'
24359 d_fsetpos='$d_fsetpos'
24360 d_fstatfs='$d_fstatfs'
24361 d_fstatvfs='$d_fstatvfs'
24362 d_fsync='$d_fsync'
24363 d_ftello='$d_ftello'
24364 d_ftime='$d_ftime'
24365 d_futimes='$d_futimes'
24366 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24367 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24368 d_getaddrinfo='$d_getaddrinfo'
24369 d_getcwd='$d_getcwd'
24370 d_getespwnam='$d_getespwnam'
24371 d_getfsstat='$d_getfsstat'
24372 d_getgrent='$d_getgrent'
24373 d_getgrent_r='$d_getgrent_r'
24374 d_getgrgid_r='$d_getgrgid_r'
24375 d_getgrnam_r='$d_getgrnam_r'
24376 d_getgrps='$d_getgrps'
24377 d_gethbyaddr='$d_gethbyaddr'
24378 d_gethbyname='$d_gethbyname'
24379 d_gethent='$d_gethent'
24380 d_gethname='$d_gethname'
24381 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24382 d_gethostbyname_r='$d_gethostbyname_r'
24383 d_gethostent_r='$d_gethostent_r'
24384 d_gethostprotos='$d_gethostprotos'
24385 d_getitimer='$d_getitimer'
24386 d_getlogin='$d_getlogin'
24387 d_getlogin_r='$d_getlogin_r'
24388 d_getmnt='$d_getmnt'
24389 d_getmntent='$d_getmntent'
24390 d_getnameinfo='$d_getnameinfo'
24391 d_getnbyaddr='$d_getnbyaddr'
24392 d_getnbyname='$d_getnbyname'
24393 d_getnent='$d_getnent'
24394 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24395 d_getnetbyname_r='$d_getnetbyname_r'
24396 d_getnetent_r='$d_getnetent_r'
24397 d_getnetprotos='$d_getnetprotos'
24398 d_getpagsz='$d_getpagsz'
24399 d_getpbyname='$d_getpbyname'
24400 d_getpbynumber='$d_getpbynumber'
24401 d_getpent='$d_getpent'
24402 d_getpgid='$d_getpgid'
24403 d_getpgrp2='$d_getpgrp2'
24404 d_getpgrp='$d_getpgrp'
24405 d_getppid='$d_getppid'
24406 d_getprior='$d_getprior'
24407 d_getprotobyname_r='$d_getprotobyname_r'
24408 d_getprotobynumber_r='$d_getprotobynumber_r'
24409 d_getprotoent_r='$d_getprotoent_r'
24410 d_getprotoprotos='$d_getprotoprotos'
24411 d_getprpwnam='$d_getprpwnam'
24412 d_getpwent='$d_getpwent'
24413 d_getpwent_r='$d_getpwent_r'
24414 d_getpwnam_r='$d_getpwnam_r'
24415 d_getpwuid_r='$d_getpwuid_r'
24416 d_getsbyname='$d_getsbyname'
24417 d_getsbyport='$d_getsbyport'
24418 d_getsent='$d_getsent'
24419 d_getservbyname_r='$d_getservbyname_r'
24420 d_getservbyport_r='$d_getservbyport_r'
24421 d_getservent_r='$d_getservent_r'
24422 d_getservprotos='$d_getservprotos'
24423 d_getspnam='$d_getspnam'
24424 d_getspnam_r='$d_getspnam_r'
24425 d_gettimeod='$d_gettimeod'
24426 d_gmtime64='$d_gmtime64'
24427 d_gmtime_r='$d_gmtime_r'
24428 d_gnulibc='$d_gnulibc'
24429 d_grpasswd='$d_grpasswd'
24430 d_hasmntopt='$d_hasmntopt'
24431 d_htonl='$d_htonl'
24432 d_hypot='$d_hypot'
24433 d_ilogb='$d_ilogb'
24434 d_ilogbl='$d_ilogbl'
24435 d_inc_version_list='$d_inc_version_list'
24436 d_index='$d_index'
24437 d_inetaton='$d_inetaton'
24438 d_inetntop='$d_inetntop'
24439 d_inetpton='$d_inetpton'
24440 d_int64_t='$d_int64_t'
24441 d_ip_mreq='$d_ip_mreq'
24442 d_ip_mreq_source='$d_ip_mreq_source'
24443 d_ipv6_mreq='$d_ipv6_mreq'
24444 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24445 d_isascii='$d_isascii'
24446 d_isblank='$d_isblank'
24447 d_isfinite='$d_isfinite'
24448 d_isfinitel='$d_isfinitel'
24449 d_isinf='$d_isinf'
24450 d_isinfl='$d_isinfl'
24451 d_isless='$d_isless'
24452 d_isnan='$d_isnan'
24453 d_isnanl='$d_isnanl'
24454 d_isnormal='$d_isnormal'
24455 d_j0='$d_j0'
24456 d_j0l='$d_j0l'
24457 d_killpg='$d_killpg'
24458 d_lc_monetary_2008='$d_lc_monetary_2008'
24459 d_lchown='$d_lchown'
24460 d_ldbl_dig='$d_ldbl_dig'
24461 d_ldexpl='$d_ldexpl'
24462 d_lgamma='$d_lgamma'
24463 d_lgamma_r='$d_lgamma_r'
24464 d_libm_lib_version='$d_libm_lib_version'
24465 d_libname_unique='$d_libname_unique'
24466 d_link='$d_link'
24467 d_llrint='$d_llrint'
24468 d_llrintl='$d_llrintl'
24469 d_llround='$d_llround'
24470 d_llroundl='$d_llroundl'
24471 d_localtime64='$d_localtime64'
24472 d_localtime_r='$d_localtime_r'
24473 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24474 d_locconv='$d_locconv'
24475 d_lockf='$d_lockf'
24476 d_log1p='$d_log1p'
24477 d_log2='$d_log2'
24478 d_logb='$d_logb'
24479 d_longdbl='$d_longdbl'
24480 d_longlong='$d_longlong'
24481 d_lrint='$d_lrint'
24482 d_lrintl='$d_lrintl'
24483 d_lround='$d_lround'
24484 d_lroundl='$d_lroundl'
24485 d_lseekproto='$d_lseekproto'
24486 d_lstat='$d_lstat'
24487 d_madvise='$d_madvise'
24488 d_malloc_good_size='$d_malloc_good_size'
24489 d_malloc_size='$d_malloc_size'
24490 d_mblen='$d_mblen'
24491 d_mbstowcs='$d_mbstowcs'
24492 d_mbtowc='$d_mbtowc'
24493 d_memchr='$d_memchr'
24494 d_memcmp='$d_memcmp'
24495 d_memcpy='$d_memcpy'
24496 d_memmem='$d_memmem'
24497 d_memmove='$d_memmove'
24498 d_memset='$d_memset'
24499 d_mkdir='$d_mkdir'
24500 d_mkdtemp='$d_mkdtemp'
24501 d_mkfifo='$d_mkfifo'
24502 d_mkstemp='$d_mkstemp'
24503 d_mkstemps='$d_mkstemps'
24504 d_mktime64='$d_mktime64'
24505 d_mktime='$d_mktime'
24506 d_mmap='$d_mmap'
24507 d_modfl='$d_modfl'
24508 d_modflproto='$d_modflproto'
24509 d_mprotect='$d_mprotect'
24510 d_msg='$d_msg'
24511 d_msg_ctrunc='$d_msg_ctrunc'
24512 d_msg_dontroute='$d_msg_dontroute'
24513 d_msg_oob='$d_msg_oob'
24514 d_msg_peek='$d_msg_peek'
24515 d_msg_proxy='$d_msg_proxy'
24516 d_msgctl='$d_msgctl'
24517 d_msgget='$d_msgget'
24518 d_msghdr_s='$d_msghdr_s'
24519 d_msgrcv='$d_msgrcv'
24520 d_msgsnd='$d_msgsnd'
24521 d_msync='$d_msync'
24522 d_munmap='$d_munmap'
24523 d_mymalloc='$d_mymalloc'
24524 d_nan='$d_nan'
24525 d_ndbm='$d_ndbm'
24526 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24527 d_nearbyint='$d_nearbyint'
24528 d_newlocale='$d_newlocale'
24529 d_nextafter='$d_nextafter'
24530 d_nexttoward='$d_nexttoward'
24531 d_nice='$d_nice'
24532 d_nl_langinfo='$d_nl_langinfo'
24533 d_nv_preserves_uv='$d_nv_preserves_uv'
24534 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24535 d_off64_t='$d_off64_t'
24536 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24537 d_oldpthreads='$d_oldpthreads'
24538 d_oldsock='$d_oldsock'
24539 d_open3='$d_open3'
24540 d_pathconf='$d_pathconf'
24541 d_pause='$d_pause'
24542 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24543 d_phostname='$d_phostname'
24544 d_pipe='$d_pipe'
24545 d_poll='$d_poll'
24546 d_portable='$d_portable'
24547 d_prctl='$d_prctl'
24548 d_prctl_set_name='$d_prctl_set_name'
24549 d_printf_format_null='$d_printf_format_null'
24550 d_procselfexe='$d_procselfexe'
24551 d_pseudofork='$d_pseudofork'
24552 d_pthread_atfork='$d_pthread_atfork'
24553 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24554 d_pthread_yield='$d_pthread_yield'
24555 d_ptrdiff_t='$d_ptrdiff_t'
24556 d_pwage='$d_pwage'
24557 d_pwchange='$d_pwchange'
24558 d_pwclass='$d_pwclass'
24559 d_pwcomment='$d_pwcomment'
24560 d_pwexpire='$d_pwexpire'
24561 d_pwgecos='$d_pwgecos'
24562 d_pwpasswd='$d_pwpasswd'
24563 d_pwquota='$d_pwquota'
24564 d_qgcvt='$d_qgcvt'
24565 d_quad='$d_quad'
24566 d_querylocale='$d_querylocale'
24567 d_random_r='$d_random_r'
24568 d_re_comp='$d_re_comp'
24569 d_readdir64_r='$d_readdir64_r'
24570 d_readdir='$d_readdir'
24571 d_readdir_r='$d_readdir_r'
24572 d_readlink='$d_readlink'
24573 d_readv='$d_readv'
24574 d_recvmsg='$d_recvmsg'
24575 d_regcmp='$d_regcmp'
24576 d_regcomp='$d_regcomp'
24577 d_remainder='$d_remainder'
24578 d_remquo='$d_remquo'
24579 d_rename='$d_rename'
24580 d_rewinddir='$d_rewinddir'
24581 d_rint='$d_rint'
24582 d_rmdir='$d_rmdir'
24583 d_round='$d_round'
24584 d_safebcpy='$d_safebcpy'
24585 d_safemcpy='$d_safemcpy'
24586 d_sanemcmp='$d_sanemcmp'
24587 d_sbrkproto='$d_sbrkproto'
24588 d_scalbn='$d_scalbn'
24589 d_scalbnl='$d_scalbnl'
24590 d_sched_yield='$d_sched_yield'
24591 d_scm_rights='$d_scm_rights'
24592 d_seekdir='$d_seekdir'
24593 d_select='$d_select'
24594 d_sem='$d_sem'
24595 d_semctl='$d_semctl'
24596 d_semctl_semid_ds='$d_semctl_semid_ds'
24597 d_semctl_semun='$d_semctl_semun'
24598 d_semget='$d_semget'
24599 d_semop='$d_semop'
24600 d_sendmsg='$d_sendmsg'
24601 d_setegid='$d_setegid'
24602 d_seteuid='$d_seteuid'
24603 d_setgrent='$d_setgrent'
24604 d_setgrent_r='$d_setgrent_r'
24605 d_setgrps='$d_setgrps'
24606 d_sethent='$d_sethent'
24607 d_sethostent_r='$d_sethostent_r'
24608 d_setitimer='$d_setitimer'
24609 d_setlinebuf='$d_setlinebuf'
24610 d_setlocale='$d_setlocale'
24611 d_setlocale_r='$d_setlocale_r'
24612 d_setnent='$d_setnent'
24613 d_setnetent_r='$d_setnetent_r'
24614 d_setpent='$d_setpent'
24615 d_setpgid='$d_setpgid'
24616 d_setpgrp2='$d_setpgrp2'
24617 d_setpgrp='$d_setpgrp'
24618 d_setprior='$d_setprior'
24619 d_setproctitle='$d_setproctitle'
24620 d_setprotoent_r='$d_setprotoent_r'
24621 d_setpwent='$d_setpwent'
24622 d_setpwent_r='$d_setpwent_r'
24623 d_setregid='$d_setregid'
24624 d_setresgid='$d_setresgid'
24625 d_setresuid='$d_setresuid'
24626 d_setreuid='$d_setreuid'
24627 d_setrgid='$d_setrgid'
24628 d_setruid='$d_setruid'
24629 d_setsent='$d_setsent'
24630 d_setservent_r='$d_setservent_r'
24631 d_setsid='$d_setsid'
24632 d_setvbuf='$d_setvbuf'
24633 d_shm='$d_shm'
24634 d_shmat='$d_shmat'
24635 d_shmatprototype='$d_shmatprototype'
24636 d_shmctl='$d_shmctl'
24637 d_shmdt='$d_shmdt'
24638 d_shmget='$d_shmget'
24639 d_sigaction='$d_sigaction'
24640 d_siginfo_si_addr='$d_siginfo_si_addr'
24641 d_siginfo_si_band='$d_siginfo_si_band'
24642 d_siginfo_si_errno='$d_siginfo_si_errno'
24643 d_siginfo_si_fd='$d_siginfo_si_fd'
24644 d_siginfo_si_pid='$d_siginfo_si_pid'
24645 d_siginfo_si_status='$d_siginfo_si_status'
24646 d_siginfo_si_uid='$d_siginfo_si_uid'
24647 d_siginfo_si_value='$d_siginfo_si_value'
24648 d_signbit='$d_signbit'
24649 d_sigprocmask='$d_sigprocmask'
24650 d_sigsetjmp='$d_sigsetjmp'
24651 d_sin6_scope_id='$d_sin6_scope_id'
24652 d_sitearch='$d_sitearch'
24653 d_snprintf='$d_snprintf'
24654 d_sockaddr_in6='$d_sockaddr_in6'
24655 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24656 d_sockatmark='$d_sockatmark'
24657 d_sockatmarkproto='$d_sockatmarkproto'
24658 d_socket='$d_socket'
24659 d_socklen_t='$d_socklen_t'
24660 d_sockpair='$d_sockpair'
24661 d_socks5_init='$d_socks5_init'
24662 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24663 d_sqrtl='$d_sqrtl'
24664 d_srand48_r='$d_srand48_r'
24665 d_srandom_r='$d_srandom_r'
24666 d_sresgproto='$d_sresgproto'
24667 d_sresuproto='$d_sresuproto'
24668 d_stat='$d_stat'
24669 d_statblks='$d_statblks'
24670 d_statfs_f_flags='$d_statfs_f_flags'
24671 d_statfs_s='$d_statfs_s'
24672 d_static_inline='$d_static_inline'
24673 d_statvfs='$d_statvfs'
24674 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24675 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24676 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24677 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24678 d_stdio_stream_array='$d_stdio_stream_array'
24679 d_stdiobase='$d_stdiobase'
24680 d_stdstdio='$d_stdstdio'
24681 d_strchr='$d_strchr'
24682 d_strcoll='$d_strcoll'
24683 d_strctcpy='$d_strctcpy'
24684 d_strerrm='$d_strerrm'
24685 d_strerror='$d_strerror'
24686 d_strerror_l='$d_strerror_l'
24687 d_strerror_r='$d_strerror_r'
24688 d_strftime='$d_strftime'
24689 d_strlcat='$d_strlcat'
24690 d_strlcpy='$d_strlcpy'
24691 d_strtod='$d_strtod'
24692 d_strtol='$d_strtol'
24693 d_strtold='$d_strtold'
24694 d_strtoll='$d_strtoll'
24695 d_strtoq='$d_strtoq'
24696 d_strtoul='$d_strtoul'
24697 d_strtoull='$d_strtoull'
24698 d_strtouq='$d_strtouq'
24699 d_strxfrm='$d_strxfrm'
24700 d_suidsafe='$d_suidsafe'
24701 d_symlink='$d_symlink'
24702 d_syscall='$d_syscall'
24703 d_syscallproto='$d_syscallproto'
24704 d_sysconf='$d_sysconf'
24705 d_sysernlst='$d_sysernlst'
24706 d_syserrlst='$d_syserrlst'
24707 d_system='$d_system'
24708 d_tcgetpgrp='$d_tcgetpgrp'
24709 d_tcsetpgrp='$d_tcsetpgrp'
24710 d_telldir='$d_telldir'
24711 d_telldirproto='$d_telldirproto'
24712 d_tgamma='$d_tgamma'
24713 d_time='$d_time'
24714 d_timegm='$d_timegm'
24715 d_times='$d_times'
24716 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24717 d_tm_tm_zone='$d_tm_tm_zone'
24718 d_tmpnam_r='$d_tmpnam_r'
24719 d_trunc='$d_trunc'
24720 d_truncate='$d_truncate'
24721 d_truncl='$d_truncl'
24722 d_ttyname_r='$d_ttyname_r'
24723 d_tzname='$d_tzname'
24724 d_u32align='$d_u32align'
24725 d_ualarm='$d_ualarm'
24726 d_umask='$d_umask'
24727 d_uname='$d_uname'
24728 d_union_semun='$d_union_semun'
24729 d_unordered='$d_unordered'
24730 d_unsetenv='$d_unsetenv'
24731 d_uselocale='$d_uselocale'
24732 d_usleep='$d_usleep'
24733 d_usleepproto='$d_usleepproto'
24734 d_ustat='$d_ustat'
24735 d_vendorarch='$d_vendorarch'
24736 d_vendorbin='$d_vendorbin'
24737 d_vendorlib='$d_vendorlib'
24738 d_vendorscript='$d_vendorscript'
24739 d_vfork='$d_vfork'
24740 d_void_closedir='$d_void_closedir'
24741 d_voidsig='$d_voidsig'
24742 d_voidtty='$d_voidtty'
24743 d_volatile='$d_volatile'
24744 d_vprintf='$d_vprintf'
24745 d_vsnprintf='$d_vsnprintf'
24746 d_wait4='$d_wait4'
24747 d_waitpid='$d_waitpid'
24748 d_wcscmp='$d_wcscmp'
24749 d_wcstombs='$d_wcstombs'
24750 d_wcsxfrm='$d_wcsxfrm'
24751 d_wctomb='$d_wctomb'
24752 d_writev='$d_writev'
24753 d_xenix='$d_xenix'
24754 date='$date'
24755 db_hashtype='$db_hashtype'
24756 db_prefixtype='$db_prefixtype'
24757 db_version_major='$db_version_major'
24758 db_version_minor='$db_version_minor'
24759 db_version_patch='$db_version_patch'
24760 direntrytype='$direntrytype'
24761 dlext='$dlext'
24762 dlsrc='$dlsrc'
24763 doubleinfbytes='$doubleinfbytes'
24764 doublekind='$doublekind'
24765 doublemantbits='$doublemantbits'
24766 doublenanbytes='$doublenanbytes'
24767 doublesize='$doublesize'
24768 drand01='$drand01'
24769 drand48_r_proto='$drand48_r_proto'
24770 dtrace='$dtrace'
24771 dtraceobject='$dtraceobject'
24772 dynamic_ext='$dynamic_ext'
24773 eagain='$eagain'
24774 ebcdic='$ebcdic'
24775 echo='$echo'
24776 egrep='$egrep'
24777 emacs='$emacs'
24778 endgrent_r_proto='$endgrent_r_proto'
24779 endhostent_r_proto='$endhostent_r_proto'
24780 endnetent_r_proto='$endnetent_r_proto'
24781 endprotoent_r_proto='$endprotoent_r_proto'
24782 endpwent_r_proto='$endpwent_r_proto'
24783 endservent_r_proto='$endservent_r_proto'
24784 eunicefix='$eunicefix'
24785 exe_ext='$exe_ext'
24786 expr='$expr'
24787 extensions='$extensions'
24788 extern_C='$extern_C'
24789 extras='$extras'
24790 fflushNULL='$fflushNULL'
24791 fflushall='$fflushall'
24792 find='$find'
24793 firstmakefile='$firstmakefile'
24794 flex='$flex'
24795 fpossize='$fpossize'
24796 fpostype='$fpostype'
24797 freetype='$freetype'
24798 from='$from'
24799 full_ar='$full_ar'
24800 full_csh='$full_csh'
24801 full_sed='$full_sed'
24802 gccansipedantic='$gccansipedantic'
24803 gccosandvers='$gccosandvers'
24804 gccversion='$gccversion'
24805 getgrent_r_proto='$getgrent_r_proto'
24806 getgrgid_r_proto='$getgrgid_r_proto'
24807 getgrnam_r_proto='$getgrnam_r_proto'
24808 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24809 gethostbyname_r_proto='$gethostbyname_r_proto'
24810 gethostent_r_proto='$gethostent_r_proto'
24811 getlogin_r_proto='$getlogin_r_proto'
24812 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24813 getnetbyname_r_proto='$getnetbyname_r_proto'
24814 getnetent_r_proto='$getnetent_r_proto'
24815 getprotobyname_r_proto='$getprotobyname_r_proto'
24816 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24817 getprotoent_r_proto='$getprotoent_r_proto'
24818 getpwent_r_proto='$getpwent_r_proto'
24819 getpwnam_r_proto='$getpwnam_r_proto'
24820 getpwuid_r_proto='$getpwuid_r_proto'
24821 getservbyname_r_proto='$getservbyname_r_proto'
24822 getservbyport_r_proto='$getservbyport_r_proto'
24823 getservent_r_proto='$getservent_r_proto'
24824 getspnam_r_proto='$getspnam_r_proto'
24825 gidformat='$gidformat'
24826 gidsign='$gidsign'
24827 gidsize='$gidsize'
24828 gidtype='$gidtype'
24829 glibpth='$glibpth'
24830 gmake='$gmake'
24831 gmtime_r_proto='$gmtime_r_proto'
24832 gnulibc_version='$gnulibc_version'
24833 grep='$grep'
24834 groupcat='$groupcat'
24835 groupstype='$groupstype'
24836 gzip='$gzip'
24837 h_fcntl='$h_fcntl'
24838 h_sysfile='$h_sysfile'
24839 hint='$hint'
24840 hostcat='$hostcat'
24841 hostgenerate='$hostgenerate'
24842 hostosname='$hostosname'
24843 hostperl='$hostperl'
24844 html1dir='$html1dir'
24845 html1direxp='$html1direxp'
24846 html3dir='$html3dir'
24847 html3direxp='$html3direxp'
24848 i16size='$i16size'
24849 i16type='$i16type'
24850 i32size='$i32size'
24851 i32type='$i32type'
24852 i64size='$i64size'
24853 i64type='$i64type'
24854 i8size='$i8size'
24855 i8type='$i8type'
24856 i_arpainet='$i_arpainet'
24857 i_assert='$i_assert'
24858 i_bfd='$i_bfd'
24859 i_bsdioctl='$i_bsdioctl'
24860 i_crypt='$i_crypt'
24861 i_db='$i_db'
24862 i_dbm='$i_dbm'
24863 i_dirent='$i_dirent'
24864 i_dlfcn='$i_dlfcn'
24865 i_execinfo='$i_execinfo'
24866 i_fcntl='$i_fcntl'
24867 i_fenv='$i_fenv'
24868 i_float='$i_float'
24869 i_fp='$i_fp'
24870 i_fp_class='$i_fp_class'
24871 i_gdbm='$i_gdbm'
24872 i_gdbm_ndbm='$i_gdbm_ndbm'
24873 i_gdbmndbm='$i_gdbmndbm'
24874 i_grp='$i_grp'
24875 i_ieeefp='$i_ieeefp'
24876 i_inttypes='$i_inttypes'
24877 i_langinfo='$i_langinfo'
24878 i_libutil='$i_libutil'
24879 i_limits='$i_limits'
24880 i_locale='$i_locale'
24881 i_machcthr='$i_machcthr'
24882 i_malloc='$i_malloc'
24883 i_mallocmalloc='$i_mallocmalloc'
24884 i_math='$i_math'
24885 i_memory='$i_memory'
24886 i_mntent='$i_mntent'
24887 i_ndbm='$i_ndbm'
24888 i_netdb='$i_netdb'
24889 i_neterrno='$i_neterrno'
24890 i_netinettcp='$i_netinettcp'
24891 i_niin='$i_niin'
24892 i_poll='$i_poll'
24893 i_prot='$i_prot'
24894 i_pthread='$i_pthread'
24895 i_pwd='$i_pwd'
24896 i_quadmath='$i_quadmath'
24897 i_rpcsvcdbm='$i_rpcsvcdbm'
24898 i_sgtty='$i_sgtty'
24899 i_shadow='$i_shadow'
24900 i_socks='$i_socks'
24901 i_stdarg='$i_stdarg'
24902 i_stdbool='$i_stdbool'
24903 i_stddef='$i_stddef'
24904 i_stdint='$i_stdint'
24905 i_stdlib='$i_stdlib'
24906 i_string='$i_string'
24907 i_sunmath='$i_sunmath'
24908 i_sysaccess='$i_sysaccess'
24909 i_sysdir='$i_sysdir'
24910 i_sysfile='$i_sysfile'
24911 i_sysfilio='$i_sysfilio'
24912 i_sysin='$i_sysin'
24913 i_sysioctl='$i_sysioctl'
24914 i_syslog='$i_syslog'
24915 i_sysmman='$i_sysmman'
24916 i_sysmode='$i_sysmode'
24917 i_sysmount='$i_sysmount'
24918 i_sysndir='$i_sysndir'
24919 i_sysparam='$i_sysparam'
24920 i_syspoll='$i_syspoll'
24921 i_sysresrc='$i_sysresrc'
24922 i_syssecrt='$i_syssecrt'
24923 i_sysselct='$i_sysselct'
24924 i_syssockio='$i_syssockio'
24925 i_sysstat='$i_sysstat'
24926 i_sysstatfs='$i_sysstatfs'
24927 i_sysstatvfs='$i_sysstatvfs'
24928 i_systime='$i_systime'
24929 i_systimek='$i_systimek'
24930 i_systimes='$i_systimes'
24931 i_systypes='$i_systypes'
24932 i_sysuio='$i_sysuio'
24933 i_sysun='$i_sysun'
24934 i_sysutsname='$i_sysutsname'
24935 i_sysvfs='$i_sysvfs'
24936 i_syswait='$i_syswait'
24937 i_termio='$i_termio'
24938 i_termios='$i_termios'
24939 i_time='$i_time'
24940 i_unistd='$i_unistd'
24941 i_ustat='$i_ustat'
24942 i_utime='$i_utime'
24943 i_values='$i_values'
24944 i_varargs='$i_varargs'
24945 i_varhdr='$i_varhdr'
24946 i_vfork='$i_vfork'
24947 i_xlocale='$i_xlocale'
24948 ignore_versioned_solibs='$ignore_versioned_solibs'
24949 inc_version_list='$inc_version_list'
24950 inc_version_list_init='$inc_version_list_init'
24951 incpath='$incpath'
24952 incpth='$incpth'
24953 inews='$inews'
24954 initialinstalllocation='$initialinstalllocation'
24955 installarchlib='$installarchlib'
24956 installbin='$installbin'
24957 installhtml1dir='$installhtml1dir'
24958 installhtml3dir='$installhtml3dir'
24959 installman1dir='$installman1dir'
24960 installman3dir='$installman3dir'
24961 installprefix='$installprefix'
24962 installprefixexp='$installprefixexp'
24963 installprivlib='$installprivlib'
24964 installscript='$installscript'
24965 installsitearch='$installsitearch'
24966 installsitebin='$installsitebin'
24967 installsitehtml1dir='$installsitehtml1dir'
24968 installsitehtml3dir='$installsitehtml3dir'
24969 installsitelib='$installsitelib'
24970 installsiteman1dir='$installsiteman1dir'
24971 installsiteman3dir='$installsiteman3dir'
24972 installsitescript='$installsitescript'
24973 installstyle='$installstyle'
24974 installusrbinperl='$installusrbinperl'
24975 installvendorarch='$installvendorarch'
24976 installvendorbin='$installvendorbin'
24977 installvendorhtml1dir='$installvendorhtml1dir'
24978 installvendorhtml3dir='$installvendorhtml3dir'
24979 installvendorlib='$installvendorlib'
24980 installvendorman1dir='$installvendorman1dir'
24981 installvendorman3dir='$installvendorman3dir'
24982 installvendorscript='$installvendorscript'
24983 intsize='$intsize'
24984 issymlink='$issymlink'
24985 ivdformat='$ivdformat'
24986 ivsize='$ivsize'
24987 ivtype='$ivtype'
24988 known_extensions='$known_extensions'
24989 ksh='$ksh'
24990 ld='$ld'
24991 ld_can_script='$ld_can_script'
24992 lddlflags='$lddlflags'
24993 ldflags='$ldflags'
24994 ldflags_uselargefiles='$ldflags_uselargefiles'
24995 ldlibpthname='$ldlibpthname'
24996 less='$less'
24997 lib_ext='$lib_ext'
24998 libc='$libc'
24999 libperl='$libperl'
25000 libpth='$libpth'
25001 libs='$libs'
25002 libsdirs='$libsdirs'
25003 libsfiles='$libsfiles'
25004 libsfound='$libsfound'
25005 libspath='$libspath'
25006 libswanted='$libswanted'
25007 libswanted_uselargefiles='$libswanted_uselargefiles'
25008 line='$line'
25009 lint='$lint'
25010 lkflags='$lkflags'
25011 ln='$ln'
25012 lns='$lns'
25013 localtime_r_proto='$localtime_r_proto'
25014 locincpth='$locincpth'
25015 loclibpth='$loclibpth'
25016 longdblinfbytes='$longdblinfbytes'
25017 longdblkind='$longdblkind'
25018 longdblmantbits='$longdblmantbits'
25019 longdblnanbytes='$longdblnanbytes'
25020 longdblsize='$longdblsize'
25021 longlongsize='$longlongsize'
25022 longsize='$longsize'
25023 lp='$lp'
25024 lpr='$lpr'
25025 ls='$ls'
25026 lseeksize='$lseeksize'
25027 lseektype='$lseektype'
25028 mail='$mail'
25029 mailx='$mailx'
25030 make='$make'
25031 make_set_make='$make_set_make'
25032 mallocobj='$mallocobj'
25033 mallocsrc='$mallocsrc'
25034 malloctype='$malloctype'
25035 man1dir='$man1dir'
25036 man1direxp='$man1direxp'
25037 man1ext='$man1ext'
25038 man3dir='$man3dir'
25039 man3direxp='$man3direxp'
25040 man3ext='$man3ext'
25041 mips_type='$mips_type'
25042 mistrustnm='$mistrustnm'
25043 mkdir='$mkdir'
25044 mmaptype='$mmaptype'
25045 modetype='$modetype'
25046 more='$more'
25047 multiarch='$multiarch'
25048 mv='$mv'
25049 myarchname='$myarchname'
25050 mydomain='$mydomain'
25051 myhostname='$myhostname'
25052 myuname='$myuname'
25053 n='$n'
25054 need_va_copy='$need_va_copy'
25055 netdb_hlen_type='$netdb_hlen_type'
25056 netdb_host_type='$netdb_host_type'
25057 netdb_name_type='$netdb_name_type'
25058 netdb_net_type='$netdb_net_type'
25059 nm='$nm'
25060 nm_opt='$nm_opt'
25061 nm_so_opt='$nm_so_opt'
25062 nonxs_ext='$nonxs_ext'
25063 nroff='$nroff'
25064 nvEUformat='$nvEUformat'
25065 nvFUformat='$nvFUformat'
25066 nvGUformat='$nvGUformat'
25067 nv_overflows_integers_at='$nv_overflows_integers_at'
25068 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25069 nveformat='$nveformat'
25070 nvfformat='$nvfformat'
25071 nvgformat='$nvgformat'
25072 nvmantbits='$nvmantbits'
25073 nvsize='$nvsize'
25074 nvtype='$nvtype'
25075 o_nonblock='$o_nonblock'
25076 obj_ext='$obj_ext'
25077 old_pthread_create_joinable='$old_pthread_create_joinable'
25078 optimize='$optimize'
25079 orderlib='$orderlib'
25080 osname='$osname'
25081 osvers='$osvers'
25082 otherlibdirs='$otherlibdirs'
25083 package='$package'
25084 pager='$pager'
25085 passcat='$passcat'
25086 patchlevel='$patchlevel'
25087 path_sep='$path_sep'
25088 perl5='$perl5'
25089 perl='$perl'
25090 perl_patchlevel='$perl_patchlevel'
25091 perl_static_inline='$perl_static_inline'
25092 perladmin='$perladmin'
25093 perllibs='$perllibs'
25094 perlpath='$perlpath'
25095 pg='$pg'
25096 phostname='$phostname'
25097 pidtype='$pidtype'
25098 plibpth='$plibpth'
25099 pmake='$pmake'
25100 pr='$pr'
25101 prefix='$prefix'
25102 prefixexp='$prefixexp'
25103 privlib='$privlib'
25104 privlibexp='$privlibexp'
25105 procselfexe='$procselfexe'
25106 prototype='$prototype'
25107 ptrsize='$ptrsize'
25108 quadkind='$quadkind'
25109 quadtype='$quadtype'
25110 randbits='$randbits'
25111 randfunc='$randfunc'
25112 random_r_proto='$random_r_proto'
25113 randseedtype='$randseedtype'
25114 ranlib='$ranlib'
25115 rd_nodata='$rd_nodata'
25116 readdir64_r_proto='$readdir64_r_proto'
25117 readdir_r_proto='$readdir_r_proto'
25118 revision='$revision'
25119 rm='$rm'
25120 rm_try='$rm_try'
25121 rmail='$rmail'
25122 run='$run'
25123 runnm='$runnm'
25124 sGMTIME_max='$sGMTIME_max'
25125 sGMTIME_min='$sGMTIME_min'
25126 sLOCALTIME_max='$sLOCALTIME_max'
25127 sLOCALTIME_min='$sLOCALTIME_min'
25128 sPRIEUldbl='$sPRIEUldbl'
25129 sPRIFUldbl='$sPRIFUldbl'
25130 sPRIGUldbl='$sPRIGUldbl'
25131 sPRIXU64='$sPRIXU64'
25132 sPRId64='$sPRId64'
25133 sPRIeldbl='$sPRIeldbl'
25134 sPRIfldbl='$sPRIfldbl'
25135 sPRIgldbl='$sPRIgldbl'
25136 sPRIi64='$sPRIi64'
25137 sPRIo64='$sPRIo64'
25138 sPRIu64='$sPRIu64'
25139 sPRIx64='$sPRIx64'
25140 sSCNfldbl='$sSCNfldbl'
25141 sched_yield='$sched_yield'
25142 scriptdir='$scriptdir'
25143 scriptdirexp='$scriptdirexp'
25144 sed='$sed'
25145 seedfunc='$seedfunc'
25146 selectminbits='$selectminbits'
25147 selecttype='$selecttype'
25148 sendmail='$sendmail'
25149 setgrent_r_proto='$setgrent_r_proto'
25150 sethostent_r_proto='$sethostent_r_proto'
25151 setlocale_r_proto='$setlocale_r_proto'
25152 setnetent_r_proto='$setnetent_r_proto'
25153 setprotoent_r_proto='$setprotoent_r_proto'
25154 setpwent_r_proto='$setpwent_r_proto'
25155 setservent_r_proto='$setservent_r_proto'
25156 sh='$sh'
25157 shar='$shar'
25158 sharpbang='$sharpbang'
25159 shmattype='$shmattype'
25160 shortsize='$shortsize'
25161 shrpenv='$shrpenv'
25162 shsharp='$shsharp'
25163 sig_count='$sig_count'
25164 sig_name='$sig_name'
25165 sig_name_init='$sig_name_init'
25166 sig_num='$sig_num'
25167 sig_num_init='$sig_num_init'
25168 sig_size='$sig_size'
25169 signal_t='$signal_t'
25170 sitearch='$sitearch'
25171 sitearchexp='$sitearchexp'
25172 sitebin='$sitebin'
25173 sitebinexp='$sitebinexp'
25174 sitehtml1dir='$sitehtml1dir'
25175 sitehtml1direxp='$sitehtml1direxp'
25176 sitehtml3dir='$sitehtml3dir'
25177 sitehtml3direxp='$sitehtml3direxp'
25178 sitelib='$sitelib'
25179 sitelib_stem='$sitelib_stem'
25180 sitelibexp='$sitelibexp'
25181 siteman1dir='$siteman1dir'
25182 siteman1direxp='$siteman1direxp'
25183 siteman3dir='$siteman3dir'
25184 siteman3direxp='$siteman3direxp'
25185 siteprefix='$siteprefix'
25186 siteprefixexp='$siteprefixexp'
25187 sitescript='$sitescript'
25188 sitescriptexp='$sitescriptexp'
25189 sizesize='$sizesize'
25190 sizetype='$sizetype'
25191 sleep='$sleep'
25192 smail='$smail'
25193 so='$so'
25194 sockethdr='$sockethdr'
25195 socketlib='$socketlib'
25196 socksizetype='$socksizetype'
25197 sort='$sort'
25198 spackage='$spackage'
25199 spitshell='$spitshell'
25200 srand48_r_proto='$srand48_r_proto'
25201 srandom_r_proto='$srandom_r_proto'
25202 src='$src'
25203 ssizetype='$ssizetype'
25204 st_ino_sign='$st_ino_sign'
25205 st_ino_size='$st_ino_size'
25206 startperl='$startperl'
25207 startsh='$startsh'
25208 static_ext='$static_ext'
25209 stdchar='$stdchar'
25210 stdio_base='$stdio_base'
25211 stdio_bufsiz='$stdio_bufsiz'
25212 stdio_cnt='$stdio_cnt'
25213 stdio_filbuf='$stdio_filbuf'
25214 stdio_ptr='$stdio_ptr'
25215 stdio_stream_array='$stdio_stream_array'
25216 strerror_r_proto='$strerror_r_proto'
25217 strings='$strings'
25218 submit='$submit'
25219 subversion='$subversion'
25220 sysman='$sysman'
25221 sysroot='$sysroot'
25222 tail='$tail'
25223 tar='$tar'
25224 targetarch='$targetarch'
25225 targetdir='$targetdir'
25226 targetenv='$targetenv'
25227 targethost='$targethost'
25228 targetmkdir='$targetmkdir'
25229 targetport='$targetport'
25230 targetsh='$targetsh'
25231 tbl='$tbl'
25232 tee='$tee'
25233 test='$test'
25234 timeincl='$timeincl'
25235 timetype='$timetype'
25236 tmpnam_r_proto='$tmpnam_r_proto'
25237 to='$to'
25238 touch='$touch'
25239 tr='$tr'
25240 trnl='$trnl'
25241 troff='$troff'
25242 ttyname_r_proto='$ttyname_r_proto'
25243 u16size='$u16size'
25244 u16type='$u16type'
25245 u32size='$u32size'
25246 u32type='$u32type'
25247 u64size='$u64size'
25248 u64type='$u64type'
25249 u8size='$u8size'
25250 u8type='$u8type'
25251 uidformat='$uidformat'
25252 uidsign='$uidsign'
25253 uidsize='$uidsize'
25254 uidtype='$uidtype'
25255 uname='$uname'
25256 uniq='$uniq'
25257 uquadtype='$uquadtype'
25258 use5005threads='$use5005threads'
25259 use64bitall='$use64bitall'
25260 use64bitint='$use64bitint'
25261 usecbacktrace='$usecbacktrace'
25262 usecrosscompile='$usecrosscompile'
25263 usedevel='$usedevel'
25264 usedl='$usedl'
25265 usedtrace='$usedtrace'
25266 usefaststdio='$usefaststdio'
25267 useithreads='$useithreads'
25268 usekernprocpathname='$usekernprocpathname'
25269 uselargefiles='$uselargefiles'
25270 uselongdouble='$uselongdouble'
25271 usemallocwrap='$usemallocwrap'
25272 usemorebits='$usemorebits'
25273 usemultiplicity='$usemultiplicity'
25274 usemymalloc='$usemymalloc'
25275 usenm='$usenm'
25276 usensgetexecutablepath='$usensgetexecutablepath'
25277 useopcode='$useopcode'
25278 useperlio='$useperlio'
25279 useposix='$useposix'
25280 usequadmath='$usequadmath'
25281 usereentrant='$usereentrant'
25282 userelocatableinc='$userelocatableinc'
25283 useshrplib='$useshrplib'
25284 usesitecustomize='$usesitecustomize'
25285 usesocks='$usesocks'
25286 usethreads='$usethreads'
25287 usevendorprefix='$usevendorprefix'
25288 useversionedarchname='$useversionedarchname'
25289 usevfork='$usevfork'
25290 usrinc='$usrinc'
25291 uuname='$uuname'
25292 uvXUformat='$uvXUformat'
25293 uvoformat='$uvoformat'
25294 uvsize='$uvsize'
25295 uvtype='$uvtype'
25296 uvuformat='$uvuformat'
25297 uvxformat='$uvxformat'
25298 vaproto='$vaproto'
25299 vendorarch='$vendorarch'
25300 vendorarchexp='$vendorarchexp'
25301 vendorbin='$vendorbin'
25302 vendorbinexp='$vendorbinexp'
25303 vendorhtml1dir='$vendorhtml1dir'
25304 vendorhtml1direxp='$vendorhtml1direxp'
25305 vendorhtml3dir='$vendorhtml3dir'
25306 vendorhtml3direxp='$vendorhtml3direxp'
25307 vendorlib='$vendorlib'
25308 vendorlib_stem='$vendorlib_stem'
25309 vendorlibexp='$vendorlibexp'
25310 vendorman1dir='$vendorman1dir'
25311 vendorman1direxp='$vendorman1direxp'
25312 vendorman3dir='$vendorman3dir'
25313 vendorman3direxp='$vendorman3direxp'
25314 vendorprefix='$vendorprefix'
25315 vendorprefixexp='$vendorprefixexp'
25316 vendorscript='$vendorscript'
25317 vendorscriptexp='$vendorscriptexp'
25318 version='$version'
25319 version_patchlevel_string='$version_patchlevel_string'
25320 versiononly='$versiononly'
25321 vi='$vi'
25322 xlibpth='$xlibpth'
25323 yacc='$yacc'
25324 yaccflags='$yaccflags'
25325 zcat='$zcat'
25326 zip='$zip'
25327 EOT
25328
25329 : add special variables
25330 $test -f $src/patchlevel.h && \
25331 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25332 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25333 echo "PERL_CONFIG_SH=true" >>config.sh
25334
25335 : propagate old symbols
25336 if $test -f UU/config.sh; then
25337         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25338         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25339                 config.sh config.sh UU/oldconfig.sh |\
25340                 $sort | $uniq -u >UU/oldsyms
25341         set X `$cat UU/oldsyms`
25342         shift
25343         case $# in
25344         0) ;;
25345         *)
25346                 $cat <<EOM
25347 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25348 EOM
25349                 echo ": Variables propagated from previous config.sh file." >>config.sh
25350                 for sym in `$cat UU/oldsyms`; do
25351                         echo "    Propagating $hint variable "'$'"$sym..."
25352                         eval 'tmp="$'"${sym}"'"'
25353                         echo "$tmp" | \
25354                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25355                 done
25356                 ;;
25357         esac
25358 fi
25359
25360 : preserve RCS keywords in files with variable substitution, grrr
25361 Id='$Id'
25362
25363 : Finish up by extracting the .SH files
25364 case "$alldone" in
25365 exit)
25366         echo "Stopping at your request, leaving temporary files around."
25367         exit 0
25368         ;;
25369 cont)
25370         ;;
25371 '')
25372         dflt=''
25373         nostick=true
25374         $cat <<EOM
25375
25376 If you'd like to make any changes to the config.sh file before I begin
25377 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25378
25379 EOM
25380         rp="Press return or use a shell escape to edit config.sh:"
25381         . UU/myread
25382         nostick=''
25383         case "$ans" in
25384         '') ;;
25385         *) : in case they cannot read
25386                 sh 1>&4 -c "$ans";;
25387         esac
25388         ;;
25389 esac
25390
25391 : if this fails, just run all the .SH files by hand
25392 . ./config.sh
25393
25394 echo " "
25395 exec 1>&4
25396 pwd=`pwd`
25397 . ./UU/extract
25398 cd "$pwd"
25399
25400 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25401         dflt=y
25402         case "$silent" in
25403         true) ;;
25404         *)
25405                 $cat <<EOM
25406
25407 Now you need to generate make dependencies by running "$make depend".
25408 You might prefer to run it in background: "$make depend > makedepend.out &"
25409 It can take a while, so you might not want to run it right now.
25410
25411 EOM
25412                 ;;
25413         esac
25414         rp="Run $make depend now?"
25415         . UU/myread
25416         case "$ans" in
25417         y*)
25418                 $make depend && echo "Now you must run '$make'."
25419                 ;;
25420         *)
25421                 echo "You must run '$make depend' then '$make'."
25422                 ;;
25423         esac
25424 elif test -f [Mm]akefile; then
25425         echo " "
25426         echo "Now you must run a $make."
25427 else
25428         echo "Configure done."
25429 fi
25430
25431 if $test -f Policy.sh; then
25432     $cat <<EOM
25433
25434 If you compile $package on a different machine or from a different object
25435 directory, copy the Policy.sh file from this object directory to the
25436 new one before you run Configure -- this will help you with most of
25437 the policy defaults.
25438
25439 EOM
25440 fi
25441 if $test -f UU/config.msg; then
25442     echo "Hmm.  I also noted the following information while running:"
25443     echo " "
25444     $cat UU/config.msg >&4
25445 fi
25446 $rm -f kit*isdone ark*isdone
25447 $rm -rf UU
25448
25449 : End of Configure
25450