This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
handy.h: Add synonyms for macros
[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_memmove=''
658 d_memset=''
659 d_mkdir=''
660 d_mkdtemp=''
661 d_mkfifo=''
662 d_mkstemp=''
663 d_mkstemps=''
664 d_mktime=''
665 d_mmap=''
666 mmaptype=''
667 d_modfl=''
668 d_modfl_pow32_bug=''
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_nextafter=''
682 d_nexttoward=''
683 d_nice=''
684 d_nl_langinfo=''
685 d_off64_t=''
686 d_open3=''
687 d_fpathconf=''
688 d_pathconf=''
689 d_pause=''
690 d_pipe=''
691 d_poll=''
692 d_portable=''
693 d_prctl=''
694 d_prctl_set_name=''
695 d_procselfexe=''
696 procselfexe=''
697 d_old_pthread_create_joinable=''
698 old_pthread_create_joinable=''
699 d_pthread_atfork=''
700 d_pthread_attr_setscope=''
701 d_pthread_yield=''
702 d_sched_yield=''
703 sched_yield=''
704 d_ptrdiff_t=''
705 d_qgcvt=''
706 d_random_r=''
707 random_r_proto=''
708 d_readdir64_r=''
709 readdir64_r_proto=''
710 d_readdir=''
711 d_rewinddir=''
712 d_seekdir=''
713 d_telldir=''
714 d_readdir_r=''
715 readdir_r_proto=''
716 d_readlink=''
717 d_readv=''
718 d_recvmsg=''
719 d_re_comp=''
720 d_regcmp=''
721 d_regcomp=''
722 d_remainder=''
723 d_remquo=''
724 d_rename=''
725 d_rint=''
726 d_rmdir=''
727 d_round=''
728 d_safebcpy=''
729 d_safemcpy=''
730 d_sanemcmp=''
731 d_sbrkproto=''
732 d_scalbn=''
733 d_scalbnl=''
734 d_select=''
735 d_sem=''
736 d_semctl=''
737 d_semget=''
738 d_semop=''
739 d_sendmsg=''
740 d_setegid=''
741 d_seteuid=''
742 d_setgrent=''
743 d_setgrent_r=''
744 setgrent_r_proto=''
745 d_setgrps=''
746 d_sethent=''
747 d_sethostent_r=''
748 sethostent_r_proto=''
749 d_setitimer=''
750 d_setlinebuf=''
751 d_setlocale=''
752 d_setlocale_r=''
753 setlocale_r_proto=''
754 d_setnent=''
755 d_setnetent_r=''
756 setnetent_r_proto=''
757 d_setpent=''
758 d_setpgid=''
759 d_setpgrp2=''
760 d_bsdsetpgrp=''
761 d_setpgrp=''
762 d_setprior=''
763 d_setproctitle=''
764 d_setprotoent_r=''
765 setprotoent_r_proto=''
766 d_setpwent=''
767 d_setpwent_r=''
768 setpwent_r_proto=''
769 d_setregid=''
770 d_setresgid=''
771 d_setresuid=''
772 d_setreuid=''
773 d_setrgid=''
774 d_setruid=''
775 d_setsent=''
776 d_setservent_r=''
777 setservent_r_proto=''
778 d_setsid=''
779 d_setvbuf=''
780 d_shm=''
781 d_shmat=''
782 d_shmatprototype=''
783 shmattype=''
784 d_shmctl=''
785 d_shmdt=''
786 d_shmget=''
787 d_sigaction=''
788 d_siginfo_si_errno=''
789 d_siginfo_si_pid=''
790 d_siginfo_si_uid=''
791 d_siginfo_si_addr=''
792 d_siginfo_si_status=''
793 d_siginfo_si_band=''
794 d_siginfo_si_value=''
795 d_signbit=''
796 d_sigprocmask=''
797 d_sigsetjmp=''
798 usesitecustomize=''
799 d_snprintf=''
800 d_vsnprintf=''
801 d_sockatmark=''
802 d_sockatmarkproto=''
803 d_ip_mreq=''
804 d_ip_mreq_source=''
805 d_ipv6_mreq=''
806 d_ipv6_mreq_source=''
807 d_msg_ctrunc=''
808 d_msg_dontroute=''
809 d_msg_oob=''
810 d_msg_peek=''
811 d_msg_proxy=''
812 d_oldsock=''
813 d_scm_rights=''
814 d_sin6_scope_id=''
815 d_sockaddr_in6=''
816 d_sockaddr_sa_len=''
817 d_socket=''
818 d_sockpair=''
819 sockethdr=''
820 socketlib=''
821 d_socklen_t=''
822 d_socks5_init=''
823 d_sprintf_returns_strlen=''
824 d_sqrtl=''
825 d_srand48_r=''
826 srand48_r_proto=''
827 d_srandom_r=''
828 srandom_r_proto=''
829 d_sresgproto=''
830 d_sresuproto=''
831 d_stat=''
832 d_statblks=''
833 d_statfs_f_flags=''
834 d_statfs_s=''
835 d_static_inline=''
836 perl_static_inline=''
837 d_fstatvfs=''
838 d_statvfs=''
839 d_stdio_cnt_lval=''
840 d_stdio_ptr_lval=''
841 d_stdio_ptr_lval_nochange_cnt=''
842 d_stdio_ptr_lval_sets_cnt=''
843 d_stdiobase=''
844 d_stdstdio=''
845 stdio_base=''
846 stdio_bufsiz=''
847 stdio_cnt=''
848 stdio_filbuf=''
849 stdio_ptr=''
850 d_index=''
851 d_strchr=''
852 d_strcoll=''
853 d_strctcpy=''
854 d_strerrm=''
855 d_strerror=''
856 d_sysernlst=''
857 d_syserrlst=''
858 d_strerror_r=''
859 strerror_r_proto=''
860 d_strftime=''
861 d_strlcat=''
862 d_strlcpy=''
863 d_strtod=''
864 d_strtol=''
865 d_strtold=''
866 d_strtoll=''
867 d_strtoq=''
868 d_strtoul=''
869 d_strtoull=''
870 d_strtouq=''
871 d_strxfrm=''
872 d_symlink=''
873 d_syscall=''
874 d_syscallproto=''
875 d_sysconf=''
876 d_system=''
877 d_tcgetpgrp=''
878 d_tcsetpgrp=''
879 d_telldirproto=''
880 d_tgamma=''
881 d_time=''
882 timetype=''
883 d_asctime64=''
884 d_ctime64=''
885 d_difftime64=''
886 d_gmtime64=''
887 d_localtime64=''
888 d_mktime64=''
889 d_timegm=''
890 clocktype=''
891 d_times=''
892 d_tmpnam_r=''
893 tmpnam_r_proto=''
894 d_trunc=''
895 d_truncate=''
896 d_truncl=''
897 d_ttyname_r=''
898 ttyname_r_proto=''
899 d_tzname=''
900 d_u32align=''
901 d_ualarm=''
902 d_umask=''
903 d_semctl_semid_ds=''
904 d_semctl_semun=''
905 d_union_semun=''
906 d_unordered=''
907 d_unsetenv=''
908 d_usleep=''
909 d_usleepproto=''
910 d_ustat=''
911 d_pseudofork=''
912 d_vfork=''
913 usevfork=''
914 d_voidsig=''
915 signal_t=''
916 d_volatile=''
917 d_charvspr=''
918 d_vprintf=''
919 d_wait4=''
920 d_waitpid=''
921 d_wcscmp=''
922 d_wcstombs=''
923 d_wcsxfrm=''
924 d_wctomb=''
925 d_writev=''
926 dlext=''
927 bin_ELF=''
928 cccdlflags=''
929 ccdlflags=''
930 dlsrc=''
931 ld=''
932 ld_can_script=''
933 lddlflags=''
934 usedl=''
935 doublesize=''
936 ebcdic=''
937 fflushNULL=''
938 fflushall=''
939 fpossize=''
940 fpostype=''
941 gccansipedantic=''
942 gccosandvers=''
943 gccversion=''
944 gidformat=''
945 gidsign=''
946 gidsize=''
947 gidtype=''
948 groupstype=''
949 h_fcntl=''
950 h_sysfile=''
951 html1dir=''
952 html1direxp=''
953 installhtml1dir=''
954 html3dir=''
955 html3direxp=''
956 installhtml3dir=''
957 i_arpainet=''
958 i_assert=''
959 i_bfd=''
960 i_crypt=''
961 db_hashtype=''
962 db_prefixtype=''
963 db_version_major=''
964 db_version_minor=''
965 db_version_patch=''
966 i_db=''
967 i_dbm=''
968 i_rpcsvcdbm=''
969 d_dirnamlen=''
970 direntrytype=''
971 i_dirent=''
972 i_dlfcn=''
973 i_execinfo=''
974 i_fcntl=''
975 i_fenv=''
976 i_float=''
977 i_fp=''
978 i_fp_class=''
979 i_gdbm=''
980 d_grpasswd=''
981 i_grp=''
982 i_ieeefp=''
983 i_inttypes=''
984 i_langinfo=''
985 i_libutil=''
986 i_limits=''
987 i_locale=''
988 i_machcthr=''
989 i_malloc=''
990 i_mallocmalloc=''
991 i_math=''
992 i_memory=''
993 i_mntent=''
994 d_gdbm_ndbm_h_uses_prototypes=''
995 d_gdbmndbm_h_uses_prototypes=''
996 d_ndbm=''
997 d_ndbm_h_uses_prototypes=''
998 i_gdbm_ndbm=''
999 i_gdbmndbm=''
1000 i_ndbm=''
1001 i_netdb=''
1002 i_neterrno=''
1003 i_netinettcp=''
1004 i_niin=''
1005 i_sysin=''
1006 i_poll=''
1007 i_prot=''
1008 i_pthread=''
1009 d_pwage=''
1010 d_pwchange=''
1011 d_pwclass=''
1012 d_pwcomment=''
1013 d_pwexpire=''
1014 d_pwgecos=''
1015 d_pwpasswd=''
1016 d_pwquota=''
1017 i_pwd=''
1018 i_quadmath=''
1019 i_shadow=''
1020 i_socks=''
1021 i_stdbool=''
1022 i_stddef=''
1023 i_stdint=''
1024 i_stdlib=''
1025 i_string=''
1026 strings=''
1027 i_sunmath=''
1028 i_sysaccess=''
1029 i_sysdir=''
1030 i_sysfile=''
1031 d_voidtty=''
1032 i_bsdioctl=''
1033 i_sysfilio=''
1034 i_sysioctl=''
1035 i_syssockio=''
1036 i_syslog=''
1037 i_sysmman=''
1038 i_sysmode=''
1039 i_sysmount=''
1040 i_sysndir=''
1041 i_sysparam=''
1042 i_syspoll=''
1043 i_sysresrc=''
1044 i_syssecrt=''
1045 i_sysselct=''
1046 i_sysstat=''
1047 i_sysstatfs=''
1048 i_sysstatvfs=''
1049 i_systimes=''
1050 i_systypes=''
1051 i_sysuio=''
1052 i_sysun=''
1053 i_sysutsname=''
1054 i_sysvfs=''
1055 i_syswait=''
1056 i_sgtty=''
1057 i_termio=''
1058 i_termios=''
1059 d_tm_tm_gmtoff=''
1060 d_tm_tm_zone=''
1061 i_systime=''
1062 i_systimek=''
1063 i_time=''
1064 timeincl=''
1065 i_unistd=''
1066 i_ustat=''
1067 i_utime=''
1068 i_values=''
1069 i_stdarg=''
1070 i_varargs=''
1071 i_varhdr=''
1072 i_vfork=''
1073 d_inc_version_list=''
1074 inc_version_list=''
1075 inc_version_list_init=''
1076 doubleinfbytes=''
1077 doublenanbytes=''
1078 longdblinfbytes=''
1079 longdblnanbytes=''
1080 installprefix=''
1081 installprefixexp=''
1082 installstyle=''
1083 installusrbinperl=''
1084 intsize=''
1085 longsize=''
1086 shortsize=''
1087 issymlink=''
1088 libc=''
1089 ldlibpthname=''
1090 libperl=''
1091 shrpenv=''
1092 useshrplib=''
1093 glibpth=''
1094 incpth=''
1095 libpth=''
1096 loclibpth=''
1097 plibpth=''
1098 xlibpth=''
1099 ignore_versioned_solibs=''
1100 libs=''
1101 libsdirs=''
1102 libsfiles=''
1103 libsfound=''
1104 libspath=''
1105 lns=''
1106 d_PRIEUldbl=''
1107 d_PRIFUldbl=''
1108 d_PRIGUldbl=''
1109 d_PRIeldbl=''
1110 d_PRIfldbl=''
1111 d_PRIgldbl=''
1112 d_SCNfldbl=''
1113 doublekind=''
1114 sPRIEUldbl=''
1115 sPRIFUldbl=''
1116 sPRIGUldbl=''
1117 sPRIeldbl=''
1118 sPRIfldbl=''
1119 sPRIgldbl=''
1120 sSCNfldbl=''
1121 lseeksize=''
1122 lseektype=''
1123 make_set_make=''
1124 d_mymalloc=''
1125 freetype=''
1126 mallocobj=''
1127 mallocsrc=''
1128 malloctype=''
1129 usemallocwrap=''
1130 usemymalloc=''
1131 installman1dir=''
1132 man1dir=''
1133 man1direxp=''
1134 man1ext=''
1135 installman3dir=''
1136 man3dir=''
1137 man3direxp=''
1138 man3ext=''
1139 doublemantbits=''
1140 longdblmantbits=''
1141 nvmantbits=''
1142 modetype=''
1143 multiarch=''
1144 mydomain=''
1145 myhostname=''
1146 phostname=''
1147 c=''
1148 n=''
1149 d_eofnblk=''
1150 eagain=''
1151 o_nonblock=''
1152 rd_nodata=''
1153 need_va_copy=''
1154 netdb_hlen_type=''
1155 netdb_host_type=''
1156 netdb_name_type=''
1157 netdb_net_type=''
1158 groupcat=''
1159 hostcat=''
1160 passcat=''
1161 orderlib=''
1162 ranlib=''
1163 d_perl_otherlibdirs=''
1164 otherlibdirs=''
1165 package=''
1166 spackage=''
1167 pager=''
1168 api_revision=''
1169 api_subversion=''
1170 api_version=''
1171 api_versionstring=''
1172 patchlevel=''
1173 perl_patchlevel=''
1174 revision=''
1175 subversion=''
1176 version=''
1177 version_patchlevel_string=''
1178 perl5=''
1179 perladmin=''
1180 perlpath=''
1181 d_nv_preserves_uv=''
1182 d_nv_zero_is_allbits_zero=''
1183 i16size=''
1184 i16type=''
1185 i32size=''
1186 i32type=''
1187 i64size=''
1188 i64type=''
1189 i8size=''
1190 i8type=''
1191 ivsize=''
1192 ivtype=''
1193 nv_overflows_integers_at=''
1194 nv_preserves_uv_bits=''
1195 nvsize=''
1196 nvtype=''
1197 u16size=''
1198 u16type=''
1199 u32size=''
1200 u32type=''
1201 u64size=''
1202 u64type=''
1203 u8size=''
1204 u8type=''
1205 uvsize=''
1206 uvtype=''
1207 ivdformat=''
1208 nvEUformat=''
1209 nvFUformat=''
1210 nvGUformat=''
1211 nveformat=''
1212 nvfformat=''
1213 nvgformat=''
1214 uvXUformat=''
1215 uvoformat=''
1216 uvuformat=''
1217 uvxformat=''
1218 pidtype=''
1219 prefix=''
1220 prefixexp=''
1221 installprivlib=''
1222 privlib=''
1223 privlibexp=''
1224 prototype=''
1225 ptrsize=''
1226 d_PRIXU64=''
1227 d_PRId64=''
1228 d_PRIi64=''
1229 d_PRIo64=''
1230 d_PRIu64=''
1231 d_PRIx64=''
1232 sPRIXU64=''
1233 sPRId64=''
1234 sPRIi64=''
1235 sPRIo64=''
1236 sPRIu64=''
1237 sPRIx64=''
1238 d_quad=''
1239 quadkind=''
1240 quadtype=''
1241 uquadtype=''
1242 drand01=''
1243 randbits=''
1244 randfunc=''
1245 randseedtype=''
1246 seedfunc=''
1247 installscript=''
1248 scriptdir=''
1249 scriptdirexp=''
1250 selectminbits=''
1251 selecttype=''
1252 sh=''
1253 targetsh=''
1254 sig_count=''
1255 sig_name=''
1256 sig_name_init=''
1257 sig_num=''
1258 sig_num_init=''
1259 sig_size=''
1260 d_sitearch=''
1261 installsitearch=''
1262 sitearch=''
1263 sitearchexp=''
1264 installsitebin=''
1265 sitebin=''
1266 sitebinexp=''
1267 installsitehtml1dir=''
1268 sitehtml1dir=''
1269 sitehtml1direxp=''
1270 installsitehtml3dir=''
1271 sitehtml3dir=''
1272 sitehtml3direxp=''
1273 installsitelib=''
1274 sitelib=''
1275 sitelib_stem=''
1276 sitelibexp=''
1277 installsiteman1dir=''
1278 siteman1dir=''
1279 siteman1direxp=''
1280 installsiteman3dir=''
1281 siteman3dir=''
1282 siteman3direxp=''
1283 siteprefix=''
1284 siteprefixexp=''
1285 installsitescript=''
1286 sitescript=''
1287 sitescriptexp=''
1288 sizesize=''
1289 sizetype=''
1290 d_libname_unique=''
1291 so=''
1292 socksizetype=''
1293 sharpbang=''
1294 shsharp=''
1295 spitshell=''
1296 src=''
1297 ssizetype=''
1298 st_ino_sign=''
1299 st_ino_size=''
1300 startperl=''
1301 startsh=''
1302 stdchar=''
1303 d_stdio_stream_array=''
1304 stdio_stream_array=''
1305 sysman=''
1306 sGMTIME_max=''
1307 sGMTIME_min=''
1308 sLOCALTIME_max=''
1309 sLOCALTIME_min=''
1310 trnl=''
1311 uidformat=''
1312 uidsign=''
1313 uidsize=''
1314 uidtype=''
1315 archname64=''
1316 use64bitall=''
1317 use64bitint=''
1318 usecbacktrace=''
1319 dtrace=''
1320 dtraceobject=''
1321 usedtrace=''
1322 usefaststdio=''
1323 usekernprocpathname=''
1324 ccflags_uselargefiles=''
1325 ldflags_uselargefiles=''
1326 libswanted_uselargefiles=''
1327 uselargefiles=''
1328 uselongdouble=''
1329 usemorebits=''
1330 usemultiplicity=''
1331 nm_opt=''
1332 nm_so_opt=''
1333 runnm=''
1334 usenm=''
1335 usensgetexecutablepath=''
1336 useperlio=''
1337 usequadmath=''
1338 usesocks=''
1339 d_oldpthreads=''
1340 use5005threads=''
1341 useithreads=''
1342 usereentrant=''
1343 usethreads=''
1344 incpath=''
1345 mips_type=''
1346 usrinc=''
1347 vaproto=''
1348 d_vendorarch=''
1349 installvendorarch=''
1350 vendorarch=''
1351 vendorarchexp=''
1352 d_vendorbin=''
1353 installvendorbin=''
1354 vendorbin=''
1355 vendorbinexp=''
1356 installvendorhtml1dir=''
1357 vendorhtml1dir=''
1358 vendorhtml1direxp=''
1359 installvendorhtml3dir=''
1360 vendorhtml3dir=''
1361 vendorhtml3direxp=''
1362 d_vendorlib=''
1363 installvendorlib=''
1364 vendorlib=''
1365 vendorlib_stem=''
1366 vendorlibexp=''
1367 installvendorman1dir=''
1368 vendorman1dir=''
1369 vendorman1direxp=''
1370 installvendorman3dir=''
1371 vendorman3dir=''
1372 vendorman3direxp=''
1373 usevendorprefix=''
1374 vendorprefix=''
1375 vendorprefixexp=''
1376 d_vendorscript=''
1377 installvendorscript=''
1378 vendorscript=''
1379 vendorscriptexp=''
1380 versiononly=''
1381 yacc=''
1382 yaccflags=''
1383 CONFIG=''
1384
1385 : Detect odd OSs
1386 define='define'
1387 undef='undef'
1388 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1389 rmlist=''
1390
1391 : We must find out about Eunice early
1392 eunicefix=':'
1393 if test -f /etc/unixtovms; then
1394         eunicefix=/etc/unixtovms
1395 fi
1396 if test -f /etc/unixtovms.exe; then
1397         eunicefix=/etc/unixtovms.exe
1398 fi
1399
1400 : Set executable suffix now -- needed before hints available
1401 if test -f "/libs/version.library"; then
1402 : Amiga OS
1403     _exe=""
1404 elif test -f "/system/gnu_library/bin/ar.pm"; then
1405 : Stratus VOS
1406     _exe=".pm"
1407 elif test -n "$DJGPP"; then
1408 : DOS DJGPP
1409     _exe=".exe"
1410 elif test -f /kern/cookiejar; then
1411 : MiNT
1412     _exe=""
1413 elif test -d c:/. -o -n "$is_os2" ; then
1414 : OS/2 or cygwin
1415     _exe=".exe"
1416 fi
1417
1418 groupstype=''
1419 i_whoami=''
1420 : Trailing extension.  Override this in a hint file, if needed.
1421 : Extra object files, if any, needed on this platform.
1422 archobjs=''
1423 archname=''
1424 : Possible local include directories to search.
1425 : Set locincpth to "" in a hint file to defeat local include searches.
1426 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1427 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1428 :
1429 : no include file wanted by default
1430 inclwanted=''
1431
1432 : Enable -DEBUGGING and -DDEBUGGING from the command line
1433 EBUGGING=''
1434 DEBUGGING=''
1435
1436 libnames=''
1437 : change the next line if compiling for Xenix/286 on Xenix/386
1438 xlibpth='/usr/lib/386 /lib/386'
1439 : Possible local library directories to search.
1440 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1441 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1442
1443 : general looking path for locating libraries
1444 glibpth="/lib /usr/lib $xlibpth"
1445 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1446 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1447 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1448 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1449
1450 : Private path used by Configure to find libraries.  Its value
1451 : is prepended to libpth. This variable takes care of special
1452 : machines, like the mips.  Usually, it should be empty.
1453 plibpth=''
1454
1455 : default library list
1456 libswanted=''
1457 : some systems want to use only the non-versioned libso:s
1458 ignore_versioned_solibs=''
1459 : set usethreads on the Configure command line to enable threads.
1460 usereentrant='undef'
1461 ccname=''
1462 ccversion=''
1463 perllibs=''
1464 : set useposix=false in your hint file to disable the POSIX extension.
1465 useposix=true
1466 : set useopcode=false in your hint file to disable the Opcode extension.
1467 useopcode=true
1468 archname64=''
1469 ccflags_uselargefiles=''
1470 ldflags_uselargefiles=''
1471 libswanted_uselargefiles=''
1472 : set usemultiplicity on the Configure command line to enable multiplicity.
1473 : set usesocks on the Configure command line to enable socks.
1474 : List of libraries we want.
1475 : If anyone needs extra -lxxx, put those in a hint file.
1476 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1477 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1478 : We probably want to search /usr/shlib before most other libraries.
1479 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1480 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1481 glibpth="/usr/shlib $glibpth"
1482 : Do not use vfork unless overridden by a hint file.
1483 usevfork=false
1484
1485 : Find the basic shell for Bourne shell scripts
1486 case "$sh" in
1487 '')
1488         case "$SYSTYPE" in
1489         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1490         *) xxx='/bin/sh';;
1491         esac
1492         if test -f "$xxx"; then
1493                 sh="$xxx"
1494         else
1495                 : Build up a list and do a single loop so we can 'break' out.
1496                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1497                 for xxx in sh bash ksh pdksh ash; do
1498                         for p in $pth; do
1499                                 try="$try ${p}/${xxx}"
1500                         done
1501                 done
1502                 for xxx in $try; do
1503                         if test -f "$xxx"; then
1504                                 sh="$xxx";
1505                                 break
1506                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1507                                 sh="$xxx";
1508                                 break
1509                         elif test -f "$xxx.exe"; then
1510                                 sh="$xxx";
1511                                 break
1512                         fi
1513                 done
1514         fi
1515         ;;
1516 esac
1517
1518 case "$sh" in
1519 '')     cat >&2 <<EOM
1520 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1521
1522 Usually it's in /bin/sh.  How did you even get this far?
1523 Please contact me (Perl Maintainers) at perlbug@perl.org and
1524 we'll try to straighten this all out.
1525 EOM
1526         exit 1
1527         ;;
1528 esac
1529
1530 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1531 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1532 targetsh=$sh
1533
1534 : see if sh knows # comments
1535 if `$sh -c '#' >/dev/null 2>&1`; then
1536         shsharp=true
1537         spitshell=cat
1538         xcat=/bin/cat
1539         test -f $xcat$_exe || xcat=/usr/bin/cat
1540         if test ! -f $xcat$_exe; then
1541                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1542                         if test -f $p/cat$_exe; then
1543                                 xcat=$p/cat
1544                                 break
1545                         fi
1546                 done
1547                 if test ! -f $xcat$_exe; then
1548                         echo "Can't find cat anywhere!"
1549                         exit 1
1550                 fi
1551         fi
1552         echo "#!$xcat" >sharp
1553         $eunicefix sharp
1554         chmod +x sharp
1555         ./sharp > today 2>/dev/null
1556         if test -s today; then
1557                 sharpbang='#!'
1558         else
1559                 echo "#! $xcat" > sharp
1560                 $eunicefix sharp
1561                 chmod +x sharp
1562                 ./sharp > today 2>/dev/null
1563                 if test -s today; then
1564                         sharpbang='#! '
1565                 else
1566                         sharpbang=': use '
1567                 fi
1568         fi
1569 else
1570         echo " "
1571         echo "Your $sh doesn't grok # comments--I will strip them later on."
1572         shsharp=false
1573         cd ..
1574         echo "exec grep -v '^[  ]*#'" >spitshell
1575         chmod +x spitshell
1576         $eunicefix spitshell
1577         spitshell=`pwd`/spitshell
1578         cd UU
1579         echo "I presume that if # doesn't work, #! won't work either!"
1580         sharpbang=': use '
1581 fi
1582 rm -f sharp today
1583
1584 : figure out how to guarantee sh startup
1585 case "$startsh" in
1586 '') startsh=${sharpbang}${sh} ;;
1587 *)
1588 esac
1589 cat >sharp <<EOSS
1590 $startsh
1591 set abc
1592 test "$?abc" != 1
1593 EOSS
1594
1595 chmod +x sharp
1596 $eunicefix sharp
1597 if ./sharp; then
1598         : echo "Yup, it does."
1599 else
1600         echo "Hmm... '$startsh' does not guarantee sh startup..."
1601         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1602 fi
1603 rm -f sharp
1604
1605 : Save command line options in file UU/cmdline.opt for later use in
1606 : generating config.sh.
1607 cat > cmdline.opt <<EOSH
1608 : Configure command line arguments.
1609 config_arg0='$0'
1610 config_args='$*'
1611 config_argc=$#
1612 EOSH
1613 argn=1
1614 args_exp=''
1615 args_sep=''
1616 for arg in "$@"; do
1617         cat >>cmdline.opt <<EOSH
1618 config_arg$argn='$arg'
1619 EOSH
1620         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1621 $arg
1622 EOC
1623         arg_exp=`cat cmdl.opt`
1624         args_exp="$args_exp$args_sep'$arg_exp'"
1625         argn=`expr $argn + 1`
1626         args_sep=' '
1627 done
1628 rm -f cmdl.opt
1629
1630 : produce awk script to parse command line options
1631 cat >options.awk <<'EOF'
1632 BEGIN {
1633         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1634
1635         len = length(optstr);
1636         for (i = 1; i <= len; i++) {
1637                 c = substr(optstr, i, 1);
1638                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1639                 if (a == ":") {
1640                         arg[c] = 1;
1641                         i++;
1642                 }
1643                 opt[c] = 1;
1644         }
1645 }
1646 {
1647         expect = 0;
1648         str = $0;
1649         if (substr(str, 1, 1) != "-") {
1650                 printf("'%s'\n", str);
1651                 next;
1652         }
1653         len = length($0);
1654         for (i = 2; i <= len; i++) {
1655                 c = substr(str, i, 1);
1656                 if (!opt[c]) {
1657                         printf("-%s\n", substr(str, i));
1658                         next;
1659                 }
1660                 printf("-%s\n", c);
1661                 if (arg[c]) {
1662                         if (i < len)
1663                                 printf("'%s'\n", substr(str, i + 1));
1664                         else
1665                                 expect = 1;
1666                         next;
1667                 }
1668         }
1669 }
1670 END {
1671         if (expect)
1672                 print "?";
1673 }
1674 EOF
1675
1676 : process the command line options
1677 set X `for arg in "$@"; do echo "X$arg"; done |
1678         sed -e s/X// | awk -f options.awk`
1679 eval "set $*"
1680 shift
1681 rm -f options.awk
1682
1683 : set up default values
1684 fastread=''
1685 reuseval=false
1686 config_sh=''
1687 alldone=''
1688 error=''
1689 silent=''
1690 extractsh=''
1691 knowitall=''
1692 rm -f optdef.sh posthint.sh
1693 cat >optdef.sh <<EOS
1694 $startsh
1695 EOS
1696
1697
1698 : option parsing
1699 while test $# -gt 0; do
1700         case "$1" in
1701         -d) shift; fastread=yes;;
1702         -e) shift; alldone=cont;;
1703         -f)
1704                 shift
1705                 cd ..
1706                 if test -r "$1"; then
1707                         config_sh="$1"
1708                 else
1709                         echo "$me: cannot read config file $1." >&2
1710                         error=true
1711                 fi
1712                 cd UU
1713                 shift;;
1714         --help|\
1715         -h) shift; error=true;;
1716         -r) shift; reuseval=true;;
1717         -s) shift; silent=true; realsilent=true;;
1718         -E) shift; alldone=exit;;
1719         -K) shift; knowitall=true;;
1720         -O) shift;;
1721         -S) shift; silent=true; extractsh=true;;
1722         -D)
1723                 shift
1724                 case "$1" in
1725                 *=)
1726                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1727                         echo "$me: ignoring -D $1" >&2
1728                         ;;
1729                 *=*) echo "$1" | \
1730                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1731                 *) echo "$1='define'" >> optdef.sh;;
1732                 esac
1733                 shift
1734                 ;;
1735         -U)
1736                 shift
1737                 case "$1" in
1738                 *=) echo "$1" >> optdef.sh;;
1739                 *=*)
1740                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1741                         echo "$me: ignoring -U $1" >&2
1742                         ;;
1743                 *) echo "$1='undef'" >> optdef.sh;;
1744                 esac
1745                 shift
1746                 ;;
1747         -A)
1748             shift
1749             xxx=''
1750             yyy="$1"
1751             zzz=''
1752             uuu=undef
1753             case "$yyy" in
1754             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1755                  case "$zzz" in
1756                  *:*) zzz='' ;;
1757                  *)   xxx=append
1758                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1759                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1760                  esac
1761                  ;;
1762             esac
1763             case "$xxx" in
1764             '')  case "$yyy" in
1765                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1766                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1767                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1768                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1769                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1770                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1771                  esac
1772                  ;;
1773             esac
1774             case "$xxx" in
1775             append)
1776                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1777             clear)
1778                 echo "$yyy=''"                  >> posthint.sh ;;
1779             define)
1780                 case "$zzz" in
1781                 '') zzz=define ;;
1782                 esac
1783                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1784             eval)
1785                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1786             prepend)
1787                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1788             undef)
1789                 case "$zzz" in
1790                 '') zzz="$uuu" ;;
1791                 esac
1792                 echo "$yyy=$zzz"                >> posthint.sh ;;
1793             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1794             esac
1795             shift
1796             ;;
1797         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1798             exit 0;;
1799         --) break;;
1800         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1801         *) break;;
1802         esac
1803 done
1804
1805 case "$error" in
1806 true)
1807         cat >&2 <<EOM
1808 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1809                  [-U symbol] [-U symbol=] [-A command:symbol...]
1810   -d : use defaults for all answers.
1811   -e : go on without questioning past the production of config.sh.
1812   -f : specify an alternate default configuration file.
1813   -h : print this help message and exit (with an error status).
1814   -r : reuse C symbols value if possible (skips costly nm extraction).
1815   -s : silent mode, only echoes questions and essential information.
1816   -D : define symbol to have some value:
1817          -D symbol         symbol gets the value 'define'
1818          -D symbol=value   symbol gets the value 'value'
1819        common used examples (see INSTALL for more info):
1820          -Duse64bitint            use 64bit integers
1821          -Duse64bitall            use 64bit integers and pointers
1822          -Dusethreads             use thread support
1823          -Dinc_version_list=none  do not include older perl trees in @INC
1824          -DEBUGGING=none          DEBUGGING options
1825          -Dcc=gcc                 choose your compiler
1826          -Dprefix=/opt/perl5      choose your destination
1827   -E : stop at the end of questions, after having produced config.sh.
1828   -K : do not use unless you know what you are doing.
1829   -O : ignored for backward compatibility
1830   -S : perform variable substitutions on all .SH files (can mix with -f)
1831   -U : undefine symbol:
1832          -U symbol    symbol gets the value 'undef'
1833          -U symbol=   symbol gets completely empty
1834        e.g.:  -Uversiononly
1835   -A : manipulate symbol after the platform specific hints have been applied:
1836          -A append:symbol=value   append value to symbol
1837          -A symbol=value          like append:, but with a separating space
1838          -A define:symbol=value   define symbol to have value
1839          -A clear:symbol          define symbol to be ''
1840          -A define:symbol         define symbol to be 'define'
1841          -A eval:symbol=value     define symbol to be eval of value
1842          -A prepend:symbol=value  prepend value to symbol
1843          -A undef:symbol          define symbol to be 'undef'
1844          -A undef:symbol=         define symbol to be ''
1845        e.g.:  -A prepend:libswanted='cl pthread '
1846               -A ccflags=-DSOME_MACRO
1847   -V : print version number and exit (with a zero status).
1848 EOM
1849         exit 1
1850         ;;
1851 esac
1852
1853 : Sanity checks
1854 case "$fastread$alldone" in
1855 yescont|yesexit) ;;
1856 *)
1857         case "$extractsh" in
1858         true) ;;
1859         *)
1860                 if test ! -t 0; then
1861                         echo "Say 'sh Configure', not 'sh <Configure'"
1862                         exit 1
1863                 fi
1864                 ;;
1865         esac
1866         ;;
1867 esac
1868
1869 exec 4>&1
1870 case "$silent" in
1871 true) exec 1>/dev/null;;
1872 esac
1873
1874 : run the defines and the undefines, if any, but leave the file out there...
1875 touch optdef.sh
1876 grep '\\' optdef.sh >/dev/null 2>&1
1877 if test $? = 0; then
1878     echo "Configure does not support \\ in -D arguments"
1879     exit 1
1880 fi
1881 . ./optdef.sh
1882 : create the posthint manipulation script and leave the file out there...
1883 touch posthint.sh
1884
1885 : set package name
1886 package='perl5'
1887 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1888 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1889 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1890 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1891 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1892 esac
1893
1894 : Some greps do not return status, grrr.
1895 echo "grimblepritz" >grimble
1896 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1897         contains=contains
1898 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1899         contains=grep
1900 else
1901         contains=contains
1902 fi
1903 rm -f grimble
1904 : the following should work in any shell
1905 case "$contains" in
1906 contains*)
1907         echo " "
1908         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1909         cat >contains <<'EOSS'
1910 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1911 EOSS
1912 chmod +x contains
1913 esac
1914
1915 : Find the path to the source tree
1916 case "$src" in
1917 '') case "$0" in
1918     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1919          case "$src" in
1920          /*)    ;;
1921          .)     ;;
1922          *)     src=`cd ../$src && pwd` ;;
1923          esac
1924          ;;
1925     *)   src='.';;
1926     esac;;
1927 esac
1928 case "$src" in
1929 '')     src=/
1930         rsrc=/
1931         ;;
1932 /*)     rsrc="$src";;
1933 *)      rsrc="../$src";;
1934 esac
1935 if test -f $rsrc/Configure && \
1936         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1937 then
1938    : found it, so we are ok.
1939 else
1940         rsrc=''
1941         for src in . .. ../.. ../../.. ../../../..; do
1942                 if test -f ../$src/Configure && \
1943                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1944                 then
1945                         rsrc=../$src
1946                         break
1947                 fi
1948         done
1949 fi
1950 case "$rsrc" in
1951 '')
1952         cat <<EOM >&4
1953
1954 Sorry, I can't seem to locate the source dir for $package.  Please start
1955 Configure with an explicit path -- i.e. /some/path/Configure.
1956
1957 EOM
1958         exit 1
1959         ;;
1960 ../.)   rsrc='..';;
1961 *)
1962         echo " "
1963         echo "Sources for $package found in \"$src\"." >&4
1964         ;;
1965 esac
1966
1967 : script used to extract .SH files with variable substitutions
1968 cat >extract <<'EOS'
1969 PERL_CONFIG_SH=true
1970 echo "Doing variable substitutions on .SH files..."
1971 if test -f MANIFEST; then
1972         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1973 else
1974         echo "(Looking for .SH files under the source directory.)"
1975         set x `(cd "$src"; find . -name "*.SH" -print)`
1976 fi
1977 shift
1978 case $# in
1979 0) set x `(cd "$src"; echo *.SH)`; shift;;
1980 esac
1981 if test ! -f "$src/$1"; then
1982         shift
1983 fi
1984 mkdir_p='
1985 name=$1;
1986 create="";
1987 while test $name; do
1988         if test ! -d "$name"; then
1989                 create="$name $create";
1990                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1991                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1992         else
1993                 name="";
1994         fi;
1995 done;
1996 for file in $create; do
1997         mkdir $file;
1998 done
1999 '
2000 for file in $*; do
2001         case "$src" in
2002         ".")
2003                 case "$file" in
2004                 */*)
2005                         dir=`expr X$file : 'X\(.*\)/'`
2006                         file=`expr X$file : 'X.*/\(.*\)'`
2007                         (cd "$dir" && . ./$file)
2008                         ;;
2009                 *)
2010                         . ./$file
2011                         ;;
2012                 esac
2013                 ;;
2014         *)
2015                 case "$file" in
2016                 */*)
2017                         dir=`expr X$file : 'X\(.*\)/'`
2018                         file=`expr X$file : 'X.*/\(.*\)'`
2019                         (set x $dir; shift; eval $mkdir_p)
2020                         sh <"$src/$dir/$file"
2021                         ;;
2022                 *)
2023                         sh <"$src/$file"
2024                         ;;
2025                 esac
2026                 ;;
2027         esac
2028 done
2029 if test -f "$src/config_h.SH"; then
2030         if test ! -f config.h; then
2031         : oops, they left it out of MANIFEST, probably, so do it anyway.
2032         . "$src/config_h.SH"
2033         fi
2034 fi
2035 EOS
2036
2037 : extract files and exit if asked to do so
2038 case "$extractsh" in
2039 true)
2040         case "$realsilent" in
2041         true) ;;
2042         *) exec 1>&4;;
2043         esac
2044         case "$config_sh" in
2045         '') config_sh='config.sh';;
2046         esac
2047         echo " "
2048         echo "Fetching answers from $config_sh..."
2049         cd ..
2050         . $config_sh
2051         . UU/optdef.sh
2052         echo " "
2053         . UU/extract
2054         rm -rf UU
2055         echo "Extraction done."
2056         exit 0
2057         ;;
2058 esac
2059
2060 : Eunice requires " " instead of "", can you believe it
2061 echo " "
2062 : Here we go...
2063 echo "Beginning of configuration questions for $package."
2064
2065 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2066
2067 : first determine how to suppress newline on echo command
2068 echo " "
2069 echo "Checking echo to see how to suppress newlines..."
2070 (echo "hi there\c" ; echo " ") >.echotmp
2071 if $contains c .echotmp >/dev/null 2>&1 ; then
2072         echo "...using -n."
2073         n='-n'
2074         c=''
2075 else
2076         cat <<'EOM'
2077 ...using \c
2078 EOM
2079         n=''
2080         c='\c'
2081 fi
2082 echo $n "The star should be here-->$c"
2083 echo '*'
2084 rm -f .echotmp
2085
2086 : Now test for existence of everything in MANIFEST
2087 echo " "
2088 if test -f "$rsrc/MANIFEST"; then
2089         echo "First let's make sure your kit is complete.  Checking..." >&4
2090         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2091                 (split -l 50 2>/dev/null || split -50)
2092         rm -f missing
2093         tmppwd=`pwd`
2094         for filelist in x??; do
2095                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2096                         >/dev/null 2>>"$tmppwd/missing")
2097         done
2098         if test -s missing; then
2099                 cat missing >&4
2100                 cat >&4 <<'EOM'
2101
2102 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2103
2104 You have the option of continuing the configuration process, despite the
2105 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2106 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2107 and contact the author (perlbug@perl.org).
2108
2109 EOM
2110                 echo $n "Continue? [n] $c" >&4
2111                 read ans
2112                 case "$ans" in
2113                 y*)
2114                         echo "Continuing..." >&4
2115                         rm -f missing
2116                         ;;
2117                 *)
2118                         echo "ABORTING..." >&4
2119                         kill $$
2120                         ;;
2121                 esac
2122         else
2123                 echo "Looks good..."
2124         fi
2125 else
2126         echo "There is no MANIFEST file.  I hope your kit is complete !"
2127 fi
2128 rm -f missing x??
2129
2130 : Find the appropriate value for a newline for tr
2131 echo " "
2132 if test -n "$DJGPP"; then
2133        trnl='\012'
2134 fi
2135 if test X"$trnl" = X; then
2136         case "`echo foo|tr '\n' x 2>/dev/null`" in
2137         foox) trnl='\n' ;;
2138         esac
2139 fi
2140 if test X"$trnl" = X; then
2141         case "`echo foo|tr '\012' x 2>/dev/null`" in
2142         foox) trnl='\012' ;;
2143         esac
2144 fi
2145 if test X"$trnl" = X; then
2146        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2147        fooxy) trnl='\n\r' ;;
2148        esac
2149 fi
2150 if test X"$trnl" = X; then
2151         cat <<EOM >&2
2152
2153 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2154
2155 EOM
2156         exit 1
2157 fi
2158
2159 : compute the number of columns on the terminal for proper question formatting
2160 case "$COLUMNS" in
2161 '') COLUMNS='80';;
2162 esac
2163
2164 : set up the echo used in my read
2165 myecho="case \"\$xxxm\" in
2166 '') echo $n \"\$rp $c\" >&4;;
2167 *) case \"\$rp\" in
2168         '') echo $n \"[\$xxxm] $c\";;
2169         *)
2170                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2171                         echo \"\$rp\" >&4
2172                         echo $n \"[\$xxxm] $c\" >&4
2173                 else
2174                         echo $n \"\$rp [\$xxxm] $c\" >&4
2175                 fi
2176                 ;;
2177         esac;;
2178 esac"
2179
2180 : now set up to do reads with possible shell escape and default assignment
2181 cat <<EOSC >myread
2182 $startsh
2183 xxxm=\$dflt
2184 $myecho
2185 ans='!'
2186 case "\$fastread" in
2187 yes) case "\$dflt" in
2188         '') ;;
2189         *) ans='';
2190                 case "\$silent-\$rp" in
2191                 true-) ;;
2192                 *) echo " " >&4;;
2193                 esac;;
2194         esac;;
2195 *) case "\$silent" in
2196         true) case "\$rp" in
2197                 '') ans='';;
2198                 esac;;
2199         esac;;
2200 esac
2201 while expr "X\$ans" : "X!" >/dev/null; do
2202         read answ
2203         set x \$xxxm
2204         shift
2205         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2206         case  "\$answ" in
2207         "!")
2208                 sh 1>&4
2209                 echo " "
2210                 $myecho
2211                 ;;
2212         !*)
2213                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2214                 shift
2215                 sh 1>&4 -c "\$*"
2216                 echo " "
2217                 $myecho
2218                 ;;
2219         "\$ans")
2220                 case "\$ans" in
2221                 \\&*)
2222                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2223                         shift
2224                         case "\$1" in
2225                         -d)
2226                                 fastread=yes
2227                                 echo "(OK, I'll run with -d after this question.)" >&4
2228                                 ;;
2229                         -*)
2230                                 echo "*** Sorry, \$1 not supported yet." >&4
2231                                 ;;
2232                         esac
2233                         $myecho
2234                         ans=!
2235                         ;;
2236                 esac;;
2237         *)
2238                 case "\$aok" in
2239                 y)
2240                         echo "*** Substitution done -- please confirm."
2241                         xxxm="\$ans"
2242                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2243                         xxxm="\$ans"
2244                         ans=!
2245                         ;;
2246                 *)
2247                         echo "*** Error -- try again."
2248                         ans=!
2249                         ;;
2250                 esac
2251                 $myecho
2252                 ;;
2253         esac
2254         case "\$ans\$xxxm\$nostick" in
2255         '')
2256                 ans=!
2257                 $myecho
2258                 ;;
2259         esac
2260 done
2261 case "\$ans" in
2262 '') ans="\$xxxm";;
2263 esac
2264 EOSC
2265
2266 : create .config dir to save info across Configure sessions
2267 test -d ../.config || mkdir ../.config
2268 cat >../.config/README <<EOF
2269 This directory created by Configure to save information that should
2270 persist across sessions for $package.
2271
2272 You may safely delete it if you wish.
2273 EOF
2274
2275 : See if we are using a devel version and want that
2276 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2277 case "$usedevel" in
2278 $define|true|[yY]*)
2279     usedevel="$define" ;;
2280 *) case "$xversion" in
2281    *[13579])
2282         cat >&4 <<EOH
2283 *** WHOA THERE!!! ***
2284
2285     This is an UNSTABLE DEVELOPMENT release.
2286     The version of this $package distribution is $xversion, that is, odd,
2287     (as opposed to even) and that signifies a development release.
2288     If you want a maintenance release, you want an even-numbered version.
2289
2290     Do ***NOT*** install this into production use.
2291     Data corruption and crashes are possible.
2292
2293     It is most seriously suggested that you do not continue any further
2294     unless you want to help in developing and debugging Perl.
2295
2296     If you *still* want to build perl, you can answer 'y' now,
2297     or pass -Dusedevel to Configure.
2298
2299 EOH
2300         rp='Do you really want to continue?'
2301         dflt='n'
2302         . ./myread
2303         case "$ans" in
2304         [yY]) echo >&4 "Okay, continuing."
2305               usedevel="$define" ;;
2306         *) echo >&4 "Okay, bye."
2307            exit 1
2308            ;;
2309         esac
2310         ;;
2311     esac
2312     usedevel="$undef"
2313     ;;
2314 esac
2315 case "$usedevel" in
2316 $define|true|[yY]*)
2317         case "$versiononly" in
2318         '') versiononly="$define" ;;
2319         esac
2320         case "$installusrbinperl" in
2321         '') installusrbinperl="$undef" ;;
2322         esac
2323         ;;
2324 esac
2325
2326 : general instructions
2327 needman=true
2328 firsttime=true
2329 user=`(logname) 2>/dev/null`
2330 case "$user" in
2331 '') user=`whoami 2>&1`;;
2332 esac
2333 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2334         firsttime=false
2335         echo " "
2336         rp='Would you like to see the instructions?'
2337         dflt=n
2338         . ./myread
2339         case "$ans" in
2340         [yY]*) ;;
2341         *) needman=false;;
2342         esac
2343 fi
2344 if $needman; then
2345         cat <<EOH
2346
2347 This installation shell script will examine your system and ask you questions
2348 to determine how the perl5 package should be installed. If you get
2349 stuck on a question, you may use a ! shell escape to start a subshell or
2350 execute a command.  Many of the questions will have default answers in square
2351 brackets; typing carriage return will give you the default.
2352
2353 On some of the questions which ask for file or directory names you are allowed
2354 to use the ~name construct to specify the login directory belonging to "name",
2355 even if you don't have a shell which knows about that.  Questions where this is
2356 allowed will be marked "(~name ok)".
2357
2358 EOH
2359         rp=''
2360         dflt='Type carriage return to continue'
2361         . ./myread
2362         cat <<'EOH'
2363
2364 The prompter used in this script allows you to use shell variables and
2365 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2366 in the default answer, as if the default line was a set of arguments given to a
2367 script shell.  This means you may also use $* to repeat the whole default line,
2368 so you do not have to re-type everything to add something to the default.
2369
2370 Every time there is a substitution, you will have to confirm.  If there is an
2371 error (e.g. an unmatched backtick), the default answer will remain unchanged
2372 and you will be prompted again.
2373
2374 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2375 the questions and use the computed defaults (or the previous answers if there
2376 was already a config.sh file). Type 'Configure -h' for a list of options.
2377 You may also start interactively and then answer '& -d' at any prompt to turn
2378 on the non-interactive behaviour for the remainder of the execution.
2379
2380 EOH
2381         . ./myread
2382         cat <<EOH
2383
2384 Much effort has been expended to ensure that this shell script will run on any
2385 Unix system.  If despite that it blows up on yours, your best bet is to edit
2386 Configure and run it again.  If you can't run Configure for some reason,
2387 you'll have to generate a config.sh file by hand.  Whatever problems you
2388 have, let me (perlbug@perl.org) know how I blew it.
2389
2390 This installation script affects things in two ways:
2391
2392 1) it may do direct variable substitutions on some of the files included
2393    in this kit.
2394 2) it builds a config.h file for inclusion in C programs.  You may edit
2395    any of these files as the need arises after running this script.
2396
2397 If you make a mistake on a question, there is no easy way to back up to it
2398 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2399 files.  Configure will offer to let you do this before it runs the SH files.
2400
2401 EOH
2402         dflt='Type carriage return to continue'
2403         . ./myread
2404         case "$firsttime" in
2405         true) echo $user >>../.config/instruct;;
2406         esac
2407 fi
2408
2409 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2410 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2411 if test "X$sysroot" = X; then
2412     sysroot=""
2413 else
2414     case "$cc" in
2415         *gcc*|*g++*)
2416             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2417             # _sysroot is used in places where we need --sysroot=foo
2418             # but using the rest of the flags could cause issues.
2419             _sysroot="--sysroot=$sysroot";
2420             case "$ccflags" in
2421                 *sysroot*) ;;
2422                 'undef'|*)
2423                 ccflags="$ccflags $_sysroot"
2424             esac
2425             case "$ldflags" in
2426                 *sysroot*) ;;
2427                 'undef'|*)
2428                 ldflags="$ldflags $_sysroot"
2429             esac
2430             case "$cppflags" in
2431                 *sysroot*) ;;
2432                 'undef'|*)
2433                 cppflags="$cppflags $_sysroot"
2434             esac
2435             # lddlflags updated below in lddlflags section;
2436             # same with cccdlflags
2437             ;;
2438     esac
2439
2440     # Adjust some defaults to also use $sysroot
2441     for var in xlibpth loclibpth locincpth glibpth; do
2442         eval xxx=\$$var
2443         eval $var=''
2444         for path in $xxx; do
2445             eval $var=\"\$$var $sysroot$path\"
2446         done
2447     done
2448
2449 fi
2450
2451 : find out where common programs are
2452 echo " "
2453 echo "Locating common programs..." >&4
2454 cat <<EOSC >loc
2455 $startsh
2456 case \$# in
2457 0) exit 1;;
2458 esac
2459 thing=\$1
2460 shift
2461 dflt=\$1
2462 shift
2463 for dir in \$*; do
2464         case "\$thing" in
2465         .)
2466         if test -d \$dir/\$thing; then
2467                 echo \$dir
2468                 exit 0
2469         fi
2470         ;;
2471         *)
2472         for thisthing in \$dir/\$thing; do
2473                 : just loop through to pick last item
2474         done
2475         if test -f \$thisthing; then
2476                 echo \$thisthing
2477                 exit 0
2478         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2479                 echo \$thisthing
2480                 exit 0
2481         elif test -f \$dir/\$thing.exe; then
2482                 if test -n "$DJGPP"; then
2483                         echo \$dir/\$thing.exe
2484                 elif test "$eunicefix" != ":"; then
2485                         : on Eunice apparently
2486                         echo \$dir/\$thing
2487                 fi
2488                 exit 0
2489         fi
2490         ;;
2491         esac
2492 done
2493 echo \$dflt
2494 exit 1
2495 EOSC
2496 chmod +x loc
2497 $eunicefix loc
2498 loclist="
2499 awk
2500 cat
2501 chmod
2502 comm
2503 cp
2504 echo
2505 expr
2506 grep
2507 ls
2508 mkdir
2509 rm
2510 sed
2511 sort
2512 touch
2513 tr
2514 uniq
2515 "
2516 trylist="
2517 ar
2518 bison
2519 byacc
2520 cpp
2521 csh
2522 date
2523 egrep
2524 gmake
2525 gzip
2526 less
2527 ln
2528 make
2529 more
2530 nm
2531 nroff
2532 perl
2533 pg
2534 test
2535 uname
2536 zip
2537 "
2538 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2539 pth="$pth $sysroot/lib $sysroot/usr/lib"
2540 for file in $loclist; do
2541         eval xxx=\$$file
2542         case "$xxx" in
2543         /*|?:[\\/]*)
2544                 if test -f "$xxx"; then
2545                         : ok
2546                 else
2547                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2548                         xxx=`./loc $file $file $pth`
2549                 fi
2550                 ;;
2551         '') xxx=`./loc $file $file $pth`;;
2552         *) xxx=`./loc $xxx $xxx $pth`;;
2553         esac
2554         eval $file=$xxx$_exe
2555         eval _$file=$xxx
2556         case "$xxx" in
2557         /*)
2558                 echo $file is in $xxx.
2559                 ;;
2560         ?:[\\/]*)
2561                 echo $file is in $xxx.
2562                 ;;
2563         *)
2564                 echo "I don't know where '$file' is, and my life depends on it." >&4
2565                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2566                 exit 1
2567                 ;;
2568         esac
2569 done
2570 echo " "
2571 echo "Don't worry if any of the following aren't found..."
2572 say=offhand
2573 for file in $trylist; do
2574         eval xxx=\$$file
2575         case "$xxx" in
2576         /*|?:[\\/]*)
2577                 if test -f "$xxx"; then
2578                         : ok
2579                 else
2580                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2581                         xxx=`./loc $file $file $pth`
2582                 fi
2583                 ;;
2584         '') xxx=`./loc $file $file $pth`;;
2585         *) xxx=`./loc $xxx $xxx $pth`;;
2586         esac
2587         eval $file=$xxx$_exe
2588         eval _$file=$xxx
2589         case "$xxx" in
2590         /*)
2591                 echo $file is in $xxx.
2592                 ;;
2593         ?:[\\/]*)
2594                 echo $file is in $xxx.
2595                 ;;
2596         *)
2597                 echo "I don't see $file out there, $say."
2598                 say=either
2599                 ;;
2600         esac
2601 done
2602 case "$egrep" in
2603 egrep)
2604         echo "Substituting grep for egrep."
2605         egrep=$grep
2606         _egrep=$grep
2607         ;;
2608 esac
2609 case "$less" in
2610 '')     ;;
2611 *)      if $less -R </dev/null >/dev/null 2>&1; then
2612                echo "Substituting less -R for less."
2613                less="$less -R"
2614                _less=$less
2615         fi
2616         ;;
2617 esac
2618 case "$ln" in
2619 ln)
2620         echo "Substituting cp for ln."
2621         ln=$cp
2622         _ln=$cp
2623         ;;
2624 esac
2625 case "$make" in
2626 make)
2627         case "$gmake" in
2628         gmake)
2629         echo "I can't find make or gmake, and my life depends on it." >&4
2630         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2631         exit 1
2632         ;;
2633         esac
2634         ;;
2635 esac
2636 case "$gmake" in
2637 gmake)  ;;
2638 *)      # We can't have osname yet.
2639         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2640                 # Assume that gmake, if found, is definitely GNU make
2641                 # and prefer it over the system make.
2642                 echo "Substituting gmake for make."
2643                 make=$gmake
2644                 _make=$gmake
2645         fi
2646         ;;
2647 esac
2648 case "$test" in
2649 test)
2650         echo "Hopefully test is built into your sh."
2651         ;;
2652 *)
2653         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2654                 echo "Using the test built into your sh."
2655                 test=test
2656                 _test=test
2657         fi
2658         ;;
2659 esac
2660 case "$echo" in
2661 echo)
2662         echo "Hopefully echo is built into your sh."
2663         ;;
2664 '') ;;
2665 *)
2666         echo " "
2667 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2668         $echo $n "hi there$c" >foo1
2669         echo $n "hi there$c" >foo2
2670         if cmp foo1 foo2 >/dev/null 2>&1; then
2671                 echo "They are compatible.  In fact, they may be identical."
2672         else
2673                 case "$n" in
2674                 '-n') n='' c='\c';;
2675                 *) n='-n' c='';;
2676                 esac
2677                 cat <<FOO
2678 They are not compatible!  You are probably running ksh on a non-USG system.
2679 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2680 have echo built in and we may have to run some Bourne shell scripts.  That
2681 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2682
2683 FOO
2684                 $echo $n "The star should be here-->$c"
2685                 $echo "*"
2686         fi
2687         $rm -f foo1 foo2
2688         ;;
2689 esac
2690
2691 # This question was auctioned at YAPC::Europe-2007 in Vienna
2692 # I never promised you could answer it. I only auctioned the question.
2693 cat <<FOO
2694 The following message is sponsored by
2695
2696   Dresden.pm<--The stars should be here.
2697
2698 Dear Perl user, system administrator or package
2699 maintainer, the Perl community sends greetings to
2700 you. Do you (emblematical) greet back [Y/n]? n
2701
2702 FOO
2703
2704 : Check what type of C compiler we use
2705 cat <<EOS >trygcc
2706 $startsh
2707 EOS
2708 cat <<'EOSC' >>trygcc
2709 case "$cc" in
2710 '') ;;
2711 *)  $rm -f try try.*
2712     $cat >try.c <<EOM
2713 int main(int argc, char *argv[]) {
2714   return 0;
2715 }
2716 EOM
2717     if $cc -o try $ccflags $ldflags try.c; then
2718        :
2719     else
2720         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2721         despair=yes
2722         trygcc=yes
2723         case "$cc" in
2724         *gcc*) trygcc=no ;;
2725         esac
2726         # Skip this test because it gives a false match on output like:
2727         #    ./trygcc: line 23: cc: command not found
2728         # case "`$cc -v -c try.c 2>&1`" in
2729         # *gcc*) trygcc=no ;;
2730         # esac
2731         if $test X"$trygcc" = Xyes; then
2732             if gcc -o try -c try.c; then
2733                 echo " "
2734                 echo "You seem to have a working gcc, though." >&4
2735                 # Switching compilers may undo the work of hints files.
2736                 # The most common problem is -D_REENTRANT for threads.
2737                 # This heuristic catches that case, but gets false positives
2738                 # if -Dusethreads was not actually specified.  Better to
2739                 # bail out here with a useful message than fail
2740                 # mysteriously later. Should we perhaps just try to
2741                 # re-invoke Configure -Dcc=gcc config_args ?
2742                 if $test -f usethreads.cbu; then
2743                         $cat >&4 <<EOM
2744
2745 *** However, any setting of the C compiler flags (e.g. for thread support)
2746 *** will be lost.  It may be necessary for you to restart Configure and
2747 *** add -Dcc=gcc to your Configure command line.
2748
2749 EOM
2750                         rp="Would you like to go ahead and try gcc anyway?"
2751                         dflt=n
2752                 else
2753                         rp="Would you like to use it?"
2754                         dflt=y
2755                 fi
2756                 if $test -f myread; then
2757                     . ./myread
2758                 else
2759                     if $test -f UU/myread; then
2760                         . ./UU/myread
2761                     else
2762                         echo "Cannot find myread, sorry.  Aborting." >&2
2763                         exit 1
2764                     fi
2765                 fi
2766                 case "$ans" in
2767                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2768                 esac
2769             fi
2770         fi
2771     fi
2772     $rm -f try try.*
2773     ;;
2774 esac
2775 EOSC
2776
2777 cat <<EOS >checkcc
2778 $startsh
2779 EOS
2780 cat <<'EOSC' >>checkcc
2781 case "$cc" in
2782 '') ;;
2783 *)  $rm -f try try.*
2784     $cat >try.c <<EOM
2785 int main(int argc, char *argv[]) {
2786   return 0;
2787 }
2788 EOM
2789     if $cc -o try $ccflags $ldflags try.c; then
2790        :
2791     else
2792         if $test X"$despair" = Xyes; then
2793            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2794         fi
2795         $cat >&4 <<EOM
2796 You need to find a working C compiler.
2797 Either (purchase and) install the C compiler supplied by your OS vendor,
2798 or for a free C compiler try http://gcc.gnu.org/
2799 I cannot continue any further, aborting.
2800 EOM
2801         exit 1
2802     fi
2803     $rm -f try try.*
2804     ;;
2805 esac
2806 EOSC
2807
2808 : determine whether symbolic links are supported
2809 echo " "
2810 $touch blurfl
2811 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2812         echo "Symbolic links are supported." >&4
2813         lns="$ln -s"
2814 else
2815         echo "Symbolic links are NOT supported." >&4
2816         lns="$ln"
2817 fi
2818 $rm -f blurfl sym
2819
2820 : determine whether symbolic links are supported
2821 echo " "
2822 case "$lns" in
2823 *"ln"*" -s")
2824         echo "Checking how to test for symbolic links..." >&4
2825         $lns blurfl sym
2826         if $test "X$issymlink" = X; then
2827                 case "$newsh" in
2828                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2829                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2830                 esac
2831                 if test $? = 0; then
2832                         issymlink="test -h"
2833                 else
2834                         echo "Your builtin 'test -h' may be broken." >&4
2835                         case "$test" in
2836                         /*)     ;;
2837                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2838                                 for p in $pth
2839                                 do
2840                                         if test -f "$p/$test"; then
2841                                                 test="$p/$test"
2842                                                 break
2843                                         fi
2844                                 done
2845                                 ;;
2846                         esac
2847                         case "$test" in
2848                         /*)
2849                                 echo "Trying external '$test -h'." >&4
2850                                 issymlink="$test -h"
2851                                 if $test ! -h sym >/dev/null 2>&1; then
2852                                         echo "External '$test -h' is broken, too." >&4
2853                                         issymlink=''
2854                                 fi
2855                                 ;;
2856                         *)      issymlink='' ;;
2857                         esac
2858                 fi
2859         fi
2860         if $test "X$issymlink" = X; then
2861                 if $test -L sym 2>/dev/null; then
2862                         issymlink="$test -L"
2863                         echo "The builtin '$test -L' worked." >&4
2864                 fi
2865         fi
2866         if $test "X$issymlink" != X; then
2867                 echo "You can test for symbolic links with '$issymlink'." >&4
2868         else
2869                 echo "I do not know how you can test for symbolic links." >&4
2870         fi
2871         $rm -f blurfl sym
2872         ;;
2873 *)      echo "No symbolic links, so not testing for their testing..." >&4
2874         ;;
2875 esac
2876 echo " "
2877
2878 : Make symlinks util
2879 case "$mksymlinks" in
2880 $define|true|[yY]*)
2881         case "$src" in
2882         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2883                 exit 1
2884                 ;;
2885         *)      case "$lns:$issymlink" in
2886                 *"ln"*" -s:"*"test -"?)
2887                         echo "Creating the symbolic links..." >&4
2888                         cd ..
2889                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2890                         awk 'NF == 1 {
2891                                 dir=".";
2892                                 file=$1 "";
2893                              }
2894                              NF == 2 {
2895                                 dir=$1 "";
2896                                 file=$2 "";
2897                              }
2898                              {
2899                                  print "# dir = ", dir, "file = ", file
2900                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2901                              } END {
2902                                  for (d in mf) {
2903                                      if (d != ".") { print("mkdir -p "d) }
2904                                      print("ln -sf "mf[d]" "d);
2905                                  }
2906                              }' source="$src" > UU/mksymlinks.$$
2907                         sh UU/mksymlinks.$$
2908                         rm UU/mksymlinks.$$
2909                         # Sanity check 1.
2910                         if test ! -d t/base; then
2911                                 echo "Failed to create the subdirectories.  Aborting." >&4
2912                                 exit 1
2913                         fi
2914                         # Sanity check 2.
2915                         if test ! -f t/base/lex.t; then
2916                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2917                                 exit 1
2918                         fi
2919                         if test ! -f win32/win32.c; then
2920                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2921                                 exit 1
2922                         fi
2923                         cd UU
2924                         ;;
2925                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2926                         ;;
2927                 esac
2928                 ;;
2929         esac
2930         ;;
2931 esac
2932
2933 : Check for Cross-Compilation
2934 if $test "X$targethost" = "X"; then
2935     targethost=""
2936 fi
2937 if $test "X$targetenv" = "X"; then
2938     targetenv=""
2939 fi
2940 case "$usecrosscompile" in
2941 $define|true|[yY]*)
2942         $echo "Cross-compiling..."
2943         croak=''
2944         case "$cc" in
2945         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2946             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2947             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2948             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2949             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2950             # leave out ld, choosing it is more complex
2951             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2952             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2953             # We are in a weird spot. Just before us, some values
2954             # were 'saved', to be restored after the hints are
2955             # run.  This means that the changes we made to ar,
2956             # nm and ranlib will get reverted.
2957             # To avoid that, we hijack the saving mechanism and
2958             # have it save our new values.
2959             for file in ar nm ranlib; do
2960                 eval xxx=\$$file
2961                 eval $file=$xxx$_exe
2962                 eval _$file=$xxx
2963             done
2964         ;;
2965         esac
2966         case "$targetarch" in
2967         '') echo "Targetarch not defined." >&4; croak=y ;;
2968         *)  echo "Using targetarch $targetarch." >&4 ;;
2969         esac
2970         case "$targethost" in
2971         '') echo "Targethost not defined." >&4; croak=y ;;
2972         *)  echo "Using targethost $targethost." >&4
2973         esac
2974         locincpth=' '
2975         loclibpth=' '
2976         case "$croak" in
2977         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2978         esac
2979     : compile a host miniperl and generate_uudmap, unless we got passed them
2980     if $test "X$hostperl" = X; then
2981       echo "Building host miniperl and generate_uudmap binaries" >&4
2982       before_host=`pwd`
2983       cd ..
2984       cd $src
2985       src=`pwd`
2986       rm -rf $src/host
2987       mkdir $src/host
2988       cd $src/host
2989       $src/Configure -des -Dusedevel -Dmksymlinks
2990       $make miniperl
2991       case "$hostgenerate" in
2992       '') $make generate_uudmap
2993           hostgenerate=$src/host/generate_uudmap
2994           ;;
2995        "$undef") hostgenerate=''
2996           ;;
2997       esac
2998       hostperl=$src/host/miniperl
2999       cd $before_host
3000     fi
3001     hostosname=`$hostperl -le 'print $^O'`
3002     ;;
3003 *)
3004     usecrosscompile="$undef"
3005     ;;
3006 esac
3007
3008 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3009 case "$targethost" in
3010     '') echo "Checking for cross-compile" >&4
3011     case "$usecrosscompile$multiarch" in
3012        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3013          if [ -f Makefile ]; then
3014            echo " "
3015            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3016          else
3017            echo "Configure done."
3018          fi
3019        exit 0
3020        ;;
3021      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3022         run=''
3023         to=:
3024         from=:
3025         ;;
3026     esac
3027     ;;
3028     *) echo "Using targethost $targethost." >&4
3029         case "$src" in
3030         /*) run=$src/Cross/run
3031             targetmkdir=$src/Cross/mkdir
3032             to=$src/Cross/to
3033             from=$src/Cross/from
3034             ;;
3035         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3036             run=$pwd/Cross/run
3037             targetmkdir=$pwd/Cross/mkdir
3038             to=$pwd/Cross/to
3039             from=$pwd/Cross/from
3040             ;;
3041         esac
3042         case "$targetrun" in
3043         '') targetrun=ssh ;;
3044         esac
3045         case "$targetto" in
3046         '') targetto=scp ;;
3047         esac
3048         case "$targetfrom" in
3049         '') targetfrom=scp ;;
3050         esac
3051         run=$run-$targetrun
3052         to=$to-$targetto
3053         from=$from-$targetfrom
3054         case "$targetdir" in
3055         '')  targetdir=/tmp
3056              echo "Guessing targetdir $targetdir." >&4
3057              ;;
3058         esac
3059         case "$targetuser" in
3060         '')  targetuser=root
3061              echo "Guessing targetuser $targetuser." >&4
3062              ;;
3063         esac
3064         case "$targetport" in
3065         '')  targetport=22
3066              echo "Guessing targetport $targetport." >&4
3067              ;;
3068         esac
3069         case "$targetfrom" in
3070         scp)    q=-q ;;
3071         *)      q='' ;;
3072         esac
3073         case "$targetrun" in
3074         ssh|rsh)
3075             cat >$run <<EOF
3076 #!/bin/sh
3077 env=''
3078 case "\$1" in
3079 -cwd)
3080   shift
3081   cwd=\$1
3082   shift
3083   ;;
3084 esac
3085 case "\$1" in
3086 -env)
3087   shift
3088   env=\$1
3089   shift
3090   ;;
3091 esac
3092 case "\$cwd" in
3093 '') cwd=$targetdir ;;
3094 esac
3095 exe=\$1
3096 shift
3097 $to \$exe
3098 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3099 EOF
3100             ;;
3101         adb)
3102             $touch $run
3103             ;;
3104         *)  echo "Unknown targetrun '$targetrun'" >&4
3105             exit 1
3106             ;;
3107         esac
3108         case "$targetmkdir" in
3109         */Cross/mkdir)
3110             cat >$targetmkdir <<EOF
3111 #!/bin/sh
3112 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3113 EOF
3114             $chmod a+rx $targetmkdir
3115             ;;
3116         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3117             exit 1
3118             ;;
3119         esac
3120         case "$targetto" in
3121         scp|rcp)
3122             cat >$to <<EOF
3123 #!/bin/sh
3124 for f in \$@
3125 do
3126   case "\$f" in
3127   /*)
3128     $targetmkdir \`dirname \$f\`
3129     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3130     ;;
3131   *)
3132     $targetmkdir $targetdir/\`dirname \$f\`
3133     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3134     ;;
3135   esac
3136 done
3137 exit 0
3138 EOF
3139             ;;
3140         cp) cat >$to <<EOF
3141 #!/bin/sh
3142 for f in \$@
3143 do
3144   case "\$f" in
3145   /*)
3146     $mkdir -p $targetdir/\`dirname \$f\`
3147     $cp \$f $targetdir/\$f || exit 1
3148     ;;
3149   *)
3150     $targetmkdir $targetdir/\`dirname \$f\`
3151     $cp \$f $targetdir/\$f || exit 1
3152     ;;
3153   esac
3154 done
3155 exit 0
3156 EOF
3157             ;;
3158         *)  echo "Unknown targetto '$targetto'" >&4
3159             exit 1
3160             ;;
3161         esac
3162         case "$targetfrom" in
3163         scp|rcp)
3164           cat >$from <<EOF
3165 #!/bin/sh
3166 for f in \$@
3167 do
3168   $rm -f \$f
3169   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3170 done
3171 exit 0
3172 EOF
3173             ;;
3174         cp) cat >$from <<EOF
3175 #!/bin/sh
3176 for f in \$@
3177 do
3178   $rm -f \$f
3179   cp $targetdir/\$f . || exit 1
3180 done
3181 exit 0
3182 EOF
3183             ;;
3184         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3185             exit 1
3186             ;;
3187         esac
3188         if $test ! -f $run; then
3189             echo "Target 'run' script '$run' not found." >&4
3190         else
3191             $chmod a+rx $run
3192         fi
3193         if $test ! -f $to; then
3194             echo "Target 'to' script '$to' not found." >&4
3195         else
3196             $chmod a+rx $to
3197         fi
3198         if $test ! -f $from; then
3199             echo "Target 'from' script '$from' not found." >&4
3200         else
3201             $chmod a+rx $from
3202         fi
3203         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3204             exit 1
3205         fi
3206         cat >&4 <<EOF
3207 Using '$run' for remote execution,
3208 and '$from' and '$to'
3209 for remote file transfer.
3210 EOF
3211         ;;
3212 *)      run=''
3213         to=:
3214         from=:
3215         usecrosscompile="$undef"
3216         targetarch=''
3217         ;;
3218 esac
3219
3220 : see whether [:lower:] and [:upper:] are supported character classes
3221 echo " "
3222 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3223 ABYZ-abyz)
3224         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3225         up='[:upper:]'
3226         low='[:lower:]'
3227         ;;
3228 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3229         # (0xd9 and 0xe2), therefore that is a nice testing point.
3230         if test "X$up" = X -o "X$low" = X; then
3231             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3232             rs) up='[A-Z]'
3233                 low='[a-z]'
3234                 ;;
3235             esac
3236         fi
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 | od -x 2>/dev/null`" in
3246             *D9E2*|*d9e2*)
3247                 echo "Hey, this might be EBCDIC." >&4
3248                 if test "X$up" = X -o "X$low" = X; then
3249                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3250                     rs) up='[A-IJ-RS-Z]'
3251                         low='[a-ij-rs-z]'
3252                         ;;
3253                     esac
3254                 fi
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                 ;;
3263             esac
3264         fi
3265 esac
3266 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3267 rs)
3268     echo "Using $up and $low to convert case." >&4
3269     ;;
3270 *)
3271     echo "I don't know how to translate letters from upper to lower case." >&4
3272     echo "Your tr is not acting any way I know of." >&4
3273     exit 1
3274     ;;
3275 esac
3276 : set up the translation script tr, must be called with ./tr of course
3277 cat >tr <<EOSC
3278 $startsh
3279 case "\$1\$2" in
3280 '[A-Z][a-z]') exec $tr '$up' '$low';;
3281 '[a-z][A-Z]') exec $tr '$low' '$up';;
3282 esac
3283 exec $tr "\$@"
3284 EOSC
3285 chmod +x tr
3286 $eunicefix tr
3287
3288 : Try to determine whether config.sh was made on this system
3289 case "$config_sh" in
3290 '')
3291 myuname=`$uname -a 2>/dev/null`
3292 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3293 # Downcase everything to avoid ambiguity.
3294 # Remove slashes and single quotes so we can use parts of this in
3295 # directory and file names.
3296 # Remove newlines so myuname is sane to use elsewhere.
3297 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3298 # because the A-Z/a-z are not consecutive.
3299 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3300         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3301 newmyuname="$myuname"
3302 dflt=n
3303 case "$knowitall" in
3304 '')
3305         if test -f ../config.sh; then
3306                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3307                         eval "`grep myuname= ../config.sh`"
3308                 fi
3309                 if test "X$myuname" = "X$newmyuname"; then
3310                         dflt=y
3311                 fi
3312         fi
3313         ;;
3314 *) dflt=y;;
3315 esac
3316
3317 : Get old answers from old config file if Configure was run on the
3318 : same system, otherwise use the hints.
3319 hint=default
3320 cd ..
3321 if test -f config.sh; then
3322         echo " "
3323         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3324         . UU/myread
3325         case "$ans" in
3326         n*|N*) echo "OK, I'll ignore it."
3327                 mv config.sh config.sh.old
3328                 myuname="$newmyuname"
3329                 ;;
3330         *)  echo "Fetching default answers from your old config.sh file..." >&4
3331                 tmp_n="$n"
3332                 tmp_c="$c"
3333                 tmp_sh="$sh"
3334                 . ./config.sh
3335                 cp config.sh UU
3336                 n="$tmp_n"
3337                 c="$tmp_c"
3338                 : Older versions did not always set $sh.  Catch re-use of such
3339                 : an old config.sh.
3340                 case "$sh" in
3341                 '') sh="$tmp_sh" ;;
3342                 esac
3343                 hint=previous
3344                 ;;
3345         esac
3346 fi
3347 . ./UU/checkcc
3348 if test ! -f config.sh; then
3349         $cat <<EOM
3350
3351 First time through, eh?  I have some defaults handy for some systems
3352 that need some extra help getting the Configure answers right:
3353
3354 EOM
3355         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3356         dflt=''
3357         : Half the following guesses are probably wrong... If you have better
3358         : tests or hints, please send them to perlbug@perl.org
3359         : The metaconfig authors would also appreciate a copy...
3360         $test -f /irix && osname=irix
3361         $test -f /xenix && osname=sco_xenix
3362         $test -f /dynix && osname=dynix
3363         $test -f /dnix && osname=dnix
3364         $test -f /lynx.os && osname=lynxos
3365         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3366         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3367         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3368         $test -f /bin/mips && /bin/mips && osname=mips
3369         $test -d /usr/apollo/bin && osname=apollo
3370         $test -f /etc/saf/_sactab && osname=svr4
3371         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3372         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3373         $test -f /sys/utilities/MultiView && osname=amigaos
3374         if $test -d /MachTen -o -d /MachTen_Folder; then
3375                 osname=machten
3376                 if $test -x /sbin/version; then
3377                         osvers=`/sbin/version | $awk '{print $2}' |
3378                         $sed -e 's/[A-Za-z]$//'`
3379                 elif $test -x /usr/etc/version; then
3380                         osvers=`/usr/etc/version | $awk '{print $2}' |
3381                         $sed -e 's/[A-Za-z]$//'`
3382                 else
3383                         osvers="$2.$3"
3384                 fi
3385         fi
3386
3387         $test -f /sys/posix.dll &&
3388                 $test -f /usr/bin/what &&
3389                 set X `/usr/bin/what /sys/posix.dll` &&
3390                 $test "$3" = UWIN &&
3391                 osname=uwin &&
3392                 osvers="$5"
3393
3394         if $test -f $uname; then
3395                 set X $myuname
3396                 shift
3397
3398                 case "$5" in
3399                 fps*) osname=fps ;;
3400                 mips*)
3401                         case "$4" in
3402                         umips) osname=umips ;;
3403                         *) osname=mips ;;
3404                         esac;;
3405                 [23]100) osname=mips ;;
3406                 i386*)
3407                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3408                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3409                                 osname='sco'
3410                                 osvers=$tmp
3411                         elif $test -f /etc/kconfig; then
3412                                 osname=isc
3413                                 if test "$lns" = "$ln -s"; then
3414                                         osvers=4
3415                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3416                                         osvers=3
3417                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3418                                         osvers=2
3419                                 fi
3420                         fi
3421                         tmp=''
3422                         ;;
3423                 pc*)
3424                         if test -n "$DJGPP"; then
3425                                 osname=dos
3426                                 osvers=djgpp
3427                         fi
3428                         ;;
3429                 esac
3430
3431                 case "$1" in
3432                 aix) osname=aix
3433                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3434                         case "$tmp" in
3435                         # oslevel can fail with:
3436                         # oslevel: Unable to acquire lock.
3437                         *not\ found) osvers="$4"."$3" ;;
3438                         '<3240'|'<>3240') osvers=3.2.0 ;;
3439                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3440                         '=3250'|'>3250') osvers=3.2.5 ;;
3441                         *) osvers=$tmp;;
3442                         esac
3443                         ;;
3444                 bitrig) osname=bitrig
3445                         osvers="$3"
3446                         ;;
3447                 bsd386) osname=bsd386
3448                         osvers=`$uname -r`
3449                         ;;
3450                 cygwin*) osname=cygwin
3451                         osvers="$3"
3452                         ;;
3453                 *dc.osx) osname=dcosx
3454                         osvers="$3"
3455                         ;;
3456                 dnix) osname=dnix
3457                         osvers="$3"
3458                         ;;
3459                 domainos) osname=apollo
3460                         osvers="$3"
3461                         ;;
3462                 dgux)   osname=dgux
3463                         osvers="$3"
3464                         ;;
3465                 dragonfly) osname=dragonfly
3466                         osvers="$3"
3467                         ;;
3468                 dynixptx*) osname=dynixptx
3469                         osvers=`echo "$4"|sed 's/^v//'`
3470                         ;;
3471                 freebsd) osname=freebsd
3472                         osvers="$3" ;;
3473                 genix)  osname=genix ;;
3474                 gnu)    osname=gnu
3475                         osvers="$3" ;;
3476                 hp*)    osname=hpux
3477                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3478                         ;;
3479                 irix*)  osname=irix
3480                         case "$3" in
3481                         4*) osvers=4 ;;
3482                         5*) osvers=5 ;;
3483                         *)      osvers="$3" ;;
3484                         esac
3485                         ;;
3486                 linux)  osname=linux
3487                         case "$3" in
3488                         *)      osvers="$3" ;;
3489                         esac
3490                         $test -f /system/lib/libandroid.so && osname=linux-android
3491                         ;;
3492                 MiNT)   osname=mint
3493                         ;;
3494                 netbsd*) osname=netbsd
3495                         osvers="$3"
3496                         ;;
3497                 news-os) osvers="$3"
3498                         case "$3" in
3499                         4*) osname=newsos4 ;;
3500                         *) osname=newsos ;;
3501                         esac
3502                         ;;
3503                 nonstop-ux) osname=nonstopux ;;
3504                 openbsd) osname=openbsd
3505                         osvers="$3"
3506                         ;;
3507                 os2)    osname=os2
3508                         osvers="$4"
3509                         ;;
3510                 POSIX-BC | posix-bc ) osname=posix-bc
3511                         osvers="$3"
3512                         ;;
3513                 powerux | power_ux | powermax_os | powermaxos | \
3514                 powerunix | power_unix) osname=powerux
3515                         osvers="$3"
3516                         ;;
3517                 qnx) osname=qnx
3518                         osvers="$4"
3519                         ;;
3520                 solaris) osname=solaris
3521                         case "$3" in
3522                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3523                         *)      osvers="$3" ;;
3524                         esac
3525                         ;;
3526                 sunos) osname=sunos
3527                         case "$3" in
3528                         5*) osname=solaris
3529                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3530                         *)      osvers="$3" ;;
3531                         esac
3532                         ;;
3533                 titanos) osname=titanos
3534                         case "$3" in
3535                         1*) osvers=1 ;;
3536                         2*) osvers=2 ;;
3537                         3*) osvers=3 ;;
3538                         4*) osvers=4 ;;
3539                         *)      osvers="$3" ;;
3540                         esac
3541                         ;;
3542                 ultrix) osname=ultrix
3543                         osvers="$3"
3544                         ;;
3545                 osf1|mls+)      case "$5" in
3546                                 alpha)
3547                                         osname=dec_osf
3548                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3549                                         case "$osvers" in
3550                                         [1-9].[0-9]*) ;;
3551                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3552                                         esac
3553                                         ;;
3554                         hp*)    osname=hp_osf1  ;;
3555                         mips)   osname=mips_osf1 ;;
3556                         esac
3557                         ;;
3558                 # UnixWare 7.1.2 is known as Open UNIX 8
3559                 openunix|unixware) osname=svr5
3560                         osvers="$4"
3561                         ;;
3562                 uts)    osname=uts
3563                         osvers="$3"
3564                         ;;
3565                 vos) osvers="$3"
3566                         ;;
3567                 $2) case "$osname" in
3568                         *isc*) ;;
3569                         *freebsd*) ;;
3570                         svr*)
3571                                 : svr4.x or possibly later
3572                                 case "svr$3" in
3573                                 ${osname}*)
3574                                         osname=svr$3
3575                                         osvers=$4
3576                                         ;;
3577                                 esac
3578                                 case "$osname" in
3579                                 svr4.0)
3580                                         : Check for ESIX
3581                                         if test -f /stand/boot ; then
3582                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3583                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3584                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3585                                                         if test -n "$isesix"; then
3586                                                                 osname=esix4
3587                                                         fi
3588                                                 fi
3589                                         fi
3590                                         ;;
3591                                 esac
3592                                 ;;
3593                         *)      if test -f /etc/systemid; then
3594                                         osname=sco
3595                                         set `echo $3 | $sed 's/\./ /g'` $4
3596                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3597                                                 osvers=$1.$2.$3
3598                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3599                                                 osvers=$1.$2
3600                                         elif $test -f $src/hints/sco_$1.sh; then
3601                                                 osvers=$1
3602                                         fi
3603                                 else
3604                                         case "$osname" in
3605                                         '') : Still unknown.  Probably a generic Sys V.
3606                                                 osname="sysv"
3607                                                 osvers="$3"
3608                                                 ;;
3609                                         esac
3610                                 fi
3611                                 ;;
3612                         esac
3613                         ;;
3614                 *)      case "$osname" in
3615                         '') : Still unknown.  Probably a generic BSD.
3616                                 osname="$1"
3617                                 osvers="$3"
3618                                 ;;
3619                         esac
3620                         ;;
3621                 esac
3622         else
3623                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3624                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3625                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3626                                 osname=news_os
3627                         fi
3628                         $rm -f UU/kernel.what
3629                 elif test -d c:/. -o -n "$is_os2" ; then
3630                         set X $myuname
3631                         osname=os2
3632                         osvers="$5"
3633                 fi
3634         fi
3635
3636         case "$targetarch" in
3637         '') ;;
3638         *)  hostarch=$osname
3639             case "$targetarch" in
3640                 nto*|*-nto-*)
3641                     # Will load qnx.sh, which should change osname to nto
3642                     osname=qnx
3643                     osvers=''
3644                     ;;
3645                 *linux-android*)
3646                     # Catch arm-linux-androideabi, mipsel-linux-android,
3647                     # and i686-linux-android
3648                     osname=linux-android
3649                     osvers=''
3650                     ;;
3651                 *linux*)
3652                     # Something like arm-linux-gnueabihf is really just
3653                     # plain linux.
3654                     osname=linux
3655                     osvers=''
3656                     ;;
3657                 *solaris*|*sunos*)
3658                     osname=solaris
3659                     # XXX perhaps we should just assume
3660                     # osvers to be 2, or maybe take the value
3661                     # from targetarch. Using $run before the
3662                     # hints are run is somewhat icky.
3663                     set X `$run $uname -a 2>/dev/null`
3664                     shift
3665                     case "$3" in
3666                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3667                         *)  osvers="$3" ;;
3668                     esac
3669                     ;;
3670                 *)
3671                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3672                     osvers=''
3673                 ;;
3674             esac
3675             ;;
3676         esac
3677
3678         : Now look for a hint file osname_osvers, unless one has been
3679         : specified already.
3680         case "$hintfile" in
3681         ''|' ')
3682                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3683                 : Also try without trailing minor version numbers.
3684                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3685                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3686                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3687                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3688                 case "$file" in
3689                 '') dflt=none ;;
3690                 *)  case "$osvers" in
3691                         '') dflt=$file
3692                                 ;;
3693                         *)  if $test -f $src/hints/$file.sh ; then
3694                                         dflt=$file
3695                                 elif $test -f $src/hints/$xfile.sh ; then
3696                                         dflt=$xfile
3697                                 elif $test -f $src/hints/$xxfile.sh ; then
3698                                         dflt=$xxfile
3699                                 elif $test -f $src/hints/$xxxfile.sh ; then
3700                                         dflt=$xxxfile
3701                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3702                                         dflt=$xxxxfile
3703                                 elif $test -f "$src/hints/${osname}.sh" ; then
3704                                         dflt="${osname}"
3705                                 else
3706                                         dflt=none
3707                                 fi
3708                                 ;;
3709                         esac
3710                         ;;
3711                 esac
3712                 if $test -f Policy.sh ; then
3713                         case "$dflt" in
3714                         *Policy*) ;;
3715                         none) dflt="Policy" ;;
3716                         *) dflt="Policy $dflt" ;;
3717                         esac
3718                 fi
3719                 ;;
3720         *)
3721                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3722                 ;;
3723         esac
3724
3725         if $test -f Policy.sh ; then
3726                 $cat <<EOM
3727
3728 There's also a Policy hint file available, which should make the
3729 site-specific (policy) questions easier to answer.
3730 EOM
3731
3732         fi
3733
3734         $cat <<EOM
3735
3736 You may give one or more space-separated answers, or "none" if appropriate.
3737 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3738 previous run of Configure, you may specify it as well as or instead of
3739 OS-specific hints.  If hints are provided for your OS, you should use them:
3740 although Perl can probably be built without hints on many platforms, using
3741 hints often improve performance and may enable features that Configure can't
3742 set up on its own. If there are no hints that match your OS, specify "none";
3743 DO NOT give a wrong version or a wrong OS.
3744
3745 EOM
3746
3747         rp="Which of these apply, if any?"
3748         . UU/myread
3749         tans=$ans
3750         for file in $tans; do
3751                 if $test X$file = XPolicy -a -f Policy.sh; then
3752                         . Policy.sh
3753                         $cat Policy.sh >> UU/config.sh
3754                 elif $test -f $src/hints/$file.sh; then
3755                         . $src/hints/$file.sh
3756                         $cat $src/hints/$file.sh >> UU/config.sh
3757                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3758                         : nothing
3759                 else
3760                         : Give one chance to correct a possible typo.
3761                         echo "$file.sh does not exist"
3762                         dflt=$file
3763                         rp="hint to use instead?"
3764                         . UU/myread
3765                         for file in $ans; do
3766                                 if $test -f "$src/hints/$file.sh"; then
3767                                         . $src/hints/$file.sh
3768                                         $cat $src/hints/$file.sh >> UU/config.sh
3769                                 elif $test X$ans = X -o X$ans = Xnone ; then
3770                                         : nothing
3771                                 else
3772                                         echo "$file.sh does not exist -- ignored."
3773                                 fi
3774                         done
3775                 fi
3776         done
3777
3778         hint=recommended
3779         : Remember our hint file for later.
3780         if $test -f "$src/hints/$file.sh" ; then
3781                 hintfile="$file"
3782         else
3783                 hintfile=''
3784         fi
3785 fi
3786 cd UU
3787 ;;
3788 *)
3789         echo " "
3790         echo "Fetching default answers from $config_sh..." >&4
3791         tmp_n="$n"
3792         tmp_c="$c"
3793         cd ..
3794         cp $config_sh config.sh 2>/dev/null
3795         chmod +w config.sh
3796         . ./config.sh
3797         cd UU
3798         cp ../config.sh .
3799         n="$tmp_n"
3800         c="$tmp_c"
3801         hint=previous
3802         ;;
3803 esac
3804 . ./optdef.sh
3805
3806 : Restore computed paths
3807 for file in $loclist $trylist; do
3808         eval $file="\$_$file"
3809 done
3810
3811 cat << EOM
3812
3813 Configure uses the operating system name and version to set some defaults.
3814 The default value is probably right if the name rings a bell. Otherwise,
3815 since spelling matters for me, either accept the default or answer "none"
3816 to leave it blank.
3817
3818 EOM
3819 case "$osname" in
3820         ''|' ')
3821                 case "$hintfile" in
3822                 ''|' '|none) dflt=none ;;
3823                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3824                 esac
3825                 ;;
3826         *) dflt="$osname" ;;
3827 esac
3828 rp="Operating system name?"
3829 . ./myread
3830 case "$ans" in
3831 none)  osname='' ;;
3832 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3833 esac
3834 echo " "
3835 case "$osvers" in
3836         ''|' ')
3837                 case "$hintfile" in
3838                 ''|' '|none) dflt=none ;;
3839                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3840                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3841                         case "$dflt" in
3842                         ''|' ') dflt=none ;;
3843                         esac
3844                         ;;
3845                 esac
3846                 ;;
3847         *) dflt="$osvers" ;;
3848 esac
3849 rp="Operating system version?"
3850 . ./myread
3851 case "$ans" in
3852 none)  osvers='' ;;
3853 *) osvers="$ans" ;;
3854 esac
3855
3856
3857 . ./posthint.sh
3858
3859 : who configured the system
3860 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3861 case "$cf_by" in
3862 "")
3863         cf_by=`(logname) 2>/dev/null`
3864         case "$cf_by" in
3865         "")
3866                 cf_by=`(whoami) 2>/dev/null`
3867                 case "$cf_by" in
3868                 "") cf_by=unknown ;;
3869                 esac ;;
3870         esac ;;
3871 esac
3872
3873 : decide how portable to be.  Allow command line overrides.
3874 case "$d_portable" in
3875 "$undef") ;;
3876 *)      d_portable="$define" ;;
3877 esac
3878
3879 : set up shell script to do ~ expansion
3880 cat >filexp <<EOSS
3881 $startsh
3882 : expand filename
3883 case "\$1" in
3884  \~/*|\~)
3885         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3886         ;;
3887  \~*)
3888         if $test -f /bin/csh; then
3889                 /bin/csh -f -c "glob \$1"
3890                 failed=\$?
3891                 echo ""
3892                 exit \$failed
3893         else
3894                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3895                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3896                 if $test ! -d "\$dir"; then
3897                         me=\`basename \$0\`
3898                         echo "\$me: can't locate home directory for: \$name" >&2
3899                         exit 1
3900                 fi
3901                 case "\$1" in
3902                 */*)
3903                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3904                         ;;
3905                 *)
3906                         echo \$dir
3907                         ;;
3908                 esac
3909         fi
3910         ;;
3911 *)
3912         echo \$1
3913         ;;
3914 esac
3915 EOSS
3916 chmod +x filexp
3917 $eunicefix filexp
3918
3919 : now set up to get a file name
3920 cat <<EOS >getfile
3921 $startsh
3922 EOS
3923 cat <<'EOSC' >>getfile
3924 tilde=''
3925 fullpath=''
3926 already=''
3927 skip=''
3928 none_ok=''
3929 exp_file=''
3930 nopath_ok=''
3931 orig_rp="$rp"
3932 orig_dflt="$dflt"
3933 case "$gfpth" in
3934 '') gfpth='.' ;;
3935 esac
3936
3937 case "$fn" in
3938 *\(*)
3939         : getfile will accept an answer from the comma-separated list
3940         : enclosed in parentheses even if it does not meet other criteria.
3941         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3942         fn=`echo $fn | sed 's/(.*)//'`
3943         ;;
3944 esac
3945
3946 case "$fn" in
3947 *:*)
3948         loc_file=`expr $fn : '.*:\(.*\)'`
3949         fn=`expr $fn : '\(.*\):.*'`
3950         ;;
3951 esac
3952
3953 case "$fn" in
3954 *~*) tilde=true;;
3955 esac
3956 case "$fn" in
3957 */*) fullpath=true;;
3958 esac
3959 case "$fn" in
3960 *+*) skip=true;;
3961 esac
3962 case "$fn" in
3963 *n*) none_ok=true;;
3964 esac
3965 case "$fn" in
3966 *e*) exp_file=true;;
3967 esac
3968 case "$fn" in
3969 *p*) nopath_ok=true;;
3970 esac
3971
3972 case "$fn" in
3973 *f*) type='File';;
3974 *d*) type='Directory';;
3975 *l*) type='Locate';;
3976 esac
3977
3978 what="$type"
3979 case "$what" in
3980 Locate) what='File';;
3981 esac
3982
3983 case "$exp_file" in
3984 '')
3985         case "$d_portable" in
3986         "$define") ;;
3987         *) exp_file=true;;
3988         esac
3989         ;;
3990 esac
3991
3992 cd ..
3993 while test "$type"; do
3994         redo=''
3995         rp="$orig_rp"
3996         dflt="$orig_dflt"
3997         case "$tilde" in
3998         true) rp="$rp (~name ok)";;
3999         esac
4000         . UU/myread
4001         if test -f UU/getfile.ok && \
4002                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4003         then
4004                 value="$ans"
4005                 ansexp="$ans"
4006                 break
4007         fi
4008         case "$ans" in
4009         none)
4010                 value=''
4011                 ansexp=''
4012                 case "$none_ok" in
4013                 true) type='';;
4014                 esac
4015                 ;;
4016         *)
4017                 case "$tilde" in
4018                 '') value="$ans"
4019                         ansexp="$ans";;
4020                 *)
4021                         value=`UU/filexp $ans`
4022                         case $? in
4023                         0)
4024                                 if test "$ans" != "$value"; then
4025                                         echo "(That expands to $value on this system.)"
4026                                 fi
4027                                 ;;
4028                         *) value="$ans";;
4029                         esac
4030                         ansexp="$value"
4031                         case "$exp_file" in
4032                         '') value="$ans";;
4033                         esac
4034                         ;;
4035                 esac
4036                 case "$fullpath" in
4037                 true)
4038                         case "$ansexp" in
4039                         /*) value="$ansexp" ;;
4040                         [a-zA-Z]:/*) value="$ansexp" ;;
4041                         *)
4042                                 redo=true
4043                                 case "$already" in
4044                                 true)
4045                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4046                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4047                                         ;;
4048                                 *)
4049                                 echo "Please give a full path name, starting with slash." >&4
4050                                         case "$tilde" in
4051                                         true)
4052                                 echo "Note that using ~name is ok provided it expands well." >&4
4053                                                 already=true
4054                                                 ;;
4055                                         esac
4056                                 esac
4057                                 ;;
4058                         esac
4059                         ;;
4060                 esac
4061                 case "$redo" in
4062                 '')
4063                         case "$type" in
4064                         File)
4065                                 for fp in $gfpth; do
4066                                         if test "X$fp" = X.; then
4067                                             pf="$ansexp"
4068                                         else    
4069                                             pf="$fp/$ansexp"
4070                                         fi
4071                                         if test -f "$pf"; then
4072                                                 type=''
4073                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4074                                         then
4075                                                 echo "($value is not a plain file, but that's ok.)"
4076                                                 type=''
4077                                         fi
4078                                         if test X"$type" = X; then
4079                                             value="$pf"
4080                                             break
4081                                         fi
4082                                 done
4083                                 ;;
4084                         Directory)
4085                                 for fp in $gfpth; do
4086                                         if test "X$fp" = X.; then
4087                                             dir="$ans"
4088                                             direxp="$ansexp"
4089                                         else    
4090                                             dir="$fp/$ansexp"
4091                                             direxp="$fp/$ansexp"
4092                                         fi
4093                                         if test -d "$direxp"; then
4094                                                 type=''
4095                                                 value="$dir"
4096                                                 break
4097                                         fi
4098                                 done
4099                                 ;;
4100                         Locate)
4101                                 if test -d "$ansexp"; then
4102                                         echo "(Looking for $loc_file in directory $value.)"
4103                                         value="$value/$loc_file"
4104                                         ansexp="$ansexp/$loc_file"
4105                                 fi
4106                                 if test -f "$ansexp"; then
4107                                         type=''
4108                                 fi
4109                                 case "$nopath_ok" in
4110                                 true)   case "$value" in
4111                                         */*) ;;
4112                                         *)      echo "Assuming $value will be in people's path."
4113                                                 type=''
4114                                                 ;;
4115                                         esac
4116                                         ;;
4117                                 esac
4118                                 ;;
4119                         esac
4120
4121                         case "$skip" in
4122                         true) type='';
4123                         esac
4124
4125                         case "$type" in
4126                         '') ;;
4127                         *)
4128                                 if test "$fastread" = yes; then
4129                                         dflt=y
4130                                 else
4131                                         dflt=n
4132                                 fi
4133                                 rp="$what $value doesn't exist.  Use that name anyway?"
4134                                 . UU/myread
4135                                 dflt=''
4136                                 case "$ans" in
4137                                 y*) type='';;
4138                                 *) echo " ";;
4139                                 esac
4140                                 ;;
4141                         esac
4142                         ;;
4143                 esac
4144                 ;;
4145         esac
4146 done
4147 cd UU
4148 ans="$value"
4149 rp="$orig_rp"
4150 dflt="$orig_dflt"
4151 rm -f getfile.ok
4152 test "X$gfpthkeep" != Xy && gfpth=""
4153 EOSC
4154
4155 : determine root of directory hierarchy where package will be installed.
4156 case "$prefix" in
4157 '')
4158         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4159         ;;
4160 *?/)
4161         dflt=`echo "$prefix" | sed 's/.$//'`
4162         ;;
4163 *)
4164         dflt="$prefix"
4165         ;;
4166 esac
4167 $cat <<EOM
4168
4169 By default, $package will be installed in $dflt/bin, manual pages
4170 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4171 installation directories. Typically this is something like /usr/local.
4172 If you wish to have binaries under /usr/bin but other parts of the
4173 installation under /usr/local, that's ok: you will be prompted
4174 separately for each of the installation directories, the prefix being
4175 only used to set the defaults.
4176
4177 EOM
4178 fn=d~
4179 rp='Installation prefix to use?'
4180 . ./getfile
4181 oldprefix=''
4182 case "$prefix" in
4183 '') ;;
4184 *)
4185         case "$ans" in
4186         "$prefix") ;;
4187         *) oldprefix="$prefix";;
4188         esac
4189         ;;
4190 esac
4191 prefix="$ans"
4192 prefixexp="$ansexp"
4193
4194 : allow them to override the AFS root
4195 case "$afsroot" in
4196 '')     afsroot=/afs ;;
4197 *)      afsroot=$afsroot ;;
4198 esac
4199
4200 : is AFS running?
4201 echo " "
4202 case "$afs" in
4203 $define|true)   afs=true ;;
4204 $undef|false)   afs=false ;;
4205 *)      if $test -d $afsroot; then
4206                 afs=true
4207         else
4208                 afs=false
4209         fi
4210         ;;
4211 esac
4212 if $afs; then
4213         echo "AFS may be running... I'll be extra cautious then..." >&4
4214 else
4215         echo "AFS does not seem to be running..." >&4
4216 fi
4217
4218 : determine installation prefix for where package is to be installed.
4219 if $afs; then
4220 $cat <<EOM
4221
4222 Since you are running AFS, I need to distinguish the directory in which
4223 files will reside from the directory in which they are installed (and from
4224 which they are presumably copied to the former directory by occult means).
4225
4226 EOM
4227         case "$installprefix" in
4228         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4229         *) dflt="$installprefix";;
4230         esac
4231 else
4232 $cat <<EOM
4233
4234 In some special cases, particularly when building $package for distribution,
4235 it is convenient to distinguish the directory in which files should be
4236 installed from the directory ($prefix) in which they will
4237 eventually reside.  For most users, these two directories are the same.
4238
4239 EOM
4240         case "$installprefix" in
4241         '') dflt=$prefix ;;
4242         *) dflt=$installprefix;;
4243         esac
4244 fi
4245 fn=d~
4246 rp='What installation prefix should I use for installing files?'
4247 . ./getfile
4248 installprefix="$ans"
4249 installprefixexp="$ansexp"
4250
4251 : Perform the prefixexp/installprefixexp correction if necessary
4252 cat <<EOS >installprefix
4253 $startsh
4254 EOS
4255 cat <<'EOSC' >>installprefix
4256 : Change installation prefix, if necessary.
4257 if $test X"$prefix" != X"$installprefix"; then
4258     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4259 else
4260     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4261 fi
4262 EOSC
4263 chmod +x installprefix
4264 $eunicefix installprefix
4265
4266 : Set variables such as privlib and privlibexp from the output of ./getfile
4267 : performing the prefixexp/installprefixexp correction if necessary.
4268 cat <<EOS >setprefixvar
4269 $startsh
4270 EOS
4271 cat <<'EOSC' >>setprefixvar
4272 eval "${prefixvar}=\"\$ans\""
4273 eval "${prefixvar}exp=\"\$ansexp\""
4274 . ./installprefix
4275 EOSC
4276 chmod +x setprefixvar
4277 $eunicefix setprefixvar
4278
4279 : set up the script used to warn in case of inconsistency
4280 cat <<EOS >whoa
4281 $startsh
4282 EOS
4283 cat <<'EOSC' >>whoa
4284 dflt=y
4285 case "$hint" in
4286     recommended)
4287         case "$hintfile" in
4288         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4289                 ;;
4290         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4291                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4292                 ;;
4293         esac
4294         ;;
4295     *)  echo " "
4296         echo "*** WHOA THERE!!! ***" >&4
4297         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4298         ;;
4299 esac
4300 rp="    Keep the $hint value?"
4301 . ./myread
4302 case "$ans" in
4303 y) td=$was; tu=$was;;
4304 esac
4305 EOSC
4306
4307 : function used to set '$1' to '$val'
4308 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4309 case "$val$was" in
4310 $define$undef) . ./whoa; eval "$var=\$td";;
4311 $undef$define) . ./whoa; eval "$var=\$tu";;
4312 *) eval "$var=$val";;
4313 esac'
4314
4315 : get the patchlevel
4316 echo " "
4317 echo "Getting the current patchlevel..." >&4
4318 if $test -r $rsrc/patchlevel.h;then
4319         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4320         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4321         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4322         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4323         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4324         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4325         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4326 else
4327         revision=0
4328         patchlevel=0
4329         subversion=0
4330         api_revision=0
4331         api_version=0
4332         api_subversion=0
4333         perl_patchlevel=0
4334         $echo "(You do not have patchlevel.h.  Eek.)"
4335 fi
4336 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4337 version_patchlevel_string="version $patchlevel subversion $subversion"
4338 case "$perl_patchlevel" in
4339 0|'') ;;
4340 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4341     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4342     ;;
4343 esac
4344
4345 $echo "(You have $package $version_patchlevel_string.)"
4346
4347 case "$osname" in
4348 dos|vms)
4349         : XXX Should be a Configure test for double-dots in filenames.
4350         version=`echo $revision $patchlevel $subversion | \
4351                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4352         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4353                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4354         ;;
4355 *)
4356         version=`echo $revision $patchlevel $subversion | \
4357                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4358         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4359                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4360         ;;
4361 esac
4362 : Special case the 5.005_xx maintenance series, which used 5.005
4363 : without any subversion label as a subdirectory in $sitelib
4364 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4365         api_versionstring='5.005'
4366 fi
4367
4368 : Do we want threads support and if so, what type
4369 case "$usethreads" in
4370 $define|true|[yY]*)     dflt='y';;
4371 *)     # Catch case where user specified ithreads or 5005threads but
4372        # forgot -Dusethreads (A.D. 4/2002)
4373        case "$useithreads$use5005threads" in
4374        *$define*)       dflt='y';;
4375        *)               dflt='n';;
4376        esac
4377        ;;
4378 esac
4379 cat <<EOM
4380
4381 Perl can be built to offer a form of threading support on some systems
4382 To do so, Configure can be run with -Dusethreads.
4383
4384 Note that Perl built with threading support runs slightly slower
4385 and uses slightly more memory than plain Perl.
4386
4387 If this doesn't make any sense to you, just accept the default '$dflt'.
4388 EOM
4389 rp='Build a threading Perl?'
4390 . ./myread
4391 case "$ans" in
4392 y|Y)    val="$define" ;;
4393 *)      val="$undef" ;;
4394 esac
4395 set usethreads
4396 eval $setvar
4397
4398 if $test $patchlevel -lt 9; then
4399     case "$usethreads" in
4400     $define)
4401         : Default to ithreads unless overridden on command line or with
4402         : old config.sh
4403         dflt='y'
4404         case "$use5005threads" in
4405                 $define|true|[yY]*)
4406                         echo "5.005 threads are no longer supported"
4407                         exit 1
4408                 ;;
4409         esac
4410         case "$useithreads" in
4411                 $undef|false|[nN]*) dflt='n';;
4412         esac
4413         rp='Use the newer interpreter-based ithreads?'
4414         . ./myread
4415         case "$ans" in
4416         y|Y)    val="$define" ;;
4417         *)      val="$undef" ;;
4418         esac
4419         set useithreads
4420         eval $setvar
4421         : Now set use5005threads to the opposite value.
4422         case "$useithreads" in
4423         $define) val="$undef" ;;
4424         *) val="$define" ;;
4425         esac
4426         set use5005threads
4427         eval $setvar
4428         ;;
4429     *)
4430         useithreads="$undef"
4431         use5005threads="$undef"
4432         ;;
4433     esac
4434
4435     case "$useithreads$use5005threads" in
4436     "$define$define")
4437         $cat >&4 <<EOM
4438
4439 You cannot have both the ithreads and the 5.005 threads enabled
4440 at the same time.  Disabling the 5.005 threads since they are
4441 much less stable than the ithreads.
4442
4443 EOM
4444         use5005threads="$undef"
4445         ;;
4446     esac
4447
4448 else
4449 : perl-5.9.x and later
4450
4451     if test X"$usethreads" = "X$define"; then
4452         case "$use5005threads" in
4453             $define|true|[yY]*)
4454                 $cat >&4 <<EOM
4455
4456 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4457
4458 EOM
4459             ;;
4460         esac
4461     fi
4462
4463     use5005threads="$undef"
4464     useithreads="$usethreads"
4465 fi
4466
4467 case "$d_oldpthreads" in
4468 '')     : Configure tests would be welcome here.  For now, assume undef.
4469         val="$undef" ;;
4470 *)      val="$d_oldpthreads" ;;
4471 esac
4472 set d_oldpthreads
4473 eval $setvar
4474
4475
4476 : Look for a hint-file generated 'call-back-unit'.  If the
4477 : user has specified that a threading perl is to be built,
4478 : we may need to set or change some other defaults.
4479 if $test -f usethreads.cbu; then
4480     echo "Your platform has some specific hints regarding threaded builds, using them..."
4481     . ./usethreads.cbu
4482 else
4483     case "$usethreads" in
4484         "$define"|true|[yY]*)
4485                 $cat <<EOM
4486 (Your platform does not have any specific hints for threaded builds.
4487  Assuming POSIX threads, then.)
4488 EOM
4489         ;;
4490     esac
4491 fi
4492
4493 : Check if multiplicity is required
4494 cat <<EOM
4495
4496 Perl can be built so that multiple Perl interpreters can coexist
4497 within the same Perl executable.
4498 EOM
4499
4500 case "$useithreads" in
4501 $define)
4502         cat <<EOM
4503 This multiple interpreter support is required for interpreter-based threads.
4504 EOM
4505         val="$define"
4506         ;;
4507 *)      case "$usemultiplicity" in
4508         $define|true|[yY]*)     dflt='y';;
4509         *) dflt='n';;
4510         esac
4511         echo " "
4512         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4513         rp='Build Perl for multiplicity?'
4514         . ./myread
4515         case "$ans" in
4516         y|Y)    val="$define" ;;
4517         *)      val="$undef" ;;
4518         esac
4519         ;;
4520 esac
4521 set usemultiplicity
4522 eval $setvar
4523
4524 : Check if morebits is requested
4525 case "$usemorebits" in
4526 "$define"|true|[yY]*)
4527         use64bitint="$define"
4528         uselongdouble="$define"
4529         usemorebits="$define"
4530         ;;
4531 *)      usemorebits="$undef"
4532         ;;
4533 esac
4534
4535 : Determine the C compiler to be used
4536 echo " "
4537 case "$cc" in
4538 '') dflt=cc;;
4539 *) dflt="$cc";;
4540 esac
4541 rp="Use which C compiler?"
4542 . ./myread
4543 cc="$ans"
4544
4545 : See whether they have no cc but they do have gcc
4546 . ./trygcc
4547 if $test -f cc.cbu; then
4548     . ./cc.cbu
4549 fi
4550 . ./checkcc
4551
4552 : make some quick guesses about what we are up against
4553 echo " "
4554 $echo $n "Hmm...  $c"
4555 echo exit 1 >bsd
4556 echo exit 1 >usg
4557 echo exit 1 >v7
4558 echo exit 1 >osf1
4559 echo exit 1 >eunice
4560 echo exit 1 >xenix
4561 echo exit 1 >venix
4562 echo exit 1 >os2
4563 d_bsd="$undef"
4564 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4565 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4566 then
4567         echo "Looks kind of like an OSF/1 system, but we'll see..."
4568         echo exit 0 >osf1
4569 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4570         xxx=`./loc addbib blurfl $pth`
4571         if $test -f $xxx; then
4572         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4573                 echo exit 0 >bsd
4574                 echo exit 0 >usg
4575         else
4576                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4577                         echo "Looks kind of like an extended USG system, but we'll see..."
4578                 else
4579                         echo "Looks kind of like a USG system, but we'll see..."
4580                 fi
4581                 echo exit 0 >usg
4582         fi
4583 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4584         echo "Looks kind of like a BSD system, but we'll see..."
4585         d_bsd="$define"
4586         echo exit 0 >bsd
4587 else
4588         echo "Looks kind of like a Version 7 system, but we'll see..."
4589         echo exit 0 >v7
4590 fi
4591 case "$eunicefix" in
4592 *unixtovms*)
4593         $cat <<'EOI'
4594 There is, however, a strange, musty smell in the air that reminds me of
4595 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4596 EOI
4597         echo exit 0 >eunice
4598         d_eunice="$define"
4599 : it so happens the Eunice I know will not run shell scripts in Unix format
4600         ;;
4601 *)
4602         echo " "
4603         echo "Congratulations.  You aren't running Eunice."
4604         d_eunice="$undef"
4605         ;;
4606 esac
4607 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4608 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4609 : semicolon as a patch separator
4610 case "$p_" in
4611 :) ;;
4612 *)
4613         $cat <<'EOI'
4614 I have the feeling something is not exactly right, however...don't tell me...
4615 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4616 (Or you may be running DOS with DJGPP.)
4617 EOI
4618         echo exit 0 >os2
4619         ;;
4620 esac
4621 if test -f /xenix; then
4622         echo "Actually, this looks more like a XENIX system..."
4623         echo exit 0 >xenix
4624         d_xenix="$define"
4625 else
4626         echo " "
4627         echo "It's not Xenix..."
4628         d_xenix="$undef"
4629 fi
4630 chmod +x xenix
4631 $eunicefix xenix
4632 if test -f /venix; then
4633         echo "Actually, this looks more like a VENIX system..."
4634         echo exit 0 >venix
4635 else
4636         echo " "
4637         if ./xenix; then
4638                 : null
4639         else
4640                 echo "Nor is it Venix..."
4641         fi
4642 fi
4643 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4644 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4645 $rm -f foo
4646
4647 : Check if we are using GNU gcc and what its version is
4648 echo " "
4649 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4650 $cat >try.c <<EOM
4651 #include <stdio.h>
4652 int main() {
4653 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4654 #ifdef __VERSION__
4655         printf("%s\n", __VERSION__);
4656 #else
4657         printf("%s\n", "1");
4658 #endif
4659 #endif
4660         return(0);
4661 }
4662 EOM
4663 if $cc -o try $ccflags $ldflags try.c; then
4664         gccversion=`$run ./try`
4665         case "$gccversion" in
4666         '') echo "You are not using GNU cc." ;;
4667         *)  echo "You are using GNU cc $gccversion."
4668             ccname=gcc
4669             ;;
4670         esac
4671 else
4672         echo " "
4673         echo "*** WHOA THERE!!! ***" >&4
4674         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4675         case "$knowitall" in
4676         '')
4677         echo "    You'd better start hunting for one and let me know about it." >&4
4678                 exit 1
4679                 ;;
4680         esac
4681 fi
4682 $rm -f try try.*
4683 case "$gccversion" in
4684 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4685 esac
4686 case "$gccversion" in
4687 '') gccosandvers='' ;;
4688 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4689    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4690    gccshortvers=''
4691    case "$gccosandvers" in
4692    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4693    $osname$osvers) ;; # looking good
4694    $osname*) cat <<EOM >&4
4695
4696 *** WHOA THERE!!! ***
4697
4698     Your gcc has not been compiled for the exact release of
4699     your operating system ($gccosandvers versus $osname$osvers).
4700
4701     In general it is a good idea to keep gcc synchronized with
4702     the operating system because otherwise serious problems
4703     may ensue when trying to compile software, like Perl.
4704
4705     I'm trying to be optimistic here, though, and will continue.
4706     If later during the configuration and build icky compilation
4707     problems appear (headerfile conflicts being the most common
4708     manifestation), I suggest reinstalling the gcc to match
4709     your operating system release.
4710
4711 EOM
4712       ;;
4713    *) gccosandvers='' ;; # failed to parse, better be silent
4714    esac
4715    ;;
4716 esac
4717 case "$ccname" in
4718 '') ccname="$cc" ;;
4719 esac
4720
4721 # gcc 3.* complain about adding -Idirectories that they already know about,
4722 # so we will take those off from locincpth.
4723 case "$gccversion" in
4724 3*)
4725     echo "main(){}">try.c
4726     for incdir in $locincpth; do
4727        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4728              grep '^c[cp]p*[01]: warning: changing search order '`
4729        if test "X$warn" != X; then
4730            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4731        fi
4732     done
4733     $rm -f try try.*
4734 esac
4735
4736 # gcc 4.9 by default does some optimizations that break perl.
4737 # see ticket 121505.
4738 #
4739 # The -fwrapv disables those optimizations (and probably others,) so
4740 # for gcc 4.9 (and later, since the optimizations probably won't go
4741 # away), add -fwrapv unless the user requests -fno-wrapv, which
4742 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4743 # which turns the overflows -fwrapv ignores into runtime errors.
4744 case "$gccversion" in
4745 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4746     case "$ccflags" in
4747     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4748     *) ccflags="$ccflags -fwrapv" ;;
4749     esac
4750 esac
4751
4752 : What should the include directory be ?
4753 : Use sysroot if set, so findhdr looks in the right place.
4754 echo " "
4755 $echo $n "Hmm...  $c"
4756 dflt="$sysroot/usr/include"
4757 incpath=''
4758 mips_type=''
4759 if $test -f /bin/mips && /bin/mips; then
4760         echo "Looks like a MIPS system..."
4761         $cat >usr.c <<'EOCP'
4762 #ifdef SYSTYPE_BSD43
4763 /bsd43
4764 #endif
4765 EOCP
4766         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4767                 dflt='/bsd43/usr/include'
4768                 incpath='/bsd43'
4769                 mips_type='BSD 4.3'
4770         else
4771                 mips_type='System V'
4772         fi
4773         $rm -f usr.c usr.out
4774         echo "and you're compiling with the $mips_type compiler and libraries."
4775         xxx_prompt=y
4776         echo "exit 0" >mips
4777 else
4778         echo "Doesn't look like a MIPS system."
4779         xxx_prompt=n
4780         echo "exit 1" >mips
4781 fi
4782 chmod +x mips
4783 $eunicefix mips
4784 case "$usrinc" in
4785 '') ;;
4786 *) dflt="$usrinc";;
4787 esac
4788 case "$xxx_prompt" in
4789 y)      fn=d/
4790         echo " "
4791         rp='Where are the include files you want to use?'
4792         . ./getfile
4793         usrinc="$ans"
4794         ;;
4795 *)      usrinc="$dflt"
4796         ;;
4797 esac
4798
4799 : see how we invoke the C preprocessor
4800 echo " "
4801 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4802 cat <<'EOT' >testcpp.c
4803 #define ABC abc
4804 #define XYZ xyz
4805 ABC.XYZ
4806 EOT
4807 cd ..
4808 if test ! -f cppstdin; then
4809         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4810                 # AIX cc -E doesn't show the absolute headerfile
4811                 # locations but we'll cheat by using the -M flag.
4812                 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
4813         else
4814                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4815         fi
4816 else
4817         echo "Keeping your $hint cppstdin wrapper."
4818 fi
4819 chmod 755 cppstdin
4820 wrapper=`pwd`/cppstdin
4821 ok='false'
4822 cd UU
4823
4824 if $test "X$cppstdin" != "X" && \
4825         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4826         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4827 then
4828         echo "You used to use $cppstdin $cppminus so we'll use that again."
4829         case "$cpprun" in
4830         '') echo "But let's see if we can live without a wrapper..." ;;
4831         *)
4832                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4833                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4834                 then
4835                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4836                         ok='true'
4837                 else
4838                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4839                 fi
4840                 ;;
4841         esac
4842 else
4843         case "$cppstdin" in
4844         '') ;;
4845         *)
4846                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4847                 ;;
4848         esac
4849 fi
4850
4851 if $ok; then
4852         : nothing
4853 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4854         $cc -E <testcpp.c >testcpp.out 2>&1; \
4855         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4856         echo "Yup, it does."
4857         x_cpp="$cc $cppflags -E"
4858         x_minus='';
4859 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4860         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4861         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4862         echo "Yup, it does."
4863         x_cpp="$cc $cppflags -E"
4864         x_minus='-';
4865 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4866         $cc -P <testcpp.c >testcpp.out 2>&1; \
4867         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4868         echo "Yipee, that works!"
4869         x_cpp="$cc $cppflags -P"
4870         x_minus='';
4871 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4872         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4873         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4874         echo "At long last!"
4875         x_cpp="$cc $cppflags -P"
4876         x_minus='-';
4877 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4878         $cpp <testcpp.c >testcpp.out 2>&1; \
4879         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4880         echo "It works!"
4881         x_cpp="$cpp $cppflags"
4882         x_minus='';
4883 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4884         $cpp - <testcpp.c >testcpp.out 2>&1; \
4885         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4886         echo "Hooray, it works!  I was beginning to wonder."
4887         x_cpp="$cpp $cppflags"
4888         x_minus='-';
4889 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4890         $wrapper <testcpp.c >testcpp.out 2>&1; \
4891         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4892         x_cpp="$wrapper"
4893         x_minus=''
4894         echo "Eureka!"
4895 else
4896         dflt=''
4897         rp="No dice.  I can't find a C preprocessor.  Name one:"
4898         . ./myread
4899         x_cpp="$ans"
4900         x_minus=''
4901         $x_cpp <testcpp.c >testcpp.out 2>&1
4902         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4903                 echo "OK, that will do." >&4
4904         else
4905 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4906                 exit 1
4907         fi
4908 fi
4909
4910 case "$ok" in
4911 false)
4912         cppstdin="$x_cpp"
4913         cppminus="$x_minus"
4914         cpprun="$x_cpp"
4915         cpplast="$x_minus"
4916         set X $x_cpp
4917         shift
4918         case "$1" in
4919         "$cpp")
4920                 echo "Perhaps can we force $cc -E using a wrapper..."
4921                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4922                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4923                 then
4924                         echo "Yup, we can."
4925                         cppstdin="$wrapper"
4926                         cppminus='';
4927                 else
4928                         echo "Nope, we'll have to live without it..."
4929                 fi
4930                 ;;
4931         esac
4932         case "$cpprun" in
4933         "$wrapper")
4934                 cpprun=''
4935                 cpplast=''
4936                 ;;
4937         esac
4938         ;;
4939 esac
4940
4941 case "$cppstdin" in
4942 "$wrapper"|'cppstdin') ;;
4943 *) $rm -f $wrapper;;
4944 esac
4945 $rm -f testcpp.c testcpp.out
4946
4947 : Adjust cppfilter for path component separator
4948 case "$osname" in
4949 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4950 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4951 *)   cppfilter='' ;;
4952 esac
4953
4954 : Use gcc to determine libpth and incpth
4955 # If using gcc or clang, we can get better values for libpth, incpth
4956 # and usrinc directly from the compiler.
4957 # Note that ccname for clang is also gcc.
4958 case "$ccname" in
4959     gcc)
4960         $echo 'extern int foo;' > try.c
4961         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4962         shift
4963         if $test $# -gt 0; then
4964             incpth="$incpth $*"
4965             incpth="`$echo $incpth|$sed 's/^ //'`"
4966             for i in $*; do
4967                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4968                 if $test -d $j; then
4969                     libpth="$libpth $j"
4970                 fi
4971             done
4972             libpth="`$echo $libpth|$sed 's/^ //'`"
4973             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4974                 if $test -d $xxx; then
4975                     case " $libpth " in
4976                     *" $xxx "*) ;;
4977                     *) libpth="$libpth $xxx";;
4978                     esac
4979                 fi
4980             done
4981         fi
4982         $rm -f try.c
4983         case "$usrinc" in
4984         '') for i in $incpth; do
4985                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4986                     usrinc="$i"
4987                     break
4988                 fi
4989             done
4990             ;;
4991         esac
4992
4993         case "$usecrosscompile" in
4994         $define|true|[yY]*)
4995             case "$incpth" in
4996                 '') echo "Incpth not defined." >&4; croak=y ;;
4997                 *)  echo "Using incpth '$incpth'." >&4 ;;
4998             esac
4999             case "$libpth" in
5000                 '') echo "Libpth not defined." >&4; croak=y ;;
5001                 *)  echo "Using libpth '$libpth'." >&4 ;;
5002             esac
5003             case "$usrinc" in
5004                 '') echo "Usrinc not defined." >&4; croak=y ;;
5005                 *)  echo "Using usrinc $usrinc." >&4 ;;
5006             esac
5007             case "$croak" in
5008                 y)
5009                 if test "X$sysroot" = X; then
5010                     echo "Cannot continue, aborting." >&4; exit 1
5011                 else
5012                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5013                 fi
5014                 ;;
5015             esac
5016             ;;
5017         esac
5018     ;;
5019 esac
5020
5021 : Default value for incpth is just usrinc
5022 case "$incpth" in
5023 '') incpth="$usrinc";;
5024 esac
5025
5026 : Set private lib path
5027 case "$plibpth" in
5028 '') if ./mips; then
5029         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5030     fi;;
5031 esac
5032 case "$libpth" in
5033 ' ') dlist='';;
5034 '') dlist="$loclibpth $plibpth $glibpth";;
5035 *) dlist="$libpth";;
5036 esac
5037
5038 : Now check and see which directories actually exist, avoiding duplicates
5039 for xxx in $dlist
5040 do
5041     if $test -d $xxx; then
5042                 case " $libpth " in
5043                 *" $xxx "*) ;;
5044                 *) libpth="$libpth $xxx";;
5045                 esac
5046     fi
5047 done
5048 $cat <<'EOM'
5049
5050 Some systems have incompatible or broken versions of libraries.  Among
5051 the directories listed in the question below, please remove any you
5052 know not to be holding relevant libraries, and add any that are needed.
5053 Say "none" for none.
5054
5055 EOM
5056
5057 if test "X$sysroot" != X; then
5058     $cat <<EOM
5059 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5060
5061 EOM
5062 fi
5063
5064 case "$libpth" in
5065 '') dflt='none';;
5066 *)
5067         set X $libpth
5068         shift
5069         dflt=${1+"$@"}
5070         ;;
5071 esac
5072 rp="Directories to use for library searches?"
5073 . ./myread
5074 case "$ans" in
5075 none) libpth=' ';;
5076 *) libpth="$ans";;
5077 esac
5078
5079 : compute shared library extension
5080 case "$so" in
5081 '')
5082         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5083                 dflt='sl'
5084         else
5085                 dflt='so'
5086         fi
5087         ;;
5088 *) dflt="$so";;
5089 esac
5090 $cat <<EOM
5091
5092 On some systems, shared libraries may be available.  Answer 'none' if
5093 you want to suppress searching of shared libraries for the remainder
5094 of this configuration.
5095
5096 EOM
5097 rp='What is the file extension used for shared libraries?'
5098 . ./myread
5099 so="$ans"
5100
5101 : Does target system insist that shared library basenames are unique
5102 $cat << EOM
5103
5104 Some dynamic loaders assume that the *basename* of shared library filenames
5105 are globally unique.  We'll default this to undef as we assume your system
5106 is not this weird. Set to defined if you're on one of them.
5107
5108 EOM
5109
5110 dflt='n'
5111 rp='Make shared library basenames unique?'
5112 . ./myread
5113 case "$ans" in
5114 y|Y) val="$define" ;;
5115 *)   val="$undef"  ;;
5116 esac
5117 set d_libname_unique
5118 eval $setvar
5119
5120 : Define several unixisms.
5121 : Hints files or command line option can be used to override them.
5122 : The convoluted testing is in case hints files set either the old
5123 : or the new name.
5124 case "$_exe" in
5125 '')     case "$exe_ext" in
5126         '')     ;;
5127         *)      _exe="$exe_ext" ;;
5128         esac
5129         ;;
5130 esac
5131 case "$_a" in
5132 '')     case "$lib_ext" in
5133     '') _a='.a';;
5134         *)      _a="$lib_ext" ;;
5135         esac
5136         ;;
5137 esac
5138 case "$_o" in
5139 '') case "$obj_ext" in
5140         '')     _o='.o';;
5141         *)      _o="$obj_ext";;
5142         esac
5143         ;;
5144 esac
5145 case "$p_" in
5146 '') case "$path_sep" in
5147         '')     p_=':';;
5148         *)      p_="$path_sep";;
5149         esac
5150         ;;
5151 esac
5152 exe_ext=$_exe
5153 lib_ext=$_a
5154 obj_ext=$_o
5155 path_sep=$p_
5156
5157 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5158
5159 : Which makefile gets called first.  This is used by make depend.
5160 case "$firstmakefile" in
5161 '') firstmakefile='makefile';;
5162 esac
5163
5164 : Check is we will use socks
5165 case "$usesocks" in
5166 $define|true|[yY]*)     dflt='y';;
5167 *) dflt='n';;
5168 esac
5169 cat <<EOM
5170
5171 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5172 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5173 to use the PerlIO abstraction layer, this will be implicitly selected.
5174
5175 If this doesn't make any sense to you, just accept the default '$dflt'.
5176 EOM
5177 rp='Build Perl for SOCKS?'
5178 . ./myread
5179 case "$ans" in
5180 y|Y)    val="$define" ;;
5181 *)      val="$undef" ;;
5182 esac
5183 set usesocks
5184 eval $setvar
5185
5186 : Check for uselongdouble support
5187 case "$ccflags" in
5188 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5189 esac
5190
5191 case "$uselongdouble" in
5192 $define|true|[yY]*)     dflt='y';;
5193 *) dflt='n';;
5194 esac
5195 cat <<EOM
5196
5197 Perl can be built to take advantage of long doubles which
5198 (if available) may give more accuracy and range for floating point numbers.
5199
5200 If this doesn't make any sense to you, just accept the default '$dflt'.
5201 EOM
5202 rp='Try to use long doubles if available?'
5203 . ./myread
5204 case "$ans" in
5205 y|Y)    val="$define"   ;;
5206 *)      val="$undef"    ;;
5207 esac
5208 set uselongdouble
5209 eval $setvar
5210
5211 case "$uselongdouble" in
5212 true|[yY]*) uselongdouble="$define" ;;
5213 esac
5214
5215 : Look for a hint-file generated 'call-back-unit'.  If the
5216 : user has specified that long doubles should be used,
5217 : we may need to set or change some other defaults.
5218 if $test -f uselongdouble.cbu; then
5219     echo "Your platform has some specific hints regarding long doubles, using them..."
5220     . ./uselongdouble.cbu
5221 else
5222     case "$uselongdouble" in
5223         $define)
5224                 $cat <<EOM
5225 (Your platform does not have any specific hints for long doubles.)
5226 EOM
5227         ;;
5228     esac
5229 fi
5230
5231 : Check if quadmath is requested
5232 case "$usequadmath" in
5233 "$define"|true|[yY]*) usequadmath="$define" ;;
5234 *)                    usequadmath="$undef"  ;;
5235 esac
5236
5237 : Looking for optional libraries
5238 echo " "
5239 echo "Checking for optional libraries..." >&4
5240 case "$libs" in
5241 ' '|'') dflt='';;
5242 *) dflt="$libs";;
5243 esac
5244 case "$libswanted" in
5245 '') libswanted='c_s';;
5246 esac
5247 case "$usesocks" in
5248 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5249 esac
5250 case "$usecbacktrace" in
5251 "$define") libswanted="$libswanted bfd" ;;
5252 esac
5253 case "$usequadmath" in
5254 "$define") libswanted="$libswanted quadmath" ;;
5255 esac
5256 libsfound=''
5257 libsfiles=''
5258 libsdirs=''
5259 libspath=''
5260 for thisdir in $libpth $xlibpth; do
5261   test -d $thisdir && libspath="$libspath $thisdir"
5262 done
5263 for thislib in $libswanted; do
5264         for thisdir in $libspath; do
5265             xxx=''
5266             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5267                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5268                 $test -f "$xxx" && eval $libscheck
5269                 $test -f "$xxx" && libstyle=shared
5270                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5271                 $test -f "$xxx" && eval $libscheck
5272                 $test -f "$xxx" && libstyle=shared
5273             fi
5274             if test ! -f "$xxx"; then
5275                 xxx=$thisdir/lib$thislib.$so
5276                 $test -f "$xxx" && eval $libscheck
5277                 $test -f "$xxx" && libstyle=shared
5278             fi
5279             if test ! -f "$xxx"; then
5280                 xxx=$thisdir/lib$thislib$_a
5281                 $test -f "$xxx" && eval $libscheck
5282                 $test -f "$xxx" && libstyle=static
5283             fi
5284             if test ! -f "$xxx"; then
5285                 xxx=$thisdir/$thislib$_a
5286                 $test -f "$xxx" && eval $libscheck
5287                 $test -f "$xxx" && libstyle=static
5288             fi
5289             if test ! -f "$xxx"; then
5290                 xxx=$thisdir/lib${thislib}_s$_a
5291                 $test -f "$xxx" && eval $libscheck
5292                 $test -f "$xxx" && libstyle=static
5293                 $test -f "$xxx" && thislib=${thislib}_s
5294             fi
5295             if test ! -f "$xxx"; then
5296                 xxx=$thisdir/Slib$thislib$_a
5297                 $test -f "$xxx" && eval $libscheck
5298                 $test -f "$xxx" && libstyle=static
5299             fi
5300             if $test -f "$xxx"; then
5301                 case "$libstyle" in
5302                 shared) echo "Found -l$thislib (shared)." ;;
5303                 static) echo "Found -l$thislib." ;;
5304                 *)      echo "Found -l$thislib ($libstyle)." ;;
5305                 esac
5306                 case " $dflt " in
5307                 *"-l$thislib "*);;
5308                 *) dflt="$dflt -l$thislib"
5309                    libsfound="$libsfound $xxx"
5310                    yyy=`basename $xxx`
5311                    libsfiles="$libsfiles $yyy"
5312                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5313                    case " $libsdirs " in
5314                    *" $yyy "*) ;;
5315                    *) libsdirs="$libsdirs $yyy" ;;
5316                    esac
5317                    ;;
5318                 esac
5319                 break
5320             fi
5321         done
5322         if $test ! -f "$xxx"; then
5323             echo "No -l$thislib."
5324         fi
5325 done
5326 set X $dflt
5327 shift
5328 dflt="$*"
5329 case "$libs" in
5330 '') dflt="$dflt";;
5331 *) dflt="$libs";;
5332 esac
5333 case "$dflt" in
5334 ' '|'') dflt='none';;
5335 esac
5336
5337 $cat <<EOM
5338
5339 In order to compile $package on your machine, a number of libraries
5340 are usually needed.  Include any other special libraries here as well.
5341 Say "none" for none.  The default list is almost always right.
5342 EOM
5343
5344 echo " "
5345 rp="What libraries to use?"
5346 . ./myread
5347 case "$ans" in
5348 none) libs=' ';;
5349 *) libs="$ans";;
5350 esac
5351
5352 : determine optimization, if desired, or use for debug flag also
5353 case "$optimize" in
5354 ' '|$undef) dflt='none';;
5355 '') dflt='-O';;
5356 *) dflt="$optimize";;
5357 esac
5358 $cat <<EOH
5359
5360 By default, $package compiles with the -O flag to use the optimizer.
5361 Alternately, you might want to use the symbolic debugger, which uses
5362 the -g flag (on traditional Unix systems).  Either flag can be
5363 specified here.  To use neither flag, specify the word "none".
5364
5365 EOH
5366 rp="What optimizer/debugger flag should be used?"
5367 . ./myread
5368 optimize="$ans"
5369 case "$optimize" in
5370 'none') optimize=" ";;
5371 esac
5372
5373 : Check what DEBUGGING is required from the command line
5374 : -DEBUGGING      or -DDEBUGGING or
5375 : -DEBUGGING=both                       = -g + -DDEBUGGING
5376 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5377 : -DEBUGGING=none or -UDEBUGGING        =
5378 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5379 case "$EBUGGING" in
5380 '')     ;;
5381 *)      DEBUGGING=$EBUGGING ;;
5382 esac
5383
5384 case "$DEBUGGING" in
5385 -g|both|$define)
5386     case "$optimize" in
5387         *-g*) ;;
5388         *)    optimize="$optimize -g" ;;
5389     esac ;;
5390 none|$undef)
5391     case "$optimize" in
5392         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5393                 shift
5394                 optimize="$*"
5395                 ;;
5396     esac ;;
5397 esac
5398
5399 dflt=''
5400 case "$DEBUGGING" in
5401 both|$define) dflt='-DDEBUGGING'
5402 esac
5403
5404 : argument order is deliberate, as the flag will start with - which set could
5405 : think is an option
5406 checkccflag='check=$1; flag=$2; callback=$3;
5407 echo " ";
5408 echo "Checking if your compiler accepts $flag" 2>&1;
5409 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5410 echo "int main(void) { return 0; }" > gcctest.c;
5411 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5412     echo "Yes, it does." 2>&1;
5413     if $test -s gcctest.out ; then
5414         echo "But your platform does not like it:";
5415         cat gcctest.out;
5416     else
5417         case "$ccflags" in
5418         *$check*)
5419             echo "Leaving current flags $ccflags alone." 2>&1
5420             ;;
5421         *) dflt="$dflt $flag";
5422             eval $callback
5423             ;;
5424         esac
5425     fi
5426 else
5427     echo "Nope, it does not, but that is ok." 2>&1;
5428 fi
5429 '
5430
5431 : We will not override a previous value, but we might want to
5432 : augment a hint file
5433 case "$hint" in
5434 default|recommended)
5435         case "$gccversion" in
5436         1*) dflt="$dflt -fpcc-struct-return" ;;
5437         esac
5438         case "$optimize:$DEBUGGING" in
5439         *-g*:old) dflt="$dflt -DDEBUGGING";;
5440         esac
5441         case "$gccversion" in
5442         2*) if $test -d /etc/conf/kconfig.d &&
5443                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5444                 then
5445                         # Interactive Systems (ISC) POSIX mode.
5446                         dflt="$dflt -posix"
5447                 fi
5448                 ;;
5449         esac
5450         case "$gccversion" in
5451         1*) ;;
5452         2.[0-8]*) ;;
5453         ?*)     set strict-aliasing -fno-strict-aliasing
5454                 eval $checkccflag
5455                 ;;
5456         esac
5457         # For gcc, adding -pipe speeds up compilations for some, but apparently
5458         # some assemblers can't read from stdin.  (It also slows down compilations
5459         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5460         case "$gccversion" in
5461         ?*)     set pipe -pipe
5462                 eval $checkccflag
5463                 ;;
5464         esac
5465
5466         # on x86_64 (at least) we require an extra library (libssp) in the
5467         # link command line. This library is not named, so I infer that it is
5468         # an implementation detail that may change. Hence the safest approach
5469         # is to add the flag to the flags passed to the compiler at link time,
5470         # as that way the compiler can do the right implementation dependant
5471         # thing. (NWC)
5472         case "$osname" in
5473         amigaos) ;; # -fstack-protector builds but doesn't work
5474         *)      case "$gccversion" in
5475                 ?*)     set stack-protector-strong -fstack-protector-strong
5476                         eval $checkccflag
5477                         case "$dflt" in
5478                         *-fstack-protector-strong*) ;; # It got added.
5479                         *) # Try the plain/older -fstack-protector.
5480                            set stack-protector -fstack-protector
5481                            eval $checkccflag
5482                            ;;
5483                         esac
5484                         ;;
5485                 esac
5486                 ;;
5487         esac
5488         ;;
5489 esac
5490
5491 case "$mips_type" in
5492 *BSD*|'') inclwanted="$locincpth $usrinc";;
5493 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5494 esac
5495 for thisincl in $inclwanted; do
5496         if $test -d $thisincl; then
5497                 if $test x$thisincl != x$usrinc; then
5498                         case "$dflt" in
5499                         *" -I$thisincl "*);;
5500                         *) dflt="$dflt -I$thisincl ";;
5501                         esac
5502                 fi
5503         fi
5504 done
5505
5506 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5507         xxx=true;
5508 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5509         xxx=true;
5510 else
5511         xxx=false;
5512 fi;
5513 if $xxx; then
5514         case "$dflt" in
5515         *$2*);;
5516         *) dflt="$dflt -D$2";;
5517         esac;
5518 fi'
5519
5520 set signal.h LANGUAGE_C; eval $inctest
5521
5522 case "$usesocks" in
5523 $define)
5524         ccflags="$ccflags -DSOCKS"
5525         ;;
5526 esac
5527
5528 case "$hint" in
5529 default|recommended) dflt="$ccflags $dflt" ;;
5530 *) dflt="$ccflags";;
5531 esac
5532
5533 case "$dflt" in
5534 ''|' ') dflt=none;;
5535 esac
5536
5537 $cat <<EOH
5538
5539 Your C compiler may want other flags.  For this question you should include
5540 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5541 but you should NOT include libraries or ld flags like -lwhatever.  If you
5542 want $package to honor its debug switch, you should include -DDEBUGGING here.
5543 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5544
5545 To use no flags, specify the word "none".
5546
5547 EOH
5548 set X $dflt
5549 shift
5550 dflt=${1+"$@"}
5551 rp="Any additional cc flags?"
5552 . ./myread
5553 case "$ans" in
5554 none) ccflags='';;
5555 *) ccflags="$ans";;
5556 esac
5557
5558 : the following weeds options from ccflags that are of no interest to cpp
5559 case "$cppflags" in
5560 '') cppflags="$ccflags" ;;
5561 *)  set X $ccflags; shift
5562     case " $cppflags " in
5563     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5564     *) cppflags="$cppflags $ccflags" ;;
5565     esac
5566     ;;
5567 esac
5568 case "$gccversion" in
5569 1*) cppflags="$cppflags -D__GNUC__"
5570 esac
5571 case "$mips_type" in
5572 '');;
5573 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5574 esac
5575 case "$cppflags" in
5576 '');;
5577 *)
5578         echo " "
5579         echo "Let me guess what the preprocessor flags are..." >&4
5580         set X $cppflags
5581         shift
5582         cppflags=''
5583         $cat >cpp.c <<'EOM'
5584 #define BLURFL foo
5585
5586 BLURFL xx LFRULB
5587 EOM
5588         previous=''
5589         for flag in $*
5590         do
5591                 case "$flag" in
5592                 -*) ftry="$flag";;
5593                 *) ftry="$previous $flag";;
5594                 esac
5595                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5596                         >cpp1.out 2>/dev/null && \
5597                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5598                         >cpp2.out 2>/dev/null && \
5599                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5600                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5601                 then
5602                         cppflags="$cppflags $ftry"
5603                         previous=''
5604                 else
5605                         previous="$flag"
5606                 fi
5607         done
5608         set X $cppflags
5609         shift
5610         cppflags=${1+"$@"}
5611         case "$cppflags" in
5612         *-*)  echo "They appear to be: $cppflags";;
5613         esac
5614         $rm -f cpp.c cpp?.out
5615         ;;
5616 esac
5617
5618 : flags used in final linking phase
5619 case "$ldflags" in
5620 '') if ./venix; then
5621                 dflt='-i -z'
5622         else
5623                 dflt=''
5624         fi
5625         case "$ccflags" in
5626         *-posix*) dflt="$dflt -posix" ;;
5627         esac
5628         ;;
5629 *) dflt="$ldflags";;
5630 esac
5631 # See note above about -fstack-protector
5632 case "$ccflags" in
5633 *-fstack-protector-strong*)
5634         case "$dflt" in
5635         *-fstack-protector-strong*) ;; # Don't add it again
5636         *) dflt="$dflt -fstack-protector-strong" ;;
5637         esac
5638         ;;
5639 *-fstack-protector*)
5640         case "$dflt" in
5641         *-fstack-protector*) ;; # Don't add it again
5642         *) dflt="$dflt -fstack-protector" ;;
5643         esac
5644         ;;
5645 esac
5646
5647 : Try to guess additional flags to pick up local libraries.
5648 for thislibdir in $libpth; do
5649         case " $loclibpth " in
5650         *" $thislibdir "*)
5651                 case "$dflt " in
5652                 *"-L$thislibdir "*) ;;
5653                 *)  dflt="$dflt -L$thislibdir" ;;
5654                 esac
5655                 ;;
5656         esac
5657 done
5658
5659 case "$dflt" in
5660 '') dflt='none' ;;
5661 esac
5662
5663 $cat <<EOH
5664
5665 Your C linker may need flags.  For this question you should
5666 include -L/whatever and any other flags used by the C linker, but you
5667 should NOT include libraries like -lwhatever.
5668
5669 Make sure you include the appropriate -L/path flags if your C linker
5670 does not normally search all of the directories you specified above,
5671 namely
5672         $libpth
5673 To use no flags, specify the word "none".
5674
5675 EOH
5676
5677 rp="Any additional ld flags (NOT including libraries)?"
5678 . ./myread
5679 case "$ans" in
5680 none) ldflags='';;
5681 *) ldflags="$ans";;
5682 esac
5683 rmlist="$rmlist pdp11"
5684
5685 : coherency check
5686 echo " "
5687 echo "Checking your choice of C compiler and flags for coherency..." >&4
5688 $cat > try.c <<'EOF'
5689 #include <stdio.h>
5690 int main() { printf("Ok\n"); return(0); }
5691 EOF
5692 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5693 shift
5694 $cat >try.msg <<'EOM'
5695 I've tried to compile and run the following simple program:
5696
5697 EOM
5698 $cat try.c >> try.msg
5699
5700 $cat >> try.msg <<EOM
5701
5702 I used the command:
5703
5704         $*
5705         $run ./try
5706
5707 and I got the following output:
5708
5709 EOM
5710 dflt=y
5711 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5712         if $sh -c "$run ./try " >>try.msg 2>&1; then
5713                 xxx=`$run ./try`
5714                 case "$xxx" in
5715                 "Ok") dflt=n ;;
5716                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5717                 esac
5718         else
5719                 echo "The program compiled OK, but exited with status $?." >>try.msg
5720                 rp="You have a problem.  Shall I abort Configure"
5721                 dflt=y
5722         fi
5723 else
5724         echo "I can't compile the test program." >>try.msg
5725         rp="You have a BIG problem.  Shall I abort Configure"
5726         dflt=y
5727 fi
5728 case "$dflt" in
5729 y)
5730         $cat try.msg >&4
5731         case "$knowitall" in
5732         '')
5733                 echo "(The supplied flags or libraries might be incorrect.)"
5734                 ;;
5735         *) dflt=n;;
5736         esac
5737         echo " "
5738         . ./myread
5739         case "$ans" in
5740         n*|N*) ;;
5741         *)      echo "Ok.  Stopping Configure." >&4
5742                 exit 1
5743                 ;;
5744         esac
5745         ;;
5746 n) echo "OK, that should do.";;
5747 esac
5748 $rm_try gcctest gcctest.out
5749
5750 : define a shorthand compile call
5751 compile='
5752 mc_file=$1;
5753 shift;
5754 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5755 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5756 exit 1;
5757 fi;
5758 esac;
5759 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5760 : define a shorthand compile call for compilations that should be ok.
5761 compile_ok='
5762 mc_file=$1;
5763 shift;
5764 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5765
5766 : determine filename position in cpp output
5767 echo " "
5768 echo "Computing filename position in cpp output for #include directives..." >&4
5769 case "$osname" in
5770 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5771 esac
5772 case "$fieldn" in
5773 '')
5774 case "$osname" in
5775 vos) testaccess=-e ;;
5776 *)   testaccess=-r ;;
5777 esac
5778 echo '#include <stdio.h>' > foo.c
5779 $cat >fieldn <<EOF
5780 $startsh
5781 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5782 $grep '^[       ]*#.*stdio\.h' | \
5783 while read cline; do
5784         pos=1
5785         set \$cline
5786         while $test \$# -gt 0; do
5787                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5788                         echo "\$pos"
5789                         exit 0
5790                 fi
5791                 shift
5792                 pos=\`expr \$pos + 1\`
5793         done
5794 done
5795 EOF
5796 chmod +x fieldn
5797 fieldn=`./fieldn`
5798 $rm -f foo.c fieldn
5799 ;;
5800 esac
5801 case $fieldn in
5802 '') pos='???';;
5803 1) pos=first;;
5804 2) pos=second;;
5805 3) pos=third;;
5806 *) pos="${fieldn}th";;
5807 esac
5808 echo "Your cpp writes the filename in the $pos field of the line."
5809
5810 : locate header file
5811 $cat >findhdr <<EOF
5812 $startsh
5813 wanted=\$1
5814 name=''
5815 for usrincdir in $incpth
5816 do
5817         if test -f \$usrincdir/\$wanted; then
5818                 echo "\$usrincdir/\$wanted"
5819                 exit 0
5820         fi
5821 done
5822 awkprg='{ print \$$fieldn }'
5823 echo "#include <\$wanted>" > foo\$\$.c
5824 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5825 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5826 while read cline; do
5827         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5828         case "\$name" in
5829         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5830         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5831         *) exit 2;;
5832         esac;
5833 done;
5834 #
5835 # status = 0: grep returned 0 lines, case statement not executed
5836 # status = 1: headerfile found
5837 # status = 2: while loop executed, no headerfile found
5838 #
5839 status=\$?
5840 $rm -f foo\$\$.c;
5841 if test \$status -eq 1; then
5842         exit 0;
5843 fi
5844 exit 1
5845 EOF
5846 chmod +x findhdr
5847
5848 : define an alternate in-header-list? function
5849 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5850 cont=true; xxf="echo \"<\$1> found.\" >&4";
5851 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5852 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5853 esac;
5854 case $# in 4) instead=instead;; *) instead="at last";; esac;
5855 while $test "$cont"; do
5856         xxx=`./findhdr $1`
5857         var=$2; eval "was=\$$2";
5858         if $test "$xxx" && $test -r "$xxx";
5859         then eval $xxf;
5860         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5861                 cont="";
5862         else eval $xxnf;
5863         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5864         set $yyy; shift; shift; yyy=$@;
5865         case $# in 0) cont="";;
5866         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5867                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5868         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5869                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5870         esac;
5871 done;
5872 while $test "$yyy";
5873 do set $yyy; var=$2; eval "was=\$$2";
5874         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5875         set $yyy; shift; shift; yyy=$@;
5876 done'
5877
5878 : see if stdlib is available
5879 set stdlib.h i_stdlib
5880 eval $inhdr
5881
5882 : check for lengths of integral types
5883 echo " "
5884 case "$intsize" in
5885 '')
5886         echo "Checking to see how big your integers are..." >&4
5887         $cat >try.c <<EOCP
5888 #include <stdio.h>
5889 #$i_stdlib I_STDLIB
5890 #ifdef I_STDLIB
5891 #include <stdlib.h>
5892 #endif
5893 int main()
5894 {
5895         printf("intsize=%d;\n", (int)sizeof(int));
5896         printf("longsize=%d;\n", (int)sizeof(long));
5897         printf("shortsize=%d;\n", (int)sizeof(short));
5898         exit(0);
5899 }
5900 EOCP
5901         set try
5902         if eval $compile_ok && $run ./try > /dev/null; then
5903                 eval `$run ./try`
5904                 echo "Your integers are $intsize bytes long."
5905                 echo "Your long integers are $longsize bytes long."
5906                 echo "Your short integers are $shortsize bytes long."
5907         else
5908                 $cat >&4 <<EOM
5909 !
5910 Help! I can't compile and run the intsize test program: please enlighten me!
5911 (This is probably a misconfiguration in your system or libraries, and
5912 you really ought to fix it.  Still, I'll try anyway.)
5913 !
5914 EOM
5915                 dflt=4
5916                 rp="What is the size of an integer (in bytes)?"
5917                 . ./myread
5918                 intsize="$ans"
5919                 dflt=$intsize
5920                 rp="What is the size of a long integer (in bytes)?"
5921                 . ./myread
5922                 longsize="$ans"
5923                 dflt=2
5924                 rp="What is the size of a short integer (in bytes)?"
5925                 . ./myread
5926                 shortsize="$ans"
5927         fi
5928         ;;
5929 esac
5930 $rm_try
5931
5932 : check for long long
5933 echo " "
5934 echo "Checking to see if you have long long..." >&4
5935 echo 'int main() { long long x = 7; return 0; }' > try.c
5936 set try
5937 if eval $compile; then
5938         val="$define"
5939         echo "You have long long."
5940 else
5941         val="$undef"
5942         echo "You do not have long long."
5943 fi
5944 $rm_try
5945 set d_longlong
5946 eval $setvar
5947
5948 : check for length of long long
5949 case "${d_longlong}${longlongsize}" in
5950 $define)
5951         echo " "
5952         echo "Checking to see how big your long longs are..." >&4
5953         $cat >try.c <<'EOCP'
5954 #include <stdio.h>
5955 int main()
5956 {
5957     printf("%d\n", (int)sizeof(long long));
5958     return(0);
5959 }
5960 EOCP
5961         set try
5962         if eval $compile_ok; then
5963                 longlongsize=`$run ./try`
5964                 echo "Your long longs are $longlongsize bytes long."
5965         else
5966                 dflt='8'
5967                 echo " "
5968                 echo "(I can't seem to compile the test program.  Guessing...)"
5969                 rp="What is the size of a long long (in bytes)?"
5970                 . ./myread
5971                 longlongsize="$ans"
5972         fi
5973         if $test "X$longsize" = "X$longlongsize"; then
5974                 echo "(That isn't any different from an ordinary long.)"
5975         fi
5976         ;;
5977 esac
5978 $rm_try
5979
5980 : see if inttypes.h is available
5981 : we want a real compile instead of Inhdr because some systems
5982 : have an inttypes.h which includes non-existent headers
5983 echo " "
5984 $cat >try.c <<EOCP
5985 #include <inttypes.h>
5986 int main() {
5987         static int32_t foo32 = 0x12345678;
5988 }
5989 EOCP
5990 set try
5991 if eval $compile; then
5992         echo "<inttypes.h> found." >&4
5993         val="$define"
5994 else
5995         echo "<inttypes.h> NOT found." >&4
5996         val="$undef"
5997 fi
5998 $rm_try
5999 set i_inttypes
6000 eval $setvar
6001
6002 : check for int64_t
6003 echo " "
6004 echo "Checking to see if you have int64_t..." >&4
6005 $cat >try.c <<EOCP
6006 #include <sys/types.h>
6007 #$i_inttypes I_INTTYPES
6008 #ifdef I_INTTYPES
6009 #include <inttypes.h>
6010 #endif
6011 int main() { int64_t x = 7; }
6012 EOCP
6013 set try
6014 if eval $compile; then
6015         val="$define"
6016         echo "You have int64_t."
6017 else
6018         val="$undef"
6019         echo "You do not have int64_t."
6020 fi
6021 $rm_try
6022 set d_int64_t
6023 eval $setvar
6024
6025 : Check if 64bit ints have a quad type
6026 echo " "
6027 echo "Checking which 64-bit integer type we could use..." >&4
6028
6029 case "$intsize" in
6030 8) val=int
6031    set quadtype
6032    eval $setvar
6033    val='"unsigned int"'
6034    set uquadtype
6035    eval $setvar
6036    quadkind=1
6037    ;;
6038 *) case "$longsize" in
6039    8) val=long
6040       set quadtype
6041       eval $setvar
6042       val='"unsigned long"'
6043       set uquadtype
6044       eval $setvar
6045       quadkind=2
6046       ;;
6047    *) case "$d_longlong:$longlongsize" in
6048       define:8)
6049         val='"long long"'
6050         set quadtype
6051         eval $setvar
6052         val='"unsigned long long"'
6053         set uquadtype
6054         eval $setvar
6055         quadkind=3
6056         ;;
6057       *) case "$d_int64_t" in
6058          define)
6059            val=int64_t
6060            set quadtype
6061            eval $setvar
6062            val=uint64_t
6063            set uquadtype
6064            eval $setvar
6065            quadkind=4
6066            ;;
6067          esac
6068          ;;
6069       esac
6070       ;;
6071    esac
6072    ;;
6073 esac
6074
6075 case "$quadtype" in
6076 '')     echo "Alas, no 64-bit integer types in sight." >&4
6077         d_quad="$undef"
6078         ;;
6079 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6080         d_quad="$define"
6081         ;;
6082 esac
6083
6084 : Do we want 64bit support
6085 case "$uselonglong" in
6086 "$define"|true|[yY]*)
6087         cat <<EOM >&4
6088
6089 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6090 EOM
6091         use64bitint="$define"
6092         ;;
6093 esac
6094 case "$use64bits" in
6095 "$define"|true|[yY]*)
6096         cat <<EOM >&4
6097
6098 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6099 EOM
6100         use64bitint="$define"
6101         ;;
6102 esac
6103 case "$use64bitints" in
6104 "$define"|true|[yY]*)
6105         cat <<EOM >&4
6106
6107 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6108 EOM
6109         use64bitint="$define"
6110         ;;
6111 esac
6112 case "$use64bitsint" in
6113 "$define"|true|[yY]*)
6114         cat <<EOM >&4
6115
6116 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6117 EOM
6118         use64bitint="$define"
6119         ;;
6120 esac
6121 case "$uselonglongs" in
6122 "$define"|true|[yY]*)
6123         cat <<EOM >&4
6124
6125 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6126 EOM
6127         use64bitint="$define"
6128         ;;
6129 esac
6130 case "$use64bitsall" in
6131 "$define"|true|[yY]*)
6132         cat <<EOM >&4
6133
6134 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6135 EOM
6136         use64bitall="$define"
6137         ;;
6138 esac
6139
6140 case "$ccflags" in
6141 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6142 esac
6143 case "$use64bitall" in
6144 "$define"|true|[yY]*) use64bitint="$define" ;;
6145 esac
6146
6147 case "$longsize" in
6148 8) cat <<EOM
6149
6150 You have natively 64-bit long integers.
6151 EOM
6152    val="$define"
6153    ;;
6154 *) case "$use64bitint" in
6155    "$define"|true|[yY]*) dflt='y';;
6156    *) dflt='n';;
6157    esac
6158    case "$d_quad" in
6159    "$define") ;;
6160    *) dflt='n' ;;
6161    esac
6162    cat <<EOM
6163
6164 Perl can be built to take advantage of 64-bit integer types
6165 on some systems.  To do so, Configure can be run with -Duse64bitint.
6166 Choosing this option will most probably introduce binary incompatibilities.
6167
6168 If this doesn't make any sense to you, just accept the default '$dflt'.
6169 (The default has been chosen based on your configuration.)
6170 EOM
6171    rp='Try to use 64-bit integers, if available?'
6172    . ./myread
6173    case "$ans" in
6174    [yY]*) val="$define" ;;
6175    *)     val="$undef"  ;;
6176    esac
6177    ;;
6178 esac
6179 set use64bitint
6180 eval $setvar
6181
6182 case "$use64bitall" in
6183 "$define"|true|[yY]*) dflt='y' ;;
6184 *) case "$longsize" in
6185    8) dflt='y' ;;
6186    *) dflt='n' ;;
6187    esac
6188    ;;
6189 esac
6190 cat <<EOM
6191
6192 You may also choose to try maximal 64-bitness.  It means using as much
6193 64-bitness as possible on the platform.  This in turn means even more
6194 binary incompatibilities.  On the other hand, your platform may not
6195 have any more 64-bitness available than what you already have chosen.
6196
6197 If this doesn't make any sense to you, just accept the default '$dflt'.
6198 (The default has been chosen based on your configuration.)
6199 EOM
6200 rp='Try to use maximal 64-bit support, if available?'
6201 . ./myread
6202 case "$ans" in
6203 [yY]*) val="$define" ;;
6204 *)     val="$undef"  ;;
6205 esac
6206 set use64bitall
6207 eval $setvar
6208 case "$use64bitall" in
6209 "$define")
6210         case "$use64bitint" in
6211         "$undef")
6212                 cat <<EOM
6213
6214 Since you have chosen a maximally 64-bit build, I'm also turning on
6215 the use of 64-bit integers.
6216 EOM
6217                 use64bitint="$define" ;;
6218         esac
6219         ;;
6220 esac
6221
6222 : Look for a hint-file generated 'call-back-unit'.  If the
6223 : user has specified that a 64-bit perl is to be built,
6224 : we may need to set or change some other defaults.
6225 if $test -f use64bitint.cbu; then
6226         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6227         . ./use64bitint.cbu
6228 fi
6229 case "$use64bitint" in
6230 "$define"|true|[yY]*)
6231         : This test was common to all the OpenBSD forks, and seems harmless for
6232         : other platforms:
6233         echo " "
6234         echo "Checking if your C library has broken 64-bit functions..." >&4
6235         cat >try.c <<EOCP
6236 #include <stdio.h>
6237 typedef $uquadtype myULL;
6238 int main (void)
6239 {
6240     struct {
6241         double d;
6242         myULL  u;
6243     } *p, test[] = {
6244         {4294967303.15, 4294967303ULL},
6245         {4294967294.2,  4294967294ULL},
6246         {4294967295.7,  4294967295ULL},
6247         {0.0, 0ULL}
6248     };
6249     for (p = test; p->u; p++) {
6250         myULL x = (myULL)p->d;
6251         if (x != p->u) {
6252             printf("buggy\n");
6253             return 0;
6254         }
6255     }
6256     printf("ok\n");
6257     return 0;
6258 }
6259 EOCP
6260         set try
6261         if eval $compile_ok; then
6262             libcquad=`$run ./try`
6263             echo "Your C library's 64-bit functions are $libcquad."
6264         else
6265             echo "(I can't seem to compile the test program.)"
6266             echo "Assuming that your C library's 64-bit functions are ok."
6267             libcquad="ok"
6268         fi
6269         $rm_try
6270
6271         case "$libcquad" in
6272             buggy*)
6273                 cat >&4 <<EOM
6274
6275 *** You have a C library with broken 64-bit functions.
6276 *** 64-bit support does not work reliably in this configuration.
6277 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6278 *** Cannot continue, aborting.
6279
6280 EOM
6281                 exit 1
6282                 ;;
6283         esac
6284         case "$longsize" in
6285         4) case "$archname64" in
6286            '') archname64=64int ;;
6287            esac
6288            ;;
6289         esac
6290         ;;
6291 esac
6292
6293 : Look for a hint-file generated 'call-back-unit'.  If the
6294 : user has specified that a maximally 64-bit perl is to be built,
6295 : we may need to set or change some other defaults.
6296 if $test -f use64bitall.cbu; then
6297         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6298         . ./use64bitall.cbu
6299 fi
6300 case "$use64bitall" in
6301 "$define"|true|[yY]*)
6302         case "$longsize" in
6303         4) case "$archname64" in
6304            ''|64int) archname64=64all ;;
6305            esac
6306            ;;
6307         esac
6308         ;;
6309 esac
6310
6311 case "$d_quad:$use64bitint" in
6312 $undef:$define)
6313         cat >&4 <<EOF
6314
6315 *** You have chosen to use 64-bit integers,
6316 *** but none can be found.
6317 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6318 *** Cannot continue, aborting.
6319
6320 EOF
6321         exit 1
6322         ;;
6323 esac
6324
6325 : Check if we are using the GNU C library
6326 echo " "
6327 echo "Checking for GNU C Library..." >&4
6328 cat >try.c <<'EOCP'
6329 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6330    alone are insufficient to distinguish different versions, such as
6331    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6332    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6333 */
6334 #include <stdio.h>
6335 int main(void)
6336 {
6337 #ifdef __GLIBC__
6338 #   ifdef __GLIBC_MINOR__
6339 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6340 #           include <gnu/libc-version.h>
6341             printf("%s\n",  gnu_get_libc_version());
6342 #       else
6343             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6344 #       endif
6345 #   else
6346         printf("%d\n",  __GLIBC__);
6347 #   endif
6348     return 0;
6349 #else
6350     return 1;
6351 #endif
6352 }
6353 EOCP
6354 set try
6355 if eval $compile_ok && $run ./try > glibc.ver; then
6356         val="$define"
6357         gnulibc_version=`$cat glibc.ver`
6358         echo "You are using the GNU C Library version $gnulibc_version"
6359 else
6360         val="$undef"
6361         gnulibc_version=''
6362         echo "You are not using the GNU C Library"
6363 fi
6364 $rm_try glibc.ver
6365 set d_gnulibc
6366 eval $setvar
6367
6368 : see if nm is to be used to determine whether a symbol is defined or not
6369 case "$usenm" in
6370 '')
6371         dflt=''
6372         case "$d_gnulibc" in
6373         "$define")
6374                 echo " "
6375                 echo "nm probably won't work on the GNU C Library." >&4
6376                 dflt=n
6377                 ;;
6378         esac
6379         case "$dflt" in
6380         '')
6381                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6382                         echo " "
6383                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6384                         echo "'nm' won't be sufficient on this system." >&4
6385                         dflt=n
6386                 fi
6387                 ;;
6388         esac
6389         case "$dflt" in
6390         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6391                 if $test $dflt -gt 20; then
6392                         dflt=y
6393                 else
6394                         dflt=n
6395                 fi
6396                 ;;
6397         esac
6398         ;;
6399 *)
6400         case "$usenm" in
6401         true|$define) dflt=y;;
6402         *) dflt=n;;
6403         esac
6404         ;;
6405 esac
6406 $cat <<EOM
6407
6408 I can use $nm to extract the symbols from your C libraries. This
6409 is a time consuming task which may generate huge output on the disk (up
6410 to 3 megabytes) but that should make the symbols extraction faster. The
6411 alternative is to skip the 'nm' extraction part and to compile a small
6412 test program instead to determine whether each symbol is present. If
6413 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6414 this may be the best solution.
6415
6416 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6417
6418 EOM
6419 rp="Shall I use $nm to extract C symbols from the libraries?"
6420 . ./myread
6421 case "$ans" in
6422 [Nn]*) usenm=false;;
6423 *) usenm=true;;
6424 esac
6425
6426 runnm=$usenm
6427 case "$reuseval" in
6428 true) runnm=false;;
6429 esac
6430
6431 : nm options which may be necessary
6432 case "$nm_opt" in
6433 '') if $test -f /mach_boot; then
6434                 nm_opt=''       # Mach
6435         elif $test -d /usr/ccs/lib; then
6436                 nm_opt='-p'     # Solaris (and SunOS?)
6437         elif $test -f /dgux; then
6438                 nm_opt='-p'     # DG-UX
6439         elif $test -f /lib64/rld; then
6440                 nm_opt='-p'     # 64-bit Irix
6441         else
6442                 nm_opt=''
6443         fi;;
6444 esac
6445
6446 : nm options which may be necessary for shared libraries but illegal
6447 : for archive libraries.  Thank you, Linux.
6448 case "$nm_so_opt" in
6449 '')     case "$myuname" in
6450         *linux*|gnu*)
6451                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6452                         nm_so_opt='--dynamic'
6453                 fi
6454                 ;;
6455         esac
6456         ;;
6457 esac
6458
6459 : Figure out where the libc is located
6460 case "$runnm" in
6461 true)
6462 : get list of predefined functions in a handy place
6463 echo " "
6464 case "$libc" in
6465 '') libc=unknown
6466         case "$libs" in
6467         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6468         esac
6469         ;;
6470 esac
6471 case "$libs" in
6472 '') ;;
6473 *)  for thislib in $libs; do
6474         case "$thislib" in
6475         -lc|-lc_s)
6476                 : Handle C library specially below.
6477                 ;;
6478         -l*)
6479                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6480                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6481                         :
6482                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6483                         :
6484                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6485                         :
6486                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6487                         :
6488                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6489                         :
6490                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6491                         :
6492                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6493                         :
6494                 else
6495                         try=''
6496                 fi
6497                 libnames="$libnames $try"
6498                 ;;
6499         *) libnames="$libnames $thislib" ;;
6500         esac
6501         done
6502         ;;
6503 esac
6504 xxx=normal
6505 case "$libc" in
6506 unknown)
6507         set /lib/libc.$so
6508         for xxx in $libpth; do
6509                 $test -r $1 || set $xxx/libc.$so
6510                 : The messy sed command sorts on library version numbers.
6511                 $test -r $1 || \
6512                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6513                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6514                                 h
6515                                 s/[0-9][0-9]*/0000&/g
6516                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6517                                 G
6518                                 s/\n/ /' | \
6519                          $sort | $sed -e 's/^.* //'`
6520                 eval set \$$#
6521         done
6522         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6523         $test -r $1 || set $sysroot/lib/libsys_s$_a
6524         ;;
6525 *)
6526         set blurfl
6527         ;;
6528 esac
6529 if $test -r "$1"; then
6530         echo "Your (shared) C library seems to be in $1."
6531         libc="$1"
6532 elif $test -r /lib/libc && $test -r /lib/clib; then
6533         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6534         xxx=apollo
6535         libc='/lib/clib /lib/libc'
6536         if $test -r /lib/syslib; then
6537                 echo "(Your math library is in /lib/syslib.)"
6538                 libc="$libc /lib/syslib"
6539         fi
6540 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6541         echo "Your C library seems to be in $libc, as you said before."
6542 elif $test -r $incpath/usr/lib/libc$_a; then
6543         libc=$incpath/usr/lib/libc$_a;
6544         echo "Your C library seems to be in $libc.  That's fine."
6545 elif $test -r /lib/libc$_a; then
6546         libc=/lib/libc$_a;
6547         echo "Your C library seems to be in $libc.  You're normal."
6548 else
6549         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6550                 :
6551         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6552                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6553         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6554                 :
6555         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6556                 :
6557         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6558                 :
6559         else
6560                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6561         fi
6562         if $test -r "$tans"; then
6563                 echo "Your C library seems to be in $tans, of all places."
6564                 libc=$tans
6565         else
6566                 libc='blurfl'
6567         fi
6568 fi
6569 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6570         dflt="$libc"
6571         cat <<EOM
6572
6573 If the guess above is wrong (which it might be if you're using a strange
6574 compiler, or your machine supports multiple models), you can override it here.
6575
6576 EOM
6577 else
6578         dflt=''
6579         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6580         cat >&4 <<EOM
6581 I can't seem to find your C library.  I've looked in the following places:
6582
6583 EOM
6584         $sed 's/^/      /' libpath
6585         cat <<EOM
6586
6587 None of these seems to contain your C library. I need to get its name...
6588
6589 EOM
6590 fi
6591 fn=f
6592 rp='Where is your C library?'
6593 . ./getfile
6594 libc="$ans"
6595
6596 echo " "
6597 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6598 set X `cat libnames`
6599 shift
6600 xxx=files
6601 case $# in 1) xxx=file; esac
6602 echo "Extracting names from the following $xxx for later perusal:" >&4
6603 echo " "
6604 $sed 's/^/      /' libnames >&4
6605 echo " "
6606 $echo $n "This may take a while...$c" >&4
6607
6608 for file in $*; do
6609         case $file in
6610         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6611         *) $nm $nm_opt $file 2>/dev/null;;
6612         esac
6613 done >libc.tmp
6614
6615 $echo $n ".$c"
6616 $grep fprintf libc.tmp > libc.ptf
6617 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6618 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6619 xxx='[ADTSIWi]'
6620 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6621         eval $xscan;\
6622         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6623                 eval $xrun
6624 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6625         eval $xscan;\
6626         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6627                 eval $xrun
6628 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6629         eval $xscan;\
6630         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6631                 eval $xrun
6632 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6633         eval $xscan;\
6634         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6635                 eval $xrun
6636 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6637         eval $xscan;\
6638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6639                 eval $xrun
6640 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6641         eval $xscan;\
6642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6643                 eval $xrun
6644 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6645                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6646         eval $xscan;\
6647         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6648                 eval $xrun
6649 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6650         eval $xscan;\
6651         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6652                 eval $xrun
6653 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6654         eval $xscan;\
6655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6656                 eval $xrun
6657 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6658         eval $xscan;\
6659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6660                 eval $xrun
6661 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6662         eval $xscan;\
6663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6664                 eval $xrun
6665 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6666         eval $xscan;\
6667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6668                 eval $xrun
6669 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6670         eval $xscan;\
6671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6672                 eval $xrun
6673 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6674         eval $xscan;\
6675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6676                 eval $xrun
6677 else
6678         $nm -p $* 2>/dev/null >libc.tmp
6679         $grep fprintf libc.tmp > libc.ptf
6680         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6681                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6682         then
6683                 nm_opt='-p'
6684                 eval $xrun
6685         else
6686                 echo " "
6687                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6688                 com=''
6689                 if $ar t $libc > libc.tmp && \
6690                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6691                 then
6692                         for thisname in $libnames $libc; do
6693                                 $ar t $thisname >>libc.tmp
6694                         done
6695                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6696                         echo "Ok." >&4
6697                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6698                         for thisname in $libnames $libc; do
6699                                 $ar tv $thisname >>libc.tmp
6700                                 emximp -o tmp.imp $thisname \
6701                                     2>/dev/null && \
6702                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6703                                     < tmp.imp >>libc.tmp
6704                                 $rm -f tmp.imp
6705                         done
6706                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6707                         echo "Ok." >&4
6708                 else
6709                         echo "$ar didn't seem to work right." >&4
6710                         echo "Maybe this is a Cray...trying bld instead..." >&4
6711                         if  bld t $libc | \
6712                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6713                                 $test -s libc.list
6714                         then
6715                                 for thisname in $libnames; do
6716                                         bld t $libnames | \
6717                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6718                                         $ar t $thisname >>libc.tmp
6719                                 done
6720                                 echo "Ok." >&4
6721                         else
6722                                 echo "That didn't work either.  Giving up." >&4
6723                                 exit 1
6724                         fi
6725                 fi
6726         fi
6727 fi
6728 nm_extract="$com"
6729 case "$PASE" in
6730 define)
6731     echo " "
6732     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6733     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6734     ;;
6735 *)  if $test -f /lib/syscalls.exp; then
6736         echo " "
6737         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6738         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6739                 /lib/syscalls.exp >>libc.list
6740     fi
6741     ;;
6742 esac
6743 ;;
6744 esac
6745 $rm -f libnames libpath
6746
6747 : Check if we are using C++
6748 echo " "
6749 echo "Checking for C++..." >&4
6750 $cat >try.c <<'EOCP'
6751 #include <stdio.h>
6752 int main(void)
6753 {
6754 #ifdef __cplusplus
6755     return 0;
6756 #else
6757     return 1;
6758 #endif
6759 }
6760 EOCP
6761 set try
6762 if eval $compile_ok && $run ./try; then
6763         val="$define"
6764         echo "You are using a C++ compiler."
6765 else
6766         val="$undef"
6767         echo "You are not using a C++ compiler."
6768 fi
6769 $rm_try cplusplus$$
6770 set d_cplusplus
6771 eval $setvar
6772
6773 : is a C symbol defined?
6774 csym='tlook=$1;
6775 case "$3" in
6776 -v) tf=libc.tmp; tdc="";;
6777 -a) tf=libc.tmp; tdc="[]";;
6778 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6779 esac;
6780 case "$d_cplusplus" in
6781     $define)    extern_C="extern \"C\"" ;;
6782     *)          extern_C="extern"       ;;
6783 esac;
6784 tx=yes;
6785 case "$reuseval-$4" in
6786 true-) ;;
6787 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6788 esac;
6789 case "$tx" in
6790 yes)
6791         tval=false;
6792         if $test "$runnm" = true; then
6793                 if $contains $tlook $tf >/dev/null 2>&1; then
6794                         tval=true;
6795                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6796                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6797                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6798                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6799                         $rm_try;
6800                 fi;
6801         else
6802                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6803                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6804                 $rm_try;
6805         fi;
6806         ;;
6807 *)
6808         case "$tval" in
6809         $define) tval=true;;
6810         *) tval=false;;
6811         esac;
6812         ;;
6813 esac;
6814 eval "$2=$tval"'
6815
6816 : define an is-in-libc? function
6817 inlibc='echo " "; td=$define; tu=$undef;
6818 sym=$1; var=$2; eval "was=\$$2";
6819 tx=yes;
6820 case "$reuseval$was" in
6821 true) ;;
6822 true*) tx=no;;
6823 esac;
6824 case "$tx" in
6825 yes)
6826         set $sym tres -f;
6827         eval $csym;
6828         case "$tres" in
6829         true)
6830                 echo "$sym() found." >&4;
6831                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6832         *)
6833                 echo "$sym() NOT found." >&4;
6834                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6835         esac;;
6836 *)
6837         case "$was" in
6838         $define) echo "$sym() found." >&4;;
6839         *) echo "$sym() NOT found." >&4;;
6840         esac;;
6841 esac'
6842
6843 : check for length of double
6844 echo " "
6845 case "$doublesize" in
6846 '')
6847         echo "Checking to see how big your double precision numbers are..." >&4
6848         $cat >try.c <<EOCP
6849 #include <stdio.h>
6850 #$i_stdlib I_STDLIB
6851 #ifdef I_STDLIB
6852 #include <stdlib.h>
6853 #endif
6854 int main()
6855 {
6856     printf("%d\n", (int)sizeof(double));
6857     exit(0);
6858 }
6859 EOCP
6860         set try
6861         if eval $compile_ok; then
6862                 doublesize=`$run ./try`
6863                 echo "Your double is $doublesize bytes long."
6864         else
6865                 dflt='8'
6866                 echo "(I can't seem to compile the test program.  Guessing...)"
6867                 rp="What is the size of a double precision number (in bytes)?"
6868                 . ./myread
6869                 doublesize="$ans"
6870         fi
6871         ;;
6872 esac
6873 $rm_try
6874
6875 : see if this is a float.h system
6876 set float.h i_float
6877 eval $inhdr
6878
6879 : check for long doubles
6880 echo " "
6881 echo "Checking to see if you have long double..." >&4
6882 echo 'int main() { long double x = 7.0; }' > try.c
6883 set try
6884 if eval $compile; then
6885         val="$define"
6886         echo "You have long double."
6887 else
6888         val="$undef"
6889         echo "You do not have long double."
6890 fi
6891 $rm_try
6892 set d_longdbl
6893 eval $setvar
6894
6895 : see if ldexpl exists
6896 set ldexpl d_ldexpl
6897 eval $inlibc
6898
6899 : check for length of long double
6900 case "${d_longdbl}${longdblsize}" in
6901 $define)
6902         echo " "
6903         echo "Checking to see how big your long doubles are..." >&4
6904         $cat >try.c <<'EOCP'
6905 #include <stdio.h>
6906 int main()
6907 {
6908         printf("%d\n", sizeof(long double));
6909 }
6910 EOCP
6911         set try
6912         set try
6913         if eval $compile; then
6914                 longdblsize=`$run ./try`
6915                 echo "Your long doubles are $longdblsize bytes long."
6916         else
6917                 dflt='8'
6918                 echo " "
6919                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6920                 rp="What is the size of a long double (in bytes)?"
6921                 . ./myread
6922                 longdblsize="$ans"
6923         fi
6924         if $test "X$doublesize" = "X$longdblsize"; then
6925                 echo "That isn't any different from an ordinary double."
6926                 echo "I'll keep your setting anyway, but you may see some"
6927                 echo "harmless compilation warnings."
6928         fi
6929         ;;
6930 esac
6931 $rm_try
6932
6933 $echo "Checking the kind of long doubles you have..." >&4
6934 case "$d_longdbl" in
6935 define)
6936 $cat <<EOP >try.c
6937 #$i_float I_FLOAT
6938 #$i_stdlib I_STDLIB
6939 #define LONGDBLSIZE $longdblsize
6940 #define DOUBLESIZE $doublesize
6941 #ifdef I_FLOAT
6942 #include <float.h>
6943 #endif
6944 #ifdef I_STDLIB
6945 #include <stdlib.h>
6946 #endif
6947 #include <stdio.h>
6948 static const long double d = -0.1L;
6949 int main() {
6950   unsigned const char* b = (unsigned const char*)(&d);
6951 #if DOUBLESIZE == LONGDBLSIZE
6952   printf("0\n"); /* if it floats like double */
6953   exit(0);
6954 #endif
6955 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6956   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6957     /* IEEE 754 128-bit little-endian */
6958     printf("1\n");
6959     exit(0);
6960   }
6961   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6962     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6963     printf("2\n");
6964     exit(0);
6965   }
6966 #endif
6967 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6968  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6969  * cannot be trusted. */
6970 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6971   if (b[0] == 0xCD && b[9] == 0xBF) {
6972     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6973      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6974      * Also known as "extended precision". */
6975     printf("3\n");
6976     exit(0);
6977   }
6978   if (b[0] == 0xBF && b[9] == 0xCD) {
6979     /* Is there ever big-endian 80-bit, really?
6980      *
6981      * The Motorola 68881 had another "extended precision" format:
6982      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6983      * for total of 96 bits of bytes.  The zero bits were unused.
6984      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
6985      * If it ever becomes relevant, this format should be allocated
6986      * a new doublekind code since it's quite different from the Intel x87.
6987      */
6988     printf("4\n");
6989     exit(0);
6990   }
6991 #endif
6992 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6993   /* software "double double", the 106 is 53+53.
6994    * but irix thinks it is 107. */
6995   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6996     /* double double 128-bit fully little-endian,
6997      * little-endian doubles in little-endian order,
6998      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6999     printf("5\n");
7000     exit(0);
7001   }
7002   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7003     /* double double 128-bit fully big-endian,
7004      * big-endian doubles in big-endian order,
7005      * e.g. PPC/Power and MIPS:
7006      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7007     printf("6\n");
7008     exit(0);
7009   }
7010   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7011     /* double double 128-bit mixed endian.
7012      * little-endian doubles in big-endian order,
7013      * e.g. ppc64el,
7014      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7015     printf("7\n");
7016     exit(0);
7017   }
7018   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7019     /* double double 128-bit mixed endian,
7020      * big-endian doubles in little-endian order,
7021      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7022     printf("8\n");
7023     exit(0);
7024   }
7025 #endif
7026   printf("-1\n"); /* unknown */
7027   exit(0);
7028 }
7029 EOP
7030 set try
7031 if eval $compile; then
7032     longdblkind=`$run ./try`
7033 else
7034     longdblkind=-1
7035 fi
7036 ;;
7037 *) longdblkind=0 ;;
7038 esac
7039 case "$longdblkind" in
7040 0) echo "Your long doubles are doubles." >&4 ;;
7041 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7042 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7043 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7044 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7045 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7046 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7047 7) echo "You have 128-bit mixed double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7048 8) echo "You have 128-bit mixed double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7049 *) echo "Cannot figure out your long double." >&4 ;;
7050 esac
7051 $rm_try
7052
7053 : determine the architecture name
7054 echo " "
7055 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7056         tarch=`arch`"-$osname"
7057 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7058         if uname -m > tmparch 2>&1 ; then
7059                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7060                         -e 's/$/'"-$osname/" tmparch`
7061         else
7062                 tarch="$osname"
7063         fi
7064         $rm -f tmparch
7065 else
7066         tarch="$osname"
7067 fi
7068 case "$myarchname" in
7069 ''|"$tarch") ;;
7070 *)
7071         echo "(Your architecture name used to be $myarchname.)"
7072         archname=''
7073         ;;
7074 esac
7075 case "$targetarch" in
7076 '') ;;
7077 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7078 esac
7079 myarchname="$tarch"
7080 case "$archname" in
7081 '') dflt="$tarch";;
7082 *) dflt="$archname";;
7083 esac
7084 rp='What is your architecture name'
7085 . ./myread
7086 archname="$ans"
7087
7088 : optionally add API version to the architecture for versioned archlibs
7089 case "$useversionedarchname" in
7090 $define|true|[yY]*) dflt='y';;
7091 *)                  dflt='n';;
7092 esac
7093 rp='Add the Perl API version to your archname?'
7094 . ./myread
7095 case "$ans" in
7096 y|Y)    useversionedarchname="$define" ;;
7097 *)      useversionedarchname="$undef" ;;
7098 esac
7099 case "$useversionedarchname" in
7100 $define)
7101         case "$archname" in
7102         *-$api_versionstring)
7103                 echo "...and architecture name already has -$api_versionstring" >&4
7104                 ;;
7105         *)
7106                 archname="$archname-$api_versionstring"
7107                 echo "...setting architecture name to $archname." >&4
7108                 ;;
7109         esac
7110         ;;
7111 esac
7112
7113 case "$usethreads" in
7114 $define)
7115         echo "Threads selected." >&4
7116         case "$archname" in
7117         *-thread*) echo "...and architecture name already has -thread." >&4
7118                 ;;
7119         *)      archname="$archname-thread"
7120                 echo "...setting architecture name to $archname." >&4
7121                 ;;
7122         esac
7123         ;;
7124 esac
7125 case "$usemultiplicity" in
7126 $define)
7127         echo "Multiplicity selected." >&4
7128         case "$archname" in
7129         *-multi*) echo "...and architecture name already has -multi." >&4
7130                 ;;
7131         *)      archname="$archname-multi"
7132                 echo "...setting architecture name to $archname." >&4
7133                 ;;
7134         esac
7135         ;;
7136 esac
7137 case "$use64bitint$use64bitall" in
7138 *"$define"*)
7139         case "$archname64" in
7140         '')
7141                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7142                 ;;
7143         *)
7144                 case "$use64bitint" in
7145                 "$define") echo "64 bit integers selected." >&4 ;;
7146                 esac
7147                 case "$use64bitall" in
7148                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7149                 esac
7150                 case "$archname" in
7151                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7152                         ;;
7153                 *)      archname="$archname-$archname64"
7154                         echo "...setting architecture name to $archname." >&4
7155                         ;;
7156                 esac
7157                 ;;
7158         esac
7159 esac
7160 case "$uselongdouble" in
7161 $define)
7162         echo "Long doubles selected." >&4
7163         case "$longdblsize" in
7164         $doublesize)
7165                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7166                 ;;
7167         *)
7168                 case "$archname" in
7169                 *-ld*) echo "...and architecture name already has -ld." >&4
7170                         ;;
7171                 *)      archname="$archname-ld"
7172                         echo "...setting architecture name to $archname." >&4
7173                         ;;
7174                 esac
7175                 ;;
7176         esac
7177         ;;
7178 esac
7179 case "$usequadmath" in
7180 $define)
7181         echo "quadmath selected." >&4
7182         case "$archname" in
7183         *-ld*) echo "...and architecture name already has -quadmath." >&4
7184                 ;;
7185         *)      archname="$archname-quadmath"
7186                 echo "...setting architecture name to $archname." >&4
7187                 ;;
7188         esac
7189         ;;
7190 esac
7191 if $test -f archname.cbu; then
7192         echo "Your platform has some specific hints for architecture name, using them..."
7193         . ./archname.cbu
7194 fi
7195
7196 : set the prefixit variable, to compute a suitable default value
7197 prefixit='case "$3" in
7198 ""|none)
7199         case "$oldprefix" in
7200         "") eval "$1=\"\$$2\"";;
7201         *)
7202                 case "$3" in
7203                 "") eval "$1=";;
7204                 none)
7205                         eval "tp=\"\$$2\"";
7206                         case "$tp" in
7207                         ""|" ") eval "$1=\"\$$2\"";;
7208                         *) eval "$1=";;
7209                         esac;;
7210                 esac;;
7211         esac;;
7212 *)
7213         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7214         case "$tp" in
7215         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7216         /*-$oldprefix/*|\~*-$oldprefix/*)
7217                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7218         *) eval "$1=\"\$$2\"";;
7219         esac;;
7220 esac'
7221
7222 : determine installation style
7223 : For now, try to deduce it from prefix unless it is already set.
7224 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7225 case "$installstyle" in
7226 '')     case "$prefix" in
7227                 *perl*) dflt='lib';;
7228                 *) dflt='lib/perl5' ;;
7229         esac
7230         ;;
7231 *)      dflt="$installstyle" ;;
7232 esac
7233 : Probably not worth prompting for this since we prompt for all
7234 : the directories individually, and the prompt would be too long and
7235 : confusing anyway.
7236 installstyle=$dflt
7237
7238 : determine where public executables go
7239 echo " "
7240 set dflt bin bin
7241 eval $prefixit
7242 fn=d~
7243 rp='Pathname where the public executables will reside?'
7244 . ./getfile
7245 if $test "X$ansexp" != "X$binexp"; then
7246         installbin=''
7247 fi
7248 prefixvar=bin
7249 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7250 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7251 :     this via initialinstalllocation
7252 . ./setprefixvar
7253
7254 case "$userelocatableinc" in
7255 $define|true|[yY]*)     dflt='y' ;;
7256 *)                      dflt='n' ;;
7257 esac
7258 cat <<EOM
7259
7260 Would you like to build Perl so that the installation is relocatable, so that
7261 library paths in @INC are determined relative to the path of the perl binary?
7262 This is not advised for system Perl installs, or if you need to run setid
7263 scripts or scripts under taint mode.
7264
7265 If this doesn't make any sense to you, just accept the default '$dflt'.
7266 EOM
7267 rp='Use relocatable @INC?'
7268 . ./myread
7269 case "$ans" in
7270 y|Y)    val="$define" ;;
7271 *)      val="$undef"  ;;
7272 esac
7273 set userelocatableinc
7274 eval $setvar
7275
7276 initialinstalllocation="$binexp"
7277 : Default prefix is now "up one level from where the binaries are"
7278 case "$userelocatableinc" in
7279 $define|true|[yY]*)
7280     bin=".../"
7281     binexp=".../"
7282     prefix=".../.."
7283     prefixexp=".../.."
7284     installprefixexp=".../.."
7285     ;;
7286 esac
7287
7288 : determine where private library files go
7289 : Usual default is /usr/local/lib/perl5/$version.
7290 : Also allow things like /opt/perl/lib/$version, since
7291 : /opt/perl/lib/perl5... would be redundant.
7292 : The default "style" setting is made in installstyle.U
7293 case "$installstyle" in
7294 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7295 *)       set dflt privlib lib/$version ;;
7296 esac
7297 eval $prefixit
7298 $cat <<EOM
7299
7300 There are some auxiliary files for $package that need to be put into a
7301 private library directory that is accessible by everyone.
7302
7303 EOM
7304 fn=$binexp
7305 fn=d~+
7306 rp='Pathname where the private library files will reside?'
7307 . ./getfile
7308 prefixvar=privlib
7309 . ./setprefixvar
7310
7311 : set the prefixup variable, to restore leading tilda escape
7312 prefixup='case "$prefixexp" in
7313 "$prefix") ;;
7314 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7315 esac'
7316
7317 : determine where public architecture dependent libraries go
7318 set archlib archlib
7319 eval $prefixit
7320 : privlib default is /usr/local/lib/$package/$version
7321 : archlib default is /usr/local/lib/$package/$version/$archname
7322 : privlib may have an optional trailing /share.
7323 tdflt=`echo $privlib | $sed 's,/share$,,'`
7324 tdflt=$tdflt/$archname
7325 case "$archlib" in
7326 '')     dflt=$tdflt
7327         ;;
7328 *)      dflt="$archlib"
7329     ;;
7330 esac
7331 $cat <<EOM
7332
7333 $spackage contains architecture-dependent library files.  If you are
7334 sharing libraries in a heterogeneous environment, you might store
7335 these files in a separate location.  Otherwise, you can just include
7336 them with the rest of the public library files.
7337
7338 EOM
7339 fn=$binexp
7340 fn=d+~
7341 rp='Where do you want to put the public architecture-dependent libraries?'
7342 . ./getfile
7343 prefixvar=archlib
7344 . ./setprefixvar
7345 if $test X"$archlib" = X"$privlib"; then
7346         d_archlib="$undef"
7347 else
7348         d_archlib="$define"
7349 fi
7350
7351 : see if setuid scripts can be secure
7352 $cat <<EOM
7353
7354 Some kernels have a bug that prevents setuid #! scripts from being
7355 secure.  Some sites have disabled setuid #! scripts because of this.
7356
7357 First let's decide if your kernel supports secure setuid #! scripts.
7358 (If setuid #! scripts would be secure but have been disabled anyway,
7359 don't say that they are secure if asked.)
7360
7361 EOM
7362
7363 val="$undef"
7364 if $test -d /dev/fd; then
7365         echo "#!$ls" >reflect
7366         chmod +x,u+s reflect
7367         ./reflect >flect 2>&1
7368         if $contains "/dev/fd" flect >/dev/null; then
7369                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7370                 val="$define"
7371         else
7372                 $cat <<EOM
7373 If you are not sure if they are secure, I can check but I'll need a
7374 username and password different from the one you are using right now.
7375 If you don't have such a username or don't want me to test, simply
7376 enter 'none'.
7377
7378 EOM
7379                 rp='Other username to test security of setuid scripts with?'
7380                 dflt='none'
7381                 . ./myread
7382                 case "$ans" in
7383                 n|none)
7384                         case "$d_suidsafe" in
7385                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7386                                 dflt=n;;
7387                         "$undef")
7388                                 echo "Well, the $hint value is *not* secure." >&4
7389                                 dflt=n;;
7390                         *)      echo "Well, the $hint value *is* secure." >&4
7391                                 dflt=y;;
7392                         esac
7393                         ;;
7394                 *)
7395                         $rm -f reflect flect
7396                         echo "#!$ls" >reflect
7397                         chmod +x,u+s reflect
7398                         echo >flect
7399                         chmod a+w flect
7400                         echo '"su" will (probably) prompt you for '"$ans's password."
7401                         su $ans -c './reflect >flect'
7402                         if $contains "/dev/fd" flect >/dev/null; then
7403                                 echo "Okay, it looks like setuid scripts are secure." >&4
7404                                 dflt=y
7405                         else
7406                                 echo "I don't think setuid scripts are secure." >&4
7407                                 dflt=n
7408                         fi
7409                         ;;
7410                 esac
7411                 rp='Does your kernel have *secure* setuid scripts?'
7412                 . ./myread
7413                 case "$ans" in
7414                 [yY]*)  val="$define";;
7415                 *)      val="$undef";;
7416                 esac
7417         fi
7418 else
7419         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7420         echo "(That's for file descriptors, not floppy disks.)"
7421         val="$undef"
7422 fi
7423 set d_suidsafe
7424 eval $setvar
7425
7426 $rm -f reflect flect
7427
7428 : now see if they want to do setuid emulation
7429 if $test $patchlevel -lt 11; then
7430 echo " "
7431 val="$undef"
7432 case "$d_suidsafe" in
7433 "$define")
7434         val="$undef"
7435         echo "No need to emulate SUID scripts since they are secure here." >&4
7436         ;;
7437 *)
7438         $cat <<EOM
7439 Some systems have disabled setuid scripts, especially systems where
7440 setuid scripts cannot be secure.  On systems where setuid scripts have
7441 been disabled, the setuid/setgid bits on scripts are currently
7442 useless.  It is possible for $package to detect those bits and emulate
7443 setuid/setgid in a secure fashion.  This emulation will only work if
7444 setuid scripts have been disabled in your kernel.
7445
7446 EOM
7447         case "$d_dosuid" in
7448         "$define") dflt=y ;;
7449         *) dflt=n ;;
7450         esac
7451         rp="Do you want to do setuid/setgid emulation?"
7452         . ./myread
7453         case "$ans" in
7454         [yY]*)  val="$define";;
7455         *)      val="$undef";;
7456         esac
7457         ;;
7458 esac
7459 set d_dosuid
7460 eval $setvar
7461 else
7462     case "$d_dosuid" in
7463         "$define")
7464         cat >&4 <<EOH
7465
7466 SUID emulation has been removed for 5.12
7467 Please re-run Configure without -Dd_dosuid
7468
7469 EOH
7470         exit 1;
7471         ;;
7472     esac
7473     d_dosuid=undef
7474 fi
7475
7476 : Find perl5.005 or later.
7477 echo "Looking for a previously installed perl5.005 or later... "
7478 case "$perl5" in
7479 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7480                 : Check if this perl is recent and can load a simple module
7481                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7482                         perl5=$tdir/perl
7483                         break;
7484                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7485                         perl5=$tdir/perl5
7486                         break;
7487                 fi
7488         done
7489         ;;
7490 *)      perl5="$perl5"
7491         ;;
7492 esac
7493 case "$perl5" in
7494 '')     echo "None found.  That's ok.";;
7495 *)      echo "Using $perl5." ;;
7496 esac
7497
7498 : Set the siteprefix variables
7499 $cat <<EOM
7500
7501 After $package is installed, you may wish to install various
7502 add-on modules and utilities.  Typically, these add-ons will
7503 be installed under $prefix with the rest
7504 of this package.  However, you may wish to install such add-ons
7505 elsewhere under a different prefix.
7506
7507 If you do not wish to put everything under a single prefix, that's
7508 ok.  You will be prompted for the individual locations; this siteprefix
7509 is only used to suggest the defaults.
7510
7511 The default should be fine for most people.
7512
7513 EOM
7514 fn=d~+
7515 rp='Installation prefix to use for add-on modules and utilities?'
7516 : XXX Here might be another good place for an installstyle setting.
7517 case "$siteprefix" in
7518 '') dflt=$prefix ;;
7519 *)  dflt=$siteprefix ;;
7520 esac
7521 . ./getfile
7522 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7523 oldsiteprefix=''
7524 case "$siteprefix" in
7525 '') ;;
7526 *)      case "$ans" in
7527         "$prefix") ;;
7528         *) oldsiteprefix="$prefix";;
7529         esac
7530         ;;
7531 esac
7532 siteprefix="$ans"
7533 siteprefixexp="$ansexp"
7534
7535 : determine where site specific libraries go.
7536 : Usual default is /usr/local/lib/perl5/site_perl/$version
7537 : The default "style" setting is made in installstyle.U
7538 : XXX No longer works with Prefixit stuff.
7539 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7540 case "$sitelib" in
7541 '') case "$installstyle" in
7542         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7543         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7544         esac
7545         ;;
7546 *)      dflt="$sitelib"
7547         ;;
7548 esac
7549 $cat <<EOM
7550
7551 The installation process will create a directory for
7552 site-specific extensions and modules.  Most users find it convenient
7553 to place all site-specific files in this directory rather than in the
7554 main distribution directory.
7555
7556 EOM
7557 fn=d~+
7558 rp='Pathname for the site-specific library files?'
7559 . ./getfile
7560 prefixvar=sitelib
7561 . ./setprefixvar
7562 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7563
7564 : Determine list of previous versions to include in @INC
7565 $cat > getverlist <<EOPL
7566 #!$perl5 -w
7567 use File::Basename;
7568 \$api_versionstring = "$api_versionstring";
7569 \$version = "$version";
7570 \$stem = "$sitelib_stem";
7571 \$archname = "$archname";
7572 EOPL
7573         $cat >> getverlist <<'EOPL'
7574 # The list found is store twice for each entry: the original name, and
7575 # the binary broken down version as pack "sss", so sorting is easy and
7576 # unambiguous. This will work for all versions that have a maximum of
7577 # three digit groups, separate by '.'s or '_'s. Names are extended with
7578 # ".0.0" to ensure at least three elements for the pack.
7579 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7580
7581 # Can't have leading @ because metaconfig interprets it as a command!
7582 ;@inc_version_list=();
7583 # XXX Redo to do opendir/readdir?
7584 if (-d $stem) {
7585     chdir($stem);
7586     ;@candidates = map {
7587         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7588     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7589 }
7590 else {
7591     ;@candidates = ();
7592 }
7593
7594 ($pversion, $aversion, $vsn5005) = map {
7595     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7596 foreach $d (@candidates) {
7597     if ($d->[1] lt $pversion) {
7598         if ($d->[1] ge $aversion) {
7599             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7600         }
7601         elsif ($d->[1] ge $vsn5005) {
7602             unshift(@inc_version_list, grep { -d } $d->[0]);
7603         }
7604     }
7605     else {
7606         # Skip newer version.  I.e. don't look in
7607         # 5.7.0 if we're installing 5.6.1.
7608     }
7609 }
7610
7611 if (@inc_version_list) {
7612     print join(' ', @inc_version_list);
7613 }
7614 else {
7615     # Blank space to preserve value for next Configure run.
7616     print " ";
7617 }
7618 EOPL
7619 chmod +x getverlist
7620 case "$inc_version_list" in
7621 '')     if test -x "$perl5$exe_ext"; then
7622                 dflt=`$perl5 getverlist`
7623         else
7624                 dflt='none'
7625         fi
7626         ;;
7627 $undef) dflt='none' ;;
7628 *)  eval dflt=\"$inc_version_list\" ;;
7629 esac
7630 case "$dflt" in
7631 ''|' ') dflt=none ;;
7632 esac
7633 case "$dflt" in
7634 5.005) dflt=none ;;
7635 esac
7636 $cat <<EOM
7637
7638 In order to ease the process of upgrading, this version of perl
7639 can be configured to use modules built and installed with earlier
7640 versions of perl that were installed under $prefix.  Specify here
7641 the list of earlier versions that this version of perl should check.
7642 If Configure detected no earlier versions of perl installed under
7643 $prefix, then the list will be empty.  Answer 'none' to tell perl
7644 to not search earlier versions.
7645
7646 The default should almost always be sensible, so if you're not sure,
7647 just accept the default.
7648 EOM
7649
7650 rp='List of earlier versions to include in @INC?'
7651 . ./myread
7652 case "$ans" in
7653 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7654 *) inc_version_list="$ans" ;;
7655 esac
7656 case "$inc_version_list" in
7657 ''|' ')
7658         inc_version_list_init='0'
7659         d_inc_version_list="$undef"
7660         ;;
7661 *)      inc_version_list_init=`echo $inc_version_list |
7662                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7663         d_inc_version_list="$define"
7664         ;;
7665 esac
7666 $rm -f getverlist
7667
7668 : see if malloc/malloc.h has to be included
7669 set malloc/malloc.h i_mallocmalloc
7670 eval $inhdr
7671
7672 : see if this is a malloc.h system
7673 : we want a real compile instead of Inhdr because some systems have a
7674 : malloc.h that just gives a compile error saying to use stdlib.h instead
7675 echo " "
7676 $cat >try.c <<EOCP
7677 #include <stdlib.h>
7678 #include <malloc.h>
7679 #$i_mallocmalloc I_MALLOCMALLOC
7680 #ifdef I_MALLOCMALLOC
7681 # include <malloc/malloc.h>
7682 #endif
7683
7684 int main () { return 0; }
7685 EOCP
7686 set try
7687 if eval $compile; then
7688     echo "<malloc.h> found." >&4
7689     val="$define"
7690 else
7691     echo "<malloc.h> NOT found." >&4
7692     val="$undef"
7693 fi
7694 $rm_try
7695 set i_malloc
7696 eval $setvar
7697
7698 : check for length of pointer
7699 echo " "
7700 case "$ptrsize" in
7701 '')
7702         echo "Checking to see how big your pointers are..." >&4
7703         $cat >try.c <<EOCP
7704 #include <stdio.h>
7705 #$i_stdlib I_STDLIB
7706 #ifdef I_STDLIB
7707 #include <stdlib.h>
7708 #endif
7709 int main()
7710 {
7711     printf("%d\n", (int)sizeof(void *));
7712     exit(0);
7713 }
7714 EOCP
7715         set try
7716         if eval $compile_ok; then
7717                 ptrsize=`$run ./try`
7718                 echo "Your pointers are $ptrsize bytes long."
7719         else
7720                 dflt='4'
7721                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7722                 rp="What is the size of a pointer (in bytes)?"
7723                 . ./myread
7724                 ptrsize="$ans"
7725         fi
7726         ;;
7727 esac
7728 $rm_try
7729 case "$use64bitall" in
7730 "$define"|true|[yY]*)
7731         case "$ptrsize" in
7732         4)      cat <<EOM >&4
7733
7734 *** You have chosen a maximally 64-bit build,
7735 *** but your pointers are only 4 bytes wide.
7736 *** Please rerun Configure without -Duse64bitall.
7737 EOM
7738                 case "$d_quad" in
7739                 define)
7740                         cat <<EOM >&4
7741 *** Since you have quads, you could possibly try with -Duse64bitint.
7742 EOM
7743                         ;;
7744                 esac
7745                 cat <<EOM >&4
7746 *** Cannot continue, aborting.
7747
7748 EOM
7749
7750                 exit 1
7751                 ;;
7752         esac
7753         ;;
7754 esac
7755
7756
7757 : determine whether to use malloc wrapping
7758 echo " "
7759 case "$usemallocwrap" in
7760 [yY]*|true|$define)     dflt='y' ;;
7761 [nN]*|false|$undef)     dflt='n' ;;
7762 *)      case "$usedevel" in
7763         [yY]*|true|$define)     dflt='y' ;;
7764         *) dflt='n' ;;
7765         esac
7766         ;;
7767 esac
7768 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7769 . ./myread
7770 usemallocwrap="$ans"
7771 case "$ans" in
7772 y*|true)
7773         usemallocwrap="$define" ;;
7774 *)
7775         usemallocwrap="$undef" ;;
7776 esac
7777
7778 : determine which malloc to compile in
7779 echo " "
7780 case "$usemymalloc" in
7781 [yY]*|true|$define)     dflt='y' ;;
7782 [nN]*|false|$undef)     dflt='n' ;;
7783 *)      case "$ptrsize" in
7784         4) dflt='y' ;;
7785         *) dflt='n' ;;
7786         esac
7787         if test "$useithreads" = "$define"; then dflt='n'; fi
7788         ;;
7789 esac
7790 rp="Do you wish to attempt to use the malloc that comes with $package?"
7791 . ./myread
7792 usemymalloc="$ans"
7793 case "$ans" in
7794 y*|true)
7795         usemymalloc='y'
7796         mallocsrc='malloc.c'
7797         mallocobj="malloc$_o"
7798         d_mymalloc="$define"
7799         case "$libs" in
7800         *-lmalloc*)
7801                 : Remove malloc from list of libraries to use
7802                 echo "Removing unneeded -lmalloc from library list" >&4
7803                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7804                 shift
7805                 libs="$*"
7806                 echo "libs = $libs" >&4
7807                 ;;
7808         esac
7809         ;;
7810 *)
7811         usemymalloc='n'
7812         mallocsrc=''
7813         mallocobj=''
7814         d_mymalloc="$undef"
7815         ;;
7816 esac
7817
7818 : compute the return types of malloc and free
7819 echo " "
7820 $cat >malloc.c <<END
7821 #$i_malloc I_MALLOC
7822 #$i_stdlib I_STDLIB
7823 #include <stdio.h>
7824 #include <sys/types.h>
7825 #ifdef I_MALLOC
7826 #include <malloc.h>
7827 #endif
7828 #ifdef I_STDLIB
7829 #include <stdlib.h>
7830 #endif
7831 #ifdef TRY_MALLOC
7832 void *malloc();
7833 #endif
7834 #ifdef TRY_FREE
7835 void free();
7836 #endif
7837 END
7838 case "$malloctype" in
7839 '')
7840         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7841                 malloctype='void *'
7842         else
7843                 malloctype='char *'
7844         fi
7845         ;;
7846 esac
7847 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7848
7849 case "$freetype" in
7850 '')
7851         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7852                 freetype='void'
7853         else
7854                 freetype='int'
7855         fi
7856         ;;
7857 esac
7858 echo "Your system uses $freetype free(), it would seem." >&4
7859 $rm -f malloc.[co]
7860 : determine where site specific architecture-dependent libraries go.
7861 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7862 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7863 : sitelib may have an optional trailing /share.
7864 case "$sitearch" in
7865 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7866         dflt="$dflt/$archname"
7867         ;;
7868 *)      dflt="$sitearch"
7869         ;;
7870 esac
7871 set sitearch sitearch none
7872 eval $prefixit
7873 $cat <<EOM
7874
7875 The installation process will also create a directory for
7876 architecture-dependent site-specific extensions and modules.
7877
7878 EOM
7879 fn=d~+
7880 rp='Pathname for the site-specific architecture-dependent library files?'
7881 . ./getfile
7882 prefixvar=sitearch
7883 . ./setprefixvar
7884 if $test X"$sitearch" = X"$sitelib"; then
7885         d_sitearch="$undef"
7886 else
7887         d_sitearch="$define"
7888 fi
7889
7890 : Set the vendorprefix variables
7891 $cat <<EOM
7892
7893 The installation process will also create a directory for
7894 vendor-supplied add-ons.  Vendors who supply perl with their system
7895 may find it convenient to place all vendor-supplied files in this
7896 directory rather than in the main distribution directory.  This will
7897 ease upgrades between binary-compatible maintenance versions of perl.
7898
7899 Of course you may also use these directories in whatever way you see
7900 fit.  For example, you might use them to access modules shared over a
7901 company-wide network.
7902
7903 The default answer should be fine for most people.
7904 This causes further questions about vendor add-ons to be skipped
7905 and no vendor-specific directories will be configured for perl.
7906
7907 EOM
7908 rp='Do you want to configure vendor-specific add-on directories?'
7909 case "$usevendorprefix" in
7910 define|true|[yY]*) dflt=y ;;
7911 *)      : User may have set vendorprefix directly on Configure command line.
7912         case "$vendorprefix" in
7913         ''|' ') dflt=n ;;
7914         *)      dflt=y ;;
7915         esac
7916         ;;
7917 esac
7918 . ./myread
7919 case "$ans" in
7920 [yY]*)  fn=d~+
7921         rp='Installation prefix to use for vendor-supplied add-ons?'
7922         case "$vendorprefix" in
7923         '') dflt="$prefix" ;;
7924         *)  dflt=$vendorprefix ;;
7925         esac
7926         . ./getfile
7927         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7928         oldvendorprefix=''
7929         case "$vendorprefix" in
7930         '') ;;
7931         *)      case "$ans" in
7932                 "$prefix") ;;
7933                 *) oldvendorprefix="$prefix";;
7934                 esac
7935                 ;;
7936         esac
7937         usevendorprefix="$define"
7938         vendorprefix="$ans"
7939         vendorprefixexp="$ansexp"
7940         ;;
7941 *)      usevendorprefix="$undef"
7942         vendorprefix=''
7943         vendorprefixexp=''
7944         ;;
7945 esac
7946
7947 : Set the vendorlib variables
7948 case "$vendorprefix" in
7949 '')     d_vendorlib="$undef"
7950         vendorlib=''
7951         vendorlibexp=''
7952         ;;
7953 *)      d_vendorlib="$define"
7954         : determine where vendor-supplied modules go.
7955         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7956         case "$vendorlib" in
7957         '')
7958                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7959                 case "$installstyle" in
7960                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7961                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7962                 esac
7963                 ;;
7964         *)      dflt="$vendorlib"
7965                 ;;
7966         esac
7967         fn=d~+
7968         rp='Pathname for the vendor-supplied library files?'
7969         . ./getfile
7970         vendorlib="$ans"
7971         vendorlibexp="$ansexp"
7972         ;;
7973 esac
7974 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7975 prefixvar=vendorlib
7976 . ./installprefix
7977
7978 : Set the vendorarch variables
7979 case "$vendorprefix" in
7980 '')     d_vendorarch="$undef"
7981         vendorarch=''
7982         vendorarchexp=''
7983         ;;
7984 *)      d_vendorarch="$define"
7985         : determine where vendor-supplied architecture-dependent libraries go.
7986         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7987         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7988         : vendorlib may have an optional trailing /share.
7989         case "$vendorarch" in
7990         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7991                 dflt="$dflt/$archname"
7992                 ;;
7993         *)      dflt="$vendorarch" ;;
7994         esac
7995         fn=d~+
7996         rp='Pathname for vendor-supplied architecture-dependent files?'
7997         . ./getfile
7998         vendorarch="$ans"
7999         vendorarchexp="$ansexp"
8000         ;;
8001 esac
8002 prefixvar=vendorarch
8003 . ./installprefix
8004 if $test X"$vendorarch" = X"$vendorlib"; then
8005         d_vendorarch="$undef"
8006 else
8007         d_vendorarch="$define"
8008 fi
8009
8010 : Final catch-all directories to search
8011 $cat <<EOM
8012
8013 Lastly, you can have perl look in other directories for extensions and
8014 modules in addition to those already specified.
8015 These directories will be searched after
8016         $sitearch
8017         $sitelib
8018 EOM
8019 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8020 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8021 echo ' '
8022 case "$otherlibdirs" in
8023 ''|' ') dflt='none' ;;
8024 *)      dflt="$otherlibdirs" ;;
8025 esac
8026 $cat <<EOM
8027 Enter a colon-separated set of extra paths to include in perl's @INC
8028 search path, or enter 'none' for no extra paths.
8029
8030 EOM
8031
8032 rp='Colon-separated list of additional directories for perl to search?'
8033 . ./myread
8034 case "$ans" in
8035 ' '|''|none)    otherlibdirs=' ' ;;
8036 *)      otherlibdirs="$ans" ;;
8037 esac
8038 case "$otherlibdirs" in
8039 ' ') val=$undef ;;
8040 *)      val=$define ;;
8041 esac
8042 set d_perl_otherlibdirs
8043 eval $setvar
8044
8045 : Cruising for prototypes
8046 echo " "
8047 echo "Checking out function prototypes..." >&4
8048 $cat >prototype.c <<EOCP
8049 #$i_stdlib I_STDLIB
8050 #ifdef I_STDLIB
8051 #include <stdlib.h>
8052 #endif
8053 int main(int argc, char *argv[]) {
8054         exit(0);}
8055 EOCP
8056 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8057         echo "Your C compiler appears to support function prototypes."
8058         val="$define"
8059 else
8060         echo "Your C compiler doesn't seem to understand function prototypes."
8061         val="$undef"
8062 fi
8063 set prototype
8064 eval $setvar
8065 $rm -f prototype*
8066
8067 : Check if ansi2knr is required
8068 case "$prototype" in
8069 "$define") ;;
8070 *)      ansi2knr='ansi2knr'
8071         echo " "
8072         cat <<EOM >&4
8073
8074 $me:  FATAL ERROR:
8075 This version of $package can only be compiled by a compiler that
8076 understands function prototypes.  Unfortunately, your C compiler
8077         $cc $ccflags
8078 doesn't seem to understand them.  Sorry about that.
8079
8080 If GNU cc is available for your system, perhaps you could try that instead.
8081
8082 Eventually, we hope to support building Perl with pre-ANSI compilers.
8083 If you would like to help in that effort, please contact <perlbug@perl.org>.
8084
8085 Aborting Configure now.
8086 EOM
8087         exit 2
8088         ;;
8089 esac
8090
8091 : DTrace support
8092 dflt_dtrace='/usr/sbin/dtrace'
8093 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8094
8095 cat <<EOM
8096
8097 Perl can be built to support DTrace on platforms that support it.
8098 DTrace is a diagnosis and performance analysis tool from Sun.
8099
8100 If this doesn't make any sense to you, just accept the default.
8101 EOM
8102
8103 while $test 1 ; do
8104         case "$usedtrace" in
8105         $define|true|[yY]*)
8106                 dflt='y'
8107                 ;;
8108         ?*)
8109                 dflt='y'
8110                 dflt_dtrace=$usedtrace
8111                 ;;
8112         *)
8113                 dflt='n'
8114                 ;;
8115         esac
8116
8117         rp='Support DTrace if available?'
8118         . ./myread
8119         case "$ans" in
8120         y|Y)    val="$define" ;;
8121         *)      val="$undef" ;;
8122         esac
8123         set usedtrace
8124         eval $setvar
8125
8126         test "X$usedtrace" != "X$define" && break
8127
8128         echo " "
8129         rp='Where is the dtrace executable?'
8130         dflt=$dflt_dtrace
8131         . ./getfile
8132         val="$ans"
8133         set dtrace
8134         eval $setvar
8135
8136         if $test -f $dtrace
8137         then
8138                 if $dtrace -h -s ../perldtrace.d \
8139                         -o perldtrace.tmp >/dev/null 2>&1 \
8140                         && rm -f perldtrace.tmp
8141                 then
8142                         echo " "
8143                         echo "Good: your $dtrace knows about the -h flag."
8144                 else
8145                         cat >&2 <<EOM
8146
8147 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8148 ***
8149 *** Your installed dtrace doesn't support the -h switch to compile a D
8150 *** program into a C header. Can't continue.
8151
8152 EOM
8153                         exit 1
8154                 fi
8155                 break;
8156         fi
8157
8158         case "$fastread" in
8159         yes)
8160                 cat >&2 <<EOM
8161
8162 *** $me:  Fatal Error:  $dtrace not found.
8163 *** Can't continue.
8164
8165 EOM
8166                 exit 1
8167                 ;;
8168         *)
8169                 echo "*** $dtrace was not found."
8170                 echo " "
8171                 ;;
8172         esac
8173 done
8174
8175 case "$usedtrace" in
8176 $define)
8177         case "$dtraceobject" in
8178         $define|true|[yY]*)
8179                 dtraceobject=$define
8180                 ;;
8181         ' '|'')
8182                 $dtrace -h -s ../perldtrace.d -o perldtrace.h
8183                 $cat >try.c <<EOM
8184 #include "perldtrace.h"
8185 int main(void) {
8186     PERL_LOADED_FILE("dummy");
8187     return 0;
8188 }
8189 EOM
8190                 dtraceobject=$undef
8191                 if $cc -c -o try.o $optimize $ccflags try.c \
8192                     && $dtrace -G -s ../perldtrace.d try.o ; then
8193                         dtraceobject=$define
8194                         echo "Your dtrace builds an object file"
8195                 fi
8196                 $rm -f try.c try.o perldtrace.o
8197                 ;;
8198         *) dtraceobject=$undef ;;
8199         esac
8200 esac
8201
8202 : See if we want extra modules installed
8203 echo " "
8204 case "$extras" in
8205 '') dflt='n';;
8206 *) dflt='y';;
8207 esac
8208 cat <<EOM
8209 Perl can be built with extra modules or bundles of modules which
8210 will be fetched from the CPAN and installed alongside Perl.
8211
8212 Notice that you will need access to the CPAN; either via the Internet,
8213 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8214 be asked later to configure the CPAN.pm module which will in turn do
8215 the installation of the rest of the extra modules or bundles.)
8216
8217 Notice also that if the modules require any external software such as
8218 libraries and headers (the libz library and the zlib.h header for the
8219 Compress::Zlib module, for example) you MUST have any such software
8220 already installed, this configuration process will NOT install such
8221 things for you.
8222
8223 If this doesn't make any sense to you, just accept the default '$dflt'.
8224 EOM
8225 rp='Install any extra modules (y or n)?'
8226 . ./myread
8227 case "$ans" in
8228 y|Y)
8229         cat <<EOM
8230
8231 Please list any extra modules or bundles to be installed from CPAN,
8232 with spaces between the names.  The names can be in any format the
8233 'install' command of CPAN.pm will understand.  (Answer 'none',
8234 without the quotes, to install no extra modules or bundles.)
8235 EOM
8236         rp='Extras?'
8237         dflt="$extras"
8238         . ./myread
8239         extras="$ans"
8240 esac
8241 case "$extras" in
8242 ''|'none')
8243         val=''
8244         $rm -f ../extras.lst
8245         ;;
8246 *)      echo "(Saving the list of extras for later...)"
8247         echo "$extras" > ../extras.lst
8248         val="'$extras'"
8249         ;;
8250 esac
8251 set extras
8252 eval $setvar
8253 echo " "
8254
8255 : determine where html pages for programs go
8256 set html1dir html1dir none
8257 eval $prefixit
8258 $cat <<EOM
8259
8260 If you wish to install html files for programs in $spackage, indicate
8261 the appropriate directory here.  To skip installing html files,
8262 answer "none".
8263 EOM
8264 case "$html1dir" in
8265 ''|none|$undef|' ') dflt=none ;;
8266 *) dflt=$html1dir ;;
8267 esac
8268 fn=dn+~
8269 rp="Directory for the main $spackage html pages?"
8270 . ./getfile
8271 prefixvar=html1dir
8272 . ./setprefixvar
8273 : Use ' ' for none so value is preserved next time through Configure
8274 $test X"$html1dir" = "X" && html1dir=' '
8275
8276 : determine where html pages for libraries and modules go
8277 set html3dir html3dir none
8278 eval $prefixit
8279 $cat <<EOM
8280
8281 If you wish to install html files for modules associated with $spackage,
8282 indicate the appropriate directory here.  To skip installing html files,
8283 answer "none".
8284 EOM
8285 : There is no obvious default.  If they have specified html1dir, then
8286 : try to key off that, possibly changing .../html1 into .../html3.
8287 case "$html3dir" in
8288 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8289 *) dflt=$html3dir ;;
8290 esac
8291 fn=dn+~
8292 rp="Directory for the $spackage module html pages?"
8293 . ./getfile
8294 prefixvar=html3dir
8295 . ./setprefixvar
8296 : Use ' ' for none so value is preserved next time through Configure
8297 $test X"$html3dir" = "X" && html3dir=' '
8298
8299 : determine whether to install perl also as /usr/bin/perl
8300
8301 echo " "
8302 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8303         $cat <<EOM
8304 Many scripts expect perl to be installed as /usr/bin/perl.
8305
8306 If you want to, I can install the perl you are about to compile
8307 as /usr/bin/perl (in addition to $bin/perl).
8308 EOM
8309         if test -f /usr/bin/perl; then
8310             $cat <<EOM
8311
8312 However, please note that because you already have a /usr/bin/perl,
8313 overwriting that with a new Perl would very probably cause problems.
8314 Therefore I'm assuming you don't want to do that (unless you insist).
8315
8316 EOM
8317             case "$installusrbinperl" in
8318             "$define"|[yY]*)    dflt='y';;
8319             *)                  dflt='n';;
8320             esac
8321         else
8322             $cat <<EOM
8323
8324 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8325
8326 EOM
8327             case "$installusrbinperl" in
8328             "$undef"|[nN]*)     dflt='n';;
8329             *)                  dflt='y';;
8330             esac
8331         fi
8332         rp="Do you want to install perl as /usr/bin/perl?"
8333         . ./myread
8334         case "$ans" in
8335         [yY]*)  val="$define";;
8336         *)      val="$undef" ;;
8337         esac
8338 else
8339         val="$undef"
8340 fi
8341 set installusrbinperl
8342 eval $setvar
8343
8344 : see if dlopen exists
8345 xxx_runnm="$runnm"
8346 xxx_ccflags="$ccflags"
8347 runnm=false
8348 : with g++ one needs -shared to get is-in-libc to work for dlopen
8349 case "$gccversion" in
8350 '')     ;;
8351 *Clang*)        ;;
8352 *)      case "$d_cplusplus" in
8353         "$define") ccflags="$ccflags -shared" ;;
8354         esac
8355         ;;
8356 esac
8357 set dlopen d_dlopen
8358 eval $inlibc
8359 runnm="$xxx_runnm"
8360 ccflags="$xxx_ccflags"
8361
8362 : see if this is a unistd.h system
8363 set unistd.h i_unistd
8364 eval $inhdr
8365
8366 : determine which dynamic loading, if any, to compile in
8367 echo " "
8368 dldir="ext/DynaLoader"
8369 case "$usedl" in
8370     $define|y|true)
8371         dflt='y'
8372         usedl="$define"
8373         ;;
8374     $undef|n|false)
8375         dflt='n'
8376         usedl="$undef"
8377         ;;
8378     *)
8379         dflt='n'
8380         case "$d_dlopen" in
8381             $define) dflt='y' ;;
8382         esac
8383         : Does a dl_xxx.xs file exist for this operating system
8384         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8385         ;;
8386 esac
8387 rp="Do you wish to use dynamic loading?"
8388 . ./myread
8389 usedl="$ans"
8390 bin_ELF="$undef"
8391 case "$ans" in
8392     y*) usedl="$define"
8393         case "$dlsrc" in
8394             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8395                     dflt="$dldir/dl_${osname}.xs"
8396                 elif $test "$d_dlopen" = "$define" ; then
8397                     dflt="$dldir/dl_dlopen.xs"
8398                 else
8399                     dflt=''
8400                 fi
8401                 ;;
8402             *)  dflt="$dldir/$dlsrc"
8403                 ;;
8404         esac
8405         echo "The following dynamic loading files are available:"
8406         : Can not go over to $dldir because getfile has path hard-coded in.
8407         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8408         rp="Source file to use for dynamic loading"
8409         fn="fne"
8410         gfpth="$src"
8411         . ./getfile
8412         usedl="$define"
8413         : emulate basename
8414         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8415
8416         $cat << EOM
8417
8418 Some systems may require passing special flags to $cc -c to
8419 compile modules that will be used to create a shared library.
8420 To use no flags, say "none".
8421
8422 EOM
8423         case "$cccdlflags" in
8424             '') case "$gccversion" in
8425                 '') case "$osname" in
8426                         hpux)   dflt='+z' ;;
8427                         irix*)  dflt='-KPIC' ;;
8428                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8429                         sunos)  dflt='-pic' ;;
8430                         *)      dflt='none' ;;
8431                     esac
8432                     ;;
8433                 *)  case "$osname" in
8434                         darwin) dflt='none' ;;
8435                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8436                         *)      dflt='-fpic' ;;
8437                     esac ;;
8438                 esac ;;
8439             ' ') dflt='none' ;;
8440             *)   dflt="$cccdlflags" ;;
8441         esac
8442
8443         case "$dflt" in
8444             none) dflt='' ;;
8445         esac
8446
8447         # If -Dsysroot was specified, now's the time to add it
8448         # to cccdlflags
8449         if test "X$sysroot" != X; then
8450             case "$gccversion" in
8451                 '') ;;
8452                 *)  case "$dflt" in
8453                         *sysroot*) ;;
8454                         'undef'|*)
8455                             dflt="$dflt --sysroot=$sysroot" ;;
8456                     esac
8457                     ;;
8458             esac
8459         fi
8460
8461         case "$dflt" in
8462             '') dflt='none';;
8463         esac
8464
8465         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8466         . ./myread
8467         case "$ans" in
8468             none) cccdlflags=' ' ;;
8469             *)    cccdlflags="$ans" ;;
8470         esac
8471
8472         cat << EOM
8473
8474 Some systems use ld to create libraries that can be dynamically loaded,
8475 while other systems (such as those using ELF) use $cc.
8476
8477 EOM
8478
8479 : Determine if this is ELF
8480         $cat >try.c <<EOM
8481 /* Test for whether ELF binaries are produced */
8482 #include <fcntl.h>
8483 #$i_stdlib I_STDLIB
8484 #ifdef I_STDLIB
8485 #include <stdlib.h>
8486 #endif
8487 #$i_unistd I_UNISTD
8488 #ifdef I_UNISTD
8489 #include <unistd.h>
8490 #endif
8491 int main() {
8492     char b[4];
8493     int i = open("a.out",O_RDONLY);
8494     if(i == -1)
8495         exit(1); /* fail */
8496     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8497         exit(0); /* succeed (yes, it is ELF) */
8498     exit(1); /* fail */
8499 }
8500 EOM
8501         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8502             bin_ELF="$define"
8503         fi
8504         $rm_try
8505
8506         case "$ld" in
8507             '') if $test $bin_ELF = "$define"; then
8508                     cat <<EOM
8509 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8510 EOM
8511                     dflt="$cc"
8512                 else
8513                     echo "I'll use ld to build dynamic libraries."
8514                     dflt='ld'
8515                 fi
8516                 ;;
8517             *)  dflt="$ld"
8518                 ;;
8519         esac
8520
8521         rp="What command should be used to create dynamic libraries?"
8522         . ./myread
8523         ld="$ans"
8524
8525         cat << EOM
8526
8527 Some systems may require passing special flags to $ld to create a
8528 library that can be dynamically loaded.  If your ld flags include
8529 -L/other/path options to locate libraries outside your loader's normal
8530 search path, you may need to specify those -L options here as well.  To
8531 use no flags, say "none".
8532
8533 EOM
8534         case "$lddlflags" in
8535             '') case "$osname" in
8536                     haiku) dflt='-shared' ;;
8537                     hpux) dflt='-b';
8538                           case "$gccversion" in
8539                               '') dflt="$dflt +vnocompatwarnings" ;;
8540                           esac
8541                           ;;
8542                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8543                     solaris) # See [perl #66604].
8544                             # On Solaris 11, gcc -m64 on amd64
8545                             # appears not to understand -G.  gcc versions at
8546                             # least as old as 3.4.3 support -shared, so just
8547                             # use that with Solaris 11 and later, but keep
8548                             # the old behavior for older Solaris versions.
8549                             case "$gccversion" in
8550                                 '') dflt='-G' ;;
8551                                 *)  case "$osvers" in
8552                                         2.?|2.10) dflt='-G' ;;
8553                                         *) dflt='-shared' ;;
8554                                     esac
8555                                     ;;
8556                             esac
8557                             ;;
8558                     sunos) dflt='-assert nodefinitions' ;;
8559                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8560                     *)     dflt='none' ;;
8561                 esac
8562                 ;;
8563             *) dflt="$lddlflags" ;;
8564         esac
8565
8566         : Only do this for gcc, since, for example, qcc has no concept
8567         : of --sysroot.
8568         if $test "X$sysroot" != X; then
8569             case "$gccversion" in
8570                 '') ;;
8571                 *)  dflt="$dflt --sysroot $sysroot" ;;
8572             esac
8573         fi
8574
8575         : Try to guess additional flags to pick up local libraries.
8576         : Be careful not to append to a plain 'none'
8577         case "$dflt" in
8578             none) dflt='' ;;
8579         esac
8580         for thisflag in $ldflags; do
8581             case "$thisflag" in
8582                 -L*|-R*|-Wl,-R*)
8583                     case " $dflt " in
8584                         *" $thisflag "*) ;;
8585                         *) dflt="$dflt $thisflag" ;;
8586                     esac
8587                     ;;
8588             esac
8589         done
8590
8591         case "$dflt" in
8592             ''|' ') dflt='none' ;;
8593         esac
8594
8595         case "$ldflags" in
8596             *-fstack-protector-strong*)
8597                 case "$dflt" in
8598                     *-fstack-protector-strong*) ;; # Don't add it again
8599                     *) dflt="$dflt -fstack-protector-strong" ;;
8600                 esac
8601                 ;;
8602             *-fstack-protector*)
8603                 case "$dflt" in
8604                     *-fstack-protector*) ;; # Don't add it again
8605                     *) dflt="$dflt -fstack-protector" ;;
8606                 esac
8607                 ;;
8608         esac
8609
8610         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8611         . ./myread
8612         case "$ans" in
8613             none) lddlflags=' ' ;;
8614             *) lddlflags="$ans" ;;
8615         esac
8616
8617         cat <<EOM
8618
8619 Some systems may require passing special flags to $cc to indicate that
8620 the resulting executable will use dynamic linking.  To use no flags,
8621 say "none".
8622
8623 EOM
8624         case "$ccdlflags" in
8625             '') case "$osname" in
8626                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8627                     sunos)             dflt='none'   ;;
8628                     *)                 dflt='none'   ;;
8629                 esac ;;
8630             ' ') dflt='none' ;;
8631             *)   dflt="$ccdlflags" ;;
8632         esac
8633         rp="Any special flags to pass to $cc to use dynamic linking?"
8634         . ./myread
8635         case "$ans" in
8636             none) ccdlflags=' ' ;;
8637             *)    ccdlflags="$ans" ;;
8638         esac
8639         ;;
8640
8641     *)  usedl="$undef"
8642         ld='ld'
8643         dlsrc='dl_none.xs'
8644         lddlflags=''
8645         ccdlflags=''
8646         ;;
8647 esac
8648
8649 ld_can_script="$undef"
8650 case "$bin_ELF$usedl" in
8651     $define$define)
8652         # Abuse try.h and a.out names for neat cleanup
8653         $cat >try.c <<EOM
8654 void foo() {}
8655 void bar() {}
8656 EOM
8657         $cat >try.h <<EOM
8658 LIBTEST_42 {
8659  global:
8660   foo;
8661  local: *;
8662  };
8663 EOM
8664         if $cc $cccdlflags $ccdlflags $ccflags \
8665                $ldflags $lddlflags -o a.out try.c \
8666                -Wl,--version-script=try.h >/dev/null 2>&1 \
8667            &&  $test -s a.out ; then
8668             echo "ld supports scripting" >&4
8669             ld_can_script="$define"
8670         else
8671             echo "ld does not support scripting" >&4
8672         fi
8673         $rm_try
8674         ;;
8675 esac
8676
8677 : Do we want a shared libperl?
8678 also=''
8679 case "$usedl" in
8680 $undef)
8681         # No dynamic loading being used, so don't bother even to prompt.
8682         useshrplib='false'
8683         ;;
8684 *)      case "$useshrplib" in
8685         '')     case "$osname" in
8686                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8687                         dflt=y
8688                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8689                         ;;
8690                 *)      dflt=n
8691                         ;;
8692                 esac
8693                 ;;
8694         $define|true|[Yy]*)
8695                 dflt=y
8696                 ;;
8697         *)      dflt=n
8698                 ;;
8699         esac
8700         $cat << EOM
8701
8702 The perl executable is normally obtained by linking perlmain.c with
8703 libperl${_a}, any static extensions (usually just DynaLoader), and
8704 any other libraries needed on this system (such as -lm, etc.).  Since
8705 your system supports dynamic loading, it is probably possible to build
8706 a shared libperl.$so.  If you will have more than one executable linked
8707 to libperl.$so, this will significantly reduce the size of each
8708 executable, but it may have a noticeable effect on performance.  The
8709 default is probably sensible for your system.
8710 $also
8711
8712 EOM
8713         rp="Build a shared libperl.$so (y/n)"
8714         . ./myread
8715         case "$ans" in
8716         true|$define|[Yy]*)
8717                 useshrplib='true'  ;;
8718         *)      useshrplib='false' ;;
8719         esac
8720         ;;
8721 esac
8722
8723 case "$useshrplib" in
8724 true)
8725         case "$userelocatableinc" in
8726         true|define)
8727                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8728                 echo "See INSTALL for an explanation why that won't work." >&4
8729                 exit 4
8730                 ;;
8731         esac
8732         case "$libperl" in
8733         '')
8734                 # Figure out a good name for libperl.so.  Since it gets stored in
8735                 # a version-specific architecture-dependent library, the version
8736                 # number isn't really that important, except for making cc/ld happy.
8737                 #
8738                 # A name such as libperl.so.10.1
8739                 majmin="libperl.$so.$patchlevel.$subversion"
8740                 # A name such as libperl.so.100
8741                 majonly=`echo $patchlevel $subversion |
8742                         $awk '{printf "%d%02d", $1, $2}'`
8743                 majonly=libperl.$so.$majonly
8744                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8745                 # rely on figuring it out from the naming of libc.
8746                 case "${osname}${osvers}" in
8747                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8748                         dflt=libperl.$so
8749                         ;;
8750                 cygwin*) # ld links now against the dll directly
8751                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8752                         majonly=`echo $patchlevel $subversion |
8753                                 $awk '{printf "%03d%03d", $1, $2}'`
8754                         majonly=cygperl5.$majonly.$so
8755                         dflt=$majmin
8756                         ;;
8757                 *)      # Try to guess based on whether libc has major.minor.
8758                         case "$libc" in
8759                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8760                         *libc.$so.[0-9]*) dflt=$majonly ;;
8761                         *)      dflt=libperl.$so ;;
8762                         esac
8763                         ;;
8764                 esac
8765                 ;;
8766         *)      dflt=$libperl
8767                 ;;
8768         esac
8769         cat << EOM
8770
8771 I need to select a good name for the shared libperl.  If your system uses
8772 library names with major and minor numbers, then you might want something
8773 like $majmin.  Alternatively, if your system uses a single version
8774 number for shared libraries, then you might want to use $majonly.
8775 Or, your system might be quite happy with a simple libperl.$so.
8776
8777 Since the shared libperl will get installed into a version-specific
8778 architecture-dependent directory, the version number of the shared perl
8779 library probably isn't important, so the default should be o.k.
8780
8781 EOM
8782         rp='What name do you want to give to the shared libperl?'
8783         . ./myread
8784         libperl=$ans
8785         echo "Ok, I'll use $libperl"
8786         ;;
8787 *)
8788         libperl="libperl${_a}"
8789         ;;
8790 esac
8791
8792 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8793 case "$shrpdir" in
8794 '') ;;
8795 *)      $cat >&4 <<EOM
8796 WARNING:  Use of the shrpdir variable for the installation location of
8797 the shared $libperl is not supported.  It was never documented and
8798 will not work in this version.  Let me (perlbug@perl.org)
8799 know of any problems this may cause.
8800
8801 EOM
8802         case "$shrpdir" in
8803         "$archlibexp/CORE")
8804                 $cat >&4 <<EOM
8805 But your current setting of $shrpdir is
8806 the default anyway, so it's harmless.
8807 EOM
8808                 ;;
8809         *)
8810                 $cat >&4 <<EOM
8811 Further, your current attempted setting of $shrpdir
8812 conflicts with the value of $archlibexp/CORE
8813 that installperl will use.
8814 EOM
8815                 ;;
8816         esac
8817         ;;
8818 esac
8819
8820 # How will the perl executable find the installed shared $libperl?
8821 # Add $xxx to ccdlflags.
8822 # If we can't figure out a command-line option, use $shrpenv to
8823 # set env LD_RUN_PATH.  The main perl makefile uses this.
8824 shrpdir=$archlibexp/CORE
8825 xxx=''
8826 tmp_shrpenv=''
8827 if "$useshrplib"; then
8828     case "$osname" in
8829         aix)
8830                 # We'll set it in Makefile.SH...
8831                 ;;
8832         solaris)
8833                 xxx="-R $shrpdir"
8834                 ;;
8835         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8836                 xxx="-Wl,-R$shrpdir"
8837                 ;;
8838         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8839                 xxx="-Wl,-rpath,$shrpdir"
8840                 ;;
8841         hpux*)
8842                 # hpux doesn't like the default, either.
8843                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8844                 ;;
8845         cygwin)
8846                 # cygwin needs only ldlibpth
8847                 ;;
8848         *)
8849                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8850                 ;;
8851         esac
8852         case "$xxx" in
8853         '') ;;
8854         *)
8855                 # Only add $xxx if it isn't already in ccdlflags.
8856                 case " $ccdlflags " in
8857                 *" $xxx "*)     ;;
8858                 *)      ccdlflags="$ccdlflags $xxx"
8859                         cat <<EOM >&4
8860
8861 Adding $xxx to the flags
8862 passed to $ld so that the perl executable will find the
8863 installed shared $libperl.
8864
8865 EOM
8866                         ;;
8867                 esac
8868                 ;;
8869         esac
8870 fi
8871 # Fix ccdlflags in AIX for building external extensions.
8872 # (For building Perl itself bare -bE:perl.exp is needed,
8873 #  Makefile.SH takes care of this.)
8874 case "$osname" in
8875 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8876 esac
8877 # Respect a hint or command-line value.
8878 case "$shrpenv" in
8879 '') shrpenv="$tmp_shrpenv" ;;
8880 esac
8881 case "$ldlibpthname" in
8882 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8883 none)   ldlibpthname='' ;;
8884 esac
8885
8886 : determine where manual pages are on this system
8887 echo " "
8888 case "$sysman" in
8889 '')
8890         syspath='/usr/share/man/man1 /usr/man/man1'
8891         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8892         syspath="$syspath /usr/man/u_man/man1"
8893         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8894         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8895         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8896         sysman=`./loc . /usr/man/man1 $syspath`
8897         ;;
8898 esac
8899 if $test -d "$sysman"; then
8900         echo "System manual is in $sysman." >&4
8901 else
8902         echo "Could not find manual pages in source form." >&4
8903 fi
8904
8905 : determine where manual pages go
8906 set man1dir man1dir none
8907 eval $prefixit
8908 $cat <<EOM
8909
8910 $spackage has manual pages available in source form.
8911 EOM
8912 case "$nroff" in
8913 nroff)
8914         echo "However, you don't have nroff, so they're probably useless to you."
8915         case "$man1dir" in
8916         '') man1dir="none";;
8917         esac;;
8918 esac
8919 echo "If you don't want the manual sources installed, answer 'none'."
8920 case "$man1dir" in
8921 ' ') dflt=none
8922         ;;
8923 '')
8924         lookpath="$prefixexp/share/man/man1"
8925         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8926         lookpath="$lookpath $prefixexp/man/p_man/man1"
8927         lookpath="$lookpath $prefixexp/man/u_man/man1"
8928         lookpath="$lookpath $prefixexp/man/man.1"
8929         case "$sysman" in
8930         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8931         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8932         esac
8933         set dflt
8934         eval $prefixup
8935         ;;
8936 *)  dflt="$man1dir"
8937         ;;
8938 esac
8939 echo " "
8940 fn=dn+~
8941 rp="Where do the main $spackage manual pages (source) go?"
8942 . ./getfile
8943 if $test "X$man1direxp" != "X$ansexp"; then
8944         installman1dir=''
8945 fi
8946 prefixvar=man1dir
8947 . ./setprefixvar
8948
8949 case "$man1dir" in
8950 '')     man1dir=' '
8951         installman1dir='';;
8952 esac
8953
8954 : What suffix to use on installed man pages
8955
8956 case "$man1dir" in
8957 ' ')
8958         man1ext='0'
8959         ;;
8960 *)
8961         rp="What suffix should be used for the main $spackage man pages?"
8962         case "$man1ext" in
8963         '')     case "$man1dir" in
8964                 *1)  dflt=1 ;;
8965                 *1p) dflt=1p ;;
8966                 *1pm) dflt=1pm ;;
8967                 *l) dflt=l;;
8968                 *n) dflt=n;;
8969                 *o) dflt=o;;
8970                 *p) dflt=p;;
8971                 *C) dflt=C;;
8972                 *L) dflt=L;;
8973                 *L1) dflt=L1;;
8974                 *) dflt=1;;
8975                 esac
8976                 ;;
8977         *)      dflt="$man1ext";;
8978         esac
8979         . ./myread
8980         man1ext="$ans"
8981         ;;
8982 esac
8983
8984 : see if we can have long filenames
8985 echo " "
8986 first=123456789abcdef
8987 $rm -f $first
8988 if (echo hi >$first) 2>/dev/null; then
8989         if $test -f 123456789abcde; then
8990                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8991                 val="$undef"
8992         else
8993                 echo 'You can have filenames longer than 14 characters.'>&4
8994                 val="$define"
8995         fi
8996 else
8997         $cat <<'EOM'
8998 You can't have filenames longer than 14 chars.
8999 You can't even think about them!
9000 EOM
9001         val="$undef"
9002 fi
9003 set d_flexfnam
9004 eval $setvar
9005 $rm -rf 123456789abcde*
9006
9007 : determine where library module manual pages go
9008 set man3dir man3dir none
9009 eval $prefixit
9010 $cat <<EOM
9011
9012 $spackage has manual pages for many of the library modules.
9013 EOM
9014
9015 case "$nroff" in
9016 nroff)
9017         $cat <<'EOM'
9018 However, you don't have nroff, so they're probably useless to you.
9019 EOM
9020         case "$man3dir" in
9021         '') man3dir="none";;
9022         esac;;
9023 esac
9024
9025 case "$d_flexfnam" in
9026 undef)
9027         $cat <<'EOM'
9028 However, your system can't handle the long file names like File::Basename.3.
9029 EOM
9030         case "$man3dir" in
9031         '') man3dir="none";;
9032         esac;;
9033 esac
9034
9035 echo "If you don't want the manual sources installed, answer 'none'."
9036 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9037 case "$man3dir" in
9038 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9039         if $test -d "$privlib/man/man3"; then
9040                 cat <<EOM >&4
9041
9042 WARNING:  Previous versions of perl installed man3 pages into
9043 $privlib/man/man3.  This version will suggest a
9044 new default of $dflt.
9045 EOM
9046                 tdflt=$dflt
9047                 dflt='n'
9048                 rp='Do you wish to preserve the old behavior?(y/n)'
9049                 . ./myread
9050                 case "$ans" in
9051                 y*) dflt="$privlib/man/man3" ;;
9052                 *)  dflt=$tdflt ;;
9053                 esac
9054     fi
9055         ;;
9056 *)      dflt="$man3dir" ;;
9057 esac
9058 case "$dflt" in
9059 ' ') dflt=none ;;
9060 esac
9061 echo " "
9062 fn=dn+~
9063 rp="Where do the $package library man pages (source) go?"
9064 . ./getfile
9065 prefixvar=man3dir
9066 . ./setprefixvar
9067
9068 case "$man3dir" in
9069 '')     man3dir=' '
9070         installman3dir='';;
9071 esac
9072
9073 : What suffix to use on installed man pages
9074 case "$man3dir" in
9075 ' ')
9076         man3ext='0'
9077         ;;
9078 *)
9079         rp="What suffix should be used for the $package library man pages?"
9080         case "$man3ext" in
9081         '')     case "$man3dir" in
9082                 *3)  dflt=3 ;;
9083                 *3p) dflt=3p ;;
9084                 *3pm) dflt=3pm ;;
9085                 *l) dflt=l;;
9086                 *n) dflt=n;;
9087                 *o) dflt=o;;
9088                 *p) dflt=p;;
9089                 *C) dflt=C;;
9090                 *L) dflt=L;;
9091                 *L3) dflt=L3;;
9092                 *) dflt=3;;
9093                 esac
9094                 ;;
9095         *)      dflt="$man3ext";;
9096         esac
9097         . ./myread
9098         man3ext="$ans"
9099         ;;
9100 esac
9101
9102 : see if we have to deal with yellow pages, now NIS.
9103 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9104         case "$hostcat" in
9105         nidump*) ;;
9106         *)
9107                 case "$hostcat" in
9108                 *ypcat*) dflt=y;;
9109                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9110                                 dflt=y
9111                         else
9112                                 dflt=n
9113                         fi;;
9114                 *) dflt=n;;
9115                 esac
9116                 echo " "
9117                 rp='Are you getting the hosts file via yellow pages?'
9118                 . ./myread
9119                 case "$ans" in
9120                 y*) hostcat='ypcat hosts';;
9121                 *) hostcat='cat /etc/hosts';;
9122                 esac
9123                 ;;
9124         esac
9125 fi
9126 case "$hostcat" in
9127 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9128 esac
9129 case "$groupcat" in
9130 '') test -f /etc/group && groupcat='cat /etc/group';;
9131 esac
9132 case "$passcat" in
9133 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9134 esac
9135
9136 : now get the host name
9137 echo " "
9138 echo "Figuring out host name..." >&4
9139 case "$myhostname" in
9140 '') cont=true
9141         echo 'Maybe "hostname" will work...'
9142         if tans=`sh -c hostname 2>&1` ; then
9143                 myhostname=$tans
9144                 phostname=hostname
9145                 cont=''
9146         fi
9147         ;;
9148 *) cont='';;
9149 esac
9150 if $test "$cont"; then
9151         if ./xenix; then
9152                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9153                 if tans=`cat /etc/systemid 2>&1` ; then
9154                         myhostname=$tans
9155                         phostname='cat /etc/systemid'
9156                         echo "Whadyaknow.  Xenix always was a bit strange..."
9157                         cont=''
9158                 fi
9159         elif $test -r /etc/systemid; then
9160                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9161         fi
9162 fi
9163 if $test "$cont"; then
9164         echo 'No, maybe "uuname -l" will work...'
9165         if tans=`sh -c 'uuname -l' 2>&1` ; then
9166                 myhostname=$tans
9167                 phostname='uuname -l'
9168         else
9169                 echo 'Strange.  Maybe "uname -n" will work...'
9170                 if tans=`sh -c 'uname -n' 2>&1` ; then
9171                         myhostname=$tans
9172                         phostname='uname -n'
9173                 else
9174                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9175                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9176                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9177                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9178                         else
9179                                 case "$myhostname" in
9180                                 '') echo "Does this machine have an identity crisis or something?"
9181                                         phostname='';;
9182                                 *)
9183                                         echo "Well, you said $myhostname before..."
9184                                         phostname='echo $myhostname';;
9185                                 esac
9186                         fi
9187                 fi
9188         fi
9189 fi
9190 case "$myhostname" in
9191 '') myhostname=noname ;;
9192 esac
9193 : you do not want to know about this
9194 set $myhostname
9195 myhostname=$1
9196
9197 : verify guess
9198 if $test "$myhostname" ; then
9199         dflt=y
9200         rp='Your host name appears to be "'$myhostname'".'" Right?"
9201         . ./myread
9202         case "$ans" in
9203         y*) ;;
9204         *) myhostname='';;
9205         esac
9206 fi
9207
9208 : bad guess or no guess
9209 while $test "X$myhostname" = X ; do
9210         dflt=''
9211         rp="Please type the (one word) name of your host:"
9212         . ./myread
9213         myhostname="$ans"
9214 done
9215
9216 : translate upper to lower if necessary
9217 case "$myhostname" in
9218 *[A-Z]*)
9219         echo "(Normalizing case in your host name)"
9220         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9221         ;;
9222 esac
9223
9224 case "$myhostname" in
9225 *.*)
9226         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9227         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9228         echo "(Trimming domain name from host name--host name is now $myhostname)"
9229         ;;
9230 *) case "$mydomain" in
9231         '')
9232                 {
9233                         test "X$hostcat" = "Xypcat hosts" &&
9234                         ypmatch "$myhostname" hosts 2>/dev/null |\
9235                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9236                         $test -s hosts
9237                 } || {
9238                         test "X$hostcat" != "X" &&
9239                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9240                                         /[       ]$myhostname[  . ]/p" > hosts
9241                 }
9242                 tmp_re="[       . ]"
9243                 if $test -f hosts; then
9244                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9245                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9246                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9247                                 hosts | $sort | $uniq | \
9248                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9249                         case `$echo X$dflt` in
9250                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9251                                 dflt=.
9252                                 ;;
9253                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9254                                 ;;
9255                         esac
9256                 else
9257                         echo "(I cannot locate a hosts database anywhere)"
9258                         dflt=.
9259                 fi
9260                 case "$dflt" in
9261                 .)
9262                         tans=`./loc resolv.conf X /etc /usr/etc`
9263                         if $test -f "$tans"; then
9264                                 echo "(Attempting domain name extraction from $tans)"
9265                                 dflt=.`$sed -n -e 's/   / /g' \
9266                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9267                                   -e 1q 2>/dev/null`
9268                                 case "$dflt" in
9269                                 .) dflt=.`$sed -n -e 's/        / /g' \
9270                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9271                                      -e 1q 2>/dev/null`
9272                                         ;;
9273                                 esac
9274                         fi
9275                         ;;
9276                 esac
9277                 case "$dflt" in
9278                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9279                         dflt=.`sh -c domainname 2>/dev/null`
9280                         case "$dflt" in
9281                         '') dflt='.';;
9282                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9283                         esac
9284                         ;;
9285                 esac
9286                 case "$dflt$osname" in
9287                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9288                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9289                         ;;
9290                 esac
9291                 case "$dflt" in
9292                 .) echo "(Lost all hope -- silly guess then)"
9293                         dflt='.nonet'
9294                         ;;
9295                 esac
9296                 $rm -f hosts
9297                 ;;
9298         *) dflt="$mydomain";;
9299         esac;;
9300 esac
9301 echo " "
9302 rp="What is your domain name?"
9303 . ./myread
9304 tans="$ans"
9305 case "$ans" in
9306 '') ;;
9307 .*) ;;
9308 *) tans=".$tans";;
9309 esac
9310 mydomain="$tans"
9311
9312 : translate upper to lower if necessary
9313 case "$mydomain" in
9314 *[A-Z]*)
9315         echo "(Normalizing case in your domain name)"
9316         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9317         ;;
9318 esac
9319
9320 : a little sanity check here
9321 case "$phostname" in
9322 '') ;;
9323 *)
9324         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9325         $myhostname$mydomain|$myhostname) ;;
9326         *)
9327                 case "$phostname" in
9328                 sed*)
9329                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9330                         ;;
9331                 *)
9332                         echo "(That doesn't agree with your $phostname command, by the way.)"
9333                         ;;
9334                 esac
9335         ;;
9336         esac
9337         ;;
9338 esac
9339
9340 : determine the e-mail address of the user who is running us
9341 $cat <<EOM
9342
9343 I need to get your e-mail address in Internet format if possible, i.e.
9344 something like user@host.domain. Please answer accurately since I have
9345 no easy means to double check it. The default value provided below
9346 is most probably close to reality but may not be valid from outside
9347 your organization...
9348
9349 EOM
9350 cont=x
9351 while test "$cont"; do
9352         case "$MAILDOMAIN" in
9353         '')
9354                 if $test -s /etc/mailname; then
9355                         maildomain=`$cat /etc/mailname`
9356                 else
9357                         maildomain="$myhostname$mydomain"
9358                 fi
9359                 ;;
9360         *)  maildomain="$MAILDOMAIN";;
9361         esac
9362         case "$cf_email" in
9363         '') dflt="$cf_by@$maildomain";;
9364         *)  dflt="$cf_email";;
9365         esac
9366         rp='What is your e-mail address?'
9367         . ./myread
9368         cf_email="$ans"
9369         case "$cf_email" in
9370         *@*.*) cont='' ;;
9371         *)
9372                 rp='Address does not look like an Internet one.  Use it anyway?'
9373                 case "$fastread" in
9374                 yes) dflt=y ;;
9375                 *) dflt=n ;;
9376                 esac
9377                 . ./myread
9378                 case "$ans" in
9379                 y*) cont='' ;;
9380                 *) echo " " ;;
9381                 esac
9382                 ;;
9383         esac
9384 done
9385
9386 : Ask e-mail of administrator
9387 $cat <<EOM
9388
9389 If you or somebody else will be maintaining perl at your site, please
9390 fill in the correct e-mail address here so that they may be contacted
9391 if necessary. Currently, the "perlbug" program included with perl
9392 will send mail to this address in addition to perlbug@perl.org. You may
9393 enter "none" for no administrator.
9394
9395 EOM
9396 case "$perladmin" in
9397 '') dflt="$cf_email";;
9398 *) dflt="$perladmin";;
9399 esac
9400 rp='Perl administrator e-mail address'
9401 . ./myread
9402 perladmin="$ans"
9403
9404 : determine whether to only install version-specific parts.
9405 echo " "
9406 $cat <<EOM
9407 Do you want to install only the version-specific parts of the perl
9408 distribution?  Usually you do *not* want to do this.
9409 EOM
9410 case "$versiononly" in
9411 "$define"|[Yy]*|true) dflt='y' ;;
9412 *) dflt='n';
9413 esac
9414 rp="Do you want to install only the version-specific parts of perl?"
9415 . ./myread
9416 case "$ans" in
9417 [yY]*)  val="$define";;
9418 *)      val="$undef" ;;
9419 esac
9420 set versiononly
9421 eval $setvar
9422
9423 case "$versiononly" in
9424 "$define") inc_version_list=''
9425            inc_version_list_init=0
9426            ;;
9427 esac
9428
9429 : figure out how to guarantee perl startup
9430 : XXX Note that this currently takes advantage of the bug that binexp ignores
9431 :     the Configure -Dinstallprefix setting, which in turn means that under
9432 :     relocatable @INC, initialinstalllocation is what binexp started as.
9433 case "$startperl" in
9434 '')
9435         case "$sharpbang" in
9436         *!)
9437                 $cat <<EOH
9438
9439 I can use the #! construct to start perl on your system. This will
9440 make startup of perl scripts faster, but may cause problems if you
9441 want to share those scripts and perl is not in a standard place
9442 ($initialinstalllocation/perl) on all your platforms. The alternative
9443 is to force a shell by starting the script with a single ':' character.
9444
9445 EOH
9446                 case "$versiononly" in
9447                 "$define")      dflt="$initialinstalllocation/perl$version";;
9448                 *)              dflt="$initialinstalllocation/perl";;
9449                 esac
9450                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9451                 . ./myread
9452                 case "$ans" in
9453                 none)   startperl=": # use perl";;
9454                 *)      startperl="#!$ans"
9455                         if $test 30 -lt `echo "$ans" | wc -c`; then
9456                                 $cat >&4 <<EOM
9457
9458 WARNING:  Some systems limit the #! command to 32 characters.
9459 If you experience difficulty running Perl scripts with #!, try
9460 installing Perl in a directory with a shorter pathname.
9461
9462 EOM
9463                         fi ;;
9464                 esac
9465                 ;;
9466         *) startperl=": # use perl"
9467                 ;;
9468         esac
9469         ;;
9470 esac
9471 echo "I'll use $startperl to start perl scripts."
9472
9473 : figure best path for perl in scripts
9474 case "$perlpath" in
9475 '')
9476         case "$versiononly" in
9477         "$define")      perlpath="$initialinstalllocation/perl$version";;
9478         *)              perlpath="$initialinstalllocation/perl";;
9479         esac
9480         case "$startperl" in
9481         *!*) ;;
9482         *)
9483                 $cat <<EOH
9484
9485 I will use the "eval 'exec'" idiom to start Perl on your system.
9486 I can use the full path of your Perl binary for this purpose, but
9487 doing so may cause problems if you want to share those scripts and
9488 Perl is not always in a standard place ($initialinstalllocation/perl).
9489
9490 EOH
9491                 dflt="$initialinstalllocation/perl"
9492                 rp="What path shall I use in \"eval 'exec'\"?"
9493                 . ./myread
9494                 perlpath="$ans"
9495                 ;;
9496         esac
9497         ;;
9498 esac
9499 case "$startperl" in
9500 *!*)    ;;
9501 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9502 esac
9503
9504 : determine where public executable scripts go
9505 set scriptdir scriptdir
9506 eval $prefixit
9507 case "$scriptdir" in
9508 '')
9509         dflt="$bin"
9510         : guess some guesses
9511         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9512         $test -d /usr/share/bin     && dflt=/usr/share/bin
9513         $test -d /usr/local/script  && dflt=/usr/local/script
9514         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9515         $test -d $prefixexp/script  && dflt=$prefixexp/script
9516         set dflt
9517         eval $prefixup
9518         ;;
9519 *)  dflt="$scriptdir"
9520         ;;
9521 esac
9522 $cat <<EOM
9523
9524 Some installations have a separate directory just for executable scripts so
9525 that they can mount it across multiple architectures but keep the scripts in
9526 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9527 Or you might just lump your scripts in with all your other executables.
9528
9529 EOM
9530 fn=d~
9531 rp='Where do you keep publicly executable scripts?'
9532 . ./getfile
9533 if $test "X$ansexp" != "X$scriptdirexp"; then
9534         installscript=''
9535 fi
9536 installscriptdir=''
9537 prefixvar=scriptdir
9538 . ./setprefixvar
9539 : A little fix up for an irregularly named variable.
9540 installscript="$installscriptdir"
9541
9542 : determine where add-on public executables go
9543 case "$sitebin" in
9544 '')     dflt=$siteprefix/bin ;;
9545 *)      dflt=$sitebin ;;
9546 esac
9547 fn=d~
9548 rp='Pathname where the add-on public executables should be installed?'
9549 . ./getfile
9550 prefixvar=sitebin
9551 . ./setprefixvar
9552
9553 : determine where add-on html pages go
9554 : There is no standard location, so try to copy the previously-selected
9555 : directory structure for the core html pages.
9556 case "$sitehtml1dir" in
9557 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9558 *)     dflt=$sitehtml1dir ;;
9559 esac
9560 case "$dflt" in
9561 ''|' ') dflt=none ;;
9562 esac
9563 fn=dn+~
9564 rp='Pathname where the site-specific html pages should be installed?'
9565 . ./getfile
9566 prefixvar=sitehtml1dir
9567 . ./setprefixvar
9568
9569 : determine where add-on library html pages go
9570 : There is no standard location, so try to copy the previously-selected
9571 : directory structure for the core html pages.
9572 case "$sitehtml3dir" in
9573 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9574 *)     dflt=$sitehtml3dir ;;
9575 esac
9576 case "$dflt" in
9577 ''|' ') dflt=none ;;
9578 esac
9579 fn=dn+~
9580 rp='Pathname where the site-specific library html pages should be installed?'
9581 . ./getfile
9582 prefixvar=sitehtml3dir
9583 . ./setprefixvar
9584
9585 : determine where add-on manual pages go
9586 case "$siteman1dir" in
9587 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9588 *)      dflt=$siteman1dir ;;
9589 esac
9590 case "$dflt" in
9591 ''|' ') dflt=none ;;
9592 esac
9593 fn=dn+~
9594 rp='Pathname where the site-specific manual pages should be installed?'
9595 . ./getfile
9596 prefixvar=siteman1dir
9597 . ./setprefixvar
9598
9599 : determine where add-on library man pages go
9600 case "$siteman3dir" in
9601 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9602 *)      dflt=$siteman3dir ;;
9603 esac
9604 case "$dflt" in
9605 ''|' ') dflt=none ;;
9606 esac
9607 fn=dn+~
9608 rp='Pathname where the site-specific library manual pages should be installed?'
9609 . ./getfile
9610 prefixvar=siteman3dir
9611 . ./setprefixvar
9612
9613 : determine where add-on public executable scripts go
9614 case "$sitescript" in
9615 '')     dflt=$siteprefix/script
9616         $test -d $dflt || dflt=$sitebin ;;
9617 *)  dflt="$sitescript" ;;
9618 esac
9619 fn=d~+
9620 rp='Pathname where add-on public executable scripts should be installed?'
9621 . ./getfile
9622 prefixvar=sitescript
9623 . ./setprefixvar
9624
9625 : see if backtrace exists
9626 set backtrace d_backtrace
9627 eval $inlibc
9628
9629 : add flags if using c backtrace
9630 case "$usecbacktrace" in
9631   "") usecbacktrace=$undef ;;
9632   [yY]*|true|$define)
9633     case "$d_backtrace" in
9634       [yY]*|true|$define)
9635         case " $ccflags " in
9636           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9637           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9638           esac
9639         ;;
9640       *)
9641         echo "This system does not support backtrace" >&4
9642         usecbacktrace=$undef
9643         ;;
9644       esac
9645     ;;
9646   esac
9647
9648 : Check if faststdio is requested and available
9649 case "$usefaststdio" in
9650 $define|true|[yY]*|'')
9651         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9652         case "$xversion" in
9653         [68])   dflt='y' ;;
9654         *)      dflt='n' ;;
9655         esac
9656         ;;
9657 *) dflt='n';;
9658 esac
9659 cat <<EOM
9660
9661 Perl can be built to use 'fast stdio', which means using the stdio
9662 library but also directly manipulating the stdio buffers to enable
9663 faster I/O.  Using stdio is better for backward compatibility (especially
9664 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9665 interface has been preferred instead of stdio.
9666
9667 If this doesn't make any sense to you, just accept the default '$dflt'.
9668 EOM
9669 rp='Use the "fast stdio" if available?'
9670 . ./myread
9671 case "$ans" in
9672 y|Y)    val="$define" ;;
9673 *)      val="$undef" ;;
9674 esac
9675 set usefaststdio
9676 eval $setvar
9677
9678
9679 : define an is-a-typedef? function
9680 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9681 case "$inclist" in
9682 "") inclist="sys/types.h";;
9683 esac;
9684 eval "varval=\$$var";
9685 case "$varval" in
9686 "")
9687         $rm -f temp.c;
9688         for inc in $inclist; do
9689                 echo "#include <$inc>" >>temp.c;
9690         done;
9691         echo "#ifdef $type" >> temp.c;
9692         echo "printf(\"We have $type\");" >> temp.c;
9693         echo "#endif" >> temp.c;
9694         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9695         if $contains $type temp.E >/dev/null 2>&1; then
9696                 eval "$var=\$type";
9697         else
9698                 eval "$var=\$def";
9699         fi;
9700         $rm -f temp.?;;
9701 *) eval "$var=\$varval";;
9702 esac'
9703
9704 : define an is-a-typedef? function that prompts if the type is not available.
9705 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9706 case "$inclist" in
9707 "") inclist="sys/types.h";;
9708 esac;
9709 eval "varval=\$$var";
9710 case "$varval" in
9711 "")
9712         $rm -f temp.c;
9713         for inc in $inclist; do
9714                 echo "#include <$inc>" >>temp.c;
9715         done;
9716         echo "#ifdef $type" >> temp.c;
9717         echo "printf(\"We have $type\");" >> temp.c;
9718         echo "#endif" >> temp.c;
9719         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9720         echo " " ;
9721         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9722         if $contains $type temp.E >/dev/null 2>&1; then
9723                 echo "$type found." >&4;
9724                 eval "$var=\$type";
9725         else
9726                 echo "$type NOT found." >&4;
9727                 dflt="$def";
9728                 . ./myread ;
9729                 eval "$var=\$ans";
9730         fi;
9731         $rm -f temp.?;;
9732 *) eval "$var=\$varval";;
9733 esac'
9734
9735 : see what type lseek is declared as in the kernel
9736 rp="What is the type used for lseek's offset on this system?"
9737 set off_t lseektype long stdio.h sys/types.h
9738 eval $typedef_ask
9739
9740 echo " "
9741 echo "Checking to see how big your file offsets are..." >&4
9742 $cat >try.c <<EOCP
9743 #include <sys/types.h>
9744 #include <stdio.h>
9745 int main()
9746 {
9747     printf("%d\n", (int)sizeof($lseektype));
9748     return(0);
9749 }
9750 EOCP
9751 set try
9752 if eval $compile_ok; then
9753         lseeksize=`$run ./try`
9754         echo "Your file offsets are $lseeksize bytes long."
9755 else
9756         dflt=$longsize
9757         echo " "
9758         echo "(I can't seem to compile the test program.  Guessing...)"
9759         rp="What is the size of your file offsets (in bytes)?"
9760         . ./myread
9761         lseeksize="$ans"
9762 fi
9763 $rm_try
9764
9765 : see what type file positions are declared as in the library
9766 rp="What is the type for file position used by fsetpos()?"
9767 set fpos_t fpostype long stdio.h sys/types.h
9768 eval $typedef_ask
9769
9770 : Check size for Fpos_t
9771 echo " "
9772 case "$fpostype" in
9773 *_t) zzz="$fpostype"    ;;
9774 *)   zzz="fpos_t"       ;;
9775 esac
9776 echo "Checking the size of $zzz..." >&4
9777 cat > try.c <<EOCP
9778 #include <sys/types.h>
9779 #include <stdio.h>
9780 #$i_stdlib I_STDLIB
9781 #ifdef I_STDLIB
9782 #include <stdlib.h>
9783 #endif
9784 int main() {
9785     printf("%d\n", (int)sizeof($fpostype));
9786     exit(0);
9787 }
9788 EOCP
9789 set try
9790 if eval $compile_ok; then
9791         yyy=`$run ./try`
9792         case "$yyy" in
9793         '')     fpossize=4
9794                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9795                 ;;
9796         *)      fpossize=$yyy
9797                 echo "Your $zzz is $fpossize bytes long."
9798                 ;;
9799         esac
9800 else
9801         dflt="$longsize"
9802         echo " " >&4
9803         echo "(I can't compile the test program.  Guessing...)" >&4
9804         rp="What is the size of your file positions (in bytes)?"
9805         . ./myread
9806         fpossize="$ans"
9807 fi
9808
9809 : Check for large file support
9810 # Backward compatibility (uselfs is deprecated).
9811 case "$uselfs" in
9812 "$define"|true|[yY]*)
9813         cat <<EOM >&4
9814
9815 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9816 EOM
9817         uselargefiles="$define"
9818         ;;
9819 esac
9820
9821 case "$lseeksize:$fpossize" in
9822 8:8) cat <<EOM
9823
9824 You can have files larger than 2 gigabytes.
9825 EOM
9826    val="$define" ;;
9827 *)    case "$uselargefiles" in
9828    "$undef"|false|[nN]*) dflt='n' ;;
9829    *)   dflt='y' ;;
9830    esac
9831    cat <<EOM
9832
9833 Perl can be built to understand large files (files larger than 2 gigabytes)
9834 on some systems.  To do so, Configure can be run with -Duselargefiles.
9835
9836 If this doesn't make any sense to you, just accept the default '$dflt'.
9837 EOM
9838    rp='Try to understand large files, if available?'
9839    . ./myread
9840    case "$ans" in
9841    y|Y)         val="$define" ;;
9842    *)           val="$undef"  ;;
9843    esac
9844    ;;
9845 esac
9846 set uselargefiles
9847 eval $setvar
9848 : Look for a hint-file generated 'call-back-unit'.  If the
9849 : user has specified that a large files perl is to be built,
9850 : we may need to set or change some other defaults.
9851 if $test -f uselargefiles.cbu; then
9852         echo "Your platform has some specific hints regarding large file builds, using them..."
9853         . ./uselargefiles.cbu
9854 fi
9855 case "$uselargefiles" in
9856 "$define")
9857         if $test -f uselargefiles.cbu; then
9858                 echo " "
9859                 echo "Rechecking to see how big your file offsets are..." >&4
9860                 $cat >try.c <<EOCP
9861 #include <sys/types.h>
9862 #include <stdio.h>
9863 int main()
9864 {
9865     printf("%d\n", (int)sizeof($lseektype));
9866     return(0);
9867 }
9868 EOCP
9869                 set try
9870                 if eval $compile_ok; then
9871                         lseeksize=`$run ./try`
9872                         $echo "Your file offsets are now $lseeksize bytes long."
9873                 else
9874                         dflt="$lseeksize"
9875                         echo " "
9876                         echo "(I can't seem to compile the test program.  Guessing...)"
9877                         rp="What is the size of your file offsets (in bytes)?"
9878                         . ./myread
9879                         lseeksize="$ans"
9880                 fi
9881                 case "$fpostype" in
9882                 *_t) zzz="$fpostype"    ;;
9883                 *)   zzz="fpos_t"       ;;
9884                 esac
9885                 $echo $n "Rechecking the size of $zzz...$c" >&4
9886                 $cat > try.c <<EOCP
9887 #include <sys/types.h>
9888 #include <stdio.h>
9889 #$i_stdlib I_STDLIB
9890 #ifdef I_STDLIB
9891 #include <stdlib.h>
9892 #endif
9893 int main() {
9894     printf("%d\n", (int)sizeof($fpostype));
9895     return(0);
9896 }
9897 EOCP
9898                 set try
9899                 if eval $compile_ok; then
9900                         yyy=`$run ./try`
9901                         dflt="$lseeksize"
9902                         case "$yyy" in
9903                         '')     echo " "
9904                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9905                                 ;;
9906                         *)      fpossize=$yyy
9907                                 echo " $fpossize bytes." >&4
9908                                 ;;
9909                         esac
9910                 else
9911                         dflt="$fpossize"
9912                         echo " "
9913                         echo "(I can't compile the test program.  Guessing...)" >&4
9914                         rp="What is the size of your file positions (in bytes)?"
9915                         . ./myread
9916                         fpossize="$ans"
9917                 fi
9918                 $rm_try
9919         fi
9920         ;;
9921 esac
9922
9923 : Check if we want perlio
9924 useperlio="$define"
9925
9926 : Set the vendorbin variables
9927 case "$vendorprefix" in
9928 '')     d_vendorbin="$undef"
9929         vendorbin=''
9930         vendorbinexp=''
9931         ;;
9932 *)      d_vendorbin="$define"
9933         : determine where vendor-supplied executables go.
9934         case "$vendorbin" in
9935         '') dflt=$vendorprefix/bin ;;
9936         *)      dflt="$vendorbin" ;;
9937         esac
9938         fn=d~+
9939         rp='Pathname for the vendor-supplied executables directory?'
9940         . ./getfile
9941         vendorbin="$ans"
9942         vendorbinexp="$ansexp"
9943         ;;
9944 esac
9945 prefixvar=vendorbin
9946 . ./installprefix
9947
9948 : Set the vendorhtml1dir variables
9949 case "$vendorprefix" in
9950 '')     vendorhtml1dir=''
9951         vendorhtml1direxp=''
9952         ;;
9953 *)      : determine where vendor-supplied html pages go.
9954         : There is no standard location, so try to copy the previously-selected
9955         : directory structure for the core html pages.
9956         : XXX Better default suggestions would be welcome.
9957         case "$vendorhtml1dir" in
9958         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9959         *)      dflt=$vendorhtml1dir ;;
9960         esac
9961         case "$dflt" in
9962         ''|' ') dflt=none ;;
9963         esac
9964         fn=dn+~
9965         rp='Pathname for the vendor-supplied html pages?'
9966         . ./getfile
9967         vendorhtml1dir="$ans"
9968         vendorhtml1direxp="$ansexp"
9969         ;;
9970 esac
9971 : Use ' ' for none so value is preserved next time through Configure
9972 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9973 prefixvar=vendorhtml1dir
9974 . ./installprefix
9975
9976 : Set the vendorhtml3dir variables
9977 case "$vendorprefix" in
9978 '')     vendorhtml3dir=''
9979         vendorhtml3direxp=''
9980         ;;
9981 *)      : determine where vendor-supplied module html pages go.
9982         : There is no standard location, so try to copy the previously-selected
9983         : directory structure for the core html pages.
9984         : XXX Better default suggestions would be welcome.
9985         case "$vendorhtml3dir" in
9986         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9987         *)      dflt=$vendorhtml3dir ;;
9988         esac
9989         case "$dflt" in
9990         ''|' ') dflt=none ;;
9991         esac
9992         fn=dn+~
9993         rp='Pathname for the vendor-supplied html pages?'
9994         . ./getfile
9995         vendorhtml3dir="$ans"
9996         vendorhtml3direxp="$ansexp"
9997         ;;
9998 esac
9999 : Use ' ' for none so value is preserved next time through Configure
10000 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
10001 prefixvar=vendorhtml3dir
10002 . ./installprefix
10003
10004 : Set the vendorman1dir variables
10005 case "$vendorprefix" in
10006 '')     vendorman1dir=''
10007         vendorman1direxp=''
10008         ;;
10009 *)      : determine where vendor-supplied manual pages go.
10010         case "$vendorman1dir" in
10011         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10012         *)      dflt=$vendorman1dir ;;
10013         esac
10014         case "$dflt" in
10015         ''|' ') dflt=none ;;
10016         esac
10017         fn=nd~+
10018         rp='Pathname for the vendor-supplied manual section 1 pages?'
10019         . ./getfile
10020         vendorman1dir="$ans"
10021         vendorman1direxp="$ansexp"
10022         ;;
10023 esac
10024 : Use ' ' for none so value is preserved next time through Configure
10025 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10026 prefixvar=vendorman1dir
10027 . ./installprefix
10028
10029 : Set the vendorman3dir variables
10030 case "$vendorprefix" in
10031 '')     vendorman3dir=''
10032         vendorman3direxp=''
10033         ;;
10034 *)      : determine where vendor-supplied module manual pages go.
10035         case "$vendorman3dir" in
10036         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10037         *)      dflt=$vendorman3dir ;;
10038         esac
10039         case "$dflt" in
10040         ''|' ') dflt=none ;;
10041         esac
10042         fn=nd~+
10043         rp='Pathname for the vendor-supplied manual section 3 pages?'
10044         . ./getfile
10045         vendorman3dir="$ans"
10046         vendorman3direxp="$ansexp"
10047         ;;
10048 esac
10049 : Use ' ' for none so value is preserved next time through Configure
10050 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10051 prefixvar=vendorman3dir
10052 . ./installprefix
10053
10054 : Set the vendorscript variables
10055 case "$vendorprefix" in
10056 '')     d_vendorscript="$undef"
10057         vendorscript=''
10058         vendorscriptexp=''
10059         ;;
10060 *)      d_vendorscript="$define"
10061         : determine where vendor-supplied scripts go.
10062         case "$vendorscript" in
10063         '')     dflt=$vendorprefix/script
10064                 $test -d $dflt || dflt=$vendorbin ;;
10065         *)  dflt="$vendorscript" ;;
10066         esac
10067         $cat <<EOM
10068
10069 The installation process will create a directory for
10070 vendor-supplied scripts.
10071
10072 EOM
10073         fn=d~+
10074         rp='Pathname for the vendor-supplied scripts directory?'
10075         . ./getfile
10076         vendorscript="$ans"
10077         vendorscriptexp="$ansexp"
10078         ;;
10079 esac
10080 prefixvar=vendorscript
10081 . ./installprefix
10082
10083 : script used to emit important warnings
10084 cat >warn <<EOS
10085 $startsh
10086 if test \$# -gt 0; then
10087         echo "\$@" >msg
10088 else
10089         cat >msg
10090 fi
10091 echo "*** WARNING:" >&4
10092 sed -e 's/^/*** /' <msg >&4
10093 echo "*** " >&4
10094 cat msg >>config.msg
10095 echo " " >>config.msg
10096 rm -f msg
10097 EOS
10098 chmod +x warn
10099 $eunicefix warn
10100
10101 : see which of string.h or strings.h is needed
10102 echo " "
10103 strings=`./findhdr string.h`
10104 if $test "$strings" && $test -r "$strings"; then
10105         echo "Using <string.h> instead of <strings.h>." >&4
10106         val="$define"
10107 else
10108         val="$undef"
10109         strings=`./findhdr strings.h`
10110         if $test "$strings" && $test -r "$strings"; then
10111                 echo "Using <strings.h> instead of <string.h>." >&4
10112         else
10113                 ./warn "No string header found -- You'll surely have problems."
10114         fi
10115 fi
10116 set i_string
10117 eval $setvar
10118 case "$i_string" in
10119 "$undef") strings=`./findhdr strings.h`;;
10120 *)        strings=`./findhdr string.h`;;
10121 esac
10122
10123 : see if qgcvt exists
10124 set qgcvt d_qgcvt
10125 eval $inlibc
10126
10127 : Check what kind of doubles your system has
10128 $echo "Checking the kind of doubles you have..." >&4
10129 $cat >try.c <<EOP
10130 #$i_stdlib I_STDLIB
10131 #define DOUBLESIZE $doublesize
10132 #ifdef I_STDLIB
10133 #include <stdlib.h>
10134 #endif
10135 #include <stdio.h>
10136 static const double d = -0.1;
10137 int main() {
10138   unsigned const char* b = (unsigned const char*)(&d);
10139 #if DOUBLESIZE == 4
10140   if (b[0] == 0xCD && b[3] == 0xBD) {
10141     /* IEEE 754 32-bit little-endian */
10142     printf("1\n");
10143     exit(0);
10144   }
10145   if (b[0] == 0xBD && b[3] == 0xCD) {
10146     /* IEEE 754 32-bit big-endian */
10147     printf("2\n");
10148     exit(0);
10149   }
10150 #endif
10151 #if DOUBLESIZE == 8
10152   if (b[0] == 0x9A && b[7] == 0xBF) {
10153     /* IEEE 754 64-bit little-endian */
10154     printf("3\n");
10155     exit(0);
10156   }
10157   if (b[0] == 0xBF && b[7] == 0x9A) {
10158     /* IEEE 754 64-bit big-endian */
10159     printf("4\n");
10160     exit(0);
10161   }
10162   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10163    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10164     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10165     * 99 99 b9 bf 9a 99 99 99 */
10166     printf("7\n");
10167     exit(0);
10168   }
10169   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10170    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10171     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10172     * 99 99 99 9a bf b9 99 99 */
10173     printf("8\n");
10174     exit(0);
10175   }
10176 #endif
10177 #if DOUBLESIZE == 16
10178   if (b[0] == 0x9A && b[15] == 0xBF) {
10179     /* IEEE 754 128-bit little-endian */
10180     printf("5\n");
10181     exit(0);
10182   }
10183   if (b[0] == 0xBF && b[15] == 0x9A) {
10184     /* IEEE 754 128-bit big-endian */
10185     printf("6\n");
10186     exit(0);
10187   }
10188 #endif
10189   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
10190    * Whether those environments can still build Perl is debatable. */
10191   printf("-1\n"); /* unknown */
10192   exit(0);
10193 }
10194 EOP
10195 set try
10196 if eval $compile; then
10197     doublekind=`$run ./try`
10198 else
10199     doublekind=-1
10200 fi
10201 case "$doublekind" in
10202 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10203 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10204 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10205 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10206 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10207 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10208 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10209 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10210 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
10211 esac
10212 $rm_try
10213
10214 : Check print/scan long double stuff
10215 echo " "
10216
10217 if $test X"$d_longdbl" = X"$define"; then
10218
10219 echo "Checking how to print long doubles..." >&4
10220
10221 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10222         $cat >try.c <<'EOCP'
10223 #include <sys/types.h>
10224 #include <stdio.h>
10225 int main() {
10226   double d = 123.456;
10227   printf("%.3f\n", d);
10228 }
10229 EOCP
10230         set try
10231         if eval $compile; then
10232                 yyy=`$run ./try`
10233                 case "$yyy" in
10234                 123.456)
10235                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10236                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10237                         echo "We will use %f."
10238                         ;;
10239                 esac
10240         fi
10241 fi
10242
10243 if $test X"$sPRIfldbl" = X; then
10244         $cat >try.c <<'EOCP'
10245 #include <sys/types.h>
10246 #include <stdio.h>
10247 int main() {
10248   long double d = 123.456;
10249   printf("%.3Lf\n", d);
10250 }
10251 EOCP
10252         set try
10253         if eval $compile; then
10254                 yyy=`$run ./try`
10255                 case "$yyy" in
10256                 123.456)
10257                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10258                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10259                         echo "We will use %Lf."
10260                         ;;
10261                 esac
10262         fi
10263 fi
10264
10265 if $test X"$sPRIfldbl" = X; then
10266         $cat >try.c <<'EOCP'
10267 #include <sys/types.h>
10268 #include <stdio.h>
10269 int main() {
10270   long double d = 123.456;
10271   printf("%.3llf\n", d);
10272 }
10273 EOCP
10274         set try
10275         if eval $compile; then
10276                 yyy=`$run ./try`
10277                 case "$yyy" in
10278                 123.456)
10279                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10280                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10281                         echo "We will use %llf."
10282                         ;;
10283                 esac
10284         fi
10285 fi
10286
10287 if $test X"$sPRIfldbl" = X; then
10288         $cat >try.c <<'EOCP'
10289 #include <sys/types.h>
10290 #include <stdio.h>
10291 int main() {
10292   long double d = 123.456;
10293   printf("%.3lf\n", d);
10294 }
10295 EOCP
10296         set try
10297         if eval $compile; then
10298                 yyy=`$run ./try`
10299                 case "$yyy" in
10300                 123.456)
10301                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10302                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10303                         echo "We will use %lf."
10304                         ;;
10305                 esac
10306         fi
10307 fi
10308
10309 if $test X"$sPRIfldbl" = X; then
10310         echo "Cannot figure out how to print long doubles." >&4
10311 else
10312         sSCNfldbl=$sPRIfldbl    # expect consistency
10313 fi
10314
10315 $rm_try
10316
10317 fi # d_longdbl
10318
10319 case "$sPRIfldbl" in
10320 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10321         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10322         d_SCNfldbl="$undef";
10323         ;;
10324 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10325         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10326         d_SCNfldbl="$define";
10327         ;;
10328 esac
10329
10330 : Before committing on uselongdouble, see whether that looks sane.
10331 if $test "$uselongdouble" = "$define"; then
10332     message=""
10333     echo " "
10334     echo "Checking if your long double math functions work right..." >&4
10335     $cat > try.c <<EOF
10336 #include <math.h>
10337 #include <stdio.h>
10338 int main() {
10339   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10340 }
10341 EOF
10342     case "$osname:$gccversion" in
10343     aix:)       saveccflags="$ccflags"
10344                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10345     esac
10346     set try
10347     if eval $compile_ok; then
10348       yyy=`$run ./try`
10349     fi
10350     case "$yyy" in
10351     3) echo "Your long double math functions are working correctly." >&4 ;;
10352     *) echo "Your long double math functions are broken, not using long doubles." >&4
10353        uselongdouble=$undef
10354        ;;
10355     esac
10356     $rm_try
10357     case "$osname:$gccversion" in
10358     aix:)       ccflags="$saveccflags" ;; # restore
10359     esac
10360 fi
10361
10362 : Check how to convert floats to strings.
10363
10364 if test "X$d_Gconvert" = X; then
10365
10366 echo " "
10367 echo "Checking for an efficient way to convert floats to strings."
10368 echo " " > try.c
10369 case "$uselongdouble" in
10370 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10371 esac
10372 case "$d_longdbl" in
10373 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10374 esac
10375 case "$d_PRIgldbl" in
10376 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10377 esac
10378 $cat >>try.c <<EOP
10379 #ifdef TRY_gconvert
10380 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10381 char *myname = "gconvert";
10382 #endif
10383 #ifdef TRY_gcvt
10384 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10385 char *myname = "gcvt";
10386 #endif
10387 #ifdef TRY_qgcvt
10388 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10389 char *myname = "qgcvt";
10390 #define DOUBLETYPE long double
10391 #endif
10392 #ifdef TRY_sprintf
10393 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10394 #ifdef HAS_PRIgldbl
10395 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10396 #else
10397 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10398 #endif
10399 #else
10400 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10401 #endif
10402 char *myname = "sprintf";
10403 #endif
10404
10405 #ifndef DOUBLETYPE
10406 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10407 #define DOUBLETYPE long double
10408 #else
10409 #define DOUBLETYPE double
10410 #endif
10411 #endif
10412
10413 #include <stdio.h>
10414
10415 #$i_stdlib I_STDLIB
10416 #ifdef I_STDLIB
10417 #include <stdlib.h>
10418 #endif
10419 #$i_string I_STRING
10420 #ifdef I_STRING
10421 #  include <string.h>
10422 #else
10423 #  include <strings.h>
10424 #endif
10425
10426 int checkit(char *expect, char *got)
10427 {
10428     if (strcmp(expect, got)) {
10429                 printf("%s oddity:  Expected %s, got %s\n",
10430                         myname, expect, got);
10431                 exit(1);
10432         }
10433 }
10434
10435 int main()
10436 {
10437         char buf[64];
10438         buf[63] = '\0';
10439
10440         /* This must be 1st test on (which?) platform */
10441         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10442         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10443         checkit("0.1", buf);
10444
10445         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10446         checkit("0.01", buf);
10447
10448         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10449         checkit("0.001", buf);
10450
10451         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10452         checkit("0.0001", buf);
10453
10454         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10455         if (strlen(buf) > 5)
10456             checkit("9e-005", buf); /* for Microsoft ?? */
10457         else
10458             checkit("9e-05", buf);
10459
10460         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10461         checkit("1", buf);
10462
10463         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10464         checkit("1.1", buf);
10465
10466         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10467         checkit("1.01", buf);
10468
10469         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10470         checkit("1.001", buf);
10471
10472         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10473         checkit("1.0001", buf);
10474
10475         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10476         checkit("1.00001", buf);
10477
10478         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10479         checkit("1.000001", buf);
10480
10481         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10482         checkit("0", buf);
10483
10484         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10485         checkit("-1", buf);
10486
10487         /* Some Linux gcvt's give 1.e+5 here. */
10488         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10489         checkit("100000", buf);
10490
10491         /* Some Linux gcvt's give -1.e+5 here. */
10492         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10493         checkit("-100000", buf);
10494
10495         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10496         checkit("123.456", buf);
10497
10498         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10499         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10500         /* 34 should be enough to scare even long double
10501          * places into using the e notation. */
10502         if (strlen(buf) > 5)
10503             checkit("1e+034", buf); /* for Microsoft */
10504         else
10505             checkit("1e+34", buf);
10506
10507         /* For Perl, if you add additional tests here, also add them to
10508          * t/base/num.t for benefit of platforms not using Configure or
10509          * overriding d_Gconvert */
10510
10511         exit(0);
10512 }
10513 EOP
10514 : first add preferred functions to our list
10515 xxx_list=""
10516 for xxx_convert in $gconvert_preference; do
10517     case $xxx_convert in
10518     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10519     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10520     esac
10521 done
10522 : then add any others
10523 for xxx_convert in gconvert gcvt sprintf; do
10524     case "$xxx_list" in
10525     *$xxx_convert*) ;;
10526     *) xxx_list="$xxx_list $xxx_convert" ;;
10527     esac
10528 done
10529
10530 case "$d_longdbl$uselongdouble" in
10531 "$define$define")
10532     : again, add preferred functions to our list first
10533     xxx_ld_list=""
10534     for xxx_convert in $gconvert_ld_preference; do
10535         case $xxx_convert in
10536         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10537         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10538         esac
10539     done
10540     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10541     for xxx_convert in qgcvt sprintf $xxx_list; do
10542         case "$xxx_ld_list" in
10543         $xxx_convert*|*" $xxx_convert"*) ;;
10544         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10545         esac
10546     done
10547     : if sprintf cannot do long doubles, move it to the end
10548     if test "$d_PRIgldbl" != "$define"; then
10549         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10550     fi
10551     : if no qgcvt, remove it
10552     if test "$d_qgcvt" != "$define"; then
10553         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10554     fi
10555     : use the ld_list
10556     xxx_list="$xxx_ld_list"
10557     ;;
10558 esac
10559
10560 for xxx_convert in $xxx_list; do
10561         echo "Trying $xxx_convert..."
10562         $rm -f try try$_o core
10563         set try -DTRY_$xxx_convert
10564         if eval $compile; then
10565                 echo "$xxx_convert() found." >&4
10566                 if $run ./try; then
10567                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10568                         break;
10569                 else
10570                         echo "...But $xxx_convert didn't work as I expected."
10571                         xxx_convert=''
10572                 fi
10573         else
10574                 echo "$xxx_convert NOT found." >&4
10575         fi
10576 done
10577
10578 if test X$xxx_convert = X; then
10579     echo "*** WHOA THERE!!! ***" >&4
10580     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10581     xxx_convert=sprintf
10582 fi
10583
10584 case "$xxx_convert" in
10585 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10586 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10587 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10588 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10589    "$define$define$define")
10590       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10591    "$define$define$undef")
10592       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10593    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10594    esac
10595    ;;
10596 esac
10597
10598 fi
10599 $rm_try
10600
10601 : see if _fwalk exists
10602 set fwalk d__fwalk
10603 eval $inlibc
10604
10605 : Initialize h_fcntl
10606 h_fcntl=false
10607
10608 : Initialize h_sysfile
10609 h_sysfile=false
10610
10611 : access call always available on UNIX
10612 set access d_access
10613 eval $inlibc
10614
10615 : locate the flags for 'access()'
10616 case "$d_access" in
10617 "$define")
10618         echo " "
10619         $cat >access.c <<EOCP
10620 #include <sys/types.h>
10621 #ifdef I_FCNTL
10622 #include <fcntl.h>
10623 #endif
10624 #ifdef I_SYS_FILE
10625 #include <sys/file.h>
10626 #endif
10627 #ifdef I_UNISTD
10628 #include <unistd.h>
10629 #endif
10630 #$i_stdlib I_STDLIB
10631 #ifdef I_STDLIB
10632 #include <stdlib.h>
10633 #endif
10634 int main() {
10635         exit(R_OK);
10636 }
10637 EOCP
10638         : check sys/file.h first, no particular reason here
10639         if $test `./findhdr sys/file.h` && \
10640                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10641                 h_sysfile=true;
10642                 echo "<sys/file.h> defines the *_OK access constants." >&4
10643         elif $test `./findhdr fcntl.h` && \
10644                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10645                 h_fcntl=true;
10646                 echo "<fcntl.h> defines the *_OK access constants." >&4
10647         elif $test `./findhdr unistd.h` && \
10648                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10649                 echo "<unistd.h> defines the *_OK access constants." >&4
10650         else
10651                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10652         fi
10653         ;;
10654 esac
10655 $rm -f access*
10656
10657 : see if accessx exists
10658 set accessx d_accessx
10659 eval $inlibc
10660
10661 : see if acosh exists
10662 set acosh d_acosh
10663 eval $inlibc
10664
10665 : see if aintl exists
10666 set aintl d_aintl
10667 eval $inlibc
10668
10669 : see if alarm exists
10670 set alarm d_alarm
10671 eval $inlibc
10672
10673 : see if 64bit time functions exists
10674
10675 set ctime64 d_ctime64
10676 eval $inlibc
10677
10678 set localtime64 d_localtime64
10679 eval $inlibc
10680
10681 set gmtime64 d_gmtime64
10682 eval $inlibc
10683
10684 set mktime64 d_mktime64
10685 eval $inlibc
10686
10687 set difftime64 d_difftime64
10688 eval $inlibc
10689
10690 set asctime64 d_asctime64
10691 eval $inlibc
10692
10693 : see if POSIX threads are available
10694 set pthread.h i_pthread
10695 eval $inhdr
10696
10697 : define a function to check prototypes
10698 $cat > protochk <<EOSH
10699 $startsh
10700 cc="$cc"
10701 optimize="$optimize"
10702 ccflags="$ccflags"
10703 prototype="$prototype"
10704 define="$define"
10705 rm_try="$rm_try"
10706 usethreads=$usethreads
10707 i_pthread=$i_pthread
10708 pthread_h_first=$pthread_h_first
10709 EOSH
10710
10711 $cat >> protochk <<'EOSH'
10712
10713 $rm_try
10714 foo="$1"
10715 shift
10716 while test $# -ge 2; do
10717         case "$1" in
10718                 $define) echo "#include <$2>" >> try.c ;;
10719                 literal) echo "$2" >> try.c ;;
10720         esac
10721     # Extra magic for the benefit of systems that need pthread.h
10722     # to be included early to correctly detect threadsafe functions.
10723     # Such functions must guarantee themselves, though, that the usethreads
10724     # and i_pthread have been defined, before calling protochk.
10725     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10726         echo "#include <pthread.h>" >> try.c
10727         pthread_h_done=yes
10728     fi
10729     shift 2
10730 done
10731 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10732 cat >> try.c <<'EOCP'
10733 #ifdef CAN_PROTOTYPE
10734 #define _(args) args
10735 #else
10736 #define _(args) ()
10737 #endif
10738 EOCP
10739 echo "$foo" >> try.c
10740 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10741 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10742 status=$?
10743 $rm_try
10744 exit $status
10745 EOSH
10746 chmod +x protochk
10747 $eunicefix protochk
10748
10749 : Define hasproto macro for Configure internal use
10750 hasproto='varname=$1; func=$2; shift; shift;
10751 while $test $# -ge 2; do
10752         case "$1" in
10753         $define) echo "#include <$2>";;
10754         esac ;
10755     shift 2;
10756 done > try.c;
10757 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10758 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10759         echo "$func() prototype found.";
10760         val="$define";
10761 else
10762         echo "$func() prototype NOT found.";
10763         val="$undef";
10764 fi;
10765 set $varname;
10766 eval $setvar;
10767 $rm_try tryout.c'
10768
10769 : see if sys/types.h has to be included
10770 set sys/types.h i_systypes
10771 eval $inhdr
10772
10773 : see if sys/select.h has to be included
10774 set sys/select.h i_sysselct
10775 eval $inhdr
10776
10777 : Define hasfield macro for Configure internal use
10778 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10779 while $test $# -ge 2; do
10780         case "$1" in
10781         $define) echo "#include <$2>";;
10782         esac ;
10783     shift 2;
10784 done > try.c;
10785 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10786 set try;
10787 if eval $compile; then
10788         val="$define";
10789 else
10790         val="$undef";
10791 fi;
10792 set $varname;
10793 eval $setvar;
10794 $rm_try'
10795
10796 : Define hasfield_t macro for Configure internal use
10797 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
10798 while $test $# -ge 2; do
10799         case "$1" in
10800         $define) echo "#include <$2>";;
10801         esac ;
10802     shift 2;
10803 done > try.c;
10804 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
10805 set try;
10806 if eval $compile; then
10807         val="$define";
10808 else
10809         val="$undef";
10810 fi;
10811 set $varname;
10812 eval $setvar;
10813 $rm_try'
10814
10815 : see if we should include time.h, sys/time.h, or both
10816 echo " "
10817 if test "X$timeincl" = X; then
10818         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10819         $echo $n "I'm now running the test program...$c"
10820         $cat >try.c <<EOCP
10821 #include <sys/types.h>
10822 #ifdef I_TIME
10823 #include <time.h>
10824 #endif
10825 #ifdef I_SYSTIME
10826 #ifdef SYSTIMEKERNEL
10827 #define KERNEL
10828 #endif
10829 #include <sys/time.h>
10830 #endif
10831 #ifdef I_SYSSELECT
10832 #include <sys/select.h>
10833 #endif
10834 #$i_stdlib I_STDLIB
10835 #ifdef I_STDLIB
10836 #include <stdlib.h>
10837 #endif
10838 int main()
10839 {
10840         struct tm foo;
10841 #ifdef S_TIMEVAL
10842         struct timeval bar;
10843 #endif
10844 #ifdef S_TIMEZONE
10845         struct timezone tzp;
10846 #endif
10847         if (foo.tm_sec == foo.tm_sec)
10848                 exit(0);
10849 #ifdef S_TIMEVAL
10850         if (bar.tv_sec == bar.tv_sec)
10851                 exit(0);
10852 #endif
10853         exit(1);
10854 }
10855 EOCP
10856         flags=''
10857         for s_timezone in '-DS_TIMEZONE' ''; do
10858         sysselect=''
10859         for s_timeval in '-DS_TIMEVAL' ''; do
10860         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10861         for i_time in '' '-DI_TIME'; do
10862         for i_systime in '-DI_SYSTIME' ''; do
10863                 case "$flags" in
10864                 '') $echo $n ".$c"
10865                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10866                         if eval $compile; then
10867                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10868                                 shift
10869                                 flags="$*"
10870                                 echo " "
10871                                 $echo $n "Succeeded with $flags$c"
10872                         fi
10873                         ;;
10874                 esac
10875         done
10876         done
10877         done
10878         done
10879         done
10880         timeincl=''
10881         echo " "
10882         case "$flags" in
10883         *SYSTIMEKERNEL*) i_systimek="$define"
10884                 timeincl=`./findhdr sys/time.h`
10885                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10886         *) i_systimek="$undef";;
10887         esac
10888         case "$flags" in
10889         *I_TIME*) i_time="$define"
10890                 timeincl=`./findhdr time.h`" $timeincl"
10891                 echo "We'll include <time.h>." >&4;;
10892         *) i_time="$undef";;
10893         esac
10894         case "$flags" in
10895         *I_SYSTIME*) i_systime="$define"
10896                 timeincl=`./findhdr sys/time.h`" $timeincl"
10897                 echo "We'll include <sys/time.h>." >&4;;
10898         *) i_systime="$undef";;
10899         esac
10900         $rm_try
10901 fi
10902 : see if struct tm knows about tm_zone
10903 case "$i_systime$i_time" in
10904 *$define*)
10905         echo " "
10906         echo "Checking to see if your struct tm has tm_zone field..." >&4
10907         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10908         eval $hasfield
10909         ;;
10910 *)      val="$undef"
10911         set d_tm_tm_zone
10912         eval $setvar
10913         ;;
10914 esac
10915 case "$d_tm_tm_zone" in
10916 "$define")      echo "Yes, it does."   ;;
10917 *)              echo "No, it doesn't." ;;
10918 esac
10919 : see if struct tm knows about tm_gmtoff
10920 case "$i_systime$i_time" in
10921 *$define*)
10922         echo " "
10923         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10924         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10925         eval $hasfield
10926         ;;
10927 *)      val="$undef"
10928         set d_tm_tm_gmtoff
10929         eval $setvar
10930         ;;
10931 esac
10932 case "$d_tm_tm_gmtoff" in
10933 "$define")      echo "Yes, it does."   ;;
10934 *)              echo "No, it doesn't." ;;
10935 esac
10936
10937 : see if asctime_r exists
10938 set asctime_r d_asctime_r
10939 eval $inlibc
10940 case "$d_asctime_r" in
10941 "$define")
10942         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10943         case "$d_asctime_r_proto:$usethreads" in
10944         ":define")      d_asctime_r_proto=define
10945                 set d_asctime_r_proto asctime_r $hdrs
10946                 eval $hasproto ;;
10947         *)      ;;
10948         esac
10949         case "$d_asctime_r_proto" in
10950         define)
10951         case "$asctime_r_proto" in
10952         ''|0) try='char* asctime_r(const struct tm*, char*);'
10953         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10954         esac
10955         case "$asctime_r_proto" in
10956         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10957         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10958         esac
10959         case "$asctime_r_proto" in
10960         ''|0) try='int asctime_r(const struct tm*, char*);'
10961         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10962         esac
10963         case "$asctime_r_proto" in
10964         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10965         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10966         esac
10967         case "$asctime_r_proto" in
10968         ''|0)   d_asctime_r=undef
10969                 asctime_r_proto=0
10970                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10971         * )     case "$asctime_r_proto" in
10972                 REENTRANT_PROTO*) ;;
10973                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10974                 esac
10975                 echo "Prototype: $try" ;;
10976         esac
10977         ;;
10978         *)      case "$usethreads" in
10979                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10980                 esac
10981                 d_asctime_r=undef
10982                 asctime_r_proto=0
10983                 ;;
10984         esac
10985         ;;
10986 *)      asctime_r_proto=0
10987         ;;
10988 esac
10989
10990 : see if asinh exists
10991 set asinh d_asinh
10992 eval $inlibc
10993
10994 : see if atanh exists
10995 set atanh d_atanh
10996 eval $inlibc
10997
10998 : see if atolf exists
10999 set atolf d_atolf
11000 eval $inlibc
11001
11002 : see if atoll exists
11003 set atoll d_atoll
11004 eval $inlibc
11005
11006 : Look for GCC-style attribute format
11007 case "$d_attribute_format" in
11008 '')
11009 echo " "
11010 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11011 $cat >attrib.c <<'EOCP'
11012 #include <stdio.h>
11013 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11014 EOCP
11015 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11016         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11017                 echo "Your C compiler doesn't support __attribute__((format))."
11018                 val="$undef"
11019         else
11020                 echo "Your C compiler supports __attribute__((format))."
11021                 val="$define"
11022         fi
11023 else
11024         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11025         val="$undef"
11026 fi
11027 ;;
11028 *) val="$d_attribute_format" ;;
11029 esac
11030 set d_attribute_format
11031 eval $setvar
11032 $rm -f attrib*
11033
11034 : Look for GCC-style attribute format with null format allowed
11035 case "$d_printf_format_null" in
11036 '') case "$d_attribute_format" in
11037     $define)
11038         echo " "
11039         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11040 $cat >attrib.c <<EOCP
11041 #include <stdio.h>
11042 #$i_stdlib I_STDLIB
11043 #ifdef I_STDLIB
11044 #include <stdlib.h>
11045 #endif
11046 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11047 int null_printf (char* pat,...) { return (int)pat; }
11048 int main () { exit(null_printf(NULL)); }
11049 EOCP
11050         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11051             : run the executable in case it produces a run-time warning
11052             if $run ./attrib >>attrib.out 2>&1; then
11053                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11054                     echo "Your C compiler doesn't allow __printf__ format to be null."
11055                     val="$undef"
11056                 else
11057                     echo "Your C compiler allows __printf__ format to be null."
11058                     val="$define"
11059                 fi
11060             else
11061             echo "Your C compiler executable failed with __printf__ format null."
11062             val="$undef"
11063         fi
11064     else
11065         echo "Your C compiler fails with __printf__ format null."
11066         val="$undef"
11067     fi
11068     ;;
11069     *)  val="$undef" ;;
11070     esac
11071 ;;
11072 *)  val="$d_printf_format_null" ;;
11073 esac
11074 set d_printf_format_null
11075 eval $setvar
11076 $rm -f attrib*
11077
11078 : Look for GCC-style attribute malloc
11079 case "$d_attribute_malloc" in
11080 '')
11081 echo " "
11082 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11083 $cat >attrib.c <<'EOCP'
11084 #include <stdio.h>
11085 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11086 EOCP
11087 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11088         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11089                 echo "Your C compiler doesn't support __attribute__((malloc))."
11090                 val="$undef"
11091         else
11092                 echo "Your C compiler supports __attribute__((malloc))."
11093                 val="$define"
11094         fi
11095 else
11096         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11097         val="$undef"
11098 fi
11099 ;;
11100 *) val="$d_attribute_malloc" ;;
11101 esac
11102 set d_attribute_malloc
11103 eval $setvar
11104 $rm -f attrib*
11105
11106 : Look for GCC-style attribute nonnull
11107 case "$d_attribute_nonnull" in
11108 '')
11109 echo " "
11110 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11111 $cat >attrib.c <<'EOCP'
11112 #include <stdio.h>
11113 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11114 EOCP
11115 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11116         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11117                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11118                 val="$undef"
11119         else
11120                 echo "Your C compiler supports __attribute__((nonnull))."
11121                 val="$define"
11122         fi
11123 else
11124         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11125         val="$undef"
11126 fi
11127 ;;
11128 *) val="$d_attribute_nonnull" ;;
11129 esac
11130 set d_attribute_nonnull
11131 eval $setvar
11132 $rm -f attrib*
11133
11134 : Look for GCC-style attribute noreturn
11135 case "$d_attribute_noreturn" in
11136 '')
11137 echo " "
11138 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11139 $cat >attrib.c <<'EOCP'
11140 #include <stdio.h>
11141 void fall_over_dead( void ) __attribute__((noreturn));
11142 EOCP
11143 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11144         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11145                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11146                 val="$undef"
11147         else
11148                 echo "Your C compiler supports __attribute__((noreturn))."
11149                 val="$define"
11150         fi
11151 else
11152         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11153         val="$undef"
11154 fi
11155 ;;
11156 *) val="$d_attribute_noreturn" ;;
11157 esac
11158 set d_attribute_noreturn
11159 eval $setvar
11160 $rm -f attrib*
11161
11162 : Look for GCC-style attribute pure
11163 case "$d_attribute_pure" in
11164 '')
11165 echo " "
11166 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11167 $cat >attrib.c <<'EOCP'
11168 #include <stdio.h>
11169 int square( int n ) __attribute__((pure));
11170 EOCP
11171 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11172         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11173                 echo "Your C compiler doesn't support __attribute__((pure))."
11174                 val="$undef"
11175         else
11176                 echo "Your C compiler supports __attribute__((pure))."
11177                 val="$define"
11178         fi
11179 else
11180         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11181         val="$undef"
11182 fi
11183 ;;
11184 *) val="$d_attribute_pure" ;;
11185 esac
11186 set d_attribute_pure
11187 eval $setvar
11188 $rm -f attrib*
11189
11190 : Look for GCC-style attribute unused
11191 case "$d_attribute_unused" in
11192 '')
11193 echo " "
11194 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11195 $cat >attrib.c <<'EOCP'
11196 #include <stdio.h>
11197 int do_something( int dummy __attribute__((unused)), int n );
11198 EOCP
11199 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11200         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11201                 echo "Your C compiler doesn't support __attribute__((unused))."
11202                 val="$undef"
11203         else
11204                 echo "Your C compiler supports __attribute__((unused))."
11205                 val="$define"
11206         fi
11207 else
11208         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11209         val="$undef"
11210 fi
11211 ;;
11212 *) val="$d_attribute_unused" ;;
11213 esac
11214 set d_attribute_unused
11215 eval $setvar
11216 $rm -f attrib*
11217
11218 : Look for GCC-style attribute deprecated
11219 case "$d_attribute_deprecated" in
11220 '')
11221 echo " "
11222 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11223 $cat >attrib.c <<'EOCP'
11224 #include <stdio.h>
11225 int I_am_deprecated(void) __attribute__((deprecated));
11226 EOCP
11227 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11228         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11229                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11230                 val="$undef"
11231         else
11232                 echo "Your C compiler supports __attribute__((deprecated))."
11233                 val="$define"
11234         fi
11235 else
11236         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11237         val="$undef"
11238 fi
11239 ;;
11240 *) val="$d_attribute_deprecated" ;;
11241 esac
11242 set d_attribute_deprecated
11243 eval $setvar
11244 $rm -f attrib*
11245
11246 : Look for GCC-style attribute warn_unused_result
11247 case "$d_attribute_warn_unused_result" in
11248 '')
11249 echo " "
11250 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11251 $cat >attrib.c <<'EOCP'
11252 #include <stdio.h>
11253 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11254 EOCP
11255 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11256         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11257                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11258                 val="$undef"
11259         else
11260                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11261                 val="$define"
11262         fi
11263 else
11264         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11265         val="$undef"
11266 fi
11267 ;;
11268 *) val="$d_attribute_warn_unused_result" ;;
11269 esac
11270 set d_attribute_warn_unused_result
11271 eval $setvar
11272 $rm -f attrib*
11273
11274 : see if bcmp exists
11275 set bcmp d_bcmp
11276 eval $inlibc
11277
11278 : see if bcopy exists
11279 set bcopy d_bcopy
11280 eval $inlibc
11281
11282 : see if getpgrp exists
11283 set getpgrp d_getpgrp
11284 eval $inlibc
11285
11286 case "$d_getpgrp" in
11287 "$define")
11288         echo " "
11289         echo "Checking to see which flavor of getpgrp is in use..."
11290         $cat >try.c <<EOP
11291 #$i_unistd I_UNISTD
11292 #include <sys/types.h>
11293 #ifdef I_UNISTD
11294 #  include <unistd.h>
11295 #endif
11296 #$i_stdlib I_STDLIB
11297 #ifdef I_STDLIB
11298 #include <stdlib.h>
11299 #endif
11300 int main()
11301 {
11302         if (getuid() == 0) {
11303                 printf("(I see you are running Configure as super-user...)\n");
11304                 setuid(1);
11305         }
11306 #ifdef TRY_BSD_PGRP
11307         if (getpgrp(1) == 0)
11308                 exit(0);
11309 #else
11310         if (getpgrp() > 0)
11311                 exit(0);
11312 #endif
11313         exit(1);
11314 }
11315 EOP
11316         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11317                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11318                 val="$define"
11319         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11320                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11321                 val="$undef"
11322         else
11323                 echo "I can't seem to compile and run the test program."
11324                 if ./usg; then
11325                         xxx="a USG one, i.e. you use getpgrp()."
11326                 else
11327                         # SVR4 systems can appear rather BSD-ish.
11328                         case "$i_unistd" in
11329                         $undef)
11330                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11331                                 val="$define"
11332                                 ;;
11333                         $define)
11334                                 xxx="probably a USG one, i.e. you use getpgrp()."
11335                                 val="$undef"
11336                                 ;;
11337                         esac
11338                 fi
11339                 echo "Assuming your getpgrp is $xxx" >&4
11340         fi
11341         ;;
11342 *) val="$undef";;
11343 esac
11344 set d_bsdgetpgrp
11345 eval $setvar
11346 $rm_try
11347
11348 : see if setpgrp exists
11349 set setpgrp d_setpgrp
11350 eval $inlibc
11351
11352 case "$d_setpgrp" in
11353 "$define")
11354         echo " "
11355         echo "Checking to see which flavor of setpgrp is in use..."
11356         $cat >try.c <<EOP
11357 #$i_unistd I_UNISTD
11358 #include <sys/types.h>
11359 #ifdef I_UNISTD
11360 #  include <unistd.h>
11361 #endif
11362 #$i_stdlib I_STDLIB
11363 #ifdef I_STDLIB
11364 #include <stdlib.h>
11365 #endif
11366 int main()
11367 {
11368         if (getuid() == 0) {
11369                 printf("(I see you are running Configure as super-user...)\n");
11370                 setuid(1);
11371         }
11372 #ifdef TRY_BSD_PGRP
11373         if (-1 == setpgrp(1, 1))
11374                 exit(0);
11375 #else
11376         if (setpgrp() != -1)
11377                 exit(0);
11378 #endif
11379         exit(1);
11380 }
11381 EOP
11382         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11383                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11384                 val="$define"
11385         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11386                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11387                 val="$undef"
11388         else
11389                 echo "(I can't seem to compile and run the test program.)"
11390                 if ./usg; then
11391                         xxx="a USG one, i.e. you use setpgrp()."
11392                 else
11393                         # SVR4 systems can appear rather BSD-ish.
11394                         case "$i_unistd" in
11395                         $undef)
11396                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11397                                 val="$define"
11398                                 ;;
11399                         $define)
11400                                 xxx="probably a USG one, i.e. you use setpgrp()."
11401                                 val="$undef"
11402                                 ;;
11403                         esac
11404                 fi
11405                 echo "Assuming your setpgrp is $xxx" >&4
11406         fi
11407         ;;
11408 *) val="$undef";;
11409 esac
11410 set d_bsdsetpgrp
11411 eval $setvar
11412 $rm_try
11413
11414 : Look for GCC-style __builtin_choose_expr
11415 case "$d_builtin_choose_expr" in
11416 '')
11417     echo " "
11418     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11419     $cat >try.c <<'EOCP'
11420 #include <assert.h>
11421 #include <stdlib.h>
11422 #include <stdio.h>
11423
11424 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11425
11426 int main(void) {
11427     assert( SYRINX(1) == 2112 );
11428     assert( SYRINX(1) != 5150 );
11429     assert( SYRINX(0) == 5150 );
11430     assert( SYRINX(0) != 2112 );
11431     puts( "All good!" );
11432     exit(0);
11433 }
11434
11435 EOCP
11436     set try
11437     if eval $compile && $run ./try; then
11438         echo "Your C compiler supports __builtin_choose_expr."
11439         val="$define"
11440     else
11441         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11442         val="$undef"
11443     fi
11444 ;;
11445 *) val="$d_builtin_choose_expr" ;;
11446 esac
11447
11448 set d_builtin_choose_expr
11449 eval $setvar
11450 $rm_try
11451
11452 : Look for GCC-style __builtin_expect
11453 case "$d_builtin_expect" in
11454 '')
11455     echo " "
11456     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11457     $cat >try.c <<'EOCP'
11458 int main(void) {
11459     int n = 50;
11460     if ( __builtin_expect(n, 0) ) n = 1;
11461     /* Remember shell exit code truth is 0, C truth is non-zero */
11462     return !(n == 1);
11463 }
11464 EOCP
11465     set try
11466     if eval $compile && $run ./try; then
11467         echo "Your C compiler supports __builtin_expect."
11468         val="$define"
11469     else
11470         echo "Your C compiler doesn't seem to understand __builtin_expect."
11471         val="$undef"
11472     fi
11473     ;;
11474 *) val="$d_builtin_expect" ;;
11475 esac
11476
11477 set d_builtin_expect
11478 eval $setvar
11479 $rm_try
11480
11481 : see if bzero exists
11482 set bzero d_bzero
11483 eval $inlibc
11484
11485 : see if stdarg is available
11486 echo " "
11487 if $test `./findhdr stdarg.h`; then
11488         echo "<stdarg.h> found." >&4
11489         valstd="$define"
11490 else
11491         echo "<stdarg.h> NOT found." >&4
11492         valstd="$undef"
11493 fi
11494
11495 : see if varargs is available
11496 echo " "
11497 if $test `./findhdr varargs.h`; then
11498         echo "<varargs.h> found." >&4
11499 else
11500         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11501 fi
11502
11503 : set up the varargs testing programs
11504 $cat > varargs.c <<EOP
11505 #ifdef I_STDARG
11506 #include <stdarg.h>
11507 #endif
11508 #ifdef I_VARARGS
11509 #include <varargs.h>
11510 #endif
11511
11512 #ifdef I_STDARG
11513 int f(char *p, ...)
11514 #else
11515 int f(va_alist)
11516 va_dcl
11517 #endif
11518 {
11519         va_list ap;
11520 #ifndef I_STDARG
11521         char *p;
11522 #endif
11523 #ifdef I_STDARG
11524         va_start(ap,p);
11525 #else
11526         va_start(ap);
11527         p = va_arg(ap, char *);
11528 #endif
11529         va_end(ap);
11530         return 0;
11531 }
11532 EOP
11533 $cat > varargs <<EOP
11534 $startsh
11535 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11536         echo "true"
11537 else
11538         echo "false"
11539 fi
11540 $rm -f varargs$_o
11541 EOP
11542 chmod +x varargs
11543
11544 : now check which varargs header should be included
11545 echo " "
11546 i_varhdr=''
11547 val=''
11548 case "$valstd" in
11549 "$define")
11550         if `./varargs I_STDARG`; then
11551                 val='stdarg.h'
11552         elif `./varargs I_VARARGS`; then
11553                 val='varargs.h'
11554         fi
11555         ;;
11556 *)
11557         if `./varargs I_VARARGS`; then
11558                 val='varargs.h'
11559         fi
11560         ;;
11561 esac
11562 case "$val" in
11563 '')
11564         echo " "
11565         echo "*** WHOA THERE!!! ***" >&4
11566         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11567         case "$knowitall" in
11568         '')
11569         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11570                 exit 1
11571                 ;;
11572         esac
11573 echo "I could not find the definition for va_dcl... You have problems..." >&4
11574         val="$undef"; set i_stdarg; eval $setvar
11575         val="$undef"; set i_varargs; eval $setvar
11576         ;;
11577 *)
11578         set i_varhdr
11579         eval $setvar
11580         case "$i_varhdr" in
11581         stdarg.h)
11582                 val="$define"; set i_stdarg; eval $setvar
11583                 val="$undef"; set i_varargs; eval $setvar
11584                 ;;
11585         varargs.h)
11586                 val="$undef"; set i_stdarg; eval $setvar
11587                 val="$define"; set i_varargs; eval $setvar
11588                 ;;
11589         esac
11590         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11591 esac
11592 $rm -f varargs*
11593
11594 : see if the Compiler supports C99 variadic macros
11595 case "$i_stdarg$i_stdlib" in
11596     "$define$define")
11597     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11598     $cat >try.c <<EOCP
11599 #include <stdio.h>
11600 #include <stdarg.h>
11601
11602 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11603
11604 int main() {
11605   char buf[20];
11606   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11607   puts(buf);
11608   return 0;
11609 }
11610 EOCP
11611     set try
11612     if eval $compile && $run ./try 2>&1 >/dev/null; then
11613         case "`$run ./try`" in
11614             "123 456 789")
11615             echo "You have C99 variadic macros." >&4
11616             d_c99_variadic_macros="$define"
11617             ;;
11618             *)
11619             echo "You don't have functional C99 variadic macros." >&4
11620             d_c99_variadic_macros="$undef"
11621             ;;
11622         esac
11623     else
11624         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11625         d_c99_variadic_macros="$undef"
11626     fi
11627     $rm_try
11628     ;;
11629     *)
11630     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11631     d_c99_variadic_macros="$undef"
11632     ;;
11633 esac
11634
11635 : see if signal is declared as pointer to function returning int or void
11636 echo " "
11637 xxx=`./findhdr signal.h`
11638 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11639 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11640         echo "You have int (*signal())() instead of void." >&4
11641         val="$undef"
11642 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11643         echo "You have void (*signal())()." >&4
11644         val="$define"
11645 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11646         echo "You have int (*signal())() instead of void." >&4
11647         val="$undef"
11648 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11649         echo "You have void (*signal())()." >&4
11650         val="$define"
11651 else
11652         case "$d_voidsig" in
11653         '')
11654         echo "I can't determine whether signal handler returns void or int..." >&4
11655                 dflt=void
11656                 rp="What type does your signal handler return?"
11657                 . ./myread
11658                 case "$ans" in
11659                 v*) val="$define";;
11660                 *) val="$undef";;
11661                 esac;;
11662         "$define")
11663                 echo "As you already told me, signal handler returns void." >&4
11664                 val="$define"
11665                 ;;
11666         *)      echo "As you already told me, signal handler returns int." >&4
11667                 val="$undef"
11668                 ;;
11669         esac
11670 fi
11671 set d_voidsig
11672 eval $setvar
11673 case "$d_voidsig" in
11674 "$define") signal_t="void";;
11675 *) signal_t="int";;
11676 esac
11677 $rm -f $$.tmp
11678
11679 : check for ability to cast large floats to 32-bit ints.
11680 echo " "
11681 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11682 if $test "$intsize" -ge 4; then
11683         xxx=int
11684 else
11685         xxx=long
11686 fi
11687 $cat >try.c <<EOCP
11688 #include <stdio.h>
11689 #$i_stdlib I_STDLIB
11690 #ifdef I_STDLIB
11691 #include <stdlib.h>
11692 #endif
11693 #include <sys/types.h>
11694 #include <signal.h>
11695 $signal_t blech(int s) { exit(3); }
11696 int main()
11697 {
11698         $xxx i32;
11699         double f, g;
11700         int result = 0;
11701         char str[16];
11702         signal(SIGFPE, blech);
11703
11704         /* Don't let compiler optimize the test away.  Store the number
11705            in a writable string for gcc to pass to sscanf under HP-UX.
11706         */
11707         sprintf(str, "2147483647");
11708         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11709         g = 10 * f;
11710         i32  = ($xxx) g;
11711
11712         /* x86 processors will probably give 0x8000 0000, which is a
11713            sign change.  We don't want that.  We want to mimic SPARC
11714            behavior here, which is to preserve the sign and give
11715            back 0x7fff ffff.
11716         */
11717         if (i32 != ($xxx) f)
11718                 result |= 1;
11719         exit(result);
11720 }
11721 EOCP
11722 set try
11723 if eval $compile_ok; then
11724         $run ./try 2>/dev/null
11725         yyy=$?
11726 else
11727         echo "(I can't seem to compile the test program--assuming it can't)"
11728         yyy=1
11729 fi
11730 case "$yyy" in
11731 0)      val="$define"
11732         echo "Yup, it can."
11733         ;;
11734 *)      val="$undef"
11735         echo "Nope, it can't."
11736         ;;
11737 esac
11738 set d_casti32
11739 eval $setvar
11740 $rm_try
11741
11742 : check for ability to cast negative floats to unsigned
11743 echo " "
11744 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11745 $cat >try.c <<EOCP
11746 #include <stdio.h>
11747 #$i_stdlib I_STDLIB
11748 #ifdef I_STDLIB
11749 #include <stdlib.h>
11750 #endif
11751 #include <sys/types.h>
11752 #include <signal.h>
11753 $signal_t blech(int s) { exit(7); }
11754 $signal_t blech_in_list(int s) { exit(4); }
11755 unsigned long dummy_long(unsigned long p) { return p; }
11756 unsigned int dummy_int(unsigned int p) { return p; }
11757 unsigned short dummy_short(unsigned short p) { return p; }
11758 int main()
11759 {
11760         double f;
11761         unsigned long along;
11762         unsigned int aint;
11763         unsigned short ashort;
11764         int result = 0;
11765         char str[16];
11766
11767         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11768            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11769            optimized the whole file away
11770         */
11771         /* Store the number in a writable string for gcc to pass to
11772            sscanf under HP-UX.
11773         */
11774         sprintf(str, "-123");
11775         sscanf(str, "%lf", &f);  /* f = -123.; */
11776
11777         signal(SIGFPE, blech);
11778         along = (unsigned long)f;
11779         aint = (unsigned int)f;
11780         ashort = (unsigned short)f;
11781         if (along != (unsigned long)-123)
11782                 result |= 1;
11783         if (aint != (unsigned int)-123)
11784                 result |= 1;
11785         if (ashort != (unsigned short)-123)
11786                 result |= 1;
11787         sprintf(str, "1073741824.");
11788         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11789         f = f + f;
11790         along = 0;
11791         along = (unsigned long)f;
11792         if (along != 0x80000000)
11793                 result |= 2;
11794         f -= 1.;
11795         along = 0;
11796         along = (unsigned long)f;
11797         if (along != 0x7fffffff)
11798                 result |= 1;
11799         f += 2.;
11800         along = 0;
11801         along = (unsigned long)f;
11802         if (along != 0x80000001)
11803                 result |= 2;
11804         if (result)
11805                 exit(result);
11806         signal(SIGFPE, blech_in_list);
11807         sprintf(str, "123.");
11808         sscanf(str, "%lf", &f);  /* f = 123.; */
11809         along = dummy_long((unsigned long)f);
11810         aint = dummy_int((unsigned int)f);
11811         ashort = dummy_short((unsigned short)f);
11812         if (along != (unsigned long)123)
11813                 result |= 4;
11814         if (aint != (unsigned int)123)
11815                 result |= 4;
11816         if (ashort != (unsigned short)123)
11817                 result |= 4;
11818         exit(result);
11819
11820 }
11821 EOCP
11822 set try
11823 if eval $compile_ok; then
11824         $run ./try 2>/dev/null
11825         castflags=$?
11826 else
11827         echo "(I can't seem to compile the test program--assuming it can't)"
11828         castflags=7
11829 fi
11830 case "$castflags" in
11831 0)      val="$define"
11832         echo "Yup, it can."
11833         ;;
11834 *)      val="$undef"
11835         echo "Nope, it can't."
11836         ;;
11837 esac
11838 set d_castneg
11839 eval $setvar
11840 $rm_try
11841
11842 : see if cbrt exists
11843 set cbrt d_cbrt
11844 eval $inlibc
11845
11846 : see if vprintf exists
11847 echo " "
11848 if set vprintf val -f d_vprintf; eval $csym; $val; then
11849         echo 'vprintf() found.' >&4
11850         val="$define"
11851         $cat >try.c <<EOF
11852 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11853 #$i_varargs I_VARARGS
11854
11855 #$i_stdlib I_STDLIB
11856 #$i_unistd I_UNISTD
11857
11858 #ifdef I_STDARG
11859 #  include <stdarg.h>
11860 #else /* I_VARARGS */
11861 #  include <varargs.h>
11862 #endif
11863
11864 #ifdef I_UNISTD
11865 #  include <unistd.h>
11866 #endif
11867
11868 #ifdef I_STDLIB
11869 #  include <stdlib.h>
11870 #endif
11871
11872 #include <stdio.h> /* vsprintf prototype */
11873
11874 #ifdef I_STDARG
11875 void xxx(int n, ...)
11876 {
11877     va_list args;
11878     char buf[10];
11879     va_start(args, n);
11880     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11881 }
11882 int main() { xxx(1, "foo"); }
11883
11884 #else /* I_VARARGS */
11885
11886 xxx(va_alist)
11887 va_dcl
11888 {
11889     va_list args;
11890     char buf[10];
11891     va_start(args);
11892     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11893 }
11894 int main() { xxx("foo"); }
11895
11896 #endif
11897
11898 EOF
11899         set try
11900         if eval $compile_ok; then
11901                 if $run ./try; then
11902                         echo "Your vsprintf() returns (int)." >&4
11903                         val2="$undef"
11904                 else
11905                         echo "Your vsprintf() returns (char*)." >&4
11906                         val2="$define"
11907                 fi
11908         else
11909                 echo 'I am unable to compile the vsprintf() test program.' >&4
11910                 # We shouldn't get here.  If we do, assume the standard signature,
11911                 # not the old BSD one.
11912                 echo 'Guessing that vsprintf() returns (int).' >&4
11913                 val2="$undef"
11914         fi
11915 else
11916         echo 'vprintf() NOT found.' >&4
11917         val="$undef"
11918         val2="$undef"
11919 fi
11920 $rm_try
11921 set d_vprintf
11922 eval $setvar
11923 val=$val2
11924 set d_charvspr
11925 eval $setvar
11926
11927 : see if chown exists
11928 set chown d_chown
11929 eval $inlibc
11930
11931 : see if chroot exists
11932 set chroot d_chroot
11933 eval $inlibc
11934
11935 : see if chsize exists
11936 set chsize d_chsize
11937 eval $inlibc
11938
11939 : see if class exists
11940 set class d_class
11941 eval $inlibc
11942
11943 : see if clearenv exists
11944 set clearenv d_clearenv
11945 eval $inlibc
11946
11947 : Define hasstruct macro for Configure internal use
11948 hasstruct='varname=$1; struct=$2; shift; shift;
11949 while $test $# -ge 2; do
11950         case "$1" in
11951         $define) echo "#include <$2>";;
11952         esac ;
11953     shift 2;
11954 done > try.c;
11955 echo "int main () { struct $struct foo; }" >> try.c;
11956 set try;
11957 if eval $compile; then
11958         val="$define";
11959 else
11960         val="$undef";
11961 fi;
11962 set $varname;
11963 eval $setvar;
11964 $rm_try'
11965
11966 : see whether socket exists
11967 socketlib=''
11968 sockethdr=''
11969 echo " "
11970 $echo $n "Hmm... $c" >&4
11971 if set socket val -f d_socket; eval $csym; $val; then
11972     echo "Looks like you have Berkeley networking support." >&4
11973     d_socket="$define"
11974     if set setsockopt val -f; eval $csym; $val; then
11975         d_oldsock="$undef"
11976     else
11977         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11978         d_oldsock="$define"
11979     fi
11980 else
11981     if $contains socklib libc.list >/dev/null 2>&1; then
11982         echo "Looks like you have Berkeley networking support." >&4
11983         d_socket="$define"
11984         : we will have to assume that it supports the 4.2 BSD interface
11985         d_oldsock="$undef"
11986     else
11987         echo "You don't have Berkeley networking in libc$_a..." >&4
11988         if test "X$d_socket" = "X$define"; then
11989             echo "...but you seem to believe that you have sockets." >&4
11990         else
11991             for net in net socket
11992             do
11993                 if test -f $sysroot/usr/lib/lib$net$_a; then
11994                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11995                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11996                     if $contains socket libc.list >/dev/null 2>&1; then
11997                         d_socket="$define"
11998                         socketlib="-l$net"
11999                         case "$net" in
12000                         net)
12001                             echo "...but the Wollongong group seems to have hacked it in." >&4
12002                             sockethdr="-I$sysroot/usr/netinclude"
12003                             ;;
12004                         esac
12005                         echo "Found Berkeley sockets interface in lib$net." >&4
12006                         if $contains setsockopt libc.list >/dev/null 2>&1; then
12007                             d_oldsock="$undef"
12008                         else
12009                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
12010                             d_oldsock="$define"
12011                         fi
12012                         break
12013                     fi
12014                 fi
12015             done
12016             if test "X$d_socket" != "X$define"; then
12017                echo "or anywhere else I see." >&4
12018                d_socket="$undef"
12019                d_oldsock="$undef"
12020             fi
12021         fi
12022     fi
12023 fi
12024
12025 : see if socketpair exists
12026 set socketpair d_sockpair
12027 eval $inlibc
12028
12029
12030 echo " "
12031 echo "Checking the availability sa_len in the sock struct ..." >&4
12032 $cat >try.c <<EOF
12033 #include <sys/types.h>
12034 #include <sys/socket.h>
12035 int main() {
12036 struct sockaddr sa;
12037 return (sa.sa_len);
12038 }
12039 EOF
12040 val="$undef"
12041 set try; if eval $compile; then
12042     val="$define"
12043 fi
12044 set d_sockaddr_sa_len; eval $setvar
12045 $rm_try
12046
12047 echo " "
12048 echo "Checking the availability struct sockaddr_in6 ..." >&4
12049 $cat >try.c <<EOF
12050 #include <sys/types.h>
12051 #include <sys/socket.h>
12052 #include <netinet/in.h>
12053 int main() {
12054 struct sockaddr_in6 sin6;
12055 return (sin6.sin6_family);
12056 }
12057 EOF
12058 val="$undef"
12059 set try; if eval $compile; then
12060     val="$define"
12061 fi
12062 set d_sockaddr_in6; eval $setvar
12063 $rm_try
12064
12065 echo " "
12066 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12067 $cat >try.c <<EOF
12068 #include <sys/types.h>
12069 #include <sys/socket.h>
12070 #include <netinet/in.h>
12071 int main() {
12072 struct sockaddr_in6 sin6;
12073 return (sin6.sin6_scope_id);
12074 }
12075 EOF
12076 val="$undef"
12077 set try; if eval $compile; then
12078     val="$define"
12079 fi
12080 set d_sin6_scope_id; eval $setvar
12081 $rm_try
12082
12083 echo " "
12084 echo "Checking the availability struct ip_mreq ..." >&4
12085 $cat >try.c <<EOF
12086 #include <sys/types.h>
12087 #include <sys/socket.h>
12088 #include <netinet/in.h>
12089 int main() {
12090 struct ip_mreq mreq;
12091 return (mreq.imr_multiaddr.s_addr);
12092 }
12093 EOF
12094 val="$undef"
12095 set try; if eval $compile; then
12096        val="$define"
12097 fi
12098 set d_ip_mreq; eval $setvar
12099 $rm_try
12100
12101 echo " "
12102 echo "Checking the availability struct ip_mreq_source ..." >&4
12103 $cat >try.c <<EOF
12104 #include <sys/types.h>
12105 #include <sys/socket.h>
12106 #include <netinet/in.h>
12107 int main() {
12108 struct ip_mreq_source mreq;
12109 return (mreq.imr_multiaddr.s_addr);
12110 }
12111 EOF
12112 val="$undef"
12113 set try; if eval $compile; then
12114        val="$define"
12115 fi
12116 set d_ip_mreq_source; eval $setvar
12117 $rm_try
12118
12119 echo " "
12120 echo "Checking the availability struct ipv6_mreq ..." >&4
12121 $cat >try.c <<EOF
12122 #include <sys/types.h>
12123 #include <sys/socket.h>
12124 #include <netinet/in.h>
12125 int main() {
12126 struct ipv6_mreq mreq;
12127 return (mreq.ipv6mr_interface);
12128 }
12129 EOF
12130 val="$undef"
12131 set try; if eval $compile; then
12132     val="$define"
12133 fi
12134 set d_ipv6_mreq; eval $setvar
12135 $rm_try
12136
12137 echo " "
12138 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12139 $cat >try.c <<EOF
12140 #include <sys/types.h>
12141 #include <sys/socket.h>
12142 #include <netinet/in.h>
12143 int main() {
12144 struct ipv6_mreq_source mreq;
12145 return (mreq.imr_multiaddr.s_addr);
12146 }
12147 EOF
12148 val="$undef"
12149 set try; if eval $compile; then
12150        val="$define"
12151 fi
12152 set d_ipv6_mreq_source; eval $setvar
12153 $rm_try
12154
12155 echo " "
12156 echo "Checking the availability of certain socket constants..." >&4
12157 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12158     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12159     $cat >try.c <<EOF
12160 #include <sys/types.h>
12161 #include <sys/socket.h>
12162 int main() {
12163     int i = $ENUM;
12164 }
12165 EOF
12166     val="$undef"
12167     set try; if eval $compile; then
12168         val="$define"
12169     fi
12170     set d_${enum}; eval $setvar
12171     $rm_try
12172 done
12173
12174 : see if this is a sys/uio.h system
12175 set sys/uio.h i_sysuio
12176 eval $inhdr
12177
12178 : Check for cmsghdr support
12179 echo " "
12180 echo "Checking to see if your system supports struct cmsghdr..." >&4
12181 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12182 eval $hasstruct
12183 case "$d_cmsghdr_s" in
12184 "$define")      echo "Yes, it does."   ;;
12185 *)              echo "No, it doesn't." ;;
12186 esac
12187
12188
12189 : check for const keyword
12190 echo " "
12191 echo 'Checking to see if your C compiler knows about "const"...' >&4
12192 $cat >const.c <<'EOCP'
12193 typedef struct spug { int drokk; } spug;
12194 int main()
12195 {
12196         const char *foo;
12197         const spug y = { 0 };
12198 }
12199 EOCP
12200 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12201         val="$define"
12202         echo "Yup, it does."
12203 else
12204         val="$undef"
12205         echo "Nope, it doesn't."
12206 fi
12207 set d_const
12208 eval $setvar
12209
12210 : see if copysign exists
12211 set copysign d_copysign
12212 eval $inlibc
12213
12214 : see if copysignl exists
12215 set copysignl d_copysignl
12216 eval $inlibc
12217
12218 : see if crypt exists
12219 echo " "
12220 set crypt d_crypt
12221 eval $inlibc
12222 case "$d_crypt" in
12223 $define) cryptlib='' ;;
12224 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12225                 echo 'crypt() found.' >&4
12226                 val="$define"
12227                 cryptlib=''
12228         else
12229                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12230                 if $test -z "$cryptlib"; then
12231                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12232                 else
12233                         cryptlib=-lcrypt
12234                 fi
12235                 if $test -z "$cryptlib"; then
12236                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12237                 else
12238                         cryptlib=-lcrypt
12239                 fi
12240                 if $test -z "$cryptlib"; then
12241                         cryptlib=`./loc libcrypt$_a "" $libpth`
12242                 else
12243                         cryptlib=-lcrypt
12244                 fi
12245                 if $test -z "$cryptlib"; then
12246                         echo 'crypt() NOT found.' >&4
12247                         val="$undef"
12248                 else
12249                         val="$define"
12250                 fi
12251         fi
12252         set d_crypt
12253         eval $setvar
12254         ;;
12255 esac
12256
12257 : see if this is a crypt.h system
12258 set crypt.h i_crypt
12259 eval $inhdr
12260
12261 : see if crypt_r exists
12262 set crypt_r d_crypt_r
12263 eval $inlibc
12264 case "$d_crypt_r" in
12265 "$define")
12266         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12267         case "$d_crypt_r_proto:$usethreads" in
12268         ":define")      d_crypt_r_proto=define
12269                 set d_crypt_r_proto crypt_r $hdrs
12270                 eval $hasproto ;;
12271         *)      ;;
12272         esac
12273         case "$d_crypt_r_proto" in
12274         define)
12275         case "$crypt_r_proto" in
12276         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12277         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12278         esac
12279         case "$crypt_r_proto" in
12280         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12281         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12282         esac
12283         case "$crypt_r_proto" in
12284         ''|0)   d_crypt_r=undef
12285                 crypt_r_proto=0
12286                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12287         * )     case "$crypt_r_proto" in
12288                 REENTRANT_PROTO*) ;;
12289                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12290                 esac
12291                 echo "Prototype: $try" ;;
12292         esac
12293         ;;
12294         *)      case "$usethreads" in
12295                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12296                 esac
12297                 d_crypt_r=undef
12298                 crypt_r_proto=0
12299                 ;;
12300         esac
12301         ;;
12302 *)      crypt_r_proto=0
12303         ;;
12304 esac
12305
12306 : get csh whereabouts
12307 case "$csh" in
12308 'csh') val="$undef" ;;
12309 *) val="$define" ;;
12310 esac
12311 set d_csh
12312 eval $setvar
12313 : Respect a hint or command line value for full_csh.
12314 case "$full_csh" in
12315 '') full_csh=$csh ;;
12316 esac
12317
12318 : see if ctermid exists
12319 set ctermid d_ctermid
12320 eval $inlibc
12321
12322 : see if ctermid_r exists
12323 set ctermid_r d_ctermid_r
12324 eval $inlibc
12325 case "$d_ctermid_r" in
12326 "$define")
12327         hdrs="$i_systypes sys/types.h define stdio.h "
12328         case "$d_ctermid_r_proto:$usethreads" in
12329         ":define")      d_ctermid_r_proto=define
12330                 set d_ctermid_r_proto ctermid_r $hdrs
12331                 eval $hasproto ;;
12332         *)      ;;
12333         esac
12334         case "$d_ctermid_r_proto" in
12335         define)
12336         case "$ctermid_r_proto" in
12337         ''|0) try='char* ctermid_r(char*);'
12338         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12339         esac
12340         case "$ctermid_r_proto" in
12341         ''|0)   d_ctermid_r=undef
12342                 ctermid_r_proto=0
12343                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12344         * )     case "$ctermid_r_proto" in
12345                 REENTRANT_PROTO*) ;;
12346                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12347                 esac
12348                 echo "Prototype: $try" ;;
12349         esac
12350         ;;
12351         *)      case "$usethreads" in
12352                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12353                 esac
12354                 d_ctermid_r=undef
12355                 ctermid_r_proto=0
12356                 ;;
12357         esac
12358         ;;
12359 *)      ctermid_r_proto=0
12360         ;;
12361 esac
12362
12363 : see if ctime_r exists
12364 set ctime_r d_ctime_r
12365 eval $inlibc
12366 case "$d_ctime_r" in
12367 "$define")
12368         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12369         case "$d_ctime_r_proto:$usethreads" in
12370         ":define")      d_ctime_r_proto=define
12371                 set d_ctime_r_proto ctime_r $hdrs
12372                 eval $hasproto ;;
12373         *)      ;;
12374         esac
12375         case "$d_ctime_r_proto" in
12376         define)
12377         case "$ctime_r_proto" in
12378         ''|0) try='char* ctime_r(const time_t*, char*);'
12379         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12380         esac
12381         case "$ctime_r_proto" in
12382         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12383         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12384         esac
12385         case "$ctime_r_proto" in
12386         ''|0) try='int ctime_r(const time_t*, char*);'
12387         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12388         esac
12389         case "$ctime_r_proto" in
12390         ''|0) try='int ctime_r(const time_t*, char*, int);'
12391         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12392         esac
12393         case "$ctime_r_proto" in
12394         ''|0)   d_ctime_r=undef
12395                 ctime_r_proto=0
12396                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12397         * )     case "$ctime_r_proto" in
12398                 REENTRANT_PROTO*) ;;
12399                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12400                 esac
12401                 echo "Prototype: $try" ;;
12402         esac
12403         ;;
12404         *)      case "$usethreads" in
12405                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12406                 esac
12407                 d_ctime_r=undef
12408                 ctime_r_proto=0
12409                 ;;
12410         esac
12411         ;;
12412 *)      ctime_r_proto=0
12413         ;;
12414 esac
12415
12416 : see if cuserid exists
12417 set cuserid d_cuserid
12418 eval $inlibc
12419
12420 : see if this is a limits.h system
12421 set limits.h i_limits
12422 eval $inhdr
12423
12424 : See if number of significant digits in a double precision number is known
12425 echo " "
12426 $cat >dbl_dig.c <<EOM
12427 #$i_limits I_LIMITS
12428 #$i_float I_FLOAT
12429 #ifdef I_LIMITS
12430 #include <limits.h>
12431 #endif
12432 #ifdef I_FLOAT
12433 #include <float.h>
12434 #endif
12435 #ifdef DBL_DIG
12436 printf("Contains DBL_DIG");
12437 #endif
12438 EOM
12439 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12440 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12441         echo "DBL_DIG found." >&4
12442         val="$define"
12443 else
12444         echo "DBL_DIG NOT found." >&4
12445         val="$undef"
12446 fi
12447 $rm -f dbl_dig.?
12448 set d_dbl_dig
12449 eval $setvar
12450
12451 : see if dbm.h is available
12452 : see if dbmclose exists
12453 set dbmclose d_dbmclose
12454 eval $inlibc
12455
12456 case "$d_dbmclose" in
12457 $define)
12458         set dbm.h i_dbm
12459         eval $inhdr
12460         case "$i_dbm" in
12461         $define)
12462                 val="$undef"
12463                 set i_rpcsvcdbm
12464                 eval $setvar
12465                 ;;
12466         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12467                 eval $inhdr
12468                 ;;
12469         esac
12470         ;;
12471 *)      echo "We won't be including <dbm.h>"
12472         val="$undef"
12473         set i_dbm
12474         eval $setvar
12475         val="$undef"
12476         set i_rpcsvcdbm
12477         eval $setvar
12478         ;;
12479 esac
12480
12481 : see if prototype for dbminit is available
12482 echo " "
12483 set d_dbminitproto dbminit $i_dbm dbm.h
12484 eval $hasproto
12485
12486 : see if difftime exists
12487 set difftime d_difftime
12488 eval $inlibc
12489
12490 : see if this is a dirent system
12491 echo " "
12492 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12493         val="$define"
12494         echo "<dirent.h> found." >&4
12495 else
12496         val="$undef"
12497         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12498                 echo "<sys/dir.h> found." >&4
12499                 echo " "
12500         else
12501                 xinc=`./findhdr sys/ndir.h`
12502         fi
12503         echo "<dirent.h> NOT found." >&4
12504 fi
12505 set i_dirent
12506 eval $setvar
12507
12508 : Look for type of directory structure.
12509 echo " "
12510 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12511
12512 case "$direntrytype" in
12513 ''|' ')
12514         case "$i_dirent" in
12515         $define) guess1='struct dirent' ;;
12516         *) guess1='struct direct'  ;;
12517         esac
12518         ;;
12519 *)      guess1="$direntrytype"
12520         ;;
12521 esac
12522
12523 case "$guess1" in
12524 'struct dirent') guess2='struct direct' ;;
12525 *) guess2='struct dirent' ;;
12526 esac
12527
12528 if $contains "$guess1" try.c >/dev/null 2>&1; then
12529         direntrytype="$guess1"
12530         echo "Your directory entries are $direntrytype." >&4
12531 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12532         direntrytype="$guess2"
12533         echo "Your directory entries seem to be $direntrytype." >&4
12534 else
12535         echo "I don't recognize your system's directory entries." >&4
12536         rp="What type is used for directory entries on this system?"
12537         dflt="$guess1"
12538         . ./myread
12539         direntrytype="$ans"
12540 fi
12541 $rm_try
12542
12543 : see if the directory entry stores field length
12544 echo " "
12545 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12546 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12547         echo "Good, your directory entry keeps length information in d_namlen." >&4
12548         val="$define"
12549 else
12550         echo "Your directory entry does not know about the d_namlen field." >&4
12551         val="$undef"
12552 fi
12553 set d_dirnamlen
12554 eval $setvar
12555 $rm_try
12556
12557 : Look for DIR.dd_fd
12558 case "$i_dirent" in
12559 "$define")
12560     echo "Checking to see if DIR has a dd_fd member variable" >&4
12561     $cat >try.c <<EOCP
12562 #$i_stdlib I_STDLIB
12563 #ifdef I_STDLIB
12564 #include <stdlib.h>
12565 #endif
12566 #include <dirent.h>
12567
12568 int main() {
12569     DIR dir;
12570     dir.dd_fd = 1;
12571     return 0;
12572 }
12573 EOCP
12574     val=$undef
12575     set try
12576     if eval $compile; then
12577         echo "Yes, it does."
12578         val="$define"
12579     else
12580         echo "No, it does not."
12581         val="$undef"
12582     fi
12583     ;;
12584 *)
12585     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12586     val="$undef"
12587     ;;
12588 esac
12589 set d_dir_dd_fd
12590 eval $setvar
12591 $rm_try
12592
12593 : see if this is an sysdir system
12594 set sys/dir.h i_sysdir
12595 eval $inhdr
12596
12597 : see if this is an sysndir system
12598 set sys/ndir.h i_sysndir
12599 eval $inhdr
12600
12601 : Look for dirfd
12602 echo " "
12603 $cat >dirfd.c <<EOM
12604 #include <stdio.h>
12605 #$i_stdlib I_STDLIB
12606 #ifdef I_STDLIB
12607 #include <stdlib.h>
12608 #endif
12609 #$i_dirent I_DIRENT             /**/
12610 #$i_sysdir I_SYS_DIR            /**/
12611 #$i_sysndir I_SYS_NDIR          /**/
12612 #$i_systypes I_SYS_TYPES        /**/
12613 #if defined(I_SYS_TYPES)
12614 #include <sys/types.h>
12615 #endif
12616 #if defined(I_DIRENT)
12617 #include <dirent.h>
12618 #else
12619 #ifdef I_SYS_NDIR
12620 #include <sys/ndir.h>
12621 #else
12622 #ifdef I_SYS_DIR
12623 #ifdef hp9000s500
12624 #include <ndir.h>       /* may be wrong in the future */
12625 #else
12626 #include <sys/dir.h>
12627 #endif
12628 #endif
12629 #endif
12630 #endif
12631 int main() {
12632         DIR *dirp = opendir(".");
12633         if (dirfd(dirp) >= 0)
12634                 exit(0);
12635         else
12636                 exit(1);
12637 }
12638 EOM
12639 val=$undef
12640 set dirfd
12641 if eval $compile; then
12642         val="$define"
12643 fi
12644 case "$val" in
12645 $define)        echo "dirfd() found." >&4       ;;
12646 *)              echo "dirfd() NOT found." >&4   ;;
12647 esac
12648 set d_dirfd
12649 eval $setvar
12650 $rm -f dirfd*
12651
12652 : see if dladdr exists
12653 set dladdr d_dladdr
12654 eval $inlibc
12655
12656 : see if dlerror exists
12657 xxx_runnm="$runnm"
12658 runnm=false
12659 set dlerror d_dlerror
12660 eval $inlibc
12661 runnm="$xxx_runnm"
12662
12663 : see if dlfcn is available
12664 set dlfcn.h i_dlfcn
12665 eval $inhdr
12666
12667 : Check what extension to use for shared libs
12668 case "$usedl" in
12669 $define|y|true)
12670         $cat << EOM
12671
12672 On a few systems, the dynamically loaded modules that perl generates and uses
12673 will need a different extension than shared libs. The default will probably
12674 be appropriate.
12675
12676 EOM
12677         case "$dlext" in
12678         '')     dflt="$so" ;;
12679         *)      dflt="$dlext" ;;
12680         esac
12681         rp='What is the extension of dynamically loaded modules'
12682         . ./myread
12683         dlext="$ans"
12684         ;;
12685 *)
12686         dlext="none"
12687         ;;
12688 esac
12689
12690 : Check if dlsym need a leading underscore
12691 echo " "
12692 val="$undef"
12693
12694 case "$dlsrc" in
12695 dl_dlopen.xs)
12696         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12697         $cat >dyna.c <<'EOM'
12698 fred () { }
12699 EOM
12700
12701 $cat >fred.c<<EOM
12702
12703 #include <stdio.h>
12704 #$i_stdlib I_STDLIB
12705 #ifdef I_STDLIB
12706 #include <stdlib.h>
12707 #endif
12708 #$i_dlfcn I_DLFCN
12709 #ifdef I_DLFCN
12710 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12711 #else
12712 #include <sys/types.h>
12713 #include <nlist.h>
12714 #include <link.h>
12715 #endif
12716
12717 extern int fred() ;
12718
12719 int main()
12720 {
12721     void * handle ;
12722     void * symbol ;
12723 #ifndef RTLD_LAZY
12724     int mode = 1 ;
12725 #else
12726     int mode = RTLD_LAZY ;
12727 #endif
12728     handle = dlopen("./dyna.$dlext", mode) ;
12729     if (handle == NULL) {
12730         printf ("1\n") ;
12731         fflush (stdout) ;
12732         exit(0);
12733     }
12734     symbol = dlsym(handle, "fred") ;
12735     if (symbol == NULL) {
12736         /* try putting a leading underscore */
12737         symbol = dlsym(handle, "_fred") ;
12738         if (symbol == NULL) {
12739             printf ("2\n") ;
12740             fflush (stdout) ;
12741             exit(0);
12742         }
12743         printf ("3\n") ;
12744     }
12745     else
12746         printf ("4\n") ;
12747     fflush (stdout) ;
12748     exit(0);
12749 }
12750 EOM
12751         : Call the object file tmp-dyna.o in case dlext=o.
12752         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12753                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12754                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12755                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12756                 xxx=`$run ./fred`
12757                 case $xxx in
12758                 1)      echo "Test program failed using dlopen." >&4
12759                         echo "Perhaps you should not use dynamic loading." >&4;;
12760                 2)      echo "Test program failed using dlsym." >&4
12761                         echo "Perhaps you should not use dynamic loading." >&4;;
12762                 3)      echo "dlsym needs a leading underscore" >&4
12763                         val="$define" ;;
12764                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12765                 esac
12766         else
12767                 echo "I can't compile and run the test program." >&4
12768                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12769         fi
12770         ;;
12771 esac
12772
12773 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12774
12775 set d_dlsymun
12776 eval $setvar
12777
12778 : see if drand48_r exists
12779 set drand48_r d_drand48_r
12780 eval $inlibc
12781 case "$d_drand48_r" in
12782 "$define")
12783         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12784         case "$d_drand48_r_proto:$usethreads" in
12785         ":define")      d_drand48_r_proto=define
12786                 set d_drand48_r_proto drand48_r $hdrs
12787                 eval $hasproto ;;
12788         *)      ;;
12789         esac
12790         case "$d_drand48_r_proto" in
12791         define)
12792         case "$drand48_r_proto" in
12793         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12794         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12795         esac
12796         case "$drand48_r_proto" in
12797         ''|0)   d_drand48_r=undef
12798                 drand48_r_proto=0
12799                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12800         * )     case "$drand48_r_proto" in
12801                 REENTRANT_PROTO*) ;;
12802                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12803                 esac
12804                 echo "Prototype: $try" ;;
12805         esac
12806         ;;
12807         *)      case "$usethreads" in
12808                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12809                 esac
12810                 d_drand48_r=undef
12811                 drand48_r_proto=0
12812                 ;;
12813         esac
12814         ;;
12815 *)      drand48_r_proto=0
12816         ;;
12817 esac
12818
12819 : see if prototype for drand48 is available
12820 echo " "
12821 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12822 eval $hasproto
12823
12824 : see if dup2 exists
12825 set dup2 d_dup2
12826 eval $inlibc
12827
12828 : see if eaccess exists
12829 set eaccess d_eaccess
12830 eval $inlibc
12831
12832 : see if endgrent exists
12833 set endgrent d_endgrent
12834 eval $inlibc
12835
12836 : see if this is an grp system
12837 set grp.h i_grp
12838 eval $inhdr
12839
12840 case "$i_grp" in
12841 $define)
12842         xxx=`./findhdr grp.h`
12843         $cppstdin $cppflags $cppminus < $xxx >$$.h
12844
12845         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12846                 val="$define"
12847         else
12848                 val="$undef"
12849         fi
12850         set d_grpasswd
12851         eval $setvar
12852
12853         $rm -f $$.h
12854         ;;
12855 *)
12856         val="$undef";
12857         set d_grpasswd; eval $setvar
12858         ;;
12859 esac
12860
12861 : see if endgrent_r exists
12862 set endgrent_r d_endgrent_r
12863 eval $inlibc
12864 case "$d_endgrent_r" in
12865 "$define")
12866         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12867         case "$d_endgrent_r_proto:$usethreads" in
12868         ":define")      d_endgrent_r_proto=define
12869                 set d_endgrent_r_proto endgrent_r $hdrs
12870                 eval $hasproto ;;
12871         *)      ;;
12872         esac
12873         case "$d_endgrent_r_proto" in
12874         define)
12875         case "$endgrent_r_proto" in
12876         ''|0) try='int endgrent_r(FILE**);'
12877         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12878         esac
12879         case "$endgrent_r_proto" in
12880         ''|0) try='void endgrent_r(FILE**);'
12881         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12882         esac
12883         case "$endgrent_r_proto" in
12884         ''|0)   d_endgrent_r=undef
12885                 endgrent_r_proto=0
12886                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12887         * )     case "$endgrent_r_proto" in
12888                 REENTRANT_PROTO*) ;;
12889                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12890                 esac
12891                 echo "Prototype: $try" ;;
12892         esac
12893         ;;
12894         *)      case "$usethreads" in
12895                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12896                 esac
12897                 d_endgrent_r=undef
12898                 endgrent_r_proto=0
12899                 ;;
12900         esac
12901         ;;
12902 *)      endgrent_r_proto=0
12903         ;;
12904 esac
12905
12906 : see if endhostent exists
12907 set endhostent d_endhent
12908 eval $inlibc
12909
12910 : see if this is a netdb.h system
12911 set netdb.h i_netdb
12912 eval $inhdr
12913
12914 : see if endhostent_r exists
12915 set endhostent_r d_endhostent_r
12916 eval $inlibc
12917 case "$d_endhostent_r" in
12918 "$define")
12919         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12920         case "$d_endhostent_r_proto:$usethreads" in
12921         ":define")      d_endhostent_r_proto=define
12922                 set d_endhostent_r_proto endhostent_r $hdrs
12923                 eval $hasproto ;;
12924         *)      ;;
12925         esac
12926         case "$d_endhostent_r_proto" in
12927         define)
12928         case "$endhostent_r_proto" in
12929         ''|0) try='int endhostent_r(struct hostent_data*);'
12930         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12931         esac
12932         case "$endhostent_r_proto" in
12933         ''|0) try='void endhostent_r(struct hostent_data*);'
12934         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12935         esac
12936         case "$endhostent_r_proto" in
12937         ''|0)   d_endhostent_r=undef
12938                 endhostent_r_proto=0
12939                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12940         * )     case "$endhostent_r_proto" in
12941                 REENTRANT_PROTO*) ;;
12942                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12943                 esac
12944                 echo "Prototype: $try" ;;
12945         esac
12946         ;;
12947         *)      case "$usethreads" in
12948                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12949                 esac
12950                 d_endhostent_r=undef
12951                 endhostent_r_proto=0
12952                 ;;
12953         esac
12954         ;;
12955 *)      endhostent_r_proto=0
12956         ;;
12957 esac
12958
12959 : see if endnetent exists
12960 set endnetent d_endnent
12961 eval $inlibc
12962
12963 : see if endnetent_r exists
12964 set endnetent_r d_endnetent_r
12965 eval $inlibc
12966 case "$d_endnetent_r" in
12967 "$define")
12968         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12969         case "$d_endnetent_r_proto:$usethreads" in
12970         ":define")      d_endnetent_r_proto=define
12971                 set d_endnetent_r_proto endnetent_r $hdrs
12972                 eval $hasproto ;;
12973         *)      ;;
12974         esac
12975         case "$d_endnetent_r_proto" in
12976         define)
12977         case "$endnetent_r_proto" in
12978         ''|0) try='int endnetent_r(struct netent_data*);'
12979         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12980         esac
12981         case "$endnetent_r_proto" in
12982         ''|0) try='void endnetent_r(struct netent_data*);'
12983         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12984         esac
12985         case "$endnetent_r_proto" in
12986         ''|0)   d_endnetent_r=undef
12987                 endnetent_r_proto=0
12988                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12989         * )     case "$endnetent_r_proto" in
12990                 REENTRANT_PROTO*) ;;
12991                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12992                 esac
12993                 echo "Prototype: $try" ;;
12994         esac
12995         ;;
12996         *)      case "$usethreads" in
12997                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12998                 esac
12999                 d_endnetent_r=undef
13000                 endnetent_r_proto=0
13001                 ;;
13002         esac
13003         ;;
13004 *)      endnetent_r_proto=0
13005         ;;
13006 esac
13007
13008 : see if endprotoent exists
13009 set endprotoent d_endpent
13010 eval $inlibc
13011
13012 : see if endprotoent_r exists
13013 set endprotoent_r d_endprotoent_r
13014 eval $inlibc
13015 case "$d_endprotoent_r" in
13016 "$define")
13017         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13018         case "$d_endprotoent_r_proto:$usethreads" in
13019         ":define")      d_endprotoent_r_proto=define
13020                 set d_endprotoent_r_proto endprotoent_r $hdrs
13021                 eval $hasproto ;;
13022         *)      ;;
13023         esac
13024         case "$d_endprotoent_r_proto" in
13025         define)
13026         case "$endprotoent_r_proto" in
13027         ''|0) try='int endprotoent_r(struct protoent_data*);'
13028         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13029         esac
13030         case "$endprotoent_r_proto" in
13031         ''|0) try='void endprotoent_r(struct protoent_data*);'
13032         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13033         esac
13034         case "$endprotoent_r_proto" in
13035         ''|0)   d_endprotoent_r=undef
13036                 endprotoent_r_proto=0
13037                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13038         * )     case "$endprotoent_r_proto" in
13039                 REENTRANT_PROTO*) ;;
13040                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13041                 esac
13042                 echo "Prototype: $try" ;;
13043         esac
13044         ;;
13045         *)      case "$usethreads" in
13046                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13047                 esac
13048                 d_endprotoent_r=undef
13049                 endprotoent_r_proto=0
13050                 ;;
13051         esac
13052         ;;
13053 *)      endprotoent_r_proto=0
13054         ;;
13055 esac
13056
13057 : see if endpwent exists
13058 set endpwent d_endpwent
13059 eval $inlibc
13060
13061 : see if this is a pwd.h system
13062 set pwd.h i_pwd
13063 eval $inhdr
13064
13065 case "$i_pwd" in
13066 $define)
13067         xxx=`./findhdr pwd.h`
13068         $cppstdin $cppflags $cppminus < $xxx >$$.h
13069
13070         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13071                 val="$define"
13072         else
13073                 val="$undef"
13074         fi
13075         set d_pwquota
13076         eval $setvar
13077
13078         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13079                 val="$define"
13080         else
13081                 val="$undef"
13082         fi
13083         set d_pwage
13084         eval $setvar
13085
13086         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13087                 val="$define"
13088         else
13089                 val="$undef"
13090         fi
13091         set d_pwchange
13092         eval $setvar
13093
13094         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13095                 val="$define"
13096         else
13097                 val="$undef"
13098         fi
13099         set d_pwclass
13100         eval $setvar
13101
13102         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13103                 val="$define"
13104         else
13105                 val="$undef"
13106         fi
13107         set d_pwexpire
13108         eval $setvar
13109
13110         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13111                 val="$define"
13112         else
13113                 val="$undef"
13114         fi
13115         set d_pwcomment
13116         eval $setvar
13117
13118         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13119                 val="$define"
13120         else
13121                 val="$undef"
13122         fi
13123         set d_pwgecos
13124         eval $setvar
13125
13126         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13127                 val="$define"
13128         else
13129                 val="$undef"
13130         fi
13131         set d_pwpasswd
13132         eval $setvar
13133
13134         $rm -f $$.h
13135         ;;
13136 *)
13137         val="$undef";
13138         set d_pwquota; eval $setvar
13139         set d_pwage; eval $setvar
13140         set d_pwchange; eval $setvar
13141         set d_pwclass; eval $setvar
13142         set d_pwexpire; eval $setvar
13143         set d_pwcomment; eval $setvar
13144         set d_pwgecos; eval $setvar
13145         set d_pwpasswd; eval $setvar
13146         ;;
13147 esac
13148
13149 : see if endpwent_r exists
13150 set endpwent_r d_endpwent_r
13151 eval $inlibc
13152 case "$d_endpwent_r" in
13153 "$define")
13154         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13155         case "$d_endpwent_r_proto:$usethreads" in
13156         ":define")      d_endpwent_r_proto=define
13157                 set d_endpwent_r_proto endpwent_r $hdrs
13158                 eval $hasproto ;;
13159         *)      ;;
13160         esac
13161         case "$d_endpwent_r_proto" in
13162         define)
13163         case "$endpwent_r_proto" in
13164         ''|0) try='int endpwent_r(FILE**);'
13165         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13166         esac
13167         case "$endpwent_r_proto" in
13168         ''|0) try='void endpwent_r(FILE**);'
13169         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13170         esac
13171         case "$endpwent_r_proto" in
13172         ''|0)   d_endpwent_r=undef
13173                 endpwent_r_proto=0
13174                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13175         * )     case "$endpwent_r_proto" in
13176                 REENTRANT_PROTO*) ;;
13177                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13178                 esac
13179                 echo "Prototype: $try" ;;
13180         esac
13181         ;;
13182         *)      case "$usethreads" in
13183                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13184                 esac
13185                 d_endpwent_r=undef
13186                 endpwent_r_proto=0
13187                 ;;
13188         esac
13189         ;;
13190 *)      endpwent_r_proto=0
13191         ;;
13192 esac
13193
13194 : see if endservent exists
13195 set endservent d_endsent
13196 eval $inlibc
13197
13198 : see if endservent_r exists
13199 set endservent_r d_endservent_r
13200 eval $inlibc
13201 case "$d_endservent_r" in
13202 "$define")
13203         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13204         case "$d_endservent_r_proto:$usethreads" in
13205         ":define")      d_endservent_r_proto=define
13206                 set d_endservent_r_proto endservent_r $hdrs
13207                 eval $hasproto ;;
13208         *)      ;;
13209         esac
13210         case "$d_endservent_r_proto" in
13211         define)
13212         case "$endservent_r_proto" in
13213         ''|0) try='int endservent_r(struct servent_data*);'
13214         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13215         esac
13216         case "$endservent_r_proto" in
13217         ''|0) try='void endservent_r(struct servent_data*);'
13218         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13219         esac
13220         case "$endservent_r_proto" in
13221         ''|0)   d_endservent_r=undef
13222                 endservent_r_proto=0
13223                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13224         * )     case "$endservent_r_proto" in
13225                 REENTRANT_PROTO*) ;;
13226                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13227                 esac
13228                 echo "Prototype: $try" ;;
13229         esac
13230         ;;
13231         *)      case "$usethreads" in
13232                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13233                 esac
13234                 d_endservent_r=undef
13235                 endservent_r_proto=0
13236                 ;;
13237         esac
13238         ;;
13239 *)      endservent_r_proto=0
13240         ;;
13241 esac
13242
13243 : Locate the flags for 'open()'
13244 echo " "
13245 $cat >try.c <<EOCP
13246 #include <sys/types.h>
13247 #ifdef I_FCNTL
13248 #include <fcntl.h>
13249 #endif
13250 #ifdef I_SYS_FILE
13251 #include <sys/file.h>
13252 #endif
13253 #$i_stdlib I_STDLIB
13254 #ifdef I_STDLIB
13255 #include <stdlib.h>
13256 #endif
13257 int main() {
13258         if(O_RDONLY);
13259 #ifdef O_TRUNC
13260         exit(0);
13261 #else
13262         exit(1);
13263 #endif
13264 }
13265 EOCP
13266 : check sys/file.h first to get FREAD on Sun
13267 if $test `./findhdr sys/file.h` && \
13268                 set try -DI_SYS_FILE && eval $compile; then
13269         h_sysfile=true;
13270         echo "<sys/file.h> defines the O_* constants..." >&4
13271         if $run ./try; then
13272                 echo "and you have the 3 argument form of open()." >&4
13273                 val="$define"
13274         else
13275                 echo "but not the 3 argument form of open().  Oh, well." >&4
13276                 val="$undef"
13277         fi
13278 elif $test `./findhdr fcntl.h` && \
13279                 set try -DI_FCNTL && eval $compile; then
13280         h_fcntl=true;
13281         echo "<fcntl.h> defines the O_* constants..." >&4
13282         if $run ./try; then
13283                 echo "and you have the 3 argument form of open()." >&4
13284                 val="$define"
13285         else
13286                 echo "but not the 3 argument form of open().  Oh, well." >&4
13287                 val="$undef"
13288         fi
13289 else
13290         val="$undef"
13291         echo "I can't find the O_* constant definitions!  You got problems." >&4
13292 fi
13293 set d_open3
13294 eval $setvar
13295 $rm_try
13296
13297 : see if this is a sys/file.h system
13298 val=''
13299 set sys/file.h val
13300 eval $inhdr
13301
13302 : do we need to include sys/file.h ?
13303 case "$val" in
13304 "$define")
13305         echo " "
13306         if $h_sysfile; then
13307                 val="$define"
13308                 echo "We'll be including <sys/file.h>." >&4
13309         else
13310                 val="$undef"
13311                 echo "We won't be including <sys/file.h>." >&4
13312         fi
13313         ;;
13314 *)
13315         h_sysfile=false
13316         ;;
13317 esac
13318 set i_sysfile
13319 eval $setvar
13320
13321 : see if fcntl.h is there
13322 val=''
13323 set fcntl.h val
13324 eval $inhdr
13325
13326 : see if we can include fcntl.h
13327 case "$val" in
13328 "$define")
13329         echo " "
13330         if $h_fcntl; then
13331                 val="$define"
13332                 echo "We'll be including <fcntl.h>." >&4
13333         else
13334                 val="$undef"
13335                 if $h_sysfile; then
13336         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13337                 else
13338                         echo "We won't be including <fcntl.h>." >&4
13339                 fi
13340         fi
13341         ;;
13342 *)
13343         h_fcntl=false
13344         val="$undef"
13345         ;;
13346 esac
13347 set i_fcntl
13348 eval $setvar
13349
13350 : see if fork exists
13351 set fork d_fork
13352 eval $inlibc
13353
13354 : see if pipe exists
13355 set pipe d_pipe
13356 eval $inlibc
13357
13358 : check for non-blocking I/O stuff
13359 case "$h_sysfile" in
13360 true) echo "#include <sys/file.h>" > head.c;;
13361 *)
13362        case "$h_fcntl" in
13363        true) echo "#include <fcntl.h>" > head.c;;
13364        *) echo "#include <sys/fcntl.h>" > head.c;;
13365        esac
13366        ;;
13367 esac
13368 echo " "
13369 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13370 case "$o_nonblock" in
13371 '')
13372         $cat head.c > try.c
13373         $cat >>try.c <<EOCP
13374 #include <stdio.h>
13375 #$i_stdlib I_STDLIB
13376 #ifdef I_STDLIB
13377 #include <stdlib.h>
13378 #endif
13379 #$i_fcntl I_FCNTL
13380 #ifdef I_FCNTL
13381 #include <fcntl.h>
13382 #endif
13383 int main() {
13384 #ifdef O_NONBLOCK
13385         printf("O_NONBLOCK\n");
13386         exit(0);
13387 #endif
13388 #ifdef O_NDELAY
13389         printf("O_NDELAY\n");
13390         exit(0);
13391 #endif
13392 #ifdef FNDELAY
13393         printf("FNDELAY\n");
13394         exit(0);
13395 #endif
13396         exit(0);
13397 }
13398 EOCP
13399         set try
13400         if eval $compile_ok; then
13401                 o_nonblock=`$run ./try`
13402                 case "$o_nonblock" in
13403                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13404                 *) echo "Seems like we can use $o_nonblock.";;
13405                 esac
13406         else
13407                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13408         fi
13409         ;;
13410 *) echo "Using $hint value $o_nonblock.";;
13411 esac
13412 $rm_try
13413
13414 echo " "
13415 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13416 case "$eagain" in
13417 '')
13418         case "$d_fork:$d_pipe:$d_alarm" in
13419         define:define:define)
13420         $cat head.c > try.c
13421         $cat >>try.c <<EOCP
13422 #include <errno.h>
13423 #include <sys/types.h>
13424 #include <signal.h>
13425 #include <stdio.h>
13426 #$i_stdlib I_STDLIB
13427 #ifdef I_STDLIB
13428 #include <stdlib.h>
13429 #endif
13430 #$i_fcntl I_FCNTL
13431 #ifdef I_FCNTL
13432 #include <fcntl.h>
13433 #endif
13434 #define MY_O_NONBLOCK $o_nonblock
13435 #ifndef errno  /* XXX need better Configure test */
13436 extern int errno;
13437 #endif
13438 #$i_unistd I_UNISTD
13439 #ifdef I_UNISTD
13440 #include <unistd.h>
13441 #endif
13442 #$i_string I_STRING
13443 #ifdef I_STRING
13444 #include <string.h>
13445 #else
13446 #include <strings.h>
13447 #endif
13448 $signal_t blech(int x) { exit(3); }
13449 EOCP
13450         $cat >> try.c <<'EOCP'
13451 int main()
13452 {
13453         int pd[2];
13454         int pu[2];
13455         char buf[1];
13456         char string[100];
13457         int ret;
13458
13459         ret = pipe(pd); /* Down: child -> parent */
13460         if (ret != 0)
13461                 exit(3);
13462         ret = pipe(pu); /* Up: parent -> child */
13463         if (ret != 0)
13464                 exit(3);
13465         if (0 != fork()) {
13466                 close(pd[1]);   /* Parent reads from pd[0] */
13467                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13468 #ifdef F_SETFL
13469                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13470                         exit(1);
13471 #else
13472                 exit(4);
13473 #endif
13474                 signal(SIGALRM, blech);
13475                 alarm(5);
13476                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13477                         exit(2);
13478                 sprintf(string, "%d\n", ret);
13479                 ret = write(2, string, strlen(string));
13480                 if (ret != strlen(string))
13481                         exit(3);
13482                 alarm(0);
13483 #ifdef EAGAIN
13484                 if (errno == EAGAIN) {
13485                         printf("EAGAIN\n");
13486                         goto ok;
13487                 }
13488 #endif
13489 #ifdef EWOULDBLOCK
13490                 if (errno == EWOULDBLOCK)
13491                         printf("EWOULDBLOCK\n");
13492 #endif
13493         ok:
13494                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13495                 if (ret != 1)
13496                         exit(3);
13497                 sleep(2);                               /* Give it time to close our pipe */
13498                 alarm(5);
13499                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13500                 alarm(0);
13501                 sprintf(string, "%d\n", ret);
13502                 ret = write(4, string, strlen(string));
13503                 if (ret != strlen(string))
13504                         exit(3);
13505                 exit(0);
13506         }
13507
13508         close(pd[0]);                   /* We write to pd[1] */
13509         close(pu[1]);                   /* We read from pu[0] */
13510         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13511         if (ret != 1)
13512                 exit(3);
13513         close(pd[1]);                   /* Pipe pd is now fully closed! */
13514         exit(0);                                /* Bye bye, thank you for playing! */
13515 }
13516 EOCP
13517         set try
13518         if eval $compile_ok; then
13519                 echo "$startsh" >mtry
13520                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13521                 chmod +x mtry
13522                 $run ./mtry >/dev/null 2>&1
13523                 case $? in
13524                 0) eagain=`$cat try.out`;;
13525                 1) echo "Could not perform non-blocking setting!";;
13526                 2) echo "I did a successful read() for something that was not there!";;
13527                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13528                 4) echo "Could not find F_SETFL!";;
13529                 *) echo "Something terribly wrong happened during testing.";;
13530                 esac
13531                 rd_nodata=`$cat try.ret`
13532                 echo "A read() system call with no data present returns $rd_nodata."
13533                 case "$rd_nodata" in
13534                 0|-1) ;;
13535                 *)
13536                         echo "(That's peculiar, fixing that to be -1.)"
13537                         rd_nodata=-1
13538                         ;;
13539                 esac
13540                 case "$eagain" in
13541                 '')
13542                         echo "Forcing errno EAGAIN on read() with no data available."
13543                         eagain=EAGAIN
13544                         ;;
13545                 *)
13546                         echo "Your read() sets errno to $eagain when no data is available."
13547                         ;;
13548                 esac
13549                 status=`$cat try.err`
13550                 case "$status" in
13551                 0) echo "And it correctly returns 0 to signal EOF.";;
13552                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13553                 *) echo "However, your read() returns '$status' on EOF??";;
13554                 esac
13555                 val="$define"
13556                 if test "$status" = "$rd_nodata"; then
13557                         echo "WARNING: you can't distinguish between EOF and no data!"
13558                         val="$undef"
13559                 fi
13560         else
13561                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13562                 eagain=EAGAIN
13563         fi
13564         ;;
13565         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13566                 eagain=EAGAIN
13567                 val="$define"
13568                 ;;
13569         esac
13570         set d_eofnblk
13571         eval $setvar
13572         ;;
13573 *)
13574         echo "Using $hint value $eagain."
13575         echo "Your read() returns $rd_nodata when no data is present."
13576         case "$d_eofnblk" in
13577         "$define") echo "And you can see EOF because read() returns 0.";;
13578         "$undef") echo "But you can't see EOF status from read() returned value.";;
13579         *)
13580                 echo "(Assuming you can't see EOF status from read anyway.)"
13581                 d_eofnblk=$undef
13582                 ;;
13583         esac
13584         ;;
13585 esac
13586 $rm_try head.c mtry
13587
13588 : see if erf exists
13589 set erf d_erf
13590 eval $inlibc
13591
13592 : see if erfc exists
13593 set erfc d_erfc
13594 eval $inlibc
13595
13596 : see if exp2 exists
13597 set exp2 d_exp2
13598 eval $inlibc
13599
13600 : see if expm1 exists
13601 set expm1 d_expm1
13602 eval $inlibc
13603
13604 : see if _ptr and _cnt from stdio act std
13605 echo " "
13606
13607 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13608         echo "(Looks like you have stdio.h from BSD.)"
13609         case "$stdio_ptr" in
13610         '') stdio_ptr='((fp)->_p)'
13611                 ptr_lval=$define
13612                 ;;
13613         *)      ptr_lval=$d_stdio_ptr_lval;;
13614         esac
13615         case "$stdio_cnt" in
13616         '') stdio_cnt='((fp)->_r)'
13617                 cnt_lval=$define
13618                 ;;
13619         *)      cnt_lval=$d_stdio_cnt_lval;;
13620         esac
13621         case "$stdio_base" in
13622         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13623         esac
13624         case "$stdio_bufsiz" in
13625         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13626         esac
13627 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13628         echo "(Looks like you have stdio.h from Linux.)"
13629         case "$stdio_ptr" in
13630         '') stdio_ptr='((fp)->_IO_read_ptr)'
13631                 ptr_lval=$define
13632                 ;;
13633         *)      ptr_lval=$d_stdio_ptr_lval;;
13634         esac
13635         case "$stdio_cnt" in
13636         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13637                 cnt_lval=$undef
13638                 ;;
13639         *)      cnt_lval=$d_stdio_cnt_lval;;
13640         esac
13641         case "$stdio_base" in
13642         '') stdio_base='((fp)->_IO_read_base)';;
13643         esac
13644         case "$stdio_bufsiz" in
13645         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13646         esac
13647 else
13648         case "$stdio_ptr" in
13649         '') stdio_ptr='((fp)->_ptr)'
13650                 ptr_lval=$define
13651                 ;;
13652         *)      ptr_lval=$d_stdio_ptr_lval;;
13653         esac
13654         case "$stdio_cnt" in
13655         '') stdio_cnt='((fp)->_cnt)'
13656                 cnt_lval=$define
13657                 ;;
13658         *)      cnt_lval=$d_stdio_cnt_lval;;
13659         esac
13660         case "$stdio_base" in
13661         '') stdio_base='((fp)->_base)';;
13662         esac
13663         case "$stdio_bufsiz" in
13664         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13665         esac
13666 fi
13667
13668 : test whether _ptr and _cnt really work
13669 echo "Checking how std your stdio is..." >&4
13670 $cat >try.c <<EOP
13671 #include <stdio.h>
13672 #$i_stdlib I_STDLIB
13673 #ifdef I_STDLIB
13674 #include <stdlib.h>
13675 #endif
13676 #define FILE_ptr(fp)    $stdio_ptr
13677 #define FILE_cnt(fp)    $stdio_cnt
13678 int main() {
13679         FILE *fp = fopen("try.c", "r");
13680         char c = getc(fp);
13681         if (
13682                 18 <= FILE_cnt(fp) &&
13683                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13684         )
13685                 exit(0);
13686         exit(1);
13687 }
13688 EOP
13689 val="$undef"
13690 set try
13691 if eval $compile && $to try.c; then
13692         if $run ./try; then
13693                 echo "Your stdio acts pretty std."
13694                 val="$define"
13695         else
13696                 echo "Your stdio isn't very std."
13697         fi
13698 else
13699         echo "Your stdio doesn't appear very std."
13700 fi
13701 $rm_try
13702
13703 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13704 # direct buffer manipulation no longer works.  The Configure tests
13705 # should be changed to correctly detect this, but until then,
13706 # the following check should at least let perl compile and run.
13707 # (This quick fix should be updated before 5.8.1.)
13708 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13709 # A. Dougherty, June 3, 2002.
13710 case "$d_gnulibc" in
13711 $define)
13712         case "$gnulibc_version" in
13713         2.[01]*)  ;;
13714         2.2) ;;
13715         2.2.[0-9]) ;;
13716         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13717                 val="$undef"
13718                 ;;
13719         esac
13720         ;;
13721 esac
13722 set d_stdstdio
13723 eval $setvar
13724
13725 : Can _ptr be used as an lvalue?
13726 case "$d_stdstdio$ptr_lval" in
13727 $define$define) val=$define ;;
13728 *) val=$undef ;;
13729 esac
13730 set d_stdio_ptr_lval
13731 eval $setvar
13732
13733 : Can _cnt be used as an lvalue?
13734 case "$d_stdstdio$cnt_lval" in
13735 $define$define) val=$define ;;
13736 *) val=$undef ;;
13737 esac
13738 set d_stdio_cnt_lval
13739 eval $setvar
13740
13741
13742 : test whether setting _ptr sets _cnt as a side effect
13743 d_stdio_ptr_lval_sets_cnt="$undef"
13744 d_stdio_ptr_lval_nochange_cnt="$undef"
13745 case "$d_stdio_ptr_lval$d_stdstdio" in
13746 $define$define)
13747         echo "Checking to see what happens if we set the stdio ptr..." >&4
13748 $cat >try.c <<EOP
13749 #include <stdio.h>
13750 /* Can we scream? */
13751 /* Eat dust sed :-) */
13752 /* In the buffer space, no one can hear you scream. */
13753 #$i_stdlib I_STDLIB
13754 #ifdef I_STDLIB
13755 #include <stdlib.h>
13756 #endif
13757 #define FILE_ptr(fp)    $stdio_ptr
13758 #define FILE_cnt(fp)    $stdio_cnt
13759 #include <sys/types.h>
13760 int main() {
13761         FILE *fp = fopen("try.c", "r");
13762         int c;
13763         char *ptr;
13764         size_t cnt;
13765         if (!fp) {
13766             puts("Fail even to read");
13767             exit(1);
13768         }
13769         c = getc(fp); /* Read away the first # */
13770         if (c == EOF) {
13771             puts("Fail even to read");
13772             exit(1);
13773         }
13774         if (!(
13775                 18 <= FILE_cnt(fp) &&
13776                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13777         )) {
13778                 puts("Fail even to read");
13779                 exit (1);
13780         }
13781         ptr = (char*) FILE_ptr(fp);
13782         cnt = (size_t)FILE_cnt(fp);
13783
13784         FILE_ptr(fp) += 42;
13785
13786         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13787                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13788                 exit (1);
13789         }
13790         if (FILE_cnt(fp) <= 20) {
13791                 printf ("Fail (<20 chars to test)");
13792                 exit (1);
13793         }
13794         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13795                 puts("Fail compare");
13796                 exit (1);
13797         }
13798         if (cnt == FILE_cnt(fp)) {
13799                 puts("Pass_unchanged");
13800                 exit (0);
13801         }
13802         if (FILE_cnt(fp) == (cnt - 42)) {
13803                 puts("Pass_changed");
13804                 exit (0);
13805         }
13806         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13807         return 1;
13808
13809 }
13810 EOP
13811         set try
13812         if eval $compile && $to try.c; then
13813                 case `$run ./try` in
13814                 Pass_changed)
13815                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13816                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13817                 Pass_unchanged)
13818                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13819                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13820                 Fail*)
13821                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13822                 *)
13823                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13824         esac
13825         else
13826                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13827         fi
13828         $rm_try
13829         ;;
13830 esac
13831
13832 : see if _base is also standard
13833 val="$undef"
13834 case "$d_stdstdio" in
13835 $define)
13836         $cat >try.c <<EOP
13837 #include <stdio.h>
13838 #$i_stdlib I_STDLIB
13839 #ifdef I_STDLIB
13840 #include <stdlib.h>
13841 #endif
13842 #define FILE_base(fp)   $stdio_base
13843 #define FILE_bufsiz(fp) $stdio_bufsiz
13844 int main() {
13845         FILE *fp = fopen("try.c", "r");
13846         char c = getc(fp);
13847         if (
13848                 19 <= FILE_bufsiz(fp) &&
13849                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13850         )
13851                 exit(0);
13852         exit(1);
13853 }
13854 EOP
13855         set try
13856         if eval $compile && $to try.c; then
13857                 if $run ./try; then
13858                         echo "And its _base field acts std."
13859                         val="$define"
13860                 else
13861                         echo "But its _base field isn't std."
13862                 fi
13863         else
13864                 echo "However, it seems to be lacking the _base field."
13865         fi
13866         $rm_try
13867         ;;
13868 esac
13869 set d_stdiobase
13870 eval $setvar
13871
13872 : see if fast_stdio exists
13873 val="$undef"
13874 case "$d_stdstdio:$d_stdio_ptr_lval" in
13875 "$define:$define")
13876         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13877         *$define*)
13878                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13879                 val="$define"
13880                 ;;
13881         esac
13882         ;;
13883 esac
13884 set d_faststdio
13885 eval $setvar
13886
13887
13888
13889 : see if fchdir exists
13890 set fchdir d_fchdir
13891 eval $inlibc
13892
13893 : see if fchmod exists
13894 set fchmod d_fchmod
13895 eval $inlibc
13896
13897 : see if fchown exists
13898 set fchown d_fchown
13899 eval $inlibc
13900
13901 : see if this is an fcntl system
13902 set fcntl d_fcntl
13903 eval $inlibc
13904
13905 : See if fcntl-based locking works.
13906 echo " "
13907 $cat >try.c <<EOCP
13908 #$i_stdlib I_STDLIB
13909 #ifdef I_STDLIB
13910 #include <stdlib.h>
13911 #endif
13912 #include <unistd.h>
13913 #include <fcntl.h>
13914 #include <signal.h>
13915 $signal_t blech(int x) { exit(3); }
13916 int main() {
13917 #if defined(F_SETLK) && defined(F_SETLKW)
13918      struct flock flock;
13919      int retval, fd;
13920      fd = open("try.c", O_RDONLY);
13921      flock.l_type = F_RDLCK;
13922      flock.l_whence = SEEK_SET;
13923      flock.l_start = flock.l_len = 0;
13924      signal(SIGALRM, blech);
13925      alarm(10);
13926      retval = fcntl(fd, F_SETLK, &flock);
13927      close(fd);
13928      (retval < 0 ? exit(2) : exit(0));
13929 #else
13930      exit(2);
13931 #endif
13932 }
13933 EOCP
13934 echo "Checking if fcntl-based file locking works... "
13935 case "$d_fcntl" in
13936 "$define")
13937         set try
13938         if eval $compile_ok; then
13939                 if $run ./try; then
13940                         echo "Yes, it seems to work."
13941                         val="$define"
13942                 else
13943                         echo "Nope, it didn't work."
13944                         val="$undef"
13945                         case "$?" in
13946                         3) $cat >&4 <<EOM
13947 ***
13948 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13949 *** This is (almost) impossible.
13950 *** If your NFS lock daemons are not feeling well, something like
13951 *** this may happen, please investigate.  Cannot continue, aborting.
13952 ***
13953 EOM
13954                                 exit 1
13955                                 ;;
13956                         esac
13957                 fi
13958         else
13959                 echo "I'm unable to compile the test program, so I'll assume not."
13960                 val="$undef"
13961         fi
13962         ;;
13963 *) val="$undef";
13964         echo "Nope, since you don't even have fcntl()."
13965         ;;
13966 esac
13967 set d_fcntl_can_lock
13968 eval $setvar
13969 $rm_try
13970
13971 : check for fd_set items
13972 $cat <<EOM
13973
13974 Checking to see how well your C compiler handles fd_set and friends ...
13975 EOM
13976 $cat >try.c <<EOCP
13977 #$i_stdlib I_STDLIB
13978 #ifdef I_STDLIB
13979 #include <stdlib.h>
13980 #endif
13981 #$i_systime I_SYS_TIME
13982 #$i_sysselct I_SYS_SELECT
13983 #$d_socket HAS_SOCKET
13984 #include <sys/types.h>
13985 #ifdef HAS_SOCKET
13986 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13987 #endif
13988 #ifdef I_SYS_TIME
13989 #include <sys/time.h>
13990 #endif
13991 #ifdef I_SYS_SELECT
13992 #include <sys/select.h>
13993 #endif
13994 int main() {
13995         fd_set fds;
13996
13997 #ifdef TRYBITS
13998         if(fds.fds_bits);
13999 #endif
14000
14001 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
14002         exit(0);
14003 #else
14004         exit(1);
14005 #endif
14006 }
14007 EOCP
14008 set try -DTRYBITS
14009 if eval $compile; then
14010         d_fds_bits="$define"
14011         d_fd_set="$define"
14012         echo "Well, your system knows about the normal fd_set typedef..." >&4
14013         if $run ./try; then
14014                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14015                 d_fd_macros="$define"
14016         else
14017                 $cat >&4 <<'EOM'
14018 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
14019 EOM
14020                 d_fd_macros="$undef"
14021         fi
14022 else
14023         $cat <<'EOM'
14024 Hmm, your compiler has some difficulty with fd_set.  Checking further...
14025 EOM
14026         set try
14027         if eval $compile; then
14028                 d_fds_bits="$undef"
14029                 d_fd_set="$define"
14030                 echo "Well, your system has some sort of fd_set available..." >&4
14031                 if $run ./try; then
14032                         echo "and you have the normal fd_set macros." >&4
14033                         d_fd_macros="$define"
14034                 else
14035                         $cat <<'EOM'
14036 but not the normal fd_set macros!  Gross!  More work for me...
14037 EOM
14038                         d_fd_macros="$undef"
14039                 fi
14040         else
14041         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14042                 d_fd_set="$undef"
14043                 d_fds_bits="$undef"
14044                 d_fd_macros="$undef"
14045         fi
14046 fi
14047 $rm_try
14048
14049 : see if fdclose exists
14050 set fdclose d_fdclose
14051 eval $inlibc
14052
14053 : see if fdim exists
14054 set fdim d_fdim
14055 eval $inlibc
14056
14057 : see if fegetround exists
14058 set fegetround d_fegetround
14059 eval $inlibc
14060
14061 : see if fgetpos exists
14062 set fgetpos d_fgetpos
14063 eval $inlibc
14064
14065 : see if finite exists
14066 set finite d_finite
14067 eval $inlibc
14068
14069 : see if finitel exists
14070 set finitel d_finitel
14071 eval $inlibc
14072
14073 : see if flock exists
14074 set flock d_flock
14075 eval $inlibc
14076
14077 : see if prototype for flock is available
14078 echo " "
14079 set d_flockproto flock $i_sysfile sys/file.h
14080 eval $hasproto
14081
14082 : see if fma exists
14083 set fma d_fma
14084 eval $inlibc
14085
14086 : see if fmax exists
14087 set fmax d_fmax
14088 eval $inlibc
14089
14090 : see if fmin exists
14091 set fmin d_fmin
14092 eval $inlibc
14093
14094 : see if fp_class exists
14095 set fp_class d_fp_class
14096 eval $inlibc
14097
14098 : see if this is a math.h system
14099 set math.h i_math
14100 eval $inhdr
14101
14102 : check for fpclassify
14103 echo "Checking to see if you have fpclassify..." >&4
14104 $cat >try.c <<EOCP
14105 #$i_math I_MATH
14106 #ifdef I_MATH
14107 #include <math.h>
14108 #endif
14109 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14110 EOCP
14111 set try
14112 if eval $compile; then
14113         val="$define"
14114         echo "You have fpclassify."
14115 else
14116         val="$undef"
14117         echo "You do not have fpclassify."
14118 fi
14119 $rm_try
14120 set d_fpclassify
14121 eval $setvar
14122
14123 : see if fp_classify exists
14124 set fp_classify d_fp_classify
14125 eval $inlibc
14126
14127 : see if fp_classl exists
14128 set fp_classl d_fp_classl
14129 eval $inlibc
14130
14131 : see if pathconf exists
14132 set pathconf d_pathconf
14133 eval $inlibc
14134
14135 : see if fpathconf exists
14136 set fpathconf d_fpathconf
14137 eval $inlibc
14138
14139 : see if fpclass exists
14140 set fpclass d_fpclass
14141 eval $inlibc
14142
14143 : see if fpclassl exists
14144 set fpclassl d_fpclassl
14145 eval $inlibc
14146
14147 : see if fpgetround exists
14148 set fpgetround d_fpgetround
14149 eval $inlibc
14150
14151 : check for fpos64_t
14152 echo " "
14153 echo "Checking to see if you have fpos64_t..." >&4
14154 $cat >try.c <<EOCP
14155 #include <stdio.h>
14156 int main() { fpos64_t x = 7; }
14157 EOCP
14158 set try
14159 if eval $compile; then
14160         val="$define"
14161         echo "You have fpos64_t."
14162 else
14163         val="$undef"
14164         echo "You do not have fpos64_t."
14165         case "$fpossize" in
14166         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14167         esac
14168 fi
14169 $rm_try
14170 set d_fpos64_t
14171 eval $setvar
14172
14173 : see if frexpl exists
14174 set frexpl d_frexpl
14175 eval $inlibc
14176
14177 : see if this is a sys/param system
14178 set sys/param.h i_sysparam
14179 eval $inhdr
14180
14181 : see if this is a sys/mount.h system
14182 set sys/mount.h i_sysmount
14183 eval $inhdr
14184
14185 : Check for fs_data_s
14186 echo " "
14187 echo "Checking to see if your system supports struct fs_data..." >&4
14188 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14189 eval $hasstruct
14190 case "$d_fs_data_s" in
14191 "$define")      echo "Yes, it does."   ;;
14192 *)              echo "No, it doesn't." ;;
14193 esac
14194
14195 : see if fseeko exists
14196 set fseeko d_fseeko
14197 eval $inlibc
14198 case "$longsize" in
14199 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14200 esac
14201
14202 : see if fsetpos exists
14203 set fsetpos d_fsetpos
14204 eval $inlibc
14205
14206 : see if fstatfs exists
14207 set fstatfs d_fstatfs
14208 eval $inlibc
14209
14210 : see if statvfs exists
14211 set statvfs d_statvfs
14212 eval $inlibc
14213
14214 : see if fstatvfs exists
14215 set fstatvfs d_fstatvfs
14216 eval $inlibc
14217
14218
14219 : see if fsync exists
14220 set fsync d_fsync
14221 eval $inlibc
14222
14223 : see if ftello exists
14224 set ftello d_ftello
14225 eval $inlibc
14226 case "$longsize" in
14227 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14228 esac
14229
14230 : check for a working futimes
14231 d_futimes="$undef"
14232 echo " "
14233 echo "Checking if you have a working futimes()" >&4
14234 $cat >try.c <<EOCP
14235 #include <stdio.h>
14236 #include <sys/time.h>
14237 #include <errno.h>
14238 #include <fcntl.h>
14239
14240 int main ()
14241 {
14242     int fd, rv;
14243     fd = open ("try.c", O_RDWR);
14244     if (-1 == fd) exit (1);
14245     rv = futimes (fd, NULL);
14246     exit (rv == -1 ? errno : 0);
14247 }
14248 EOCP
14249 set try
14250 if eval $compile; then
14251     `$run ./try`
14252     rc=$?
14253     case "$rc" in
14254         0)  echo "Yes, you have" >&4
14255             d_futimes="$define"
14256             ;;
14257         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14258             ;;
14259     esac
14260 else
14261     echo "No, it does not (probably harmless)" >&4
14262 fi
14263 $rm_try
14264
14265 : see if ndbm.h is available
14266 set ndbm.h i_ndbm
14267 eval $inhdr
14268 : Compatibility location for RedHat 7.1
14269 set gdbm/ndbm.h i_gdbmndbm
14270 eval $inhdr
14271 : Compatibility location for Debian 4.0
14272 set gdbm-ndbm.h i_gdbm_ndbm
14273 eval $inhdr
14274
14275 val="$undef"
14276 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14277         : see if dbm_open exists
14278         set dbm_open d_dbm_open
14279         eval $inlibc
14280         case "$d_dbm_open" in
14281         $undef)
14282                 i_ndbm="$undef"
14283                 i_gdbmndbm="$undef"
14284                 i_gdbm_ndbm="$undef"
14285                 echo "We won't be including <ndbm.h>"
14286                 val="$undef"
14287                 ;;
14288         *) val="$define"
14289            ;;
14290         esac
14291 fi
14292 set d_ndbm
14293 eval $setvar
14294
14295 ndbm_hdr_protochk='name=$1; hdr=$2;
14296 eval "ihdr=\$""i_$name";
14297 val="$undef";
14298 if $test "$ihdr" = "$define"; then
14299         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14300         case "$d_cplusplus" in
14301         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14302         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14303         esac;
14304         case "$val" in
14305         $define) $echo "Your <$hdr> seems to have prototypes";;
14306         *) $echo "Your <$hdr> does not seem to have prototypes";;
14307         esac;
14308 fi;
14309 set "d_${name}_h_uses_prototypes";
14310 eval $setvar'
14311
14312 set ndbm ndbm.h
14313 eval $ndbm_hdr_protochk
14314 set gdbmndbm gdbm/ndbm.h
14315 eval $ndbm_hdr_protochk
14316 set gdbm_ndbm gdbm-ndbm.h
14317 eval $ndbm_hdr_protochk
14318
14319 : see if getaddrinfo exists
14320 set getaddrinfo d_getaddrinfo
14321 eval $inlibc
14322
14323 : see if getcwd exists
14324 set getcwd d_getcwd
14325 eval $inlibc
14326
14327 : see if getespwnam exists
14328 set getespwnam d_getespwnam
14329 eval $inlibc
14330
14331 : see if getfsstat exists
14332 set getfsstat d_getfsstat
14333 eval $inlibc
14334
14335 : see if getgrent exists
14336 set getgrent d_getgrent
14337 eval $inlibc
14338
14339 : see if getgrent_r exists
14340 set getgrent_r d_getgrent_r
14341 eval $inlibc
14342 case "$d_getgrent_r" in
14343 "$define")
14344         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14345         case "$d_getgrent_r_proto:$usethreads" in
14346         ":define")      d_getgrent_r_proto=define
14347                 set d_getgrent_r_proto getgrent_r $hdrs
14348                 eval $hasproto ;;
14349         *)      ;;
14350         esac
14351         case "$d_getgrent_r_proto" in
14352         define)
14353         case "$getgrent_r_proto" in
14354         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14355         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14356         esac
14357         case "$getgrent_r_proto" in
14358         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14359         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14360         esac
14361         case "$getgrent_r_proto" in
14362         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14363         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14364         esac
14365         case "$getgrent_r_proto" in
14366         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14367         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14368         esac
14369         case "$getgrent_r_proto" in
14370         ''|0) try='int getgrent_r(struct group*, char*, int);'
14371         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14372         esac
14373         case "$getgrent_r_proto" in
14374         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14375         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14376         esac
14377         case "$getgrent_r_proto" in
14378         ''|0)   d_getgrent_r=undef
14379                 getgrent_r_proto=0
14380                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14381         * )     case "$getgrent_r_proto" in
14382                 REENTRANT_PROTO*) ;;
14383                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14384                 esac
14385                 echo "Prototype: $try" ;;
14386         esac
14387         ;;
14388         *)      case "$usethreads" in
14389                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14390                 esac
14391                 d_getgrent_r=undef
14392                 getgrent_r_proto=0
14393                 ;;
14394         esac
14395         ;;
14396 *)      getgrent_r_proto=0
14397         ;;
14398 esac
14399
14400 : see if getgrgid_r exists
14401 set getgrgid_r d_getgrgid_r
14402 eval $inlibc
14403 case "$d_getgrgid_r" in
14404 "$define")
14405         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14406         case "$d_getgrgid_r_proto:$usethreads" in
14407         ":define")      d_getgrgid_r_proto=define
14408                 set d_getgrgid_r_proto getgrgid_r $hdrs
14409                 eval $hasproto ;;
14410         *)      ;;
14411         esac
14412         case "$d_getgrgid_r_proto" in
14413         define)
14414         case "$getgrgid_r_proto" in
14415         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14416         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14417         esac
14418         case "$getgrgid_r_proto" in
14419         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14420         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14421         esac
14422         case "$getgrgid_r_proto" in
14423         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14424         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14425         esac
14426         case "$getgrgid_r_proto" in
14427         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14428         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14429         esac
14430         case "$getgrgid_r_proto" in
14431         ''|0)   d_getgrgid_r=undef
14432                 getgrgid_r_proto=0
14433                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14434         * )     case "$getgrgid_r_proto" in
14435                 REENTRANT_PROTO*) ;;
14436                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14437                 esac
14438                 echo "Prototype: $try" ;;
14439         esac
14440         ;;
14441         *)      case "$usethreads" in
14442                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14443                 esac
14444                 d_getgrgid_r=undef
14445                 getgrgid_r_proto=0
14446                 ;;
14447         esac
14448         ;;
14449 *)      getgrgid_r_proto=0
14450         ;;
14451 esac
14452
14453 : see if getgrnam_r exists
14454 set getgrnam_r d_getgrnam_r
14455 eval $inlibc
14456 case "$d_getgrnam_r" in
14457 "$define")
14458         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14459         case "$d_getgrnam_r_proto:$usethreads" in
14460         ":define")      d_getgrnam_r_proto=define
14461                 set d_getgrnam_r_proto getgrnam_r $hdrs
14462                 eval $hasproto ;;
14463         *)      ;;
14464         esac
14465         case "$d_getgrnam_r_proto" in
14466         define)
14467         case "$getgrnam_r_proto" in
14468         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14469         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14470         esac
14471         case "$getgrnam_r_proto" in
14472         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14473         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14474         esac
14475         case "$getgrnam_r_proto" in
14476         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14477         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14478         esac
14479         case "$getgrnam_r_proto" in
14480         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14481         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14482         esac
14483         case "$getgrnam_r_proto" in
14484         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14485         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14486         esac
14487         case "$getgrnam_r_proto" in
14488         ''|0)   d_getgrnam_r=undef
14489                 getgrnam_r_proto=0
14490                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14491         * )     case "$getgrnam_r_proto" in
14492                 REENTRANT_PROTO*) ;;
14493                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14494                 esac
14495                 echo "Prototype: $try" ;;
14496         esac
14497         ;;
14498         *)      case "$usethreads" in
14499                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14500                 esac
14501                 d_getgrnam_r=undef
14502                 getgrnam_r_proto=0
14503                 ;;
14504         esac
14505         ;;
14506 *)      getgrnam_r_proto=0
14507         ;;
14508 esac
14509
14510 : see if gethostbyaddr exists
14511 set gethostbyaddr d_gethbyaddr
14512 eval $inlibc
14513
14514 : see if gethostbyname exists
14515 set gethostbyname d_gethbyname
14516 eval $inlibc
14517
14518 : see if gethostent exists
14519 set gethostent d_gethent
14520 eval $inlibc
14521
14522 : see how we will look up host name
14523 echo " "
14524 call=''
14525 if set gethostname val -f d_gethname; eval $csym; $val; then
14526         echo 'gethostname() found.' >&4
14527         d_gethname="$define"
14528         call=gethostname
14529 fi
14530 if set uname val -f d_uname; eval $csym; $val; then
14531         if ./xenix; then
14532                 $cat <<'EOM'
14533 uname() was found, but you're running xenix, and older versions of xenix
14534 have a broken uname(). If you don't really know whether your xenix is old
14535 enough to have a broken system call, use the default answer.
14536
14537 EOM
14538                 dflt=y
14539                 case "$d_uname" in
14540                 "$define") dflt=n;;
14541                 esac
14542                 rp='Is your uname() broken?'
14543                 . ./myread
14544                 case "$ans" in
14545                 n*) d_uname="$define"; call=uname;;
14546                 esac
14547         else
14548                 echo 'uname() found.' >&4
14549                 d_uname="$define"
14550                 case "$call" in
14551                 '') call=uname ;;
14552                 esac
14553         fi
14554 fi
14555 case "$d_gethname" in
14556 '') d_gethname="$undef";;
14557 esac
14558 case "$d_uname" in
14559 '') d_uname="$undef";;
14560 esac
14561 case "$d_uname$d_gethname" in
14562 *define*)
14563         dflt=n
14564         cat <<EOM
14565
14566 Every now and then someone has a $call() that lies about the hostname
14567 but can't be fixed for political or economic reasons.  If you wish, I can
14568 pretend $call() isn't there and maybe compute hostname at run-time
14569 thanks to the '$phostname' command.
14570
14571 EOM
14572         rp="Shall I ignore $call() from now on?"
14573         . ./myread
14574         case "$ans" in
14575         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14576         esac;;
14577 esac
14578 case "$phostname" in
14579 '') aphostname='';;
14580 *) case "$aphostname" in
14581         /*) ;;
14582         *) set X $phostname
14583                 shift
14584                 file=$1
14585                 shift
14586                 file=`./loc $file $file $pth`
14587                 aphostname=`echo $file $*`
14588                 ;;
14589         esac
14590         ;;
14591 esac
14592 case "$d_uname$d_gethname" in
14593 *define*) ;;
14594 *)
14595         case "$phostname" in
14596         '')
14597                 echo "There will be no way for $package to get your hostname." >&4;;
14598         *)
14599         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14600                 ;;
14601         esac;;
14602 esac
14603 case "$d_phostname" in
14604 '') d_phostname="$undef";;
14605 esac
14606
14607 : see if gethostbyaddr_r exists
14608 set gethostbyaddr_r d_gethostbyaddr_r
14609 eval $inlibc
14610 case "$d_gethostbyaddr_r" in
14611 "$define")
14612         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14613         case "$d_gethostbyaddr_r_proto:$usethreads" in
14614         ":define")      d_gethostbyaddr_r_proto=define
14615                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14616                 eval $hasproto ;;
14617         *)      ;;
14618         esac
14619         case "$d_gethostbyaddr_r_proto" in
14620         define)
14621         case "$gethostbyaddr_r_proto" in
14622         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14623         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14624         esac
14625         case "$gethostbyaddr_r_proto" in
14626         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14627         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14628         esac
14629         case "$gethostbyaddr_r_proto" in
14630         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14631         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14632         esac
14633         case "$gethostbyaddr_r_proto" in
14634         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14635         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14636         esac
14637         case "$gethostbyaddr_r_proto" in
14638         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14639         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14640         esac
14641         case "$gethostbyaddr_r_proto" in
14642         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14643         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14644         esac
14645         case "$gethostbyaddr_r_proto" in
14646         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14647         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14648         esac
14649         case "$gethostbyaddr_r_proto" in
14650         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14651         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14652         esac
14653         case "$gethostbyaddr_r_proto" in
14654         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14655         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14656         esac
14657         case "$gethostbyaddr_r_proto" in
14658         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14659         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14660         esac
14661         case "$gethostbyaddr_r_proto" in
14662         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14663         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14664         esac
14665         case "$gethostbyaddr_r_proto" in
14666         ''|0)   d_gethostbyaddr_r=undef
14667                 gethostbyaddr_r_proto=0
14668                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14669         * )     case "$gethostbyaddr_r_proto" in
14670                 REENTRANT_PROTO*) ;;
14671                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14672                 esac
14673                 echo "Prototype: $try" ;;
14674         esac
14675         ;;
14676         *)      case "$usethreads" in
14677                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14678                 esac
14679                 d_gethostbyaddr_r=undef
14680                 gethostbyaddr_r_proto=0
14681                 ;;
14682         esac
14683         ;;
14684 *)      gethostbyaddr_r_proto=0
14685         ;;
14686 esac
14687
14688 : see if gethostbyname_r exists
14689 set gethostbyname_r d_gethostbyname_r
14690 eval $inlibc
14691 case "$d_gethostbyname_r" in
14692 "$define")
14693         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14694         case "$d_gethostbyname_r_proto:$usethreads" in
14695         ":define")      d_gethostbyname_r_proto=define
14696                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14697                 eval $hasproto ;;
14698         *)      ;;
14699         esac
14700         case "$d_gethostbyname_r_proto" in
14701         define)
14702         case "$gethostbyname_r_proto" in
14703         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14704         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14705         esac
14706         case "$gethostbyname_r_proto" in
14707         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14708         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14709         esac
14710         case "$gethostbyname_r_proto" in
14711         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14712         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14713         esac
14714         case "$gethostbyname_r_proto" in
14715         ''|0)   d_gethostbyname_r=undef
14716                 gethostbyname_r_proto=0
14717                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14718         * )     case "$gethostbyname_r_proto" in
14719                 REENTRANT_PROTO*) ;;
14720                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14721                 esac
14722                 echo "Prototype: $try" ;;
14723         esac
14724         ;;
14725         *)      case "$usethreads" in
14726                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14727                 esac
14728                 d_gethostbyname_r=undef
14729                 gethostbyname_r_proto=0
14730                 ;;
14731         esac
14732         ;;
14733 *)      gethostbyname_r_proto=0
14734         ;;
14735 esac
14736
14737 : see if gethostent_r exists
14738 set gethostent_r d_gethostent_r
14739 eval $inlibc
14740 case "$d_gethostent_r" in
14741 "$define")
14742         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14743         case "$d_gethostent_r_proto:$usethreads" in
14744         ":define")      d_gethostent_r_proto=define
14745                 set d_gethostent_r_proto gethostent_r $hdrs
14746                 eval $hasproto ;;
14747         *)      ;;
14748         esac
14749         case "$d_gethostent_r_proto" in
14750         define)
14751         case "$gethostent_r_proto" in
14752         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14753         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14754         esac
14755         case "$gethostent_r_proto" in
14756         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14757         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14758         esac
14759         case "$gethostent_r_proto" in
14760         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14761         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14762         esac
14763         case "$gethostent_r_proto" in
14764         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14765         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14766         esac
14767         case "$gethostent_r_proto" in
14768         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14769         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14770         esac
14771         case "$gethostent_r_proto" in
14772         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14773         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14774         esac
14775         case "$gethostent_r_proto" in
14776         ''|0)   d_gethostent_r=undef
14777                 gethostent_r_proto=0
14778                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14779         * )     case "$gethostent_r_proto" in
14780                 REENTRANT_PROTO*) ;;
14781                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14782                 esac
14783                 echo "Prototype: $try" ;;
14784         esac
14785         ;;
14786         *)      case "$usethreads" in
14787                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14788                 esac
14789                 d_gethostent_r=undef
14790                 gethostent_r_proto=0
14791                 ;;
14792         esac
14793         ;;
14794 *)      gethostent_r_proto=0
14795         ;;
14796 esac
14797
14798 : see if prototypes for various gethostxxx netdb.h functions are available
14799 echo " "
14800 set d_gethostprotos gethostent $i_netdb netdb.h
14801 eval $hasproto
14802
14803 : see if getitimer exists
14804 set getitimer d_getitimer
14805 eval $inlibc
14806
14807 : see if getlogin exists
14808 set getlogin d_getlogin
14809 eval $inlibc
14810
14811 : see if getlogin_r exists
14812 set getlogin_r d_getlogin_r
14813 eval $inlibc
14814 case "$d_getlogin_r" in
14815 "$define")
14816         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14817         case "$d_getlogin_r_proto:$usethreads" in
14818         ":define")      d_getlogin_r_proto=define
14819                 set d_getlogin_r_proto getlogin_r $hdrs
14820                 eval $hasproto ;;
14821         *)      ;;
14822         esac
14823         case "$d_getlogin_r_proto" in
14824         define)
14825         case "$getlogin_r_proto" in
14826         ''|0) try='int getlogin_r(char*, size_t);'
14827         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14828         esac
14829         case "$getlogin_r_proto" in
14830         ''|0) try='int getlogin_r(char*, int);'
14831         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14832         esac
14833         case "$getlogin_r_proto" in
14834         ''|0) try='char* getlogin_r(char*, size_t);'
14835         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14836         esac
14837         case "$getlogin_r_proto" in
14838         ''|0) try='char* getlogin_r(char*, int);'
14839         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14840         esac
14841         case "$getlogin_r_proto" in
14842         ''|0)   d_getlogin_r=undef
14843                 getlogin_r_proto=0
14844                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14845         * )     case "$getlogin_r_proto" in
14846                 REENTRANT_PROTO*) ;;
14847                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14848                 esac
14849                 echo "Prototype: $try" ;;
14850         esac
14851         ;;
14852         *)      case "$usethreads" in
14853                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14854                 esac
14855                 d_getlogin_r=undef
14856                 getlogin_r_proto=0
14857                 ;;
14858         esac
14859         ;;
14860 *)      getlogin_r_proto=0
14861         ;;
14862 esac
14863
14864 : see if getmnt exists
14865 set getmnt d_getmnt
14866 eval $inlibc
14867
14868 : see if getmntent exists
14869 set getmntent d_getmntent
14870 eval $inlibc
14871
14872 : see if getnameinfo exists
14873 set getnameinfo d_getnameinfo
14874 eval $inlibc
14875
14876 : see if getnetbyaddr exists
14877 set getnetbyaddr d_getnbyaddr
14878 eval $inlibc
14879
14880 : see if getnetbyname exists
14881 set getnetbyname d_getnbyname
14882 eval $inlibc
14883
14884 : see if getnetent exists
14885 set getnetent d_getnent
14886 eval $inlibc
14887
14888 : see if getnetbyaddr_r exists
14889 set getnetbyaddr_r d_getnetbyaddr_r
14890 eval $inlibc
14891 case "$d_getnetbyaddr_r" in
14892 "$define")
14893         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14894         case "$d_getnetbyaddr_r_proto:$usethreads" in
14895         ":define")      d_getnetbyaddr_r_proto=define
14896                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14897                 eval $hasproto ;;
14898         *)      ;;
14899         esac
14900         case "$d_getnetbyaddr_r_proto" in
14901         define)
14902         case "$getnetbyaddr_r_proto" in
14903         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14904         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14905         esac
14906         case "$getnetbyaddr_r_proto" in
14907         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14908         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14909         esac
14910         case "$getnetbyaddr_r_proto" in
14911         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14912         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14913         esac
14914         case "$getnetbyaddr_r_proto" in
14915         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14916         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14917         esac
14918         case "$getnetbyaddr_r_proto" in
14919         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14920         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14921         esac
14922         case "$getnetbyaddr_r_proto" in
14923         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14924         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14925         esac
14926         case "$getnetbyaddr_r_proto" in
14927         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14928         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14929         esac
14930         case "$getnetbyaddr_r_proto" in
14931         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14932         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14933         esac
14934         case "$getnetbyaddr_r_proto" in
14935         ''|0)   d_getnetbyaddr_r=undef
14936                 getnetbyaddr_r_proto=0
14937                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14938         * )     case "$getnetbyaddr_r_proto" in
14939                 REENTRANT_PROTO*) ;;
14940                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14941                 esac
14942                 echo "Prototype: $try" ;;
14943         esac
14944         ;;
14945         *)      case "$usethreads" in
14946                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14947                 esac
14948                 d_getnetbyaddr_r=undef
14949                 getnetbyaddr_r_proto=0
14950                 ;;
14951         esac
14952         ;;
14953 *)      getnetbyaddr_r_proto=0
14954         ;;
14955 esac
14956
14957 : see if getnetbyname_r exists
14958 set getnetbyname_r d_getnetbyname_r
14959 eval $inlibc
14960 case "$d_getnetbyname_r" in
14961 "$define")
14962         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14963         case "$d_getnetbyname_r_proto:$usethreads" in
14964         ":define")      d_getnetbyname_r_proto=define
14965                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14966                 eval $hasproto ;;
14967         *)      ;;
14968         esac
14969         case "$d_getnetbyname_r_proto" in
14970         define)
14971         case "$getnetbyname_r_proto" in
14972         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14973         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14974         esac
14975         case "$getnetbyname_r_proto" in
14976         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14977         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14978         esac
14979         case "$getnetbyname_r_proto" in
14980         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14981         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14982         esac
14983         case "$getnetbyname_r_proto" in
14984         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14985         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14986         esac
14987         case "$getnetbyname_r_proto" in
14988         ''|0)   d_getnetbyname_r=undef
14989                 getnetbyname_r_proto=0
14990                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14991         * )     case "$getnetbyname_r_proto" in
14992                 REENTRANT_PROTO*) ;;
14993                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14994                 esac
14995                 echo "Prototype: $try" ;;
14996         esac
14997         ;;
14998         *)      case "$usethreads" in
14999                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
15000                 esac
15001                 d_getnetbyname_r=undef
15002                 getnetbyname_r_proto=0
15003                 ;;
15004         esac
15005         ;;
15006 *)      getnetbyname_r_proto=0
15007         ;;
15008 esac
15009
15010 : see if getnetent_r exists
15011 set getnetent_r d_getnetent_r
15012 eval $inlibc
15013 case "$d_getnetent_r" in
15014 "$define")
15015         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15016         case "$d_getnetent_r_proto:$usethreads" in
15017         ":define")      d_getnetent_r_proto=define
15018                 set d_getnetent_r_proto getnetent_r $hdrs
15019                 eval $hasproto ;;
15020         *)      ;;
15021         esac
15022         case "$d_getnetent_r_proto" in
15023         define)
15024         case "$getnetent_r_proto" in
15025         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15026         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15027         esac
15028         case "$getnetent_r_proto" in
15029         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15030         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15031         esac
15032         case "$getnetent_r_proto" in
15033         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15034         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15035         esac
15036         case "$getnetent_r_proto" in
15037         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15038         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15039         esac
15040         case "$getnetent_r_proto" in
15041         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15042         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15043         esac
15044         case "$getnetent_r_proto" in
15045         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15046         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15047         esac
15048         case "$getnetent_r_proto" in
15049         ''|0)   d_getnetent_r=undef
15050                 getnetent_r_proto=0
15051                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15052         * )     case "$getnetent_r_proto" in
15053                 REENTRANT_PROTO*) ;;
15054                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15055                 esac
15056                 echo "Prototype: $try" ;;
15057         esac
15058         ;;
15059         *)      case "$usethreads" in
15060                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15061                 esac
15062                 d_getnetent_r=undef
15063                 getnetent_r_proto=0
15064                 ;;
15065         esac
15066         ;;
15067 *)      getnetent_r_proto=0
15068         ;;
15069 esac
15070
15071 : see if prototypes for various getnetxxx netdb.h functions are available
15072 echo " "
15073 set d_getnetprotos getnetent $i_netdb netdb.h
15074 eval $hasproto
15075
15076 : see if getpagesize exists
15077 set getpagesize d_getpagsz
15078 eval $inlibc
15079
15080 : Optional checks for getprotobyname and getprotobynumber
15081
15082 : see if getprotobyname exists
15083 set getprotobyname d_getpbyname
15084 eval $inlibc
15085
15086 : see if getprotobynumber exists
15087 set getprotobynumber d_getpbynumber
15088 eval $inlibc
15089
15090 : see if getprotoent exists
15091 set getprotoent d_getpent
15092 eval $inlibc
15093
15094 : see if getpgid exists
15095 set getpgid d_getpgid
15096 eval $inlibc
15097
15098 : see if getpgrp2 exists
15099 set getpgrp2 d_getpgrp2
15100 eval $inlibc
15101
15102 : see if getppid exists
15103 set getppid d_getppid
15104 eval $inlibc
15105
15106 : see if getpriority exists
15107 set getpriority d_getprior
15108 eval $inlibc
15109
15110 : see if getprotobyname_r exists
15111 set getprotobyname_r d_getprotobyname_r
15112 eval $inlibc
15113 case "$d_getprotobyname_r" in
15114 "$define")
15115         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15116         case "$d_getprotobyname_r_proto:$usethreads" in
15117         ":define")      d_getprotobyname_r_proto=define
15118                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15119                 eval $hasproto ;;
15120         *)      ;;
15121         esac
15122         case "$d_getprotobyname_r_proto" in
15123         define)
15124         case "$getprotobyname_r_proto" in
15125         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15126         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15127         esac
15128         case "$getprotobyname_r_proto" in
15129         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15130         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15131         esac
15132         case "$getprotobyname_r_proto" in
15133         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15134         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15135         esac
15136         case "$getprotobyname_r_proto" in
15137         ''|0)   d_getprotobyname_r=undef
15138                 getprotobyname_r_proto=0
15139                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15140         * )     case "$getprotobyname_r_proto" in
15141                 REENTRANT_PROTO*) ;;
15142                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15143                 esac
15144                 echo "Prototype: $try" ;;
15145         esac
15146         ;;
15147         *)      case "$usethreads" in
15148                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15149                 esac
15150                 d_getprotobyname_r=undef
15151                 getprotobyname_r_proto=0
15152                 ;;
15153         esac
15154         ;;
15155 *)      getprotobyname_r_proto=0
15156         ;;
15157 esac
15158
15159 : see if getprotobynumber_r exists
15160 set getprotobynumber_r d_getprotobynumber_r
15161 eval $inlibc
15162 case "$d_getprotobynumber_r" in
15163 "$define")
15164         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15165         case "$d_getprotobynumber_r_proto:$usethreads" in
15166         ":define")      d_getprotobynumber_r_proto=define
15167                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15168                 eval $hasproto ;;
15169         *)      ;;
15170         esac
15171         case "$d_getprotobynumber_r_proto" in
15172         define)
15173         case "$getprotobynumber_r_proto" in
15174         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15175         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15176         esac
15177         case "$getprotobynumber_r_proto" in
15178         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15179         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15180         esac
15181         case "$getprotobynumber_r_proto" in
15182         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15183         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15184         esac
15185         case "$getprotobynumber_r_proto" in
15186         ''|0)   d_getprotobynumber_r=undef
15187                 getprotobynumber_r_proto=0
15188                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15189         * )     case "$getprotobynumber_r_proto" in
15190                 REENTRANT_PROTO*) ;;
15191                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15192                 esac
15193                 echo "Prototype: $try" ;;
15194         esac
15195         ;;
15196         *)      case "$usethreads" in
15197                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15198                 esac
15199                 d_getprotobynumber_r=undef
15200                 getprotobynumber_r_proto=0
15201                 ;;
15202         esac
15203         ;;
15204 *)      getprotobynumber_r_proto=0
15205         ;;
15206 esac
15207
15208 : see if getprotoent_r exists
15209 set getprotoent_r d_getprotoent_r
15210 eval $inlibc
15211 case "$d_getprotoent_r" in
15212 "$define")
15213         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15214         case "$d_getprotoent_r_proto:$usethreads" in
15215         ":define")      d_getprotoent_r_proto=define
15216                 set d_getprotoent_r_proto getprotoent_r $hdrs
15217                 eval $hasproto ;;
15218         *)      ;;
15219         esac
15220         case "$d_getprotoent_r_proto" in
15221         define)
15222         case "$getprotoent_r_proto" in
15223         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15224         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15225         esac
15226         case "$getprotoent_r_proto" in
15227         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15228         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15229         esac
15230         case "$getprotoent_r_proto" in
15231         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15232         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15233         esac
15234         case "$getprotoent_r_proto" in
15235         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15236         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15237         esac
15238         case "$getprotoent_r_proto" in
15239         ''|0)   d_getprotoent_r=undef
15240                 getprotoent_r_proto=0
15241                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15242         * )     case "$getprotoent_r_proto" in
15243                 REENTRANT_PROTO*) ;;
15244                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15245                 esac
15246                 echo "Prototype: $try" ;;
15247         esac
15248         ;;
15249         *)      case "$usethreads" in
15250                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15251                 esac
15252                 d_getprotoent_r=undef
15253                 getprotoent_r_proto=0
15254                 ;;
15255         esac
15256         ;;
15257 *)      getprotoent_r_proto=0
15258         ;;
15259 esac
15260
15261 : see if prototypes for various getprotoxxx netdb.h functions are available
15262 echo " "
15263 set d_getprotoprotos getprotoent $i_netdb netdb.h
15264 eval $hasproto
15265
15266 : see if getprpwnam exists
15267 set getprpwnam d_getprpwnam
15268 eval $inlibc
15269
15270 : see if getpwent exists
15271 set getpwent d_getpwent
15272 eval $inlibc
15273
15274 : see if getpwent_r exists
15275 set getpwent_r d_getpwent_r
15276 eval $inlibc
15277 case "$d_getpwent_r" in
15278 "$define")
15279         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15280         case "$d_getpwent_r_proto:$usethreads" in
15281         ":define")      d_getpwent_r_proto=define
15282                 set d_getpwent_r_proto getpwent_r $hdrs
15283                 eval $hasproto ;;
15284         *)      ;;
15285         esac
15286         case "$d_getpwent_r_proto" in
15287         define)
15288         case "$getpwent_r_proto" in
15289         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15290         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15291         esac
15292         case "$getpwent_r_proto" in
15293         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15294         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15295         esac
15296         case "$getpwent_r_proto" in
15297         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15298         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15299         esac
15300         case "$getpwent_r_proto" in
15301         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15302         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15303         esac
15304         case "$getpwent_r_proto" in
15305         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15306         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15307         esac
15308         case "$getpwent_r_proto" in
15309         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15310         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15311         esac
15312         case "$getpwent_r_proto" in
15313         ''|0)   d_getpwent_r=undef
15314                 getpwent_r_proto=0
15315                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15316         * )     case "$getpwent_r_proto" in
15317                 REENTRANT_PROTO*) ;;
15318                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15319                 esac
15320                 echo "Prototype: $try" ;;
15321         esac
15322         ;;
15323         *)      case "$usethreads" in
15324                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15325                 esac
15326                 d_getpwent_r=undef
15327                 getpwent_r_proto=0
15328                 ;;
15329         esac
15330         ;;
15331 *)      getpwent_r_proto=0
15332         ;;
15333 esac
15334
15335 : see if getpwnam_r exists
15336 set getpwnam_r d_getpwnam_r
15337 eval $inlibc
15338 case "$d_getpwnam_r" in
15339 "$define")
15340         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15341         case "$d_getpwnam_r_proto:$usethreads" in
15342         ":define")      d_getpwnam_r_proto=define
15343                 set d_getpwnam_r_proto getpwnam_r $hdrs
15344                 eval $hasproto ;;
15345         *)      ;;
15346         esac
15347         case "$d_getpwnam_r_proto" in
15348         define)
15349         case "$getpwnam_r_proto" in
15350         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15351         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15352         esac
15353         case "$getpwnam_r_proto" in
15354         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15355         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15356         esac
15357         case "$getpwnam_r_proto" in
15358         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15359         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15360         esac
15361         case "$getpwnam_r_proto" in
15362         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15363         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15364         esac
15365         case "$getpwnam_r_proto" in
15366         ''|0)   d_getpwnam_r=undef
15367                 getpwnam_r_proto=0
15368                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15369         * )     case "$getpwnam_r_proto" in
15370                 REENTRANT_PROTO*) ;;
15371                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15372                 esac
15373                 echo "Prototype: $try" ;;
15374         esac
15375         ;;
15376         *)      case "$usethreads" in
15377                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15378                 esac
15379                 d_getpwnam_r=undef
15380                 getpwnam_r_proto=0
15381                 ;;
15382         esac
15383         ;;
15384 *)      getpwnam_r_proto=0
15385         ;;
15386 esac
15387
15388 : see if getpwuid_r exists
15389 set getpwuid_r d_getpwuid_r
15390 eval $inlibc
15391 case "$d_getpwuid_r" in
15392 "$define")
15393         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15394         case "$d_getpwuid_r_proto:$usethreads" in
15395         ":define")      d_getpwuid_r_proto=define
15396                 set d_getpwuid_r_proto getpwuid_r $hdrs
15397                 eval $hasproto ;;
15398         *)      ;;
15399         esac
15400         case "$d_getpwuid_r_proto" in
15401         define)
15402         case "$getpwuid_r_proto" in
15403         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15404         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15405         esac
15406         case "$getpwuid_r_proto" in
15407         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15408         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15409         esac
15410         case "$getpwuid_r_proto" in
15411         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15412         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15413         esac
15414         case "$getpwuid_r_proto" in
15415         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15416         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15417         esac
15418         case "$getpwuid_r_proto" in
15419         ''|0)   d_getpwuid_r=undef
15420                 getpwuid_r_proto=0
15421                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15422         * )     case "$getpwuid_r_proto" in
15423                 REENTRANT_PROTO*) ;;
15424                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15425                 esac
15426                 echo "Prototype: $try" ;;
15427         esac
15428         ;;
15429         *)      case "$usethreads" in
15430                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15431                 esac
15432                 d_getpwuid_r=undef
15433                 getpwuid_r_proto=0
15434                 ;;
15435         esac
15436         ;;
15437 *)      getpwuid_r_proto=0
15438         ;;
15439 esac
15440
15441 : Optional checks for getsbyname and getsbyport
15442
15443 : see if getservbyname exists
15444 set getservbyname d_getsbyname
15445 eval $inlibc
15446
15447 : see if getservbyport exists
15448 set getservbyport d_getsbyport
15449 eval $inlibc
15450
15451 : see if getservent exists
15452 set getservent d_getsent
15453 eval $inlibc
15454
15455 : see if getservbyname_r exists
15456 set getservbyname_r d_getservbyname_r
15457 eval $inlibc
15458 case "$d_getservbyname_r" in
15459 "$define")
15460         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15461         case "$d_getservbyname_r_proto:$usethreads" in
15462         ":define")      d_getservbyname_r_proto=define
15463                 set d_getservbyname_r_proto getservbyname_r $hdrs
15464                 eval $hasproto ;;
15465         *)      ;;
15466         esac
15467         case "$d_getservbyname_r_proto" in
15468         define)
15469         case "$getservbyname_r_proto" in
15470         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15471         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15472         esac
15473         case "$getservbyname_r_proto" in
15474         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15475         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15476         esac
15477         case "$getservbyname_r_proto" in
15478         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15479         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15480         esac
15481         case "$getservbyname_r_proto" in
15482         ''|0)   d_getservbyname_r=undef
15483                 getservbyname_r_proto=0
15484                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15485         * )     case "$getservbyname_r_proto" in
15486                 REENTRANT_PROTO*) ;;
15487                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15488                 esac
15489                 echo "Prototype: $try" ;;
15490         esac
15491         ;;
15492         *)      case "$usethreads" in
15493                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15494                 esac
15495                 d_getservbyname_r=undef
15496                 getservbyname_r_proto=0
15497                 ;;
15498         esac
15499         ;;
15500 *)      getservbyname_r_proto=0
15501         ;;
15502 esac
15503
15504 : see if getservbyport_r exists
15505 set getservbyport_r d_getservbyport_r
15506 eval $inlibc
15507 case "$d_getservbyport_r" in
15508 "$define")
15509         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15510         case "$d_getservbyport_r_proto:$usethreads" in
15511         ":define")      d_getservbyport_r_proto=define
15512                 set d_getservbyport_r_proto getservbyport_r $hdrs
15513                 eval $hasproto ;;
15514         *)      ;;
15515         esac
15516         case "$d_getservbyport_r_proto" in
15517         define)
15518         case "$getservbyport_r_proto" in
15519         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15520         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15521         esac
15522         case "$getservbyport_r_proto" in
15523         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15524         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15525         esac
15526         case "$getservbyport_r_proto" in
15527         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15528         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15529         esac
15530         case "$getservbyport_r_proto" in
15531         ''|0)   d_getservbyport_r=undef
15532                 getservbyport_r_proto=0
15533                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15534         * )     case "$getservbyport_r_proto" in
15535                 REENTRANT_PROTO*) ;;
15536                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15537                 esac
15538                 echo "Prototype: $try" ;;
15539         esac
15540         ;;
15541         *)      case "$usethreads" in
15542                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15543                 esac
15544                 d_getservbyport_r=undef
15545                 getservbyport_r_proto=0
15546                 ;;
15547         esac
15548         ;;
15549 *)      getservbyport_r_proto=0
15550         ;;
15551 esac
15552
15553 : see if getservent_r exists
15554 set getservent_r d_getservent_r
15555 eval $inlibc
15556 case "$d_getservent_r" in
15557 "$define")
15558         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15559         case "$d_getservent_r_proto:$usethreads" in
15560         ":define")      d_getservent_r_proto=define
15561                 set d_getservent_r_proto getservent_r $hdrs
15562                 eval $hasproto ;;
15563         *)      ;;
15564         esac
15565         case "$d_getservent_r_proto" in
15566         define)
15567         case "$getservent_r_proto" in
15568         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15569         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15570         esac
15571         case "$getservent_r_proto" in
15572         ''|0) try='int getservent_r(struct servent*, char*, int);'
15573         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15574         esac
15575         case "$getservent_r_proto" in
15576         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15577         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15578         esac
15579         case "$getservent_r_proto" in
15580         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15581         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15582         esac
15583         case "$getservent_r_proto" in
15584         ''|0)   d_getservent_r=undef
15585                 getservent_r_proto=0
15586                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15587         * )     case "$getservent_r_proto" in
15588                 REENTRANT_PROTO*) ;;
15589                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15590                 esac
15591                 echo "Prototype: $try" ;;
15592         esac
15593         ;;
15594         *)      case "$usethreads" in
15595                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15596                 esac
15597                 d_getservent_r=undef
15598                 getservent_r_proto=0
15599                 ;;
15600         esac
15601         ;;
15602 *)      getservent_r_proto=0
15603         ;;
15604 esac
15605
15606 : see if prototypes for various getservxxx netdb.h functions are available
15607 echo " "
15608 set d_getservprotos getservent $i_netdb netdb.h
15609 eval $hasproto
15610
15611 : see if getspnam exists
15612 set getspnam d_getspnam
15613 eval $inlibc
15614
15615 : see if this is a shadow.h system
15616 set shadow.h i_shadow
15617 eval $inhdr
15618
15619 : see if getspnam_r exists
15620 set getspnam_r d_getspnam_r
15621 eval $inlibc
15622 case "$d_getspnam_r" in
15623 "$define")
15624         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15625         case "$d_getspnam_r_proto:$usethreads" in
15626         ":define")      d_getspnam_r_proto=define
15627                 set d_getspnam_r_proto getspnam_r $hdrs
15628                 eval $hasproto ;;
15629         *)      ;;
15630         esac
15631         case "$d_getspnam_r_proto" in
15632         define)
15633         case "$getspnam_r_proto" in
15634         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15635         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15636         esac
15637         case "$getspnam_r_proto" in
15638         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15639         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15640         esac
15641         case "$getspnam_r_proto" in
15642         ''|0)   d_getspnam_r=undef
15643                 getspnam_r_proto=0
15644                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15645         * )     case "$getspnam_r_proto" in
15646                 REENTRANT_PROTO*) ;;
15647                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15648                 esac
15649                 echo "Prototype: $try" ;;
15650         esac
15651         ;;
15652         *)      case "$usethreads" in
15653                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15654                 esac
15655                 d_getspnam_r=undef
15656                 getspnam_r_proto=0
15657                 ;;
15658         esac
15659         ;;
15660 *)      getspnam_r_proto=0
15661         ;;
15662 esac
15663
15664 : see if gettimeofday or ftime exists
15665 set gettimeofday d_gettimeod
15666 eval $inlibc
15667 case "$d_gettimeod" in
15668 "$undef")
15669         set ftime d_ftime 
15670         eval $inlibc
15671         ;;
15672 *)
15673         val="$undef"; set d_ftime; eval $setvar
15674         ;;
15675 esac
15676 case "$d_gettimeod$d_ftime" in
15677 "$undef$undef")
15678         echo " "
15679         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15680         ;;
15681 esac
15682
15683 : see if gmtime_r exists
15684 set gmtime_r d_gmtime_r
15685 eval $inlibc
15686 case "$d_gmtime_r" in
15687 "$define")
15688         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15689         case "$d_gmtime_r_proto:$usethreads" in
15690         ":define")      d_gmtime_r_proto=define
15691                 set d_gmtime_r_proto gmtime_r $hdrs
15692                 eval $hasproto ;;
15693         *)      ;;
15694         esac
15695         case "$d_gmtime_r_proto" in
15696         define)
15697         case "$gmtime_r_proto" in
15698         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15699         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15700         esac
15701         case "$gmtime_r_proto" in
15702         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15703         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15704         esac
15705         case "$gmtime_r_proto" in
15706         ''|0)   d_gmtime_r=undef
15707                 gmtime_r_proto=0
15708                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15709         * )     case "$gmtime_r_proto" in
15710                 REENTRANT_PROTO*) ;;
15711                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15712                 esac
15713                 echo "Prototype: $try" ;;
15714         esac
15715         ;;
15716         *)      case "$usethreads" in
15717                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15718                 esac
15719                 d_gmtime_r=undef
15720                 gmtime_r_proto=0
15721                 ;;
15722         esac
15723         ;;
15724 *)      gmtime_r_proto=0
15725         ;;
15726 esac
15727
15728 : see if hasmntopt exists
15729 set hasmntopt d_hasmntopt
15730 eval $inlibc
15731
15732 : see if this is a netinet/in.h or sys/in.h system
15733 set netinet/in.h i_niin sys/in.h i_sysin
15734 eval $inhdr
15735
15736 : see if arpa/inet.h has to be included
15737 set arpa/inet.h i_arpainet
15738 eval $inhdr
15739
15740 : see if htonl --and friends-- exists
15741 val=''
15742 set htonl val
15743 eval $inlibc
15744
15745 : Maybe they are macros.
15746 case "$val" in
15747 $undef)
15748         $cat >htonl.c <<EOM
15749 #include <stdio.h>
15750 #include <sys/types.h>
15751 #$i_niin I_NETINET_IN
15752 #$i_sysin I_SYS_IN
15753 #$i_arpainet I_ARPA_INET
15754 #ifdef I_NETINET_IN
15755 #include <netinet/in.h>
15756 #endif
15757 #ifdef I_SYS_IN
15758 #include <sys/in.h>
15759 #endif
15760 #ifdef I_ARPA_INET
15761 #include <arpa/inet.h>
15762 #endif
15763 #ifdef htonl
15764 printf("Defined as a macro.");
15765 #endif
15766 EOM
15767         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15768         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15769                 val="$define"
15770                 echo "But it seems to be defined as a macro." >&4
15771         fi
15772         $rm -f htonl.?
15773         ;;
15774 esac
15775 set d_htonl
15776 eval $setvar
15777
15778 : see if hypot exists
15779 set hypot d_hypot
15780 eval $inlibc
15781
15782 : see if ilogb exists
15783 set ilogb d_ilogb
15784 eval $inlibc
15785
15786 : see if ilogbl exists
15787 set ilogbl d_ilogbl
15788 eval $inlibc
15789
15790 : index or strchr
15791 echo " "
15792 if set index val -f; eval $csym; $val; then
15793         if set strchr val -f d_strchr; eval $csym; $val; then
15794                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15795                         val="$define"
15796                         vali="$undef"
15797                         echo "strchr() found." >&4
15798                 else
15799                         val="$undef"
15800                         vali="$define"
15801                         echo "index() found." >&4
15802                 fi
15803         else
15804                 val="$undef"
15805                 vali="$define"
15806                 echo "index() found." >&4
15807         fi
15808 else
15809         if set strchr val -f d_strchr; eval $csym; $val; then
15810                 val="$define"
15811                 vali="$undef"
15812                 echo "strchr() found." >&4
15813         else
15814                 echo "No index() or strchr() found!" >&4
15815                 val="$undef"
15816                 vali="$undef"
15817         fi
15818 fi
15819 set d_strchr; eval $setvar
15820 val="$vali"
15821 set d_index; eval $setvar
15822
15823 : check whether inet_aton exists
15824 set inet_aton d_inetaton
15825 eval $inlibc
15826
15827 : see if inet_ntop exists
15828 set inet_ntop d_inetntop
15829 eval $inlibc
15830
15831 : see if inet_pton exists
15832 set inet_pton d_inetpton
15833 eval $inlibc
15834
15835 : Look for isascii
15836 echo " "
15837 $cat >isascii.c <<EOCP
15838 #include <stdio.h>
15839 #include <ctype.h>
15840 #$i_stdlib I_STDLIB
15841 #ifdef I_STDLIB
15842 #include <stdlib.h>
15843 #endif
15844 int main() {
15845         int c = 'A';
15846         if (isascii(c))
15847                 exit(0);
15848         else
15849                 exit(1);
15850 }
15851 EOCP
15852 set isascii
15853 if eval $compile; then
15854         echo "isascii() found." >&4
15855         val="$define"
15856 else
15857         echo "isascii() NOT found." >&4
15858         val="$undef"
15859 fi
15860 set d_isascii
15861 eval $setvar
15862 $rm -f isascii*
15863
15864 : Look for isblank
15865 echo " "
15866 $cat >isblank.c <<'EOCP'
15867 #include <stdio.h>
15868 #include <ctype.h>
15869 int main() {
15870         int c = ' ';
15871         if (isblank(c))
15872                 return 0 ;
15873         else
15874                 return 1 ;
15875 }
15876 EOCP
15877 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15878         echo "isblank() found." >&4
15879         val="$define"
15880 else
15881         echo "isblank() NOT found." >&4
15882         val="$undef"
15883 fi
15884 set d_isblank
15885 eval $setvar
15886 $rm -f isblank*
15887
15888 : check for isfinite
15889 echo "Checking to see if you have isfinite..." >&4
15890 $cat >try.c <<EOCP
15891 #$i_math I_MATH
15892 #ifdef I_MATH
15893 #include <math.h>
15894 #endif
15895 int main() { return isfinite(0.0); }
15896 EOCP
15897 set try
15898 if eval $compile; then
15899         val="$define"
15900         echo "You have isfinite."
15901 else
15902         val="$undef"
15903         echo "You do not have isfinite."
15904 fi
15905 $rm_try
15906 set d_isfinite
15907 eval $setvar
15908
15909 : see if isfinitel exists
15910 set isfinitel d_isfinitel
15911 eval $inlibc
15912
15913 : check for isinf
15914 echo "Checking to see if you have isinf..." >&4
15915 $cat >try.c <<EOCP
15916 #$i_math I_MATH
15917 #ifdef I_MATH
15918 #include <math.h>
15919 #endif
15920 int main() { return isinf(0.0); }
15921 EOCP
15922 set try
15923 if eval $compile; then
15924         val="$define"
15925         echo "You have isinf."
15926 else
15927         val="$undef"
15928         echo "You do not have isinf."
15929 fi
15930 $rm_try
15931 set d_isinf
15932 eval $setvar
15933
15934 : see if isinfl exists
15935 set isinfl d_isinfl
15936 eval $inlibc
15937
15938 : check for isless
15939 echo "Checking to see if you have isless..." >&4
15940 $cat >try.c <<EOCP
15941 #$i_math I_MATH
15942 #ifdef I_MATH
15943 #include <math.h>
15944 #endif
15945 int main() { return isless(0.0); }
15946 EOCP
15947 set try
15948 if eval $compile; then
15949         val="$define"
15950         echo "You have isless."
15951 else
15952         val="$undef"
15953         echo "You do not have isless."
15954 fi
15955 $rm_try
15956 set d_isless
15957 eval $setvar
15958
15959 : check for isnan
15960 echo "Checking to see if you have isnan..." >&4
15961 $cat >try.c <<EOCP
15962 #$i_math I_MATH
15963 #ifdef I_MATH
15964 #include <math.h>
15965 #endif
15966 int main() { return isnan(0.0); }
15967 EOCP
15968 set try
15969 if eval $compile; then
15970         val="$define"
15971         echo "You have isnan."
15972 else
15973         val="$undef"
15974         echo "You do not have isnan."
15975 fi
15976 $rm_try
15977 set d_isnan
15978 eval $setvar
15979
15980 : see if isnanl exists
15981 set isnanl d_isnanl
15982 eval $inlibc
15983
15984 : check for isnormal
15985 echo "Checking to see if you have isnormal..." >&4
15986 $cat >try.c <<EOCP
15987 #$i_math I_MATH
15988 #ifdef I_MATH
15989 #include <math.h>
15990 #endif
15991 int main() { return isnormal(0.0); }
15992 EOCP
15993 set try
15994 if eval $compile; then
15995         val="$define"
15996         echo "You have isnormal."
15997 else
15998         val="$undef"
15999         echo "You do not have isnormal."
16000 fi
16001 $rm_try
16002 set d_isnormal
16003 eval $setvar
16004
16005 : see if j0 exists
16006 set j0 d_j0
16007 eval $inlibc
16008
16009 : see if j0l exists
16010 set j0l d_j0l
16011 eval $inlibc
16012
16013 : see if killpg exists
16014 set killpg d_killpg
16015 eval $inlibc
16016
16017 : see if localeconv exists
16018 set localeconv d_locconv
16019 eval $inlibc
16020
16021 : see if libc has the POSIX.1-2008 currency locale rules
16022 case "$d_locconv:$d_lc_monetary_2008" in
16023 $define:)
16024         $cat >try.c <<EOCP
16025 #include <locale.h>
16026 int main() {
16027         struct lconv *lc = localeconv();
16028         char int_p_cs_precedes = lc->int_p_cs_precedes;
16029         return 0;
16030 }
16031 EOCP
16032         set try
16033         if eval $compile; then
16034                 d_lc_monetary_2008="$define"
16035         else
16036                 d_lc_monetary_2008="$undef"
16037         fi;
16038         $rm_try
16039         ;;
16040 esac
16041
16042 : see if lchown exists
16043 echo " "
16044 $cat > try.c <<'EOCP'
16045 /* System header to define __stub macros and hopefully few prototypes,
16046     which can conflict with char lchown(); below.  */
16047 #include <assert.h>
16048 /* Override any gcc2 internal prototype to avoid an error.  */
16049 /* We use char because int might match the return type of a gcc2
16050    builtin and then its argument prototype would still apply.  */
16051 char lchown();
16052 int main() {
16053     /*  The GNU C library defines this for functions which it implements
16054         to always fail with ENOSYS.  Some functions are actually named
16055         something starting with __ and the normal name is an alias.  */
16056 #if defined (__stub_lchown) || defined (__stub___lchown)
16057 choke me
16058 #else
16059 lchown();
16060 #endif
16061 ; return 0; }
16062 EOCP
16063 set try
16064 if eval $compile; then
16065     $echo "lchown() found." >&4
16066     val="$define"
16067 else
16068     $echo "lchown() NOT found." >&4
16069     val="$undef"
16070 fi
16071 set d_lchown
16072 eval $setvar
16073
16074 : See if number of significant digits in a double precision number is known
16075 echo " "
16076 $cat >ldbl_dig.c <<EOM
16077 #$i_limits I_LIMITS
16078 #$i_float I_FLOAT
16079 #ifdef I_LIMITS
16080 #include <limits.h>
16081 #endif
16082 #ifdef I_FLOAT
16083 #include <float.h>
16084 #endif
16085 #ifdef LDBL_DIG
16086 printf("Contains LDBL_DIG");
16087 #endif
16088 EOM
16089 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16090 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16091         echo "LDBL_DIG found." >&4
16092         val="$define"
16093 else
16094         echo "LDBL_DIG NOT found." >&4
16095         val="$undef"
16096 fi
16097 $rm -f ldbl_dig.?
16098 set d_ldbl_dig
16099 eval $setvar
16100
16101 : see if lgamma exists
16102 set lgamma d_lgamma
16103 eval $inlibc
16104
16105 : see if lgamma_r exists
16106 set lgamma_r d_lgamma_r
16107 eval $inlibc
16108
16109 : check to see if math.h defines _LIB_VERSION
16110 d_libm_lib_version="$undef"
16111 case $i_math in
16112     $define)
16113         echo " "
16114         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16115         $cat >try.c <<EOCP
16116 #include <unistd.h>
16117 #include <math.h>
16118 int main (int argc, char *argv[])
16119 {
16120     printf ("%d\n", _LIB_VERSION);
16121     return (0);
16122     } /* main */
16123 EOCP
16124         set try
16125         if eval $compile; then
16126             foo=`$run ./try`
16127             echo "Yes, it does ($foo)" >&4
16128             d_libm_lib_version="$define"
16129         else
16130             echo "No, it does not (probably harmless)" >&4
16131             fi
16132         $rm_try
16133         ;;
16134
16135     esac
16136
16137 : see if link exists
16138 set link d_link
16139 eval $inlibc
16140
16141 : see if llrint exists
16142 set llrint d_llrint
16143 eval $inlibc
16144
16145 : see if llrintl exists
16146 set llrintl d_llrintl
16147 eval $inlibc
16148
16149 : see if llround exists
16150 set llround d_llround
16151 eval $inlibc
16152
16153 : see if llroundl exists
16154 set llroundl d_llroundl
16155 eval $inlibc
16156
16157 : see if localtime_r exists
16158 set localtime_r d_localtime_r
16159 eval $inlibc
16160 case "$d_localtime_r" in
16161 "$define")
16162         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16163         case "$d_localtime_r_proto:$usethreads" in
16164         ":define")      d_localtime_r_proto=define
16165                 set d_localtime_r_proto localtime_r $hdrs
16166                 eval $hasproto ;;
16167         *)      ;;
16168         esac
16169         case "$d_localtime_r_proto" in
16170         define)
16171         case "$localtime_r_proto" in
16172         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16173         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16174         esac
16175         case "$localtime_r_proto" in
16176         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16177         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16178         esac
16179         case "$localtime_r_proto" in
16180         ''|0)   d_localtime_r=undef
16181                 localtime_r_proto=0
16182                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16183         * )     case "$localtime_r_proto" in
16184                 REENTRANT_PROTO*) ;;
16185                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16186                 esac
16187                 echo "Prototype: $try" ;;
16188         esac
16189         ;;
16190         *)      case "$usethreads" in
16191                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16192                 esac
16193                 d_localtime_r=undef
16194                 localtime_r_proto=0
16195                 ;;
16196         esac
16197         ;;
16198 *)      localtime_r_proto=0
16199         ;;
16200 esac
16201
16202 : see if localtime_r calls tzset
16203 case "$localtime_r_proto" in
16204 REENTRANT_PROTO*)
16205         $cat >try.c <<EOCP
16206 /*  Does our libc's localtime_r call tzset ?
16207  *  return 0 if so, 1 otherwise.
16208  */
16209 #$i_systypes    I_SYS_TYPES
16210 #$i_unistd      I_UNISTD
16211 #$i_time        I_TIME
16212 #$i_stdlib      I_STDLIB
16213 #$i_string      I_STRING
16214 #$i_malloc      I_MALLOC
16215 #ifdef I_SYS_TYPES
16216 #  include <sys/types.h>
16217 #endif
16218 #ifdef I_UNISTD
16219 #  include <unistd.h>
16220 #endif
16221 #ifdef I_TIME
16222 #  include <time.h>
16223 #endif
16224 #ifdef I_STDLIB
16225 #include <stdlib.h>
16226 #endif
16227 #ifdef I_STRING
16228 #  include <string.h>
16229 #else
16230 #  include <strings.h>
16231 #endif
16232 #ifdef I_MALLOC
16233 #  include <malloc.h>
16234 #endif
16235 int main()
16236 {
16237     time_t t = time(0L);
16238     char w_tz[]="TZ" "=GMT+5",
16239          e_tz[]="TZ" "=GMT-5",
16240         *tz_e = (char*)malloc(16),
16241         *tz_w = (char*)malloc(16);
16242     struct tm tm_e, tm_w;
16243     memset(&tm_e,'\0',sizeof(struct tm));
16244     memset(&tm_w,'\0',sizeof(struct tm));
16245     strcpy(tz_e,e_tz);
16246     strcpy(tz_w,w_tz);
16247
16248     putenv(tz_e);
16249     localtime_r(&t, &tm_e);
16250
16251     putenv(tz_w);
16252     localtime_r(&t, &tm_w);
16253
16254     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16255         return 1;
16256     return 0;
16257 }
16258 EOCP
16259         set try
16260         if eval $compile; then
16261             if $run ./try; then
16262                 d_localtime_r_needs_tzset=undef;
16263             else
16264                 d_localtime_r_needs_tzset=define;
16265             fi;
16266         else
16267             d_localtime_r_needs_tzset=undef;
16268         fi;
16269      ;;
16270   *)
16271      d_localtime_r_needs_tzset=undef;
16272      ;;
16273 esac
16274 $rm_try
16275
16276 : see if lockf exists
16277 set lockf d_lockf
16278 eval $inlibc
16279
16280 : see if log1p exists
16281 set log1p d_log1p
16282 eval $inlibc
16283
16284 : see if log2 exists
16285 set log2 d_log2
16286 eval $inlibc
16287
16288 : see if logb exists
16289 set logb d_logb
16290 eval $inlibc
16291
16292 : see if lrint exists
16293 set lrint d_lrint
16294 eval $inlibc
16295
16296 : see if lrintl exists
16297 set lrintl d_lrintl
16298 eval $inlibc
16299
16300 : see if lround exists
16301 set lround d_lround
16302 eval $inlibc
16303
16304 : see if lroundl exists
16305 set lroundl d_lroundl
16306 eval $inlibc
16307
16308 : see if prototype for lseek is available
16309 echo " "
16310 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16311 eval $hasproto
16312
16313 : see if lstat exists
16314 set lstat d_lstat
16315 eval $inlibc
16316
16317 : see if madvise exists
16318 set madvise d_madvise
16319 eval $inlibc
16320
16321 : see if malloc_size exists
16322 set malloc_size d_malloc_size
16323 eval $inlibc
16324
16325 : see if malloc_size_good exists
16326 set malloc_good_size d_malloc_good_size
16327 eval $inlibc
16328
16329 : see if mblen exists
16330 set mblen d_mblen
16331 eval $inlibc
16332
16333 : see if mbstowcs exists
16334 set mbstowcs d_mbstowcs
16335 eval $inlibc
16336
16337 : see if mbtowc exists
16338 set mbtowc d_mbtowc
16339 eval $inlibc
16340
16341 : see if memchr exists
16342 set memchr d_memchr
16343 eval $inlibc
16344
16345 : see if memcmp exists
16346 set memcmp d_memcmp
16347 eval $inlibc
16348
16349 : see if memcpy exists
16350 set memcpy d_memcpy
16351 eval $inlibc
16352
16353 : see if memmove exists
16354 set memmove d_memmove
16355 eval $inlibc
16356
16357 : see if memset exists
16358 set memset d_memset
16359 eval $inlibc
16360
16361 : see if mkdir exists
16362 set mkdir d_mkdir
16363 eval $inlibc
16364
16365 : see if mkdtemp exists
16366 set mkdtemp d_mkdtemp
16367 eval $inlibc
16368
16369 : see if mkfifo exists
16370 set mkfifo d_mkfifo
16371 eval $inlibc
16372
16373 : see if mkstemp exists
16374 set mkstemp d_mkstemp
16375 eval $inlibc
16376
16377 : see if mkstemps exists
16378 set mkstemps d_mkstemps
16379 eval $inlibc
16380
16381 : see if mktime exists
16382 set mktime d_mktime
16383 eval $inlibc
16384
16385 : see if this is a sys/mman.h system
16386 set sys/mman.h i_sysmman
16387 eval $inhdr
16388
16389 : see if mmap exists
16390 set mmap d_mmap
16391 eval $inlibc
16392 : see what shmat returns
16393 : default to something harmless
16394 mmaptype='void *'
16395 case "$i_sysmman$d_mmap" in
16396 "$define$define")
16397         $cat >mmap.c <<'END'
16398 #include <sys/mman.h>
16399 void *mmap();
16400 END
16401         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16402                 mmaptype='void *'
16403         else
16404                 mmaptype='caddr_t'
16405         fi
16406         echo "and it returns ($mmaptype)." >&4
16407         ;;
16408 esac
16409
16410
16411
16412 : see if sqrtl exists
16413 set sqrtl d_sqrtl
16414 eval $inlibc
16415
16416 : see if scalbnl exists
16417 set scalbnl d_scalbnl
16418 eval $inlibc
16419
16420 : see if truncl exists
16421 set truncl d_truncl
16422 eval $inlibc
16423
16424 : see if modfl exists
16425 set modfl d_modfl
16426 eval $inlibc
16427
16428 : see if prototype for modfl is available
16429 echo " "
16430 set d_modflproto modfl $i_math math.h
16431 eval $hasproto
16432
16433 d_modfl_pow32_bug="$undef"
16434
16435 case "$d_longdbl$d_modfl" in
16436 $define$define)
16437         $cat <<EOM
16438 Checking to see whether your modfl() is okay for large values...
16439 EOM
16440 $cat >try.c <<EOCP
16441 #include <math.h>
16442 #include <stdio.h>
16443 EOCP
16444 if $test "X$d_modflproto" != "X$define"; then
16445         $cat >>try.c <<EOCP
16446 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16447 long double modfl (long double, long double *);
16448 EOCP
16449 fi
16450 $cat >>try.c <<EOCP
16451 int main() {
16452     long double nv = 4294967303.15;
16453     long double v, w;
16454     v = modfl(nv, &w);
16455 #ifdef __GLIBC__
16456     printf("glibc");
16457 #endif
16458     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16459     return 0;
16460 }
16461 EOCP
16462         case "$osname:$gccversion" in
16463         aix:)   saveccflags="$ccflags"
16464                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16465         esac
16466         set try
16467         if eval $compile; then
16468                 foo=`$run ./try`
16469                 case "$foo" in
16470                 *" 4294967303.150000 1.150000 4294967302.000000")
16471                         echo >&4 "Your modfl() is broken for large values."
16472                         d_modfl_pow32_bug="$define"
16473                         case "$foo" in
16474                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16475                         ;;
16476                         esac
16477                         ;;
16478                 *" 4294967303.150000 0.150000 4294967303.000000")
16479                         echo >&4 "Your modfl() seems okay for large values."
16480                         ;;
16481                 *)      echo >&4 "I don't understand your modfl() at all."
16482                         d_modfl="$undef"
16483                         ;;
16484                 esac
16485                 $rm_try
16486         else
16487                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16488                 d_modfl="$undef"
16489         fi
16490         case "$osname:$gccversion" in
16491         aix:)   ccflags="$saveccflags" ;; # restore
16492         esac
16493         ;;
16494 esac
16495
16496 if $test "$uselongdouble" = "$define"; then
16497     message=""
16498     if $test "$d_sqrtl" != "$define"; then
16499         message="$message sqrtl"
16500     fi
16501     if $test "$d_modfl" != "$define"; then
16502         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16503             echo "You have both truncl and copysignl, so I can emulate modfl."
16504         else
16505             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16506                 echo "You have both aintl and copysignl, so I can emulate modfl."
16507             else
16508                 message="$message modfl"
16509             fi
16510         fi
16511     fi
16512     if $test "$d_frexpl" != "$define"; then
16513         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16514             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16515         else
16516             message="$message frexpl"
16517         fi
16518     fi
16519     if $test "$d_ldexpl" != "$define"; then
16520         message="$message ldexpl"
16521     fi
16522
16523     if $test "$message" != ""; then
16524         $cat <<EOM >&4
16525
16526 *** You requested the use of long doubles but you do not seem to have
16527 *** the following mathematical functions needed for long double support:
16528 ***    $message
16529 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16530 *** Cannot continue, aborting.
16531
16532 EOM
16533
16534         exit 1
16535     fi
16536 fi
16537
16538 : see if mprotect exists
16539 set mprotect d_mprotect
16540 eval $inlibc
16541
16542 : see if msgctl exists
16543 set msgctl d_msgctl
16544 eval $inlibc
16545
16546 : see if msgget exists
16547 set msgget d_msgget
16548 eval $inlibc
16549
16550 : see if msgsnd exists
16551 set msgsnd d_msgsnd
16552 eval $inlibc
16553
16554 : see if msgrcv exists
16555 set msgrcv d_msgrcv
16556 eval $inlibc
16557
16558 : see how much of the 'msg*(2)' library is present.
16559 h_msg=true
16560 echo " "
16561 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16562 *"$undef"*) h_msg=false;;
16563 esac
16564 case "$osname" in
16565 freebsd)
16566     case "`ipcs 2>&1`" in
16567     "SVID messages"*"not configured"*)
16568         echo "Your $osname does not have the msg*(2) configured." >&4
16569         h_msg=false
16570         val="$undef"
16571         set msgctl d_msgctl
16572         eval $setvar
16573         set msgget d_msgget
16574         eval $setvar
16575         set msgsnd d_msgsnd
16576         eval $setvar
16577         set msgrcv d_msgrcv
16578         eval $setvar
16579         ;;
16580     esac
16581     ;;
16582 esac
16583 : we could also check for sys/ipc.h ...
16584 if $h_msg && $test `./findhdr sys/msg.h`; then
16585         echo "You have the full msg*(2) library." >&4
16586         val="$define"
16587 else
16588         echo "You don't have the full msg*(2) library." >&4
16589         val="$undef"
16590 fi
16591 set d_msg
16592 eval $setvar
16593
16594 : Check for msghdr_s
16595 echo " "
16596 echo "Checking to see if your system supports struct msghdr..." >&4
16597 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16598 eval $hasstruct
16599 case "$d_msghdr_s" in
16600 "$define")      echo "Yes, it does."   ;;
16601 *)              echo "No, it doesn't." ;;
16602 esac
16603
16604
16605 : see if msync exists
16606 set msync d_msync
16607 eval $inlibc
16608
16609 : see if munmap exists
16610 set munmap d_munmap
16611 eval $inlibc
16612
16613 : see if nan exists
16614 set nan d_nan
16615 eval $inlibc
16616
16617 : see if nearbyint exists
16618 set nearbyint d_nearbyint
16619 eval $inlibc
16620
16621 : see if nextafter exists
16622 set nextafter d_nextafter
16623 eval $inlibc
16624
16625 : see if nexttoward exists
16626 set nexttoward d_nexttoward
16627 eval $inlibc
16628
16629 : see if nice exists
16630 set nice d_nice
16631 eval $inlibc
16632
16633 : see if this is a langinfo.h system
16634 set langinfo.h i_langinfo
16635 eval $inhdr
16636
16637 : see if nl_langinfo exists
16638 set nl_langinfo d_nl_langinfo
16639 eval $inlibc
16640
16641 : see if this is a quadmath.h system
16642 set quadmath.h i_quadmath
16643 eval $inhdr
16644
16645 : check for volatile keyword
16646 echo " "
16647 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16648 $cat >try.c <<'EOCP'
16649 int main()
16650 {
16651         typedef struct _goo_struct goo_struct;
16652         goo_struct * volatile goo = ((goo_struct *)0);
16653         struct _goo_struct {
16654                 long long_int;
16655                 int reg_int;
16656                 char char_var;
16657         };
16658         typedef unsigned short foo_t;
16659         char *volatile foo;
16660         volatile int bar;
16661         volatile foo_t blech;
16662         foo = foo;
16663 }
16664 EOCP
16665 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16666         val="$define"
16667         echo "Yup, it does."
16668 else
16669         val="$undef"
16670         echo "Nope, it doesn't."
16671 fi
16672 set d_volatile
16673 eval $setvar
16674 $rm_try
16675
16676 : Check basic sizes
16677 echo " "
16678 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16679
16680 case "$use64bitint:$d_quad:$quadtype" in
16681 define:define:?*)
16682         ivtype="$quadtype"
16683         uvtype="$uquadtype"
16684         ivsize=8
16685         uvsize=8
16686         ;;
16687 *)      ivtype="long"
16688         uvtype="unsigned long"
16689         ivsize=$longsize
16690         uvsize=$longsize
16691         ;;
16692 esac
16693
16694 case "$uselongdouble:$d_longdbl" in
16695 define:define)
16696         nvtype="long double"
16697         nvsize=$longdblsize
16698         ;;
16699 *)      nvtype=double
16700         nvsize=$doublesize
16701         ;;
16702 esac
16703
16704 case "$usequadmath:$i_quadmath" in
16705 define:define)
16706   nvtype="__float128"
16707   nvsize=16
16708   case "$libs" in
16709   *quadmath*) ;;
16710   *) $cat <<EOM >&4
16711
16712 *** You requested the use of the quadmath library, but you
16713 *** do not seem to have the quadmath library installed.
16714 *** Cannot continue, aborting.
16715 EOM
16716     exit 1
16717     ;;
16718   esac
16719   ;;
16720 define:*) $cat <<EOM >&4
16721
16722 *** You requested the use of the quadmath library, but you
16723 *** do not seem to have the required header, <quadmath.h>.
16724 EOM
16725   case "$gccversion" in
16726   [23].*|4.[0-5]*)
16727    $cat <<EOM >&4
16728 *** Your gcc looks a bit old:
16729 *** $gccversion
16730 EOM
16731     ;;
16732   '')
16733    $cat <<EOM >&4
16734 *** You are not running a gcc.
16735 EOM
16736     ;;
16737   esac
16738   $cat <<EOM >&4
16739 *** For the quadmath library you need at least gcc 4.6.
16740 *** Cannot continue, aborting.
16741 EOM
16742   exit 1
16743   ;;
16744 esac
16745
16746 $echo "(IV will be "$ivtype", $ivsize bytes)"
16747 $echo "(UV will be "$uvtype", $uvsize bytes)"
16748 $echo "(NV will be "$nvtype", $nvsize bytes)"
16749
16750 $cat >try.c <<EOCP
16751 #$i_inttypes I_INTTYPES
16752 #ifdef I_INTTYPES
16753 #include <inttypes.h>
16754 #endif
16755 #include <stdio.h>
16756 int main() {
16757 #ifdef INT8
16758    int8_t i =  INT8_MAX;
16759   uint8_t u = UINT8_MAX;
16760   printf("int8_t\n");
16761 #endif
16762 #ifdef INT16
16763    int16_t i =  INT16_MAX;
16764   uint16_t u = UINT16_MAX;
16765   printf("int16_t\n");
16766 #endif
16767 #ifdef INT32
16768    int32_t i =  INT32_MAX;
16769   uint32_t u = UINT32_MAX;
16770   printf("int32_t\n");
16771 #endif
16772 }
16773 EOCP
16774
16775 i8type="signed char"
16776 u8type="unsigned char"
16777 i8size=1
16778 u8size=1
16779
16780 case "$i16type" in
16781 '')     case "$shortsize" in
16782         2)      i16type=short
16783                 u16type="unsigned short"
16784                 i16size=$shortsize
16785                 u16size=$shortsize
16786                 ;;
16787         esac
16788         ;;
16789 esac
16790 case "$i16type" in
16791 '')     set try -DINT16
16792         if eval $compile; then
16793                 case "`$run ./try`" in
16794                 int16_t)
16795                         i16type=int16_t
16796                         u16type=uint16_t
16797                         i16size=2
16798                         u16size=2
16799                         ;;
16800                 esac
16801         fi
16802         ;;
16803 esac
16804 case "$i16type" in
16805 '')     if $test $shortsize -ge 2; then
16806                 i16type=short
16807                 u16type="unsigned short"
16808                 i16size=$shortsize
16809                 u16size=$shortsize
16810         fi
16811         ;;
16812 esac
16813
16814 case "$i32type" in
16815 '')     case "$longsize" in
16816         4)      i32type=long
16817                 u32type="unsigned long"
16818                 i32size=$longsize
16819                 u32size=$longsize
16820                 ;;
16821         *)      case "$intsize" in
16822                 4)      i32type=int
16823                         u32type="unsigned int"
16824                         i32size=$intsize
16825                         u32size=$intsize
16826                         ;;
16827                 esac
16828                 ;;
16829         esac
16830         ;;
16831 esac
16832 case "$i32type" in
16833 '')     set try -DINT32
16834         if eval $compile; then
16835                 case "`$run ./try`" in
16836                 int32_t)
16837                         i32type=int32_t
16838                         u32type=uint32_t
16839                         i32size=4
16840                         u32size=4
16841                         ;;
16842                 esac
16843         fi
16844         ;;
16845 esac
16846 case "$i32type" in
16847 '')     if $test $intsize -ge 4; then
16848                 i32type=int
16849                 u32type="unsigned int"
16850                 i32size=$intsize
16851                 u32size=$intsize
16852         fi
16853         ;;
16854 esac
16855
16856 case "$i64type" in
16857 '')     case "$d_quad:$quadtype" in
16858         define:?*)
16859                 i64type="$quadtype"
16860                 u64type="$uquadtype"
16861                 i64size=8
16862                 u64size=8
16863                 ;;
16864         esac
16865         ;;
16866 esac
16867
16868 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16869 : volatile so that the compiler has to store it out to memory.
16870 if test X"$d_volatile" = X"$define"; then
16871         volatile=volatile
16872 fi
16873 $cat <<EOP >try.c
16874 #include <stdio.h>
16875 #$i_stdlib I_STDLIB
16876 #ifdef I_STDLIB
16877 #include <stdlib.h>
16878 #endif
16879 #include <sys/types.h>
16880 #include <signal.h>
16881 #ifdef SIGFPE
16882 $volatile int bletched = 0;
16883 $signal_t blech(int s) { bletched = 1; }
16884 #endif
16885 int main() {
16886     $uvtype u = 0;
16887     $nvtype d;
16888     int     n = 8 * $uvsize;
16889     int     i;
16890 #ifdef SIGFPE
16891     signal(SIGFPE, blech);
16892 #endif
16893
16894     for (i = 0; i < n; i++) {
16895       u = u << 1 | ($uvtype)1;
16896       d = ($nvtype)u;
16897       if (($uvtype)d != u)
16898         break;
16899       if (d <= 0)
16900         break;
16901       d = ($nvtype)(u - 1);
16902       if (($uvtype)d != (u - 1))
16903         break;
16904 #ifdef SIGFPE
16905       if (bletched)
16906         break;
16907 #endif
16908     }
16909     printf("%d\n", ((i == n) ? -n : i));
16910     exit(0);
16911 }
16912 EOP
16913 set try
16914
16915 d_nv_preserves_uv="$undef"
16916 if eval $compile; then
16917         nv_preserves_uv_bits="`$run ./try`"
16918 fi
16919 case "$nv_preserves_uv_bits" in
16920 \-[1-9]*)
16921         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16922         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16923         d_nv_preserves_uv="$define"
16924         ;;
16925 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16926         d_nv_preserves_uv="$undef" ;;
16927 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16928         nv_preserves_uv_bits="0" ;;
16929 esac
16930 $rm_try
16931
16932 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16933 : volatile so that the compiler has to store it out to memory.
16934 if test X"$d_volatile" = X"$define"; then
16935         volatile=volatile
16936 fi
16937 $cat <<EOP >try.c
16938 #include <stdio.h>
16939
16940 typedef $nvtype NV;
16941
16942 int
16943 main() {
16944   NV value = 2;
16945   int count = 1;
16946
16947   while(count < 256) {
16948     $volatile NV up = value + 1.0;
16949     $volatile NV negated = -value;
16950     $volatile NV down = negated - 1.0;
16951     $volatile NV got_up = up - value;
16952     int up_good = got_up == 1.0;
16953     int got_down = down - negated;
16954     int down_good = got_down == -1.0;
16955
16956     if (down_good != up_good) {
16957       fprintf(stderr,
16958               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16959               up_good, (double) got_up, down_good, (double) got_down,
16960               count, (double) value);
16961       return 1;
16962     }
16963     if (!up_good) {
16964       while (1) {
16965         if (count > 8) {
16966           count -= 8;
16967           fputs("256.0", stdout);
16968         } else {
16969           count--;
16970           fputs("2.0", stdout);
16971         }
16972         if (!count) {
16973           puts("");
16974           return 0;
16975         }
16976         fputs("*", stdout);
16977       }
16978     }
16979     value *= 2;
16980     ++count;
16981   }
16982   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16983           count, (double) value);
16984   return 1;
16985 }
16986 EOP
16987 set try
16988
16989 nv_overflows_integers_at='0'
16990 if eval $compile; then
16991     xxx="`$run ./try`"
16992     case "$?" in
16993         0)
16994             case "$xxx" in
16995                 2*)  cat >&4 <<EOM
16996 The largest integer your NVs can preserve is equal to $xxx
16997 EOM
16998                     nv_overflows_integers_at="$xxx"
16999                     ;;
17000                 *)  cat >&4 <<EOM
17001 Cannot determine the largest integer value your NVs can hold, unexpected output
17002 '$xxx'
17003 EOM
17004                     ;;
17005             esac
17006             ;;
17007         *)  cat >&4 <<EOM
17008 Cannot determine the largest integer value your NVs can hold
17009 EOM
17010             ;;
17011     esac
17012 fi
17013 $rm_try
17014
17015 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
17016 : volatile so that the compiler has to store it out to memory.
17017 if test X"$d_volatile" = X"$define"; then
17018         volatile=volatile
17019 fi
17020 $cat <<EOP >try.c
17021 #include <stdio.h>
17022 #$i_stdlib I_STDLIB
17023 #ifdef I_STDLIB
17024 #include <stdlib.h>
17025 #endif
17026 #$i_string I_STRING
17027 #ifdef I_STRING
17028 #  include <string.h>
17029 #else
17030 #  include <strings.h>
17031 #endif
17032 #include <sys/types.h>
17033 #include <signal.h>
17034 #ifdef SIGFPE
17035 $volatile int bletched = 0;
17036 $signal_t blech(int s) { bletched = 1; }
17037 #endif
17038
17039 int checkit($nvtype d, char *where) {
17040     unsigned char *p = (char *)&d;
17041     unsigned char *end = p + sizeof(d);
17042     int fail = 0;
17043
17044     while (p < end)
17045         fail += *p++;
17046
17047     if (!fail)
17048         return 0;
17049
17050     p = (char *)&d;
17051     printf("No - %s: 0x", where);
17052     while (p < end)
17053         printf ("%02X", *p++);
17054     printf("\n");
17055     return 1;
17056 }
17057
17058 int main(int argc, char **argv) {
17059     $nvtype d = 0.0;
17060     int fail = 0;
17061     fail += checkit(d, "0.0");
17062
17063     /* The compiler shouldn't be assuming that bletched is 0  */
17064     d = bletched;
17065
17066     fail += checkit(d, "bleched");
17067
17068 #ifdef SIGFPE
17069     signal(SIGFPE, blech);
17070 #endif
17071
17072     /* Paranoia - the compiler should have no way of knowing that ANSI says
17073        that argv[argc] will always be NULL.  Actually, if it did assume this it
17074        would be buggy, as this is C and main() can be called from elsewhere in
17075        the program.  */
17076     d = argv[argc] ? 1 : 0;
17077
17078     if (d) {
17079         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17080     }
17081
17082     fail += checkit(d, "ternary");
17083
17084     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17085
17086     if (d != 0.0) {
17087         printf("No - memset doesn't give 0.0\n");
17088         /* This might just blow up:  */
17089         printf("(gives %g)\n", d);
17090         return 1;
17091     }
17092
17093 #ifdef SIGFPE
17094     if (bletched) {
17095         printf("No - something bleched\n");
17096         return 1;
17097     }
17098 #endif
17099     if (fail) {
17100       printf("No - %d fail(s)\n", fail);
17101       return 1;
17102     }
17103     printf("Yes\n");
17104     return 0;
17105 }
17106 EOP
17107 set try
17108
17109 d_nv_zero_is_allbits_zero="$undef"
17110 if eval $compile; then
17111     xxx="`$run ./try`"
17112     case "$?" in
17113         0)
17114             case "$xxx" in
17115                 Yes)  cat >&4 <<EOM
17116 0.0 is represented as all bits zero in memory
17117 EOM
17118                     d_nv_zero_is_allbits_zero="$define"
17119                     ;;
17120                 *)  cat >&4 <<EOM
17121 0.0 is not represented as all bits zero in memory
17122 EOM
17123                     d_nv_zero_is_allbits_zero="$undef"
17124                     ;;
17125             esac
17126             ;;
17127         *)  cat >&4 <<EOM
17128 0.0 is not represented as all bits zero in memory
17129 EOM
17130             d_nv_zero_is_allbits_zero="$undef"
17131             ;;
17132     esac
17133 fi
17134 $rm_try
17135
17136 : check for off64_t
17137 echo " "
17138 echo "Checking to see if you have off64_t..." >&4
17139 $cat >try.c <<EOCP
17140 #include <sys/types.h>
17141 #include <unistd.h>
17142 int main() { off64_t x = 7; }
17143 EOCP
17144 set try
17145 if eval $compile; then
17146         val="$define"
17147         echo "You have off64_t."
17148 else
17149         val="$undef"
17150         echo "You do not have off64_t."
17151         case "$lseeksize" in
17152         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17153         esac
17154 fi
17155 $rm_try
17156 set d_off64_t
17157 eval $setvar
17158
17159 : how to create joinable pthreads
17160 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17161         echo " "
17162         echo "Checking what constant to use for creating joinable pthreads..." >&4
17163         $cat >try.c <<'EOCP'
17164 #include <pthread.h>
17165 int main() {
17166     int detachstate = JOINABLE;
17167 }
17168 EOCP
17169         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17170         if eval $compile; then
17171                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17172                 val="$undef" # Yes, undef.
17173                 set d_old_pthread_create_joinable
17174                 eval $setvar
17175                 val=""
17176                 set old_pthread_create_joinable
17177                 eval $setvar
17178         else
17179                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17180                 if eval $compile; then
17181                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17182                         val="$define"
17183                         set d_old_pthread_create_joinable
17184                         eval $setvar
17185                         val=PTHREAD_CREATE_UNDETACHED
17186                         set old_pthread_create_joinable
17187                         eval $setvar
17188                 else
17189                         set try -DJOINABLE=__UNDETACHED
17190                         if eval $compile; then
17191                                 echo "You seem to use __UNDETACHED." >&4
17192                                 val="$define"
17193                                 set d_old_pthread_create_joinable
17194                                 eval $setvar
17195                                 val=__UNDETACHED
17196                                 set old_pthread_create_joinable
17197                                 eval $setvar
17198                         else
17199                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17200                                 val="$define"
17201                                 set d_old_pthread_create_joinable
17202                                 eval $setvar
17203                                 val=0
17204                                 set old_pthread_create_joinable
17205                                 eval $setvar
17206                         fi
17207                 fi
17208         fi
17209         $rm_try
17210 else
17211     d_old_pthread_create_joinable="$undef"
17212     old_pthread_create_joinable=""
17213 fi
17214
17215 : see if pause exists
17216 set pause d_pause
17217 eval $inlibc
17218
17219 : see if poll exists
17220 set poll d_poll
17221 eval $inlibc
17222
17223 : see if prctl exists
17224 set prctl d_prctl
17225 eval $inlibc
17226
17227 : see if prctl supports PR_SET_NAME
17228 d_prctl_set_name=$undef
17229 case $d_prctl in
17230     $define)
17231         $cat >try.c <<EOM
17232 #ifdef __ANDROID__
17233 #include <unistd.h>
17234 #endif
17235 #include <sys/prctl.h>
17236
17237 int main (int argc, char *argv[])
17238 {
17239     return (prctl (PR_SET_NAME, "Test"));
17240     } /* main */
17241 EOM
17242         set try
17243         if eval $compile_ok && $run ./try; then
17244             echo "Your prctl (PR_SET_NAME, ...) works"
17245             d_prctl_set_name=$define
17246             fi
17247         $rm_try
17248         ;;
17249     esac
17250
17251 : see if readlink exists
17252 set readlink d_readlink
17253 eval $inlibc
17254
17255 : Check if there is a /proc symlink to the abs path of
17256 : the executing program.  We will honor hints of d_procselfexe=$undef
17257 : or procselfexe being non-empty, otherwise will try to determine both
17258 : if we have readlink.
17259 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17260 : referenced, and AmigaOS does not have a proc filesystem anyway.
17261 echo " "
17262 val="$undef"
17263 if $test "X$d_procselfexe" = Xundef; then
17264         procselfexe=''
17265 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17266         val="$define"
17267 elif $test "X$d_readlink" = Xdefine; then
17268         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17269         : and it feels more tidy to avoid an extra level of symlink
17270         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17271         while test $# -gt 0; do
17272             type=$1; try=$2
17273             shift; shift
17274             if $issymlink $try; then
17275                 $ls -l $try > reflect
17276                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17277                     echo "You have $type-like $try."
17278                     procselfexe='"'$try'"'
17279                     val="$define"
17280                     : This will break out of the loop
17281                     set X; shift
17282                 fi
17283             fi
17284         done
17285 fi
17286 $rm -f reflect
17287 set d_procselfexe
17288 eval $setvar
17289
17290 : backward compatibility for d_hvfork
17291 if test X$d_hvfork != X; then
17292         d_vfork="$d_hvfork"
17293         d_hvfork=''
17294 fi
17295 : see if there is a vfork
17296 val=''
17297 set vfork val
17298 eval $inlibc
17299
17300 d_pseudofork=$undef
17301
17302 : Ok, but do we want to use it. vfork is reportedly unreliable in
17303 : perl on Solaris 2.x, and probably elsewhere.
17304 case "$val" in
17305 $define)
17306         echo " "
17307         case "$usevfork" in
17308         false) dflt='n';;
17309         *) dflt='y';;
17310         esac
17311         cat <<'EOM'
17312
17313 Perl can only use a vfork() that doesn't suffer from strict
17314 restrictions on calling functions or modifying global data in
17315 the child.  For example, glibc-2.1 contains such a vfork()
17316 that is unsuitable.  If your system provides a proper fork()
17317 call, chances are that you do NOT want perl to use vfork().
17318
17319 EOM
17320         rp="Do you still want to use vfork()?"
17321         . ./myread
17322         case "$ans" in
17323         y|Y) ;;
17324         *)
17325                 echo "Ok, we won't use vfork()."
17326                 val="$undef"
17327                 ;;
17328         esac
17329         ;;
17330 esac
17331 set d_vfork
17332 eval $setvar
17333 case "$d_vfork" in
17334 $define) usevfork='true';;
17335 *) usevfork='false';;
17336 esac
17337
17338 : see whether the pthread_atfork exists
17339 $cat >try.c <<EOP
17340 #include <pthread.h>
17341 #include <stdio.h>
17342 int main() {
17343 #ifdef  PTHREAD_ATFORK
17344         pthread_atfork(NULL,NULL,NULL);
17345 #endif
17346 }
17347 EOP
17348
17349 : see if pthread_atfork exists
17350 set try -DPTHREAD_ATFORK
17351 if eval $compile; then
17352     val="$define"
17353 else
17354     val="$undef"
17355 fi
17356 case "$usethreads" in
17357 $define)
17358         case "$val" in
17359         $define) echo 'pthread_atfork found.' >&4        ;;
17360         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17361         esac
17362 esac
17363 set d_pthread_atfork
17364 eval $setvar
17365
17366 : see if pthread_attr_setscope exists
17367 set pthread_attr_setscope d_pthread_attr_setscope
17368 eval $inlibc
17369
17370 : see whether the various POSIXish _yields exist
17371 $cat >try.c <<EOP
17372 #include <pthread.h>
17373 #include <stdio.h>
17374 int main() {
17375 #ifdef SCHED_YIELD
17376         sched_yield();
17377 #else
17378 #ifdef PTHREAD_YIELD
17379         pthread_yield();
17380 #else
17381 #ifdef PTHREAD_YIELD_NULL
17382         pthread_yield(NULL);
17383 #endif
17384 #endif
17385 #endif
17386 }
17387 EOP
17388 : see if sched_yield exists
17389 set try -DSCHED_YIELD
17390 if eval $compile; then
17391     val="$define"
17392     sched_yield='sched_yield()'
17393 else
17394     val="$undef"
17395 fi
17396 case "$usethreads" in
17397 $define)
17398         case "$val" in
17399         $define) echo 'sched_yield() found.' >&4        ;;
17400         *)       echo 'sched_yield() NOT found.' >&4    ;;
17401         esac
17402 esac
17403 set d_sched_yield
17404 eval $setvar
17405
17406 : see if pthread_yield exists
17407 set try -DPTHREAD_YIELD
17408 if eval $compile; then
17409     val="$define"
17410     case "$sched_yield" in
17411     '') sched_yield='pthread_yield()' ;;
17412     esac
17413 else
17414     set try -DPTHREAD_YIELD_NULL
17415     if eval $compile; then
17416         val="$define"
17417         case "$sched_yield" in
17418         '') sched_yield='pthread_yield(NULL)' ;;
17419         esac
17420     else
17421         val="$undef"
17422     fi
17423 fi
17424 case "$usethreads" in
17425 $define)
17426         case "$val" in
17427         $define) echo 'pthread_yield() found.' >&4      ;;
17428         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17429         esac
17430         ;;
17431 esac
17432 set d_pthread_yield
17433 eval $setvar
17434 case "$sched_yield" in
17435 '') sched_yield=undef ;;
17436 esac
17437 $rm_try
17438
17439 : check for ptrdiff_t
17440 echo " "
17441 echo "Checking to see if you have ptrdiff_t..." >&4
17442 $cat >try.c <<EOCP
17443 #include <stddef.h>
17444 int main() { ptrdiff_t x = 7; }
17445 EOCP
17446 set try
17447 if eval $compile; then
17448         val="$define"
17449         echo "You have ptrdiff_t."
17450 else
17451         val="$undef"
17452         echo "You do not have ptrdiff_t."
17453 fi
17454 $rm_try
17455 set d_ptrdiff_t
17456 eval $setvar
17457
17458 : see if random_r exists
17459 set random_r d_random_r
17460 eval $inlibc
17461 case "$d_random_r" in
17462 "$define")
17463         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17464         case "$d_random_r_proto:$usethreads" in
17465         ":define")      d_random_r_proto=define
17466                 set d_random_r_proto random_r $hdrs
17467                 eval $hasproto ;;
17468         *)      ;;
17469         esac
17470         case "$d_random_r_proto" in
17471         define)
17472         case "$random_r_proto" in
17473         ''|0) try='int random_r(int*, struct random_data*);'
17474         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17475         esac
17476         case "$random_r_proto" in
17477         ''|0) try='int random_r(long*, struct random_data*);'
17478         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17479         esac
17480         case "$random_r_proto" in
17481         ''|0) try='int random_r(struct random_data*, int32_t*);'
17482         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17483         esac
17484         case "$random_r_proto" in
17485         ''|0)   d_random_r=undef
17486                 random_r_proto=0
17487                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17488         * )     case "$random_r_proto" in
17489                 REENTRANT_PROTO*) ;;
17490                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17491                 esac
17492                 echo "Prototype: $try" ;;
17493         esac
17494         ;;
17495         *)      case "$usethreads" in
17496                 define) echo "random_r has no prototype, not using it." >&4 ;;
17497                 esac
17498                 d_random_r=undef
17499                 random_r_proto=0
17500                 ;;
17501         esac
17502         ;;
17503 *)      random_r_proto=0
17504         ;;
17505 esac
17506
17507 : see if readdir and friends exist
17508 set readdir d_readdir
17509 eval $inlibc
17510 set seekdir d_seekdir
17511 eval $inlibc
17512 set telldir d_telldir
17513 eval $inlibc
17514 set rewinddir d_rewinddir
17515 eval $inlibc
17516
17517 : see if readdir64_r exists
17518 set readdir64_r d_readdir64_r
17519 eval $inlibc
17520 case "$d_readdir64_r" in
17521 "$define")
17522         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17523         case "$d_readdir64_r_proto:$usethreads" in
17524         ":define")      d_readdir64_r_proto=define
17525                 set d_readdir64_r_proto readdir64_r $hdrs
17526                 eval $hasproto ;;
17527         *)      ;;
17528         esac
17529         case "$d_readdir64_r_proto" in
17530         define)
17531         case "$readdir64_r_proto" in
17532         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17533         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17534         esac
17535         case "$readdir64_r_proto" in
17536         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17537         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17538         esac
17539         case "$readdir64_r_proto" in
17540         ''|0)   d_readdir64_r=undef
17541                 readdir64_r_proto=0
17542                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17543         * )     case "$readdir64_r_proto" in
17544                 REENTRANT_PROTO*) ;;
17545                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17546                 esac
17547                 echo "Prototype: $try" ;;
17548         esac
17549         ;;
17550         *)      case "$usethreads" in
17551                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17552                 esac
17553                 d_readdir64_r=undef
17554                 readdir64_r_proto=0
17555                 ;;
17556         esac
17557         ;;
17558 *)      readdir64_r_proto=0
17559         ;;
17560 esac
17561
17562 : see if readdir_r exists
17563 set readdir_r d_readdir_r
17564 eval $inlibc
17565 case "$d_readdir_r" in
17566 "$define")
17567         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17568         case "$d_readdir_r_proto:$usethreads" in
17569         ":define")      d_readdir_r_proto=define
17570                 set d_readdir_r_proto readdir_r $hdrs
17571                 eval $hasproto ;;
17572         *)      ;;
17573         esac
17574         case "$d_readdir_r_proto" in
17575         define)
17576         case "$readdir_r_proto" in
17577         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17578         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17579         esac
17580         case "$readdir_r_proto" in
17581         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17582         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17583         esac
17584         case "$readdir_r_proto" in
17585         ''|0)   d_readdir_r=undef
17586                 readdir_r_proto=0
17587                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17588         * )     case "$readdir_r_proto" in
17589                 REENTRANT_PROTO*) ;;
17590                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17591                 esac
17592                 echo "Prototype: $try" ;;
17593         esac
17594         ;;
17595         *)      case "$usethreads" in
17596                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17597                 esac
17598                 d_readdir_r=undef
17599                 readdir_r_proto=0
17600                 ;;
17601         esac
17602         ;;
17603 *)      readdir_r_proto=0
17604         ;;
17605 esac
17606
17607 : see if readv exists
17608 set readv d_readv
17609 eval $inlibc
17610
17611 : see if recvmsg exists
17612 set recvmsg d_recvmsg
17613 eval $inlibc
17614
17615 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17616 echo " "
17617 if set regcomp val -f d_regcomp; eval $csym; $val; then
17618         echo 'regcomp() found.' >&4
17619         d_regcomp="$define"
17620         d_regcmp="$undef"
17621         d_re_comp="$undef"
17622 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17623         echo 'regcmp() found.' >&4
17624         d_regcmp="$define"
17625         d_regcomp="$undef"
17626         d_re_comp="$undef"
17627 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17628         echo 're_comp() found, assuming re_exec() also exists.' >&4
17629         d_re_comp="$define"
17630         d_regcomp="$undef"
17631         d_regcmp="$undef"
17632 else
17633         $cat >&4 <<EOM
17634 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17635 EOM
17636         d_regcmp="$undef"
17637         d_re_comp="$undef"
17638         d_regcomp="$undef"
17639 fi
17640
17641 : see if remainder exists
17642 set remainder d_remainder
17643 eval $inlibc
17644
17645 : see if remquo exists
17646 set remquo d_remquo
17647 eval $inlibc
17648
17649 : see if rename exists
17650 set rename d_rename
17651 eval $inlibc
17652
17653 : see if rint exists
17654 set rint d_rint
17655 eval $inlibc
17656
17657 : see if rmdir exists
17658 set rmdir d_rmdir
17659 eval $inlibc
17660
17661 : see if round exists
17662 set round d_round
17663 eval $inlibc
17664
17665 : see if memory.h is available.
17666 val=''
17667 set memory.h val
17668 eval $inhdr
17669
17670 : See if it conflicts with string.h
17671 case "$val" in
17672 $define)
17673         case "$strings" in
17674         '') ;;
17675         *)
17676                 $cppstdin $cppflags $cppminus < $strings > mem.h
17677                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17678                         echo " "
17679                         echo "We won't be including <memory.h>."
17680                         val="$undef"
17681                 fi
17682                 $rm -f mem.h
17683                 ;;
17684         esac
17685 esac
17686 set i_memory
17687 eval $setvar
17688
17689 : can bcopy handle overlapping blocks?
17690 echo " "
17691 val="$undef"
17692 case "$d_memmove" in
17693 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17694 *)      case "$d_bcopy" in
17695         "$define")
17696                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17697                 $cat >try.c <<EOCP
17698 #$i_memory I_MEMORY
17699 #$i_stdlib I_STDLIB
17700 #$i_string I_STRING
17701 #$i_unistd I_UNISTD
17702 EOCP
17703         $cat >>try.c <<'EOCP'
17704 #include <stdio.h>
17705 #ifdef I_MEMORY
17706 #  include <memory.h>
17707 #endif
17708 #ifdef I_STDLIB
17709 #  include <stdlib.h>
17710 #endif
17711 #ifdef I_STRING
17712 #  include <string.h>
17713 #else
17714 #  include <strings.h>
17715 #endif
17716 #ifdef I_UNISTD
17717 #  include <unistd.h>  /* Needed for NetBSD */
17718 #endif
17719 int main()
17720 {
17721 char buf[128], abc[128];
17722 char *b;
17723 int len;
17724 int off;
17725 int align;
17726
17727 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17728    try to store the string in read-only memory. */
17729 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17730
17731 for (align = 7; align >= 0; align--) {
17732         for (len = 36; len; len--) {
17733                 b = buf+align;
17734                 bcopy(abc, b, len);
17735                 for (off = 1; off <= len; off++) {
17736                         bcopy(b, b+off, len);
17737                         bcopy(b+off, b, len);
17738                         if (bcmp(b, abc, len))
17739                                 exit(1);
17740                 }
17741         }
17742 }
17743 exit(0);
17744 }
17745 EOCP
17746                 set try
17747                 if eval $compile_ok; then
17748                         if $run ./try 2>/dev/null; then
17749                                 echo "Yes, it can."
17750                                 val="$define"
17751                         else
17752                                 echo "It can't, sorry."
17753                         fi
17754                 else
17755                         echo "(I can't compile the test program, so we'll assume not...)"
17756                 fi
17757                 ;;
17758         esac
17759         $rm_try
17760         ;;
17761 esac
17762 set d_safebcpy
17763 eval $setvar
17764
17765 : can memcpy handle overlapping blocks?
17766 echo " "
17767 val="$undef"
17768 case "$d_memmove" in
17769 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17770 *)      case "$d_memcpy" in
17771         "$define")
17772                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17773                 $cat >try.c <<EOCP
17774 #$i_memory I_MEMORY
17775 #$i_stdlib I_STDLIB
17776 #$i_string I_STRING
17777 #$i_unistd I_UNISTD
17778 EOCP
17779         $cat >>try.c <<'EOCP'
17780 #include <stdio.h>
17781 #ifdef I_MEMORY
17782 #  include <memory.h>
17783 #endif
17784 #ifdef I_STDLIB
17785 #  include <stdlib.h>
17786 #endif
17787 #ifdef I_STRING
17788 #  include <string.h>
17789 #else
17790 #  include <strings.h>
17791 #endif
17792 #ifdef I_UNISTD
17793 #  include <unistd.h>  /* Needed for NetBSD */
17794 #endif
17795 int main()
17796 {
17797 char buf[128], abc[128];
17798 char *b;
17799 int len;
17800 int off;
17801 int align;
17802
17803 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17804    try to store the string in read-only memory. */
17805 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17806
17807 for (align = 7; align >= 0; align--) {
17808         for (len = 36; len; len--) {
17809                 b = buf+align;
17810                 memcpy(b, abc, len);
17811                 for (off = 1; off <= len; off++) {
17812                         memcpy(b+off, b, len);
17813                         memcpy(b, b+off, len);
17814                         if (memcmp(b, abc, len))
17815                                 exit(1);
17816                 }
17817         }
17818 }
17819 exit(0);
17820 }
17821 EOCP
17822                 set try
17823                 if eval $compile_ok; then
17824                         if $run ./try 2>/dev/null; then
17825                                 echo "Yes, it can."
17826                                 val="$define"
17827                         else
17828                                 echo "It can't, sorry."
17829                         fi
17830                 else
17831                         echo "(I can't compile the test program, so we'll assume not...)"
17832                 fi
17833                 ;;
17834         esac
17835         $rm_try
17836         ;;
17837 esac
17838 set d_safemcpy
17839 eval $setvar
17840
17841 : can memcmp be trusted to compare relative magnitude?
17842 val="$undef"
17843 case "$d_memcmp" in
17844 "$define")
17845         echo " "
17846         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17847         $cat >try.c <<EOCP
17848 #$i_memory I_MEMORY
17849 #$i_stdlib I_STDLIB
17850 #$i_string I_STRING
17851 #$i_unistd I_UNISTD
17852 EOCP
17853         $cat >>try.c <<'EOCP'
17854 #include <stdio.h>
17855 #ifdef I_MEMORY
17856 #  include <memory.h>
17857 #endif
17858 #ifdef I_STDLIB
17859 #  include <stdlib.h>
17860 #endif
17861 #ifdef I_STRING
17862 #  include <string.h>
17863 #else
17864 #  include <strings.h>
17865 #endif
17866 #ifdef I_UNISTD
17867 #  include <unistd.h>  /* Needed for NetBSD */
17868 #endif
17869 int main()
17870 {
17871 char a = -1;
17872 char b = 0;
17873 if ((a < b) && memcmp(&a, &b, 1) < 0)
17874         exit(1);
17875 exit(0);
17876 }
17877 EOCP
17878         set try
17879         if eval $compile_ok; then
17880                 if $run ./try 2>/dev/null; then
17881                         echo "Yes, it can."
17882                         val="$define"
17883                 else
17884                         echo "No, it can't (it uses signed chars)."
17885                 fi
17886         else
17887                 echo "(I can't compile the test program, so we'll assume not...)"
17888         fi
17889         ;;
17890 esac
17891 $rm_try
17892 set d_sanemcmp
17893 eval $setvar
17894
17895 : see if prototype for sbrk is available
17896 echo " "
17897 set d_sbrkproto sbrk $i_unistd unistd.h
17898 eval $hasproto
17899
17900 : see if scalbn exists
17901 set scalbn d_scalbn
17902 eval $inlibc
17903
17904 : see if select exists
17905 set select d_select
17906 eval $inlibc
17907
17908 : see if semctl exists
17909 set semctl d_semctl
17910 eval $inlibc
17911
17912 : see if semget exists
17913 set semget d_semget
17914 eval $inlibc
17915
17916 : see if semop exists
17917 set semop d_semop
17918 eval $inlibc
17919
17920 : see how much of the 'sem*(2)' library is present.
17921 h_sem=true
17922 echo " "
17923 case "$d_semctl$d_semget$d_semop" in
17924 *"$undef"*) h_sem=false;;
17925 esac
17926 case "$osname" in
17927 freebsd)
17928     case "`ipcs 2>&1`" in
17929     "SVID messages"*"not configured"*)
17930         echo "Your $osname does not have the sem*(2) configured." >&4
17931         h_sem=false
17932         val="$undef"
17933         set semctl d_semctl
17934         eval $setvar
17935         set semget d_semget
17936         eval $setvar
17937         set semop d_semop
17938         eval $setvar
17939         ;;
17940     esac
17941     ;;
17942 esac
17943 : we could also check for sys/ipc.h ...
17944 if $h_sem && $test `./findhdr sys/sem.h`; then
17945         echo "You have the full sem*(2) library." >&4
17946         val="$define"
17947 else
17948         echo "You don't have the full sem*(2) library." >&4
17949         val="$undef"
17950 fi
17951 set d_sem
17952 eval $setvar
17953
17954 : see whether sys/sem.h defines union semun
17955 echo " "
17956 $cat > try.c <<'END'
17957 #include <sys/types.h>
17958 #include <sys/ipc.h>
17959 #include <sys/sem.h>
17960 int main () { union semun semun; semun.buf = 0; }
17961 END
17962 set try
17963 if eval $compile; then
17964     echo "You have union semun in <sys/sem.h>." >&4
17965     val="$define"
17966 else
17967     echo "You do not have union semun in <sys/sem.h>." >&4
17968     val="$undef"
17969 fi
17970 $rm_try
17971 set d_union_semun
17972 eval $setvar
17973
17974 : see how to do semctl IPC_STAT
17975 case "$d_sem" in
17976 $define)
17977     echo " "
17978     $cat > tryh.h <<END
17979 #ifndef S_IRUSR
17980 #   ifdef S_IREAD
17981 #       define S_IRUSR S_IREAD
17982 #       define S_IWUSR S_IWRITE
17983 #       define S_IXUSR S_IEXEC
17984 #   else
17985 #       define S_IRUSR 0400
17986 #       define S_IWUSR 0200
17987 #       define S_IXUSR 0100
17988 #   endif
17989 #   define S_IRGRP (S_IRUSR>>3)
17990 #   define S_IWGRP (S_IWUSR>>3)
17991 #   define S_IXGRP (S_IXUSR>>3)
17992 #   define S_IROTH (S_IRUSR>>6)
17993 #   define S_IWOTH (S_IWUSR>>6)
17994 #   define S_IXOTH (S_IXUSR>>6)
17995 #endif
17996 #ifndef S_IRWXU
17997 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17998 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17999 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
18000 #endif
18001 END
18002     : see whether semctl IPC_STAT can use union semun
18003     case "$d_semctl_semun" in
18004     '')
18005       val="$undef"
18006       $cat > try.c <<END
18007 #include <sys/types.h>
18008 #include <sys/ipc.h>
18009 #include <sys/sem.h>
18010 #include <sys/stat.h>
18011 #include <stdio.h>
18012 #include <errno.h>
18013 #include "tryh.h"
18014 #ifndef errno
18015 extern int errno;
18016 #endif
18017 #$d_union_semun HAS_UNION_SEMUN
18018 int main() {
18019     union semun
18020 #ifndef HAS_UNION_SEMUN
18021     {
18022         int val;
18023         struct semid_ds *buf;
18024         unsigned short *array;
18025     }
18026 #endif
18027     arg;
18028     int sem, st;
18029
18030 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18031     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18032     if (sem > -1) {
18033         struct semid_ds argbuf;
18034         arg.buf = &argbuf;
18035 #       ifdef IPC_STAT
18036         st = semctl(sem, 0, IPC_STAT, arg);
18037         if (st == 0)
18038             printf("semun\n");
18039         else
18040 #       endif /* IPC_STAT */
18041             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18042 #       ifdef IPC_RMID
18043         if (semctl(sem, 0, IPC_RMID, arg) != 0)
18044 #       endif /* IPC_RMID */
18045             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18046     } else
18047 #endif /* IPC_PRIVATE && ... */
18048         printf("semget failed: errno = %d\n", errno);
18049   return 0;
18050 }
18051 END
18052       set try
18053       if eval $compile; then
18054           xxx=`$run ./try`
18055           case "$xxx" in
18056           semun) val="$define" ;;
18057           esac
18058       fi
18059       $rm_try
18060       set d_semctl_semun
18061       eval $setvar
18062       ;;
18063     esac
18064     case "$d_semctl_semun" in
18065     $define)
18066         echo "You can use union semun for semctl IPC_STAT." >&4
18067         also='also'
18068         ;;
18069     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
18070         also=''
18071         ;;
18072     esac
18073
18074     : see whether semctl IPC_STAT can use struct semid_ds pointer
18075     case "$d_semctl_semid_ds" in
18076     '')
18077       val="$undef"
18078       $cat > try.c <<'END'
18079 #include <sys/types.h>
18080 #include <sys/ipc.h>
18081 #include <sys/sem.h>
18082 #include <sys/stat.h>
18083 #include "tryh.h"
18084 #include <stdio.h>
18085 #include <errno.h>
18086 #ifndef errno
18087 extern int errno;
18088 #endif
18089 int main() {
18090     struct semid_ds arg;
18091     int sem, st;
18092
18093 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18094     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18095     if (sem > -1) {
18096 #       ifdef IPC_STAT
18097         st = semctl(sem, 0, IPC_STAT, &arg);
18098         if (st == 0)
18099             printf("semid_ds\n");
18100         else
18101 #       endif /* IPC_STAT */
18102             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18103 #       ifdef IPC_RMID
18104         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18105 #       endif /* IPC_RMID */
18106             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18107     } else
18108 #endif /* IPC_PRIVATE && ... */
18109         printf("semget failed: errno = %d\n", errno);
18110
18111     return 0;
18112 }
18113 END
18114       set try
18115       if eval $compile; then
18116           xxx=`$run ./try`
18117           case "$xxx" in
18118           semid_ds) val="$define" ;;
18119           esac
18120       fi
18121       $rm_try
18122       set d_semctl_semid_ds
18123       eval $setvar
18124       ;;
18125     esac
18126     case "$d_semctl_semid_ds" in
18127     $define)
18128         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18129         ;;
18130     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18131         ;;
18132     esac
18133     ;;
18134 *)  val="$undef"
18135
18136     # We do not have the full sem*(2) library, so assume we can not
18137     # use either.
18138
18139     set d_semctl_semun
18140     eval $setvar
18141
18142     set d_semctl_semid_ds
18143     eval $setvar
18144     ;;
18145 esac
18146 $rm_try tryh.h
18147
18148 : see if sendmsg exists
18149 set sendmsg d_sendmsg
18150 eval $inlibc
18151
18152 : see if setegid exists
18153 set setegid d_setegid
18154 eval $inlibc
18155
18156 : see if seteuid exists
18157 set seteuid d_seteuid
18158 eval $inlibc
18159
18160 : see if setgrent exists
18161 set setgrent d_setgrent
18162 eval $inlibc
18163
18164 : see if setgrent_r exists
18165 set setgrent_r d_setgrent_r
18166 eval $inlibc
18167 case "$d_setgrent_r" in
18168 "$define")
18169         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18170         case "$d_setgrent_r_proto:$usethreads" in
18171         ":define")      d_setgrent_r_proto=define
18172                 set d_setgrent_r_proto setgrent_r $hdrs
18173                 eval $hasproto ;;
18174         *)      ;;
18175         esac
18176         case "$d_setgrent_r_proto" in
18177         define)
18178         case "$setgrent_r_proto" in
18179         ''|0) try='int setgrent_r(FILE**);'
18180         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18181         esac
18182         case "$setgrent_r_proto" in
18183         ''|0) try='void setgrent_r(FILE**);'
18184         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18185         esac
18186         case "$setgrent_r_proto" in
18187         ''|0)   d_setgrent_r=undef
18188                 setgrent_r_proto=0
18189                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18190         * )     case "$setgrent_r_proto" in
18191                 REENTRANT_PROTO*) ;;
18192                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18193                 esac
18194                 echo "Prototype: $try" ;;
18195         esac
18196         ;;
18197         *)      case "$usethreads" in
18198                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18199                 esac
18200                 d_setgrent_r=undef
18201                 setgrent_r_proto=0
18202                 ;;
18203         esac
18204         ;;
18205 *)      setgrent_r_proto=0
18206         ;;
18207 esac
18208
18209 : see if sethostent exists
18210 set sethostent d_sethent
18211 eval $inlibc
18212
18213 : see if sethostent_r exists
18214 set sethostent_r d_sethostent_r
18215 eval $inlibc
18216 case "$d_sethostent_r" in
18217 "$define")
18218         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18219         case "$d_sethostent_r_proto:$usethreads" in
18220         ":define")      d_sethostent_r_proto=define
18221                 set d_sethostent_r_proto sethostent_r $hdrs
18222                 eval $hasproto ;;
18223         *)      ;;
18224         esac
18225         case "$d_sethostent_r_proto" in
18226         define)
18227         case "$sethostent_r_proto" in
18228         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18229         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18230         esac
18231         case "$sethostent_r_proto" in
18232         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18233         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18234         esac
18235         case "$sethostent_r_proto" in
18236         ''|0)   d_sethostent_r=undef
18237                 sethostent_r_proto=0
18238                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18239         * )     case "$sethostent_r_proto" in
18240                 REENTRANT_PROTO*) ;;
18241                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18242                 esac
18243                 echo "Prototype: $try" ;;
18244         esac
18245         ;;
18246         *)      case "$usethreads" in
18247                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18248                 esac
18249                 d_sethostent_r=undef
18250                 sethostent_r_proto=0
18251                 ;;
18252         esac
18253         ;;
18254 *)      sethostent_r_proto=0
18255         ;;
18256 esac
18257
18258 : see if setitimer exists
18259 set setitimer d_setitimer
18260 eval $inlibc
18261
18262 : see if setlinebuf exists
18263 set setlinebuf d_setlinebuf
18264 eval $inlibc
18265
18266 : see if setlocale exists
18267 set setlocale d_setlocale
18268 eval $inlibc
18269
18270 : see if locale.h is available
18271 set locale.h i_locale
18272 eval $inhdr
18273
18274 : see if setlocale_r exists
18275 set setlocale_r d_setlocale_r
18276 eval $inlibc
18277 case "$d_setlocale_r" in
18278 "$define")
18279         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18280         case "$d_setlocale_r_proto:$usethreads" in
18281         ":define")      d_setlocale_r_proto=define
18282                 set d_setlocale_r_proto setlocale_r $hdrs
18283                 eval $hasproto ;;
18284         *)      ;;
18285         esac
18286         case "$d_setlocale_r_proto" in
18287         define)
18288         case "$setlocale_r_proto" in
18289         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18290         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18291         esac
18292         case "$setlocale_r_proto" in
18293         ''|0)   d_setlocale_r=undef
18294                 setlocale_r_proto=0
18295                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18296         * )     case "$setlocale_r_proto" in
18297                 REENTRANT_PROTO*) ;;
18298                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18299                 esac
18300                 echo "Prototype: $try" ;;
18301         esac
18302         ;;
18303         *)      case "$usethreads" in
18304                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18305                 esac
18306                 d_setlocale_r=undef
18307                 setlocale_r_proto=0
18308                 ;;
18309         esac
18310         ;;
18311 *)      setlocale_r_proto=0
18312         ;;
18313 esac
18314
18315 : see if setnetent exists
18316 set setnetent d_setnent
18317 eval $inlibc
18318
18319 : see if setnetent_r exists
18320 set setnetent_r d_setnetent_r
18321 eval $inlibc
18322 case "$d_setnetent_r" in
18323 "$define")
18324         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18325         case "$d_setnetent_r_proto:$usethreads" in
18326         ":define")      d_setnetent_r_proto=define
18327                 set d_setnetent_r_proto setnetent_r $hdrs
18328                 eval $hasproto ;;
18329         *)      ;;
18330         esac
18331         case "$d_setnetent_r_proto" in
18332         define)
18333         case "$setnetent_r_proto" in
18334         ''|0) try='int setnetent_r(int, struct netent_data*);'
18335         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18336         esac
18337         case "$setnetent_r_proto" in
18338         ''|0) try='void setnetent_r(int, struct netent_data*);'
18339         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18340         esac
18341         case "$setnetent_r_proto" in
18342         ''|0)   d_setnetent_r=undef
18343                 setnetent_r_proto=0
18344                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18345         * )     case "$setnetent_r_proto" in
18346                 REENTRANT_PROTO*) ;;
18347                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18348                 esac
18349                 echo "Prototype: $try" ;;
18350         esac
18351         ;;
18352         *)      case "$usethreads" in
18353                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18354                 esac
18355                 d_setnetent_r=undef
18356                 setnetent_r_proto=0
18357                 ;;
18358         esac
18359         ;;
18360 *)      setnetent_r_proto=0
18361         ;;
18362 esac
18363
18364 : see if setprotoent exists
18365 set setprotoent d_setpent
18366 eval $inlibc
18367
18368 : see if setpgid exists
18369 set setpgid d_setpgid
18370 eval $inlibc
18371
18372 : see if setpgrp2 exists
18373 set setpgrp2 d_setpgrp2
18374 eval $inlibc
18375
18376 : see if setpriority exists
18377 set setpriority d_setprior
18378 eval $inlibc
18379
18380 : see if setproctitle exists
18381 set setproctitle d_setproctitle
18382 eval $inlibc
18383
18384 : see if setprotoent_r exists
18385 set setprotoent_r d_setprotoent_r
18386 eval $inlibc
18387 case "$d_setprotoent_r" in
18388 "$define")
18389         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18390         case "$d_setprotoent_r_proto:$usethreads" in
18391         ":define")      d_setprotoent_r_proto=define
18392                 set d_setprotoent_r_proto setprotoent_r $hdrs
18393                 eval $hasproto ;;
18394         *)      ;;
18395         esac
18396         case "$d_setprotoent_r_proto" in
18397         define)
18398         case "$setprotoent_r_proto" in
18399         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18400         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18401         esac
18402         case "$setprotoent_r_proto" in
18403         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18404         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18405         esac
18406         case "$setprotoent_r_proto" in
18407         ''|0)   d_setprotoent_r=undef
18408                 setprotoent_r_proto=0
18409                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18410         * )     case "$setprotoent_r_proto" in
18411                 REENTRANT_PROTO*) ;;
18412                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18413                 esac
18414                 echo "Prototype: $try" ;;
18415         esac
18416         ;;
18417         *)      case "$usethreads" in
18418                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18419                 esac
18420                 d_setprotoent_r=undef
18421                 setprotoent_r_proto=0
18422                 ;;
18423         esac
18424         ;;
18425 *)      setprotoent_r_proto=0
18426         ;;
18427 esac
18428
18429 : see if setpwent exists
18430 set setpwent d_setpwent
18431 eval $inlibc
18432
18433 : see if setpwent_r exists
18434 set setpwent_r d_setpwent_r
18435 eval $inlibc
18436 case "$d_setpwent_r" in
18437 "$define")
18438         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18439         case "$d_setpwent_r_proto:$usethreads" in
18440         ":define")      d_setpwent_r_proto=define
18441                 set d_setpwent_r_proto setpwent_r $hdrs
18442                 eval $hasproto ;;
18443         *)      ;;
18444         esac
18445         case "$d_setpwent_r_proto" in
18446         define)
18447         case "$setpwent_r_proto" in
18448         ''|0) try='int setpwent_r(FILE**);'
18449         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18450         esac
18451         case "$setpwent_r_proto" in
18452         ''|0) try='void setpwent_r(FILE**);'
18453         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18454         esac
18455         case "$setpwent_r_proto" in
18456         ''|0)   d_setpwent_r=undef
18457                 setpwent_r_proto=0
18458                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18459         * )     case "$setpwent_r_proto" in
18460                 REENTRANT_PROTO*) ;;
18461                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18462                 esac
18463                 echo "Prototype: $try" ;;
18464         esac
18465         ;;
18466         *)      case "$usethreads" in
18467                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18468                 esac
18469                 d_setpwent_r=undef
18470                 setpwent_r_proto=0
18471                 ;;
18472         esac
18473         ;;
18474 *)      setpwent_r_proto=0
18475         ;;
18476 esac
18477
18478 : see if setregid exists
18479 set setregid d_setregid
18480 eval $inlibc
18481 set setresgid d_setresgid
18482 eval $inlibc
18483
18484 : see if setreuid exists
18485 set setreuid d_setreuid
18486 eval $inlibc
18487 set setresuid d_setresuid
18488 eval $inlibc
18489
18490 : see if setrgid exists
18491 set setrgid d_setrgid
18492 eval $inlibc
18493
18494 : see if setruid exists
18495 set setruid d_setruid
18496 eval $inlibc
18497
18498 : see if setservent exists
18499 set setservent d_setsent
18500 eval $inlibc
18501
18502 : see if setservent_r exists
18503 set setservent_r d_setservent_r
18504 eval $inlibc
18505 case "$d_setservent_r" in
18506 "$define")
18507         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18508         case "$d_setservent_r_proto:$usethreads" in
18509         ":define")      d_setservent_r_proto=define
18510                 set d_setservent_r_proto setservent_r $hdrs
18511                 eval $hasproto ;;
18512         *)      ;;
18513         esac
18514         case "$d_setservent_r_proto" in
18515         define)
18516         case "$setservent_r_proto" in
18517         ''|0) try='int setservent_r(int, struct servent_data*);'
18518         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18519         esac
18520         case "$setservent_r_proto" in
18521         ''|0) try='void setservent_r(int, struct servent_data*);'
18522         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18523         esac
18524         case "$setservent_r_proto" in
18525         ''|0)   d_setservent_r=undef
18526                 setservent_r_proto=0
18527                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18528         * )     case "$setservent_r_proto" in
18529                 REENTRANT_PROTO*) ;;
18530                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18531                 esac
18532                 echo "Prototype: $try" ;;
18533         esac
18534         ;;
18535         *)      case "$usethreads" in
18536                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18537                 esac
18538                 d_setservent_r=undef
18539                 setservent_r_proto=0
18540                 ;;
18541         esac
18542         ;;
18543 *)      setservent_r_proto=0
18544         ;;
18545 esac
18546
18547 : see if setsid exists
18548 set setsid d_setsid
18549 eval $inlibc
18550
18551 : see if setvbuf exists
18552 set setvbuf d_setvbuf
18553 eval $inlibc
18554
18555 : see if shmctl exists
18556 set shmctl d_shmctl
18557 eval $inlibc
18558
18559 : see if shmget exists
18560 set shmget d_shmget
18561 eval $inlibc
18562
18563 : see if shmat exists
18564 set shmat d_shmat
18565 eval $inlibc
18566 : see what shmat returns
18567 case "$d_shmat" in
18568 "$define")
18569         $cat >shmat.c <<'END'
18570 #include <sys/shm.h>
18571 void *shmat();
18572 END
18573         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18574                 shmattype='void *'
18575         else
18576                 shmattype='char *'
18577         fi
18578         echo "and it returns ($shmattype)." >&4
18579         : see if a prototype for shmat is available
18580         xxx=`./findhdr sys/shm.h`
18581         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18582         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18583                 val="$define"
18584         else
18585                 val="$undef"
18586         fi
18587         $rm -f shmat.[co]
18588         ;;
18589 *)
18590         val="$undef"
18591         ;;
18592 esac
18593 set d_shmatprototype
18594 eval $setvar
18595
18596 : see if shmdt exists
18597 set shmdt d_shmdt
18598 eval $inlibc
18599
18600 : see how much of the 'shm*(2)' library is present.
18601 h_shm=true
18602 echo " "
18603 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18604 *"$undef"*) h_shm=false;;
18605 esac
18606 case "$osname" in
18607 freebsd)
18608     case "`ipcs 2>&1`" in
18609     "SVID shared memory"*"not configured"*)
18610         echo "Your $osname does not have the shm*(2) configured." >&4
18611         h_shm=false
18612         val="$undef"
18613         set shmctl d_shmctl
18614         eval $setvar
18615         set shmget d_shmget
18616         eval $setvar
18617         set shmat d_shmat
18618         eval $setvar
18619         set shmdt d_shmdt
18620         eval $setvar
18621         ;;
18622     esac
18623     ;;
18624 esac
18625 : we could also check for sys/ipc.h ...
18626 if $h_shm && $test `./findhdr sys/shm.h`; then
18627         echo "You have the full shm*(2) library." >&4
18628         val="$define"
18629 else
18630         echo "You don't have the full shm*(2) library." >&4
18631         val="$undef"
18632 fi
18633 set d_shm
18634 eval $setvar
18635
18636 : see if we have sigaction
18637 echo " "
18638 if set sigaction val -f d_sigaction; eval $csym; $val; then
18639         echo 'sigaction() found.' >&4
18640         $cat > try.c <<EOP
18641 #include <stdio.h>
18642 #include <sys/types.h>
18643 #include <signal.h>
18644 #$i_stdlib I_STDLIB
18645 #ifdef I_STDLIB
18646 #include <stdlib.h>
18647 #endif
18648 int main()
18649 {
18650     struct sigaction act, oact;
18651     act.sa_flags = 0;
18652     oact.sa_handler = 0;
18653     /* so that act and oact are used */
18654     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18655 }
18656 EOP
18657         set try
18658         if eval $compile_ok; then
18659                 val="$define"
18660         else
18661                 echo "But you don't seem to have a usable struct sigaction." >&4
18662                 val="$undef"
18663         fi
18664 else
18665         echo 'sigaction NOT found.' >&4
18666         val="$undef"
18667 fi
18668 set d_sigaction; eval $setvar
18669 $rm_try
18670
18671 : see if this is a sunmath.h system
18672 set sunmath.h i_sunmath
18673 eval $inhdr
18674
18675 : see if signbit exists
18676 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18677 $cat >try.c <<EOCP
18678 #$i_math I_MATH
18679 #$i_sunmath I_SUNMATH
18680 #ifdef I_MATH
18681 #  include <math.h>
18682 #endif
18683 #ifdef I_SUNMATH  /* Solaris special math library */
18684 #  include <sunmath.h>
18685 #endif
18686 #define NV $nvtype
18687 int main(int argc, char **argv)
18688 {
18689     NV x = 0.0;
18690     NV y = -0.0;
18691     if ((signbit(x) == 0) && (signbit(y) != 0))
18692         return 0;
18693     else
18694         return 1;
18695 }
18696 EOCP
18697 val="$undef"
18698 set try
18699 if eval $compile; then
18700     if $run ./try; then
18701         $echo "Yes." >&4
18702         val="$define"
18703     else
18704         $echo "Signbit seems to be available, but doesn't work as I expected."
18705         $echo "I won't use it." >&4
18706         val="$undef"
18707     fi
18708 else
18709     $echo "Nope." >&4
18710     dflt="$undef"
18711 fi
18712 set d_signbit
18713 eval $setvar
18714 $rm_try
18715
18716 : see if sigprocmask exists
18717 set sigprocmask d_sigprocmask
18718 eval $inlibc
18719
18720 : see if sigsetjmp exists
18721 echo " "
18722 case "$d_sigsetjmp" in
18723 '')
18724         $cat >try.c <<EOP
18725 #include <setjmp.h>
18726 #$i_stdlib I_STDLIB
18727 #ifdef I_STDLIB
18728 #include <stdlib.h>
18729 #endif
18730 sigjmp_buf env;
18731 int set = 1;
18732 int main()
18733 {
18734         if (sigsetjmp(env,1))
18735                 exit(set);
18736         set = 0;
18737         siglongjmp(env, 1);
18738         exit(1);
18739 }
18740 EOP
18741         set try
18742         if eval $compile; then
18743                 if $run ./try >/dev/null 2>&1; then
18744                         echo "POSIX sigsetjmp found." >&4
18745                         val="$define"
18746                 else
18747                         $cat >&4 <<EOM
18748 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18749 I'll ignore them.
18750 EOM
18751                         val="$undef"
18752                 fi
18753         else
18754                 echo "sigsetjmp not found." >&4
18755                 val="$undef"
18756         fi
18757         ;;
18758 *) val="$d_sigsetjmp"
18759         case "$d_sigsetjmp" in
18760         $define) echo "POSIX sigsetjmp found." >&4;;
18761         $undef) echo "sigsetjmp not found." >&4;;
18762         esac
18763         ;;
18764 esac
18765 set d_sigsetjmp
18766 eval $setvar
18767 $rm_try
18768
18769 : see if snprintf exists
18770 set snprintf d_snprintf
18771 eval $inlibc
18772
18773 : see if vsnprintf exists
18774 set vsnprintf d_vsnprintf
18775 eval $inlibc
18776
18777 case "$d_snprintf-$d_vsnprintf" in
18778 "$define-$define")
18779     $cat <<EOM
18780 Checking whether your snprintf() and vsnprintf() work okay...
18781 EOM
18782     $cat >try.c <<'EOCP'
18783 /* v?snprintf testing logic courtesy of Russ Allbery.
18784  * According to C99:
18785  * - if the buffer is too short it still must be \0-terminated
18786  * - if the buffer is too short the potentially required length
18787  *   must be returned and not -1
18788  * - if the buffer is NULL the potentially required length
18789  *   must be returned and not -1 or core dump
18790  */
18791 #include <stdio.h>
18792 #include <stdarg.h>
18793
18794 char buf[2];
18795
18796 int test (char *format, ...)
18797 {
18798     va_list args;
18799     int count;
18800
18801     va_start (args, format);
18802     count = vsnprintf (buf, sizeof buf, format, args);
18803     va_end (args);
18804     return count;
18805 }
18806
18807 int main ()
18808 {
18809     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18810              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18811 }
18812 EOCP
18813     set try
18814     if eval $compile; then
18815         `$run ./try`
18816         case "$?" in
18817         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18818         *) cat <<EOM >&4
18819 Your snprintf() and snprintf() don't seem to be working okay.
18820 EOM
18821            d_snprintf="$undef"
18822            d_vsnprintf="$undef"
18823            ;;
18824         esac
18825     else
18826         echo "(I can't seem to compile the test program--assuming they don't)"
18827         d_snprintf="$undef"
18828         d_vsnprintf="$undef"
18829     fi
18830     $rm_try
18831     ;;
18832 esac
18833
18834 : see if sockatmark exists
18835 set sockatmark d_sockatmark
18836 eval $inlibc
18837
18838 : see if prototype for sockatmark is available
18839 echo " "
18840 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18841 eval $hasproto
18842
18843 : see if socks5_init exists
18844 set socks5_init d_socks5_init
18845 eval $inlibc
18846
18847 : see if sprintf returns the length of the string in the buffer as per ANSI
18848 $echo "Checking whether sprintf returns the length of the string..." >&4
18849 $cat <<EOP >try.c
18850 #include <stdio.h>
18851 #$i_stdlib I_STDLIB
18852 #ifdef I_STDLIB
18853 #include <stdlib.h>
18854 #endif
18855 #$i_string I_STRING
18856 #ifdef I_STRING
18857 #  include <string.h>
18858 #else
18859 #  include <strings.h>
18860 #endif
18861 #$i_math I_MATH
18862 #ifdef I_MATH
18863 #include <math.h>
18864 #endif
18865
18866 char buffer[256];
18867
18868 int check (size_t expect, int test) {
18869   size_t got = strlen(buffer);
18870   if (expect == got)
18871     return 0;
18872
18873   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18874        test, buffer);
18875   exit (test);
18876 }
18877
18878 int main(int argc, char **argv) {
18879   int test = 0;
18880
18881   check(sprintf(buffer, ""), ++test);
18882   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18883   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18884
18885   return 0;
18886 }
18887 EOP
18888 set try
18889
18890 if eval $compile; then
18891     xxx="`$run ./try`"
18892     case "$?" in
18893         0) cat >&4 <<EOM
18894 sprintf returns the length of the string (as ANSI says it should)
18895 EOM
18896         d_sprintf_returns_strlen="$define"
18897         ;;
18898         *) cat >&4 <<EOM
18899 sprintf does not return the length of the string (how old is this system?)
18900 EOM
18901         d_sprintf_returns_strlen="$undef"
18902         ;;
18903     esac
18904 else
18905     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18906     d_sprintf_returns_strlen="$undef"
18907 fi
18908 $rm_try
18909
18910 : see if srand48_r exists
18911 set srand48_r d_srand48_r
18912 eval $inlibc
18913 case "$d_srand48_r" in
18914 "$define")
18915         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18916         case "$d_srand48_r_proto:$usethreads" in
18917         ":define")      d_srand48_r_proto=define
18918                 set d_srand48_r_proto srand48_r $hdrs
18919                 eval $hasproto ;;
18920         *)      ;;
18921         esac
18922         case "$d_srand48_r_proto" in
18923         define)
18924         case "$srand48_r_proto" in
18925         ''|0) try='int srand48_r(long, struct drand48_data*);'
18926         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18927         esac
18928         case "$srand48_r_proto" in
18929         ''|0)   d_srand48_r=undef
18930                 srand48_r_proto=0
18931                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18932         * )     case "$srand48_r_proto" in
18933                 REENTRANT_PROTO*) ;;
18934                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18935                 esac
18936                 echo "Prototype: $try" ;;
18937         esac
18938         ;;
18939         *)      case "$usethreads" in
18940                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18941                 esac
18942                 d_srand48_r=undef
18943                 srand48_r_proto=0
18944                 ;;
18945         esac
18946         ;;
18947 *)      srand48_r_proto=0
18948         ;;
18949 esac
18950
18951 : see if srandom_r exists
18952 set srandom_r d_srandom_r
18953 eval $inlibc
18954 case "$d_srandom_r" in
18955 "$define")
18956         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18957         case "$d_srandom_r_proto:$usethreads" in
18958         ":define")      d_srandom_r_proto=define
18959                 set d_srandom_r_proto srandom_r $hdrs
18960                 eval $hasproto ;;
18961         *)      ;;
18962         esac
18963         case "$d_srandom_r_proto" in
18964         define)
18965         case "$srandom_r_proto" in
18966         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18967         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18968         esac
18969         case "$srandom_r_proto" in
18970         ''|0)   d_srandom_r=undef
18971                 srandom_r_proto=0
18972                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18973         * )     case "$srandom_r_proto" in
18974                 REENTRANT_PROTO*) ;;
18975                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18976                 esac
18977                 echo "Prototype: $try" ;;
18978         esac
18979         ;;
18980         *)      case "$usethreads" in
18981                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18982                 esac
18983                 d_srandom_r=undef
18984                 srandom_r_proto=0
18985                 ;;
18986         esac
18987         ;;
18988 *)      srandom_r_proto=0
18989         ;;
18990 esac
18991
18992 : see if prototype for setresgid is available
18993 echo " "
18994 set d_sresgproto setresgid $i_unistd unistd.h
18995 eval $hasproto
18996
18997 : see if prototype for setresuid is available
18998 echo " "
18999 set d_sresuproto setresuid $i_unistd unistd.h
19000 eval $hasproto
19001
19002 : see if stat exists
19003 set stat d_stat
19004 eval $inlibc
19005
19006 : see if sys/stat.h is available
19007 set sys/stat.h i_sysstat
19008 eval $inhdr
19009
19010 : see if stat knows about block sizes
19011 echo " "
19012 echo "Checking to see if your struct stat has st_blocks field..." >&4
19013 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19014 eval $hasfield
19015
19016 : see if this is a sys/vfs.h system
19017 set sys/vfs.h i_sysvfs
19018 eval $inhdr
19019
19020 : see if this is a sys/statfs.h system
19021 set sys/statfs.h i_sysstatfs
19022 eval $inhdr
19023
19024 : Check for statfs_s
19025 echo " "
19026 echo "Checking to see if your system supports struct statfs..." >&4
19027 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
19028 eval $hasstruct
19029 case "$d_statfs_s" in
19030 "$define")      echo "Yes, it does."   ;;
19031 *)              echo "No, it doesn't." ;;
19032 esac
19033
19034
19035 : see if struct statfs knows about f_flags
19036 case "$d_statfs_s" in
19037 define)
19038         echo " "
19039         echo "Checking to see if your struct statfs has f_flags field..." >&4
19040         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
19041         eval $hasfield
19042         ;;
19043 *)      val="$undef"
19044         set d_statfs_f_flags
19045         eval $setvar
19046         ;;
19047 esac
19048 case "$d_statfs_f_flags" in
19049 "$define")      echo "Yes, it does."   ;;
19050 *)              echo "No, it doesn't." ;;
19051 esac
19052
19053 : see what flavor, if any, of static inline is supported
19054 echo " "
19055 echo "Checking to see if your system supports static inline..."
19056 $cat > try.c <<'EOCP'
19057 #include <stdlib.h>
19058 extern int f_via_a(int x);
19059 extern int f_via_b(int x);
19060 int main(int argc, char **argv)
19061 {
19062     int y;
19063
19064     y = f_via_a(0);
19065 #ifdef USE_B
19066     y = f_via_b(0);
19067 #endif
19068     if (y == 42) {
19069         return EXIT_SUCCESS;
19070     }
19071     else {
19072         return EXIT_FAILURE;
19073     }
19074 }
19075 EOCP
19076 $cat > a.c <<'EOCP'
19077 static INLINE int f(int x) {
19078     int y;
19079     y = x + 42;
19080     return y;
19081 }
19082
19083 int f_via_a(int x)
19084 {
19085     return f(x);
19086 }
19087 EOCP
19088 $cat > b.c <<'EOCP'
19089 extern int f(int x);
19090
19091 int f_via_b(int x)
19092 {
19093     return f(x);
19094 }
19095 EOCP
19096
19097 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19098 case "$perl_static_inline" in
19099 '')     # Check the various possibilities, and break out on success.
19100         # For gcc, prefer __inline__, which will still permit
19101         # cflags.SH to add in -ansi.
19102         case "$gccversion" in
19103                 '') xxx="inline __inline__ __inline _inline";;
19104                 *)  xxx="__inline__ inline __inline _inline";;
19105         esac
19106         for inline in $xxx; do
19107                 set try -DINLINE=$inline a.c
19108                 if eval $compile && $run ./try; then
19109                         # Now make sure there is no external linkage of static
19110                         # functions
19111                         set try -DINLINE=$inline -DUSE_B a.c b.c
19112                         if eval $compile && $run ./try; then
19113                                 $echo "Your compiler supports static $inline, " >&4
19114                                 $echo "but it also creates an external definition," >&4
19115                                 $echo "so I won't use it." >&4
19116                                 val=$undef
19117                         else
19118                                 $echo "Your compiler supports static $inline." >&4
19119                                 val=$define
19120                                 perl_static_inline="static $inline";
19121                                 break;
19122                         fi
19123                 else
19124                         $echo "Your compiler does NOT support static $inline." >&4
19125                         val="$undef"
19126                 fi
19127         done
19128         ;;
19129 *inline*) # Some variant of inline exists.
19130         echo "Keeping your $hint value of $perl_static_inline."
19131         val=$define
19132         ;;
19133 static)  # No inline capabilities
19134         echo "Keeping your $hint value of $perl_static_inline."
19135         val=$undef
19136         ;;
19137 *)  # Unrecognized previous value -- blindly trust the supplied
19138         # value and hope it makes sense.  Use old value for
19139         # d_static_inline, if there is one.
19140         echo "Keeping your $hint value of $perl_static_inline."
19141         case "$d_static_inline" in
19142                 '') val=$define ;;
19143                 *)  val=$d_static_inline ;;
19144         esac
19145         ;;
19146 esac
19147 # Fallback to plain 'static' if nothing worked.
19148 case "$perl_static_inline" in
19149 '')
19150         perl_static_inline="static"
19151         val=$undef
19152         ;;
19153 esac
19154 set d_static_inline
19155 eval $setvar
19156 $rm -f a.[co] b.[co]
19157 $rm_try
19158
19159 : Check stream access
19160 $cat >&4 <<EOM
19161 Checking how to access stdio streams by file descriptor number...
19162 EOM
19163 case "$stdio_stream_array" in
19164 '')     $cat >try.c <<EOCP
19165 #include <stdio.h>
19166 int main() {
19167   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19168     printf("yes\n");
19169 }
19170 EOCP
19171         for s in _iob __iob __sF
19172         do
19173                 set try -DSTDIO_STREAM_ARRAY=$s
19174                 if eval $compile; then
19175                         case "`$run ./try`" in
19176                         yes)    stdio_stream_array=$s; break ;;
19177                         esac
19178                 fi
19179         done
19180         $rm_try
19181 esac
19182 case "$stdio_stream_array" in
19183 '')     $cat >&4 <<EOM
19184 I can't figure out how to access stdio streams by file descriptor number.
19185 EOM
19186         d_stdio_stream_array="$undef"
19187         ;;
19188 *)      $cat >&4 <<EOM
19189 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19190 EOM
19191         d_stdio_stream_array="$define"
19192         ;;
19193 esac
19194
19195 : see if strcoll exists
19196 set strcoll d_strcoll
19197 eval $inlibc
19198
19199 : check for structure copying
19200 echo " "
19201 echo "Checking to see if your C compiler can copy structs..." >&4
19202 $cat >try.c <<'EOCP'
19203 int main()
19204 {
19205         struct blurfl {
19206                 int dyick;
19207         } foo, bar;
19208
19209         foo = bar;
19210 }
19211 EOCP
19212 if $cc -c try.c >/dev/null 2>&1 ; then
19213         val="$define"
19214         echo "Yup, it can."
19215 else
19216         val="$undef"
19217         echo "Nope, it can't."
19218 fi
19219 set d_strctcpy
19220 eval $setvar
19221 $rm_try
19222
19223 : see if strerror and/or sys_errlist[] exist
19224 echo " "
19225 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19226     if set strerror val -f d_strerror; eval $csym; $val; then
19227                 echo 'strerror() found.' >&4
19228                 d_strerror="$define"
19229                 d_strerrm='strerror(e)'
19230                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19231                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19232                         d_syserrlst="$define"
19233                 else
19234                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19235                         d_syserrlst="$undef"
19236                 fi
19237     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19238                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19239                 echo 'strerror() found in string header.' >&4
19240                 d_strerror="$define"
19241                 d_strerrm='strerror(e)'
19242                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19243                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19244                                 d_syserrlst="$define"
19245                 else
19246                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19247                         d_syserrlst="$undef"
19248                 fi
19249     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19250                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19251                 d_strerror="$undef"
19252                 d_syserrlst="$define"
19253                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19254     else
19255                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19256                 d_strerror="$undef"
19257                 d_syserrlst="$undef"
19258                 d_strerrm='"unknown"'
19259     fi
19260 fi
19261
19262 : see if strerror_r exists
19263 set strerror_r d_strerror_r
19264 eval $inlibc
19265 case "$d_strerror_r" in
19266 "$define")
19267         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19268         case "$d_strerror_r_proto:$usethreads" in
19269         ":define")      d_strerror_r_proto=define
19270                 set d_strerror_r_proto strerror_r $hdrs
19271                 eval $hasproto ;;
19272         *)      ;;
19273         esac
19274         case "$d_strerror_r_proto" in
19275         define)
19276         case "$strerror_r_proto" in
19277         ''|0) try='int strerror_r(int, char*, size_t);'
19278         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19279         esac
19280         case "$strerror_r_proto" in
19281         ''|0) try='int strerror_r(int, char*, int);'
19282         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19283         esac
19284         case "$strerror_r_proto" in
19285         ''|0) try='char* strerror_r(int, char*, size_t);'
19286         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19287         esac
19288         case "$strerror_r_proto" in
19289         ''|0)   d_strerror_r=undef
19290                 strerror_r_proto=0
19291                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19292         * )     case "$strerror_r_proto" in
19293                 REENTRANT_PROTO*) ;;
19294                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19295                 esac
19296                 echo "Prototype: $try" ;;
19297         esac
19298         ;;
19299         *)      case "$usethreads" in
19300                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19301                 esac
19302                 d_strerror_r=undef
19303                 strerror_r_proto=0
19304                 ;;
19305         esac
19306         ;;
19307 *)      strerror_r_proto=0
19308         ;;
19309 esac
19310
19311 : see if strftime exists
19312 set strftime d_strftime
19313 eval $inlibc
19314
19315 : see if strlcat exists
19316 set strlcat d_strlcat
19317 eval $inlibc
19318
19319 : see if strlcpy exists
19320 set strlcpy d_strlcpy
19321 eval $inlibc
19322
19323 : see if strtod exists
19324 set strtod d_strtod
19325 eval $inlibc
19326
19327 : see if strtol exists
19328 set strtol d_strtol
19329 eval $inlibc
19330
19331 : see if strtold exists
19332 set strtold d_strtold
19333 eval $inlibc
19334
19335 : see if strtoll exists
19336 set strtoll d_strtoll
19337 eval $inlibc
19338
19339 case "$d_longlong-$d_strtoll" in
19340 "$define-$define")
19341         $cat <<EOM
19342 Checking whether your strtoll() works okay...
19343 EOM
19344         $cat >try.c <<'EOCP'
19345 #include <errno.h>
19346 #ifdef __hpux
19347 #define strtoll __strtoll
19348 #endif
19349 #ifdef __EMX__
19350 #define strtoll _strtoll
19351 #endif
19352 #include <stdio.h>
19353 extern long long int strtoll(char *s, char **, int);
19354 static int bad = 0;
19355 int check(char *s, long long ell, int een) {
19356         long long gll;
19357         errno = 0;
19358         gll = strtoll(s, 0, 10);
19359         if (!((gll == ell) && (errno == een)))
19360                 bad++;
19361 }
19362 int main() {
19363         check(" 1",                                      1LL, 0);
19364         check(" 0",                                      0LL, 0);
19365         check("-1",                                     -1LL, 0);
19366         check("-9223372036854775808", -9223372036854775808LL, 0);
19367         check("-9223372036854775808", -9223372036854775808LL, 0);
19368         check(" 9223372036854775807",  9223372036854775807LL, 0);
19369         check("-9223372036854775808", -9223372036854775808LL, 0);
19370         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19371         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19372         if (!bad)
19373                 printf("ok\n");
19374 }
19375 EOCP
19376         set try
19377         if eval $compile; then
19378                 yyy=`$run ./try`
19379                 case "$yyy" in
19380                 ok) echo "Your strtoll() seems to be working okay." ;;
19381                 *) cat <<EOM >&4
19382 Your strtoll() doesn't seem to be working okay.
19383 EOM
19384                    d_strtoll="$undef"
19385                    ;;
19386                 esac
19387         else
19388                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19389                 d_strtoll="$undef"
19390         fi
19391         ;;
19392 esac
19393
19394 : see if strtoq exists
19395 set strtoq d_strtoq
19396 eval $inlibc
19397
19398 : see if strtoul exists
19399 set strtoul d_strtoul
19400 eval $inlibc
19401
19402 case "$d_strtoul" in
19403 "$define")
19404         $cat <<EOM
19405 Checking whether your strtoul() works okay...
19406 EOM
19407         $cat >try.c <<'EOCP'
19408 #include <errno.h>
19409 #include <stdio.h>
19410 extern unsigned long int strtoul(char *s, char **, int);
19411 static int bad = 0;
19412 void check(char *s, unsigned long eul, int een) {
19413         unsigned long gul;
19414         errno = 0;
19415         gul = strtoul(s, 0, 10);
19416         if (!((gul == eul) && (errno == een)))
19417                 bad++;
19418 }
19419 int main() {
19420         check(" 1", 1L, 0);
19421         check(" 0", 0L, 0);
19422 EOCP
19423         case "$longsize" in
19424         8)
19425             $cat >>try.c <<'EOCP'
19426         check("18446744073709551615", 18446744073709551615UL, 0);
19427         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19428 #if 0 /* strtoul() for /^-/ strings is undefined. */
19429         check("-1", 18446744073709551615UL, 0);
19430         check("-18446744073709551614", 2, 0);
19431         check("-18446744073709551615", 1, 0);
19432         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19433         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19434 #endif
19435 EOCP
19436                 ;;
19437         4)
19438                     $cat >>try.c <<'EOCP'
19439         check("4294967295", 4294967295UL, 0);
19440         check("4294967296", 4294967295UL, ERANGE);
19441 #if 0 /* strtoul() for /^-/ strings is undefined. */
19442         check("-1", 4294967295UL, 0);
19443         check("-4294967294", 2, 0);
19444         check("-4294967295", 1, 0);
19445         check("-4294967296", 4294967295UL, ERANGE);
19446         check("-4294967297", 4294967295UL, ERANGE);
19447 #endif
19448 EOCP
19449                 ;;
19450         *)
19451 : Should we write these tests to be more portable by sprintf-ing
19452 : ~0 and then manipulating that char string as input for strtol?
19453                 ;;
19454         esac
19455         $cat >>try.c <<'EOCP'
19456         if (!bad)
19457                 printf("ok\n");
19458         return 0;
19459 }
19460 EOCP
19461         set try
19462         if eval $compile; then
19463                 case "`$run ./try`" in
19464                 ok) echo "Your strtoul() seems to be working okay." ;;
19465                 *) cat <<EOM >&4
19466 Your strtoul() doesn't seem to be working okay.
19467 EOM
19468                    d_strtoul="$undef"
19469                    ;;
19470                 esac
19471         else
19472                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19473                 d_strtoul="$undef"
19474         fi
19475         ;;
19476 esac
19477
19478 : see if strtoull exists
19479 set strtoull d_strtoull
19480 eval $inlibc
19481
19482 case "$d_longlong-$d_strtoull" in
19483 "$define-$define")
19484         $cat <<EOM
19485 Checking whether your strtoull() works okay...
19486 EOM
19487         $cat >try.c <<'EOCP'
19488 #include <errno.h>
19489 #ifdef __hpux
19490 #define strtoull __strtoull
19491 #endif
19492 #include <stdio.h>
19493 extern unsigned long long int strtoull(char *s, char **, int);
19494 static int bad = 0;
19495 int check(char *s, long long eull, int een) {
19496         long long gull;
19497         errno = 0;
19498         gull = strtoull(s, 0, 10);
19499         if (!((gull == eull) && (errno == een)))
19500                 bad++;
19501 }
19502 int main() {
19503         check(" 1",                                        1LL, 0);
19504         check(" 0",                                        0LL, 0);
19505         check("18446744073709551615",  18446744073709551615ULL, 0);
19506         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19507 #if 0 /* strtoull() for /^-/ strings is undefined. */
19508         check("-1",                    18446744073709551615ULL, 0);
19509         check("-18446744073709551614",                     2LL, 0);
19510         check("-18446744073709551615",                     1LL, 0);
19511         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19512         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19513 #endif
19514         if (!bad)
19515                 printf("ok\n");
19516 }
19517 EOCP
19518         set try
19519         if eval $compile; then
19520                 case "`$run ./try`" in
19521                 ok) echo "Your strtoull() seems to be working okay." ;;
19522                 *) cat <<EOM >&4
19523 Your strtoull() doesn't seem to be working okay.
19524 EOM
19525                    d_strtoull="$undef"
19526                    ;;
19527                 esac
19528         else
19529                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19530                 d_strtoull="$undef"
19531         fi
19532         ;;
19533 esac
19534
19535 : see if strtouq exists
19536 set strtouq d_strtouq
19537 eval $inlibc
19538
19539 case "$d_strtouq" in
19540 "$define")
19541         $cat <<EOM
19542 Checking whether your strtouq() works okay...
19543 EOM
19544         $cat >try.c <<'EOCP'
19545 #include <errno.h>
19546 #include <stdio.h>
19547 extern unsigned long long int strtouq(char *s, char **, int);
19548 static int bad = 0;
19549 void check(char *s, unsigned long long eull, int een) {
19550         unsigned long long gull;
19551         errno = 0;
19552         gull = strtouq(s, 0, 10);
19553         if (!((gull == eull) && (errno == een)))
19554                 bad++;
19555 }
19556 int main() {
19557         check(" 1",                                        1LL, 0);
19558         check(" 0",                                        0LL, 0);
19559         check("18446744073709551615",  18446744073709551615ULL, 0);
19560         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19561 #if 0 /* strtouq() for /^-/ strings is undefined. */
19562         check("-1",                    18446744073709551615ULL, 0);
19563         check("-18446744073709551614",                     2LL, 0);
19564         check("-18446744073709551615",                     1LL, 0);
19565         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19566         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19567 #endif
19568         if (!bad)
19569                 printf("ok\n");
19570         return 0;
19571 }
19572 EOCP
19573         set try
19574         if eval $compile; then
19575                 case "`$run ./try`" in
19576                 ok) echo "Your strtouq() seems to be working okay." ;;
19577                 *) cat <<EOM >&4
19578 Your strtouq() doesn't seem to be working okay.
19579 EOM
19580                    d_strtouq="$undef"
19581                    ;;
19582                 esac
19583         else
19584                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19585                 d_strtouq="$undef"
19586         fi
19587         ;;
19588 esac
19589
19590 : see if strxfrm exists
19591 set strxfrm d_strxfrm
19592 eval $inlibc
19593
19594 : see if symlink exists
19595 set symlink d_symlink
19596 eval $inlibc
19597
19598 : see if syscall exists
19599 set syscall d_syscall
19600 eval $inlibc
19601
19602 : see if prototype for syscall is available
19603 echo " "
19604 set d_syscallproto syscall $i_unistd unistd.h
19605 eval $hasproto
19606
19607 : see if sysconf exists
19608 set sysconf d_sysconf
19609 eval $inlibc
19610
19611 : see if system exists
19612 set system d_system
19613 eval $inlibc
19614
19615 : see if tcgetpgrp exists
19616 set tcgetpgrp d_tcgetpgrp
19617 eval $inlibc
19618
19619 : see if tcsetpgrp exists
19620 set tcsetpgrp d_tcsetpgrp
19621 eval $inlibc
19622
19623 : see if prototype for telldir is available
19624 echo " "
19625 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19626 eval $hasproto
19627
19628 : see if tgamma exists
19629 set tgamma d_tgamma
19630 eval $inlibc
19631
19632 : see if time exists
19633 echo " "
19634 if test "X$d_time" = X -o X"$timetype" = X; then
19635     if set time val -f d_time; eval $csym; $val; then
19636                 echo 'time() found.' >&4
19637                 val="$define"
19638                 rp="What is the type returned by time() on this system?"
19639                 set time_t timetype long stdio.h sys/types.h
19640                 eval $typedef_ask
19641     else
19642                 echo 'time() not found, hope that will do.' >&4
19643                 val="$undef"
19644                 timetype='int';
19645     fi
19646     set d_time
19647     eval $setvar
19648 fi
19649
19650 : see if timegm exists
19651 set timegm d_timegm
19652 eval $inlibc
19653
19654 : see if this is a sys/times.h system
19655 set sys/times.h i_systimes
19656 eval $inhdr
19657
19658 : see if times exists
19659 echo " "
19660 if set times val -f d_times; eval $csym; $val; then
19661         echo 'times() found.' >&4
19662         d_times="$define"
19663         inc=''
19664         case "$i_systimes" in
19665         "$define") inc='sys/times.h';;
19666         esac
19667         rp="What is the type returned by times() on this system?"
19668         set clock_t clocktype long stdio.h sys/types.h $inc
19669         eval $typedef_ask
19670 else
19671         echo 'times() NOT found, hope that will do.' >&4
19672         d_times="$undef"
19673         clocktype='int'
19674 fi
19675
19676 : see if tmpnam_r exists
19677 set tmpnam_r d_tmpnam_r
19678 eval $inlibc
19679 case "$d_tmpnam_r" in
19680 "$define")
19681         hdrs="$i_systypes sys/types.h define stdio.h "
19682         case "$d_tmpnam_r_proto:$usethreads" in
19683         ":define")      d_tmpnam_r_proto=define
19684                 set d_tmpnam_r_proto tmpnam_r $hdrs
19685                 eval $hasproto ;;
19686         *)      ;;
19687         esac
19688         case "$d_tmpnam_r_proto" in
19689         define)
19690         case "$tmpnam_r_proto" in
19691         ''|0) try='char* tmpnam_r(char*);'
19692         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19693         esac
19694         case "$tmpnam_r_proto" in
19695         ''|0)   d_tmpnam_r=undef
19696                 tmpnam_r_proto=0
19697                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19698         * )     case "$tmpnam_r_proto" in
19699                 REENTRANT_PROTO*) ;;
19700                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19701                 esac
19702                 echo "Prototype: $try" ;;
19703         esac
19704         ;;
19705         *)      case "$usethreads" in
19706                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19707                 esac
19708                 d_tmpnam_r=undef
19709                 tmpnam_r_proto=0
19710                 ;;
19711         esac
19712         ;;
19713 *)      tmpnam_r_proto=0
19714         ;;
19715 esac
19716
19717 : see if trunc exists
19718 set trunc d_trunc
19719 eval $inlibc
19720
19721 : see if truncate exists
19722 set truncate d_truncate
19723 eval $inlibc
19724
19725 : see if ttyname_r exists
19726 set ttyname_r d_ttyname_r
19727 eval $inlibc
19728 case "$d_ttyname_r" in
19729 "$define")
19730         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19731         case "$d_ttyname_r_proto:$usethreads" in
19732         ":define")      d_ttyname_r_proto=define
19733                 set d_ttyname_r_proto ttyname_r $hdrs
19734                 eval $hasproto ;;
19735         *)      ;;
19736         esac
19737         case "$d_ttyname_r_proto" in
19738         define)
19739         case "$ttyname_r_proto" in
19740         ''|0) try='int ttyname_r(int, char*, size_t);'
19741         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19742         esac
19743         case "$ttyname_r_proto" in
19744         ''|0) try='int ttyname_r(int, char*, int);'
19745         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19746         esac
19747         case "$ttyname_r_proto" in
19748         ''|0) try='char* ttyname_r(int, char*, int);'
19749         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19750         esac
19751         case "$ttyname_r_proto" in
19752         ''|0)   d_ttyname_r=undef
19753                 ttyname_r_proto=0
19754                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19755         * )     case "$ttyname_r_proto" in
19756                 REENTRANT_PROTO*) ;;
19757                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19758                 esac
19759                 echo "Prototype: $try" ;;
19760         esac
19761         ;;
19762         *)      case "$usethreads" in
19763                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19764                 esac
19765                 d_ttyname_r=undef
19766                 ttyname_r_proto=0
19767                 ;;
19768         esac
19769         ;;
19770 *)      ttyname_r_proto=0
19771         ;;
19772 esac
19773
19774 : see if tzname[] exists
19775 echo " "
19776 if set tzname val -a d_tzname; eval $csym; $val; then
19777         val="$define"
19778         echo 'tzname[] found.' >&4
19779 else
19780         val="$undef"
19781         echo 'tzname[] NOT found.' >&4
19782 fi
19783 set d_tzname
19784 eval $setvar
19785
19786 : Check if is a multiplatform env
19787 case "$osname" in
19788 darwin) multiarch="$define" ;;
19789 esac
19790 case "$multiarch" in
19791 ''|[nN]*) multiarch="$undef" ;;
19792 esac
19793
19794 : check for ordering of bytes in a UV
19795 echo " "
19796 case "$multiarch" in
19797 *$define*)
19798         $cat <<EOM
19799 You seem to be doing a multiarchitecture build,
19800 skipping the byteorder check.
19801
19802 EOM
19803         byteorder='ffff'
19804         ;;
19805 *)
19806         case "$byteorder" in
19807         '')
19808                 $cat <<'EOM'
19809 In the following, larger digits indicate more significance.  A big-endian
19810 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19811 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19812 machines may have weird orders like 3412.  A Cray will report 87654321,
19813 an Alpha will report 12345678. If the test program works the default is
19814 probably right.
19815 I'm now running the test program...
19816 EOM
19817                 $cat >try.c <<EOCP
19818 #include <stdio.h>
19819 #$i_stdlib I_STDLIB
19820 #ifdef I_STDLIB
19821 #include <stdlib.h>
19822 #endif
19823 #include <sys/types.h>
19824 typedef $uvtype UV;
19825 int main()
19826 {
19827         int i;
19828         union {
19829                 UV l;
19830                 char c[$uvsize];
19831         } u;
19832
19833         if ($uvsize > 4)
19834                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19835         else
19836                 u.l = (UV)0x04030201;
19837         for (i = 0; i < $uvsize; i++)
19838                 printf("%c", u.c[i]+'0');
19839         printf("\n");
19840         exit(0);
19841 }
19842 EOCP
19843                 xxx_prompt=y
19844                 set try
19845                 if eval $compile && $run ./try > /dev/null; then
19846                         dflt=`$run ./try`
19847                         case "$dflt" in
19848                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19849                                 echo "(The test program ran ok.)"
19850                                 echo "byteorder=$dflt"
19851                                 xxx_prompt=n
19852                         ;;
19853                         ????|????????) echo "(The test program ran ok.)" ;;
19854                         *) echo "(The test program didn't run right for some reason.)" ;;
19855                         esac
19856                 else
19857                         dflt='4321'
19858                         cat <<'EOM'
19859 (I can't seem to compile the test program.  Guessing big-endian...)
19860 EOM
19861                 fi
19862                 case "$xxx_prompt" in
19863                 y)
19864                         rp="What is the order of bytes in $uvtype?"
19865                         . ./myread
19866                         byteorder="$ans"
19867                         ;;
19868                 *)      byteorder=$dflt
19869                         ;;
19870                 esac
19871                 ;;
19872         esac
19873         $rm_try
19874         ;;
19875 esac
19876
19877 : Checking 32bit alignedness
19878 $cat <<EOM
19879
19880 Checking to see whether you can access character data unalignedly...
19881 EOM
19882 case "$d_u32align" in
19883 '')   $cat >try.c <<EOCP
19884 #include <stdio.h>
19885 #$i_stdlib I_STDLIB
19886 #ifdef I_STDLIB
19887 #include <stdlib.h>
19888 #endif
19889 #define U32 $u32type
19890 #define BYTEORDER 0x$byteorder
19891 #define U8 $u8type
19892 #include <signal.h>
19893 #ifdef SIGBUS
19894 $signal_t bletch(int s) { exit(4); }
19895 #endif
19896 int main() {
19897 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19898     volatile U8 buf[8];
19899     volatile U32 *up;
19900     int i;
19901
19902     if (sizeof(U32) != 4) {
19903         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19904         exit(1);
19905     }
19906
19907     fflush(stdout);
19908
19909 #ifdef SIGBUS
19910     signal(SIGBUS, bletch);
19911 #endif
19912
19913     buf[0] = 0;
19914     buf[1] = 0;
19915     buf[2] = 0;
19916     buf[3] = 1;
19917     buf[4] = 0;
19918     buf[5] = 0;
19919     buf[6] = 0;
19920     buf[7] = 1;
19921
19922     for (i = 0; i < 4; i++) {
19923         up = (U32*)(buf + i);
19924         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19925                (*up == 1 << (8*(3-i)))  /* little-endian */
19926               )
19927            )
19928         {
19929             printf("read failed (%x)\n", *up);
19930             exit(2);
19931         }
19932     }
19933
19934     /* write test */
19935     for (i = 0; i < 4; i++) {
19936         up = (U32*)(buf + i);
19937         *up = 0xBeef;
19938         if (*up != 0xBeef) {
19939             printf("write failed (%x)\n", *up);
19940             exit(3);
19941         }
19942     }
19943
19944     exit(0);
19945 #else
19946     printf("1\n");
19947     exit(1);
19948 #endif
19949     return 0;
19950 }
19951 EOCP
19952 set try
19953 if eval $compile_ok; then
19954         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19955         $run ./try 2>&1 >/dev/null
19956         case "$?" in
19957         0)      cat >&4 <<EOM
19958 You can access character data pretty unalignedly.
19959 EOM
19960                 d_u32align="$undef"
19961                 ;;
19962         *)      cat >&4 <<EOM
19963 It seems that you must access character data in an aligned manner.
19964 EOM
19965                 d_u32align="$define"
19966                 ;;
19967         esac
19968 else
19969         rp='Can you access character data at unaligned addresses?'
19970         dflt='n'
19971         . ./myread
19972         case "$ans" in
19973         [yY]*)  d_u32align="$undef"  ;;
19974         *)      d_u32align="$define" ;;
19975         esac
19976 fi
19977 $rm_try
19978 ;;
19979 esac
19980
19981 : see if ualarm exists
19982 set ualarm d_ualarm
19983 eval $inlibc
19984
19985 : see if umask exists
19986 set umask d_umask
19987 eval $inlibc
19988
19989 : see if unordered exists
19990 set unordered d_unordered
19991 eval $inlibc
19992
19993 : see if unsetenv exists
19994 set unsetenv d_unsetenv
19995 eval $inlibc
19996
19997 : see if usleep exists
19998 set usleep d_usleep
19999 eval $inlibc
20000
20001 : see if prototype for usleep is available
20002 echo " "
20003 set d_usleepproto usleep $i_unistd unistd.h
20004 eval $hasproto
20005
20006 : see if ustat exists
20007 set ustat d_ustat
20008 eval $inlibc
20009
20010 : see if closedir exists
20011 set closedir d_closedir
20012 eval $inlibc
20013
20014 case "$d_closedir" in
20015 "$define")
20016         echo " "
20017         echo "Checking whether closedir() returns a status..." >&4
20018         cat > try.c <<EOM
20019 #$i_dirent I_DIRENT             /**/
20020 #$i_sysdir I_SYS_DIR            /**/
20021 #$i_sysndir I_SYS_NDIR          /**/
20022 #$i_systypes I_SYS_TYPES        /**/
20023
20024 #if defined(I_SYS_TYPES)
20025 #include <sys/types.h>
20026 #endif
20027 #if defined(I_DIRENT)
20028 #include <dirent.h>
20029 #else
20030 #ifdef I_SYS_NDIR
20031 #include <sys/ndir.h>
20032 #else
20033 #ifdef I_SYS_DIR
20034 #ifdef hp9000s500
20035 #include <ndir.h>       /* may be wrong in the future */
20036 #else
20037 #include <sys/dir.h>
20038 #endif
20039 #endif
20040 #endif
20041 #endif
20042 int main() { return closedir(opendir(".")); }
20043 EOM
20044         set try
20045         if eval $compile_ok; then
20046                 if $run ./try > /dev/null 2>&1 ; then
20047                         echo "Yes, it does."
20048                         val="$undef"
20049                 else
20050                         echo "No, it doesn't."
20051                         val="$define"
20052                 fi
20053         else
20054                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20055                 val="$define"
20056         fi
20057         ;;
20058 *)
20059         val="$undef";
20060         ;;
20061 esac
20062 set d_void_closedir
20063 eval $setvar
20064 $rm_try
20065
20066 : see if there is a wait4
20067 set wait4 d_wait4
20068 eval $inlibc
20069
20070 : see if waitpid exists
20071 set waitpid d_waitpid
20072 eval $inlibc
20073
20074 : look for wcscmp
20075 echo " "
20076 $cat >try.c <<'EOCP'
20077 #include <stdio.h>
20078 #include <wchar.h>
20079 int main ()
20080 {
20081     wchar_t *s = L" ";
20082     return (wcscmp (s, s) ? 1 : 0);
20083     }
20084 EOCP
20085 set try
20086 val="$undef"
20087 if eval $compile; then
20088     `$run ./try`
20089     case "$?" in
20090         0)  echo "A working wcscmp() found." >&4
20091             val="$define" ;;
20092         *)  echo "wcscmp() found, but it doesn't work" >&4
20093             ;;
20094         esac
20095 else
20096     echo "wcscmp() NOT found." >&4
20097     fi
20098 set d_wcscmp
20099 eval $setvar
20100 $rm_try
20101
20102 : see if wcstombs exists
20103 set wcstombs d_wcstombs
20104 eval $inlibc
20105
20106 : look for wcsxfrm
20107 echo " "
20108 $cat >try.c <<'EOCP'
20109 #include <errno.h>
20110 #include <wchar.h>
20111 int main ()
20112 {
20113     wchar_t dst[4], *src = L" ";
20114     errno = 0;
20115     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20116     }
20117 EOCP
20118 set try
20119 val="$undef"
20120 if eval $compile; then
20121     `$run ./try`
20122     case "$?" in
20123         0)  echo "A working wcsxfrm() found." >&4
20124             val="$define" ;;
20125         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20126             ;;
20127         esac
20128 else
20129     echo "wcsxfrm() NOT found." >&4
20130     fi
20131 set d_wcsxfrm
20132 eval $setvar
20133 $rm_try
20134
20135 : see if wctomb exists
20136 set wctomb d_wctomb
20137 eval $inlibc
20138
20139 : see if writev exists
20140 set writev d_writev
20141 eval $inlibc
20142
20143 : check for alignment requirements
20144 echo " "
20145 case "$alignbytes" in
20146     '') echo "Checking alignment constraints..." >&4
20147         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
20148             $cat >try.c <<'EOCP'
20149 typedef long double NV;
20150 EOCP
20151         else
20152             $cat >try.c <<'EOCP'
20153 typedef double NV;
20154 EOCP
20155         fi
20156         $cat >>try.c <<'EOCP'
20157 #include <stdio.h>
20158 struct foobar {
20159     char foo;
20160     NV bar;
20161 } try_algn;
20162 int main()
20163 {
20164     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20165     return(0);
20166 }
20167 EOCP
20168         set try
20169         if eval $compile_ok; then
20170             dflt=`$run ./try`
20171         else
20172             dflt='8'
20173             echo "(I can't seem to compile the test program...)"
20174         fi
20175         case "$multiarch" in
20176             *$define*)
20177                 : The usual safe value is 8, but Darwin with -Duselongdouble
20178                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20179                 : Configure to pick a larger value if needed.
20180                 if $test "$dflt" -lt 8; then
20181                     dflt='8'
20182                     echo "Setting alignment to 8 for multiarch support.">&4
20183                 fi
20184                 ;;
20185         esac
20186         ;;
20187     *) dflt="$alignbytes"
20188         ;;
20189 esac
20190 rp="Doubles must be aligned on a how-many-byte boundary?"
20191 . ./myread
20192 alignbytes="$ans"
20193 $rm_try
20194
20195 : set the base revision
20196 baserev=5.0
20197
20198 : length of character in bytes. Is always 1, otherwise it is not C
20199 : This used to be a test using sizeof
20200 charsize=1
20201
20202 : Check for the number of bits in a character
20203 case "$charbits" in
20204 '')     echo "Checking how long a character is (in bits)..." >&4
20205         $cat >try.c <<EOCP
20206 #include <stdio.h>
20207 int main ()
20208 {
20209     int n;
20210     unsigned char c;
20211     for (c = 1, n = 0; c; c <<= 1, n++) ;
20212     printf ("%d\n", n);
20213     return (0);
20214     }
20215 EOCP
20216         set try
20217         if eval $compile_ok; then
20218                 dflt=`$run ./try`
20219         else
20220                 dflt='8'
20221                 echo "(I can't seem to compile the test program.  Guessing...)"
20222         fi
20223         ;;
20224 *)
20225         dflt="$charbits"
20226         ;;
20227 esac
20228 rp="What is the length of a character (in bits)?"
20229 . ./myread
20230 charbits="$ans"
20231 $rm_try
20232 case "$charbits" in
20233 8)      ;;
20234 *)      cat >&4 << EOM
20235 Your system has an unsigned character size of $charbits bits, which
20236 is rather unusual (normally it is 8 bits).  Perl likely will not work
20237 correctly on your system, with subtle bugs in various places.
20238 EOM
20239         rp='Do you really want to continue?'
20240         dflt='n'
20241         . ./myread
20242         case "$ans" in
20243                 [yY])   echo >&4 "Okay, continuing."    ;;
20244                 *)      exit 1                          ;;
20245         esac
20246 esac
20247
20248 : how do we concatenate cpp tokens here?
20249 echo " "
20250 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20251 $cat >cpp_stuff.c <<'EOCP'
20252 #define RCAT(a,b)a/**/b
20253 #define ACAT(a,b)a ## b
20254 RCAT(Rei,ser)
20255 ACAT(Cir,cus)
20256 EOCP
20257 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20258 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20259         echo "Oh!  Smells like ANSI's been here." >&4
20260         echo "We can catify or stringify, separately or together!"
20261         cpp_stuff=42
20262 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20263         echo "Ah, yes!  The good old days!" >&4
20264         echo "However, in the good old days we don't know how to stringify and"
20265         echo "catify at the same time."
20266         cpp_stuff=1
20267 else
20268         $cat >&4 <<EOM
20269 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20270 You're going to have to edit the values of CAT[2-5] in config.h...
20271 EOM
20272         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20273 fi
20274 $rm -f cpp_stuff.*
20275
20276 : see if this is a db.h system
20277 set db.h i_db
20278 eval $inhdr
20279
20280 case "$i_db" in
20281 $define)
20282         : Check db version.
20283         echo " "
20284         echo "Checking Berkeley DB version ..." >&4
20285         $cat >try.c <<EOCP
20286 #$d_const HASCONST
20287 #ifndef HASCONST
20288 #define const
20289 #endif
20290 #include <sys/types.h>
20291 #include <stdio.h>
20292 #$i_stdlib I_STDLIB
20293 #ifdef I_STDLIB
20294 #include <stdlib.h>
20295 #endif
20296 #include <db.h>
20297 int main(int argc, char *argv[])
20298 {
20299 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20300     int Major, Minor, Patch ;
20301     unsigned long Version ;
20302     (void)db_version(&Major, &Minor, &Patch) ;
20303     if (argc == 2) {
20304         printf("%d %d %d %d %d %d\n",
20305                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20306                Major, Minor, Patch);
20307         exit(0);
20308     }
20309     printf("You have Berkeley DB Version 2 or greater.\n");
20310
20311     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20312                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20313     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20314                 Major, Minor, Patch) ;
20315
20316     /* check that db.h & libdb are compatible */
20317     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20318         printf("db.h and libdb are incompatible.\n") ;
20319         exit(3);
20320     }
20321
20322     printf("db.h and libdb are compatible.\n") ;
20323
20324     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20325                 + DB_VERSION_PATCH ;
20326
20327     /* needs to be >= 2.3.4 */
20328     if (Version < 2003004) {
20329     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20330         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20331         exit(2);
20332     }
20333
20334     exit(0);
20335 #else
20336 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20337     if (argc == 2) {
20338         printf("1 0 0\n");
20339         exit(0);
20340     }
20341     printf("You have Berkeley DB Version 1.\n");
20342     exit(0);    /* DB version < 2: the coast is clear. */
20343 #else
20344     exit(1);    /* <db.h> not Berkeley DB? */
20345 #endif
20346 #endif
20347 }
20348 EOCP
20349         set try
20350         if eval $compile_ok && $run ./try; then
20351                 echo 'Looks OK.' >&4
20352                 set `$run ./try 1`
20353                 db_version_major=$1
20354                 db_version_minor=$2
20355                 db_version_patch=$3
20356         else
20357                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20358                 i_db=$undef
20359                 case " $libs " in
20360                 *"-ldb "*)
20361                         : Remove db from list of libraries to use
20362                         echo "Removing unusable -ldb from library list" >&4
20363                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20364                         shift
20365                         libs="$*"
20366                         echo "libs = $libs" >&4
20367                         ;;
20368                 esac
20369         fi
20370         $rm_try
20371         ;;
20372 esac
20373
20374 case "$i_db" in
20375 define)
20376         : Check the return type needed for hash
20377         echo " "
20378         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20379         $cat >try.c <<EOCP
20380 #$d_const HASCONST
20381 #ifndef HASCONST
20382 #define const
20383 #endif
20384 #include <sys/types.h>
20385 #include <db.h>
20386
20387 #ifndef DB_VERSION_MAJOR
20388 u_int32_t hash_cb (const void* ptr, size_t size)
20389 {
20390 }
20391 HASHINFO info;
20392 int main()
20393 {
20394         info.hash = hash_cb;
20395 }
20396 #endif
20397 EOCP
20398         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20399                 if $contains warning try.out >>/dev/null 2>&1 ; then
20400                         db_hashtype='int'
20401                 else
20402                         db_hashtype='u_int32_t'
20403                 fi
20404         else
20405                 : XXX Maybe we should just give up here.
20406                 db_hashtype=u_int32_t
20407                 $cat try.out >&4
20408                 echo "Help:  I can't seem to compile the db test program." >&4
20409                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20410         fi
20411         $rm_try
20412         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20413         ;;
20414 *)      db_hashtype=u_int32_t
20415         ;;
20416 esac
20417 case "$i_db" in
20418 define)
20419         : Check the return type needed for prefix
20420         echo " "
20421         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20422         cat >try.c <<EOCP
20423 #$d_const HASCONST
20424 #ifndef HASCONST
20425 #define const
20426 #endif
20427 #include <sys/types.h>
20428 #include <db.h>
20429
20430 #ifndef DB_VERSION_MAJOR
20431 size_t prefix_cb (const DBT *key1, const DBT *key2)
20432 {
20433 }
20434 BTREEINFO info;
20435 int main()
20436 {
20437         info.prefix = prefix_cb;
20438 }
20439 #endif
20440 EOCP
20441         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20442                 if $contains warning try.out >>/dev/null 2>&1 ; then
20443                         db_prefixtype='int'
20444                 else
20445                         db_prefixtype='size_t'
20446                 fi
20447         else
20448                 db_prefixtype='size_t'
20449                 : XXX Maybe we should just give up here.
20450                 $cat try.out >&4
20451                 echo "Help:  I can't seem to compile the db test program." >&4
20452                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20453         fi
20454         $rm_try
20455         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20456         ;;
20457 *)      db_prefixtype='size_t'
20458         ;;
20459 esac
20460
20461 : Check what kind of inf/nan your system has
20462 $echo "Checking the kind of infinities and nans you have..." >&4
20463 $cat >try.c <<EOP
20464 #define DOUBLESIZE $doublesize
20465 #$d_longdbl HAS_LONG_DOUBLE
20466 #ifdef HAS_LONG_DOUBLE
20467 #define LONGDBLSIZE $longdblsize
20468 #define LONGDBLKIND $longdblkind
20469 #endif
20470 #$i_math I_MATH
20471 #ifdef I_MATH
20472 #include <math.h>
20473 #endif
20474 #include <stdio.h>
20475 /* Note that whether the sign bit is on or off
20476  * for NaN depends on the CPU/FPU, and possibly
20477  * can be affected by the build toolchain.
20478  *
20479  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20480  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20481  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20482  * (respectively) as opposed to the more usual
20483  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20484  */
20485 static void bytes(unsigned char *p, unsigned int n) {
20486   int i;
20487   for (i = 0; i < n; i++) {
20488     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20489   }
20490 }
20491 int main(int argc, char *argv[]) {
20492    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20493     * because some compilers are 'smart' and not only warn but refuse to
20494     * compile such 'illegal' values. */
20495    double dinf = exp(1e9);
20496    double dnan = sqrt(-1.0);
20497 #ifdef HAS_LONG_DOUBLE
20498    long double ldinf = (long double)exp(1e9);
20499    long double ldnan = (long double)sqrt(-1.0);
20500 #endif
20501   if (argc == 2) {
20502     switch (argv[1][0]) {
20503     case '1': bytes(&dinf, sizeof(dinf)); break;
20504     case '2': bytes(&dnan, sizeof(dnan)); break;
20505 #ifdef HAS_LONG_DOUBLE
20506 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20507 /* the 80-bit long doubles might have garbage in their excess bytes */
20508     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20509 # endif
20510     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20511     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20512 #endif
20513     }
20514   }
20515   return 0;
20516 }
20517 EOP
20518 set try
20519 if eval $compile; then
20520     doubleinfbytes=`$run ./try 1`
20521     doublenanbytes=`$run ./try 2`
20522     case "$d_longdbl" in
20523     $define)
20524       longdblinfbytes=`$run ./try 3`
20525       longdblnanbytes=`$run ./try 4`
20526       ;;
20527     esac
20528 else
20529     # Defaults in case the above test program failed.
20530     case "$doublekind" in
20531     1) # IEEE 754 32-bit LE
20532        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20533        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20534        ;;
20535     2) # IEEE 754 32-bit BE
20536        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20537        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20538        ;;
20539     3) # IEEE 754 64-bit LE
20540        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20541        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20542        ;;
20543     4) # IEEE 754 64-bit BE
20544        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20545        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20546        ;;
20547     5) # IEEE 754 128-bit LE
20548        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20549        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20550        ;;
20551     6) # IEEE 754 128-bit BE
20552        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20553        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20554        ;;
20555     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20556        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20557        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20558        ;;
20559     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20560        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20561        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20562        ;;
20563     *) # No idea.
20564        doubleinfbytes=$undef
20565        doublenanbytes=$undef
20566        ;;
20567     esac
20568     case "$longdblkind" in
20569     1) # IEEE 754 128-bit LE
20570        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20571        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20572        ;;
20573     2) # IEEE 754 128-bit BE
20574        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20575        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20576        ;;
20577     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20578        case "$longdblsize" in
20579        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20580            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20581            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20582            ;;
20583        16) # x86_64
20584            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20585            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20586            ;;
20587        *)  # No idea.
20588            longdblinfbytes=$undef
20589            longdblnanbytes=$undef
20590        ;;
20591        esac
20592        ;;
20593     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20594        case "$longdblsize" in
20595        12) # 32-bit system
20596            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20597            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20598            ;;
20599        16) # 64-bit system
20600            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20601            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20602            ;;
20603        *)  # No idea.
20604            longdblinfbytes=$undef
20605            longdblnanbytes=$undef
20606        ;;
20607        esac
20608        ;;
20609     5) # 128-bit LE-LE "double double"
20610        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20611        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20612        ;;
20613     6) # 128-bit BE-BE "double double"
20614        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20615        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20616        ;;
20617     7) # 128-bit LE-BE "double double"
20618        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20619        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20620        ;;
20621     8) # 128-bit BE-LE "double double"
20622        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20623        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20624        ;;
20625     *) # No idea.
20626        longdblinfbytes=$undef
20627        longdblnanbytes=$undef
20628        ;;
20629     esac
20630 fi
20631 $rm_try
20632
20633 : Check the length of the double mantissa
20634 $echo "Checking how many mantissa bits your doubles have..." >&4
20635 $cat >try.c <<EOP
20636 #$i_float I_FLOAT
20637 #$i_sunmath I_SUNMATH
20638 #ifdef I_FLOAT
20639 # include <float.h>
20640 #endif
20641 #ifdef I_SUNMATH
20642 # include <sunmath.h>
20643 #endif
20644 #ifdef DBL_MANT_DIG
20645 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20646 #endif
20647 #include <stdio.h>
20648 int main(int argc, char *argv[]) {
20649 #ifdef BITS
20650   printf("%d\n", BITS);
20651 #endif
20652   return 0;
20653 }
20654 EOP
20655 set try
20656 if eval $compile; then
20657     doublemantbits=`$run ./try`
20658 else
20659     doublemantbits="$undef"
20660 fi
20661 $rm_try
20662
20663 : Check the length of the longdouble mantissa
20664 $echo "Checking how many mantissa bits your long doubles have..." >&4
20665 $cat >try.c <<EOP
20666 #$i_float I_FLOAT
20667 #$i_sunmath I_SUNMATH
20668 #ifdef I_FLOAT
20669 # include <float.h>
20670 #endif
20671 #ifdef I_SUNMATH
20672 # include <sunmath.h>
20673 #endif
20674 #$d_longdbl HAS_LONG_DOUBLE
20675 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20676 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20677 /* This format has no implicit bit.  Beware, however, that for
20678  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20679  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20680  * and the top bit must have been one since 387, zero is plain invalid.
20681  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20682 #  define BITS LDBL_MANT_DIG
20683 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20684 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20685  * reason e.g. Irix thinks 107.  But in any case, we want only
20686  * the number of real bits, the implicit bits are of no interest.  */
20687 #  define BITS 2 * (DBL_MANT_DIG - 1)
20688 # else
20689 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20690 # endif
20691 #endif
20692 #include <stdio.h>
20693 int main(int argc, char *argv[]) {
20694 #ifdef BITS
20695   printf("%d\n", BITS);
20696 #endif
20697   return 0;
20698 }
20699 EOP
20700 set try
20701 if eval $compile; then
20702     longdblmantbits=`$run ./try`
20703 else
20704     longdblmantbits="$undef"
20705 fi
20706 $rm_try
20707
20708 : Check the length of the NV mantissa
20709 $echo "Checking how many mantissa bits your NVs have..." >&4
20710 if test "X$usequadmath" = "X$define"; then
20711   nvmantbits=112 # 128-1-15
20712 else
20713   if test "X$nvsize" = "X$doublesize"; then
20714     nvmantbits="$doublemantbits"
20715   else
20716      if test "X$nvsize" = "X$longdblsize"; then
20717        nvmantbits="$longdblmantbits"
20718      else
20719        nvmantbits="$undef"
20720      fi
20721   fi
20722 fi
20723
20724 : How can we generate normalized random numbers ?
20725 echo " "
20726 echo "Using our internal random number implementation..." >&4
20727
20728 case "$ccflags" in
20729 *-Dmy_rand=*|*-Dmy_srand=*)
20730         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20731         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20732         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20733         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20734         ;;
20735 esac
20736
20737 randfunc=Perl_drand48
20738 drand01="Perl_drand48()"
20739 seedfunc="Perl_drand48_init"
20740 randbits=48
20741 randseedtype=U32
20742
20743 : Determine if this is an EBCDIC system
20744 echo " "
20745 echo "Determining whether or not we are on an EBCDIC system..." >&4
20746 $cat >try.c <<'EOM'
20747 int main()
20748 {
20749   if ('M'==0xd4) return 0;
20750   return 1;
20751 }
20752 EOM
20753
20754 val=$undef
20755 set try
20756 if eval $compile_ok; then
20757         if $run ./try; then
20758                 echo "You seem to speak EBCDIC." >&4
20759                 val="$define"
20760         else
20761                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20762         fi
20763 else
20764         echo "I'm unable to compile the test program." >&4
20765         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20766 fi
20767 $rm_try
20768 set ebcdic
20769 eval $setvar
20770
20771 : Check how to flush
20772 echo " "
20773 $cat >&4 <<EOM
20774 Checking how to flush all pending stdio output...
20775 EOM
20776 # I only know how to find the first 32 possibly open files on SunOS.
20777 # See also hints/sunos_4_1.sh and util.c  --AD
20778 case "$osname" in
20779 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20780 esac
20781 $cat >>try.c <<EOCP
20782 #include <stdio.h>
20783 #$i_stdlib I_STDLIB
20784 #ifdef I_STDLIB
20785 #include <stdlib.h>
20786 #endif
20787 #$i_unistd I_UNISTD
20788 #ifdef I_UNISTD
20789 # include <unistd.h>
20790 #endif
20791 #$d_sysconf HAS_SYSCONF
20792 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20793 #ifdef HAS_STDIO_STREAM_ARRAY
20794 # define STDIO_STREAM_ARRAY $stdio_stream_array
20795 #endif
20796 int main() {
20797   FILE* p;
20798   unlink("try.out");
20799   p = fopen("try.out", "w");
20800 #ifdef TRY_FPUTC
20801   fputc('x', p);
20802 #else
20803 # ifdef TRY_FPRINTF
20804   fprintf(p, "x");
20805 # endif
20806 #endif
20807 #ifdef TRY_FFLUSH_NULL
20808   fflush(NULL);
20809 #endif
20810 #ifdef TRY_FFLUSH_ALL
20811   {
20812     long open_max = -1;
20813 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20814     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20815 # else
20816 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20817     open_max = sysconf(_SC_OPEN_MAX);
20818 #  else
20819 #   ifdef FOPEN_MAX
20820     open_max = FOPEN_MAX;
20821 #   else
20822 #    ifdef OPEN_MAX
20823     open_max = OPEN_MAX;
20824 #    else
20825 #     ifdef _NFILE
20826     open_max = _NFILE;
20827 #     endif
20828 #    endif
20829 #   endif
20830 #  endif
20831 # endif
20832 # ifdef HAS_STDIO_STREAM_ARRAY
20833     if (open_max > 0) {
20834       long i;
20835       for (i = 0; i < open_max; i++)
20836             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20837                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20838                 STDIO_STREAM_ARRAY[i]._flag)
20839                 fflush(&STDIO_STREAM_ARRAY[i]);
20840     }
20841   }
20842 # endif
20843 #endif
20844   _exit(42);
20845 }
20846 EOCP
20847 : first we have to find out how _not_ to flush
20848 $to try.c
20849 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20850     output=''
20851     set try -DTRY_FPUTC
20852     if eval $compile; then
20853             $run ./try 2>/dev/null
20854             code="$?"
20855             $from try.out
20856             if $test ! -s try.out -a "X$code" = X42; then
20857                 output=-DTRY_FPUTC
20858             fi
20859     fi
20860     case "$output" in
20861     '')
20862             set try -DTRY_FPRINTF
20863             if eval $compile; then
20864                     $run ./try 2>/dev/null
20865                     code="$?"
20866                     $from try.out
20867                     if $test ! -s try.out -a "X$code" = X42; then
20868                         output=-DTRY_FPRINTF
20869                     fi
20870             fi
20871         ;;
20872     esac
20873 fi
20874 : check for fflush NULL behavior
20875 case "$fflushNULL" in
20876 '')     set try -DTRY_FFLUSH_NULL $output
20877         if eval $compile; then
20878                 $run ./try 2>/dev/null
20879                 code="$?"
20880                 $from try.out
20881                 if $test -s try.out -a "X$code" = X42; then
20882                         fflushNULL="`$cat try.out`"
20883                 else
20884                         if $test "X$code" != X42; then
20885                                 $cat >&4 <<EOM
20886 (If this test failed, don't worry, we'll try another method shortly.)
20887 EOM
20888                         fi
20889                 fi
20890         fi
20891         $rm -f core try.core core.try.*
20892         case "$fflushNULL" in
20893         x)      $cat >&4 <<EOM
20894 Your fflush(NULL) works okay for output streams.
20895 Let's see if it clobbers input pipes...
20896 EOM
20897 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20898 # bug that improperly flushes the input end of pipes.  So we avoid the
20899 # autoflush on fork/system/exec support for now. :-(
20900 $cat >tryp.c <<EOCP
20901 #include <stdio.h>
20902 int
20903 main(int argc, char **argv)
20904 {
20905     char buf[1024];
20906     int i;
20907     char *bp = buf;
20908     while (1) {
20909         while ((i = getc(stdin)) != -1
20910                && (*bp++ = i) != '\n'
20911                && bp < &buf[1024])
20912         /* DO NOTHING */ ;
20913         *bp = '\0';
20914         fprintf(stdout, "%s", buf);
20915         fflush(NULL);
20916         if (i == -1)
20917             return 0;
20918         bp = buf;
20919     }
20920 }
20921 EOCP
20922                 fflushNULL="$define"
20923                 set tryp
20924                 if eval $compile; then
20925                     $rm -f tryp.out
20926                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20927                     if $test "X$targethost" != X; then
20928                         $to tryp.c
20929                         $to tryp
20930                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20931                     else
20932                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20933                     fi
20934                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20935                        $cat >&4 <<EOM
20936 fflush(NULL) seems to behave okay with input streams.
20937 EOM
20938                         fflushNULL="$define"
20939                     else
20940                         $cat >&4 <<EOM
20941 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20942 EOM
20943                         fflushNULL="$undef"
20944                     fi
20945                 fi
20946                 $rm -f core tryp.c tryp.core core.tryp.*
20947                 ;;
20948         '')     $cat >&4 <<EOM
20949 Your fflush(NULL) isn't working (contrary to ANSI C).
20950 EOM
20951                 fflushNULL="$undef"
20952                 ;;
20953         *)      $cat >&4 <<EOM
20954 Cannot figure out whether your fflush(NULL) works or not.
20955 I'm assuming it doesn't (contrary to ANSI C).
20956 EOM
20957                 fflushNULL="$undef"
20958                 ;;
20959         esac
20960         ;;
20961 $define|true|[yY]*)
20962         fflushNULL="$define"
20963         ;;
20964 *)
20965         fflushNULL="$undef"
20966         ;;
20967 esac
20968 : check explicit looping only if NULL did not work, and if the pipe
20969 : bug does not show up on an explicit flush too
20970 case "$fflushNULL" in
20971 "$undef")
20972         $cat >tryp.c <<EOCP
20973 #include <stdio.h>
20974 int
20975 main(int argc, char **argv)
20976 {
20977     char buf[1024];
20978     int i;
20979     char *bp = buf;
20980     while (1) {
20981         while ((i = getc(stdin)) != -1
20982                && (*bp++ = i) != '\n'
20983                && bp < &buf[1024])
20984         /* DO NOTHING */ ;
20985         *bp = '\0';
20986         fprintf(stdout, "%s", buf);
20987         fflush(stdin);
20988         if (i == -1)
20989             return 0;
20990         bp = buf;
20991     }
20992 }
20993 EOCP
20994         set tryp
20995         if eval $compile; then
20996             $rm -f tryp.out
20997             if $test "X$targethost" != X; then
20998                 $to tryp.c
20999                 $to tryp
21000                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21001             else
21002                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21003             fi
21004             if cmp tryp.c tryp.out >/dev/null 2>&1; then
21005                $cat >&4 <<EOM
21006 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21007 EOM
21008                 : now check for fflushall behaviour
21009                 case "$fflushall" in
21010                 '')     set try -DTRY_FFLUSH_ALL $output
21011                         if eval $compile; then
21012                                 $cat >&4 <<EOM
21013 (Now testing the other method--but note that this also may fail.)
21014 EOM
21015                                 $run ./try 2>/dev/null
21016                                 code=$?
21017                                 $from try.out
21018                                 if $test -s try.out -a "X$code" = X42; then
21019                                         fflushall="`$cat try.out`"
21020                                 fi
21021                         fi
21022                         $rm_try
21023                         case "$fflushall" in
21024                         x)      $cat >&4 <<EOM
21025 Whew. Flushing explicitly all the stdio streams works.
21026 EOM
21027                                 fflushall="$define"
21028                                 ;;
21029                         '')     $cat >&4 <<EOM
21030 Sigh. Flushing explicitly all the stdio streams doesn't work.
21031 EOM
21032                                 fflushall="$undef"
21033                                 ;;
21034                         *)      $cat >&4 <<EOM
21035 Cannot figure out whether flushing stdio streams explicitly works or not.
21036 I'm assuming it doesn't.
21037 EOM
21038                                 fflushall="$undef"
21039                                 ;;
21040                         esac
21041                         ;;
21042                 "$define"|true|[yY]*)
21043                         fflushall="$define"
21044                         ;;
21045                 *)
21046                         fflushall="$undef"
21047                         ;;
21048                 esac
21049             else
21050                 $cat >&4 <<EOM
21051 All is futile.  Even fflush(stdin) clobbers input pipes!
21052 EOM
21053                 fflushall="$undef"
21054             fi
21055         else
21056             fflushall="$undef"
21057         fi
21058         $rm -f core tryp.c tryp.core core.tryp.*
21059         ;;
21060 *)      fflushall="$undef"
21061         ;;
21062 esac
21063
21064 case "$fflushNULL$fflushall" in
21065 undefundef)
21066         $cat <<EOM
21067 OK, I give up.  I cannot figure out how to flush pending stdio output.
21068 We won't be flushing handles at all before fork/exec/popen.
21069 EOM
21070         ;;
21071 esac
21072 $rm_try tryp
21073
21074 : Store the full pathname to the ar program for use in the C program
21075 : Respect a hint or command line value for full_ar.
21076 case "$full_ar" in
21077 '') full_ar=$ar ;;
21078 esac
21079
21080 : Store the full pathname to the sed program for use in the C program
21081 full_sed=$sed
21082
21083 : see what type gids are declared as in the kernel
21084 echo " "
21085 echo "Looking for the type for group ids returned by getgid()."
21086 set gid_t gidtype xxx stdio.h sys/types.h
21087 eval $typedef
21088 case "$gidtype" in
21089 xxx)
21090         xxx=`./findhdr sys/user.h`
21091         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21092         case $1 in
21093         unsigned) dflt="$1 $2" ;;
21094         *) dflt="$1" ;;
21095         esac
21096         ;;
21097 *) dflt="$gidtype";;
21098 esac
21099 case "$gidtype" in
21100 gid_t) echo "gid_t found." ;;
21101 *)      rp="What is the type for group ids returned by getgid()?"
21102         . ./myread
21103         gidtype="$ans"
21104         ;;
21105 esac
21106
21107 : Check the size of GID
21108 echo " "
21109 case "$gidtype" in
21110 *_t) zzz="$gidtype"     ;;
21111 *)   zzz="gid"          ;;
21112 esac
21113 echo "Checking the size of $zzz..." >&4
21114 cat > try.c <<EOCP
21115 #include <sys/types.h>
21116 #include <stdio.h>
21117 #$i_stdlib I_STDLIB
21118 #ifdef I_STDLIB
21119 #include <stdlib.h>
21120 #endif
21121 int main() {
21122     printf("%d\n", (int)sizeof($gidtype));
21123     exit(0);
21124 }
21125 EOCP
21126 set try
21127 if eval $compile_ok; then
21128         yyy=`$run ./try`
21129         case "$yyy" in
21130         '')     gidsize=4
21131                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21132                 ;;
21133         *)      gidsize=$yyy
21134                 echo "Your $zzz is $gidsize bytes long."
21135                 ;;
21136         esac
21137 else
21138         gidsize=4
21139         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21140 fi
21141
21142
21143 : Check if GID is signed
21144 echo " "
21145 case "$gidtype" in
21146 *_t) zzz="$gidtype"     ;;
21147 *)   zzz="gid"          ;;
21148 esac
21149 echo "Checking the sign of $zzz..." >&4
21150 cat > try.c <<EOCP
21151 #include <sys/types.h>
21152 #include <stdio.h>
21153 int main() {
21154         $gidtype foo = -1;
21155         if (foo < 0)
21156                 printf("-1\n");
21157         else
21158                 printf("1\n");
21159 }
21160 EOCP
21161 set try
21162 if eval $compile; then
21163         yyy=`$run ./try`
21164         case "$yyy" in
21165         '')     gidsign=1
21166                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21167                 ;;
21168         *)      gidsign=$yyy
21169                 case "$gidsign" in
21170                  1) echo "Your $zzz is unsigned." ;;
21171                 -1) echo "Your $zzz is signed."   ;;
21172                 esac
21173                 ;;
21174         esac
21175 else
21176         gidsign=1
21177         echo "(I can't compile the test program--guessing unsigned.)" >&4
21178 fi
21179
21180
21181 : Check 64bit sizes
21182 echo " "
21183
21184 if $test X"$quadtype" != X; then
21185
21186 echo "Checking how to print 64-bit integers..." >&4
21187
21188 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21189         $cat >try.c <<'EOCP'
21190 #include <sys/types.h>
21191 #include <stdio.h>
21192 int main() {
21193   int q = 12345678901;
21194   printf("%ld\n", q);
21195 }
21196 EOCP
21197         set try
21198         if eval $compile; then
21199                 yyy=`$run ./try`
21200                 case "$yyy" in
21201                 12345678901)
21202                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21203                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21204                         echo "We will use %d."
21205                         ;;
21206                 esac
21207         fi
21208 fi
21209
21210 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21211         $cat >try.c <<'EOCP'
21212 #include <sys/types.h>
21213 #include <stdio.h>
21214 int main() {
21215   long q = 12345678901;
21216   printf("%ld\n", q);
21217 }
21218 EOCP
21219         set try
21220         if eval $compile; then
21221                 yyy=`$run ./try`
21222                 case "$yyy" in
21223                 12345678901)
21224                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21225                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21226                         echo "We will use %ld."
21227                         ;;
21228                 esac
21229         fi
21230 fi
21231
21232 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21233         $cat >try.c <<'EOCP'
21234 #include <sys/types.h>
21235 #include <inttypes.h>
21236 #include <stdio.h>
21237 int main() {
21238   int64_t q = 12345678901;
21239   printf("%" PRId64 "\n", q);
21240 }
21241 EOCP
21242         set try
21243         if eval $compile; then
21244                 yyy=`$run ./try`
21245                 case "$yyy" in
21246                 12345678901)
21247                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21248                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21249                         echo "We will use the C9X style."
21250                         ;;
21251                 esac
21252         fi
21253 fi
21254
21255 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21256         $cat >try.c <<EOCP
21257 #include <sys/types.h>
21258 #include <stdio.h>
21259 int main() {
21260   $quadtype q = 12345678901;
21261   printf("%Ld\n", q);
21262 }
21263 EOCP
21264         set try
21265         if eval $compile; then
21266                 yyy=`$run ./try`
21267                 case "$yyy" in
21268                 12345678901)
21269                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21270                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21271                         echo "We will use %Ld."
21272                         ;;
21273                 esac
21274         fi
21275 fi
21276
21277 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21278         $cat >try.c <<'EOCP'
21279 #include <sys/types.h>
21280 #include <stdio.h>
21281 int main() {
21282   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21283   printf("%lld\n", q);
21284 }
21285 EOCP
21286         set try
21287         if eval $compile; then
21288                 yyy=`$run ./try`
21289                 case "$yyy" in
21290                 12345678901)
21291                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21292                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21293                         echo "We will use the %lld style."
21294                         ;;
21295                 esac
21296         fi
21297 fi
21298
21299 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21300         $cat >try.c <<EOCP
21301 #include <sys/types.h>
21302 #include <stdio.h>
21303 int main() {
21304   $quadtype q = 12345678901;
21305   printf("%qd\n", q);
21306 }
21307 EOCP
21308         set try
21309         if eval $compile; then
21310                 yyy=`$run ./try`
21311                 case "$yyy" in
21312                 12345678901)
21313                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21314                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21315                         echo "We will use %qd."
21316                         ;;
21317                 esac
21318         fi
21319 fi
21320
21321 if $test X"$sPRId64" = X; then
21322         echo "Cannot figure out how to print 64-bit integers." >&4
21323 fi
21324 $rm_try
21325
21326 fi
21327
21328 case "$sPRId64" in
21329 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21330         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21331         ;;
21332 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21333         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21334         ;;
21335 esac
21336
21337 : Check format strings for internal types
21338 echo " "
21339 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21340
21341 if $test X"$ivsize" = X8; then
21342         ivdformat="$sPRId64"
21343         uvuformat="$sPRIu64"
21344         uvoformat="$sPRIo64"
21345         uvxformat="$sPRIx64"
21346         uvXUformat="$sPRIXU64"
21347 else
21348         if $test X"$ivsize" = X"$longsize"; then
21349                 ivdformat='"ld"'
21350                 uvuformat='"lu"'
21351                 uvoformat='"lo"'
21352                 uvxformat='"lx"'
21353                 uvXUformat='"lX"'
21354         else
21355                 if $test X"$ivsize" = X"$intsize"; then
21356                         ivdformat='"d"'
21357                         uvuformat='"u"'
21358                         uvoformat='"o"'
21359                         uvxformat='"x"'
21360                         uvXUformat='"X"'
21361                 else
21362                         : far out
21363                         if $test X"$ivsize" = X"$shortsize"; then
21364                                 ivdformat='"hd"'
21365                                 uvuformat='"hu"'
21366                                 uvoformat='"ho"'
21367                                 uvxformat='"hx"'
21368                                 uvXUformat='"hX"'
21369                         fi
21370                 fi
21371         fi
21372 fi
21373
21374 if $test X"$usequadmath" = X"$define"; then
21375     nveformat='"Qe"'
21376     nvfformat='"Qf"'
21377     nvgformat='"Qg"'
21378     nvEUformat='"QE"'
21379     nvFUformat='"QF"'
21380     nvGUformat='"QG"'
21381 else
21382     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21383         nveformat="$sPRIeldbl"
21384         nvfformat="$sPRIfldbl"
21385         nvgformat="$sPRIgldbl"
21386         nvEUformat="$sPRIEUldbl"
21387         nvFUformat="$sPRIFUldbl"
21388         nvGUformat="$sPRIGUldbl"
21389     else
21390         nveformat='"e"'
21391         nvfformat='"f"'
21392         nvgformat='"g"'
21393         nvEUformat='"E"'
21394         nvFUformat='"F"'
21395         nvGUformat='"G"'
21396     fi
21397 fi
21398
21399 case "$ivdformat" in
21400 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21401     exit 1
21402     ;;
21403 esac
21404
21405 : Check format string for GID
21406
21407 echo " "
21408 $echo "Checking the format string to be used for gids..." >&4
21409
21410 case "$gidsign" in
21411 -1)     if $test X"$gidsize" = X"$ivsize"; then
21412                 gidformat="$ivdformat"
21413         else
21414                 if $test X"$gidsize" = X"$longsize"; then
21415                         gidformat='"ld"'
21416                 else
21417                         if $test X"$gidsize" = X"$intsize"; then
21418                                 gidformat='"d"'
21419                         else
21420                                 if $test X"$gidsize" = X"$shortsize"; then
21421                                         gidformat='"hd"'
21422                                 fi
21423                         fi
21424                 fi
21425         fi
21426         ;;
21427 *)      if $test X"$gidsize" = X"$uvsize"; then
21428                 gidformat="$uvuformat"
21429         else
21430                 if $test X"$gidsize" = X"$longsize"; then
21431                         gidformat='"lu"'
21432                 else
21433                         if $test X"$gidsize" = X"$intsize"; then
21434                                 gidformat='"u"'
21435                         else
21436                                 if $test X"$gidsize" = X"$shortsize"; then
21437                                         gidformat='"hu"'
21438                                 fi
21439                         fi
21440                 fi
21441         fi
21442         ;;
21443 esac
21444
21445 : see if getgroups exists
21446 set getgroups d_getgrps
21447 eval $inlibc
21448
21449 : see if setgroups exists
21450 set setgroups d_setgrps
21451 eval $inlibc
21452
21453 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21454 echo " "
21455 case "$d_getgrps$d_setgrps" in
21456 *define*)
21457         case "$groupstype" in
21458         '') dflt="$gidtype" ;;
21459         *)  dflt="$groupstype" ;;
21460         esac
21461         $cat <<EOM
21462 What type of pointer is the second argument to getgroups() and setgroups()?
21463 Usually this is the same as group ids, $gidtype, but not always.
21464
21465 EOM
21466         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21467         . ./myread
21468         groupstype="$ans"
21469         ;;
21470 *)  groupstype="$gidtype";;
21471 esac
21472
21473 : check whether make sets MAKE
21474 echo " "
21475 echo "Checking if your $make program sets \$(MAKE)..." >&4
21476 case "$make_set_make" in
21477 '')
21478         $sed 's/^X //' > testmake.mak << 'EOF'
21479 Xall:
21480 X       @echo 'maketemp="$(MAKE)"'
21481 EOF
21482         case "`$make -f testmake.mak 2>/dev/null`" in
21483         *maketemp=*) make_set_make='#' ;;
21484         *)      make_set_make="MAKE=$make" ;;
21485         esac
21486         $rm -f testmake.mak
21487         ;;
21488 esac
21489 case "$make_set_make" in
21490 '#') echo "Yup, it does.";;
21491 *) echo "Nope, it doesn't.";;
21492 esac
21493
21494 : see what type is used for mode_t
21495 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21496 set mode_t modetype int stdio.h sys/types.h
21497 eval $typedef_ask
21498
21499 : see if we need va_copy
21500 echo " "
21501 case "$i_stdarg" in
21502 "$define")
21503         $cat >try.c <<EOCP
21504 #include <stdarg.h>
21505 #include <stdio.h>
21506 #$i_stdlib I_STDLIB
21507 #ifdef I_STDLIB
21508 #include <stdlib.h>
21509 #endif
21510 #include <signal.h>
21511
21512 int
21513 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21514 {
21515   return vfprintf(f, fmt, *valp);
21516 }
21517
21518 int
21519 myvfprintf(FILE *f, const  char *fmt, va_list val)
21520 {
21521   return ivfprintf(f, fmt, &val);
21522 }
21523
21524 int
21525 myprintf(char *fmt, ...)
21526 {
21527   va_list val;
21528   va_start(val, fmt);
21529   return myvfprintf(stdout, fmt, val);
21530 }
21531
21532 int
21533 main(int ac, char **av)
21534 {
21535   signal(SIGSEGV, exit);
21536
21537   myprintf("%s%cs all right, then\n", "that", '\'');
21538   exit(0);
21539 }
21540 EOCP
21541         set try
21542         if eval $compile && $run ./try 2>&1 >/dev/null; then
21543                 case "`$run ./try`" in
21544                 "that's all right, then")
21545                         okay=yes
21546                         ;;
21547                 esac
21548         fi
21549         case "$okay" in
21550         yes)    echo "It seems that you don't need va_copy()." >&4
21551                 need_va_copy="$undef"
21552                 ;;
21553         *)      echo "It seems that va_copy() or similar will be needed." >&4
21554                 need_va_copy="$define"
21555                 ;;
21556         esac
21557         $rm_try
21558         ;;
21559 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21560         need_va_copy="$undef"
21561         ;;
21562 esac
21563
21564 : see what type is used for size_t
21565 rp="What is the type used for the length parameter for string functions?"
21566 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21567 eval $typedef_ask
21568
21569 : check for type of arguments to gethostbyaddr.
21570 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21571         case "$d_gethbyaddr" in
21572         $define)
21573                 $cat <<EOM
21574
21575 Checking to see what type of arguments are accepted by gethostbyaddr().
21576 EOM
21577                 hdrs="$define sys/types.h
21578                         $d_socket sys/socket.h
21579                         $i_niin netinet/in.h
21580                         $i_netdb netdb.h
21581                         $i_unistd unistd.h"
21582                 : The first arg can 'char *' or 'void *'
21583                 : The second arg is some of integral type
21584                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21585                         for yyy in size_t long int; do
21586                                 case "$netdb_host_type" in
21587                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21588                                         if ./protochk "$try" $hdrs; then
21589                                                 echo "Your system accepts $xxx for the first arg."
21590                                                 echo "...and $yyy for the second arg."
21591                                                 netdb_host_type="$xxx"
21592                                                 netdb_hlen_type="$yyy"
21593                                         fi
21594                                         ;;
21595                                 esac
21596                         done
21597                 done
21598                 : In case none of those worked, prompt the user.
21599                 case "$netdb_host_type" in
21600                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21601                         dflt='char *'
21602                         . ./myread
21603                         netdb_host_type=$ans
21604                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21605                         dflt="$sizetype"
21606                         . ./myread
21607                         netdb_hlen_type=$ans
21608                         ;;
21609                 esac
21610                 ;;
21611         *)      : no gethostbyaddr, so pick harmless defaults
21612                 netdb_host_type='char *'
21613                 netdb_hlen_type="$sizetype"
21614                 ;;
21615         esac
21616         # Remove the "const" if needed. -- but then we'll have a
21617         # prototype clash!
21618         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21619 fi
21620
21621 : check for type of argument to gethostbyname.
21622 if test "X$netdb_name_type" = X ; then
21623         case "$d_gethbyname" in
21624         $define)
21625                 $cat <<EOM
21626
21627 Checking to see what type of argument is accepted by gethostbyname().
21628 EOM
21629                 hdrs="$define sys/types.h
21630                         $d_socket sys/socket.h
21631                         $i_niin netinet/in.h
21632                         $i_netdb netdb.h
21633                         $i_unistd unistd.h"
21634                 for xxx in "const char *" "char *"; do
21635                         case "$netdb_name_type" in
21636                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21637                                 if ./protochk "$try" $hdrs; then
21638                                         echo "Your system accepts $xxx."
21639                                         netdb_name_type="$xxx"
21640                                 fi
21641                                 ;;
21642                         esac
21643                 done
21644                 : In case none of those worked, prompt the user.
21645                 case "$netdb_name_type" in
21646                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21647                         dflt='char *'
21648                         . ./myread
21649                         netdb_name_type=$ans
21650                         ;;
21651                 esac
21652                 ;;
21653         *)      : no gethostbyname, so pick harmless default
21654                 netdb_name_type='char *'
21655                 ;;
21656         esac
21657 fi
21658
21659 : check for type of 1st argument to getnetbyaddr.
21660 if test "X$netdb_net_type" = X ; then
21661         case "$d_getnbyaddr" in
21662         $define)
21663                 $cat <<EOM
21664
21665 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21666 EOM
21667                 hdrs="$define sys/types.h
21668                         $d_socket sys/socket.h
21669                         $i_niin netinet/in.h
21670                         $i_netdb netdb.h
21671                         $i_unistd unistd.h"
21672                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21673                         case "$netdb_net_type" in
21674                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21675                                 if ./protochk "$try" $hdrs; then
21676                                         echo "Your system accepts $xxx."
21677                                         netdb_net_type="$xxx"
21678                                 fi
21679                                 ;;
21680                         esac
21681                 done
21682                 : In case none of those worked, prompt the user.
21683                 case "$netdb_net_type" in
21684                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21685                         dflt='long'
21686                         . ./myread
21687                         netdb_net_type=$ans
21688                         ;;
21689                 esac
21690                 ;;
21691         *)      : no getnetbyaddr, so pick harmless default
21692                 netdb_net_type='long'
21693                 ;;
21694         esac
21695 fi
21696 : locate the preferred pager for this system
21697 fn=f/
21698 case "$pager" in
21699 '')
21700         dflt=''
21701         case "$pg" in
21702         /*) dflt=$pg;;
21703         [a-zA-Z]:/*) dflt=$pg;;
21704         esac
21705         case "$more" in
21706         /*) dflt=$more;;
21707         [a-zA-Z]:/*) dflt=$more;;
21708         esac
21709         case "$less" in
21710         /*) dflt=$less;;
21711         [a-zA-Z]:/*) dflt=$less;;
21712         esac
21713         case "$dflt" in
21714         '') dflt=/usr/ucb/more;;
21715         esac
21716         ;;
21717 *)      dflt="$pager"
21718         ;;
21719 esac
21720 fn="f/($dflt)"
21721 echo " "
21722 rp='What pager is used on your system?'
21723 . ./getfile
21724 pager="$ans"
21725
21726 : see what type pids are declared as in the kernel
21727 rp="What is the type of process ids on this system?"
21728 set pid_t pidtype int stdio.h sys/types.h
21729 eval $typedef_ask
21730
21731 : see if ar generates random libraries by itself
21732 echo " "
21733 echo "Checking how to generate random libraries on your machine..." >&4
21734 echo 'int bar1() { return bar2(); }' > bar1.c
21735 echo 'int bar2() { return 2; }' > bar2.c
21736 $cat > foo.c <<EOP
21737 #$i_stdlib I_STDLIB
21738 #ifdef I_STDLIB
21739 #include <stdlib.h>
21740 #endif
21741 int main() { printf("%d\n", bar1()); exit(0); }
21742 EOP
21743 $cc $ccflags -c bar1.c >/dev/null 2>&1
21744 $cc $ccflags -c bar2.c >/dev/null 2>&1
21745 $cc $ccflags -c foo.c >/dev/null 2>&1
21746 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21747 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21748         $run ./foobar >/dev/null 2>&1; then
21749         echo "$ar appears to generate random libraries itself."
21750         orderlib=false
21751         if [ "X$ranlib" = "X" ]; then
21752             ranlib=":"
21753         fi
21754 elif $ar s bar$_a >/dev/null 2>&1 &&
21755         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21756         $run ./foobar >/dev/null 2>&1; then
21757                 echo "a table of contents needs to be added with '$ar s'."
21758                 orderlib=false
21759                 ranlib="$ar s"
21760 elif $ar ts bar$_a >/dev/null 2>&1 &&
21761         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21762         $run ./foobar >/dev/null 2>&1; then
21763                 echo "a table of contents needs to be added with '$ar ts'."
21764                 orderlib=false
21765                 ranlib="$ar ts"
21766 else
21767         case "$ranlib" in
21768         :) ranlib='';;
21769         '')
21770                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21771                 $test -f $ranlib || ranlib=''
21772                 ;;
21773         esac
21774         if $test -n "$ranlib"; then
21775                 echo "your system has '$ranlib'; we'll use that."
21776                 orderlib=false
21777         else
21778                 echo "your system doesn't seem to support random libraries"
21779                 echo "so we'll use lorder and tsort to order the libraries."
21780                 orderlib=true
21781                 ranlib=":"
21782         fi
21783 fi
21784 $rm -f foo* bar*
21785
21786 : see if this is a values.h system
21787 set values.h i_values
21788 eval $inhdr
21789
21790 : Check the max offset that gmtime and localtime accept
21791 echo "Checking max offsets that gmtime () accepts"
21792
21793 case $i_values in
21794     define) yyy="#include <values.h>" ;;
21795     *)      yyy="" ;;
21796     esac
21797
21798 case "$sGMTIME_min/$sGMTIME_max" in
21799     0/0|/)
21800         $cat >try.c <<EOCP
21801 #include <sys/types.h>
21802 #include <stdio.h>
21803 #include <time.h>
21804 $yyy
21805
21806 int i;
21807 struct tm *tmp;
21808 time_t pt;
21809
21810 void gm_check (time_t t, int min_year, int max_year)
21811 {
21812     tmp = gmtime (&t);
21813     if ( tmp == NULL ||
21814         /* Check tm_year overflow */
21815          tmp->tm_year < min_year || tmp->tm_year > max_year)
21816         tmp = NULL;
21817     else
21818         pt = t;
21819     } /* gm_check */
21820
21821 int check_max ()
21822 {
21823     tmp = NULL;
21824     pt  = 0;
21825 #ifdef MAXLONG
21826     gm_check (MAXLONG, 69, 0x7fffffff);
21827 #endif
21828     if (tmp == NULL || tmp->tm_year < 0) {
21829         for (i = 63; i >= 0; i--) {
21830             time_t x = pt | ((time_t)1 << i);
21831             if (x < 0 || x < pt) continue;
21832             gm_check (x, 69, 0x7fffffff);
21833             }
21834         }
21835     printf ("sGMTIME_max=%ld\n", pt);
21836     return (0);
21837     } /* check_max */
21838
21839 int check_min ()
21840 {
21841     tmp = NULL;
21842     pt  = 0;
21843 #ifdef MINLONG
21844     gm_check (MINLONG, -1900, 70);
21845 #endif
21846     if (tmp == NULL) {
21847         for (i = 36; i >= 0; i--) {
21848             time_t x = pt - ((time_t)1 << i);
21849             if (x > 0) continue;
21850             gm_check (x, -1900, 70);
21851             }
21852         }
21853     printf ("sGMTIME_min=%ld\n", pt);
21854     return (0);
21855     } /* check_min */
21856
21857 int main (int argc, char *argv[])
21858 {
21859     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21860     check_max ();
21861     check_min ();
21862     return (0);
21863     } /* main */
21864 EOCP
21865         set try
21866         if eval $compile; then
21867             eval `$run ./try 2>/dev/null`
21868         else
21869             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21870             fi
21871         $rm_try
21872         ;;
21873     esac
21874
21875 echo "Checking max offsets that localtime () accepts"
21876
21877 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21878     0/0|/)
21879         $cat >try.c <<EOCP
21880 #include <sys/types.h>
21881 #include <stdio.h>
21882 #include <time.h>
21883 $yyy
21884
21885 int i;
21886 struct tm *tmp;
21887 time_t pt;
21888
21889 void local_check (time_t t, int min_year, int max_year)
21890 {
21891     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21892         tmp = NULL;
21893     else
21894         tmp = localtime (&t);
21895     if ( tmp == NULL ||
21896         /* Check tm_year overflow */
21897          tmp->tm_year < min_year || tmp->tm_year > max_year)
21898         tmp = NULL;
21899     else
21900         pt = t;
21901     } /* local_check */
21902
21903 int check_max ()
21904 {
21905     tmp = NULL;
21906     pt  = 0;
21907 #ifdef MAXLONG
21908     local_check (MAXLONG, 69, 0x7fffffff);
21909 #endif
21910     if (tmp == NULL || tmp->tm_year < 0) {
21911         for (i = 63; i >= 0; i--) {
21912             time_t x = pt | ((time_t)1 << i);
21913             if (x < 0 || x < pt) continue;
21914             local_check (x, 69, 0x7fffffff);
21915             }
21916         }
21917     printf ("sLOCALTIME_max=%ld\n", pt);
21918     return (0);
21919    } /* check_max */
21920
21921 int check_min ()
21922 {
21923     tmp = NULL;
21924     pt  = 0;
21925 #ifdef MINLONG
21926     local_check (MINLONG, -1900, 70);
21927 #endif
21928     if (tmp == NULL) {
21929         for (i = 36; i >= 0; i--) {
21930             time_t x = pt - ((time_t)1 << i);
21931             if (x > 0) continue;
21932             local_check (x, -1900, 70);
21933             }
21934         }
21935     printf ("sLOCALTIME_min=%ld\n", pt);
21936     return (0);
21937     } /* check_min */
21938
21939 int main (int argc, char *argv[])
21940 {
21941     check_max ();
21942     check_min ();
21943     return (0);
21944     } /* main */
21945 EOCP
21946         set try
21947         if eval $compile; then
21948             eval `$run ./try 2>/dev/null`
21949         else
21950             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21951             fi
21952         $rm_try
21953         ;;
21954     esac
21955
21956 : check for type of arguments to select.
21957 case "$selecttype" in
21958 '') case "$d_select" in
21959         $define)
21960                 echo " "
21961                 $cat <<EOM
21962 Checking to see what type of arguments are accepted by select().
21963 EOM
21964                 hdrs="$define sys/types.h
21965                         $i_systime sys/time.h
21966                         $i_sysselct sys/select.h
21967                         $d_socket sys/socket.h"
21968                 : The first arg can be int, unsigned, or size_t
21969                 : The last arg may or may not be 'const'
21970                 val=''
21971                 : void pointer has been seen but using that
21972                 : breaks the selectminbits test
21973                 for xxx in 'fd_set *' 'int *'; do
21974                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21975                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21976                                         case "$val" in
21977                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21978                                                 if ./protochk "$try" $hdrs; then
21979                                                         echo "Your system accepts $xxx."
21980                                                         val="$xxx"
21981                                                 fi
21982                                                 ;;
21983                                         esac
21984                                 done
21985                         done
21986                 done
21987                 case "$val" in
21988                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21989                         case "$d_fd_set" in
21990                                 $define) dflt="fd_set *" ;;
21991                                 *)              dflt="int *" ;;
21992                         esac
21993                         . ./myread
21994                         val=$ans
21995                         ;;
21996                 esac
21997                 selecttype="$val"
21998                 ;;
21999         *)      : no select, so pick a harmless default
22000                 selecttype='int *'
22001                 ;;
22002         esac
22003         ;;
22004 esac
22005
22006 : check for the select 'width'
22007 case "$selectminbits" in
22008 '') safebits=`expr $ptrsize \* 8`
22009     case "$d_select" in
22010         $define)
22011                 $cat <<EOM
22012
22013 Checking to see on how many bits at a time your select() operates...
22014 EOM
22015                 $cat >try.c <<EOCP
22016 #include <sys/types.h>
22017 #$i_time I_TIME
22018 #$i_systime I_SYS_TIME
22019 #$i_systimek I_SYS_TIME_KERNEL
22020 #ifdef I_TIME
22021 #   include <time.h>
22022 #endif
22023 #ifdef I_SYS_TIME
22024 #   ifdef I_SYS_TIME_KERNEL
22025 #       define KERNEL
22026 #   endif
22027 #   include <sys/time.h>
22028 #   ifdef I_SYS_TIME_KERNEL
22029 #       undef KERNEL
22030 #   endif
22031 #endif
22032 #$i_sysselct I_SYS_SELECT
22033 #ifdef I_SYS_SELECT
22034 #include <sys/select.h>
22035 #endif
22036 #$d_socket HAS_SOCKET
22037 #ifdef HAS_SOCKET
22038 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22039 #endif
22040 #include <stdio.h>
22041 #$i_stdlib I_STDLIB
22042 #ifdef I_STDLIB
22043 #include <stdlib.h>
22044 #endif
22045 $selecttype b;
22046 #define S sizeof(*(b))
22047 #define MINBITS 64
22048 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22049 #define NBITS  (NBYTES * 8)
22050 int main() {
22051     char *s = (char *)malloc(NBYTES);
22052     struct timeval t;
22053     int i;
22054     FILE* fp;
22055     int fd;
22056
22057     if (!s)
22058         exit(1);
22059     fclose(stdin);
22060     fp = fopen("try.c", "r");
22061     if (fp == 0)
22062       exit(2);
22063     fd = fileno(fp);
22064     if (fd < 0)
22065       exit(3);
22066     b = ($selecttype)s;
22067     for (i = 0; i < NBITS; i++)
22068         FD_SET(i, b);
22069     t.tv_sec  = 0;
22070     t.tv_usec = 0;
22071     select(fd + 1, b, 0, 0, &t);
22072     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22073     free(s);
22074     printf("%d\n", i + 1);
22075     return 0;
22076 }
22077 EOCP
22078                 set try
22079                 if eval $compile_ok; then
22080                         selectminbits=`$run ./try 2>/dev/null`
22081                         case "$selectminbits" in
22082                         '')     cat >&4 <<EOM
22083 Cannot figure out on how many bits at a time your select() operates.
22084 I'll play safe and guess it is $safebits bits.
22085 EOM
22086                                 selectminbits=$safebits
22087                                 bits="$safebits bits"
22088                                 ;;
22089                         1)      bits="1 bit" ;;
22090                         *)      bits="$selectminbits bits" ;;
22091                         esac
22092                         echo "Your select() operates on $bits at a time." >&4
22093                 else
22094                         rp='What is the minimum number of bits your select() operates on?'
22095                         case "$byteorder" in
22096                         12345678)       dflt=64 ;;
22097                         1234)           dflt=32 ;;
22098                         *)              dflt=1  ;;
22099                         esac
22100                         . ./myread
22101                         val=$ans
22102                         selectminbits="$val"
22103                 fi
22104                 $rm_try
22105                 ;;
22106         *)      : no select, so pick a harmless default
22107                 selectminbits=$safebits
22108                 ;;
22109         esac
22110         ;;
22111 esac
22112
22113 : Trace out the files included by signal.h, then look for SIGxxx names.
22114 case "$sig_num_init" in
22115 '')
22116 if [ "X$fieldn" = X ]; then
22117         : Just make some guesses.  We check them later.
22118         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22119 else
22120         xxx=`echo '#include <signal.h>' |
22121         $cppstdin $cppminus $cppflags 2>/dev/null |
22122         $grep '^[       ]*#.*include' |
22123         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22124                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22125 fi
22126 xxxfiles=''
22127 for xx in $xxx /dev/null ; do
22128         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22129 done
22130 case "$xxxfiles" in
22131 '')     xxxfiles=`./findhdr signal.h` ;;
22132 esac
22133 xxx=`awk '
22134 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22135         print substr($2, 4, 20)
22136 }
22137 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22138         print substr($3, 4, 20)
22139 }' $xxxfiles`
22140 : Append some common names just in case the awk scan failed.
22141 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22142 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22143 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22144 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22145 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22146
22147 : generate a few handy files for later
22148 $cat > signal.c <<EOCP
22149 #include <sys/types.h>
22150 #include <signal.h>
22151 #$i_stdlib I_STDLIB
22152 #ifdef I_STDLIB
22153 #include <stdlib.h>
22154 #endif
22155 #include <stdio.h>
22156 int main() {
22157
22158 /* Strange style to avoid deeply-nested #if/#else/#endif */
22159 #ifndef NSIG
22160 #  ifdef _NSIG
22161 #    define NSIG (_NSIG)
22162 #  endif
22163 #endif
22164
22165 #ifndef NSIG
22166 #  ifdef SIGMAX
22167 #    define NSIG (SIGMAX+1)
22168 #  endif
22169 #endif
22170
22171 #ifndef NSIG
22172 #  ifdef SIG_MAX
22173 #    define NSIG (SIG_MAX+1)
22174 #  endif
22175 #endif
22176
22177 #ifndef NSIG
22178 #  ifdef _SIG_MAX
22179 #    define NSIG (_SIG_MAX+1)
22180 #  endif
22181 #endif
22182
22183 #ifndef NSIG
22184 #  ifdef MAXSIG
22185 #    define NSIG (MAXSIG+1)
22186 #  endif
22187 #endif
22188
22189 #ifndef NSIG
22190 #  ifdef MAX_SIG
22191 #    define NSIG (MAX_SIG+1)
22192 #  endif
22193 #endif
22194
22195 #ifndef NSIG
22196 #  ifdef SIGARRAYSIZE
22197 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22198 #  endif
22199 #endif
22200
22201 #ifndef NSIG
22202 #  ifdef _sys_nsig
22203 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22204 #  endif
22205 #endif
22206
22207 /* Default to some arbitrary number that's big enough to get most
22208    of the common signals.
22209 */
22210 #ifndef NSIG
22211 #    define NSIG 50
22212 #endif
22213
22214 printf("NSIG %d\n", NSIG);
22215
22216 #ifndef JUST_NSIG
22217
22218 EOCP
22219
22220 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22221 {
22222         printf "#ifdef SIG"; printf $1; printf "\n"
22223         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22224         printf $1; printf ");\n"
22225         printf "#endif\n"
22226 }
22227 END {
22228         printf "#endif /* JUST_NSIG */\n";
22229         printf "exit(0);\n}\n";
22230 }
22231 ' >>signal.c
22232 $cat >signal.awk <<'EOP'
22233 BEGIN { ndups = 0 }
22234 $1 ~ /^NSIG$/ { nsig = $2 }
22235 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22236     if ($2 > maxsig) { maxsig = $2 }
22237     if (sig_name[$2]) {
22238         dup_name[ndups] = $1
22239         dup_num[ndups] = $2
22240         ndups++
22241     }
22242     else {
22243         sig_name[$2] = $1
22244         sig_num[$2] = $2
22245     }
22246 }
22247 END {
22248     if (nsig == 0) {
22249         nsig = maxsig + 1
22250     }
22251     printf("NSIG %d\n", nsig);
22252     for (n = 1; n < nsig; n++) {
22253         if (sig_name[n]) {
22254             printf("%s %d\n", sig_name[n], sig_num[n])
22255         }
22256         else {
22257             printf("NUM%d %d\n", n, n)
22258         }
22259     }
22260     for (n = 0; n < ndups; n++) {
22261         printf("%s %d\n", dup_name[n], dup_num[n])
22262     }
22263 }
22264 EOP
22265 $cat >signal_cmd <<EOS
22266 $startsh
22267 if $test -s signal.lst; then
22268     echo "Using your existing signal.lst file"
22269         exit 0
22270 fi
22271 xxx="$xxx"
22272 EOS
22273 $cat >>signal_cmd <<'EOS'
22274
22275 set signal
22276 if eval $compile_ok; then
22277         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22278                 $uniq | $awk -f signal.awk >signal.lst
22279 else
22280         echo "(I can't seem be able to compile the whole test program)" >&4
22281         echo "(I'll try it in little pieces.)" >&4
22282         set signal -DJUST_NSIG
22283         if eval $compile_ok; then
22284                 $run ./signal$_exe > signal.nsg
22285                 $cat signal.nsg
22286         else
22287                 echo "I can't seem to figure out how many signals you have." >&4
22288                 echo "Guessing 50." >&4
22289                 echo 'NSIG 50' > signal.nsg
22290         fi
22291         : Now look at all the signal names, one at a time.
22292         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22293                 $cat > signal.c <<EOCP
22294 #include <sys/types.h>
22295 #include <signal.h>
22296 #include <stdio.h>
22297 int main() {
22298 printf("$xx %d\n", SIG${xx});
22299 return 0;
22300 }
22301 EOCP
22302                 set signal
22303                 if eval $compile; then
22304                         echo "SIG${xx} found."
22305                         $run ./signal$_exe  >> signal.ls1
22306                 else
22307                         echo "SIG${xx} NOT found."
22308                 fi
22309         done
22310         if $test -s signal.ls1; then
22311                 $cat signal.nsg signal.ls1 |
22312                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22313         fi
22314
22315 fi
22316 if $test -s signal.lst; then
22317         :
22318 else
22319         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22320         echo 'kill -l' >signal
22321         set X `csh -f <signal`
22322         $rm -f signal
22323         shift
22324         case $# in
22325         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22326         esac
22327         echo $@ | $tr ' ' $trnl | \
22328             $awk '{ printf "%s %d\n", $1, ++s; }
22329                   END { printf "NSIG %d\n", ++s }' >signal.lst
22330 fi
22331 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22332 EOS
22333 chmod a+x signal_cmd
22334 $eunicefix signal_cmd
22335
22336 : generate list of signal names
22337 echo " "
22338 case "$sig_name_init" in
22339 '') doinit=yes ;;
22340 *)  case "$sig_num_init" in
22341     ''|*,*) doinit=yes ;;
22342     esac ;;
22343 esac
22344 case "$doinit" in
22345 yes)
22346         echo "Generating a list of signal names and numbers..." >&4
22347         . ./signal_cmd
22348         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22349         sig_name=`$awk 'BEGIN { printf "ZERO " }
22350                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22351         sig_num=`$awk  'BEGIN { printf "0 " }
22352                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22353         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22354                              !/^NSIG/   { printf "\"%s\", ", $1 }
22355                              END        { printf "0\n" }' signal.lst`
22356         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22357                              !/^NSIG/   { printf "%d, ", $2}
22358                              END        { printf "0\n"}' signal.lst`
22359         ;;
22360 esac
22361 echo "The following $sig_count signals are available:"
22362 echo " "
22363 echo $sig_name | $awk \
22364 'BEGIN { linelen = 0 }
22365 {
22366         for (i = 1; i <= NF; i++) {
22367                 name = "SIG" $i " "
22368                 linelen = linelen + length(name)
22369                 if (linelen > 70) {
22370                         printf "\n"
22371                         linelen = length(name)
22372                 }
22373                 printf "%s", name
22374         }
22375         printf "\n"
22376 }'
22377 sig_size=`echo $sig_name | awk '{print NF}'`
22378 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22379 ;;
22380 esac
22381
22382 : Check size of size
22383 echo " "
22384 case "$sizetype" in
22385 *_t) zzz="$sizetype"    ;;
22386 *)   zzz="filesize"     ;;
22387 esac
22388 echo "Checking the size of $zzz..." >&4
22389 cat > try.c <<EOCP
22390 #include <sys/types.h>
22391 #include <stdio.h>
22392 #$i_stdlib I_STDLIB
22393 #ifdef I_STDLIB
22394 #include <stdlib.h>
22395 #endif
22396 int main() {
22397     printf("%d\n", (int)sizeof($sizetype));
22398     exit(0);
22399 }
22400 EOCP
22401 set try
22402 if eval $compile_ok; then
22403         yyy=`$run ./try`
22404         case "$yyy" in
22405         '')     sizesize=4
22406                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22407                 ;;
22408         *)      sizesize=$yyy
22409                 echo "Your $zzz size is $sizesize bytes."
22410                 ;;
22411         esac
22412 else
22413         sizesize=4
22414         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22415 fi
22416
22417
22418 : check for socklen_t
22419 echo " "
22420 echo "Checking to see if you have socklen_t..." >&4
22421 $cat >try.c <<EOCP
22422 #include <sys/types.h>
22423 #$d_socket HAS_SOCKET
22424 #ifdef HAS_SOCKET
22425 #include <sys/socket.h>
22426 #endif
22427 int main() { socklen_t x = 16; }
22428 EOCP
22429 set try
22430 if eval $compile; then
22431         val="$define"
22432         echo "You have socklen_t."
22433 else
22434         val="$undef"
22435         echo "You do not have socklen_t."
22436         case "$sizetype" in
22437         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22438         esac
22439 fi
22440 $rm_try
22441 set d_socklen_t
22442 eval $setvar
22443
22444 : see if this is a socks.h system
22445 set socks.h i_socks
22446 eval $inhdr
22447
22448 : check for type of the size argument to socket calls
22449 case "$d_socket" in
22450 "$define")
22451         $cat <<EOM
22452
22453 Checking to see what type is the last argument of accept().
22454 EOM
22455         yyy=''
22456         case "$d_socklen_t" in
22457         "$define") yyy="$yyy socklen_t"
22458         esac
22459         yyy="$yyy $sizetype int long unsigned"
22460         for xxx in $yyy; do
22461                 case "$socksizetype" in
22462                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22463                         case "$usesocks" in
22464                         "$define")
22465                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22466                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22467                                         socksizetype="$xxx"
22468                                 fi
22469                                 ;;
22470                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22471                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22472                                         socksizetype="$xxx"
22473                                 fi
22474                                 ;;
22475                         esac
22476                         ;;
22477                 esac
22478         done
22479 : In case none of those worked, prompt the user.
22480         case "$socksizetype" in
22481         '')     rp='What is the type for socket address structure sizes?'
22482                 dflt='int'
22483                 . ./myread
22484                 socksizetype=$ans
22485                 ;;
22486         esac
22487         ;;
22488 *)      : no sockets, so pick relatively harmless default
22489         socksizetype='int'
22490         ;;
22491 esac
22492
22493 : see what type is used for signed size_t
22494 set ssize_t ssizetype int stdio.h sys/types.h
22495 eval $typedef
22496 dflt="$ssizetype"
22497 $cat > try.c <<EOM
22498 #include <stdio.h>
22499 #$i_stdlib I_STDLIB
22500 #ifdef I_STDLIB
22501 #include <stdlib.h>
22502 #endif
22503 #include <sys/types.h>
22504 #define Size_t $sizetype
22505 #define SSize_t $dflt
22506 int main()
22507 {
22508         if (sizeof(Size_t) == sizeof(SSize_t))
22509                 printf("$dflt\n");
22510         else if (sizeof(Size_t) == sizeof(int))
22511                 printf("int\n");
22512         else
22513                 printf("long\n");
22514         exit(0);
22515 }
22516 EOM
22517 echo " "
22518 set try
22519 if eval $compile_ok && $run ./try > /dev/null; then
22520         ssizetype=`$run ./try`
22521         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22522 else
22523         $cat >&4 <<EOM
22524 Help! I can't compile and run the ssize_t test program: please enlighten me!
22525 (This is probably a misconfiguration in your system or libraries, and
22526 you really ought to fix it.  Still, I'll try anyway.)
22527
22528 I need a type that is the same size as $sizetype, but is guaranteed to
22529 be signed.  Common values are ssize_t, int and long.
22530
22531 EOM
22532         rp="What signed type is the same size as $sizetype?"
22533         . ./myread
22534         ssizetype="$ans"
22535 fi
22536 $rm_try
22537
22538 : Check the size of st_ino
22539 $echo " "
22540 $echo "Checking the size of st_ino..." >&4
22541 $cat > try.c <<EOCP
22542 #include <sys/stat.h>
22543 #include <stdio.h>
22544 #$i_stdlib I_STDLIB
22545 #ifdef I_STDLIB
22546 #include <stdlib.h>
22547 #endif
22548 int main() {
22549     struct stat st;
22550     printf("%d\n", (int)sizeof(st.st_ino));
22551     exit(0);
22552 }
22553 EOCP
22554 set try
22555 if eval $compile_ok; then
22556         val=`$run ./try`
22557         case "$val" in
22558         '')     st_ino_size=4
22559                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22560                 ;;
22561         *)      st_ino_size=$val
22562                 $echo "Your st_ino is $st_ino_size bytes long."
22563                 ;;
22564         esac
22565 else
22566         st_ino_size=4
22567         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22568 fi
22569 $rm_try
22570
22571 : Check if st_ino is signed
22572 $echo " "
22573 $echo "Checking the sign of st_ino..." >&4
22574 $cat > try.c <<EOCP
22575 #include <sys/stat.h>
22576 #include <stdio.h>
22577 int main() {
22578         struct stat foo;
22579         foo.st_ino = -1;
22580         if (foo.st_ino < 0)
22581                 printf("-1\n");
22582         else
22583                 printf("1\n");
22584 }
22585 EOCP
22586 set try
22587 if eval $compile; then
22588         val=`$run ./try`
22589         case "$val" in
22590         '')     st_ino_sign=1
22591                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22592                 ;;
22593         *)      st_ino_sign=$val
22594                 case "$st_ino_sign" in
22595                  1) $echo "Your st_ino is unsigned." ;;
22596                 -1) $echo "Your st_ino is signed."   ;;
22597                 esac
22598                 ;;
22599         esac
22600 else
22601         st_ino_sign=1
22602         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22603 fi
22604 $rm_try
22605
22606 : see what type of char stdio uses.
22607 echo " "
22608 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22609 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22610         echo "Your stdio uses unsigned chars." >&4
22611         stdchar="unsigned char"
22612 else
22613         echo "Your stdio uses signed chars." >&4
22614         stdchar="char"
22615 fi
22616 $rm -f stdioh
22617
22618 : see what type uids are declared as in the kernel
22619 echo " "
22620 echo "Looking for the type for user ids returned by getuid()."
22621 set uid_t uidtype xxx stdio.h sys/types.h
22622 eval $typedef
22623 case "$uidtype" in
22624 xxx)
22625         xxx=`./findhdr sys/user.h`
22626         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22627         case $1 in
22628         unsigned) dflt="$1 $2" ;;
22629         *) dflt="$1" ;;
22630         esac
22631         ;;
22632 *) dflt="$uidtype";;
22633 esac
22634 case "$uidtype" in
22635 uid_t)  echo "uid_t found." ;;
22636 *)      rp="What is the type for user ids returned by getuid()?"
22637         . ./myread
22638         uidtype="$ans"
22639         ;;
22640 esac
22641
22642 : Check size of UID
22643 echo " "
22644 case "$uidtype" in
22645 *_t) zzz="$uidtype"     ;;
22646 *)   zzz="uid"          ;;
22647 esac
22648 echo "Checking the size of $zzz..." >&4
22649 cat > try.c <<EOCP
22650 #include <sys/types.h>
22651 #include <stdio.h>
22652 #$i_stdlib I_STDLIB
22653 #ifdef I_STDLIB
22654 #include <stdlib.h>
22655 #endif
22656 int main() {
22657     printf("%d\n", (int)sizeof($uidtype));
22658     exit(0);
22659 }
22660 EOCP
22661 set try
22662 if eval $compile_ok; then
22663         yyy=`$run ./try`
22664         case "$yyy" in
22665         '')     uidsize=4
22666                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22667                 ;;
22668         *)      uidsize=$yyy
22669                 echo "Your $zzz is $uidsize bytes long."
22670                 ;;
22671         esac
22672 else
22673         uidsize=4
22674         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22675 fi
22676
22677 : Check if UID is signed
22678 echo " "
22679 case "$uidtype" in
22680 *_t) zzz="$uidtype"     ;;
22681 *)   zzz="uid"          ;;
22682 esac
22683 echo "Checking the sign of $zzz..." >&4
22684 cat > try.c <<EOCP
22685 #include <sys/types.h>
22686 #include <stdio.h>
22687 int main() {
22688         $uidtype foo = -1;
22689         if (foo < 0)
22690                 printf("-1\n");
22691         else
22692                 printf("1\n");
22693 }
22694 EOCP
22695 set try
22696 if eval $compile; then
22697         yyy=`$run ./try`
22698         case "$yyy" in
22699         '')     uidsign=1
22700                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22701                 ;;
22702         *)      uidsign=$yyy
22703                 case "$uidsign" in
22704                  1) echo "Your $zzz is unsigned." ;;
22705                 -1) echo "Your $zzz is signed."   ;;
22706                 esac
22707                 ;;
22708         esac
22709 else
22710         uidsign=1
22711         echo "(I can't compile the test program--guessing unsigned.)" >&4
22712 fi
22713
22714
22715 : Check format string for UID
22716 echo " "
22717 $echo "Checking the format string to be used for uids..." >&4
22718
22719 case "$uidsign" in
22720 -1)     if $test X"$uidsize" = X"$ivsize"; then
22721                 uidformat="$ivdformat"
22722         else
22723                 if $test X"$uidsize" = X"$longsize"; then
22724                         uidformat='"ld"'
22725                 else
22726                         if $test X"$uidsize" = X"$intsize"; then
22727                                 uidformat='"d"'
22728                         else
22729                                 if $test X"$uidsize" = X"$shortsize"; then
22730                                         uidformat='"hd"'
22731                                 fi
22732                         fi
22733                 fi
22734         fi
22735         ;;
22736 *)      if $test X"$uidsize" = X"$uvsize"; then
22737                 uidformat="$uvuformat"
22738         else
22739                 if $test X"$uidsize" = X"$longsize"; then
22740                         uidformat='"lu"'
22741                 else
22742                         if $test X"$uidsize" = X"$intsize"; then
22743                                 uidformat='"u"'
22744                         else
22745                                 if $test X"$uidsize" = X"$shortsize"; then
22746                                         uidformat='"hu"'
22747                                 fi
22748                         fi
22749                 fi
22750         fi
22751         ;;
22752 esac
22753
22754 : see what siginfo fields we have
22755 case "$d_sigaction" in
22756 "$define")
22757         echo "Checking if your siginfo_t has si_errno field...">&4
22758         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
22759         eval $hasfield_t;
22760
22761         echo "Checking if your siginfo_t has si_pid field...">&4
22762         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
22763         eval $hasfield_t;
22764
22765         echo "Checking if your siginfo_t has si_uid field...">&4
22766         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
22767         eval $hasfield_t;
22768
22769         echo "Checking if your siginfo_t has si_addr field...">&4
22770         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
22771         eval $hasfield_t;
22772
22773         echo "Checking if your siginfo_t has si_status field...">&4
22774         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
22775         eval $hasfield_t;
22776
22777         echo "Checking if your siginfo_t has si_band field...">&4
22778         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
22779         eval $hasfield_t;
22780
22781         echo "Checking if your siginfo_t has si_value field...">&4
22782         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
22783         eval $hasfield_t;
22784
22785         ;;
22786 *)
22787         d_siginfo_si_errno="$undef"
22788         d_siginfo_si_pid="$undef"
22789         d_siginfo_si_uid="$undef"
22790         d_siginfo_si_addr="$undef"
22791         d_siginfo_si_status="$undef"
22792         d_siginfo_si_band="$undef"
22793         d_siginfo_si_value="$undef"
22794         ;;
22795 esac
22796
22797 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22798 echo " "
22799 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22800 $cat >try.c <<'EOM'
22801 /* Intentionally a long probe as I'd like to sanity check that the exact
22802    approach is going to work, as thinking it will work, but only having it
22803    part working at runtime is worse than not having it.  */
22804
22805 #include <sys/types.h>
22806 #include <sys/sysctl.h>
22807 #include <sys/param.h>
22808 #include <stdio.h>
22809 #include <string.h>
22810 #include <stdlib.h>
22811 #include <unistd.h>
22812
22813 int
22814 main(int argc, char **argv) {
22815     char *buffer;
22816     char *argv_leaf = strrchr(argv[0], '/');
22817     char *buffer_leaf;
22818     size_t size = 0;
22819     int mib[4];
22820
22821     mib[0] = CTL_KERN;
22822     mib[1] = KERN_PROC;
22823     mib[2] = KERN_PROC_PATHNAME;
22824     mib[3] = -1;
22825
22826     if (!argv_leaf) {
22827         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22828         return 1;
22829     }
22830
22831     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22832         perror("sysctl");
22833         return 2;
22834     }
22835
22836     if (size < strlen(argv_leaf) + 1) {
22837         fprintf(stderr, "size %lu is too short for a path\n",
22838                 (unsigned long) size);
22839         return 3;
22840     }
22841
22842     if (size > MAXPATHLEN * MAXPATHLEN) {
22843         fprintf(stderr, "size %lu is too long for a path\n",
22844                 (unsigned long) size);
22845         return 4;
22846     }
22847
22848     buffer = malloc(size);
22849     if (!buffer) {
22850         perror("malloc");
22851         return 5;
22852     }
22853
22854     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22855         perror("sysctl");
22856         return 6;
22857     }
22858
22859     if (strlen(buffer) + 1 != size) {
22860         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22861                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22862         return 7;
22863     }
22864
22865
22866     if (*buffer != '/') {
22867         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22868         return 8;
22869     }
22870
22871     if (strstr(buffer, "/./")) {
22872         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22873         return 9;
22874     }
22875
22876     if (strstr(buffer, "/../")) {
22877         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22878         return 10;
22879     }
22880
22881     buffer_leaf = strrchr(buffer, '/');
22882     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22883         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22884         return 11;
22885     }
22886
22887     free(buffer);
22888
22889     return 0;
22890 }
22891 EOM
22892
22893 val=$undef
22894 set try
22895 if eval $compile; then
22896         if $run ./try; then
22897                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22898                 val="$define"
22899         else
22900                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22901                 val="$undef"
22902         fi
22903 else
22904         echo "I'm unable to compile the test program." >&4
22905         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22906         val="$undef"
22907 fi
22908 $rm_try
22909 set usekernprocpathname
22910 eval $setvar
22911
22912 : Determine if we can use _NSGetExecutablePath to find executing program
22913 echo " "
22914 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22915 $cat >try.c <<'EOM'
22916 /* Intentionally a long probe as I'd like to sanity check that the exact
22917    approach is going to work, as thinking it will work, but only having it
22918    part working at runtime is worse than not having it.  */
22919 #include <mach-o/dyld.h>
22920 #include <stdio.h>
22921 #include <stdlib.h>
22922 #include <sys/param.h>
22923 #include <string.h>
22924
22925 int
22926 main(int argc, char **argv) {
22927     char buf[1];
22928     uint32_t size = sizeof(buf);
22929     int result;
22930     char *buffer;
22931     char *tidied;
22932     char *argv_leaf = strrchr(argv[0], '/');
22933     char *tidied_leaf;
22934
22935     if (!argv_leaf) {
22936         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22937         return 1;
22938     }
22939
22940     _NSGetExecutablePath(buf, &size);
22941     if (size > MAXPATHLEN * MAXPATHLEN) {
22942         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22943                 (unsigned int) size);
22944         return 2;
22945     }
22946
22947     buffer = malloc(size);
22948     if (!buffer) {
22949         perror("malloc");
22950         return 3;
22951     }
22952
22953     result = _NSGetExecutablePath(buffer, &size);
22954     if (result != 0) {
22955         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22956                 result, (unsigned int) size);
22957         return 4;
22958     }
22959
22960     tidied = realpath(buffer, NULL);
22961     if (!tidied) {
22962         perror("realpath");
22963         return 5;
22964     }
22965
22966     free(buffer);
22967
22968     if (*tidied != '/') {
22969         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22970         return 6;
22971     }
22972
22973     if (strstr(tidied, "/./")) {
22974         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22975         return 7;
22976     }
22977
22978     if (strstr(tidied, "/../")) {
22979         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22980         return 8;
22981     }
22982
22983     tidied_leaf = strrchr(tidied, '/');
22984     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22985         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22986         return 9;
22987     }
22988
22989     free(tidied);
22990
22991     return 0;
22992 }
22993 EOM
22994
22995 val=$undef
22996 set try
22997 if eval $compile; then
22998         if $run ./try; then
22999                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
23000                 val="$define"
23001         else
23002                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23003         fi
23004 else
23005         echo "I'm unable to compile the test program." >&4
23006         echo "I'll assume no _NSGetExecutablePath here." >&4
23007 fi
23008 $rm_try
23009 set usensgetexecutablepath
23010 eval $setvar
23011
23012 : Check if site customization support was requested
23013 case "$usesitecustomize" in
23014     $define|true|[Yy]*)
23015         usesitecustomize="$define"
23016         ;;
23017     *)
23018         usesitecustomize="$undef"
23019         ;;
23020     esac
23021
23022 : see if prototypes support variable argument declarations
23023 echo " "
23024 case "$prototype$i_stdarg" in
23025 $define$define)
23026         echo "It appears we'll be able to prototype varargs functions." >&4
23027         val="$define"
23028         ;;
23029 *)
23030         echo "Too bad... We won't be using prototyped varargs functions..." >&4
23031         val="$undef"
23032         ;;
23033 esac
23034 set vaproto
23035 eval $setvar
23036
23037 : determine compiler compiler
23038 case "$yacc" in
23039 '')
23040         dflt=yacc;;
23041 *)
23042         dflt="$yacc";;
23043 esac
23044 echo " "
23045 comp='yacc'
23046 if $test -f "$byacc$_exe"; then
23047         dflt="$byacc"
23048         comp="byacc or $comp"
23049 fi
23050 if $test -f "$bison$_exe"; then
23051         comp="$comp or bison -y"
23052 fi
23053 rp="Which compiler compiler ($comp) shall I use?"
23054 . ./myread
23055 yacc="$ans"
23056 case "$yacc" in
23057 *bis*)
23058         case "$yacc" in
23059         *-y*) ;;
23060         *)
23061                 yacc="$yacc -y"
23062                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23063                 ;;
23064         esac
23065         ;;
23066 esac
23067
23068 : see if this is a assert.h system
23069 set assert.h i_assert
23070 eval $inhdr
23071
23072 : see if this is a bfd.h system
23073 set bfd.h i_bfd
23074 eval $inhdr
23075
23076 : see if this is an execinfo.h system
23077 set execinfo.h i_execinfo
23078 eval $inhdr
23079
23080 : see if this is a fenv.h system
23081 set fenv.h i_fenv
23082 eval $inhdr
23083
23084 : see if this is a fp.h system
23085 set fp.h i_fp
23086 eval $inhdr
23087
23088 : see if this is a fp_class.h system
23089 set fp_class.h i_fp_class
23090 eval $inhdr
23091
23092 : see if gdbm.h is available
23093 set gdbm.h t_gdbm
23094 eval $inhdr
23095 case "$t_gdbm" in
23096 $define)
23097         : see if gdbm_open exists
23098         set gdbm_open d_gdbm_open
23099         eval $inlibc
23100         case "$d_gdbm_open" in
23101         $undef)
23102                 t_gdbm="$undef"
23103                 echo "We won't be including <gdbm.h>"
23104                 ;;
23105         esac
23106         ;;
23107 esac
23108 val="$t_gdbm"
23109 set i_gdbm
23110 eval $setvar
23111
23112 : see if this is a ieeefp.h system
23113 case "$i_ieeefp" in
23114 '' ) set ieeefp.h i_ieeefp
23115      eval $inhdr
23116      ;;
23117 esac
23118
23119 : see if this is a libutil.h system
23120 set libutil.h i_libutil
23121 eval $inhdr
23122
23123 : see if mach cthreads are available
23124 if test "X$usethreads" = "X$define"; then
23125         set mach/cthreads.h i_machcthr
23126         eval $inhdr
23127 else
23128         i_machcthr="$undef"
23129 fi
23130
23131 : see if this is a mntent.h system
23132 set mntent.h i_mntent
23133 eval $inhdr
23134
23135 : see if net/errno.h is available
23136 val=''
23137 set net/errno.h val
23138 eval $inhdr
23139
23140 : Unfortunately, it causes problems on some systems.  Arrgh.
23141 case "$val" in
23142 $define)
23143         cat > try.c <<'EOM'
23144 #include <stdio.h>
23145 #include <errno.h>
23146 #include <net/errno.h>
23147 int func()
23148 {
23149         return ENOTSOCK;
23150 }
23151 EOM
23152         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23153                 echo "We'll be including <net/errno.h>." >&4
23154         else
23155                 echo "We won't be including <net/errno.h>." >&4
23156                 val="$undef"
23157         fi
23158         $rm_try
23159         ;;
23160 esac
23161 set i_neterrno
23162 eval $setvar
23163
23164 : see if netinet/tcp.h is available
23165 set netinet/tcp.h i_netinettcp
23166 eval $inhdr
23167
23168 : see if this is a poll.h system
23169 set poll.h i_poll
23170 eval $inhdr
23171
23172 : see if this is a prot.h system
23173 set prot.h i_prot
23174 eval $inhdr
23175
23176 : Preprocessor symbols
23177 echo " "
23178 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23179 $cat <<'EOSH' > Cppsym.know
23180 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23181 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23182 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23183 arch_pwr ardent ARM ARM32 atarist att386 att3b
23184 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23185 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23186 byteorder byte_order
23187 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23188 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23189 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23190 ELF encore EPI EXTENSIONS
23191 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23192 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23193 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23194 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23195 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23196 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23197 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23198 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23199 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23200 ksr1
23201 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23202 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23203 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23204 luna88k Lynx
23205 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23206 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23207 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23208 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23209 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23210 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23211 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23212 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23213 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23214 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23215 ns32000 ns32016 ns32332 ns32k nsc32000
23216 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23217 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23218 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23219 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23220 QK_USER QNX
23221 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23222 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23223 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23224 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23225 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23226 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23227 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23228 SYSV4 SYSV5 sysV68 sysV88
23229 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23230 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23231 tower32_800 tower32_850 tss
23232 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23233 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23234 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23235 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23236 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23237 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23238 uxpm uxps
23239 vax venix VMESA vms
23240 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23241 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23242 z8000 zarch
23243 EOSH
23244 # Maybe put other stuff here too.
23245 ./tr '-' '_' <<EOSH >>Cppsym.know
23246 $osname
23247 EOSH
23248 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23249 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23250 $cat Cppsym.know > Cppsym.c
23251 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23252 $rm -f Cppsym.a Cppsym.b Cppsym.c
23253 cat <<EOSH > Cppsym
23254 $startsh
23255 if $test \$# -gt 0; then
23256     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23257     if $test -s Cppsym.got; then
23258         $rm -f Cppsym.got
23259         exit 0
23260     fi
23261     $rm -f Cppsym.got
23262     exit 1
23263 else
23264     $tr " " "$trnl" | ./Cppsym.try
23265     exit 0
23266 fi
23267 EOSH
23268 chmod +x Cppsym
23269 $eunicefix Cppsym
23270 cat <<EOSH > Cppsym.try
23271 $startsh
23272 cat <<'EOCP' > try.c
23273 #include <stdio.h>
23274 #if cpp_stuff == 1
23275 #define STRINGIFY(a)    "a"
23276 #endif
23277 #if cpp_stuff == 42
23278 #define StGiFy(a)  #a
23279 #define STRINGIFY(a)    StGiFy(a)
23280 #endif
23281 #if $cpp_stuff != 1 && $cpp_stuff != 42
23282 #   include "Bletch: How does this C preprocessor stringify macros?"
23283 #endif
23284 int main() {
23285 EOCP
23286 $awk \\
23287 EOSH
23288 cat <<'EOSH' >> Cppsym.try
23289 'length($1) > 0 {
23290     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23291     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23292     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23293     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23294 }'       >> try.c
23295 echo 'return 0;}' >> try.c
23296 EOSH
23297 cat <<EOSH >> Cppsym.try
23298 ccflags="$ccflags"
23299 case "$osname-$gccversion" in
23300 irix-) ccflags="\$ccflags -woff 1178" ;;
23301 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23302 esac
23303 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try  | $sed 's/ /\\\\ /g'
23304 EOSH
23305 chmod +x Cppsym.try
23306 $eunicefix Cppsym.try
23307 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23308 : Add in any Linux cpp "predefined macros":
23309 case "$osname::$gccversion" in
23310   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23311     tHdrH=_tmpHdr
23312     rm -f $tHdrH'.h' $tHdrH
23313     touch $tHdrH'.h'
23314     # Filter out macro arguments, such as Linux's __INT8_C(c)
23315     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23316        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23317        if [ -s $tHdrH'_cppsym.real' ]; then
23318           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23319        fi
23320     fi
23321     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23322   ;;
23323 esac
23324 : now check the C compiler for additional symbols
23325 postprocess_cc_v=''
23326 case "$osname" in
23327 aix) postprocess_cc_v="|$tr , ' '" ;;
23328 esac
23329 $cat >ccsym <<EOS
23330 $startsh
23331 $cat >tmp.c <<EOF
23332 extern int foo;
23333 EOF
23334 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23335 do
23336         case "\$i" in
23337         -D*) echo "\$i" | $sed 's/^-D//';;
23338         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23339         esac
23340 done
23341 $rm_try
23342 EOS
23343 postprocess_cc_v=''
23344 chmod +x ccsym
23345 $eunicefix ccsym
23346 ./ccsym > ccsym1.raw
23347 if $test -s ccsym1.raw; then
23348     $sort ccsym1.raw | $uniq >ccsym.raw
23349 else
23350     mv ccsym1.raw ccsym.raw
23351 fi
23352
23353 $awk '/\=/ { print $0; next }
23354         { print $0"=1" }' ccsym.raw >ccsym.list
23355 $comm -13 Cppsym.true ccsym.list >ccsym.own
23356 $comm -12 Cppsym.true ccsym.list >ccsym.com
23357 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23358 also=''
23359 if $test -z ccsym.raw; then
23360         echo "Your C compiler doesn't seem to define any symbols!" >&4
23361         echo " "
23362         echo "However, your C preprocessor defines the following symbols:"
23363         $cat Cppsym.true
23364         ccsymbols=''
23365         cppsymbols=`$cat Cppsym.true`
23366         cppsymbols=`echo $cppsymbols`
23367         cppccsymbols="$cppsymbols"
23368 else
23369         if $test -s ccsym.com; then
23370                 echo "Your C compiler and pre-processor define these symbols:"
23371                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23372                 also='also '
23373                 symbols='ones'
23374                 cppccsymbols=`$cat ccsym.com`
23375                 cppccsymbols=`echo $cppccsymbols`
23376                 $test "$silent" || sleep 1
23377         fi
23378         if $test -s ccsym.cpp; then
23379                 $test "$also" && echo " "
23380                 echo "Your C pre-processor ${also}defines the following symbols:"
23381                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23382                 also='further '
23383                 cppsymbols=`$cat ccsym.cpp`
23384                 cppsymbols=`echo $cppsymbols`
23385                 $test "$silent" || sleep 1
23386         fi
23387         if $test -s ccsym.own; then
23388                 $test "$also" && echo " "
23389                 echo "Your C compiler ${also}defines the following cpp symbols:"
23390                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23391                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23392                 ccsymbols=`$cat ccsym.own`
23393                 ccsymbols=`echo $ccsymbols`
23394                 $test "$silent" || sleep 1
23395         fi
23396 fi
23397
23398 : add -D_FORTIFY_SOURCE if feasible and not already there
23399 case "$gccversion" in
23400 [45].*) case "$optimize$ccflags" in
23401         *-O*)   case "$ccflags$cppsymbols" in
23402                 *_FORTIFY_SOURCE=*) # Don't add it again.
23403                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23404                         ;;
23405                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23406                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23407                         ;;
23408                 esac
23409                 ;;
23410         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23411                 ;;
23412         esac
23413         ;;
23414 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23415         ;;
23416 esac
23417
23418 : see if this is a termio system
23419 val="$undef"
23420 val2="$undef"
23421 val3="$undef"
23422 if $test `./findhdr termios.h`; then
23423     set tcsetattr i_termios
23424     eval $inlibc
23425     val3="$i_termios"
23426 fi
23427 echo " "
23428 case "$val3" in
23429     "$define") echo "You have POSIX termios.h... good!" >&4;;
23430     *)  if ./Cppsym pyr; then
23431             case "`$run /bin/universe`" in
23432                 ucb) if $test `./findhdr sgtty.h`; then
23433                         val2="$define"
23434                         echo "<sgtty.h> found." >&4
23435                     else
23436                         echo "System is pyramid with BSD universe."
23437                         ./warn "<sgtty.h> not found--you could have problems."
23438                     fi;;
23439                 *)  if $test `./findhdr termio.h`; then
23440                         val="$define"
23441                         echo "<termio.h> found." >&4
23442                     else
23443                         echo "System is pyramid with USG universe."
23444                         ./warn "<termio.h> not found--you could have problems."
23445                     fi;;
23446             esac
23447         elif ./usg; then
23448             if $test `./findhdr termio.h`; then
23449                 echo "<termio.h> found." >&4
23450                 val="$define"
23451             elif $test `./findhdr sgtty.h`; then
23452                 echo "<sgtty.h> found." >&4
23453                 val2="$define"
23454             else
23455                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23456             fi
23457         else
23458             if $test `./findhdr sgtty.h`; then
23459                 echo "<sgtty.h> found." >&4
23460                 val2="$define"
23461             elif $test `./findhdr termio.h`; then
23462                 echo "<termio.h> found." >&4
23463                 val="$define"
23464             else
23465                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23466             fi
23467         fi;;
23468 esac
23469 set i_termio; eval $setvar
23470 val=$val2; set i_sgtty; eval $setvar
23471 val=$val3; set i_termios; eval $setvar
23472
23473 : see if stdbool is available
23474 : we want a real compile instead of Inhdr because some Solaris systems
23475 : have stdbool.h, but it can only be used if the compiler indicates it
23476 : is sufficiently c99-compliant.
23477 echo " "
23478 $cat >try.c <<EOCP
23479 #include <stdio.h>
23480 #include <stdbool.h>
23481 int func(bool x)
23482 {
23483     return x ? 1 : 0;
23484 }
23485 int main(int argc, char **argv)
23486 {
23487     return func(0);
23488 }
23489 EOCP
23490 set try
23491 if eval $compile; then
23492         echo "<stdbool.h> found." >&4
23493         val="$define"
23494 else
23495         echo "<stdbool.h> NOT found." >&4
23496         val="$undef"
23497 fi
23498 $rm_try
23499 set i_stdbool
23500 eval $setvar
23501
23502 : see if stddef is available
23503 set stddef.h i_stddef
23504 eval $inhdr
23505
23506 : see if stdint is available
23507 set stdint.h i_stdint
23508 eval $inhdr
23509
23510 : see if sys/access.h is available
23511 set sys/access.h i_sysaccess
23512 eval $inhdr
23513
23514 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23515 set sys/filio.h i_sysfilio
23516 eval $inhdr
23517 echo " "
23518 if $test `./findhdr sys/ioctl.h`; then
23519         val="$define"
23520         echo '<sys/ioctl.h> found.' >&4
23521 else
23522         val="$undef"
23523         if $test $i_sysfilio = "$define"; then
23524             echo '<sys/ioctl.h> NOT found.' >&4
23525         else
23526                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23527                 $test $i_termio = "$define" && xxx="termio.h"
23528                 $test $i_termios = "$define" && xxx="termios.h"
23529 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23530         fi
23531 fi
23532 set i_sysioctl
23533 eval $setvar
23534
23535 : see if socket ioctl defs are in sys/sockio.h
23536 echo " "
23537 xxx=`./findhdr sys/sockio.h`
23538 if $test "$xxx"; then
23539         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23540                 val="$define"
23541                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23542         else
23543                 val="$undef"
23544                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23545         fi
23546 else
23547         val="$undef"
23548         $cat <<EOM
23549 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23550 EOM
23551 fi
23552 set i_syssockio
23553 eval $setvar
23554
23555 : see if this is a syslog.h system
23556 set syslog.h i_syslog
23557 eval $inhdr
23558
23559 : see if this is a sys/mode.h system
23560 set sys/mode.h i_sysmode
23561 eval $inhdr
23562
23563 : see if there is a sys/poll.h file
23564 set sys/poll.h i_syspoll
23565 eval $inhdr
23566
23567 : see if sys/resource.h has to be included
23568 set sys/resource.h i_sysresrc
23569 eval $inhdr
23570
23571 : see if sys/security.h is available
23572 set sys/security.h i_syssecrt
23573 eval $inhdr
23574
23575 : see if this is a sys/statvfs.h system
23576 set sys/statvfs.h i_sysstatvfs
23577 eval $inhdr
23578
23579 : see if this is a sys/un.h system
23580 set sys/un.h i_sysun
23581 eval $inhdr
23582
23583 : see if this is a sys/utsname.h system
23584 set sys/utsname.h i_sysutsname
23585 eval $inhdr
23586
23587 : see if this is a syswait system
23588 set sys/wait.h i_syswait
23589 eval $inhdr
23590
23591 : see if this is a ustat.h system
23592 set ustat.h i_ustat
23593 eval $inhdr
23594
23595 : see if this is an utime system
23596 set utime.h i_utime
23597 eval $inhdr
23598
23599 : see if this is a vfork system
23600 case "$d_vfork" in
23601 "$define")
23602         set vfork.h i_vfork
23603         eval $inhdr
23604         ;;
23605 *)
23606         i_vfork="$undef"
23607         ;;
23608 esac
23609
23610 : Check extensions
23611 echo " "
23612 echo "Looking for extensions..." >&4
23613 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23614 : contain old or inaccurate or duplicate values.
23615 nonxs_extensions=''
23616 xs_extensions=''
23617 : We do not use find because it might not be available.
23618 : We do not just use MANIFEST because the user may have dropped
23619 : some additional extensions into the source tree and expect them
23620 : to be built.
23621
23622 : Function to recursively find available extensions, ignoring DynaLoader
23623 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23624 : In 5.10.1 and later, extensions are stored in directories
23625 : like File-Glob instead of the older File/Glob/.
23626 find_extensions='
23627     for xxx in *; do
23628         case "$xxx" in
23629             DynaLoader|dynaload) ;;
23630             *)
23631             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23632             case "$this_ext" in
23633                 Scalar/List/Utils) this_ext="List/Util" ;;
23634                 PathTools)         this_ext="Cwd"       ;;
23635             esac;
23636             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23637             if $contains " $this_ext " "$tdir/$$.tmp"; then
23638                 echo >&4;
23639                 echo "Duplicate directories detected for extension $xxx" >&4;
23640                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23641                 case "$knowitall" in
23642                 "") dflt=y;;
23643                 *) dflt=n;;
23644                 esac;
23645                 . ../UU/myread;
23646                 case "$ans" in
23647                 n*|N*) ;;
23648                 *) echo >&4;
23649                     echo "Ok.  Stopping Configure." >&4;
23650                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23651                     exit 1;;
23652                 esac;
23653                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23654             fi;
23655             $ls -1 "$xxx" > "$tdir/$$.tmp";
23656             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23657                 xs_extensions="$xs_extensions $this_ext";
23658             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23659                 xs_extensions="$xs_extensions $this_ext";
23660             elif $test -d "$xxx"; then
23661                 nonxs_extensions="$nonxs_extensions $this_ext";
23662             fi;
23663             $rm -f "$tdir/$$.tmp";
23664             ;;
23665         esac;
23666     done'
23667 tdir=`pwd`
23668 cd "$rsrc/cpan"
23669 set X
23670 shift
23671 eval $find_extensions
23672 cd "$rsrc/dist"
23673 set X
23674 shift
23675 eval $find_extensions
23676 cd "$rsrc/ext"
23677 set X
23678 shift
23679 eval $find_extensions
23680 set X $xs_extensions
23681 shift
23682 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23683 set X $nonxs_extensions
23684 shift
23685 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23686 cd "$tdir"
23687 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23688
23689 : Now see which are supported on this system.
23690 avail_ext=''
23691 for xxx in $xs_extensions ; do
23692         case "$xxx" in
23693         Amiga*)
23694                 case "$osname" in
23695                 amigaos) avail_ext="$avail_ext $xxx" ;;
23696                 esac
23697                 ;;
23698         DB_File|db_file)
23699                 case "$i_db" in
23700                 $define) avail_ext="$avail_ext $xxx" ;;
23701                 esac
23702                 ;;
23703         GDBM_File|gdbm_fil)
23704                 case "$i_gdbm" in
23705                 $define) avail_ext="$avail_ext $xxx" ;;
23706                 esac
23707                 ;;
23708         I18N/Langinfo|i18n_lan)
23709                 case "$i_langinfo$d_nl_langinfo" in
23710                 $define$define) avail_ext="$avail_ext $xxx" ;;
23711                 esac
23712                 ;;
23713         IPC/SysV|ipc/sysv)
23714                 : XXX Do we need a useipcsysv variable here
23715                 case "${d_msg}${d_sem}${d_shm}" in
23716                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23717                 esac
23718                 ;;
23719         NDBM_File|ndbm_fil)
23720                 case "$d_ndbm" in
23721                 $define)
23722                     case "$osname-$use64bitint" in
23723                     hpux-define)
23724                         case "$libs" in
23725                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23726                         esac
23727                         ;;
23728                     *) avail_ext="$avail_ext $xxx" ;;
23729                     esac
23730                     ;;
23731                 esac
23732                 ;;
23733         ODBM_File|odbm_fil)
23734                 case "${i_dbm}${i_rpcsvcdbm}" in
23735                 *"${define}"*)
23736                     case "$d_cplusplus" in
23737                     define) ;; # delete as a function name will not work
23738                     *)  case "$osname-$use64bitint" in
23739                         hpux-define)
23740                             case "$libs" in
23741                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23742                             esac
23743                             ;;
23744                         *) avail_ext="$avail_ext $xxx" ;;
23745                         esac
23746                         ;;
23747                     esac
23748                     ;;
23749                 esac
23750                 ;;
23751         Opcode|opcode)
23752                 case "$useopcode" in
23753                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23754                 esac
23755                 ;;
23756         POSIX|posix)
23757                 case "$useposix" in
23758                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23759                 esac
23760                 ;;
23761         Socket|socket)
23762                 case "$d_socket" in
23763                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23764                 esac
23765                 ;;
23766         Sys/Syslog|sys/syslog)
23767                 case $osname in
23768                         amigaos) ;; # not really very useful on AmigaOS
23769                         *)
23770                         : XXX syslog requires socket
23771                         case "$d_socket" in
23772                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23773                         esac
23774                         ;;
23775                 esac
23776                 ;;
23777         Thread|thread)
23778                 case "$usethreads" in
23779                 true|$define|y)
23780                         case "$use5005threads" in
23781                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23782                         esac
23783                 esac
23784                 ;;
23785         threads|threads/shared)
23786                 # threads and threads::shared are special cases.
23787                 # To stop people from asking "Perl 5.8.0 was supposed
23788                 # to have this new fancy threads implementation but my
23789                 # perl doesn't have it" and from people trying to
23790                 # (re)install the threads module using CPAN.pm and
23791                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23792                 # the threads.pm and threads/shared.pm will always be
23793                 # there, croaking informatively ("you need to rebuild
23794                 # all of Perl with threads, sorry") when threads haven't
23795                 # been compiled in.
23796                 # --jhi
23797                 avail_ext="$avail_ext $xxx"
23798                 ;;
23799         VMS*)
23800                 ;;
23801         Win32*)
23802                 case "$osname" in
23803                 cygwin) avail_ext="$avail_ext $xxx" ;;
23804                 esac
23805                 ;;
23806         XS/APItest|xs/apitest)
23807                 # This is just for testing.  Skip it unless we have dynamic loading.
23808
23809                 case "$usedl" in
23810                 $define) avail_ext="$avail_ext $xxx" ;;
23811                 esac
23812                 ;;
23813         XS/Typemap|xs/typemap)
23814                 # This is just for testing.  Skip it unless we have dynamic loading.
23815                 case "$usedl" in
23816                 $define) avail_ext="$avail_ext $xxx" ;;
23817                 esac
23818                 ;;
23819         *)      avail_ext="$avail_ext $xxx"
23820                 ;;
23821         esac
23822 done
23823
23824 set X $avail_ext
23825 shift
23826 avail_ext="$*"
23827
23828 case "$onlyextensions" in
23829 '') ;;
23830 *)  keepextensions=''
23831     echo "You have requested that only certain extensions be included..." >&4
23832     for i in $onlyextensions; do
23833         case " $avail_ext " in
23834         *" $i "*)
23835             echo "Keeping extension $i."
23836             keepextensions="$keepextensions $i"
23837             ;;
23838         *) echo "Ignoring extension $i." ;;
23839         esac
23840     done
23841     avail_ext="$keepextensions"
23842     ;;
23843 esac
23844
23845 case "$noextensions" in
23846 '') ;;
23847 *)  keepextensions=''
23848     echo "You have requested that certain extensions be ignored..." >&4
23849     for i in $avail_ext; do
23850         case " $noextensions " in
23851         *" $i "*) echo "Ignoring extension $i." ;;
23852         *) echo "Keeping extension $i.";
23853            keepextensions="$keepextensions $i"
23854            ;;
23855         esac
23856     done
23857     avail_ext="$keepextensions"
23858     ;;
23859 esac
23860
23861 : Now see which nonxs extensions are supported on this system.
23862 : For now assume all are.
23863 nonxs_ext=''
23864 for xxx in $nonxs_extensions ; do
23865         case "$xxx" in
23866         VMS*)
23867                 ;;
23868         *)      nonxs_ext="$nonxs_ext $xxx"
23869                 ;;
23870         esac
23871 done
23872
23873 set X $nonxs_ext
23874 shift
23875 nonxs_ext="$*"
23876
23877 case $usedl in
23878 $define)
23879         $cat <<EOM
23880 A number of extensions are supplied with $package.  You may choose to
23881 compile these extensions for dynamic loading (the default), compile
23882 them into the $package executable (static loading), or not include
23883 them at all.  Answer "none" to include no extensions.
23884 Note that DynaLoader is always built and need not be mentioned here.
23885
23886 EOM
23887         case "$dynamic_ext" in
23888         '')
23889                 : Exclude those listed in static_ext
23890                 dflt=''
23891                 for xxx in $avail_ext; do
23892                         case " $static_ext " in
23893                         *" $xxx "*) ;;
23894                         *) dflt="$dflt $xxx" ;;
23895                         esac
23896                 done
23897                 set X $dflt
23898                 shift
23899                 dflt="$*"
23900                 ;;
23901         *)      dflt="$dynamic_ext"
23902                 # Perhaps we are reusing an old out-of-date config.sh.
23903                 case "$hint" in
23904                 previous)
23905                         if test X"$dynamic_ext" != X"$avail_ext"; then
23906                                 $cat <<EOM
23907 NOTICE:  Your previous config.sh list may be incorrect.
23908 The extensions now available to you are
23909         ${avail_ext}
23910 but the default list from your previous config.sh is
23911         ${dynamic_ext}
23912
23913 EOM
23914                         fi
23915                         ;;
23916                 esac
23917                 ;;
23918         esac
23919         case "$dflt" in
23920         '')     dflt=none;;
23921         esac
23922         rp="What extensions do you wish to load dynamically?"
23923         . ./myread
23924         case "$ans" in
23925         none) dynamic_ext=' ' ;;
23926         *) dynamic_ext="$ans" ;;
23927         esac
23928
23929         case "$static_ext" in
23930         '')
23931                 : Exclude those already listed in dynamic linking
23932                 dflt=''
23933                 for xxx in $avail_ext; do
23934                         case " $dynamic_ext " in
23935                         *" $xxx "*) ;;
23936                         *) dflt="$dflt $xxx" ;;
23937                         esac
23938                 done
23939                 set X $dflt
23940                 shift
23941                 dflt="$*"
23942                 ;;
23943         *)  dflt="$static_ext"
23944                 ;;
23945         esac
23946
23947         case "$dflt" in
23948         '')     dflt=none;;
23949         esac
23950         rp="What extensions do you wish to load statically?"
23951         . ./myread
23952         case "$ans" in
23953         none) static_ext=' ' ;;
23954         *) static_ext="$ans" ;;
23955         esac
23956         ;;
23957 *)
23958         $cat <<EOM
23959 A number of extensions are supplied with $package.  Answer "none"
23960 to include no extensions.
23961 Note that DynaLoader is always built and need not be mentioned here.
23962
23963 EOM
23964         case "$static_ext" in
23965         '') dflt="$avail_ext" ;;
23966         *)      dflt="$static_ext"
23967                 # Perhaps we are reusing an old out-of-date config.sh.
23968                 case "$hint" in
23969                 previous)
23970                         if test X"$static_ext" != X"$avail_ext"; then
23971                                 $cat <<EOM
23972 NOTICE:  Your previous config.sh list may be incorrect.
23973 The extensions now available to you are
23974         ${avail_ext}
23975 but the default list from your previous config.sh is
23976         ${static_ext}
23977
23978 EOM
23979                         fi
23980                         ;;
23981                 esac
23982                 ;;
23983         esac
23984         : Exclude those that are not xs extensions
23985         case "$dflt" in
23986         '')     dflt=none;;
23987         esac
23988         rp="What extensions do you wish to include?"
23989         . ./myread
23990         case "$ans" in
23991         none) static_ext=' ' ;;
23992         *) static_ext="$ans" ;;
23993         esac
23994         ;;
23995 esac
23996 #
23997 # Encode is a special case.  If we are building Encode as a static
23998 # extension, we need to explicitly list its subextensions as well.
23999 # For other nested extensions, this is handled automatically by
24000 # the appropriate Makefile.PL.
24001 case " $static_ext " in
24002         *" Encode "*) # Add the subextensions of Encode
24003         cd "$rsrc/cpan"
24004         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24005                 static_ext="$static_ext Encode/$xxx"
24006                 known_extensions="$known_extensions Encode/$xxx"
24007         done
24008         cd "$tdir"
24009         ;;
24010 esac
24011
24012 set X $dynamic_ext $static_ext $nonxs_ext
24013 shift
24014 extensions="$*"
24015
24016 # Sanity check:  We require an extension suitable for use with
24017 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
24018 # should show up as failures in the test suite, but it's helpful to
24019 # catch them now.) The 'extensions' list is normally sorted
24020 # alphabetically, so we need to accept either
24021 #    DB_File ... Fcntl ... IO  ....
24022 # or something like
24023 #    Fcntl ... NDBM_File ... IO  ....
24024 case " $extensions"  in
24025 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
24026 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24027 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24028 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24029    echo "WARNING: The Perl you are building will be quite crippled." >& 4
24030    ;;
24031 esac
24032
24033 : Remove libraries needed only for extensions
24034 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24035 : The exception is SunOS 4.x, which needs them.
24036 case "${osname}X${osvers}" in
24037 sunos*X4*)
24038     perllibs="$libs"
24039     ;;
24040 *) case "$usedl" in
24041     $define|true|[yY]*)
24042             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24043             shift
24044             perllibs="$*"
24045             ;;
24046     *)  perllibs="$libs"
24047             ;;
24048     esac
24049     ;;
24050 esac
24051
24052 : Remove build directory name from cppstdin so it can be used from
24053 : either the present location or the final installed location.
24054 echo " "
24055 : Get out of the UU directory to get correct path name.
24056 cd ..
24057 case "$cppstdin" in
24058 `pwd`/cppstdin)
24059         echo "Stripping down cppstdin path name"
24060         cppstdin=cppstdin
24061         ;;
24062 esac
24063 cd UU
24064
24065 : end of configuration questions
24066 echo " "
24067 echo "End of configuration questions."
24068 echo " "
24069
24070 : back to where it started
24071 if test -d ../UU; then
24072         cd ..
24073 fi
24074
24075 : configuration may be unconditionally patched via a 'config.arch' file
24076 if $test -f config.arch; then
24077         echo "I see a config.arch file, loading it." >&4
24078         . ./config.arch
24079 fi
24080
24081 : configuration may be patched via a 'config.over' file
24082 if $test -f config.over; then
24083         echo " "
24084         dflt=y
24085         rp='I see a config.over file.  Do you wish to load it?'
24086         . UU/myread
24087         case "$ans" in
24088         n*) echo "OK, I'll ignore it.";;
24089         *)      . ./config.over
24090                 echo "Configuration override changes have been loaded."
24091                 ;;
24092         esac
24093 fi
24094
24095 : in case they want portability, strip down executable paths
24096 case "$d_portable" in
24097 "$define")
24098         echo " "
24099         echo "Stripping down executable paths..." >&4
24100         for file in $loclist $trylist; do
24101                 eval temp=\$$file
24102                 eval $file=`basename $temp`
24103         done
24104         ;;
24105 esac
24106
24107 : create config.sh file
24108 echo " "
24109 echo "Creating config.sh..." >&4
24110 $spitshell <<EOT >config.sh
24111 $startsh
24112 #
24113 # This file was produced by running the Configure script. It holds all the
24114 # definitions figured out by Configure. Should you modify one of these values,
24115 # do not forget to propagate your changes by running "Configure -der". You may
24116 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24117 #
24118
24119 # Package name      : $package
24120 # Source directory  : $src
24121 # Configuration time: $cf_time
24122 # Configured by     : $cf_by
24123 # Target system     : $myuname
24124
24125 EOT
24126 : Add in command line options if available
24127 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24128
24129 $spitshell <<EOT >>config.sh
24130
24131 Author='$Author'
24132 Date='$Date'
24133 Header='$Header'
24134 Id='$Id'
24135 Locker='$Locker'
24136 Log='$Log'
24137 RCSfile='$RCSfile'
24138 Revision='$Revision'
24139 Source='$Source'
24140 State='$State'
24141 _a='$_a'
24142 _exe='$_exe'
24143 _o='$_o'
24144 afs='$afs'
24145 afsroot='$afsroot'
24146 alignbytes='$alignbytes'
24147 ansi2knr='$ansi2knr'
24148 aphostname='$aphostname'
24149 api_revision='$api_revision'
24150 api_subversion='$api_subversion'
24151 api_version='$api_version'
24152 api_versionstring='$api_versionstring'
24153 ar='$ar'
24154 archlib='$archlib'
24155 archlibexp='$archlibexp'
24156 archname64='$archname64'
24157 archname='$archname'
24158 archobjs='$archobjs'
24159 asctime_r_proto='$asctime_r_proto'
24160 awk='$awk'
24161 baserev='$baserev'
24162 bash='$bash'
24163 bin='$bin'
24164 bin_ELF='$bin_ELF'
24165 binexp='$binexp'
24166 bison='$bison'
24167 byacc='$byacc'
24168 byteorder='$byteorder'
24169 c='$c'
24170 castflags='$castflags'
24171 cat='$cat'
24172 cc='$cc'
24173 cccdlflags='$cccdlflags'
24174 ccdlflags='$ccdlflags'
24175 ccflags='$ccflags'
24176 ccflags_uselargefiles='$ccflags_uselargefiles'
24177 ccname='$ccname'
24178 ccsymbols='$ccsymbols'
24179 ccversion='$ccversion'
24180 cf_by='$cf_by'
24181 cf_email='$cf_email'
24182 cf_time='$cf_time'
24183 charbits='$charbits'
24184 charsize='$charsize'
24185 chgrp='$chgrp'
24186 chmod='$chmod'
24187 chown='$chown'
24188 clocktype='$clocktype'
24189 comm='$comm'
24190 compress='$compress'
24191 contains='$contains'
24192 cp='$cp'
24193 cpio='$cpio'
24194 cpp='$cpp'
24195 cpp_stuff='$cpp_stuff'
24196 cppccsymbols='$cppccsymbols'
24197 cppflags='$cppflags'
24198 cpplast='$cpplast'
24199 cppminus='$cppminus'
24200 cpprun='$cpprun'
24201 cppstdin='$cppstdin'
24202 cppsymbols='$cppsymbols'
24203 crypt_r_proto='$crypt_r_proto'
24204 cryptlib='$cryptlib'
24205 csh='$csh'
24206 ctermid_r_proto='$ctermid_r_proto'
24207 ctime_r_proto='$ctime_r_proto'
24208 d_Gconvert='$d_Gconvert'
24209 d_PRIEUldbl='$d_PRIEUldbl'
24210 d_PRIFUldbl='$d_PRIFUldbl'
24211 d_PRIGUldbl='$d_PRIGUldbl'
24212 d_PRIXU64='$d_PRIXU64'
24213 d_PRId64='$d_PRId64'
24214 d_PRIeldbl='$d_PRIeldbl'
24215 d_PRIfldbl='$d_PRIfldbl'
24216 d_PRIgldbl='$d_PRIgldbl'
24217 d_PRIi64='$d_PRIi64'
24218 d_PRIo64='$d_PRIo64'
24219 d_PRIu64='$d_PRIu64'
24220 d_PRIx64='$d_PRIx64'
24221 d_SCNfldbl='$d_SCNfldbl'
24222 d__fwalk='$d__fwalk'
24223 d_access='$d_access'
24224 d_accessx='$d_accessx'
24225 d_acosh='$d_acosh'
24226 d_aintl='$d_aintl'
24227 d_alarm='$d_alarm'
24228 d_archlib='$d_archlib'
24229 d_asctime64='$d_asctime64'
24230 d_asctime_r='$d_asctime_r'
24231 d_asinh='$d_asinh'
24232 d_atanh='$d_atanh'
24233 d_atolf='$d_atolf'
24234 d_atoll='$d_atoll'
24235 d_attribute_deprecated='$d_attribute_deprecated'
24236 d_attribute_format='$d_attribute_format'
24237 d_attribute_malloc='$d_attribute_malloc'
24238 d_attribute_nonnull='$d_attribute_nonnull'
24239 d_attribute_noreturn='$d_attribute_noreturn'
24240 d_attribute_pure='$d_attribute_pure'
24241 d_attribute_unused='$d_attribute_unused'
24242 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24243 d_backtrace='$d_backtrace'
24244 d_bcmp='$d_bcmp'
24245 d_bcopy='$d_bcopy'
24246 d_bsd='$d_bsd'
24247 d_bsdgetpgrp='$d_bsdgetpgrp'
24248 d_bsdsetpgrp='$d_bsdsetpgrp'
24249 d_builtin_choose_expr='$d_builtin_choose_expr'
24250 d_builtin_expect='$d_builtin_expect'
24251 d_bzero='$d_bzero'
24252 d_c99_variadic_macros='$d_c99_variadic_macros'
24253 d_casti32='$d_casti32'
24254 d_castneg='$d_castneg'
24255 d_cbrt='$d_cbrt'
24256 d_charvspr='$d_charvspr'
24257 d_chown='$d_chown'
24258 d_chroot='$d_chroot'
24259 d_chsize='$d_chsize'
24260 d_class='$d_class'
24261 d_clearenv='$d_clearenv'
24262 d_closedir='$d_closedir'
24263 d_cmsghdr_s='$d_cmsghdr_s'
24264 d_const='$d_const'
24265 d_copysign='$d_copysign'
24266 d_copysignl='$d_copysignl'
24267 d_cplusplus='$d_cplusplus'
24268 d_crypt='$d_crypt'
24269 d_crypt_r='$d_crypt_r'
24270 d_csh='$d_csh'
24271 d_ctermid='$d_ctermid'
24272 d_ctermid_r='$d_ctermid_r'
24273 d_ctime64='$d_ctime64'
24274 d_ctime_r='$d_ctime_r'
24275 d_cuserid='$d_cuserid'
24276 d_dbl_dig='$d_dbl_dig'
24277 d_dbminitproto='$d_dbminitproto'
24278 d_difftime64='$d_difftime64'
24279 d_difftime='$d_difftime'
24280 d_dir_dd_fd='$d_dir_dd_fd'
24281 d_dirfd='$d_dirfd'
24282 d_dirnamlen='$d_dirnamlen'
24283 d_dladdr='$d_dladdr'
24284 d_dlerror='$d_dlerror'
24285 d_dlopen='$d_dlopen'
24286 d_dlsymun='$d_dlsymun'
24287 d_dosuid='$d_dosuid'
24288 d_drand48_r='$d_drand48_r'
24289 d_drand48proto='$d_drand48proto'
24290 d_dup2='$d_dup2'
24291 d_eaccess='$d_eaccess'
24292 d_endgrent='$d_endgrent'
24293 d_endgrent_r='$d_endgrent_r'
24294 d_endhent='$d_endhent'
24295 d_endhostent_r='$d_endhostent_r'
24296 d_endnent='$d_endnent'
24297 d_endnetent_r='$d_endnetent_r'
24298 d_endpent='$d_endpent'
24299 d_endprotoent_r='$d_endprotoent_r'
24300 d_endpwent='$d_endpwent'
24301 d_endpwent_r='$d_endpwent_r'
24302 d_endsent='$d_endsent'
24303 d_endservent_r='$d_endservent_r'
24304 d_eofnblk='$d_eofnblk'
24305 d_erf='$d_erf'
24306 d_erfc='$d_erfc'
24307 d_eunice='$d_eunice'
24308 d_exp2='$d_exp2'
24309 d_expm1='$d_expm1'
24310 d_faststdio='$d_faststdio'
24311 d_fchdir='$d_fchdir'
24312 d_fchmod='$d_fchmod'
24313 d_fchown='$d_fchown'
24314 d_fcntl='$d_fcntl'
24315 d_fcntl_can_lock='$d_fcntl_can_lock'
24316 d_fd_macros='$d_fd_macros'
24317 d_fd_set='$d_fd_set'
24318 d_fdclose='$d_fdclose'
24319 d_fdim='$d_fdim'
24320 d_fds_bits='$d_fds_bits'
24321 d_fegetround='$d_fegetround'
24322 d_fgetpos='$d_fgetpos'
24323 d_finite='$d_finite'
24324 d_finitel='$d_finitel'
24325 d_flexfnam='$d_flexfnam'
24326 d_flock='$d_flock'
24327 d_flockproto='$d_flockproto'
24328 d_fma='$d_fma'
24329 d_fmax='$d_fmax'
24330 d_fmin='$d_fmin'
24331 d_fork='$d_fork'
24332 d_fp_class='$d_fp_class'
24333 d_fp_classify='$d_fp_classify'
24334 d_fp_classl='$d_fp_classl'
24335 d_fpathconf='$d_fpathconf'
24336 d_fpclass='$d_fpclass'
24337 d_fpclassify='$d_fpclassify'
24338 d_fpclassl='$d_fpclassl'
24339 d_fpgetround='$d_fpgetround'
24340 d_fpos64_t='$d_fpos64_t'
24341 d_frexpl='$d_frexpl'
24342 d_fs_data_s='$d_fs_data_s'
24343 d_fseeko='$d_fseeko'
24344 d_fsetpos='$d_fsetpos'
24345 d_fstatfs='$d_fstatfs'
24346 d_fstatvfs='$d_fstatvfs'
24347 d_fsync='$d_fsync'
24348 d_ftello='$d_ftello'
24349 d_ftime='$d_ftime'
24350 d_futimes='$d_futimes'
24351 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24352 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24353 d_getaddrinfo='$d_getaddrinfo'
24354 d_getcwd='$d_getcwd'
24355 d_getespwnam='$d_getespwnam'
24356 d_getfsstat='$d_getfsstat'
24357 d_getgrent='$d_getgrent'
24358 d_getgrent_r='$d_getgrent_r'
24359 d_getgrgid_r='$d_getgrgid_r'
24360 d_getgrnam_r='$d_getgrnam_r'
24361 d_getgrps='$d_getgrps'
24362 d_gethbyaddr='$d_gethbyaddr'
24363 d_gethbyname='$d_gethbyname'
24364 d_gethent='$d_gethent'
24365 d_gethname='$d_gethname'
24366 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24367 d_gethostbyname_r='$d_gethostbyname_r'
24368 d_gethostent_r='$d_gethostent_r'
24369 d_gethostprotos='$d_gethostprotos'
24370 d_getitimer='$d_getitimer'
24371 d_getlogin='$d_getlogin'
24372 d_getlogin_r='$d_getlogin_r'
24373 d_getmnt='$d_getmnt'
24374 d_getmntent='$d_getmntent'
24375 d_getnameinfo='$d_getnameinfo'
24376 d_getnbyaddr='$d_getnbyaddr'
24377 d_getnbyname='$d_getnbyname'
24378 d_getnent='$d_getnent'
24379 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24380 d_getnetbyname_r='$d_getnetbyname_r'
24381 d_getnetent_r='$d_getnetent_r'
24382 d_getnetprotos='$d_getnetprotos'
24383 d_getpagsz='$d_getpagsz'
24384 d_getpbyname='$d_getpbyname'
24385 d_getpbynumber='$d_getpbynumber'
24386 d_getpent='$d_getpent'
24387 d_getpgid='$d_getpgid'
24388 d_getpgrp2='$d_getpgrp2'
24389 d_getpgrp='$d_getpgrp'
24390 d_getppid='$d_getppid'
24391 d_getprior='$d_getprior'
24392 d_getprotobyname_r='$d_getprotobyname_r'
24393 d_getprotobynumber_r='$d_getprotobynumber_r'
24394 d_getprotoent_r='$d_getprotoent_r'
24395 d_getprotoprotos='$d_getprotoprotos'
24396 d_getprpwnam='$d_getprpwnam'
24397 d_getpwent='$d_getpwent'
24398 d_getpwent_r='$d_getpwent_r'
24399 d_getpwnam_r='$d_getpwnam_r'
24400 d_getpwuid_r='$d_getpwuid_r'
24401 d_getsbyname='$d_getsbyname'
24402 d_getsbyport='$d_getsbyport'
24403 d_getsent='$d_getsent'
24404 d_getservbyname_r='$d_getservbyname_r'
24405 d_getservbyport_r='$d_getservbyport_r'
24406 d_getservent_r='$d_getservent_r'
24407 d_getservprotos='$d_getservprotos'
24408 d_getspnam='$d_getspnam'
24409 d_getspnam_r='$d_getspnam_r'
24410 d_gettimeod='$d_gettimeod'
24411 d_gmtime64='$d_gmtime64'
24412 d_gmtime_r='$d_gmtime_r'
24413 d_gnulibc='$d_gnulibc'
24414 d_grpasswd='$d_grpasswd'
24415 d_hasmntopt='$d_hasmntopt'
24416 d_htonl='$d_htonl'
24417 d_hypot='$d_hypot'
24418 d_ilogb='$d_ilogb'
24419 d_ilogbl='$d_ilogbl'
24420 d_inc_version_list='$d_inc_version_list'
24421 d_index='$d_index'
24422 d_inetaton='$d_inetaton'
24423 d_inetntop='$d_inetntop'
24424 d_inetpton='$d_inetpton'
24425 d_int64_t='$d_int64_t'
24426 d_ip_mreq='$d_ip_mreq'
24427 d_ip_mreq_source='$d_ip_mreq_source'
24428 d_ipv6_mreq='$d_ipv6_mreq'
24429 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24430 d_isascii='$d_isascii'
24431 d_isblank='$d_isblank'
24432 d_isfinite='$d_isfinite'
24433 d_isfinitel='$d_isfinitel'
24434 d_isinf='$d_isinf'
24435 d_isinfl='$d_isinfl'
24436 d_isless='$d_isless'
24437 d_isnan='$d_isnan'
24438 d_isnanl='$d_isnanl'
24439 d_isnormal='$d_isnormal'
24440 d_j0='$d_j0'
24441 d_j0l='$d_j0l'
24442 d_killpg='$d_killpg'
24443 d_lc_monetary_2008='$d_lc_monetary_2008'
24444 d_lchown='$d_lchown'
24445 d_ldbl_dig='$d_ldbl_dig'
24446 d_ldexpl='$d_ldexpl'
24447 d_lgamma='$d_lgamma'
24448 d_lgamma_r='$d_lgamma_r'
24449 d_libm_lib_version='$d_libm_lib_version'
24450 d_libname_unique='$d_libname_unique'
24451 d_link='$d_link'
24452 d_llrint='$d_llrint'
24453 d_llrintl='$d_llrintl'
24454 d_llround='$d_llround'
24455 d_llroundl='$d_llroundl'
24456 d_localtime64='$d_localtime64'
24457 d_localtime_r='$d_localtime_r'
24458 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24459 d_locconv='$d_locconv'
24460 d_lockf='$d_lockf'
24461 d_log1p='$d_log1p'
24462 d_log2='$d_log2'
24463 d_logb='$d_logb'
24464 d_longdbl='$d_longdbl'
24465 d_longlong='$d_longlong'
24466 d_lrint='$d_lrint'
24467 d_lrintl='$d_lrintl'
24468 d_lround='$d_lround'
24469 d_lroundl='$d_lroundl'
24470 d_lseekproto='$d_lseekproto'
24471 d_lstat='$d_lstat'
24472 d_madvise='$d_madvise'
24473 d_malloc_good_size='$d_malloc_good_size'
24474 d_malloc_size='$d_malloc_size'
24475 d_mblen='$d_mblen'
24476 d_mbstowcs='$d_mbstowcs'
24477 d_mbtowc='$d_mbtowc'
24478 d_memchr='$d_memchr'
24479 d_memcmp='$d_memcmp'
24480 d_memcpy='$d_memcpy'
24481 d_memmove='$d_memmove'
24482 d_memset='$d_memset'
24483 d_mkdir='$d_mkdir'
24484 d_mkdtemp='$d_mkdtemp'
24485 d_mkfifo='$d_mkfifo'
24486 d_mkstemp='$d_mkstemp'
24487 d_mkstemps='$d_mkstemps'
24488 d_mktime64='$d_mktime64'
24489 d_mktime='$d_mktime'
24490 d_mmap='$d_mmap'
24491 d_modfl='$d_modfl'
24492 d_modfl_pow32_bug='$d_modfl_pow32_bug'
24493 d_modflproto='$d_modflproto'
24494 d_mprotect='$d_mprotect'
24495 d_msg='$d_msg'
24496 d_msg_ctrunc='$d_msg_ctrunc'
24497 d_msg_dontroute='$d_msg_dontroute'
24498 d_msg_oob='$d_msg_oob'
24499 d_msg_peek='$d_msg_peek'
24500 d_msg_proxy='$d_msg_proxy'
24501 d_msgctl='$d_msgctl'
24502 d_msgget='$d_msgget'
24503 d_msghdr_s='$d_msghdr_s'
24504 d_msgrcv='$d_msgrcv'
24505 d_msgsnd='$d_msgsnd'
24506 d_msync='$d_msync'
24507 d_munmap='$d_munmap'
24508 d_mymalloc='$d_mymalloc'
24509 d_nan='$d_nan'
24510 d_ndbm='$d_ndbm'
24511 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24512 d_nearbyint='$d_nearbyint'
24513 d_nextafter='$d_nextafter'
24514 d_nexttoward='$d_nexttoward'
24515 d_nice='$d_nice'
24516 d_nl_langinfo='$d_nl_langinfo'
24517 d_nv_preserves_uv='$d_nv_preserves_uv'
24518 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24519 d_off64_t='$d_off64_t'
24520 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24521 d_oldpthreads='$d_oldpthreads'
24522 d_oldsock='$d_oldsock'
24523 d_open3='$d_open3'
24524 d_pathconf='$d_pathconf'
24525 d_pause='$d_pause'
24526 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24527 d_phostname='$d_phostname'
24528 d_pipe='$d_pipe'
24529 d_poll='$d_poll'
24530 d_portable='$d_portable'
24531 d_prctl='$d_prctl'
24532 d_prctl_set_name='$d_prctl_set_name'
24533 d_printf_format_null='$d_printf_format_null'
24534 d_procselfexe='$d_procselfexe'
24535 d_pseudofork='$d_pseudofork'
24536 d_pthread_atfork='$d_pthread_atfork'
24537 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24538 d_pthread_yield='$d_pthread_yield'
24539 d_ptrdiff_t='$d_ptrdiff_t'
24540 d_pwage='$d_pwage'
24541 d_pwchange='$d_pwchange'
24542 d_pwclass='$d_pwclass'
24543 d_pwcomment='$d_pwcomment'
24544 d_pwexpire='$d_pwexpire'
24545 d_pwgecos='$d_pwgecos'
24546 d_pwpasswd='$d_pwpasswd'
24547 d_pwquota='$d_pwquota'
24548 d_qgcvt='$d_qgcvt'
24549 d_quad='$d_quad'
24550 d_random_r='$d_random_r'
24551 d_re_comp='$d_re_comp'
24552 d_readdir64_r='$d_readdir64_r'
24553 d_readdir='$d_readdir'
24554 d_readdir_r='$d_readdir_r'
24555 d_readlink='$d_readlink'
24556 d_readv='$d_readv'
24557 d_recvmsg='$d_recvmsg'
24558 d_regcmp='$d_regcmp'
24559 d_regcomp='$d_regcomp'
24560 d_remainder='$d_remainder'
24561 d_remquo='$d_remquo'
24562 d_rename='$d_rename'
24563 d_rewinddir='$d_rewinddir'
24564 d_rint='$d_rint'
24565 d_rmdir='$d_rmdir'
24566 d_round='$d_round'
24567 d_safebcpy='$d_safebcpy'
24568 d_safemcpy='$d_safemcpy'
24569 d_sanemcmp='$d_sanemcmp'
24570 d_sbrkproto='$d_sbrkproto'
24571 d_scalbn='$d_scalbn'
24572 d_scalbnl='$d_scalbnl'
24573 d_sched_yield='$d_sched_yield'
24574 d_scm_rights='$d_scm_rights'
24575 d_seekdir='$d_seekdir'
24576 d_select='$d_select'
24577 d_sem='$d_sem'
24578 d_semctl='$d_semctl'
24579 d_semctl_semid_ds='$d_semctl_semid_ds'
24580 d_semctl_semun='$d_semctl_semun'
24581 d_semget='$d_semget'
24582 d_semop='$d_semop'
24583 d_sendmsg='$d_sendmsg'
24584 d_setegid='$d_setegid'
24585 d_seteuid='$d_seteuid'
24586 d_setgrent='$d_setgrent'
24587 d_setgrent_r='$d_setgrent_r'
24588 d_setgrps='$d_setgrps'
24589 d_sethent='$d_sethent'
24590 d_sethostent_r='$d_sethostent_r'
24591 d_setitimer='$d_setitimer'
24592 d_setlinebuf='$d_setlinebuf'
24593 d_setlocale='$d_setlocale'
24594 d_setlocale_r='$d_setlocale_r'
24595 d_setnent='$d_setnent'
24596 d_setnetent_r='$d_setnetent_r'
24597 d_setpent='$d_setpent'
24598 d_setpgid='$d_setpgid'
24599 d_setpgrp2='$d_setpgrp2'
24600 d_setpgrp='$d_setpgrp'
24601 d_setprior='$d_setprior'
24602 d_setproctitle='$d_setproctitle'
24603 d_setprotoent_r='$d_setprotoent_r'
24604 d_setpwent='$d_setpwent'
24605 d_setpwent_r='$d_setpwent_r'
24606 d_setregid='$d_setregid'
24607 d_setresgid='$d_setresgid'
24608 d_setresuid='$d_setresuid'
24609 d_setreuid='$d_setreuid'
24610 d_setrgid='$d_setrgid'
24611 d_setruid='$d_setruid'
24612 d_setsent='$d_setsent'
24613 d_setservent_r='$d_setservent_r'
24614 d_setsid='$d_setsid'
24615 d_setvbuf='$d_setvbuf'
24616 d_shm='$d_shm'
24617 d_shmat='$d_shmat'
24618 d_shmatprototype='$d_shmatprototype'
24619 d_shmctl='$d_shmctl'
24620 d_shmdt='$d_shmdt'
24621 d_shmget='$d_shmget'
24622 d_sigaction='$d_sigaction'
24623 d_siginfo_si_errno='$d_siginfo_si_errno'
24624 d_siginfo_si_pid='$d_siginfo_si_pid'
24625 d_siginfo_si_uid='$d_siginfo_si_uid'
24626 d_siginfo_si_addr='$d_siginfo_si_addr'
24627 d_siginfo_si_status='$d_siginfo_si_status'
24628 d_siginfo_si_band='$d_siginfo_si_band'
24629 d_siginfo_si_value='$d_siginfo_si_value'
24630 d_signbit='$d_signbit'
24631 d_sigprocmask='$d_sigprocmask'
24632 d_sigsetjmp='$d_sigsetjmp'
24633 d_sin6_scope_id='$d_sin6_scope_id'
24634 d_sitearch='$d_sitearch'
24635 d_snprintf='$d_snprintf'
24636 d_sockaddr_in6='$d_sockaddr_in6'
24637 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24638 d_sockatmark='$d_sockatmark'
24639 d_sockatmarkproto='$d_sockatmarkproto'
24640 d_socket='$d_socket'
24641 d_socklen_t='$d_socklen_t'
24642 d_sockpair='$d_sockpair'
24643 d_socks5_init='$d_socks5_init'
24644 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24645 d_sqrtl='$d_sqrtl'
24646 d_srand48_r='$d_srand48_r'
24647 d_srandom_r='$d_srandom_r'
24648 d_sresgproto='$d_sresgproto'
24649 d_sresuproto='$d_sresuproto'
24650 d_stat='$d_stat'
24651 d_statblks='$d_statblks'
24652 d_statfs_f_flags='$d_statfs_f_flags'
24653 d_statfs_s='$d_statfs_s'
24654 d_static_inline='$d_static_inline'
24655 d_statvfs='$d_statvfs'
24656 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24657 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24658 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24659 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24660 d_stdio_stream_array='$d_stdio_stream_array'
24661 d_stdiobase='$d_stdiobase'
24662 d_stdstdio='$d_stdstdio'
24663 d_strchr='$d_strchr'
24664 d_strcoll='$d_strcoll'
24665 d_strctcpy='$d_strctcpy'
24666 d_strerrm='$d_strerrm'
24667 d_strerror='$d_strerror'
24668 d_strerror_r='$d_strerror_r'
24669 d_strftime='$d_strftime'
24670 d_strlcat='$d_strlcat'
24671 d_strlcpy='$d_strlcpy'
24672 d_strtod='$d_strtod'
24673 d_strtol='$d_strtol'
24674 d_strtold='$d_strtold'
24675 d_strtoll='$d_strtoll'
24676 d_strtoq='$d_strtoq'
24677 d_strtoul='$d_strtoul'
24678 d_strtoull='$d_strtoull'
24679 d_strtouq='$d_strtouq'
24680 d_strxfrm='$d_strxfrm'
24681 d_suidsafe='$d_suidsafe'
24682 d_symlink='$d_symlink'
24683 d_syscall='$d_syscall'
24684 d_syscallproto='$d_syscallproto'
24685 d_sysconf='$d_sysconf'
24686 d_sysernlst='$d_sysernlst'
24687 d_syserrlst='$d_syserrlst'
24688 d_system='$d_system'
24689 d_tcgetpgrp='$d_tcgetpgrp'
24690 d_tcsetpgrp='$d_tcsetpgrp'
24691 d_telldir='$d_telldir'
24692 d_telldirproto='$d_telldirproto'
24693 d_tgamma='$d_tgamma'
24694 d_time='$d_time'
24695 d_timegm='$d_timegm'
24696 d_times='$d_times'
24697 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24698 d_tm_tm_zone='$d_tm_tm_zone'
24699 d_tmpnam_r='$d_tmpnam_r'
24700 d_trunc='$d_trunc'
24701 d_truncate='$d_truncate'
24702 d_truncl='$d_truncl'
24703 d_ttyname_r='$d_ttyname_r'
24704 d_tzname='$d_tzname'
24705 d_u32align='$d_u32align'
24706 d_ualarm='$d_ualarm'
24707 d_umask='$d_umask'
24708 d_uname='$d_uname'
24709 d_union_semun='$d_union_semun'
24710 d_unordered='$d_unordered'
24711 d_unsetenv='$d_unsetenv'
24712 d_usleep='$d_usleep'
24713 d_usleepproto='$d_usleepproto'
24714 d_ustat='$d_ustat'
24715 d_vendorarch='$d_vendorarch'
24716 d_vendorbin='$d_vendorbin'
24717 d_vendorlib='$d_vendorlib'
24718 d_vendorscript='$d_vendorscript'
24719 d_vfork='$d_vfork'
24720 d_void_closedir='$d_void_closedir'
24721 d_voidsig='$d_voidsig'
24722 d_voidtty='$d_voidtty'
24723 d_volatile='$d_volatile'
24724 d_vprintf='$d_vprintf'
24725 d_vsnprintf='$d_vsnprintf'
24726 d_wait4='$d_wait4'
24727 d_waitpid='$d_waitpid'
24728 d_wcscmp='$d_wcscmp'
24729 d_wcstombs='$d_wcstombs'
24730 d_wcsxfrm='$d_wcsxfrm'
24731 d_wctomb='$d_wctomb'
24732 d_writev='$d_writev'
24733 d_xenix='$d_xenix'
24734 date='$date'
24735 db_hashtype='$db_hashtype'
24736 db_prefixtype='$db_prefixtype'
24737 db_version_major='$db_version_major'
24738 db_version_minor='$db_version_minor'
24739 db_version_patch='$db_version_patch'
24740 direntrytype='$direntrytype'
24741 dlext='$dlext'
24742 dlsrc='$dlsrc'
24743 doubleinfbytes='$doubleinfbytes'
24744 doublekind='$doublekind'
24745 doublemantbits='$doublemantbits'
24746 doublenanbytes='$doublenanbytes'
24747 doublesize='$doublesize'
24748 drand01='$drand01'
24749 drand48_r_proto='$drand48_r_proto'
24750 dtrace='$dtrace'
24751 dtraceobject='$dtraceobject'
24752 dynamic_ext='$dynamic_ext'
24753 eagain='$eagain'
24754 ebcdic='$ebcdic'
24755 echo='$echo'
24756 egrep='$egrep'
24757 emacs='$emacs'
24758 endgrent_r_proto='$endgrent_r_proto'
24759 endhostent_r_proto='$endhostent_r_proto'
24760 endnetent_r_proto='$endnetent_r_proto'
24761 endprotoent_r_proto='$endprotoent_r_proto'
24762 endpwent_r_proto='$endpwent_r_proto'
24763 endservent_r_proto='$endservent_r_proto'
24764 eunicefix='$eunicefix'
24765 exe_ext='$exe_ext'
24766 expr='$expr'
24767 extensions='$extensions'
24768 extern_C='$extern_C'
24769 extras='$extras'
24770 fflushNULL='$fflushNULL'
24771 fflushall='$fflushall'
24772 find='$find'
24773 firstmakefile='$firstmakefile'
24774 flex='$flex'
24775 fpossize='$fpossize'
24776 fpostype='$fpostype'
24777 freetype='$freetype'
24778 from='$from'
24779 full_ar='$full_ar'
24780 full_csh='$full_csh'
24781 full_sed='$full_sed'
24782 gccansipedantic='$gccansipedantic'
24783 gccosandvers='$gccosandvers'
24784 gccversion='$gccversion'
24785 getgrent_r_proto='$getgrent_r_proto'
24786 getgrgid_r_proto='$getgrgid_r_proto'
24787 getgrnam_r_proto='$getgrnam_r_proto'
24788 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24789 gethostbyname_r_proto='$gethostbyname_r_proto'
24790 gethostent_r_proto='$gethostent_r_proto'
24791 getlogin_r_proto='$getlogin_r_proto'
24792 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24793 getnetbyname_r_proto='$getnetbyname_r_proto'
24794 getnetent_r_proto='$getnetent_r_proto'
24795 getprotobyname_r_proto='$getprotobyname_r_proto'
24796 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24797 getprotoent_r_proto='$getprotoent_r_proto'
24798 getpwent_r_proto='$getpwent_r_proto'
24799 getpwnam_r_proto='$getpwnam_r_proto'
24800 getpwuid_r_proto='$getpwuid_r_proto'
24801 getservbyname_r_proto='$getservbyname_r_proto'
24802 getservbyport_r_proto='$getservbyport_r_proto'
24803 getservent_r_proto='$getservent_r_proto'
24804 getspnam_r_proto='$getspnam_r_proto'
24805 gidformat='$gidformat'
24806 gidsign='$gidsign'
24807 gidsize='$gidsize'
24808 gidtype='$gidtype'
24809 glibpth='$glibpth'
24810 gmake='$gmake'
24811 gmtime_r_proto='$gmtime_r_proto'
24812 gnulibc_version='$gnulibc_version'
24813 grep='$grep'
24814 groupcat='$groupcat'
24815 groupstype='$groupstype'
24816 gzip='$gzip'
24817 h_fcntl='$h_fcntl'
24818 h_sysfile='$h_sysfile'
24819 hint='$hint'
24820 hostcat='$hostcat'
24821 hostgenerate='$hostgenerate'
24822 hostosname='$hostosname'
24823 hostperl='$hostperl'
24824 html1dir='$html1dir'
24825 html1direxp='$html1direxp'
24826 html3dir='$html3dir'
24827 html3direxp='$html3direxp'
24828 i16size='$i16size'
24829 i16type='$i16type'
24830 i32size='$i32size'
24831 i32type='$i32type'
24832 i64size='$i64size'
24833 i64type='$i64type'
24834 i8size='$i8size'
24835 i8type='$i8type'
24836 i_arpainet='$i_arpainet'
24837 i_assert='$i_assert'
24838 i_bfd='$i_bfd'
24839 i_bsdioctl='$i_bsdioctl'
24840 i_crypt='$i_crypt'
24841 i_db='$i_db'
24842 i_dbm='$i_dbm'
24843 i_dirent='$i_dirent'
24844 i_dlfcn='$i_dlfcn'
24845 i_execinfo='$i_execinfo'
24846 i_fcntl='$i_fcntl'
24847 i_fenv='$i_fenv'
24848 i_float='$i_float'
24849 i_fp='$i_fp'
24850 i_fp_class='$i_fp_class'
24851 i_gdbm='$i_gdbm'
24852 i_gdbm_ndbm='$i_gdbm_ndbm'
24853 i_gdbmndbm='$i_gdbmndbm'
24854 i_grp='$i_grp'
24855 i_ieeefp='$i_ieeefp'
24856 i_inttypes='$i_inttypes'
24857 i_langinfo='$i_langinfo'
24858 i_libutil='$i_libutil'
24859 i_limits='$i_limits'
24860 i_locale='$i_locale'
24861 i_machcthr='$i_machcthr'
24862 i_malloc='$i_malloc'
24863 i_mallocmalloc='$i_mallocmalloc'
24864 i_math='$i_math'
24865 i_memory='$i_memory'
24866 i_mntent='$i_mntent'
24867 i_ndbm='$i_ndbm'
24868 i_netdb='$i_netdb'
24869 i_neterrno='$i_neterrno'
24870 i_netinettcp='$i_netinettcp'
24871 i_niin='$i_niin'
24872 i_poll='$i_poll'
24873 i_prot='$i_prot'
24874 i_pthread='$i_pthread'
24875 i_pwd='$i_pwd'
24876 i_quadmath='$i_quadmath'
24877 i_rpcsvcdbm='$i_rpcsvcdbm'
24878 i_sgtty='$i_sgtty'
24879 i_shadow='$i_shadow'
24880 i_socks='$i_socks'
24881 i_stdarg='$i_stdarg'
24882 i_stdbool='$i_stdbool'
24883 i_stddef='$i_stddef'
24884 i_stdint='$i_stdint'
24885 i_stdlib='$i_stdlib'
24886 i_string='$i_string'
24887 i_sunmath='$i_sunmath'
24888 i_sysaccess='$i_sysaccess'
24889 i_sysdir='$i_sysdir'
24890 i_sysfile='$i_sysfile'
24891 i_sysfilio='$i_sysfilio'
24892 i_sysin='$i_sysin'
24893 i_sysioctl='$i_sysioctl'
24894 i_syslog='$i_syslog'
24895 i_sysmman='$i_sysmman'
24896 i_sysmode='$i_sysmode'
24897 i_sysmount='$i_sysmount'
24898 i_sysndir='$i_sysndir'
24899 i_sysparam='$i_sysparam'
24900 i_syspoll='$i_syspoll'
24901 i_sysresrc='$i_sysresrc'
24902 i_syssecrt='$i_syssecrt'
24903 i_sysselct='$i_sysselct'
24904 i_syssockio='$i_syssockio'
24905 i_sysstat='$i_sysstat'
24906 i_sysstatfs='$i_sysstatfs'
24907 i_sysstatvfs='$i_sysstatvfs'
24908 i_systime='$i_systime'
24909 i_systimek='$i_systimek'
24910 i_systimes='$i_systimes'
24911 i_systypes='$i_systypes'
24912 i_sysuio='$i_sysuio'
24913 i_sysun='$i_sysun'
24914 i_sysutsname='$i_sysutsname'
24915 i_sysvfs='$i_sysvfs'
24916 i_syswait='$i_syswait'
24917 i_termio='$i_termio'
24918 i_termios='$i_termios'
24919 i_time='$i_time'
24920 i_unistd='$i_unistd'
24921 i_ustat='$i_ustat'
24922 i_utime='$i_utime'
24923 i_values='$i_values'
24924 i_varargs='$i_varargs'
24925 i_varhdr='$i_varhdr'
24926 i_vfork='$i_vfork'
24927 ignore_versioned_solibs='$ignore_versioned_solibs'
24928 inc_version_list='$inc_version_list'
24929 inc_version_list_init='$inc_version_list_init'
24930 incpath='$incpath'
24931 incpth='$incpth'
24932 inews='$inews'
24933 initialinstalllocation='$initialinstalllocation'
24934 installarchlib='$installarchlib'
24935 installbin='$installbin'
24936 installhtml1dir='$installhtml1dir'
24937 installhtml3dir='$installhtml3dir'
24938 installman1dir='$installman1dir'
24939 installman3dir='$installman3dir'
24940 installprefix='$installprefix'
24941 installprefixexp='$installprefixexp'
24942 installprivlib='$installprivlib'
24943 installscript='$installscript'
24944 installsitearch='$installsitearch'
24945 installsitebin='$installsitebin'
24946 installsitehtml1dir='$installsitehtml1dir'
24947 installsitehtml3dir='$installsitehtml3dir'
24948 installsitelib='$installsitelib'
24949 installsiteman1dir='$installsiteman1dir'
24950 installsiteman3dir='$installsiteman3dir'
24951 installsitescript='$installsitescript'
24952 installstyle='$installstyle'
24953 installusrbinperl='$installusrbinperl'
24954 installvendorarch='$installvendorarch'
24955 installvendorbin='$installvendorbin'
24956 installvendorhtml1dir='$installvendorhtml1dir'
24957 installvendorhtml3dir='$installvendorhtml3dir'
24958 installvendorlib='$installvendorlib'
24959 installvendorman1dir='$installvendorman1dir'
24960 installvendorman3dir='$installvendorman3dir'
24961 installvendorscript='$installvendorscript'
24962 intsize='$intsize'
24963 issymlink='$issymlink'
24964 ivdformat='$ivdformat'
24965 ivsize='$ivsize'
24966 ivtype='$ivtype'
24967 known_extensions='$known_extensions'
24968 ksh='$ksh'
24969 ld='$ld'
24970 ld_can_script='$ld_can_script'
24971 lddlflags='$lddlflags'
24972 ldflags='$ldflags'
24973 ldflags_uselargefiles='$ldflags_uselargefiles'
24974 ldlibpthname='$ldlibpthname'
24975 less='$less'
24976 lib_ext='$lib_ext'
24977 libc='$libc'
24978 libperl='$libperl'
24979 libpth='$libpth'
24980 libs='$libs'
24981 libsdirs='$libsdirs'
24982 libsfiles='$libsfiles'
24983 libsfound='$libsfound'
24984 libspath='$libspath'
24985 libswanted='$libswanted'
24986 libswanted_uselargefiles='$libswanted_uselargefiles'
24987 line='$line'
24988 lint='$lint'
24989 lkflags='$lkflags'
24990 ln='$ln'
24991 lns='$lns'
24992 localtime_r_proto='$localtime_r_proto'
24993 locincpth='$locincpth'
24994 loclibpth='$loclibpth'
24995 longdblinfbytes='$longdblinfbytes'
24996 longdblkind='$longdblkind'
24997 longdblmantbits='$longdblmantbits'
24998 longdblnanbytes='$longdblnanbytes'
24999 longdblsize='$longdblsize'
25000 longlongsize='$longlongsize'
25001 longsize='$longsize'
25002 lp='$lp'
25003 lpr='$lpr'
25004 ls='$ls'
25005 lseeksize='$lseeksize'
25006 lseektype='$lseektype'
25007 mail='$mail'
25008 mailx='$mailx'
25009 make='$make'
25010 make_set_make='$make_set_make'
25011 mallocobj='$mallocobj'
25012 mallocsrc='$mallocsrc'
25013 malloctype='$malloctype'
25014 man1dir='$man1dir'
25015 man1direxp='$man1direxp'
25016 man1ext='$man1ext'
25017 man3dir='$man3dir'
25018 man3direxp='$man3direxp'
25019 man3ext='$man3ext'
25020 mips_type='$mips_type'
25021 mistrustnm='$mistrustnm'
25022 mkdir='$mkdir'
25023 mmaptype='$mmaptype'
25024 modetype='$modetype'
25025 more='$more'
25026 multiarch='$multiarch'
25027 mv='$mv'
25028 myarchname='$myarchname'
25029 mydomain='$mydomain'
25030 myhostname='$myhostname'
25031 myuname='$myuname'
25032 n='$n'
25033 need_va_copy='$need_va_copy'
25034 netdb_hlen_type='$netdb_hlen_type'
25035 netdb_host_type='$netdb_host_type'
25036 netdb_name_type='$netdb_name_type'
25037 netdb_net_type='$netdb_net_type'
25038 nm='$nm'
25039 nm_opt='$nm_opt'
25040 nm_so_opt='$nm_so_opt'
25041 nonxs_ext='$nonxs_ext'
25042 nroff='$nroff'
25043 nvEUformat='$nvEUformat'
25044 nvFUformat='$nvFUformat'
25045 nvGUformat='$nvGUformat'
25046 nv_overflows_integers_at='$nv_overflows_integers_at'
25047 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25048 nveformat='$nveformat'
25049 nvfformat='$nvfformat'
25050 nvgformat='$nvgformat'
25051 nvmantbits='$nvmantbits'
25052 nvsize='$nvsize'
25053 nvtype='$nvtype'
25054 o_nonblock='$o_nonblock'
25055 obj_ext='$obj_ext'
25056 old_pthread_create_joinable='$old_pthread_create_joinable'
25057 optimize='$optimize'
25058 orderlib='$orderlib'
25059 osname='$osname'
25060 osvers='$osvers'
25061 otherlibdirs='$otherlibdirs'
25062 package='$package'
25063 pager='$pager'
25064 passcat='$passcat'
25065 patchlevel='$patchlevel'
25066 path_sep='$path_sep'
25067 perl5='$perl5'
25068 perl='$perl'
25069 perl_patchlevel='$perl_patchlevel'
25070 perl_static_inline='$perl_static_inline'
25071 perladmin='$perladmin'
25072 perllibs='$perllibs'
25073 perlpath='$perlpath'
25074 pg='$pg'
25075 phostname='$phostname'
25076 pidtype='$pidtype'
25077 plibpth='$plibpth'
25078 pmake='$pmake'
25079 pr='$pr'
25080 prefix='$prefix'
25081 prefixexp='$prefixexp'
25082 privlib='$privlib'
25083 privlibexp='$privlibexp'
25084 procselfexe='$procselfexe'
25085 prototype='$prototype'
25086 ptrsize='$ptrsize'
25087 quadkind='$quadkind'
25088 quadtype='$quadtype'
25089 randbits='$randbits'
25090 randfunc='$randfunc'
25091 random_r_proto='$random_r_proto'
25092 randseedtype='$randseedtype'
25093 ranlib='$ranlib'
25094 rd_nodata='$rd_nodata'
25095 readdir64_r_proto='$readdir64_r_proto'
25096 readdir_r_proto='$readdir_r_proto'
25097 revision='$revision'
25098 rm='$rm'
25099 rm_try='$rm_try'
25100 rmail='$rmail'
25101 run='$run'
25102 runnm='$runnm'
25103 sGMTIME_max='$sGMTIME_max'
25104 sGMTIME_min='$sGMTIME_min'
25105 sLOCALTIME_max='$sLOCALTIME_max'
25106 sLOCALTIME_min='$sLOCALTIME_min'
25107 sPRIEUldbl='$sPRIEUldbl'
25108 sPRIFUldbl='$sPRIFUldbl'
25109 sPRIGUldbl='$sPRIGUldbl'
25110 sPRIXU64='$sPRIXU64'
25111 sPRId64='$sPRId64'
25112 sPRIeldbl='$sPRIeldbl'
25113 sPRIfldbl='$sPRIfldbl'
25114 sPRIgldbl='$sPRIgldbl'
25115 sPRIi64='$sPRIi64'
25116 sPRIo64='$sPRIo64'
25117 sPRIu64='$sPRIu64'
25118 sPRIx64='$sPRIx64'
25119 sSCNfldbl='$sSCNfldbl'
25120 sched_yield='$sched_yield'
25121 scriptdir='$scriptdir'
25122 scriptdirexp='$scriptdirexp'
25123 sed='$sed'
25124 seedfunc='$seedfunc'
25125 selectminbits='$selectminbits'
25126 selecttype='$selecttype'
25127 sendmail='$sendmail'
25128 setgrent_r_proto='$setgrent_r_proto'
25129 sethostent_r_proto='$sethostent_r_proto'
25130 setlocale_r_proto='$setlocale_r_proto'
25131 setnetent_r_proto='$setnetent_r_proto'
25132 setprotoent_r_proto='$setprotoent_r_proto'
25133 setpwent_r_proto='$setpwent_r_proto'
25134 setservent_r_proto='$setservent_r_proto'
25135 sh='$sh'
25136 shar='$shar'
25137 sharpbang='$sharpbang'
25138 shmattype='$shmattype'
25139 shortsize='$shortsize'
25140 shrpenv='$shrpenv'
25141 shsharp='$shsharp'
25142 sig_count='$sig_count'
25143 sig_name='$sig_name'
25144 sig_name_init='$sig_name_init'
25145 sig_num='$sig_num'
25146 sig_num_init='$sig_num_init'
25147 sig_size='$sig_size'
25148 signal_t='$signal_t'
25149 sitearch='$sitearch'
25150 sitearchexp='$sitearchexp'
25151 sitebin='$sitebin'
25152 sitebinexp='$sitebinexp'
25153 sitehtml1dir='$sitehtml1dir'
25154 sitehtml1direxp='$sitehtml1direxp'
25155 sitehtml3dir='$sitehtml3dir'
25156 sitehtml3direxp='$sitehtml3direxp'
25157 sitelib='$sitelib'
25158 sitelib_stem='$sitelib_stem'
25159 sitelibexp='$sitelibexp'
25160 siteman1dir='$siteman1dir'
25161 siteman1direxp='$siteman1direxp'
25162 siteman3dir='$siteman3dir'
25163 siteman3direxp='$siteman3direxp'
25164 siteprefix='$siteprefix'
25165 siteprefixexp='$siteprefixexp'
25166 sitescript='$sitescript'
25167 sitescriptexp='$sitescriptexp'
25168 sizesize='$sizesize'
25169 sizetype='$sizetype'
25170 sleep='$sleep'
25171 smail='$smail'
25172 so='$so'
25173 sockethdr='$sockethdr'
25174 socketlib='$socketlib'
25175 socksizetype='$socksizetype'
25176 sort='$sort'
25177 spackage='$spackage'
25178 spitshell='$spitshell'
25179 srand48_r_proto='$srand48_r_proto'
25180 srandom_r_proto='$srandom_r_proto'
25181 src='$src'
25182 ssizetype='$ssizetype'
25183 st_ino_sign='$st_ino_sign'
25184 st_ino_size='$st_ino_size'
25185 startperl='$startperl'
25186 startsh='$startsh'
25187 static_ext='$static_ext'
25188 stdchar='$stdchar'
25189 stdio_base='$stdio_base'
25190 stdio_bufsiz='$stdio_bufsiz'
25191 stdio_cnt='$stdio_cnt'
25192 stdio_filbuf='$stdio_filbuf'
25193 stdio_ptr='$stdio_ptr'
25194 stdio_stream_array='$stdio_stream_array'
25195 strerror_r_proto='$strerror_r_proto'
25196 strings='$strings'
25197 submit='$submit'
25198 subversion='$subversion'
25199 sysman='$sysman'
25200 sysroot='$sysroot'
25201 tail='$tail'
25202 tar='$tar'
25203 targetarch='$targetarch'
25204 targetdir='$targetdir'
25205 targetenv='$targetenv'
25206 targethost='$targethost'
25207 targetmkdir='$targetmkdir'
25208 targetport='$targetport'
25209 targetsh='$targetsh'
25210 tbl='$tbl'
25211 tee='$tee'
25212 test='$test'
25213 timeincl='$timeincl'
25214 timetype='$timetype'
25215 tmpnam_r_proto='$tmpnam_r_proto'
25216 to='$to'
25217 touch='$touch'
25218 tr='$tr'
25219 trnl='$trnl'
25220 troff='$troff'
25221 ttyname_r_proto='$ttyname_r_proto'
25222 u16size='$u16size'
25223 u16type='$u16type'
25224 u32size='$u32size'
25225 u32type='$u32type'
25226 u64size='$u64size'
25227 u64type='$u64type'
25228 u8size='$u8size'
25229 u8type='$u8type'
25230 uidformat='$uidformat'
25231 uidsign='$uidsign'
25232 uidsize='$uidsize'
25233 uidtype='$uidtype'
25234 uname='$uname'
25235 uniq='$uniq'
25236 uquadtype='$uquadtype'
25237 use5005threads='$use5005threads'
25238 use64bitall='$use64bitall'
25239 use64bitint='$use64bitint'
25240 usecbacktrace='$usecbacktrace'
25241 usecrosscompile='$usecrosscompile'
25242 usedevel='$usedevel'
25243 usedl='$usedl'
25244 usedtrace='$usedtrace'
25245 usefaststdio='$usefaststdio'
25246 useithreads='$useithreads'
25247 usekernprocpathname='$usekernprocpathname'
25248 uselargefiles='$uselargefiles'
25249 uselongdouble='$uselongdouble'
25250 usemallocwrap='$usemallocwrap'
25251 usemorebits='$usemorebits'
25252 usemultiplicity='$usemultiplicity'
25253 usemymalloc='$usemymalloc'
25254 usenm='$usenm'
25255 usensgetexecutablepath='$usensgetexecutablepath'
25256 useopcode='$useopcode'
25257 useperlio='$useperlio'
25258 useposix='$useposix'
25259 usequadmath='$usequadmath'
25260 usereentrant='$usereentrant'
25261 userelocatableinc='$userelocatableinc'
25262 useshrplib='$useshrplib'
25263 usesitecustomize='$usesitecustomize'
25264 usesocks='$usesocks'
25265 usethreads='$usethreads'
25266 usevendorprefix='$usevendorprefix'
25267 useversionedarchname='$useversionedarchname'
25268 usevfork='$usevfork'
25269 usrinc='$usrinc'
25270 uuname='$uuname'
25271 uvXUformat='$uvXUformat'
25272 uvoformat='$uvoformat'
25273 uvsize='$uvsize'
25274 uvtype='$uvtype'
25275 uvuformat='$uvuformat'
25276 uvxformat='$uvxformat'
25277 vaproto='$vaproto'
25278 vendorarch='$vendorarch'
25279 vendorarchexp='$vendorarchexp'
25280 vendorbin='$vendorbin'
25281 vendorbinexp='$vendorbinexp'
25282 vendorhtml1dir='$vendorhtml1dir'
25283 vendorhtml1direxp='$vendorhtml1direxp'
25284 vendorhtml3dir='$vendorhtml3dir'
25285 vendorhtml3direxp='$vendorhtml3direxp'
25286 vendorlib='$vendorlib'
25287 vendorlib_stem='$vendorlib_stem'
25288 vendorlibexp='$vendorlibexp'
25289 vendorman1dir='$vendorman1dir'
25290 vendorman1direxp='$vendorman1direxp'
25291 vendorman3dir='$vendorman3dir'
25292 vendorman3direxp='$vendorman3direxp'
25293 vendorprefix='$vendorprefix'
25294 vendorprefixexp='$vendorprefixexp'
25295 vendorscript='$vendorscript'
25296 vendorscriptexp='$vendorscriptexp'
25297 version='$version'
25298 version_patchlevel_string='$version_patchlevel_string'
25299 versiononly='$versiononly'
25300 vi='$vi'
25301 xlibpth='$xlibpth'
25302 yacc='$yacc'
25303 yaccflags='$yaccflags'
25304 zcat='$zcat'
25305 zip='$zip'
25306 EOT
25307
25308 : add special variables
25309 $test -f $src/patchlevel.h && \
25310 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25311 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25312 echo "PERL_CONFIG_SH=true" >>config.sh
25313
25314 : propagate old symbols
25315 if $test -f UU/config.sh; then
25316         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25317         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25318                 config.sh config.sh UU/oldconfig.sh |\
25319                 $sort | $uniq -u >UU/oldsyms
25320         set X `$cat UU/oldsyms`
25321         shift
25322         case $# in
25323         0) ;;
25324         *)
25325                 $cat <<EOM
25326 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25327 EOM
25328                 echo ": Variables propagated from previous config.sh file." >>config.sh
25329                 for sym in `$cat UU/oldsyms`; do
25330                         echo "    Propagating $hint variable "'$'"$sym..."
25331                         eval 'tmp="$'"${sym}"'"'
25332                         echo "$tmp" | \
25333                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25334                 done
25335                 ;;
25336         esac
25337 fi
25338
25339 : preserve RCS keywords in files with variable substitution, grrr
25340 Id='$Id'
25341
25342 : Finish up by extracting the .SH files
25343 case "$alldone" in
25344 exit)
25345         $rm -rf UU
25346         echo "Extraction done."
25347         exit 0
25348         ;;
25349 cont)
25350         ;;
25351 '')
25352         dflt=''
25353         nostick=true
25354         $cat <<EOM
25355
25356 If you'd like to make any changes to the config.sh file before I begin
25357 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25358
25359 EOM
25360         rp="Press return or use a shell escape to edit config.sh:"
25361         . UU/myread
25362         nostick=''
25363         case "$ans" in
25364         '') ;;
25365         *) : in case they cannot read
25366                 sh 1>&4 -c "$ans";;
25367         esac
25368         ;;
25369 esac
25370
25371 : if this fails, just run all the .SH files by hand
25372 . ./config.sh
25373
25374 echo " "
25375 exec 1>&4
25376 pwd=`pwd`
25377 . ./UU/extract
25378 cd "$pwd"
25379
25380 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25381         dflt=y
25382         case "$silent" in
25383         true) ;;
25384         *)
25385                 $cat <<EOM
25386
25387 Now you need to generate make dependencies by running "$make depend".
25388 You might prefer to run it in background: "$make depend > makedepend.out &"
25389 It can take a while, so you might not want to run it right now.
25390
25391 EOM
25392                 ;;
25393         esac
25394         rp="Run $make depend now?"
25395         . UU/myread
25396         case "$ans" in
25397         y*)
25398                 $make depend && echo "Now you must run '$make'."
25399                 ;;
25400         *)
25401                 echo "You must run '$make depend' then '$make'."
25402                 ;;
25403         esac
25404 elif test -f [Mm]akefile; then
25405         echo " "
25406         echo "Now you must run a $make."
25407 else
25408         echo "Configure done."
25409 fi
25410
25411 if $test -f Policy.sh; then
25412     $cat <<EOM
25413
25414 If you compile $package on a different machine or from a different object
25415 directory, copy the Policy.sh file from this object directory to the
25416 new one before you run Configure -- this will help you with most of
25417 the policy defaults.
25418
25419 EOM
25420 fi
25421 if $test -f config.msg; then
25422     echo "Hmm.  I also noted the following information while running:"
25423     echo " "
25424     $cat config.msg >&4
25425     $rm -f config.msg
25426 fi
25427 $rm -f kit*isdone ark*isdone
25428 $rm -rf UU
25429
25430 : End of Configure
25431