This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_iter(): optimise stack handling
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically by the tool
15 # called "metaconfig". Rather than working with this copy of Configure,
16 # you 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 usedtrace=''
1321 usefaststdio=''
1322 usekernprocpathname=''
1323 ccflags_uselargefiles=''
1324 ldflags_uselargefiles=''
1325 libswanted_uselargefiles=''
1326 uselargefiles=''
1327 uselongdouble=''
1328 usemorebits=''
1329 usemultiplicity=''
1330 nm_opt=''
1331 nm_so_opt=''
1332 runnm=''
1333 usenm=''
1334 usensgetexecutablepath=''
1335 useperlio=''
1336 usequadmath=''
1337 usesocks=''
1338 d_oldpthreads=''
1339 use5005threads=''
1340 useithreads=''
1341 usereentrant=''
1342 usethreads=''
1343 incpath=''
1344 mips_type=''
1345 usrinc=''
1346 vaproto=''
1347 d_vendorarch=''
1348 installvendorarch=''
1349 vendorarch=''
1350 vendorarchexp=''
1351 d_vendorbin=''
1352 installvendorbin=''
1353 vendorbin=''
1354 vendorbinexp=''
1355 installvendorhtml1dir=''
1356 vendorhtml1dir=''
1357 vendorhtml1direxp=''
1358 installvendorhtml3dir=''
1359 vendorhtml3dir=''
1360 vendorhtml3direxp=''
1361 d_vendorlib=''
1362 installvendorlib=''
1363 vendorlib=''
1364 vendorlib_stem=''
1365 vendorlibexp=''
1366 installvendorman1dir=''
1367 vendorman1dir=''
1368 vendorman1direxp=''
1369 installvendorman3dir=''
1370 vendorman3dir=''
1371 vendorman3direxp=''
1372 usevendorprefix=''
1373 vendorprefix=''
1374 vendorprefixexp=''
1375 d_vendorscript=''
1376 installvendorscript=''
1377 vendorscript=''
1378 vendorscriptexp=''
1379 versiononly=''
1380 yacc=''
1381 yaccflags=''
1382 CONFIG=''
1383
1384 : Detect odd OSs
1385 define='define'
1386 undef='undef'
1387 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1388 rmlist=''
1389
1390 : We must find out about Eunice early
1391 eunicefix=':'
1392 if test -f /etc/unixtovms; then
1393         eunicefix=/etc/unixtovms
1394 fi
1395 if test -f /etc/unixtovms.exe; then
1396         eunicefix=/etc/unixtovms.exe
1397 fi
1398
1399 : Set executable suffix now -- needed before hints available
1400 if test -f "/libs/version.library"; then
1401 : Amiga OS
1402     _exe=""
1403 elif test -f "/system/gnu_library/bin/ar.pm"; then
1404 : Stratus VOS
1405     _exe=".pm"
1406 elif test -n "$DJGPP"; then
1407 : DOS DJGPP
1408     _exe=".exe"
1409 elif test -f /kern/cookiejar; then
1410 : MiNT
1411     _exe=""
1412 elif test -d c:/. -o -n "$is_os2" ; then
1413 : OS/2 or cygwin
1414     _exe=".exe"
1415 fi
1416
1417 groupstype=''
1418 i_whoami=''
1419 : Trailing extension.  Override this in a hint file, if needed.
1420 : Extra object files, if any, needed on this platform.
1421 archobjs=''
1422 archname=''
1423 : Possible local include directories to search.
1424 : Set locincpth to "" in a hint file to defeat local include searches.
1425 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1426 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1427 :
1428 : no include file wanted by default
1429 inclwanted=''
1430
1431 : Enable -DEBUGGING and -DDEBUGGING from the command line
1432 EBUGGING=''
1433 DEBUGGING=''
1434
1435 libnames=''
1436 : change the next line if compiling for Xenix/286 on Xenix/386
1437 xlibpth='/usr/lib/386 /lib/386'
1438 : Possible local library directories to search.
1439 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1440 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1441
1442 : general looking path for locating libraries
1443 glibpth="/lib /usr/lib $xlibpth"
1444 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1445 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1446 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1447 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1448
1449 : Private path used by Configure to find libraries.  Its value
1450 : is prepended to libpth. This variable takes care of special
1451 : machines, like the mips.  Usually, it should be empty.
1452 plibpth=''
1453
1454 : default library list
1455 libswanted=''
1456 : some systems want to use only the non-versioned libso:s
1457 ignore_versioned_solibs=''
1458 : set usethreads on the Configure command line to enable threads.
1459 usereentrant='undef'
1460 ccname=''
1461 ccversion=''
1462 perllibs=''
1463 : set useposix=false in your hint file to disable the POSIX extension.
1464 useposix=true
1465 : set useopcode=false in your hint file to disable the Opcode extension.
1466 useopcode=true
1467 archname64=''
1468 ccflags_uselargefiles=''
1469 ldflags_uselargefiles=''
1470 libswanted_uselargefiles=''
1471 : set usemultiplicity on the Configure command line to enable multiplicity.
1472 : set usesocks on the Configure command line to enable socks.
1473 : List of libraries we want.
1474 : If anyone needs extra -lxxx, put those in a hint file.
1475 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1476 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1477 : We probably want to search /usr/shlib before most other libraries.
1478 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1479 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1480 glibpth="/usr/shlib $glibpth"
1481 : Do not use vfork unless overridden by a hint file.
1482 usevfork=false
1483
1484 : Find the basic shell for Bourne shell scripts
1485 case "$sh" in
1486 '')
1487         case "$SYSTYPE" in
1488         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1489         *) xxx='/bin/sh';;
1490         esac
1491         if test -f "$xxx"; then
1492                 sh="$xxx"
1493         else
1494                 : Build up a list and do a single loop so we can 'break' out.
1495                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1496                 for xxx in sh bash ksh pdksh ash; do
1497                         for p in $pth; do
1498                                 try="$try ${p}/${xxx}"
1499                         done
1500                 done
1501                 for xxx in $try; do
1502                         if test -f "$xxx"; then
1503                                 sh="$xxx";
1504                                 break
1505                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1506                                 sh="$xxx";
1507                                 break
1508                         elif test -f "$xxx.exe"; then
1509                                 sh="$xxx";
1510                                 break
1511                         fi
1512                 done
1513         fi
1514         ;;
1515 esac
1516
1517 case "$sh" in
1518 '')     cat >&2 <<EOM
1519 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1520
1521 Usually it's in /bin/sh.  How did you even get this far?
1522 Please contact me (Perl Maintainers) at perlbug@perl.org and
1523 we'll try to straighten this all out.
1524 EOM
1525         exit 1
1526         ;;
1527 esac
1528
1529 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1530 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1531 targetsh=$sh
1532
1533 : see if sh knows # comments
1534 if `$sh -c '#' >/dev/null 2>&1`; then
1535         shsharp=true
1536         spitshell=cat
1537         xcat=/bin/cat
1538         test -f $xcat$_exe || xcat=/usr/bin/cat
1539         if test ! -f $xcat$_exe; then
1540                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1541                         if test -f $p/cat$_exe; then
1542                                 xcat=$p/cat
1543                                 break
1544                         fi
1545                 done
1546                 if test ! -f $xcat$_exe; then
1547                         echo "Can't find cat anywhere!"
1548                         exit 1
1549                 fi
1550         fi
1551         echo "#!$xcat" >sharp
1552         $eunicefix sharp
1553         chmod +x sharp
1554         ./sharp > today 2>/dev/null
1555         if test -s today; then
1556                 sharpbang='#!'
1557         else
1558                 echo "#! $xcat" > sharp
1559                 $eunicefix sharp
1560                 chmod +x sharp
1561                 ./sharp > today 2>/dev/null
1562                 if test -s today; then
1563                         sharpbang='#! '
1564                 else
1565                         sharpbang=': use '
1566                 fi
1567         fi
1568 else
1569         echo " "
1570         echo "Your $sh doesn't grok # comments--I will strip them later on."
1571         shsharp=false
1572         cd ..
1573         echo "exec grep -v '^[  ]*#'" >spitshell
1574         chmod +x spitshell
1575         $eunicefix spitshell
1576         spitshell=`pwd`/spitshell
1577         cd UU
1578         echo "I presume that if # doesn't work, #! won't work either!"
1579         sharpbang=': use '
1580 fi
1581 rm -f sharp today
1582
1583 : figure out how to guarantee sh startup
1584 case "$startsh" in
1585 '') startsh=${sharpbang}${sh} ;;
1586 *)
1587 esac
1588 cat >sharp <<EOSS
1589 $startsh
1590 set abc
1591 test "$?abc" != 1
1592 EOSS
1593
1594 chmod +x sharp
1595 $eunicefix sharp
1596 if ./sharp; then
1597         : echo "Yup, it does."
1598 else
1599         echo "Hmm... '$startsh' does not guarantee sh startup..."
1600         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1601 fi
1602 rm -f sharp
1603
1604 : Save command line options in file UU/cmdline.opt for later use in
1605 : generating config.sh.
1606 cat > cmdline.opt <<EOSH
1607 : Configure command line arguments.
1608 config_arg0='$0'
1609 config_args='$*'
1610 config_argc=$#
1611 EOSH
1612 argn=1
1613 args_exp=''
1614 args_sep=''
1615 for arg in "$@"; do
1616         cat >>cmdline.opt <<EOSH
1617 config_arg$argn='$arg'
1618 EOSH
1619         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1620 $arg
1621 EOC
1622         arg_exp=`cat cmdl.opt`
1623         args_exp="$args_exp$args_sep'$arg_exp'"
1624         argn=`expr $argn + 1`
1625         args_sep=' '
1626 done
1627 rm -f cmdl.opt
1628
1629 : produce awk script to parse command line options
1630 cat >options.awk <<'EOF'
1631 BEGIN {
1632         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1633
1634         len = length(optstr);
1635         for (i = 1; i <= len; i++) {
1636                 c = substr(optstr, i, 1);
1637                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1638                 if (a == ":") {
1639                         arg[c] = 1;
1640                         i++;
1641                 }
1642                 opt[c] = 1;
1643         }
1644 }
1645 {
1646         expect = 0;
1647         str = $0;
1648         if (substr(str, 1, 1) != "-") {
1649                 printf("'%s'\n", str);
1650                 next;
1651         }
1652         len = length($0);
1653         for (i = 2; i <= len; i++) {
1654                 c = substr(str, i, 1);
1655                 if (!opt[c]) {
1656                         printf("-%s\n", substr(str, i));
1657                         next;
1658                 }
1659                 printf("-%s\n", c);
1660                 if (arg[c]) {
1661                         if (i < len)
1662                                 printf("'%s'\n", substr(str, i + 1));
1663                         else
1664                                 expect = 1;
1665                         next;
1666                 }
1667         }
1668 }
1669 END {
1670         if (expect)
1671                 print "?";
1672 }
1673 EOF
1674
1675 : process the command line options
1676 set X `for arg in "$@"; do echo "X$arg"; done |
1677         sed -e s/X// | awk -f options.awk`
1678 eval "set $*"
1679 shift
1680 rm -f options.awk
1681
1682 : set up default values
1683 fastread=''
1684 reuseval=false
1685 config_sh=''
1686 alldone=''
1687 error=''
1688 silent=''
1689 extractsh=''
1690 knowitall=''
1691 rm -f optdef.sh posthint.sh
1692 cat >optdef.sh <<EOS
1693 $startsh
1694 EOS
1695
1696
1697 : option parsing
1698 while test $# -gt 0; do
1699         case "$1" in
1700         -d) shift; fastread=yes;;
1701         -e) shift; alldone=cont;;
1702         -f)
1703                 shift
1704                 cd ..
1705                 if test -r "$1"; then
1706                         config_sh="$1"
1707                 else
1708                         echo "$me: cannot read config file $1." >&2
1709                         error=true
1710                 fi
1711                 cd UU
1712                 shift;;
1713         --help|\
1714         -h) shift; error=true;;
1715         -r) shift; reuseval=true;;
1716         -s) shift; silent=true; realsilent=true;;
1717         -E) shift; alldone=exit;;
1718         -K) shift; knowitall=true;;
1719         -O) shift;;
1720         -S) shift; silent=true; extractsh=true;;
1721         -D)
1722                 shift
1723                 case "$1" in
1724                 *=)
1725                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1726                         echo "$me: ignoring -D $1" >&2
1727                         ;;
1728                 *=*) echo "$1" | \
1729                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1730                 *) echo "$1='define'" >> optdef.sh;;
1731                 esac
1732                 shift
1733                 ;;
1734         -U)
1735                 shift
1736                 case "$1" in
1737                 *=) echo "$1" >> optdef.sh;;
1738                 *=*)
1739                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1740                         echo "$me: ignoring -U $1" >&2
1741                         ;;
1742                 *) echo "$1='undef'" >> optdef.sh;;
1743                 esac
1744                 shift
1745                 ;;
1746         -A)
1747             shift
1748             xxx=''
1749             yyy="$1"
1750             zzz=''
1751             uuu=undef
1752             case "$yyy" in
1753             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1754                  case "$zzz" in
1755                  *:*) zzz='' ;;
1756                  *)   xxx=append
1757                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1758                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1759                  esac
1760                  ;;
1761             esac
1762             case "$xxx" in
1763             '')  case "$yyy" in
1764                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1765                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1766                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1767                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1768                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1769                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1770                  esac
1771                  ;;
1772             esac
1773             case "$xxx" in
1774             append)
1775                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1776             clear)
1777                 echo "$yyy=''"                  >> posthint.sh ;;
1778             define)
1779                 case "$zzz" in
1780                 '') zzz=define ;;
1781                 esac
1782                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1783             eval)
1784                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1785             prepend)
1786                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1787             undef)
1788                 case "$zzz" in
1789                 '') zzz="$uuu" ;;
1790                 esac
1791                 echo "$yyy=$zzz"                >> posthint.sh ;;
1792             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1793             esac
1794             shift
1795             ;;
1796         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1797             exit 0;;
1798         --) break;;
1799         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1800         *) break;;
1801         esac
1802 done
1803
1804 case "$error" in
1805 true)
1806         cat >&2 <<EOM
1807 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1808                  [-U symbol] [-U symbol=] [-A command:symbol...]
1809   -d : use defaults for all answers.
1810   -e : go on without questioning past the production of config.sh.
1811   -f : specify an alternate default configuration file.
1812   -h : print this help message and exit (with an error status).
1813   -r : reuse C symbols value if possible (skips costly nm extraction).
1814   -s : silent mode, only echoes questions and essential information.
1815   -D : define symbol to have some value:
1816          -D symbol         symbol gets the value 'define'
1817          -D symbol=value   symbol gets the value 'value'
1818        common used examples (see INSTALL for more info):
1819          -Duse64bitint            use 64bit integers
1820          -Duse64bitall            use 64bit integers and pointers
1821          -Dusethreads             use thread support
1822          -Dinc_version_list=none  do not include older perl trees in @INC
1823          -DEBUGGING=none          DEBUGGING options
1824          -Dcc=gcc                 choose your compiler
1825          -Dprefix=/opt/perl5      choose your destination
1826   -E : stop at the end of questions, after having produced config.sh.
1827   -K : do not use unless you know what you are doing.
1828   -O : ignored for backward compatibility
1829   -S : perform variable substitutions on all .SH files (can mix with -f)
1830   -U : undefine symbol:
1831          -U symbol    symbol gets the value 'undef'
1832          -U symbol=   symbol gets completely empty
1833        e.g.:  -Uversiononly
1834   -A : manipulate symbol after the platform specific hints have been applied:
1835          -A append:symbol=value   append value to symbol
1836          -A symbol=value          like append:, but with a separating space
1837          -A define:symbol=value   define symbol to have value
1838          -A clear:symbol          define symbol to be ''
1839          -A define:symbol         define symbol to be 'define'
1840          -A eval:symbol=value     define symbol to be eval of value
1841          -A prepend:symbol=value  prepend value to symbol
1842          -A undef:symbol          define symbol to be 'undef'
1843          -A undef:symbol=         define symbol to be ''
1844        e.g.:  -A prepend:libswanted='cl pthread '
1845               -A ccflags=-DSOME_MACRO
1846   -V : print version number and exit (with a zero status).
1847 EOM
1848         exit 1
1849         ;;
1850 esac
1851
1852 : Sanity checks
1853 case "$fastread$alldone" in
1854 yescont|yesexit) ;;
1855 *)
1856         case "$extractsh" in
1857         true) ;;
1858         *)
1859                 if test ! -t 0; then
1860                         echo "Say 'sh Configure', not 'sh <Configure'"
1861                         exit 1
1862                 fi
1863                 ;;
1864         esac
1865         ;;
1866 esac
1867
1868 exec 4>&1
1869 case "$silent" in
1870 true) exec 1>/dev/null;;
1871 esac
1872
1873 : run the defines and the undefines, if any, but leave the file out there...
1874 touch optdef.sh
1875 grep '\\' optdef.sh >/dev/null 2>&1
1876 if test $? = 0; then
1877     echo "Configure does not support \\ in -D arguments"
1878     exit 1
1879 fi
1880 . ./optdef.sh
1881 : create the posthint manipulation script and leave the file out there...
1882 touch posthint.sh
1883
1884 : set package name
1885 package='perl5'
1886 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1887 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1888 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1889 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1890 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1891 esac
1892
1893 : Some greps do not return status, grrr.
1894 echo "grimblepritz" >grimble
1895 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1896         contains=contains
1897 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1898         contains=grep
1899 else
1900         contains=contains
1901 fi
1902 rm -f grimble
1903 : the following should work in any shell
1904 case "$contains" in
1905 contains*)
1906         echo " "
1907         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1908         cat >contains <<'EOSS'
1909 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1910 EOSS
1911 chmod +x contains
1912 esac
1913
1914 : Find the path to the source tree
1915 case "$src" in
1916 '') case "$0" in
1917     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1918          case "$src" in
1919          /*)    ;;
1920          .)     ;;
1921          *)     src=`cd ../$src && pwd` ;;
1922          esac
1923          ;;
1924     *)   src='.';;
1925     esac;;
1926 esac
1927 case "$src" in
1928 '')     src=/
1929         rsrc=/
1930         ;;
1931 /*)     rsrc="$src";;
1932 *)      rsrc="../$src";;
1933 esac
1934 if test -f $rsrc/Configure && \
1935         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1936 then
1937    : found it, so we are ok.
1938 else
1939         rsrc=''
1940         for src in . .. ../.. ../../.. ../../../..; do
1941                 if test -f ../$src/Configure && \
1942                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1943                 then
1944                         rsrc=../$src
1945                         break
1946                 fi
1947         done
1948 fi
1949 case "$rsrc" in
1950 '')
1951         cat <<EOM >&4
1952
1953 Sorry, I can't seem to locate the source dir for $package.  Please start
1954 Configure with an explicit path -- i.e. /some/path/Configure.
1955
1956 EOM
1957         exit 1
1958         ;;
1959 ../.)   rsrc='..';;
1960 *)
1961         echo " "
1962         echo "Sources for $package found in \"$src\"." >&4
1963         ;;
1964 esac
1965
1966 : script used to extract .SH files with variable substitutions
1967 cat >extract <<'EOS'
1968 PERL_CONFIG_SH=true
1969 echo "Doing variable substitutions on .SH files..."
1970 if test -f MANIFEST; then
1971         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1972 else
1973         echo "(Looking for .SH files under the source directory.)"
1974         set x `(cd "$src"; find . -name "*.SH" -print)`
1975 fi
1976 shift
1977 case $# in
1978 0) set x `(cd "$src"; echo *.SH)`; shift;;
1979 esac
1980 if test ! -f "$src/$1"; then
1981         shift
1982 fi
1983 mkdir_p='
1984 name=$1;
1985 create="";
1986 while test $name; do
1987         if test ! -d "$name"; then
1988                 create="$name $create";
1989                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1990                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1991         else
1992                 name="";
1993         fi;
1994 done;
1995 for file in $create; do
1996         mkdir $file;
1997 done
1998 '
1999 for file in $*; do
2000         case "$src" in
2001         ".")
2002                 case "$file" in
2003                 */*)
2004                         dir=`expr X$file : 'X\(.*\)/'`
2005                         file=`expr X$file : 'X.*/\(.*\)'`
2006                         (cd "$dir" && . ./$file)
2007                         ;;
2008                 *)
2009                         . ./$file
2010                         ;;
2011                 esac
2012                 ;;
2013         *)
2014                 case "$file" in
2015                 */*)
2016                         dir=`expr X$file : 'X\(.*\)/'`
2017                         file=`expr X$file : 'X.*/\(.*\)'`
2018                         (set x $dir; shift; eval $mkdir_p)
2019                         sh <"$src/$dir/$file"
2020                         ;;
2021                 *)
2022                         sh <"$src/$file"
2023                         ;;
2024                 esac
2025                 ;;
2026         esac
2027 done
2028 if test -f "$src/config_h.SH"; then
2029         if test ! -f config.h; then
2030         : oops, they left it out of MANIFEST, probably, so do it anyway.
2031         . "$src/config_h.SH"
2032         fi
2033 fi
2034 EOS
2035
2036 : extract files and exit if asked to do so
2037 case "$extractsh" in
2038 true)
2039         case "$realsilent" in
2040         true) ;;
2041         *) exec 1>&4;;
2042         esac
2043         case "$config_sh" in
2044         '') config_sh='config.sh';;
2045         esac
2046         echo " "
2047         echo "Fetching answers from $config_sh..."
2048         cd ..
2049         . $config_sh
2050         . UU/optdef.sh
2051         echo " "
2052         . UU/extract
2053         rm -rf UU
2054         echo "Extraction done."
2055         exit 0
2056         ;;
2057 esac
2058
2059 : Eunice requires " " instead of "", can you believe it
2060 echo " "
2061 : Here we go...
2062 echo "Beginning of configuration questions for $package."
2063
2064 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2065
2066 : first determine how to suppress newline on echo command
2067 echo " "
2068 echo "Checking echo to see how to suppress newlines..."
2069 (echo "hi there\c" ; echo " ") >.echotmp
2070 if $contains c .echotmp >/dev/null 2>&1 ; then
2071         echo "...using -n."
2072         n='-n'
2073         c=''
2074 else
2075         cat <<'EOM'
2076 ...using \c
2077 EOM
2078         n=''
2079         c='\c'
2080 fi
2081 echo $n "The star should be here-->$c"
2082 echo '*'
2083 rm -f .echotmp
2084
2085 : Now test for existence of everything in MANIFEST
2086 echo " "
2087 if test -f "$rsrc/MANIFEST"; then
2088         echo "First let's make sure your kit is complete.  Checking..." >&4
2089         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2090                 (split -l 50 2>/dev/null || split -50)
2091         rm -f missing
2092         tmppwd=`pwd`
2093         for filelist in x??; do
2094                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2095                         >/dev/null 2>>"$tmppwd/missing")
2096         done
2097         if test -s missing; then
2098                 cat missing >&4
2099                 cat >&4 <<'EOM'
2100
2101 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2102
2103 You have the option of continuing the configuration process, despite the
2104 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2105 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2106 and contact the author (perlbug@perl.org).
2107
2108 EOM
2109                 echo $n "Continue? [n] $c" >&4
2110                 read ans
2111                 case "$ans" in
2112                 y*)
2113                         echo "Continuing..." >&4
2114                         rm -f missing
2115                         ;;
2116                 *)
2117                         echo "ABORTING..." >&4
2118                         kill $$
2119                         ;;
2120                 esac
2121         else
2122                 echo "Looks good..."
2123         fi
2124 else
2125         echo "There is no MANIFEST file.  I hope your kit is complete !"
2126 fi
2127 rm -f missing x??
2128
2129 : Find the appropriate value for a newline for tr
2130 echo " "
2131 if test -n "$DJGPP"; then
2132        trnl='\012'
2133 fi
2134 if test X"$trnl" = X; then
2135         case "`echo foo|tr '\n' x 2>/dev/null`" in
2136         foox) trnl='\n' ;;
2137         esac
2138 fi
2139 if test X"$trnl" = X; then
2140         case "`echo foo|tr '\012' x 2>/dev/null`" in
2141         foox) trnl='\012' ;;
2142         esac
2143 fi
2144 if test X"$trnl" = X; then
2145        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2146        fooxy) trnl='\n\r' ;;
2147        esac
2148 fi
2149 if test X"$trnl" = X; then
2150         cat <<EOM >&2
2151
2152 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2153
2154 EOM
2155         exit 1
2156 fi
2157
2158 : compute the number of columns on the terminal for proper question formatting
2159 case "$COLUMNS" in
2160 '') COLUMNS='80';;
2161 esac
2162
2163 : set up the echo used in my read
2164 myecho="case \"\$xxxm\" in
2165 '') echo $n \"\$rp $c\" >&4;;
2166 *) case \"\$rp\" in
2167         '') echo $n \"[\$xxxm] $c\";;
2168         *)
2169                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2170                         echo \"\$rp\" >&4
2171                         echo $n \"[\$xxxm] $c\" >&4
2172                 else
2173                         echo $n \"\$rp [\$xxxm] $c\" >&4
2174                 fi
2175                 ;;
2176         esac;;
2177 esac"
2178
2179 : now set up to do reads with possible shell escape and default assignment
2180 cat <<EOSC >myread
2181 $startsh
2182 xxxm=\$dflt
2183 $myecho
2184 ans='!'
2185 case "\$fastread" in
2186 yes) case "\$dflt" in
2187         '') ;;
2188         *) ans='';
2189                 case "\$silent-\$rp" in
2190                 true-) ;;
2191                 *) echo " " >&4;;
2192                 esac;;
2193         esac;;
2194 *) case "\$silent" in
2195         true) case "\$rp" in
2196                 '') ans='';;
2197                 esac;;
2198         esac;;
2199 esac
2200 while expr "X\$ans" : "X!" >/dev/null; do
2201         read answ
2202         set x \$xxxm
2203         shift
2204         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2205         case  "\$answ" in
2206         "!")
2207                 sh 1>&4
2208                 echo " "
2209                 $myecho
2210                 ;;
2211         !*)
2212                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2213                 shift
2214                 sh 1>&4 -c "\$*"
2215                 echo " "
2216                 $myecho
2217                 ;;
2218         "\$ans")
2219                 case "\$ans" in
2220                 \\&*)
2221                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2222                         shift
2223                         case "\$1" in
2224                         -d)
2225                                 fastread=yes
2226                                 echo "(OK, I'll run with -d after this question.)" >&4
2227                                 ;;
2228                         -*)
2229                                 echo "*** Sorry, \$1 not supported yet." >&4
2230                                 ;;
2231                         esac
2232                         $myecho
2233                         ans=!
2234                         ;;
2235                 esac;;
2236         *)
2237                 case "\$aok" in
2238                 y)
2239                         echo "*** Substitution done -- please confirm."
2240                         xxxm="\$ans"
2241                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2242                         xxxm="\$ans"
2243                         ans=!
2244                         ;;
2245                 *)
2246                         echo "*** Error -- try again."
2247                         ans=!
2248                         ;;
2249                 esac
2250                 $myecho
2251                 ;;
2252         esac
2253         case "\$ans\$xxxm\$nostick" in
2254         '')
2255                 ans=!
2256                 $myecho
2257                 ;;
2258         esac
2259 done
2260 case "\$ans" in
2261 '') ans="\$xxxm";;
2262 esac
2263 EOSC
2264
2265 : create .config dir to save info across Configure sessions
2266 test -d ../.config || mkdir ../.config
2267 cat >../.config/README <<EOF
2268 This directory created by Configure to save information that should
2269 persist across sessions for $package.
2270
2271 You may safely delete it if you wish.
2272 EOF
2273
2274 : See if we are using a devel version and want that
2275 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2276 case "$usedevel" in
2277 $define|true|[yY]*)
2278     usedevel="$define" ;;
2279 *) case "$xversion" in
2280    *[13579])
2281         cat >&4 <<EOH
2282 *** WHOA THERE!!! ***
2283
2284     This is an UNSTABLE DEVELOPMENT release.
2285     The version of this $package distribution is $xversion, that is, odd,
2286     (as opposed to even) and that signifies a development release.
2287     If you want a maintenance release, you want an even-numbered version.
2288
2289     Do ***NOT*** install this into production use.
2290     Data corruption and crashes are possible.
2291
2292     It is most seriously suggested that you do not continue any further
2293     unless you want to help in developing and debugging Perl.
2294
2295     If you *still* want to build perl, you can answer 'y' now,
2296     or pass -Dusedevel to Configure.
2297
2298 EOH
2299         rp='Do you really want to continue?'
2300         dflt='n'
2301         . ./myread
2302         case "$ans" in
2303         [yY]) echo >&4 "Okay, continuing."
2304               usedevel="$define" ;;
2305         *) echo >&4 "Okay, bye."
2306            exit 1
2307            ;;
2308         esac
2309         ;;
2310     esac
2311     usedevel="$undef"
2312     ;;
2313 esac
2314 case "$usedevel" in
2315 $define|true|[yY]*)
2316         case "$versiononly" in
2317         '') versiononly="$define" ;;
2318         esac
2319         case "$installusrbinperl" in
2320         '') installusrbinperl="$undef" ;;
2321         esac
2322         ;;
2323 esac
2324
2325 : general instructions
2326 needman=true
2327 firsttime=true
2328 user=`(logname) 2>/dev/null`
2329 case "$user" in
2330 '') user=`whoami 2>&1`;;
2331 esac
2332 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2333         firsttime=false
2334         echo " "
2335         rp='Would you like to see the instructions?'
2336         dflt=n
2337         . ./myread
2338         case "$ans" in
2339         [yY]*) ;;
2340         *) needman=false;;
2341         esac
2342 fi
2343 if $needman; then
2344         cat <<EOH
2345
2346 This installation shell script will examine your system and ask you questions
2347 to determine how the perl5 package should be installed. If you get
2348 stuck on a question, you may use a ! shell escape to start a subshell or
2349 execute a command.  Many of the questions will have default answers in square
2350 brackets; typing carriage return will give you the default.
2351
2352 On some of the questions which ask for file or directory names you are allowed
2353 to use the ~name construct to specify the login directory belonging to "name",
2354 even if you don't have a shell which knows about that.  Questions where this is
2355 allowed will be marked "(~name ok)".
2356
2357 EOH
2358         rp=''
2359         dflt='Type carriage return to continue'
2360         . ./myread
2361         cat <<'EOH'
2362
2363 The prompter used in this script allows you to use shell variables and
2364 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2365 in the default answer, as if the default line was a set of arguments given to a
2366 script shell.  This means you may also use $* to repeat the whole default line,
2367 so you do not have to re-type everything to add something to the default.
2368
2369 Every time there is a substitution, you will have to confirm.  If there is an
2370 error (e.g. an unmatched backtick), the default answer will remain unchanged
2371 and you will be prompted again.
2372
2373 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2374 the questions and use the computed defaults (or the previous answers if there
2375 was already a config.sh file). Type 'Configure -h' for a list of options.
2376 You may also start interactively and then answer '& -d' at any prompt to turn
2377 on the non-interactive behaviour for the remainder of the execution.
2378
2379 EOH
2380         . ./myread
2381         cat <<EOH
2382
2383 Much effort has been expended to ensure that this shell script will run on any
2384 Unix system.  If despite that it blows up on yours, your best bet is to edit
2385 Configure and run it again.  If you can't run Configure for some reason,
2386 you'll have to generate a config.sh file by hand.  Whatever problems you
2387 have, let me (perlbug@perl.org) know how I blew it.
2388
2389 This installation script affects things in two ways:
2390
2391 1) it may do direct variable substitutions on some of the files included
2392    in this kit.
2393 2) it builds a config.h file for inclusion in C programs.  You may edit
2394    any of these files as the need arises after running this script.
2395
2396 If you make a mistake on a question, there is no easy way to back up to it
2397 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2398 files.  Configure will offer to let you do this before it runs the SH files.
2399
2400 EOH
2401         dflt='Type carriage return to continue'
2402         . ./myread
2403         case "$firsttime" in
2404         true) echo $user >>../.config/instruct;;
2405         esac
2406 fi
2407
2408 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2409 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2410 if test "X$sysroot" = X; then
2411     sysroot=""
2412 else
2413     case "$cc" in
2414         *gcc*|*g++*)
2415             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2416             # _sysroot is used in places where we need --sysroot=foo
2417             # but using the rest of the flags could cause issues.
2418             _sysroot="--sysroot=$sysroot";
2419             case "$ccflags" in
2420                 *sysroot*) ;;
2421                 'undef'|*)
2422                 ccflags="$ccflags $_sysroot"
2423             esac
2424             case "$ldflags" in
2425                 *sysroot*) ;;
2426                 'undef'|*)
2427                 ldflags="$ldflags $_sysroot"
2428             esac
2429             case "$cppflags" in
2430                 *sysroot*) ;;
2431                 'undef'|*)
2432                 cppflags="$cppflags $_sysroot"
2433             esac
2434             # lddlflags updated below in lddlflags section;
2435             # same with cccdlflags
2436             ;;
2437     esac
2438
2439     # Adjust some defaults to also use $sysroot
2440     for var in xlibpth loclibpth locincpth glibpth; do
2441         eval xxx=\$$var
2442         eval $var=''
2443         for path in $xxx; do
2444             eval $var=\"\$$var $sysroot$path\"
2445         done
2446     done
2447
2448 fi
2449
2450 : find out where common programs are
2451 echo " "
2452 echo "Locating common programs..." >&4
2453 cat <<EOSC >loc
2454 $startsh
2455 case \$# in
2456 0) exit 1;;
2457 esac
2458 thing=\$1
2459 shift
2460 dflt=\$1
2461 shift
2462 for dir in \$*; do
2463         case "\$thing" in
2464         .)
2465         if test -d \$dir/\$thing; then
2466                 echo \$dir
2467                 exit 0
2468         fi
2469         ;;
2470         *)
2471         for thisthing in \$dir/\$thing; do
2472                 : just loop through to pick last item
2473         done
2474         if test -f \$thisthing; then
2475                 echo \$thisthing
2476                 exit 0
2477         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2478                 echo \$thisthing
2479                 exit 0
2480         elif test -f \$dir/\$thing.exe; then
2481                 if test -n "$DJGPP"; then
2482                         echo \$dir/\$thing.exe
2483                 elif test "$eunicefix" != ":"; then
2484                         : on Eunice apparently
2485                         echo \$dir/\$thing
2486                 fi
2487                 exit 0
2488         fi
2489         ;;
2490         esac
2491 done
2492 echo \$dflt
2493 exit 1
2494 EOSC
2495 chmod +x loc
2496 $eunicefix loc
2497 loclist="
2498 awk
2499 cat
2500 chmod
2501 comm
2502 cp
2503 echo
2504 expr
2505 grep
2506 ls
2507 mkdir
2508 rm
2509 sed
2510 sort
2511 touch
2512 tr
2513 uniq
2514 "
2515 trylist="
2516 ar
2517 bison
2518 byacc
2519 cpp
2520 csh
2521 date
2522 egrep
2523 gmake
2524 gzip
2525 less
2526 ln
2527 make
2528 more
2529 nm
2530 nroff
2531 perl
2532 pg
2533 test
2534 uname
2535 zip
2536 "
2537 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2538 pth="$pth $sysroot/lib $sysroot/usr/lib"
2539 for file in $loclist; do
2540         eval xxx=\$$file
2541         case "$xxx" in
2542         /*|?:[\\/]*)
2543                 if test -f "$xxx"; then
2544                         : ok
2545                 else
2546                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2547                         xxx=`./loc $file $file $pth`
2548                 fi
2549                 ;;
2550         '') xxx=`./loc $file $file $pth`;;
2551         *) xxx=`./loc $xxx $xxx $pth`;;
2552         esac
2553         eval $file=$xxx$_exe
2554         eval _$file=$xxx
2555         case "$xxx" in
2556         /*)
2557                 echo $file is in $xxx.
2558                 ;;
2559         ?:[\\/]*)
2560                 echo $file is in $xxx.
2561                 ;;
2562         *)
2563                 echo "I don't know where '$file' is, and my life depends on it." >&4
2564                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2565                 exit 1
2566                 ;;
2567         esac
2568 done
2569 echo " "
2570 echo "Don't worry if any of the following aren't found..."
2571 say=offhand
2572 for file in $trylist; do
2573         eval xxx=\$$file
2574         case "$xxx" in
2575         /*|?:[\\/]*)
2576                 if test -f "$xxx"; then
2577                         : ok
2578                 else
2579                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2580                         xxx=`./loc $file $file $pth`
2581                 fi
2582                 ;;
2583         '') xxx=`./loc $file $file $pth`;;
2584         *) xxx=`./loc $xxx $xxx $pth`;;
2585         esac
2586         eval $file=$xxx$_exe
2587         eval _$file=$xxx
2588         case "$xxx" in
2589         /*)
2590                 echo $file is in $xxx.
2591                 ;;
2592         ?:[\\/]*)
2593                 echo $file is in $xxx.
2594                 ;;
2595         *)
2596                 echo "I don't see $file out there, $say."
2597                 say=either
2598                 ;;
2599         esac
2600 done
2601 case "$egrep" in
2602 egrep)
2603         echo "Substituting grep for egrep."
2604         egrep=$grep
2605         _egrep=$grep
2606         ;;
2607 esac
2608 case "$less" in
2609 '')     ;;
2610 *)      if $less -R </dev/null >/dev/null 2>&1; then
2611                echo "Substituting less -R for less."
2612                less="$less -R"
2613                _less=$less
2614         fi
2615         ;;
2616 esac
2617 case "$ln" in
2618 ln)
2619         echo "Substituting cp for ln."
2620         ln=$cp
2621         _ln=$cp
2622         ;;
2623 esac
2624 case "$make" in
2625 make)
2626         case "$gmake" in
2627         gmake)
2628         echo "I can't find make or gmake, and my life depends on it." >&4
2629         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2630         exit 1
2631         ;;
2632         esac
2633         ;;
2634 esac
2635 case "$gmake" in
2636 gmake)  ;;
2637 *)      # We can't have osname yet.
2638         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2639                 # Assume that gmake, if found, is definitely GNU make
2640                 # and prefer it over the system make.
2641                 echo "Substituting gmake for make."
2642                 make=$gmake
2643                 _make=$gmake
2644         fi
2645         ;;
2646 esac
2647 case "$test" in
2648 test)
2649         echo "Hopefully test is built into your sh."
2650         ;;
2651 *)
2652         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2653                 echo "Using the test built into your sh."
2654                 test=test
2655                 _test=test
2656         fi
2657         ;;
2658 esac
2659 case "$echo" in
2660 echo)
2661         echo "Hopefully echo is built into your sh."
2662         ;;
2663 '') ;;
2664 *)
2665         echo " "
2666 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2667         $echo $n "hi there$c" >foo1
2668         echo $n "hi there$c" >foo2
2669         if cmp foo1 foo2 >/dev/null 2>&1; then
2670                 echo "They are compatible.  In fact, they may be identical."
2671         else
2672                 case "$n" in
2673                 '-n') n='' c='\c';;
2674                 *) n='-n' c='';;
2675                 esac
2676                 cat <<FOO
2677 They are not compatible!  You are probably running ksh on a non-USG system.
2678 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2679 have echo built in and we may have to run some Bourne shell scripts.  That
2680 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2681
2682 FOO
2683                 $echo $n "The star should be here-->$c"
2684                 $echo "*"
2685         fi
2686         $rm -f foo1 foo2
2687         ;;
2688 esac
2689
2690 # This question was auctioned at YAPC::Europe-2007 in Vienna
2691 # I never promised you could answer it. I only auctioned the question.
2692 cat <<FOO
2693 The following message is sponsored by
2694
2695   Dresden.pm<--The stars should be here.
2696
2697 Dear Perl user, system administrator or package
2698 maintainer, the Perl community sends greetings to
2699 you. Do you (emblematical) greet back [Y/n]? n
2700
2701 FOO
2702
2703 : Check what type of C compiler we use
2704 cat <<EOS >trygcc
2705 $startsh
2706 EOS
2707 cat <<'EOSC' >>trygcc
2708 case "$cc" in
2709 '') ;;
2710 *)  $rm -f try try.*
2711     $cat >try.c <<EOM
2712 int main(int argc, char *argv[]) {
2713   return 0;
2714 }
2715 EOM
2716     if $cc -o try $ccflags $ldflags try.c; then
2717        :
2718     else
2719         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2720         despair=yes
2721         trygcc=yes
2722         case "$cc" in
2723         *gcc*) trygcc=no ;;
2724         esac
2725         # Skip this test because it gives a false match on output like:
2726         #    ./trygcc: line 23: cc: command not found
2727         # case "`$cc -v -c try.c 2>&1`" in
2728         # *gcc*) trygcc=no ;;
2729         # esac
2730         if $test X"$trygcc" = Xyes; then
2731             if gcc -o try -c try.c; then
2732                 echo " "
2733                 echo "You seem to have a working gcc, though." >&4
2734                 # Switching compilers may undo the work of hints files.
2735                 # The most common problem is -D_REENTRANT for threads.
2736                 # This heuristic catches that case, but gets false positives
2737                 # if -Dusethreads was not actually specified.  Better to
2738                 # bail out here with a useful message than fail
2739                 # mysteriously later. Should we perhaps just try to
2740                 # re-invoke Configure -Dcc=gcc config_args ?
2741                 if $test -f usethreads.cbu; then
2742                         $cat >&4 <<EOM
2743
2744 *** However, any setting of the C compiler flags (e.g. for thread support)
2745 *** will be lost.  It may be necessary for you to restart Configure and
2746 *** add -Dcc=gcc to your Configure command line.
2747
2748 EOM
2749                         rp="Would you like to go ahead and try gcc anyway?"
2750                         dflt=n
2751                 else
2752                         rp="Would you like to use it?"
2753                         dflt=y
2754                 fi
2755                 if $test -f myread; then
2756                     . ./myread
2757                 else
2758                     if $test -f UU/myread; then
2759                         . ./UU/myread
2760                     else
2761                         echo "Cannot find myread, sorry.  Aborting." >&2
2762                         exit 1
2763                     fi
2764                 fi
2765                 case "$ans" in
2766                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2767                 esac
2768             fi
2769         fi
2770     fi
2771     $rm -f try try.*
2772     ;;
2773 esac
2774 EOSC
2775
2776 cat <<EOS >checkcc
2777 $startsh
2778 EOS
2779 cat <<'EOSC' >>checkcc
2780 case "$cc" in
2781 '') ;;
2782 *)  $rm -f try try.*
2783     $cat >try.c <<EOM
2784 int main(int argc, char *argv[]) {
2785   return 0;
2786 }
2787 EOM
2788     if $cc -o try $ccflags $ldflags try.c; then
2789        :
2790     else
2791         if $test X"$despair" = Xyes; then
2792            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2793         fi
2794         $cat >&4 <<EOM
2795 You need to find a working C compiler.
2796 Either (purchase and) install the C compiler supplied by your OS vendor,
2797 or for a free C compiler try http://gcc.gnu.org/
2798 I cannot continue any further, aborting.
2799 EOM
2800         exit 1
2801     fi
2802     $rm -f try try.*
2803     ;;
2804 esac
2805 EOSC
2806
2807 : determine whether symbolic links are supported
2808 echo " "
2809 $touch blurfl
2810 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2811         echo "Symbolic links are supported." >&4
2812         lns="$ln -s"
2813 else
2814         echo "Symbolic links are NOT supported." >&4
2815         lns="$ln"
2816 fi
2817 $rm -f blurfl sym
2818
2819 : determine whether symbolic links are supported
2820 echo " "
2821 case "$lns" in
2822 *"ln"*" -s")
2823         echo "Checking how to test for symbolic links..." >&4
2824         $lns blurfl sym
2825         if $test "X$issymlink" = X; then
2826                 case "$newsh" in
2827                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2828                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2829                 esac
2830                 if test $? = 0; then
2831                         issymlink="test -h"
2832                 else
2833                         echo "Your builtin 'test -h' may be broken." >&4
2834                         case "$test" in
2835                         /*)     ;;
2836                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2837                                 for p in $pth
2838                                 do
2839                                         if test -f "$p/$test"; then
2840                                                 test="$p/$test"
2841                                                 break
2842                                         fi
2843                                 done
2844                                 ;;
2845                         esac
2846                         case "$test" in
2847                         /*)
2848                                 echo "Trying external '$test -h'." >&4
2849                                 issymlink="$test -h"
2850                                 if $test ! -h sym >/dev/null 2>&1; then
2851                                         echo "External '$test -h' is broken, too." >&4
2852                                         issymlink=''
2853                                 fi
2854                                 ;;
2855                         *)      issymlink='' ;;
2856                         esac
2857                 fi
2858         fi
2859         if $test "X$issymlink" = X; then
2860                 if $test -L sym 2>/dev/null; then
2861                         issymlink="$test -L"
2862                         echo "The builtin '$test -L' worked." >&4
2863                 fi
2864         fi
2865         if $test "X$issymlink" != X; then
2866                 echo "You can test for symbolic links with '$issymlink'." >&4
2867         else
2868                 echo "I do not know how you can test for symbolic links." >&4
2869         fi
2870         $rm -f blurfl sym
2871         ;;
2872 *)      echo "No symbolic links, so not testing for their testing..." >&4
2873         ;;
2874 esac
2875 echo " "
2876
2877 : Make symlinks util
2878 case "$mksymlinks" in
2879 $define|true|[yY]*)
2880         case "$src" in
2881         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2882                 exit 1
2883                 ;;
2884         *)      case "$lns:$issymlink" in
2885                 *"ln"*" -s:"*"test -"?)
2886                         echo "Creating the symbolic links..." >&4
2887                         cd ..
2888                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2889                         awk 'NF == 1 {
2890                                 dir=".";
2891                                 file=$1 "";
2892                              }
2893                              NF == 2 {
2894                                 dir=$1 "";
2895                                 file=$2 "";
2896                              }
2897                              {
2898                                  print "# dir = ", dir, "file = ", file
2899                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2900                              } END {
2901                                  for (d in mf) {
2902                                      if (d != ".") { print("mkdir -p "d) }
2903                                      print("ln -sf "mf[d]" "d);
2904                                  }
2905                              }' source="$src" > UU/mksymlinks.$$
2906                         sh UU/mksymlinks.$$
2907                         rm UU/mksymlinks.$$
2908                         # Sanity check 1.
2909                         if test ! -d t/base; then
2910                                 echo "Failed to create the subdirectories.  Aborting." >&4
2911                                 exit 1
2912                         fi
2913                         # Sanity check 2.
2914                         if test ! -f t/base/lex.t; then
2915                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2916                                 exit 1
2917                         fi
2918                         if test ! -f win32/win32.c; then
2919                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2920                                 exit 1
2921                         fi
2922                         cd UU
2923                         ;;
2924                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2925                         ;;
2926                 esac
2927                 ;;
2928         esac
2929         ;;
2930 esac
2931
2932 : Check for Cross-Compilation
2933 if $test "X$targethost" = "X"; then
2934     targethost=""
2935 fi
2936 if $test "X$targetenv" = "X"; then
2937     targetenv=""
2938 fi
2939 case "$usecrosscompile" in
2940 $define|true|[yY]*)
2941         $echo "Cross-compiling..."
2942         croak=''
2943         case "$cc" in
2944         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2945             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2946             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2947             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2948             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2949             # leave out ld, choosing it is more complex
2950             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2951             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2952             # We are in a weird spot. Just before us, some values
2953             # were 'saved', to be restored after the hints are
2954             # run.  This means that the changes we made to ar,
2955             # nm and ranlib will get reverted.
2956             # To avoid that, we hijack the saving mechanism and
2957             # have it save our new values.
2958             for file in ar nm ranlib; do
2959                 eval xxx=\$$file
2960                 eval $file=$xxx$_exe
2961                 eval _$file=$xxx
2962             done
2963         ;;
2964         esac
2965         case "$targetarch" in
2966         '') echo "Targetarch not defined." >&4; croak=y ;;
2967         *)  echo "Using targetarch $targetarch." >&4 ;;
2968         esac
2969         case "$targethost" in
2970         '') echo "Targethost not defined." >&4; croak=y ;;
2971         *)  echo "Using targethost $targethost." >&4
2972         esac
2973         locincpth=' '
2974         loclibpth=' '
2975         case "$croak" in
2976         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2977         esac
2978     : compile a host miniperl and generate_uudmap, unless we got passed them
2979     if $test "X$hostperl" = X; then
2980       echo "Building host miniperl and generate_uudmap binaries" >&4
2981       before_host=`pwd`
2982       cd ..
2983       cd $src
2984       src=`pwd`
2985       rm -rf $src/host
2986       mkdir $src/host
2987       cd $src/host
2988       $src/Configure -des -Dusedevel -Dmksymlinks
2989       $make miniperl
2990       case "$hostgenerate" in
2991       '') $make generate_uudmap
2992           hostgenerate=$src/host/generate_uudmap
2993           ;;
2994        "$undef") hostgenerate=''
2995           ;;
2996       esac
2997       hostperl=$src/host/miniperl
2998       cd $before_host
2999     fi
3000     hostosname=`$hostperl -le 'print $^O'`
3001     ;;
3002 *)
3003     usecrosscompile="$undef"
3004     ;;
3005 esac
3006
3007 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3008 case "$targethost" in
3009     '') echo "Checking for cross-compile" >&4
3010     case "$usecrosscompile$multiarch" in
3011        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3012          if [ -f Makefile ]; then
3013            echo " "
3014            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3015          else
3016            echo "Configure done."
3017          fi
3018        exit 0
3019        ;;
3020      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3021         run=''
3022         to=:
3023         from=:
3024         ;;
3025     esac
3026     ;;
3027     *) echo "Using targethost $targethost." >&4
3028         case "$src" in
3029         /*) run=$src/Cross/run
3030             targetmkdir=$src/Cross/mkdir
3031             to=$src/Cross/to
3032             from=$src/Cross/from
3033             ;;
3034         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3035             run=$pwd/Cross/run
3036             targetmkdir=$pwd/Cross/mkdir
3037             to=$pwd/Cross/to
3038             from=$pwd/Cross/from
3039             ;;
3040         esac
3041         case "$targetrun" in
3042         '') targetrun=ssh ;;
3043         esac
3044         case "$targetto" in
3045         '') targetto=scp ;;
3046         esac
3047         case "$targetfrom" in
3048         '') targetfrom=scp ;;
3049         esac
3050         run=$run-$targetrun
3051         to=$to-$targetto
3052         from=$from-$targetfrom
3053         case "$targetdir" in
3054         '')  targetdir=/tmp
3055              echo "Guessing targetdir $targetdir." >&4
3056              ;;
3057         esac
3058         case "$targetuser" in
3059         '')  targetuser=root
3060              echo "Guessing targetuser $targetuser." >&4
3061              ;;
3062         esac
3063         case "$targetport" in
3064         '')  targetport=22
3065              echo "Guessing targetport $targetport." >&4
3066              ;;
3067         esac
3068         case "$targetfrom" in
3069         scp)    q=-q ;;
3070         *)      q='' ;;
3071         esac
3072         case "$targetrun" in
3073         ssh|rsh)
3074             cat >$run <<EOF
3075 #!/bin/sh
3076 env=''
3077 case "\$1" in
3078 -cwd)
3079   shift
3080   cwd=\$1
3081   shift
3082   ;;
3083 esac
3084 case "\$1" in
3085 -env)
3086   shift
3087   env=\$1
3088   shift
3089   ;;
3090 esac
3091 case "\$cwd" in
3092 '') cwd=$targetdir ;;
3093 esac
3094 exe=\$1
3095 shift
3096 $to \$exe
3097 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3098 EOF
3099             ;;
3100         adb)
3101             $touch $run
3102             ;;
3103         *)  echo "Unknown targetrun '$targetrun'" >&4
3104             exit 1
3105             ;;
3106         esac
3107         case "$targetmkdir" in
3108         */Cross/mkdir)
3109             cat >$targetmkdir <<EOF
3110 #!/bin/sh
3111 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3112 EOF
3113             $chmod a+rx $targetmkdir
3114             ;;
3115         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3116             exit 1
3117             ;;
3118         esac
3119         case "$targetto" in
3120         scp|rcp)
3121             cat >$to <<EOF
3122 #!/bin/sh
3123 for f in \$@
3124 do
3125   case "\$f" in
3126   /*)
3127     $targetmkdir \`dirname \$f\`
3128     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3129     ;;
3130   *)
3131     $targetmkdir $targetdir/\`dirname \$f\`
3132     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3133     ;;
3134   esac
3135 done
3136 exit 0
3137 EOF
3138             ;;
3139         cp) cat >$to <<EOF
3140 #!/bin/sh
3141 for f in \$@
3142 do
3143   case "\$f" in
3144   /*)
3145     $mkdir -p $targetdir/\`dirname \$f\`
3146     $cp \$f $targetdir/\$f || exit 1
3147     ;;
3148   *)
3149     $targetmkdir $targetdir/\`dirname \$f\`
3150     $cp \$f $targetdir/\$f || exit 1
3151     ;;
3152   esac
3153 done
3154 exit 0
3155 EOF
3156             ;;
3157         *)  echo "Unknown targetto '$targetto'" >&4
3158             exit 1
3159             ;;
3160         esac
3161         case "$targetfrom" in
3162         scp|rcp)
3163           cat >$from <<EOF
3164 #!/bin/sh
3165 for f in \$@
3166 do
3167   $rm -f \$f
3168   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3169 done
3170 exit 0
3171 EOF
3172             ;;
3173         cp) cat >$from <<EOF
3174 #!/bin/sh
3175 for f in \$@
3176 do
3177   $rm -f \$f
3178   cp $targetdir/\$f . || exit 1
3179 done
3180 exit 0
3181 EOF
3182             ;;
3183         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3184             exit 1
3185             ;;
3186         esac
3187         if $test ! -f $run; then
3188             echo "Target 'run' script '$run' not found." >&4
3189         else
3190             $chmod a+rx $run
3191         fi
3192         if $test ! -f $to; then
3193             echo "Target 'to' script '$to' not found." >&4
3194         else
3195             $chmod a+rx $to
3196         fi
3197         if $test ! -f $from; then
3198             echo "Target 'from' script '$from' not found." >&4
3199         else
3200             $chmod a+rx $from
3201         fi
3202         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3203             exit 1
3204         fi
3205         cat >&4 <<EOF
3206 Using '$run' for remote execution,
3207 and '$from' and '$to'
3208 for remote file transfer.
3209 EOF
3210         ;;
3211 *)      run=''
3212         to=:
3213         from=:
3214         usecrosscompile="$undef"
3215         targetarch=''
3216         ;;
3217 esac
3218
3219 : see whether [:lower:] and [:upper:] are supported character classes
3220 echo " "
3221 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3222 ABYZ-abyz)
3223         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3224         up='[:upper:]'
3225         low='[:lower:]'
3226         ;;
3227 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3228         # (0xd9 and 0xe2), therefore that is a nice testing point.
3229         if test "X$up" = X -o "X$low" = X; then
3230             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3231             rs) up='[A-Z]'
3232                 low='[a-z]'
3233                 ;;
3234             esac
3235         fi
3236         if test "X$up" = X -o "X$low" = X; then
3237             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3238             rs) up='A-Z'
3239                 low='a-z'
3240                 ;;
3241             esac
3242         fi
3243         if test "X$up" = X -o "X$low" = X; then
3244             case "`echo RS | od -x 2>/dev/null`" in
3245             *D9E2*|*d9e2*)
3246                 echo "Hey, this might be EBCDIC." >&4
3247                 if test "X$up" = X -o "X$low" = X; then
3248                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3249                     rs) up='[A-IJ-RS-Z]'
3250                         low='[a-ij-rs-z]'
3251                         ;;
3252                     esac
3253                 fi
3254                 if test "X$up" = X -o "X$low" = X; then
3255                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3256                     rs) up='A-IJ-RS-Z'
3257                         low='a-ij-rs-z'
3258                         ;;
3259                     esac
3260                 fi
3261                 ;;
3262             esac
3263         fi
3264 esac
3265 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3266 rs)
3267     echo "Using $up and $low to convert case." >&4
3268     ;;
3269 *)
3270     echo "I don't know how to translate letters from upper to lower case." >&4
3271     echo "Your tr is not acting any way I know of." >&4
3272     exit 1
3273     ;;
3274 esac
3275 : set up the translation script tr, must be called with ./tr of course
3276 cat >tr <<EOSC
3277 $startsh
3278 case "\$1\$2" in
3279 '[A-Z][a-z]') exec $tr '$up' '$low';;
3280 '[a-z][A-Z]') exec $tr '$low' '$up';;
3281 esac
3282 exec $tr "\$@"
3283 EOSC
3284 chmod +x tr
3285 $eunicefix tr
3286
3287 : Try to determine whether config.sh was made on this system
3288 case "$config_sh" in
3289 '')
3290 myuname=`$uname -a 2>/dev/null`
3291 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3292 # Downcase everything to avoid ambiguity.
3293 # Remove slashes and single quotes so we can use parts of this in
3294 # directory and file names.
3295 # Remove newlines so myuname is sane to use elsewhere.
3296 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3297 # because the A-Z/a-z are not consecutive.
3298 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3299         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3300 newmyuname="$myuname"
3301 dflt=n
3302 case "$knowitall" in
3303 '')
3304         if test -f ../config.sh; then
3305                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3306                         eval "`grep myuname= ../config.sh`"
3307                 fi
3308                 if test "X$myuname" = "X$newmyuname"; then
3309                         dflt=y
3310                 fi
3311         fi
3312         ;;
3313 *) dflt=y;;
3314 esac
3315
3316 : Get old answers from old config file if Configure was run on the
3317 : same system, otherwise use the hints.
3318 hint=default
3319 cd ..
3320 if test -f config.sh; then
3321         echo " "
3322         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3323         . UU/myread
3324         case "$ans" in
3325         n*|N*) echo "OK, I'll ignore it."
3326                 mv config.sh config.sh.old
3327                 myuname="$newmyuname"
3328                 ;;
3329         *)  echo "Fetching default answers from your old config.sh file..." >&4
3330                 tmp_n="$n"
3331                 tmp_c="$c"
3332                 tmp_sh="$sh"
3333                 . ./config.sh
3334                 cp config.sh UU
3335                 n="$tmp_n"
3336                 c="$tmp_c"
3337                 : Older versions did not always set $sh.  Catch re-use of such
3338                 : an old config.sh.
3339                 case "$sh" in
3340                 '') sh="$tmp_sh" ;;
3341                 esac
3342                 hint=previous
3343                 ;;
3344         esac
3345 fi
3346 . ./UU/checkcc
3347 if test ! -f config.sh; then
3348         $cat <<EOM
3349
3350 First time through, eh?  I have some defaults handy for some systems
3351 that need some extra help getting the Configure answers right:
3352
3353 EOM
3354         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3355         dflt=''
3356         : Half the following guesses are probably wrong... If you have better
3357         : tests or hints, please send them to perlbug@perl.org
3358         : The metaconfig authors would also appreciate a copy...
3359         $test -f /irix && osname=irix
3360         $test -f /xenix && osname=sco_xenix
3361         $test -f /dynix && osname=dynix
3362         $test -f /dnix && osname=dnix
3363         $test -f /lynx.os && osname=lynxos
3364         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3365         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3366         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3367         $test -f /bin/mips && /bin/mips && osname=mips
3368         $test -d /usr/apollo/bin && osname=apollo
3369         $test -f /etc/saf/_sactab && osname=svr4
3370         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3371         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3372         $test -f /sys/utilities/MultiView && osname=amigaos
3373         if $test -d /MachTen -o -d /MachTen_Folder; then
3374                 osname=machten
3375                 if $test -x /sbin/version; then
3376                         osvers=`/sbin/version | $awk '{print $2}' |
3377                         $sed -e 's/[A-Za-z]$//'`
3378                 elif $test -x /usr/etc/version; then
3379                         osvers=`/usr/etc/version | $awk '{print $2}' |
3380                         $sed -e 's/[A-Za-z]$//'`
3381                 else
3382                         osvers="$2.$3"
3383                 fi
3384         fi
3385
3386         $test -f /sys/posix.dll &&
3387                 $test -f /usr/bin/what &&
3388                 set X `/usr/bin/what /sys/posix.dll` &&
3389                 $test "$3" = UWIN &&
3390                 osname=uwin &&
3391                 osvers="$5"
3392
3393         if $test -f $uname; then
3394                 set X $myuname
3395                 shift
3396
3397                 case "$5" in
3398                 fps*) osname=fps ;;
3399                 mips*)
3400                         case "$4" in
3401                         umips) osname=umips ;;
3402                         *) osname=mips ;;
3403                         esac;;
3404                 [23]100) osname=mips ;;
3405                 i386*)
3406                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3407                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3408                                 osname='sco'
3409                                 osvers=$tmp
3410                         elif $test -f /etc/kconfig; then
3411                                 osname=isc
3412                                 if test "$lns" = "$ln -s"; then
3413                                         osvers=4
3414                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3415                                         osvers=3
3416                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3417                                         osvers=2
3418                                 fi
3419                         fi
3420                         tmp=''
3421                         ;;
3422                 pc*)
3423                         if test -n "$DJGPP"; then
3424                                 osname=dos
3425                                 osvers=djgpp
3426                         fi
3427                         ;;
3428                 esac
3429
3430                 case "$1" in
3431                 aix) osname=aix
3432                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3433                         case "$tmp" in
3434                         # oslevel can fail with:
3435                         # oslevel: Unable to acquire lock.
3436                         *not\ found) osvers="$4"."$3" ;;
3437                         '<3240'|'<>3240') osvers=3.2.0 ;;
3438                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3439                         '=3250'|'>3250') osvers=3.2.5 ;;
3440                         *) osvers=$tmp;;
3441                         esac
3442                         ;;
3443                 bitrig) osname=bitrig
3444                         osvers="$3"
3445                         ;;
3446                 bsd386) osname=bsd386
3447                         osvers=`$uname -r`
3448                         ;;
3449                 cygwin*) osname=cygwin
3450                         osvers="$3"
3451                         ;;
3452                 *dc.osx) osname=dcosx
3453                         osvers="$3"
3454                         ;;
3455                 dnix) osname=dnix
3456                         osvers="$3"
3457                         ;;
3458                 domainos) osname=apollo
3459                         osvers="$3"
3460                         ;;
3461                 dgux)   osname=dgux
3462                         osvers="$3"
3463                         ;;
3464                 dragonfly) osname=dragonfly
3465                         osvers="$3"
3466                         ;;
3467                 dynixptx*) osname=dynixptx
3468                         osvers=`echo "$4"|sed 's/^v//'`
3469                         ;;
3470                 freebsd) osname=freebsd
3471                         osvers="$3" ;;
3472                 genix)  osname=genix ;;
3473                 gnu)    osname=gnu
3474                         osvers="$3" ;;
3475                 hp*)    osname=hpux
3476                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3477                         ;;
3478                 irix*)  osname=irix
3479                         case "$3" in
3480                         4*) osvers=4 ;;
3481                         5*) osvers=5 ;;
3482                         *)      osvers="$3" ;;
3483                         esac
3484                         ;;
3485                 linux)  osname=linux
3486                         case "$3" in
3487                         *)      osvers="$3" ;;
3488                         esac
3489                         $test -f /system/lib/libandroid.so && osname=linux-android
3490                         ;;
3491                 MiNT)   osname=mint
3492                         ;;
3493                 netbsd*) osname=netbsd
3494                         osvers="$3"
3495                         ;;
3496                 news-os) osvers="$3"
3497                         case "$3" in
3498                         4*) osname=newsos4 ;;
3499                         *) osname=newsos ;;
3500                         esac
3501                         ;;
3502                 nonstop-ux) osname=nonstopux ;;
3503                 openbsd) osname=openbsd
3504                         osvers="$3"
3505                         ;;
3506                 os2)    osname=os2
3507                         osvers="$4"
3508                         ;;
3509                 POSIX-BC | posix-bc ) osname=posix-bc
3510                         osvers="$3"
3511                         ;;
3512                 powerux | power_ux | powermax_os | powermaxos | \
3513                 powerunix | power_unix) osname=powerux
3514                         osvers="$3"
3515                         ;;
3516                 qnx) osname=qnx
3517                         osvers="$4"
3518                         ;;
3519                 solaris) osname=solaris
3520                         case "$3" in
3521                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3522                         *)      osvers="$3" ;;
3523                         esac
3524                         ;;
3525                 sunos) osname=sunos
3526                         case "$3" in
3527                         5*) osname=solaris
3528                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3529                         *)      osvers="$3" ;;
3530                         esac
3531                         ;;
3532                 titanos) osname=titanos
3533                         case "$3" in
3534                         1*) osvers=1 ;;
3535                         2*) osvers=2 ;;
3536                         3*) osvers=3 ;;
3537                         4*) osvers=4 ;;
3538                         *)      osvers="$3" ;;
3539                         esac
3540                         ;;
3541                 ultrix) osname=ultrix
3542                         osvers="$3"
3543                         ;;
3544                 osf1|mls+)      case "$5" in
3545                                 alpha)
3546                                         osname=dec_osf
3547                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3548                                         case "$osvers" in
3549                                         [1-9].[0-9]*) ;;
3550                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3551                                         esac
3552                                         ;;
3553                         hp*)    osname=hp_osf1  ;;
3554                         mips)   osname=mips_osf1 ;;
3555                         esac
3556                         ;;
3557                 # UnixWare 7.1.2 is known as Open UNIX 8
3558                 openunix|unixware) osname=svr5
3559                         osvers="$4"
3560                         ;;
3561                 uts)    osname=uts
3562                         osvers="$3"
3563                         ;;
3564                 vos) osvers="$3"
3565                         ;;
3566                 $2) case "$osname" in
3567                         *isc*) ;;
3568                         *freebsd*) ;;
3569                         svr*)
3570                                 : svr4.x or possibly later
3571                                 case "svr$3" in
3572                                 ${osname}*)
3573                                         osname=svr$3
3574                                         osvers=$4
3575                                         ;;
3576                                 esac
3577                                 case "$osname" in
3578                                 svr4.0)
3579                                         : Check for ESIX
3580                                         if test -f /stand/boot ; then
3581                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3582                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3583                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3584                                                         if test -n "$isesix"; then
3585                                                                 osname=esix4
3586                                                         fi
3587                                                 fi
3588                                         fi
3589                                         ;;
3590                                 esac
3591                                 ;;
3592                         *)      if test -f /etc/systemid; then
3593                                         osname=sco
3594                                         set `echo $3 | $sed 's/\./ /g'` $4
3595                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3596                                                 osvers=$1.$2.$3
3597                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3598                                                 osvers=$1.$2
3599                                         elif $test -f $src/hints/sco_$1.sh; then
3600                                                 osvers=$1
3601                                         fi
3602                                 else
3603                                         case "$osname" in
3604                                         '') : Still unknown.  Probably a generic Sys V.
3605                                                 osname="sysv"
3606                                                 osvers="$3"
3607                                                 ;;
3608                                         esac
3609                                 fi
3610                                 ;;
3611                         esac
3612                         ;;
3613                 *)      case "$osname" in
3614                         '') : Still unknown.  Probably a generic BSD.
3615                                 osname="$1"
3616                                 osvers="$3"
3617                                 ;;
3618                         esac
3619                         ;;
3620                 esac
3621         else
3622                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3623                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3624                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3625                                 osname=news_os
3626                         fi
3627                         $rm -f UU/kernel.what
3628                 elif test -d c:/. -o -n "$is_os2" ; then
3629                         set X $myuname
3630                         osname=os2
3631                         osvers="$5"
3632                 fi
3633         fi
3634
3635         case "$targetarch" in
3636         '') ;;
3637         *)  hostarch=$osname
3638             case "$targetarch" in
3639                 nto*|*-nto-*)
3640                     # Will load qnx.sh, which should change osname to nto
3641                     osname=qnx
3642                     osvers=''
3643                     ;;
3644                 *linux-android*)
3645                     # Catch arm-linux-androideabi, mipsel-linux-android,
3646                     # and i686-linux-android
3647                     osname=linux-android
3648                     osvers=''
3649                     ;;
3650                 *linux*)
3651                     # Something like arm-linux-gnueabihf is really just
3652                     # plain linux.
3653                     osname=linux
3654                     osvers=''
3655                     ;;
3656                 *solaris*|*sunos*)
3657                     osname=solaris
3658                     # XXX perhaps we should just assume
3659                     # osvers to be 2, or maybe take the value
3660                     # from targetarch. Using $run before the
3661                     # hints are run is somewhat icky.
3662                     set X `$run $uname -a 2>/dev/null`
3663                     shift
3664                     case "$3" in
3665                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3666                         *)  osvers="$3" ;;
3667                     esac
3668                     ;;
3669                 *)
3670                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3671                     osvers=''
3672                 ;;
3673             esac
3674             ;;
3675         esac
3676
3677         : Now look for a hint file osname_osvers, unless one has been
3678         : specified already.
3679         case "$hintfile" in
3680         ''|' ')
3681                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3682                 : Also try without trailing minor version numbers.
3683                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3684                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3685                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3686                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3687                 case "$file" in
3688                 '') dflt=none ;;
3689                 *)  case "$osvers" in
3690                         '') dflt=$file
3691                                 ;;
3692                         *)  if $test -f $src/hints/$file.sh ; then
3693                                         dflt=$file
3694                                 elif $test -f $src/hints/$xfile.sh ; then
3695                                         dflt=$xfile
3696                                 elif $test -f $src/hints/$xxfile.sh ; then
3697                                         dflt=$xxfile
3698                                 elif $test -f $src/hints/$xxxfile.sh ; then
3699                                         dflt=$xxxfile
3700                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3701                                         dflt=$xxxxfile
3702                                 elif $test -f "$src/hints/${osname}.sh" ; then
3703                                         dflt="${osname}"
3704                                 else
3705                                         dflt=none
3706                                 fi
3707                                 ;;
3708                         esac
3709                         ;;
3710                 esac
3711                 if $test -f Policy.sh ; then
3712                         case "$dflt" in
3713                         *Policy*) ;;
3714                         none) dflt="Policy" ;;
3715                         *) dflt="Policy $dflt" ;;
3716                         esac
3717                 fi
3718                 ;;
3719         *)
3720                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3721                 ;;
3722         esac
3723
3724         if $test -f Policy.sh ; then
3725                 $cat <<EOM
3726
3727 There's also a Policy hint file available, which should make the
3728 site-specific (policy) questions easier to answer.
3729 EOM
3730
3731         fi
3732
3733         $cat <<EOM
3734
3735 You may give one or more space-separated answers, or "none" if appropriate.
3736 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3737 previous run of Configure, you may specify it as well as or instead of
3738 OS-specific hints.  If hints are provided for your OS, you should use them:
3739 although Perl can probably be built without hints on many platforms, using
3740 hints often improve performance and may enable features that Configure can't
3741 set up on its own. If there are no hints that match your OS, specify "none";
3742 DO NOT give a wrong version or a wrong OS.
3743
3744 EOM
3745
3746         rp="Which of these apply, if any?"
3747         . UU/myread
3748         tans=$ans
3749         for file in $tans; do
3750                 if $test X$file = XPolicy -a -f Policy.sh; then
3751                         . Policy.sh
3752                         $cat Policy.sh >> UU/config.sh
3753                 elif $test -f $src/hints/$file.sh; then
3754                         . $src/hints/$file.sh
3755                         $cat $src/hints/$file.sh >> UU/config.sh
3756                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3757                         : nothing
3758                 else
3759                         : Give one chance to correct a possible typo.
3760                         echo "$file.sh does not exist"
3761                         dflt=$file
3762                         rp="hint to use instead?"
3763                         . UU/myread
3764                         for file in $ans; do
3765                                 if $test -f "$src/hints/$file.sh"; then
3766                                         . $src/hints/$file.sh
3767                                         $cat $src/hints/$file.sh >> UU/config.sh
3768                                 elif $test X$ans = X -o X$ans = Xnone ; then
3769                                         : nothing
3770                                 else
3771                                         echo "$file.sh does not exist -- ignored."
3772                                 fi
3773                         done
3774                 fi
3775         done
3776
3777         hint=recommended
3778         : Remember our hint file for later.
3779         if $test -f "$src/hints/$file.sh" ; then
3780                 hintfile="$file"
3781         else
3782                 hintfile=''
3783         fi
3784 fi
3785 cd UU
3786 ;;
3787 *)
3788         echo " "
3789         echo "Fetching default answers from $config_sh..." >&4
3790         tmp_n="$n"
3791         tmp_c="$c"
3792         cd ..
3793         cp $config_sh config.sh 2>/dev/null
3794         chmod +w config.sh
3795         . ./config.sh
3796         cd UU
3797         cp ../config.sh .
3798         n="$tmp_n"
3799         c="$tmp_c"
3800         hint=previous
3801         ;;
3802 esac
3803 . ./optdef.sh
3804
3805 : Restore computed paths
3806 for file in $loclist $trylist; do
3807         eval $file="\$_$file"
3808 done
3809
3810 cat << EOM
3811
3812 Configure uses the operating system name and version to set some defaults.
3813 The default value is probably right if the name rings a bell. Otherwise,
3814 since spelling matters for me, either accept the default or answer "none"
3815 to leave it blank.
3816
3817 EOM
3818 case "$osname" in
3819         ''|' ')
3820                 case "$hintfile" in
3821                 ''|' '|none) dflt=none ;;
3822                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3823                 esac
3824                 ;;
3825         *) dflt="$osname" ;;
3826 esac
3827 rp="Operating system name?"
3828 . ./myread
3829 case "$ans" in
3830 none)  osname='' ;;
3831 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3832 esac
3833 echo " "
3834 case "$osvers" in
3835         ''|' ')
3836                 case "$hintfile" in
3837                 ''|' '|none) dflt=none ;;
3838                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3839                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3840                         case "$dflt" in
3841                         ''|' ') dflt=none ;;
3842                         esac
3843                         ;;
3844                 esac
3845                 ;;
3846         *) dflt="$osvers" ;;
3847 esac
3848 rp="Operating system version?"
3849 . ./myread
3850 case "$ans" in
3851 none)  osvers='' ;;
3852 *) osvers="$ans" ;;
3853 esac
3854
3855
3856 . ./posthint.sh
3857
3858 : who configured the system
3859 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3860 case "$cf_by" in
3861 "")
3862         cf_by=`(logname) 2>/dev/null`
3863         case "$cf_by" in
3864         "")
3865                 cf_by=`(whoami) 2>/dev/null`
3866                 case "$cf_by" in
3867                 "") cf_by=unknown ;;
3868                 esac ;;
3869         esac ;;
3870 esac
3871
3872 : decide how portable to be.  Allow command line overrides.
3873 case "$d_portable" in
3874 "$undef") ;;
3875 *)      d_portable="$define" ;;
3876 esac
3877
3878 : set up shell script to do ~ expansion
3879 cat >filexp <<EOSS
3880 $startsh
3881 : expand filename
3882 case "\$1" in
3883  \~/*|\~)
3884         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3885         ;;
3886  \~*)
3887         if $test -f /bin/csh; then
3888                 /bin/csh -f -c "glob \$1"
3889                 failed=\$?
3890                 echo ""
3891                 exit \$failed
3892         else
3893                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3894                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3895                 if $test ! -d "\$dir"; then
3896                         me=\`basename \$0\`
3897                         echo "\$me: can't locate home directory for: \$name" >&2
3898                         exit 1
3899                 fi
3900                 case "\$1" in
3901                 */*)
3902                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3903                         ;;
3904                 *)
3905                         echo \$dir
3906                         ;;
3907                 esac
3908         fi
3909         ;;
3910 *)
3911         echo \$1
3912         ;;
3913 esac
3914 EOSS
3915 chmod +x filexp
3916 $eunicefix filexp
3917
3918 : now set up to get a file name
3919 cat <<EOS >getfile
3920 $startsh
3921 EOS
3922 cat <<'EOSC' >>getfile
3923 tilde=''
3924 fullpath=''
3925 already=''
3926 skip=''
3927 none_ok=''
3928 exp_file=''
3929 nopath_ok=''
3930 orig_rp="$rp"
3931 orig_dflt="$dflt"
3932 case "$gfpth" in
3933 '') gfpth='.' ;;
3934 esac
3935
3936 case "$fn" in
3937 *\(*)
3938         : getfile will accept an answer from the comma-separated list
3939         : enclosed in parentheses even if it does not meet other criteria.
3940         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3941         fn=`echo $fn | sed 's/(.*)//'`
3942         ;;
3943 esac
3944
3945 case "$fn" in
3946 *:*)
3947         loc_file=`expr $fn : '.*:\(.*\)'`
3948         fn=`expr $fn : '\(.*\):.*'`
3949         ;;
3950 esac
3951
3952 case "$fn" in
3953 *~*) tilde=true;;
3954 esac
3955 case "$fn" in
3956 */*) fullpath=true;;
3957 esac
3958 case "$fn" in
3959 *+*) skip=true;;
3960 esac
3961 case "$fn" in
3962 *n*) none_ok=true;;
3963 esac
3964 case "$fn" in
3965 *e*) exp_file=true;;
3966 esac
3967 case "$fn" in
3968 *p*) nopath_ok=true;;
3969 esac
3970
3971 case "$fn" in
3972 *f*) type='File';;
3973 *d*) type='Directory';;
3974 *l*) type='Locate';;
3975 esac
3976
3977 what="$type"
3978 case "$what" in
3979 Locate) what='File';;
3980 esac
3981
3982 case "$exp_file" in
3983 '')
3984         case "$d_portable" in
3985         "$define") ;;
3986         *) exp_file=true;;
3987         esac
3988         ;;
3989 esac
3990
3991 cd ..
3992 while test "$type"; do
3993         redo=''
3994         rp="$orig_rp"
3995         dflt="$orig_dflt"
3996         case "$tilde" in
3997         true) rp="$rp (~name ok)";;
3998         esac
3999         . UU/myread
4000         if test -f UU/getfile.ok && \
4001                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4002         then
4003                 value="$ans"
4004                 ansexp="$ans"
4005                 break
4006         fi
4007         case "$ans" in
4008         none)
4009                 value=''
4010                 ansexp=''
4011                 case "$none_ok" in
4012                 true) type='';;
4013                 esac
4014                 ;;
4015         *)
4016                 case "$tilde" in
4017                 '') value="$ans"
4018                         ansexp="$ans";;
4019                 *)
4020                         value=`UU/filexp $ans`
4021                         case $? in
4022                         0)
4023                                 if test "$ans" != "$value"; then
4024                                         echo "(That expands to $value on this system.)"
4025                                 fi
4026                                 ;;
4027                         *) value="$ans";;
4028                         esac
4029                         ansexp="$value"
4030                         case "$exp_file" in
4031                         '') value="$ans";;
4032                         esac
4033                         ;;
4034                 esac
4035                 case "$fullpath" in
4036                 true)
4037                         case "$ansexp" in
4038                         /*) value="$ansexp" ;;
4039                         [a-zA-Z]:/*) value="$ansexp" ;;
4040                         *)
4041                                 redo=true
4042                                 case "$already" in
4043                                 true)
4044                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4045                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4046                                         ;;
4047                                 *)
4048                                 echo "Please give a full path name, starting with slash." >&4
4049                                         case "$tilde" in
4050                                         true)
4051                                 echo "Note that using ~name is ok provided it expands well." >&4
4052                                                 already=true
4053                                                 ;;
4054                                         esac
4055                                 esac
4056                                 ;;
4057                         esac
4058                         ;;
4059                 esac
4060                 case "$redo" in
4061                 '')
4062                         case "$type" in
4063                         File)
4064                                 for fp in $gfpth; do
4065                                         if test "X$fp" = X.; then
4066                                             pf="$ansexp"
4067                                         else    
4068                                             pf="$fp/$ansexp"
4069                                         fi
4070                                         if test -f "$pf"; then
4071                                                 type=''
4072                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4073                                         then
4074                                                 echo "($value is not a plain file, but that's ok.)"
4075                                                 type=''
4076                                         fi
4077                                         if test X"$type" = X; then
4078                                             value="$pf"
4079                                             break
4080                                         fi
4081                                 done
4082                                 ;;
4083                         Directory)
4084                                 for fp in $gfpth; do
4085                                         if test "X$fp" = X.; then
4086                                             dir="$ans"
4087                                             direxp="$ansexp"
4088                                         else    
4089                                             dir="$fp/$ansexp"
4090                                             direxp="$fp/$ansexp"
4091                                         fi
4092                                         if test -d "$direxp"; then
4093                                                 type=''
4094                                                 value="$dir"
4095                                                 break
4096                                         fi
4097                                 done
4098                                 ;;
4099                         Locate)
4100                                 if test -d "$ansexp"; then
4101                                         echo "(Looking for $loc_file in directory $value.)"
4102                                         value="$value/$loc_file"
4103                                         ansexp="$ansexp/$loc_file"
4104                                 fi
4105                                 if test -f "$ansexp"; then
4106                                         type=''
4107                                 fi
4108                                 case "$nopath_ok" in
4109                                 true)   case "$value" in
4110                                         */*) ;;
4111                                         *)      echo "Assuming $value will be in people's path."
4112                                                 type=''
4113                                                 ;;
4114                                         esac
4115                                         ;;
4116                                 esac
4117                                 ;;
4118                         esac
4119
4120                         case "$skip" in
4121                         true) type='';
4122                         esac
4123
4124                         case "$type" in
4125                         '') ;;
4126                         *)
4127                                 if test "$fastread" = yes; then
4128                                         dflt=y
4129                                 else
4130                                         dflt=n
4131                                 fi
4132                                 rp="$what $value doesn't exist.  Use that name anyway?"
4133                                 . UU/myread
4134                                 dflt=''
4135                                 case "$ans" in
4136                                 y*) type='';;
4137                                 *) echo " ";;
4138                                 esac
4139                                 ;;
4140                         esac
4141                         ;;
4142                 esac
4143                 ;;
4144         esac
4145 done
4146 cd UU
4147 ans="$value"
4148 rp="$orig_rp"
4149 dflt="$orig_dflt"
4150 rm -f getfile.ok
4151 test "X$gfpthkeep" != Xy && gfpth=""
4152 EOSC
4153
4154 : determine root of directory hierarchy where package will be installed.
4155 case "$prefix" in
4156 '')
4157         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4158         ;;
4159 *?/)
4160         dflt=`echo "$prefix" | sed 's/.$//'`
4161         ;;
4162 *)
4163         dflt="$prefix"
4164         ;;
4165 esac
4166 $cat <<EOM
4167
4168 By default, $package will be installed in $dflt/bin, manual pages
4169 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4170 installation directories. Typically this is something like /usr/local.
4171 If you wish to have binaries under /usr/bin but other parts of the
4172 installation under /usr/local, that's ok: you will be prompted
4173 separately for each of the installation directories, the prefix being
4174 only used to set the defaults.
4175
4176 EOM
4177 fn=d~
4178 rp='Installation prefix to use?'
4179 . ./getfile
4180 oldprefix=''
4181 case "$prefix" in
4182 '') ;;
4183 *)
4184         case "$ans" in
4185         "$prefix") ;;
4186         *) oldprefix="$prefix";;
4187         esac
4188         ;;
4189 esac
4190 prefix="$ans"
4191 prefixexp="$ansexp"
4192
4193 : allow them to override the AFS root
4194 case "$afsroot" in
4195 '')     afsroot=/afs ;;
4196 *)      afsroot=$afsroot ;;
4197 esac
4198
4199 : is AFS running?
4200 echo " "
4201 case "$afs" in
4202 $define|true)   afs=true ;;
4203 $undef|false)   afs=false ;;
4204 *)      if $test -d $afsroot; then
4205                 afs=true
4206         else
4207                 afs=false
4208         fi
4209         ;;
4210 esac
4211 if $afs; then
4212         echo "AFS may be running... I'll be extra cautious then..." >&4
4213 else
4214         echo "AFS does not seem to be running..." >&4
4215 fi
4216
4217 : determine installation prefix for where package is to be installed.
4218 if $afs; then
4219 $cat <<EOM
4220
4221 Since you are running AFS, I need to distinguish the directory in which
4222 files will reside from the directory in which they are installed (and from
4223 which they are presumably copied to the former directory by occult means).
4224
4225 EOM
4226         case "$installprefix" in
4227         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4228         *) dflt="$installprefix";;
4229         esac
4230 else
4231 $cat <<EOM
4232
4233 In some special cases, particularly when building $package for distribution,
4234 it is convenient to distinguish the directory in which files should be
4235 installed from the directory ($prefix) in which they will
4236 eventually reside.  For most users, these two directories are the same.
4237
4238 EOM
4239         case "$installprefix" in
4240         '') dflt=$prefix ;;
4241         *) dflt=$installprefix;;
4242         esac
4243 fi
4244 fn=d~
4245 rp='What installation prefix should I use for installing files?'
4246 . ./getfile
4247 installprefix="$ans"
4248 installprefixexp="$ansexp"
4249
4250 : Perform the prefixexp/installprefixexp correction if necessary
4251 cat <<EOS >installprefix
4252 $startsh
4253 EOS
4254 cat <<'EOSC' >>installprefix
4255 : Change installation prefix, if necessary.
4256 if $test X"$prefix" != X"$installprefix"; then
4257     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4258 else
4259     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4260 fi
4261 EOSC
4262 chmod +x installprefix
4263 $eunicefix installprefix
4264
4265 : Set variables such as privlib and privlibexp from the output of ./getfile
4266 : performing the prefixexp/installprefixexp correction if necessary.
4267 cat <<EOS >setprefixvar
4268 $startsh
4269 EOS
4270 cat <<'EOSC' >>setprefixvar
4271 eval "${prefixvar}=\"\$ans\""
4272 eval "${prefixvar}exp=\"\$ansexp\""
4273 . ./installprefix
4274 EOSC
4275 chmod +x setprefixvar
4276 $eunicefix setprefixvar
4277
4278 : set up the script used to warn in case of inconsistency
4279 cat <<EOS >whoa
4280 $startsh
4281 EOS
4282 cat <<'EOSC' >>whoa
4283 dflt=y
4284 case "$hint" in
4285     recommended)
4286         case "$hintfile" in
4287         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4288                 ;;
4289         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4290                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4291                 ;;
4292         esac
4293         ;;
4294     *)  echo " "
4295         echo "*** WHOA THERE!!! ***" >&4
4296         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4297         ;;
4298 esac
4299 rp="    Keep the $hint value?"
4300 . ./myread
4301 case "$ans" in
4302 y) td=$was; tu=$was;;
4303 esac
4304 EOSC
4305
4306 : function used to set '$1' to '$val'
4307 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4308 case "$val$was" in
4309 $define$undef) . ./whoa; eval "$var=\$td";;
4310 $undef$define) . ./whoa; eval "$var=\$tu";;
4311 *) eval "$var=$val";;
4312 esac'
4313
4314 : get the patchlevel
4315 echo " "
4316 echo "Getting the current patchlevel..." >&4
4317 if $test -r $rsrc/patchlevel.h;then
4318         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4319         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4320         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4321         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4322         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4323         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4324         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4325 else
4326         revision=0
4327         patchlevel=0
4328         subversion=0
4329         api_revision=0
4330         api_version=0
4331         api_subversion=0
4332         perl_patchlevel=0
4333         $echo "(You do not have patchlevel.h.  Eek.)"
4334 fi
4335 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4336 version_patchlevel_string="version $patchlevel subversion $subversion"
4337 case "$perl_patchlevel" in
4338 0|'') ;;
4339 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4340     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4341     ;;
4342 esac
4343
4344 $echo "(You have $package $version_patchlevel_string.)"
4345
4346 case "$osname" in
4347 dos|vms)
4348         : XXX Should be a Configure test for double-dots in filenames.
4349         version=`echo $revision $patchlevel $subversion | \
4350                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4351         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4352                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4353         ;;
4354 *)
4355         version=`echo $revision $patchlevel $subversion | \
4356                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4357         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4358                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4359         ;;
4360 esac
4361 : Special case the 5.005_xx maintenance series, which used 5.005
4362 : without any subversion label as a subdirectory in $sitelib
4363 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4364         api_versionstring='5.005'
4365 fi
4366
4367 : Do we want threads support and if so, what type
4368 case "$usethreads" in
4369 $define|true|[yY]*)     dflt='y';;
4370 *)     # Catch case where user specified ithreads or 5005threads but
4371        # forgot -Dusethreads (A.D. 4/2002)
4372        case "$useithreads$use5005threads" in
4373        *$define*)       dflt='y';;
4374        *)               dflt='n';;
4375        esac
4376        ;;
4377 esac
4378 cat <<EOM
4379
4380 Perl can be built to offer a form of threading support on some systems
4381 To do so, Configure can be run with -Dusethreads.
4382
4383 Note that Perl built with threading support runs slightly slower
4384 and uses slightly more memory than plain Perl.
4385
4386 If this doesn't make any sense to you, just accept the default '$dflt'.
4387 EOM
4388 rp='Build a threading Perl?'
4389 . ./myread
4390 case "$ans" in
4391 y|Y)    val="$define" ;;
4392 *)      val="$undef" ;;
4393 esac
4394 set usethreads
4395 eval $setvar
4396
4397 if $test $patchlevel -lt 9; then
4398     case "$usethreads" in
4399     $define)
4400         : Default to ithreads unless overridden on command line or with
4401         : old config.sh
4402         dflt='y'
4403         case "$use5005threads" in
4404                 $define|true|[yY]*)
4405                         echo "5.005 threads are no longer supported"
4406                         exit 1
4407                 ;;
4408         esac
4409         case "$useithreads" in
4410                 $undef|false|[nN]*) dflt='n';;
4411         esac
4412         rp='Use the newer interpreter-based ithreads?'
4413         . ./myread
4414         case "$ans" in
4415         y|Y)    val="$define" ;;
4416         *)      val="$undef" ;;
4417         esac
4418         set useithreads
4419         eval $setvar
4420         : Now set use5005threads to the opposite value.
4421         case "$useithreads" in
4422         $define) val="$undef" ;;
4423         *) val="$define" ;;
4424         esac
4425         set use5005threads
4426         eval $setvar
4427         ;;
4428     *)
4429         useithreads="$undef"
4430         use5005threads="$undef"
4431         ;;
4432     esac
4433
4434     case "$useithreads$use5005threads" in
4435     "$define$define")
4436         $cat >&4 <<EOM
4437
4438 You cannot have both the ithreads and the 5.005 threads enabled
4439 at the same time.  Disabling the 5.005 threads since they are
4440 much less stable than the ithreads.
4441
4442 EOM
4443         use5005threads="$undef"
4444         ;;
4445     esac
4446
4447 else
4448 : perl-5.9.x and later
4449
4450     if test X"$usethreads" = "X$define"; then
4451         case "$use5005threads" in
4452             $define|true|[yY]*)
4453                 $cat >&4 <<EOM
4454
4455 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4456
4457 EOM
4458             ;;
4459         esac
4460     fi
4461
4462     use5005threads="$undef"
4463     useithreads="$usethreads"
4464 fi
4465
4466 case "$d_oldpthreads" in
4467 '')     : Configure tests would be welcome here.  For now, assume undef.
4468         val="$undef" ;;
4469 *)      val="$d_oldpthreads" ;;
4470 esac
4471 set d_oldpthreads
4472 eval $setvar
4473
4474
4475 : Look for a hint-file generated 'call-back-unit'.  If the
4476 : user has specified that a threading perl is to be built,
4477 : we may need to set or change some other defaults.
4478 if $test -f usethreads.cbu; then
4479     echo "Your platform has some specific hints regarding threaded builds, using them..."
4480     . ./usethreads.cbu
4481 else
4482     case "$usethreads" in
4483         "$define"|true|[yY]*)
4484                 $cat <<EOM
4485 (Your platform does not have any specific hints for threaded builds.
4486  Assuming POSIX threads, then.)
4487 EOM
4488         ;;
4489     esac
4490 fi
4491
4492 : Check if multiplicity is required
4493 cat <<EOM
4494
4495 Perl can be built so that multiple Perl interpreters can coexist
4496 within the same Perl executable.
4497 EOM
4498
4499 case "$useithreads" in
4500 $define)
4501         cat <<EOM
4502 This multiple interpreter support is required for interpreter-based threads.
4503 EOM
4504         val="$define"
4505         ;;
4506 *)      case "$usemultiplicity" in
4507         $define|true|[yY]*)     dflt='y';;
4508         *) dflt='n';;
4509         esac
4510         echo " "
4511         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4512         rp='Build Perl for multiplicity?'
4513         . ./myread
4514         case "$ans" in
4515         y|Y)    val="$define" ;;
4516         *)      val="$undef" ;;
4517         esac
4518         ;;
4519 esac
4520 set usemultiplicity
4521 eval $setvar
4522
4523 : Check if morebits is requested
4524 case "$usemorebits" in
4525 "$define"|true|[yY]*)
4526         use64bitint="$define"
4527         uselongdouble="$define"
4528         usemorebits="$define"
4529         ;;
4530 *)      usemorebits="$undef"
4531         ;;
4532 esac
4533
4534 : Determine the C compiler to be used
4535 echo " "
4536 case "$cc" in
4537 '') dflt=cc;;
4538 *) dflt="$cc";;
4539 esac
4540 rp="Use which C compiler?"
4541 . ./myread
4542 cc="$ans"
4543
4544 : See whether they have no cc but they do have gcc
4545 . ./trygcc
4546 if $test -f cc.cbu; then
4547     . ./cc.cbu
4548 fi
4549 . ./checkcc
4550
4551 : make some quick guesses about what we are up against
4552 echo " "
4553 $echo $n "Hmm...  $c"
4554 echo exit 1 >bsd
4555 echo exit 1 >usg
4556 echo exit 1 >v7
4557 echo exit 1 >osf1
4558 echo exit 1 >eunice
4559 echo exit 1 >xenix
4560 echo exit 1 >venix
4561 echo exit 1 >os2
4562 d_bsd="$undef"
4563 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4564 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4565 then
4566         echo "Looks kind of like an OSF/1 system, but we'll see..."
4567         echo exit 0 >osf1
4568 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4569         xxx=`./loc addbib blurfl $pth`
4570         if $test -f $xxx; then
4571         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4572                 echo exit 0 >bsd
4573                 echo exit 0 >usg
4574         else
4575                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4576                         echo "Looks kind of like an extended USG system, but we'll see..."
4577                 else
4578                         echo "Looks kind of like a USG system, but we'll see..."
4579                 fi
4580                 echo exit 0 >usg
4581         fi
4582 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4583         echo "Looks kind of like a BSD system, but we'll see..."
4584         d_bsd="$define"
4585         echo exit 0 >bsd
4586 else
4587         echo "Looks kind of like a Version 7 system, but we'll see..."
4588         echo exit 0 >v7
4589 fi
4590 case "$eunicefix" in
4591 *unixtovms*)
4592         $cat <<'EOI'
4593 There is, however, a strange, musty smell in the air that reminds me of
4594 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4595 EOI
4596         echo exit 0 >eunice
4597         d_eunice="$define"
4598 : it so happens the Eunice I know will not run shell scripts in Unix format
4599         ;;
4600 *)
4601         echo " "
4602         echo "Congratulations.  You aren't running Eunice."
4603         d_eunice="$undef"
4604         ;;
4605 esac
4606 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4607 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4608 : semicolon as a patch separator
4609 case "$p_" in
4610 :) ;;
4611 *)
4612         $cat <<'EOI'
4613 I have the feeling something is not exactly right, however...don't tell me...
4614 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4615 (Or you may be running DOS with DJGPP.)
4616 EOI
4617         echo exit 0 >os2
4618         ;;
4619 esac
4620 if test -f /xenix; then
4621         echo "Actually, this looks more like a XENIX system..."
4622         echo exit 0 >xenix
4623         d_xenix="$define"
4624 else
4625         echo " "
4626         echo "It's not Xenix..."
4627         d_xenix="$undef"
4628 fi
4629 chmod +x xenix
4630 $eunicefix xenix
4631 if test -f /venix; then
4632         echo "Actually, this looks more like a VENIX system..."
4633         echo exit 0 >venix
4634 else
4635         echo " "
4636         if ./xenix; then
4637                 : null
4638         else
4639                 echo "Nor is it Venix..."
4640         fi
4641 fi
4642 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4643 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4644 $rm -f foo
4645
4646 : Check if we are using GNU gcc and what its version is
4647 echo " "
4648 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4649 $cat >try.c <<EOM
4650 #include <stdio.h>
4651 int main() {
4652 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4653 #ifdef __VERSION__
4654         printf("%s\n", __VERSION__);
4655 #else
4656         printf("%s\n", "1");
4657 #endif
4658 #endif
4659         return(0);
4660 }
4661 EOM
4662 if $cc -o try $ccflags $ldflags try.c; then
4663         gccversion=`$run ./try`
4664         case "$gccversion" in
4665         '') echo "You are not using GNU cc." ;;
4666         *)  echo "You are using GNU cc $gccversion."
4667             ccname=gcc
4668             ;;
4669         esac
4670 else
4671         echo " "
4672         echo "*** WHOA THERE!!! ***" >&4
4673         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4674         case "$knowitall" in
4675         '')
4676         echo "    You'd better start hunting for one and let me know about it." >&4
4677                 exit 1
4678                 ;;
4679         esac
4680 fi
4681 $rm -f try try.*
4682 case "$gccversion" in
4683 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4684 esac
4685 case "$gccversion" in
4686 '') gccosandvers='' ;;
4687 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4688    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4689    gccshortvers=''
4690    case "$gccosandvers" in
4691    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4692    $osname$osvers) ;; # looking good
4693    $osname*) cat <<EOM >&4
4694
4695 *** WHOA THERE!!! ***
4696
4697     Your gcc has not been compiled for the exact release of
4698     your operating system ($gccosandvers versus $osname$osvers).
4699
4700     In general it is a good idea to keep gcc synchronized with
4701     the operating system because otherwise serious problems
4702     may ensue when trying to compile software, like Perl.
4703
4704     I'm trying to be optimistic here, though, and will continue.
4705     If later during the configuration and build icky compilation
4706     problems appear (headerfile conflicts being the most common
4707     manifestation), I suggest reinstalling the gcc to match
4708     your operating system release.
4709
4710 EOM
4711       ;;
4712    *) gccosandvers='' ;; # failed to parse, better be silent
4713    esac
4714    ;;
4715 esac
4716 case "$ccname" in
4717 '') ccname="$cc" ;;
4718 esac
4719
4720 # gcc 3.* complain about adding -Idirectories that they already know about,
4721 # so we will take those off from locincpth.
4722 case "$gccversion" in
4723 3*)
4724     echo "main(){}">try.c
4725     for incdir in $locincpth; do
4726        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4727              grep '^c[cp]p*[01]: warning: changing search order '`
4728        if test "X$warn" != X; then
4729            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4730        fi
4731     done
4732     $rm -f try try.*
4733 esac
4734
4735 # gcc 4.9 by default does some optimizations that break perl.
4736 # see ticket 121505.
4737 #
4738 # The -fwrapv disables those optimizations (and probably others,) so
4739 # for gcc 4.9 (and later, since the optimizations probably won't go
4740 # away), add -fwrapv unless the user requests -fno-wrapv, which
4741 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4742 # which turns the overflows -fwrapv ignores into runtime errors.
4743 case "$gccversion" in
4744 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4745     case "$ccflags" in
4746     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4747     *) ccflags="$ccflags -fwrapv" ;;
4748     esac
4749 esac
4750
4751 : What should the include directory be ?
4752 : Use sysroot if set, so findhdr looks in the right place.
4753 echo " "
4754 $echo $n "Hmm...  $c"
4755 dflt="$sysroot/usr/include"
4756 incpath=''
4757 mips_type=''
4758 if $test -f /bin/mips && /bin/mips; then
4759         echo "Looks like a MIPS system..."
4760         $cat >usr.c <<'EOCP'
4761 #ifdef SYSTYPE_BSD43
4762 /bsd43
4763 #endif
4764 EOCP
4765         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4766                 dflt='/bsd43/usr/include'
4767                 incpath='/bsd43'
4768                 mips_type='BSD 4.3'
4769         else
4770                 mips_type='System V'
4771         fi
4772         $rm -f usr.c usr.out
4773         echo "and you're compiling with the $mips_type compiler and libraries."
4774         xxx_prompt=y
4775         echo "exit 0" >mips
4776 else
4777         echo "Doesn't look like a MIPS system."
4778         xxx_prompt=n
4779         echo "exit 1" >mips
4780 fi
4781 chmod +x mips
4782 $eunicefix mips
4783 case "$usrinc" in
4784 '') ;;
4785 *) dflt="$usrinc";;
4786 esac
4787 case "$xxx_prompt" in
4788 y)      fn=d/
4789         echo " "
4790         rp='Where are the include files you want to use?'
4791         . ./getfile
4792         usrinc="$ans"
4793         ;;
4794 *)      usrinc="$dflt"
4795         ;;
4796 esac
4797
4798 : see how we invoke the C preprocessor
4799 echo " "
4800 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4801 cat <<'EOT' >testcpp.c
4802 #define ABC abc
4803 #define XYZ xyz
4804 ABC.XYZ
4805 EOT
4806 cd ..
4807 if test ! -f cppstdin; then
4808         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4809                 # AIX cc -E doesn't show the absolute headerfile
4810                 # locations but we'll cheat by using the -M flag.
4811                 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
4812         else
4813                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4814         fi
4815 else
4816         echo "Keeping your $hint cppstdin wrapper."
4817 fi
4818 chmod 755 cppstdin
4819 wrapper=`pwd`/cppstdin
4820 ok='false'
4821 cd UU
4822
4823 if $test "X$cppstdin" != "X" && \
4824         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4825         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4826 then
4827         echo "You used to use $cppstdin $cppminus so we'll use that again."
4828         case "$cpprun" in
4829         '') echo "But let's see if we can live without a wrapper..." ;;
4830         *)
4831                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4832                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4833                 then
4834                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4835                         ok='true'
4836                 else
4837                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4838                 fi
4839                 ;;
4840         esac
4841 else
4842         case "$cppstdin" in
4843         '') ;;
4844         *)
4845                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4846                 ;;
4847         esac
4848 fi
4849
4850 if $ok; then
4851         : nothing
4852 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4853         $cc -E <testcpp.c >testcpp.out 2>&1; \
4854         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4855         echo "Yup, it does."
4856         x_cpp="$cc $cppflags -E"
4857         x_minus='';
4858 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4859         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4860         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4861         echo "Yup, it does."
4862         x_cpp="$cc $cppflags -E"
4863         x_minus='-';
4864 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4865         $cc -P <testcpp.c >testcpp.out 2>&1; \
4866         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4867         echo "Yipee, that works!"
4868         x_cpp="$cc $cppflags -P"
4869         x_minus='';
4870 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4871         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4872         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4873         echo "At long last!"
4874         x_cpp="$cc $cppflags -P"
4875         x_minus='-';
4876 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4877         $cpp <testcpp.c >testcpp.out 2>&1; \
4878         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4879         echo "It works!"
4880         x_cpp="$cpp $cppflags"
4881         x_minus='';
4882 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4883         $cpp - <testcpp.c >testcpp.out 2>&1; \
4884         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4885         echo "Hooray, it works!  I was beginning to wonder."
4886         x_cpp="$cpp $cppflags"
4887         x_minus='-';
4888 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4889         $wrapper <testcpp.c >testcpp.out 2>&1; \
4890         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4891         x_cpp="$wrapper"
4892         x_minus=''
4893         echo "Eureka!"
4894 else
4895         dflt=''
4896         rp="No dice.  I can't find a C preprocessor.  Name one:"
4897         . ./myread
4898         x_cpp="$ans"
4899         x_minus=''
4900         $x_cpp <testcpp.c >testcpp.out 2>&1
4901         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4902                 echo "OK, that will do." >&4
4903         else
4904 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4905                 exit 1
4906         fi
4907 fi
4908
4909 case "$ok" in
4910 false)
4911         cppstdin="$x_cpp"
4912         cppminus="$x_minus"
4913         cpprun="$x_cpp"
4914         cpplast="$x_minus"
4915         set X $x_cpp
4916         shift
4917         case "$1" in
4918         "$cpp")
4919                 echo "Perhaps can we force $cc -E using a wrapper..."
4920                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4921                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4922                 then
4923                         echo "Yup, we can."
4924                         cppstdin="$wrapper"
4925                         cppminus='';
4926                 else
4927                         echo "Nope, we'll have to live without it..."
4928                 fi
4929                 ;;
4930         esac
4931         case "$cpprun" in
4932         "$wrapper")
4933                 cpprun=''
4934                 cpplast=''
4935                 ;;
4936         esac
4937         ;;
4938 esac
4939
4940 case "$cppstdin" in
4941 "$wrapper"|'cppstdin') ;;
4942 *) $rm -f $wrapper;;
4943 esac
4944 $rm -f testcpp.c testcpp.out
4945
4946 : Adjust cppfilter for path component separator
4947 case "$osname" in
4948 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4949 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4950 *)   cppfilter='' ;;
4951 esac
4952
4953 : Use gcc to determine libpth and incpth
4954 # If using gcc or clang, we can get better values for libpth, incpth
4955 # and usrinc directly from the compiler.
4956 # Note that ccname for clang is also gcc.
4957 case "$ccname" in
4958     gcc)
4959         $echo 'extern int foo;' > try.c
4960         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4961         shift
4962         if $test $# -gt 0; then
4963             incpth="$incpth $*"
4964             incpth="`$echo $incpth|$sed 's/^ //'`"
4965             for i in $*; do
4966                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4967                 if $test -d $j; then
4968                     libpth="$libpth $j"
4969                 fi
4970             done
4971             libpth="`$echo $libpth|$sed 's/^ //'`"
4972             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4973                 if $test -d $xxx; then
4974                     case " $libpth " in
4975                     *" $xxx "*) ;;
4976                     *) libpth="$libpth $xxx";;
4977                     esac
4978                 fi
4979             done
4980         fi
4981         $rm -f try.c
4982         case "$usrinc" in
4983         '') for i in $incpth; do
4984                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4985                     usrinc="$i"
4986                     break
4987                 fi
4988             done
4989             ;;
4990         esac
4991
4992         case "$usecrosscompile" in
4993         $define|true|[yY]*)
4994             case "$incpth" in
4995                 '') echo "Incpth not defined." >&4; croak=y ;;
4996                 *)  echo "Using incpth '$incpth'." >&4 ;;
4997             esac
4998             case "$libpth" in
4999                 '') echo "Libpth not defined." >&4; croak=y ;;
5000                 *)  echo "Using libpth '$libpth'." >&4 ;;
5001             esac
5002             case "$usrinc" in
5003                 '') echo "Usrinc not defined." >&4; croak=y ;;
5004                 *)  echo "Using usrinc $usrinc." >&4 ;;
5005             esac
5006             case "$croak" in
5007                 y)
5008                 if test "X$sysroot" = X; then
5009                     echo "Cannot continue, aborting." >&4; exit 1
5010                 else
5011                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5012                 fi
5013                 ;;
5014             esac
5015             ;;
5016         esac
5017     ;;
5018 esac
5019
5020 : Default value for incpth is just usrinc
5021 case "$incpth" in
5022 '') incpth="$usrinc";;
5023 esac
5024
5025 : Set private lib path
5026 case "$plibpth" in
5027 '') if ./mips; then
5028         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5029     fi;;
5030 esac
5031 case "$libpth" in
5032 ' ') dlist='';;
5033 '') dlist="$loclibpth $plibpth $glibpth";;
5034 *) dlist="$libpth";;
5035 esac
5036
5037 : Now check and see which directories actually exist, avoiding duplicates
5038 for xxx in $dlist
5039 do
5040     if $test -d $xxx; then
5041                 case " $libpth " in
5042                 *" $xxx "*) ;;
5043                 *) libpth="$libpth $xxx";;
5044                 esac
5045     fi
5046 done
5047 $cat <<'EOM'
5048
5049 Some systems have incompatible or broken versions of libraries.  Among
5050 the directories listed in the question below, please remove any you
5051 know not to be holding relevant libraries, and add any that are needed.
5052 Say "none" for none.
5053
5054 EOM
5055
5056 if test "X$sysroot" != X; then
5057     $cat <<EOM
5058 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5059
5060 EOM
5061 fi
5062
5063 case "$libpth" in
5064 '') dflt='none';;
5065 *)
5066         set X $libpth
5067         shift
5068         dflt=${1+"$@"}
5069         ;;
5070 esac
5071 rp="Directories to use for library searches?"
5072 . ./myread
5073 case "$ans" in
5074 none) libpth=' ';;
5075 *) libpth="$ans";;
5076 esac
5077
5078 : compute shared library extension
5079 case "$so" in
5080 '')
5081         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5082                 dflt='sl'
5083         else
5084                 dflt='so'
5085         fi
5086         ;;
5087 *) dflt="$so";;
5088 esac
5089 $cat <<EOM
5090
5091 On some systems, shared libraries may be available.  Answer 'none' if
5092 you want to suppress searching of shared libraries for the remainder
5093 of this configuration.
5094
5095 EOM
5096 rp='What is the file extension used for shared libraries?'
5097 . ./myread
5098 so="$ans"
5099
5100 : Does target system insist that shared library basenames are unique
5101 $cat << EOM
5102
5103 Some dynamic loaders assume that the *basename* of shared library filenames
5104 are globally unique.  We'll default this to undef as we assume your system
5105 is not this weird. Set to defined if you're on one of them.
5106
5107 EOM
5108
5109 dflt='n'
5110 rp='Make shared library basenames unique?'
5111 . ./myread
5112 case "$ans" in
5113 y|Y) val="$define" ;;
5114 *)   val="$undef"  ;;
5115 esac
5116 set d_libname_unique
5117 eval $setvar
5118
5119 : Define several unixisms.
5120 : Hints files or command line option can be used to override them.
5121 : The convoluted testing is in case hints files set either the old
5122 : or the new name.
5123 case "$_exe" in
5124 '')     case "$exe_ext" in
5125         '')     ;;
5126         *)      _exe="$exe_ext" ;;
5127         esac
5128         ;;
5129 esac
5130 case "$_a" in
5131 '')     case "$lib_ext" in
5132     '') _a='.a';;
5133         *)      _a="$lib_ext" ;;
5134         esac
5135         ;;
5136 esac
5137 case "$_o" in
5138 '') case "$obj_ext" in
5139         '')     _o='.o';;
5140         *)      _o="$obj_ext";;
5141         esac
5142         ;;
5143 esac
5144 case "$p_" in
5145 '') case "$path_sep" in
5146         '')     p_=':';;
5147         *)      p_="$path_sep";;
5148         esac
5149         ;;
5150 esac
5151 exe_ext=$_exe
5152 lib_ext=$_a
5153 obj_ext=$_o
5154 path_sep=$p_
5155
5156 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5157
5158 : Which makefile gets called first.  This is used by make depend.
5159 case "$firstmakefile" in
5160 '') firstmakefile='makefile';;
5161 esac
5162
5163 : Check is we will use socks
5164 case "$usesocks" in
5165 $define|true|[yY]*)     dflt='y';;
5166 *) dflt='n';;
5167 esac
5168 cat <<EOM
5169
5170 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5171 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5172 to use the PerlIO abstraction layer, this will be implicitly selected.
5173
5174 If this doesn't make any sense to you, just accept the default '$dflt'.
5175 EOM
5176 rp='Build Perl for SOCKS?'
5177 . ./myread
5178 case "$ans" in
5179 y|Y)    val="$define" ;;
5180 *)      val="$undef" ;;
5181 esac
5182 set usesocks
5183 eval $setvar
5184
5185 : Check for uselongdouble support
5186 case "$ccflags" in
5187 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5188 esac
5189
5190 case "$uselongdouble" in
5191 $define|true|[yY]*)     dflt='y';;
5192 *) dflt='n';;
5193 esac
5194 cat <<EOM
5195
5196 Perl can be built to take advantage of long doubles which
5197 (if available) may give more accuracy and range for floating point numbers.
5198
5199 If this doesn't make any sense to you, just accept the default '$dflt'.
5200 EOM
5201 rp='Try to use long doubles if available?'
5202 . ./myread
5203 case "$ans" in
5204 y|Y)    val="$define"   ;;
5205 *)      val="$undef"    ;;
5206 esac
5207 set uselongdouble
5208 eval $setvar
5209
5210 case "$uselongdouble" in
5211 true|[yY]*) uselongdouble="$define" ;;
5212 esac
5213
5214 : Look for a hint-file generated 'call-back-unit'.  If the
5215 : user has specified that long doubles should be used,
5216 : we may need to set or change some other defaults.
5217 if $test -f uselongdouble.cbu; then
5218     echo "Your platform has some specific hints regarding long doubles, using them..."
5219     . ./uselongdouble.cbu
5220 else
5221     case "$uselongdouble" in
5222         $define)
5223                 $cat <<EOM
5224 (Your platform does not have any specific hints for long doubles.)
5225 EOM
5226         ;;
5227     esac
5228 fi
5229
5230 : Check if quadmath is requested
5231 case "$usequadmath" in
5232 "$define"|true|[yY]*) usequadmath="$define" ;;
5233 *)                    usequadmath="$undef"  ;;
5234 esac
5235
5236 : Looking for optional libraries
5237 echo " "
5238 echo "Checking for optional libraries..." >&4
5239 case "$libs" in
5240 ' '|'') dflt='';;
5241 *) dflt="$libs";;
5242 esac
5243 case "$libswanted" in
5244 '') libswanted='c_s';;
5245 esac
5246 case "$usesocks" in
5247 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5248 esac
5249 case "$usecbacktrace" in
5250 "$define") libswanted="$libswanted bfd" ;;
5251 esac
5252 case "$usequadmath" in
5253 "$define") libswanted="$libswanted quadmath" ;;
5254 esac
5255 libsfound=''
5256 libsfiles=''
5257 libsdirs=''
5258 libspath=''
5259 for thisdir in $libpth $xlibpth; do
5260   test -d $thisdir && libspath="$libspath $thisdir"
5261 done
5262 for thislib in $libswanted; do
5263         for thisdir in $libspath; do
5264             xxx=''
5265             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5266                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5267                 $test -f "$xxx" && eval $libscheck
5268                 $test -f "$xxx" && libstyle=shared
5269                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5270                 $test -f "$xxx" && eval $libscheck
5271                 $test -f "$xxx" && libstyle=shared
5272             fi
5273             if test ! -f "$xxx"; then
5274                 xxx=$thisdir/lib$thislib.$so
5275                 $test -f "$xxx" && eval $libscheck
5276                 $test -f "$xxx" && libstyle=shared
5277             fi
5278             if test ! -f "$xxx"; then
5279                 xxx=$thisdir/lib$thislib$_a
5280                 $test -f "$xxx" && eval $libscheck
5281                 $test -f "$xxx" && libstyle=static
5282             fi
5283             if test ! -f "$xxx"; then
5284                 xxx=$thisdir/$thislib$_a
5285                 $test -f "$xxx" && eval $libscheck
5286                 $test -f "$xxx" && libstyle=static
5287             fi
5288             if test ! -f "$xxx"; then
5289                 xxx=$thisdir/lib${thislib}_s$_a
5290                 $test -f "$xxx" && eval $libscheck
5291                 $test -f "$xxx" && libstyle=static
5292                 $test -f "$xxx" && thislib=${thislib}_s
5293             fi
5294             if test ! -f "$xxx"; then
5295                 xxx=$thisdir/Slib$thislib$_a
5296                 $test -f "$xxx" && eval $libscheck
5297                 $test -f "$xxx" && libstyle=static
5298             fi
5299             if $test -f "$xxx"; then
5300                 case "$libstyle" in
5301                 shared) echo "Found -l$thislib (shared)." ;;
5302                 static) echo "Found -l$thislib." ;;
5303                 *)      echo "Found -l$thislib ($libstyle)." ;;
5304                 esac
5305                 case " $dflt " in
5306                 *"-l$thislib "*);;
5307                 *) dflt="$dflt -l$thislib"
5308                    libsfound="$libsfound $xxx"
5309                    yyy=`basename $xxx`
5310                    libsfiles="$libsfiles $yyy"
5311                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5312                    case " $libsdirs " in
5313                    *" $yyy "*) ;;
5314                    *) libsdirs="$libsdirs $yyy" ;;
5315                    esac
5316                    ;;
5317                 esac
5318                 break
5319             fi
5320         done
5321         if $test ! -f "$xxx"; then
5322             echo "No -l$thislib."
5323         fi
5324 done
5325 set X $dflt
5326 shift
5327 dflt="$*"
5328 case "$libs" in
5329 '') dflt="$dflt";;
5330 *) dflt="$libs";;
5331 esac
5332 case "$dflt" in
5333 ' '|'') dflt='none';;
5334 esac
5335
5336 $cat <<EOM
5337
5338 In order to compile $package on your machine, a number of libraries
5339 are usually needed.  Include any other special libraries here as well.
5340 Say "none" for none.  The default list is almost always right.
5341 EOM
5342
5343 echo " "
5344 rp="What libraries to use?"
5345 . ./myread
5346 case "$ans" in
5347 none) libs=' ';;
5348 *) libs="$ans";;
5349 esac
5350
5351 : determine optimization, if desired, or use for debug flag also
5352 case "$optimize" in
5353 ' '|$undef) dflt='none';;
5354 '') dflt='-O';;
5355 *) dflt="$optimize";;
5356 esac
5357 $cat <<EOH
5358
5359 By default, $package compiles with the -O flag to use the optimizer.
5360 Alternately, you might want to use the symbolic debugger, which uses
5361 the -g flag (on traditional Unix systems).  Either flag can be
5362 specified here.  To use neither flag, specify the word "none".
5363
5364 EOH
5365 rp="What optimizer/debugger flag should be used?"
5366 . ./myread
5367 optimize="$ans"
5368 case "$optimize" in
5369 'none') optimize=" ";;
5370 esac
5371
5372 : Check what DEBUGGING is required from the command line
5373 : -DEBUGGING      or -DDEBUGGING or
5374 : -DEBUGGING=both                       = -g + -DDEBUGGING
5375 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5376 : -DEBUGGING=none or -UDEBUGGING        =
5377 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5378 case "$EBUGGING" in
5379 '')     ;;
5380 *)      DEBUGGING=$EBUGGING ;;
5381 esac
5382
5383 case "$DEBUGGING" in
5384 -g|both|$define)
5385     case "$optimize" in
5386         *-g*) ;;
5387         *)    optimize="$optimize -g" ;;
5388     esac ;;
5389 none|$undef)
5390     case "$optimize" in
5391         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5392                 shift
5393                 optimize="$*"
5394                 ;;
5395     esac ;;
5396 esac
5397
5398 dflt=''
5399 case "$DEBUGGING" in
5400 both|$define) dflt='-DDEBUGGING'
5401 esac
5402
5403 : argument order is deliberate, as the flag will start with - which set could
5404 : think is an option
5405 checkccflag='check=$1; flag=$2; callback=$3;
5406 echo " ";
5407 echo "Checking if your compiler accepts $flag" 2>&1;
5408 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5409 echo "int main(void) { return 0; }" > gcctest.c;
5410 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5411     echo "Yes, it does." 2>&1;
5412     if $test -s gcctest.out ; then
5413         echo "But your platform does not like it:";
5414         cat gcctest.out;
5415     else
5416         case "$ccflags" in
5417         *$check*)
5418             echo "Leaving current flags $ccflags alone." 2>&1
5419             ;;
5420         *) dflt="$dflt $flag";
5421             eval $callback
5422             ;;
5423         esac
5424     fi
5425 else
5426     echo "Nope, it does not, but that is ok." 2>&1;
5427 fi
5428 '
5429
5430 : We will not override a previous value, but we might want to
5431 : augment a hint file
5432 case "$hint" in
5433 default|recommended)
5434         case "$gccversion" in
5435         1*) dflt="$dflt -fpcc-struct-return" ;;
5436         esac
5437         case "$optimize:$DEBUGGING" in
5438         *-g*:old) dflt="$dflt -DDEBUGGING";;
5439         esac
5440         case "$gccversion" in
5441         2*) if $test -d /etc/conf/kconfig.d &&
5442                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5443                 then
5444                         # Interactive Systems (ISC) POSIX mode.
5445                         dflt="$dflt -posix"
5446                 fi
5447                 ;;
5448         esac
5449         case "$gccversion" in
5450         1*) ;;
5451         2.[0-8]*) ;;
5452         ?*)     set strict-aliasing -fno-strict-aliasing
5453                 eval $checkccflag
5454                 ;;
5455         esac
5456         # For gcc, adding -pipe speeds up compilations for some, but apparently
5457         # some assemblers can't read from stdin.  (It also slows down compilations
5458         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5459         case "$gccversion" in
5460         ?*)     set pipe -pipe
5461                 eval $checkccflag
5462                 ;;
5463         esac
5464
5465         # on x86_64 (at least) we require an extra library (libssp) in the
5466         # link command line. This library is not named, so I infer that it is
5467         # an implementation detail that may change. Hence the safest approach
5468         # is to add the flag to the flags passed to the compiler at link time,
5469         # as that way the compiler can do the right implementation dependant
5470         # thing. (NWC)
5471         case "$osname" in
5472         amigaos) ;; # -fstack-protector builds but doesn't work
5473         *)      case "$gccversion" in
5474                 ?*)     set stack-protector-strong -fstack-protector-strong
5475                         eval $checkccflag
5476                         case "$dflt" in
5477                         *-fstack-protector-strong*) ;; # It got added.
5478                         *) # Try the plain/older -fstack-protector.
5479                            set stack-protector -fstack-protector
5480                            eval $checkccflag
5481                            ;;
5482                         esac
5483                         ;;
5484                 esac
5485                 ;;
5486         esac
5487         ;;
5488 esac
5489
5490 case "$mips_type" in
5491 *BSD*|'') inclwanted="$locincpth $usrinc";;
5492 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5493 esac
5494 for thisincl in $inclwanted; do
5495         if $test -d $thisincl; then
5496                 if $test x$thisincl != x$usrinc; then
5497                         case "$dflt" in
5498                         *" -I$thisincl "*);;
5499                         *) dflt="$dflt -I$thisincl ";;
5500                         esac
5501                 fi
5502         fi
5503 done
5504
5505 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5506         xxx=true;
5507 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5508         xxx=true;
5509 else
5510         xxx=false;
5511 fi;
5512 if $xxx; then
5513         case "$dflt" in
5514         *$2*);;
5515         *) dflt="$dflt -D$2";;
5516         esac;
5517 fi'
5518
5519 set signal.h LANGUAGE_C; eval $inctest
5520
5521 case "$usesocks" in
5522 $define)
5523         ccflags="$ccflags -DSOCKS"
5524         ;;
5525 esac
5526
5527 case "$hint" in
5528 default|recommended) dflt="$ccflags $dflt" ;;
5529 *) dflt="$ccflags";;
5530 esac
5531
5532 case "$dflt" in
5533 ''|' ') dflt=none;;
5534 esac
5535
5536 $cat <<EOH
5537
5538 Your C compiler may want other flags.  For this question you should include
5539 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5540 but you should NOT include libraries or ld flags like -lwhatever.  If you
5541 want $package to honor its debug switch, you should include -DDEBUGGING here.
5542 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5543
5544 To use no flags, specify the word "none".
5545
5546 EOH
5547 set X $dflt
5548 shift
5549 dflt=${1+"$@"}
5550 rp="Any additional cc flags?"
5551 . ./myread
5552 case "$ans" in
5553 none) ccflags='';;
5554 *) ccflags="$ans";;
5555 esac
5556
5557 : the following weeds options from ccflags that are of no interest to cpp
5558 case "$cppflags" in
5559 '') cppflags="$ccflags" ;;
5560 *)  set X $ccflags; shift
5561     case " $cppflags " in
5562     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5563     *) cppflags="$cppflags $ccflags" ;;
5564     esac
5565     ;;
5566 esac
5567 case "$gccversion" in
5568 1*) cppflags="$cppflags -D__GNUC__"
5569 esac
5570 case "$mips_type" in
5571 '');;
5572 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5573 esac
5574 case "$cppflags" in
5575 '');;
5576 *)
5577         echo " "
5578         echo "Let me guess what the preprocessor flags are..." >&4
5579         set X $cppflags
5580         shift
5581         cppflags=''
5582         $cat >cpp.c <<'EOM'
5583 #define BLURFL foo
5584
5585 BLURFL xx LFRULB
5586 EOM
5587         previous=''
5588         for flag in $*
5589         do
5590                 case "$flag" in
5591                 -*) ftry="$flag";;
5592                 *) ftry="$previous $flag";;
5593                 esac
5594                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5595                         >cpp1.out 2>/dev/null && \
5596                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5597                         >cpp2.out 2>/dev/null && \
5598                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5599                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5600                 then
5601                         cppflags="$cppflags $ftry"
5602                         previous=''
5603                 else
5604                         previous="$flag"
5605                 fi
5606         done
5607         set X $cppflags
5608         shift
5609         cppflags=${1+"$@"}
5610         case "$cppflags" in
5611         *-*)  echo "They appear to be: $cppflags";;
5612         esac
5613         $rm -f cpp.c cpp?.out
5614         ;;
5615 esac
5616
5617 : flags used in final linking phase
5618 case "$ldflags" in
5619 '') if ./venix; then
5620                 dflt='-i -z'
5621         else
5622                 dflt=''
5623         fi
5624         case "$ccflags" in
5625         *-posix*) dflt="$dflt -posix" ;;
5626         esac
5627         ;;
5628 *) dflt="$ldflags";;
5629 esac
5630 # See note above about -fstack-protector
5631 case "$ccflags" in
5632 *-fstack-protector-strong*)
5633         case "$dflt" in
5634         *-fstack-protector-strong*) ;; # Don't add it again
5635         *) dflt="$dflt -fstack-protector-strong" ;;
5636         esac
5637         ;;
5638 *-fstack-protector*)
5639         case "$dflt" in
5640         *-fstack-protector*) ;; # Don't add it again
5641         *) dflt="$dflt -fstack-protector" ;;
5642         esac
5643         ;;
5644 esac
5645
5646 : Try to guess additional flags to pick up local libraries.
5647 for thislibdir in $libpth; do
5648         case " $loclibpth " in
5649         *" $thislibdir "*)
5650                 case "$dflt " in
5651                 *"-L$thislibdir "*) ;;
5652                 *)  dflt="$dflt -L$thislibdir" ;;
5653                 esac
5654                 ;;
5655         esac
5656 done
5657
5658 case "$dflt" in
5659 '') dflt='none' ;;
5660 esac
5661
5662 $cat <<EOH
5663
5664 Your C linker may need flags.  For this question you should
5665 include -L/whatever and any other flags used by the C linker, but you
5666 should NOT include libraries like -lwhatever.
5667
5668 Make sure you include the appropriate -L/path flags if your C linker
5669 does not normally search all of the directories you specified above,
5670 namely
5671         $libpth
5672 To use no flags, specify the word "none".
5673
5674 EOH
5675
5676 rp="Any additional ld flags (NOT including libraries)?"
5677 . ./myread
5678 case "$ans" in
5679 none) ldflags='';;
5680 *) ldflags="$ans";;
5681 esac
5682 rmlist="$rmlist pdp11"
5683
5684 : coherency check
5685 echo " "
5686 echo "Checking your choice of C compiler and flags for coherency..." >&4
5687 $cat > try.c <<'EOF'
5688 #include <stdio.h>
5689 int main() { printf("Ok\n"); return(0); }
5690 EOF
5691 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5692 shift
5693 $cat >try.msg <<'EOM'
5694 I've tried to compile and run the following simple program:
5695
5696 EOM
5697 $cat try.c >> try.msg
5698
5699 $cat >> try.msg <<EOM
5700
5701 I used the command:
5702
5703         $*
5704         $run ./try
5705
5706 and I got the following output:
5707
5708 EOM
5709 dflt=y
5710 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5711         if $sh -c "$run ./try " >>try.msg 2>&1; then
5712                 xxx=`$run ./try`
5713                 case "$xxx" in
5714                 "Ok") dflt=n ;;
5715                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5716                 esac
5717         else
5718                 echo "The program compiled OK, but exited with status $?." >>try.msg
5719                 rp="You have a problem.  Shall I abort Configure"
5720                 dflt=y
5721         fi
5722 else
5723         echo "I can't compile the test program." >>try.msg
5724         rp="You have a BIG problem.  Shall I abort Configure"
5725         dflt=y
5726 fi
5727 case "$dflt" in
5728 y)
5729         $cat try.msg >&4
5730         case "$knowitall" in
5731         '')
5732                 echo "(The supplied flags or libraries might be incorrect.)"
5733                 ;;
5734         *) dflt=n;;
5735         esac
5736         echo " "
5737         . ./myread
5738         case "$ans" in
5739         n*|N*) ;;
5740         *)      echo "Ok.  Stopping Configure." >&4
5741                 exit 1
5742                 ;;
5743         esac
5744         ;;
5745 n) echo "OK, that should do.";;
5746 esac
5747 $rm_try gcctest gcctest.out
5748
5749 : define a shorthand compile call
5750 compile='
5751 mc_file=$1;
5752 shift;
5753 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5754 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5755 exit 1;
5756 fi;
5757 esac;
5758 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5759 : define a shorthand compile call for compilations that should be ok.
5760 compile_ok='
5761 mc_file=$1;
5762 shift;
5763 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5764
5765 : determine filename position in cpp output
5766 echo " "
5767 echo "Computing filename position in cpp output for #include directives..." >&4
5768 case "$osname" in
5769 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5770 esac
5771 case "$fieldn" in
5772 '')
5773 case "$osname" in
5774 vos) testaccess=-e ;;
5775 *)   testaccess=-r ;;
5776 esac
5777 echo '#include <stdio.h>' > foo.c
5778 $cat >fieldn <<EOF
5779 $startsh
5780 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5781 $grep '^[       ]*#.*stdio\.h' | \
5782 while read cline; do
5783         pos=1
5784         set \$cline
5785         while $test \$# -gt 0; do
5786                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5787                         echo "\$pos"
5788                         exit 0
5789                 fi
5790                 shift
5791                 pos=\`expr \$pos + 1\`
5792         done
5793 done
5794 EOF
5795 chmod +x fieldn
5796 fieldn=`./fieldn`
5797 $rm -f foo.c fieldn
5798 ;;
5799 esac
5800 case $fieldn in
5801 '') pos='???';;
5802 1) pos=first;;
5803 2) pos=second;;
5804 3) pos=third;;
5805 *) pos="${fieldn}th";;
5806 esac
5807 echo "Your cpp writes the filename in the $pos field of the line."
5808
5809 : locate header file
5810 $cat >findhdr <<EOF
5811 $startsh
5812 wanted=\$1
5813 name=''
5814 for usrincdir in $incpth
5815 do
5816         if test -f \$usrincdir/\$wanted; then
5817                 echo "\$usrincdir/\$wanted"
5818                 exit 0
5819         fi
5820 done
5821 awkprg='{ print \$$fieldn }'
5822 echo "#include <\$wanted>" > foo\$\$.c
5823 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5824 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5825 while read cline; do
5826         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5827         case "\$name" in
5828         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5829         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5830         *) exit 2;;
5831         esac;
5832 done;
5833 #
5834 # status = 0: grep returned 0 lines, case statement not executed
5835 # status = 1: headerfile found
5836 # status = 2: while loop executed, no headerfile found
5837 #
5838 status=\$?
5839 $rm -f foo\$\$.c;
5840 if test \$status -eq 1; then
5841         exit 0;
5842 fi
5843 exit 1
5844 EOF
5845 chmod +x findhdr
5846
5847 : define an alternate in-header-list? function
5848 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5849 cont=true; xxf="echo \"<\$1> found.\" >&4";
5850 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5851 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5852 esac;
5853 case $# in 4) instead=instead;; *) instead="at last";; esac;
5854 while $test "$cont"; do
5855         xxx=`./findhdr $1`
5856         var=$2; eval "was=\$$2";
5857         if $test "$xxx" && $test -r "$xxx";
5858         then eval $xxf;
5859         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5860                 cont="";
5861         else eval $xxnf;
5862         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5863         set $yyy; shift; shift; yyy=$@;
5864         case $# in 0) cont="";;
5865         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5866                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5867         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5868                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5869         esac;
5870 done;
5871 while $test "$yyy";
5872 do set $yyy; var=$2; eval "was=\$$2";
5873         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5874         set $yyy; shift; shift; yyy=$@;
5875 done'
5876
5877 : see if stdlib is available
5878 set stdlib.h i_stdlib
5879 eval $inhdr
5880
5881 : check for lengths of integral types
5882 echo " "
5883 case "$intsize" in
5884 '')
5885         echo "Checking to see how big your integers are..." >&4
5886         $cat >try.c <<EOCP
5887 #include <stdio.h>
5888 #$i_stdlib I_STDLIB
5889 #ifdef I_STDLIB
5890 #include <stdlib.h>
5891 #endif
5892 int main()
5893 {
5894         printf("intsize=%d;\n", (int)sizeof(int));
5895         printf("longsize=%d;\n", (int)sizeof(long));
5896         printf("shortsize=%d;\n", (int)sizeof(short));
5897         exit(0);
5898 }
5899 EOCP
5900         set try
5901         if eval $compile_ok && $run ./try > /dev/null; then
5902                 eval `$run ./try`
5903                 echo "Your integers are $intsize bytes long."
5904                 echo "Your long integers are $longsize bytes long."
5905                 echo "Your short integers are $shortsize bytes long."
5906         else
5907                 $cat >&4 <<EOM
5908 !
5909 Help! I can't compile and run the intsize test program: please enlighten me!
5910 (This is probably a misconfiguration in your system or libraries, and
5911 you really ought to fix it.  Still, I'll try anyway.)
5912 !
5913 EOM
5914                 dflt=4
5915                 rp="What is the size of an integer (in bytes)?"
5916                 . ./myread
5917                 intsize="$ans"
5918                 dflt=$intsize
5919                 rp="What is the size of a long integer (in bytes)?"
5920                 . ./myread
5921                 longsize="$ans"
5922                 dflt=2
5923                 rp="What is the size of a short integer (in bytes)?"
5924                 . ./myread
5925                 shortsize="$ans"
5926         fi
5927         ;;
5928 esac
5929 $rm_try
5930
5931 : check for long long
5932 echo " "
5933 echo "Checking to see if you have long long..." >&4
5934 echo 'int main() { long long x = 7; return 0; }' > try.c
5935 set try
5936 if eval $compile; then
5937         val="$define"
5938         echo "You have long long."
5939 else
5940         val="$undef"
5941         echo "You do not have long long."
5942 fi
5943 $rm_try
5944 set d_longlong
5945 eval $setvar
5946
5947 : check for length of long long
5948 case "${d_longlong}${longlongsize}" in
5949 $define)
5950         echo " "
5951         echo "Checking to see how big your long longs are..." >&4
5952         $cat >try.c <<'EOCP'
5953 #include <stdio.h>
5954 int main()
5955 {
5956     printf("%d\n", (int)sizeof(long long));
5957     return(0);
5958 }
5959 EOCP
5960         set try
5961         if eval $compile_ok; then
5962                 longlongsize=`$run ./try`
5963                 echo "Your long longs are $longlongsize bytes long."
5964         else
5965                 dflt='8'
5966                 echo " "
5967                 echo "(I can't seem to compile the test program.  Guessing...)"
5968                 rp="What is the size of a long long (in bytes)?"
5969                 . ./myread
5970                 longlongsize="$ans"
5971         fi
5972         if $test "X$longsize" = "X$longlongsize"; then
5973                 echo "(That isn't any different from an ordinary long.)"
5974         fi
5975         ;;
5976 esac
5977 $rm_try
5978
5979 : see if inttypes.h is available
5980 : we want a real compile instead of Inhdr because some systems
5981 : have an inttypes.h which includes non-existent headers
5982 echo " "
5983 $cat >try.c <<EOCP
5984 #include <inttypes.h>
5985 int main() {
5986         static int32_t foo32 = 0x12345678;
5987 }
5988 EOCP
5989 set try
5990 if eval $compile; then
5991         echo "<inttypes.h> found." >&4
5992         val="$define"
5993 else
5994         echo "<inttypes.h> NOT found." >&4
5995         val="$undef"
5996 fi
5997 $rm_try
5998 set i_inttypes
5999 eval $setvar
6000
6001 : check for int64_t
6002 echo " "
6003 echo "Checking to see if you have int64_t..." >&4
6004 $cat >try.c <<EOCP
6005 #include <sys/types.h>
6006 #$i_inttypes I_INTTYPES
6007 #ifdef I_INTTYPES
6008 #include <inttypes.h>
6009 #endif
6010 int main() { int64_t x = 7; }
6011 EOCP
6012 set try
6013 if eval $compile; then
6014         val="$define"
6015         echo "You have int64_t."
6016 else
6017         val="$undef"
6018         echo "You do not have int64_t."
6019 fi
6020 $rm_try
6021 set d_int64_t
6022 eval $setvar
6023
6024 : Check if 64bit ints have a quad type
6025 echo " "
6026 echo "Checking which 64-bit integer type we could use..." >&4
6027
6028 case "$intsize" in
6029 8) val=int
6030    set quadtype
6031    eval $setvar
6032    val='"unsigned int"'
6033    set uquadtype
6034    eval $setvar
6035    quadkind=1
6036    ;;
6037 *) case "$longsize" in
6038    8) val=long
6039       set quadtype
6040       eval $setvar
6041       val='"unsigned long"'
6042       set uquadtype
6043       eval $setvar
6044       quadkind=2
6045       ;;
6046    *) case "$d_longlong:$longlongsize" in
6047       define:8)
6048         val='"long long"'
6049         set quadtype
6050         eval $setvar
6051         val='"unsigned long long"'
6052         set uquadtype
6053         eval $setvar
6054         quadkind=3
6055         ;;
6056       *) case "$d_int64_t" in
6057          define)
6058            val=int64_t
6059            set quadtype
6060            eval $setvar
6061            val=uint64_t
6062            set uquadtype
6063            eval $setvar
6064            quadkind=4
6065            ;;
6066          esac
6067          ;;
6068       esac
6069       ;;
6070    esac
6071    ;;
6072 esac
6073
6074 case "$quadtype" in
6075 '')     echo "Alas, no 64-bit integer types in sight." >&4
6076         d_quad="$undef"
6077         ;;
6078 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6079         d_quad="$define"
6080         ;;
6081 esac
6082
6083 : Do we want 64bit support
6084 case "$uselonglong" in
6085 "$define"|true|[yY]*)
6086         cat <<EOM >&4
6087
6088 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6089 EOM
6090         use64bitint="$define"
6091         ;;
6092 esac
6093 case "$use64bits" in
6094 "$define"|true|[yY]*)
6095         cat <<EOM >&4
6096
6097 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6098 EOM
6099         use64bitint="$define"
6100         ;;
6101 esac
6102 case "$use64bitints" in
6103 "$define"|true|[yY]*)
6104         cat <<EOM >&4
6105
6106 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6107 EOM
6108         use64bitint="$define"
6109         ;;
6110 esac
6111 case "$use64bitsint" in
6112 "$define"|true|[yY]*)
6113         cat <<EOM >&4
6114
6115 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6116 EOM
6117         use64bitint="$define"
6118         ;;
6119 esac
6120 case "$uselonglongs" in
6121 "$define"|true|[yY]*)
6122         cat <<EOM >&4
6123
6124 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6125 EOM
6126         use64bitint="$define"
6127         ;;
6128 esac
6129 case "$use64bitsall" in
6130 "$define"|true|[yY]*)
6131         cat <<EOM >&4
6132
6133 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6134 EOM
6135         use64bitall="$define"
6136         ;;
6137 esac
6138
6139 case "$ccflags" in
6140 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6141 esac
6142 case "$use64bitall" in
6143 "$define"|true|[yY]*) use64bitint="$define" ;;
6144 esac
6145
6146 case "$longsize" in
6147 8) cat <<EOM
6148
6149 You have natively 64-bit long integers.
6150 EOM
6151    val="$define"
6152    ;;
6153 *) case "$use64bitint" in
6154    "$define"|true|[yY]*) dflt='y';;
6155    *) dflt='n';;
6156    esac
6157    case "$d_quad" in
6158    "$define") ;;
6159    *) dflt='n' ;;
6160    esac
6161    cat <<EOM
6162
6163 Perl can be built to take advantage of 64-bit integer types
6164 on some systems.  To do so, Configure can be run with -Duse64bitint.
6165 Choosing this option will most probably introduce binary incompatibilities.
6166
6167 If this doesn't make any sense to you, just accept the default '$dflt'.
6168 (The default has been chosen based on your configuration.)
6169 EOM
6170    rp='Try to use 64-bit integers, if available?'
6171    . ./myread
6172    case "$ans" in
6173    [yY]*) val="$define" ;;
6174    *)     val="$undef"  ;;
6175    esac
6176    ;;
6177 esac
6178 set use64bitint
6179 eval $setvar
6180
6181 case "$use64bitall" in
6182 "$define"|true|[yY]*) dflt='y' ;;
6183 *) case "$longsize" in
6184    8) dflt='y' ;;
6185    *) dflt='n' ;;
6186    esac
6187    ;;
6188 esac
6189 cat <<EOM
6190
6191 You may also choose to try maximal 64-bitness.  It means using as much
6192 64-bitness as possible on the platform.  This in turn means even more
6193 binary incompatibilities.  On the other hand, your platform may not
6194 have any more 64-bitness available than what you already have chosen.
6195
6196 If this doesn't make any sense to you, just accept the default '$dflt'.
6197 (The default has been chosen based on your configuration.)
6198 EOM
6199 rp='Try to use maximal 64-bit support, if available?'
6200 . ./myread
6201 case "$ans" in
6202 [yY]*) val="$define" ;;
6203 *)     val="$undef"  ;;
6204 esac
6205 set use64bitall
6206 eval $setvar
6207 case "$use64bitall" in
6208 "$define")
6209         case "$use64bitint" in
6210         "$undef")
6211                 cat <<EOM
6212
6213 Since you have chosen a maximally 64-bit build, I'm also turning on
6214 the use of 64-bit integers.
6215 EOM
6216                 use64bitint="$define" ;;
6217         esac
6218         ;;
6219 esac
6220
6221 : Look for a hint-file generated 'call-back-unit'.  If the
6222 : user has specified that a 64-bit perl is to be built,
6223 : we may need to set or change some other defaults.
6224 if $test -f use64bitint.cbu; then
6225         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6226         . ./use64bitint.cbu
6227 fi
6228 case "$use64bitint" in
6229 "$define"|true|[yY]*)
6230         : This test was common to all the OpenBSD forks, and seems harmless for
6231         : other platforms:
6232         echo " "
6233         echo "Checking if your C library has broken 64-bit functions..." >&4
6234         cat >try.c <<EOCP
6235 #include <stdio.h>
6236 typedef $uquadtype myULL;
6237 int main (void)
6238 {
6239     struct {
6240         double d;
6241         myULL  u;
6242     } *p, test[] = {
6243         {4294967303.15, 4294967303ULL},
6244         {4294967294.2,  4294967294ULL},
6245         {4294967295.7,  4294967295ULL},
6246         {0.0, 0ULL}
6247     };
6248     for (p = test; p->u; p++) {
6249         myULL x = (myULL)p->d;
6250         if (x != p->u) {
6251             printf("buggy\n");
6252             return 0;
6253         }
6254     }
6255     printf("ok\n");
6256     return 0;
6257 }
6258 EOCP
6259         set try
6260         if eval $compile_ok; then
6261             libcquad=`$run ./try`
6262             echo "Your C library's 64-bit functions are $libcquad."
6263         else
6264             echo "(I can't seem to compile the test program.)"
6265             echo "Assuming that your C library's 64-bit functions are ok."
6266             libcquad="ok"
6267         fi
6268         $rm_try
6269
6270         case "$libcquad" in
6271             buggy*)
6272                 cat >&4 <<EOM
6273
6274 *** You have a C library with broken 64-bit functions.
6275 *** 64-bit support does not work reliably in this configuration.
6276 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6277 *** Cannot continue, aborting.
6278
6279 EOM
6280                 exit 1
6281                 ;;
6282         esac
6283         case "$longsize" in
6284         4) case "$archname64" in
6285            '') archname64=64int ;;
6286            esac
6287            ;;
6288         esac
6289         ;;
6290 esac
6291
6292 : Look for a hint-file generated 'call-back-unit'.  If the
6293 : user has specified that a maximally 64-bit perl is to be built,
6294 : we may need to set or change some other defaults.
6295 if $test -f use64bitall.cbu; then
6296         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6297         . ./use64bitall.cbu
6298 fi
6299 case "$use64bitall" in
6300 "$define"|true|[yY]*)
6301         case "$longsize" in
6302         4) case "$archname64" in
6303            ''|64int) archname64=64all ;;
6304            esac
6305            ;;
6306         esac
6307         ;;
6308 esac
6309
6310 case "$d_quad:$use64bitint" in
6311 $undef:$define)
6312         cat >&4 <<EOF
6313
6314 *** You have chosen to use 64-bit integers,
6315 *** but none can be found.
6316 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6317 *** Cannot continue, aborting.
6318
6319 EOF
6320         exit 1
6321         ;;
6322 esac
6323
6324 : Check if we are using the GNU C library
6325 echo " "
6326 echo "Checking for GNU C Library..." >&4
6327 cat >try.c <<'EOCP'
6328 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6329    alone are insufficient to distinguish different versions, such as
6330    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6331    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6332 */
6333 #include <stdio.h>
6334 int main(void)
6335 {
6336 #ifdef __GLIBC__
6337 #   ifdef __GLIBC_MINOR__
6338 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6339 #           include <gnu/libc-version.h>
6340             printf("%s\n",  gnu_get_libc_version());
6341 #       else
6342             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6343 #       endif
6344 #   else
6345         printf("%d\n",  __GLIBC__);
6346 #   endif
6347     return 0;
6348 #else
6349     return 1;
6350 #endif
6351 }
6352 EOCP
6353 set try
6354 if eval $compile_ok && $run ./try > glibc.ver; then
6355         val="$define"
6356         gnulibc_version=`$cat glibc.ver`
6357         echo "You are using the GNU C Library version $gnulibc_version"
6358 else
6359         val="$undef"
6360         gnulibc_version=''
6361         echo "You are not using the GNU C Library"
6362 fi
6363 $rm_try glibc.ver
6364 set d_gnulibc
6365 eval $setvar
6366
6367 : see if nm is to be used to determine whether a symbol is defined or not
6368 case "$usenm" in
6369 '')
6370         dflt=''
6371         case "$d_gnulibc" in
6372         "$define")
6373                 echo " "
6374                 echo "nm probably won't work on the GNU C Library." >&4
6375                 dflt=n
6376                 ;;
6377         esac
6378         case "$dflt" in
6379         '')
6380                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6381                         echo " "
6382                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6383                         echo "'nm' won't be sufficient on this system." >&4
6384                         dflt=n
6385                 fi
6386                 ;;
6387         esac
6388         case "$dflt" in
6389         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6390                 if $test $dflt -gt 20; then
6391                         dflt=y
6392                 else
6393                         dflt=n
6394                 fi
6395                 ;;
6396         esac
6397         ;;
6398 *)
6399         case "$usenm" in
6400         true|$define) dflt=y;;
6401         *) dflt=n;;
6402         esac
6403         ;;
6404 esac
6405 $cat <<EOM
6406
6407 I can use $nm to extract the symbols from your C libraries. This
6408 is a time consuming task which may generate huge output on the disk (up
6409 to 3 megabytes) but that should make the symbols extraction faster. The
6410 alternative is to skip the 'nm' extraction part and to compile a small
6411 test program instead to determine whether each symbol is present. If
6412 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6413 this may be the best solution.
6414
6415 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6416
6417 EOM
6418 rp="Shall I use $nm to extract C symbols from the libraries?"
6419 . ./myread
6420 case "$ans" in
6421 [Nn]*) usenm=false;;
6422 *) usenm=true;;
6423 esac
6424
6425 runnm=$usenm
6426 case "$reuseval" in
6427 true) runnm=false;;
6428 esac
6429
6430 : nm options which may be necessary
6431 case "$nm_opt" in
6432 '') if $test -f /mach_boot; then
6433                 nm_opt=''       # Mach
6434         elif $test -d /usr/ccs/lib; then
6435                 nm_opt='-p'     # Solaris (and SunOS?)
6436         elif $test -f /dgux; then
6437                 nm_opt='-p'     # DG-UX
6438         elif $test -f /lib64/rld; then
6439                 nm_opt='-p'     # 64-bit Irix
6440         else
6441                 nm_opt=''
6442         fi;;
6443 esac
6444
6445 : nm options which may be necessary for shared libraries but illegal
6446 : for archive libraries.  Thank you, Linux.
6447 case "$nm_so_opt" in
6448 '')     case "$myuname" in
6449         *linux*|gnu*)
6450                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6451                         nm_so_opt='--dynamic'
6452                 fi
6453                 ;;
6454         esac
6455         ;;
6456 esac
6457
6458 : Figure out where the libc is located
6459 case "$runnm" in
6460 true)
6461 : get list of predefined functions in a handy place
6462 echo " "
6463 case "$libc" in
6464 '') libc=unknown
6465         case "$libs" in
6466         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6467         esac
6468         ;;
6469 esac
6470 case "$libs" in
6471 '') ;;
6472 *)  for thislib in $libs; do
6473         case "$thislib" in
6474         -lc|-lc_s)
6475                 : Handle C library specially below.
6476                 ;;
6477         -l*)
6478                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6479                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6480                         :
6481                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6482                         :
6483                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6484                         :
6485                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6486                         :
6487                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6488                         :
6489                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6490                         :
6491                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6492                         :
6493                 else
6494                         try=''
6495                 fi
6496                 libnames="$libnames $try"
6497                 ;;
6498         *) libnames="$libnames $thislib" ;;
6499         esac
6500         done
6501         ;;
6502 esac
6503 xxx=normal
6504 case "$libc" in
6505 unknown)
6506         set /lib/libc.$so
6507         for xxx in $libpth; do
6508                 $test -r $1 || set $xxx/libc.$so
6509                 : The messy sed command sorts on library version numbers.
6510                 $test -r $1 || \
6511                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6512                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6513                                 h
6514                                 s/[0-9][0-9]*/0000&/g
6515                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6516                                 G
6517                                 s/\n/ /' | \
6518                          $sort | $sed -e 's/^.* //'`
6519                 eval set \$$#
6520         done
6521         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6522         $test -r $1 || set $sysroot/lib/libsys_s$_a
6523         ;;
6524 *)
6525         set blurfl
6526         ;;
6527 esac
6528 if $test -r "$1"; then
6529         echo "Your (shared) C library seems to be in $1."
6530         libc="$1"
6531 elif $test -r /lib/libc && $test -r /lib/clib; then
6532         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6533         xxx=apollo
6534         libc='/lib/clib /lib/libc'
6535         if $test -r /lib/syslib; then
6536                 echo "(Your math library is in /lib/syslib.)"
6537                 libc="$libc /lib/syslib"
6538         fi
6539 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6540         echo "Your C library seems to be in $libc, as you said before."
6541 elif $test -r $incpath/usr/lib/libc$_a; then
6542         libc=$incpath/usr/lib/libc$_a;
6543         echo "Your C library seems to be in $libc.  That's fine."
6544 elif $test -r /lib/libc$_a; then
6545         libc=/lib/libc$_a;
6546         echo "Your C library seems to be in $libc.  You're normal."
6547 else
6548         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6549                 :
6550         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6551                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6552         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6553                 :
6554         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6555                 :
6556         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6557                 :
6558         else
6559                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6560         fi
6561         if $test -r "$tans"; then
6562                 echo "Your C library seems to be in $tans, of all places."
6563                 libc=$tans
6564         else
6565                 libc='blurfl'
6566         fi
6567 fi
6568 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6569         dflt="$libc"
6570         cat <<EOM
6571
6572 If the guess above is wrong (which it might be if you're using a strange
6573 compiler, or your machine supports multiple models), you can override it here.
6574
6575 EOM
6576 else
6577         dflt=''
6578         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6579         cat >&4 <<EOM
6580 I can't seem to find your C library.  I've looked in the following places:
6581
6582 EOM
6583         $sed 's/^/      /' libpath
6584         cat <<EOM
6585
6586 None of these seems to contain your C library. I need to get its name...
6587
6588 EOM
6589 fi
6590 fn=f
6591 rp='Where is your C library?'
6592 . ./getfile
6593 libc="$ans"
6594
6595 echo " "
6596 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6597 set X `cat libnames`
6598 shift
6599 xxx=files
6600 case $# in 1) xxx=file; esac
6601 echo "Extracting names from the following $xxx for later perusal:" >&4
6602 echo " "
6603 $sed 's/^/      /' libnames >&4
6604 echo " "
6605 $echo $n "This may take a while...$c" >&4
6606
6607 for file in $*; do
6608         case $file in
6609         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6610         *) $nm $nm_opt $file 2>/dev/null;;
6611         esac
6612 done >libc.tmp
6613
6614 $echo $n ".$c"
6615 $grep fprintf libc.tmp > libc.ptf
6616 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6617 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6618 xxx='[ADTSIWi]'
6619 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6620         eval $xscan;\
6621         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6622                 eval $xrun
6623 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6624         eval $xscan;\
6625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6626                 eval $xrun
6627 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6628         eval $xscan;\
6629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6630                 eval $xrun
6631 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6632         eval $xscan;\
6633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6634                 eval $xrun
6635 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6636         eval $xscan;\
6637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6638                 eval $xrun
6639 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6640         eval $xscan;\
6641         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6642                 eval $xrun
6643 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6644                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6645         eval $xscan;\
6646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6647                 eval $xrun
6648 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6649         eval $xscan;\
6650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6651                 eval $xrun
6652 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6653         eval $xscan;\
6654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6655                 eval $xrun
6656 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6657         eval $xscan;\
6658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6659                 eval $xrun
6660 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6661         eval $xscan;\
6662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6663                 eval $xrun
6664 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6665         eval $xscan;\
6666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6667                 eval $xrun
6668 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6669         eval $xscan;\
6670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6671                 eval $xrun
6672 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6673         eval $xscan;\
6674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6675                 eval $xrun
6676 else
6677         $nm -p $* 2>/dev/null >libc.tmp
6678         $grep fprintf libc.tmp > libc.ptf
6679         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6680                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6681         then
6682                 nm_opt='-p'
6683                 eval $xrun
6684         else
6685                 echo " "
6686                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6687                 com=''
6688                 if $ar t $libc > libc.tmp && \
6689                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6690                 then
6691                         for thisname in $libnames $libc; do
6692                                 $ar t $thisname >>libc.tmp
6693                         done
6694                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6695                         echo "Ok." >&4
6696                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6697                         for thisname in $libnames $libc; do
6698                                 $ar tv $thisname >>libc.tmp
6699                                 emximp -o tmp.imp $thisname \
6700                                     2>/dev/null && \
6701                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6702                                     < tmp.imp >>libc.tmp
6703                                 $rm -f tmp.imp
6704                         done
6705                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6706                         echo "Ok." >&4
6707                 else
6708                         echo "$ar didn't seem to work right." >&4
6709                         echo "Maybe this is a Cray...trying bld instead..." >&4
6710                         if  bld t $libc | \
6711                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6712                                 $test -s libc.list
6713                         then
6714                                 for thisname in $libnames; do
6715                                         bld t $libnames | \
6716                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6717                                         $ar t $thisname >>libc.tmp
6718                                 done
6719                                 echo "Ok." >&4
6720                         else
6721                                 echo "That didn't work either.  Giving up." >&4
6722                                 exit 1
6723                         fi
6724                 fi
6725         fi
6726 fi
6727 nm_extract="$com"
6728 case "$PASE" in
6729 define)
6730     echo " "
6731     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6732     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6733     ;;
6734 *)  if $test -f /lib/syscalls.exp; then
6735         echo " "
6736         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6737         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6738                 /lib/syscalls.exp >>libc.list
6739     fi
6740     ;;
6741 esac
6742 ;;
6743 esac
6744 $rm -f libnames libpath
6745
6746 : Check if we are using C++
6747 echo " "
6748 echo "Checking for C++..." >&4
6749 $cat >try.c <<'EOCP'
6750 #include <stdio.h>
6751 int main(void)
6752 {
6753 #ifdef __cplusplus
6754     return 0;
6755 #else
6756     return 1;
6757 #endif
6758 }
6759 EOCP
6760 set try
6761 if eval $compile_ok && $run ./try; then
6762         val="$define"
6763         echo "You are using a C++ compiler."
6764 else
6765         val="$undef"
6766         echo "You are not using a C++ compiler."
6767 fi
6768 $rm_try cplusplus$$
6769 set d_cplusplus
6770 eval $setvar
6771
6772 : is a C symbol defined?
6773 csym='tlook=$1;
6774 case "$3" in
6775 -v) tf=libc.tmp; tdc="";;
6776 -a) tf=libc.tmp; tdc="[]";;
6777 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6778 esac;
6779 case "$d_cplusplus" in
6780     $define)    extern_C="extern \"C\"" ;;
6781     *)          extern_C="extern"       ;;
6782 esac;
6783 tx=yes;
6784 case "$reuseval-$4" in
6785 true-) ;;
6786 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6787 esac;
6788 case "$tx" in
6789 yes)
6790         tval=false;
6791         if $test "$runnm" = true; then
6792                 if $contains $tlook $tf >/dev/null 2>&1; then
6793                         tval=true;
6794                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6795                         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;
6796                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6797                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6798                         $rm_try;
6799                 fi;
6800         else
6801                 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;
6802                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6803                 $rm_try;
6804         fi;
6805         ;;
6806 *)
6807         case "$tval" in
6808         $define) tval=true;;
6809         *) tval=false;;
6810         esac;
6811         ;;
6812 esac;
6813 eval "$2=$tval"'
6814
6815 : define an is-in-libc? function
6816 inlibc='echo " "; td=$define; tu=$undef;
6817 sym=$1; var=$2; eval "was=\$$2";
6818 tx=yes;
6819 case "$reuseval$was" in
6820 true) ;;
6821 true*) tx=no;;
6822 esac;
6823 case "$tx" in
6824 yes)
6825         set $sym tres -f;
6826         eval $csym;
6827         case "$tres" in
6828         true)
6829                 echo "$sym() found." >&4;
6830                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6831         *)
6832                 echo "$sym() NOT found." >&4;
6833                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6834         esac;;
6835 *)
6836         case "$was" in
6837         $define) echo "$sym() found." >&4;;
6838         *) echo "$sym() NOT found." >&4;;
6839         esac;;
6840 esac'
6841
6842 : check for length of double
6843 echo " "
6844 case "$doublesize" in
6845 '')
6846         echo "Checking to see how big your double precision numbers are..." >&4
6847         $cat >try.c <<EOCP
6848 #include <stdio.h>
6849 #$i_stdlib I_STDLIB
6850 #ifdef I_STDLIB
6851 #include <stdlib.h>
6852 #endif
6853 int main()
6854 {
6855     printf("%d\n", (int)sizeof(double));
6856     exit(0);
6857 }
6858 EOCP
6859         set try
6860         if eval $compile_ok; then
6861                 doublesize=`$run ./try`
6862                 echo "Your double is $doublesize bytes long."
6863         else
6864                 dflt='8'
6865                 echo "(I can't seem to compile the test program.  Guessing...)"
6866                 rp="What is the size of a double precision number (in bytes)?"
6867                 . ./myread
6868                 doublesize="$ans"
6869         fi
6870         ;;
6871 esac
6872 $rm_try
6873
6874 : see if this is a float.h system
6875 set float.h i_float
6876 eval $inhdr
6877
6878 : check for long doubles
6879 echo " "
6880 echo "Checking to see if you have long double..." >&4
6881 echo 'int main() { long double x = 7.0; }' > try.c
6882 set try
6883 if eval $compile; then
6884         val="$define"
6885         echo "You have long double."
6886 else
6887         val="$undef"
6888         echo "You do not have long double."
6889 fi
6890 $rm_try
6891 set d_longdbl
6892 eval $setvar
6893
6894 : see if ldexpl exists
6895 set ldexpl d_ldexpl
6896 eval $inlibc
6897
6898 : check for length of long double
6899 case "${d_longdbl}${longdblsize}" in
6900 $define)
6901         echo " "
6902         echo "Checking to see how big your long doubles are..." >&4
6903         $cat >try.c <<'EOCP'
6904 #include <stdio.h>
6905 int main()
6906 {
6907         printf("%d\n", sizeof(long double));
6908 }
6909 EOCP
6910         set try
6911         set try
6912         if eval $compile; then
6913                 longdblsize=`$run ./try`
6914                 echo "Your long doubles are $longdblsize bytes long."
6915         else
6916                 dflt='8'
6917                 echo " "
6918                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6919                 rp="What is the size of a long double (in bytes)?"
6920                 . ./myread
6921                 longdblsize="$ans"
6922         fi
6923         if $test "X$doublesize" = "X$longdblsize"; then
6924                 echo "That isn't any different from an ordinary double."
6925                 echo "I'll keep your setting anyway, but you may see some"
6926                 echo "harmless compilation warnings."
6927         fi
6928         ;;
6929 esac
6930 $rm_try
6931
6932 $echo "Checking the kind of long doubles you have..." >&4
6933 case "$d_longdbl" in
6934 define)
6935 $cat <<EOP >try.c
6936 #$i_float I_FLOAT
6937 #$i_stdlib I_STDLIB
6938 #define LONGDBLSIZE $longdblsize
6939 #define DOUBLESIZE $doublesize
6940 #ifdef I_FLOAT
6941 #include <float.h>
6942 #endif
6943 #ifdef I_STDLIB
6944 #include <stdlib.h>
6945 #endif
6946 #include <stdio.h>
6947 static const long double d = -0.1L;
6948 int main() {
6949   unsigned const char* b = (unsigned const char*)(&d);
6950 #if DOUBLESIZE == LONGDBLSIZE
6951   printf("0\n"); /* if it floats like double */
6952   exit(0);
6953 #endif
6954 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6955   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6956     /* IEEE 754 128-bit little-endian */
6957     printf("1\n");
6958     exit(0);
6959   }
6960   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6961     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6962     printf("2\n");
6963     exit(0);
6964   }
6965 #endif
6966 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6967  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6968  * cannot be trusted. */
6969 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6970   if (b[0] == 0xCD && b[9] == 0xBF) {
6971     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6972      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6973      * Also known as "extended precision". */
6974     printf("3\n");
6975     exit(0);
6976   }
6977   if (b[0] == 0xBF && b[9] == 0xCD) {
6978     /* Is there ever big-endian 80-bit, really?
6979      *
6980      * The Motorola 68881 had another "extended precision" format:
6981      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6982      * for total of 96 bits of bytes.  The zero bits were unused.
6983      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
6984      * If it ever becomes relevant, this format should be allocated
6985      * a new doublekind code since it's quite different from the Intel x87.
6986      */
6987     printf("4\n");
6988     exit(0);
6989   }
6990 #endif
6991 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6992   /* software "double double", the 106 is 53+53.
6993    * but irix thinks it is 107. */
6994   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6995     /* double double 128-bit fully little-endian,
6996      * little-endian doubles in little-endian order,
6997      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6998     printf("5\n");
6999     exit(0);
7000   }
7001   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7002     /* double double 128-bit fully big-endian,
7003      * big-endian doubles in big-endian order,
7004      * e.g. PPC/Power and MIPS:
7005      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7006     printf("6\n");
7007     exit(0);
7008   }
7009   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7010     /* double double 128-bit mixed endian.
7011      * little-endian doubles in big-endian order,
7012      * e.g. ppc64el,
7013      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7014     printf("7\n");
7015     exit(0);
7016   }
7017   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7018     /* double double 128-bit mixed endian,
7019      * big-endian doubles in little-endian order,
7020      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7021     printf("8\n");
7022     exit(0);
7023   }
7024 #endif
7025   printf("-1\n"); /* unknown */
7026   exit(0);
7027 }
7028 EOP
7029 set try
7030 if eval $compile; then
7031     longdblkind=`$run ./try`
7032 else
7033     longdblkind=-1
7034 fi
7035 ;;
7036 *) longdblkind=0 ;;
7037 esac
7038 case "$longdblkind" in
7039 0) echo "Your long doubles are doubles." >&4 ;;
7040 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7041 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7042 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7043 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7044 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7045 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7046 7) echo "You have 128-bit mixed double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7047 8) echo "You have 128-bit mixed double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7048 *) echo "Cannot figure out your long double." >&4 ;;
7049 esac
7050 $rm_try
7051
7052 : determine the architecture name
7053 echo " "
7054 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7055         tarch=`arch`"-$osname"
7056 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7057         if uname -m > tmparch 2>&1 ; then
7058                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7059                         -e 's/$/'"-$osname/" tmparch`
7060         else
7061                 tarch="$osname"
7062         fi
7063         $rm -f tmparch
7064 else
7065         tarch="$osname"
7066 fi
7067 case "$myarchname" in
7068 ''|"$tarch") ;;
7069 *)
7070         echo "(Your architecture name used to be $myarchname.)"
7071         archname=''
7072         ;;
7073 esac
7074 case "$targetarch" in
7075 '') ;;
7076 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7077 esac
7078 myarchname="$tarch"
7079 case "$archname" in
7080 '') dflt="$tarch";;
7081 *) dflt="$archname";;
7082 esac
7083 rp='What is your architecture name'
7084 . ./myread
7085 archname="$ans"
7086
7087 : optionally add API version to the architecture for versioned archlibs
7088 case "$useversionedarchname" in
7089 $define|true|[yY]*) dflt='y';;
7090 *)                  dflt='n';;
7091 esac
7092 rp='Add the Perl API version to your archname?'
7093 . ./myread
7094 case "$ans" in
7095 y|Y)    useversionedarchname="$define" ;;
7096 *)      useversionedarchname="$undef" ;;
7097 esac
7098 case "$useversionedarchname" in
7099 $define)
7100         case "$archname" in
7101         *-$api_versionstring)
7102                 echo "...and architecture name already has -$api_versionstring" >&4
7103                 ;;
7104         *)
7105                 archname="$archname-$api_versionstring"
7106                 echo "...setting architecture name to $archname." >&4
7107                 ;;
7108         esac
7109         ;;
7110 esac
7111
7112 case "$usethreads" in
7113 $define)
7114         echo "Threads selected." >&4
7115         case "$archname" in
7116         *-thread*) echo "...and architecture name already has -thread." >&4
7117                 ;;
7118         *)      archname="$archname-thread"
7119                 echo "...setting architecture name to $archname." >&4
7120                 ;;
7121         esac
7122         ;;
7123 esac
7124 case "$usemultiplicity" in
7125 $define)
7126         echo "Multiplicity selected." >&4
7127         case "$archname" in
7128         *-multi*) echo "...and architecture name already has -multi." >&4
7129                 ;;
7130         *)      archname="$archname-multi"
7131                 echo "...setting architecture name to $archname." >&4
7132                 ;;
7133         esac
7134         ;;
7135 esac
7136 case "$use64bitint$use64bitall" in
7137 *"$define"*)
7138         case "$archname64" in
7139         '')
7140                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7141                 ;;
7142         *)
7143                 case "$use64bitint" in
7144                 "$define") echo "64 bit integers selected." >&4 ;;
7145                 esac
7146                 case "$use64bitall" in
7147                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7148                 esac
7149                 case "$archname" in
7150                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7151                         ;;
7152                 *)      archname="$archname-$archname64"
7153                         echo "...setting architecture name to $archname." >&4
7154                         ;;
7155                 esac
7156                 ;;
7157         esac
7158 esac
7159 case "$uselongdouble" in
7160 $define)
7161         echo "Long doubles selected." >&4
7162         case "$longdblsize" in
7163         $doublesize)
7164                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7165                 ;;
7166         *)
7167                 case "$archname" in
7168                 *-ld*) echo "...and architecture name already has -ld." >&4
7169                         ;;
7170                 *)      archname="$archname-ld"
7171                         echo "...setting architecture name to $archname." >&4
7172                         ;;
7173                 esac
7174                 ;;
7175         esac
7176         ;;
7177 esac
7178 case "$usequadmath" in
7179 $define)
7180         echo "quadmath selected." >&4
7181         case "$archname" in
7182         *-ld*) echo "...and architecture name already has -quadmath." >&4
7183                 ;;
7184         *)      archname="$archname-quadmath"
7185                 echo "...setting architecture name to $archname." >&4
7186                 ;;
7187         esac
7188         ;;
7189 esac
7190 if $test -f archname.cbu; then
7191         echo "Your platform has some specific hints for architecture name, using them..."
7192         . ./archname.cbu
7193 fi
7194
7195 : set the prefixit variable, to compute a suitable default value
7196 prefixit='case "$3" in
7197 ""|none)
7198         case "$oldprefix" in
7199         "") eval "$1=\"\$$2\"";;
7200         *)
7201                 case "$3" in
7202                 "") eval "$1=";;
7203                 none)
7204                         eval "tp=\"\$$2\"";
7205                         case "$tp" in
7206                         ""|" ") eval "$1=\"\$$2\"";;
7207                         *) eval "$1=";;
7208                         esac;;
7209                 esac;;
7210         esac;;
7211 *)
7212         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7213         case "$tp" in
7214         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7215         /*-$oldprefix/*|\~*-$oldprefix/*)
7216                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7217         *) eval "$1=\"\$$2\"";;
7218         esac;;
7219 esac'
7220
7221 : determine installation style
7222 : For now, try to deduce it from prefix unless it is already set.
7223 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7224 case "$installstyle" in
7225 '')     case "$prefix" in
7226                 *perl*) dflt='lib';;
7227                 *) dflt='lib/perl5' ;;
7228         esac
7229         ;;
7230 *)      dflt="$installstyle" ;;
7231 esac
7232 : Probably not worth prompting for this since we prompt for all
7233 : the directories individually, and the prompt would be too long and
7234 : confusing anyway.
7235 installstyle=$dflt
7236
7237 : determine where public executables go
7238 echo " "
7239 set dflt bin bin
7240 eval $prefixit
7241 fn=d~
7242 rp='Pathname where the public executables will reside?'
7243 . ./getfile
7244 if $test "X$ansexp" != "X$binexp"; then
7245         installbin=''
7246 fi
7247 prefixvar=bin
7248 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7249 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7250 :     this via initialinstalllocation
7251 . ./setprefixvar
7252
7253 case "$userelocatableinc" in
7254 $define|true|[yY]*)     dflt='y' ;;
7255 *)                      dflt='n' ;;
7256 esac
7257 cat <<EOM
7258
7259 Would you like to build Perl so that the installation is relocatable, so that
7260 library paths in @INC are determined relative to the path of the perl binary?
7261 This is not advised for system Perl installs, or if you need to run setid
7262 scripts or scripts under taint mode.
7263
7264 If this doesn't make any sense to you, just accept the default '$dflt'.
7265 EOM
7266 rp='Use relocatable @INC?'
7267 . ./myread
7268 case "$ans" in
7269 y|Y)    val="$define" ;;
7270 *)      val="$undef"  ;;
7271 esac
7272 set userelocatableinc
7273 eval $setvar
7274
7275 initialinstalllocation="$binexp"
7276 : Default prefix is now "up one level from where the binaries are"
7277 case "$userelocatableinc" in
7278 $define|true|[yY]*)
7279     bin=".../"
7280     binexp=".../"
7281     prefix=".../.."
7282     prefixexp=".../.."
7283     installprefixexp=".../.."
7284     ;;
7285 esac
7286
7287 : determine where private library files go
7288 : Usual default is /usr/local/lib/perl5/$version.
7289 : Also allow things like /opt/perl/lib/$version, since
7290 : /opt/perl/lib/perl5... would be redundant.
7291 : The default "style" setting is made in installstyle.U
7292 case "$installstyle" in
7293 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7294 *)       set dflt privlib lib/$version ;;
7295 esac
7296 eval $prefixit
7297 $cat <<EOM
7298
7299 There are some auxiliary files for $package that need to be put into a
7300 private library directory that is accessible by everyone.
7301
7302 EOM
7303 fn=$binexp
7304 fn=d~+
7305 rp='Pathname where the private library files will reside?'
7306 . ./getfile
7307 prefixvar=privlib
7308 . ./setprefixvar
7309
7310 : set the prefixup variable, to restore leading tilda escape
7311 prefixup='case "$prefixexp" in
7312 "$prefix") ;;
7313 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7314 esac'
7315
7316 : determine where public architecture dependent libraries go
7317 set archlib archlib
7318 eval $prefixit
7319 : privlib default is /usr/local/lib/$package/$version
7320 : archlib default is /usr/local/lib/$package/$version/$archname
7321 : privlib may have an optional trailing /share.
7322 tdflt=`echo $privlib | $sed 's,/share$,,'`
7323 tdflt=$tdflt/$archname
7324 case "$archlib" in
7325 '')     dflt=$tdflt
7326         ;;
7327 *)      dflt="$archlib"
7328     ;;
7329 esac
7330 $cat <<EOM
7331
7332 $spackage contains architecture-dependent library files.  If you are
7333 sharing libraries in a heterogeneous environment, you might store
7334 these files in a separate location.  Otherwise, you can just include
7335 them with the rest of the public library files.
7336
7337 EOM
7338 fn=$binexp
7339 fn=d+~
7340 rp='Where do you want to put the public architecture-dependent libraries?'
7341 . ./getfile
7342 prefixvar=archlib
7343 . ./setprefixvar
7344 if $test X"$archlib" = X"$privlib"; then
7345         d_archlib="$undef"
7346 else
7347         d_archlib="$define"
7348 fi
7349
7350 : see if setuid scripts can be secure
7351 $cat <<EOM
7352
7353 Some kernels have a bug that prevents setuid #! scripts from being
7354 secure.  Some sites have disabled setuid #! scripts because of this.
7355
7356 First let's decide if your kernel supports secure setuid #! scripts.
7357 (If setuid #! scripts would be secure but have been disabled anyway,
7358 don't say that they are secure if asked.)
7359
7360 EOM
7361
7362 val="$undef"
7363 if $test -d /dev/fd; then
7364         echo "#!$ls" >reflect
7365         chmod +x,u+s reflect
7366         ./reflect >flect 2>&1
7367         if $contains "/dev/fd" flect >/dev/null; then
7368                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7369                 val="$define"
7370         else
7371                 $cat <<EOM
7372 If you are not sure if they are secure, I can check but I'll need a
7373 username and password different from the one you are using right now.
7374 If you don't have such a username or don't want me to test, simply
7375 enter 'none'.
7376
7377 EOM
7378                 rp='Other username to test security of setuid scripts with?'
7379                 dflt='none'
7380                 . ./myread
7381                 case "$ans" in
7382                 n|none)
7383                         case "$d_suidsafe" in
7384                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7385                                 dflt=n;;
7386                         "$undef")
7387                                 echo "Well, the $hint value is *not* secure." >&4
7388                                 dflt=n;;
7389                         *)      echo "Well, the $hint value *is* secure." >&4
7390                                 dflt=y;;
7391                         esac
7392                         ;;
7393                 *)
7394                         $rm -f reflect flect
7395                         echo "#!$ls" >reflect
7396                         chmod +x,u+s reflect
7397                         echo >flect
7398                         chmod a+w flect
7399                         echo '"su" will (probably) prompt you for '"$ans's password."
7400                         su $ans -c './reflect >flect'
7401                         if $contains "/dev/fd" flect >/dev/null; then
7402                                 echo "Okay, it looks like setuid scripts are secure." >&4
7403                                 dflt=y
7404                         else
7405                                 echo "I don't think setuid scripts are secure." >&4
7406                                 dflt=n
7407                         fi
7408                         ;;
7409                 esac
7410                 rp='Does your kernel have *secure* setuid scripts?'
7411                 . ./myread
7412                 case "$ans" in
7413                 [yY]*)  val="$define";;
7414                 *)      val="$undef";;
7415                 esac
7416         fi
7417 else
7418         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7419         echo "(That's for file descriptors, not floppy disks.)"
7420         val="$undef"
7421 fi
7422 set d_suidsafe
7423 eval $setvar
7424
7425 $rm -f reflect flect
7426
7427 : now see if they want to do setuid emulation
7428 if $test $patchlevel -lt 11; then
7429 echo " "
7430 val="$undef"
7431 case "$d_suidsafe" in
7432 "$define")
7433         val="$undef"
7434         echo "No need to emulate SUID scripts since they are secure here." >&4
7435         ;;
7436 *)
7437         $cat <<EOM
7438 Some systems have disabled setuid scripts, especially systems where
7439 setuid scripts cannot be secure.  On systems where setuid scripts have
7440 been disabled, the setuid/setgid bits on scripts are currently
7441 useless.  It is possible for $package to detect those bits and emulate
7442 setuid/setgid in a secure fashion.  This emulation will only work if
7443 setuid scripts have been disabled in your kernel.
7444
7445 EOM
7446         case "$d_dosuid" in
7447         "$define") dflt=y ;;
7448         *) dflt=n ;;
7449         esac
7450         rp="Do you want to do setuid/setgid emulation?"
7451         . ./myread
7452         case "$ans" in
7453         [yY]*)  val="$define";;
7454         *)      val="$undef";;
7455         esac
7456         ;;
7457 esac
7458 set d_dosuid
7459 eval $setvar
7460 else
7461     case "$d_dosuid" in
7462         "$define")
7463         cat >&4 <<EOH
7464
7465 SUID emulation has been removed for 5.12
7466 Please re-run Configure without -Dd_dosuid
7467
7468 EOH
7469         exit 1;
7470         ;;
7471     esac
7472     d_dosuid=undef
7473 fi
7474
7475 : Find perl5.005 or later.
7476 echo "Looking for a previously installed perl5.005 or later... "
7477 case "$perl5" in
7478 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7479                 : Check if this perl is recent and can load a simple module
7480                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7481                         perl5=$tdir/perl
7482                         break;
7483                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7484                         perl5=$tdir/perl5
7485                         break;
7486                 fi
7487         done
7488         ;;
7489 *)      perl5="$perl5"
7490         ;;
7491 esac
7492 case "$perl5" in
7493 '')     echo "None found.  That's ok.";;
7494 *)      echo "Using $perl5." ;;
7495 esac
7496
7497 : Set the siteprefix variables
7498 $cat <<EOM
7499
7500 After $package is installed, you may wish to install various
7501 add-on modules and utilities.  Typically, these add-ons will
7502 be installed under $prefix with the rest
7503 of this package.  However, you may wish to install such add-ons
7504 elsewhere under a different prefix.
7505
7506 If you do not wish to put everything under a single prefix, that's
7507 ok.  You will be prompted for the individual locations; this siteprefix
7508 is only used to suggest the defaults.
7509
7510 The default should be fine for most people.
7511
7512 EOM
7513 fn=d~+
7514 rp='Installation prefix to use for add-on modules and utilities?'
7515 : XXX Here might be another good place for an installstyle setting.
7516 case "$siteprefix" in
7517 '') dflt=$prefix ;;
7518 *)  dflt=$siteprefix ;;
7519 esac
7520 . ./getfile
7521 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7522 oldsiteprefix=''
7523 case "$siteprefix" in
7524 '') ;;
7525 *)      case "$ans" in
7526         "$prefix") ;;
7527         *) oldsiteprefix="$prefix";;
7528         esac
7529         ;;
7530 esac
7531 siteprefix="$ans"
7532 siteprefixexp="$ansexp"
7533
7534 : determine where site specific libraries go.
7535 : Usual default is /usr/local/lib/perl5/site_perl/$version
7536 : The default "style" setting is made in installstyle.U
7537 : XXX No longer works with Prefixit stuff.
7538 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7539 case "$sitelib" in
7540 '') case "$installstyle" in
7541         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7542         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7543         esac
7544         ;;
7545 *)      dflt="$sitelib"
7546         ;;
7547 esac
7548 $cat <<EOM
7549
7550 The installation process will create a directory for
7551 site-specific extensions and modules.  Most users find it convenient
7552 to place all site-specific files in this directory rather than in the
7553 main distribution directory.
7554
7555 EOM
7556 fn=d~+
7557 rp='Pathname for the site-specific library files?'
7558 . ./getfile
7559 prefixvar=sitelib
7560 . ./setprefixvar
7561 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7562
7563 : Determine list of previous versions to include in @INC
7564 $cat > getverlist <<EOPL
7565 #!$perl5 -w
7566 use File::Basename;
7567 \$api_versionstring = "$api_versionstring";
7568 \$version = "$version";
7569 \$stem = "$sitelib_stem";
7570 \$archname = "$archname";
7571 EOPL
7572         $cat >> getverlist <<'EOPL'
7573 # The list found is store twice for each entry: the original name, and
7574 # the binary broken down version as pack "sss", so sorting is easy and
7575 # unambiguous. This will work for all versions that have a maximum of
7576 # three digit groups, separate by '.'s or '_'s. Names are extended with
7577 # ".0.0" to ensure at least three elements for the pack.
7578 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7579
7580 # Can't have leading @ because metaconfig interprets it as a command!
7581 ;@inc_version_list=();
7582 # XXX Redo to do opendir/readdir?
7583 if (-d $stem) {
7584     chdir($stem);
7585     ;@candidates = map {
7586         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7587     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7588 }
7589 else {
7590     ;@candidates = ();
7591 }
7592
7593 ($pversion, $aversion, $vsn5005) = map {
7594     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7595 foreach $d (@candidates) {
7596     if ($d->[1] lt $pversion) {
7597         if ($d->[1] ge $aversion) {
7598             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7599         }
7600         elsif ($d->[1] ge $vsn5005) {
7601             unshift(@inc_version_list, grep { -d } $d->[0]);
7602         }
7603     }
7604     else {
7605         # Skip newer version.  I.e. don't look in
7606         # 5.7.0 if we're installing 5.6.1.
7607     }
7608 }
7609
7610 if (@inc_version_list) {
7611     print join(' ', @inc_version_list);
7612 }
7613 else {
7614     # Blank space to preserve value for next Configure run.
7615     print " ";
7616 }
7617 EOPL
7618 chmod +x getverlist
7619 case "$inc_version_list" in
7620 '')     if test -x "$perl5$exe_ext"; then
7621                 dflt=`$perl5 getverlist`
7622         else
7623                 dflt='none'
7624         fi
7625         ;;
7626 $undef) dflt='none' ;;
7627 *)  eval dflt=\"$inc_version_list\" ;;
7628 esac
7629 case "$dflt" in
7630 ''|' ') dflt=none ;;
7631 esac
7632 case "$dflt" in
7633 5.005) dflt=none ;;
7634 esac
7635 $cat <<EOM
7636
7637 In order to ease the process of upgrading, this version of perl
7638 can be configured to use modules built and installed with earlier
7639 versions of perl that were installed under $prefix.  Specify here
7640 the list of earlier versions that this version of perl should check.
7641 If Configure detected no earlier versions of perl installed under
7642 $prefix, then the list will be empty.  Answer 'none' to tell perl
7643 to not search earlier versions.
7644
7645 The default should almost always be sensible, so if you're not sure,
7646 just accept the default.
7647 EOM
7648
7649 rp='List of earlier versions to include in @INC?'
7650 . ./myread
7651 case "$ans" in
7652 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7653 *) inc_version_list="$ans" ;;
7654 esac
7655 case "$inc_version_list" in
7656 ''|' ')
7657         inc_version_list_init='0'
7658         d_inc_version_list="$undef"
7659         ;;
7660 *)      inc_version_list_init=`echo $inc_version_list |
7661                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7662         d_inc_version_list="$define"
7663         ;;
7664 esac
7665 $rm -f getverlist
7666
7667 : see if malloc/malloc.h has to be included
7668 set malloc/malloc.h i_mallocmalloc
7669 eval $inhdr
7670
7671 : see if this is a malloc.h system
7672 : we want a real compile instead of Inhdr because some systems have a
7673 : malloc.h that just gives a compile error saying to use stdlib.h instead
7674 echo " "
7675 $cat >try.c <<EOCP
7676 #include <stdlib.h>
7677 #include <malloc.h>
7678 #$i_mallocmalloc I_MALLOCMALLOC
7679 #ifdef I_MALLOCMALLOC
7680 # include <malloc/malloc.h>
7681 #endif
7682
7683 int main () { return 0; }
7684 EOCP
7685 set try
7686 if eval $compile; then
7687     echo "<malloc.h> found." >&4
7688     val="$define"
7689 else
7690     echo "<malloc.h> NOT found." >&4
7691     val="$undef"
7692 fi
7693 $rm_try
7694 set i_malloc
7695 eval $setvar
7696
7697 : check for length of pointer
7698 echo " "
7699 case "$ptrsize" in
7700 '')
7701         echo "Checking to see how big your pointers are..." >&4
7702         $cat >try.c <<EOCP
7703 #include <stdio.h>
7704 #$i_stdlib I_STDLIB
7705 #ifdef I_STDLIB
7706 #include <stdlib.h>
7707 #endif
7708 int main()
7709 {
7710     printf("%d\n", (int)sizeof(void *));
7711     exit(0);
7712 }
7713 EOCP
7714         set try
7715         if eval $compile_ok; then
7716                 ptrsize=`$run ./try`
7717                 echo "Your pointers are $ptrsize bytes long."
7718         else
7719                 dflt='4'
7720                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7721                 rp="What is the size of a pointer (in bytes)?"
7722                 . ./myread
7723                 ptrsize="$ans"
7724         fi
7725         ;;
7726 esac
7727 $rm_try
7728 case "$use64bitall" in
7729 "$define"|true|[yY]*)
7730         case "$ptrsize" in
7731         4)      cat <<EOM >&4
7732
7733 *** You have chosen a maximally 64-bit build,
7734 *** but your pointers are only 4 bytes wide.
7735 *** Please rerun Configure without -Duse64bitall.
7736 EOM
7737                 case "$d_quad" in
7738                 define)
7739                         cat <<EOM >&4
7740 *** Since you have quads, you could possibly try with -Duse64bitint.
7741 EOM
7742                         ;;
7743                 esac
7744                 cat <<EOM >&4
7745 *** Cannot continue, aborting.
7746
7747 EOM
7748
7749                 exit 1
7750                 ;;
7751         esac
7752         ;;
7753 esac
7754
7755
7756 : determine whether to use malloc wrapping
7757 echo " "
7758 case "$usemallocwrap" in
7759 [yY]*|true|$define)     dflt='y' ;;
7760 [nN]*|false|$undef)     dflt='n' ;;
7761 *)      case "$usedevel" in
7762         [yY]*|true|$define)     dflt='y' ;;
7763         *) dflt='n' ;;
7764         esac
7765         ;;
7766 esac
7767 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7768 . ./myread
7769 usemallocwrap="$ans"
7770 case "$ans" in
7771 y*|true)
7772         usemallocwrap="$define" ;;
7773 *)
7774         usemallocwrap="$undef" ;;
7775 esac
7776
7777 : determine which malloc to compile in
7778 echo " "
7779 case "$usemymalloc" in
7780 [yY]*|true|$define)     dflt='y' ;;
7781 [nN]*|false|$undef)     dflt='n' ;;
7782 *)      case "$ptrsize" in
7783         4) dflt='y' ;;
7784         *) dflt='n' ;;
7785         esac
7786         if test "$useithreads" = "$define"; then dflt='n'; fi
7787         ;;
7788 esac
7789 rp="Do you wish to attempt to use the malloc that comes with $package?"
7790 . ./myread
7791 usemymalloc="$ans"
7792 case "$ans" in
7793 y*|true)
7794         usemymalloc='y'
7795         mallocsrc='malloc.c'
7796         mallocobj="malloc$_o"
7797         d_mymalloc="$define"
7798         case "$libs" in
7799         *-lmalloc*)
7800                 : Remove malloc from list of libraries to use
7801                 echo "Removing unneeded -lmalloc from library list" >&4
7802                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7803                 shift
7804                 libs="$*"
7805                 echo "libs = $libs" >&4
7806                 ;;
7807         esac
7808         ;;
7809 *)
7810         usemymalloc='n'
7811         mallocsrc=''
7812         mallocobj=''
7813         d_mymalloc="$undef"
7814         ;;
7815 esac
7816
7817 : compute the return types of malloc and free
7818 echo " "
7819 $cat >malloc.c <<END
7820 #$i_malloc I_MALLOC
7821 #$i_stdlib I_STDLIB
7822 #include <stdio.h>
7823 #include <sys/types.h>
7824 #ifdef I_MALLOC
7825 #include <malloc.h>
7826 #endif
7827 #ifdef I_STDLIB
7828 #include <stdlib.h>
7829 #endif
7830 #ifdef TRY_MALLOC
7831 void *malloc();
7832 #endif
7833 #ifdef TRY_FREE
7834 void free();
7835 #endif
7836 END
7837 case "$malloctype" in
7838 '')
7839         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7840                 malloctype='void *'
7841         else
7842                 malloctype='char *'
7843         fi
7844         ;;
7845 esac
7846 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7847
7848 case "$freetype" in
7849 '')
7850         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7851                 freetype='void'
7852         else
7853                 freetype='int'
7854         fi
7855         ;;
7856 esac
7857 echo "Your system uses $freetype free(), it would seem." >&4
7858 $rm -f malloc.[co]
7859 : determine where site specific architecture-dependent libraries go.
7860 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7861 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7862 : sitelib may have an optional trailing /share.
7863 case "$sitearch" in
7864 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7865         dflt="$dflt/$archname"
7866         ;;
7867 *)      dflt="$sitearch"
7868         ;;
7869 esac
7870 set sitearch sitearch none
7871 eval $prefixit
7872 $cat <<EOM
7873
7874 The installation process will also create a directory for
7875 architecture-dependent site-specific extensions and modules.
7876
7877 EOM
7878 fn=d~+
7879 rp='Pathname for the site-specific architecture-dependent library files?'
7880 . ./getfile
7881 prefixvar=sitearch
7882 . ./setprefixvar
7883 if $test X"$sitearch" = X"$sitelib"; then
7884         d_sitearch="$undef"
7885 else
7886         d_sitearch="$define"
7887 fi
7888
7889 : Set the vendorprefix variables
7890 $cat <<EOM
7891
7892 The installation process will also create a directory for
7893 vendor-supplied add-ons.  Vendors who supply perl with their system
7894 may find it convenient to place all vendor-supplied files in this
7895 directory rather than in the main distribution directory.  This will
7896 ease upgrades between binary-compatible maintenance versions of perl.
7897
7898 Of course you may also use these directories in whatever way you see
7899 fit.  For example, you might use them to access modules shared over a
7900 company-wide network.
7901
7902 The default answer should be fine for most people.
7903 This causes further questions about vendor add-ons to be skipped
7904 and no vendor-specific directories will be configured for perl.
7905
7906 EOM
7907 rp='Do you want to configure vendor-specific add-on directories?'
7908 case "$usevendorprefix" in
7909 define|true|[yY]*) dflt=y ;;
7910 *)      : User may have set vendorprefix directly on Configure command line.
7911         case "$vendorprefix" in
7912         ''|' ') dflt=n ;;
7913         *)      dflt=y ;;
7914         esac
7915         ;;
7916 esac
7917 . ./myread
7918 case "$ans" in
7919 [yY]*)  fn=d~+
7920         rp='Installation prefix to use for vendor-supplied add-ons?'
7921         case "$vendorprefix" in
7922         '') dflt="$prefix" ;;
7923         *)  dflt=$vendorprefix ;;
7924         esac
7925         . ./getfile
7926         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7927         oldvendorprefix=''
7928         case "$vendorprefix" in
7929         '') ;;
7930         *)      case "$ans" in
7931                 "$prefix") ;;
7932                 *) oldvendorprefix="$prefix";;
7933                 esac
7934                 ;;
7935         esac
7936         usevendorprefix="$define"
7937         vendorprefix="$ans"
7938         vendorprefixexp="$ansexp"
7939         ;;
7940 *)      usevendorprefix="$undef"
7941         vendorprefix=''
7942         vendorprefixexp=''
7943         ;;
7944 esac
7945
7946 : Set the vendorlib variables
7947 case "$vendorprefix" in
7948 '')     d_vendorlib="$undef"
7949         vendorlib=''
7950         vendorlibexp=''
7951         ;;
7952 *)      d_vendorlib="$define"
7953         : determine where vendor-supplied modules go.
7954         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7955         case "$vendorlib" in
7956         '')
7957                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7958                 case "$installstyle" in
7959                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7960                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7961                 esac
7962                 ;;
7963         *)      dflt="$vendorlib"
7964                 ;;
7965         esac
7966         fn=d~+
7967         rp='Pathname for the vendor-supplied library files?'
7968         . ./getfile
7969         vendorlib="$ans"
7970         vendorlibexp="$ansexp"
7971         ;;
7972 esac
7973 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7974 prefixvar=vendorlib
7975 . ./installprefix
7976
7977 : Set the vendorarch variables
7978 case "$vendorprefix" in
7979 '')     d_vendorarch="$undef"
7980         vendorarch=''
7981         vendorarchexp=''
7982         ;;
7983 *)      d_vendorarch="$define"
7984         : determine where vendor-supplied architecture-dependent libraries go.
7985         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7986         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7987         : vendorlib may have an optional trailing /share.
7988         case "$vendorarch" in
7989         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7990                 dflt="$dflt/$archname"
7991                 ;;
7992         *)      dflt="$vendorarch" ;;
7993         esac
7994         fn=d~+
7995         rp='Pathname for vendor-supplied architecture-dependent files?'
7996         . ./getfile
7997         vendorarch="$ans"
7998         vendorarchexp="$ansexp"
7999         ;;
8000 esac
8001 prefixvar=vendorarch
8002 . ./installprefix
8003 if $test X"$vendorarch" = X"$vendorlib"; then
8004         d_vendorarch="$undef"
8005 else
8006         d_vendorarch="$define"
8007 fi
8008
8009 : Final catch-all directories to search
8010 $cat <<EOM
8011
8012 Lastly, you can have perl look in other directories for extensions and
8013 modules in addition to those already specified.
8014 These directories will be searched after
8015         $sitearch
8016         $sitelib
8017 EOM
8018 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8019 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8020 echo ' '
8021 case "$otherlibdirs" in
8022 ''|' ') dflt='none' ;;
8023 *)      dflt="$otherlibdirs" ;;
8024 esac
8025 $cat <<EOM
8026 Enter a colon-separated set of extra paths to include in perl's @INC
8027 search path, or enter 'none' for no extra paths.
8028
8029 EOM
8030
8031 rp='Colon-separated list of additional directories for perl to search?'
8032 . ./myread
8033 case "$ans" in
8034 ' '|''|none)    otherlibdirs=' ' ;;
8035 *)      otherlibdirs="$ans" ;;
8036 esac
8037 case "$otherlibdirs" in
8038 ' ') val=$undef ;;
8039 *)      val=$define ;;
8040 esac
8041 set d_perl_otherlibdirs
8042 eval $setvar
8043
8044 : Cruising for prototypes
8045 echo " "
8046 echo "Checking out function prototypes..." >&4
8047 $cat >prototype.c <<EOCP
8048 #$i_stdlib I_STDLIB
8049 #ifdef I_STDLIB
8050 #include <stdlib.h>
8051 #endif
8052 int main(int argc, char *argv[]) {
8053         exit(0);}
8054 EOCP
8055 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8056         echo "Your C compiler appears to support function prototypes."
8057         val="$define"
8058 else
8059         echo "Your C compiler doesn't seem to understand function prototypes."
8060         val="$undef"
8061 fi
8062 set prototype
8063 eval $setvar
8064 $rm -f prototype*
8065
8066 : Check if ansi2knr is required
8067 case "$prototype" in
8068 "$define") ;;
8069 *)      ansi2knr='ansi2knr'
8070         echo " "
8071         cat <<EOM >&4
8072
8073 $me:  FATAL ERROR:
8074 This version of $package can only be compiled by a compiler that
8075 understands function prototypes.  Unfortunately, your C compiler
8076         $cc $ccflags
8077 doesn't seem to understand them.  Sorry about that.
8078
8079 If GNU cc is available for your system, perhaps you could try that instead.
8080
8081 Eventually, we hope to support building Perl with pre-ANSI compilers.
8082 If you would like to help in that effort, please contact <perlbug@perl.org>.
8083
8084 Aborting Configure now.
8085 EOM
8086         exit 2
8087         ;;
8088 esac
8089
8090 : DTrace support
8091 dflt_dtrace='/usr/sbin/dtrace'
8092 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8093
8094 cat <<EOM
8095
8096 Perl can be built to support DTrace on platforms that support it.
8097 DTrace is a diagnosis and performance analysis tool from Sun.
8098
8099 If this doesn't make any sense to you, just accept the default.
8100 EOM
8101
8102 while $test 1 ; do
8103         case "$usedtrace" in
8104         $define|true|[yY]*)
8105                 dflt='y'
8106                 ;;
8107         ?*)
8108                 dflt='y'
8109                 dflt_dtrace=$usedtrace
8110                 ;;
8111         *)
8112                 dflt='n'
8113                 ;;
8114         esac
8115
8116         rp='Support DTrace if available?'
8117         . ./myread
8118         case "$ans" in
8119         y|Y)    val="$define" ;;
8120         *)      val="$undef" ;;
8121         esac
8122         set usedtrace
8123         eval $setvar
8124
8125         test "X$usedtrace" != "X$define" && break
8126
8127         echo " "
8128         rp='Where is the dtrace executable?'
8129         dflt=$dflt_dtrace
8130         . ./getfile
8131         val="$ans"
8132         set dtrace
8133         eval $setvar
8134
8135         if $test -f $dtrace
8136         then
8137                 if $dtrace -h -s ../perldtrace.d \
8138                         -o perldtrace.tmp >/dev/null 2>&1 \
8139                         && rm -f perldtrace.tmp
8140                 then
8141                         echo " "
8142                         echo "Good: your $dtrace knows about the -h flag."
8143                 else
8144                         cat >&2 <<EOM
8145
8146 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8147 ***
8148 *** Your installed dtrace doesn't support the -h switch to compile a D
8149 *** program into a C header. Can't continue.
8150
8151 EOM
8152                         exit 1
8153                 fi
8154                 break;
8155         fi
8156
8157         case "$fastread" in
8158         yes)
8159                 cat >&2 <<EOM
8160
8161 *** $me:  Fatal Error:  $dtrace not found.
8162 *** Can't continue.
8163
8164 EOM
8165                 exit 1
8166                 ;;
8167         *)
8168                 echo "*** $dtrace was not found."
8169                 echo " "
8170                 ;;
8171         esac
8172 done
8173
8174 : See if we want extra modules installed
8175 echo " "
8176 case "$extras" in
8177 '') dflt='n';;
8178 *) dflt='y';;
8179 esac
8180 cat <<EOM
8181 Perl can be built with extra modules or bundles of modules which
8182 will be fetched from the CPAN and installed alongside Perl.
8183
8184 Notice that you will need access to the CPAN; either via the Internet,
8185 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8186 be asked later to configure the CPAN.pm module which will in turn do
8187 the installation of the rest of the extra modules or bundles.)
8188
8189 Notice also that if the modules require any external software such as
8190 libraries and headers (the libz library and the zlib.h header for the
8191 Compress::Zlib module, for example) you MUST have any such software
8192 already installed, this configuration process will NOT install such
8193 things for you.
8194
8195 If this doesn't make any sense to you, just accept the default '$dflt'.
8196 EOM
8197 rp='Install any extra modules (y or n)?'
8198 . ./myread
8199 case "$ans" in
8200 y|Y)
8201         cat <<EOM
8202
8203 Please list any extra modules or bundles to be installed from CPAN,
8204 with spaces between the names.  The names can be in any format the
8205 'install' command of CPAN.pm will understand.  (Answer 'none',
8206 without the quotes, to install no extra modules or bundles.)
8207 EOM
8208         rp='Extras?'
8209         dflt="$extras"
8210         . ./myread
8211         extras="$ans"
8212 esac
8213 case "$extras" in
8214 ''|'none')
8215         val=''
8216         $rm -f ../extras.lst
8217         ;;
8218 *)      echo "(Saving the list of extras for later...)"
8219         echo "$extras" > ../extras.lst
8220         val="'$extras'"
8221         ;;
8222 esac
8223 set extras
8224 eval $setvar
8225 echo " "
8226
8227 : determine where html pages for programs go
8228 set html1dir html1dir none
8229 eval $prefixit
8230 $cat <<EOM
8231
8232 If you wish to install html files for programs in $spackage, indicate
8233 the appropriate directory here.  To skip installing html files,
8234 answer "none".
8235 EOM
8236 case "$html1dir" in
8237 ''|none|$undef|' ') dflt=none ;;
8238 *) dflt=$html1dir ;;
8239 esac
8240 fn=dn+~
8241 rp="Directory for the main $spackage html pages?"
8242 . ./getfile
8243 prefixvar=html1dir
8244 . ./setprefixvar
8245 : Use ' ' for none so value is preserved next time through Configure
8246 $test X"$html1dir" = "X" && html1dir=' '
8247
8248 : determine where html pages for libraries and modules go
8249 set html3dir html3dir none
8250 eval $prefixit
8251 $cat <<EOM
8252
8253 If you wish to install html files for modules associated with $spackage,
8254 indicate the appropriate directory here.  To skip installing html files,
8255 answer "none".
8256 EOM
8257 : There is no obvious default.  If they have specified html1dir, then
8258 : try to key off that, possibly changing .../html1 into .../html3.
8259 case "$html3dir" in
8260 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8261 *) dflt=$html3dir ;;
8262 esac
8263 fn=dn+~
8264 rp="Directory for the $spackage module html pages?"
8265 . ./getfile
8266 prefixvar=html3dir
8267 . ./setprefixvar
8268 : Use ' ' for none so value is preserved next time through Configure
8269 $test X"$html3dir" = "X" && html3dir=' '
8270
8271 : determine whether to install perl also as /usr/bin/perl
8272
8273 echo " "
8274 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8275         $cat <<EOM
8276 Many scripts expect perl to be installed as /usr/bin/perl.
8277
8278 If you want to, I can install the perl you are about to compile
8279 as /usr/bin/perl (in addition to $bin/perl).
8280 EOM
8281         if test -f /usr/bin/perl; then
8282             $cat <<EOM
8283
8284 However, please note that because you already have a /usr/bin/perl,
8285 overwriting that with a new Perl would very probably cause problems.
8286 Therefore I'm assuming you don't want to do that (unless you insist).
8287
8288 EOM
8289             case "$installusrbinperl" in
8290             "$define"|[yY]*)    dflt='y';;
8291             *)                  dflt='n';;
8292             esac
8293         else
8294             $cat <<EOM
8295
8296 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8297
8298 EOM
8299             case "$installusrbinperl" in
8300             "$undef"|[nN]*)     dflt='n';;
8301             *)                  dflt='y';;
8302             esac
8303         fi
8304         rp="Do you want to install perl as /usr/bin/perl?"
8305         . ./myread
8306         case "$ans" in
8307         [yY]*)  val="$define";;
8308         *)      val="$undef" ;;
8309         esac
8310 else
8311         val="$undef"
8312 fi
8313 set installusrbinperl
8314 eval $setvar
8315
8316 : see if dlopen exists
8317 xxx_runnm="$runnm"
8318 xxx_ccflags="$ccflags"
8319 runnm=false
8320 : with g++ one needs -shared to get is-in-libc to work for dlopen
8321 case "$gccversion" in
8322 '')     ;;
8323 *Clang*)        ;;
8324 *)      case "$d_cplusplus" in
8325         "$define") ccflags="$ccflags -shared" ;;
8326         esac
8327         ;;
8328 esac
8329 set dlopen d_dlopen
8330 eval $inlibc
8331 runnm="$xxx_runnm"
8332 ccflags="$xxx_ccflags"
8333
8334 : see if this is a unistd.h system
8335 set unistd.h i_unistd
8336 eval $inhdr
8337
8338 : determine which dynamic loading, if any, to compile in
8339 echo " "
8340 dldir="ext/DynaLoader"
8341 case "$usedl" in
8342     $define|y|true)
8343         dflt='y'
8344         usedl="$define"
8345         ;;
8346     $undef|n|false)
8347         dflt='n'
8348         usedl="$undef"
8349         ;;
8350     *)
8351         dflt='n'
8352         case "$d_dlopen" in
8353             $define) dflt='y' ;;
8354         esac
8355         : Does a dl_xxx.xs file exist for this operating system
8356         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8357         ;;
8358 esac
8359 rp="Do you wish to use dynamic loading?"
8360 . ./myread
8361 usedl="$ans"
8362 bin_ELF="$undef"
8363 case "$ans" in
8364     y*) usedl="$define"
8365         case "$dlsrc" in
8366             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8367                     dflt="$dldir/dl_${osname}.xs"
8368                 elif $test "$d_dlopen" = "$define" ; then
8369                     dflt="$dldir/dl_dlopen.xs"
8370                 else
8371                     dflt=''
8372                 fi
8373                 ;;
8374             *)  dflt="$dldir/$dlsrc"
8375                 ;;
8376         esac
8377         echo "The following dynamic loading files are available:"
8378         : Can not go over to $dldir because getfile has path hard-coded in.
8379         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8380         rp="Source file to use for dynamic loading"
8381         fn="fne"
8382         gfpth="$src"
8383         . ./getfile
8384         usedl="$define"
8385         : emulate basename
8386         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8387
8388         $cat << EOM
8389
8390 Some systems may require passing special flags to $cc -c to
8391 compile modules that will be used to create a shared library.
8392 To use no flags, say "none".
8393
8394 EOM
8395         case "$cccdlflags" in
8396             '') case "$gccversion" in
8397                 '') case "$osname" in
8398                         hpux)   dflt='+z' ;;
8399                         irix*)  dflt='-KPIC' ;;
8400                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8401                         sunos)  dflt='-pic' ;;
8402                         *)      dflt='none' ;;
8403                     esac
8404                     ;;
8405                 *)  case "$osname" in
8406                         darwin) dflt='none' ;;
8407                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8408                         *)      dflt='-fpic' ;;
8409                     esac ;;
8410                 esac ;;
8411             ' ') dflt='none' ;;
8412             *)   dflt="$cccdlflags" ;;
8413         esac
8414
8415         case "$dflt" in
8416             none) dflt='' ;;
8417         esac
8418
8419         # If -Dsysroot was specified, now's the time to add it
8420         # to cccdlflags
8421         if test "X$sysroot" != X; then
8422             case "$gccversion" in
8423                 '') ;;
8424                 *)  case "$dflt" in
8425                         *sysroot*) ;;
8426                         'undef'|*)
8427                             dflt="$dflt --sysroot=$sysroot" ;;
8428                     esac
8429                     ;;
8430             esac
8431         fi
8432
8433         case "$dflt" in
8434             '') dflt='none';;
8435         esac
8436
8437         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8438         . ./myread
8439         case "$ans" in
8440             none) cccdlflags=' ' ;;
8441             *)    cccdlflags="$ans" ;;
8442         esac
8443
8444         cat << EOM
8445
8446 Some systems use ld to create libraries that can be dynamically loaded,
8447 while other systems (such as those using ELF) use $cc.
8448
8449 EOM
8450
8451 : Determine if this is ELF
8452         $cat >try.c <<EOM
8453 /* Test for whether ELF binaries are produced */
8454 #include <fcntl.h>
8455 #$i_stdlib I_STDLIB
8456 #ifdef I_STDLIB
8457 #include <stdlib.h>
8458 #endif
8459 #$i_unistd I_UNISTD
8460 #ifdef I_UNISTD
8461 #include <unistd.h>
8462 #endif
8463 int main() {
8464     char b[4];
8465     int i = open("a.out",O_RDONLY);
8466     if(i == -1)
8467         exit(1); /* fail */
8468     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8469         exit(0); /* succeed (yes, it is ELF) */
8470     exit(1); /* fail */
8471 }
8472 EOM
8473         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8474             bin_ELF="$define"
8475         fi
8476         $rm_try
8477
8478         case "$ld" in
8479             '') if $test $bin_ELF = "$define"; then
8480                     cat <<EOM
8481 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8482 EOM
8483                     dflt="$cc"
8484                 else
8485                     echo "I'll use ld to build dynamic libraries."
8486                     dflt='ld'
8487                 fi
8488                 ;;
8489             *)  dflt="$ld"
8490                 ;;
8491         esac
8492
8493         rp="What command should be used to create dynamic libraries?"
8494         . ./myread
8495         ld="$ans"
8496
8497         cat << EOM
8498
8499 Some systems may require passing special flags to $ld to create a
8500 library that can be dynamically loaded.  If your ld flags include
8501 -L/other/path options to locate libraries outside your loader's normal
8502 search path, you may need to specify those -L options here as well.  To
8503 use no flags, say "none".
8504
8505 EOM
8506         case "$lddlflags" in
8507             '') case "$osname" in
8508                     haiku) dflt='-shared' ;;
8509                     hpux) dflt='-b';
8510                           case "$gccversion" in
8511                               '') dflt="$dflt +vnocompatwarnings" ;;
8512                           esac
8513                           ;;
8514                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8515                     solaris) # See [perl #66604].
8516                             # On Solaris 11, gcc -m64 on amd64
8517                             # appears not to understand -G.  gcc versions at
8518                             # least as old as 3.4.3 support -shared, so just
8519                             # use that with Solaris 11 and later, but keep
8520                             # the old behavior for older Solaris versions.
8521                             case "$gccversion" in
8522                                 '') dflt='-G' ;;
8523                                 *)  case "$osvers" in
8524                                         2.?|2.10) dflt='-G' ;;
8525                                         *) dflt='-shared' ;;
8526                                     esac
8527                                     ;;
8528                             esac
8529                             ;;
8530                     sunos) dflt='-assert nodefinitions' ;;
8531                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8532                     *)     dflt='none' ;;
8533                 esac
8534                 ;;
8535             *) dflt="$lddlflags" ;;
8536         esac
8537
8538         : Only do this for gcc, since, for example, qcc has no concept
8539         : of --sysroot.
8540         if $test "X$sysroot" != X; then
8541             case "$gccversion" in
8542                 '') ;;
8543                 *)  dflt="$dflt --sysroot $sysroot" ;;
8544             esac
8545         fi
8546
8547         : Try to guess additional flags to pick up local libraries.
8548         : Be careful not to append to a plain 'none'
8549         case "$dflt" in
8550             none) dflt='' ;;
8551         esac
8552         for thisflag in $ldflags; do
8553             case "$thisflag" in
8554                 -L*|-R*|-Wl,-R*)
8555                     case " $dflt " in
8556                         *" $thisflag "*) ;;
8557                         *) dflt="$dflt $thisflag" ;;
8558                     esac
8559                     ;;
8560             esac
8561         done
8562
8563         case "$dflt" in
8564             ''|' ') dflt='none' ;;
8565         esac
8566
8567         case "$ldflags" in
8568             *-fstack-protector-strong*)
8569                 case "$dflt" in
8570                     *-fstack-protector-strong*) ;; # Don't add it again
8571                     *) dflt="$dflt -fstack-protector-strong" ;;
8572                 esac
8573                 ;;
8574             *-fstack-protector*)
8575                 case "$dflt" in
8576                     *-fstack-protector*) ;; # Don't add it again
8577                     *) dflt="$dflt -fstack-protector" ;;
8578                 esac
8579                 ;;
8580         esac
8581
8582         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8583         . ./myread
8584         case "$ans" in
8585             none) lddlflags=' ' ;;
8586             *) lddlflags="$ans" ;;
8587         esac
8588
8589         cat <<EOM
8590
8591 Some systems may require passing special flags to $cc to indicate that
8592 the resulting executable will use dynamic linking.  To use no flags,
8593 say "none".
8594
8595 EOM
8596         case "$ccdlflags" in
8597             '') case "$osname" in
8598                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8599                     sunos)             dflt='none'   ;;
8600                     *)                 dflt='none'   ;;
8601                 esac ;;
8602             ' ') dflt='none' ;;
8603             *)   dflt="$ccdlflags" ;;
8604         esac
8605         rp="Any special flags to pass to $cc to use dynamic linking?"
8606         . ./myread
8607         case "$ans" in
8608             none) ccdlflags=' ' ;;
8609             *)    ccdlflags="$ans" ;;
8610         esac
8611         ;;
8612
8613     *)  usedl="$undef"
8614         ld='ld'
8615         dlsrc='dl_none.xs'
8616         lddlflags=''
8617         ccdlflags=''
8618         ;;
8619 esac
8620
8621 ld_can_script="$undef"
8622 case "$bin_ELF$usedl" in
8623     $define$define)
8624         # Abuse try.h and a.out names for neat cleanup
8625         $cat >try.c <<EOM
8626 void foo() {}
8627 void bar() {}
8628 EOM
8629         $cat >try.h <<EOM
8630 LIBTEST_42 {
8631  global:
8632   foo;
8633  local: *;
8634  };
8635 EOM
8636         if $cc $cccdlflags $ccdlflags $ccflags \
8637                $ldflags $lddlflags -o a.out try.c \
8638                -Wl,--version-script=try.h >/dev/null 2>&1 \
8639            &&  $test -s a.out ; then
8640             echo "ld supports scripting" >&4
8641             ld_can_script="$define"
8642         else
8643             echo "ld does not support scripting" >&4
8644         fi
8645         $rm_try
8646         ;;
8647 esac
8648
8649 : Do we want a shared libperl?
8650 also=''
8651 case "$usedl" in
8652 $undef)
8653         # No dynamic loading being used, so don't bother even to prompt.
8654         useshrplib='false'
8655         ;;
8656 *)      case "$useshrplib" in
8657         '')     case "$osname" in
8658                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8659                         dflt=y
8660                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8661                         ;;
8662                 *)      dflt=n
8663                         ;;
8664                 esac
8665                 ;;
8666         $define|true|[Yy]*)
8667                 dflt=y
8668                 ;;
8669         *)      dflt=n
8670                 ;;
8671         esac
8672         $cat << EOM
8673
8674 The perl executable is normally obtained by linking perlmain.c with
8675 libperl${_a}, any static extensions (usually just DynaLoader), and
8676 any other libraries needed on this system (such as -lm, etc.).  Since
8677 your system supports dynamic loading, it is probably possible to build
8678 a shared libperl.$so.  If you will have more than one executable linked
8679 to libperl.$so, this will significantly reduce the size of each
8680 executable, but it may have a noticeable effect on performance.  The
8681 default is probably sensible for your system.
8682 $also
8683
8684 EOM
8685         rp="Build a shared libperl.$so (y/n)"
8686         . ./myread
8687         case "$ans" in
8688         true|$define|[Yy]*)
8689                 useshrplib='true'  ;;
8690         *)      useshrplib='false' ;;
8691         esac
8692         ;;
8693 esac
8694
8695 case "$useshrplib" in
8696 true)
8697         case "$userelocatableinc" in
8698         true|define)
8699                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8700                 echo "See INSTALL for an explanation why that won't work." >&4
8701                 exit 4
8702                 ;;
8703         esac
8704         case "$libperl" in
8705         '')
8706                 # Figure out a good name for libperl.so.  Since it gets stored in
8707                 # a version-specific architecture-dependent library, the version
8708                 # number isn't really that important, except for making cc/ld happy.
8709                 #
8710                 # A name such as libperl.so.10.1
8711                 majmin="libperl.$so.$patchlevel.$subversion"
8712                 # A name such as libperl.so.100
8713                 majonly=`echo $patchlevel $subversion |
8714                         $awk '{printf "%d%02d", $1, $2}'`
8715                 majonly=libperl.$so.$majonly
8716                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8717                 # rely on figuring it out from the naming of libc.
8718                 case "${osname}${osvers}" in
8719                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8720                         dflt=libperl.$so
8721                         ;;
8722                 cygwin*) # ld links now against the dll directly
8723                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8724                         majonly=`echo $patchlevel $subversion |
8725                                 $awk '{printf "%03d%03d", $1, $2}'`
8726                         majonly=cygperl5.$majonly.$so
8727                         dflt=$majmin
8728                         ;;
8729                 *)      # Try to guess based on whether libc has major.minor.
8730                         case "$libc" in
8731                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8732                         *libc.$so.[0-9]*) dflt=$majonly ;;
8733                         *)      dflt=libperl.$so ;;
8734                         esac
8735                         ;;
8736                 esac
8737                 ;;
8738         *)      dflt=$libperl
8739                 ;;
8740         esac
8741         cat << EOM
8742
8743 I need to select a good name for the shared libperl.  If your system uses
8744 library names with major and minor numbers, then you might want something
8745 like $majmin.  Alternatively, if your system uses a single version
8746 number for shared libraries, then you might want to use $majonly.
8747 Or, your system might be quite happy with a simple libperl.$so.
8748
8749 Since the shared libperl will get installed into a version-specific
8750 architecture-dependent directory, the version number of the shared perl
8751 library probably isn't important, so the default should be o.k.
8752
8753 EOM
8754         rp='What name do you want to give to the shared libperl?'
8755         . ./myread
8756         libperl=$ans
8757         echo "Ok, I'll use $libperl"
8758         ;;
8759 *)
8760         libperl="libperl${_a}"
8761         ;;
8762 esac
8763
8764 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8765 case "$shrpdir" in
8766 '') ;;
8767 *)      $cat >&4 <<EOM
8768 WARNING:  Use of the shrpdir variable for the installation location of
8769 the shared $libperl is not supported.  It was never documented and
8770 will not work in this version.  Let me (perlbug@perl.org)
8771 know of any problems this may cause.
8772
8773 EOM
8774         case "$shrpdir" in
8775         "$archlibexp/CORE")
8776                 $cat >&4 <<EOM
8777 But your current setting of $shrpdir is
8778 the default anyway, so it's harmless.
8779 EOM
8780                 ;;
8781         *)
8782                 $cat >&4 <<EOM
8783 Further, your current attempted setting of $shrpdir
8784 conflicts with the value of $archlibexp/CORE
8785 that installperl will use.
8786 EOM
8787                 ;;
8788         esac
8789         ;;
8790 esac
8791
8792 # How will the perl executable find the installed shared $libperl?
8793 # Add $xxx to ccdlflags.
8794 # If we can't figure out a command-line option, use $shrpenv to
8795 # set env LD_RUN_PATH.  The main perl makefile uses this.
8796 shrpdir=$archlibexp/CORE
8797 xxx=''
8798 tmp_shrpenv=''
8799 if "$useshrplib"; then
8800     case "$osname" in
8801         aix)
8802                 # We'll set it in Makefile.SH...
8803                 ;;
8804         solaris)
8805                 xxx="-R $shrpdir"
8806                 ;;
8807         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8808                 xxx="-Wl,-R$shrpdir"
8809                 ;;
8810         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8811                 xxx="-Wl,-rpath,$shrpdir"
8812                 ;;
8813         hpux*)
8814                 # hpux doesn't like the default, either.
8815                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8816                 ;;
8817         cygwin)
8818                 # cygwin needs only ldlibpth
8819                 ;;
8820         *)
8821                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8822                 ;;
8823         esac
8824         case "$xxx" in
8825         '') ;;
8826         *)
8827                 # Only add $xxx if it isn't already in ccdlflags.
8828                 case " $ccdlflags " in
8829                 *" $xxx "*)     ;;
8830                 *)      ccdlflags="$ccdlflags $xxx"
8831                         cat <<EOM >&4
8832
8833 Adding $xxx to the flags
8834 passed to $ld so that the perl executable will find the
8835 installed shared $libperl.
8836
8837 EOM
8838                         ;;
8839                 esac
8840                 ;;
8841         esac
8842 fi
8843 # Fix ccdlflags in AIX for building external extensions.
8844 # (For building Perl itself bare -bE:perl.exp is needed,
8845 #  Makefile.SH takes care of this.)
8846 case "$osname" in
8847 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8848 esac
8849 # Respect a hint or command-line value.
8850 case "$shrpenv" in
8851 '') shrpenv="$tmp_shrpenv" ;;
8852 esac
8853 case "$ldlibpthname" in
8854 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8855 none)   ldlibpthname='' ;;
8856 esac
8857
8858 : determine where manual pages are on this system
8859 echo " "
8860 case "$sysman" in
8861 '')
8862         syspath='/usr/share/man/man1 /usr/man/man1'
8863         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8864         syspath="$syspath /usr/man/u_man/man1"
8865         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8866         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8867         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8868         sysman=`./loc . /usr/man/man1 $syspath`
8869         ;;
8870 esac
8871 if $test -d "$sysman"; then
8872         echo "System manual is in $sysman." >&4
8873 else
8874         echo "Could not find manual pages in source form." >&4
8875 fi
8876
8877 : determine where manual pages go
8878 set man1dir man1dir none
8879 eval $prefixit
8880 $cat <<EOM
8881
8882 $spackage has manual pages available in source form.
8883 EOM
8884 case "$nroff" in
8885 nroff)
8886         echo "However, you don't have nroff, so they're probably useless to you."
8887         case "$man1dir" in
8888         '') man1dir="none";;
8889         esac;;
8890 esac
8891 echo "If you don't want the manual sources installed, answer 'none'."
8892 case "$man1dir" in
8893 ' ') dflt=none
8894         ;;
8895 '')
8896         lookpath="$prefixexp/share/man/man1"
8897         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8898         lookpath="$lookpath $prefixexp/man/p_man/man1"
8899         lookpath="$lookpath $prefixexp/man/u_man/man1"
8900         lookpath="$lookpath $prefixexp/man/man.1"
8901         case "$sysman" in
8902         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8903         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8904         esac
8905         set dflt
8906         eval $prefixup
8907         ;;
8908 *)  dflt="$man1dir"
8909         ;;
8910 esac
8911 echo " "
8912 fn=dn+~
8913 rp="Where do the main $spackage manual pages (source) go?"
8914 . ./getfile
8915 if $test "X$man1direxp" != "X$ansexp"; then
8916         installman1dir=''
8917 fi
8918 prefixvar=man1dir
8919 . ./setprefixvar
8920
8921 case "$man1dir" in
8922 '')     man1dir=' '
8923         installman1dir='';;
8924 esac
8925
8926 : What suffix to use on installed man pages
8927
8928 case "$man1dir" in
8929 ' ')
8930         man1ext='0'
8931         ;;
8932 *)
8933         rp="What suffix should be used for the main $spackage man pages?"
8934         case "$man1ext" in
8935         '')     case "$man1dir" in
8936                 *1)  dflt=1 ;;
8937                 *1p) dflt=1p ;;
8938                 *1pm) dflt=1pm ;;
8939                 *l) dflt=l;;
8940                 *n) dflt=n;;
8941                 *o) dflt=o;;
8942                 *p) dflt=p;;
8943                 *C) dflt=C;;
8944                 *L) dflt=L;;
8945                 *L1) dflt=L1;;
8946                 *) dflt=1;;
8947                 esac
8948                 ;;
8949         *)      dflt="$man1ext";;
8950         esac
8951         . ./myread
8952         man1ext="$ans"
8953         ;;
8954 esac
8955
8956 : see if we can have long filenames
8957 echo " "
8958 first=123456789abcdef
8959 $rm -f $first
8960 if (echo hi >$first) 2>/dev/null; then
8961         if $test -f 123456789abcde; then
8962                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8963                 val="$undef"
8964         else
8965                 echo 'You can have filenames longer than 14 characters.'>&4
8966                 val="$define"
8967         fi
8968 else
8969         $cat <<'EOM'
8970 You can't have filenames longer than 14 chars.
8971 You can't even think about them!
8972 EOM
8973         val="$undef"
8974 fi
8975 set d_flexfnam
8976 eval $setvar
8977 $rm -rf 123456789abcde*
8978
8979 : determine where library module manual pages go
8980 set man3dir man3dir none
8981 eval $prefixit
8982 $cat <<EOM
8983
8984 $spackage has manual pages for many of the library modules.
8985 EOM
8986
8987 case "$nroff" in
8988 nroff)
8989         $cat <<'EOM'
8990 However, you don't have nroff, so they're probably useless to you.
8991 EOM
8992         case "$man3dir" in
8993         '') man3dir="none";;
8994         esac;;
8995 esac
8996
8997 case "$d_flexfnam" in
8998 undef)
8999         $cat <<'EOM'
9000 However, your system can't handle the long file names like File::Basename.3.
9001 EOM
9002         case "$man3dir" in
9003         '') man3dir="none";;
9004         esac;;
9005 esac
9006
9007 echo "If you don't want the manual sources installed, answer 'none'."
9008 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9009 case "$man3dir" in
9010 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9011         if $test -d "$privlib/man/man3"; then
9012                 cat <<EOM >&4
9013
9014 WARNING:  Previous versions of perl installed man3 pages into
9015 $privlib/man/man3.  This version will suggest a
9016 new default of $dflt.
9017 EOM
9018                 tdflt=$dflt
9019                 dflt='n'
9020                 rp='Do you wish to preserve the old behavior?(y/n)'
9021                 . ./myread
9022                 case "$ans" in
9023                 y*) dflt="$privlib/man/man3" ;;
9024                 *)  dflt=$tdflt ;;
9025                 esac
9026     fi
9027         ;;
9028 *)      dflt="$man3dir" ;;
9029 esac
9030 case "$dflt" in
9031 ' ') dflt=none ;;
9032 esac
9033 echo " "
9034 fn=dn+~
9035 rp="Where do the $package library man pages (source) go?"
9036 . ./getfile
9037 prefixvar=man3dir
9038 . ./setprefixvar
9039
9040 case "$man3dir" in
9041 '')     man3dir=' '
9042         installman3dir='';;
9043 esac
9044
9045 : What suffix to use on installed man pages
9046 case "$man3dir" in
9047 ' ')
9048         man3ext='0'
9049         ;;
9050 *)
9051         rp="What suffix should be used for the $package library man pages?"
9052         case "$man3ext" in
9053         '')     case "$man3dir" in
9054                 *3)  dflt=3 ;;
9055                 *3p) dflt=3p ;;
9056                 *3pm) dflt=3pm ;;
9057                 *l) dflt=l;;
9058                 *n) dflt=n;;
9059                 *o) dflt=o;;
9060                 *p) dflt=p;;
9061                 *C) dflt=C;;
9062                 *L) dflt=L;;
9063                 *L3) dflt=L3;;
9064                 *) dflt=3;;
9065                 esac
9066                 ;;
9067         *)      dflt="$man3ext";;
9068         esac
9069         . ./myread
9070         man3ext="$ans"
9071         ;;
9072 esac
9073
9074 : see if we have to deal with yellow pages, now NIS.
9075 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9076         case "$hostcat" in
9077         nidump*) ;;
9078         *)
9079                 case "$hostcat" in
9080                 *ypcat*) dflt=y;;
9081                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9082                                 dflt=y
9083                         else
9084                                 dflt=n
9085                         fi;;
9086                 *) dflt=n;;
9087                 esac
9088                 echo " "
9089                 rp='Are you getting the hosts file via yellow pages?'
9090                 . ./myread
9091                 case "$ans" in
9092                 y*) hostcat='ypcat hosts';;
9093                 *) hostcat='cat /etc/hosts';;
9094                 esac
9095                 ;;
9096         esac
9097 fi
9098 case "$hostcat" in
9099 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9100 esac
9101 case "$groupcat" in
9102 '') test -f /etc/group && groupcat='cat /etc/group';;
9103 esac
9104 case "$passcat" in
9105 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9106 esac
9107
9108 : now get the host name
9109 echo " "
9110 echo "Figuring out host name..." >&4
9111 case "$myhostname" in
9112 '') cont=true
9113         echo 'Maybe "hostname" will work...'
9114         if tans=`sh -c hostname 2>&1` ; then
9115                 myhostname=$tans
9116                 phostname=hostname
9117                 cont=''
9118         fi
9119         ;;
9120 *) cont='';;
9121 esac
9122 if $test "$cont"; then
9123         if ./xenix; then
9124                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9125                 if tans=`cat /etc/systemid 2>&1` ; then
9126                         myhostname=$tans
9127                         phostname='cat /etc/systemid'
9128                         echo "Whadyaknow.  Xenix always was a bit strange..."
9129                         cont=''
9130                 fi
9131         elif $test -r /etc/systemid; then
9132                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9133         fi
9134 fi
9135 if $test "$cont"; then
9136         echo 'No, maybe "uuname -l" will work...'
9137         if tans=`sh -c 'uuname -l' 2>&1` ; then
9138                 myhostname=$tans
9139                 phostname='uuname -l'
9140         else
9141                 echo 'Strange.  Maybe "uname -n" will work...'
9142                 if tans=`sh -c 'uname -n' 2>&1` ; then
9143                         myhostname=$tans
9144                         phostname='uname -n'
9145                 else
9146                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9147                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9148                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9149                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9150                         else
9151                                 case "$myhostname" in
9152                                 '') echo "Does this machine have an identity crisis or something?"
9153                                         phostname='';;
9154                                 *)
9155                                         echo "Well, you said $myhostname before..."
9156                                         phostname='echo $myhostname';;
9157                                 esac
9158                         fi
9159                 fi
9160         fi
9161 fi
9162 case "$myhostname" in
9163 '') myhostname=noname ;;
9164 esac
9165 : you do not want to know about this
9166 set $myhostname
9167 myhostname=$1
9168
9169 : verify guess
9170 if $test "$myhostname" ; then
9171         dflt=y
9172         rp='Your host name appears to be "'$myhostname'".'" Right?"
9173         . ./myread
9174         case "$ans" in
9175         y*) ;;
9176         *) myhostname='';;
9177         esac
9178 fi
9179
9180 : bad guess or no guess
9181 while $test "X$myhostname" = X ; do
9182         dflt=''
9183         rp="Please type the (one word) name of your host:"
9184         . ./myread
9185         myhostname="$ans"
9186 done
9187
9188 : translate upper to lower if necessary
9189 case "$myhostname" in
9190 *[A-Z]*)
9191         echo "(Normalizing case in your host name)"
9192         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9193         ;;
9194 esac
9195
9196 case "$myhostname" in
9197 *.*)
9198         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9199         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9200         echo "(Trimming domain name from host name--host name is now $myhostname)"
9201         ;;
9202 *) case "$mydomain" in
9203         '')
9204                 {
9205                         test "X$hostcat" = "Xypcat hosts" &&
9206                         ypmatch "$myhostname" hosts 2>/dev/null |\
9207                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9208                         $test -s hosts
9209                 } || {
9210                         test "X$hostcat" != "X" &&
9211                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9212                                         /[       ]$myhostname[  . ]/p" > hosts
9213                 }
9214                 tmp_re="[       . ]"
9215                 if $test -f hosts; then
9216                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9217                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9218                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9219                                 hosts | $sort | $uniq | \
9220                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9221                         case `$echo X$dflt` in
9222                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9223                                 dflt=.
9224                                 ;;
9225                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9226                                 ;;
9227                         esac
9228                 else
9229                         echo "(I cannot locate a hosts database anywhere)"
9230                         dflt=.
9231                 fi
9232                 case "$dflt" in
9233                 .)
9234                         tans=`./loc resolv.conf X /etc /usr/etc`
9235                         if $test -f "$tans"; then
9236                                 echo "(Attempting domain name extraction from $tans)"
9237                                 dflt=.`$sed -n -e 's/   / /g' \
9238                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9239                                   -e 1q 2>/dev/null`
9240                                 case "$dflt" in
9241                                 .) dflt=.`$sed -n -e 's/        / /g' \
9242                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9243                                      -e 1q 2>/dev/null`
9244                                         ;;
9245                                 esac
9246                         fi
9247                         ;;
9248                 esac
9249                 case "$dflt" in
9250                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9251                         dflt=.`sh -c domainname 2>/dev/null`
9252                         case "$dflt" in
9253                         '') dflt='.';;
9254                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9255                         esac
9256                         ;;
9257                 esac
9258                 case "$dflt$osname" in
9259                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9260                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9261                         ;;
9262                 esac
9263                 case "$dflt" in
9264                 .) echo "(Lost all hope -- silly guess then)"
9265                         dflt='.nonet'
9266                         ;;
9267                 esac
9268                 $rm -f hosts
9269                 ;;
9270         *) dflt="$mydomain";;
9271         esac;;
9272 esac
9273 echo " "
9274 rp="What is your domain name?"
9275 . ./myread
9276 tans="$ans"
9277 case "$ans" in
9278 '') ;;
9279 .*) ;;
9280 *) tans=".$tans";;
9281 esac
9282 mydomain="$tans"
9283
9284 : translate upper to lower if necessary
9285 case "$mydomain" in
9286 *[A-Z]*)
9287         echo "(Normalizing case in your domain name)"
9288         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9289         ;;
9290 esac
9291
9292 : a little sanity check here
9293 case "$phostname" in
9294 '') ;;
9295 *)
9296         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9297         $myhostname$mydomain|$myhostname) ;;
9298         *)
9299                 case "$phostname" in
9300                 sed*)
9301                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9302                         ;;
9303                 *)
9304                         echo "(That doesn't agree with your $phostname command, by the way.)"
9305                         ;;
9306                 esac
9307         ;;
9308         esac
9309         ;;
9310 esac
9311
9312 : determine the e-mail address of the user who is running us
9313 $cat <<EOM
9314
9315 I need to get your e-mail address in Internet format if possible, i.e.
9316 something like user@host.domain. Please answer accurately since I have
9317 no easy means to double check it. The default value provided below
9318 is most probably close to reality but may not be valid from outside
9319 your organization...
9320
9321 EOM
9322 cont=x
9323 while test "$cont"; do
9324         case "$MAILDOMAIN" in
9325         '')
9326                 if $test -s /etc/mailname; then
9327                         maildomain=`$cat /etc/mailname`
9328                 else
9329                         maildomain="$myhostname$mydomain"
9330                 fi
9331                 ;;
9332         *)  maildomain="$MAILDOMAIN";;
9333         esac
9334         case "$cf_email" in
9335         '') dflt="$cf_by@$maildomain";;
9336         *)  dflt="$cf_email";;
9337         esac
9338         rp='What is your e-mail address?'
9339         . ./myread
9340         cf_email="$ans"
9341         case "$cf_email" in
9342         *@*.*) cont='' ;;
9343         *)
9344                 rp='Address does not look like an Internet one.  Use it anyway?'
9345                 case "$fastread" in
9346                 yes) dflt=y ;;
9347                 *) dflt=n ;;
9348                 esac
9349                 . ./myread
9350                 case "$ans" in
9351                 y*) cont='' ;;
9352                 *) echo " " ;;
9353                 esac
9354                 ;;
9355         esac
9356 done
9357
9358 : Ask e-mail of administrator
9359 $cat <<EOM
9360
9361 If you or somebody else will be maintaining perl at your site, please
9362 fill in the correct e-mail address here so that they may be contacted
9363 if necessary. Currently, the "perlbug" program included with perl
9364 will send mail to this address in addition to perlbug@perl.org. You may
9365 enter "none" for no administrator.
9366
9367 EOM
9368 case "$perladmin" in
9369 '') dflt="$cf_email";;
9370 *) dflt="$perladmin";;
9371 esac
9372 rp='Perl administrator e-mail address'
9373 . ./myread
9374 perladmin="$ans"
9375
9376 : determine whether to only install version-specific parts.
9377 echo " "
9378 $cat <<EOM
9379 Do you want to install only the version-specific parts of the perl
9380 distribution?  Usually you do *not* want to do this.
9381 EOM
9382 case "$versiononly" in
9383 "$define"|[Yy]*|true) dflt='y' ;;
9384 *) dflt='n';
9385 esac
9386 rp="Do you want to install only the version-specific parts of perl?"
9387 . ./myread
9388 case "$ans" in
9389 [yY]*)  val="$define";;
9390 *)      val="$undef" ;;
9391 esac
9392 set versiononly
9393 eval $setvar
9394
9395 case "$versiononly" in
9396 "$define") inc_version_list=''
9397            inc_version_list_init=0
9398            ;;
9399 esac
9400
9401 : figure out how to guarantee perl startup
9402 : XXX Note that this currently takes advantage of the bug that binexp ignores
9403 :     the Configure -Dinstallprefix setting, which in turn means that under
9404 :     relocatable @INC, initialinstalllocation is what binexp started as.
9405 case "$startperl" in
9406 '')
9407         case "$sharpbang" in
9408         *!)
9409                 $cat <<EOH
9410
9411 I can use the #! construct to start perl on your system. This will
9412 make startup of perl scripts faster, but may cause problems if you
9413 want to share those scripts and perl is not in a standard place
9414 ($initialinstalllocation/perl) on all your platforms. The alternative
9415 is to force a shell by starting the script with a single ':' character.
9416
9417 EOH
9418                 case "$versiononly" in
9419                 "$define")      dflt="$initialinstalllocation/perl$version";;
9420                 *)              dflt="$initialinstalllocation/perl";;
9421                 esac
9422                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9423                 . ./myread
9424                 case "$ans" in
9425                 none)   startperl=": # use perl";;
9426                 *)      startperl="#!$ans"
9427                         if $test 30 -lt `echo "$ans" | wc -c`; then
9428                                 $cat >&4 <<EOM
9429
9430 WARNING:  Some systems limit the #! command to 32 characters.
9431 If you experience difficulty running Perl scripts with #!, try
9432 installing Perl in a directory with a shorter pathname.
9433
9434 EOM
9435                         fi ;;
9436                 esac
9437                 ;;
9438         *) startperl=": # use perl"
9439                 ;;
9440         esac
9441         ;;
9442 esac
9443 echo "I'll use $startperl to start perl scripts."
9444
9445 : figure best path for perl in scripts
9446 case "$perlpath" in
9447 '')
9448         case "$versiononly" in
9449         "$define")      perlpath="$initialinstalllocation/perl$version";;
9450         *)              perlpath="$initialinstalllocation/perl";;
9451         esac
9452         case "$startperl" in
9453         *!*) ;;
9454         *)
9455                 $cat <<EOH
9456
9457 I will use the "eval 'exec'" idiom to start Perl on your system.
9458 I can use the full path of your Perl binary for this purpose, but
9459 doing so may cause problems if you want to share those scripts and
9460 Perl is not always in a standard place ($initialinstalllocation/perl).
9461
9462 EOH
9463                 dflt="$initialinstalllocation/perl"
9464                 rp="What path shall I use in \"eval 'exec'\"?"
9465                 . ./myread
9466                 perlpath="$ans"
9467                 ;;
9468         esac
9469         ;;
9470 esac
9471 case "$startperl" in
9472 *!*)    ;;
9473 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9474 esac
9475
9476 : determine where public executable scripts go
9477 set scriptdir scriptdir
9478 eval $prefixit
9479 case "$scriptdir" in
9480 '')
9481         dflt="$bin"
9482         : guess some guesses
9483         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9484         $test -d /usr/share/bin     && dflt=/usr/share/bin
9485         $test -d /usr/local/script  && dflt=/usr/local/script
9486         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9487         $test -d $prefixexp/script  && dflt=$prefixexp/script
9488         set dflt
9489         eval $prefixup
9490         ;;
9491 *)  dflt="$scriptdir"
9492         ;;
9493 esac
9494 $cat <<EOM
9495
9496 Some installations have a separate directory just for executable scripts so
9497 that they can mount it across multiple architectures but keep the scripts in
9498 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9499 Or you might just lump your scripts in with all your other executables.
9500
9501 EOM
9502 fn=d~
9503 rp='Where do you keep publicly executable scripts?'
9504 . ./getfile
9505 if $test "X$ansexp" != "X$scriptdirexp"; then
9506         installscript=''
9507 fi
9508 installscriptdir=''
9509 prefixvar=scriptdir
9510 . ./setprefixvar
9511 : A little fix up for an irregularly named variable.
9512 installscript="$installscriptdir"
9513
9514 : determine where add-on public executables go
9515 case "$sitebin" in
9516 '')     dflt=$siteprefix/bin ;;
9517 *)      dflt=$sitebin ;;
9518 esac
9519 fn=d~
9520 rp='Pathname where the add-on public executables should be installed?'
9521 . ./getfile
9522 prefixvar=sitebin
9523 . ./setprefixvar
9524
9525 : determine where add-on html pages go
9526 : There is no standard location, so try to copy the previously-selected
9527 : directory structure for the core html pages.
9528 case "$sitehtml1dir" in
9529 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9530 *)     dflt=$sitehtml1dir ;;
9531 esac
9532 case "$dflt" in
9533 ''|' ') dflt=none ;;
9534 esac
9535 fn=dn+~
9536 rp='Pathname where the site-specific html pages should be installed?'
9537 . ./getfile
9538 prefixvar=sitehtml1dir
9539 . ./setprefixvar
9540
9541 : determine where add-on library html pages go
9542 : There is no standard location, so try to copy the previously-selected
9543 : directory structure for the core html pages.
9544 case "$sitehtml3dir" in
9545 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9546 *)     dflt=$sitehtml3dir ;;
9547 esac
9548 case "$dflt" in
9549 ''|' ') dflt=none ;;
9550 esac
9551 fn=dn+~
9552 rp='Pathname where the site-specific library html pages should be installed?'
9553 . ./getfile
9554 prefixvar=sitehtml3dir
9555 . ./setprefixvar
9556
9557 : determine where add-on manual pages go
9558 case "$siteman1dir" in
9559 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9560 *)      dflt=$siteman1dir ;;
9561 esac
9562 case "$dflt" in
9563 ''|' ') dflt=none ;;
9564 esac
9565 fn=dn+~
9566 rp='Pathname where the site-specific manual pages should be installed?'
9567 . ./getfile
9568 prefixvar=siteman1dir
9569 . ./setprefixvar
9570
9571 : determine where add-on library man pages go
9572 case "$siteman3dir" in
9573 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9574 *)      dflt=$siteman3dir ;;
9575 esac
9576 case "$dflt" in
9577 ''|' ') dflt=none ;;
9578 esac
9579 fn=dn+~
9580 rp='Pathname where the site-specific library manual pages should be installed?'
9581 . ./getfile
9582 prefixvar=siteman3dir
9583 . ./setprefixvar
9584
9585 : determine where add-on public executable scripts go
9586 case "$sitescript" in
9587 '')     dflt=$siteprefix/script
9588         $test -d $dflt || dflt=$sitebin ;;
9589 *)  dflt="$sitescript" ;;
9590 esac
9591 fn=d~+
9592 rp='Pathname where add-on public executable scripts should be installed?'
9593 . ./getfile
9594 prefixvar=sitescript
9595 . ./setprefixvar
9596
9597 : see if backtrace exists
9598 set backtrace d_backtrace
9599 eval $inlibc
9600
9601 : add flags if using c backtrace
9602 case "$usecbacktrace" in
9603   "") usecbacktrace=$undef ;;
9604   [yY]*|true|$define)
9605     case "$d_backtrace" in
9606       [yY]*|true|$define)
9607         case " $ccflags " in
9608           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9609           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9610           esac
9611         ;;
9612       *)
9613         echo "This system does not support backtrace" >&4
9614         usecbacktrace=$undef
9615         ;;
9616       esac
9617     ;;
9618   esac
9619
9620 : Check if faststdio is requested and available
9621 case "$usefaststdio" in
9622 $define|true|[yY]*|'')
9623         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9624         case "$xversion" in
9625         [68])   dflt='y' ;;
9626         *)      dflt='n' ;;
9627         esac
9628         ;;
9629 *) dflt='n';;
9630 esac
9631 cat <<EOM
9632
9633 Perl can be built to use 'fast stdio', which means using the stdio
9634 library but also directly manipulating the stdio buffers to enable
9635 faster I/O.  Using stdio is better for backward compatibility (especially
9636 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9637 interface has been preferred instead of stdio.
9638
9639 If this doesn't make any sense to you, just accept the default '$dflt'.
9640 EOM
9641 rp='Use the "fast stdio" if available?'
9642 . ./myread
9643 case "$ans" in
9644 y|Y)    val="$define" ;;
9645 *)      val="$undef" ;;
9646 esac
9647 set usefaststdio
9648 eval $setvar
9649
9650
9651 : define an is-a-typedef? function
9652 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9653 case "$inclist" in
9654 "") inclist="sys/types.h";;
9655 esac;
9656 eval "varval=\$$var";
9657 case "$varval" in
9658 "")
9659         $rm -f temp.c;
9660         for inc in $inclist; do
9661                 echo "#include <$inc>" >>temp.c;
9662         done;
9663         echo "#ifdef $type" >> temp.c;
9664         echo "printf(\"We have $type\");" >> temp.c;
9665         echo "#endif" >> temp.c;
9666         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9667         if $contains $type temp.E >/dev/null 2>&1; then
9668                 eval "$var=\$type";
9669         else
9670                 eval "$var=\$def";
9671         fi;
9672         $rm -f temp.?;;
9673 *) eval "$var=\$varval";;
9674 esac'
9675
9676 : define an is-a-typedef? function that prompts if the type is not available.
9677 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9678 case "$inclist" in
9679 "") inclist="sys/types.h";;
9680 esac;
9681 eval "varval=\$$var";
9682 case "$varval" in
9683 "")
9684         $rm -f temp.c;
9685         for inc in $inclist; do
9686                 echo "#include <$inc>" >>temp.c;
9687         done;
9688         echo "#ifdef $type" >> temp.c;
9689         echo "printf(\"We have $type\");" >> temp.c;
9690         echo "#endif" >> temp.c;
9691         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9692         echo " " ;
9693         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9694         if $contains $type temp.E >/dev/null 2>&1; then
9695                 echo "$type found." >&4;
9696                 eval "$var=\$type";
9697         else
9698                 echo "$type NOT found." >&4;
9699                 dflt="$def";
9700                 . ./myread ;
9701                 eval "$var=\$ans";
9702         fi;
9703         $rm -f temp.?;;
9704 *) eval "$var=\$varval";;
9705 esac'
9706
9707 : see what type lseek is declared as in the kernel
9708 rp="What is the type used for lseek's offset on this system?"
9709 set off_t lseektype long stdio.h sys/types.h
9710 eval $typedef_ask
9711
9712 echo " "
9713 echo "Checking to see how big your file offsets are..." >&4
9714 $cat >try.c <<EOCP
9715 #include <sys/types.h>
9716 #include <stdio.h>
9717 int main()
9718 {
9719     printf("%d\n", (int)sizeof($lseektype));
9720     return(0);
9721 }
9722 EOCP
9723 set try
9724 if eval $compile_ok; then
9725         lseeksize=`$run ./try`
9726         echo "Your file offsets are $lseeksize bytes long."
9727 else
9728         dflt=$longsize
9729         echo " "
9730         echo "(I can't seem to compile the test program.  Guessing...)"
9731         rp="What is the size of your file offsets (in bytes)?"
9732         . ./myread
9733         lseeksize="$ans"
9734 fi
9735 $rm_try
9736
9737 : see what type file positions are declared as in the library
9738 rp="What is the type for file position used by fsetpos()?"
9739 set fpos_t fpostype long stdio.h sys/types.h
9740 eval $typedef_ask
9741
9742 : Check size for Fpos_t
9743 echo " "
9744 case "$fpostype" in
9745 *_t) zzz="$fpostype"    ;;
9746 *)   zzz="fpos_t"       ;;
9747 esac
9748 echo "Checking the size of $zzz..." >&4
9749 cat > try.c <<EOCP
9750 #include <sys/types.h>
9751 #include <stdio.h>
9752 #$i_stdlib I_STDLIB
9753 #ifdef I_STDLIB
9754 #include <stdlib.h>
9755 #endif
9756 int main() {
9757     printf("%d\n", (int)sizeof($fpostype));
9758     exit(0);
9759 }
9760 EOCP
9761 set try
9762 if eval $compile_ok; then
9763         yyy=`$run ./try`
9764         case "$yyy" in
9765         '')     fpossize=4
9766                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9767                 ;;
9768         *)      fpossize=$yyy
9769                 echo "Your $zzz is $fpossize bytes long."
9770                 ;;
9771         esac
9772 else
9773         dflt="$longsize"
9774         echo " " >&4
9775         echo "(I can't compile the test program.  Guessing...)" >&4
9776         rp="What is the size of your file positions (in bytes)?"
9777         . ./myread
9778         fpossize="$ans"
9779 fi
9780
9781 : Check for large file support
9782 # Backward compatibility (uselfs is deprecated).
9783 case "$uselfs" in
9784 "$define"|true|[yY]*)
9785         cat <<EOM >&4
9786
9787 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9788 EOM
9789         uselargefiles="$define"
9790         ;;
9791 esac
9792
9793 case "$lseeksize:$fpossize" in
9794 8:8) cat <<EOM
9795
9796 You can have files larger than 2 gigabytes.
9797 EOM
9798    val="$define" ;;
9799 *)    case "$uselargefiles" in
9800    "$undef"|false|[nN]*) dflt='n' ;;
9801    *)   dflt='y' ;;
9802    esac
9803    cat <<EOM
9804
9805 Perl can be built to understand large files (files larger than 2 gigabytes)
9806 on some systems.  To do so, Configure can be run with -Duselargefiles.
9807
9808 If this doesn't make any sense to you, just accept the default '$dflt'.
9809 EOM
9810    rp='Try to understand large files, if available?'
9811    . ./myread
9812    case "$ans" in
9813    y|Y)         val="$define" ;;
9814    *)           val="$undef"  ;;
9815    esac
9816    ;;
9817 esac
9818 set uselargefiles
9819 eval $setvar
9820 : Look for a hint-file generated 'call-back-unit'.  If the
9821 : user has specified that a large files perl is to be built,
9822 : we may need to set or change some other defaults.
9823 if $test -f uselargefiles.cbu; then
9824         echo "Your platform has some specific hints regarding large file builds, using them..."
9825         . ./uselargefiles.cbu
9826 fi
9827 case "$uselargefiles" in
9828 "$define")
9829         if $test -f uselargefiles.cbu; then
9830                 echo " "
9831                 echo "Rechecking to see how big your file offsets are..." >&4
9832                 $cat >try.c <<EOCP
9833 #include <sys/types.h>
9834 #include <stdio.h>
9835 int main()
9836 {
9837     printf("%d\n", (int)sizeof($lseektype));
9838     return(0);
9839 }
9840 EOCP
9841                 set try
9842                 if eval $compile_ok; then
9843                         lseeksize=`$run ./try`
9844                         $echo "Your file offsets are now $lseeksize bytes long."
9845                 else
9846                         dflt="$lseeksize"
9847                         echo " "
9848                         echo "(I can't seem to compile the test program.  Guessing...)"
9849                         rp="What is the size of your file offsets (in bytes)?"
9850                         . ./myread
9851                         lseeksize="$ans"
9852                 fi
9853                 case "$fpostype" in
9854                 *_t) zzz="$fpostype"    ;;
9855                 *)   zzz="fpos_t"       ;;
9856                 esac
9857                 $echo $n "Rechecking the size of $zzz...$c" >&4
9858                 $cat > try.c <<EOCP
9859 #include <sys/types.h>
9860 #include <stdio.h>
9861 #$i_stdlib I_STDLIB
9862 #ifdef I_STDLIB
9863 #include <stdlib.h>
9864 #endif
9865 int main() {
9866     printf("%d\n", (int)sizeof($fpostype));
9867     return(0);
9868 }
9869 EOCP
9870                 set try
9871                 if eval $compile_ok; then
9872                         yyy=`$run ./try`
9873                         dflt="$lseeksize"
9874                         case "$yyy" in
9875                         '')     echo " "
9876                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9877                                 ;;
9878                         *)      fpossize=$yyy
9879                                 echo " $fpossize bytes." >&4
9880                                 ;;
9881                         esac
9882                 else
9883                         dflt="$fpossize"
9884                         echo " "
9885                         echo "(I can't compile the test program.  Guessing...)" >&4
9886                         rp="What is the size of your file positions (in bytes)?"
9887                         . ./myread
9888                         fpossize="$ans"
9889                 fi
9890                 $rm_try
9891         fi
9892         ;;
9893 esac
9894
9895 : Check if we want perlio
9896 useperlio="$define"
9897
9898 : Set the vendorbin variables
9899 case "$vendorprefix" in
9900 '')     d_vendorbin="$undef"
9901         vendorbin=''
9902         vendorbinexp=''
9903         ;;
9904 *)      d_vendorbin="$define"
9905         : determine where vendor-supplied executables go.
9906         case "$vendorbin" in
9907         '') dflt=$vendorprefix/bin ;;
9908         *)      dflt="$vendorbin" ;;
9909         esac
9910         fn=d~+
9911         rp='Pathname for the vendor-supplied executables directory?'
9912         . ./getfile
9913         vendorbin="$ans"
9914         vendorbinexp="$ansexp"
9915         ;;
9916 esac
9917 prefixvar=vendorbin
9918 . ./installprefix
9919
9920 : Set the vendorhtml1dir variables
9921 case "$vendorprefix" in
9922 '')     vendorhtml1dir=''
9923         vendorhtml1direxp=''
9924         ;;
9925 *)      : determine where vendor-supplied html pages go.
9926         : There is no standard location, so try to copy the previously-selected
9927         : directory structure for the core html pages.
9928         : XXX Better default suggestions would be welcome.
9929         case "$vendorhtml1dir" in
9930         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9931         *)      dflt=$vendorhtml1dir ;;
9932         esac
9933         case "$dflt" in
9934         ''|' ') dflt=none ;;
9935         esac
9936         fn=dn+~
9937         rp='Pathname for the vendor-supplied html pages?'
9938         . ./getfile
9939         vendorhtml1dir="$ans"
9940         vendorhtml1direxp="$ansexp"
9941         ;;
9942 esac
9943 : Use ' ' for none so value is preserved next time through Configure
9944 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9945 prefixvar=vendorhtml1dir
9946 . ./installprefix
9947
9948 : Set the vendorhtml3dir variables
9949 case "$vendorprefix" in
9950 '')     vendorhtml3dir=''
9951         vendorhtml3direxp=''
9952         ;;
9953 *)      : determine where vendor-supplied module 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 "$vendorhtml3dir" in
9958         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9959         *)      dflt=$vendorhtml3dir ;;
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         vendorhtml3dir="$ans"
9968         vendorhtml3direxp="$ansexp"
9969         ;;
9970 esac
9971 : Use ' ' for none so value is preserved next time through Configure
9972 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9973 prefixvar=vendorhtml3dir
9974 . ./installprefix
9975
9976 : Set the vendorman1dir variables
9977 case "$vendorprefix" in
9978 '')     vendorman1dir=''
9979         vendorman1direxp=''
9980         ;;
9981 *)      : determine where vendor-supplied manual pages go.
9982         case "$vendorman1dir" in
9983         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9984         *)      dflt=$vendorman1dir ;;
9985         esac
9986         case "$dflt" in
9987         ''|' ') dflt=none ;;
9988         esac
9989         fn=nd~+
9990         rp='Pathname for the vendor-supplied manual section 1 pages?'
9991         . ./getfile
9992         vendorman1dir="$ans"
9993         vendorman1direxp="$ansexp"
9994         ;;
9995 esac
9996 : Use ' ' for none so value is preserved next time through Configure
9997 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9998 prefixvar=vendorman1dir
9999 . ./installprefix
10000
10001 : Set the vendorman3dir variables
10002 case "$vendorprefix" in
10003 '')     vendorman3dir=''
10004         vendorman3direxp=''
10005         ;;
10006 *)      : determine where vendor-supplied module manual pages go.
10007         case "$vendorman3dir" in
10008         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10009         *)      dflt=$vendorman3dir ;;
10010         esac
10011         case "$dflt" in
10012         ''|' ') dflt=none ;;
10013         esac
10014         fn=nd~+
10015         rp='Pathname for the vendor-supplied manual section 3 pages?'
10016         . ./getfile
10017         vendorman3dir="$ans"
10018         vendorman3direxp="$ansexp"
10019         ;;
10020 esac
10021 : Use ' ' for none so value is preserved next time through Configure
10022 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10023 prefixvar=vendorman3dir
10024 . ./installprefix
10025
10026 : Set the vendorscript variables
10027 case "$vendorprefix" in
10028 '')     d_vendorscript="$undef"
10029         vendorscript=''
10030         vendorscriptexp=''
10031         ;;
10032 *)      d_vendorscript="$define"
10033         : determine where vendor-supplied scripts go.
10034         case "$vendorscript" in
10035         '')     dflt=$vendorprefix/script
10036                 $test -d $dflt || dflt=$vendorbin ;;
10037         *)  dflt="$vendorscript" ;;
10038         esac
10039         $cat <<EOM
10040
10041 The installation process will create a directory for
10042 vendor-supplied scripts.
10043
10044 EOM
10045         fn=d~+
10046         rp='Pathname for the vendor-supplied scripts directory?'
10047         . ./getfile
10048         vendorscript="$ans"
10049         vendorscriptexp="$ansexp"
10050         ;;
10051 esac
10052 prefixvar=vendorscript
10053 . ./installprefix
10054
10055 : script used to emit important warnings
10056 cat >warn <<EOS
10057 $startsh
10058 if test \$# -gt 0; then
10059         echo "\$@" >msg
10060 else
10061         cat >msg
10062 fi
10063 echo "*** WARNING:" >&4
10064 sed -e 's/^/*** /' <msg >&4
10065 echo "*** " >&4
10066 cat msg >>config.msg
10067 echo " " >>config.msg
10068 rm -f msg
10069 EOS
10070 chmod +x warn
10071 $eunicefix warn
10072
10073 : see which of string.h or strings.h is needed
10074 echo " "
10075 strings=`./findhdr string.h`
10076 if $test "$strings" && $test -r "$strings"; then
10077         echo "Using <string.h> instead of <strings.h>." >&4
10078         val="$define"
10079 else
10080         val="$undef"
10081         strings=`./findhdr strings.h`
10082         if $test "$strings" && $test -r "$strings"; then
10083                 echo "Using <strings.h> instead of <string.h>." >&4
10084         else
10085                 ./warn "No string header found -- You'll surely have problems."
10086         fi
10087 fi
10088 set i_string
10089 eval $setvar
10090 case "$i_string" in
10091 "$undef") strings=`./findhdr strings.h`;;
10092 *)        strings=`./findhdr string.h`;;
10093 esac
10094
10095 : see if qgcvt exists
10096 set qgcvt d_qgcvt
10097 eval $inlibc
10098
10099 : Check what kind of doubles your system has
10100 $echo "Checking the kind of doubles you have..." >&4
10101 $cat >try.c <<EOP
10102 #$i_stdlib I_STDLIB
10103 #define DOUBLESIZE $doublesize
10104 #ifdef I_STDLIB
10105 #include <stdlib.h>
10106 #endif
10107 #include <stdio.h>
10108 static const double d = -0.1;
10109 int main() {
10110   unsigned const char* b = (unsigned const char*)(&d);
10111 #if DOUBLESIZE == 4
10112   if (b[0] == 0xCD && b[3] == 0xBD) {
10113     /* IEEE 754 32-bit little-endian */
10114     printf("1\n");
10115     exit(0);
10116   }
10117   if (b[0] == 0xBD && b[3] == 0xCD) {
10118     /* IEEE 754 32-bit big-endian */
10119     printf("2\n");
10120     exit(0);
10121   }
10122 #endif
10123 #if DOUBLESIZE == 8
10124   if (b[0] == 0x9A && b[7] == 0xBF) {
10125     /* IEEE 754 64-bit little-endian */
10126     printf("3\n");
10127     exit(0);
10128   }
10129   if (b[0] == 0xBF && b[7] == 0x9A) {
10130     /* IEEE 754 64-bit big-endian */
10131     printf("4\n");
10132     exit(0);
10133   }
10134   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10135    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10136     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10137     * 99 99 b9 bf 9a 99 99 99 */
10138     printf("7\n");
10139     exit(0);
10140   }
10141   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10142    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10143     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10144     * 99 99 99 9a bf b9 99 99 */
10145     printf("8\n");
10146     exit(0);
10147   }
10148 #endif
10149 #if DOUBLESIZE == 16
10150   if (b[0] == 0x9A && b[15] == 0xBF) {
10151     /* IEEE 754 128-bit little-endian */
10152     printf("5\n");
10153     exit(0);
10154   }
10155   if (b[0] == 0xBF && b[15] == 0x9A) {
10156     /* IEEE 754 128-bit big-endian */
10157     printf("6\n");
10158     exit(0);
10159   }
10160 #endif
10161   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
10162    * Whether those environments can still build Perl is debatable. */
10163   printf("-1\n"); /* unknown */
10164   exit(0);
10165 }
10166 EOP
10167 set try
10168 if eval $compile; then
10169     doublekind=`$run ./try`
10170 else
10171     doublekind=-1
10172 fi
10173 case "$doublekind" in
10174 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10175 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10176 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10177 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10178 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10179 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10180 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10181 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10182 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
10183 esac
10184 $rm_try
10185
10186 : Check print/scan long double stuff
10187 echo " "
10188
10189 if $test X"$d_longdbl" = X"$define"; then
10190
10191 echo "Checking how to print long doubles..." >&4
10192
10193 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10194         $cat >try.c <<'EOCP'
10195 #include <sys/types.h>
10196 #include <stdio.h>
10197 int main() {
10198   double d = 123.456;
10199   printf("%.3f\n", d);
10200 }
10201 EOCP
10202         set try
10203         if eval $compile; then
10204                 yyy=`$run ./try`
10205                 case "$yyy" in
10206                 123.456)
10207                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10208                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10209                         echo "We will use %f."
10210                         ;;
10211                 esac
10212         fi
10213 fi
10214
10215 if $test X"$sPRIfldbl" = X; then
10216         $cat >try.c <<'EOCP'
10217 #include <sys/types.h>
10218 #include <stdio.h>
10219 int main() {
10220   long double d = 123.456;
10221   printf("%.3Lf\n", d);
10222 }
10223 EOCP
10224         set try
10225         if eval $compile; then
10226                 yyy=`$run ./try`
10227                 case "$yyy" in
10228                 123.456)
10229                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10230                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10231                         echo "We will use %Lf."
10232                         ;;
10233                 esac
10234         fi
10235 fi
10236
10237 if $test X"$sPRIfldbl" = X; then
10238         $cat >try.c <<'EOCP'
10239 #include <sys/types.h>
10240 #include <stdio.h>
10241 int main() {
10242   long double d = 123.456;
10243   printf("%.3llf\n", d);
10244 }
10245 EOCP
10246         set try
10247         if eval $compile; then
10248                 yyy=`$run ./try`
10249                 case "$yyy" in
10250                 123.456)
10251                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10252                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10253                         echo "We will use %llf."
10254                         ;;
10255                 esac
10256         fi
10257 fi
10258
10259 if $test X"$sPRIfldbl" = X; then
10260         $cat >try.c <<'EOCP'
10261 #include <sys/types.h>
10262 #include <stdio.h>
10263 int main() {
10264   long double d = 123.456;
10265   printf("%.3lf\n", d);
10266 }
10267 EOCP
10268         set try
10269         if eval $compile; then
10270                 yyy=`$run ./try`
10271                 case "$yyy" in
10272                 123.456)
10273                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10274                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10275                         echo "We will use %lf."
10276                         ;;
10277                 esac
10278         fi
10279 fi
10280
10281 if $test X"$sPRIfldbl" = X; then
10282         echo "Cannot figure out how to print long doubles." >&4
10283 else
10284         sSCNfldbl=$sPRIfldbl    # expect consistency
10285 fi
10286
10287 $rm_try
10288
10289 fi # d_longdbl
10290
10291 case "$sPRIfldbl" in
10292 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10293         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10294         d_SCNfldbl="$undef";
10295         ;;
10296 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10297         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10298         d_SCNfldbl="$define";
10299         ;;
10300 esac
10301
10302 : Before committing on uselongdouble, see whether that looks sane.
10303 if $test "$uselongdouble" = "$define"; then
10304     message=""
10305     echo " "
10306     echo "Checking if your long double math functions work right..." >&4
10307     $cat > try.c <<EOF
10308 #include <math.h>
10309 #include <stdio.h>
10310 int main() {
10311   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10312 }
10313 EOF
10314     case "$osname:$gccversion" in
10315     aix:)       saveccflags="$ccflags"
10316                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10317     esac
10318     set try
10319     if eval $compile_ok; then
10320       yyy=`$run ./try`
10321     fi
10322     case "$yyy" in
10323     3) echo "Your long double math functions are working correctly." >&4 ;;
10324     *) echo "Your long double math functions are broken, not using long doubles." >&4
10325        uselongdouble=$undef
10326        ;;
10327     esac
10328     $rm_try
10329     case "$osname:$gccversion" in
10330     aix:)       ccflags="$saveccflags" ;; # restore
10331     esac
10332 fi
10333
10334 : Check how to convert floats to strings.
10335
10336 if test "X$d_Gconvert" = X; then
10337
10338 echo " "
10339 echo "Checking for an efficient way to convert floats to strings."
10340 echo " " > try.c
10341 case "$uselongdouble" in
10342 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10343 esac
10344 case "$d_longdbl" in
10345 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10346 esac
10347 case "$d_PRIgldbl" in
10348 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10349 esac
10350 $cat >>try.c <<EOP
10351 #ifdef TRY_gconvert
10352 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10353 char *myname = "gconvert";
10354 #endif
10355 #ifdef TRY_gcvt
10356 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10357 char *myname = "gcvt";
10358 #endif
10359 #ifdef TRY_qgcvt
10360 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10361 char *myname = "qgcvt";
10362 #define DOUBLETYPE long double
10363 #endif
10364 #ifdef TRY_sprintf
10365 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10366 #ifdef HAS_PRIgldbl
10367 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10368 #else
10369 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10370 #endif
10371 #else
10372 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10373 #endif
10374 char *myname = "sprintf";
10375 #endif
10376
10377 #ifndef DOUBLETYPE
10378 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10379 #define DOUBLETYPE long double
10380 #else
10381 #define DOUBLETYPE double
10382 #endif
10383 #endif
10384
10385 #include <stdio.h>
10386
10387 #$i_stdlib I_STDLIB
10388 #ifdef I_STDLIB
10389 #include <stdlib.h>
10390 #endif
10391 #$i_string I_STRING
10392 #ifdef I_STRING
10393 #  include <string.h>
10394 #else
10395 #  include <strings.h>
10396 #endif
10397
10398 int checkit(char *expect, char *got)
10399 {
10400     if (strcmp(expect, got)) {
10401                 printf("%s oddity:  Expected %s, got %s\n",
10402                         myname, expect, got);
10403                 exit(1);
10404         }
10405 }
10406
10407 int main()
10408 {
10409         char buf[64];
10410         buf[63] = '\0';
10411
10412         /* This must be 1st test on (which?) platform */
10413         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10414         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10415         checkit("0.1", buf);
10416
10417         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10418         checkit("0.01", buf);
10419
10420         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10421         checkit("0.001", buf);
10422
10423         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10424         checkit("0.0001", buf);
10425
10426         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10427         if (strlen(buf) > 5)
10428             checkit("9e-005", buf); /* for Microsoft ?? */
10429         else
10430             checkit("9e-05", buf);
10431
10432         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10433         checkit("1", buf);
10434
10435         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10436         checkit("1.1", buf);
10437
10438         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10439         checkit("1.01", buf);
10440
10441         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10442         checkit("1.001", buf);
10443
10444         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10445         checkit("1.0001", buf);
10446
10447         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10448         checkit("1.00001", buf);
10449
10450         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10451         checkit("1.000001", buf);
10452
10453         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10454         checkit("0", buf);
10455
10456         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10457         checkit("-1", buf);
10458
10459         /* Some Linux gcvt's give 1.e+5 here. */
10460         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10461         checkit("100000", buf);
10462
10463         /* Some Linux gcvt's give -1.e+5 here. */
10464         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10465         checkit("-100000", buf);
10466
10467         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10468         checkit("123.456", buf);
10469
10470         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10471         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10472         /* 34 should be enough to scare even long double
10473          * places into using the e notation. */
10474         if (strlen(buf) > 5)
10475             checkit("1e+034", buf); /* for Microsoft */
10476         else
10477             checkit("1e+34", buf);
10478
10479         /* For Perl, if you add additional tests here, also add them to
10480          * t/base/num.t for benefit of platforms not using Configure or
10481          * overriding d_Gconvert */
10482
10483         exit(0);
10484 }
10485 EOP
10486 : first add preferred functions to our list
10487 xxx_list=""
10488 for xxx_convert in $gconvert_preference; do
10489     case $xxx_convert in
10490     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10491     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10492     esac
10493 done
10494 : then add any others
10495 for xxx_convert in gconvert gcvt sprintf; do
10496     case "$xxx_list" in
10497     *$xxx_convert*) ;;
10498     *) xxx_list="$xxx_list $xxx_convert" ;;
10499     esac
10500 done
10501
10502 case "$d_longdbl$uselongdouble" in
10503 "$define$define")
10504     : again, add preferred functions to our list first
10505     xxx_ld_list=""
10506     for xxx_convert in $gconvert_ld_preference; do
10507         case $xxx_convert in
10508         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10509         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10510         esac
10511     done
10512     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10513     for xxx_convert in qgcvt sprintf $xxx_list; do
10514         case "$xxx_ld_list" in
10515         $xxx_convert*|*" $xxx_convert"*) ;;
10516         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10517         esac
10518     done
10519     : if sprintf cannot do long doubles, move it to the end
10520     if test "$d_PRIgldbl" != "$define"; then
10521         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10522     fi
10523     : if no qgcvt, remove it
10524     if test "$d_qgcvt" != "$define"; then
10525         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10526     fi
10527     : use the ld_list
10528     xxx_list="$xxx_ld_list"
10529     ;;
10530 esac
10531
10532 for xxx_convert in $xxx_list; do
10533         echo "Trying $xxx_convert..."
10534         $rm -f try try$_o core
10535         set try -DTRY_$xxx_convert
10536         if eval $compile; then
10537                 echo "$xxx_convert() found." >&4
10538                 if $run ./try; then
10539                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10540                         break;
10541                 else
10542                         echo "...But $xxx_convert didn't work as I expected."
10543                         xxx_convert=''
10544                 fi
10545         else
10546                 echo "$xxx_convert NOT found." >&4
10547         fi
10548 done
10549
10550 if test X$xxx_convert = X; then
10551     echo "*** WHOA THERE!!! ***" >&4
10552     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10553     xxx_convert=sprintf
10554 fi
10555
10556 case "$xxx_convert" in
10557 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10558 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10559 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10560 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10561    "$define$define$define")
10562       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10563    "$define$define$undef")
10564       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10565    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10566    esac
10567    ;;
10568 esac
10569
10570 fi
10571 $rm_try
10572
10573 : see if _fwalk exists
10574 set fwalk d__fwalk
10575 eval $inlibc
10576
10577 : Initialize h_fcntl
10578 h_fcntl=false
10579
10580 : Initialize h_sysfile
10581 h_sysfile=false
10582
10583 : access call always available on UNIX
10584 set access d_access
10585 eval $inlibc
10586
10587 : locate the flags for 'access()'
10588 case "$d_access" in
10589 "$define")
10590         echo " "
10591         $cat >access.c <<EOCP
10592 #include <sys/types.h>
10593 #ifdef I_FCNTL
10594 #include <fcntl.h>
10595 #endif
10596 #ifdef I_SYS_FILE
10597 #include <sys/file.h>
10598 #endif
10599 #ifdef I_UNISTD
10600 #include <unistd.h>
10601 #endif
10602 #$i_stdlib I_STDLIB
10603 #ifdef I_STDLIB
10604 #include <stdlib.h>
10605 #endif
10606 int main() {
10607         exit(R_OK);
10608 }
10609 EOCP
10610         : check sys/file.h first, no particular reason here
10611         if $test `./findhdr sys/file.h` && \
10612                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10613                 h_sysfile=true;
10614                 echo "<sys/file.h> defines the *_OK access constants." >&4
10615         elif $test `./findhdr fcntl.h` && \
10616                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10617                 h_fcntl=true;
10618                 echo "<fcntl.h> defines the *_OK access constants." >&4
10619         elif $test `./findhdr unistd.h` && \
10620                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10621                 echo "<unistd.h> defines the *_OK access constants." >&4
10622         else
10623                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10624         fi
10625         ;;
10626 esac
10627 $rm -f access*
10628
10629 : see if accessx exists
10630 set accessx d_accessx
10631 eval $inlibc
10632
10633 : see if acosh exists
10634 set acosh d_acosh
10635 eval $inlibc
10636
10637 : see if aintl exists
10638 set aintl d_aintl
10639 eval $inlibc
10640
10641 : see if alarm exists
10642 set alarm d_alarm
10643 eval $inlibc
10644
10645 : see if 64bit time functions exists
10646
10647 set ctime64 d_ctime64
10648 eval $inlibc
10649
10650 set localtime64 d_localtime64
10651 eval $inlibc
10652
10653 set gmtime64 d_gmtime64
10654 eval $inlibc
10655
10656 set mktime64 d_mktime64
10657 eval $inlibc
10658
10659 set difftime64 d_difftime64
10660 eval $inlibc
10661
10662 set asctime64 d_asctime64
10663 eval $inlibc
10664
10665 : see if POSIX threads are available
10666 set pthread.h i_pthread
10667 eval $inhdr
10668
10669 : define a function to check prototypes
10670 $cat > protochk <<EOSH
10671 $startsh
10672 cc="$cc"
10673 optimize="$optimize"
10674 ccflags="$ccflags"
10675 prototype="$prototype"
10676 define="$define"
10677 rm_try="$rm_try"
10678 usethreads=$usethreads
10679 i_pthread=$i_pthread
10680 pthread_h_first=$pthread_h_first
10681 EOSH
10682
10683 $cat >> protochk <<'EOSH'
10684
10685 $rm_try
10686 foo="$1"
10687 shift
10688 while test $# -ge 2; do
10689         case "$1" in
10690                 $define) echo "#include <$2>" >> try.c ;;
10691                 literal) echo "$2" >> try.c ;;
10692         esac
10693     # Extra magic for the benefit of systems that need pthread.h
10694     # to be included early to correctly detect threadsafe functions.
10695     # Such functions must guarantee themselves, though, that the usethreads
10696     # and i_pthread have been defined, before calling protochk.
10697     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10698         echo "#include <pthread.h>" >> try.c
10699         pthread_h_done=yes
10700     fi
10701     shift 2
10702 done
10703 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10704 cat >> try.c <<'EOCP'
10705 #ifdef CAN_PROTOTYPE
10706 #define _(args) args
10707 #else
10708 #define _(args) ()
10709 #endif
10710 EOCP
10711 echo "$foo" >> try.c
10712 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10713 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10714 status=$?
10715 $rm_try
10716 exit $status
10717 EOSH
10718 chmod +x protochk
10719 $eunicefix protochk
10720
10721 : Define hasproto macro for Configure internal use
10722 hasproto='varname=$1; func=$2; shift; shift;
10723 while $test $# -ge 2; do
10724         case "$1" in
10725         $define) echo "#include <$2>";;
10726         esac ;
10727     shift 2;
10728 done > try.c;
10729 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10730 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10731         echo "$func() prototype found.";
10732         val="$define";
10733 else
10734         echo "$func() prototype NOT found.";
10735         val="$undef";
10736 fi;
10737 set $varname;
10738 eval $setvar;
10739 $rm_try tryout.c'
10740
10741 : see if sys/types.h has to be included
10742 set sys/types.h i_systypes
10743 eval $inhdr
10744
10745 : see if sys/select.h has to be included
10746 set sys/select.h i_sysselct
10747 eval $inhdr
10748
10749 : Define hasfield macro for Configure internal use
10750 hasfield='varname=$1; struct=$2; field=$3; shift; 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 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10758 set try;
10759 if eval $compile; then
10760         val="$define";
10761 else
10762         val="$undef";
10763 fi;
10764 set $varname;
10765 eval $setvar;
10766 $rm_try'
10767
10768 : Define hasfield_t macro for Configure internal use
10769 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
10770 while $test $# -ge 2; do
10771         case "$1" in
10772         $define) echo "#include <$2>";;
10773         esac ;
10774     shift 2;
10775 done > try.c;
10776 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
10777 set try;
10778 if eval $compile; then
10779         val="$define";
10780 else
10781         val="$undef";
10782 fi;
10783 set $varname;
10784 eval $setvar;
10785 $rm_try'
10786
10787 : see if we should include time.h, sys/time.h, or both
10788 echo " "
10789 if test "X$timeincl" = X; then
10790         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10791         $echo $n "I'm now running the test program...$c"
10792         $cat >try.c <<EOCP
10793 #include <sys/types.h>
10794 #ifdef I_TIME
10795 #include <time.h>
10796 #endif
10797 #ifdef I_SYSTIME
10798 #ifdef SYSTIMEKERNEL
10799 #define KERNEL
10800 #endif
10801 #include <sys/time.h>
10802 #endif
10803 #ifdef I_SYSSELECT
10804 #include <sys/select.h>
10805 #endif
10806 #$i_stdlib I_STDLIB
10807 #ifdef I_STDLIB
10808 #include <stdlib.h>
10809 #endif
10810 int main()
10811 {
10812         struct tm foo;
10813 #ifdef S_TIMEVAL
10814         struct timeval bar;
10815 #endif
10816 #ifdef S_TIMEZONE
10817         struct timezone tzp;
10818 #endif
10819         if (foo.tm_sec == foo.tm_sec)
10820                 exit(0);
10821 #ifdef S_TIMEVAL
10822         if (bar.tv_sec == bar.tv_sec)
10823                 exit(0);
10824 #endif
10825         exit(1);
10826 }
10827 EOCP
10828         flags=''
10829         for s_timezone in '-DS_TIMEZONE' ''; do
10830         sysselect=''
10831         for s_timeval in '-DS_TIMEVAL' ''; do
10832         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10833         for i_time in '' '-DI_TIME'; do
10834         for i_systime in '-DI_SYSTIME' ''; do
10835                 case "$flags" in
10836                 '') $echo $n ".$c"
10837                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10838                         if eval $compile; then
10839                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10840                                 shift
10841                                 flags="$*"
10842                                 echo " "
10843                                 $echo $n "Succeeded with $flags$c"
10844                         fi
10845                         ;;
10846                 esac
10847         done
10848         done
10849         done
10850         done
10851         done
10852         timeincl=''
10853         echo " "
10854         case "$flags" in
10855         *SYSTIMEKERNEL*) i_systimek="$define"
10856                 timeincl=`./findhdr sys/time.h`
10857                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10858         *) i_systimek="$undef";;
10859         esac
10860         case "$flags" in
10861         *I_TIME*) i_time="$define"
10862                 timeincl=`./findhdr time.h`" $timeincl"
10863                 echo "We'll include <time.h>." >&4;;
10864         *) i_time="$undef";;
10865         esac
10866         case "$flags" in
10867         *I_SYSTIME*) i_systime="$define"
10868                 timeincl=`./findhdr sys/time.h`" $timeincl"
10869                 echo "We'll include <sys/time.h>." >&4;;
10870         *) i_systime="$undef";;
10871         esac
10872         $rm_try
10873 fi
10874 : see if struct tm knows about tm_zone
10875 case "$i_systime$i_time" in
10876 *$define*)
10877         echo " "
10878         echo "Checking to see if your struct tm has tm_zone field..." >&4
10879         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10880         eval $hasfield
10881         ;;
10882 *)      val="$undef"
10883         set d_tm_tm_zone
10884         eval $setvar
10885         ;;
10886 esac
10887 case "$d_tm_tm_zone" in
10888 "$define")      echo "Yes, it does."   ;;
10889 *)              echo "No, it doesn't." ;;
10890 esac
10891 : see if struct tm knows about tm_gmtoff
10892 case "$i_systime$i_time" in
10893 *$define*)
10894         echo " "
10895         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10896         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10897         eval $hasfield
10898         ;;
10899 *)      val="$undef"
10900         set d_tm_tm_gmtoff
10901         eval $setvar
10902         ;;
10903 esac
10904 case "$d_tm_tm_gmtoff" in
10905 "$define")      echo "Yes, it does."   ;;
10906 *)              echo "No, it doesn't." ;;
10907 esac
10908
10909 : see if asctime_r exists
10910 set asctime_r d_asctime_r
10911 eval $inlibc
10912 case "$d_asctime_r" in
10913 "$define")
10914         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10915         case "$d_asctime_r_proto:$usethreads" in
10916         ":define")      d_asctime_r_proto=define
10917                 set d_asctime_r_proto asctime_r $hdrs
10918                 eval $hasproto ;;
10919         *)      ;;
10920         esac
10921         case "$d_asctime_r_proto" in
10922         define)
10923         case "$asctime_r_proto" in
10924         ''|0) try='char* asctime_r(const struct tm*, char*);'
10925         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10926         esac
10927         case "$asctime_r_proto" in
10928         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10929         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10930         esac
10931         case "$asctime_r_proto" in
10932         ''|0) try='int asctime_r(const struct tm*, char*);'
10933         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10934         esac
10935         case "$asctime_r_proto" in
10936         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10937         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10938         esac
10939         case "$asctime_r_proto" in
10940         ''|0)   d_asctime_r=undef
10941                 asctime_r_proto=0
10942                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10943         * )     case "$asctime_r_proto" in
10944                 REENTRANT_PROTO*) ;;
10945                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10946                 esac
10947                 echo "Prototype: $try" ;;
10948         esac
10949         ;;
10950         *)      case "$usethreads" in
10951                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10952                 esac
10953                 d_asctime_r=undef
10954                 asctime_r_proto=0
10955                 ;;
10956         esac
10957         ;;
10958 *)      asctime_r_proto=0
10959         ;;
10960 esac
10961
10962 : see if asinh exists
10963 set asinh d_asinh
10964 eval $inlibc
10965
10966 : see if atanh exists
10967 set atanh d_atanh
10968 eval $inlibc
10969
10970 : see if atolf exists
10971 set atolf d_atolf
10972 eval $inlibc
10973
10974 : see if atoll exists
10975 set atoll d_atoll
10976 eval $inlibc
10977
10978 : Look for GCC-style attribute format
10979 case "$d_attribute_format" in
10980 '')
10981 echo " "
10982 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10983 $cat >attrib.c <<'EOCP'
10984 #include <stdio.h>
10985 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10986 EOCP
10987 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10988         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10989                 echo "Your C compiler doesn't support __attribute__((format))."
10990                 val="$undef"
10991         else
10992                 echo "Your C compiler supports __attribute__((format))."
10993                 val="$define"
10994         fi
10995 else
10996         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10997         val="$undef"
10998 fi
10999 ;;
11000 *) val="$d_attribute_format" ;;
11001 esac
11002 set d_attribute_format
11003 eval $setvar
11004 $rm -f attrib*
11005
11006 : Look for GCC-style attribute format with null format allowed
11007 case "$d_printf_format_null" in
11008 '') case "$d_attribute_format" in
11009     $define)
11010         echo " "
11011         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11012 $cat >attrib.c <<EOCP
11013 #include <stdio.h>
11014 #$i_stdlib I_STDLIB
11015 #ifdef I_STDLIB
11016 #include <stdlib.h>
11017 #endif
11018 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11019 int null_printf (char* pat,...) { return (int)pat; }
11020 int main () { exit(null_printf(NULL)); }
11021 EOCP
11022         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11023             : run the executable in case it produces a run-time warning
11024             if $run ./attrib >>attrib.out 2>&1; then
11025                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11026                     echo "Your C compiler doesn't allow __printf__ format to be null."
11027                     val="$undef"
11028                 else
11029                     echo "Your C compiler allows __printf__ format to be null."
11030                     val="$define"
11031                 fi
11032             else
11033             echo "Your C compiler executable failed with __printf__ format null."
11034             val="$undef"
11035         fi
11036     else
11037         echo "Your C compiler fails with __printf__ format null."
11038         val="$undef"
11039     fi
11040     ;;
11041     *)  val="$undef" ;;
11042     esac
11043 ;;
11044 *)  val="$d_printf_format_null" ;;
11045 esac
11046 set d_printf_format_null
11047 eval $setvar
11048 $rm -f attrib*
11049
11050 : Look for GCC-style attribute malloc
11051 case "$d_attribute_malloc" in
11052 '')
11053 echo " "
11054 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11055 $cat >attrib.c <<'EOCP'
11056 #include <stdio.h>
11057 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11058 EOCP
11059 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11060         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11061                 echo "Your C compiler doesn't support __attribute__((malloc))."
11062                 val="$undef"
11063         else
11064                 echo "Your C compiler supports __attribute__((malloc))."
11065                 val="$define"
11066         fi
11067 else
11068         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11069         val="$undef"
11070 fi
11071 ;;
11072 *) val="$d_attribute_malloc" ;;
11073 esac
11074 set d_attribute_malloc
11075 eval $setvar
11076 $rm -f attrib*
11077
11078 : Look for GCC-style attribute nonnull
11079 case "$d_attribute_nonnull" in
11080 '')
11081 echo " "
11082 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11083 $cat >attrib.c <<'EOCP'
11084 #include <stdio.h>
11085 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
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__((nonnull))."
11090                 val="$undef"
11091         else
11092                 echo "Your C compiler supports __attribute__((nonnull))."
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_nonnull" ;;
11101 esac
11102 set d_attribute_nonnull
11103 eval $setvar
11104 $rm -f attrib*
11105
11106 : Look for GCC-style attribute noreturn
11107 case "$d_attribute_noreturn" in
11108 '')
11109 echo " "
11110 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11111 $cat >attrib.c <<'EOCP'
11112 #include <stdio.h>
11113 void fall_over_dead( void ) __attribute__((noreturn));
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__((noreturn))."
11118                 val="$undef"
11119         else
11120                 echo "Your C compiler supports __attribute__((noreturn))."
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_noreturn" ;;
11129 esac
11130 set d_attribute_noreturn
11131 eval $setvar
11132 $rm -f attrib*
11133
11134 : Look for GCC-style attribute pure
11135 case "$d_attribute_pure" in
11136 '')
11137 echo " "
11138 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11139 $cat >attrib.c <<'EOCP'
11140 #include <stdio.h>
11141 int square( int n ) __attribute__((pure));
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__((pure))."
11146                 val="$undef"
11147         else
11148                 echo "Your C compiler supports __attribute__((pure))."
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_pure" ;;
11157 esac
11158 set d_attribute_pure
11159 eval $setvar
11160 $rm -f attrib*
11161
11162 : Look for GCC-style attribute unused
11163 case "$d_attribute_unused" in
11164 '')
11165 echo " "
11166 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11167 $cat >attrib.c <<'EOCP'
11168 #include <stdio.h>
11169 int do_something( int dummy __attribute__((unused)), int n );
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__((unused))."
11174                 val="$undef"
11175         else
11176                 echo "Your C compiler supports __attribute__((unused))."
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_unused" ;;
11185 esac
11186 set d_attribute_unused
11187 eval $setvar
11188 $rm -f attrib*
11189
11190 : Look for GCC-style attribute deprecated
11191 case "$d_attribute_deprecated" in
11192 '')
11193 echo " "
11194 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11195 $cat >attrib.c <<'EOCP'
11196 #include <stdio.h>
11197 int I_am_deprecated(void) __attribute__((deprecated));
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__((deprecated))."
11202                 val="$undef"
11203         else
11204                 echo "Your C compiler supports __attribute__((deprecated))."
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_deprecated" ;;
11213 esac
11214 set d_attribute_deprecated
11215 eval $setvar
11216 $rm -f attrib*
11217
11218 : Look for GCC-style attribute warn_unused_result
11219 case "$d_attribute_warn_unused_result" in
11220 '')
11221 echo " "
11222 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11223 $cat >attrib.c <<'EOCP'
11224 #include <stdio.h>
11225 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
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__((warn_unused_result))."
11230                 val="$undef"
11231         else
11232                 echo "Your C compiler supports __attribute__((warn_unused_result))."
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_warn_unused_result" ;;
11241 esac
11242 set d_attribute_warn_unused_result
11243 eval $setvar
11244 $rm -f attrib*
11245
11246 : see if bcmp exists
11247 set bcmp d_bcmp
11248 eval $inlibc
11249
11250 : see if bcopy exists
11251 set bcopy d_bcopy
11252 eval $inlibc
11253
11254 : see if getpgrp exists
11255 set getpgrp d_getpgrp
11256 eval $inlibc
11257
11258 case "$d_getpgrp" in
11259 "$define")
11260         echo " "
11261         echo "Checking to see which flavor of getpgrp is in use..."
11262         $cat >try.c <<EOP
11263 #$i_unistd I_UNISTD
11264 #include <sys/types.h>
11265 #ifdef I_UNISTD
11266 #  include <unistd.h>
11267 #endif
11268 #$i_stdlib I_STDLIB
11269 #ifdef I_STDLIB
11270 #include <stdlib.h>
11271 #endif
11272 int main()
11273 {
11274         if (getuid() == 0) {
11275                 printf("(I see you are running Configure as super-user...)\n");
11276                 setuid(1);
11277         }
11278 #ifdef TRY_BSD_PGRP
11279         if (getpgrp(1) == 0)
11280                 exit(0);
11281 #else
11282         if (getpgrp() > 0)
11283                 exit(0);
11284 #endif
11285         exit(1);
11286 }
11287 EOP
11288         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11289                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11290                 val="$define"
11291         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11292                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11293                 val="$undef"
11294         else
11295                 echo "I can't seem to compile and run the test program."
11296                 if ./usg; then
11297                         xxx="a USG one, i.e. you use getpgrp()."
11298                 else
11299                         # SVR4 systems can appear rather BSD-ish.
11300                         case "$i_unistd" in
11301                         $undef)
11302                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11303                                 val="$define"
11304                                 ;;
11305                         $define)
11306                                 xxx="probably a USG one, i.e. you use getpgrp()."
11307                                 val="$undef"
11308                                 ;;
11309                         esac
11310                 fi
11311                 echo "Assuming your getpgrp is $xxx" >&4
11312         fi
11313         ;;
11314 *) val="$undef";;
11315 esac
11316 set d_bsdgetpgrp
11317 eval $setvar
11318 $rm_try
11319
11320 : see if setpgrp exists
11321 set setpgrp d_setpgrp
11322 eval $inlibc
11323
11324 case "$d_setpgrp" in
11325 "$define")
11326         echo " "
11327         echo "Checking to see which flavor of setpgrp is in use..."
11328         $cat >try.c <<EOP
11329 #$i_unistd I_UNISTD
11330 #include <sys/types.h>
11331 #ifdef I_UNISTD
11332 #  include <unistd.h>
11333 #endif
11334 #$i_stdlib I_STDLIB
11335 #ifdef I_STDLIB
11336 #include <stdlib.h>
11337 #endif
11338 int main()
11339 {
11340         if (getuid() == 0) {
11341                 printf("(I see you are running Configure as super-user...)\n");
11342                 setuid(1);
11343         }
11344 #ifdef TRY_BSD_PGRP
11345         if (-1 == setpgrp(1, 1))
11346                 exit(0);
11347 #else
11348         if (setpgrp() != -1)
11349                 exit(0);
11350 #endif
11351         exit(1);
11352 }
11353 EOP
11354         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11355                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11356                 val="$define"
11357         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11358                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11359                 val="$undef"
11360         else
11361                 echo "(I can't seem to compile and run the test program.)"
11362                 if ./usg; then
11363                         xxx="a USG one, i.e. you use setpgrp()."
11364                 else
11365                         # SVR4 systems can appear rather BSD-ish.
11366                         case "$i_unistd" in
11367                         $undef)
11368                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11369                                 val="$define"
11370                                 ;;
11371                         $define)
11372                                 xxx="probably a USG one, i.e. you use setpgrp()."
11373                                 val="$undef"
11374                                 ;;
11375                         esac
11376                 fi
11377                 echo "Assuming your setpgrp is $xxx" >&4
11378         fi
11379         ;;
11380 *) val="$undef";;
11381 esac
11382 set d_bsdsetpgrp
11383 eval $setvar
11384 $rm_try
11385
11386 : Look for GCC-style __builtin_choose_expr
11387 case "$d_builtin_choose_expr" in
11388 '')
11389     echo " "
11390     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11391     $cat >try.c <<'EOCP'
11392 #include <assert.h>
11393 #include <stdlib.h>
11394 #include <stdio.h>
11395
11396 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11397
11398 int main(void) {
11399     assert( SYRINX(1) == 2112 );
11400     assert( SYRINX(1) != 5150 );
11401     assert( SYRINX(0) == 5150 );
11402     assert( SYRINX(0) != 2112 );
11403     puts( "All good!" );
11404     exit(0);
11405 }
11406
11407 EOCP
11408     set try
11409     if eval $compile && $run ./try; then
11410         echo "Your C compiler supports __builtin_choose_expr."
11411         val="$define"
11412     else
11413         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11414         val="$undef"
11415     fi
11416 ;;
11417 *) val="$d_builtin_choose_expr" ;;
11418 esac
11419
11420 set d_builtin_choose_expr
11421 eval $setvar
11422 $rm_try
11423
11424 : Look for GCC-style __builtin_expect
11425 case "$d_builtin_expect" in
11426 '')
11427     echo " "
11428     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11429     $cat >try.c <<'EOCP'
11430 int main(void) {
11431     int n = 50;
11432     if ( __builtin_expect(n, 0) ) n = 1;
11433     /* Remember shell exit code truth is 0, C truth is non-zero */
11434     return !(n == 1);
11435 }
11436 EOCP
11437     set try
11438     if eval $compile && $run ./try; then
11439         echo "Your C compiler supports __builtin_expect."
11440         val="$define"
11441     else
11442         echo "Your C compiler doesn't seem to understand __builtin_expect."
11443         val="$undef"
11444     fi
11445     ;;
11446 *) val="$d_builtin_expect" ;;
11447 esac
11448
11449 set d_builtin_expect
11450 eval $setvar
11451 $rm_try
11452
11453 : see if bzero exists
11454 set bzero d_bzero
11455 eval $inlibc
11456
11457 : see if stdarg is available
11458 echo " "
11459 if $test `./findhdr stdarg.h`; then
11460         echo "<stdarg.h> found." >&4
11461         valstd="$define"
11462 else
11463         echo "<stdarg.h> NOT found." >&4
11464         valstd="$undef"
11465 fi
11466
11467 : see if varargs is available
11468 echo " "
11469 if $test `./findhdr varargs.h`; then
11470         echo "<varargs.h> found." >&4
11471 else
11472         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11473 fi
11474
11475 : set up the varargs testing programs
11476 $cat > varargs.c <<EOP
11477 #ifdef I_STDARG
11478 #include <stdarg.h>
11479 #endif
11480 #ifdef I_VARARGS
11481 #include <varargs.h>
11482 #endif
11483
11484 #ifdef I_STDARG
11485 int f(char *p, ...)
11486 #else
11487 int f(va_alist)
11488 va_dcl
11489 #endif
11490 {
11491         va_list ap;
11492 #ifndef I_STDARG
11493         char *p;
11494 #endif
11495 #ifdef I_STDARG
11496         va_start(ap,p);
11497 #else
11498         va_start(ap);
11499         p = va_arg(ap, char *);
11500 #endif
11501         va_end(ap);
11502         return 0;
11503 }
11504 EOP
11505 $cat > varargs <<EOP
11506 $startsh
11507 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11508         echo "true"
11509 else
11510         echo "false"
11511 fi
11512 $rm -f varargs$_o
11513 EOP
11514 chmod +x varargs
11515
11516 : now check which varargs header should be included
11517 echo " "
11518 i_varhdr=''
11519 val=''
11520 case "$valstd" in
11521 "$define")
11522         if `./varargs I_STDARG`; then
11523                 val='stdarg.h'
11524         elif `./varargs I_VARARGS`; then
11525                 val='varargs.h'
11526         fi
11527         ;;
11528 *)
11529         if `./varargs I_VARARGS`; then
11530                 val='varargs.h'
11531         fi
11532         ;;
11533 esac
11534 case "$val" in
11535 '')
11536         echo " "
11537         echo "*** WHOA THERE!!! ***" >&4
11538         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11539         case "$knowitall" in
11540         '')
11541         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11542                 exit 1
11543                 ;;
11544         esac
11545 echo "I could not find the definition for va_dcl... You have problems..." >&4
11546         val="$undef"; set i_stdarg; eval $setvar
11547         val="$undef"; set i_varargs; eval $setvar
11548         ;;
11549 *)
11550         set i_varhdr
11551         eval $setvar
11552         case "$i_varhdr" in
11553         stdarg.h)
11554                 val="$define"; set i_stdarg; eval $setvar
11555                 val="$undef"; set i_varargs; eval $setvar
11556                 ;;
11557         varargs.h)
11558                 val="$undef"; set i_stdarg; eval $setvar
11559                 val="$define"; set i_varargs; eval $setvar
11560                 ;;
11561         esac
11562         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11563 esac
11564 $rm -f varargs*
11565
11566 : see if the Compiler supports C99 variadic macros
11567 case "$i_stdarg$i_stdlib" in
11568     "$define$define")
11569     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11570     $cat >try.c <<EOCP
11571 #include <stdio.h>
11572 #include <stdarg.h>
11573
11574 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11575
11576 int main() {
11577   char buf[20];
11578   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11579   puts(buf);
11580   return 0;
11581 }
11582 EOCP
11583     set try
11584     if eval $compile && $run ./try 2>&1 >/dev/null; then
11585         case "`$run ./try`" in
11586             "123 456 789")
11587             echo "You have C99 variadic macros." >&4
11588             d_c99_variadic_macros="$define"
11589             ;;
11590             *)
11591             echo "You don't have functional C99 variadic macros." >&4
11592             d_c99_variadic_macros="$undef"
11593             ;;
11594         esac
11595     else
11596         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11597         d_c99_variadic_macros="$undef"
11598     fi
11599     $rm_try
11600     ;;
11601     *)
11602     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11603     d_c99_variadic_macros="$undef"
11604     ;;
11605 esac
11606
11607 : see if signal is declared as pointer to function returning int or void
11608 echo " "
11609 xxx=`./findhdr signal.h`
11610 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11611 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11612         echo "You have int (*signal())() instead of void." >&4
11613         val="$undef"
11614 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11615         echo "You have void (*signal())()." >&4
11616         val="$define"
11617 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11618         echo "You have int (*signal())() instead of void." >&4
11619         val="$undef"
11620 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11621         echo "You have void (*signal())()." >&4
11622         val="$define"
11623 else
11624         case "$d_voidsig" in
11625         '')
11626         echo "I can't determine whether signal handler returns void or int..." >&4
11627                 dflt=void
11628                 rp="What type does your signal handler return?"
11629                 . ./myread
11630                 case "$ans" in
11631                 v*) val="$define";;
11632                 *) val="$undef";;
11633                 esac;;
11634         "$define")
11635                 echo "As you already told me, signal handler returns void." >&4
11636                 val="$define"
11637                 ;;
11638         *)      echo "As you already told me, signal handler returns int." >&4
11639                 val="$undef"
11640                 ;;
11641         esac
11642 fi
11643 set d_voidsig
11644 eval $setvar
11645 case "$d_voidsig" in
11646 "$define") signal_t="void";;
11647 *) signal_t="int";;
11648 esac
11649 $rm -f $$.tmp
11650
11651 : check for ability to cast large floats to 32-bit ints.
11652 echo " "
11653 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11654 if $test "$intsize" -ge 4; then
11655         xxx=int
11656 else
11657         xxx=long
11658 fi
11659 $cat >try.c <<EOCP
11660 #include <stdio.h>
11661 #$i_stdlib I_STDLIB
11662 #ifdef I_STDLIB
11663 #include <stdlib.h>
11664 #endif
11665 #include <sys/types.h>
11666 #include <signal.h>
11667 $signal_t blech(int s) { exit(3); }
11668 int main()
11669 {
11670         $xxx i32;
11671         double f, g;
11672         int result = 0;
11673         char str[16];
11674         signal(SIGFPE, blech);
11675
11676         /* Don't let compiler optimize the test away.  Store the number
11677            in a writable string for gcc to pass to sscanf under HP-UX.
11678         */
11679         sprintf(str, "2147483647");
11680         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11681         g = 10 * f;
11682         i32  = ($xxx) g;
11683
11684         /* x86 processors will probably give 0x8000 0000, which is a
11685            sign change.  We don't want that.  We want to mimic SPARC
11686            behavior here, which is to preserve the sign and give
11687            back 0x7fff ffff.
11688         */
11689         if (i32 != ($xxx) f)
11690                 result |= 1;
11691         exit(result);
11692 }
11693 EOCP
11694 set try
11695 if eval $compile_ok; then
11696         $run ./try 2>/dev/null
11697         yyy=$?
11698 else
11699         echo "(I can't seem to compile the test program--assuming it can't)"
11700         yyy=1
11701 fi
11702 case "$yyy" in
11703 0)      val="$define"
11704         echo "Yup, it can."
11705         ;;
11706 *)      val="$undef"
11707         echo "Nope, it can't."
11708         ;;
11709 esac
11710 set d_casti32
11711 eval $setvar
11712 $rm_try
11713
11714 : check for ability to cast negative floats to unsigned
11715 echo " "
11716 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11717 $cat >try.c <<EOCP
11718 #include <stdio.h>
11719 #$i_stdlib I_STDLIB
11720 #ifdef I_STDLIB
11721 #include <stdlib.h>
11722 #endif
11723 #include <sys/types.h>
11724 #include <signal.h>
11725 $signal_t blech(int s) { exit(7); }
11726 $signal_t blech_in_list(int s) { exit(4); }
11727 unsigned long dummy_long(unsigned long p) { return p; }
11728 unsigned int dummy_int(unsigned int p) { return p; }
11729 unsigned short dummy_short(unsigned short p) { return p; }
11730 int main()
11731 {
11732         double f;
11733         unsigned long along;
11734         unsigned int aint;
11735         unsigned short ashort;
11736         int result = 0;
11737         char str[16];
11738
11739         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11740            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11741            optimized the whole file away
11742         */
11743         /* Store the number in a writable string for gcc to pass to
11744            sscanf under HP-UX.
11745         */
11746         sprintf(str, "-123");
11747         sscanf(str, "%lf", &f);  /* f = -123.; */
11748
11749         signal(SIGFPE, blech);
11750         along = (unsigned long)f;
11751         aint = (unsigned int)f;
11752         ashort = (unsigned short)f;
11753         if (along != (unsigned long)-123)
11754                 result |= 1;
11755         if (aint != (unsigned int)-123)
11756                 result |= 1;
11757         if (ashort != (unsigned short)-123)
11758                 result |= 1;
11759         sprintf(str, "1073741824.");
11760         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11761         f = f + f;
11762         along = 0;
11763         along = (unsigned long)f;
11764         if (along != 0x80000000)
11765                 result |= 2;
11766         f -= 1.;
11767         along = 0;
11768         along = (unsigned long)f;
11769         if (along != 0x7fffffff)
11770                 result |= 1;
11771         f += 2.;
11772         along = 0;
11773         along = (unsigned long)f;
11774         if (along != 0x80000001)
11775                 result |= 2;
11776         if (result)
11777                 exit(result);
11778         signal(SIGFPE, blech_in_list);
11779         sprintf(str, "123.");
11780         sscanf(str, "%lf", &f);  /* f = 123.; */
11781         along = dummy_long((unsigned long)f);
11782         aint = dummy_int((unsigned int)f);
11783         ashort = dummy_short((unsigned short)f);
11784         if (along != (unsigned long)123)
11785                 result |= 4;
11786         if (aint != (unsigned int)123)
11787                 result |= 4;
11788         if (ashort != (unsigned short)123)
11789                 result |= 4;
11790         exit(result);
11791
11792 }
11793 EOCP
11794 set try
11795 if eval $compile_ok; then
11796         $run ./try 2>/dev/null
11797         castflags=$?
11798 else
11799         echo "(I can't seem to compile the test program--assuming it can't)"
11800         castflags=7
11801 fi
11802 case "$castflags" in
11803 0)      val="$define"
11804         echo "Yup, it can."
11805         ;;
11806 *)      val="$undef"
11807         echo "Nope, it can't."
11808         ;;
11809 esac
11810 set d_castneg
11811 eval $setvar
11812 $rm_try
11813
11814 : see if cbrt exists
11815 set cbrt d_cbrt
11816 eval $inlibc
11817
11818 : see if vprintf exists
11819 echo " "
11820 if set vprintf val -f d_vprintf; eval $csym; $val; then
11821         echo 'vprintf() found.' >&4
11822         val="$define"
11823         $cat >try.c <<EOF
11824 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11825 #$i_varargs I_VARARGS
11826
11827 #$i_stdlib I_STDLIB
11828 #$i_unistd I_UNISTD
11829
11830 #ifdef I_STDARG
11831 #  include <stdarg.h>
11832 #else /* I_VARARGS */
11833 #  include <varargs.h>
11834 #endif
11835
11836 #ifdef I_UNISTD
11837 #  include <unistd.h>
11838 #endif
11839
11840 #ifdef I_STDLIB
11841 #  include <stdlib.h>
11842 #endif
11843
11844 #include <stdio.h> /* vsprintf prototype */
11845
11846 #ifdef I_STDARG
11847 void xxx(int n, ...)
11848 {
11849     va_list args;
11850     char buf[10];
11851     va_start(args, n);
11852     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11853 }
11854 int main() { xxx(1, "foo"); }
11855
11856 #else /* I_VARARGS */
11857
11858 xxx(va_alist)
11859 va_dcl
11860 {
11861     va_list args;
11862     char buf[10];
11863     va_start(args);
11864     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11865 }
11866 int main() { xxx("foo"); }
11867
11868 #endif
11869
11870 EOF
11871         set try
11872         if eval $compile_ok; then
11873                 if $run ./try; then
11874                         echo "Your vsprintf() returns (int)." >&4
11875                         val2="$undef"
11876                 else
11877                         echo "Your vsprintf() returns (char*)." >&4
11878                         val2="$define"
11879                 fi
11880         else
11881                 echo 'I am unable to compile the vsprintf() test program.' >&4
11882                 # We shouldn't get here.  If we do, assume the standard signature,
11883                 # not the old BSD one.
11884                 echo 'Guessing that vsprintf() returns (int).' >&4
11885                 val2="$undef"
11886         fi
11887 else
11888         echo 'vprintf() NOT found.' >&4
11889         val="$undef"
11890         val2="$undef"
11891 fi
11892 $rm_try
11893 set d_vprintf
11894 eval $setvar
11895 val=$val2
11896 set d_charvspr
11897 eval $setvar
11898
11899 : see if chown exists
11900 set chown d_chown
11901 eval $inlibc
11902
11903 : see if chroot exists
11904 set chroot d_chroot
11905 eval $inlibc
11906
11907 : see if chsize exists
11908 set chsize d_chsize
11909 eval $inlibc
11910
11911 : see if class exists
11912 set class d_class
11913 eval $inlibc
11914
11915 : see if clearenv exists
11916 set clearenv d_clearenv
11917 eval $inlibc
11918
11919 : Define hasstruct macro for Configure internal use
11920 hasstruct='varname=$1; struct=$2; shift; shift;
11921 while $test $# -ge 2; do
11922         case "$1" in
11923         $define) echo "#include <$2>";;
11924         esac ;
11925     shift 2;
11926 done > try.c;
11927 echo "int main () { struct $struct foo; }" >> try.c;
11928 set try;
11929 if eval $compile; then
11930         val="$define";
11931 else
11932         val="$undef";
11933 fi;
11934 set $varname;
11935 eval $setvar;
11936 $rm_try'
11937
11938 : see whether socket exists
11939 socketlib=''
11940 sockethdr=''
11941 echo " "
11942 $echo $n "Hmm... $c" >&4
11943 if set socket val -f d_socket; eval $csym; $val; then
11944     echo "Looks like you have Berkeley networking support." >&4
11945     d_socket="$define"
11946     if set setsockopt val -f; eval $csym; $val; then
11947         d_oldsock="$undef"
11948     else
11949         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11950         d_oldsock="$define"
11951     fi
11952 else
11953     if $contains socklib libc.list >/dev/null 2>&1; then
11954         echo "Looks like you have Berkeley networking support." >&4
11955         d_socket="$define"
11956         : we will have to assume that it supports the 4.2 BSD interface
11957         d_oldsock="$undef"
11958     else
11959         echo "You don't have Berkeley networking in libc$_a..." >&4
11960         if test "X$d_socket" = "X$define"; then
11961             echo "...but you seem to believe that you have sockets." >&4
11962         else
11963             for net in net socket
11964             do
11965                 if test -f $sysroot/usr/lib/lib$net$_a; then
11966                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11967                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11968                     if $contains socket libc.list >/dev/null 2>&1; then
11969                         d_socket="$define"
11970                         socketlib="-l$net"
11971                         case "$net" in
11972                         net)
11973                             echo "...but the Wollongong group seems to have hacked it in." >&4
11974                             sockethdr="-I$sysroot/usr/netinclude"
11975                             ;;
11976                         esac
11977                         echo "Found Berkeley sockets interface in lib$net." >&4
11978                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11979                             d_oldsock="$undef"
11980                         else
11981                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11982                             d_oldsock="$define"
11983                         fi
11984                         break
11985                     fi
11986                 fi
11987             done
11988             if test "X$d_socket" != "X$define"; then
11989                echo "or anywhere else I see." >&4
11990                d_socket="$undef"
11991                d_oldsock="$undef"
11992             fi
11993         fi
11994     fi
11995 fi
11996
11997 : see if socketpair exists
11998 set socketpair d_sockpair
11999 eval $inlibc
12000
12001
12002 echo " "
12003 echo "Checking the availability sa_len in the sock struct ..." >&4
12004 $cat >try.c <<EOF
12005 #include <sys/types.h>
12006 #include <sys/socket.h>
12007 int main() {
12008 struct sockaddr sa;
12009 return (sa.sa_len);
12010 }
12011 EOF
12012 val="$undef"
12013 set try; if eval $compile; then
12014     val="$define"
12015 fi
12016 set d_sockaddr_sa_len; eval $setvar
12017 $rm_try
12018
12019 echo " "
12020 echo "Checking the availability struct sockaddr_in6 ..." >&4
12021 $cat >try.c <<EOF
12022 #include <sys/types.h>
12023 #include <sys/socket.h>
12024 #include <netinet/in.h>
12025 int main() {
12026 struct sockaddr_in6 sin6;
12027 return (sin6.sin6_family);
12028 }
12029 EOF
12030 val="$undef"
12031 set try; if eval $compile; then
12032     val="$define"
12033 fi
12034 set d_sockaddr_in6; eval $setvar
12035 $rm_try
12036
12037 echo " "
12038 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12039 $cat >try.c <<EOF
12040 #include <sys/types.h>
12041 #include <sys/socket.h>
12042 #include <netinet/in.h>
12043 int main() {
12044 struct sockaddr_in6 sin6;
12045 return (sin6.sin6_scope_id);
12046 }
12047 EOF
12048 val="$undef"
12049 set try; if eval $compile; then
12050     val="$define"
12051 fi
12052 set d_sin6_scope_id; eval $setvar
12053 $rm_try
12054
12055 echo " "
12056 echo "Checking the availability struct ip_mreq ..." >&4
12057 $cat >try.c <<EOF
12058 #include <sys/types.h>
12059 #include <sys/socket.h>
12060 #include <netinet/in.h>
12061 int main() {
12062 struct ip_mreq mreq;
12063 return (mreq.imr_multiaddr.s_addr);
12064 }
12065 EOF
12066 val="$undef"
12067 set try; if eval $compile; then
12068        val="$define"
12069 fi
12070 set d_ip_mreq; eval $setvar
12071 $rm_try
12072
12073 echo " "
12074 echo "Checking the availability struct ip_mreq_source ..." >&4
12075 $cat >try.c <<EOF
12076 #include <sys/types.h>
12077 #include <sys/socket.h>
12078 #include <netinet/in.h>
12079 int main() {
12080 struct ip_mreq_source mreq;
12081 return (mreq.imr_multiaddr.s_addr);
12082 }
12083 EOF
12084 val="$undef"
12085 set try; if eval $compile; then
12086        val="$define"
12087 fi
12088 set d_ip_mreq_source; eval $setvar
12089 $rm_try
12090
12091 echo " "
12092 echo "Checking the availability struct ipv6_mreq ..." >&4
12093 $cat >try.c <<EOF
12094 #include <sys/types.h>
12095 #include <sys/socket.h>
12096 #include <netinet/in.h>
12097 int main() {
12098 struct ipv6_mreq mreq;
12099 return (mreq.ipv6mr_interface);
12100 }
12101 EOF
12102 val="$undef"
12103 set try; if eval $compile; then
12104     val="$define"
12105 fi
12106 set d_ipv6_mreq; eval $setvar
12107 $rm_try
12108
12109 echo " "
12110 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12111 $cat >try.c <<EOF
12112 #include <sys/types.h>
12113 #include <sys/socket.h>
12114 #include <netinet/in.h>
12115 int main() {
12116 struct ipv6_mreq_source mreq;
12117 return (mreq.imr_multiaddr.s_addr);
12118 }
12119 EOF
12120 val="$undef"
12121 set try; if eval $compile; then
12122        val="$define"
12123 fi
12124 set d_ipv6_mreq_source; eval $setvar
12125 $rm_try
12126
12127 echo " "
12128 echo "Checking the availability of certain socket constants..." >&4
12129 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12130     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12131     $cat >try.c <<EOF
12132 #include <sys/types.h>
12133 #include <sys/socket.h>
12134 int main() {
12135     int i = $ENUM;
12136 }
12137 EOF
12138     val="$undef"
12139     set try; if eval $compile; then
12140         val="$define"
12141     fi
12142     set d_${enum}; eval $setvar
12143     $rm_try
12144 done
12145
12146 : see if this is a sys/uio.h system
12147 set sys/uio.h i_sysuio
12148 eval $inhdr
12149
12150 : Check for cmsghdr support
12151 echo " "
12152 echo "Checking to see if your system supports struct cmsghdr..." >&4
12153 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12154 eval $hasstruct
12155 case "$d_cmsghdr_s" in
12156 "$define")      echo "Yes, it does."   ;;
12157 *)              echo "No, it doesn't." ;;
12158 esac
12159
12160
12161 : check for const keyword
12162 echo " "
12163 echo 'Checking to see if your C compiler knows about "const"...' >&4
12164 $cat >const.c <<'EOCP'
12165 typedef struct spug { int drokk; } spug;
12166 int main()
12167 {
12168         const char *foo;
12169         const spug y = { 0 };
12170 }
12171 EOCP
12172 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12173         val="$define"
12174         echo "Yup, it does."
12175 else
12176         val="$undef"
12177         echo "Nope, it doesn't."
12178 fi
12179 set d_const
12180 eval $setvar
12181
12182 : see if copysign exists
12183 set copysign d_copysign
12184 eval $inlibc
12185
12186 : see if copysignl exists
12187 set copysignl d_copysignl
12188 eval $inlibc
12189
12190 : see if crypt exists
12191 echo " "
12192 set crypt d_crypt
12193 eval $inlibc
12194 case "$d_crypt" in
12195 $define) cryptlib='' ;;
12196 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12197                 echo 'crypt() found.' >&4
12198                 val="$define"
12199                 cryptlib=''
12200         else
12201                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12202                 if $test -z "$cryptlib"; then
12203                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12204                 else
12205                         cryptlib=-lcrypt
12206                 fi
12207                 if $test -z "$cryptlib"; then
12208                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12209                 else
12210                         cryptlib=-lcrypt
12211                 fi
12212                 if $test -z "$cryptlib"; then
12213                         cryptlib=`./loc libcrypt$_a "" $libpth`
12214                 else
12215                         cryptlib=-lcrypt
12216                 fi
12217                 if $test -z "$cryptlib"; then
12218                         echo 'crypt() NOT found.' >&4
12219                         val="$undef"
12220                 else
12221                         val="$define"
12222                 fi
12223         fi
12224         set d_crypt
12225         eval $setvar
12226         ;;
12227 esac
12228
12229 : see if this is a crypt.h system
12230 set crypt.h i_crypt
12231 eval $inhdr
12232
12233 : see if crypt_r exists
12234 set crypt_r d_crypt_r
12235 eval $inlibc
12236 case "$d_crypt_r" in
12237 "$define")
12238         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12239         case "$d_crypt_r_proto:$usethreads" in
12240         ":define")      d_crypt_r_proto=define
12241                 set d_crypt_r_proto crypt_r $hdrs
12242                 eval $hasproto ;;
12243         *)      ;;
12244         esac
12245         case "$d_crypt_r_proto" in
12246         define)
12247         case "$crypt_r_proto" in
12248         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12249         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12250         esac
12251         case "$crypt_r_proto" in
12252         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12253         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12254         esac
12255         case "$crypt_r_proto" in
12256         ''|0)   d_crypt_r=undef
12257                 crypt_r_proto=0
12258                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12259         * )     case "$crypt_r_proto" in
12260                 REENTRANT_PROTO*) ;;
12261                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12262                 esac
12263                 echo "Prototype: $try" ;;
12264         esac
12265         ;;
12266         *)      case "$usethreads" in
12267                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12268                 esac
12269                 d_crypt_r=undef
12270                 crypt_r_proto=0
12271                 ;;
12272         esac
12273         ;;
12274 *)      crypt_r_proto=0
12275         ;;
12276 esac
12277
12278 : get csh whereabouts
12279 case "$csh" in
12280 'csh') val="$undef" ;;
12281 *) val="$define" ;;
12282 esac
12283 set d_csh
12284 eval $setvar
12285 : Respect a hint or command line value for full_csh.
12286 case "$full_csh" in
12287 '') full_csh=$csh ;;
12288 esac
12289
12290 : see if ctermid exists
12291 set ctermid d_ctermid
12292 eval $inlibc
12293
12294 : see if ctermid_r exists
12295 set ctermid_r d_ctermid_r
12296 eval $inlibc
12297 case "$d_ctermid_r" in
12298 "$define")
12299         hdrs="$i_systypes sys/types.h define stdio.h "
12300         case "$d_ctermid_r_proto:$usethreads" in
12301         ":define")      d_ctermid_r_proto=define
12302                 set d_ctermid_r_proto ctermid_r $hdrs
12303                 eval $hasproto ;;
12304         *)      ;;
12305         esac
12306         case "$d_ctermid_r_proto" in
12307         define)
12308         case "$ctermid_r_proto" in
12309         ''|0) try='char* ctermid_r(char*);'
12310         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12311         esac
12312         case "$ctermid_r_proto" in
12313         ''|0)   d_ctermid_r=undef
12314                 ctermid_r_proto=0
12315                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12316         * )     case "$ctermid_r_proto" in
12317                 REENTRANT_PROTO*) ;;
12318                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12319                 esac
12320                 echo "Prototype: $try" ;;
12321         esac
12322         ;;
12323         *)      case "$usethreads" in
12324                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12325                 esac
12326                 d_ctermid_r=undef
12327                 ctermid_r_proto=0
12328                 ;;
12329         esac
12330         ;;
12331 *)      ctermid_r_proto=0
12332         ;;
12333 esac
12334
12335 : see if ctime_r exists
12336 set ctime_r d_ctime_r
12337 eval $inlibc
12338 case "$d_ctime_r" in
12339 "$define")
12340         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12341         case "$d_ctime_r_proto:$usethreads" in
12342         ":define")      d_ctime_r_proto=define
12343                 set d_ctime_r_proto ctime_r $hdrs
12344                 eval $hasproto ;;
12345         *)      ;;
12346         esac
12347         case "$d_ctime_r_proto" in
12348         define)
12349         case "$ctime_r_proto" in
12350         ''|0) try='char* ctime_r(const time_t*, char*);'
12351         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12352         esac
12353         case "$ctime_r_proto" in
12354         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12355         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12356         esac
12357         case "$ctime_r_proto" in
12358         ''|0) try='int ctime_r(const time_t*, char*);'
12359         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12360         esac
12361         case "$ctime_r_proto" in
12362         ''|0) try='int ctime_r(const time_t*, char*, int);'
12363         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12364         esac
12365         case "$ctime_r_proto" in
12366         ''|0)   d_ctime_r=undef
12367                 ctime_r_proto=0
12368                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12369         * )     case "$ctime_r_proto" in
12370                 REENTRANT_PROTO*) ;;
12371                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12372                 esac
12373                 echo "Prototype: $try" ;;
12374         esac
12375         ;;
12376         *)      case "$usethreads" in
12377                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12378                 esac
12379                 d_ctime_r=undef
12380                 ctime_r_proto=0
12381                 ;;
12382         esac
12383         ;;
12384 *)      ctime_r_proto=0
12385         ;;
12386 esac
12387
12388 : see if cuserid exists
12389 set cuserid d_cuserid
12390 eval $inlibc
12391
12392 : see if this is a limits.h system
12393 set limits.h i_limits
12394 eval $inhdr
12395
12396 : See if number of significant digits in a double precision number is known
12397 echo " "
12398 $cat >dbl_dig.c <<EOM
12399 #$i_limits I_LIMITS
12400 #$i_float I_FLOAT
12401 #ifdef I_LIMITS
12402 #include <limits.h>
12403 #endif
12404 #ifdef I_FLOAT
12405 #include <float.h>
12406 #endif
12407 #ifdef DBL_DIG
12408 printf("Contains DBL_DIG");
12409 #endif
12410 EOM
12411 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12412 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12413         echo "DBL_DIG found." >&4
12414         val="$define"
12415 else
12416         echo "DBL_DIG NOT found." >&4
12417         val="$undef"
12418 fi
12419 $rm -f dbl_dig.?
12420 set d_dbl_dig
12421 eval $setvar
12422
12423 : see if dbm.h is available
12424 : see if dbmclose exists
12425 set dbmclose d_dbmclose
12426 eval $inlibc
12427
12428 case "$d_dbmclose" in
12429 $define)
12430         set dbm.h i_dbm
12431         eval $inhdr
12432         case "$i_dbm" in
12433         $define)
12434                 val="$undef"
12435                 set i_rpcsvcdbm
12436                 eval $setvar
12437                 ;;
12438         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12439                 eval $inhdr
12440                 ;;
12441         esac
12442         ;;
12443 *)      echo "We won't be including <dbm.h>"
12444         val="$undef"
12445         set i_dbm
12446         eval $setvar
12447         val="$undef"
12448         set i_rpcsvcdbm
12449         eval $setvar
12450         ;;
12451 esac
12452
12453 : see if prototype for dbminit is available
12454 echo " "
12455 set d_dbminitproto dbminit $i_dbm dbm.h
12456 eval $hasproto
12457
12458 : see if difftime exists
12459 set difftime d_difftime
12460 eval $inlibc
12461
12462 : see if this is a dirent system
12463 echo " "
12464 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12465         val="$define"
12466         echo "<dirent.h> found." >&4
12467 else
12468         val="$undef"
12469         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12470                 echo "<sys/dir.h> found." >&4
12471                 echo " "
12472         else
12473                 xinc=`./findhdr sys/ndir.h`
12474         fi
12475         echo "<dirent.h> NOT found." >&4
12476 fi
12477 set i_dirent
12478 eval $setvar
12479
12480 : Look for type of directory structure.
12481 echo " "
12482 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12483
12484 case "$direntrytype" in
12485 ''|' ')
12486         case "$i_dirent" in
12487         $define) guess1='struct dirent' ;;
12488         *) guess1='struct direct'  ;;
12489         esac
12490         ;;
12491 *)      guess1="$direntrytype"
12492         ;;
12493 esac
12494
12495 case "$guess1" in
12496 'struct dirent') guess2='struct direct' ;;
12497 *) guess2='struct dirent' ;;
12498 esac
12499
12500 if $contains "$guess1" try.c >/dev/null 2>&1; then
12501         direntrytype="$guess1"
12502         echo "Your directory entries are $direntrytype." >&4
12503 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12504         direntrytype="$guess2"
12505         echo "Your directory entries seem to be $direntrytype." >&4
12506 else
12507         echo "I don't recognize your system's directory entries." >&4
12508         rp="What type is used for directory entries on this system?"
12509         dflt="$guess1"
12510         . ./myread
12511         direntrytype="$ans"
12512 fi
12513 $rm_try
12514
12515 : see if the directory entry stores field length
12516 echo " "
12517 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12518 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12519         echo "Good, your directory entry keeps length information in d_namlen." >&4
12520         val="$define"
12521 else
12522         echo "Your directory entry does not know about the d_namlen field." >&4
12523         val="$undef"
12524 fi
12525 set d_dirnamlen
12526 eval $setvar
12527 $rm_try
12528
12529 : Look for DIR.dd_fd
12530 case "$i_dirent" in
12531 "$define")
12532     echo "Checking to see if DIR has a dd_fd member variable" >&4
12533     $cat >try.c <<EOCP
12534 #$i_stdlib I_STDLIB
12535 #ifdef I_STDLIB
12536 #include <stdlib.h>
12537 #endif
12538 #include <dirent.h>
12539
12540 int main() {
12541     DIR dir;
12542     dir.dd_fd = 1;
12543     return 0;
12544 }
12545 EOCP
12546     val=$undef
12547     set try
12548     if eval $compile; then
12549         echo "Yes, it does."
12550         val="$define"
12551     else
12552         echo "No, it does not."
12553         val="$undef"
12554     fi
12555     ;;
12556 *)
12557     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12558     val="$undef"
12559     ;;
12560 esac
12561 set d_dir_dd_fd
12562 eval $setvar
12563 $rm_try
12564
12565 : see if this is an sysdir system
12566 set sys/dir.h i_sysdir
12567 eval $inhdr
12568
12569 : see if this is an sysndir system
12570 set sys/ndir.h i_sysndir
12571 eval $inhdr
12572
12573 : Look for dirfd
12574 echo " "
12575 $cat >dirfd.c <<EOM
12576 #include <stdio.h>
12577 #$i_stdlib I_STDLIB
12578 #ifdef I_STDLIB
12579 #include <stdlib.h>
12580 #endif
12581 #$i_dirent I_DIRENT             /**/
12582 #$i_sysdir I_SYS_DIR            /**/
12583 #$i_sysndir I_SYS_NDIR          /**/
12584 #$i_systypes I_SYS_TYPES        /**/
12585 #if defined(I_SYS_TYPES)
12586 #include <sys/types.h>
12587 #endif
12588 #if defined(I_DIRENT)
12589 #include <dirent.h>
12590 #else
12591 #ifdef I_SYS_NDIR
12592 #include <sys/ndir.h>
12593 #else
12594 #ifdef I_SYS_DIR
12595 #ifdef hp9000s500
12596 #include <ndir.h>       /* may be wrong in the future */
12597 #else
12598 #include <sys/dir.h>
12599 #endif
12600 #endif
12601 #endif
12602 #endif
12603 int main() {
12604         DIR *dirp = opendir(".");
12605         if (dirfd(dirp) >= 0)
12606                 exit(0);
12607         else
12608                 exit(1);
12609 }
12610 EOM
12611 val=$undef
12612 set dirfd
12613 if eval $compile; then
12614         val="$define"
12615 fi
12616 case "$val" in
12617 $define)        echo "dirfd() found." >&4       ;;
12618 *)              echo "dirfd() NOT found." >&4   ;;
12619 esac
12620 set d_dirfd
12621 eval $setvar
12622 $rm -f dirfd*
12623
12624 : see if dladdr exists
12625 set dladdr d_dladdr
12626 eval $inlibc
12627
12628 : see if dlerror exists
12629 xxx_runnm="$runnm"
12630 runnm=false
12631 set dlerror d_dlerror
12632 eval $inlibc
12633 runnm="$xxx_runnm"
12634
12635 : see if dlfcn is available
12636 set dlfcn.h i_dlfcn
12637 eval $inhdr
12638
12639 : Check what extension to use for shared libs
12640 case "$usedl" in
12641 $define|y|true)
12642         $cat << EOM
12643
12644 On a few systems, the dynamically loaded modules that perl generates and uses
12645 will need a different extension than shared libs. The default will probably
12646 be appropriate.
12647
12648 EOM
12649         case "$dlext" in
12650         '')     dflt="$so" ;;
12651         *)      dflt="$dlext" ;;
12652         esac
12653         rp='What is the extension of dynamically loaded modules'
12654         . ./myread
12655         dlext="$ans"
12656         ;;
12657 *)
12658         dlext="none"
12659         ;;
12660 esac
12661
12662 : Check if dlsym need a leading underscore
12663 echo " "
12664 val="$undef"
12665
12666 case "$dlsrc" in
12667 dl_dlopen.xs)
12668         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12669         $cat >dyna.c <<'EOM'
12670 fred () { }
12671 EOM
12672
12673 $cat >fred.c<<EOM
12674
12675 #include <stdio.h>
12676 #$i_stdlib I_STDLIB
12677 #ifdef I_STDLIB
12678 #include <stdlib.h>
12679 #endif
12680 #$i_dlfcn I_DLFCN
12681 #ifdef I_DLFCN
12682 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12683 #else
12684 #include <sys/types.h>
12685 #include <nlist.h>
12686 #include <link.h>
12687 #endif
12688
12689 extern int fred() ;
12690
12691 int main()
12692 {
12693     void * handle ;
12694     void * symbol ;
12695 #ifndef RTLD_LAZY
12696     int mode = 1 ;
12697 #else
12698     int mode = RTLD_LAZY ;
12699 #endif
12700     handle = dlopen("./dyna.$dlext", mode) ;
12701     if (handle == NULL) {
12702         printf ("1\n") ;
12703         fflush (stdout) ;
12704         exit(0);
12705     }
12706     symbol = dlsym(handle, "fred") ;
12707     if (symbol == NULL) {
12708         /* try putting a leading underscore */
12709         symbol = dlsym(handle, "_fred") ;
12710         if (symbol == NULL) {
12711             printf ("2\n") ;
12712             fflush (stdout) ;
12713             exit(0);
12714         }
12715         printf ("3\n") ;
12716     }
12717     else
12718         printf ("4\n") ;
12719     fflush (stdout) ;
12720     exit(0);
12721 }
12722 EOM
12723         : Call the object file tmp-dyna.o in case dlext=o.
12724         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12725                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12726                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12727                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12728                 xxx=`$run ./fred`
12729                 case $xxx in
12730                 1)      echo "Test program failed using dlopen." >&4
12731                         echo "Perhaps you should not use dynamic loading." >&4;;
12732                 2)      echo "Test program failed using dlsym." >&4
12733                         echo "Perhaps you should not use dynamic loading." >&4;;
12734                 3)      echo "dlsym needs a leading underscore" >&4
12735                         val="$define" ;;
12736                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12737                 esac
12738         else
12739                 echo "I can't compile and run the test program." >&4
12740                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12741         fi
12742         ;;
12743 esac
12744
12745 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12746
12747 set d_dlsymun
12748 eval $setvar
12749
12750 : see if drand48_r exists
12751 set drand48_r d_drand48_r
12752 eval $inlibc
12753 case "$d_drand48_r" in
12754 "$define")
12755         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12756         case "$d_drand48_r_proto:$usethreads" in
12757         ":define")      d_drand48_r_proto=define
12758                 set d_drand48_r_proto drand48_r $hdrs
12759                 eval $hasproto ;;
12760         *)      ;;
12761         esac
12762         case "$d_drand48_r_proto" in
12763         define)
12764         case "$drand48_r_proto" in
12765         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12766         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12767         esac
12768         case "$drand48_r_proto" in
12769         ''|0)   d_drand48_r=undef
12770                 drand48_r_proto=0
12771                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12772         * )     case "$drand48_r_proto" in
12773                 REENTRANT_PROTO*) ;;
12774                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12775                 esac
12776                 echo "Prototype: $try" ;;
12777         esac
12778         ;;
12779         *)      case "$usethreads" in
12780                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12781                 esac
12782                 d_drand48_r=undef
12783                 drand48_r_proto=0
12784                 ;;
12785         esac
12786         ;;
12787 *)      drand48_r_proto=0
12788         ;;
12789 esac
12790
12791 : see if prototype for drand48 is available
12792 echo " "
12793 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12794 eval $hasproto
12795
12796 : see if dup2 exists
12797 set dup2 d_dup2
12798 eval $inlibc
12799
12800 : see if eaccess exists
12801 set eaccess d_eaccess
12802 eval $inlibc
12803
12804 : see if endgrent exists
12805 set endgrent d_endgrent
12806 eval $inlibc
12807
12808 : see if this is an grp system
12809 set grp.h i_grp
12810 eval $inhdr
12811
12812 case "$i_grp" in
12813 $define)
12814         xxx=`./findhdr grp.h`
12815         $cppstdin $cppflags $cppminus < $xxx >$$.h
12816
12817         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12818                 val="$define"
12819         else
12820                 val="$undef"
12821         fi
12822         set d_grpasswd
12823         eval $setvar
12824
12825         $rm -f $$.h
12826         ;;
12827 *)
12828         val="$undef";
12829         set d_grpasswd; eval $setvar
12830         ;;
12831 esac
12832
12833 : see if endgrent_r exists
12834 set endgrent_r d_endgrent_r
12835 eval $inlibc
12836 case "$d_endgrent_r" in
12837 "$define")
12838         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12839         case "$d_endgrent_r_proto:$usethreads" in
12840         ":define")      d_endgrent_r_proto=define
12841                 set d_endgrent_r_proto endgrent_r $hdrs
12842                 eval $hasproto ;;
12843         *)      ;;
12844         esac
12845         case "$d_endgrent_r_proto" in
12846         define)
12847         case "$endgrent_r_proto" in
12848         ''|0) try='int endgrent_r(FILE**);'
12849         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12850         esac
12851         case "$endgrent_r_proto" in
12852         ''|0) try='void endgrent_r(FILE**);'
12853         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12854         esac
12855         case "$endgrent_r_proto" in
12856         ''|0)   d_endgrent_r=undef
12857                 endgrent_r_proto=0
12858                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12859         * )     case "$endgrent_r_proto" in
12860                 REENTRANT_PROTO*) ;;
12861                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12862                 esac
12863                 echo "Prototype: $try" ;;
12864         esac
12865         ;;
12866         *)      case "$usethreads" in
12867                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12868                 esac
12869                 d_endgrent_r=undef
12870                 endgrent_r_proto=0
12871                 ;;
12872         esac
12873         ;;
12874 *)      endgrent_r_proto=0
12875         ;;
12876 esac
12877
12878 : see if endhostent exists
12879 set endhostent d_endhent
12880 eval $inlibc
12881
12882 : see if this is a netdb.h system
12883 set netdb.h i_netdb
12884 eval $inhdr
12885
12886 : see if endhostent_r exists
12887 set endhostent_r d_endhostent_r
12888 eval $inlibc
12889 case "$d_endhostent_r" in
12890 "$define")
12891         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12892         case "$d_endhostent_r_proto:$usethreads" in
12893         ":define")      d_endhostent_r_proto=define
12894                 set d_endhostent_r_proto endhostent_r $hdrs
12895                 eval $hasproto ;;
12896         *)      ;;
12897         esac
12898         case "$d_endhostent_r_proto" in
12899         define)
12900         case "$endhostent_r_proto" in
12901         ''|0) try='int endhostent_r(struct hostent_data*);'
12902         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12903         esac
12904         case "$endhostent_r_proto" in
12905         ''|0) try='void endhostent_r(struct hostent_data*);'
12906         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12907         esac
12908         case "$endhostent_r_proto" in
12909         ''|0)   d_endhostent_r=undef
12910                 endhostent_r_proto=0
12911                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12912         * )     case "$endhostent_r_proto" in
12913                 REENTRANT_PROTO*) ;;
12914                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12915                 esac
12916                 echo "Prototype: $try" ;;
12917         esac
12918         ;;
12919         *)      case "$usethreads" in
12920                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12921                 esac
12922                 d_endhostent_r=undef
12923                 endhostent_r_proto=0
12924                 ;;
12925         esac
12926         ;;
12927 *)      endhostent_r_proto=0
12928         ;;
12929 esac
12930
12931 : see if endnetent exists
12932 set endnetent d_endnent
12933 eval $inlibc
12934
12935 : see if endnetent_r exists
12936 set endnetent_r d_endnetent_r
12937 eval $inlibc
12938 case "$d_endnetent_r" in
12939 "$define")
12940         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12941         case "$d_endnetent_r_proto:$usethreads" in
12942         ":define")      d_endnetent_r_proto=define
12943                 set d_endnetent_r_proto endnetent_r $hdrs
12944                 eval $hasproto ;;
12945         *)      ;;
12946         esac
12947         case "$d_endnetent_r_proto" in
12948         define)
12949         case "$endnetent_r_proto" in
12950         ''|0) try='int endnetent_r(struct netent_data*);'
12951         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12952         esac
12953         case "$endnetent_r_proto" in
12954         ''|0) try='void endnetent_r(struct netent_data*);'
12955         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12956         esac
12957         case "$endnetent_r_proto" in
12958         ''|0)   d_endnetent_r=undef
12959                 endnetent_r_proto=0
12960                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12961         * )     case "$endnetent_r_proto" in
12962                 REENTRANT_PROTO*) ;;
12963                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12964                 esac
12965                 echo "Prototype: $try" ;;
12966         esac
12967         ;;
12968         *)      case "$usethreads" in
12969                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12970                 esac
12971                 d_endnetent_r=undef
12972                 endnetent_r_proto=0
12973                 ;;
12974         esac
12975         ;;
12976 *)      endnetent_r_proto=0
12977         ;;
12978 esac
12979
12980 : see if endprotoent exists
12981 set endprotoent d_endpent
12982 eval $inlibc
12983
12984 : see if endprotoent_r exists
12985 set endprotoent_r d_endprotoent_r
12986 eval $inlibc
12987 case "$d_endprotoent_r" in
12988 "$define")
12989         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12990         case "$d_endprotoent_r_proto:$usethreads" in
12991         ":define")      d_endprotoent_r_proto=define
12992                 set d_endprotoent_r_proto endprotoent_r $hdrs
12993                 eval $hasproto ;;
12994         *)      ;;
12995         esac
12996         case "$d_endprotoent_r_proto" in
12997         define)
12998         case "$endprotoent_r_proto" in
12999         ''|0) try='int endprotoent_r(struct protoent_data*);'
13000         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13001         esac
13002         case "$endprotoent_r_proto" in
13003         ''|0) try='void endprotoent_r(struct protoent_data*);'
13004         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13005         esac
13006         case "$endprotoent_r_proto" in
13007         ''|0)   d_endprotoent_r=undef
13008                 endprotoent_r_proto=0
13009                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13010         * )     case "$endprotoent_r_proto" in
13011                 REENTRANT_PROTO*) ;;
13012                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13013                 esac
13014                 echo "Prototype: $try" ;;
13015         esac
13016         ;;
13017         *)      case "$usethreads" in
13018                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13019                 esac
13020                 d_endprotoent_r=undef
13021                 endprotoent_r_proto=0
13022                 ;;
13023         esac
13024         ;;
13025 *)      endprotoent_r_proto=0
13026         ;;
13027 esac
13028
13029 : see if endpwent exists
13030 set endpwent d_endpwent
13031 eval $inlibc
13032
13033 : see if this is a pwd.h system
13034 set pwd.h i_pwd
13035 eval $inhdr
13036
13037 case "$i_pwd" in
13038 $define)
13039         xxx=`./findhdr pwd.h`
13040         $cppstdin $cppflags $cppminus < $xxx >$$.h
13041
13042         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13043                 val="$define"
13044         else
13045                 val="$undef"
13046         fi
13047         set d_pwquota
13048         eval $setvar
13049
13050         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13051                 val="$define"
13052         else
13053                 val="$undef"
13054         fi
13055         set d_pwage
13056         eval $setvar
13057
13058         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13059                 val="$define"
13060         else
13061                 val="$undef"
13062         fi
13063         set d_pwchange
13064         eval $setvar
13065
13066         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13067                 val="$define"
13068         else
13069                 val="$undef"
13070         fi
13071         set d_pwclass
13072         eval $setvar
13073
13074         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13075                 val="$define"
13076         else
13077                 val="$undef"
13078         fi
13079         set d_pwexpire
13080         eval $setvar
13081
13082         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13083                 val="$define"
13084         else
13085                 val="$undef"
13086         fi
13087         set d_pwcomment
13088         eval $setvar
13089
13090         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13091                 val="$define"
13092         else
13093                 val="$undef"
13094         fi
13095         set d_pwgecos
13096         eval $setvar
13097
13098         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13099                 val="$define"
13100         else
13101                 val="$undef"
13102         fi
13103         set d_pwpasswd
13104         eval $setvar
13105
13106         $rm -f $$.h
13107         ;;
13108 *)
13109         val="$undef";
13110         set d_pwquota; eval $setvar
13111         set d_pwage; eval $setvar
13112         set d_pwchange; eval $setvar
13113         set d_pwclass; eval $setvar
13114         set d_pwexpire; eval $setvar
13115         set d_pwcomment; eval $setvar
13116         set d_pwgecos; eval $setvar
13117         set d_pwpasswd; eval $setvar
13118         ;;
13119 esac
13120
13121 : see if endpwent_r exists
13122 set endpwent_r d_endpwent_r
13123 eval $inlibc
13124 case "$d_endpwent_r" in
13125 "$define")
13126         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13127         case "$d_endpwent_r_proto:$usethreads" in
13128         ":define")      d_endpwent_r_proto=define
13129                 set d_endpwent_r_proto endpwent_r $hdrs
13130                 eval $hasproto ;;
13131         *)      ;;
13132         esac
13133         case "$d_endpwent_r_proto" in
13134         define)
13135         case "$endpwent_r_proto" in
13136         ''|0) try='int endpwent_r(FILE**);'
13137         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13138         esac
13139         case "$endpwent_r_proto" in
13140         ''|0) try='void endpwent_r(FILE**);'
13141         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13142         esac
13143         case "$endpwent_r_proto" in
13144         ''|0)   d_endpwent_r=undef
13145                 endpwent_r_proto=0
13146                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13147         * )     case "$endpwent_r_proto" in
13148                 REENTRANT_PROTO*) ;;
13149                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13150                 esac
13151                 echo "Prototype: $try" ;;
13152         esac
13153         ;;
13154         *)      case "$usethreads" in
13155                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13156                 esac
13157                 d_endpwent_r=undef
13158                 endpwent_r_proto=0
13159                 ;;
13160         esac
13161         ;;
13162 *)      endpwent_r_proto=0
13163         ;;
13164 esac
13165
13166 : see if endservent exists
13167 set endservent d_endsent
13168 eval $inlibc
13169
13170 : see if endservent_r exists
13171 set endservent_r d_endservent_r
13172 eval $inlibc
13173 case "$d_endservent_r" in
13174 "$define")
13175         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13176         case "$d_endservent_r_proto:$usethreads" in
13177         ":define")      d_endservent_r_proto=define
13178                 set d_endservent_r_proto endservent_r $hdrs
13179                 eval $hasproto ;;
13180         *)      ;;
13181         esac
13182         case "$d_endservent_r_proto" in
13183         define)
13184         case "$endservent_r_proto" in
13185         ''|0) try='int endservent_r(struct servent_data*);'
13186         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13187         esac
13188         case "$endservent_r_proto" in
13189         ''|0) try='void endservent_r(struct servent_data*);'
13190         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13191         esac
13192         case "$endservent_r_proto" in
13193         ''|0)   d_endservent_r=undef
13194                 endservent_r_proto=0
13195                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13196         * )     case "$endservent_r_proto" in
13197                 REENTRANT_PROTO*) ;;
13198                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13199                 esac
13200                 echo "Prototype: $try" ;;
13201         esac
13202         ;;
13203         *)      case "$usethreads" in
13204                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13205                 esac
13206                 d_endservent_r=undef
13207                 endservent_r_proto=0
13208                 ;;
13209         esac
13210         ;;
13211 *)      endservent_r_proto=0
13212         ;;
13213 esac
13214
13215 : Locate the flags for 'open()'
13216 echo " "
13217 $cat >try.c <<EOCP
13218 #include <sys/types.h>
13219 #ifdef I_FCNTL
13220 #include <fcntl.h>
13221 #endif
13222 #ifdef I_SYS_FILE
13223 #include <sys/file.h>
13224 #endif
13225 #$i_stdlib I_STDLIB
13226 #ifdef I_STDLIB
13227 #include <stdlib.h>
13228 #endif
13229 int main() {
13230         if(O_RDONLY);
13231 #ifdef O_TRUNC
13232         exit(0);
13233 #else
13234         exit(1);
13235 #endif
13236 }
13237 EOCP
13238 : check sys/file.h first to get FREAD on Sun
13239 if $test `./findhdr sys/file.h` && \
13240                 set try -DI_SYS_FILE && eval $compile; then
13241         h_sysfile=true;
13242         echo "<sys/file.h> defines the O_* constants..." >&4
13243         if $run ./try; then
13244                 echo "and you have the 3 argument form of open()." >&4
13245                 val="$define"
13246         else
13247                 echo "but not the 3 argument form of open().  Oh, well." >&4
13248                 val="$undef"
13249         fi
13250 elif $test `./findhdr fcntl.h` && \
13251                 set try -DI_FCNTL && eval $compile; then
13252         h_fcntl=true;
13253         echo "<fcntl.h> defines the O_* constants..." >&4
13254         if $run ./try; then
13255                 echo "and you have the 3 argument form of open()." >&4
13256                 val="$define"
13257         else
13258                 echo "but not the 3 argument form of open().  Oh, well." >&4
13259                 val="$undef"
13260         fi
13261 else
13262         val="$undef"
13263         echo "I can't find the O_* constant definitions!  You got problems." >&4
13264 fi
13265 set d_open3
13266 eval $setvar
13267 $rm_try
13268
13269 : see if this is a sys/file.h system
13270 val=''
13271 set sys/file.h val
13272 eval $inhdr
13273
13274 : do we need to include sys/file.h ?
13275 case "$val" in
13276 "$define")
13277         echo " "
13278         if $h_sysfile; then
13279                 val="$define"
13280                 echo "We'll be including <sys/file.h>." >&4
13281         else
13282                 val="$undef"
13283                 echo "We won't be including <sys/file.h>." >&4
13284         fi
13285         ;;
13286 *)
13287         h_sysfile=false
13288         ;;
13289 esac
13290 set i_sysfile
13291 eval $setvar
13292
13293 : see if fcntl.h is there
13294 val=''
13295 set fcntl.h val
13296 eval $inhdr
13297
13298 : see if we can include fcntl.h
13299 case "$val" in
13300 "$define")
13301         echo " "
13302         if $h_fcntl; then
13303                 val="$define"
13304                 echo "We'll be including <fcntl.h>." >&4
13305         else
13306                 val="$undef"
13307                 if $h_sysfile; then
13308         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13309                 else
13310                         echo "We won't be including <fcntl.h>." >&4
13311                 fi
13312         fi
13313         ;;
13314 *)
13315         h_fcntl=false
13316         val="$undef"
13317         ;;
13318 esac
13319 set i_fcntl
13320 eval $setvar
13321
13322 : see if fork exists
13323 set fork d_fork
13324 eval $inlibc
13325
13326 : see if pipe exists
13327 set pipe d_pipe
13328 eval $inlibc
13329
13330 : check for non-blocking I/O stuff
13331 case "$h_sysfile" in
13332 true) echo "#include <sys/file.h>" > head.c;;
13333 *)
13334        case "$h_fcntl" in
13335        true) echo "#include <fcntl.h>" > head.c;;
13336        *) echo "#include <sys/fcntl.h>" > head.c;;
13337        esac
13338        ;;
13339 esac
13340 echo " "
13341 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13342 case "$o_nonblock" in
13343 '')
13344         $cat head.c > try.c
13345         $cat >>try.c <<EOCP
13346 #include <stdio.h>
13347 #$i_stdlib I_STDLIB
13348 #ifdef I_STDLIB
13349 #include <stdlib.h>
13350 #endif
13351 #$i_fcntl I_FCNTL
13352 #ifdef I_FCNTL
13353 #include <fcntl.h>
13354 #endif
13355 int main() {
13356 #ifdef O_NONBLOCK
13357         printf("O_NONBLOCK\n");
13358         exit(0);
13359 #endif
13360 #ifdef O_NDELAY
13361         printf("O_NDELAY\n");
13362         exit(0);
13363 #endif
13364 #ifdef FNDELAY
13365         printf("FNDELAY\n");
13366         exit(0);
13367 #endif
13368         exit(0);
13369 }
13370 EOCP
13371         set try
13372         if eval $compile_ok; then
13373                 o_nonblock=`$run ./try`
13374                 case "$o_nonblock" in
13375                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13376                 *) echo "Seems like we can use $o_nonblock.";;
13377                 esac
13378         else
13379                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13380         fi
13381         ;;
13382 *) echo "Using $hint value $o_nonblock.";;
13383 esac
13384 $rm_try
13385
13386 echo " "
13387 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13388 case "$eagain" in
13389 '')
13390         case "$d_fork:$d_pipe:$d_alarm" in
13391         define:define:define)
13392         $cat head.c > try.c
13393         $cat >>try.c <<EOCP
13394 #include <errno.h>
13395 #include <sys/types.h>
13396 #include <signal.h>
13397 #include <stdio.h>
13398 #$i_stdlib I_STDLIB
13399 #ifdef I_STDLIB
13400 #include <stdlib.h>
13401 #endif
13402 #$i_fcntl I_FCNTL
13403 #ifdef I_FCNTL
13404 #include <fcntl.h>
13405 #endif
13406 #define MY_O_NONBLOCK $o_nonblock
13407 #ifndef errno  /* XXX need better Configure test */
13408 extern int errno;
13409 #endif
13410 #$i_unistd I_UNISTD
13411 #ifdef I_UNISTD
13412 #include <unistd.h>
13413 #endif
13414 #$i_string I_STRING
13415 #ifdef I_STRING
13416 #include <string.h>
13417 #else
13418 #include <strings.h>
13419 #endif
13420 $signal_t blech(int x) { exit(3); }
13421 EOCP
13422         $cat >> try.c <<'EOCP'
13423 int main()
13424 {
13425         int pd[2];
13426         int pu[2];
13427         char buf[1];
13428         char string[100];
13429         int ret;
13430
13431         ret = pipe(pd); /* Down: child -> parent */
13432         if (ret != 0)
13433                 exit(3);
13434         ret = pipe(pu); /* Up: parent -> child */
13435         if (ret != 0)
13436                 exit(3);
13437         if (0 != fork()) {
13438                 close(pd[1]);   /* Parent reads from pd[0] */
13439                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13440 #ifdef F_SETFL
13441                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13442                         exit(1);
13443 #else
13444                 exit(4);
13445 #endif
13446                 signal(SIGALRM, blech);
13447                 alarm(5);
13448                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13449                         exit(2);
13450                 sprintf(string, "%d\n", ret);
13451                 ret = write(2, string, strlen(string));
13452                 if (ret != strlen(string))
13453                         exit(3);
13454                 alarm(0);
13455 #ifdef EAGAIN
13456                 if (errno == EAGAIN) {
13457                         printf("EAGAIN\n");
13458                         goto ok;
13459                 }
13460 #endif
13461 #ifdef EWOULDBLOCK
13462                 if (errno == EWOULDBLOCK)
13463                         printf("EWOULDBLOCK\n");
13464 #endif
13465         ok:
13466                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13467                 if (ret != 1)
13468                         exit(3);
13469                 sleep(2);                               /* Give it time to close our pipe */
13470                 alarm(5);
13471                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13472                 alarm(0);
13473                 sprintf(string, "%d\n", ret);
13474                 ret = write(4, string, strlen(string));
13475                 if (ret != strlen(string))
13476                         exit(3);
13477                 exit(0);
13478         }
13479
13480         close(pd[0]);                   /* We write to pd[1] */
13481         close(pu[1]);                   /* We read from pu[0] */
13482         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13483         if (ret != 1)
13484                 exit(3);
13485         close(pd[1]);                   /* Pipe pd is now fully closed! */
13486         exit(0);                                /* Bye bye, thank you for playing! */
13487 }
13488 EOCP
13489         set try
13490         if eval $compile_ok; then
13491                 echo "$startsh" >mtry
13492                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13493                 chmod +x mtry
13494                 $run ./mtry >/dev/null 2>&1
13495                 case $? in
13496                 0) eagain=`$cat try.out`;;
13497                 1) echo "Could not perform non-blocking setting!";;
13498                 2) echo "I did a successful read() for something that was not there!";;
13499                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13500                 4) echo "Could not find F_SETFL!";;
13501                 *) echo "Something terribly wrong happened during testing.";;
13502                 esac
13503                 rd_nodata=`$cat try.ret`
13504                 echo "A read() system call with no data present returns $rd_nodata."
13505                 case "$rd_nodata" in
13506                 0|-1) ;;
13507                 *)
13508                         echo "(That's peculiar, fixing that to be -1.)"
13509                         rd_nodata=-1
13510                         ;;
13511                 esac
13512                 case "$eagain" in
13513                 '')
13514                         echo "Forcing errno EAGAIN on read() with no data available."
13515                         eagain=EAGAIN
13516                         ;;
13517                 *)
13518                         echo "Your read() sets errno to $eagain when no data is available."
13519                         ;;
13520                 esac
13521                 status=`$cat try.err`
13522                 case "$status" in
13523                 0) echo "And it correctly returns 0 to signal EOF.";;
13524                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13525                 *) echo "However, your read() returns '$status' on EOF??";;
13526                 esac
13527                 val="$define"
13528                 if test "$status" = "$rd_nodata"; then
13529                         echo "WARNING: you can't distinguish between EOF and no data!"
13530                         val="$undef"
13531                 fi
13532         else
13533                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13534                 eagain=EAGAIN
13535         fi
13536         ;;
13537         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13538                 eagain=EAGAIN
13539                 val="$define"
13540                 ;;
13541         esac
13542         set d_eofnblk
13543         eval $setvar
13544         ;;
13545 *)
13546         echo "Using $hint value $eagain."
13547         echo "Your read() returns $rd_nodata when no data is present."
13548         case "$d_eofnblk" in
13549         "$define") echo "And you can see EOF because read() returns 0.";;
13550         "$undef") echo "But you can't see EOF status from read() returned value.";;
13551         *)
13552                 echo "(Assuming you can't see EOF status from read anyway.)"
13553                 d_eofnblk=$undef
13554                 ;;
13555         esac
13556         ;;
13557 esac
13558 $rm_try head.c mtry
13559
13560 : see if erf exists
13561 set erf d_erf
13562 eval $inlibc
13563
13564 : see if erfc exists
13565 set erfc d_erfc
13566 eval $inlibc
13567
13568 : see if exp2 exists
13569 set exp2 d_exp2
13570 eval $inlibc
13571
13572 : see if expm1 exists
13573 set expm1 d_expm1
13574 eval $inlibc
13575
13576 : see if _ptr and _cnt from stdio act std
13577 echo " "
13578
13579 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13580         echo "(Looks like you have stdio.h from BSD.)"
13581         case "$stdio_ptr" in
13582         '') stdio_ptr='((fp)->_p)'
13583                 ptr_lval=$define
13584                 ;;
13585         *)      ptr_lval=$d_stdio_ptr_lval;;
13586         esac
13587         case "$stdio_cnt" in
13588         '') stdio_cnt='((fp)->_r)'
13589                 cnt_lval=$define
13590                 ;;
13591         *)      cnt_lval=$d_stdio_cnt_lval;;
13592         esac
13593         case "$stdio_base" in
13594         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13595         esac
13596         case "$stdio_bufsiz" in
13597         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13598         esac
13599 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13600         echo "(Looks like you have stdio.h from Linux.)"
13601         case "$stdio_ptr" in
13602         '') stdio_ptr='((fp)->_IO_read_ptr)'
13603                 ptr_lval=$define
13604                 ;;
13605         *)      ptr_lval=$d_stdio_ptr_lval;;
13606         esac
13607         case "$stdio_cnt" in
13608         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13609                 cnt_lval=$undef
13610                 ;;
13611         *)      cnt_lval=$d_stdio_cnt_lval;;
13612         esac
13613         case "$stdio_base" in
13614         '') stdio_base='((fp)->_IO_read_base)';;
13615         esac
13616         case "$stdio_bufsiz" in
13617         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13618         esac
13619 else
13620         case "$stdio_ptr" in
13621         '') stdio_ptr='((fp)->_ptr)'
13622                 ptr_lval=$define
13623                 ;;
13624         *)      ptr_lval=$d_stdio_ptr_lval;;
13625         esac
13626         case "$stdio_cnt" in
13627         '') stdio_cnt='((fp)->_cnt)'
13628                 cnt_lval=$define
13629                 ;;
13630         *)      cnt_lval=$d_stdio_cnt_lval;;
13631         esac
13632         case "$stdio_base" in
13633         '') stdio_base='((fp)->_base)';;
13634         esac
13635         case "$stdio_bufsiz" in
13636         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13637         esac
13638 fi
13639
13640 : test whether _ptr and _cnt really work
13641 echo "Checking how std your stdio is..." >&4
13642 $cat >try.c <<EOP
13643 #include <stdio.h>
13644 #$i_stdlib I_STDLIB
13645 #ifdef I_STDLIB
13646 #include <stdlib.h>
13647 #endif
13648 #define FILE_ptr(fp)    $stdio_ptr
13649 #define FILE_cnt(fp)    $stdio_cnt
13650 int main() {
13651         FILE *fp = fopen("try.c", "r");
13652         char c = getc(fp);
13653         if (
13654                 18 <= FILE_cnt(fp) &&
13655                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13656         )
13657                 exit(0);
13658         exit(1);
13659 }
13660 EOP
13661 val="$undef"
13662 set try
13663 if eval $compile && $to try.c; then
13664         if $run ./try; then
13665                 echo "Your stdio acts pretty std."
13666                 val="$define"
13667         else
13668                 echo "Your stdio isn't very std."
13669         fi
13670 else
13671         echo "Your stdio doesn't appear very std."
13672 fi
13673 $rm_try
13674
13675 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13676 # direct buffer manipulation no longer works.  The Configure tests
13677 # should be changed to correctly detect this, but until then,
13678 # the following check should at least let perl compile and run.
13679 # (This quick fix should be updated before 5.8.1.)
13680 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13681 # A. Dougherty, June 3, 2002.
13682 case "$d_gnulibc" in
13683 $define)
13684         case "$gnulibc_version" in
13685         2.[01]*)  ;;
13686         2.2) ;;
13687         2.2.[0-9]) ;;
13688         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13689                 val="$undef"
13690                 ;;
13691         esac
13692         ;;
13693 esac
13694 set d_stdstdio
13695 eval $setvar
13696
13697 : Can _ptr be used as an lvalue?
13698 case "$d_stdstdio$ptr_lval" in
13699 $define$define) val=$define ;;
13700 *) val=$undef ;;
13701 esac
13702 set d_stdio_ptr_lval
13703 eval $setvar
13704
13705 : Can _cnt be used as an lvalue?
13706 case "$d_stdstdio$cnt_lval" in
13707 $define$define) val=$define ;;
13708 *) val=$undef ;;
13709 esac
13710 set d_stdio_cnt_lval
13711 eval $setvar
13712
13713
13714 : test whether setting _ptr sets _cnt as a side effect
13715 d_stdio_ptr_lval_sets_cnt="$undef"
13716 d_stdio_ptr_lval_nochange_cnt="$undef"
13717 case "$d_stdio_ptr_lval$d_stdstdio" in
13718 $define$define)
13719         echo "Checking to see what happens if we set the stdio ptr..." >&4
13720 $cat >try.c <<EOP
13721 #include <stdio.h>
13722 /* Can we scream? */
13723 /* Eat dust sed :-) */
13724 /* In the buffer space, no one can hear you scream. */
13725 #$i_stdlib I_STDLIB
13726 #ifdef I_STDLIB
13727 #include <stdlib.h>
13728 #endif
13729 #define FILE_ptr(fp)    $stdio_ptr
13730 #define FILE_cnt(fp)    $stdio_cnt
13731 #include <sys/types.h>
13732 int main() {
13733         FILE *fp = fopen("try.c", "r");
13734         int c;
13735         char *ptr;
13736         size_t cnt;
13737         if (!fp) {
13738             puts("Fail even to read");
13739             exit(1);
13740         }
13741         c = getc(fp); /* Read away the first # */
13742         if (c == EOF) {
13743             puts("Fail even to read");
13744             exit(1);
13745         }
13746         if (!(
13747                 18 <= FILE_cnt(fp) &&
13748                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13749         )) {
13750                 puts("Fail even to read");
13751                 exit (1);
13752         }
13753         ptr = (char*) FILE_ptr(fp);
13754         cnt = (size_t)FILE_cnt(fp);
13755
13756         FILE_ptr(fp) += 42;
13757
13758         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13759                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13760                 exit (1);
13761         }
13762         if (FILE_cnt(fp) <= 20) {
13763                 printf ("Fail (<20 chars to test)");
13764                 exit (1);
13765         }
13766         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13767                 puts("Fail compare");
13768                 exit (1);
13769         }
13770         if (cnt == FILE_cnt(fp)) {
13771                 puts("Pass_unchanged");
13772                 exit (0);
13773         }
13774         if (FILE_cnt(fp) == (cnt - 42)) {
13775                 puts("Pass_changed");
13776                 exit (0);
13777         }
13778         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13779         return 1;
13780
13781 }
13782 EOP
13783         set try
13784         if eval $compile && $to try.c; then
13785                 case `$run ./try` in
13786                 Pass_changed)
13787                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13788                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13789                 Pass_unchanged)
13790                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13791                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13792                 Fail*)
13793                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13794                 *)
13795                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13796         esac
13797         else
13798                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13799         fi
13800         $rm_try
13801         ;;
13802 esac
13803
13804 : see if _base is also standard
13805 val="$undef"
13806 case "$d_stdstdio" in
13807 $define)
13808         $cat >try.c <<EOP
13809 #include <stdio.h>
13810 #$i_stdlib I_STDLIB
13811 #ifdef I_STDLIB
13812 #include <stdlib.h>
13813 #endif
13814 #define FILE_base(fp)   $stdio_base
13815 #define FILE_bufsiz(fp) $stdio_bufsiz
13816 int main() {
13817         FILE *fp = fopen("try.c", "r");
13818         char c = getc(fp);
13819         if (
13820                 19 <= FILE_bufsiz(fp) &&
13821                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13822         )
13823                 exit(0);
13824         exit(1);
13825 }
13826 EOP
13827         set try
13828         if eval $compile && $to try.c; then
13829                 if $run ./try; then
13830                         echo "And its _base field acts std."
13831                         val="$define"
13832                 else
13833                         echo "But its _base field isn't std."
13834                 fi
13835         else
13836                 echo "However, it seems to be lacking the _base field."
13837         fi
13838         $rm_try
13839         ;;
13840 esac
13841 set d_stdiobase
13842 eval $setvar
13843
13844 : see if fast_stdio exists
13845 val="$undef"
13846 case "$d_stdstdio:$d_stdio_ptr_lval" in
13847 "$define:$define")
13848         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13849         *$define*)
13850                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13851                 val="$define"
13852                 ;;
13853         esac
13854         ;;
13855 esac
13856 set d_faststdio
13857 eval $setvar
13858
13859
13860
13861 : see if fchdir exists
13862 set fchdir d_fchdir
13863 eval $inlibc
13864
13865 : see if fchmod exists
13866 set fchmod d_fchmod
13867 eval $inlibc
13868
13869 : see if fchown exists
13870 set fchown d_fchown
13871 eval $inlibc
13872
13873 : see if this is an fcntl system
13874 set fcntl d_fcntl
13875 eval $inlibc
13876
13877 : See if fcntl-based locking works.
13878 echo " "
13879 $cat >try.c <<EOCP
13880 #$i_stdlib I_STDLIB
13881 #ifdef I_STDLIB
13882 #include <stdlib.h>
13883 #endif
13884 #include <unistd.h>
13885 #include <fcntl.h>
13886 #include <signal.h>
13887 $signal_t blech(int x) { exit(3); }
13888 int main() {
13889 #if defined(F_SETLK) && defined(F_SETLKW)
13890      struct flock flock;
13891      int retval, fd;
13892      fd = open("try.c", O_RDONLY);
13893      flock.l_type = F_RDLCK;
13894      flock.l_whence = SEEK_SET;
13895      flock.l_start = flock.l_len = 0;
13896      signal(SIGALRM, blech);
13897      alarm(10);
13898      retval = fcntl(fd, F_SETLK, &flock);
13899      close(fd);
13900      (retval < 0 ? exit(2) : exit(0));
13901 #else
13902      exit(2);
13903 #endif
13904 }
13905 EOCP
13906 echo "Checking if fcntl-based file locking works... "
13907 case "$d_fcntl" in
13908 "$define")
13909         set try
13910         if eval $compile_ok; then
13911                 if $run ./try; then
13912                         echo "Yes, it seems to work."
13913                         val="$define"
13914                 else
13915                         echo "Nope, it didn't work."
13916                         val="$undef"
13917                         case "$?" in
13918                         3) $cat >&4 <<EOM
13919 ***
13920 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13921 *** This is (almost) impossible.
13922 *** If your NFS lock daemons are not feeling well, something like
13923 *** this may happen, please investigate.  Cannot continue, aborting.
13924 ***
13925 EOM
13926                                 exit 1
13927                                 ;;
13928                         esac
13929                 fi
13930         else
13931                 echo "I'm unable to compile the test program, so I'll assume not."
13932                 val="$undef"
13933         fi
13934         ;;
13935 *) val="$undef";
13936         echo "Nope, since you don't even have fcntl()."
13937         ;;
13938 esac
13939 set d_fcntl_can_lock
13940 eval $setvar
13941 $rm_try
13942
13943 : check for fd_set items
13944 $cat <<EOM
13945
13946 Checking to see how well your C compiler handles fd_set and friends ...
13947 EOM
13948 $cat >try.c <<EOCP
13949 #$i_stdlib I_STDLIB
13950 #ifdef I_STDLIB
13951 #include <stdlib.h>
13952 #endif
13953 #$i_systime I_SYS_TIME
13954 #$i_sysselct I_SYS_SELECT
13955 #$d_socket HAS_SOCKET
13956 #include <sys/types.h>
13957 #ifdef HAS_SOCKET
13958 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13959 #endif
13960 #ifdef I_SYS_TIME
13961 #include <sys/time.h>
13962 #endif
13963 #ifdef I_SYS_SELECT
13964 #include <sys/select.h>
13965 #endif
13966 int main() {
13967         fd_set fds;
13968
13969 #ifdef TRYBITS
13970         if(fds.fds_bits);
13971 #endif
13972
13973 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13974         exit(0);
13975 #else
13976         exit(1);
13977 #endif
13978 }
13979 EOCP
13980 set try -DTRYBITS
13981 if eval $compile; then
13982         d_fds_bits="$define"
13983         d_fd_set="$define"
13984         echo "Well, your system knows about the normal fd_set typedef..." >&4
13985         if $run ./try; then
13986                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13987                 d_fd_macros="$define"
13988         else
13989                 $cat >&4 <<'EOM'
13990 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13991 EOM
13992                 d_fd_macros="$undef"
13993         fi
13994 else
13995         $cat <<'EOM'
13996 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13997 EOM
13998         set try
13999         if eval $compile; then
14000                 d_fds_bits="$undef"
14001                 d_fd_set="$define"
14002                 echo "Well, your system has some sort of fd_set available..." >&4
14003                 if $run ./try; then
14004                         echo "and you have the normal fd_set macros." >&4
14005                         d_fd_macros="$define"
14006                 else
14007                         $cat <<'EOM'
14008 but not the normal fd_set macros!  Gross!  More work for me...
14009 EOM
14010                         d_fd_macros="$undef"
14011                 fi
14012         else
14013         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14014                 d_fd_set="$undef"
14015                 d_fds_bits="$undef"
14016                 d_fd_macros="$undef"
14017         fi
14018 fi
14019 $rm_try
14020
14021 : see if fdclose exists
14022 set fdclose d_fdclose
14023 eval $inlibc
14024
14025 : see if fdim exists
14026 set fdim d_fdim
14027 eval $inlibc
14028
14029 : see if fegetround exists
14030 set fegetround d_fegetround
14031 eval $inlibc
14032
14033 : see if fgetpos exists
14034 set fgetpos d_fgetpos
14035 eval $inlibc
14036
14037 : see if finite exists
14038 set finite d_finite
14039 eval $inlibc
14040
14041 : see if finitel exists
14042 set finitel d_finitel
14043 eval $inlibc
14044
14045 : see if flock exists
14046 set flock d_flock
14047 eval $inlibc
14048
14049 : see if prototype for flock is available
14050 echo " "
14051 set d_flockproto flock $i_sysfile sys/file.h
14052 eval $hasproto
14053
14054 : see if fma exists
14055 set fma d_fma
14056 eval $inlibc
14057
14058 : see if fmax exists
14059 set fmax d_fmax
14060 eval $inlibc
14061
14062 : see if fmin exists
14063 set fmin d_fmin
14064 eval $inlibc
14065
14066 : see if fp_class exists
14067 set fp_class d_fp_class
14068 eval $inlibc
14069
14070 : see if this is a math.h system
14071 set math.h i_math
14072 eval $inhdr
14073
14074 : check for fpclassify
14075 echo "Checking to see if you have fpclassify..." >&4
14076 $cat >try.c <<EOCP
14077 #$i_math I_MATH
14078 #ifdef I_MATH
14079 #include <math.h>
14080 #endif
14081 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14082 EOCP
14083 set try
14084 if eval $compile; then
14085         val="$define"
14086         echo "You have fpclassify."
14087 else
14088         val="$undef"
14089         echo "You do not have fpclassify."
14090 fi
14091 $rm_try
14092 set d_fpclassify
14093 eval $setvar
14094
14095 : see if fp_classify exists
14096 set fp_classify d_fp_classify
14097 eval $inlibc
14098
14099 : see if fp_classl exists
14100 set fp_classl d_fp_classl
14101 eval $inlibc
14102
14103 : see if pathconf exists
14104 set pathconf d_pathconf
14105 eval $inlibc
14106
14107 : see if fpathconf exists
14108 set fpathconf d_fpathconf
14109 eval $inlibc
14110
14111 : see if fpclass exists
14112 set fpclass d_fpclass
14113 eval $inlibc
14114
14115 : see if fpclassl exists
14116 set fpclassl d_fpclassl
14117 eval $inlibc
14118
14119 : see if fpgetround exists
14120 set fpgetround d_fpgetround
14121 eval $inlibc
14122
14123 : check for fpos64_t
14124 echo " "
14125 echo "Checking to see if you have fpos64_t..." >&4
14126 $cat >try.c <<EOCP
14127 #include <stdio.h>
14128 int main() { fpos64_t x = 7; }
14129 EOCP
14130 set try
14131 if eval $compile; then
14132         val="$define"
14133         echo "You have fpos64_t."
14134 else
14135         val="$undef"
14136         echo "You do not have fpos64_t."
14137         case "$fpossize" in
14138         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14139         esac
14140 fi
14141 $rm_try
14142 set d_fpos64_t
14143 eval $setvar
14144
14145 : see if frexpl exists
14146 set frexpl d_frexpl
14147 eval $inlibc
14148
14149 : see if this is a sys/param system
14150 set sys/param.h i_sysparam
14151 eval $inhdr
14152
14153 : see if this is a sys/mount.h system
14154 set sys/mount.h i_sysmount
14155 eval $inhdr
14156
14157 : Check for fs_data_s
14158 echo " "
14159 echo "Checking to see if your system supports struct fs_data..." >&4
14160 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14161 eval $hasstruct
14162 case "$d_fs_data_s" in
14163 "$define")      echo "Yes, it does."   ;;
14164 *)              echo "No, it doesn't." ;;
14165 esac
14166
14167 : see if fseeko exists
14168 set fseeko d_fseeko
14169 eval $inlibc
14170 case "$longsize" in
14171 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14172 esac
14173
14174 : see if fsetpos exists
14175 set fsetpos d_fsetpos
14176 eval $inlibc
14177
14178 : see if fstatfs exists
14179 set fstatfs d_fstatfs
14180 eval $inlibc
14181
14182 : see if statvfs exists
14183 set statvfs d_statvfs
14184 eval $inlibc
14185
14186 : see if fstatvfs exists
14187 set fstatvfs d_fstatvfs
14188 eval $inlibc
14189
14190
14191 : see if fsync exists
14192 set fsync d_fsync
14193 eval $inlibc
14194
14195 : see if ftello exists
14196 set ftello d_ftello
14197 eval $inlibc
14198 case "$longsize" in
14199 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14200 esac
14201
14202 : check for a working futimes
14203 d_futimes="$undef"
14204 echo " "
14205 echo "Checking if you have a working futimes()" >&4
14206 $cat >try.c <<EOCP
14207 #include <stdio.h>
14208 #include <sys/time.h>
14209 #include <errno.h>
14210 #include <fcntl.h>
14211
14212 int main ()
14213 {
14214     int fd, rv;
14215     fd = open ("try.c", O_RDWR);
14216     if (-1 == fd) exit (1);
14217     rv = futimes (fd, NULL);
14218     exit (rv == -1 ? errno : 0);
14219 }
14220 EOCP
14221 set try
14222 if eval $compile; then
14223     `$run ./try`
14224     rc=$?
14225     case "$rc" in
14226         0)  echo "Yes, you have" >&4
14227             d_futimes="$define"
14228             ;;
14229         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14230             ;;
14231     esac
14232 else
14233     echo "No, it does not (probably harmless)" >&4
14234 fi
14235 $rm_try
14236
14237 : see if ndbm.h is available
14238 set ndbm.h i_ndbm
14239 eval $inhdr
14240 : Compatibility location for RedHat 7.1
14241 set gdbm/ndbm.h i_gdbmndbm
14242 eval $inhdr
14243 : Compatibility location for Debian 4.0
14244 set gdbm-ndbm.h i_gdbm_ndbm
14245 eval $inhdr
14246
14247 val="$undef"
14248 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14249         : see if dbm_open exists
14250         set dbm_open d_dbm_open
14251         eval $inlibc
14252         case "$d_dbm_open" in
14253         $undef)
14254                 i_ndbm="$undef"
14255                 i_gdbmndbm="$undef"
14256                 i_gdbm_ndbm="$undef"
14257                 echo "We won't be including <ndbm.h>"
14258                 val="$undef"
14259                 ;;
14260         *) val="$define"
14261            ;;
14262         esac
14263 fi
14264 set d_ndbm
14265 eval $setvar
14266
14267 ndbm_hdr_protochk='name=$1; hdr=$2;
14268 eval "ihdr=\$""i_$name";
14269 val="$undef";
14270 if $test "$ihdr" = "$define"; then
14271         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14272         case "$d_cplusplus" in
14273         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14274         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14275         esac;
14276         case "$val" in
14277         $define) $echo "Your <$hdr> seems to have prototypes";;
14278         *) $echo "Your <$hdr> does not seem to have prototypes";;
14279         esac;
14280 fi;
14281 set "d_${name}_h_uses_prototypes";
14282 eval $setvar'
14283
14284 set ndbm ndbm.h
14285 eval $ndbm_hdr_protochk
14286 set gdbmndbm gdbm/ndbm.h
14287 eval $ndbm_hdr_protochk
14288 set gdbm_ndbm gdbm-ndbm.h
14289 eval $ndbm_hdr_protochk
14290
14291 : see if getaddrinfo exists
14292 set getaddrinfo d_getaddrinfo
14293 eval $inlibc
14294
14295 : see if getcwd exists
14296 set getcwd d_getcwd
14297 eval $inlibc
14298
14299 : see if getespwnam exists
14300 set getespwnam d_getespwnam
14301 eval $inlibc
14302
14303 : see if getfsstat exists
14304 set getfsstat d_getfsstat
14305 eval $inlibc
14306
14307 : see if getgrent exists
14308 set getgrent d_getgrent
14309 eval $inlibc
14310
14311 : see if getgrent_r exists
14312 set getgrent_r d_getgrent_r
14313 eval $inlibc
14314 case "$d_getgrent_r" in
14315 "$define")
14316         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14317         case "$d_getgrent_r_proto:$usethreads" in
14318         ":define")      d_getgrent_r_proto=define
14319                 set d_getgrent_r_proto getgrent_r $hdrs
14320                 eval $hasproto ;;
14321         *)      ;;
14322         esac
14323         case "$d_getgrent_r_proto" in
14324         define)
14325         case "$getgrent_r_proto" in
14326         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14327         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14328         esac
14329         case "$getgrent_r_proto" in
14330         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14331         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14332         esac
14333         case "$getgrent_r_proto" in
14334         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14335         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14336         esac
14337         case "$getgrent_r_proto" in
14338         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14339         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14340         esac
14341         case "$getgrent_r_proto" in
14342         ''|0) try='int getgrent_r(struct group*, char*, int);'
14343         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14344         esac
14345         case "$getgrent_r_proto" in
14346         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14347         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14348         esac
14349         case "$getgrent_r_proto" in
14350         ''|0)   d_getgrent_r=undef
14351                 getgrent_r_proto=0
14352                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14353         * )     case "$getgrent_r_proto" in
14354                 REENTRANT_PROTO*) ;;
14355                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14356                 esac
14357                 echo "Prototype: $try" ;;
14358         esac
14359         ;;
14360         *)      case "$usethreads" in
14361                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14362                 esac
14363                 d_getgrent_r=undef
14364                 getgrent_r_proto=0
14365                 ;;
14366         esac
14367         ;;
14368 *)      getgrent_r_proto=0
14369         ;;
14370 esac
14371
14372 : see if getgrgid_r exists
14373 set getgrgid_r d_getgrgid_r
14374 eval $inlibc
14375 case "$d_getgrgid_r" in
14376 "$define")
14377         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14378         case "$d_getgrgid_r_proto:$usethreads" in
14379         ":define")      d_getgrgid_r_proto=define
14380                 set d_getgrgid_r_proto getgrgid_r $hdrs
14381                 eval $hasproto ;;
14382         *)      ;;
14383         esac
14384         case "$d_getgrgid_r_proto" in
14385         define)
14386         case "$getgrgid_r_proto" in
14387         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14388         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14389         esac
14390         case "$getgrgid_r_proto" in
14391         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14392         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14393         esac
14394         case "$getgrgid_r_proto" in
14395         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14396         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14397         esac
14398         case "$getgrgid_r_proto" in
14399         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14400         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14401         esac
14402         case "$getgrgid_r_proto" in
14403         ''|0)   d_getgrgid_r=undef
14404                 getgrgid_r_proto=0
14405                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14406         * )     case "$getgrgid_r_proto" in
14407                 REENTRANT_PROTO*) ;;
14408                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14409                 esac
14410                 echo "Prototype: $try" ;;
14411         esac
14412         ;;
14413         *)      case "$usethreads" in
14414                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14415                 esac
14416                 d_getgrgid_r=undef
14417                 getgrgid_r_proto=0
14418                 ;;
14419         esac
14420         ;;
14421 *)      getgrgid_r_proto=0
14422         ;;
14423 esac
14424
14425 : see if getgrnam_r exists
14426 set getgrnam_r d_getgrnam_r
14427 eval $inlibc
14428 case "$d_getgrnam_r" in
14429 "$define")
14430         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14431         case "$d_getgrnam_r_proto:$usethreads" in
14432         ":define")      d_getgrnam_r_proto=define
14433                 set d_getgrnam_r_proto getgrnam_r $hdrs
14434                 eval $hasproto ;;
14435         *)      ;;
14436         esac
14437         case "$d_getgrnam_r_proto" in
14438         define)
14439         case "$getgrnam_r_proto" in
14440         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14441         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14442         esac
14443         case "$getgrnam_r_proto" in
14444         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14445         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14446         esac
14447         case "$getgrnam_r_proto" in
14448         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14449         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14450         esac
14451         case "$getgrnam_r_proto" in
14452         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14453         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14454         esac
14455         case "$getgrnam_r_proto" in
14456         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14457         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14458         esac
14459         case "$getgrnam_r_proto" in
14460         ''|0)   d_getgrnam_r=undef
14461                 getgrnam_r_proto=0
14462                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14463         * )     case "$getgrnam_r_proto" in
14464                 REENTRANT_PROTO*) ;;
14465                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14466                 esac
14467                 echo "Prototype: $try" ;;
14468         esac
14469         ;;
14470         *)      case "$usethreads" in
14471                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14472                 esac
14473                 d_getgrnam_r=undef
14474                 getgrnam_r_proto=0
14475                 ;;
14476         esac
14477         ;;
14478 *)      getgrnam_r_proto=0
14479         ;;
14480 esac
14481
14482 : see if gethostbyaddr exists
14483 set gethostbyaddr d_gethbyaddr
14484 eval $inlibc
14485
14486 : see if gethostbyname exists
14487 set gethostbyname d_gethbyname
14488 eval $inlibc
14489
14490 : see if gethostent exists
14491 set gethostent d_gethent
14492 eval $inlibc
14493
14494 : see how we will look up host name
14495 echo " "
14496 call=''
14497 if set gethostname val -f d_gethname; eval $csym; $val; then
14498         echo 'gethostname() found.' >&4
14499         d_gethname="$define"
14500         call=gethostname
14501 fi
14502 if set uname val -f d_uname; eval $csym; $val; then
14503         if ./xenix; then
14504                 $cat <<'EOM'
14505 uname() was found, but you're running xenix, and older versions of xenix
14506 have a broken uname(). If you don't really know whether your xenix is old
14507 enough to have a broken system call, use the default answer.
14508
14509 EOM
14510                 dflt=y
14511                 case "$d_uname" in
14512                 "$define") dflt=n;;
14513                 esac
14514                 rp='Is your uname() broken?'
14515                 . ./myread
14516                 case "$ans" in
14517                 n*) d_uname="$define"; call=uname;;
14518                 esac
14519         else
14520                 echo 'uname() found.' >&4
14521                 d_uname="$define"
14522                 case "$call" in
14523                 '') call=uname ;;
14524                 esac
14525         fi
14526 fi
14527 case "$d_gethname" in
14528 '') d_gethname="$undef";;
14529 esac
14530 case "$d_uname" in
14531 '') d_uname="$undef";;
14532 esac
14533 case "$d_uname$d_gethname" in
14534 *define*)
14535         dflt=n
14536         cat <<EOM
14537
14538 Every now and then someone has a $call() that lies about the hostname
14539 but can't be fixed for political or economic reasons.  If you wish, I can
14540 pretend $call() isn't there and maybe compute hostname at run-time
14541 thanks to the '$phostname' command.
14542
14543 EOM
14544         rp="Shall I ignore $call() from now on?"
14545         . ./myread
14546         case "$ans" in
14547         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14548         esac;;
14549 esac
14550 case "$phostname" in
14551 '') aphostname='';;
14552 *) case "$aphostname" in
14553         /*) ;;
14554         *) set X $phostname
14555                 shift
14556                 file=$1
14557                 shift
14558                 file=`./loc $file $file $pth`
14559                 aphostname=`echo $file $*`
14560                 ;;
14561         esac
14562         ;;
14563 esac
14564 case "$d_uname$d_gethname" in
14565 *define*) ;;
14566 *)
14567         case "$phostname" in
14568         '')
14569                 echo "There will be no way for $package to get your hostname." >&4;;
14570         *)
14571         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14572                 ;;
14573         esac;;
14574 esac
14575 case "$d_phostname" in
14576 '') d_phostname="$undef";;
14577 esac
14578
14579 : see if gethostbyaddr_r exists
14580 set gethostbyaddr_r d_gethostbyaddr_r
14581 eval $inlibc
14582 case "$d_gethostbyaddr_r" in
14583 "$define")
14584         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14585         case "$d_gethostbyaddr_r_proto:$usethreads" in
14586         ":define")      d_gethostbyaddr_r_proto=define
14587                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14588                 eval $hasproto ;;
14589         *)      ;;
14590         esac
14591         case "$d_gethostbyaddr_r_proto" in
14592         define)
14593         case "$gethostbyaddr_r_proto" in
14594         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14595         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14596         esac
14597         case "$gethostbyaddr_r_proto" in
14598         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14599         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14600         esac
14601         case "$gethostbyaddr_r_proto" in
14602         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14603         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14604         esac
14605         case "$gethostbyaddr_r_proto" in
14606         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14607         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14608         esac
14609         case "$gethostbyaddr_r_proto" in
14610         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14611         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14612         esac
14613         case "$gethostbyaddr_r_proto" in
14614         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14615         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14616         esac
14617         case "$gethostbyaddr_r_proto" in
14618         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14619         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14620         esac
14621         case "$gethostbyaddr_r_proto" in
14622         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14623         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14624         esac
14625         case "$gethostbyaddr_r_proto" in
14626         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14627         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14628         esac
14629         case "$gethostbyaddr_r_proto" in
14630         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14631         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14632         esac
14633         case "$gethostbyaddr_r_proto" in
14634         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14635         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14636         esac
14637         case "$gethostbyaddr_r_proto" in
14638         ''|0)   d_gethostbyaddr_r=undef
14639                 gethostbyaddr_r_proto=0
14640                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14641         * )     case "$gethostbyaddr_r_proto" in
14642                 REENTRANT_PROTO*) ;;
14643                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14644                 esac
14645                 echo "Prototype: $try" ;;
14646         esac
14647         ;;
14648         *)      case "$usethreads" in
14649                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14650                 esac
14651                 d_gethostbyaddr_r=undef
14652                 gethostbyaddr_r_proto=0
14653                 ;;
14654         esac
14655         ;;
14656 *)      gethostbyaddr_r_proto=0
14657         ;;
14658 esac
14659
14660 : see if gethostbyname_r exists
14661 set gethostbyname_r d_gethostbyname_r
14662 eval $inlibc
14663 case "$d_gethostbyname_r" in
14664 "$define")
14665         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14666         case "$d_gethostbyname_r_proto:$usethreads" in
14667         ":define")      d_gethostbyname_r_proto=define
14668                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14669                 eval $hasproto ;;
14670         *)      ;;
14671         esac
14672         case "$d_gethostbyname_r_proto" in
14673         define)
14674         case "$gethostbyname_r_proto" in
14675         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14676         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14677         esac
14678         case "$gethostbyname_r_proto" in
14679         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14680         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14681         esac
14682         case "$gethostbyname_r_proto" in
14683         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14684         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14685         esac
14686         case "$gethostbyname_r_proto" in
14687         ''|0)   d_gethostbyname_r=undef
14688                 gethostbyname_r_proto=0
14689                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14690         * )     case "$gethostbyname_r_proto" in
14691                 REENTRANT_PROTO*) ;;
14692                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14693                 esac
14694                 echo "Prototype: $try" ;;
14695         esac
14696         ;;
14697         *)      case "$usethreads" in
14698                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14699                 esac
14700                 d_gethostbyname_r=undef
14701                 gethostbyname_r_proto=0
14702                 ;;
14703         esac
14704         ;;
14705 *)      gethostbyname_r_proto=0
14706         ;;
14707 esac
14708
14709 : see if gethostent_r exists
14710 set gethostent_r d_gethostent_r
14711 eval $inlibc
14712 case "$d_gethostent_r" in
14713 "$define")
14714         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14715         case "$d_gethostent_r_proto:$usethreads" in
14716         ":define")      d_gethostent_r_proto=define
14717                 set d_gethostent_r_proto gethostent_r $hdrs
14718                 eval $hasproto ;;
14719         *)      ;;
14720         esac
14721         case "$d_gethostent_r_proto" in
14722         define)
14723         case "$gethostent_r_proto" in
14724         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14725         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14726         esac
14727         case "$gethostent_r_proto" in
14728         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14729         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14730         esac
14731         case "$gethostent_r_proto" in
14732         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14733         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14734         esac
14735         case "$gethostent_r_proto" in
14736         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14737         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14738         esac
14739         case "$gethostent_r_proto" in
14740         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14741         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14742         esac
14743         case "$gethostent_r_proto" in
14744         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14745         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14746         esac
14747         case "$gethostent_r_proto" in
14748         ''|0)   d_gethostent_r=undef
14749                 gethostent_r_proto=0
14750                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14751         * )     case "$gethostent_r_proto" in
14752                 REENTRANT_PROTO*) ;;
14753                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14754                 esac
14755                 echo "Prototype: $try" ;;
14756         esac
14757         ;;
14758         *)      case "$usethreads" in
14759                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14760                 esac
14761                 d_gethostent_r=undef
14762                 gethostent_r_proto=0
14763                 ;;
14764         esac
14765         ;;
14766 *)      gethostent_r_proto=0
14767         ;;
14768 esac
14769
14770 : see if prototypes for various gethostxxx netdb.h functions are available
14771 echo " "
14772 set d_gethostprotos gethostent $i_netdb netdb.h
14773 eval $hasproto
14774
14775 : see if getitimer exists
14776 set getitimer d_getitimer
14777 eval $inlibc
14778
14779 : see if getlogin exists
14780 set getlogin d_getlogin
14781 eval $inlibc
14782
14783 : see if getlogin_r exists
14784 set getlogin_r d_getlogin_r
14785 eval $inlibc
14786 case "$d_getlogin_r" in
14787 "$define")
14788         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14789         case "$d_getlogin_r_proto:$usethreads" in
14790         ":define")      d_getlogin_r_proto=define
14791                 set d_getlogin_r_proto getlogin_r $hdrs
14792                 eval $hasproto ;;
14793         *)      ;;
14794         esac
14795         case "$d_getlogin_r_proto" in
14796         define)
14797         case "$getlogin_r_proto" in
14798         ''|0) try='int getlogin_r(char*, size_t);'
14799         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14800         esac
14801         case "$getlogin_r_proto" in
14802         ''|0) try='int getlogin_r(char*, int);'
14803         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14804         esac
14805         case "$getlogin_r_proto" in
14806         ''|0) try='char* getlogin_r(char*, size_t);'
14807         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14808         esac
14809         case "$getlogin_r_proto" in
14810         ''|0) try='char* getlogin_r(char*, int);'
14811         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14812         esac
14813         case "$getlogin_r_proto" in
14814         ''|0)   d_getlogin_r=undef
14815                 getlogin_r_proto=0
14816                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14817         * )     case "$getlogin_r_proto" in
14818                 REENTRANT_PROTO*) ;;
14819                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14820                 esac
14821                 echo "Prototype: $try" ;;
14822         esac
14823         ;;
14824         *)      case "$usethreads" in
14825                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14826                 esac
14827                 d_getlogin_r=undef
14828                 getlogin_r_proto=0
14829                 ;;
14830         esac
14831         ;;
14832 *)      getlogin_r_proto=0
14833         ;;
14834 esac
14835
14836 : see if getmnt exists
14837 set getmnt d_getmnt
14838 eval $inlibc
14839
14840 : see if getmntent exists
14841 set getmntent d_getmntent
14842 eval $inlibc
14843
14844 : see if getnameinfo exists
14845 set getnameinfo d_getnameinfo
14846 eval $inlibc
14847
14848 : see if getnetbyaddr exists
14849 set getnetbyaddr d_getnbyaddr
14850 eval $inlibc
14851
14852 : see if getnetbyname exists
14853 set getnetbyname d_getnbyname
14854 eval $inlibc
14855
14856 : see if getnetent exists
14857 set getnetent d_getnent
14858 eval $inlibc
14859
14860 : see if getnetbyaddr_r exists
14861 set getnetbyaddr_r d_getnetbyaddr_r
14862 eval $inlibc
14863 case "$d_getnetbyaddr_r" in
14864 "$define")
14865         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14866         case "$d_getnetbyaddr_r_proto:$usethreads" in
14867         ":define")      d_getnetbyaddr_r_proto=define
14868                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14869                 eval $hasproto ;;
14870         *)      ;;
14871         esac
14872         case "$d_getnetbyaddr_r_proto" in
14873         define)
14874         case "$getnetbyaddr_r_proto" in
14875         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14876         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14877         esac
14878         case "$getnetbyaddr_r_proto" in
14879         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14880         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14881         esac
14882         case "$getnetbyaddr_r_proto" in
14883         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14884         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14885         esac
14886         case "$getnetbyaddr_r_proto" in
14887         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14888         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14889         esac
14890         case "$getnetbyaddr_r_proto" in
14891         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14892         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14893         esac
14894         case "$getnetbyaddr_r_proto" in
14895         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14896         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14897         esac
14898         case "$getnetbyaddr_r_proto" in
14899         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14900         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14901         esac
14902         case "$getnetbyaddr_r_proto" in
14903         ''|0) try='int getnetbyaddr_r(uint32_t, 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)   d_getnetbyaddr_r=undef
14908                 getnetbyaddr_r_proto=0
14909                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14910         * )     case "$getnetbyaddr_r_proto" in
14911                 REENTRANT_PROTO*) ;;
14912                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14913                 esac
14914                 echo "Prototype: $try" ;;
14915         esac
14916         ;;
14917         *)      case "$usethreads" in
14918                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14919                 esac
14920                 d_getnetbyaddr_r=undef
14921                 getnetbyaddr_r_proto=0
14922                 ;;
14923         esac
14924         ;;
14925 *)      getnetbyaddr_r_proto=0
14926         ;;
14927 esac
14928
14929 : see if getnetbyname_r exists
14930 set getnetbyname_r d_getnetbyname_r
14931 eval $inlibc
14932 case "$d_getnetbyname_r" in
14933 "$define")
14934         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14935         case "$d_getnetbyname_r_proto:$usethreads" in
14936         ":define")      d_getnetbyname_r_proto=define
14937                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14938                 eval $hasproto ;;
14939         *)      ;;
14940         esac
14941         case "$d_getnetbyname_r_proto" in
14942         define)
14943         case "$getnetbyname_r_proto" in
14944         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14945         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14946         esac
14947         case "$getnetbyname_r_proto" in
14948         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14949         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14950         esac
14951         case "$getnetbyname_r_proto" in
14952         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14953         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14954         esac
14955         case "$getnetbyname_r_proto" in
14956         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14957         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14958         esac
14959         case "$getnetbyname_r_proto" in
14960         ''|0)   d_getnetbyname_r=undef
14961                 getnetbyname_r_proto=0
14962                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14963         * )     case "$getnetbyname_r_proto" in
14964                 REENTRANT_PROTO*) ;;
14965                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14966                 esac
14967                 echo "Prototype: $try" ;;
14968         esac
14969         ;;
14970         *)      case "$usethreads" in
14971                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14972                 esac
14973                 d_getnetbyname_r=undef
14974                 getnetbyname_r_proto=0
14975                 ;;
14976         esac
14977         ;;
14978 *)      getnetbyname_r_proto=0
14979         ;;
14980 esac
14981
14982 : see if getnetent_r exists
14983 set getnetent_r d_getnetent_r
14984 eval $inlibc
14985 case "$d_getnetent_r" in
14986 "$define")
14987         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14988         case "$d_getnetent_r_proto:$usethreads" in
14989         ":define")      d_getnetent_r_proto=define
14990                 set d_getnetent_r_proto getnetent_r $hdrs
14991                 eval $hasproto ;;
14992         *)      ;;
14993         esac
14994         case "$d_getnetent_r_proto" in
14995         define)
14996         case "$getnetent_r_proto" in
14997         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14998         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14999         esac
15000         case "$getnetent_r_proto" in
15001         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15002         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15003         esac
15004         case "$getnetent_r_proto" in
15005         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15006         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15007         esac
15008         case "$getnetent_r_proto" in
15009         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15010         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15011         esac
15012         case "$getnetent_r_proto" in
15013         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15014         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15015         esac
15016         case "$getnetent_r_proto" in
15017         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15018         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15019         esac
15020         case "$getnetent_r_proto" in
15021         ''|0)   d_getnetent_r=undef
15022                 getnetent_r_proto=0
15023                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15024         * )     case "$getnetent_r_proto" in
15025                 REENTRANT_PROTO*) ;;
15026                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15027                 esac
15028                 echo "Prototype: $try" ;;
15029         esac
15030         ;;
15031         *)      case "$usethreads" in
15032                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15033                 esac
15034                 d_getnetent_r=undef
15035                 getnetent_r_proto=0
15036                 ;;
15037         esac
15038         ;;
15039 *)      getnetent_r_proto=0
15040         ;;
15041 esac
15042
15043 : see if prototypes for various getnetxxx netdb.h functions are available
15044 echo " "
15045 set d_getnetprotos getnetent $i_netdb netdb.h
15046 eval $hasproto
15047
15048 : see if getpagesize exists
15049 set getpagesize d_getpagsz
15050 eval $inlibc
15051
15052 : Optional checks for getprotobyname and getprotobynumber
15053
15054 : see if getprotobyname exists
15055 set getprotobyname d_getpbyname
15056 eval $inlibc
15057
15058 : see if getprotobynumber exists
15059 set getprotobynumber d_getpbynumber
15060 eval $inlibc
15061
15062 : see if getprotoent exists
15063 set getprotoent d_getpent
15064 eval $inlibc
15065
15066 : see if getpgid exists
15067 set getpgid d_getpgid
15068 eval $inlibc
15069
15070 : see if getpgrp2 exists
15071 set getpgrp2 d_getpgrp2
15072 eval $inlibc
15073
15074 : see if getppid exists
15075 set getppid d_getppid
15076 eval $inlibc
15077
15078 : see if getpriority exists
15079 set getpriority d_getprior
15080 eval $inlibc
15081
15082 : see if getprotobyname_r exists
15083 set getprotobyname_r d_getprotobyname_r
15084 eval $inlibc
15085 case "$d_getprotobyname_r" in
15086 "$define")
15087         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15088         case "$d_getprotobyname_r_proto:$usethreads" in
15089         ":define")      d_getprotobyname_r_proto=define
15090                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15091                 eval $hasproto ;;
15092         *)      ;;
15093         esac
15094         case "$d_getprotobyname_r_proto" in
15095         define)
15096         case "$getprotobyname_r_proto" in
15097         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15098         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15099         esac
15100         case "$getprotobyname_r_proto" in
15101         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15102         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15103         esac
15104         case "$getprotobyname_r_proto" in
15105         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15106         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15107         esac
15108         case "$getprotobyname_r_proto" in
15109         ''|0)   d_getprotobyname_r=undef
15110                 getprotobyname_r_proto=0
15111                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15112         * )     case "$getprotobyname_r_proto" in
15113                 REENTRANT_PROTO*) ;;
15114                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15115                 esac
15116                 echo "Prototype: $try" ;;
15117         esac
15118         ;;
15119         *)      case "$usethreads" in
15120                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15121                 esac
15122                 d_getprotobyname_r=undef
15123                 getprotobyname_r_proto=0
15124                 ;;
15125         esac
15126         ;;
15127 *)      getprotobyname_r_proto=0
15128         ;;
15129 esac
15130
15131 : see if getprotobynumber_r exists
15132 set getprotobynumber_r d_getprotobynumber_r
15133 eval $inlibc
15134 case "$d_getprotobynumber_r" in
15135 "$define")
15136         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15137         case "$d_getprotobynumber_r_proto:$usethreads" in
15138         ":define")      d_getprotobynumber_r_proto=define
15139                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15140                 eval $hasproto ;;
15141         *)      ;;
15142         esac
15143         case "$d_getprotobynumber_r_proto" in
15144         define)
15145         case "$getprotobynumber_r_proto" in
15146         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15147         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15148         esac
15149         case "$getprotobynumber_r_proto" in
15150         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15151         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15152         esac
15153         case "$getprotobynumber_r_proto" in
15154         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15155         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15156         esac
15157         case "$getprotobynumber_r_proto" in
15158         ''|0)   d_getprotobynumber_r=undef
15159                 getprotobynumber_r_proto=0
15160                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15161         * )     case "$getprotobynumber_r_proto" in
15162                 REENTRANT_PROTO*) ;;
15163                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15164                 esac
15165                 echo "Prototype: $try" ;;
15166         esac
15167         ;;
15168         *)      case "$usethreads" in
15169                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15170                 esac
15171                 d_getprotobynumber_r=undef
15172                 getprotobynumber_r_proto=0
15173                 ;;
15174         esac
15175         ;;
15176 *)      getprotobynumber_r_proto=0
15177         ;;
15178 esac
15179
15180 : see if getprotoent_r exists
15181 set getprotoent_r d_getprotoent_r
15182 eval $inlibc
15183 case "$d_getprotoent_r" in
15184 "$define")
15185         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15186         case "$d_getprotoent_r_proto:$usethreads" in
15187         ":define")      d_getprotoent_r_proto=define
15188                 set d_getprotoent_r_proto getprotoent_r $hdrs
15189                 eval $hasproto ;;
15190         *)      ;;
15191         esac
15192         case "$d_getprotoent_r_proto" in
15193         define)
15194         case "$getprotoent_r_proto" in
15195         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15196         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15197         esac
15198         case "$getprotoent_r_proto" in
15199         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15200         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15201         esac
15202         case "$getprotoent_r_proto" in
15203         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15204         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15205         esac
15206         case "$getprotoent_r_proto" in
15207         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15208         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15209         esac
15210         case "$getprotoent_r_proto" in
15211         ''|0)   d_getprotoent_r=undef
15212                 getprotoent_r_proto=0
15213                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15214         * )     case "$getprotoent_r_proto" in
15215                 REENTRANT_PROTO*) ;;
15216                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15217                 esac
15218                 echo "Prototype: $try" ;;
15219         esac
15220         ;;
15221         *)      case "$usethreads" in
15222                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15223                 esac
15224                 d_getprotoent_r=undef
15225                 getprotoent_r_proto=0
15226                 ;;
15227         esac
15228         ;;
15229 *)      getprotoent_r_proto=0
15230         ;;
15231 esac
15232
15233 : see if prototypes for various getprotoxxx netdb.h functions are available
15234 echo " "
15235 set d_getprotoprotos getprotoent $i_netdb netdb.h
15236 eval $hasproto
15237
15238 : see if getprpwnam exists
15239 set getprpwnam d_getprpwnam
15240 eval $inlibc
15241
15242 : see if getpwent exists
15243 set getpwent d_getpwent
15244 eval $inlibc
15245
15246 : see if getpwent_r exists
15247 set getpwent_r d_getpwent_r
15248 eval $inlibc
15249 case "$d_getpwent_r" in
15250 "$define")
15251         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15252         case "$d_getpwent_r_proto:$usethreads" in
15253         ":define")      d_getpwent_r_proto=define
15254                 set d_getpwent_r_proto getpwent_r $hdrs
15255                 eval $hasproto ;;
15256         *)      ;;
15257         esac
15258         case "$d_getpwent_r_proto" in
15259         define)
15260         case "$getpwent_r_proto" in
15261         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15262         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15263         esac
15264         case "$getpwent_r_proto" in
15265         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15266         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15267         esac
15268         case "$getpwent_r_proto" in
15269         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15270         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15271         esac
15272         case "$getpwent_r_proto" in
15273         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15274         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15275         esac
15276         case "$getpwent_r_proto" in
15277         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15278         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15279         esac
15280         case "$getpwent_r_proto" in
15281         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15282         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15283         esac
15284         case "$getpwent_r_proto" in
15285         ''|0)   d_getpwent_r=undef
15286                 getpwent_r_proto=0
15287                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15288         * )     case "$getpwent_r_proto" in
15289                 REENTRANT_PROTO*) ;;
15290                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15291                 esac
15292                 echo "Prototype: $try" ;;
15293         esac
15294         ;;
15295         *)      case "$usethreads" in
15296                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15297                 esac
15298                 d_getpwent_r=undef
15299                 getpwent_r_proto=0
15300                 ;;
15301         esac
15302         ;;
15303 *)      getpwent_r_proto=0
15304         ;;
15305 esac
15306
15307 : see if getpwnam_r exists
15308 set getpwnam_r d_getpwnam_r
15309 eval $inlibc
15310 case "$d_getpwnam_r" in
15311 "$define")
15312         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15313         case "$d_getpwnam_r_proto:$usethreads" in
15314         ":define")      d_getpwnam_r_proto=define
15315                 set d_getpwnam_r_proto getpwnam_r $hdrs
15316                 eval $hasproto ;;
15317         *)      ;;
15318         esac
15319         case "$d_getpwnam_r_proto" in
15320         define)
15321         case "$getpwnam_r_proto" in
15322         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15323         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15324         esac
15325         case "$getpwnam_r_proto" in
15326         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15327         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15328         esac
15329         case "$getpwnam_r_proto" in
15330         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15331         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15332         esac
15333         case "$getpwnam_r_proto" in
15334         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15335         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15336         esac
15337         case "$getpwnam_r_proto" in
15338         ''|0)   d_getpwnam_r=undef
15339                 getpwnam_r_proto=0
15340                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15341         * )     case "$getpwnam_r_proto" in
15342                 REENTRANT_PROTO*) ;;
15343                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15344                 esac
15345                 echo "Prototype: $try" ;;
15346         esac
15347         ;;
15348         *)      case "$usethreads" in
15349                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15350                 esac
15351                 d_getpwnam_r=undef
15352                 getpwnam_r_proto=0
15353                 ;;
15354         esac
15355         ;;
15356 *)      getpwnam_r_proto=0
15357         ;;
15358 esac
15359
15360 : see if getpwuid_r exists
15361 set getpwuid_r d_getpwuid_r
15362 eval $inlibc
15363 case "$d_getpwuid_r" in
15364 "$define")
15365         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15366         case "$d_getpwuid_r_proto:$usethreads" in
15367         ":define")      d_getpwuid_r_proto=define
15368                 set d_getpwuid_r_proto getpwuid_r $hdrs
15369                 eval $hasproto ;;
15370         *)      ;;
15371         esac
15372         case "$d_getpwuid_r_proto" in
15373         define)
15374         case "$getpwuid_r_proto" in
15375         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15376         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15377         esac
15378         case "$getpwuid_r_proto" in
15379         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15380         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15381         esac
15382         case "$getpwuid_r_proto" in
15383         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15384         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15385         esac
15386         case "$getpwuid_r_proto" in
15387         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15388         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15389         esac
15390         case "$getpwuid_r_proto" in
15391         ''|0)   d_getpwuid_r=undef
15392                 getpwuid_r_proto=0
15393                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15394         * )     case "$getpwuid_r_proto" in
15395                 REENTRANT_PROTO*) ;;
15396                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15397                 esac
15398                 echo "Prototype: $try" ;;
15399         esac
15400         ;;
15401         *)      case "$usethreads" in
15402                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15403                 esac
15404                 d_getpwuid_r=undef
15405                 getpwuid_r_proto=0
15406                 ;;
15407         esac
15408         ;;
15409 *)      getpwuid_r_proto=0
15410         ;;
15411 esac
15412
15413 : Optional checks for getsbyname and getsbyport
15414
15415 : see if getservbyname exists
15416 set getservbyname d_getsbyname
15417 eval $inlibc
15418
15419 : see if getservbyport exists
15420 set getservbyport d_getsbyport
15421 eval $inlibc
15422
15423 : see if getservent exists
15424 set getservent d_getsent
15425 eval $inlibc
15426
15427 : see if getservbyname_r exists
15428 set getservbyname_r d_getservbyname_r
15429 eval $inlibc
15430 case "$d_getservbyname_r" in
15431 "$define")
15432         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15433         case "$d_getservbyname_r_proto:$usethreads" in
15434         ":define")      d_getservbyname_r_proto=define
15435                 set d_getservbyname_r_proto getservbyname_r $hdrs
15436                 eval $hasproto ;;
15437         *)      ;;
15438         esac
15439         case "$d_getservbyname_r_proto" in
15440         define)
15441         case "$getservbyname_r_proto" in
15442         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15443         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15444         esac
15445         case "$getservbyname_r_proto" in
15446         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15447         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15448         esac
15449         case "$getservbyname_r_proto" in
15450         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15451         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15452         esac
15453         case "$getservbyname_r_proto" in
15454         ''|0)   d_getservbyname_r=undef
15455                 getservbyname_r_proto=0
15456                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15457         * )     case "$getservbyname_r_proto" in
15458                 REENTRANT_PROTO*) ;;
15459                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15460                 esac
15461                 echo "Prototype: $try" ;;
15462         esac
15463         ;;
15464         *)      case "$usethreads" in
15465                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15466                 esac
15467                 d_getservbyname_r=undef
15468                 getservbyname_r_proto=0
15469                 ;;
15470         esac
15471         ;;
15472 *)      getservbyname_r_proto=0
15473         ;;
15474 esac
15475
15476 : see if getservbyport_r exists
15477 set getservbyport_r d_getservbyport_r
15478 eval $inlibc
15479 case "$d_getservbyport_r" in
15480 "$define")
15481         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15482         case "$d_getservbyport_r_proto:$usethreads" in
15483         ":define")      d_getservbyport_r_proto=define
15484                 set d_getservbyport_r_proto getservbyport_r $hdrs
15485                 eval $hasproto ;;
15486         *)      ;;
15487         esac
15488         case "$d_getservbyport_r_proto" in
15489         define)
15490         case "$getservbyport_r_proto" in
15491         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15492         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15493         esac
15494         case "$getservbyport_r_proto" in
15495         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15496         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15497         esac
15498         case "$getservbyport_r_proto" in
15499         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15500         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15501         esac
15502         case "$getservbyport_r_proto" in
15503         ''|0)   d_getservbyport_r=undef
15504                 getservbyport_r_proto=0
15505                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15506         * )     case "$getservbyport_r_proto" in
15507                 REENTRANT_PROTO*) ;;
15508                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15509                 esac
15510                 echo "Prototype: $try" ;;
15511         esac
15512         ;;
15513         *)      case "$usethreads" in
15514                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15515                 esac
15516                 d_getservbyport_r=undef
15517                 getservbyport_r_proto=0
15518                 ;;
15519         esac
15520         ;;
15521 *)      getservbyport_r_proto=0
15522         ;;
15523 esac
15524
15525 : see if getservent_r exists
15526 set getservent_r d_getservent_r
15527 eval $inlibc
15528 case "$d_getservent_r" in
15529 "$define")
15530         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15531         case "$d_getservent_r_proto:$usethreads" in
15532         ":define")      d_getservent_r_proto=define
15533                 set d_getservent_r_proto getservent_r $hdrs
15534                 eval $hasproto ;;
15535         *)      ;;
15536         esac
15537         case "$d_getservent_r_proto" in
15538         define)
15539         case "$getservent_r_proto" in
15540         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15541         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15542         esac
15543         case "$getservent_r_proto" in
15544         ''|0) try='int getservent_r(struct servent*, char*, int);'
15545         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15546         esac
15547         case "$getservent_r_proto" in
15548         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15549         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15550         esac
15551         case "$getservent_r_proto" in
15552         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15553         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15554         esac
15555         case "$getservent_r_proto" in
15556         ''|0)   d_getservent_r=undef
15557                 getservent_r_proto=0
15558                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15559         * )     case "$getservent_r_proto" in
15560                 REENTRANT_PROTO*) ;;
15561                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15562                 esac
15563                 echo "Prototype: $try" ;;
15564         esac
15565         ;;
15566         *)      case "$usethreads" in
15567                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15568                 esac
15569                 d_getservent_r=undef
15570                 getservent_r_proto=0
15571                 ;;
15572         esac
15573         ;;
15574 *)      getservent_r_proto=0
15575         ;;
15576 esac
15577
15578 : see if prototypes for various getservxxx netdb.h functions are available
15579 echo " "
15580 set d_getservprotos getservent $i_netdb netdb.h
15581 eval $hasproto
15582
15583 : see if getspnam exists
15584 set getspnam d_getspnam
15585 eval $inlibc
15586
15587 : see if this is a shadow.h system
15588 set shadow.h i_shadow
15589 eval $inhdr
15590
15591 : see if getspnam_r exists
15592 set getspnam_r d_getspnam_r
15593 eval $inlibc
15594 case "$d_getspnam_r" in
15595 "$define")
15596         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15597         case "$d_getspnam_r_proto:$usethreads" in
15598         ":define")      d_getspnam_r_proto=define
15599                 set d_getspnam_r_proto getspnam_r $hdrs
15600                 eval $hasproto ;;
15601         *)      ;;
15602         esac
15603         case "$d_getspnam_r_proto" in
15604         define)
15605         case "$getspnam_r_proto" in
15606         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15607         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15608         esac
15609         case "$getspnam_r_proto" in
15610         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15611         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15612         esac
15613         case "$getspnam_r_proto" in
15614         ''|0)   d_getspnam_r=undef
15615                 getspnam_r_proto=0
15616                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15617         * )     case "$getspnam_r_proto" in
15618                 REENTRANT_PROTO*) ;;
15619                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15620                 esac
15621                 echo "Prototype: $try" ;;
15622         esac
15623         ;;
15624         *)      case "$usethreads" in
15625                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15626                 esac
15627                 d_getspnam_r=undef
15628                 getspnam_r_proto=0
15629                 ;;
15630         esac
15631         ;;
15632 *)      getspnam_r_proto=0
15633         ;;
15634 esac
15635
15636 : see if gettimeofday or ftime exists
15637 set gettimeofday d_gettimeod
15638 eval $inlibc
15639 case "$d_gettimeod" in
15640 "$undef")
15641         set ftime d_ftime 
15642         eval $inlibc
15643         ;;
15644 *)
15645         val="$undef"; set d_ftime; eval $setvar
15646         ;;
15647 esac
15648 case "$d_gettimeod$d_ftime" in
15649 "$undef$undef")
15650         echo " "
15651         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15652         ;;
15653 esac
15654
15655 : see if gmtime_r exists
15656 set gmtime_r d_gmtime_r
15657 eval $inlibc
15658 case "$d_gmtime_r" in
15659 "$define")
15660         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15661         case "$d_gmtime_r_proto:$usethreads" in
15662         ":define")      d_gmtime_r_proto=define
15663                 set d_gmtime_r_proto gmtime_r $hdrs
15664                 eval $hasproto ;;
15665         *)      ;;
15666         esac
15667         case "$d_gmtime_r_proto" in
15668         define)
15669         case "$gmtime_r_proto" in
15670         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15671         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15672         esac
15673         case "$gmtime_r_proto" in
15674         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15675         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15676         esac
15677         case "$gmtime_r_proto" in
15678         ''|0)   d_gmtime_r=undef
15679                 gmtime_r_proto=0
15680                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15681         * )     case "$gmtime_r_proto" in
15682                 REENTRANT_PROTO*) ;;
15683                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15684                 esac
15685                 echo "Prototype: $try" ;;
15686         esac
15687         ;;
15688         *)      case "$usethreads" in
15689                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15690                 esac
15691                 d_gmtime_r=undef
15692                 gmtime_r_proto=0
15693                 ;;
15694         esac
15695         ;;
15696 *)      gmtime_r_proto=0
15697         ;;
15698 esac
15699
15700 : see if hasmntopt exists
15701 set hasmntopt d_hasmntopt
15702 eval $inlibc
15703
15704 : see if this is a netinet/in.h or sys/in.h system
15705 set netinet/in.h i_niin sys/in.h i_sysin
15706 eval $inhdr
15707
15708 : see if arpa/inet.h has to be included
15709 set arpa/inet.h i_arpainet
15710 eval $inhdr
15711
15712 : see if htonl --and friends-- exists
15713 val=''
15714 set htonl val
15715 eval $inlibc
15716
15717 : Maybe they are macros.
15718 case "$val" in
15719 $undef)
15720         $cat >htonl.c <<EOM
15721 #include <stdio.h>
15722 #include <sys/types.h>
15723 #$i_niin I_NETINET_IN
15724 #$i_sysin I_SYS_IN
15725 #$i_arpainet I_ARPA_INET
15726 #ifdef I_NETINET_IN
15727 #include <netinet/in.h>
15728 #endif
15729 #ifdef I_SYS_IN
15730 #include <sys/in.h>
15731 #endif
15732 #ifdef I_ARPA_INET
15733 #include <arpa/inet.h>
15734 #endif
15735 #ifdef htonl
15736 printf("Defined as a macro.");
15737 #endif
15738 EOM
15739         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15740         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15741                 val="$define"
15742                 echo "But it seems to be defined as a macro." >&4
15743         fi
15744         $rm -f htonl.?
15745         ;;
15746 esac
15747 set d_htonl
15748 eval $setvar
15749
15750 : see if hypot exists
15751 set hypot d_hypot
15752 eval $inlibc
15753
15754 : see if ilogb exists
15755 set ilogb d_ilogb
15756 eval $inlibc
15757
15758 : see if ilogbl exists
15759 set ilogbl d_ilogbl
15760 eval $inlibc
15761
15762 : index or strchr
15763 echo " "
15764 if set index val -f; eval $csym; $val; then
15765         if set strchr val -f d_strchr; eval $csym; $val; then
15766                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15767                         val="$define"
15768                         vali="$undef"
15769                         echo "strchr() found." >&4
15770                 else
15771                         val="$undef"
15772                         vali="$define"
15773                         echo "index() found." >&4
15774                 fi
15775         else
15776                 val="$undef"
15777                 vali="$define"
15778                 echo "index() found." >&4
15779         fi
15780 else
15781         if set strchr val -f d_strchr; eval $csym; $val; then
15782                 val="$define"
15783                 vali="$undef"
15784                 echo "strchr() found." >&4
15785         else
15786                 echo "No index() or strchr() found!" >&4
15787                 val="$undef"
15788                 vali="$undef"
15789         fi
15790 fi
15791 set d_strchr; eval $setvar
15792 val="$vali"
15793 set d_index; eval $setvar
15794
15795 : check whether inet_aton exists
15796 set inet_aton d_inetaton
15797 eval $inlibc
15798
15799 : see if inet_ntop exists
15800 set inet_ntop d_inetntop
15801 eval $inlibc
15802
15803 : see if inet_pton exists
15804 set inet_pton d_inetpton
15805 eval $inlibc
15806
15807 : Look for isascii
15808 echo " "
15809 $cat >isascii.c <<EOCP
15810 #include <stdio.h>
15811 #include <ctype.h>
15812 #$i_stdlib I_STDLIB
15813 #ifdef I_STDLIB
15814 #include <stdlib.h>
15815 #endif
15816 int main() {
15817         int c = 'A';
15818         if (isascii(c))
15819                 exit(0);
15820         else
15821                 exit(1);
15822 }
15823 EOCP
15824 set isascii
15825 if eval $compile; then
15826         echo "isascii() found." >&4
15827         val="$define"
15828 else
15829         echo "isascii() NOT found." >&4
15830         val="$undef"
15831 fi
15832 set d_isascii
15833 eval $setvar
15834 $rm -f isascii*
15835
15836 : Look for isblank
15837 echo " "
15838 $cat >isblank.c <<'EOCP'
15839 #include <stdio.h>
15840 #include <ctype.h>
15841 int main() {
15842         int c = ' ';
15843         if (isblank(c))
15844                 return 0 ;
15845         else
15846                 return 1 ;
15847 }
15848 EOCP
15849 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15850         echo "isblank() found." >&4
15851         val="$define"
15852 else
15853         echo "isblank() NOT found." >&4
15854         val="$undef"
15855 fi
15856 set d_isblank
15857 eval $setvar
15858 $rm -f isblank*
15859
15860 : check for isfinite
15861 echo "Checking to see if you have isfinite..." >&4
15862 $cat >try.c <<EOCP
15863 #$i_math I_MATH
15864 #ifdef I_MATH
15865 #include <math.h>
15866 #endif
15867 int main() { return isfinite(0.0); }
15868 EOCP
15869 set try
15870 if eval $compile; then
15871         val="$define"
15872         echo "You have isfinite."
15873 else
15874         val="$undef"
15875         echo "You do not have isfinite."
15876 fi
15877 $rm_try
15878 set d_isfinite
15879 eval $setvar
15880
15881 : see if isfinitel exists
15882 set isfinitel d_isfinitel
15883 eval $inlibc
15884
15885 : check for isinf
15886 echo "Checking to see if you have isinf..." >&4
15887 $cat >try.c <<EOCP
15888 #$i_math I_MATH
15889 #ifdef I_MATH
15890 #include <math.h>
15891 #endif
15892 int main() { return isinf(0.0); }
15893 EOCP
15894 set try
15895 if eval $compile; then
15896         val="$define"
15897         echo "You have isinf."
15898 else
15899         val="$undef"
15900         echo "You do not have isinf."
15901 fi
15902 $rm_try
15903 set d_isinf
15904 eval $setvar
15905
15906 : see if isinfl exists
15907 set isinfl d_isinfl
15908 eval $inlibc
15909
15910 : check for isless
15911 echo "Checking to see if you have isless..." >&4
15912 $cat >try.c <<EOCP
15913 #$i_math I_MATH
15914 #ifdef I_MATH
15915 #include <math.h>
15916 #endif
15917 int main() { return isless(0.0); }
15918 EOCP
15919 set try
15920 if eval $compile; then
15921         val="$define"
15922         echo "You have isless."
15923 else
15924         val="$undef"
15925         echo "You do not have isless."
15926 fi
15927 $rm_try
15928 set d_isless
15929 eval $setvar
15930
15931 : check for isnan
15932 echo "Checking to see if you have isnan..." >&4
15933 $cat >try.c <<EOCP
15934 #$i_math I_MATH
15935 #ifdef I_MATH
15936 #include <math.h>
15937 #endif
15938 int main() { return isnan(0.0); }
15939 EOCP
15940 set try
15941 if eval $compile; then
15942         val="$define"
15943         echo "You have isnan."
15944 else
15945         val="$undef"
15946         echo "You do not have isnan."
15947 fi
15948 $rm_try
15949 set d_isnan
15950 eval $setvar
15951
15952 : see if isnanl exists
15953 set isnanl d_isnanl
15954 eval $inlibc
15955
15956 : check for isnormal
15957 echo "Checking to see if you have isnormal..." >&4
15958 $cat >try.c <<EOCP
15959 #$i_math I_MATH
15960 #ifdef I_MATH
15961 #include <math.h>
15962 #endif
15963 int main() { return isnormal(0.0); }
15964 EOCP
15965 set try
15966 if eval $compile; then
15967         val="$define"
15968         echo "You have isnormal."
15969 else
15970         val="$undef"
15971         echo "You do not have isnormal."
15972 fi
15973 $rm_try
15974 set d_isnormal
15975 eval $setvar
15976
15977 : see if j0 exists
15978 set j0 d_j0
15979 eval $inlibc
15980
15981 : see if j0l exists
15982 set j0l d_j0l
15983 eval $inlibc
15984
15985 : see if killpg exists
15986 set killpg d_killpg
15987 eval $inlibc
15988
15989 : see if localeconv exists
15990 set localeconv d_locconv
15991 eval $inlibc
15992
15993 : see if libc has the POSIX.1-2008 currency locale rules
15994 case "$d_locconv:$d_lc_monetary_2008" in
15995 $define:)
15996         $cat >try.c <<EOCP
15997 #include <locale.h>
15998 int main() {
15999         struct lconv *lc = localeconv();
16000         char int_p_cs_precedes = lc->int_p_cs_precedes;
16001         return 0;
16002 }
16003 EOCP
16004         set try
16005         if eval $compile; then
16006                 d_lc_monetary_2008="$define"
16007         else
16008                 d_lc_monetary_2008="$undef"
16009         fi;
16010         $rm_try
16011         ;;
16012 esac
16013
16014 : see if lchown exists
16015 echo " "
16016 $cat > try.c <<'EOCP'
16017 /* System header to define __stub macros and hopefully few prototypes,
16018     which can conflict with char lchown(); below.  */
16019 #include <assert.h>
16020 /* Override any gcc2 internal prototype to avoid an error.  */
16021 /* We use char because int might match the return type of a gcc2
16022    builtin and then its argument prototype would still apply.  */
16023 char lchown();
16024 int main() {
16025     /*  The GNU C library defines this for functions which it implements
16026         to always fail with ENOSYS.  Some functions are actually named
16027         something starting with __ and the normal name is an alias.  */
16028 #if defined (__stub_lchown) || defined (__stub___lchown)
16029 choke me
16030 #else
16031 lchown();
16032 #endif
16033 ; return 0; }
16034 EOCP
16035 set try
16036 if eval $compile; then
16037     $echo "lchown() found." >&4
16038     val="$define"
16039 else
16040     $echo "lchown() NOT found." >&4
16041     val="$undef"
16042 fi
16043 set d_lchown
16044 eval $setvar
16045
16046 : See if number of significant digits in a double precision number is known
16047 echo " "
16048 $cat >ldbl_dig.c <<EOM
16049 #$i_limits I_LIMITS
16050 #$i_float I_FLOAT
16051 #ifdef I_LIMITS
16052 #include <limits.h>
16053 #endif
16054 #ifdef I_FLOAT
16055 #include <float.h>
16056 #endif
16057 #ifdef LDBL_DIG
16058 printf("Contains LDBL_DIG");
16059 #endif
16060 EOM
16061 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16062 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16063         echo "LDBL_DIG found." >&4
16064         val="$define"
16065 else
16066         echo "LDBL_DIG NOT found." >&4
16067         val="$undef"
16068 fi
16069 $rm -f ldbl_dig.?
16070 set d_ldbl_dig
16071 eval $setvar
16072
16073 : see if lgamma exists
16074 set lgamma d_lgamma
16075 eval $inlibc
16076
16077 : see if lgamma_r exists
16078 set lgamma_r d_lgamma_r
16079 eval $inlibc
16080
16081 : check to see if math.h defines _LIB_VERSION
16082 d_libm_lib_version="$undef"
16083 case $i_math in
16084     $define)
16085         echo " "
16086         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16087         $cat >try.c <<EOCP
16088 #include <unistd.h>
16089 #include <math.h>
16090 int main (int argc, char *argv[])
16091 {
16092     printf ("%d\n", _LIB_VERSION);
16093     return (0);
16094     } /* main */
16095 EOCP
16096         set try
16097         if eval $compile; then
16098             foo=`$run ./try`
16099             echo "Yes, it does ($foo)" >&4
16100             d_libm_lib_version="$define"
16101         else
16102             echo "No, it does not (probably harmless)" >&4
16103             fi
16104         $rm_try
16105         ;;
16106
16107     esac
16108
16109 : see if link exists
16110 set link d_link
16111 eval $inlibc
16112
16113 : see if llrint exists
16114 set llrint d_llrint
16115 eval $inlibc
16116
16117 : see if llrintl exists
16118 set llrintl d_llrintl
16119 eval $inlibc
16120
16121 : see if llround exists
16122 set llround d_llround
16123 eval $inlibc
16124
16125 : see if llroundl exists
16126 set llroundl d_llroundl
16127 eval $inlibc
16128
16129 : see if localtime_r exists
16130 set localtime_r d_localtime_r
16131 eval $inlibc
16132 case "$d_localtime_r" in
16133 "$define")
16134         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16135         case "$d_localtime_r_proto:$usethreads" in
16136         ":define")      d_localtime_r_proto=define
16137                 set d_localtime_r_proto localtime_r $hdrs
16138                 eval $hasproto ;;
16139         *)      ;;
16140         esac
16141         case "$d_localtime_r_proto" in
16142         define)
16143         case "$localtime_r_proto" in
16144         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16145         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16146         esac
16147         case "$localtime_r_proto" in
16148         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16149         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16150         esac
16151         case "$localtime_r_proto" in
16152         ''|0)   d_localtime_r=undef
16153                 localtime_r_proto=0
16154                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16155         * )     case "$localtime_r_proto" in
16156                 REENTRANT_PROTO*) ;;
16157                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16158                 esac
16159                 echo "Prototype: $try" ;;
16160         esac
16161         ;;
16162         *)      case "$usethreads" in
16163                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16164                 esac
16165                 d_localtime_r=undef
16166                 localtime_r_proto=0
16167                 ;;
16168         esac
16169         ;;
16170 *)      localtime_r_proto=0
16171         ;;
16172 esac
16173
16174 : see if localtime_r calls tzset
16175 case "$localtime_r_proto" in
16176 REENTRANT_PROTO*)
16177         $cat >try.c <<EOCP
16178 /*  Does our libc's localtime_r call tzset ?
16179  *  return 0 if so, 1 otherwise.
16180  */
16181 #$i_systypes    I_SYS_TYPES
16182 #$i_unistd      I_UNISTD
16183 #$i_time        I_TIME
16184 #$i_stdlib      I_STDLIB
16185 #$i_string      I_STRING
16186 #$i_malloc      I_MALLOC
16187 #ifdef I_SYS_TYPES
16188 #  include <sys/types.h>
16189 #endif
16190 #ifdef I_UNISTD
16191 #  include <unistd.h>
16192 #endif
16193 #ifdef I_TIME
16194 #  include <time.h>
16195 #endif
16196 #ifdef I_STDLIB
16197 #include <stdlib.h>
16198 #endif
16199 #ifdef I_STRING
16200 #  include <string.h>
16201 #else
16202 #  include <strings.h>
16203 #endif
16204 #ifdef I_MALLOC
16205 #  include <malloc.h>
16206 #endif
16207 int main()
16208 {
16209     time_t t = time(0L);
16210     char w_tz[]="TZ" "=GMT+5",
16211          e_tz[]="TZ" "=GMT-5",
16212         *tz_e = (char*)malloc(16),
16213         *tz_w = (char*)malloc(16);
16214     struct tm tm_e, tm_w;
16215     memset(&tm_e,'\0',sizeof(struct tm));
16216     memset(&tm_w,'\0',sizeof(struct tm));
16217     strcpy(tz_e,e_tz);
16218     strcpy(tz_w,w_tz);
16219
16220     putenv(tz_e);
16221     localtime_r(&t, &tm_e);
16222
16223     putenv(tz_w);
16224     localtime_r(&t, &tm_w);
16225
16226     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16227         return 1;
16228     return 0;
16229 }
16230 EOCP
16231         set try
16232         if eval $compile; then
16233             if $run ./try; then
16234                 d_localtime_r_needs_tzset=undef;
16235             else
16236                 d_localtime_r_needs_tzset=define;
16237             fi;
16238         else
16239             d_localtime_r_needs_tzset=undef;
16240         fi;
16241      ;;
16242   *)
16243      d_localtime_r_needs_tzset=undef;
16244      ;;
16245 esac
16246 $rm_try
16247
16248 : see if lockf exists
16249 set lockf d_lockf
16250 eval $inlibc
16251
16252 : see if log1p exists
16253 set log1p d_log1p
16254 eval $inlibc
16255
16256 : see if log2 exists
16257 set log2 d_log2
16258 eval $inlibc
16259
16260 : see if logb exists
16261 set logb d_logb
16262 eval $inlibc
16263
16264 : see if lrint exists
16265 set lrint d_lrint
16266 eval $inlibc
16267
16268 : see if lrintl exists
16269 set lrintl d_lrintl
16270 eval $inlibc
16271
16272 : see if lround exists
16273 set lround d_lround
16274 eval $inlibc
16275
16276 : see if lroundl exists
16277 set lroundl d_lroundl
16278 eval $inlibc
16279
16280 : see if prototype for lseek is available
16281 echo " "
16282 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16283 eval $hasproto
16284
16285 : see if lstat exists
16286 set lstat d_lstat
16287 eval $inlibc
16288
16289 : see if madvise exists
16290 set madvise d_madvise
16291 eval $inlibc
16292
16293 : see if malloc_size exists
16294 set malloc_size d_malloc_size
16295 eval $inlibc
16296
16297 : see if malloc_size_good exists
16298 set malloc_good_size d_malloc_good_size
16299 eval $inlibc
16300
16301 : see if mblen exists
16302 set mblen d_mblen
16303 eval $inlibc
16304
16305 : see if mbstowcs exists
16306 set mbstowcs d_mbstowcs
16307 eval $inlibc
16308
16309 : see if mbtowc exists
16310 set mbtowc d_mbtowc
16311 eval $inlibc
16312
16313 : see if memchr exists
16314 set memchr d_memchr
16315 eval $inlibc
16316
16317 : see if memcmp exists
16318 set memcmp d_memcmp
16319 eval $inlibc
16320
16321 : see if memcpy exists
16322 set memcpy d_memcpy
16323 eval $inlibc
16324
16325 : see if memmove exists
16326 set memmove d_memmove
16327 eval $inlibc
16328
16329 : see if memset exists
16330 set memset d_memset
16331 eval $inlibc
16332
16333 : see if mkdir exists
16334 set mkdir d_mkdir
16335 eval $inlibc
16336
16337 : see if mkdtemp exists
16338 set mkdtemp d_mkdtemp
16339 eval $inlibc
16340
16341 : see if mkfifo exists
16342 set mkfifo d_mkfifo
16343 eval $inlibc
16344
16345 : see if mkstemp exists
16346 set mkstemp d_mkstemp
16347 eval $inlibc
16348
16349 : see if mkstemps exists
16350 set mkstemps d_mkstemps
16351 eval $inlibc
16352
16353 : see if mktime exists
16354 set mktime d_mktime
16355 eval $inlibc
16356
16357 : see if this is a sys/mman.h system
16358 set sys/mman.h i_sysmman
16359 eval $inhdr
16360
16361 : see if mmap exists
16362 set mmap d_mmap
16363 eval $inlibc
16364 : see what shmat returns
16365 : default to something harmless
16366 mmaptype='void *'
16367 case "$i_sysmman$d_mmap" in
16368 "$define$define")
16369         $cat >mmap.c <<'END'
16370 #include <sys/mman.h>
16371 void *mmap();
16372 END
16373         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16374                 mmaptype='void *'
16375         else
16376                 mmaptype='caddr_t'
16377         fi
16378         echo "and it returns ($mmaptype)." >&4
16379         ;;
16380 esac
16381
16382
16383
16384 : see if sqrtl exists
16385 set sqrtl d_sqrtl
16386 eval $inlibc
16387
16388 : see if scalbnl exists
16389 set scalbnl d_scalbnl
16390 eval $inlibc
16391
16392 : see if truncl exists
16393 set truncl d_truncl
16394 eval $inlibc
16395
16396 : see if modfl exists
16397 set modfl d_modfl
16398 eval $inlibc
16399
16400 : see if prototype for modfl is available
16401 echo " "
16402 set d_modflproto modfl $i_math math.h
16403 eval $hasproto
16404
16405 d_modfl_pow32_bug="$undef"
16406
16407 case "$d_longdbl$d_modfl" in
16408 $define$define)
16409         $cat <<EOM
16410 Checking to see whether your modfl() is okay for large values...
16411 EOM
16412 $cat >try.c <<EOCP
16413 #include <math.h>
16414 #include <stdio.h>
16415 EOCP
16416 if $test "X$d_modflproto" != "X$define"; then
16417         $cat >>try.c <<EOCP
16418 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16419 long double modfl (long double, long double *);
16420 EOCP
16421 fi
16422 $cat >>try.c <<EOCP
16423 int main() {
16424     long double nv = 4294967303.15;
16425     long double v, w;
16426     v = modfl(nv, &w);
16427 #ifdef __GLIBC__
16428     printf("glibc");
16429 #endif
16430     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16431     return 0;
16432 }
16433 EOCP
16434         case "$osname:$gccversion" in
16435         aix:)   saveccflags="$ccflags"
16436                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16437         esac
16438         set try
16439         if eval $compile; then
16440                 foo=`$run ./try`
16441                 case "$foo" in
16442                 *" 4294967303.150000 1.150000 4294967302.000000")
16443                         echo >&4 "Your modfl() is broken for large values."
16444                         d_modfl_pow32_bug="$define"
16445                         case "$foo" in
16446                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16447                         ;;
16448                         esac
16449                         ;;
16450                 *" 4294967303.150000 0.150000 4294967303.000000")
16451                         echo >&4 "Your modfl() seems okay for large values."
16452                         ;;
16453                 *)      echo >&4 "I don't understand your modfl() at all."
16454                         d_modfl="$undef"
16455                         ;;
16456                 esac
16457                 $rm_try
16458         else
16459                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16460                 d_modfl="$undef"
16461         fi
16462         case "$osname:$gccversion" in
16463         aix:)   ccflags="$saveccflags" ;; # restore
16464         esac
16465         ;;
16466 esac
16467
16468 if $test "$uselongdouble" = "$define"; then
16469     message=""
16470     if $test "$d_sqrtl" != "$define"; then
16471         message="$message sqrtl"
16472     fi
16473     if $test "$d_modfl" != "$define"; then
16474         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16475             echo "You have both truncl and copysignl, so I can emulate modfl."
16476         else
16477             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16478                 echo "You have both aintl and copysignl, so I can emulate modfl."
16479             else
16480                 message="$message modfl"
16481             fi
16482         fi
16483     fi
16484     if $test "$d_frexpl" != "$define"; then
16485         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16486             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16487         else
16488             message="$message frexpl"
16489         fi
16490     fi
16491     if $test "$d_ldexpl" != "$define"; then
16492         message="$message ldexpl"
16493     fi
16494
16495     if $test "$message" != ""; then
16496         $cat <<EOM >&4
16497
16498 *** You requested the use of long doubles but you do not seem to have
16499 *** the following mathematical functions needed for long double support:
16500 ***    $message
16501 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16502 *** Cannot continue, aborting.
16503
16504 EOM
16505
16506         exit 1
16507     fi
16508 fi
16509
16510 : see if mprotect exists
16511 set mprotect d_mprotect
16512 eval $inlibc
16513
16514 : see if msgctl exists
16515 set msgctl d_msgctl
16516 eval $inlibc
16517
16518 : see if msgget exists
16519 set msgget d_msgget
16520 eval $inlibc
16521
16522 : see if msgsnd exists
16523 set msgsnd d_msgsnd
16524 eval $inlibc
16525
16526 : see if msgrcv exists
16527 set msgrcv d_msgrcv
16528 eval $inlibc
16529
16530 : see how much of the 'msg*(2)' library is present.
16531 h_msg=true
16532 echo " "
16533 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16534 *"$undef"*) h_msg=false;;
16535 esac
16536 case "$osname" in
16537 freebsd)
16538     case "`ipcs 2>&1`" in
16539     "SVID messages"*"not configured"*)
16540         echo "Your $osname does not have the msg*(2) configured." >&4
16541         h_msg=false
16542         val="$undef"
16543         set msgctl d_msgctl
16544         eval $setvar
16545         set msgget d_msgget
16546         eval $setvar
16547         set msgsnd d_msgsnd
16548         eval $setvar
16549         set msgrcv d_msgrcv
16550         eval $setvar
16551         ;;
16552     esac
16553     ;;
16554 esac
16555 : we could also check for sys/ipc.h ...
16556 if $h_msg && $test `./findhdr sys/msg.h`; then
16557         echo "You have the full msg*(2) library." >&4
16558         val="$define"
16559 else
16560         echo "You don't have the full msg*(2) library." >&4
16561         val="$undef"
16562 fi
16563 set d_msg
16564 eval $setvar
16565
16566 : Check for msghdr_s
16567 echo " "
16568 echo "Checking to see if your system supports struct msghdr..." >&4
16569 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16570 eval $hasstruct
16571 case "$d_msghdr_s" in
16572 "$define")      echo "Yes, it does."   ;;
16573 *)              echo "No, it doesn't." ;;
16574 esac
16575
16576
16577 : see if msync exists
16578 set msync d_msync
16579 eval $inlibc
16580
16581 : see if munmap exists
16582 set munmap d_munmap
16583 eval $inlibc
16584
16585 : see if nan exists
16586 set nan d_nan
16587 eval $inlibc
16588
16589 : see if nearbyint exists
16590 set nearbyint d_nearbyint
16591 eval $inlibc
16592
16593 : see if nextafter exists
16594 set nextafter d_nextafter
16595 eval $inlibc
16596
16597 : see if nexttoward exists
16598 set nexttoward d_nexttoward
16599 eval $inlibc
16600
16601 : see if nice exists
16602 set nice d_nice
16603 eval $inlibc
16604
16605 : see if this is a langinfo.h system
16606 set langinfo.h i_langinfo
16607 eval $inhdr
16608
16609 : see if nl_langinfo exists
16610 set nl_langinfo d_nl_langinfo
16611 eval $inlibc
16612
16613 : see if this is a quadmath.h system
16614 set quadmath.h i_quadmath
16615 eval $inhdr
16616
16617 : check for volatile keyword
16618 echo " "
16619 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16620 $cat >try.c <<'EOCP'
16621 int main()
16622 {
16623         typedef struct _goo_struct goo_struct;
16624         goo_struct * volatile goo = ((goo_struct *)0);
16625         struct _goo_struct {
16626                 long long_int;
16627                 int reg_int;
16628                 char char_var;
16629         };
16630         typedef unsigned short foo_t;
16631         char *volatile foo;
16632         volatile int bar;
16633         volatile foo_t blech;
16634         foo = foo;
16635 }
16636 EOCP
16637 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16638         val="$define"
16639         echo "Yup, it does."
16640 else
16641         val="$undef"
16642         echo "Nope, it doesn't."
16643 fi
16644 set d_volatile
16645 eval $setvar
16646 $rm_try
16647
16648 : Check basic sizes
16649 echo " "
16650 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16651
16652 case "$use64bitint:$d_quad:$quadtype" in
16653 define:define:?*)
16654         ivtype="$quadtype"
16655         uvtype="$uquadtype"
16656         ivsize=8
16657         uvsize=8
16658         ;;
16659 *)      ivtype="long"
16660         uvtype="unsigned long"
16661         ivsize=$longsize
16662         uvsize=$longsize
16663         ;;
16664 esac
16665
16666 case "$uselongdouble:$d_longdbl" in
16667 define:define)
16668         nvtype="long double"
16669         nvsize=$longdblsize
16670         ;;
16671 *)      nvtype=double
16672         nvsize=$doublesize
16673         ;;
16674 esac
16675
16676 case "$usequadmath:$i_quadmath" in
16677 define:define)
16678   nvtype="__float128"
16679   nvsize=16
16680   case "$libs" in
16681   *quadmath*) ;;
16682   *) $cat <<EOM >&4
16683
16684 *** You requested the use of the quadmath library, but you
16685 *** do not seem to have the quadmath library installed.
16686 *** Cannot continue, aborting.
16687 EOM
16688     exit 1
16689     ;;
16690   esac
16691   ;;
16692 define:*) $cat <<EOM >&4
16693
16694 *** You requested the use of the quadmath library, but you
16695 *** do not seem to have the required header, <quadmath.h>.
16696 EOM
16697   case "$gccversion" in
16698   [23].*|4.[0-5]*)
16699    $cat <<EOM >&4
16700 *** Your gcc looks a bit old:
16701 *** $gccversion
16702 EOM
16703     ;;
16704   '')
16705    $cat <<EOM >&4
16706 *** You are not running a gcc.
16707 EOM
16708     ;;
16709   esac
16710   $cat <<EOM >&4
16711 *** For the quadmath library you need at least gcc 4.6.
16712 *** Cannot continue, aborting.
16713 EOM
16714   exit 1
16715   ;;
16716 esac
16717
16718 $echo "(IV will be "$ivtype", $ivsize bytes)"
16719 $echo "(UV will be "$uvtype", $uvsize bytes)"
16720 $echo "(NV will be "$nvtype", $nvsize bytes)"
16721
16722 $cat >try.c <<EOCP
16723 #$i_inttypes I_INTTYPES
16724 #ifdef I_INTTYPES
16725 #include <inttypes.h>
16726 #endif
16727 #include <stdio.h>
16728 int main() {
16729 #ifdef INT8
16730    int8_t i =  INT8_MAX;
16731   uint8_t u = UINT8_MAX;
16732   printf("int8_t\n");
16733 #endif
16734 #ifdef INT16
16735    int16_t i =  INT16_MAX;
16736   uint16_t u = UINT16_MAX;
16737   printf("int16_t\n");
16738 #endif
16739 #ifdef INT32
16740    int32_t i =  INT32_MAX;
16741   uint32_t u = UINT32_MAX;
16742   printf("int32_t\n");
16743 #endif
16744 }
16745 EOCP
16746
16747 i8type="signed char"
16748 u8type="unsigned char"
16749 i8size=1
16750 u8size=1
16751
16752 case "$i16type" in
16753 '')     case "$shortsize" in
16754         2)      i16type=short
16755                 u16type="unsigned short"
16756                 i16size=$shortsize
16757                 u16size=$shortsize
16758                 ;;
16759         esac
16760         ;;
16761 esac
16762 case "$i16type" in
16763 '')     set try -DINT16
16764         if eval $compile; then
16765                 case "`$run ./try`" in
16766                 int16_t)
16767                         i16type=int16_t
16768                         u16type=uint16_t
16769                         i16size=2
16770                         u16size=2
16771                         ;;
16772                 esac
16773         fi
16774         ;;
16775 esac
16776 case "$i16type" in
16777 '')     if $test $shortsize -ge 2; then
16778                 i16type=short
16779                 u16type="unsigned short"
16780                 i16size=$shortsize
16781                 u16size=$shortsize
16782         fi
16783         ;;
16784 esac
16785
16786 case "$i32type" in
16787 '')     case "$longsize" in
16788         4)      i32type=long
16789                 u32type="unsigned long"
16790                 i32size=$longsize
16791                 u32size=$longsize
16792                 ;;
16793         *)      case "$intsize" in
16794                 4)      i32type=int
16795                         u32type="unsigned int"
16796                         i32size=$intsize
16797                         u32size=$intsize
16798                         ;;
16799                 esac
16800                 ;;
16801         esac
16802         ;;
16803 esac
16804 case "$i32type" in
16805 '')     set try -DINT32
16806         if eval $compile; then
16807                 case "`$run ./try`" in
16808                 int32_t)
16809                         i32type=int32_t
16810                         u32type=uint32_t
16811                         i32size=4
16812                         u32size=4
16813                         ;;
16814                 esac
16815         fi
16816         ;;
16817 esac
16818 case "$i32type" in
16819 '')     if $test $intsize -ge 4; then
16820                 i32type=int
16821                 u32type="unsigned int"
16822                 i32size=$intsize
16823                 u32size=$intsize
16824         fi
16825         ;;
16826 esac
16827
16828 case "$i64type" in
16829 '')     case "$d_quad:$quadtype" in
16830         define:?*)
16831                 i64type="$quadtype"
16832                 u64type="$uquadtype"
16833                 i64size=8
16834                 u64size=8
16835                 ;;
16836         esac
16837         ;;
16838 esac
16839
16840 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16841 : volatile so that the compiler has to store it out to memory.
16842 if test X"$d_volatile" = X"$define"; then
16843         volatile=volatile
16844 fi
16845 $cat <<EOP >try.c
16846 #include <stdio.h>
16847 #$i_stdlib I_STDLIB
16848 #ifdef I_STDLIB
16849 #include <stdlib.h>
16850 #endif
16851 #include <sys/types.h>
16852 #include <signal.h>
16853 #ifdef SIGFPE
16854 $volatile int bletched = 0;
16855 $signal_t blech(int s) { bletched = 1; }
16856 #endif
16857 int main() {
16858     $uvtype u = 0;
16859     $nvtype d;
16860     int     n = 8 * $uvsize;
16861     int     i;
16862 #ifdef SIGFPE
16863     signal(SIGFPE, blech);
16864 #endif
16865
16866     for (i = 0; i < n; i++) {
16867       u = u << 1 | ($uvtype)1;
16868       d = ($nvtype)u;
16869       if (($uvtype)d != u)
16870         break;
16871       if (d <= 0)
16872         break;
16873       d = ($nvtype)(u - 1);
16874       if (($uvtype)d != (u - 1))
16875         break;
16876 #ifdef SIGFPE
16877       if (bletched)
16878         break;
16879 #endif
16880     }
16881     printf("%d\n", ((i == n) ? -n : i));
16882     exit(0);
16883 }
16884 EOP
16885 set try
16886
16887 d_nv_preserves_uv="$undef"
16888 if eval $compile; then
16889         nv_preserves_uv_bits="`$run ./try`"
16890 fi
16891 case "$nv_preserves_uv_bits" in
16892 \-[1-9]*)
16893         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16894         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16895         d_nv_preserves_uv="$define"
16896         ;;
16897 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16898         d_nv_preserves_uv="$undef" ;;
16899 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16900         nv_preserves_uv_bits="0" ;;
16901 esac
16902 $rm_try
16903
16904 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16905 : volatile so that the compiler has to store it out to memory.
16906 if test X"$d_volatile" = X"$define"; then
16907         volatile=volatile
16908 fi
16909 $cat <<EOP >try.c
16910 #include <stdio.h>
16911
16912 typedef $nvtype NV;
16913
16914 int
16915 main() {
16916   NV value = 2;
16917   int count = 1;
16918
16919   while(count < 256) {
16920     $volatile NV up = value + 1.0;
16921     $volatile NV negated = -value;
16922     $volatile NV down = negated - 1.0;
16923     $volatile NV got_up = up - value;
16924     int up_good = got_up == 1.0;
16925     int got_down = down - negated;
16926     int down_good = got_down == -1.0;
16927
16928     if (down_good != up_good) {
16929       fprintf(stderr,
16930               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16931               up_good, (double) got_up, down_good, (double) got_down,
16932               count, (double) value);
16933       return 1;
16934     }
16935     if (!up_good) {
16936       while (1) {
16937         if (count > 8) {
16938           count -= 8;
16939           fputs("256.0", stdout);
16940         } else {
16941           count--;
16942           fputs("2.0", stdout);
16943         }
16944         if (!count) {
16945           puts("");
16946           return 0;
16947         }
16948         fputs("*", stdout);
16949       }
16950     }
16951     value *= 2;
16952     ++count;
16953   }
16954   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16955           count, (double) value);
16956   return 1;
16957 }
16958 EOP
16959 set try
16960
16961 nv_overflows_integers_at='0'
16962 if eval $compile; then
16963     xxx="`$run ./try`"
16964     case "$?" in
16965         0)
16966             case "$xxx" in
16967                 2*)  cat >&4 <<EOM
16968 The largest integer your NVs can preserve is equal to $xxx
16969 EOM
16970                     nv_overflows_integers_at="$xxx"
16971                     ;;
16972                 *)  cat >&4 <<EOM
16973 Cannot determine the largest integer value your NVs can hold, unexpected output
16974 '$xxx'
16975 EOM
16976                     ;;
16977             esac
16978             ;;
16979         *)  cat >&4 <<EOM
16980 Cannot determine the largest integer value your NVs can hold
16981 EOM
16982             ;;
16983     esac
16984 fi
16985 $rm_try
16986
16987 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16988 : volatile so that the compiler has to store it out to memory.
16989 if test X"$d_volatile" = X"$define"; then
16990         volatile=volatile
16991 fi
16992 $cat <<EOP >try.c
16993 #include <stdio.h>
16994 #$i_stdlib I_STDLIB
16995 #ifdef I_STDLIB
16996 #include <stdlib.h>
16997 #endif
16998 #$i_string I_STRING
16999 #ifdef I_STRING
17000 #  include <string.h>
17001 #else
17002 #  include <strings.h>
17003 #endif
17004 #include <sys/types.h>
17005 #include <signal.h>
17006 #ifdef SIGFPE
17007 $volatile int bletched = 0;
17008 $signal_t blech(int s) { bletched = 1; }
17009 #endif
17010
17011 int checkit($nvtype d, char *where) {
17012     unsigned char *p = (char *)&d;
17013     unsigned char *end = p + sizeof(d);
17014     int fail = 0;
17015
17016     while (p < end)
17017         fail += *p++;
17018
17019     if (!fail)
17020         return 0;
17021
17022     p = (char *)&d;
17023     printf("No - %s: 0x", where);
17024     while (p < end)
17025         printf ("%02X", *p++);
17026     printf("\n");
17027     return 1;
17028 }
17029
17030 int main(int argc, char **argv) {
17031     $nvtype d = 0.0;
17032     int fail = 0;
17033     fail += checkit(d, "0.0");
17034
17035     /* The compiler shouldn't be assuming that bletched is 0  */
17036     d = bletched;
17037
17038     fail += checkit(d, "bleched");
17039
17040 #ifdef SIGFPE
17041     signal(SIGFPE, blech);
17042 #endif
17043
17044     /* Paranoia - the compiler should have no way of knowing that ANSI says
17045        that argv[argc] will always be NULL.  Actually, if it did assume this it
17046        would be buggy, as this is C and main() can be called from elsewhere in
17047        the program.  */
17048     d = argv[argc] ? 1 : 0;
17049
17050     if (d) {
17051         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17052     }
17053
17054     fail += checkit(d, "ternary");
17055
17056     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17057
17058     if (d != 0.0) {
17059         printf("No - memset doesn't give 0.0\n");
17060         /* This might just blow up:  */
17061         printf("(gives %g)\n", d);
17062         return 1;
17063     }
17064
17065 #ifdef SIGFPE
17066     if (bletched) {
17067         printf("No - something bleched\n");
17068         return 1;
17069     }
17070 #endif
17071     if (fail) {
17072       printf("No - %d fail(s)\n", fail);
17073       return 1;
17074     }
17075     printf("Yes\n");
17076     return 0;
17077 }
17078 EOP
17079 set try
17080
17081 d_nv_zero_is_allbits_zero="$undef"
17082 if eval $compile; then
17083     xxx="`$run ./try`"
17084     case "$?" in
17085         0)
17086             case "$xxx" in
17087                 Yes)  cat >&4 <<EOM
17088 0.0 is represented as all bits zero in memory
17089 EOM
17090                     d_nv_zero_is_allbits_zero="$define"
17091                     ;;
17092                 *)  cat >&4 <<EOM
17093 0.0 is not represented as all bits zero in memory
17094 EOM
17095                     d_nv_zero_is_allbits_zero="$undef"
17096                     ;;
17097             esac
17098             ;;
17099         *)  cat >&4 <<EOM
17100 0.0 is not represented as all bits zero in memory
17101 EOM
17102             d_nv_zero_is_allbits_zero="$undef"
17103             ;;
17104     esac
17105 fi
17106 $rm_try
17107
17108 : check for off64_t
17109 echo " "
17110 echo "Checking to see if you have off64_t..." >&4
17111 $cat >try.c <<EOCP
17112 #include <sys/types.h>
17113 #include <unistd.h>
17114 int main() { off64_t x = 7; }
17115 EOCP
17116 set try
17117 if eval $compile; then
17118         val="$define"
17119         echo "You have off64_t."
17120 else
17121         val="$undef"
17122         echo "You do not have off64_t."
17123         case "$lseeksize" in
17124         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17125         esac
17126 fi
17127 $rm_try
17128 set d_off64_t
17129 eval $setvar
17130
17131 : how to create joinable pthreads
17132 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17133         echo " "
17134         echo "Checking what constant to use for creating joinable pthreads..." >&4
17135         $cat >try.c <<'EOCP'
17136 #include <pthread.h>
17137 int main() {
17138     int detachstate = JOINABLE;
17139 }
17140 EOCP
17141         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17142         if eval $compile; then
17143                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17144                 val="$undef" # Yes, undef.
17145                 set d_old_pthread_create_joinable
17146                 eval $setvar
17147                 val=""
17148                 set old_pthread_create_joinable
17149                 eval $setvar
17150         else
17151                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17152                 if eval $compile; then
17153                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17154                         val="$define"
17155                         set d_old_pthread_create_joinable
17156                         eval $setvar
17157                         val=PTHREAD_CREATE_UNDETACHED
17158                         set old_pthread_create_joinable
17159                         eval $setvar
17160                 else
17161                         set try -DJOINABLE=__UNDETACHED
17162                         if eval $compile; then
17163                                 echo "You seem to use __UNDETACHED." >&4
17164                                 val="$define"
17165                                 set d_old_pthread_create_joinable
17166                                 eval $setvar
17167                                 val=__UNDETACHED
17168                                 set old_pthread_create_joinable
17169                                 eval $setvar
17170                         else
17171                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17172                                 val="$define"
17173                                 set d_old_pthread_create_joinable
17174                                 eval $setvar
17175                                 val=0
17176                                 set old_pthread_create_joinable
17177                                 eval $setvar
17178                         fi
17179                 fi
17180         fi
17181         $rm_try
17182 else
17183     d_old_pthread_create_joinable="$undef"
17184     old_pthread_create_joinable=""
17185 fi
17186
17187 : see if pause exists
17188 set pause d_pause
17189 eval $inlibc
17190
17191 : see if poll exists
17192 set poll d_poll
17193 eval $inlibc
17194
17195 : see if prctl exists
17196 set prctl d_prctl
17197 eval $inlibc
17198
17199 : see if prctl supports PR_SET_NAME
17200 d_prctl_set_name=$undef
17201 case $d_prctl in
17202     $define)
17203         $cat >try.c <<EOM
17204 #ifdef __ANDROID__
17205 #include <unistd.h>
17206 #endif
17207 #include <sys/prctl.h>
17208
17209 int main (int argc, char *argv[])
17210 {
17211     return (prctl (PR_SET_NAME, "Test"));
17212     } /* main */
17213 EOM
17214         set try
17215         if eval $compile_ok && $run ./try; then
17216             echo "Your prctl (PR_SET_NAME, ...) works"
17217             d_prctl_set_name=$define
17218             fi
17219         $rm_try
17220         ;;
17221     esac
17222
17223 : see if readlink exists
17224 set readlink d_readlink
17225 eval $inlibc
17226
17227 : Check if there is a /proc symlink to the abs path of
17228 : the executing program.  We will honor hints of d_procselfexe=$undef
17229 : or procselfexe being non-empty, otherwise will try to determine both
17230 : if we have readlink.
17231 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17232 : referenced, and AmigaOS does not have a proc filesystem anyway.
17233 echo " "
17234 val="$undef"
17235 if $test "X$d_procselfexe" = Xundef; then
17236         procselfexe=''
17237 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17238         val="$define"
17239 elif $test "X$d_readlink" = Xdefine; then
17240         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17241         : and it feels more tidy to avoid an extra level of symlink
17242         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17243         while test $# -gt 0; do
17244             type=$1; try=$2
17245             shift; shift
17246             if $issymlink $try; then
17247                 $ls -l $try > reflect
17248                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17249                     echo "You have $type-like $try."
17250                     procselfexe='"'$try'"'
17251                     val="$define"
17252                     : This will break out of the loop
17253                     set X; shift
17254                 fi
17255             fi
17256         done
17257 fi
17258 $rm -f reflect
17259 set d_procselfexe
17260 eval $setvar
17261
17262 : backward compatibility for d_hvfork
17263 if test X$d_hvfork != X; then
17264         d_vfork="$d_hvfork"
17265         d_hvfork=''
17266 fi
17267 : see if there is a vfork
17268 val=''
17269 set vfork val
17270 eval $inlibc
17271
17272 d_pseudofork=$undef
17273
17274 : Ok, but do we want to use it. vfork is reportedly unreliable in
17275 : perl on Solaris 2.x, and probably elsewhere.
17276 case "$val" in
17277 $define)
17278         echo " "
17279         case "$usevfork" in
17280         false) dflt='n';;
17281         *) dflt='y';;
17282         esac
17283         cat <<'EOM'
17284
17285 Perl can only use a vfork() that doesn't suffer from strict
17286 restrictions on calling functions or modifying global data in
17287 the child.  For example, glibc-2.1 contains such a vfork()
17288 that is unsuitable.  If your system provides a proper fork()
17289 call, chances are that you do NOT want perl to use vfork().
17290
17291 EOM
17292         rp="Do you still want to use vfork()?"
17293         . ./myread
17294         case "$ans" in
17295         y|Y) ;;
17296         *)
17297                 echo "Ok, we won't use vfork()."
17298                 val="$undef"
17299                 ;;
17300         esac
17301         ;;
17302 esac
17303 set d_vfork
17304 eval $setvar
17305 case "$d_vfork" in
17306 $define) usevfork='true';;
17307 *) usevfork='false';;
17308 esac
17309
17310 : see whether the pthread_atfork exists
17311 $cat >try.c <<EOP
17312 #include <pthread.h>
17313 #include <stdio.h>
17314 int main() {
17315 #ifdef  PTHREAD_ATFORK
17316         pthread_atfork(NULL,NULL,NULL);
17317 #endif
17318 }
17319 EOP
17320
17321 : see if pthread_atfork exists
17322 set try -DPTHREAD_ATFORK
17323 if eval $compile; then
17324     val="$define"
17325 else
17326     val="$undef"
17327 fi
17328 case "$usethreads" in
17329 $define)
17330         case "$val" in
17331         $define) echo 'pthread_atfork found.' >&4        ;;
17332         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17333         esac
17334 esac
17335 set d_pthread_atfork
17336 eval $setvar
17337
17338 : see if pthread_attr_setscope exists
17339 set pthread_attr_setscope d_pthread_attr_setscope
17340 eval $inlibc
17341
17342 : see whether the various POSIXish _yields exist
17343 $cat >try.c <<EOP
17344 #include <pthread.h>
17345 #include <stdio.h>
17346 int main() {
17347 #ifdef SCHED_YIELD
17348         sched_yield();
17349 #else
17350 #ifdef PTHREAD_YIELD
17351         pthread_yield();
17352 #else
17353 #ifdef PTHREAD_YIELD_NULL
17354         pthread_yield(NULL);
17355 #endif
17356 #endif
17357 #endif
17358 }
17359 EOP
17360 : see if sched_yield exists
17361 set try -DSCHED_YIELD
17362 if eval $compile; then
17363     val="$define"
17364     sched_yield='sched_yield()'
17365 else
17366     val="$undef"
17367 fi
17368 case "$usethreads" in
17369 $define)
17370         case "$val" in
17371         $define) echo 'sched_yield() found.' >&4        ;;
17372         *)       echo 'sched_yield() NOT found.' >&4    ;;
17373         esac
17374 esac
17375 set d_sched_yield
17376 eval $setvar
17377
17378 : see if pthread_yield exists
17379 set try -DPTHREAD_YIELD
17380 if eval $compile; then
17381     val="$define"
17382     case "$sched_yield" in
17383     '') sched_yield='pthread_yield()' ;;
17384     esac
17385 else
17386     set try -DPTHREAD_YIELD_NULL
17387     if eval $compile; then
17388         val="$define"
17389         case "$sched_yield" in
17390         '') sched_yield='pthread_yield(NULL)' ;;
17391         esac
17392     else
17393         val="$undef"
17394     fi
17395 fi
17396 case "$usethreads" in
17397 $define)
17398         case "$val" in
17399         $define) echo 'pthread_yield() found.' >&4      ;;
17400         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17401         esac
17402         ;;
17403 esac
17404 set d_pthread_yield
17405 eval $setvar
17406 case "$sched_yield" in
17407 '') sched_yield=undef ;;
17408 esac
17409 $rm_try
17410
17411 : check for ptrdiff_t
17412 echo " "
17413 echo "Checking to see if you have ptrdiff_t..." >&4
17414 $cat >try.c <<EOCP
17415 #include <stddef.h>
17416 int main() { ptrdiff_t x = 7; }
17417 EOCP
17418 set try
17419 if eval $compile; then
17420         val="$define"
17421         echo "You have ptrdiff_t."
17422 else
17423         val="$undef"
17424         echo "You do not have ptrdiff_t."
17425 fi
17426 $rm_try
17427 set d_ptrdiff_t
17428 eval $setvar
17429
17430 : see if random_r exists
17431 set random_r d_random_r
17432 eval $inlibc
17433 case "$d_random_r" in
17434 "$define")
17435         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17436         case "$d_random_r_proto:$usethreads" in
17437         ":define")      d_random_r_proto=define
17438                 set d_random_r_proto random_r $hdrs
17439                 eval $hasproto ;;
17440         *)      ;;
17441         esac
17442         case "$d_random_r_proto" in
17443         define)
17444         case "$random_r_proto" in
17445         ''|0) try='int random_r(int*, struct random_data*);'
17446         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17447         esac
17448         case "$random_r_proto" in
17449         ''|0) try='int random_r(long*, struct random_data*);'
17450         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17451         esac
17452         case "$random_r_proto" in
17453         ''|0) try='int random_r(struct random_data*, int32_t*);'
17454         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17455         esac
17456         case "$random_r_proto" in
17457         ''|0)   d_random_r=undef
17458                 random_r_proto=0
17459                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17460         * )     case "$random_r_proto" in
17461                 REENTRANT_PROTO*) ;;
17462                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17463                 esac
17464                 echo "Prototype: $try" ;;
17465         esac
17466         ;;
17467         *)      case "$usethreads" in
17468                 define) echo "random_r has no prototype, not using it." >&4 ;;
17469                 esac
17470                 d_random_r=undef
17471                 random_r_proto=0
17472                 ;;
17473         esac
17474         ;;
17475 *)      random_r_proto=0
17476         ;;
17477 esac
17478
17479 : see if readdir and friends exist
17480 set readdir d_readdir
17481 eval $inlibc
17482 set seekdir d_seekdir
17483 eval $inlibc
17484 set telldir d_telldir
17485 eval $inlibc
17486 set rewinddir d_rewinddir
17487 eval $inlibc
17488
17489 : see if readdir64_r exists
17490 set readdir64_r d_readdir64_r
17491 eval $inlibc
17492 case "$d_readdir64_r" in
17493 "$define")
17494         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17495         case "$d_readdir64_r_proto:$usethreads" in
17496         ":define")      d_readdir64_r_proto=define
17497                 set d_readdir64_r_proto readdir64_r $hdrs
17498                 eval $hasproto ;;
17499         *)      ;;
17500         esac
17501         case "$d_readdir64_r_proto" in
17502         define)
17503         case "$readdir64_r_proto" in
17504         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17505         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17506         esac
17507         case "$readdir64_r_proto" in
17508         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17509         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17510         esac
17511         case "$readdir64_r_proto" in
17512         ''|0)   d_readdir64_r=undef
17513                 readdir64_r_proto=0
17514                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17515         * )     case "$readdir64_r_proto" in
17516                 REENTRANT_PROTO*) ;;
17517                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17518                 esac
17519                 echo "Prototype: $try" ;;
17520         esac
17521         ;;
17522         *)      case "$usethreads" in
17523                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17524                 esac
17525                 d_readdir64_r=undef
17526                 readdir64_r_proto=0
17527                 ;;
17528         esac
17529         ;;
17530 *)      readdir64_r_proto=0
17531         ;;
17532 esac
17533
17534 : see if readdir_r exists
17535 set readdir_r d_readdir_r
17536 eval $inlibc
17537 case "$d_readdir_r" in
17538 "$define")
17539         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17540         case "$d_readdir_r_proto:$usethreads" in
17541         ":define")      d_readdir_r_proto=define
17542                 set d_readdir_r_proto readdir_r $hdrs
17543                 eval $hasproto ;;
17544         *)      ;;
17545         esac
17546         case "$d_readdir_r_proto" in
17547         define)
17548         case "$readdir_r_proto" in
17549         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17550         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17551         esac
17552         case "$readdir_r_proto" in
17553         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17554         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17555         esac
17556         case "$readdir_r_proto" in
17557         ''|0)   d_readdir_r=undef
17558                 readdir_r_proto=0
17559                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17560         * )     case "$readdir_r_proto" in
17561                 REENTRANT_PROTO*) ;;
17562                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17563                 esac
17564                 echo "Prototype: $try" ;;
17565         esac
17566         ;;
17567         *)      case "$usethreads" in
17568                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17569                 esac
17570                 d_readdir_r=undef
17571                 readdir_r_proto=0
17572                 ;;
17573         esac
17574         ;;
17575 *)      readdir_r_proto=0
17576         ;;
17577 esac
17578
17579 : see if readv exists
17580 set readv d_readv
17581 eval $inlibc
17582
17583 : see if recvmsg exists
17584 set recvmsg d_recvmsg
17585 eval $inlibc
17586
17587 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17588 echo " "
17589 if set regcomp val -f d_regcomp; eval $csym; $val; then
17590         echo 'regcomp() found.' >&4
17591         d_regcomp="$define"
17592         d_regcmp="$undef"
17593         d_re_comp="$undef"
17594 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17595         echo 'regcmp() found.' >&4
17596         d_regcmp="$define"
17597         d_regcomp="$undef"
17598         d_re_comp="$undef"
17599 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17600         echo 're_comp() found, assuming re_exec() also exists.' >&4
17601         d_re_comp="$define"
17602         d_regcomp="$undef"
17603         d_regcmp="$undef"
17604 else
17605         $cat >&4 <<EOM
17606 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17607 EOM
17608         d_regcmp="$undef"
17609         d_re_comp="$undef"
17610         d_regcomp="$undef"
17611 fi
17612
17613 : see if remainder exists
17614 set remainder d_remainder
17615 eval $inlibc
17616
17617 : see if remquo exists
17618 set remquo d_remquo
17619 eval $inlibc
17620
17621 : see if rename exists
17622 set rename d_rename
17623 eval $inlibc
17624
17625 : see if rint exists
17626 set rint d_rint
17627 eval $inlibc
17628
17629 : see if rmdir exists
17630 set rmdir d_rmdir
17631 eval $inlibc
17632
17633 : see if round exists
17634 set round d_round
17635 eval $inlibc
17636
17637 : see if memory.h is available.
17638 val=''
17639 set memory.h val
17640 eval $inhdr
17641
17642 : See if it conflicts with string.h
17643 case "$val" in
17644 $define)
17645         case "$strings" in
17646         '') ;;
17647         *)
17648                 $cppstdin $cppflags $cppminus < $strings > mem.h
17649                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17650                         echo " "
17651                         echo "We won't be including <memory.h>."
17652                         val="$undef"
17653                 fi
17654                 $rm -f mem.h
17655                 ;;
17656         esac
17657 esac
17658 set i_memory
17659 eval $setvar
17660
17661 : can bcopy handle overlapping blocks?
17662 echo " "
17663 val="$undef"
17664 case "$d_memmove" in
17665 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17666 *)      case "$d_bcopy" in
17667         "$define")
17668                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17669                 $cat >try.c <<EOCP
17670 #$i_memory I_MEMORY
17671 #$i_stdlib I_STDLIB
17672 #$i_string I_STRING
17673 #$i_unistd I_UNISTD
17674 EOCP
17675         $cat >>try.c <<'EOCP'
17676 #include <stdio.h>
17677 #ifdef I_MEMORY
17678 #  include <memory.h>
17679 #endif
17680 #ifdef I_STDLIB
17681 #  include <stdlib.h>
17682 #endif
17683 #ifdef I_STRING
17684 #  include <string.h>
17685 #else
17686 #  include <strings.h>
17687 #endif
17688 #ifdef I_UNISTD
17689 #  include <unistd.h>  /* Needed for NetBSD */
17690 #endif
17691 int main()
17692 {
17693 char buf[128], abc[128];
17694 char *b;
17695 int len;
17696 int off;
17697 int align;
17698
17699 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17700    try to store the string in read-only memory. */
17701 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17702
17703 for (align = 7; align >= 0; align--) {
17704         for (len = 36; len; len--) {
17705                 b = buf+align;
17706                 bcopy(abc, b, len);
17707                 for (off = 1; off <= len; off++) {
17708                         bcopy(b, b+off, len);
17709                         bcopy(b+off, b, len);
17710                         if (bcmp(b, abc, len))
17711                                 exit(1);
17712                 }
17713         }
17714 }
17715 exit(0);
17716 }
17717 EOCP
17718                 set try
17719                 if eval $compile_ok; then
17720                         if $run ./try 2>/dev/null; then
17721                                 echo "Yes, it can."
17722                                 val="$define"
17723                         else
17724                                 echo "It can't, sorry."
17725                         fi
17726                 else
17727                         echo "(I can't compile the test program, so we'll assume not...)"
17728                 fi
17729                 ;;
17730         esac
17731         $rm_try
17732         ;;
17733 esac
17734 set d_safebcpy
17735 eval $setvar
17736
17737 : can memcpy handle overlapping blocks?
17738 echo " "
17739 val="$undef"
17740 case "$d_memmove" in
17741 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17742 *)      case "$d_memcpy" in
17743         "$define")
17744                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17745                 $cat >try.c <<EOCP
17746 #$i_memory I_MEMORY
17747 #$i_stdlib I_STDLIB
17748 #$i_string I_STRING
17749 #$i_unistd I_UNISTD
17750 EOCP
17751         $cat >>try.c <<'EOCP'
17752 #include <stdio.h>
17753 #ifdef I_MEMORY
17754 #  include <memory.h>
17755 #endif
17756 #ifdef I_STDLIB
17757 #  include <stdlib.h>
17758 #endif
17759 #ifdef I_STRING
17760 #  include <string.h>
17761 #else
17762 #  include <strings.h>
17763 #endif
17764 #ifdef I_UNISTD
17765 #  include <unistd.h>  /* Needed for NetBSD */
17766 #endif
17767 int main()
17768 {
17769 char buf[128], abc[128];
17770 char *b;
17771 int len;
17772 int off;
17773 int align;
17774
17775 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17776    try to store the string in read-only memory. */
17777 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17778
17779 for (align = 7; align >= 0; align--) {
17780         for (len = 36; len; len--) {
17781                 b = buf+align;
17782                 memcpy(b, abc, len);
17783                 for (off = 1; off <= len; off++) {
17784                         memcpy(b+off, b, len);
17785                         memcpy(b, b+off, len);
17786                         if (memcmp(b, abc, len))
17787                                 exit(1);
17788                 }
17789         }
17790 }
17791 exit(0);
17792 }
17793 EOCP
17794                 set try
17795                 if eval $compile_ok; then
17796                         if $run ./try 2>/dev/null; then
17797                                 echo "Yes, it can."
17798                                 val="$define"
17799                         else
17800                                 echo "It can't, sorry."
17801                         fi
17802                 else
17803                         echo "(I can't compile the test program, so we'll assume not...)"
17804                 fi
17805                 ;;
17806         esac
17807         $rm_try
17808         ;;
17809 esac
17810 set d_safemcpy
17811 eval $setvar
17812
17813 : can memcmp be trusted to compare relative magnitude?
17814 val="$undef"
17815 case "$d_memcmp" in
17816 "$define")
17817         echo " "
17818         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17819         $cat >try.c <<EOCP
17820 #$i_memory I_MEMORY
17821 #$i_stdlib I_STDLIB
17822 #$i_string I_STRING
17823 #$i_unistd I_UNISTD
17824 EOCP
17825         $cat >>try.c <<'EOCP'
17826 #include <stdio.h>
17827 #ifdef I_MEMORY
17828 #  include <memory.h>
17829 #endif
17830 #ifdef I_STDLIB
17831 #  include <stdlib.h>
17832 #endif
17833 #ifdef I_STRING
17834 #  include <string.h>
17835 #else
17836 #  include <strings.h>
17837 #endif
17838 #ifdef I_UNISTD
17839 #  include <unistd.h>  /* Needed for NetBSD */
17840 #endif
17841 int main()
17842 {
17843 char a = -1;
17844 char b = 0;
17845 if ((a < b) && memcmp(&a, &b, 1) < 0)
17846         exit(1);
17847 exit(0);
17848 }
17849 EOCP
17850         set try
17851         if eval $compile_ok; then
17852                 if $run ./try 2>/dev/null; then
17853                         echo "Yes, it can."
17854                         val="$define"
17855                 else
17856                         echo "No, it can't (it uses signed chars)."
17857                 fi
17858         else
17859                 echo "(I can't compile the test program, so we'll assume not...)"
17860         fi
17861         ;;
17862 esac
17863 $rm_try
17864 set d_sanemcmp
17865 eval $setvar
17866
17867 : see if prototype for sbrk is available
17868 echo " "
17869 set d_sbrkproto sbrk $i_unistd unistd.h
17870 eval $hasproto
17871
17872 : see if scalbn exists
17873 set scalbn d_scalbn
17874 eval $inlibc
17875
17876 : see if select exists
17877 set select d_select
17878 eval $inlibc
17879
17880 : see if semctl exists
17881 set semctl d_semctl
17882 eval $inlibc
17883
17884 : see if semget exists
17885 set semget d_semget
17886 eval $inlibc
17887
17888 : see if semop exists
17889 set semop d_semop
17890 eval $inlibc
17891
17892 : see how much of the 'sem*(2)' library is present.
17893 h_sem=true
17894 echo " "
17895 case "$d_semctl$d_semget$d_semop" in
17896 *"$undef"*) h_sem=false;;
17897 esac
17898 case "$osname" in
17899 freebsd)
17900     case "`ipcs 2>&1`" in
17901     "SVID messages"*"not configured"*)
17902         echo "Your $osname does not have the sem*(2) configured." >&4
17903         h_sem=false
17904         val="$undef"
17905         set semctl d_semctl
17906         eval $setvar
17907         set semget d_semget
17908         eval $setvar
17909         set semop d_semop
17910         eval $setvar
17911         ;;
17912     esac
17913     ;;
17914 esac
17915 : we could also check for sys/ipc.h ...
17916 if $h_sem && $test `./findhdr sys/sem.h`; then
17917         echo "You have the full sem*(2) library." >&4
17918         val="$define"
17919 else
17920         echo "You don't have the full sem*(2) library." >&4
17921         val="$undef"
17922 fi
17923 set d_sem
17924 eval $setvar
17925
17926 : see whether sys/sem.h defines union semun
17927 echo " "
17928 $cat > try.c <<'END'
17929 #include <sys/types.h>
17930 #include <sys/ipc.h>
17931 #include <sys/sem.h>
17932 int main () { union semun semun; semun.buf = 0; }
17933 END
17934 set try
17935 if eval $compile; then
17936     echo "You have union semun in <sys/sem.h>." >&4
17937     val="$define"
17938 else
17939     echo "You do not have union semun in <sys/sem.h>." >&4
17940     val="$undef"
17941 fi
17942 $rm_try
17943 set d_union_semun
17944 eval $setvar
17945
17946 : see how to do semctl IPC_STAT
17947 case "$d_sem" in
17948 $define)
17949     echo " "
17950     $cat > tryh.h <<END
17951 #ifndef S_IRUSR
17952 #   ifdef S_IREAD
17953 #       define S_IRUSR S_IREAD
17954 #       define S_IWUSR S_IWRITE
17955 #       define S_IXUSR S_IEXEC
17956 #   else
17957 #       define S_IRUSR 0400
17958 #       define S_IWUSR 0200
17959 #       define S_IXUSR 0100
17960 #   endif
17961 #   define S_IRGRP (S_IRUSR>>3)
17962 #   define S_IWGRP (S_IWUSR>>3)
17963 #   define S_IXGRP (S_IXUSR>>3)
17964 #   define S_IROTH (S_IRUSR>>6)
17965 #   define S_IWOTH (S_IWUSR>>6)
17966 #   define S_IXOTH (S_IXUSR>>6)
17967 #endif
17968 #ifndef S_IRWXU
17969 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17970 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17971 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17972 #endif
17973 END
17974     : see whether semctl IPC_STAT can use union semun
17975     case "$d_semctl_semun" in
17976     '')
17977       val="$undef"
17978       $cat > try.c <<END
17979 #include <sys/types.h>
17980 #include <sys/ipc.h>
17981 #include <sys/sem.h>
17982 #include <sys/stat.h>
17983 #include <stdio.h>
17984 #include <errno.h>
17985 #include "tryh.h"
17986 #ifndef errno
17987 extern int errno;
17988 #endif
17989 #$d_union_semun HAS_UNION_SEMUN
17990 int main() {
17991     union semun
17992 #ifndef HAS_UNION_SEMUN
17993     {
17994         int val;
17995         struct semid_ds *buf;
17996         unsigned short *array;
17997     }
17998 #endif
17999     arg;
18000     int sem, st;
18001
18002 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18003     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18004     if (sem > -1) {
18005         struct semid_ds argbuf;
18006         arg.buf = &argbuf;
18007 #       ifdef IPC_STAT
18008         st = semctl(sem, 0, IPC_STAT, arg);
18009         if (st == 0)
18010             printf("semun\n");
18011         else
18012 #       endif /* IPC_STAT */
18013             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18014 #       ifdef IPC_RMID
18015         if (semctl(sem, 0, IPC_RMID, arg) != 0)
18016 #       endif /* IPC_RMID */
18017             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18018     } else
18019 #endif /* IPC_PRIVATE && ... */
18020         printf("semget failed: errno = %d\n", errno);
18021   return 0;
18022 }
18023 END
18024       set try
18025       if eval $compile; then
18026           xxx=`$run ./try`
18027           case "$xxx" in
18028           semun) val="$define" ;;
18029           esac
18030       fi
18031       $rm_try
18032       set d_semctl_semun
18033       eval $setvar
18034       ;;
18035     esac
18036     case "$d_semctl_semun" in
18037     $define)
18038         echo "You can use union semun for semctl IPC_STAT." >&4
18039         also='also'
18040         ;;
18041     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
18042         also=''
18043         ;;
18044     esac
18045
18046     : see whether semctl IPC_STAT can use struct semid_ds pointer
18047     case "$d_semctl_semid_ds" in
18048     '')
18049       val="$undef"
18050       $cat > try.c <<'END'
18051 #include <sys/types.h>
18052 #include <sys/ipc.h>
18053 #include <sys/sem.h>
18054 #include <sys/stat.h>
18055 #include "tryh.h"
18056 #include <stdio.h>
18057 #include <errno.h>
18058 #ifndef errno
18059 extern int errno;
18060 #endif
18061 int main() {
18062     struct semid_ds arg;
18063     int sem, st;
18064
18065 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18066     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18067     if (sem > -1) {
18068 #       ifdef IPC_STAT
18069         st = semctl(sem, 0, IPC_STAT, &arg);
18070         if (st == 0)
18071             printf("semid_ds\n");
18072         else
18073 #       endif /* IPC_STAT */
18074             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18075 #       ifdef IPC_RMID
18076         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18077 #       endif /* IPC_RMID */
18078             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18079     } else
18080 #endif /* IPC_PRIVATE && ... */
18081         printf("semget failed: errno = %d\n", errno);
18082
18083     return 0;
18084 }
18085 END
18086       set try
18087       if eval $compile; then
18088           xxx=`$run ./try`
18089           case "$xxx" in
18090           semid_ds) val="$define" ;;
18091           esac
18092       fi
18093       $rm_try
18094       set d_semctl_semid_ds
18095       eval $setvar
18096       ;;
18097     esac
18098     case "$d_semctl_semid_ds" in
18099     $define)
18100         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18101         ;;
18102     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18103         ;;
18104     esac
18105     ;;
18106 *)  val="$undef"
18107
18108     # We do not have the full sem*(2) library, so assume we can not
18109     # use either.
18110
18111     set d_semctl_semun
18112     eval $setvar
18113
18114     set d_semctl_semid_ds
18115     eval $setvar
18116     ;;
18117 esac
18118 $rm_try tryh.h
18119
18120 : see if sendmsg exists
18121 set sendmsg d_sendmsg
18122 eval $inlibc
18123
18124 : see if setegid exists
18125 set setegid d_setegid
18126 eval $inlibc
18127
18128 : see if seteuid exists
18129 set seteuid d_seteuid
18130 eval $inlibc
18131
18132 : see if setgrent exists
18133 set setgrent d_setgrent
18134 eval $inlibc
18135
18136 : see if setgrent_r exists
18137 set setgrent_r d_setgrent_r
18138 eval $inlibc
18139 case "$d_setgrent_r" in
18140 "$define")
18141         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18142         case "$d_setgrent_r_proto:$usethreads" in
18143         ":define")      d_setgrent_r_proto=define
18144                 set d_setgrent_r_proto setgrent_r $hdrs
18145                 eval $hasproto ;;
18146         *)      ;;
18147         esac
18148         case "$d_setgrent_r_proto" in
18149         define)
18150         case "$setgrent_r_proto" in
18151         ''|0) try='int setgrent_r(FILE**);'
18152         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18153         esac
18154         case "$setgrent_r_proto" in
18155         ''|0) try='void setgrent_r(FILE**);'
18156         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18157         esac
18158         case "$setgrent_r_proto" in
18159         ''|0)   d_setgrent_r=undef
18160                 setgrent_r_proto=0
18161                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18162         * )     case "$setgrent_r_proto" in
18163                 REENTRANT_PROTO*) ;;
18164                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18165                 esac
18166                 echo "Prototype: $try" ;;
18167         esac
18168         ;;
18169         *)      case "$usethreads" in
18170                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18171                 esac
18172                 d_setgrent_r=undef
18173                 setgrent_r_proto=0
18174                 ;;
18175         esac
18176         ;;
18177 *)      setgrent_r_proto=0
18178         ;;
18179 esac
18180
18181 : see if sethostent exists
18182 set sethostent d_sethent
18183 eval $inlibc
18184
18185 : see if sethostent_r exists
18186 set sethostent_r d_sethostent_r
18187 eval $inlibc
18188 case "$d_sethostent_r" in
18189 "$define")
18190         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18191         case "$d_sethostent_r_proto:$usethreads" in
18192         ":define")      d_sethostent_r_proto=define
18193                 set d_sethostent_r_proto sethostent_r $hdrs
18194                 eval $hasproto ;;
18195         *)      ;;
18196         esac
18197         case "$d_sethostent_r_proto" in
18198         define)
18199         case "$sethostent_r_proto" in
18200         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18201         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18202         esac
18203         case "$sethostent_r_proto" in
18204         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18205         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18206         esac
18207         case "$sethostent_r_proto" in
18208         ''|0)   d_sethostent_r=undef
18209                 sethostent_r_proto=0
18210                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18211         * )     case "$sethostent_r_proto" in
18212                 REENTRANT_PROTO*) ;;
18213                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18214                 esac
18215                 echo "Prototype: $try" ;;
18216         esac
18217         ;;
18218         *)      case "$usethreads" in
18219                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18220                 esac
18221                 d_sethostent_r=undef
18222                 sethostent_r_proto=0
18223                 ;;
18224         esac
18225         ;;
18226 *)      sethostent_r_proto=0
18227         ;;
18228 esac
18229
18230 : see if setitimer exists
18231 set setitimer d_setitimer
18232 eval $inlibc
18233
18234 : see if setlinebuf exists
18235 set setlinebuf d_setlinebuf
18236 eval $inlibc
18237
18238 : see if setlocale exists
18239 set setlocale d_setlocale
18240 eval $inlibc
18241
18242 : see if locale.h is available
18243 set locale.h i_locale
18244 eval $inhdr
18245
18246 : see if setlocale_r exists
18247 set setlocale_r d_setlocale_r
18248 eval $inlibc
18249 case "$d_setlocale_r" in
18250 "$define")
18251         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18252         case "$d_setlocale_r_proto:$usethreads" in
18253         ":define")      d_setlocale_r_proto=define
18254                 set d_setlocale_r_proto setlocale_r $hdrs
18255                 eval $hasproto ;;
18256         *)      ;;
18257         esac
18258         case "$d_setlocale_r_proto" in
18259         define)
18260         case "$setlocale_r_proto" in
18261         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18262         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18263         esac
18264         case "$setlocale_r_proto" in
18265         ''|0)   d_setlocale_r=undef
18266                 setlocale_r_proto=0
18267                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18268         * )     case "$setlocale_r_proto" in
18269                 REENTRANT_PROTO*) ;;
18270                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18271                 esac
18272                 echo "Prototype: $try" ;;
18273         esac
18274         ;;
18275         *)      case "$usethreads" in
18276                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18277                 esac
18278                 d_setlocale_r=undef
18279                 setlocale_r_proto=0
18280                 ;;
18281         esac
18282         ;;
18283 *)      setlocale_r_proto=0
18284         ;;
18285 esac
18286
18287 : see if setnetent exists
18288 set setnetent d_setnent
18289 eval $inlibc
18290
18291 : see if setnetent_r exists
18292 set setnetent_r d_setnetent_r
18293 eval $inlibc
18294 case "$d_setnetent_r" in
18295 "$define")
18296         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18297         case "$d_setnetent_r_proto:$usethreads" in
18298         ":define")      d_setnetent_r_proto=define
18299                 set d_setnetent_r_proto setnetent_r $hdrs
18300                 eval $hasproto ;;
18301         *)      ;;
18302         esac
18303         case "$d_setnetent_r_proto" in
18304         define)
18305         case "$setnetent_r_proto" in
18306         ''|0) try='int setnetent_r(int, struct netent_data*);'
18307         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18308         esac
18309         case "$setnetent_r_proto" in
18310         ''|0) try='void setnetent_r(int, struct netent_data*);'
18311         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18312         esac
18313         case "$setnetent_r_proto" in
18314         ''|0)   d_setnetent_r=undef
18315                 setnetent_r_proto=0
18316                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18317         * )     case "$setnetent_r_proto" in
18318                 REENTRANT_PROTO*) ;;
18319                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18320                 esac
18321                 echo "Prototype: $try" ;;
18322         esac
18323         ;;
18324         *)      case "$usethreads" in
18325                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18326                 esac
18327                 d_setnetent_r=undef
18328                 setnetent_r_proto=0
18329                 ;;
18330         esac
18331         ;;
18332 *)      setnetent_r_proto=0
18333         ;;
18334 esac
18335
18336 : see if setprotoent exists
18337 set setprotoent d_setpent
18338 eval $inlibc
18339
18340 : see if setpgid exists
18341 set setpgid d_setpgid
18342 eval $inlibc
18343
18344 : see if setpgrp2 exists
18345 set setpgrp2 d_setpgrp2
18346 eval $inlibc
18347
18348 : see if setpriority exists
18349 set setpriority d_setprior
18350 eval $inlibc
18351
18352 : see if setproctitle exists
18353 set setproctitle d_setproctitle
18354 eval $inlibc
18355
18356 : see if setprotoent_r exists
18357 set setprotoent_r d_setprotoent_r
18358 eval $inlibc
18359 case "$d_setprotoent_r" in
18360 "$define")
18361         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18362         case "$d_setprotoent_r_proto:$usethreads" in
18363         ":define")      d_setprotoent_r_proto=define
18364                 set d_setprotoent_r_proto setprotoent_r $hdrs
18365                 eval $hasproto ;;
18366         *)      ;;
18367         esac
18368         case "$d_setprotoent_r_proto" in
18369         define)
18370         case "$setprotoent_r_proto" in
18371         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18372         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18373         esac
18374         case "$setprotoent_r_proto" in
18375         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18376         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18377         esac
18378         case "$setprotoent_r_proto" in
18379         ''|0)   d_setprotoent_r=undef
18380                 setprotoent_r_proto=0
18381                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18382         * )     case "$setprotoent_r_proto" in
18383                 REENTRANT_PROTO*) ;;
18384                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18385                 esac
18386                 echo "Prototype: $try" ;;
18387         esac
18388         ;;
18389         *)      case "$usethreads" in
18390                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18391                 esac
18392                 d_setprotoent_r=undef
18393                 setprotoent_r_proto=0
18394                 ;;
18395         esac
18396         ;;
18397 *)      setprotoent_r_proto=0
18398         ;;
18399 esac
18400
18401 : see if setpwent exists
18402 set setpwent d_setpwent
18403 eval $inlibc
18404
18405 : see if setpwent_r exists
18406 set setpwent_r d_setpwent_r
18407 eval $inlibc
18408 case "$d_setpwent_r" in
18409 "$define")
18410         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18411         case "$d_setpwent_r_proto:$usethreads" in
18412         ":define")      d_setpwent_r_proto=define
18413                 set d_setpwent_r_proto setpwent_r $hdrs
18414                 eval $hasproto ;;
18415         *)      ;;
18416         esac
18417         case "$d_setpwent_r_proto" in
18418         define)
18419         case "$setpwent_r_proto" in
18420         ''|0) try='int setpwent_r(FILE**);'
18421         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18422         esac
18423         case "$setpwent_r_proto" in
18424         ''|0) try='void setpwent_r(FILE**);'
18425         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18426         esac
18427         case "$setpwent_r_proto" in
18428         ''|0)   d_setpwent_r=undef
18429                 setpwent_r_proto=0
18430                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18431         * )     case "$setpwent_r_proto" in
18432                 REENTRANT_PROTO*) ;;
18433                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18434                 esac
18435                 echo "Prototype: $try" ;;
18436         esac
18437         ;;
18438         *)      case "$usethreads" in
18439                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18440                 esac
18441                 d_setpwent_r=undef
18442                 setpwent_r_proto=0
18443                 ;;
18444         esac
18445         ;;
18446 *)      setpwent_r_proto=0
18447         ;;
18448 esac
18449
18450 : see if setregid exists
18451 set setregid d_setregid
18452 eval $inlibc
18453 set setresgid d_setresgid
18454 eval $inlibc
18455
18456 : see if setreuid exists
18457 set setreuid d_setreuid
18458 eval $inlibc
18459 set setresuid d_setresuid
18460 eval $inlibc
18461
18462 : see if setrgid exists
18463 set setrgid d_setrgid
18464 eval $inlibc
18465
18466 : see if setruid exists
18467 set setruid d_setruid
18468 eval $inlibc
18469
18470 : see if setservent exists
18471 set setservent d_setsent
18472 eval $inlibc
18473
18474 : see if setservent_r exists
18475 set setservent_r d_setservent_r
18476 eval $inlibc
18477 case "$d_setservent_r" in
18478 "$define")
18479         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18480         case "$d_setservent_r_proto:$usethreads" in
18481         ":define")      d_setservent_r_proto=define
18482                 set d_setservent_r_proto setservent_r $hdrs
18483                 eval $hasproto ;;
18484         *)      ;;
18485         esac
18486         case "$d_setservent_r_proto" in
18487         define)
18488         case "$setservent_r_proto" in
18489         ''|0) try='int setservent_r(int, struct servent_data*);'
18490         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18491         esac
18492         case "$setservent_r_proto" in
18493         ''|0) try='void setservent_r(int, struct servent_data*);'
18494         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18495         esac
18496         case "$setservent_r_proto" in
18497         ''|0)   d_setservent_r=undef
18498                 setservent_r_proto=0
18499                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18500         * )     case "$setservent_r_proto" in
18501                 REENTRANT_PROTO*) ;;
18502                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18503                 esac
18504                 echo "Prototype: $try" ;;
18505         esac
18506         ;;
18507         *)      case "$usethreads" in
18508                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18509                 esac
18510                 d_setservent_r=undef
18511                 setservent_r_proto=0
18512                 ;;
18513         esac
18514         ;;
18515 *)      setservent_r_proto=0
18516         ;;
18517 esac
18518
18519 : see if setsid exists
18520 set setsid d_setsid
18521 eval $inlibc
18522
18523 : see if setvbuf exists
18524 set setvbuf d_setvbuf
18525 eval $inlibc
18526
18527 : see if shmctl exists
18528 set shmctl d_shmctl
18529 eval $inlibc
18530
18531 : see if shmget exists
18532 set shmget d_shmget
18533 eval $inlibc
18534
18535 : see if shmat exists
18536 set shmat d_shmat
18537 eval $inlibc
18538 : see what shmat returns
18539 case "$d_shmat" in
18540 "$define")
18541         $cat >shmat.c <<'END'
18542 #include <sys/shm.h>
18543 void *shmat();
18544 END
18545         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18546                 shmattype='void *'
18547         else
18548                 shmattype='char *'
18549         fi
18550         echo "and it returns ($shmattype)." >&4
18551         : see if a prototype for shmat is available
18552         xxx=`./findhdr sys/shm.h`
18553         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18554         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18555                 val="$define"
18556         else
18557                 val="$undef"
18558         fi
18559         $rm -f shmat.[co]
18560         ;;
18561 *)
18562         val="$undef"
18563         ;;
18564 esac
18565 set d_shmatprototype
18566 eval $setvar
18567
18568 : see if shmdt exists
18569 set shmdt d_shmdt
18570 eval $inlibc
18571
18572 : see how much of the 'shm*(2)' library is present.
18573 h_shm=true
18574 echo " "
18575 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18576 *"$undef"*) h_shm=false;;
18577 esac
18578 case "$osname" in
18579 freebsd)
18580     case "`ipcs 2>&1`" in
18581     "SVID shared memory"*"not configured"*)
18582         echo "Your $osname does not have the shm*(2) configured." >&4
18583         h_shm=false
18584         val="$undef"
18585         set shmctl d_shmctl
18586         eval $setvar
18587         set shmget d_shmget
18588         eval $setvar
18589         set shmat d_shmat
18590         eval $setvar
18591         set shmdt d_shmdt
18592         eval $setvar
18593         ;;
18594     esac
18595     ;;
18596 esac
18597 : we could also check for sys/ipc.h ...
18598 if $h_shm && $test `./findhdr sys/shm.h`; then
18599         echo "You have the full shm*(2) library." >&4
18600         val="$define"
18601 else
18602         echo "You don't have the full shm*(2) library." >&4
18603         val="$undef"
18604 fi
18605 set d_shm
18606 eval $setvar
18607
18608 : see if we have sigaction
18609 echo " "
18610 if set sigaction val -f d_sigaction; eval $csym; $val; then
18611         echo 'sigaction() found.' >&4
18612         $cat > try.c <<EOP
18613 #include <stdio.h>
18614 #include <sys/types.h>
18615 #include <signal.h>
18616 #$i_stdlib I_STDLIB
18617 #ifdef I_STDLIB
18618 #include <stdlib.h>
18619 #endif
18620 int main()
18621 {
18622     struct sigaction act, oact;
18623     act.sa_flags = 0;
18624     oact.sa_handler = 0;
18625     /* so that act and oact are used */
18626     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18627 }
18628 EOP
18629         set try
18630         if eval $compile_ok; then
18631                 val="$define"
18632         else
18633                 echo "But you don't seem to have a usable struct sigaction." >&4
18634                 val="$undef"
18635         fi
18636 else
18637         echo 'sigaction NOT found.' >&4
18638         val="$undef"
18639 fi
18640 set d_sigaction; eval $setvar
18641 $rm_try
18642
18643 : see if this is a sunmath.h system
18644 set sunmath.h i_sunmath
18645 eval $inhdr
18646
18647 : see if signbit exists
18648 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18649 $cat >try.c <<EOCP
18650 #$i_math I_MATH
18651 #$i_sunmath I_SUNMATH
18652 #ifdef I_MATH
18653 #  include <math.h>
18654 #endif
18655 #ifdef I_SUNMATH  /* Solaris special math library */
18656 #  include <sunmath.h>
18657 #endif
18658 #define NV $nvtype
18659 int main(int argc, char **argv)
18660 {
18661     NV x = 0.0;
18662     NV y = -0.0;
18663     if ((signbit(x) == 0) && (signbit(y) != 0))
18664         return 0;
18665     else
18666         return 1;
18667 }
18668 EOCP
18669 val="$undef"
18670 set try
18671 if eval $compile; then
18672     if $run ./try; then
18673         $echo "Yes." >&4
18674         val="$define"
18675     else
18676         $echo "Signbit seems to be available, but doesn't work as I expected."
18677         $echo "I won't use it." >&4
18678         val="$undef"
18679     fi
18680 else
18681     $echo "Nope." >&4
18682     dflt="$undef"
18683 fi
18684 set d_signbit
18685 eval $setvar
18686 $rm_try
18687
18688 : see if sigprocmask exists
18689 set sigprocmask d_sigprocmask
18690 eval $inlibc
18691
18692 : see if sigsetjmp exists
18693 echo " "
18694 case "$d_sigsetjmp" in
18695 '')
18696         $cat >try.c <<EOP
18697 #include <setjmp.h>
18698 #$i_stdlib I_STDLIB
18699 #ifdef I_STDLIB
18700 #include <stdlib.h>
18701 #endif
18702 sigjmp_buf env;
18703 int set = 1;
18704 int main()
18705 {
18706         if (sigsetjmp(env,1))
18707                 exit(set);
18708         set = 0;
18709         siglongjmp(env, 1);
18710         exit(1);
18711 }
18712 EOP
18713         set try
18714         if eval $compile; then
18715                 if $run ./try >/dev/null 2>&1; then
18716                         echo "POSIX sigsetjmp found." >&4
18717                         val="$define"
18718                 else
18719                         $cat >&4 <<EOM
18720 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18721 I'll ignore them.
18722 EOM
18723                         val="$undef"
18724                 fi
18725         else
18726                 echo "sigsetjmp not found." >&4
18727                 val="$undef"
18728         fi
18729         ;;
18730 *) val="$d_sigsetjmp"
18731         case "$d_sigsetjmp" in
18732         $define) echo "POSIX sigsetjmp found." >&4;;
18733         $undef) echo "sigsetjmp not found." >&4;;
18734         esac
18735         ;;
18736 esac
18737 set d_sigsetjmp
18738 eval $setvar
18739 $rm_try
18740
18741 : see if snprintf exists
18742 set snprintf d_snprintf
18743 eval $inlibc
18744
18745 : see if vsnprintf exists
18746 set vsnprintf d_vsnprintf
18747 eval $inlibc
18748
18749 case "$d_snprintf-$d_vsnprintf" in
18750 "$define-$define")
18751     $cat <<EOM
18752 Checking whether your snprintf() and vsnprintf() work okay...
18753 EOM
18754     $cat >try.c <<'EOCP'
18755 /* v?snprintf testing logic courtesy of Russ Allbery.
18756  * According to C99:
18757  * - if the buffer is too short it still must be \0-terminated
18758  * - if the buffer is too short the potentially required length
18759  *   must be returned and not -1
18760  * - if the buffer is NULL the potentially required length
18761  *   must be returned and not -1 or core dump
18762  */
18763 #include <stdio.h>
18764 #include <stdarg.h>
18765
18766 char buf[2];
18767
18768 int test (char *format, ...)
18769 {
18770     va_list args;
18771     int count;
18772
18773     va_start (args, format);
18774     count = vsnprintf (buf, sizeof buf, format, args);
18775     va_end (args);
18776     return count;
18777 }
18778
18779 int main ()
18780 {
18781     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18782              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18783 }
18784 EOCP
18785     set try
18786     if eval $compile; then
18787         `$run ./try`
18788         case "$?" in
18789         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18790         *) cat <<EOM >&4
18791 Your snprintf() and snprintf() don't seem to be working okay.
18792 EOM
18793            d_snprintf="$undef"
18794            d_vsnprintf="$undef"
18795            ;;
18796         esac
18797     else
18798         echo "(I can't seem to compile the test program--assuming they don't)"
18799         d_snprintf="$undef"
18800         d_vsnprintf="$undef"
18801     fi
18802     $rm_try
18803     ;;
18804 esac
18805
18806 : see if sockatmark exists
18807 set sockatmark d_sockatmark
18808 eval $inlibc
18809
18810 : see if prototype for sockatmark is available
18811 echo " "
18812 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18813 eval $hasproto
18814
18815 : see if socks5_init exists
18816 set socks5_init d_socks5_init
18817 eval $inlibc
18818
18819 : see if sprintf returns the length of the string in the buffer as per ANSI
18820 $echo "Checking whether sprintf returns the length of the string..." >&4
18821 $cat <<EOP >try.c
18822 #include <stdio.h>
18823 #$i_stdlib I_STDLIB
18824 #ifdef I_STDLIB
18825 #include <stdlib.h>
18826 #endif
18827 #$i_string I_STRING
18828 #ifdef I_STRING
18829 #  include <string.h>
18830 #else
18831 #  include <strings.h>
18832 #endif
18833 #$i_math I_MATH
18834 #ifdef I_MATH
18835 #include <math.h>
18836 #endif
18837
18838 char buffer[256];
18839
18840 int check (size_t expect, int test) {
18841   size_t got = strlen(buffer);
18842   if (expect == got)
18843     return 0;
18844
18845   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18846        test, buffer);
18847   exit (test);
18848 }
18849
18850 int main(int argc, char **argv) {
18851   int test = 0;
18852
18853   check(sprintf(buffer, ""), ++test);
18854   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18855   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18856
18857   return 0;
18858 }
18859 EOP
18860 set try
18861
18862 if eval $compile; then
18863     xxx="`$run ./try`"
18864     case "$?" in
18865         0) cat >&4 <<EOM
18866 sprintf returns the length of the string (as ANSI says it should)
18867 EOM
18868         d_sprintf_returns_strlen="$define"
18869         ;;
18870         *) cat >&4 <<EOM
18871 sprintf does not return the length of the string (how old is this system?)
18872 EOM
18873         d_sprintf_returns_strlen="$undef"
18874         ;;
18875     esac
18876 else
18877     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18878     d_sprintf_returns_strlen="$undef"
18879 fi
18880 $rm_try
18881
18882 : see if srand48_r exists
18883 set srand48_r d_srand48_r
18884 eval $inlibc
18885 case "$d_srand48_r" in
18886 "$define")
18887         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18888         case "$d_srand48_r_proto:$usethreads" in
18889         ":define")      d_srand48_r_proto=define
18890                 set d_srand48_r_proto srand48_r $hdrs
18891                 eval $hasproto ;;
18892         *)      ;;
18893         esac
18894         case "$d_srand48_r_proto" in
18895         define)
18896         case "$srand48_r_proto" in
18897         ''|0) try='int srand48_r(long, struct drand48_data*);'
18898         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18899         esac
18900         case "$srand48_r_proto" in
18901         ''|0)   d_srand48_r=undef
18902                 srand48_r_proto=0
18903                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18904         * )     case "$srand48_r_proto" in
18905                 REENTRANT_PROTO*) ;;
18906                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18907                 esac
18908                 echo "Prototype: $try" ;;
18909         esac
18910         ;;
18911         *)      case "$usethreads" in
18912                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18913                 esac
18914                 d_srand48_r=undef
18915                 srand48_r_proto=0
18916                 ;;
18917         esac
18918         ;;
18919 *)      srand48_r_proto=0
18920         ;;
18921 esac
18922
18923 : see if srandom_r exists
18924 set srandom_r d_srandom_r
18925 eval $inlibc
18926 case "$d_srandom_r" in
18927 "$define")
18928         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18929         case "$d_srandom_r_proto:$usethreads" in
18930         ":define")      d_srandom_r_proto=define
18931                 set d_srandom_r_proto srandom_r $hdrs
18932                 eval $hasproto ;;
18933         *)      ;;
18934         esac
18935         case "$d_srandom_r_proto" in
18936         define)
18937         case "$srandom_r_proto" in
18938         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18939         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18940         esac
18941         case "$srandom_r_proto" in
18942         ''|0)   d_srandom_r=undef
18943                 srandom_r_proto=0
18944                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18945         * )     case "$srandom_r_proto" in
18946                 REENTRANT_PROTO*) ;;
18947                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18948                 esac
18949                 echo "Prototype: $try" ;;
18950         esac
18951         ;;
18952         *)      case "$usethreads" in
18953                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18954                 esac
18955                 d_srandom_r=undef
18956                 srandom_r_proto=0
18957                 ;;
18958         esac
18959         ;;
18960 *)      srandom_r_proto=0
18961         ;;
18962 esac
18963
18964 : see if prototype for setresgid is available
18965 echo " "
18966 set d_sresgproto setresgid $i_unistd unistd.h
18967 eval $hasproto
18968
18969 : see if prototype for setresuid is available
18970 echo " "
18971 set d_sresuproto setresuid $i_unistd unistd.h
18972 eval $hasproto
18973
18974 : see if stat exists
18975 set stat d_stat
18976 eval $inlibc
18977
18978 : see if sys/stat.h is available
18979 set sys/stat.h i_sysstat
18980 eval $inhdr
18981
18982 : see if stat knows about block sizes
18983 echo " "
18984 echo "Checking to see if your struct stat has st_blocks field..." >&4
18985 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18986 eval $hasfield
18987
18988 : see if this is a sys/vfs.h system
18989 set sys/vfs.h i_sysvfs
18990 eval $inhdr
18991
18992 : see if this is a sys/statfs.h system
18993 set sys/statfs.h i_sysstatfs
18994 eval $inhdr
18995
18996 : Check for statfs_s
18997 echo " "
18998 echo "Checking to see if your system supports struct statfs..." >&4
18999 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
19000 eval $hasstruct
19001 case "$d_statfs_s" in
19002 "$define")      echo "Yes, it does."   ;;
19003 *)              echo "No, it doesn't." ;;
19004 esac
19005
19006
19007 : see if struct statfs knows about f_flags
19008 case "$d_statfs_s" in
19009 define)
19010         echo " "
19011         echo "Checking to see if your struct statfs has f_flags field..." >&4
19012         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
19013         eval $hasfield
19014         ;;
19015 *)      val="$undef"
19016         set d_statfs_f_flags
19017         eval $setvar
19018         ;;
19019 esac
19020 case "$d_statfs_f_flags" in
19021 "$define")      echo "Yes, it does."   ;;
19022 *)              echo "No, it doesn't." ;;
19023 esac
19024
19025 : see what flavor, if any, of static inline is supported
19026 echo " "
19027 echo "Checking to see if your system supports static inline..."
19028 $cat > try.c <<'EOCP'
19029 #include <stdlib.h>
19030 extern int f_via_a(int x);
19031 extern int f_via_b(int x);
19032 int main(int argc, char **argv)
19033 {
19034     int y;
19035
19036     y = f_via_a(0);
19037 #ifdef USE_B
19038     y = f_via_b(0);
19039 #endif
19040     if (y == 42) {
19041         return EXIT_SUCCESS;
19042     }
19043     else {
19044         return EXIT_FAILURE;
19045     }
19046 }
19047 EOCP
19048 $cat > a.c <<'EOCP'
19049 static INLINE int f(int x) {
19050     int y;
19051     y = x + 42;
19052     return y;
19053 }
19054
19055 int f_via_a(int x)
19056 {
19057     return f(x);
19058 }
19059 EOCP
19060 $cat > b.c <<'EOCP'
19061 extern int f(int x);
19062
19063 int f_via_b(int x)
19064 {
19065     return f(x);
19066 }
19067 EOCP
19068
19069 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19070 case "$perl_static_inline" in
19071 '')     # Check the various possibilities, and break out on success.
19072         # For gcc, prefer __inline__, which will still permit
19073         # cflags.SH to add in -ansi.
19074         case "$gccversion" in
19075                 '') xxx="inline __inline__ __inline _inline";;
19076                 *)  xxx="__inline__ inline __inline _inline";;
19077         esac
19078         for inline in $xxx; do
19079                 set try -DINLINE=$inline a.c
19080                 if eval $compile && $run ./try; then
19081                         # Now make sure there is no external linkage of static
19082                         # functions
19083                         set try -DINLINE=$inline -DUSE_B a.c b.c
19084                         if eval $compile && $run ./try; then
19085                                 $echo "Your compiler supports static $inline, " >&4
19086                                 $echo "but it also creates an external definition," >&4
19087                                 $echo "so I won't use it." >&4
19088                                 val=$undef
19089                         else
19090                                 $echo "Your compiler supports static $inline." >&4
19091                                 val=$define
19092                                 perl_static_inline="static $inline";
19093                                 break;
19094                         fi
19095                 else
19096                         $echo "Your compiler does NOT support static $inline." >&4
19097                         val="$undef"
19098                 fi
19099         done
19100         ;;
19101 *inline*) # Some variant of inline exists.
19102         echo "Keeping your $hint value of $perl_static_inline."
19103         val=$define
19104         ;;
19105 static)  # No inline capabilities
19106         echo "Keeping your $hint value of $perl_static_inline."
19107         val=$undef
19108         ;;
19109 *)  # Unrecognized previous value -- blindly trust the supplied
19110         # value and hope it makes sense.  Use old value for
19111         # d_static_inline, if there is one.
19112         echo "Keeping your $hint value of $perl_static_inline."
19113         case "$d_static_inline" in
19114                 '') val=$define ;;
19115                 *)  val=$d_static_inline ;;
19116         esac
19117         ;;
19118 esac
19119 # Fallback to plain 'static' if nothing worked.
19120 case "$perl_static_inline" in
19121 '')
19122         perl_static_inline="static"
19123         val=$undef
19124         ;;
19125 esac
19126 set d_static_inline
19127 eval $setvar
19128 $rm -f a.[co] b.[co]
19129 $rm_try
19130
19131 : Check stream access
19132 $cat >&4 <<EOM
19133 Checking how to access stdio streams by file descriptor number...
19134 EOM
19135 case "$stdio_stream_array" in
19136 '')     $cat >try.c <<EOCP
19137 #include <stdio.h>
19138 int main() {
19139   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19140     printf("yes\n");
19141 }
19142 EOCP
19143         for s in _iob __iob __sF
19144         do
19145                 set try -DSTDIO_STREAM_ARRAY=$s
19146                 if eval $compile; then
19147                         case "`$run ./try`" in
19148                         yes)    stdio_stream_array=$s; break ;;
19149                         esac
19150                 fi
19151         done
19152         $rm_try
19153 esac
19154 case "$stdio_stream_array" in
19155 '')     $cat >&4 <<EOM
19156 I can't figure out how to access stdio streams by file descriptor number.
19157 EOM
19158         d_stdio_stream_array="$undef"
19159         ;;
19160 *)      $cat >&4 <<EOM
19161 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19162 EOM
19163         d_stdio_stream_array="$define"
19164         ;;
19165 esac
19166
19167 : see if strcoll exists
19168 set strcoll d_strcoll
19169 eval $inlibc
19170
19171 : check for structure copying
19172 echo " "
19173 echo "Checking to see if your C compiler can copy structs..." >&4
19174 $cat >try.c <<'EOCP'
19175 int main()
19176 {
19177         struct blurfl {
19178                 int dyick;
19179         } foo, bar;
19180
19181         foo = bar;
19182 }
19183 EOCP
19184 if $cc -c try.c >/dev/null 2>&1 ; then
19185         val="$define"
19186         echo "Yup, it can."
19187 else
19188         val="$undef"
19189         echo "Nope, it can't."
19190 fi
19191 set d_strctcpy
19192 eval $setvar
19193 $rm_try
19194
19195 : see if strerror and/or sys_errlist[] exist
19196 echo " "
19197 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19198     if set strerror val -f d_strerror; eval $csym; $val; then
19199                 echo 'strerror() found.' >&4
19200                 d_strerror="$define"
19201                 d_strerrm='strerror(e)'
19202                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19203                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19204                         d_syserrlst="$define"
19205                 else
19206                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19207                         d_syserrlst="$undef"
19208                 fi
19209     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19210                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19211                 echo 'strerror() found in string header.' >&4
19212                 d_strerror="$define"
19213                 d_strerrm='strerror(e)'
19214                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19215                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19216                                 d_syserrlst="$define"
19217                 else
19218                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19219                         d_syserrlst="$undef"
19220                 fi
19221     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19222                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19223                 d_strerror="$undef"
19224                 d_syserrlst="$define"
19225                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19226     else
19227                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19228                 d_strerror="$undef"
19229                 d_syserrlst="$undef"
19230                 d_strerrm='"unknown"'
19231     fi
19232 fi
19233
19234 : see if strerror_r exists
19235 set strerror_r d_strerror_r
19236 eval $inlibc
19237 case "$d_strerror_r" in
19238 "$define")
19239         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19240         case "$d_strerror_r_proto:$usethreads" in
19241         ":define")      d_strerror_r_proto=define
19242                 set d_strerror_r_proto strerror_r $hdrs
19243                 eval $hasproto ;;
19244         *)      ;;
19245         esac
19246         case "$d_strerror_r_proto" in
19247         define)
19248         case "$strerror_r_proto" in
19249         ''|0) try='int strerror_r(int, char*, size_t);'
19250         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19251         esac
19252         case "$strerror_r_proto" in
19253         ''|0) try='int strerror_r(int, char*, int);'
19254         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19255         esac
19256         case "$strerror_r_proto" in
19257         ''|0) try='char* strerror_r(int, char*, size_t);'
19258         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19259         esac
19260         case "$strerror_r_proto" in
19261         ''|0)   d_strerror_r=undef
19262                 strerror_r_proto=0
19263                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19264         * )     case "$strerror_r_proto" in
19265                 REENTRANT_PROTO*) ;;
19266                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19267                 esac
19268                 echo "Prototype: $try" ;;
19269         esac
19270         ;;
19271         *)      case "$usethreads" in
19272                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19273                 esac
19274                 d_strerror_r=undef
19275                 strerror_r_proto=0
19276                 ;;
19277         esac
19278         ;;
19279 *)      strerror_r_proto=0
19280         ;;
19281 esac
19282
19283 : see if strftime exists
19284 set strftime d_strftime
19285 eval $inlibc
19286
19287 : see if strlcat exists
19288 set strlcat d_strlcat
19289 eval $inlibc
19290
19291 : see if strlcpy exists
19292 set strlcpy d_strlcpy
19293 eval $inlibc
19294
19295 : see if strtod exists
19296 set strtod d_strtod
19297 eval $inlibc
19298
19299 : see if strtol exists
19300 set strtol d_strtol
19301 eval $inlibc
19302
19303 : see if strtold exists
19304 set strtold d_strtold
19305 eval $inlibc
19306
19307 : see if strtoll exists
19308 set strtoll d_strtoll
19309 eval $inlibc
19310
19311 case "$d_longlong-$d_strtoll" in
19312 "$define-$define")
19313         $cat <<EOM
19314 Checking whether your strtoll() works okay...
19315 EOM
19316         $cat >try.c <<'EOCP'
19317 #include <errno.h>
19318 #ifdef __hpux
19319 #define strtoll __strtoll
19320 #endif
19321 #ifdef __EMX__
19322 #define strtoll _strtoll
19323 #endif
19324 #include <stdio.h>
19325 extern long long int strtoll(char *s, char **, int);
19326 static int bad = 0;
19327 int check(char *s, long long ell, int een) {
19328         long long gll;
19329         errno = 0;
19330         gll = strtoll(s, 0, 10);
19331         if (!((gll == ell) && (errno == een)))
19332                 bad++;
19333 }
19334 int main() {
19335         check(" 1",                                      1LL, 0);
19336         check(" 0",                                      0LL, 0);
19337         check("-1",                                     -1LL, 0);
19338         check("-9223372036854775808", -9223372036854775808LL, 0);
19339         check("-9223372036854775808", -9223372036854775808LL, 0);
19340         check(" 9223372036854775807",  9223372036854775807LL, 0);
19341         check("-9223372036854775808", -9223372036854775808LL, 0);
19342         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19343         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19344         if (!bad)
19345                 printf("ok\n");
19346 }
19347 EOCP
19348         set try
19349         if eval $compile; then
19350                 yyy=`$run ./try`
19351                 case "$yyy" in
19352                 ok) echo "Your strtoll() seems to be working okay." ;;
19353                 *) cat <<EOM >&4
19354 Your strtoll() doesn't seem to be working okay.
19355 EOM
19356                    d_strtoll="$undef"
19357                    ;;
19358                 esac
19359         else
19360                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19361                 d_strtoll="$undef"
19362         fi
19363         ;;
19364 esac
19365
19366 : see if strtoq exists
19367 set strtoq d_strtoq
19368 eval $inlibc
19369
19370 : see if strtoul exists
19371 set strtoul d_strtoul
19372 eval $inlibc
19373
19374 case "$d_strtoul" in
19375 "$define")
19376         $cat <<EOM
19377 Checking whether your strtoul() works okay...
19378 EOM
19379         $cat >try.c <<'EOCP'
19380 #include <errno.h>
19381 #include <stdio.h>
19382 extern unsigned long int strtoul(char *s, char **, int);
19383 static int bad = 0;
19384 void check(char *s, unsigned long eul, int een) {
19385         unsigned long gul;
19386         errno = 0;
19387         gul = strtoul(s, 0, 10);
19388         if (!((gul == eul) && (errno == een)))
19389                 bad++;
19390 }
19391 int main() {
19392         check(" 1", 1L, 0);
19393         check(" 0", 0L, 0);
19394 EOCP
19395         case "$longsize" in
19396         8)
19397             $cat >>try.c <<'EOCP'
19398         check("18446744073709551615", 18446744073709551615UL, 0);
19399         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19400 #if 0 /* strtoul() for /^-/ strings is undefined. */
19401         check("-1", 18446744073709551615UL, 0);
19402         check("-18446744073709551614", 2, 0);
19403         check("-18446744073709551615", 1, 0);
19404         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19405         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19406 #endif
19407 EOCP
19408                 ;;
19409         4)
19410                     $cat >>try.c <<'EOCP'
19411         check("4294967295", 4294967295UL, 0);
19412         check("4294967296", 4294967295UL, ERANGE);
19413 #if 0 /* strtoul() for /^-/ strings is undefined. */
19414         check("-1", 4294967295UL, 0);
19415         check("-4294967294", 2, 0);
19416         check("-4294967295", 1, 0);
19417         check("-4294967296", 4294967295UL, ERANGE);
19418         check("-4294967297", 4294967295UL, ERANGE);
19419 #endif
19420 EOCP
19421                 ;;
19422         *)
19423 : Should we write these tests to be more portable by sprintf-ing
19424 : ~0 and then manipulating that char string as input for strtol?
19425                 ;;
19426         esac
19427         $cat >>try.c <<'EOCP'
19428         if (!bad)
19429                 printf("ok\n");
19430         return 0;
19431 }
19432 EOCP
19433         set try
19434         if eval $compile; then
19435                 case "`$run ./try`" in
19436                 ok) echo "Your strtoul() seems to be working okay." ;;
19437                 *) cat <<EOM >&4
19438 Your strtoul() doesn't seem to be working okay.
19439 EOM
19440                    d_strtoul="$undef"
19441                    ;;
19442                 esac
19443         else
19444                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19445                 d_strtoul="$undef"
19446         fi
19447         ;;
19448 esac
19449
19450 : see if strtoull exists
19451 set strtoull d_strtoull
19452 eval $inlibc
19453
19454 case "$d_longlong-$d_strtoull" in
19455 "$define-$define")
19456         $cat <<EOM
19457 Checking whether your strtoull() works okay...
19458 EOM
19459         $cat >try.c <<'EOCP'
19460 #include <errno.h>
19461 #ifdef __hpux
19462 #define strtoull __strtoull
19463 #endif
19464 #include <stdio.h>
19465 extern unsigned long long int strtoull(char *s, char **, int);
19466 static int bad = 0;
19467 int check(char *s, long long eull, int een) {
19468         long long gull;
19469         errno = 0;
19470         gull = strtoull(s, 0, 10);
19471         if (!((gull == eull) && (errno == een)))
19472                 bad++;
19473 }
19474 int main() {
19475         check(" 1",                                        1LL, 0);
19476         check(" 0",                                        0LL, 0);
19477         check("18446744073709551615",  18446744073709551615ULL, 0);
19478         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19479 #if 0 /* strtoull() for /^-/ strings is undefined. */
19480         check("-1",                    18446744073709551615ULL, 0);
19481         check("-18446744073709551614",                     2LL, 0);
19482         check("-18446744073709551615",                     1LL, 0);
19483         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19484         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19485 #endif
19486         if (!bad)
19487                 printf("ok\n");
19488 }
19489 EOCP
19490         set try
19491         if eval $compile; then
19492                 case "`$run ./try`" in
19493                 ok) echo "Your strtoull() seems to be working okay." ;;
19494                 *) cat <<EOM >&4
19495 Your strtoull() doesn't seem to be working okay.
19496 EOM
19497                    d_strtoull="$undef"
19498                    ;;
19499                 esac
19500         else
19501                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19502                 d_strtoull="$undef"
19503         fi
19504         ;;
19505 esac
19506
19507 : see if strtouq exists
19508 set strtouq d_strtouq
19509 eval $inlibc
19510
19511 case "$d_strtouq" in
19512 "$define")
19513         $cat <<EOM
19514 Checking whether your strtouq() works okay...
19515 EOM
19516         $cat >try.c <<'EOCP'
19517 #include <errno.h>
19518 #include <stdio.h>
19519 extern unsigned long long int strtouq(char *s, char **, int);
19520 static int bad = 0;
19521 void check(char *s, unsigned long long eull, int een) {
19522         unsigned long long gull;
19523         errno = 0;
19524         gull = strtouq(s, 0, 10);
19525         if (!((gull == eull) && (errno == een)))
19526                 bad++;
19527 }
19528 int main() {
19529         check(" 1",                                        1LL, 0);
19530         check(" 0",                                        0LL, 0);
19531         check("18446744073709551615",  18446744073709551615ULL, 0);
19532         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19533 #if 0 /* strtouq() for /^-/ strings is undefined. */
19534         check("-1",                    18446744073709551615ULL, 0);
19535         check("-18446744073709551614",                     2LL, 0);
19536         check("-18446744073709551615",                     1LL, 0);
19537         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19538         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19539 #endif
19540         if (!bad)
19541                 printf("ok\n");
19542         return 0;
19543 }
19544 EOCP
19545         set try
19546         if eval $compile; then
19547                 case "`$run ./try`" in
19548                 ok) echo "Your strtouq() seems to be working okay." ;;
19549                 *) cat <<EOM >&4
19550 Your strtouq() doesn't seem to be working okay.
19551 EOM
19552                    d_strtouq="$undef"
19553                    ;;
19554                 esac
19555         else
19556                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19557                 d_strtouq="$undef"
19558         fi
19559         ;;
19560 esac
19561
19562 : see if strxfrm exists
19563 set strxfrm d_strxfrm
19564 eval $inlibc
19565
19566 : see if symlink exists
19567 set symlink d_symlink
19568 eval $inlibc
19569
19570 : see if syscall exists
19571 set syscall d_syscall
19572 eval $inlibc
19573
19574 : see if prototype for syscall is available
19575 echo " "
19576 set d_syscallproto syscall $i_unistd unistd.h
19577 eval $hasproto
19578
19579 : see if sysconf exists
19580 set sysconf d_sysconf
19581 eval $inlibc
19582
19583 : see if system exists
19584 set system d_system
19585 eval $inlibc
19586
19587 : see if tcgetpgrp exists
19588 set tcgetpgrp d_tcgetpgrp
19589 eval $inlibc
19590
19591 : see if tcsetpgrp exists
19592 set tcsetpgrp d_tcsetpgrp
19593 eval $inlibc
19594
19595 : see if prototype for telldir is available
19596 echo " "
19597 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19598 eval $hasproto
19599
19600 : see if tgamma exists
19601 set tgamma d_tgamma
19602 eval $inlibc
19603
19604 : see if time exists
19605 echo " "
19606 if test "X$d_time" = X -o X"$timetype" = X; then
19607     if set time val -f d_time; eval $csym; $val; then
19608                 echo 'time() found.' >&4
19609                 val="$define"
19610                 rp="What is the type returned by time() on this system?"
19611                 set time_t timetype long stdio.h sys/types.h
19612                 eval $typedef_ask
19613     else
19614                 echo 'time() not found, hope that will do.' >&4
19615                 val="$undef"
19616                 timetype='int';
19617     fi
19618     set d_time
19619     eval $setvar
19620 fi
19621
19622 : see if timegm exists
19623 set timegm d_timegm
19624 eval $inlibc
19625
19626 : see if this is a sys/times.h system
19627 set sys/times.h i_systimes
19628 eval $inhdr
19629
19630 : see if times exists
19631 echo " "
19632 if set times val -f d_times; eval $csym; $val; then
19633         echo 'times() found.' >&4
19634         d_times="$define"
19635         inc=''
19636         case "$i_systimes" in
19637         "$define") inc='sys/times.h';;
19638         esac
19639         rp="What is the type returned by times() on this system?"
19640         set clock_t clocktype long stdio.h sys/types.h $inc
19641         eval $typedef_ask
19642 else
19643         echo 'times() NOT found, hope that will do.' >&4
19644         d_times="$undef"
19645         clocktype='int'
19646 fi
19647
19648 : see if tmpnam_r exists
19649 set tmpnam_r d_tmpnam_r
19650 eval $inlibc
19651 case "$d_tmpnam_r" in
19652 "$define")
19653         hdrs="$i_systypes sys/types.h define stdio.h "
19654         case "$d_tmpnam_r_proto:$usethreads" in
19655         ":define")      d_tmpnam_r_proto=define
19656                 set d_tmpnam_r_proto tmpnam_r $hdrs
19657                 eval $hasproto ;;
19658         *)      ;;
19659         esac
19660         case "$d_tmpnam_r_proto" in
19661         define)
19662         case "$tmpnam_r_proto" in
19663         ''|0) try='char* tmpnam_r(char*);'
19664         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19665         esac
19666         case "$tmpnam_r_proto" in
19667         ''|0)   d_tmpnam_r=undef
19668                 tmpnam_r_proto=0
19669                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19670         * )     case "$tmpnam_r_proto" in
19671                 REENTRANT_PROTO*) ;;
19672                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19673                 esac
19674                 echo "Prototype: $try" ;;
19675         esac
19676         ;;
19677         *)      case "$usethreads" in
19678                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19679                 esac
19680                 d_tmpnam_r=undef
19681                 tmpnam_r_proto=0
19682                 ;;
19683         esac
19684         ;;
19685 *)      tmpnam_r_proto=0
19686         ;;
19687 esac
19688
19689 : see if trunc exists
19690 set trunc d_trunc
19691 eval $inlibc
19692
19693 : see if truncate exists
19694 set truncate d_truncate
19695 eval $inlibc
19696
19697 : see if ttyname_r exists
19698 set ttyname_r d_ttyname_r
19699 eval $inlibc
19700 case "$d_ttyname_r" in
19701 "$define")
19702         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19703         case "$d_ttyname_r_proto:$usethreads" in
19704         ":define")      d_ttyname_r_proto=define
19705                 set d_ttyname_r_proto ttyname_r $hdrs
19706                 eval $hasproto ;;
19707         *)      ;;
19708         esac
19709         case "$d_ttyname_r_proto" in
19710         define)
19711         case "$ttyname_r_proto" in
19712         ''|0) try='int ttyname_r(int, char*, size_t);'
19713         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19714         esac
19715         case "$ttyname_r_proto" in
19716         ''|0) try='int ttyname_r(int, char*, int);'
19717         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19718         esac
19719         case "$ttyname_r_proto" in
19720         ''|0) try='char* ttyname_r(int, char*, int);'
19721         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19722         esac
19723         case "$ttyname_r_proto" in
19724         ''|0)   d_ttyname_r=undef
19725                 ttyname_r_proto=0
19726                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19727         * )     case "$ttyname_r_proto" in
19728                 REENTRANT_PROTO*) ;;
19729                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19730                 esac
19731                 echo "Prototype: $try" ;;
19732         esac
19733         ;;
19734         *)      case "$usethreads" in
19735                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19736                 esac
19737                 d_ttyname_r=undef
19738                 ttyname_r_proto=0
19739                 ;;
19740         esac
19741         ;;
19742 *)      ttyname_r_proto=0
19743         ;;
19744 esac
19745
19746 : see if tzname[] exists
19747 echo " "
19748 if set tzname val -a d_tzname; eval $csym; $val; then
19749         val="$define"
19750         echo 'tzname[] found.' >&4
19751 else
19752         val="$undef"
19753         echo 'tzname[] NOT found.' >&4
19754 fi
19755 set d_tzname
19756 eval $setvar
19757
19758 : Check if is a multiplatform env
19759 case "$osname" in
19760 darwin) multiarch="$define" ;;
19761 esac
19762 case "$multiarch" in
19763 ''|[nN]*) multiarch="$undef" ;;
19764 esac
19765
19766 : check for ordering of bytes in a UV
19767 echo " "
19768 case "$multiarch" in
19769 *$define*)
19770         $cat <<EOM
19771 You seem to be doing a multiarchitecture build,
19772 skipping the byteorder check.
19773
19774 EOM
19775         byteorder='ffff'
19776         ;;
19777 *)
19778         case "$byteorder" in
19779         '')
19780                 $cat <<'EOM'
19781 In the following, larger digits indicate more significance.  A big-endian
19782 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19783 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19784 machines may have weird orders like 3412.  A Cray will report 87654321,
19785 an Alpha will report 12345678. If the test program works the default is
19786 probably right.
19787 I'm now running the test program...
19788 EOM
19789                 $cat >try.c <<EOCP
19790 #include <stdio.h>
19791 #$i_stdlib I_STDLIB
19792 #ifdef I_STDLIB
19793 #include <stdlib.h>
19794 #endif
19795 #include <sys/types.h>
19796 typedef $uvtype UV;
19797 int main()
19798 {
19799         int i;
19800         union {
19801                 UV l;
19802                 char c[$uvsize];
19803         } u;
19804
19805         if ($uvsize > 4)
19806                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19807         else
19808                 u.l = (UV)0x04030201;
19809         for (i = 0; i < $uvsize; i++)
19810                 printf("%c", u.c[i]+'0');
19811         printf("\n");
19812         exit(0);
19813 }
19814 EOCP
19815                 xxx_prompt=y
19816                 set try
19817                 if eval $compile && $run ./try > /dev/null; then
19818                         dflt=`$run ./try`
19819                         case "$dflt" in
19820                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19821                                 echo "(The test program ran ok.)"
19822                                 echo "byteorder=$dflt"
19823                                 xxx_prompt=n
19824                         ;;
19825                         ????|????????) echo "(The test program ran ok.)" ;;
19826                         *) echo "(The test program didn't run right for some reason.)" ;;
19827                         esac
19828                 else
19829                         dflt='4321'
19830                         cat <<'EOM'
19831 (I can't seem to compile the test program.  Guessing big-endian...)
19832 EOM
19833                 fi
19834                 case "$xxx_prompt" in
19835                 y)
19836                         rp="What is the order of bytes in $uvtype?"
19837                         . ./myread
19838                         byteorder="$ans"
19839                         ;;
19840                 *)      byteorder=$dflt
19841                         ;;
19842                 esac
19843                 ;;
19844         esac
19845         $rm_try
19846         ;;
19847 esac
19848
19849 : Checking 32bit alignedness
19850 $cat <<EOM
19851
19852 Checking to see whether you can access character data unalignedly...
19853 EOM
19854 case "$d_u32align" in
19855 '')   $cat >try.c <<EOCP
19856 #include <stdio.h>
19857 #$i_stdlib I_STDLIB
19858 #ifdef I_STDLIB
19859 #include <stdlib.h>
19860 #endif
19861 #define U32 $u32type
19862 #define BYTEORDER 0x$byteorder
19863 #define U8 $u8type
19864 #include <signal.h>
19865 #ifdef SIGBUS
19866 $signal_t bletch(int s) { exit(4); }
19867 #endif
19868 int main() {
19869 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19870     volatile U8 buf[8];
19871     volatile U32 *up;
19872     int i;
19873
19874     if (sizeof(U32) != 4) {
19875         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19876         exit(1);
19877     }
19878
19879     fflush(stdout);
19880
19881 #ifdef SIGBUS
19882     signal(SIGBUS, bletch);
19883 #endif
19884
19885     buf[0] = 0;
19886     buf[1] = 0;
19887     buf[2] = 0;
19888     buf[3] = 1;
19889     buf[4] = 0;
19890     buf[5] = 0;
19891     buf[6] = 0;
19892     buf[7] = 1;
19893
19894     for (i = 0; i < 4; i++) {
19895         up = (U32*)(buf + i);
19896         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19897                (*up == 1 << (8*(3-i)))  /* little-endian */
19898               )
19899            )
19900         {
19901             printf("read failed (%x)\n", *up);
19902             exit(2);
19903         }
19904     }
19905
19906     /* write test */
19907     for (i = 0; i < 4; i++) {
19908         up = (U32*)(buf + i);
19909         *up = 0xBeef;
19910         if (*up != 0xBeef) {
19911             printf("write failed (%x)\n", *up);
19912             exit(3);
19913         }
19914     }
19915
19916     exit(0);
19917 #else
19918     printf("1\n");
19919     exit(1);
19920 #endif
19921     return 0;
19922 }
19923 EOCP
19924 set try
19925 if eval $compile_ok; then
19926         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19927         $run ./try 2>&1 >/dev/null
19928         case "$?" in
19929         0)      cat >&4 <<EOM
19930 You can access character data pretty unalignedly.
19931 EOM
19932                 d_u32align="$undef"
19933                 ;;
19934         *)      cat >&4 <<EOM
19935 It seems that you must access character data in an aligned manner.
19936 EOM
19937                 d_u32align="$define"
19938                 ;;
19939         esac
19940 else
19941         rp='Can you access character data at unaligned addresses?'
19942         dflt='n'
19943         . ./myread
19944         case "$ans" in
19945         [yY]*)  d_u32align="$undef"  ;;
19946         *)      d_u32align="$define" ;;
19947         esac
19948 fi
19949 $rm_try
19950 ;;
19951 esac
19952
19953 : see if ualarm exists
19954 set ualarm d_ualarm
19955 eval $inlibc
19956
19957 : see if umask exists
19958 set umask d_umask
19959 eval $inlibc
19960
19961 : see if unordered exists
19962 set unordered d_unordered
19963 eval $inlibc
19964
19965 : see if unsetenv exists
19966 set unsetenv d_unsetenv
19967 eval $inlibc
19968
19969 : see if usleep exists
19970 set usleep d_usleep
19971 eval $inlibc
19972
19973 : see if prototype for usleep is available
19974 echo " "
19975 set d_usleepproto usleep $i_unistd unistd.h
19976 eval $hasproto
19977
19978 : see if ustat exists
19979 set ustat d_ustat
19980 eval $inlibc
19981
19982 : see if closedir exists
19983 set closedir d_closedir
19984 eval $inlibc
19985
19986 case "$d_closedir" in
19987 "$define")
19988         echo " "
19989         echo "Checking whether closedir() returns a status..." >&4
19990         cat > try.c <<EOM
19991 #$i_dirent I_DIRENT             /**/
19992 #$i_sysdir I_SYS_DIR            /**/
19993 #$i_sysndir I_SYS_NDIR          /**/
19994 #$i_systypes I_SYS_TYPES        /**/
19995
19996 #if defined(I_SYS_TYPES)
19997 #include <sys/types.h>
19998 #endif
19999 #if defined(I_DIRENT)
20000 #include <dirent.h>
20001 #else
20002 #ifdef I_SYS_NDIR
20003 #include <sys/ndir.h>
20004 #else
20005 #ifdef I_SYS_DIR
20006 #ifdef hp9000s500
20007 #include <ndir.h>       /* may be wrong in the future */
20008 #else
20009 #include <sys/dir.h>
20010 #endif
20011 #endif
20012 #endif
20013 #endif
20014 int main() { return closedir(opendir(".")); }
20015 EOM
20016         set try
20017         if eval $compile_ok; then
20018                 if $run ./try > /dev/null 2>&1 ; then
20019                         echo "Yes, it does."
20020                         val="$undef"
20021                 else
20022                         echo "No, it doesn't."
20023                         val="$define"
20024                 fi
20025         else
20026                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20027                 val="$define"
20028         fi
20029         ;;
20030 *)
20031         val="$undef";
20032         ;;
20033 esac
20034 set d_void_closedir
20035 eval $setvar
20036 $rm_try
20037
20038 : see if there is a wait4
20039 set wait4 d_wait4
20040 eval $inlibc
20041
20042 : see if waitpid exists
20043 set waitpid d_waitpid
20044 eval $inlibc
20045
20046 : look for wcscmp
20047 echo " "
20048 $cat >try.c <<'EOCP'
20049 #include <stdio.h>
20050 #include <wchar.h>
20051 int main ()
20052 {
20053     wchar_t *s = L" ";
20054     return (wcscmp (s, s) ? 1 : 0);
20055     }
20056 EOCP
20057 set try
20058 val="$undef"
20059 if eval $compile; then
20060     `$run ./try`
20061     case "$?" in
20062         0)  echo "A working wcscmp() found." >&4
20063             val="$define" ;;
20064         *)  echo "wcscmp() found, but it doesn't work" >&4
20065             ;;
20066         esac
20067 else
20068     echo "wcscmp() NOT found." >&4
20069     fi
20070 set d_wcscmp
20071 eval $setvar
20072 $rm_try
20073
20074 : see if wcstombs exists
20075 set wcstombs d_wcstombs
20076 eval $inlibc
20077
20078 : look for wcsxfrm
20079 echo " "
20080 $cat >try.c <<'EOCP'
20081 #include <errno.h>
20082 #include <wchar.h>
20083 int main ()
20084 {
20085     wchar_t dst[4], *src = L" ";
20086     errno = 0;
20087     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20088     }
20089 EOCP
20090 set try
20091 val="$undef"
20092 if eval $compile; then
20093     `$run ./try`
20094     case "$?" in
20095         0)  echo "A working wcsxfrm() found." >&4
20096             val="$define" ;;
20097         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20098             ;;
20099         esac
20100 else
20101     echo "wcsxfrm() NOT found." >&4
20102     fi
20103 set d_wcsxfrm
20104 eval $setvar
20105 $rm_try
20106
20107 : see if wctomb exists
20108 set wctomb d_wctomb
20109 eval $inlibc
20110
20111 : see if writev exists
20112 set writev d_writev
20113 eval $inlibc
20114
20115 : check for alignment requirements
20116 echo " "
20117 case "$alignbytes" in
20118     '') echo "Checking alignment constraints..." >&4
20119         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
20120             $cat >try.c <<'EOCP'
20121 typedef long double NV;
20122 EOCP
20123         else
20124             $cat >try.c <<'EOCP'
20125 typedef double NV;
20126 EOCP
20127         fi
20128         $cat >>try.c <<'EOCP'
20129 #include <stdio.h>
20130 struct foobar {
20131     char foo;
20132     NV bar;
20133 } try_algn;
20134 int main()
20135 {
20136     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20137     return(0);
20138 }
20139 EOCP
20140         set try
20141         if eval $compile_ok; then
20142             dflt=`$run ./try`
20143         else
20144             dflt='8'
20145             echo "(I can't seem to compile the test program...)"
20146         fi
20147         case "$multiarch" in
20148             *$define*)
20149                 : The usual safe value is 8, but Darwin with -Duselongdouble
20150                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20151                 : Configure to pick a larger value if needed.
20152                 if $test "$dflt" -lt 8; then
20153                     dflt='8'
20154                     echo "Setting alignment to 8 for multiarch support.">&4
20155                 fi
20156                 ;;
20157         esac
20158         ;;
20159     *) dflt="$alignbytes"
20160         ;;
20161 esac
20162 rp="Doubles must be aligned on a how-many-byte boundary?"
20163 . ./myread
20164 alignbytes="$ans"
20165 $rm_try
20166
20167 : set the base revision
20168 baserev=5.0
20169
20170 : length of character in bytes. Is always 1, otherwise it is not C
20171 : This used to be a test using sizeof
20172 charsize=1
20173
20174 : Check for the number of bits in a character
20175 case "$charbits" in
20176 '')     echo "Checking how long a character is (in bits)..." >&4
20177         $cat >try.c <<EOCP
20178 #include <stdio.h>
20179 int main ()
20180 {
20181     int n;
20182     unsigned char c;
20183     for (c = 1, n = 0; c; c <<= 1, n++) ;
20184     printf ("%d\n", n);
20185     return (0);
20186     }
20187 EOCP
20188         set try
20189         if eval $compile_ok; then
20190                 dflt=`$run ./try`
20191         else
20192                 dflt='8'
20193                 echo "(I can't seem to compile the test program.  Guessing...)"
20194         fi
20195         ;;
20196 *)
20197         dflt="$charbits"
20198         ;;
20199 esac
20200 rp="What is the length of a character (in bits)?"
20201 . ./myread
20202 charbits="$ans"
20203 $rm_try
20204 case "$charbits" in
20205 8)      ;;
20206 *)      cat >&4 << EOM
20207 Your system has an unsigned character size of $charbits bits, which
20208 is rather unusual (normally it is 8 bits).  Perl likely will not work
20209 correctly on your system, with subtle bugs in various places.
20210 EOM
20211         rp='Do you really want to continue?'
20212         dflt='n'
20213         . ./myread
20214         case "$ans" in
20215                 [yY])   echo >&4 "Okay, continuing."    ;;
20216                 *)      exit 1                          ;;
20217         esac
20218 esac
20219
20220 : how do we concatenate cpp tokens here?
20221 echo " "
20222 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20223 $cat >cpp_stuff.c <<'EOCP'
20224 #define RCAT(a,b)a/**/b
20225 #define ACAT(a,b)a ## b
20226 RCAT(Rei,ser)
20227 ACAT(Cir,cus)
20228 EOCP
20229 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20230 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20231         echo "Oh!  Smells like ANSI's been here." >&4
20232         echo "We can catify or stringify, separately or together!"
20233         cpp_stuff=42
20234 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20235         echo "Ah, yes!  The good old days!" >&4
20236         echo "However, in the good old days we don't know how to stringify and"
20237         echo "catify at the same time."
20238         cpp_stuff=1
20239 else
20240         $cat >&4 <<EOM
20241 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20242 You're going to have to edit the values of CAT[2-5] in config.h...
20243 EOM
20244         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20245 fi
20246 $rm -f cpp_stuff.*
20247
20248 : see if this is a db.h system
20249 set db.h i_db
20250 eval $inhdr
20251
20252 case "$i_db" in
20253 $define)
20254         : Check db version.
20255         echo " "
20256         echo "Checking Berkeley DB version ..." >&4
20257         $cat >try.c <<EOCP
20258 #$d_const HASCONST
20259 #ifndef HASCONST
20260 #define const
20261 #endif
20262 #include <sys/types.h>
20263 #include <stdio.h>
20264 #$i_stdlib I_STDLIB
20265 #ifdef I_STDLIB
20266 #include <stdlib.h>
20267 #endif
20268 #include <db.h>
20269 int main(int argc, char *argv[])
20270 {
20271 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20272     int Major, Minor, Patch ;
20273     unsigned long Version ;
20274     (void)db_version(&Major, &Minor, &Patch) ;
20275     if (argc == 2) {
20276         printf("%d %d %d %d %d %d\n",
20277                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20278                Major, Minor, Patch);
20279         exit(0);
20280     }
20281     printf("You have Berkeley DB Version 2 or greater.\n");
20282
20283     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20284                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20285     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20286                 Major, Minor, Patch) ;
20287
20288     /* check that db.h & libdb are compatible */
20289     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20290         printf("db.h and libdb are incompatible.\n") ;
20291         exit(3);
20292     }
20293
20294     printf("db.h and libdb are compatible.\n") ;
20295
20296     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20297                 + DB_VERSION_PATCH ;
20298
20299     /* needs to be >= 2.3.4 */
20300     if (Version < 2003004) {
20301     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20302         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20303         exit(2);
20304     }
20305
20306     exit(0);
20307 #else
20308 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20309     if (argc == 2) {
20310         printf("1 0 0\n");
20311         exit(0);
20312     }
20313     printf("You have Berkeley DB Version 1.\n");
20314     exit(0);    /* DB version < 2: the coast is clear. */
20315 #else
20316     exit(1);    /* <db.h> not Berkeley DB? */
20317 #endif
20318 #endif
20319 }
20320 EOCP
20321         set try
20322         if eval $compile_ok && $run ./try; then
20323                 echo 'Looks OK.' >&4
20324                 set `$run ./try 1`
20325                 db_version_major=$1
20326                 db_version_minor=$2
20327                 db_version_patch=$3
20328         else
20329                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20330                 i_db=$undef
20331                 case " $libs " in
20332                 *"-ldb "*)
20333                         : Remove db from list of libraries to use
20334                         echo "Removing unusable -ldb from library list" >&4
20335                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20336                         shift
20337                         libs="$*"
20338                         echo "libs = $libs" >&4
20339                         ;;
20340                 esac
20341         fi
20342         $rm_try
20343         ;;
20344 esac
20345
20346 case "$i_db" in
20347 define)
20348         : Check the return type needed for hash
20349         echo " "
20350         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20351         $cat >try.c <<EOCP
20352 #$d_const HASCONST
20353 #ifndef HASCONST
20354 #define const
20355 #endif
20356 #include <sys/types.h>
20357 #include <db.h>
20358
20359 #ifndef DB_VERSION_MAJOR
20360 u_int32_t hash_cb (const void* ptr, size_t size)
20361 {
20362 }
20363 HASHINFO info;
20364 int main()
20365 {
20366         info.hash = hash_cb;
20367 }
20368 #endif
20369 EOCP
20370         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20371                 if $contains warning try.out >>/dev/null 2>&1 ; then
20372                         db_hashtype='int'
20373                 else
20374                         db_hashtype='u_int32_t'
20375                 fi
20376         else
20377                 : XXX Maybe we should just give up here.
20378                 db_hashtype=u_int32_t
20379                 $cat try.out >&4
20380                 echo "Help:  I can't seem to compile the db test program." >&4
20381                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20382         fi
20383         $rm_try
20384         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20385         ;;
20386 *)      db_hashtype=u_int32_t
20387         ;;
20388 esac
20389 case "$i_db" in
20390 define)
20391         : Check the return type needed for prefix
20392         echo " "
20393         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20394         cat >try.c <<EOCP
20395 #$d_const HASCONST
20396 #ifndef HASCONST
20397 #define const
20398 #endif
20399 #include <sys/types.h>
20400 #include <db.h>
20401
20402 #ifndef DB_VERSION_MAJOR
20403 size_t prefix_cb (const DBT *key1, const DBT *key2)
20404 {
20405 }
20406 BTREEINFO info;
20407 int main()
20408 {
20409         info.prefix = prefix_cb;
20410 }
20411 #endif
20412 EOCP
20413         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20414                 if $contains warning try.out >>/dev/null 2>&1 ; then
20415                         db_prefixtype='int'
20416                 else
20417                         db_prefixtype='size_t'
20418                 fi
20419         else
20420                 db_prefixtype='size_t'
20421                 : XXX Maybe we should just give up here.
20422                 $cat try.out >&4
20423                 echo "Help:  I can't seem to compile the db test program." >&4
20424                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20425         fi
20426         $rm_try
20427         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20428         ;;
20429 *)      db_prefixtype='size_t'
20430         ;;
20431 esac
20432
20433 : Check what kind of inf/nan your system has
20434 $echo "Checking the kind of infinities and nans you have..." >&4
20435 $cat >try.c <<EOP
20436 #define DOUBLESIZE $doublesize
20437 #$d_longdbl HAS_LONG_DOUBLE
20438 #ifdef HAS_LONG_DOUBLE
20439 #define LONGDBLSIZE $longdblsize
20440 #define LONGDBLKIND $longdblkind
20441 #endif
20442 #$i_math I_MATH
20443 #ifdef I_MATH
20444 #include <math.h>
20445 #endif
20446 #include <stdio.h>
20447 /* Note that whether the sign bit is on or off
20448  * for NaN depends on the CPU/FPU, and possibly
20449  * can be affected by the build toolchain.
20450  *
20451  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20452  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20453  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20454  * (respectively) as opposed to the more usual
20455  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20456  */
20457 static void bytes(unsigned char *p, unsigned int n) {
20458   int i;
20459   for (i = 0; i < n; i++) {
20460     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20461   }
20462 }
20463 int main(int argc, char *argv[]) {
20464    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20465     * because some compilers are 'smart' and not only warn but refuse to
20466     * compile such 'illegal' values. */
20467    double dinf = exp(1e9);
20468    double dnan = sqrt(-1.0);
20469 #ifdef HAS_LONG_DOUBLE
20470    long double ldinf = (long double)exp(1e9);
20471    long double ldnan = (long double)sqrt(-1.0);
20472 #endif
20473   if (argc == 2) {
20474     switch (argv[1][0]) {
20475     case '1': bytes(&dinf, sizeof(dinf)); break;
20476     case '2': bytes(&dnan, sizeof(dnan)); break;
20477 #ifdef HAS_LONG_DOUBLE
20478 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20479 /* the 80-bit long doubles might have garbage in their excess bytes */
20480     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20481 # endif
20482     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20483     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20484 #endif
20485     }
20486   }
20487   return 0;
20488 }
20489 EOP
20490 set try
20491 if eval $compile; then
20492     doubleinfbytes=`$run ./try 1`
20493     doublenanbytes=`$run ./try 2`
20494     case "$d_longdbl" in
20495     $define)
20496       longdblinfbytes=`$run ./try 3`
20497       longdblnanbytes=`$run ./try 4`
20498       ;;
20499     esac
20500 else
20501     # Defaults in case the above test program failed.
20502     case "$doublekind" in
20503     1) # IEEE 754 32-bit LE
20504        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20505        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20506        ;;
20507     2) # IEEE 754 32-bit BE
20508        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20509        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20510        ;;
20511     3) # IEEE 754 64-bit LE
20512        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20513        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20514        ;;
20515     4) # IEEE 754 64-bit BE
20516        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20517        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20518        ;;
20519     5) # IEEE 754 128-bit LE
20520        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20521        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20522        ;;
20523     6) # IEEE 754 128-bit BE
20524        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20525        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20526        ;;
20527     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20528        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20529        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20530        ;;
20531     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20532        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20533        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20534        ;;
20535     *) # No idea.
20536        doubleinfbytes=$undef
20537        doublenanbytes=$undef
20538        ;;
20539     esac
20540     case "$longdblkind" in
20541     1) # IEEE 754 128-bit LE
20542        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20543        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20544        ;;
20545     2) # IEEE 754 128-bit BE
20546        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20547        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20548        ;;
20549     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20550        case "$longdblsize" in
20551        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20552            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20553            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20554            ;;
20555        16) # x86_64
20556            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20557            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20558            ;;
20559        *)  # No idea.
20560            longdblinfbytes=$undef
20561            longdblnanbytes=$undef
20562        ;;
20563        esac
20564        ;;
20565     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20566        case "$longdblsize" in
20567        12) # 32-bit system
20568            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20569            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20570            ;;
20571        16) # 64-bit system
20572            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20573            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20574            ;;
20575        *)  # No idea.
20576            longdblinfbytes=$undef
20577            longdblnanbytes=$undef
20578        ;;
20579        esac
20580        ;;
20581     5) # 128-bit LE-LE "double double"
20582        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20583        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20584        ;;
20585     6) # 128-bit BE-BE "double double"
20586        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20587        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20588        ;;
20589     7) # 128-bit LE-BE "double double"
20590        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20591        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20592        ;;
20593     8) # 128-bit BE-LE "double double"
20594        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20595        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20596        ;;
20597     *) # No idea.
20598        longdblinfbytes=$undef
20599        longdblnanbytes=$undef
20600        ;;
20601     esac
20602 fi
20603 $rm_try
20604
20605 : Check the length of the double mantissa
20606 $echo "Checking how many mantissa bits your doubles have..." >&4
20607 $cat >try.c <<EOP
20608 #$i_float I_FLOAT
20609 #$i_sunmath I_SUNMATH
20610 #ifdef I_FLOAT
20611 # include <float.h>
20612 #endif
20613 #ifdef I_SUNMATH
20614 # include <sunmath.h>
20615 #endif
20616 #ifdef DBL_MANT_DIG
20617 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20618 #endif
20619 #include <stdio.h>
20620 int main(int argc, char *argv[]) {
20621 #ifdef BITS
20622   printf("%d\n", BITS);
20623 #endif
20624   return 0;
20625 }
20626 EOP
20627 set try
20628 if eval $compile; then
20629     doublemantbits=`$run ./try`
20630 else
20631     doublemantbits="$undef"
20632 fi
20633 $rm_try
20634
20635 : Check the length of the longdouble mantissa
20636 $echo "Checking how many mantissa bits your long doubles have..." >&4
20637 $cat >try.c <<EOP
20638 #$i_float I_FLOAT
20639 #$i_sunmath I_SUNMATH
20640 #ifdef I_FLOAT
20641 # include <float.h>
20642 #endif
20643 #ifdef I_SUNMATH
20644 # include <sunmath.h>
20645 #endif
20646 #$d_longdbl HAS_LONG_DOUBLE
20647 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20648 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20649 /* This format has no implicit bit.  Beware, however, that for
20650  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20651  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20652  * and the top bit must have been one since 387, zero is plain invalid.
20653  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20654 #  define BITS LDBL_MANT_DIG
20655 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20656 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20657  * reason e.g. Irix thinks 107.  But in any case, we want only
20658  * the number of real bits, the implicit bits are of no interest.  */
20659 #  define BITS 2 * (DBL_MANT_DIG - 1)
20660 # else
20661 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20662 # endif
20663 #endif
20664 #include <stdio.h>
20665 int main(int argc, char *argv[]) {
20666 #ifdef BITS
20667   printf("%d\n", BITS);
20668 #endif
20669   return 0;
20670 }
20671 EOP
20672 set try
20673 if eval $compile; then
20674     longdblmantbits=`$run ./try`
20675 else
20676     longdblmantbits="$undef"
20677 fi
20678 $rm_try
20679
20680 : Check the length of the NV mantissa
20681 $echo "Checking how many mantissa bits your NVs have..." >&4
20682 if test "X$usequadmath" = "X$define"; then
20683   nvmantbits=112 # 128-1-15
20684 else
20685   if test "X$nvsize" = "X$doublesize"; then
20686     nvmantbits="$doublemantbits"
20687   else
20688      if test "X$nvsize" = "X$longdblsize"; then
20689        nvmantbits="$longdblmantbits"
20690      else
20691        nvmantbits="$undef"
20692      fi
20693   fi
20694 fi
20695
20696 : How can we generate normalized random numbers ?
20697 echo " "
20698 echo "Using our internal random number implementation..." >&4
20699
20700 case "$ccflags" in
20701 *-Dmy_rand=*|*-Dmy_srand=*)
20702         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20703         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20704         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20705         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20706         ;;
20707 esac
20708
20709 randfunc=Perl_drand48
20710 drand01="Perl_drand48()"
20711 seedfunc="Perl_drand48_init"
20712 randbits=48
20713 randseedtype=U32
20714
20715 : Determine if this is an EBCDIC system
20716 echo " "
20717 echo "Determining whether or not we are on an EBCDIC system..." >&4
20718 $cat >try.c <<'EOM'
20719 int main()
20720 {
20721   if ('M'==0xd4) return 0;
20722   return 1;
20723 }
20724 EOM
20725
20726 val=$undef
20727 set try
20728 if eval $compile_ok; then
20729         if $run ./try; then
20730                 echo "You seem to speak EBCDIC." >&4
20731                 val="$define"
20732         else
20733                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20734         fi
20735 else
20736         echo "I'm unable to compile the test program." >&4
20737         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20738 fi
20739 $rm_try
20740 set ebcdic
20741 eval $setvar
20742
20743 : Check how to flush
20744 echo " "
20745 $cat >&4 <<EOM
20746 Checking how to flush all pending stdio output...
20747 EOM
20748 # I only know how to find the first 32 possibly open files on SunOS.
20749 # See also hints/sunos_4_1.sh and util.c  --AD
20750 case "$osname" in
20751 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20752 esac
20753 $cat >>try.c <<EOCP
20754 #include <stdio.h>
20755 #$i_stdlib I_STDLIB
20756 #ifdef I_STDLIB
20757 #include <stdlib.h>
20758 #endif
20759 #$i_unistd I_UNISTD
20760 #ifdef I_UNISTD
20761 # include <unistd.h>
20762 #endif
20763 #$d_sysconf HAS_SYSCONF
20764 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20765 #ifdef HAS_STDIO_STREAM_ARRAY
20766 # define STDIO_STREAM_ARRAY $stdio_stream_array
20767 #endif
20768 int main() {
20769   FILE* p;
20770   unlink("try.out");
20771   p = fopen("try.out", "w");
20772 #ifdef TRY_FPUTC
20773   fputc('x', p);
20774 #else
20775 # ifdef TRY_FPRINTF
20776   fprintf(p, "x");
20777 # endif
20778 #endif
20779 #ifdef TRY_FFLUSH_NULL
20780   fflush(NULL);
20781 #endif
20782 #ifdef TRY_FFLUSH_ALL
20783   {
20784     long open_max = -1;
20785 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20786     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20787 # else
20788 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20789     open_max = sysconf(_SC_OPEN_MAX);
20790 #  else
20791 #   ifdef FOPEN_MAX
20792     open_max = FOPEN_MAX;
20793 #   else
20794 #    ifdef OPEN_MAX
20795     open_max = OPEN_MAX;
20796 #    else
20797 #     ifdef _NFILE
20798     open_max = _NFILE;
20799 #     endif
20800 #    endif
20801 #   endif
20802 #  endif
20803 # endif
20804 # ifdef HAS_STDIO_STREAM_ARRAY
20805     if (open_max > 0) {
20806       long i;
20807       for (i = 0; i < open_max; i++)
20808             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20809                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20810                 STDIO_STREAM_ARRAY[i]._flag)
20811                 fflush(&STDIO_STREAM_ARRAY[i]);
20812     }
20813   }
20814 # endif
20815 #endif
20816   _exit(42);
20817 }
20818 EOCP
20819 : first we have to find out how _not_ to flush
20820 $to try.c
20821 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20822     output=''
20823     set try -DTRY_FPUTC
20824     if eval $compile; then
20825             $run ./try 2>/dev/null
20826             code="$?"
20827             $from try.out
20828             if $test ! -s try.out -a "X$code" = X42; then
20829                 output=-DTRY_FPUTC
20830             fi
20831     fi
20832     case "$output" in
20833     '')
20834             set try -DTRY_FPRINTF
20835             if eval $compile; then
20836                     $run ./try 2>/dev/null
20837                     code="$?"
20838                     $from try.out
20839                     if $test ! -s try.out -a "X$code" = X42; then
20840                         output=-DTRY_FPRINTF
20841                     fi
20842             fi
20843         ;;
20844     esac
20845 fi
20846 : check for fflush NULL behavior
20847 case "$fflushNULL" in
20848 '')     set try -DTRY_FFLUSH_NULL $output
20849         if eval $compile; then
20850                 $run ./try 2>/dev/null
20851                 code="$?"
20852                 $from try.out
20853                 if $test -s try.out -a "X$code" = X42; then
20854                         fflushNULL="`$cat try.out`"
20855                 else
20856                         if $test "X$code" != X42; then
20857                                 $cat >&4 <<EOM
20858 (If this test failed, don't worry, we'll try another method shortly.)
20859 EOM
20860                         fi
20861                 fi
20862         fi
20863         $rm -f core try.core core.try.*
20864         case "$fflushNULL" in
20865         x)      $cat >&4 <<EOM
20866 Your fflush(NULL) works okay for output streams.
20867 Let's see if it clobbers input pipes...
20868 EOM
20869 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20870 # bug that improperly flushes the input end of pipes.  So we avoid the
20871 # autoflush on fork/system/exec support for now. :-(
20872 $cat >tryp.c <<EOCP
20873 #include <stdio.h>
20874 int
20875 main(int argc, char **argv)
20876 {
20877     char buf[1024];
20878     int i;
20879     char *bp = buf;
20880     while (1) {
20881         while ((i = getc(stdin)) != -1
20882                && (*bp++ = i) != '\n'
20883                && bp < &buf[1024])
20884         /* DO NOTHING */ ;
20885         *bp = '\0';
20886         fprintf(stdout, "%s", buf);
20887         fflush(NULL);
20888         if (i == -1)
20889             return 0;
20890         bp = buf;
20891     }
20892 }
20893 EOCP
20894                 fflushNULL="$define"
20895                 set tryp
20896                 if eval $compile; then
20897                     $rm -f tryp.out
20898                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20899                     if $test "X$targethost" != X; then
20900                         $to tryp.c
20901                         $to tryp
20902                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20903                     else
20904                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20905                     fi
20906                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20907                        $cat >&4 <<EOM
20908 fflush(NULL) seems to behave okay with input streams.
20909 EOM
20910                         fflushNULL="$define"
20911                     else
20912                         $cat >&4 <<EOM
20913 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20914 EOM
20915                         fflushNULL="$undef"
20916                     fi
20917                 fi
20918                 $rm -f core tryp.c tryp.core core.tryp.*
20919                 ;;
20920         '')     $cat >&4 <<EOM
20921 Your fflush(NULL) isn't working (contrary to ANSI C).
20922 EOM
20923                 fflushNULL="$undef"
20924                 ;;
20925         *)      $cat >&4 <<EOM
20926 Cannot figure out whether your fflush(NULL) works or not.
20927 I'm assuming it doesn't (contrary to ANSI C).
20928 EOM
20929                 fflushNULL="$undef"
20930                 ;;
20931         esac
20932         ;;
20933 $define|true|[yY]*)
20934         fflushNULL="$define"
20935         ;;
20936 *)
20937         fflushNULL="$undef"
20938         ;;
20939 esac
20940 : check explicit looping only if NULL did not work, and if the pipe
20941 : bug does not show up on an explicit flush too
20942 case "$fflushNULL" in
20943 "$undef")
20944         $cat >tryp.c <<EOCP
20945 #include <stdio.h>
20946 int
20947 main(int argc, char **argv)
20948 {
20949     char buf[1024];
20950     int i;
20951     char *bp = buf;
20952     while (1) {
20953         while ((i = getc(stdin)) != -1
20954                && (*bp++ = i) != '\n'
20955                && bp < &buf[1024])
20956         /* DO NOTHING */ ;
20957         *bp = '\0';
20958         fprintf(stdout, "%s", buf);
20959         fflush(stdin);
20960         if (i == -1)
20961             return 0;
20962         bp = buf;
20963     }
20964 }
20965 EOCP
20966         set tryp
20967         if eval $compile; then
20968             $rm -f tryp.out
20969             if $test "X$targethost" != X; then
20970                 $to tryp.c
20971                 $to tryp
20972                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20973             else
20974                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20975             fi
20976             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20977                $cat >&4 <<EOM
20978 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20979 EOM
20980                 : now check for fflushall behaviour
20981                 case "$fflushall" in
20982                 '')     set try -DTRY_FFLUSH_ALL $output
20983                         if eval $compile; then
20984                                 $cat >&4 <<EOM
20985 (Now testing the other method--but note that this also may fail.)
20986 EOM
20987                                 $run ./try 2>/dev/null
20988                                 code=$?
20989                                 $from try.out
20990                                 if $test -s try.out -a "X$code" = X42; then
20991                                         fflushall="`$cat try.out`"
20992                                 fi
20993                         fi
20994                         $rm_try
20995                         case "$fflushall" in
20996                         x)      $cat >&4 <<EOM
20997 Whew. Flushing explicitly all the stdio streams works.
20998 EOM
20999                                 fflushall="$define"
21000                                 ;;
21001                         '')     $cat >&4 <<EOM
21002 Sigh. Flushing explicitly all the stdio streams doesn't work.
21003 EOM
21004                                 fflushall="$undef"
21005                                 ;;
21006                         *)      $cat >&4 <<EOM
21007 Cannot figure out whether flushing stdio streams explicitly works or not.
21008 I'm assuming it doesn't.
21009 EOM
21010                                 fflushall="$undef"
21011                                 ;;
21012                         esac
21013                         ;;
21014                 "$define"|true|[yY]*)
21015                         fflushall="$define"
21016                         ;;
21017                 *)
21018                         fflushall="$undef"
21019                         ;;
21020                 esac
21021             else
21022                 $cat >&4 <<EOM
21023 All is futile.  Even fflush(stdin) clobbers input pipes!
21024 EOM
21025                 fflushall="$undef"
21026             fi
21027         else
21028             fflushall="$undef"
21029         fi
21030         $rm -f core tryp.c tryp.core core.tryp.*
21031         ;;
21032 *)      fflushall="$undef"
21033         ;;
21034 esac
21035
21036 case "$fflushNULL$fflushall" in
21037 undefundef)
21038         $cat <<EOM
21039 OK, I give up.  I cannot figure out how to flush pending stdio output.
21040 We won't be flushing handles at all before fork/exec/popen.
21041 EOM
21042         ;;
21043 esac
21044 $rm_try tryp
21045
21046 : Store the full pathname to the ar program for use in the C program
21047 : Respect a hint or command line value for full_ar.
21048 case "$full_ar" in
21049 '') full_ar=$ar ;;
21050 esac
21051
21052 : Store the full pathname to the sed program for use in the C program
21053 full_sed=$sed
21054
21055 : see what type gids are declared as in the kernel
21056 echo " "
21057 echo "Looking for the type for group ids returned by getgid()."
21058 set gid_t gidtype xxx stdio.h sys/types.h
21059 eval $typedef
21060 case "$gidtype" in
21061 xxx)
21062         xxx=`./findhdr sys/user.h`
21063         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21064         case $1 in
21065         unsigned) dflt="$1 $2" ;;
21066         *) dflt="$1" ;;
21067         esac
21068         ;;
21069 *) dflt="$gidtype";;
21070 esac
21071 case "$gidtype" in
21072 gid_t) echo "gid_t found." ;;
21073 *)      rp="What is the type for group ids returned by getgid()?"
21074         . ./myread
21075         gidtype="$ans"
21076         ;;
21077 esac
21078
21079 : Check the size of GID
21080 echo " "
21081 case "$gidtype" in
21082 *_t) zzz="$gidtype"     ;;
21083 *)   zzz="gid"          ;;
21084 esac
21085 echo "Checking the size of $zzz..." >&4
21086 cat > try.c <<EOCP
21087 #include <sys/types.h>
21088 #include <stdio.h>
21089 #$i_stdlib I_STDLIB
21090 #ifdef I_STDLIB
21091 #include <stdlib.h>
21092 #endif
21093 int main() {
21094     printf("%d\n", (int)sizeof($gidtype));
21095     exit(0);
21096 }
21097 EOCP
21098 set try
21099 if eval $compile_ok; then
21100         yyy=`$run ./try`
21101         case "$yyy" in
21102         '')     gidsize=4
21103                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21104                 ;;
21105         *)      gidsize=$yyy
21106                 echo "Your $zzz is $gidsize bytes long."
21107                 ;;
21108         esac
21109 else
21110         gidsize=4
21111         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21112 fi
21113
21114
21115 : Check if GID is signed
21116 echo " "
21117 case "$gidtype" in
21118 *_t) zzz="$gidtype"     ;;
21119 *)   zzz="gid"          ;;
21120 esac
21121 echo "Checking the sign of $zzz..." >&4
21122 cat > try.c <<EOCP
21123 #include <sys/types.h>
21124 #include <stdio.h>
21125 int main() {
21126         $gidtype foo = -1;
21127         if (foo < 0)
21128                 printf("-1\n");
21129         else
21130                 printf("1\n");
21131 }
21132 EOCP
21133 set try
21134 if eval $compile; then
21135         yyy=`$run ./try`
21136         case "$yyy" in
21137         '')     gidsign=1
21138                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21139                 ;;
21140         *)      gidsign=$yyy
21141                 case "$gidsign" in
21142                  1) echo "Your $zzz is unsigned." ;;
21143                 -1) echo "Your $zzz is signed."   ;;
21144                 esac
21145                 ;;
21146         esac
21147 else
21148         gidsign=1
21149         echo "(I can't compile the test program--guessing unsigned.)" >&4
21150 fi
21151
21152
21153 : Check 64bit sizes
21154 echo " "
21155
21156 if $test X"$quadtype" != X; then
21157
21158 echo "Checking how to print 64-bit integers..." >&4
21159
21160 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21161         $cat >try.c <<'EOCP'
21162 #include <sys/types.h>
21163 #include <stdio.h>
21164 int main() {
21165   int q = 12345678901;
21166   printf("%ld\n", q);
21167 }
21168 EOCP
21169         set try
21170         if eval $compile; then
21171                 yyy=`$run ./try`
21172                 case "$yyy" in
21173                 12345678901)
21174                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21175                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21176                         echo "We will use %d."
21177                         ;;
21178                 esac
21179         fi
21180 fi
21181
21182 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21183         $cat >try.c <<'EOCP'
21184 #include <sys/types.h>
21185 #include <stdio.h>
21186 int main() {
21187   long q = 12345678901;
21188   printf("%ld\n", q);
21189 }
21190 EOCP
21191         set try
21192         if eval $compile; then
21193                 yyy=`$run ./try`
21194                 case "$yyy" in
21195                 12345678901)
21196                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21197                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21198                         echo "We will use %ld."
21199                         ;;
21200                 esac
21201         fi
21202 fi
21203
21204 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21205         $cat >try.c <<'EOCP'
21206 #include <sys/types.h>
21207 #include <inttypes.h>
21208 #include <stdio.h>
21209 int main() {
21210   int64_t q = 12345678901;
21211   printf("%" PRId64 "\n", q);
21212 }
21213 EOCP
21214         set try
21215         if eval $compile; then
21216                 yyy=`$run ./try`
21217                 case "$yyy" in
21218                 12345678901)
21219                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21220                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21221                         echo "We will use the C9X style."
21222                         ;;
21223                 esac
21224         fi
21225 fi
21226
21227 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21228         $cat >try.c <<EOCP
21229 #include <sys/types.h>
21230 #include <stdio.h>
21231 int main() {
21232   $quadtype q = 12345678901;
21233   printf("%Ld\n", q);
21234 }
21235 EOCP
21236         set try
21237         if eval $compile; then
21238                 yyy=`$run ./try`
21239                 case "$yyy" in
21240                 12345678901)
21241                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21242                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21243                         echo "We will use %Ld."
21244                         ;;
21245                 esac
21246         fi
21247 fi
21248
21249 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21250         $cat >try.c <<'EOCP'
21251 #include <sys/types.h>
21252 #include <stdio.h>
21253 int main() {
21254   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21255   printf("%lld\n", q);
21256 }
21257 EOCP
21258         set try
21259         if eval $compile; then
21260                 yyy=`$run ./try`
21261                 case "$yyy" in
21262                 12345678901)
21263                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21264                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21265                         echo "We will use the %lld style."
21266                         ;;
21267                 esac
21268         fi
21269 fi
21270
21271 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21272         $cat >try.c <<EOCP
21273 #include <sys/types.h>
21274 #include <stdio.h>
21275 int main() {
21276   $quadtype q = 12345678901;
21277   printf("%qd\n", q);
21278 }
21279 EOCP
21280         set try
21281         if eval $compile; then
21282                 yyy=`$run ./try`
21283                 case "$yyy" in
21284                 12345678901)
21285                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21286                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21287                         echo "We will use %qd."
21288                         ;;
21289                 esac
21290         fi
21291 fi
21292
21293 if $test X"$sPRId64" = X; then
21294         echo "Cannot figure out how to print 64-bit integers." >&4
21295 fi
21296 $rm_try
21297
21298 fi
21299
21300 case "$sPRId64" in
21301 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21302         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21303         ;;
21304 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21305         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21306         ;;
21307 esac
21308
21309 : Check format strings for internal types
21310 echo " "
21311 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21312
21313 if $test X"$ivsize" = X8; then
21314         ivdformat="$sPRId64"
21315         uvuformat="$sPRIu64"
21316         uvoformat="$sPRIo64"
21317         uvxformat="$sPRIx64"
21318         uvXUformat="$sPRIXU64"
21319 else
21320         if $test X"$ivsize" = X"$longsize"; then
21321                 ivdformat='"ld"'
21322                 uvuformat='"lu"'
21323                 uvoformat='"lo"'
21324                 uvxformat='"lx"'
21325                 uvXUformat='"lX"'
21326         else
21327                 if $test X"$ivsize" = X"$intsize"; then
21328                         ivdformat='"d"'
21329                         uvuformat='"u"'
21330                         uvoformat='"o"'
21331                         uvxformat='"x"'
21332                         uvXUformat='"X"'
21333                 else
21334                         : far out
21335                         if $test X"$ivsize" = X"$shortsize"; then
21336                                 ivdformat='"hd"'
21337                                 uvuformat='"hu"'
21338                                 uvoformat='"ho"'
21339                                 uvxformat='"hx"'
21340                                 uvXUformat='"hX"'
21341                         fi
21342                 fi
21343         fi
21344 fi
21345
21346 if $test X"$usequadmath" = X"$define"; then
21347     nveformat='"Qe"'
21348     nvfformat='"Qf"'
21349     nvgformat='"Qg"'
21350     nvEUformat='"QE"'
21351     nvFUformat='"QF"'
21352     nvGUformat='"QG"'
21353 else
21354     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21355         nveformat="$sPRIeldbl"
21356         nvfformat="$sPRIfldbl"
21357         nvgformat="$sPRIgldbl"
21358         nvEUformat="$sPRIEUldbl"
21359         nvFUformat="$sPRIFUldbl"
21360         nvGUformat="$sPRIGUldbl"
21361     else
21362         nveformat='"e"'
21363         nvfformat='"f"'
21364         nvgformat='"g"'
21365         nvEUformat='"E"'
21366         nvFUformat='"F"'
21367         nvGUformat='"G"'
21368     fi
21369 fi
21370
21371 case "$ivdformat" in
21372 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21373     exit 1
21374     ;;
21375 esac
21376
21377 : Check format string for GID
21378
21379 echo " "
21380 $echo "Checking the format string to be used for gids..." >&4
21381
21382 case "$gidsign" in
21383 -1)     if $test X"$gidsize" = X"$ivsize"; then
21384                 gidformat="$ivdformat"
21385         else
21386                 if $test X"$gidsize" = X"$longsize"; then
21387                         gidformat='"ld"'
21388                 else
21389                         if $test X"$gidsize" = X"$intsize"; then
21390                                 gidformat='"d"'
21391                         else
21392                                 if $test X"$gidsize" = X"$shortsize"; then
21393                                         gidformat='"hd"'
21394                                 fi
21395                         fi
21396                 fi
21397         fi
21398         ;;
21399 *)      if $test X"$gidsize" = X"$uvsize"; then
21400                 gidformat="$uvuformat"
21401         else
21402                 if $test X"$gidsize" = X"$longsize"; then
21403                         gidformat='"lu"'
21404                 else
21405                         if $test X"$gidsize" = X"$intsize"; then
21406                                 gidformat='"u"'
21407                         else
21408                                 if $test X"$gidsize" = X"$shortsize"; then
21409                                         gidformat='"hu"'
21410                                 fi
21411                         fi
21412                 fi
21413         fi
21414         ;;
21415 esac
21416
21417 : see if getgroups exists
21418 set getgroups d_getgrps
21419 eval $inlibc
21420
21421 : see if setgroups exists
21422 set setgroups d_setgrps
21423 eval $inlibc
21424
21425 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21426 echo " "
21427 case "$d_getgrps$d_setgrps" in
21428 *define*)
21429         case "$groupstype" in
21430         '') dflt="$gidtype" ;;
21431         *)  dflt="$groupstype" ;;
21432         esac
21433         $cat <<EOM
21434 What type of pointer is the second argument to getgroups() and setgroups()?
21435 Usually this is the same as group ids, $gidtype, but not always.
21436
21437 EOM
21438         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21439         . ./myread
21440         groupstype="$ans"
21441         ;;
21442 *)  groupstype="$gidtype";;
21443 esac
21444
21445 : check whether make sets MAKE
21446 echo " "
21447 echo "Checking if your $make program sets \$(MAKE)..." >&4
21448 case "$make_set_make" in
21449 '')
21450         $sed 's/^X //' > testmake.mak << 'EOF'
21451 Xall:
21452 X       @echo 'maketemp="$(MAKE)"'
21453 EOF
21454         case "`$make -f testmake.mak 2>/dev/null`" in
21455         *maketemp=*) make_set_make='#' ;;
21456         *)      make_set_make="MAKE=$make" ;;
21457         esac
21458         $rm -f testmake.mak
21459         ;;
21460 esac
21461 case "$make_set_make" in
21462 '#') echo "Yup, it does.";;
21463 *) echo "Nope, it doesn't.";;
21464 esac
21465
21466 : see what type is used for mode_t
21467 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21468 set mode_t modetype int stdio.h sys/types.h
21469 eval $typedef_ask
21470
21471 : see if we need va_copy
21472 echo " "
21473 case "$i_stdarg" in
21474 "$define")
21475         $cat >try.c <<EOCP
21476 #include <stdarg.h>
21477 #include <stdio.h>
21478 #$i_stdlib I_STDLIB
21479 #ifdef I_STDLIB
21480 #include <stdlib.h>
21481 #endif
21482 #include <signal.h>
21483
21484 int
21485 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21486 {
21487   return vfprintf(f, fmt, *valp);
21488 }
21489
21490 int
21491 myvfprintf(FILE *f, const  char *fmt, va_list val)
21492 {
21493   return ivfprintf(f, fmt, &val);
21494 }
21495
21496 int
21497 myprintf(char *fmt, ...)
21498 {
21499   va_list val;
21500   va_start(val, fmt);
21501   return myvfprintf(stdout, fmt, val);
21502 }
21503
21504 int
21505 main(int ac, char **av)
21506 {
21507   signal(SIGSEGV, exit);
21508
21509   myprintf("%s%cs all right, then\n", "that", '\'');
21510   exit(0);
21511 }
21512 EOCP
21513         set try
21514         if eval $compile && $run ./try 2>&1 >/dev/null; then
21515                 case "`$run ./try`" in
21516                 "that's all right, then")
21517                         okay=yes
21518                         ;;
21519                 esac
21520         fi
21521         case "$okay" in
21522         yes)    echo "It seems that you don't need va_copy()." >&4
21523                 need_va_copy="$undef"
21524                 ;;
21525         *)      echo "It seems that va_copy() or similar will be needed." >&4
21526                 need_va_copy="$define"
21527                 ;;
21528         esac
21529         $rm_try
21530         ;;
21531 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21532         need_va_copy="$undef"
21533         ;;
21534 esac
21535
21536 : see what type is used for size_t
21537 rp="What is the type used for the length parameter for string functions?"
21538 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21539 eval $typedef_ask
21540
21541 : check for type of arguments to gethostbyaddr.
21542 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21543         case "$d_gethbyaddr" in
21544         $define)
21545                 $cat <<EOM
21546
21547 Checking to see what type of arguments are accepted by gethostbyaddr().
21548 EOM
21549                 hdrs="$define sys/types.h
21550                         $d_socket sys/socket.h
21551                         $i_niin netinet/in.h
21552                         $i_netdb netdb.h
21553                         $i_unistd unistd.h"
21554                 : The first arg can 'char *' or 'void *'
21555                 : The second arg is some of integral type
21556                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21557                         for yyy in size_t long int; do
21558                                 case "$netdb_host_type" in
21559                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21560                                         if ./protochk "$try" $hdrs; then
21561                                                 echo "Your system accepts $xxx for the first arg."
21562                                                 echo "...and $yyy for the second arg."
21563                                                 netdb_host_type="$xxx"
21564                                                 netdb_hlen_type="$yyy"
21565                                         fi
21566                                         ;;
21567                                 esac
21568                         done
21569                 done
21570                 : In case none of those worked, prompt the user.
21571                 case "$netdb_host_type" in
21572                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21573                         dflt='char *'
21574                         . ./myread
21575                         netdb_host_type=$ans
21576                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21577                         dflt="$sizetype"
21578                         . ./myread
21579                         netdb_hlen_type=$ans
21580                         ;;
21581                 esac
21582                 ;;
21583         *)      : no gethostbyaddr, so pick harmless defaults
21584                 netdb_host_type='char *'
21585                 netdb_hlen_type="$sizetype"
21586                 ;;
21587         esac
21588         # Remove the "const" if needed. -- but then we'll have a
21589         # prototype clash!
21590         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21591 fi
21592
21593 : check for type of argument to gethostbyname.
21594 if test "X$netdb_name_type" = X ; then
21595         case "$d_gethbyname" in
21596         $define)
21597                 $cat <<EOM
21598
21599 Checking to see what type of argument is accepted by gethostbyname().
21600 EOM
21601                 hdrs="$define sys/types.h
21602                         $d_socket sys/socket.h
21603                         $i_niin netinet/in.h
21604                         $i_netdb netdb.h
21605                         $i_unistd unistd.h"
21606                 for xxx in "const char *" "char *"; do
21607                         case "$netdb_name_type" in
21608                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21609                                 if ./protochk "$try" $hdrs; then
21610                                         echo "Your system accepts $xxx."
21611                                         netdb_name_type="$xxx"
21612                                 fi
21613                                 ;;
21614                         esac
21615                 done
21616                 : In case none of those worked, prompt the user.
21617                 case "$netdb_name_type" in
21618                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21619                         dflt='char *'
21620                         . ./myread
21621                         netdb_name_type=$ans
21622                         ;;
21623                 esac
21624                 ;;
21625         *)      : no gethostbyname, so pick harmless default
21626                 netdb_name_type='char *'
21627                 ;;
21628         esac
21629 fi
21630
21631 : check for type of 1st argument to getnetbyaddr.
21632 if test "X$netdb_net_type" = X ; then
21633         case "$d_getnbyaddr" in
21634         $define)
21635                 $cat <<EOM
21636
21637 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21638 EOM
21639                 hdrs="$define sys/types.h
21640                         $d_socket sys/socket.h
21641                         $i_niin netinet/in.h
21642                         $i_netdb netdb.h
21643                         $i_unistd unistd.h"
21644                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21645                         case "$netdb_net_type" in
21646                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21647                                 if ./protochk "$try" $hdrs; then
21648                                         echo "Your system accepts $xxx."
21649                                         netdb_net_type="$xxx"
21650                                 fi
21651                                 ;;
21652                         esac
21653                 done
21654                 : In case none of those worked, prompt the user.
21655                 case "$netdb_net_type" in
21656                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21657                         dflt='long'
21658                         . ./myread
21659                         netdb_net_type=$ans
21660                         ;;
21661                 esac
21662                 ;;
21663         *)      : no getnetbyaddr, so pick harmless default
21664                 netdb_net_type='long'
21665                 ;;
21666         esac
21667 fi
21668 : locate the preferred pager for this system
21669 fn=f/
21670 case "$pager" in
21671 '')
21672         dflt=''
21673         case "$pg" in
21674         /*) dflt=$pg;;
21675         [a-zA-Z]:/*) dflt=$pg;;
21676         esac
21677         case "$more" in
21678         /*) dflt=$more;;
21679         [a-zA-Z]:/*) dflt=$more;;
21680         esac
21681         case "$less" in
21682         /*) dflt=$less;;
21683         [a-zA-Z]:/*) dflt=$less;;
21684         esac
21685         case "$dflt" in
21686         '') dflt=/usr/ucb/more;;
21687         esac
21688         ;;
21689 *)      dflt="$pager"
21690         ;;
21691 esac
21692 fn="f/($dflt)"
21693 echo " "
21694 rp='What pager is used on your system?'
21695 . ./getfile
21696 pager="$ans"
21697
21698 : see what type pids are declared as in the kernel
21699 rp="What is the type of process ids on this system?"
21700 set pid_t pidtype int stdio.h sys/types.h
21701 eval $typedef_ask
21702
21703 : see if ar generates random libraries by itself
21704 echo " "
21705 echo "Checking how to generate random libraries on your machine..." >&4
21706 echo 'int bar1() { return bar2(); }' > bar1.c
21707 echo 'int bar2() { return 2; }' > bar2.c
21708 $cat > foo.c <<EOP
21709 #$i_stdlib I_STDLIB
21710 #ifdef I_STDLIB
21711 #include <stdlib.h>
21712 #endif
21713 int main() { printf("%d\n", bar1()); exit(0); }
21714 EOP
21715 $cc $ccflags -c bar1.c >/dev/null 2>&1
21716 $cc $ccflags -c bar2.c >/dev/null 2>&1
21717 $cc $ccflags -c foo.c >/dev/null 2>&1
21718 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21719 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21720         $run ./foobar >/dev/null 2>&1; then
21721         echo "$ar appears to generate random libraries itself."
21722         orderlib=false
21723         if [ "X$ranlib" = "X" ]; then
21724             ranlib=":"
21725         fi
21726 elif $ar s bar$_a >/dev/null 2>&1 &&
21727         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21728         $run ./foobar >/dev/null 2>&1; then
21729                 echo "a table of contents needs to be added with '$ar s'."
21730                 orderlib=false
21731                 ranlib="$ar s"
21732 elif $ar ts bar$_a >/dev/null 2>&1 &&
21733         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21734         $run ./foobar >/dev/null 2>&1; then
21735                 echo "a table of contents needs to be added with '$ar ts'."
21736                 orderlib=false
21737                 ranlib="$ar ts"
21738 else
21739         case "$ranlib" in
21740         :) ranlib='';;
21741         '')
21742                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21743                 $test -f $ranlib || ranlib=''
21744                 ;;
21745         esac
21746         if $test -n "$ranlib"; then
21747                 echo "your system has '$ranlib'; we'll use that."
21748                 orderlib=false
21749         else
21750                 echo "your system doesn't seem to support random libraries"
21751                 echo "so we'll use lorder and tsort to order the libraries."
21752                 orderlib=true
21753                 ranlib=":"
21754         fi
21755 fi
21756 $rm -f foo* bar*
21757
21758 : see if this is a values.h system
21759 set values.h i_values
21760 eval $inhdr
21761
21762 : Check the max offset that gmtime and localtime accept
21763 echo "Checking max offsets that gmtime () accepts"
21764
21765 case $i_values in
21766     define) yyy="#include <values.h>" ;;
21767     *)      yyy="" ;;
21768     esac
21769
21770 case "$sGMTIME_min/$sGMTIME_max" in
21771     0/0|/)
21772         $cat >try.c <<EOCP
21773 #include <sys/types.h>
21774 #include <stdio.h>
21775 #include <time.h>
21776 $yyy
21777
21778 int i;
21779 struct tm *tmp;
21780 time_t pt;
21781
21782 void gm_check (time_t t, int min_year, int max_year)
21783 {
21784     tmp = gmtime (&t);
21785     if ( tmp == NULL ||
21786         /* Check tm_year overflow */
21787          tmp->tm_year < min_year || tmp->tm_year > max_year)
21788         tmp = NULL;
21789     else
21790         pt = t;
21791     } /* gm_check */
21792
21793 int check_max ()
21794 {
21795     tmp = NULL;
21796     pt  = 0;
21797 #ifdef MAXLONG
21798     gm_check (MAXLONG, 69, 0x7fffffff);
21799 #endif
21800     if (tmp == NULL || tmp->tm_year < 0) {
21801         for (i = 63; i >= 0; i--) {
21802             time_t x = pt | ((time_t)1 << i);
21803             if (x < 0 || x < pt) continue;
21804             gm_check (x, 69, 0x7fffffff);
21805             }
21806         }
21807     printf ("sGMTIME_max=%ld\n", pt);
21808     return (0);
21809     } /* check_max */
21810
21811 int check_min ()
21812 {
21813     tmp = NULL;
21814     pt  = 0;
21815 #ifdef MINLONG
21816     gm_check (MINLONG, -1900, 70);
21817 #endif
21818     if (tmp == NULL) {
21819         for (i = 36; i >= 0; i--) {
21820             time_t x = pt - ((time_t)1 << i);
21821             if (x > 0) continue;
21822             gm_check (x, -1900, 70);
21823             }
21824         }
21825     printf ("sGMTIME_min=%ld\n", pt);
21826     return (0);
21827     } /* check_min */
21828
21829 int main (int argc, char *argv[])
21830 {
21831     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21832     check_max ();
21833     check_min ();
21834     return (0);
21835     } /* main */
21836 EOCP
21837         set try
21838         if eval $compile; then
21839             eval `$run ./try 2>/dev/null`
21840         else
21841             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21842             fi
21843         $rm_try
21844         ;;
21845     esac
21846
21847 echo "Checking max offsets that localtime () accepts"
21848
21849 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21850     0/0|/)
21851         $cat >try.c <<EOCP
21852 #include <sys/types.h>
21853 #include <stdio.h>
21854 #include <time.h>
21855 $yyy
21856
21857 int i;
21858 struct tm *tmp;
21859 time_t pt;
21860
21861 void local_check (time_t t, int min_year, int max_year)
21862 {
21863     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21864         tmp = NULL;
21865     else
21866         tmp = localtime (&t);
21867     if ( tmp == NULL ||
21868         /* Check tm_year overflow */
21869          tmp->tm_year < min_year || tmp->tm_year > max_year)
21870         tmp = NULL;
21871     else
21872         pt = t;
21873     } /* local_check */
21874
21875 int check_max ()
21876 {
21877     tmp = NULL;
21878     pt  = 0;
21879 #ifdef MAXLONG
21880     local_check (MAXLONG, 69, 0x7fffffff);
21881 #endif
21882     if (tmp == NULL || tmp->tm_year < 0) {
21883         for (i = 63; i >= 0; i--) {
21884             time_t x = pt | ((time_t)1 << i);
21885             if (x < 0 || x < pt) continue;
21886             local_check (x, 69, 0x7fffffff);
21887             }
21888         }
21889     printf ("sLOCALTIME_max=%ld\n", pt);
21890     return (0);
21891    } /* check_max */
21892
21893 int check_min ()
21894 {
21895     tmp = NULL;
21896     pt  = 0;
21897 #ifdef MINLONG
21898     local_check (MINLONG, -1900, 70);
21899 #endif
21900     if (tmp == NULL) {
21901         for (i = 36; i >= 0; i--) {
21902             time_t x = pt - ((time_t)1 << i);
21903             if (x > 0) continue;
21904             local_check (x, -1900, 70);
21905             }
21906         }
21907     printf ("sLOCALTIME_min=%ld\n", pt);
21908     return (0);
21909     } /* check_min */
21910
21911 int main (int argc, char *argv[])
21912 {
21913     check_max ();
21914     check_min ();
21915     return (0);
21916     } /* main */
21917 EOCP
21918         set try
21919         if eval $compile; then
21920             eval `$run ./try 2>/dev/null`
21921         else
21922             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21923             fi
21924         $rm_try
21925         ;;
21926     esac
21927
21928 : check for type of arguments to select.
21929 case "$selecttype" in
21930 '') case "$d_select" in
21931         $define)
21932                 echo " "
21933                 $cat <<EOM
21934 Checking to see what type of arguments are accepted by select().
21935 EOM
21936                 hdrs="$define sys/types.h
21937                         $i_systime sys/time.h
21938                         $i_sysselct sys/select.h
21939                         $d_socket sys/socket.h"
21940                 : The first arg can be int, unsigned, or size_t
21941                 : The last arg may or may not be 'const'
21942                 val=''
21943                 : void pointer has been seen but using that
21944                 : breaks the selectminbits test
21945                 for xxx in 'fd_set *' 'int *'; do
21946                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21947                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21948                                         case "$val" in
21949                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21950                                                 if ./protochk "$try" $hdrs; then
21951                                                         echo "Your system accepts $xxx."
21952                                                         val="$xxx"
21953                                                 fi
21954                                                 ;;
21955                                         esac
21956                                 done
21957                         done
21958                 done
21959                 case "$val" in
21960                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21961                         case "$d_fd_set" in
21962                                 $define) dflt="fd_set *" ;;
21963                                 *)              dflt="int *" ;;
21964                         esac
21965                         . ./myread
21966                         val=$ans
21967                         ;;
21968                 esac
21969                 selecttype="$val"
21970                 ;;
21971         *)      : no select, so pick a harmless default
21972                 selecttype='int *'
21973                 ;;
21974         esac
21975         ;;
21976 esac
21977
21978 : check for the select 'width'
21979 case "$selectminbits" in
21980 '') safebits=`expr $ptrsize \* 8`
21981     case "$d_select" in
21982         $define)
21983                 $cat <<EOM
21984
21985 Checking to see on how many bits at a time your select() operates...
21986 EOM
21987                 $cat >try.c <<EOCP
21988 #include <sys/types.h>
21989 #$i_time I_TIME
21990 #$i_systime I_SYS_TIME
21991 #$i_systimek I_SYS_TIME_KERNEL
21992 #ifdef I_TIME
21993 #   include <time.h>
21994 #endif
21995 #ifdef I_SYS_TIME
21996 #   ifdef I_SYS_TIME_KERNEL
21997 #       define KERNEL
21998 #   endif
21999 #   include <sys/time.h>
22000 #   ifdef I_SYS_TIME_KERNEL
22001 #       undef KERNEL
22002 #   endif
22003 #endif
22004 #$i_sysselct I_SYS_SELECT
22005 #ifdef I_SYS_SELECT
22006 #include <sys/select.h>
22007 #endif
22008 #$d_socket HAS_SOCKET
22009 #ifdef HAS_SOCKET
22010 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22011 #endif
22012 #include <stdio.h>
22013 #$i_stdlib I_STDLIB
22014 #ifdef I_STDLIB
22015 #include <stdlib.h>
22016 #endif
22017 $selecttype b;
22018 #define S sizeof(*(b))
22019 #define MINBITS 64
22020 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22021 #define NBITS  (NBYTES * 8)
22022 int main() {
22023     char *s = (char *)malloc(NBYTES);
22024     struct timeval t;
22025     int i;
22026     FILE* fp;
22027     int fd;
22028
22029     if (!s)
22030         exit(1);
22031     fclose(stdin);
22032     fp = fopen("try.c", "r");
22033     if (fp == 0)
22034       exit(2);
22035     fd = fileno(fp);
22036     if (fd < 0)
22037       exit(3);
22038     b = ($selecttype)s;
22039     for (i = 0; i < NBITS; i++)
22040         FD_SET(i, b);
22041     t.tv_sec  = 0;
22042     t.tv_usec = 0;
22043     select(fd + 1, b, 0, 0, &t);
22044     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22045     free(s);
22046     printf("%d\n", i + 1);
22047     return 0;
22048 }
22049 EOCP
22050                 set try
22051                 if eval $compile_ok; then
22052                         selectminbits=`$run ./try 2>/dev/null`
22053                         case "$selectminbits" in
22054                         '')     cat >&4 <<EOM
22055 Cannot figure out on how many bits at a time your select() operates.
22056 I'll play safe and guess it is $safebits bits.
22057 EOM
22058                                 selectminbits=$safebits
22059                                 bits="$safebits bits"
22060                                 ;;
22061                         1)      bits="1 bit" ;;
22062                         *)      bits="$selectminbits bits" ;;
22063                         esac
22064                         echo "Your select() operates on $bits at a time." >&4
22065                 else
22066                         rp='What is the minimum number of bits your select() operates on?'
22067                         case "$byteorder" in
22068                         12345678)       dflt=64 ;;
22069                         1234)           dflt=32 ;;
22070                         *)              dflt=1  ;;
22071                         esac
22072                         . ./myread
22073                         val=$ans
22074                         selectminbits="$val"
22075                 fi
22076                 $rm_try
22077                 ;;
22078         *)      : no select, so pick a harmless default
22079                 selectminbits=$safebits
22080                 ;;
22081         esac
22082         ;;
22083 esac
22084
22085 : Trace out the files included by signal.h, then look for SIGxxx names.
22086 case "$sig_num_init" in
22087 '')
22088 if [ "X$fieldn" = X ]; then
22089         : Just make some guesses.  We check them later.
22090         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22091 else
22092         xxx=`echo '#include <signal.h>' |
22093         $cppstdin $cppminus $cppflags 2>/dev/null |
22094         $grep '^[       ]*#.*include' |
22095         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22096                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22097 fi
22098 xxxfiles=''
22099 for xx in $xxx /dev/null ; do
22100         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22101 done
22102 case "$xxxfiles" in
22103 '')     xxxfiles=`./findhdr signal.h` ;;
22104 esac
22105 xxx=`awk '
22106 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22107         print substr($2, 4, 20)
22108 }
22109 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22110         print substr($3, 4, 20)
22111 }' $xxxfiles`
22112 : Append some common names just in case the awk scan failed.
22113 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22114 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22115 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22116 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22117 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22118
22119 : generate a few handy files for later
22120 $cat > signal.c <<EOCP
22121 #include <sys/types.h>
22122 #include <signal.h>
22123 #$i_stdlib I_STDLIB
22124 #ifdef I_STDLIB
22125 #include <stdlib.h>
22126 #endif
22127 #include <stdio.h>
22128 int main() {
22129
22130 /* Strange style to avoid deeply-nested #if/#else/#endif */
22131 #ifndef NSIG
22132 #  ifdef _NSIG
22133 #    define NSIG (_NSIG)
22134 #  endif
22135 #endif
22136
22137 #ifndef NSIG
22138 #  ifdef SIGMAX
22139 #    define NSIG (SIGMAX+1)
22140 #  endif
22141 #endif
22142
22143 #ifndef NSIG
22144 #  ifdef SIG_MAX
22145 #    define NSIG (SIG_MAX+1)
22146 #  endif
22147 #endif
22148
22149 #ifndef NSIG
22150 #  ifdef _SIG_MAX
22151 #    define NSIG (_SIG_MAX+1)
22152 #  endif
22153 #endif
22154
22155 #ifndef NSIG
22156 #  ifdef MAXSIG
22157 #    define NSIG (MAXSIG+1)
22158 #  endif
22159 #endif
22160
22161 #ifndef NSIG
22162 #  ifdef MAX_SIG
22163 #    define NSIG (MAX_SIG+1)
22164 #  endif
22165 #endif
22166
22167 #ifndef NSIG
22168 #  ifdef SIGARRAYSIZE
22169 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22170 #  endif
22171 #endif
22172
22173 #ifndef NSIG
22174 #  ifdef _sys_nsig
22175 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22176 #  endif
22177 #endif
22178
22179 /* Default to some arbitrary number that's big enough to get most
22180    of the common signals.
22181 */
22182 #ifndef NSIG
22183 #    define NSIG 50
22184 #endif
22185
22186 printf("NSIG %d\n", NSIG);
22187
22188 #ifndef JUST_NSIG
22189
22190 EOCP
22191
22192 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22193 {
22194         printf "#ifdef SIG"; printf $1; printf "\n"
22195         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22196         printf $1; printf ");\n"
22197         printf "#endif\n"
22198 }
22199 END {
22200         printf "#endif /* JUST_NSIG */\n";
22201         printf "exit(0);\n}\n";
22202 }
22203 ' >>signal.c
22204 $cat >signal.awk <<'EOP'
22205 BEGIN { ndups = 0 }
22206 $1 ~ /^NSIG$/ { nsig = $2 }
22207 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22208     if ($2 > maxsig) { maxsig = $2 }
22209     if (sig_name[$2]) {
22210         dup_name[ndups] = $1
22211         dup_num[ndups] = $2
22212         ndups++
22213     }
22214     else {
22215         sig_name[$2] = $1
22216         sig_num[$2] = $2
22217     }
22218 }
22219 END {
22220     if (nsig == 0) {
22221         nsig = maxsig + 1
22222     }
22223     printf("NSIG %d\n", nsig);
22224     for (n = 1; n < nsig; n++) {
22225         if (sig_name[n]) {
22226             printf("%s %d\n", sig_name[n], sig_num[n])
22227         }
22228         else {
22229             printf("NUM%d %d\n", n, n)
22230         }
22231     }
22232     for (n = 0; n < ndups; n++) {
22233         printf("%s %d\n", dup_name[n], dup_num[n])
22234     }
22235 }
22236 EOP
22237 $cat >signal_cmd <<EOS
22238 $startsh
22239 if $test -s signal.lst; then
22240     echo "Using your existing signal.lst file"
22241         exit 0
22242 fi
22243 xxx="$xxx"
22244 EOS
22245 $cat >>signal_cmd <<'EOS'
22246
22247 set signal
22248 if eval $compile_ok; then
22249         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22250                 $uniq | $awk -f signal.awk >signal.lst
22251 else
22252         echo "(I can't seem be able to compile the whole test program)" >&4
22253         echo "(I'll try it in little pieces.)" >&4
22254         set signal -DJUST_NSIG
22255         if eval $compile_ok; then
22256                 $run ./signal$_exe > signal.nsg
22257                 $cat signal.nsg
22258         else
22259                 echo "I can't seem to figure out how many signals you have." >&4
22260                 echo "Guessing 50." >&4
22261                 echo 'NSIG 50' > signal.nsg
22262         fi
22263         : Now look at all the signal names, one at a time.
22264         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22265                 $cat > signal.c <<EOCP
22266 #include <sys/types.h>
22267 #include <signal.h>
22268 #include <stdio.h>
22269 int main() {
22270 printf("$xx %d\n", SIG${xx});
22271 return 0;
22272 }
22273 EOCP
22274                 set signal
22275                 if eval $compile; then
22276                         echo "SIG${xx} found."
22277                         $run ./signal$_exe  >> signal.ls1
22278                 else
22279                         echo "SIG${xx} NOT found."
22280                 fi
22281         done
22282         if $test -s signal.ls1; then
22283                 $cat signal.nsg signal.ls1 |
22284                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22285         fi
22286
22287 fi
22288 if $test -s signal.lst; then
22289         :
22290 else
22291         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22292         echo 'kill -l' >signal
22293         set X `csh -f <signal`
22294         $rm -f signal
22295         shift
22296         case $# in
22297         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22298         esac
22299         echo $@ | $tr ' ' $trnl | \
22300             $awk '{ printf "%s %d\n", $1, ++s; }
22301                   END { printf "NSIG %d\n", ++s }' >signal.lst
22302 fi
22303 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22304 EOS
22305 chmod a+x signal_cmd
22306 $eunicefix signal_cmd
22307
22308 : generate list of signal names
22309 echo " "
22310 case "$sig_name_init" in
22311 '') doinit=yes ;;
22312 *)  case "$sig_num_init" in
22313     ''|*,*) doinit=yes ;;
22314     esac ;;
22315 esac
22316 case "$doinit" in
22317 yes)
22318         echo "Generating a list of signal names and numbers..." >&4
22319         . ./signal_cmd
22320         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22321         sig_name=`$awk 'BEGIN { printf "ZERO " }
22322                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22323         sig_num=`$awk  'BEGIN { printf "0 " }
22324                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22325         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22326                              !/^NSIG/   { printf "\"%s\", ", $1 }
22327                              END        { printf "0\n" }' signal.lst`
22328         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22329                              !/^NSIG/   { printf "%d, ", $2}
22330                              END        { printf "0\n"}' signal.lst`
22331         ;;
22332 esac
22333 echo "The following $sig_count signals are available:"
22334 echo " "
22335 echo $sig_name | $awk \
22336 'BEGIN { linelen = 0 }
22337 {
22338         for (i = 1; i <= NF; i++) {
22339                 name = "SIG" $i " "
22340                 linelen = linelen + length(name)
22341                 if (linelen > 70) {
22342                         printf "\n"
22343                         linelen = length(name)
22344                 }
22345                 printf "%s", name
22346         }
22347         printf "\n"
22348 }'
22349 sig_size=`echo $sig_name | awk '{print NF}'`
22350 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22351 ;;
22352 esac
22353
22354 : Check size of size
22355 echo " "
22356 case "$sizetype" in
22357 *_t) zzz="$sizetype"    ;;
22358 *)   zzz="filesize"     ;;
22359 esac
22360 echo "Checking the size of $zzz..." >&4
22361 cat > try.c <<EOCP
22362 #include <sys/types.h>
22363 #include <stdio.h>
22364 #$i_stdlib I_STDLIB
22365 #ifdef I_STDLIB
22366 #include <stdlib.h>
22367 #endif
22368 int main() {
22369     printf("%d\n", (int)sizeof($sizetype));
22370     exit(0);
22371 }
22372 EOCP
22373 set try
22374 if eval $compile_ok; then
22375         yyy=`$run ./try`
22376         case "$yyy" in
22377         '')     sizesize=4
22378                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22379                 ;;
22380         *)      sizesize=$yyy
22381                 echo "Your $zzz size is $sizesize bytes."
22382                 ;;
22383         esac
22384 else
22385         sizesize=4
22386         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22387 fi
22388
22389
22390 : check for socklen_t
22391 echo " "
22392 echo "Checking to see if you have socklen_t..." >&4
22393 $cat >try.c <<EOCP
22394 #include <sys/types.h>
22395 #$d_socket HAS_SOCKET
22396 #ifdef HAS_SOCKET
22397 #include <sys/socket.h>
22398 #endif
22399 int main() { socklen_t x = 16; }
22400 EOCP
22401 set try
22402 if eval $compile; then
22403         val="$define"
22404         echo "You have socklen_t."
22405 else
22406         val="$undef"
22407         echo "You do not have socklen_t."
22408         case "$sizetype" in
22409         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22410         esac
22411 fi
22412 $rm_try
22413 set d_socklen_t
22414 eval $setvar
22415
22416 : see if this is a socks.h system
22417 set socks.h i_socks
22418 eval $inhdr
22419
22420 : check for type of the size argument to socket calls
22421 case "$d_socket" in
22422 "$define")
22423         $cat <<EOM
22424
22425 Checking to see what type is the last argument of accept().
22426 EOM
22427         yyy=''
22428         case "$d_socklen_t" in
22429         "$define") yyy="$yyy socklen_t"
22430         esac
22431         yyy="$yyy $sizetype int long unsigned"
22432         for xxx in $yyy; do
22433                 case "$socksizetype" in
22434                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22435                         case "$usesocks" in
22436                         "$define")
22437                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22438                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22439                                         socksizetype="$xxx"
22440                                 fi
22441                                 ;;
22442                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22443                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22444                                         socksizetype="$xxx"
22445                                 fi
22446                                 ;;
22447                         esac
22448                         ;;
22449                 esac
22450         done
22451 : In case none of those worked, prompt the user.
22452         case "$socksizetype" in
22453         '')     rp='What is the type for socket address structure sizes?'
22454                 dflt='int'
22455                 . ./myread
22456                 socksizetype=$ans
22457                 ;;
22458         esac
22459         ;;
22460 *)      : no sockets, so pick relatively harmless default
22461         socksizetype='int'
22462         ;;
22463 esac
22464
22465 : see what type is used for signed size_t
22466 set ssize_t ssizetype int stdio.h sys/types.h
22467 eval $typedef
22468 dflt="$ssizetype"
22469 $cat > try.c <<EOM
22470 #include <stdio.h>
22471 #$i_stdlib I_STDLIB
22472 #ifdef I_STDLIB
22473 #include <stdlib.h>
22474 #endif
22475 #include <sys/types.h>
22476 #define Size_t $sizetype
22477 #define SSize_t $dflt
22478 int main()
22479 {
22480         if (sizeof(Size_t) == sizeof(SSize_t))
22481                 printf("$dflt\n");
22482         else if (sizeof(Size_t) == sizeof(int))
22483                 printf("int\n");
22484         else
22485                 printf("long\n");
22486         exit(0);
22487 }
22488 EOM
22489 echo " "
22490 set try
22491 if eval $compile_ok && $run ./try > /dev/null; then
22492         ssizetype=`$run ./try`
22493         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22494 else
22495         $cat >&4 <<EOM
22496 Help! I can't compile and run the ssize_t test program: please enlighten me!
22497 (This is probably a misconfiguration in your system or libraries, and
22498 you really ought to fix it.  Still, I'll try anyway.)
22499
22500 I need a type that is the same size as $sizetype, but is guaranteed to
22501 be signed.  Common values are ssize_t, int and long.
22502
22503 EOM
22504         rp="What signed type is the same size as $sizetype?"
22505         . ./myread
22506         ssizetype="$ans"
22507 fi
22508 $rm_try
22509
22510 : Check the size of st_ino
22511 $echo " "
22512 $echo "Checking the size of st_ino..." >&4
22513 $cat > try.c <<EOCP
22514 #include <sys/stat.h>
22515 #include <stdio.h>
22516 #$i_stdlib I_STDLIB
22517 #ifdef I_STDLIB
22518 #include <stdlib.h>
22519 #endif
22520 int main() {
22521     struct stat st;
22522     printf("%d\n", (int)sizeof(st.st_ino));
22523     exit(0);
22524 }
22525 EOCP
22526 set try
22527 if eval $compile_ok; then
22528         val=`$run ./try`
22529         case "$val" in
22530         '')     st_ino_size=4
22531                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22532                 ;;
22533         *)      st_ino_size=$val
22534                 $echo "Your st_ino is $st_ino_size bytes long."
22535                 ;;
22536         esac
22537 else
22538         st_ino_size=4
22539         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22540 fi
22541 $rm_try
22542
22543 : Check if st_ino is signed
22544 $echo " "
22545 $echo "Checking the sign of st_ino..." >&4
22546 $cat > try.c <<EOCP
22547 #include <sys/stat.h>
22548 #include <stdio.h>
22549 int main() {
22550         struct stat foo;
22551         foo.st_ino = -1;
22552         if (foo.st_ino < 0)
22553                 printf("-1\n");
22554         else
22555                 printf("1\n");
22556 }
22557 EOCP
22558 set try
22559 if eval $compile; then
22560         val=`$run ./try`
22561         case "$val" in
22562         '')     st_ino_sign=1
22563                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22564                 ;;
22565         *)      st_ino_sign=$val
22566                 case "$st_ino_sign" in
22567                  1) $echo "Your st_ino is unsigned." ;;
22568                 -1) $echo "Your st_ino is signed."   ;;
22569                 esac
22570                 ;;
22571         esac
22572 else
22573         st_ino_sign=1
22574         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22575 fi
22576 $rm_try
22577
22578 : see what type of char stdio uses.
22579 echo " "
22580 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22581 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22582         echo "Your stdio uses unsigned chars." >&4
22583         stdchar="unsigned char"
22584 else
22585         echo "Your stdio uses signed chars." >&4
22586         stdchar="char"
22587 fi
22588 $rm -f stdioh
22589
22590 : see what type uids are declared as in the kernel
22591 echo " "
22592 echo "Looking for the type for user ids returned by getuid()."
22593 set uid_t uidtype xxx stdio.h sys/types.h
22594 eval $typedef
22595 case "$uidtype" in
22596 xxx)
22597         xxx=`./findhdr sys/user.h`
22598         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22599         case $1 in
22600         unsigned) dflt="$1 $2" ;;
22601         *) dflt="$1" ;;
22602         esac
22603         ;;
22604 *) dflt="$uidtype";;
22605 esac
22606 case "$uidtype" in
22607 uid_t)  echo "uid_t found." ;;
22608 *)      rp="What is the type for user ids returned by getuid()?"
22609         . ./myread
22610         uidtype="$ans"
22611         ;;
22612 esac
22613
22614 : Check size of UID
22615 echo " "
22616 case "$uidtype" in
22617 *_t) zzz="$uidtype"     ;;
22618 *)   zzz="uid"          ;;
22619 esac
22620 echo "Checking the size of $zzz..." >&4
22621 cat > try.c <<EOCP
22622 #include <sys/types.h>
22623 #include <stdio.h>
22624 #$i_stdlib I_STDLIB
22625 #ifdef I_STDLIB
22626 #include <stdlib.h>
22627 #endif
22628 int main() {
22629     printf("%d\n", (int)sizeof($uidtype));
22630     exit(0);
22631 }
22632 EOCP
22633 set try
22634 if eval $compile_ok; then
22635         yyy=`$run ./try`
22636         case "$yyy" in
22637         '')     uidsize=4
22638                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22639                 ;;
22640         *)      uidsize=$yyy
22641                 echo "Your $zzz is $uidsize bytes long."
22642                 ;;
22643         esac
22644 else
22645         uidsize=4
22646         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22647 fi
22648
22649 : Check if UID is signed
22650 echo " "
22651 case "$uidtype" in
22652 *_t) zzz="$uidtype"     ;;
22653 *)   zzz="uid"          ;;
22654 esac
22655 echo "Checking the sign of $zzz..." >&4
22656 cat > try.c <<EOCP
22657 #include <sys/types.h>
22658 #include <stdio.h>
22659 int main() {
22660         $uidtype foo = -1;
22661         if (foo < 0)
22662                 printf("-1\n");
22663         else
22664                 printf("1\n");
22665 }
22666 EOCP
22667 set try
22668 if eval $compile; then
22669         yyy=`$run ./try`
22670         case "$yyy" in
22671         '')     uidsign=1
22672                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22673                 ;;
22674         *)      uidsign=$yyy
22675                 case "$uidsign" in
22676                  1) echo "Your $zzz is unsigned." ;;
22677                 -1) echo "Your $zzz is signed."   ;;
22678                 esac
22679                 ;;
22680         esac
22681 else
22682         uidsign=1
22683         echo "(I can't compile the test program--guessing unsigned.)" >&4
22684 fi
22685
22686
22687 : Check format string for UID
22688 echo " "
22689 $echo "Checking the format string to be used for uids..." >&4
22690
22691 case "$uidsign" in
22692 -1)     if $test X"$uidsize" = X"$ivsize"; then
22693                 uidformat="$ivdformat"
22694         else
22695                 if $test X"$uidsize" = X"$longsize"; then
22696                         uidformat='"ld"'
22697                 else
22698                         if $test X"$uidsize" = X"$intsize"; then
22699                                 uidformat='"d"'
22700                         else
22701                                 if $test X"$uidsize" = X"$shortsize"; then
22702                                         uidformat='"hd"'
22703                                 fi
22704                         fi
22705                 fi
22706         fi
22707         ;;
22708 *)      if $test X"$uidsize" = X"$uvsize"; then
22709                 uidformat="$uvuformat"
22710         else
22711                 if $test X"$uidsize" = X"$longsize"; then
22712                         uidformat='"lu"'
22713                 else
22714                         if $test X"$uidsize" = X"$intsize"; then
22715                                 uidformat='"u"'
22716                         else
22717                                 if $test X"$uidsize" = X"$shortsize"; then
22718                                         uidformat='"hu"'
22719                                 fi
22720                         fi
22721                 fi
22722         fi
22723         ;;
22724 esac
22725
22726 : see what siginfo fields we have
22727 case "$d_sigaction" in
22728 "$define")
22729         echo "Checking if your siginfo_t has si_errno field...">&4
22730         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
22731         eval $hasfield_t;
22732
22733         echo "Checking if your siginfo_t has si_pid field...">&4
22734         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
22735         eval $hasfield_t;
22736
22737         echo "Checking if your siginfo_t has si_uid field...">&4
22738         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
22739         eval $hasfield_t;
22740
22741         echo "Checking if your siginfo_t has si_addr field...">&4
22742         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
22743         eval $hasfield_t;
22744
22745         echo "Checking if your siginfo_t has si_status field...">&4
22746         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
22747         eval $hasfield_t;
22748
22749         echo "Checking if your siginfo_t has si_band field...">&4
22750         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
22751         eval $hasfield_t;
22752
22753         echo "Checking if your siginfo_t has si_value field...">&4
22754         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
22755         eval $hasfield_t;
22756
22757         ;;
22758 esac
22759
22760 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22761 echo " "
22762 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22763 $cat >try.c <<'EOM'
22764 /* Intentionally a long probe as I'd like to sanity check that the exact
22765    approach is going to work, as thinking it will work, but only having it
22766    part working at runtime is worse than not having it.  */
22767
22768 #include <sys/types.h>
22769 #include <sys/sysctl.h>
22770 #include <sys/param.h>
22771 #include <stdio.h>
22772 #include <string.h>
22773 #include <stdlib.h>
22774 #include <unistd.h>
22775
22776 int
22777 main(int argc, char **argv) {
22778     char *buffer;
22779     char *argv_leaf = strrchr(argv[0], '/');
22780     char *buffer_leaf;
22781     size_t size = 0;
22782     int mib[4];
22783
22784     mib[0] = CTL_KERN;
22785     mib[1] = KERN_PROC;
22786     mib[2] = KERN_PROC_PATHNAME;
22787     mib[3] = -1;
22788
22789     if (!argv_leaf) {
22790         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22791         return 1;
22792     }
22793
22794     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22795         perror("sysctl");
22796         return 2;
22797     }
22798
22799     if (size < strlen(argv_leaf) + 1) {
22800         fprintf(stderr, "size %lu is too short for a path\n",
22801                 (unsigned long) size);
22802         return 3;
22803     }
22804
22805     if (size > MAXPATHLEN * MAXPATHLEN) {
22806         fprintf(stderr, "size %lu is too long for a path\n",
22807                 (unsigned long) size);
22808         return 4;
22809     }
22810
22811     buffer = malloc(size);
22812     if (!buffer) {
22813         perror("malloc");
22814         return 5;
22815     }
22816
22817     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22818         perror("sysctl");
22819         return 6;
22820     }
22821
22822     if (strlen(buffer) + 1 != size) {
22823         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22824                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22825         return 7;
22826     }
22827
22828
22829     if (*buffer != '/') {
22830         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22831         return 8;
22832     }
22833
22834     if (strstr(buffer, "/./")) {
22835         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22836         return 9;
22837     }
22838
22839     if (strstr(buffer, "/../")) {
22840         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22841         return 10;
22842     }
22843
22844     buffer_leaf = strrchr(buffer, '/');
22845     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22846         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22847         return 11;
22848     }
22849
22850     free(buffer);
22851
22852     return 0;
22853 }
22854 EOM
22855
22856 val=$undef
22857 set try
22858 if eval $compile; then
22859         if $run ./try; then
22860                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22861                 val="$define"
22862         else
22863                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22864                 val="$undef"
22865         fi
22866 else
22867         echo "I'm unable to compile the test program." >&4
22868         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22869         val="$undef"
22870 fi
22871 $rm_try
22872 set usekernprocpathname
22873 eval $setvar
22874
22875 : Determine if we can use _NSGetExecutablePath to find executing program
22876 echo " "
22877 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22878 $cat >try.c <<'EOM'
22879 /* Intentionally a long probe as I'd like to sanity check that the exact
22880    approach is going to work, as thinking it will work, but only having it
22881    part working at runtime is worse than not having it.  */
22882 #include <mach-o/dyld.h>
22883 #include <stdio.h>
22884 #include <stdlib.h>
22885 #include <sys/param.h>
22886 #include <string.h>
22887
22888 int
22889 main(int argc, char **argv) {
22890     char buf[1];
22891     uint32_t size = sizeof(buf);
22892     int result;
22893     char *buffer;
22894     char *tidied;
22895     char *argv_leaf = strrchr(argv[0], '/');
22896     char *tidied_leaf;
22897
22898     if (!argv_leaf) {
22899         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22900         return 1;
22901     }
22902
22903     _NSGetExecutablePath(buf, &size);
22904     if (size > MAXPATHLEN * MAXPATHLEN) {
22905         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22906                 (unsigned int) size);
22907         return 2;
22908     }
22909
22910     buffer = malloc(size);
22911     if (!buffer) {
22912         perror("malloc");
22913         return 3;
22914     }
22915
22916     result = _NSGetExecutablePath(buffer, &size);
22917     if (result != 0) {
22918         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22919                 result, (unsigned int) size);
22920         return 4;
22921     }
22922
22923     tidied = realpath(buffer, NULL);
22924     if (!tidied) {
22925         perror("realpath");
22926         return 5;
22927     }
22928
22929     free(buffer);
22930
22931     if (*tidied != '/') {
22932         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22933         return 6;
22934     }
22935
22936     if (strstr(tidied, "/./")) {
22937         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22938         return 7;
22939     }
22940
22941     if (strstr(tidied, "/../")) {
22942         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22943         return 8;
22944     }
22945
22946     tidied_leaf = strrchr(tidied, '/');
22947     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22948         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22949         return 9;
22950     }
22951
22952     free(tidied);
22953
22954     return 0;
22955 }
22956 EOM
22957
22958 val=$undef
22959 set try
22960 if eval $compile; then
22961         if $run ./try; then
22962                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22963                 val="$define"
22964         else
22965                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22966         fi
22967 else
22968         echo "I'm unable to compile the test program." >&4
22969         echo "I'll assume no _NSGetExecutablePath here." >&4
22970 fi
22971 $rm_try
22972 set usensgetexecutablepath
22973 eval $setvar
22974
22975 : Check if site customization support was requested
22976 case "$usesitecustomize" in
22977     $define|true|[Yy]*)
22978         usesitecustomize="$define"
22979         ;;
22980     *)
22981         usesitecustomize="$undef"
22982         ;;
22983     esac
22984
22985 : see if prototypes support variable argument declarations
22986 echo " "
22987 case "$prototype$i_stdarg" in
22988 $define$define)
22989         echo "It appears we'll be able to prototype varargs functions." >&4
22990         val="$define"
22991         ;;
22992 *)
22993         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22994         val="$undef"
22995         ;;
22996 esac
22997 set vaproto
22998 eval $setvar
22999
23000 : determine compiler compiler
23001 case "$yacc" in
23002 '')
23003         dflt=yacc;;
23004 *)
23005         dflt="$yacc";;
23006 esac
23007 echo " "
23008 comp='yacc'
23009 if $test -f "$byacc$_exe"; then
23010         dflt="$byacc"
23011         comp="byacc or $comp"
23012 fi
23013 if $test -f "$bison$_exe"; then
23014         comp="$comp or bison -y"
23015 fi
23016 rp="Which compiler compiler ($comp) shall I use?"
23017 . ./myread
23018 yacc="$ans"
23019 case "$yacc" in
23020 *bis*)
23021         case "$yacc" in
23022         *-y*) ;;
23023         *)
23024                 yacc="$yacc -y"
23025                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23026                 ;;
23027         esac
23028         ;;
23029 esac
23030
23031 : see if this is a assert.h system
23032 set assert.h i_assert
23033 eval $inhdr
23034
23035 : see if this is a bfd.h system
23036 set bfd.h i_bfd
23037 eval $inhdr
23038
23039 : see if this is an execinfo.h system
23040 set execinfo.h i_execinfo
23041 eval $inhdr
23042
23043 : see if this is a fenv.h system
23044 set fenv.h i_fenv
23045 eval $inhdr
23046
23047 : see if this is a fp.h system
23048 set fp.h i_fp
23049 eval $inhdr
23050
23051 : see if this is a fp_class.h system
23052 set fp_class.h i_fp_class
23053 eval $inhdr
23054
23055 : see if gdbm.h is available
23056 set gdbm.h t_gdbm
23057 eval $inhdr
23058 case "$t_gdbm" in
23059 $define)
23060         : see if gdbm_open exists
23061         set gdbm_open d_gdbm_open
23062         eval $inlibc
23063         case "$d_gdbm_open" in
23064         $undef)
23065                 t_gdbm="$undef"
23066                 echo "We won't be including <gdbm.h>"
23067                 ;;
23068         esac
23069         ;;
23070 esac
23071 val="$t_gdbm"
23072 set i_gdbm
23073 eval $setvar
23074
23075 : see if this is a ieeefp.h system
23076 case "$i_ieeefp" in
23077 '' ) set ieeefp.h i_ieeefp
23078      eval $inhdr
23079      ;;
23080 esac
23081
23082 : see if this is a libutil.h system
23083 set libutil.h i_libutil
23084 eval $inhdr
23085
23086 : see if mach cthreads are available
23087 if test "X$usethreads" = "X$define"; then
23088         set mach/cthreads.h i_machcthr
23089         eval $inhdr
23090 else
23091         i_machcthr="$undef"
23092 fi
23093
23094 : see if this is a mntent.h system
23095 set mntent.h i_mntent
23096 eval $inhdr
23097
23098 : see if net/errno.h is available
23099 val=''
23100 set net/errno.h val
23101 eval $inhdr
23102
23103 : Unfortunately, it causes problems on some systems.  Arrgh.
23104 case "$val" in
23105 $define)
23106         cat > try.c <<'EOM'
23107 #include <stdio.h>
23108 #include <errno.h>
23109 #include <net/errno.h>
23110 int func()
23111 {
23112         return ENOTSOCK;
23113 }
23114 EOM
23115         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23116                 echo "We'll be including <net/errno.h>." >&4
23117         else
23118                 echo "We won't be including <net/errno.h>." >&4
23119                 val="$undef"
23120         fi
23121         $rm_try
23122         ;;
23123 esac
23124 set i_neterrno
23125 eval $setvar
23126
23127 : see if netinet/tcp.h is available
23128 set netinet/tcp.h i_netinettcp
23129 eval $inhdr
23130
23131 : see if this is a poll.h system
23132 set poll.h i_poll
23133 eval $inhdr
23134
23135 : see if this is a prot.h system
23136 set prot.h i_prot
23137 eval $inhdr
23138
23139 : Preprocessor symbols
23140 echo " "
23141 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23142 $cat <<'EOSH' > Cppsym.know
23143 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23144 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23145 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23146 arch_pwr ardent ARM ARM32 atarist att386 att3b
23147 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23148 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23149 byteorder byte_order
23150 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23151 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23152 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23153 ELF encore EPI EXTENSIONS
23154 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23155 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23156 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23157 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23158 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23159 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23160 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23161 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23162 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23163 ksr1
23164 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23165 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23166 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23167 luna88k Lynx
23168 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23169 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23170 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23171 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23172 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23173 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23174 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23175 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23176 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23177 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23178 ns32000 ns32016 ns32332 ns32k nsc32000
23179 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23180 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23181 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23182 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23183 QK_USER QNX
23184 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23185 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23186 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23187 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23188 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23189 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23190 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23191 SYSV4 SYSV5 sysV68 sysV88
23192 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23193 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23194 tower32_800 tower32_850 tss
23195 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23196 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23197 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23198 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23199 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23200 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23201 uxpm uxps
23202 vax venix VMESA vms
23203 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23204 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23205 z8000 zarch
23206 EOSH
23207 # Maybe put other stuff here too.
23208 ./tr '-' '_' <<EOSH >>Cppsym.know
23209 $osname
23210 EOSH
23211 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23212 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23213 $cat Cppsym.know > Cppsym.c
23214 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23215 $rm -f Cppsym.a Cppsym.b Cppsym.c
23216 cat <<EOSH > Cppsym
23217 $startsh
23218 if $test \$# -gt 0; then
23219     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23220     if $test -s Cppsym.got; then
23221         $rm -f Cppsym.got
23222         exit 0
23223     fi
23224     $rm -f Cppsym.got
23225     exit 1
23226 else
23227     $tr " " "$trnl" | ./Cppsym.try
23228     exit 0
23229 fi
23230 EOSH
23231 chmod +x Cppsym
23232 $eunicefix Cppsym
23233 cat <<EOSH > Cppsym.try
23234 $startsh
23235 cat <<'EOCP' > try.c
23236 #include <stdio.h>
23237 #if cpp_stuff == 1
23238 #define STRINGIFY(a)    "a"
23239 #endif
23240 #if cpp_stuff == 42
23241 #define StGiFy(a)  #a
23242 #define STRINGIFY(a)    StGiFy(a)
23243 #endif
23244 #if $cpp_stuff != 1 && $cpp_stuff != 42
23245 #   include "Bletch: How does this C preprocessor stringify macros?"
23246 #endif
23247 int main() {
23248 EOCP
23249 $awk \\
23250 EOSH
23251 cat <<'EOSH' >> Cppsym.try
23252 'length($1) > 0 {
23253     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23254     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23255     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23256     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23257 }'       >> try.c
23258 echo 'return 0;}' >> try.c
23259 EOSH
23260 cat <<EOSH >> Cppsym.try
23261 ccflags="$ccflags"
23262 case "$osname-$gccversion" in
23263 irix-) ccflags="\$ccflags -woff 1178" ;;
23264 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23265 esac
23266 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
23267 EOSH
23268 chmod +x Cppsym.try
23269 $eunicefix Cppsym.try
23270 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23271 : Add in any Linux cpp "predefined macros":
23272 case "$osname::$gccversion" in
23273   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23274     tHdrH=_tmpHdr
23275     rm -f $tHdrH'.h' $tHdrH
23276     touch $tHdrH'.h'
23277     # Filter out macro arguments, such as Linux's __INT8_C(c)
23278     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23279        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23280        if [ -s $tHdrH'_cppsym.real' ]; then
23281           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23282        fi
23283     fi
23284     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23285   ;;
23286 esac
23287 : now check the C compiler for additional symbols
23288 postprocess_cc_v=''
23289 case "$osname" in
23290 aix) postprocess_cc_v="|$tr , ' '" ;;
23291 esac
23292 $cat >ccsym <<EOS
23293 $startsh
23294 $cat >tmp.c <<EOF
23295 extern int foo;
23296 EOF
23297 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23298 do
23299         case "\$i" in
23300         -D*) echo "\$i" | $sed 's/^-D//';;
23301         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23302         esac
23303 done
23304 $rm_try
23305 EOS
23306 postprocess_cc_v=''
23307 chmod +x ccsym
23308 $eunicefix ccsym
23309 ./ccsym > ccsym1.raw
23310 if $test -s ccsym1.raw; then
23311     $sort ccsym1.raw | $uniq >ccsym.raw
23312 else
23313     mv ccsym1.raw ccsym.raw
23314 fi
23315
23316 $awk '/\=/ { print $0; next }
23317         { print $0"=1" }' ccsym.raw >ccsym.list
23318 $comm -13 Cppsym.true ccsym.list >ccsym.own
23319 $comm -12 Cppsym.true ccsym.list >ccsym.com
23320 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23321 also=''
23322 if $test -z ccsym.raw; then
23323         echo "Your C compiler doesn't seem to define any symbols!" >&4
23324         echo " "
23325         echo "However, your C preprocessor defines the following symbols:"
23326         $cat Cppsym.true
23327         ccsymbols=''
23328         cppsymbols=`$cat Cppsym.true`
23329         cppsymbols=`echo $cppsymbols`
23330         cppccsymbols="$cppsymbols"
23331 else
23332         if $test -s ccsym.com; then
23333                 echo "Your C compiler and pre-processor define these symbols:"
23334                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23335                 also='also '
23336                 symbols='ones'
23337                 cppccsymbols=`$cat ccsym.com`
23338                 cppccsymbols=`echo $cppccsymbols`
23339                 $test "$silent" || sleep 1
23340         fi
23341         if $test -s ccsym.cpp; then
23342                 $test "$also" && echo " "
23343                 echo "Your C pre-processor ${also}defines the following symbols:"
23344                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23345                 also='further '
23346                 cppsymbols=`$cat ccsym.cpp`
23347                 cppsymbols=`echo $cppsymbols`
23348                 $test "$silent" || sleep 1
23349         fi
23350         if $test -s ccsym.own; then
23351                 $test "$also" && echo " "
23352                 echo "Your C compiler ${also}defines the following cpp symbols:"
23353                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23354                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23355                 ccsymbols=`$cat ccsym.own`
23356                 ccsymbols=`echo $ccsymbols`
23357                 $test "$silent" || sleep 1
23358         fi
23359 fi
23360
23361 : add -D_FORTIFY_SOURCE if feasible and not already there
23362 case "$gccversion" in
23363 [45].*) case "$optimize$ccflags" in
23364         *-O*)   case "$ccflags$cppsymbols" in
23365                 *_FORTIFY_SOURCE=*) # Don't add it again.
23366                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23367                         ;;
23368                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23369                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23370                         ;;
23371                 esac
23372                 ;;
23373         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23374                 ;;
23375         esac
23376         ;;
23377 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23378         ;;
23379 esac
23380
23381 : see if this is a termio system
23382 val="$undef"
23383 val2="$undef"
23384 val3="$undef"
23385 if $test `./findhdr termios.h`; then
23386     set tcsetattr i_termios
23387     eval $inlibc
23388     val3="$i_termios"
23389 fi
23390 echo " "
23391 case "$val3" in
23392     "$define") echo "You have POSIX termios.h... good!" >&4;;
23393     *)  if ./Cppsym pyr; then
23394             case "`$run /bin/universe`" in
23395                 ucb) if $test `./findhdr sgtty.h`; then
23396                         val2="$define"
23397                         echo "<sgtty.h> found." >&4
23398                     else
23399                         echo "System is pyramid with BSD universe."
23400                         ./warn "<sgtty.h> not found--you could have problems."
23401                     fi;;
23402                 *)  if $test `./findhdr termio.h`; then
23403                         val="$define"
23404                         echo "<termio.h> found." >&4
23405                     else
23406                         echo "System is pyramid with USG universe."
23407                         ./warn "<termio.h> not found--you could have problems."
23408                     fi;;
23409             esac
23410         elif ./usg; then
23411             if $test `./findhdr termio.h`; then
23412                 echo "<termio.h> found." >&4
23413                 val="$define"
23414             elif $test `./findhdr sgtty.h`; then
23415                 echo "<sgtty.h> found." >&4
23416                 val2="$define"
23417             else
23418                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23419             fi
23420         else
23421             if $test `./findhdr sgtty.h`; then
23422                 echo "<sgtty.h> found." >&4
23423                 val2="$define"
23424             elif $test `./findhdr termio.h`; then
23425                 echo "<termio.h> found." >&4
23426                 val="$define"
23427             else
23428                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23429             fi
23430         fi;;
23431 esac
23432 set i_termio; eval $setvar
23433 val=$val2; set i_sgtty; eval $setvar
23434 val=$val3; set i_termios; eval $setvar
23435
23436 : see if stdbool is available
23437 : we want a real compile instead of Inhdr because some Solaris systems
23438 : have stdbool.h, but it can only be used if the compiler indicates it
23439 : is sufficiently c99-compliant.
23440 echo " "
23441 $cat >try.c <<EOCP
23442 #include <stdio.h>
23443 #include <stdbool.h>
23444 int func(bool x)
23445 {
23446     return x ? 1 : 0;
23447 }
23448 int main(int argc, char **argv)
23449 {
23450     return func(0);
23451 }
23452 EOCP
23453 set try
23454 if eval $compile; then
23455         echo "<stdbool.h> found." >&4
23456         val="$define"
23457 else
23458         echo "<stdbool.h> NOT found." >&4
23459         val="$undef"
23460 fi
23461 $rm_try
23462 set i_stdbool
23463 eval $setvar
23464
23465 : see if stddef is available
23466 set stddef.h i_stddef
23467 eval $inhdr
23468
23469 : see if stdint is available
23470 set stdint.h i_stdint
23471 eval $inhdr
23472
23473 : see if sys/access.h is available
23474 set sys/access.h i_sysaccess
23475 eval $inhdr
23476
23477 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23478 set sys/filio.h i_sysfilio
23479 eval $inhdr
23480 echo " "
23481 if $test `./findhdr sys/ioctl.h`; then
23482         val="$define"
23483         echo '<sys/ioctl.h> found.' >&4
23484 else
23485         val="$undef"
23486         if $test $i_sysfilio = "$define"; then
23487             echo '<sys/ioctl.h> NOT found.' >&4
23488         else
23489                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23490                 $test $i_termio = "$define" && xxx="termio.h"
23491                 $test $i_termios = "$define" && xxx="termios.h"
23492 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23493         fi
23494 fi
23495 set i_sysioctl
23496 eval $setvar
23497
23498 : see if socket ioctl defs are in sys/sockio.h
23499 echo " "
23500 xxx=`./findhdr sys/sockio.h`
23501 if $test "$xxx"; then
23502         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23503                 val="$define"
23504                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23505         else
23506                 val="$undef"
23507                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23508         fi
23509 else
23510         val="$undef"
23511         $cat <<EOM
23512 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23513 EOM
23514 fi
23515 set i_syssockio
23516 eval $setvar
23517
23518 : see if this is a syslog.h system
23519 set syslog.h i_syslog
23520 eval $inhdr
23521
23522 : see if this is a sys/mode.h system
23523 set sys/mode.h i_sysmode
23524 eval $inhdr
23525
23526 : see if there is a sys/poll.h file
23527 set sys/poll.h i_syspoll
23528 eval $inhdr
23529
23530 : see if sys/resource.h has to be included
23531 set sys/resource.h i_sysresrc
23532 eval $inhdr
23533
23534 : see if sys/security.h is available
23535 set sys/security.h i_syssecrt
23536 eval $inhdr
23537
23538 : see if this is a sys/statvfs.h system
23539 set sys/statvfs.h i_sysstatvfs
23540 eval $inhdr
23541
23542 : see if this is a sys/un.h system
23543 set sys/un.h i_sysun
23544 eval $inhdr
23545
23546 : see if this is a sys/utsname.h system
23547 set sys/utsname.h i_sysutsname
23548 eval $inhdr
23549
23550 : see if this is a syswait system
23551 set sys/wait.h i_syswait
23552 eval $inhdr
23553
23554 : see if this is a ustat.h system
23555 set ustat.h i_ustat
23556 eval $inhdr
23557
23558 : see if this is an utime system
23559 set utime.h i_utime
23560 eval $inhdr
23561
23562 : see if this is a vfork system
23563 case "$d_vfork" in
23564 "$define")
23565         set vfork.h i_vfork
23566         eval $inhdr
23567         ;;
23568 *)
23569         i_vfork="$undef"
23570         ;;
23571 esac
23572
23573 : Check extensions
23574 echo " "
23575 echo "Looking for extensions..." >&4
23576 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23577 : contain old or inaccurate or duplicate values.
23578 nonxs_extensions=''
23579 xs_extensions=''
23580 : We do not use find because it might not be available.
23581 : We do not just use MANIFEST because the user may have dropped
23582 : some additional extensions into the source tree and expect them
23583 : to be built.
23584
23585 : Function to recursively find available extensions, ignoring DynaLoader
23586 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23587 : In 5.10.1 and later, extensions are stored in directories
23588 : like File-Glob instead of the older File/Glob/.
23589 find_extensions='
23590     for xxx in *; do
23591         case "$xxx" in
23592             DynaLoader|dynaload) ;;
23593             *)
23594             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23595             case "$this_ext" in
23596                 Scalar/List/Utils) this_ext="List/Util" ;;
23597                 PathTools)         this_ext="Cwd"       ;;
23598             esac;
23599             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23600             if $contains " $this_ext " "$tdir/$$.tmp"; then
23601                 echo >&4;
23602                 echo "Duplicate directories detected for extension $xxx" >&4;
23603                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23604                 case "$knowitall" in
23605                 "") dflt=y;;
23606                 *) dflt=n;;
23607                 esac;
23608                 . ../UU/myread;
23609                 case "$ans" in
23610                 n*|N*) ;;
23611                 *) echo >&4;
23612                     echo "Ok.  Stopping Configure." >&4;
23613                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23614                     exit 1;;
23615                 esac;
23616                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23617             fi;
23618             $ls -1 "$xxx" > "$tdir/$$.tmp";
23619             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23620                 xs_extensions="$xs_extensions $this_ext";
23621             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23622                 xs_extensions="$xs_extensions $this_ext";
23623             elif $test -d "$xxx"; then
23624                 nonxs_extensions="$nonxs_extensions $this_ext";
23625             fi;
23626             $rm -f "$tdir/$$.tmp";
23627             ;;
23628         esac;
23629     done'
23630 tdir=`pwd`
23631 cd "$rsrc/cpan"
23632 set X
23633 shift
23634 eval $find_extensions
23635 cd "$rsrc/dist"
23636 set X
23637 shift
23638 eval $find_extensions
23639 cd "$rsrc/ext"
23640 set X
23641 shift
23642 eval $find_extensions
23643 set X $xs_extensions
23644 shift
23645 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23646 set X $nonxs_extensions
23647 shift
23648 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23649 cd "$tdir"
23650 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23651
23652 : Now see which are supported on this system.
23653 avail_ext=''
23654 for xxx in $xs_extensions ; do
23655         case "$xxx" in
23656         Amiga*)
23657                 case "$osname" in
23658                 amigaos) avail_ext="$avail_ext $xxx" ;;
23659                 esac
23660                 ;;
23661         DB_File|db_file)
23662                 case "$i_db" in
23663                 $define) avail_ext="$avail_ext $xxx" ;;
23664                 esac
23665                 ;;
23666         GDBM_File|gdbm_fil)
23667                 case "$i_gdbm" in
23668                 $define) avail_ext="$avail_ext $xxx" ;;
23669                 esac
23670                 ;;
23671         I18N/Langinfo|i18n_lan)
23672                 case "$i_langinfo$d_nl_langinfo" in
23673                 $define$define) avail_ext="$avail_ext $xxx" ;;
23674                 esac
23675                 ;;
23676         IPC/SysV|ipc/sysv)
23677                 : XXX Do we need a useipcsysv variable here
23678                 case "${d_msg}${d_sem}${d_shm}" in
23679                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23680                 esac
23681                 ;;
23682         NDBM_File|ndbm_fil)
23683                 case "$d_ndbm" in
23684                 $define)
23685                     case "$osname-$use64bitint" in
23686                     hpux-define)
23687                         case "$libs" in
23688                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23689                         esac
23690                         ;;
23691                     *) avail_ext="$avail_ext $xxx" ;;
23692                     esac
23693                     ;;
23694                 esac
23695                 ;;
23696         ODBM_File|odbm_fil)
23697                 case "${i_dbm}${i_rpcsvcdbm}" in
23698                 *"${define}"*)
23699                     case "$d_cplusplus" in
23700                     define) ;; # delete as a function name will not work
23701                     *)  case "$osname-$use64bitint" in
23702                         hpux-define)
23703                             case "$libs" in
23704                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23705                             esac
23706                             ;;
23707                         *) avail_ext="$avail_ext $xxx" ;;
23708                         esac
23709                         ;;
23710                     esac
23711                     ;;
23712                 esac
23713                 ;;
23714         Opcode|opcode)
23715                 case "$useopcode" in
23716                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23717                 esac
23718                 ;;
23719         POSIX|posix)
23720                 case "$useposix" in
23721                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23722                 esac
23723                 ;;
23724         Socket|socket)
23725                 case "$d_socket" in
23726                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23727                 esac
23728                 ;;
23729         Sys/Syslog|sys/syslog)
23730                 case $osname in
23731                         amigaos) ;; # not really very useful on AmigaOS
23732                         *)
23733                         : XXX syslog requires socket
23734                         case "$d_socket" in
23735                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23736                         esac
23737                         ;;
23738                 esac
23739                 ;;
23740         Thread|thread)
23741                 case "$usethreads" in
23742                 true|$define|y)
23743                         case "$use5005threads" in
23744                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23745                         esac
23746                 esac
23747                 ;;
23748         threads|threads/shared)
23749                 # threads and threads::shared are special cases.
23750                 # To stop people from asking "Perl 5.8.0 was supposed
23751                 # to have this new fancy threads implementation but my
23752                 # perl doesn't have it" and from people trying to
23753                 # (re)install the threads module using CPAN.pm and
23754                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23755                 # the threads.pm and threads/shared.pm will always be
23756                 # there, croaking informatively ("you need to rebuild
23757                 # all of Perl with threads, sorry") when threads haven't
23758                 # been compiled in.
23759                 # --jhi
23760                 avail_ext="$avail_ext $xxx"
23761                 ;;
23762         VMS*)
23763                 ;;
23764         Win32*)
23765                 case "$osname" in
23766                 cygwin) avail_ext="$avail_ext $xxx" ;;
23767                 esac
23768                 ;;
23769         XS/APItest|xs/apitest)
23770                 # This is just for testing.  Skip it unless we have dynamic loading.
23771
23772                 case "$usedl" in
23773                 $define) avail_ext="$avail_ext $xxx" ;;
23774                 esac
23775                 ;;
23776         XS/Typemap|xs/typemap)
23777                 # This is just for testing.  Skip it unless we have dynamic loading.
23778                 case "$usedl" in
23779                 $define) avail_ext="$avail_ext $xxx" ;;
23780                 esac
23781                 ;;
23782         *)      avail_ext="$avail_ext $xxx"
23783                 ;;
23784         esac
23785 done
23786
23787 set X $avail_ext
23788 shift
23789 avail_ext="$*"
23790
23791 case "$onlyextensions" in
23792 '') ;;
23793 *)  keepextensions=''
23794     echo "You have requested that only certain extensions be included..." >&4
23795     for i in $onlyextensions; do
23796         case " $avail_ext " in
23797         *" $i "*)
23798             echo "Keeping extension $i."
23799             keepextensions="$keepextensions $i"
23800             ;;
23801         *) echo "Ignoring extension $i." ;;
23802         esac
23803     done
23804     avail_ext="$keepextensions"
23805     ;;
23806 esac
23807
23808 case "$noextensions" in
23809 '') ;;
23810 *)  keepextensions=''
23811     echo "You have requested that certain extensions be ignored..." >&4
23812     for i in $avail_ext; do
23813         case " $noextensions " in
23814         *" $i "*) echo "Ignoring extension $i." ;;
23815         *) echo "Keeping extension $i.";
23816            keepextensions="$keepextensions $i"
23817            ;;
23818         esac
23819     done
23820     avail_ext="$keepextensions"
23821     ;;
23822 esac
23823
23824 : Now see which nonxs extensions are supported on this system.
23825 : For now assume all are.
23826 nonxs_ext=''
23827 for xxx in $nonxs_extensions ; do
23828         case "$xxx" in
23829         VMS*)
23830                 ;;
23831         *)      nonxs_ext="$nonxs_ext $xxx"
23832                 ;;
23833         esac
23834 done
23835
23836 set X $nonxs_ext
23837 shift
23838 nonxs_ext="$*"
23839
23840 case $usedl in
23841 $define)
23842         $cat <<EOM
23843 A number of extensions are supplied with $package.  You may choose to
23844 compile these extensions for dynamic loading (the default), compile
23845 them into the $package executable (static loading), or not include
23846 them at all.  Answer "none" to include no extensions.
23847 Note that DynaLoader is always built and need not be mentioned here.
23848
23849 EOM
23850         case "$dynamic_ext" in
23851         '')
23852                 : Exclude those listed in static_ext
23853                 dflt=''
23854                 for xxx in $avail_ext; do
23855                         case " $static_ext " in
23856                         *" $xxx "*) ;;
23857                         *) dflt="$dflt $xxx" ;;
23858                         esac
23859                 done
23860                 set X $dflt
23861                 shift
23862                 dflt="$*"
23863                 ;;
23864         *)      dflt="$dynamic_ext"
23865                 # Perhaps we are reusing an old out-of-date config.sh.
23866                 case "$hint" in
23867                 previous)
23868                         if test X"$dynamic_ext" != X"$avail_ext"; then
23869                                 $cat <<EOM
23870 NOTICE:  Your previous config.sh list may be incorrect.
23871 The extensions now available to you are
23872         ${avail_ext}
23873 but the default list from your previous config.sh is
23874         ${dynamic_ext}
23875
23876 EOM
23877                         fi
23878                         ;;
23879                 esac
23880                 ;;
23881         esac
23882         case "$dflt" in
23883         '')     dflt=none;;
23884         esac
23885         rp="What extensions do you wish to load dynamically?"
23886         . ./myread
23887         case "$ans" in
23888         none) dynamic_ext=' ' ;;
23889         *) dynamic_ext="$ans" ;;
23890         esac
23891
23892         case "$static_ext" in
23893         '')
23894                 : Exclude those already listed in dynamic linking
23895                 dflt=''
23896                 for xxx in $avail_ext; do
23897                         case " $dynamic_ext " in
23898                         *" $xxx "*) ;;
23899                         *) dflt="$dflt $xxx" ;;
23900                         esac
23901                 done
23902                 set X $dflt
23903                 shift
23904                 dflt="$*"
23905                 ;;
23906         *)  dflt="$static_ext"
23907                 ;;
23908         esac
23909
23910         case "$dflt" in
23911         '')     dflt=none;;
23912         esac
23913         rp="What extensions do you wish to load statically?"
23914         . ./myread
23915         case "$ans" in
23916         none) static_ext=' ' ;;
23917         *) static_ext="$ans" ;;
23918         esac
23919         ;;
23920 *)
23921         $cat <<EOM
23922 A number of extensions are supplied with $package.  Answer "none"
23923 to include no extensions.
23924 Note that DynaLoader is always built and need not be mentioned here.
23925
23926 EOM
23927         case "$static_ext" in
23928         '') dflt="$avail_ext" ;;
23929         *)      dflt="$static_ext"
23930                 # Perhaps we are reusing an old out-of-date config.sh.
23931                 case "$hint" in
23932                 previous)
23933                         if test X"$static_ext" != X"$avail_ext"; then
23934                                 $cat <<EOM
23935 NOTICE:  Your previous config.sh list may be incorrect.
23936 The extensions now available to you are
23937         ${avail_ext}
23938 but the default list from your previous config.sh is
23939         ${static_ext}
23940
23941 EOM
23942                         fi
23943                         ;;
23944                 esac
23945                 ;;
23946         esac
23947         : Exclude those that are not xs extensions
23948         case "$dflt" in
23949         '')     dflt=none;;
23950         esac
23951         rp="What extensions do you wish to include?"
23952         . ./myread
23953         case "$ans" in
23954         none) static_ext=' ' ;;
23955         *) static_ext="$ans" ;;
23956         esac
23957         ;;
23958 esac
23959 #
23960 # Encode is a special case.  If we are building Encode as a static
23961 # extension, we need to explicitly list its subextensions as well.
23962 # For other nested extensions, this is handled automatically by
23963 # the appropriate Makefile.PL.
23964 case " $static_ext " in
23965         *" Encode "*) # Add the subextensions of Encode
23966         cd "$rsrc/cpan"
23967         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23968                 static_ext="$static_ext Encode/$xxx"
23969                 known_extensions="$known_extensions Encode/$xxx"
23970         done
23971         cd "$tdir"
23972         ;;
23973 esac
23974
23975 set X $dynamic_ext $static_ext $nonxs_ext
23976 shift
23977 extensions="$*"
23978
23979 # Sanity check:  We require an extension suitable for use with
23980 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23981 # should show up as failures in the test suite, but it's helpful to
23982 # catch them now.) The 'extensions' list is normally sorted
23983 # alphabetically, so we need to accept either
23984 #    DB_File ... Fcntl ... IO  ....
23985 # or something like
23986 #    Fcntl ... NDBM_File ... IO  ....
23987 case " $extensions"  in
23988 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23989 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23990 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23991 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23992    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23993    ;;
23994 esac
23995
23996 : Remove libraries needed only for extensions
23997 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23998 : The exception is SunOS 4.x, which needs them.
23999 case "${osname}X${osvers}" in
24000 sunos*X4*)
24001     perllibs="$libs"
24002     ;;
24003 *) case "$usedl" in
24004     $define|true|[yY]*)
24005             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24006             shift
24007             perllibs="$*"
24008             ;;
24009     *)  perllibs="$libs"
24010             ;;
24011     esac
24012     ;;
24013 esac
24014
24015 : Remove build directory name from cppstdin so it can be used from
24016 : either the present location or the final installed location.
24017 echo " "
24018 : Get out of the UU directory to get correct path name.
24019 cd ..
24020 case "$cppstdin" in
24021 `pwd`/cppstdin)
24022         echo "Stripping down cppstdin path name"
24023         cppstdin=cppstdin
24024         ;;
24025 esac
24026 cd UU
24027
24028 : end of configuration questions
24029 echo " "
24030 echo "End of configuration questions."
24031 echo " "
24032
24033 : back to where it started
24034 if test -d ../UU; then
24035         cd ..
24036 fi
24037
24038 : configuration may be unconditionally patched via a 'config.arch' file
24039 if $test -f config.arch; then
24040         echo "I see a config.arch file, loading it." >&4
24041         . ./config.arch
24042 fi
24043
24044 : configuration may be patched via a 'config.over' file
24045 if $test -f config.over; then
24046         echo " "
24047         dflt=y
24048         rp='I see a config.over file.  Do you wish to load it?'
24049         . UU/myread
24050         case "$ans" in
24051         n*) echo "OK, I'll ignore it.";;
24052         *)      . ./config.over
24053                 echo "Configuration override changes have been loaded."
24054                 ;;
24055         esac
24056 fi
24057
24058 : in case they want portability, strip down executable paths
24059 case "$d_portable" in
24060 "$define")
24061         echo " "
24062         echo "Stripping down executable paths..." >&4
24063         for file in $loclist $trylist; do
24064                 eval temp=\$$file
24065                 eval $file=`basename $temp`
24066         done
24067         ;;
24068 esac
24069
24070 : create config.sh file
24071 echo " "
24072 echo "Creating config.sh..." >&4
24073 $spitshell <<EOT >config.sh
24074 $startsh
24075 #
24076 # This file was produced by running the Configure script. It holds all the
24077 # definitions figured out by Configure. Should you modify one of these values,
24078 # do not forget to propagate your changes by running "Configure -der". You may
24079 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24080 #
24081
24082 # Package name      : $package
24083 # Source directory  : $src
24084 # Configuration time: $cf_time
24085 # Configured by     : $cf_by
24086 # Target system     : $myuname
24087
24088 EOT
24089 : Add in command line options if available
24090 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24091
24092 $spitshell <<EOT >>config.sh
24093
24094 Author='$Author'
24095 Date='$Date'
24096 Header='$Header'
24097 Id='$Id'
24098 Locker='$Locker'
24099 Log='$Log'
24100 RCSfile='$RCSfile'
24101 Revision='$Revision'
24102 Source='$Source'
24103 State='$State'
24104 _a='$_a'
24105 _exe='$_exe'
24106 _o='$_o'
24107 afs='$afs'
24108 afsroot='$afsroot'
24109 alignbytes='$alignbytes'
24110 ansi2knr='$ansi2knr'
24111 aphostname='$aphostname'
24112 api_revision='$api_revision'
24113 api_subversion='$api_subversion'
24114 api_version='$api_version'
24115 api_versionstring='$api_versionstring'
24116 ar='$ar'
24117 archlib='$archlib'
24118 archlibexp='$archlibexp'
24119 archname64='$archname64'
24120 archname='$archname'
24121 archobjs='$archobjs'
24122 asctime_r_proto='$asctime_r_proto'
24123 awk='$awk'
24124 baserev='$baserev'
24125 bash='$bash'
24126 bin='$bin'
24127 bin_ELF='$bin_ELF'
24128 binexp='$binexp'
24129 bison='$bison'
24130 byacc='$byacc'
24131 byteorder='$byteorder'
24132 c='$c'
24133 castflags='$castflags'
24134 cat='$cat'
24135 cc='$cc'
24136 cccdlflags='$cccdlflags'
24137 ccdlflags='$ccdlflags'
24138 ccflags='$ccflags'
24139 ccflags_uselargefiles='$ccflags_uselargefiles'
24140 ccname='$ccname'
24141 ccsymbols='$ccsymbols'
24142 ccversion='$ccversion'
24143 cf_by='$cf_by'
24144 cf_email='$cf_email'
24145 cf_time='$cf_time'
24146 charbits='$charbits'
24147 charsize='$charsize'
24148 chgrp='$chgrp'
24149 chmod='$chmod'
24150 chown='$chown'
24151 clocktype='$clocktype'
24152 comm='$comm'
24153 compress='$compress'
24154 contains='$contains'
24155 cp='$cp'
24156 cpio='$cpio'
24157 cpp='$cpp'
24158 cpp_stuff='$cpp_stuff'
24159 cppccsymbols='$cppccsymbols'
24160 cppflags='$cppflags'
24161 cpplast='$cpplast'
24162 cppminus='$cppminus'
24163 cpprun='$cpprun'
24164 cppstdin='$cppstdin'
24165 cppsymbols='$cppsymbols'
24166 crypt_r_proto='$crypt_r_proto'
24167 cryptlib='$cryptlib'
24168 csh='$csh'
24169 ctermid_r_proto='$ctermid_r_proto'
24170 ctime_r_proto='$ctime_r_proto'
24171 d_Gconvert='$d_Gconvert'
24172 d_PRIEUldbl='$d_PRIEUldbl'
24173 d_PRIFUldbl='$d_PRIFUldbl'
24174 d_PRIGUldbl='$d_PRIGUldbl'
24175 d_PRIXU64='$d_PRIXU64'
24176 d_PRId64='$d_PRId64'
24177 d_PRIeldbl='$d_PRIeldbl'
24178 d_PRIfldbl='$d_PRIfldbl'
24179 d_PRIgldbl='$d_PRIgldbl'
24180 d_PRIi64='$d_PRIi64'
24181 d_PRIo64='$d_PRIo64'
24182 d_PRIu64='$d_PRIu64'
24183 d_PRIx64='$d_PRIx64'
24184 d_SCNfldbl='$d_SCNfldbl'
24185 d__fwalk='$d__fwalk'
24186 d_access='$d_access'
24187 d_accessx='$d_accessx'
24188 d_acosh='$d_acosh'
24189 d_aintl='$d_aintl'
24190 d_alarm='$d_alarm'
24191 d_archlib='$d_archlib'
24192 d_asctime64='$d_asctime64'
24193 d_asctime_r='$d_asctime_r'
24194 d_asinh='$d_asinh'
24195 d_atanh='$d_atanh'
24196 d_atolf='$d_atolf'
24197 d_atoll='$d_atoll'
24198 d_attribute_deprecated='$d_attribute_deprecated'
24199 d_attribute_format='$d_attribute_format'
24200 d_attribute_malloc='$d_attribute_malloc'
24201 d_attribute_nonnull='$d_attribute_nonnull'
24202 d_attribute_noreturn='$d_attribute_noreturn'
24203 d_attribute_pure='$d_attribute_pure'
24204 d_attribute_unused='$d_attribute_unused'
24205 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24206 d_backtrace='$d_backtrace'
24207 d_bcmp='$d_bcmp'
24208 d_bcopy='$d_bcopy'
24209 d_bsd='$d_bsd'
24210 d_bsdgetpgrp='$d_bsdgetpgrp'
24211 d_bsdsetpgrp='$d_bsdsetpgrp'
24212 d_builtin_choose_expr='$d_builtin_choose_expr'
24213 d_builtin_expect='$d_builtin_expect'
24214 d_bzero='$d_bzero'
24215 d_c99_variadic_macros='$d_c99_variadic_macros'
24216 d_casti32='$d_casti32'
24217 d_castneg='$d_castneg'
24218 d_cbrt='$d_cbrt'
24219 d_charvspr='$d_charvspr'
24220 d_chown='$d_chown'
24221 d_chroot='$d_chroot'
24222 d_chsize='$d_chsize'
24223 d_class='$d_class'
24224 d_clearenv='$d_clearenv'
24225 d_closedir='$d_closedir'
24226 d_cmsghdr_s='$d_cmsghdr_s'
24227 d_const='$d_const'
24228 d_copysign='$d_copysign'
24229 d_copysignl='$d_copysignl'
24230 d_cplusplus='$d_cplusplus'
24231 d_crypt='$d_crypt'
24232 d_crypt_r='$d_crypt_r'
24233 d_csh='$d_csh'
24234 d_ctermid='$d_ctermid'
24235 d_ctermid_r='$d_ctermid_r'
24236 d_ctime64='$d_ctime64'
24237 d_ctime_r='$d_ctime_r'
24238 d_cuserid='$d_cuserid'
24239 d_dbl_dig='$d_dbl_dig'
24240 d_dbminitproto='$d_dbminitproto'
24241 d_difftime64='$d_difftime64'
24242 d_difftime='$d_difftime'
24243 d_dir_dd_fd='$d_dir_dd_fd'
24244 d_dirfd='$d_dirfd'
24245 d_dirnamlen='$d_dirnamlen'
24246 d_dladdr='$d_dladdr'
24247 d_dlerror='$d_dlerror'
24248 d_dlopen='$d_dlopen'
24249 d_dlsymun='$d_dlsymun'
24250 d_dosuid='$d_dosuid'
24251 d_drand48_r='$d_drand48_r'
24252 d_drand48proto='$d_drand48proto'
24253 d_dup2='$d_dup2'
24254 d_eaccess='$d_eaccess'
24255 d_endgrent='$d_endgrent'
24256 d_endgrent_r='$d_endgrent_r'
24257 d_endhent='$d_endhent'
24258 d_endhostent_r='$d_endhostent_r'
24259 d_endnent='$d_endnent'
24260 d_endnetent_r='$d_endnetent_r'
24261 d_endpent='$d_endpent'
24262 d_endprotoent_r='$d_endprotoent_r'
24263 d_endpwent='$d_endpwent'
24264 d_endpwent_r='$d_endpwent_r'
24265 d_endsent='$d_endsent'
24266 d_endservent_r='$d_endservent_r'
24267 d_eofnblk='$d_eofnblk'
24268 d_erf='$d_erf'
24269 d_erfc='$d_erfc'
24270 d_eunice='$d_eunice'
24271 d_exp2='$d_exp2'
24272 d_expm1='$d_expm1'
24273 d_faststdio='$d_faststdio'
24274 d_fchdir='$d_fchdir'
24275 d_fchmod='$d_fchmod'
24276 d_fchown='$d_fchown'
24277 d_fcntl='$d_fcntl'
24278 d_fcntl_can_lock='$d_fcntl_can_lock'
24279 d_fd_macros='$d_fd_macros'
24280 d_fd_set='$d_fd_set'
24281 d_fdclose='$d_fdclose'
24282 d_fdim='$d_fdim'
24283 d_fds_bits='$d_fds_bits'
24284 d_fegetround='$d_fegetround'
24285 d_fgetpos='$d_fgetpos'
24286 d_finite='$d_finite'
24287 d_finitel='$d_finitel'
24288 d_flexfnam='$d_flexfnam'
24289 d_flock='$d_flock'
24290 d_flockproto='$d_flockproto'
24291 d_fma='$d_fma'
24292 d_fmax='$d_fmax'
24293 d_fmin='$d_fmin'
24294 d_fork='$d_fork'
24295 d_fp_class='$d_fp_class'
24296 d_fp_classify='$d_fp_classify'
24297 d_fp_classl='$d_fp_classl'
24298 d_fpathconf='$d_fpathconf'
24299 d_fpclass='$d_fpclass'
24300 d_fpclassify='$d_fpclassify'
24301 d_fpclassl='$d_fpclassl'
24302 d_fpgetround='$d_fpgetround'
24303 d_fpos64_t='$d_fpos64_t'
24304 d_frexpl='$d_frexpl'
24305 d_fs_data_s='$d_fs_data_s'
24306 d_fseeko='$d_fseeko'
24307 d_fsetpos='$d_fsetpos'
24308 d_fstatfs='$d_fstatfs'
24309 d_fstatvfs='$d_fstatvfs'
24310 d_fsync='$d_fsync'
24311 d_ftello='$d_ftello'
24312 d_ftime='$d_ftime'
24313 d_futimes='$d_futimes'
24314 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24315 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24316 d_getaddrinfo='$d_getaddrinfo'
24317 d_getcwd='$d_getcwd'
24318 d_getespwnam='$d_getespwnam'
24319 d_getfsstat='$d_getfsstat'
24320 d_getgrent='$d_getgrent'
24321 d_getgrent_r='$d_getgrent_r'
24322 d_getgrgid_r='$d_getgrgid_r'
24323 d_getgrnam_r='$d_getgrnam_r'
24324 d_getgrps='$d_getgrps'
24325 d_gethbyaddr='$d_gethbyaddr'
24326 d_gethbyname='$d_gethbyname'
24327 d_gethent='$d_gethent'
24328 d_gethname='$d_gethname'
24329 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24330 d_gethostbyname_r='$d_gethostbyname_r'
24331 d_gethostent_r='$d_gethostent_r'
24332 d_gethostprotos='$d_gethostprotos'
24333 d_getitimer='$d_getitimer'
24334 d_getlogin='$d_getlogin'
24335 d_getlogin_r='$d_getlogin_r'
24336 d_getmnt='$d_getmnt'
24337 d_getmntent='$d_getmntent'
24338 d_getnameinfo='$d_getnameinfo'
24339 d_getnbyaddr='$d_getnbyaddr'
24340 d_getnbyname='$d_getnbyname'
24341 d_getnent='$d_getnent'
24342 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24343 d_getnetbyname_r='$d_getnetbyname_r'
24344 d_getnetent_r='$d_getnetent_r'
24345 d_getnetprotos='$d_getnetprotos'
24346 d_getpagsz='$d_getpagsz'
24347 d_getpbyname='$d_getpbyname'
24348 d_getpbynumber='$d_getpbynumber'
24349 d_getpent='$d_getpent'
24350 d_getpgid='$d_getpgid'
24351 d_getpgrp2='$d_getpgrp2'
24352 d_getpgrp='$d_getpgrp'
24353 d_getppid='$d_getppid'
24354 d_getprior='$d_getprior'
24355 d_getprotobyname_r='$d_getprotobyname_r'
24356 d_getprotobynumber_r='$d_getprotobynumber_r'
24357 d_getprotoent_r='$d_getprotoent_r'
24358 d_getprotoprotos='$d_getprotoprotos'
24359 d_getprpwnam='$d_getprpwnam'
24360 d_getpwent='$d_getpwent'
24361 d_getpwent_r='$d_getpwent_r'
24362 d_getpwnam_r='$d_getpwnam_r'
24363 d_getpwuid_r='$d_getpwuid_r'
24364 d_getsbyname='$d_getsbyname'
24365 d_getsbyport='$d_getsbyport'
24366 d_getsent='$d_getsent'
24367 d_getservbyname_r='$d_getservbyname_r'
24368 d_getservbyport_r='$d_getservbyport_r'
24369 d_getservent_r='$d_getservent_r'
24370 d_getservprotos='$d_getservprotos'
24371 d_getspnam='$d_getspnam'
24372 d_getspnam_r='$d_getspnam_r'
24373 d_gettimeod='$d_gettimeod'
24374 d_gmtime64='$d_gmtime64'
24375 d_gmtime_r='$d_gmtime_r'
24376 d_gnulibc='$d_gnulibc'
24377 d_grpasswd='$d_grpasswd'
24378 d_hasmntopt='$d_hasmntopt'
24379 d_htonl='$d_htonl'
24380 d_hypot='$d_hypot'
24381 d_ilogb='$d_ilogb'
24382 d_ilogbl='$d_ilogbl'
24383 d_inc_version_list='$d_inc_version_list'
24384 d_index='$d_index'
24385 d_inetaton='$d_inetaton'
24386 d_inetntop='$d_inetntop'
24387 d_inetpton='$d_inetpton'
24388 d_int64_t='$d_int64_t'
24389 d_ip_mreq='$d_ip_mreq'
24390 d_ip_mreq_source='$d_ip_mreq_source'
24391 d_ipv6_mreq='$d_ipv6_mreq'
24392 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24393 d_isascii='$d_isascii'
24394 d_isblank='$d_isblank'
24395 d_isfinite='$d_isfinite'
24396 d_isfinitel='$d_isfinitel'
24397 d_isinf='$d_isinf'
24398 d_isinfl='$d_isinfl'
24399 d_isless='$d_isless'
24400 d_isnan='$d_isnan'
24401 d_isnanl='$d_isnanl'
24402 d_isnormal='$d_isnormal'
24403 d_j0='$d_j0'
24404 d_j0l='$d_j0l'
24405 d_killpg='$d_killpg'
24406 d_lc_monetary_2008='$d_lc_monetary_2008'
24407 d_lchown='$d_lchown'
24408 d_ldbl_dig='$d_ldbl_dig'
24409 d_ldexpl='$d_ldexpl'
24410 d_lgamma='$d_lgamma'
24411 d_lgamma_r='$d_lgamma_r'
24412 d_libm_lib_version='$d_libm_lib_version'
24413 d_libname_unique='$d_libname_unique'
24414 d_link='$d_link'
24415 d_llrint='$d_llrint'
24416 d_llrintl='$d_llrintl'
24417 d_llround='$d_llround'
24418 d_llroundl='$d_llroundl'
24419 d_localtime64='$d_localtime64'
24420 d_localtime_r='$d_localtime_r'
24421 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24422 d_locconv='$d_locconv'
24423 d_lockf='$d_lockf'
24424 d_log1p='$d_log1p'
24425 d_log2='$d_log2'
24426 d_logb='$d_logb'
24427 d_longdbl='$d_longdbl'
24428 d_longlong='$d_longlong'
24429 d_lrint='$d_lrint'
24430 d_lrintl='$d_lrintl'
24431 d_lround='$d_lround'
24432 d_lroundl='$d_lroundl'
24433 d_lseekproto='$d_lseekproto'
24434 d_lstat='$d_lstat'
24435 d_madvise='$d_madvise'
24436 d_malloc_good_size='$d_malloc_good_size'
24437 d_malloc_size='$d_malloc_size'
24438 d_mblen='$d_mblen'
24439 d_mbstowcs='$d_mbstowcs'
24440 d_mbtowc='$d_mbtowc'
24441 d_memchr='$d_memchr'
24442 d_memcmp='$d_memcmp'
24443 d_memcpy='$d_memcpy'
24444 d_memmove='$d_memmove'
24445 d_memset='$d_memset'
24446 d_mkdir='$d_mkdir'
24447 d_mkdtemp='$d_mkdtemp'
24448 d_mkfifo='$d_mkfifo'
24449 d_mkstemp='$d_mkstemp'
24450 d_mkstemps='$d_mkstemps'
24451 d_mktime64='$d_mktime64'
24452 d_mktime='$d_mktime'
24453 d_mmap='$d_mmap'
24454 d_modfl='$d_modfl'
24455 d_modfl_pow32_bug='$d_modfl_pow32_bug'
24456 d_modflproto='$d_modflproto'
24457 d_mprotect='$d_mprotect'
24458 d_msg='$d_msg'
24459 d_msg_ctrunc='$d_msg_ctrunc'
24460 d_msg_dontroute='$d_msg_dontroute'
24461 d_msg_oob='$d_msg_oob'
24462 d_msg_peek='$d_msg_peek'
24463 d_msg_proxy='$d_msg_proxy'
24464 d_msgctl='$d_msgctl'
24465 d_msgget='$d_msgget'
24466 d_msghdr_s='$d_msghdr_s'
24467 d_msgrcv='$d_msgrcv'
24468 d_msgsnd='$d_msgsnd'
24469 d_msync='$d_msync'
24470 d_munmap='$d_munmap'
24471 d_mymalloc='$d_mymalloc'
24472 d_nan='$d_nan'
24473 d_ndbm='$d_ndbm'
24474 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24475 d_nearbyint='$d_nearbyint'
24476 d_nextafter='$d_nextafter'
24477 d_nexttoward='$d_nexttoward'
24478 d_nice='$d_nice'
24479 d_nl_langinfo='$d_nl_langinfo'
24480 d_nv_preserves_uv='$d_nv_preserves_uv'
24481 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24482 d_off64_t='$d_off64_t'
24483 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24484 d_oldpthreads='$d_oldpthreads'
24485 d_oldsock='$d_oldsock'
24486 d_open3='$d_open3'
24487 d_pathconf='$d_pathconf'
24488 d_pause='$d_pause'
24489 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24490 d_phostname='$d_phostname'
24491 d_pipe='$d_pipe'
24492 d_poll='$d_poll'
24493 d_portable='$d_portable'
24494 d_prctl='$d_prctl'
24495 d_prctl_set_name='$d_prctl_set_name'
24496 d_printf_format_null='$d_printf_format_null'
24497 d_procselfexe='$d_procselfexe'
24498 d_pseudofork='$d_pseudofork'
24499 d_pthread_atfork='$d_pthread_atfork'
24500 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24501 d_pthread_yield='$d_pthread_yield'
24502 d_ptrdiff_t='$d_ptrdiff_t'
24503 d_pwage='$d_pwage'
24504 d_pwchange='$d_pwchange'
24505 d_pwclass='$d_pwclass'
24506 d_pwcomment='$d_pwcomment'
24507 d_pwexpire='$d_pwexpire'
24508 d_pwgecos='$d_pwgecos'
24509 d_pwpasswd='$d_pwpasswd'
24510 d_pwquota='$d_pwquota'
24511 d_qgcvt='$d_qgcvt'
24512 d_quad='$d_quad'
24513 d_random_r='$d_random_r'
24514 d_re_comp='$d_re_comp'
24515 d_readdir64_r='$d_readdir64_r'
24516 d_readdir='$d_readdir'
24517 d_readdir_r='$d_readdir_r'
24518 d_readlink='$d_readlink'
24519 d_readv='$d_readv'
24520 d_recvmsg='$d_recvmsg'
24521 d_regcmp='$d_regcmp'
24522 d_regcomp='$d_regcomp'
24523 d_remainder='$d_remainder'
24524 d_remquo='$d_remquo'
24525 d_rename='$d_rename'
24526 d_rewinddir='$d_rewinddir'
24527 d_rint='$d_rint'
24528 d_rmdir='$d_rmdir'
24529 d_round='$d_round'
24530 d_safebcpy='$d_safebcpy'
24531 d_safemcpy='$d_safemcpy'
24532 d_sanemcmp='$d_sanemcmp'
24533 d_sbrkproto='$d_sbrkproto'
24534 d_scalbn='$d_scalbn'
24535 d_scalbnl='$d_scalbnl'
24536 d_sched_yield='$d_sched_yield'
24537 d_scm_rights='$d_scm_rights'
24538 d_seekdir='$d_seekdir'
24539 d_select='$d_select'
24540 d_sem='$d_sem'
24541 d_semctl='$d_semctl'
24542 d_semctl_semid_ds='$d_semctl_semid_ds'
24543 d_semctl_semun='$d_semctl_semun'
24544 d_semget='$d_semget'
24545 d_semop='$d_semop'
24546 d_sendmsg='$d_sendmsg'
24547 d_setegid='$d_setegid'
24548 d_seteuid='$d_seteuid'
24549 d_setgrent='$d_setgrent'
24550 d_setgrent_r='$d_setgrent_r'
24551 d_setgrps='$d_setgrps'
24552 d_sethent='$d_sethent'
24553 d_sethostent_r='$d_sethostent_r'
24554 d_setitimer='$d_setitimer'
24555 d_setlinebuf='$d_setlinebuf'
24556 d_setlocale='$d_setlocale'
24557 d_setlocale_r='$d_setlocale_r'
24558 d_setnent='$d_setnent'
24559 d_setnetent_r='$d_setnetent_r'
24560 d_setpent='$d_setpent'
24561 d_setpgid='$d_setpgid'
24562 d_setpgrp2='$d_setpgrp2'
24563 d_setpgrp='$d_setpgrp'
24564 d_setprior='$d_setprior'
24565 d_setproctitle='$d_setproctitle'
24566 d_setprotoent_r='$d_setprotoent_r'
24567 d_setpwent='$d_setpwent'
24568 d_setpwent_r='$d_setpwent_r'
24569 d_setregid='$d_setregid'
24570 d_setresgid='$d_setresgid'
24571 d_setresuid='$d_setresuid'
24572 d_setreuid='$d_setreuid'
24573 d_setrgid='$d_setrgid'
24574 d_setruid='$d_setruid'
24575 d_setsent='$d_setsent'
24576 d_setservent_r='$d_setservent_r'
24577 d_setsid='$d_setsid'
24578 d_setvbuf='$d_setvbuf'
24579 d_shm='$d_shm'
24580 d_shmat='$d_shmat'
24581 d_shmatprototype='$d_shmatprototype'
24582 d_shmctl='$d_shmctl'
24583 d_shmdt='$d_shmdt'
24584 d_shmget='$d_shmget'
24585 d_sigaction='$d_sigaction'
24586 d_siginfo_si_errno='$d_siginfo_si_errno'
24587 d_siginfo_si_pid='$d_siginfo_si_pid'
24588 d_siginfo_si_uid='$d_siginfo_si_uid'
24589 d_siginfo_si_addr='$d_siginfo_si_addr'
24590 d_siginfo_si_status='$d_siginfo_si_status'
24591 d_siginfo_si_band='$d_siginfo_si_band'
24592 d_siginfo_si_value='$d_siginfo_si_value'
24593 d_signbit='$d_signbit'
24594 d_sigprocmask='$d_sigprocmask'
24595 d_sigsetjmp='$d_sigsetjmp'
24596 d_sin6_scope_id='$d_sin6_scope_id'
24597 d_sitearch='$d_sitearch'
24598 d_snprintf='$d_snprintf'
24599 d_sockaddr_in6='$d_sockaddr_in6'
24600 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24601 d_sockatmark='$d_sockatmark'
24602 d_sockatmarkproto='$d_sockatmarkproto'
24603 d_socket='$d_socket'
24604 d_socklen_t='$d_socklen_t'
24605 d_sockpair='$d_sockpair'
24606 d_socks5_init='$d_socks5_init'
24607 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24608 d_sqrtl='$d_sqrtl'
24609 d_srand48_r='$d_srand48_r'
24610 d_srandom_r='$d_srandom_r'
24611 d_sresgproto='$d_sresgproto'
24612 d_sresuproto='$d_sresuproto'
24613 d_stat='$d_stat'
24614 d_statblks='$d_statblks'
24615 d_statfs_f_flags='$d_statfs_f_flags'
24616 d_statfs_s='$d_statfs_s'
24617 d_static_inline='$d_static_inline'
24618 d_statvfs='$d_statvfs'
24619 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24620 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24621 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24622 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24623 d_stdio_stream_array='$d_stdio_stream_array'
24624 d_stdiobase='$d_stdiobase'
24625 d_stdstdio='$d_stdstdio'
24626 d_strchr='$d_strchr'
24627 d_strcoll='$d_strcoll'
24628 d_strctcpy='$d_strctcpy'
24629 d_strerrm='$d_strerrm'
24630 d_strerror='$d_strerror'
24631 d_strerror_r='$d_strerror_r'
24632 d_strftime='$d_strftime'
24633 d_strlcat='$d_strlcat'
24634 d_strlcpy='$d_strlcpy'
24635 d_strtod='$d_strtod'
24636 d_strtol='$d_strtol'
24637 d_strtold='$d_strtold'
24638 d_strtoll='$d_strtoll'
24639 d_strtoq='$d_strtoq'
24640 d_strtoul='$d_strtoul'
24641 d_strtoull='$d_strtoull'
24642 d_strtouq='$d_strtouq'
24643 d_strxfrm='$d_strxfrm'
24644 d_suidsafe='$d_suidsafe'
24645 d_symlink='$d_symlink'
24646 d_syscall='$d_syscall'
24647 d_syscallproto='$d_syscallproto'
24648 d_sysconf='$d_sysconf'
24649 d_sysernlst='$d_sysernlst'
24650 d_syserrlst='$d_syserrlst'
24651 d_system='$d_system'
24652 d_tcgetpgrp='$d_tcgetpgrp'
24653 d_tcsetpgrp='$d_tcsetpgrp'
24654 d_telldir='$d_telldir'
24655 d_telldirproto='$d_telldirproto'
24656 d_tgamma='$d_tgamma'
24657 d_time='$d_time'
24658 d_timegm='$d_timegm'
24659 d_times='$d_times'
24660 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24661 d_tm_tm_zone='$d_tm_tm_zone'
24662 d_tmpnam_r='$d_tmpnam_r'
24663 d_trunc='$d_trunc'
24664 d_truncate='$d_truncate'
24665 d_truncl='$d_truncl'
24666 d_ttyname_r='$d_ttyname_r'
24667 d_tzname='$d_tzname'
24668 d_u32align='$d_u32align'
24669 d_ualarm='$d_ualarm'
24670 d_umask='$d_umask'
24671 d_uname='$d_uname'
24672 d_union_semun='$d_union_semun'
24673 d_unordered='$d_unordered'
24674 d_unsetenv='$d_unsetenv'
24675 d_usleep='$d_usleep'
24676 d_usleepproto='$d_usleepproto'
24677 d_ustat='$d_ustat'
24678 d_vendorarch='$d_vendorarch'
24679 d_vendorbin='$d_vendorbin'
24680 d_vendorlib='$d_vendorlib'
24681 d_vendorscript='$d_vendorscript'
24682 d_vfork='$d_vfork'
24683 d_void_closedir='$d_void_closedir'
24684 d_voidsig='$d_voidsig'
24685 d_voidtty='$d_voidtty'
24686 d_volatile='$d_volatile'
24687 d_vprintf='$d_vprintf'
24688 d_vsnprintf='$d_vsnprintf'
24689 d_wait4='$d_wait4'
24690 d_waitpid='$d_waitpid'
24691 d_wcscmp='$d_wcscmp'
24692 d_wcstombs='$d_wcstombs'
24693 d_wcsxfrm='$d_wcsxfrm'
24694 d_wctomb='$d_wctomb'
24695 d_writev='$d_writev'
24696 d_xenix='$d_xenix'
24697 date='$date'
24698 db_hashtype='$db_hashtype'
24699 db_prefixtype='$db_prefixtype'
24700 db_version_major='$db_version_major'
24701 db_version_minor='$db_version_minor'
24702 db_version_patch='$db_version_patch'
24703 direntrytype='$direntrytype'
24704 dlext='$dlext'
24705 dlsrc='$dlsrc'
24706 doubleinfbytes='$doubleinfbytes'
24707 doublekind='$doublekind'
24708 doublemantbits='$doublemantbits'
24709 doublenanbytes='$doublenanbytes'
24710 doublesize='$doublesize'
24711 drand01='$drand01'
24712 drand48_r_proto='$drand48_r_proto'
24713 dtrace='$dtrace'
24714 dynamic_ext='$dynamic_ext'
24715 eagain='$eagain'
24716 ebcdic='$ebcdic'
24717 echo='$echo'
24718 egrep='$egrep'
24719 emacs='$emacs'
24720 endgrent_r_proto='$endgrent_r_proto'
24721 endhostent_r_proto='$endhostent_r_proto'
24722 endnetent_r_proto='$endnetent_r_proto'
24723 endprotoent_r_proto='$endprotoent_r_proto'
24724 endpwent_r_proto='$endpwent_r_proto'
24725 endservent_r_proto='$endservent_r_proto'
24726 eunicefix='$eunicefix'
24727 exe_ext='$exe_ext'
24728 expr='$expr'
24729 extensions='$extensions'
24730 extern_C='$extern_C'
24731 extras='$extras'
24732 fflushNULL='$fflushNULL'
24733 fflushall='$fflushall'
24734 find='$find'
24735 firstmakefile='$firstmakefile'
24736 flex='$flex'
24737 fpossize='$fpossize'
24738 fpostype='$fpostype'
24739 freetype='$freetype'
24740 from='$from'
24741 full_ar='$full_ar'
24742 full_csh='$full_csh'
24743 full_sed='$full_sed'
24744 gccansipedantic='$gccansipedantic'
24745 gccosandvers='$gccosandvers'
24746 gccversion='$gccversion'
24747 getgrent_r_proto='$getgrent_r_proto'
24748 getgrgid_r_proto='$getgrgid_r_proto'
24749 getgrnam_r_proto='$getgrnam_r_proto'
24750 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24751 gethostbyname_r_proto='$gethostbyname_r_proto'
24752 gethostent_r_proto='$gethostent_r_proto'
24753 getlogin_r_proto='$getlogin_r_proto'
24754 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24755 getnetbyname_r_proto='$getnetbyname_r_proto'
24756 getnetent_r_proto='$getnetent_r_proto'
24757 getprotobyname_r_proto='$getprotobyname_r_proto'
24758 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24759 getprotoent_r_proto='$getprotoent_r_proto'
24760 getpwent_r_proto='$getpwent_r_proto'
24761 getpwnam_r_proto='$getpwnam_r_proto'
24762 getpwuid_r_proto='$getpwuid_r_proto'
24763 getservbyname_r_proto='$getservbyname_r_proto'
24764 getservbyport_r_proto='$getservbyport_r_proto'
24765 getservent_r_proto='$getservent_r_proto'
24766 getspnam_r_proto='$getspnam_r_proto'
24767 gidformat='$gidformat'
24768 gidsign='$gidsign'
24769 gidsize='$gidsize'
24770 gidtype='$gidtype'
24771 glibpth='$glibpth'
24772 gmake='$gmake'
24773 gmtime_r_proto='$gmtime_r_proto'
24774 gnulibc_version='$gnulibc_version'
24775 grep='$grep'
24776 groupcat='$groupcat'
24777 groupstype='$groupstype'
24778 gzip='$gzip'
24779 h_fcntl='$h_fcntl'
24780 h_sysfile='$h_sysfile'
24781 hint='$hint'
24782 hostcat='$hostcat'
24783 hostgenerate='$hostgenerate'
24784 hostosname='$hostosname'
24785 hostperl='$hostperl'
24786 html1dir='$html1dir'
24787 html1direxp='$html1direxp'
24788 html3dir='$html3dir'
24789 html3direxp='$html3direxp'
24790 i16size='$i16size'
24791 i16type='$i16type'
24792 i32size='$i32size'
24793 i32type='$i32type'
24794 i64size='$i64size'
24795 i64type='$i64type'
24796 i8size='$i8size'
24797 i8type='$i8type'
24798 i_arpainet='$i_arpainet'
24799 i_assert='$i_assert'
24800 i_bfd='$i_bfd'
24801 i_bsdioctl='$i_bsdioctl'
24802 i_crypt='$i_crypt'
24803 i_db='$i_db'
24804 i_dbm='$i_dbm'
24805 i_dirent='$i_dirent'
24806 i_dlfcn='$i_dlfcn'
24807 i_execinfo='$i_execinfo'
24808 i_fcntl='$i_fcntl'
24809 i_fenv='$i_fenv'
24810 i_float='$i_float'
24811 i_fp='$i_fp'
24812 i_fp_class='$i_fp_class'
24813 i_gdbm='$i_gdbm'
24814 i_gdbm_ndbm='$i_gdbm_ndbm'
24815 i_gdbmndbm='$i_gdbmndbm'
24816 i_grp='$i_grp'
24817 i_ieeefp='$i_ieeefp'
24818 i_inttypes='$i_inttypes'
24819 i_langinfo='$i_langinfo'
24820 i_libutil='$i_libutil'
24821 i_limits='$i_limits'
24822 i_locale='$i_locale'
24823 i_machcthr='$i_machcthr'
24824 i_malloc='$i_malloc'
24825 i_mallocmalloc='$i_mallocmalloc'
24826 i_math='$i_math'
24827 i_memory='$i_memory'
24828 i_mntent='$i_mntent'
24829 i_ndbm='$i_ndbm'
24830 i_netdb='$i_netdb'
24831 i_neterrno='$i_neterrno'
24832 i_netinettcp='$i_netinettcp'
24833 i_niin='$i_niin'
24834 i_poll='$i_poll'
24835 i_prot='$i_prot'
24836 i_pthread='$i_pthread'
24837 i_pwd='$i_pwd'
24838 i_quadmath='$i_quadmath'
24839 i_rpcsvcdbm='$i_rpcsvcdbm'
24840 i_sgtty='$i_sgtty'
24841 i_shadow='$i_shadow'
24842 i_socks='$i_socks'
24843 i_stdarg='$i_stdarg'
24844 i_stdbool='$i_stdbool'
24845 i_stddef='$i_stddef'
24846 i_stdint='$i_stdint'
24847 i_stdlib='$i_stdlib'
24848 i_string='$i_string'
24849 i_sunmath='$i_sunmath'
24850 i_sysaccess='$i_sysaccess'
24851 i_sysdir='$i_sysdir'
24852 i_sysfile='$i_sysfile'
24853 i_sysfilio='$i_sysfilio'
24854 i_sysin='$i_sysin'
24855 i_sysioctl='$i_sysioctl'
24856 i_syslog='$i_syslog'
24857 i_sysmman='$i_sysmman'
24858 i_sysmode='$i_sysmode'
24859 i_sysmount='$i_sysmount'
24860 i_sysndir='$i_sysndir'
24861 i_sysparam='$i_sysparam'
24862 i_syspoll='$i_syspoll'
24863 i_sysresrc='$i_sysresrc'
24864 i_syssecrt='$i_syssecrt'
24865 i_sysselct='$i_sysselct'
24866 i_syssockio='$i_syssockio'
24867 i_sysstat='$i_sysstat'
24868 i_sysstatfs='$i_sysstatfs'
24869 i_sysstatvfs='$i_sysstatvfs'
24870 i_systime='$i_systime'
24871 i_systimek='$i_systimek'
24872 i_systimes='$i_systimes'
24873 i_systypes='$i_systypes'
24874 i_sysuio='$i_sysuio'
24875 i_sysun='$i_sysun'
24876 i_sysutsname='$i_sysutsname'
24877 i_sysvfs='$i_sysvfs'
24878 i_syswait='$i_syswait'
24879 i_termio='$i_termio'
24880 i_termios='$i_termios'
24881 i_time='$i_time'
24882 i_unistd='$i_unistd'
24883 i_ustat='$i_ustat'
24884 i_utime='$i_utime'
24885 i_values='$i_values'
24886 i_varargs='$i_varargs'
24887 i_varhdr='$i_varhdr'
24888 i_vfork='$i_vfork'
24889 ignore_versioned_solibs='$ignore_versioned_solibs'
24890 inc_version_list='$inc_version_list'
24891 inc_version_list_init='$inc_version_list_init'
24892 incpath='$incpath'
24893 incpth='$incpth'
24894 inews='$inews'
24895 initialinstalllocation='$initialinstalllocation'
24896 installarchlib='$installarchlib'
24897 installbin='$installbin'
24898 installhtml1dir='$installhtml1dir'
24899 installhtml3dir='$installhtml3dir'
24900 installman1dir='$installman1dir'
24901 installman3dir='$installman3dir'
24902 installprefix='$installprefix'
24903 installprefixexp='$installprefixexp'
24904 installprivlib='$installprivlib'
24905 installscript='$installscript'
24906 installsitearch='$installsitearch'
24907 installsitebin='$installsitebin'
24908 installsitehtml1dir='$installsitehtml1dir'
24909 installsitehtml3dir='$installsitehtml3dir'
24910 installsitelib='$installsitelib'
24911 installsiteman1dir='$installsiteman1dir'
24912 installsiteman3dir='$installsiteman3dir'
24913 installsitescript='$installsitescript'
24914 installstyle='$installstyle'
24915 installusrbinperl='$installusrbinperl'
24916 installvendorarch='$installvendorarch'
24917 installvendorbin='$installvendorbin'
24918 installvendorhtml1dir='$installvendorhtml1dir'
24919 installvendorhtml3dir='$installvendorhtml3dir'
24920 installvendorlib='$installvendorlib'
24921 installvendorman1dir='$installvendorman1dir'
24922 installvendorman3dir='$installvendorman3dir'
24923 installvendorscript='$installvendorscript'
24924 intsize='$intsize'
24925 issymlink='$issymlink'
24926 ivdformat='$ivdformat'
24927 ivsize='$ivsize'
24928 ivtype='$ivtype'
24929 known_extensions='$known_extensions'
24930 ksh='$ksh'
24931 ld='$ld'
24932 ld_can_script='$ld_can_script'
24933 lddlflags='$lddlflags'
24934 ldflags='$ldflags'
24935 ldflags_uselargefiles='$ldflags_uselargefiles'
24936 ldlibpthname='$ldlibpthname'
24937 less='$less'
24938 lib_ext='$lib_ext'
24939 libc='$libc'
24940 libperl='$libperl'
24941 libpth='$libpth'
24942 libs='$libs'
24943 libsdirs='$libsdirs'
24944 libsfiles='$libsfiles'
24945 libsfound='$libsfound'
24946 libspath='$libspath'
24947 libswanted='$libswanted'
24948 libswanted_uselargefiles='$libswanted_uselargefiles'
24949 line='$line'
24950 lint='$lint'
24951 lkflags='$lkflags'
24952 ln='$ln'
24953 lns='$lns'
24954 localtime_r_proto='$localtime_r_proto'
24955 locincpth='$locincpth'
24956 loclibpth='$loclibpth'
24957 longdblinfbytes='$longdblinfbytes'
24958 longdblkind='$longdblkind'
24959 longdblmantbits='$longdblmantbits'
24960 longdblnanbytes='$longdblnanbytes'
24961 longdblsize='$longdblsize'
24962 longlongsize='$longlongsize'
24963 longsize='$longsize'
24964 lp='$lp'
24965 lpr='$lpr'
24966 ls='$ls'
24967 lseeksize='$lseeksize'
24968 lseektype='$lseektype'
24969 mail='$mail'
24970 mailx='$mailx'
24971 make='$make'
24972 make_set_make='$make_set_make'
24973 mallocobj='$mallocobj'
24974 mallocsrc='$mallocsrc'
24975 malloctype='$malloctype'
24976 man1dir='$man1dir'
24977 man1direxp='$man1direxp'
24978 man1ext='$man1ext'
24979 man3dir='$man3dir'
24980 man3direxp='$man3direxp'
24981 man3ext='$man3ext'
24982 mips_type='$mips_type'
24983 mistrustnm='$mistrustnm'
24984 mkdir='$mkdir'
24985 mmaptype='$mmaptype'
24986 modetype='$modetype'
24987 more='$more'
24988 multiarch='$multiarch'
24989 mv='$mv'
24990 myarchname='$myarchname'
24991 mydomain='$mydomain'
24992 myhostname='$myhostname'
24993 myuname='$myuname'
24994 n='$n'
24995 need_va_copy='$need_va_copy'
24996 netdb_hlen_type='$netdb_hlen_type'
24997 netdb_host_type='$netdb_host_type'
24998 netdb_name_type='$netdb_name_type'
24999 netdb_net_type='$netdb_net_type'
25000 nm='$nm'
25001 nm_opt='$nm_opt'
25002 nm_so_opt='$nm_so_opt'
25003 nonxs_ext='$nonxs_ext'
25004 nroff='$nroff'
25005 nvEUformat='$nvEUformat'
25006 nvFUformat='$nvFUformat'
25007 nvGUformat='$nvGUformat'
25008 nv_overflows_integers_at='$nv_overflows_integers_at'
25009 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25010 nveformat='$nveformat'
25011 nvfformat='$nvfformat'
25012 nvgformat='$nvgformat'
25013 nvmantbits='$nvmantbits'
25014 nvsize='$nvsize'
25015 nvtype='$nvtype'
25016 o_nonblock='$o_nonblock'
25017 obj_ext='$obj_ext'
25018 old_pthread_create_joinable='$old_pthread_create_joinable'
25019 optimize='$optimize'
25020 orderlib='$orderlib'
25021 osname='$osname'
25022 osvers='$osvers'
25023 otherlibdirs='$otherlibdirs'
25024 package='$package'
25025 pager='$pager'
25026 passcat='$passcat'
25027 patchlevel='$patchlevel'
25028 path_sep='$path_sep'
25029 perl5='$perl5'
25030 perl='$perl'
25031 perl_patchlevel='$perl_patchlevel'
25032 perl_static_inline='$perl_static_inline'
25033 perladmin='$perladmin'
25034 perllibs='$perllibs'
25035 perlpath='$perlpath'
25036 pg='$pg'
25037 phostname='$phostname'
25038 pidtype='$pidtype'
25039 plibpth='$plibpth'
25040 pmake='$pmake'
25041 pr='$pr'
25042 prefix='$prefix'
25043 prefixexp='$prefixexp'
25044 privlib='$privlib'
25045 privlibexp='$privlibexp'
25046 procselfexe='$procselfexe'
25047 prototype='$prototype'
25048 ptrsize='$ptrsize'
25049 quadkind='$quadkind'
25050 quadtype='$quadtype'
25051 randbits='$randbits'
25052 randfunc='$randfunc'
25053 random_r_proto='$random_r_proto'
25054 randseedtype='$randseedtype'
25055 ranlib='$ranlib'
25056 rd_nodata='$rd_nodata'
25057 readdir64_r_proto='$readdir64_r_proto'
25058 readdir_r_proto='$readdir_r_proto'
25059 revision='$revision'
25060 rm='$rm'
25061 rm_try='$rm_try'
25062 rmail='$rmail'
25063 run='$run'
25064 runnm='$runnm'
25065 sGMTIME_max='$sGMTIME_max'
25066 sGMTIME_min='$sGMTIME_min'
25067 sLOCALTIME_max='$sLOCALTIME_max'
25068 sLOCALTIME_min='$sLOCALTIME_min'
25069 sPRIEUldbl='$sPRIEUldbl'
25070 sPRIFUldbl='$sPRIFUldbl'
25071 sPRIGUldbl='$sPRIGUldbl'
25072 sPRIXU64='$sPRIXU64'
25073 sPRId64='$sPRId64'
25074 sPRIeldbl='$sPRIeldbl'
25075 sPRIfldbl='$sPRIfldbl'
25076 sPRIgldbl='$sPRIgldbl'
25077 sPRIi64='$sPRIi64'
25078 sPRIo64='$sPRIo64'
25079 sPRIu64='$sPRIu64'
25080 sPRIx64='$sPRIx64'
25081 sSCNfldbl='$sSCNfldbl'
25082 sched_yield='$sched_yield'
25083 scriptdir='$scriptdir'
25084 scriptdirexp='$scriptdirexp'
25085 sed='$sed'
25086 seedfunc='$seedfunc'
25087 selectminbits='$selectminbits'
25088 selecttype='$selecttype'
25089 sendmail='$sendmail'
25090 setgrent_r_proto='$setgrent_r_proto'
25091 sethostent_r_proto='$sethostent_r_proto'
25092 setlocale_r_proto='$setlocale_r_proto'
25093 setnetent_r_proto='$setnetent_r_proto'
25094 setprotoent_r_proto='$setprotoent_r_proto'
25095 setpwent_r_proto='$setpwent_r_proto'
25096 setservent_r_proto='$setservent_r_proto'
25097 sh='$sh'
25098 shar='$shar'
25099 sharpbang='$sharpbang'
25100 shmattype='$shmattype'
25101 shortsize='$shortsize'
25102 shrpenv='$shrpenv'
25103 shsharp='$shsharp'
25104 sig_count='$sig_count'
25105 sig_name='$sig_name'
25106 sig_name_init='$sig_name_init'
25107 sig_num='$sig_num'
25108 sig_num_init='$sig_num_init'
25109 sig_size='$sig_size'
25110 signal_t='$signal_t'
25111 sitearch='$sitearch'
25112 sitearchexp='$sitearchexp'
25113 sitebin='$sitebin'
25114 sitebinexp='$sitebinexp'
25115 sitehtml1dir='$sitehtml1dir'
25116 sitehtml1direxp='$sitehtml1direxp'
25117 sitehtml3dir='$sitehtml3dir'
25118 sitehtml3direxp='$sitehtml3direxp'
25119 sitelib='$sitelib'
25120 sitelib_stem='$sitelib_stem'
25121 sitelibexp='$sitelibexp'
25122 siteman1dir='$siteman1dir'
25123 siteman1direxp='$siteman1direxp'
25124 siteman3dir='$siteman3dir'
25125 siteman3direxp='$siteman3direxp'
25126 siteprefix='$siteprefix'
25127 siteprefixexp='$siteprefixexp'
25128 sitescript='$sitescript'
25129 sitescriptexp='$sitescriptexp'
25130 sizesize='$sizesize'
25131 sizetype='$sizetype'
25132 sleep='$sleep'
25133 smail='$smail'
25134 so='$so'
25135 sockethdr='$sockethdr'
25136 socketlib='$socketlib'
25137 socksizetype='$socksizetype'
25138 sort='$sort'
25139 spackage='$spackage'
25140 spitshell='$spitshell'
25141 srand48_r_proto='$srand48_r_proto'
25142 srandom_r_proto='$srandom_r_proto'
25143 src='$src'
25144 ssizetype='$ssizetype'
25145 st_ino_sign='$st_ino_sign'
25146 st_ino_size='$st_ino_size'
25147 startperl='$startperl'
25148 startsh='$startsh'
25149 static_ext='$static_ext'
25150 stdchar='$stdchar'
25151 stdio_base='$stdio_base'
25152 stdio_bufsiz='$stdio_bufsiz'
25153 stdio_cnt='$stdio_cnt'
25154 stdio_filbuf='$stdio_filbuf'
25155 stdio_ptr='$stdio_ptr'
25156 stdio_stream_array='$stdio_stream_array'
25157 strerror_r_proto='$strerror_r_proto'
25158 strings='$strings'
25159 submit='$submit'
25160 subversion='$subversion'
25161 sysman='$sysman'
25162 sysroot='$sysroot'
25163 tail='$tail'
25164 tar='$tar'
25165 targetarch='$targetarch'
25166 targetdir='$targetdir'
25167 targetenv='$targetenv'
25168 targethost='$targethost'
25169 targetmkdir='$targetmkdir'
25170 targetport='$targetport'
25171 targetsh='$targetsh'
25172 tbl='$tbl'
25173 tee='$tee'
25174 test='$test'
25175 timeincl='$timeincl'
25176 timetype='$timetype'
25177 tmpnam_r_proto='$tmpnam_r_proto'
25178 to='$to'
25179 touch='$touch'
25180 tr='$tr'
25181 trnl='$trnl'
25182 troff='$troff'
25183 ttyname_r_proto='$ttyname_r_proto'
25184 u16size='$u16size'
25185 u16type='$u16type'
25186 u32size='$u32size'
25187 u32type='$u32type'
25188 u64size='$u64size'
25189 u64type='$u64type'
25190 u8size='$u8size'
25191 u8type='$u8type'
25192 uidformat='$uidformat'
25193 uidsign='$uidsign'
25194 uidsize='$uidsize'
25195 uidtype='$uidtype'
25196 uname='$uname'
25197 uniq='$uniq'
25198 uquadtype='$uquadtype'
25199 use5005threads='$use5005threads'
25200 use64bitall='$use64bitall'
25201 use64bitint='$use64bitint'
25202 usecbacktrace='$usecbacktrace'
25203 usecrosscompile='$usecrosscompile'
25204 usedevel='$usedevel'
25205 usedl='$usedl'
25206 usedtrace='$usedtrace'
25207 usefaststdio='$usefaststdio'
25208 useithreads='$useithreads'
25209 usekernprocpathname='$usekernprocpathname'
25210 uselargefiles='$uselargefiles'
25211 uselongdouble='$uselongdouble'
25212 usemallocwrap='$usemallocwrap'
25213 usemorebits='$usemorebits'
25214 usemultiplicity='$usemultiplicity'
25215 usemymalloc='$usemymalloc'
25216 usenm='$usenm'
25217 usensgetexecutablepath='$usensgetexecutablepath'
25218 useopcode='$useopcode'
25219 useperlio='$useperlio'
25220 useposix='$useposix'
25221 usequadmath='$usequadmath'
25222 usereentrant='$usereentrant'
25223 userelocatableinc='$userelocatableinc'
25224 useshrplib='$useshrplib'
25225 usesitecustomize='$usesitecustomize'
25226 usesocks='$usesocks'
25227 usethreads='$usethreads'
25228 usevendorprefix='$usevendorprefix'
25229 useversionedarchname='$useversionedarchname'
25230 usevfork='$usevfork'
25231 usrinc='$usrinc'
25232 uuname='$uuname'
25233 uvXUformat='$uvXUformat'
25234 uvoformat='$uvoformat'
25235 uvsize='$uvsize'
25236 uvtype='$uvtype'
25237 uvuformat='$uvuformat'
25238 uvxformat='$uvxformat'
25239 vaproto='$vaproto'
25240 vendorarch='$vendorarch'
25241 vendorarchexp='$vendorarchexp'
25242 vendorbin='$vendorbin'
25243 vendorbinexp='$vendorbinexp'
25244 vendorhtml1dir='$vendorhtml1dir'
25245 vendorhtml1direxp='$vendorhtml1direxp'
25246 vendorhtml3dir='$vendorhtml3dir'
25247 vendorhtml3direxp='$vendorhtml3direxp'
25248 vendorlib='$vendorlib'
25249 vendorlib_stem='$vendorlib_stem'
25250 vendorlibexp='$vendorlibexp'
25251 vendorman1dir='$vendorman1dir'
25252 vendorman1direxp='$vendorman1direxp'
25253 vendorman3dir='$vendorman3dir'
25254 vendorman3direxp='$vendorman3direxp'
25255 vendorprefix='$vendorprefix'
25256 vendorprefixexp='$vendorprefixexp'
25257 vendorscript='$vendorscript'
25258 vendorscriptexp='$vendorscriptexp'
25259 version='$version'
25260 version_patchlevel_string='$version_patchlevel_string'
25261 versiononly='$versiononly'
25262 vi='$vi'
25263 xlibpth='$xlibpth'
25264 yacc='$yacc'
25265 yaccflags='$yaccflags'
25266 zcat='$zcat'
25267 zip='$zip'
25268 EOT
25269
25270 : add special variables
25271 $test -f $src/patchlevel.h && \
25272 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25273 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25274 echo "PERL_CONFIG_SH=true" >>config.sh
25275
25276 : propagate old symbols
25277 if $test -f UU/config.sh; then
25278         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25279         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25280                 config.sh config.sh UU/oldconfig.sh |\
25281                 $sort | $uniq -u >UU/oldsyms
25282         set X `$cat UU/oldsyms`
25283         shift
25284         case $# in
25285         0) ;;
25286         *)
25287                 $cat <<EOM
25288 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25289 EOM
25290                 echo ": Variables propagated from previous config.sh file." >>config.sh
25291                 for sym in `$cat UU/oldsyms`; do
25292                         echo "    Propagating $hint variable "'$'"$sym..."
25293                         eval 'tmp="$'"${sym}"'"'
25294                         echo "$tmp" | \
25295                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25296                 done
25297                 ;;
25298         esac
25299 fi
25300
25301 : preserve RCS keywords in files with variable substitution, grrr
25302 Id='$Id'
25303
25304 : Finish up by extracting the .SH files
25305 case "$alldone" in
25306 exit)
25307         $rm -rf UU
25308         echo "Extraction done."
25309         exit 0
25310         ;;
25311 cont)
25312         ;;
25313 '')
25314         dflt=''
25315         nostick=true
25316         $cat <<EOM
25317
25318 If you'd like to make any changes to the config.sh file before I begin
25319 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25320
25321 EOM
25322         rp="Press return or use a shell escape to edit config.sh:"
25323         . UU/myread
25324         nostick=''
25325         case "$ans" in
25326         '') ;;
25327         *) : in case they cannot read
25328                 sh 1>&4 -c "$ans";;
25329         esac
25330         ;;
25331 esac
25332
25333 : if this fails, just run all the .SH files by hand
25334 . ./config.sh
25335
25336 echo " "
25337 exec 1>&4
25338 pwd=`pwd`
25339 . ./UU/extract
25340 cd "$pwd"
25341
25342 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25343         dflt=y
25344         case "$silent" in
25345         true) ;;
25346         *)
25347                 $cat <<EOM
25348
25349 Now you need to generate make dependencies by running "$make depend".
25350 You might prefer to run it in background: "$make depend > makedepend.out &"
25351 It can take a while, so you might not want to run it right now.
25352
25353 EOM
25354                 ;;
25355         esac
25356         rp="Run $make depend now?"
25357         . UU/myread
25358         case "$ans" in
25359         y*)
25360                 $make depend && echo "Now you must run '$make'."
25361                 ;;
25362         *)
25363                 echo "You must run '$make depend' then '$make'."
25364                 ;;
25365         esac
25366 elif test -f [Mm]akefile; then
25367         echo " "
25368         echo "Now you must run a $make."
25369 else
25370         echo "Configure done."
25371 fi
25372
25373 if $test -f Policy.sh; then
25374     $cat <<EOM
25375
25376 If you compile $package on a different machine or from a different object
25377 directory, copy the Policy.sh file from this object directory to the
25378 new one before you run Configure -- this will help you with most of
25379 the policy defaults.
25380
25381 EOM
25382 fi
25383 if $test -f config.msg; then
25384     echo "Hmm.  I also noted the following information while running:"
25385     echo " "
25386     $cat config.msg >&4
25387     $rm -f config.msg
25388 fi
25389 $rm -f kit*isdone ark*isdone
25390 $rm -rf UU
25391
25392 : End of Configure
25393