This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldiag: Rewrite a mangled sentence
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically by the tool
15 # called "metaconfig". Rather than working with this copy of Configure,
16 # you may wish to get metaconfig. Perl uses a modified version of this
17 # tool, available in the "dist" folder in the checkout of the git repo
18 #    $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
19 # The original dist package (including metaconfig) is available via SVN:
20 #    $ svn co https://svn.code.sf.net/p/dist/code/trunk/dist
21 #
22 # Though this script was generated by metaconfig from metaunits, it is
23 # OK to send patches against Configure itself. It's up to the Configure
24 # pumpkin to backport the patch to the metaunits if it is accepted.
25 # For more information on patching Configure, see pod/perlhack.pod
26 #
27 # The metaunits are also available from the public git repository:
28 #     http://perl5.git.perl.org/metaconfig.git/ or
29 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
30 #
31 # See Porting/pumpkin.pod for more information on metaconfig.
32
33 # Generated using [metaconfig 3.5 PL0]
34 # (with additional metaconfig patches by perlbug@perl.org)
35
36 cat >c1$$ <<EOF
37 ARGGGHHHH!!!!!
38
39 SCO csh still thinks true is false.  Write to SCO today and tell them that next
40 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43 we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45 [End of diatribe. We now return you to your regularly scheduled programming...]
46 EOF
47 cat >c2$$ <<EOF
48
49 OOPS!  You naughty creature!  You didn't run Configure with sh!
50 I will attempt to remedy the situation by running sh for you...
51 EOF
52
53 true || cat c1$$ c2$$
54 true || exec sh $0 $argv:q
55
56 (exit $?0) || cat c2$$
57 (exit $?0) || exec sh $0 $argv:q
58 rm -f c1$$ c2$$
59
60 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61         cat <<EOF
62 ***
63 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65 *** Please read the README.plan9 for further instructions.
66 *** Cannot continue, aborting.
67 ***
68 EOF
69         exit 1
70 fi
71
72 if test -f /sys/utilities/MultiView ; then
73         # AmigaOS, test -c for /dev/null is not useful
74         :
75 elif test ! -c /dev/null ; then
76         cat <<EOF
77 ***
78 *** I'm sorry, but /dev/null appears to be a file rather than a device.
79 *** Please consult your operating sytem's notes for making a device
80 *** in /dev.
81 *** Cannot continue, aborting.
82 ***
83 EOF
84         exit 1
85 fi
86
87 : compute my invocation name
88 me=$0
89 case "$0" in
90 */*)
91         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
92         test "$me" || me=$0
93         ;;
94 esac
95
96 : Proper separator for the PATH environment variable
97 p_=:
98 : On OS/2 this directory should exist if this is not floppy only system ":-]"
99 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
100         if test -n "$OS2_SHELL"; then
101                 p_=\;
102                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
103                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
104                 is_os2=yes
105         elif test -n "$DJGPP"; then
106                 case "X${MACHTYPE:-nonesuchmach}" in
107                 *cygwin|*msys) ;;
108                 *) p_=\; ;;
109                 esac
110         fi
111 fi
112
113 : Proper PATH setting
114 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
115 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
116 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
117 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
118 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
119 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
120 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
121 paths="$paths /sbin /usr/sbin /usr/libexec"
122 paths="$paths /system/gnu_library/bin"
123
124 for p in $paths
125 do
126         case "$p_$PATH$p_" in
127         *$p_$p$p_*) ;;
128         *) test -d $p && PATH=$PATH$p_$p ;;
129         esac
130 done
131
132 PATH=.$p_$PATH
133 export PATH
134
135 : shall we be using ksh?
136 inksh=''
137 needksh=''
138 avoidksh=''
139 newsh=/bin/ksh
140 changesh=''
141 if (PATH=.; alias -x) >/dev/null 2>&1; then
142                 inksh=true
143 fi
144 if test -f /hp-ux -a -f /bin/ksh; then
145         needksh='to avoid sh bug in "here document" expansion'
146 fi
147 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
148         if test X`/usr/bin/uname -v` = X4; then
149                 avoidksh="to avoid AIX 4's /bin/sh"
150                 newsh=/usr/bin/bsh
151         fi
152 fi
153 if test -f /osf_boot -a -f /usr/sbin/setld; then
154         if test X`/usr/bin/uname -s` = XOSF1; then
155                 avoidksh="to avoid Digital UNIX' ksh"
156                 newsh=/bin/sh
157                 unset BIN_SH
158         fi
159 fi
160 case "$inksh/$needksh" in
161 /[a-z]*)
162                 ENV=''
163                 changesh=true
164                 reason="$needksh"
165         ;;
166 esac
167 case "$inksh/$avoidksh" in
168 true/[a-z]*)
169         changesh=true
170         reason="$avoidksh"
171         ;;
172 esac
173 case "$inksh/$needksh-$avoidksh-" in
174 true/--)
175                 cat <<EOM
176 (I see you are using the Korn shell.  Some ksh's blow up on $me,
177 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
178 EOM
179         ;;
180 esac
181 case "$changesh" in
182 true)
183         export newsh
184         echo "(Feeding myself to $newsh $reason.)"
185         case "$0" in
186         Configure|*/Configure) exec $newsh $0 "$@";;
187         *) exec $newsh Configure "$@";;
188         esac
189         ;;
190 esac
191 test -x "${newsh}" || unset newsh
192
193 : if needed, set CDPATH to a harmless value that is not chatty
194 : avoid bash 2.02 problems with empty CDPATH.
195 case "$CDPATH" in
196 '')     ;;
197 *)      case "$SHELL" in
198         *bash*) CDPATH='.' ;;
199         *) CDPATH='' ;;
200         esac
201         ;;
202 esac
203
204 : Configure runs within the UU subdirectory
205 test -d UU || mkdir UU
206 cd UU && rm -f ./*
207
208 ccname=''
209 ccversion=''
210 ccsymbols=''
211 cppccsymbols=''
212 cppsymbols=''
213 from=''
214 hostgenerate=''
215 hostosname=''
216 hostperl=''
217 run=''
218 targetarch=''
219 targetdir=''
220 targetenv=''
221 targethost=''
222 targetmkdir=''
223 targetport=''
224 to=''
225 usecrosscompile=''
226 extern_C=''
227 mistrustnm=''
228 usedevel=''
229 perllibs=''
230 dynamic_ext=''
231 extensions=''
232 known_extensions=''
233 nonxs_ext=''
234 static_ext=''
235 useopcode=''
236 useposix=''
237 extras=''
238 d_bsd=''
239 d_eunice=''
240 d_xenix=''
241 eunicefix=''
242 ar=''
243 awk=''
244 bash=''
245 bison=''
246 byacc=''
247 cat=''
248 chgrp=''
249 chmod=''
250 chown=''
251 comm=''
252 compress=''
253 cp=''
254 cpio=''
255 cpp=''
256 csh=''
257 date=''
258 echo=''
259 egrep=''
260 emacs=''
261 expr=''
262 find=''
263 flex=''
264 gmake=''
265 grep=''
266 gzip=''
267 inews=''
268 ksh=''
269 less=''
270 line=''
271 lint=''
272 ln=''
273 lp=''
274 lpr=''
275 ls=''
276 mail=''
277 mailx=''
278 make=''
279 mkdir=''
280 more=''
281 mv=''
282 nm=''
283 nroff=''
284 perl=''
285 pg=''
286 pmake=''
287 pr=''
288 rm=''
289 rmail=''
290 sed=''
291 sendmail=''
292 shar=''
293 sleep=''
294 smail=''
295 sort=''
296 submit=''
297 tail=''
298 tar=''
299 tbl=''
300 tee=''
301 test=''
302 touch=''
303 tr=''
304 troff=''
305 uname=''
306 uniq=''
307 uuname=''
308 vi=''
309 zcat=''
310 zip=''
311 full_ar=''
312 full_sed=''
313 libswanted=''
314 hint=''
315 myuname=''
316 osname=''
317 osvers=''
318 Author=''
319 Date=''
320 Header=''
321 Id=''
322 Locker=''
323 Log=''
324 RCSfile=''
325 Revision=''
326 Source=''
327 State=''
328 sysroot=''
329 _a=''
330 _exe=''
331 _o=''
332 archobjs=''
333 exe_ext=''
334 firstmakefile=''
335 lib_ext=''
336 obj_ext=''
337 path_sep=''
338 rm_try=''
339 afs=''
340 afsroot=''
341 alignbytes=''
342 ansi2knr=''
343 archlib=''
344 archlibexp=''
345 d_archlib=''
346 installarchlib=''
347 archname=''
348 myarchname=''
349 useversionedarchname=''
350 d_atolf=''
351 d_atoll=''
352 baserev=''
353 bin=''
354 binexp=''
355 initialinstalllocation=''
356 installbin=''
357 userelocatableinc=''
358 byteorder=''
359 cc=''
360 ccflags=''
361 cppflags=''
362 ldflags=''
363 lkflags=''
364 locincpth=''
365 optimize=''
366 cf_email=''
367 cf_by=''
368 cf_time=''
369 charbits=''
370 charsize=''
371 contains=''
372 cpp_stuff=''
373 cpplast=''
374 cppminus=''
375 cpprun=''
376 cppstdin=''
377 d__fwalk=''
378 d_access=''
379 d_accessx=''
380 d_acosh=''
381 d_aintl=''
382 d_alarm=''
383 asctime_r_proto=''
384 d_asctime_r=''
385 d_asinh=''
386 d_atanh=''
387 d_attribute_deprecated=''
388 d_attribute_format=''
389 d_attribute_malloc=''
390 d_attribute_nonnull=''
391 d_attribute_noreturn=''
392 d_attribute_pure=''
393 d_attribute_unused=''
394 d_attribute_warn_unused_result=''
395 d_printf_format_null=''
396 d_backtrace=''
397 d_bcmp=''
398 d_bcopy=''
399 d_builtin_choose_expr=''
400 d_builtin_expect=''
401 d_bzero=''
402 d_c99_variadic_macros=''
403 d_casti32=''
404 castflags=''
405 d_castneg=''
406 d_cbrt=''
407 d_chown=''
408 d_chroot=''
409 d_chsize=''
410 d_class=''
411 d_clearenv=''
412 d_closedir=''
413 d_void_closedir=''
414 d_cmsghdr_s=''
415 d_const=''
416 d_copysign=''
417 d_copysignl=''
418 d_cplusplus=''
419 cryptlib=''
420 d_crypt=''
421 crypt_r_proto=''
422 d_crypt_r=''
423 d_csh=''
424 full_csh=''
425 d_ctermid=''
426 ctermid_r_proto=''
427 d_ctermid_r=''
428 ctime_r_proto=''
429 d_ctime_r=''
430 d_cuserid=''
431 d_dbl_dig=''
432 d_dbminitproto=''
433 d_difftime=''
434 d_dir_dd_fd=''
435 d_dirfd=''
436 d_dladdr=''
437 d_dlerror=''
438 d_dlopen=''
439 d_dlsymun=''
440 d_dosuid=''
441 d_suidsafe=''
442 d_drand48_r=''
443 drand48_r_proto=''
444 d_drand48proto=''
445 d_dup2=''
446 d_eaccess=''
447 d_endgrent=''
448 d_endgrent_r=''
449 endgrent_r_proto=''
450 d_endhent=''
451 d_endhostent_r=''
452 endhostent_r_proto=''
453 d_endnent=''
454 d_endnetent_r=''
455 endnetent_r_proto=''
456 d_endpent=''
457 d_endprotoent_r=''
458 endprotoent_r_proto=''
459 d_endpwent=''
460 d_endpwent_r=''
461 endpwent_r_proto=''
462 d_endsent=''
463 d_endservent_r=''
464 endservent_r_proto=''
465 d_erf=''
466 d_erfc=''
467 d_exp2=''
468 d_expm1=''
469 d_faststdio=''
470 d_fchdir=''
471 d_fchmod=''
472 d_fchown=''
473 d_fcntl=''
474 d_fcntl_can_lock=''
475 d_fd_macros=''
476 d_fd_set=''
477 d_fds_bits=''
478 d_fdclose=''
479 d_fdim=''
480 d_fegetround=''
481 d_fgetpos=''
482 d_finite=''
483 d_finitel=''
484 d_flexfnam=''
485 d_flock=''
486 d_flockproto=''
487 d_fma=''
488 d_fmax=''
489 d_fmin=''
490 d_fork=''
491 d_fp_class=''
492 d_fp_classl=''
493 d_fpclass=''
494 d_fp_classify=''
495 d_fpclassify=''
496 d_fpclassl=''
497 d_fpgetround=''
498 d_fpos64_t=''
499 d_frexpl=''
500 d_fs_data_s=''
501 d_fseeko=''
502 d_fsetpos=''
503 d_fstatfs=''
504 d_fsync=''
505 d_ftello=''
506 d_ftime=''
507 d_gettimeod=''
508 d_futimes=''
509 d_Gconvert=''
510 d_getaddrinfo=''
511 d_getcwd=''
512 d_getespwnam=''
513 d_getfsstat=''
514 d_getgrent=''
515 d_getgrent_r=''
516 getgrent_r_proto=''
517 d_getgrgid_r=''
518 getgrgid_r_proto=''
519 d_getgrnam_r=''
520 getgrnam_r_proto=''
521 d_getgrps=''
522 d_gethbyaddr=''
523 d_gethbyname=''
524 d_gethent=''
525 aphostname=''
526 d_gethname=''
527 d_phostname=''
528 d_uname=''
529 d_gethostbyaddr_r=''
530 gethostbyaddr_r_proto=''
531 d_gethostbyname_r=''
532 gethostbyname_r_proto=''
533 d_gethostent_r=''
534 gethostent_r_proto=''
535 d_gethostprotos=''
536 d_getitimer=''
537 d_getlogin=''
538 d_getlogin_r=''
539 getlogin_r_proto=''
540 d_getmnt=''
541 d_getmntent=''
542 d_getnameinfo=''
543 d_getnbyaddr=''
544 d_getnbyname=''
545 d_getnent=''
546 d_getnetbyaddr_r=''
547 getnetbyaddr_r_proto=''
548 d_getnetbyname_r=''
549 getnetbyname_r_proto=''
550 d_getnetent_r=''
551 getnetent_r_proto=''
552 d_getnetprotos=''
553 d_getpagsz=''
554 d_getpent=''
555 d_getpgid=''
556 d_getpgrp2=''
557 d_bsdgetpgrp=''
558 d_getpgrp=''
559 d_getppid=''
560 d_getprior=''
561 d_getpbyname=''
562 d_getpbynumber=''
563 d_getprotobyname_r=''
564 getprotobyname_r_proto=''
565 d_getprotobynumber_r=''
566 getprotobynumber_r_proto=''
567 d_getprotoent_r=''
568 getprotoent_r_proto=''
569 d_getprotoprotos=''
570 d_getprpwnam=''
571 d_getpwent=''
572 d_getpwent_r=''
573 getpwent_r_proto=''
574 d_getpwnam_r=''
575 getpwnam_r_proto=''
576 d_getpwuid_r=''
577 getpwuid_r_proto=''
578 d_getsent=''
579 d_getservbyname_r=''
580 getservbyname_r_proto=''
581 d_getservbyport_r=''
582 getservbyport_r_proto=''
583 d_getservent_r=''
584 getservent_r_proto=''
585 d_getservprotos=''
586 d_getspnam=''
587 d_getspnam_r=''
588 getspnam_r_proto=''
589 d_getsbyname=''
590 d_getsbyport=''
591 d_gmtime_r=''
592 gmtime_r_proto=''
593 d_gnulibc=''
594 gnulibc_version=''
595 d_hasmntopt=''
596 d_htonl=''
597 d_hypot=''
598 d_ilogb=''
599 d_ilogbl=''
600 d_inetaton=''
601 d_inetntop=''
602 d_inetpton=''
603 d_int64_t=''
604 d_isascii=''
605 d_isblank=''
606 d_isfinite=''
607 d_isfinitel=''
608 d_isinf=''
609 d_isinfl=''
610 d_isless=''
611 d_isnan=''
612 d_isnanl=''
613 d_isnormal=''
614 d_j0=''
615 d_j0l=''
616 d_killpg=''
617 d_lc_monetary_2008=''
618 d_lchown=''
619 d_ldbl_dig=''
620 d_lgamma=''
621 d_lgamma_r=''
622 d_libm_lib_version=''
623 d_link=''
624 d_llrint=''
625 d_llrintl=''
626 d_llround=''
627 d_llroundl=''
628 d_localtime_r=''
629 d_localtime_r_needs_tzset=''
630 localtime_r_proto=''
631 d_locconv=''
632 d_lockf=''
633 d_log1p=''
634 d_log2=''
635 d_logb=''
636 d_ldexpl=''
637 d_longdbl=''
638 longdblkind=''
639 longdblsize=''
640 d_longlong=''
641 longlongsize=''
642 d_lrint=''
643 d_lrintl=''
644 d_lround=''
645 d_lroundl=''
646 d_lseekproto=''
647 d_lstat=''
648 d_madvise=''
649 d_malloc_good_size=''
650 d_malloc_size=''
651 d_mblen=''
652 d_mbstowcs=''
653 d_mbtowc=''
654 d_memchr=''
655 d_memcmp=''
656 d_memcpy=''
657 d_memmem=''
658 d_memmove=''
659 d_memset=''
660 d_mkdir=''
661 d_mkdtemp=''
662 d_mkfifo=''
663 d_mkstemp=''
664 d_mkstemps=''
665 d_mktime=''
666 d_mmap=''
667 mmaptype=''
668 d_modfl=''
669 d_modflproto=''
670 d_mprotect=''
671 d_msg=''
672 d_msgctl=''
673 d_msgget=''
674 d_msghdr_s=''
675 d_msgrcv=''
676 d_msgsnd=''
677 d_msync=''
678 d_munmap=''
679 d_nan=''
680 d_nearbyint=''
681 d_duplocale=''
682 d_freelocale=''
683 d_newlocale=''
684 d_uselocale=''
685 i_xlocale=''
686 d_nextafter=''
687 d_nexttoward=''
688 d_nice=''
689 d_nl_langinfo=''
690 d_off64_t=''
691 d_open3=''
692 d_fpathconf=''
693 d_pathconf=''
694 d_pause=''
695 d_pipe=''
696 d_poll=''
697 d_portable=''
698 d_prctl=''
699 d_prctl_set_name=''
700 d_procselfexe=''
701 procselfexe=''
702 d_old_pthread_create_joinable=''
703 old_pthread_create_joinable=''
704 d_pthread_atfork=''
705 d_pthread_attr_setscope=''
706 d_pthread_yield=''
707 d_sched_yield=''
708 sched_yield=''
709 d_ptrdiff_t=''
710 d_qgcvt=''
711 d_random_r=''
712 random_r_proto=''
713 d_readdir64_r=''
714 readdir64_r_proto=''
715 d_readdir=''
716 d_rewinddir=''
717 d_seekdir=''
718 d_telldir=''
719 d_readdir_r=''
720 readdir_r_proto=''
721 d_readlink=''
722 d_readv=''
723 d_recvmsg=''
724 d_re_comp=''
725 d_regcmp=''
726 d_regcomp=''
727 d_remainder=''
728 d_remquo=''
729 d_rename=''
730 d_rint=''
731 d_rmdir=''
732 d_round=''
733 d_safebcpy=''
734 d_safemcpy=''
735 d_sanemcmp=''
736 d_sbrkproto=''
737 d_scalbn=''
738 d_scalbnl=''
739 d_select=''
740 d_sem=''
741 d_semctl=''
742 d_semget=''
743 d_semop=''
744 d_sendmsg=''
745 d_setegid=''
746 d_seteuid=''
747 d_setgrent=''
748 d_setgrent_r=''
749 setgrent_r_proto=''
750 d_setgrps=''
751 d_sethent=''
752 d_sethostent_r=''
753 sethostent_r_proto=''
754 d_setitimer=''
755 d_setlinebuf=''
756 d_setlocale=''
757 d_setlocale_r=''
758 setlocale_r_proto=''
759 d_setnent=''
760 d_setnetent_r=''
761 setnetent_r_proto=''
762 d_setpent=''
763 d_setpgid=''
764 d_setpgrp2=''
765 d_bsdsetpgrp=''
766 d_setpgrp=''
767 d_setprior=''
768 d_setproctitle=''
769 d_setprotoent_r=''
770 setprotoent_r_proto=''
771 d_setpwent=''
772 d_setpwent_r=''
773 setpwent_r_proto=''
774 d_setregid=''
775 d_setresgid=''
776 d_setresuid=''
777 d_setreuid=''
778 d_setrgid=''
779 d_setruid=''
780 d_setsent=''
781 d_setservent_r=''
782 setservent_r_proto=''
783 d_setsid=''
784 d_setvbuf=''
785 d_shm=''
786 d_shmat=''
787 d_shmatprototype=''
788 shmattype=''
789 d_shmctl=''
790 d_shmdt=''
791 d_shmget=''
792 d_sigaction=''
793 d_siginfo_si_addr=''
794 d_siginfo_si_band=''
795 d_siginfo_si_errno=''
796 d_siginfo_si_fd=''
797 d_siginfo_si_pid=''
798 d_siginfo_si_status=''
799 d_siginfo_si_uid=''
800 d_siginfo_si_value=''
801 d_signbit=''
802 d_sigprocmask=''
803 d_sigsetjmp=''
804 usesitecustomize=''
805 d_snprintf=''
806 d_vsnprintf=''
807 d_sockatmark=''
808 d_sockatmarkproto=''
809 d_ip_mreq=''
810 d_ip_mreq_source=''
811 d_ipv6_mreq=''
812 d_ipv6_mreq_source=''
813 d_msg_ctrunc=''
814 d_msg_dontroute=''
815 d_msg_oob=''
816 d_msg_peek=''
817 d_msg_proxy=''
818 d_oldsock=''
819 d_scm_rights=''
820 d_sin6_scope_id=''
821 d_sockaddr_in6=''
822 d_sockaddr_sa_len=''
823 d_socket=''
824 d_sockpair=''
825 sockethdr=''
826 socketlib=''
827 d_socklen_t=''
828 d_socks5_init=''
829 d_sprintf_returns_strlen=''
830 d_sqrtl=''
831 d_srand48_r=''
832 srand48_r_proto=''
833 d_srandom_r=''
834 srandom_r_proto=''
835 d_sresgproto=''
836 d_sresuproto=''
837 d_stat=''
838 d_statblks=''
839 d_statfs_f_flags=''
840 d_statfs_s=''
841 d_static_inline=''
842 perl_static_inline=''
843 d_fstatvfs=''
844 d_statvfs=''
845 d_stdio_cnt_lval=''
846 d_stdio_ptr_lval=''
847 d_stdio_ptr_lval_nochange_cnt=''
848 d_stdio_ptr_lval_sets_cnt=''
849 d_stdiobase=''
850 d_stdstdio=''
851 stdio_base=''
852 stdio_bufsiz=''
853 stdio_cnt=''
854 stdio_filbuf=''
855 stdio_ptr=''
856 d_index=''
857 d_strchr=''
858 d_strcoll=''
859 d_strctcpy=''
860 d_strerrm=''
861 d_strerror=''
862 d_sysernlst=''
863 d_syserrlst=''
864 d_strerror_r=''
865 strerror_r_proto=''
866 d_strftime=''
867 d_strlcat=''
868 d_strlcpy=''
869 d_strtod=''
870 d_strtol=''
871 d_strtold=''
872 d_strtoll=''
873 d_strtoq=''
874 d_strtoul=''
875 d_strtoull=''
876 d_strtouq=''
877 d_strxfrm=''
878 d_symlink=''
879 d_syscall=''
880 d_syscallproto=''
881 d_sysconf=''
882 d_system=''
883 d_tcgetpgrp=''
884 d_tcsetpgrp=''
885 d_telldirproto=''
886 d_tgamma=''
887 d_time=''
888 timetype=''
889 d_asctime64=''
890 d_ctime64=''
891 d_difftime64=''
892 d_gmtime64=''
893 d_localtime64=''
894 d_mktime64=''
895 d_timegm=''
896 clocktype=''
897 d_times=''
898 d_tmpnam_r=''
899 tmpnam_r_proto=''
900 d_trunc=''
901 d_truncate=''
902 d_truncl=''
903 d_ttyname_r=''
904 ttyname_r_proto=''
905 d_tzname=''
906 d_u32align=''
907 d_ualarm=''
908 d_umask=''
909 d_semctl_semid_ds=''
910 d_semctl_semun=''
911 d_union_semun=''
912 d_unordered=''
913 d_unsetenv=''
914 d_usleep=''
915 d_usleepproto=''
916 d_ustat=''
917 d_pseudofork=''
918 d_vfork=''
919 usevfork=''
920 d_voidsig=''
921 signal_t=''
922 d_volatile=''
923 d_charvspr=''
924 d_vprintf=''
925 d_wait4=''
926 d_waitpid=''
927 d_wcscmp=''
928 d_wcstombs=''
929 d_wcsxfrm=''
930 d_wctomb=''
931 d_writev=''
932 dlext=''
933 bin_ELF=''
934 cccdlflags=''
935 ccdlflags=''
936 dlsrc=''
937 ld=''
938 ld_can_script=''
939 lddlflags=''
940 usedl=''
941 doublesize=''
942 dtraceobject=''
943 ebcdic=''
944 fflushNULL=''
945 fflushall=''
946 fpossize=''
947 fpostype=''
948 gccansipedantic=''
949 gccosandvers=''
950 gccversion=''
951 gidformat=''
952 gidsign=''
953 gidsize=''
954 gidtype=''
955 groupstype=''
956 h_fcntl=''
957 h_sysfile=''
958 html1dir=''
959 html1direxp=''
960 installhtml1dir=''
961 html3dir=''
962 html3direxp=''
963 installhtml3dir=''
964 i_arpainet=''
965 i_assert=''
966 i_bfd=''
967 i_crypt=''
968 db_hashtype=''
969 db_prefixtype=''
970 db_version_major=''
971 db_version_minor=''
972 db_version_patch=''
973 i_db=''
974 i_dbm=''
975 i_rpcsvcdbm=''
976 d_dirnamlen=''
977 direntrytype=''
978 i_dirent=''
979 i_dlfcn=''
980 i_execinfo=''
981 i_fcntl=''
982 i_fenv=''
983 i_float=''
984 i_fp=''
985 i_fp_class=''
986 i_gdbm=''
987 d_grpasswd=''
988 i_grp=''
989 i_ieeefp=''
990 i_inttypes=''
991 i_langinfo=''
992 i_libutil=''
993 i_limits=''
994 i_locale=''
995 i_machcthr=''
996 i_malloc=''
997 i_mallocmalloc=''
998 i_math=''
999 i_memory=''
1000 i_mntent=''
1001 d_gdbm_ndbm_h_uses_prototypes=''
1002 d_gdbmndbm_h_uses_prototypes=''
1003 d_ndbm=''
1004 d_ndbm_h_uses_prototypes=''
1005 i_gdbm_ndbm=''
1006 i_gdbmndbm=''
1007 i_ndbm=''
1008 i_netdb=''
1009 i_neterrno=''
1010 i_netinettcp=''
1011 i_niin=''
1012 i_sysin=''
1013 i_poll=''
1014 i_prot=''
1015 i_pthread=''
1016 d_pwage=''
1017 d_pwchange=''
1018 d_pwclass=''
1019 d_pwcomment=''
1020 d_pwexpire=''
1021 d_pwgecos=''
1022 d_pwpasswd=''
1023 d_pwquota=''
1024 i_pwd=''
1025 i_quadmath=''
1026 i_shadow=''
1027 i_socks=''
1028 i_stdbool=''
1029 i_stddef=''
1030 i_stdint=''
1031 i_stdlib=''
1032 i_string=''
1033 strings=''
1034 i_sunmath=''
1035 i_sysaccess=''
1036 i_sysdir=''
1037 i_sysfile=''
1038 d_voidtty=''
1039 i_bsdioctl=''
1040 i_sysfilio=''
1041 i_sysioctl=''
1042 i_syssockio=''
1043 i_syslog=''
1044 i_sysmman=''
1045 i_sysmode=''
1046 i_sysmount=''
1047 i_sysndir=''
1048 i_sysparam=''
1049 i_syspoll=''
1050 i_sysresrc=''
1051 i_syssecrt=''
1052 i_sysselct=''
1053 i_sysstat=''
1054 i_sysstatfs=''
1055 i_sysstatvfs=''
1056 i_systimes=''
1057 i_systypes=''
1058 i_sysuio=''
1059 i_sysun=''
1060 i_sysutsname=''
1061 i_sysvfs=''
1062 i_syswait=''
1063 i_sgtty=''
1064 i_termio=''
1065 i_termios=''
1066 d_tm_tm_gmtoff=''
1067 d_tm_tm_zone=''
1068 i_systime=''
1069 i_systimek=''
1070 i_time=''
1071 timeincl=''
1072 i_unistd=''
1073 i_ustat=''
1074 i_utime=''
1075 i_values=''
1076 i_stdarg=''
1077 i_varargs=''
1078 i_varhdr=''
1079 i_vfork=''
1080 d_inc_version_list=''
1081 inc_version_list=''
1082 inc_version_list_init=''
1083 doubleinfbytes=''
1084 doublenanbytes=''
1085 longdblinfbytes=''
1086 longdblnanbytes=''
1087 installprefix=''
1088 installprefixexp=''
1089 installstyle=''
1090 installusrbinperl=''
1091 intsize=''
1092 longsize=''
1093 shortsize=''
1094 issymlink=''
1095 libc=''
1096 ldlibpthname=''
1097 libperl=''
1098 shrpenv=''
1099 useshrplib=''
1100 glibpth=''
1101 incpth=''
1102 libpth=''
1103 loclibpth=''
1104 plibpth=''
1105 xlibpth=''
1106 ignore_versioned_solibs=''
1107 libs=''
1108 libsdirs=''
1109 libsfiles=''
1110 libsfound=''
1111 libspath=''
1112 lns=''
1113 d_PRIEUldbl=''
1114 d_PRIFUldbl=''
1115 d_PRIGUldbl=''
1116 d_PRIeldbl=''
1117 d_PRIfldbl=''
1118 d_PRIgldbl=''
1119 d_SCNfldbl=''
1120 doublekind=''
1121 sPRIEUldbl=''
1122 sPRIFUldbl=''
1123 sPRIGUldbl=''
1124 sPRIeldbl=''
1125 sPRIfldbl=''
1126 sPRIgldbl=''
1127 sSCNfldbl=''
1128 lseeksize=''
1129 lseektype=''
1130 make_set_make=''
1131 d_mymalloc=''
1132 freetype=''
1133 mallocobj=''
1134 mallocsrc=''
1135 malloctype=''
1136 usemallocwrap=''
1137 usemymalloc=''
1138 installman1dir=''
1139 man1dir=''
1140 man1direxp=''
1141 man1ext=''
1142 installman3dir=''
1143 man3dir=''
1144 man3direxp=''
1145 man3ext=''
1146 doublemantbits=''
1147 longdblmantbits=''
1148 nvmantbits=''
1149 modetype=''
1150 multiarch=''
1151 mydomain=''
1152 myhostname=''
1153 phostname=''
1154 c=''
1155 n=''
1156 d_eofnblk=''
1157 eagain=''
1158 o_nonblock=''
1159 rd_nodata=''
1160 need_va_copy=''
1161 netdb_hlen_type=''
1162 netdb_host_type=''
1163 netdb_name_type=''
1164 netdb_net_type=''
1165 groupcat=''
1166 hostcat=''
1167 passcat=''
1168 orderlib=''
1169 ranlib=''
1170 d_perl_otherlibdirs=''
1171 otherlibdirs=''
1172 package=''
1173 spackage=''
1174 pager=''
1175 api_revision=''
1176 api_subversion=''
1177 api_version=''
1178 api_versionstring=''
1179 patchlevel=''
1180 perl_patchlevel=''
1181 revision=''
1182 subversion=''
1183 version=''
1184 version_patchlevel_string=''
1185 perl5=''
1186 perladmin=''
1187 perlpath=''
1188 d_nv_preserves_uv=''
1189 d_nv_zero_is_allbits_zero=''
1190 i16size=''
1191 i16type=''
1192 i32size=''
1193 i32type=''
1194 i64size=''
1195 i64type=''
1196 i8size=''
1197 i8type=''
1198 ivsize=''
1199 ivtype=''
1200 nv_overflows_integers_at=''
1201 nv_preserves_uv_bits=''
1202 nvsize=''
1203 nvtype=''
1204 u16size=''
1205 u16type=''
1206 u32size=''
1207 u32type=''
1208 u64size=''
1209 u64type=''
1210 u8size=''
1211 u8type=''
1212 uvsize=''
1213 uvtype=''
1214 ivdformat=''
1215 nvEUformat=''
1216 nvFUformat=''
1217 nvGUformat=''
1218 nveformat=''
1219 nvfformat=''
1220 nvgformat=''
1221 uvXUformat=''
1222 uvoformat=''
1223 uvuformat=''
1224 uvxformat=''
1225 pidtype=''
1226 prefix=''
1227 prefixexp=''
1228 installprivlib=''
1229 privlib=''
1230 privlibexp=''
1231 prototype=''
1232 ptrsize=''
1233 d_PRIXU64=''
1234 d_PRId64=''
1235 d_PRIi64=''
1236 d_PRIo64=''
1237 d_PRIu64=''
1238 d_PRIx64=''
1239 sPRIXU64=''
1240 sPRId64=''
1241 sPRIi64=''
1242 sPRIo64=''
1243 sPRIu64=''
1244 sPRIx64=''
1245 d_quad=''
1246 quadkind=''
1247 quadtype=''
1248 uquadtype=''
1249 drand01=''
1250 randbits=''
1251 randfunc=''
1252 randseedtype=''
1253 seedfunc=''
1254 installscript=''
1255 scriptdir=''
1256 scriptdirexp=''
1257 selectminbits=''
1258 selecttype=''
1259 sh=''
1260 targetsh=''
1261 sig_count=''
1262 sig_name=''
1263 sig_name_init=''
1264 sig_num=''
1265 sig_num_init=''
1266 sig_size=''
1267 d_sitearch=''
1268 installsitearch=''
1269 sitearch=''
1270 sitearchexp=''
1271 installsitebin=''
1272 sitebin=''
1273 sitebinexp=''
1274 installsitehtml1dir=''
1275 sitehtml1dir=''
1276 sitehtml1direxp=''
1277 installsitehtml3dir=''
1278 sitehtml3dir=''
1279 sitehtml3direxp=''
1280 installsitelib=''
1281 sitelib=''
1282 sitelib_stem=''
1283 sitelibexp=''
1284 installsiteman1dir=''
1285 siteman1dir=''
1286 siteman1direxp=''
1287 installsiteman3dir=''
1288 siteman3dir=''
1289 siteman3direxp=''
1290 siteprefix=''
1291 siteprefixexp=''
1292 installsitescript=''
1293 sitescript=''
1294 sitescriptexp=''
1295 sizesize=''
1296 sizetype=''
1297 d_libname_unique=''
1298 so=''
1299 socksizetype=''
1300 sharpbang=''
1301 shsharp=''
1302 spitshell=''
1303 src=''
1304 ssizetype=''
1305 st_ino_sign=''
1306 st_ino_size=''
1307 startperl=''
1308 startsh=''
1309 stdchar=''
1310 d_stdio_stream_array=''
1311 stdio_stream_array=''
1312 sysman=''
1313 sGMTIME_max=''
1314 sGMTIME_min=''
1315 sLOCALTIME_max=''
1316 sLOCALTIME_min=''
1317 trnl=''
1318 uidformat=''
1319 uidsign=''
1320 uidsize=''
1321 uidtype=''
1322 archname64=''
1323 use64bitall=''
1324 use64bitint=''
1325 usecbacktrace=''
1326 dtrace=''
1327 usedtrace=''
1328 usefaststdio=''
1329 usekernprocpathname=''
1330 ccflags_uselargefiles=''
1331 ldflags_uselargefiles=''
1332 libswanted_uselargefiles=''
1333 uselargefiles=''
1334 uselongdouble=''
1335 usemorebits=''
1336 usemultiplicity=''
1337 nm_opt=''
1338 nm_so_opt=''
1339 runnm=''
1340 usenm=''
1341 usensgetexecutablepath=''
1342 useperlio=''
1343 usequadmath=''
1344 usesocks=''
1345 d_oldpthreads=''
1346 use5005threads=''
1347 useithreads=''
1348 usereentrant=''
1349 usethreads=''
1350 incpath=''
1351 mips_type=''
1352 usrinc=''
1353 vaproto=''
1354 d_vendorarch=''
1355 installvendorarch=''
1356 vendorarch=''
1357 vendorarchexp=''
1358 d_vendorbin=''
1359 installvendorbin=''
1360 vendorbin=''
1361 vendorbinexp=''
1362 installvendorhtml1dir=''
1363 vendorhtml1dir=''
1364 vendorhtml1direxp=''
1365 installvendorhtml3dir=''
1366 vendorhtml3dir=''
1367 vendorhtml3direxp=''
1368 d_vendorlib=''
1369 installvendorlib=''
1370 vendorlib=''
1371 vendorlib_stem=''
1372 vendorlibexp=''
1373 installvendorman1dir=''
1374 vendorman1dir=''
1375 vendorman1direxp=''
1376 installvendorman3dir=''
1377 vendorman3dir=''
1378 vendorman3direxp=''
1379 usevendorprefix=''
1380 vendorprefix=''
1381 vendorprefixexp=''
1382 d_vendorscript=''
1383 installvendorscript=''
1384 vendorscript=''
1385 vendorscriptexp=''
1386 versiononly=''
1387 yacc=''
1388 yaccflags=''
1389 CONFIG=''
1390
1391 : Detect odd OSs
1392 define='define'
1393 undef='undef'
1394 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1395 rmlist=''
1396
1397 : We must find out about Eunice early
1398 eunicefix=':'
1399 if test -f /etc/unixtovms; then
1400         eunicefix=/etc/unixtovms
1401 fi
1402 if test -f /etc/unixtovms.exe; then
1403         eunicefix=/etc/unixtovms.exe
1404 fi
1405
1406 : Set executable suffix now -- needed before hints available
1407 if test -f "/libs/version.library"; then
1408 : Amiga OS
1409     _exe=""
1410 elif test -f "/system/gnu_library/bin/ar.pm"; then
1411 : Stratus VOS
1412     _exe=".pm"
1413 elif test -n "$DJGPP"; then
1414 : DOS DJGPP
1415     _exe=".exe"
1416 elif test -f /kern/cookiejar; then
1417 : MiNT
1418     _exe=""
1419 elif test -d c:/. -o -n "$is_os2" ; then
1420 : OS/2 or cygwin
1421     _exe=".exe"
1422 fi
1423
1424 groupstype=''
1425 i_whoami=''
1426 : Possible local include directories to search.
1427 : Set locincpth to "" in a hint file to defeat local include searches.
1428 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1429 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1430 :
1431 : no include file wanted by default
1432 inclwanted=''
1433
1434 : Enable -DEBUGGING and -DDEBUGGING from the command line
1435 EBUGGING=''
1436 DEBUGGING=''
1437
1438 : Trailing extension.  Override this in a hint file, if needed.
1439 : Extra object files, if any, needed on this platform.
1440 archobjs=''
1441 libnames=''
1442 : change the next line if compiling for Xenix/286 on Xenix/386
1443 xlibpth='/usr/lib/386 /lib/386'
1444 : Possible local library directories to search.
1445 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1446 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1447
1448 : general looking path for locating libraries
1449 glibpth="/lib /usr/lib $xlibpth"
1450 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1451 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1452 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1453 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1454
1455 : Private path used by Configure to find libraries.  Its value
1456 : is prepended to libpth. This variable takes care of special
1457 : machines, like the mips.  Usually, it should be empty.
1458 plibpth=''
1459
1460 : default library list
1461 libswanted=''
1462 : some systems want to use only the non-versioned libso:s
1463 ignore_versioned_solibs=''
1464 ccname=''
1465 ccversion=''
1466 perllibs=''
1467 : set useposix=false in your hint file to disable the POSIX extension.
1468 useposix=true
1469 : set useopcode=false in your hint file to disable the Opcode extension.
1470 useopcode=true
1471 archname64=''
1472 ccflags_uselargefiles=''
1473 ldflags_uselargefiles=''
1474 libswanted_uselargefiles=''
1475 : set usemultiplicity on the Configure command line to enable multiplicity.
1476 : set usesocks on the Configure command line to enable socks.
1477 archname=''
1478 : set usethreads on the Configure command line to enable threads.
1479 usereentrant='undef'
1480 : List of libraries we want.
1481 : If anyone needs extra -lxxx, put those in a hint file.
1482 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1483 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1484 : We probably want to search /usr/shlib before most other libraries.
1485 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1486 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1487 glibpth="/usr/shlib $glibpth"
1488 : Do not use vfork unless overridden by a hint file.
1489 usevfork=false
1490
1491 : Find the basic shell for Bourne shell scripts
1492 case "$sh" in
1493 '')
1494         case "$SYSTYPE" in
1495         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1496         *) xxx='/bin/sh';;
1497         esac
1498         if test -f "$xxx"; then
1499                 sh="$xxx"
1500         else
1501                 : Build up a list and do a single loop so we can 'break' out.
1502                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1503                 for xxx in sh bash ksh pdksh ash; do
1504                         for p in $pth; do
1505                                 try="$try ${p}/${xxx}"
1506                         done
1507                 done
1508                 for xxx in $try; do
1509                         if test -f "$xxx"; then
1510                                 sh="$xxx";
1511                                 break
1512                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1513                                 sh="$xxx";
1514                                 break
1515                         elif test -f "$xxx.exe"; then
1516                                 sh="$xxx";
1517                                 break
1518                         fi
1519                 done
1520         fi
1521         ;;
1522 esac
1523
1524 case "$sh" in
1525 '')     cat >&2 <<EOM
1526 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1527
1528 Usually it's in /bin/sh.  How did you even get this far?
1529 Please contact me (Perl Maintainers) at perlbug@perl.org and
1530 we'll try to straighten this all out.
1531 EOM
1532         exit 1
1533         ;;
1534 esac
1535
1536 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1537 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1538 targetsh=$sh
1539
1540 : see if sh knows # comments
1541 if `$sh -c '#' >/dev/null 2>&1`; then
1542         shsharp=true
1543         spitshell=cat
1544         xcat=/bin/cat
1545         test -f $xcat$_exe || xcat=/usr/bin/cat
1546         if test ! -f $xcat$_exe; then
1547                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1548                         if test -f $p/cat$_exe; then
1549                                 xcat=$p/cat
1550                                 break
1551                         fi
1552                 done
1553                 if test ! -f $xcat$_exe; then
1554                         echo "Can't find cat anywhere!"
1555                         exit 1
1556                 fi
1557         fi
1558         echo "#!$xcat" >sharp
1559         $eunicefix sharp
1560         chmod +x sharp
1561         ./sharp > today 2>/dev/null
1562         if test -s today; then
1563                 sharpbang='#!'
1564         else
1565                 echo "#! $xcat" > sharp
1566                 $eunicefix sharp
1567                 chmod +x sharp
1568                 ./sharp > today 2>/dev/null
1569                 if test -s today; then
1570                         sharpbang='#! '
1571                 else
1572                         sharpbang=': use '
1573                 fi
1574         fi
1575 else
1576         echo " "
1577         echo "Your $sh doesn't grok # comments--I will strip them later on."
1578         shsharp=false
1579         cd ..
1580         echo "exec grep -v '^[  ]*#'" >spitshell
1581         chmod +x spitshell
1582         $eunicefix spitshell
1583         spitshell=`pwd`/spitshell
1584         cd UU
1585         echo "I presume that if # doesn't work, #! won't work either!"
1586         sharpbang=': use '
1587 fi
1588 rm -f sharp today
1589
1590 : figure out how to guarantee sh startup
1591 case "$startsh" in
1592 '') startsh=${sharpbang}${sh} ;;
1593 *)
1594 esac
1595 cat >sharp <<EOSS
1596 $startsh
1597 set abc
1598 test "$?abc" != 1
1599 EOSS
1600
1601 chmod +x sharp
1602 $eunicefix sharp
1603 if ./sharp; then
1604         : echo "Yup, it does."
1605 else
1606         echo "Hmm... '$startsh' does not guarantee sh startup..."
1607         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1608 fi
1609 rm -f sharp
1610
1611 : Save command line options in file UU/cmdline.opt for later use in
1612 : generating config.sh.
1613 cat > cmdline.opt <<EOSH
1614 : Configure command line arguments.
1615 config_arg0='$0'
1616 config_args='$*'
1617 config_argc=$#
1618 EOSH
1619 argn=1
1620 args_exp=''
1621 args_sep=''
1622 for arg in "$@"; do
1623         cat >>cmdline.opt <<EOSH
1624 config_arg$argn='$arg'
1625 EOSH
1626         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1627 $arg
1628 EOC
1629         arg_exp=`cat cmdl.opt`
1630         args_exp="$args_exp$args_sep'$arg_exp'"
1631         argn=`expr $argn + 1`
1632         args_sep=' '
1633 done
1634 rm -f cmdl.opt
1635
1636 : produce awk script to parse command line options
1637 cat >options.awk <<'EOF'
1638 BEGIN {
1639         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1640
1641         len = length(optstr);
1642         for (i = 1; i <= len; i++) {
1643                 c = substr(optstr, i, 1);
1644                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1645                 if (a == ":") {
1646                         arg[c] = 1;
1647                         i++;
1648                 }
1649                 opt[c] = 1;
1650         }
1651 }
1652 {
1653         expect = 0;
1654         str = $0;
1655         if (substr(str, 1, 1) != "-") {
1656                 printf("'%s'\n", str);
1657                 next;
1658         }
1659         len = length($0);
1660         for (i = 2; i <= len; i++) {
1661                 c = substr(str, i, 1);
1662                 if (!opt[c]) {
1663                         printf("-%s\n", substr(str, i));
1664                         next;
1665                 }
1666                 printf("-%s\n", c);
1667                 if (arg[c]) {
1668                         if (i < len)
1669                                 printf("'%s'\n", substr(str, i + 1));
1670                         else
1671                                 expect = 1;
1672                         next;
1673                 }
1674         }
1675 }
1676 END {
1677         if (expect)
1678                 print "?";
1679 }
1680 EOF
1681
1682 : process the command line options
1683 set X `for arg in "$@"; do echo "X$arg"; done |
1684         sed -e s/X// | awk -f options.awk`
1685 eval "set $*"
1686 shift
1687 rm -f options.awk
1688
1689 : set up default values
1690 fastread=''
1691 reuseval=false
1692 config_sh=''
1693 alldone=''
1694 error=''
1695 silent=''
1696 extractsh=''
1697 knowitall=''
1698 rm -f optdef.sh posthint.sh
1699 cat >optdef.sh <<EOS
1700 $startsh
1701 EOS
1702
1703
1704 : option parsing
1705 while test $# -gt 0; do
1706         case "$1" in
1707         -d) shift; fastread=yes;;
1708         -e) shift; alldone=cont;;
1709         -f)
1710                 shift
1711                 cd ..
1712                 if test -r "$1"; then
1713                         config_sh="$1"
1714                 else
1715                         echo "$me: cannot read config file $1." >&2
1716                         error=true
1717                 fi
1718                 cd UU
1719                 shift;;
1720         --help|\
1721         -h) shift; error=true;;
1722         -r) shift; reuseval=true;;
1723         -s) shift; silent=true; realsilent=true;;
1724         -E) shift; alldone=exit;;
1725         -K) shift; knowitall=true;;
1726         -O) shift;;
1727         -S) shift; silent=true; extractsh=true;;
1728         -D)
1729                 shift
1730                 case "$1" in
1731                 *=)
1732                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1733                         echo "$me: ignoring -D $1" >&2
1734                         ;;
1735                 *=*) echo "$1" | \
1736                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1737                 *) echo "$1='define'" >> optdef.sh;;
1738                 esac
1739                 shift
1740                 ;;
1741         -U)
1742                 shift
1743                 case "$1" in
1744                 *=) echo "$1" >> optdef.sh;;
1745                 *=*)
1746                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1747                         echo "$me: ignoring -U $1" >&2
1748                         ;;
1749                 *) echo "$1='undef'" >> optdef.sh;;
1750                 esac
1751                 shift
1752                 ;;
1753         -A)
1754             shift
1755             xxx=''
1756             yyy="$1"
1757             zzz=''
1758             uuu=undef
1759             case "$yyy" in
1760             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1761                  case "$zzz" in
1762                  *:*) zzz='' ;;
1763                  *)   xxx=append
1764                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1765                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1766                  esac
1767                  ;;
1768             esac
1769             case "$xxx" in
1770             '')  case "$yyy" in
1771                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1772                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1773                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1774                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1775                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1776                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1777                  esac
1778                  ;;
1779             esac
1780             case "$xxx" in
1781             append)
1782                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1783             clear)
1784                 echo "$yyy=''"                  >> posthint.sh ;;
1785             define)
1786                 case "$zzz" in
1787                 '') zzz=define ;;
1788                 esac
1789                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1790             eval)
1791                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1792             prepend)
1793                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1794             undef)
1795                 case "$zzz" in
1796                 '') zzz="$uuu" ;;
1797                 esac
1798                 echo "$yyy=$zzz"                >> posthint.sh ;;
1799             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1800             esac
1801             shift
1802             ;;
1803         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1804             exit 0;;
1805         --) break;;
1806         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1807         *) break;;
1808         esac
1809 done
1810
1811 case "$error" in
1812 true)
1813         cat >&2 <<EOM
1814 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1815                  [-U symbol] [-U symbol=] [-A command:symbol...]
1816   -d : use defaults for all answers.
1817   -e : go on without questioning past the production of config.sh.
1818   -f : specify an alternate default configuration file.
1819   -h : print this help message and exit (with an error status).
1820   -r : reuse C symbols value if possible (skips costly nm extraction).
1821   -s : silent mode, only echoes questions and essential information.
1822   -D : define symbol to have some value:
1823          -D symbol         symbol gets the value 'define'
1824          -D symbol=value   symbol gets the value 'value'
1825        common used examples (see INSTALL for more info):
1826          -Duse64bitint            use 64bit integers
1827          -Duse64bitall            use 64bit integers and pointers
1828          -Dusethreads             use thread support
1829          -Dinc_version_list=none  do not include older perl trees in @INC
1830          -DEBUGGING=none          DEBUGGING options
1831          -Dcc=gcc                 choose your compiler
1832          -Dprefix=/opt/perl5      choose your destination
1833   -E : stop at the end of questions, after having produced config.sh.
1834   -K : do not use unless you know what you are doing.
1835   -O : ignored for backward compatibility
1836   -S : perform variable substitutions on all .SH files (can mix with -f)
1837   -U : undefine symbol:
1838          -U symbol    symbol gets the value 'undef'
1839          -U symbol=   symbol gets completely empty
1840        e.g.:  -Uversiononly
1841   -A : manipulate symbol after the platform specific hints have been applied:
1842          -A append:symbol=value   append value to symbol
1843          -A symbol=value          like append:, but with a separating space
1844          -A define:symbol=value   define symbol to have value
1845          -A clear:symbol          define symbol to be ''
1846          -A define:symbol         define symbol to be 'define'
1847          -A eval:symbol=value     define symbol to be eval of value
1848          -A prepend:symbol=value  prepend value to symbol
1849          -A undef:symbol          define symbol to be 'undef'
1850          -A undef:symbol=         define symbol to be ''
1851        e.g.:  -A prepend:libswanted='cl pthread '
1852               -A ccflags=-DSOME_MACRO
1853   -V : print version number and exit (with a zero status).
1854 EOM
1855         exit 1
1856         ;;
1857 esac
1858
1859 : Sanity checks
1860 case "$fastread$alldone" in
1861 yescont|yesexit) ;;
1862 *)
1863         case "$extractsh" in
1864         true) ;;
1865         *)
1866                 if test ! -t 0; then
1867                         echo "Say 'sh Configure', not 'sh <Configure'"
1868                         exit 1
1869                 fi
1870                 ;;
1871         esac
1872         ;;
1873 esac
1874
1875 exec 4>&1
1876 case "$silent" in
1877 true) exec 1>/dev/null;;
1878 esac
1879
1880 : run the defines and the undefines, if any, but leave the file out there...
1881 touch optdef.sh
1882 grep '\\' optdef.sh >/dev/null 2>&1
1883 if test $? = 0; then
1884     echo "Configure does not support \\ in -D arguments"
1885     exit 1
1886 fi
1887 . ./optdef.sh
1888 : create the posthint manipulation script and leave the file out there...
1889 touch posthint.sh
1890
1891 : set package name
1892 package='perl5'
1893 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1894 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1895 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1896 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1897 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1898 esac
1899
1900 : Some greps do not return status, grrr.
1901 echo "grimblepritz" >grimble
1902 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1903         contains=contains
1904 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1905         contains=grep
1906 else
1907         contains=contains
1908 fi
1909 rm -f grimble
1910 : the following should work in any shell
1911 case "$contains" in
1912 contains*)
1913         echo " "
1914         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1915         cat >contains <<'EOSS'
1916 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1917 EOSS
1918 chmod +x contains
1919 esac
1920
1921 : Find the path to the source tree
1922 case "$src" in
1923 '') case "$0" in
1924     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1925          case "$src" in
1926          /*)    ;;
1927          .)     ;;
1928          *)     src=`cd ../$src && pwd` ;;
1929          esac
1930          ;;
1931     *)   src='.';;
1932     esac;;
1933 esac
1934 case "$src" in
1935 '')     src=/
1936         rsrc=/
1937         ;;
1938 /*)     rsrc="$src";;
1939 *)      rsrc="../$src";;
1940 esac
1941 if test -f $rsrc/Configure && \
1942         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1943 then
1944    : found it, so we are ok.
1945 else
1946         rsrc=''
1947         for src in . .. ../.. ../../.. ../../../..; do
1948                 if test -f ../$src/Configure && \
1949                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1950                 then
1951                         rsrc=../$src
1952                         break
1953                 fi
1954         done
1955 fi
1956 case "$rsrc" in
1957 '')
1958         cat <<EOM >&4
1959
1960 Sorry, I can't seem to locate the source dir for $package.  Please start
1961 Configure with an explicit path -- i.e. /some/path/Configure.
1962
1963 EOM
1964         exit 1
1965         ;;
1966 ../.)   rsrc='..';;
1967 *)
1968         echo " "
1969         echo "Sources for $package found in \"$src\"." >&4
1970         ;;
1971 esac
1972
1973 : script used to extract .SH files with variable substitutions
1974 cat >extract <<'EOS'
1975 PERL_CONFIG_SH=true
1976 echo "Doing variable substitutions on .SH files..."
1977 if test -f MANIFEST; then
1978         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1979 else
1980         echo "(Looking for .SH files under the source directory.)"
1981         set x `(cd "$src"; find . -name "*.SH" -print)`
1982 fi
1983 shift
1984 case $# in
1985 0) set x `(cd "$src"; echo *.SH)`; shift;;
1986 esac
1987 if test ! -f "$src/$1"; then
1988         shift
1989 fi
1990 mkdir_p='
1991 name=$1;
1992 create="";
1993 while test $name; do
1994         if test ! -d "$name"; then
1995                 create="$name $create";
1996                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1997                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1998         else
1999                 name="";
2000         fi;
2001 done;
2002 for file in $create; do
2003         mkdir $file;
2004 done
2005 '
2006 for file in $*; do
2007         case "$src" in
2008         ".")
2009                 case "$file" in
2010                 */*)
2011                         dir=`expr X$file : 'X\(.*\)/'`
2012                         file=`expr X$file : 'X.*/\(.*\)'`
2013                         (cd "$dir" && . ./$file)
2014                         ;;
2015                 *)
2016                         . ./$file
2017                         ;;
2018                 esac
2019                 ;;
2020         *)
2021                 case "$file" in
2022                 */*)
2023                         dir=`expr X$file : 'X\(.*\)/'`
2024                         file=`expr X$file : 'X.*/\(.*\)'`
2025                         (set x $dir; shift; eval $mkdir_p)
2026                         sh <"$src/$dir/$file"
2027                         ;;
2028                 *)
2029                         sh <"$src/$file"
2030                         ;;
2031                 esac
2032                 ;;
2033         esac
2034 done
2035 if test -f "$src/config_h.SH"; then
2036         if test ! -f config.h; then
2037         : oops, they left it out of MANIFEST, probably, so do it anyway.
2038         . "$src/config_h.SH"
2039         fi
2040 fi
2041 EOS
2042
2043 : extract files and exit if asked to do so
2044 case "$extractsh" in
2045 true)
2046         case "$realsilent" in
2047         true) ;;
2048         *) exec 1>&4;;
2049         esac
2050         case "$config_sh" in
2051         '') config_sh='config.sh';;
2052         esac
2053         echo " "
2054         echo "Fetching answers from $config_sh..."
2055         cd ..
2056         . $config_sh
2057         . UU/optdef.sh
2058         echo " "
2059         . UU/extract
2060         rm -rf UU
2061         echo "Extraction done."
2062         exit 0
2063         ;;
2064 esac
2065
2066 : Eunice requires " " instead of "", can you believe it
2067 echo " "
2068 : Here we go...
2069 echo "Beginning of configuration questions for $package."
2070
2071 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2072
2073 : first determine how to suppress newline on echo command
2074 echo " "
2075 echo "Checking echo to see how to suppress newlines..."
2076 (echo "hi there\c" ; echo " ") >.echotmp
2077 if $contains c .echotmp >/dev/null 2>&1 ; then
2078         echo "...using -n."
2079         n='-n'
2080         c=''
2081 else
2082         cat <<'EOM'
2083 ...using \c
2084 EOM
2085         n=''
2086         c='\c'
2087 fi
2088 echo $n "The star should be here-->$c"
2089 echo '*'
2090 rm -f .echotmp
2091
2092 : Now test for existence of everything in MANIFEST
2093 echo " "
2094 if test -f "$rsrc/MANIFEST"; then
2095         echo "First let's make sure your kit is complete.  Checking..." >&4
2096         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2097                 (split -l 50 2>/dev/null || split -50)
2098         rm -f missing
2099         tmppwd=`pwd`
2100         for filelist in x??; do
2101                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2102                         >/dev/null 2>>"$tmppwd/missing")
2103         done
2104         if test -s missing; then
2105                 cat missing >&4
2106                 cat >&4 <<'EOM'
2107
2108 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2109
2110 You have the option of continuing the configuration process, despite the
2111 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2112 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2113 and contact the author (perlbug@perl.org).
2114
2115 EOM
2116                 echo $n "Continue? [n] $c" >&4
2117                 read ans
2118                 case "$ans" in
2119                 y*)
2120                         echo "Continuing..." >&4
2121                         rm -f missing
2122                         ;;
2123                 *)
2124                         echo "ABORTING..." >&4
2125                         kill $$
2126                         ;;
2127                 esac
2128         else
2129                 echo "Looks good..."
2130         fi
2131 else
2132         echo "There is no MANIFEST file.  I hope your kit is complete !"
2133 fi
2134 rm -f missing x??
2135
2136 : Find the appropriate value for a newline for tr
2137 if test -n "$DJGPP"; then
2138        trnl='\012'
2139 fi
2140 if test X"$trnl" = X; then
2141         case "`echo foo | tr '\n' x 2>/dev/null`" in
2142         foox) trnl='\n' ;;
2143         esac
2144 fi
2145 if test X"$trnl" = X; then
2146         case "`echo foo | tr '\012' x 2>/dev/null`" in
2147         foox) trnl='\012' ;;
2148         esac
2149 fi
2150 if test X"$trnl" = X; then
2151        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2152        fooxy) trnl='\n\r' ;;
2153        esac
2154 fi
2155 if test X"$trnl" = X; then
2156         cat <<EOM >&2
2157
2158 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2159
2160 EOM
2161         exit 1
2162 fi
2163
2164 : compute the number of columns on the terminal for proper question formatting
2165 case "$COLUMNS" in
2166 '') COLUMNS='80';;
2167 esac
2168
2169 : set up the echo used in my read
2170 myecho="case \"\$xxxm\" in
2171 '') echo $n \"\$rp $c\" >&4;;
2172 *) case \"\$rp\" in
2173         '') echo $n \"[\$xxxm] $c\";;
2174         *)
2175                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2176                         echo \"\$rp\" >&4
2177                         echo $n \"[\$xxxm] $c\" >&4
2178                 else
2179                         echo $n \"\$rp [\$xxxm] $c\" >&4
2180                 fi
2181                 ;;
2182         esac;;
2183 esac"
2184
2185 : now set up to do reads with possible shell escape and default assignment
2186 cat <<EOSC >myread
2187 $startsh
2188 xxxm=\$dflt
2189 $myecho
2190 ans='!'
2191 case "\$fastread" in
2192 yes) case "\$dflt" in
2193         '') ;;
2194         *) ans='';
2195                 case "\$silent-\$rp" in
2196                 true-) ;;
2197                 *) echo " " >&4;;
2198                 esac;;
2199         esac;;
2200 *) case "\$silent" in
2201         true) case "\$rp" in
2202                 '') ans='';;
2203                 esac;;
2204         esac;;
2205 esac
2206 while expr "X\$ans" : "X!" >/dev/null; do
2207         read answ
2208         set x \$xxxm
2209         shift
2210         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2211         case  "\$answ" in
2212         "!")
2213                 sh 1>&4
2214                 echo " "
2215                 $myecho
2216                 ;;
2217         !*)
2218                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2219                 shift
2220                 sh 1>&4 -c "\$*"
2221                 echo " "
2222                 $myecho
2223                 ;;
2224         "\$ans")
2225                 case "\$ans" in
2226                 \\&*)
2227                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2228                         shift
2229                         case "\$1" in
2230                         -d)
2231                                 fastread=yes
2232                                 echo "(OK, I'll run with -d after this question.)" >&4
2233                                 ;;
2234                         -*)
2235                                 echo "*** Sorry, \$1 not supported yet." >&4
2236                                 ;;
2237                         esac
2238                         $myecho
2239                         ans=!
2240                         ;;
2241                 esac;;
2242         *)
2243                 case "\$aok" in
2244                 y)
2245                         echo "*** Substitution done -- please confirm."
2246                         xxxm="\$ans"
2247                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2248                         xxxm="\$ans"
2249                         ans=!
2250                         ;;
2251                 *)
2252                         echo "*** Error -- try again."
2253                         ans=!
2254                         ;;
2255                 esac
2256                 $myecho
2257                 ;;
2258         esac
2259         case "\$ans\$xxxm\$nostick" in
2260         '')
2261                 ans=!
2262                 $myecho
2263                 ;;
2264         esac
2265 done
2266 case "\$ans" in
2267 '') ans="\$xxxm";;
2268 esac
2269 EOSC
2270
2271 : create .config dir to save info across Configure sessions
2272 test -d ../.config || mkdir ../.config
2273 cat >../.config/README <<EOF
2274 This directory created by Configure to save information that should
2275 persist across sessions for $package.
2276
2277 You may safely delete it if you wish.
2278 EOF
2279
2280 : See if we are using a devel version and want that
2281 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2282 case "$usedevel" in
2283 $define|true|[yY]*)
2284     usedevel="$define" ;;
2285 *) case "$xversion" in
2286    *[13579])
2287         cat >&4 <<EOH
2288 *** WHOA THERE!!! ***
2289
2290     This is an UNSTABLE DEVELOPMENT release.
2291     The version of this $package distribution is $xversion, that is, odd,
2292     (as opposed to even) and that signifies a development release.
2293     If you want a maintenance release, you want an even-numbered version.
2294
2295     Do ***NOT*** install this into production use.
2296     Data corruption and crashes are possible.
2297
2298     It is most seriously suggested that you do not continue any further
2299     unless you want to help in developing and debugging Perl.
2300
2301     If you *still* want to build perl, you can answer 'y' now,
2302     or pass -Dusedevel to Configure.
2303
2304 EOH
2305         rp='Do you really want to continue?'
2306         dflt='n'
2307         . ./myread
2308         case "$ans" in
2309         [yY]) echo >&4 "Okay, continuing."
2310               usedevel="$define" ;;
2311         *) echo >&4 "Okay, bye."
2312            exit 1
2313            ;;
2314         esac
2315         ;;
2316     esac
2317     usedevel="$undef"
2318     ;;
2319 esac
2320 case "$usedevel" in
2321 $define|true|[yY]*)
2322         case "$versiononly" in
2323         '') versiononly="$define" ;;
2324         esac
2325         case "$installusrbinperl" in
2326         '') installusrbinperl="$undef" ;;
2327         esac
2328         ;;
2329 esac
2330
2331 : general instructions
2332 needman=true
2333 firsttime=true
2334 user=`(logname) 2>/dev/null`
2335 case "$user" in
2336 '') user=`whoami 2>&1`;;
2337 esac
2338 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2339         firsttime=false
2340         echo " "
2341         rp='Would you like to see the instructions?'
2342         dflt=n
2343         . ./myread
2344         case "$ans" in
2345         [yY]*) ;;
2346         *) needman=false;;
2347         esac
2348 fi
2349 if $needman; then
2350         cat <<EOH
2351
2352 This installation shell script will examine your system and ask you questions
2353 to determine how the perl5 package should be installed. If you get
2354 stuck on a question, you may use a ! shell escape to start a subshell or
2355 execute a command.  Many of the questions will have default answers in square
2356 brackets; typing carriage return will give you the default.
2357
2358 On some of the questions which ask for file or directory names you are allowed
2359 to use the ~name construct to specify the login directory belonging to "name",
2360 even if you don't have a shell which knows about that.  Questions where this is
2361 allowed will be marked "(~name ok)".
2362
2363 EOH
2364         rp=''
2365         dflt='Type carriage return to continue'
2366         . ./myread
2367         cat <<'EOH'
2368
2369 The prompter used in this script allows you to use shell variables and
2370 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2371 in the default answer, as if the default line was a set of arguments given to a
2372 script shell.  This means you may also use $* to repeat the whole default line,
2373 so you do not have to re-type everything to add something to the default.
2374
2375 Every time there is a substitution, you will have to confirm.  If there is an
2376 error (e.g. an unmatched backtick), the default answer will remain unchanged
2377 and you will be prompted again.
2378
2379 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2380 the questions and use the computed defaults (or the previous answers if there
2381 was already a config.sh file). Type 'Configure -h' for a list of options.
2382 You may also start interactively and then answer '& -d' at any prompt to turn
2383 on the non-interactive behaviour for the remainder of the execution.
2384
2385 EOH
2386         . ./myread
2387         cat <<EOH
2388
2389 Much effort has been expended to ensure that this shell script will run on any
2390 Unix system.  If despite that it blows up on yours, your best bet is to edit
2391 Configure and run it again.  If you can't run Configure for some reason,
2392 you'll have to generate a config.sh file by hand.  Whatever problems you
2393 have, let me (perlbug@perl.org) know how I blew it.
2394
2395 This installation script affects things in two ways:
2396
2397 1) it may do direct variable substitutions on some of the files included
2398    in this kit.
2399 2) it builds a config.h file for inclusion in C programs.  You may edit
2400    any of these files as the need arises after running this script.
2401
2402 If you make a mistake on a question, there is no easy way to back up to it
2403 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2404 files.  Configure will offer to let you do this before it runs the SH files.
2405
2406 EOH
2407         dflt='Type carriage return to continue'
2408         . ./myread
2409         case "$firsttime" in
2410         true) echo $user >>../.config/instruct;;
2411         esac
2412 fi
2413
2414 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2415 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2416 if test "X$sysroot" = X; then
2417     sysroot=""
2418 else
2419     case "$cc" in
2420         *gcc*|*g++*)
2421             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2422             # _sysroot is used in places where we need --sysroot=foo
2423             # but using the rest of the flags could cause issues.
2424             _sysroot="--sysroot=$sysroot";
2425             case "$ccflags" in
2426                 *sysroot*) ;;
2427                 'undef'|*)
2428                 ccflags="$ccflags $_sysroot"
2429             esac
2430             case "$ldflags" in
2431                 *sysroot*) ;;
2432                 'undef'|*)
2433                 ldflags="$ldflags $_sysroot"
2434             esac
2435             case "$cppflags" in
2436                 *sysroot*) ;;
2437                 'undef'|*)
2438                 cppflags="$cppflags $_sysroot"
2439             esac
2440             # lddlflags updated below in lddlflags section;
2441             # same with cccdlflags
2442             ;;
2443     esac
2444
2445     # Adjust some defaults to also use $sysroot
2446     for var in xlibpth loclibpth locincpth glibpth; do
2447         eval xxx=\$$var
2448         eval $var=''
2449         for path in $xxx; do
2450             eval $var=\"\$$var $sysroot$path\"
2451         done
2452     done
2453
2454 fi
2455
2456 : find out where common programs are
2457 echo " "
2458 echo "Locating common programs..." >&4
2459 cat <<EOSC >loc
2460 $startsh
2461 case \$# in
2462 0) exit 1;;
2463 esac
2464 thing=\$1
2465 shift
2466 dflt=\$1
2467 shift
2468 for dir in \$*; do
2469         case "\$thing" in
2470         .)
2471         if test -d \$dir/\$thing; then
2472                 echo \$dir
2473                 exit 0
2474         fi
2475         ;;
2476         *)
2477         for thisthing in \$dir/\$thing; do
2478                 : just loop through to pick last item
2479         done
2480         if test -f \$thisthing; then
2481                 echo \$thisthing
2482                 exit 0
2483         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2484                 echo \$thisthing
2485                 exit 0
2486         elif test -f \$dir/\$thing.exe; then
2487                 if test -n "$DJGPP"; then
2488                         echo \$dir/\$thing.exe
2489                 elif test "$eunicefix" != ":"; then
2490                         : on Eunice apparently
2491                         echo \$dir/\$thing
2492                 fi
2493                 exit 0
2494         fi
2495         ;;
2496         esac
2497 done
2498 echo \$dflt
2499 exit 1
2500 EOSC
2501 chmod +x loc
2502 $eunicefix loc
2503 loclist="
2504 awk
2505 cat
2506 chmod
2507 comm
2508 cp
2509 echo
2510 expr
2511 grep
2512 ls
2513 mkdir
2514 rm
2515 sed
2516 sort
2517 touch
2518 tr
2519 uniq
2520 "
2521 trylist="
2522 ar
2523 bison
2524 byacc
2525 cpp
2526 csh
2527 date
2528 egrep
2529 gmake
2530 gzip
2531 less
2532 ln
2533 make
2534 more
2535 nm
2536 nroff
2537 perl
2538 pg
2539 test
2540 uname
2541 zip
2542 "
2543 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2544 pth="$pth $sysroot/lib $sysroot/usr/lib"
2545 for file in $loclist; do
2546         eval xxx=\$$file
2547         case "$xxx" in
2548         /*|?:[\\/]*)
2549                 if test -f "$xxx"; then
2550                         : ok
2551                 else
2552                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2553                         xxx=`./loc $file $file $pth`
2554                 fi
2555                 ;;
2556         '') xxx=`./loc $file $file $pth`;;
2557         *) xxx=`./loc $xxx $xxx $pth`;;
2558         esac
2559         eval $file=$xxx$_exe
2560         eval _$file=$xxx
2561         case "$xxx" in
2562         /*)
2563                 echo $file is in $xxx.
2564                 ;;
2565         ?:[\\/]*)
2566                 echo $file is in $xxx.
2567                 ;;
2568         *)
2569                 echo "I don't know where '$file' is, and my life depends on it." >&4
2570                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2571                 exit 1
2572                 ;;
2573         esac
2574 done
2575 echo " "
2576 echo "Don't worry if any of the following aren't found..."
2577 say=offhand
2578 for file in $trylist; do
2579         eval xxx=\$$file
2580         case "$xxx" in
2581         /*|?:[\\/]*)
2582                 if test -f "$xxx"; then
2583                         : ok
2584                 else
2585                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2586                         xxx=`./loc $file $file $pth`
2587                 fi
2588                 ;;
2589         '') xxx=`./loc $file $file $pth`;;
2590         *) xxx=`./loc $xxx $xxx $pth`;;
2591         esac
2592         eval $file=$xxx$_exe
2593         eval _$file=$xxx
2594         case "$xxx" in
2595         /*)
2596                 echo $file is in $xxx.
2597                 ;;
2598         ?:[\\/]*)
2599                 echo $file is in $xxx.
2600                 ;;
2601         *)
2602                 echo "I don't see $file out there, $say."
2603                 say=either
2604                 ;;
2605         esac
2606 done
2607 case "$egrep" in
2608 egrep)
2609         echo "Substituting grep for egrep."
2610         egrep=$grep
2611         _egrep=$grep
2612         ;;
2613 esac
2614 case "$less" in
2615 '')     ;;
2616 *)      if $less -R </dev/null >/dev/null 2>&1; then
2617                echo "Substituting less -R for less."
2618                less="$less -R"
2619                _less=$less
2620         fi
2621         ;;
2622 esac
2623 case "$ln" in
2624 ln)
2625         echo "Substituting cp for ln."
2626         ln=$cp
2627         _ln=$cp
2628         ;;
2629 esac
2630 case "$make" in
2631 make)
2632         case "$gmake" in
2633         gmake)
2634         echo "I can't find make or gmake, and my life depends on it." >&4
2635         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2636         exit 1
2637         ;;
2638         esac
2639         ;;
2640 esac
2641 case "$gmake" in
2642 gmake)  ;;
2643 *)      # We can't have osname yet.
2644         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2645                 # Assume that gmake, if found, is definitely GNU make
2646                 # and prefer it over the system make.
2647                 echo "Substituting gmake for make."
2648                 make=$gmake
2649                 _make=$gmake
2650         fi
2651         ;;
2652 esac
2653 case "$test" in
2654 test)
2655         echo "Hopefully test is built into your sh."
2656         ;;
2657 *)
2658         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2659                 echo "Using the test built into your sh."
2660                 test=test
2661                 _test=test
2662         fi
2663         ;;
2664 esac
2665 case "$echo" in
2666 echo)
2667         echo "Hopefully echo is built into your sh."
2668         ;;
2669 '') ;;
2670 *)
2671         echo " "
2672 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2673         $echo $n "hi there$c" >foo1
2674         echo $n "hi there$c" >foo2
2675         if cmp foo1 foo2 >/dev/null 2>&1; then
2676                 echo "They are compatible.  In fact, they may be identical."
2677         else
2678                 case "$n" in
2679                 '-n') n='' c='\c';;
2680                 *) n='-n' c='';;
2681                 esac
2682                 cat <<FOO
2683 They are not compatible!  You are probably running ksh on a non-USG system.
2684 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2685 have echo built in and we may have to run some Bourne shell scripts.  That
2686 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2687
2688 FOO
2689                 $echo $n "The star should be here-->$c"
2690                 $echo "*"
2691         fi
2692         $rm -f foo1 foo2
2693         ;;
2694 esac
2695
2696 # This question was auctioned at YAPC::Europe-2007 in Vienna
2697 # I never promised you could answer it. I only auctioned the question.
2698 cat <<FOO
2699 The following message is sponsored by
2700
2701   Dresden.pm<--The stars should be here.
2702
2703 Dear Perl user, system administrator or package
2704 maintainer, the Perl community sends greetings to
2705 you. Do you (emblematical) greet back [Y/n]? n
2706
2707 FOO
2708
2709 : Check what type of C compiler we use
2710 cat <<EOS >trygcc
2711 $startsh
2712 EOS
2713 cat <<'EOSC' >>trygcc
2714 case "$cc" in
2715 '') ;;
2716 *)  $rm -f try try.*
2717     $cat >try.c <<EOM
2718 int main(int argc, char *argv[]) {
2719   return 0;
2720 }
2721 EOM
2722     if $cc -o try $ccflags $ldflags try.c; then
2723        :
2724     else
2725         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2726         despair=yes
2727         trygcc=yes
2728         case "$cc" in
2729         *gcc*) trygcc=no ;;
2730         esac
2731         # Skip this test because it gives a false match on output like:
2732         #    ./trygcc: line 23: cc: command not found
2733         # case "`$cc -v -c try.c 2>&1`" in
2734         # *gcc*) trygcc=no ;;
2735         # esac
2736         if $test X"$trygcc" = Xyes; then
2737             if gcc -o try -c try.c; then
2738                 echo " "
2739                 echo "You seem to have a working gcc, though." >&4
2740                 # Switching compilers may undo the work of hints files.
2741                 # The most common problem is -D_REENTRANT for threads.
2742                 # This heuristic catches that case, but gets false positives
2743                 # if -Dusethreads was not actually specified.  Better to
2744                 # bail out here with a useful message than fail
2745                 # mysteriously later. Should we perhaps just try to
2746                 # re-invoke Configure -Dcc=gcc config_args ?
2747                 if $test -f usethreads.cbu; then
2748                         $cat >&4 <<EOM
2749
2750 *** However, any setting of the C compiler flags (e.g. for thread support)
2751 *** will be lost.  It may be necessary for you to restart Configure and
2752 *** add -Dcc=gcc to your Configure command line.
2753
2754 EOM
2755                         rp="Would you like to go ahead and try gcc anyway?"
2756                         dflt=n
2757                 else
2758                         rp="Would you like to use it?"
2759                         dflt=y
2760                 fi
2761                 if $test -f myread; then
2762                     . ./myread
2763                 else
2764                     if $test -f UU/myread; then
2765                         . ./UU/myread
2766                     else
2767                         echo "Cannot find myread, sorry.  Aborting." >&2
2768                         exit 1
2769                     fi
2770                 fi
2771                 case "$ans" in
2772                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2773                 esac
2774             fi
2775         fi
2776     fi
2777     $rm -f try try.*
2778     ;;
2779 esac
2780 EOSC
2781
2782 cat <<EOS >checkcc
2783 $startsh
2784 EOS
2785 cat <<'EOSC' >>checkcc
2786 case "$cc" in
2787 '') ;;
2788 *)  $rm -f try try.*
2789     $cat >try.c <<EOM
2790 int main(int argc, char *argv[]) {
2791   return 0;
2792 }
2793 EOM
2794     if $cc -o try $ccflags $ldflags try.c; then
2795        :
2796     else
2797         if $test X"$despair" = Xyes; then
2798            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2799         fi
2800         $cat >&4 <<EOM
2801 You need to find a working C compiler.
2802 Either (purchase and) install the C compiler supplied by your OS vendor,
2803 or for a free C compiler try http://gcc.gnu.org/
2804 I cannot continue any further, aborting.
2805 EOM
2806         exit 1
2807     fi
2808     $rm -f try try.*
2809     ;;
2810 esac
2811 EOSC
2812
2813 : determine whether symbolic links are supported
2814 echo " "
2815 $touch blurfl
2816 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2817         echo "Symbolic links are supported." >&4
2818         lns="$ln -s"
2819 else
2820         echo "Symbolic links are NOT supported." >&4
2821         lns="$ln"
2822 fi
2823 $rm -f blurfl sym
2824
2825 : determine whether symbolic links are supported
2826 echo " "
2827 case "$lns" in
2828 *"ln"*" -s")
2829         echo "Checking how to test for symbolic links..." >&4
2830         $lns blurfl sym
2831         if $test "X$issymlink" = X; then
2832                 case "$newsh" in
2833                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2834                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2835                 esac
2836                 if test $? = 0; then
2837                         issymlink="test -h"
2838                 else
2839                         echo "Your builtin 'test -h' may be broken." >&4
2840                         case "$test" in
2841                         /*)     ;;
2842                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2843                                 for p in $pth
2844                                 do
2845                                         if test -f "$p/$test"; then
2846                                                 test="$p/$test"
2847                                                 break
2848                                         fi
2849                                 done
2850                                 ;;
2851                         esac
2852                         case "$test" in
2853                         /*)
2854                                 echo "Trying external '$test -h'." >&4
2855                                 issymlink="$test -h"
2856                                 if $test ! -h sym >/dev/null 2>&1; then
2857                                         echo "External '$test -h' is broken, too." >&4
2858                                         issymlink=''
2859                                 fi
2860                                 ;;
2861                         *)      issymlink='' ;;
2862                         esac
2863                 fi
2864         fi
2865         if $test "X$issymlink" = X; then
2866                 if $test -L sym 2>/dev/null; then
2867                         issymlink="$test -L"
2868                         echo "The builtin '$test -L' worked." >&4
2869                 fi
2870         fi
2871         if $test "X$issymlink" != X; then
2872                 echo "You can test for symbolic links with '$issymlink'." >&4
2873         else
2874                 echo "I do not know how you can test for symbolic links." >&4
2875         fi
2876         $rm -f blurfl sym
2877         ;;
2878 *)      echo "No symbolic links, so not testing for their testing..." >&4
2879         ;;
2880 esac
2881 echo " "
2882
2883 : Make symlinks util
2884 case "$mksymlinks" in
2885 $define|true|[yY]*)
2886         case "$src" in
2887         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2888                 exit 1
2889                 ;;
2890         *)      case "$lns:$issymlink" in
2891                 *"ln"*" -s:"*"test -"?)
2892                         echo "Creating the symbolic links..." >&4
2893                         cd ..
2894                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2895                         awk 'NF == 1 {
2896                                 dir=".";
2897                                 file=$1 "";
2898                              }
2899                              NF == 2 {
2900                                 dir=$1 "";
2901                                 file=$2 "";
2902                              }
2903                              {
2904                                  print "# dir = ", dir, "file = ", file
2905                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2906                              } END {
2907                                  for (d in mf) {
2908                                      if (d != ".") { print("mkdir -p "d) }
2909                                      print("ln -sf "mf[d]" "d);
2910                                  }
2911                              }' source="$src" > UU/mksymlinks.$$
2912                         sh UU/mksymlinks.$$
2913                         rm UU/mksymlinks.$$
2914                         # Sanity check 1.
2915                         if test ! -d t/base; then
2916                                 echo "Failed to create the subdirectories.  Aborting." >&4
2917                                 exit 1
2918                         fi
2919                         # Sanity check 2.
2920                         if test ! -f t/base/lex.t; then
2921                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2922                                 exit 1
2923                         fi
2924                         if test ! -f win32/win32.c; then
2925                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2926                                 exit 1
2927                         fi
2928                         cd UU
2929                         ;;
2930                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2931                         ;;
2932                 esac
2933                 ;;
2934         esac
2935         ;;
2936 esac
2937
2938 : Check for Cross-Compilation
2939 if $test "X$targethost" = "X"; then
2940     targethost=""
2941 fi
2942 if $test "X$targetenv" = "X"; then
2943     targetenv=""
2944 fi
2945 case "$usecrosscompile" in
2946 $define|true|[yY]*)
2947         $echo "Cross-compiling..."
2948         croak=''
2949         case "$cc" in
2950         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2951             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2952             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2953             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2954             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2955             # leave out ld, choosing it is more complex
2956             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2957             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2958             # We are in a weird spot. Just before us, some values
2959             # were 'saved', to be restored after the hints are
2960             # run.  This means that the changes we made to ar,
2961             # nm and ranlib will get reverted.
2962             # To avoid that, we hijack the saving mechanism and
2963             # have it save our new values.
2964             for file in ar nm ranlib; do
2965                 eval xxx=\$$file
2966                 eval $file=$xxx$_exe
2967                 eval _$file=$xxx
2968             done
2969         ;;
2970         esac
2971         case "$targetarch" in
2972         '') echo "Targetarch not defined." >&4; croak=y ;;
2973         *)  echo "Using targetarch $targetarch." >&4 ;;
2974         esac
2975         case "$targethost" in
2976         '') echo "Targethost not defined." >&4; croak=n ;;
2977         *)  echo "Using targethost $targethost." >&4
2978         esac
2979         locincpth=' '
2980         loclibpth=' '
2981         case "$croak" in
2982         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2983         esac
2984     : compile a host miniperl and generate_uudmap, unless we got passed them
2985     if $test "X$hostperl" = X; then
2986       echo "Building host miniperl and generate_uudmap binaries" >&4
2987       before_host=`pwd`
2988       cd ..
2989       cd $src
2990       src=`pwd`
2991       rm -rf $src/host
2992       mkdir $src/host
2993       cd $src/host
2994       $src/Configure -des -Dusedevel -Dmksymlinks
2995       $make miniperl
2996       case "$hostgenerate" in
2997       '') $make generate_uudmap
2998           hostgenerate=$src/host/generate_uudmap
2999           ;;
3000        "$undef") hostgenerate=''
3001           ;;
3002       esac
3003       hostperl=$src/host/miniperl
3004       cd $before_host
3005     fi
3006     hostosname=`$hostperl -le 'print $^O'`
3007     ;;
3008 *)
3009     usecrosscompile="$undef"
3010     ;;
3011 esac
3012
3013 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3014 case "$targethost" in
3015     '') echo "Checking for cross-compile" >&4
3016     case "$usecrosscompile$multiarch" in
3017        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3018          if [ -f Makefile ]; then
3019            echo " "
3020            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3021          else
3022            echo "Configure done."
3023          fi
3024        exit 0
3025        ;;
3026      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3027         run=''
3028         to=:
3029         from=:
3030         ;;
3031     esac
3032     ;;
3033     *) echo "Using targethost $targethost." >&4
3034         case "$src" in
3035         /*) run=$src/Cross/run
3036             targetmkdir=$src/Cross/mkdir
3037             to=$src/Cross/to
3038             from=$src/Cross/from
3039             ;;
3040         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3041             run=$pwd/Cross/run
3042             targetmkdir=$pwd/Cross/mkdir
3043             to=$pwd/Cross/to
3044             from=$pwd/Cross/from
3045             ;;
3046         esac
3047         case "$targetrun" in
3048         '') targetrun=ssh ;;
3049         esac
3050         case "$targetto" in
3051         '') targetto=scp ;;
3052         esac
3053         case "$targetfrom" in
3054         '') targetfrom=scp ;;
3055         esac
3056         run=$run-$targetrun
3057         to=$to-$targetto
3058         from=$from-$targetfrom
3059         case "$targetdir" in
3060         '')  targetdir=/tmp
3061              echo "Guessing targetdir $targetdir." >&4
3062              ;;
3063         esac
3064         case "$targetuser" in
3065         '')  targetuser=root
3066              echo "Guessing targetuser $targetuser." >&4
3067              ;;
3068         esac
3069         case "$targetport" in
3070         '')  targetport=22
3071              echo "Guessing targetport $targetport." >&4
3072              ;;
3073         esac
3074         case "$targetfrom" in
3075         scp)    q=-q ;;
3076         *)      q='' ;;
3077         esac
3078         case "$targetrun" in
3079         ssh|rsh)
3080             cat >$run <<EOF
3081 #!/bin/sh
3082 env=''
3083 case "\$1" in
3084 -cwd)
3085   shift
3086   cwd=\$1
3087   shift
3088   ;;
3089 esac
3090 case "\$1" in
3091 -env)
3092   shift
3093   env=\$1
3094   shift
3095   ;;
3096 esac
3097 case "\$cwd" in
3098 '') cwd=$targetdir ;;
3099 esac
3100 exe=\$1
3101 shift
3102 $to \$exe
3103 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3104 EOF
3105             ;;
3106         adb)
3107             $touch $run
3108             ;;
3109         *)  echo "Unknown targetrun '$targetrun'" >&4
3110             exit 1
3111             ;;
3112         esac
3113         case "$targetmkdir" in
3114         */Cross/mkdir)
3115             cat >$targetmkdir <<EOF
3116 #!/bin/sh
3117 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3118 EOF
3119             $chmod a+rx $targetmkdir
3120             ;;
3121         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3122             exit 1
3123             ;;
3124         esac
3125         case "$targetto" in
3126         scp|rcp)
3127             cat >$to <<EOF
3128 #!/bin/sh
3129 for f in \$@
3130 do
3131   case "\$f" in
3132   /*)
3133     $targetmkdir \`dirname \$f\`
3134     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3135     ;;
3136   *)
3137     $targetmkdir $targetdir/\`dirname \$f\`
3138     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3139     ;;
3140   esac
3141 done
3142 exit 0
3143 EOF
3144             ;;
3145         cp) cat >$to <<EOF
3146 #!/bin/sh
3147 for f in \$@
3148 do
3149   case "\$f" in
3150   /*)
3151     $mkdir -p $targetdir/\`dirname \$f\`
3152     $cp \$f $targetdir/\$f || exit 1
3153     ;;
3154   *)
3155     $targetmkdir $targetdir/\`dirname \$f\`
3156     $cp \$f $targetdir/\$f || exit 1
3157     ;;
3158   esac
3159 done
3160 exit 0
3161 EOF
3162             ;;
3163         *)  echo "Unknown targetto '$targetto'" >&4
3164             exit 1
3165             ;;
3166         esac
3167         case "$targetfrom" in
3168         scp|rcp)
3169           cat >$from <<EOF
3170 #!/bin/sh
3171 for f in \$@
3172 do
3173   $rm -f \$f
3174   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3175 done
3176 exit 0
3177 EOF
3178             ;;
3179         cp) cat >$from <<EOF
3180 #!/bin/sh
3181 for f in \$@
3182 do
3183   $rm -f \$f
3184   cp $targetdir/\$f . || exit 1
3185 done
3186 exit 0
3187 EOF
3188             ;;
3189         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3190             exit 1
3191             ;;
3192         esac
3193         if $test ! -f $run; then
3194             echo "Target 'run' script '$run' not found." >&4
3195         else
3196             $chmod a+rx $run
3197         fi
3198         if $test ! -f $to; then
3199             echo "Target 'to' script '$to' not found." >&4
3200         else
3201             $chmod a+rx $to
3202         fi
3203         if $test ! -f $from; then
3204             echo "Target 'from' script '$from' not found." >&4
3205         else
3206             $chmod a+rx $from
3207         fi
3208         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3209             exit 1
3210         fi
3211         cat >&4 <<EOF
3212 Using '$run' for remote execution,
3213 and '$from' and '$to'
3214 for remote file transfer.
3215 EOF
3216         ;;
3217 *)      run=''
3218         to=:
3219         from=:
3220         usecrosscompile="$undef"
3221         targetarch=''
3222         ;;
3223 esac
3224
3225 : see whether [:lower:] and [:upper:] are supported character classes
3226 echo " "
3227 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3228 ABYZ-abyz)
3229         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3230         up='[:upper:]'
3231         low='[:lower:]'
3232         ;;
3233 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3234         # (0xd9 and 0xe2), therefore that is a nice testing point.
3235         if test "X$up" = X -o "X$low" = X; then
3236             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3237             rs) up='[A-Z]'
3238                 low='[a-z]'
3239                 ;;
3240             esac
3241         fi
3242         if test "X$up" = X -o "X$low" = X; then
3243             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3244             rs) up='A-Z'
3245                 low='a-z'
3246                 ;;
3247             esac
3248         fi
3249         if test "X$up" = X -o "X$low" = X; then
3250             case "`echo RS | od -x 2>/dev/null`" in
3251             *D9E2*|*d9e2*)
3252                 echo "Hey, this might be EBCDIC." >&4
3253                 if test "X$up" = X -o "X$low" = X; then
3254                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3255                     rs) up='[A-IJ-RS-Z]'
3256                         low='[a-ij-rs-z]'
3257                         ;;
3258                     esac
3259                 fi
3260                 if test "X$up" = X -o "X$low" = X; then
3261                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3262                     rs) up='A-IJ-RS-Z'
3263                         low='a-ij-rs-z'
3264                         ;;
3265                     esac
3266                 fi
3267                 ;;
3268             esac
3269         fi
3270 esac
3271 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3272 rs)
3273     echo "Using $up and $low to convert case." >&4
3274     ;;
3275 *)
3276     echo "I don't know how to translate letters from upper to lower case." >&4
3277     echo "Your tr is not acting any way I know of." >&4
3278     exit 1
3279     ;;
3280 esac
3281 : set up the translation script tr, must be called with ./tr of course
3282 cat >tr <<EOSC
3283 $startsh
3284 case "\$1\$2" in
3285 '[A-Z][a-z]') exec $tr '$up' '$low';;
3286 '[a-z][A-Z]') exec $tr '$low' '$up';;
3287 esac
3288 exec $tr "\$@"
3289 EOSC
3290 chmod +x tr
3291 $eunicefix tr
3292
3293 : Try to determine whether config.sh was made on this system
3294 case "$config_sh" in
3295 '')
3296 myuname=`$uname -a 2>/dev/null`
3297 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3298 # Downcase everything to avoid ambiguity.
3299 # Remove slashes and single quotes so we can use parts of this in
3300 # directory and file names.
3301 # Remove newlines so myuname is sane to use elsewhere.
3302 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3303 # because the A-Z/a-z are not consecutive.
3304 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3305         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3306 newmyuname="$myuname"
3307 dflt=n
3308 case "$knowitall" in
3309 '')
3310         if test -f ../config.sh; then
3311                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3312                         eval "`grep myuname= ../config.sh`"
3313                 fi
3314                 if test "X$myuname" = "X$newmyuname"; then
3315                         dflt=y
3316                 fi
3317         fi
3318         ;;
3319 *) dflt=y;;
3320 esac
3321
3322 : Get old answers from old config file if Configure was run on the
3323 : same system, otherwise use the hints.
3324 hint=default
3325 cd ..
3326 if test -f config.sh; then
3327         echo " "
3328         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3329         . UU/myread
3330         case "$ans" in
3331         n*|N*) echo "OK, I'll ignore it."
3332                 mv config.sh config.sh.old
3333                 myuname="$newmyuname"
3334                 ;;
3335         *)  echo "Fetching default answers from your old config.sh file..." >&4
3336                 tmp_n="$n"
3337                 tmp_c="$c"
3338                 tmp_sh="$sh"
3339                 . ./config.sh
3340                 cp config.sh UU
3341                 n="$tmp_n"
3342                 c="$tmp_c"
3343                 : Older versions did not always set $sh.  Catch re-use of such
3344                 : an old config.sh.
3345                 case "$sh" in
3346                 '') sh="$tmp_sh" ;;
3347                 esac
3348                 hint=previous
3349                 ;;
3350         esac
3351 fi
3352 . ./UU/checkcc
3353 if test ! -f config.sh; then
3354         $cat <<EOM
3355
3356 First time through, eh?  I have some defaults handy for some systems
3357 that need some extra help getting the Configure answers right:
3358
3359 EOM
3360         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3361         dflt=''
3362         : Half the following guesses are probably wrong... If you have better
3363         : tests or hints, please send them to perlbug@perl.org
3364         : The metaconfig authors would also appreciate a copy...
3365         $test -f /irix && osname=irix
3366         $test -f /xenix && osname=sco_xenix
3367         $test -f /dynix && osname=dynix
3368         $test -f /dnix && osname=dnix
3369         $test -f /lynx.os && osname=lynxos
3370         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3371         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3372         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3373         $test -f /bin/mips && /bin/mips && osname=mips
3374         $test -d /usr/apollo/bin && osname=apollo
3375         $test -f /etc/saf/_sactab && osname=svr4
3376         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3377         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3378         $test -f /sys/utilities/MultiView && osname=amigaos
3379         if $test -d /MachTen -o -d /MachTen_Folder; then
3380                 osname=machten
3381                 if $test -x /sbin/version; then
3382                         osvers=`/sbin/version | $awk '{print $2}' |
3383                         $sed -e 's/[A-Za-z]$//'`
3384                 elif $test -x /usr/etc/version; then
3385                         osvers=`/usr/etc/version | $awk '{print $2}' |
3386                         $sed -e 's/[A-Za-z]$//'`
3387                 else
3388                         osvers="$2.$3"
3389                 fi
3390         fi
3391
3392         $test -f /sys/posix.dll &&
3393                 $test -f /usr/bin/what &&
3394                 set X `/usr/bin/what /sys/posix.dll` &&
3395                 $test "$3" = UWIN &&
3396                 osname=uwin &&
3397                 osvers="$5"
3398
3399         if $test -f $uname; then
3400                 set X $myuname
3401                 shift
3402
3403                 case "$5" in
3404                 fps*) osname=fps ;;
3405                 mips*)
3406                         case "$4" in
3407                         umips) osname=umips ;;
3408                         *) osname=mips ;;
3409                         esac;;
3410                 [23]100) osname=mips ;;
3411                 i386*)
3412                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3413                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3414                                 osname='sco'
3415                                 osvers=$tmp
3416                         elif $test -f /etc/kconfig; then
3417                                 osname=isc
3418                                 if test "$lns" = "$ln -s"; then
3419                                         osvers=4
3420                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3421                                         osvers=3
3422                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3423                                         osvers=2
3424                                 fi
3425                         fi
3426                         tmp=''
3427                         ;;
3428                 pc*)
3429                         if test -n "$DJGPP"; then
3430                                 osname=dos
3431                                 osvers=djgpp
3432                         fi
3433                         ;;
3434                 esac
3435
3436                 case "$1" in
3437                 aix) osname=aix
3438                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3439                         case "$tmp" in
3440                         # oslevel can fail with:
3441                         # oslevel: Unable to acquire lock.
3442                         *not\ found) osvers="$4"."$3" ;;
3443                         '<3240'|'<>3240') osvers=3.2.0 ;;
3444                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3445                         '=3250'|'>3250') osvers=3.2.5 ;;
3446                         *) osvers=$tmp;;
3447                         esac
3448                         ;;
3449                 bitrig) osname=bitrig
3450                         osvers="$3"
3451                         ;;
3452                 bsd386) osname=bsd386
3453                         osvers=`$uname -r`
3454                         ;;
3455                 cygwin*) osname=cygwin
3456                         osvers="$3"
3457                         ;;
3458                 *dc.osx) osname=dcosx
3459                         osvers="$3"
3460                         ;;
3461                 dnix) osname=dnix
3462                         osvers="$3"
3463                         ;;
3464                 domainos) osname=apollo
3465                         osvers="$3"
3466                         ;;
3467                 dgux)   osname=dgux
3468                         osvers="$3"
3469                         ;;
3470                 dragonfly) osname=dragonfly
3471                         osvers="$3"
3472                         ;;
3473                 dynixptx*) osname=dynixptx
3474                         osvers=`echo "$4"|sed 's/^v//'`
3475                         ;;
3476                 freebsd) osname=freebsd
3477                         osvers="$3" ;;
3478                 genix)  osname=genix ;;
3479                 gnu)    osname=gnu
3480                         osvers="$3" ;;
3481                 hp*)    osname=hpux
3482                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3483                         ;;
3484                 irix*)  osname=irix
3485                         case "$3" in
3486                         4*) osvers=4 ;;
3487                         5*) osvers=5 ;;
3488                         *)      osvers="$3" ;;
3489                         esac
3490                         ;;
3491                 linux)  osname=linux
3492                         case "$3" in
3493                         *)      osvers="$3" ;;
3494                         esac
3495                         $test -f /system/lib/libandroid.so && osname=linux-android
3496                         ;;
3497                 MiNT)   osname=mint
3498                         ;;
3499                 netbsd*) osname=netbsd
3500                         osvers="$3"
3501                         ;;
3502                 news-os) osvers="$3"
3503                         case "$3" in
3504                         4*) osname=newsos4 ;;
3505                         *) osname=newsos ;;
3506                         esac
3507                         ;;
3508                 nonstop-ux) osname=nonstopux ;;
3509                 openbsd) osname=openbsd
3510                         osvers="$3"
3511                         ;;
3512                 os2)    osname=os2
3513                         osvers="$4"
3514                         ;;
3515                 POSIX-BC | posix-bc ) osname=posix-bc
3516                         osvers="$3"
3517                         ;;
3518                 powerux | power_ux | powermax_os | powermaxos | \
3519                 powerunix | power_unix) osname=powerux
3520                         osvers="$3"
3521                         ;;
3522                 qnx) osname=qnx
3523                         osvers="$4"
3524                         ;;
3525                 solaris) osname=solaris
3526                         case "$3" in
3527                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3528                         *)      osvers="$3" ;;
3529                         esac
3530                         ;;
3531                 sunos) osname=sunos
3532                         case "$3" in
3533                         5*) osname=solaris
3534                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3535                         *)      osvers="$3" ;;
3536                         esac
3537                         ;;
3538                 titanos) osname=titanos
3539                         case "$3" in
3540                         1*) osvers=1 ;;
3541                         2*) osvers=2 ;;
3542                         3*) osvers=3 ;;
3543                         4*) osvers=4 ;;
3544                         *)      osvers="$3" ;;
3545                         esac
3546                         ;;
3547                 ultrix) osname=ultrix
3548                         osvers="$3"
3549                         ;;
3550                 osf1|mls+)      case "$5" in
3551                                 alpha)
3552                                         osname=dec_osf
3553                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3554                                         case "$osvers" in
3555                                         [1-9].[0-9]*) ;;
3556                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3557                                         esac
3558                                         ;;
3559                         hp*)    osname=hp_osf1  ;;
3560                         mips)   osname=mips_osf1 ;;
3561                         esac
3562                         ;;
3563                 # UnixWare 7.1.2 is known as Open UNIX 8
3564                 openunix|unixware) osname=svr5
3565                         osvers="$4"
3566                         ;;
3567                 uts)    osname=uts
3568                         osvers="$3"
3569                         ;;
3570                 vos) osvers="$3"
3571                         ;;
3572                 $2) case "$osname" in
3573                         *isc*) ;;
3574                         *freebsd*) ;;
3575                         svr*)
3576                                 : svr4.x or possibly later
3577                                 case "svr$3" in
3578                                 ${osname}*)
3579                                         osname=svr$3
3580                                         osvers=$4
3581                                         ;;
3582                                 esac
3583                                 case "$osname" in
3584                                 svr4.0)
3585                                         : Check for ESIX
3586                                         if test -f /stand/boot ; then
3587                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3588                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3589                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3590                                                         if test -n "$isesix"; then
3591                                                                 osname=esix4
3592                                                         fi
3593                                                 fi
3594                                         fi
3595                                         ;;
3596                                 esac
3597                                 ;;
3598                         *)      if test -f /etc/systemid; then
3599                                         osname=sco
3600                                         set `echo $3 | $sed 's/\./ /g'` $4
3601                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3602                                                 osvers=$1.$2.$3
3603                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3604                                                 osvers=$1.$2
3605                                         elif $test -f $src/hints/sco_$1.sh; then
3606                                                 osvers=$1
3607                                         fi
3608                                 else
3609                                         case "$osname" in
3610                                         '') : Still unknown.  Probably a generic Sys V.
3611                                                 osname="sysv"
3612                                                 osvers="$3"
3613                                                 ;;
3614                                         esac
3615                                 fi
3616                                 ;;
3617                         esac
3618                         ;;
3619                 *)      case "$osname" in
3620                         '') : Still unknown.  Probably a generic BSD.
3621                                 osname="$1"
3622                                 osvers="$3"
3623                                 ;;
3624                         esac
3625                         ;;
3626                 esac
3627         else
3628                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3629                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3630                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3631                                 osname=news_os
3632                         fi
3633                         $rm -f UU/kernel.what
3634                 elif test -d c:/. -o -n "$is_os2" ; then
3635                         set X $myuname
3636                         osname=os2
3637                         osvers="$5"
3638                 fi
3639         fi
3640
3641         case "$targetarch" in
3642         '') ;;
3643         *)  hostarch=$osname
3644             case "$targetarch" in
3645                 nto*|*-nto-*)
3646                     # Will load qnx.sh, which should change osname to nto
3647                     osname=qnx
3648                     osvers=''
3649                     ;;
3650                 *linux-android*)
3651                     # Catch arm-linux-androideabi, mipsel-linux-android,
3652                     # and i686-linux-android
3653                     osname=linux-android
3654                     osvers=''
3655                     ;;
3656                 *linux*)
3657                     # Something like arm-linux-gnueabihf is really just
3658                     # plain linux.
3659                     osname=linux
3660                     osvers=''
3661                     ;;
3662                 *solaris*|*sunos*)
3663                     osname=solaris
3664                     # XXX perhaps we should just assume
3665                     # osvers to be 2, or maybe take the value
3666                     # from targetarch. Using $run before the
3667                     # hints are run is somewhat icky.
3668                     set X `$run $uname -a 2>/dev/null`
3669                     shift
3670                     case "$3" in
3671                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3672                         *)  osvers="$3" ;;
3673                     esac
3674                     ;;
3675                 *)
3676                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3677                     osvers=''
3678                 ;;
3679             esac
3680             ;;
3681         esac
3682
3683         : Now look for a hint file osname_osvers, unless one has been
3684         : specified already.
3685         case "$hintfile" in
3686         ''|' ')
3687                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3688                 : Also try without trailing minor version numbers.
3689                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3690                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3691                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3692                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3693                 case "$file" in
3694                 '') dflt=none ;;
3695                 *)  case "$osvers" in
3696                         '') dflt=$file
3697                                 ;;
3698                         *)  if $test -f $src/hints/$file.sh ; then
3699                                         dflt=$file
3700                                 elif $test -f $src/hints/$xfile.sh ; then
3701                                         dflt=$xfile
3702                                 elif $test -f $src/hints/$xxfile.sh ; then
3703                                         dflt=$xxfile
3704                                 elif $test -f $src/hints/$xxxfile.sh ; then
3705                                         dflt=$xxxfile
3706                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3707                                         dflt=$xxxxfile
3708                                 elif $test -f "$src/hints/${osname}.sh" ; then
3709                                         dflt="${osname}"
3710                                 else
3711                                         dflt=none
3712                                 fi
3713                                 ;;
3714                         esac
3715                         ;;
3716                 esac
3717                 if $test -f Policy.sh ; then
3718                         case "$dflt" in
3719                         *Policy*) ;;
3720                         none) dflt="Policy" ;;
3721                         *) dflt="Policy $dflt" ;;
3722                         esac
3723                 fi
3724                 ;;
3725         *)
3726                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3727                 ;;
3728         esac
3729
3730         if $test -f Policy.sh ; then
3731                 $cat <<EOM
3732
3733 There's also a Policy hint file available, which should make the
3734 site-specific (policy) questions easier to answer.
3735 EOM
3736
3737         fi
3738
3739         $cat <<EOM
3740
3741 You may give one or more space-separated answers, or "none" if appropriate.
3742 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3743 previous run of Configure, you may specify it as well as or instead of
3744 OS-specific hints.  If hints are provided for your OS, you should use them:
3745 although Perl can probably be built without hints on many platforms, using
3746 hints often improve performance and may enable features that Configure can't
3747 set up on its own. If there are no hints that match your OS, specify "none";
3748 DO NOT give a wrong version or a wrong OS.
3749
3750 EOM
3751
3752         rp="Which of these apply, if any?"
3753         . UU/myread
3754         tans=$ans
3755         for file in $tans; do
3756                 if $test X$file = XPolicy -a -f Policy.sh; then
3757                         . Policy.sh
3758                         $cat Policy.sh >> UU/config.sh
3759                 elif $test -f $src/hints/$file.sh; then
3760                         . $src/hints/$file.sh
3761                         $cat $src/hints/$file.sh >> UU/config.sh
3762                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3763                         : nothing
3764                 else
3765                         : Give one chance to correct a possible typo.
3766                         echo "$file.sh does not exist"
3767                         dflt=$file
3768                         rp="hint to use instead?"
3769                         . UU/myread
3770                         for file in $ans; do
3771                                 if $test -f "$src/hints/$file.sh"; then
3772                                         . $src/hints/$file.sh
3773                                         $cat $src/hints/$file.sh >> UU/config.sh
3774                                 elif $test X$ans = X -o X$ans = Xnone ; then
3775                                         : nothing
3776                                 else
3777                                         echo "$file.sh does not exist -- ignored."
3778                                 fi
3779                         done
3780                 fi
3781         done
3782
3783         hint=recommended
3784         : Remember our hint file for later.
3785         if $test -f "$src/hints/$file.sh" ; then
3786                 hintfile="$file"
3787         else
3788                 hintfile=''
3789         fi
3790 fi
3791 cd UU
3792 ;;
3793 *)
3794         echo " "
3795         echo "Fetching default answers from $config_sh..." >&4
3796         tmp_n="$n"
3797         tmp_c="$c"
3798         cd ..
3799         cp $config_sh config.sh 2>/dev/null
3800         chmod +w config.sh
3801         . ./config.sh
3802         cd UU
3803         cp ../config.sh .
3804         n="$tmp_n"
3805         c="$tmp_c"
3806         hint=previous
3807         ;;
3808 esac
3809 . ./optdef.sh
3810
3811 : Restore computed paths
3812 for file in $loclist $trylist; do
3813         eval $file="\$_$file"
3814 done
3815
3816 cat << EOM
3817
3818 Configure uses the operating system name and version to set some defaults.
3819 The default value is probably right if the name rings a bell. Otherwise,
3820 since spelling matters for me, either accept the default or answer "none"
3821 to leave it blank.
3822
3823 EOM
3824 case "$osname" in
3825         ''|' ')
3826                 case "$hintfile" in
3827                 ''|' '|none) dflt=none ;;
3828                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3829                 esac
3830                 ;;
3831         *) dflt="$osname" ;;
3832 esac
3833 rp="Operating system name?"
3834 . ./myread
3835 case "$ans" in
3836 none)  osname='' ;;
3837 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3838 esac
3839 echo " "
3840 case "$osvers" in
3841         ''|' ')
3842                 case "$hintfile" in
3843                 ''|' '|none) dflt=none ;;
3844                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3845                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3846                         case "$dflt" in
3847                         ''|' ') dflt=none ;;
3848                         esac
3849                         ;;
3850                 esac
3851                 ;;
3852         *) dflt="$osvers" ;;
3853 esac
3854 rp="Operating system version?"
3855 . ./myread
3856 case "$ans" in
3857 none)  osvers='' ;;
3858 *) osvers="$ans" ;;
3859 esac
3860
3861
3862 . ./posthint.sh
3863
3864 : who configured the system
3865 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3866 case "$cf_by" in
3867 "")
3868         cf_by=`(logname) 2>/dev/null`
3869         case "$cf_by" in
3870         "")
3871                 cf_by=`(whoami) 2>/dev/null`
3872                 case "$cf_by" in
3873                 "") cf_by=unknown ;;
3874                 esac ;;
3875         esac ;;
3876 esac
3877
3878 : decide how portable to be.  Allow command line overrides.
3879 case "$d_portable" in
3880 "$undef") ;;
3881 *)      d_portable="$define" ;;
3882 esac
3883
3884 : set up shell script to do ~ expansion
3885 cat >filexp <<EOSS
3886 $startsh
3887 : expand filename
3888 case "\$1" in
3889  \~/*|\~)
3890         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3891         ;;
3892  \~*)
3893         if $test -f /bin/csh; then
3894                 /bin/csh -f -c "glob \$1"
3895                 failed=\$?
3896                 echo ""
3897                 exit \$failed
3898         else
3899                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3900                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3901                 if $test ! -d "\$dir"; then
3902                         me=\`basename \$0\`
3903                         echo "\$me: can't locate home directory for: \$name" >&2
3904                         exit 1
3905                 fi
3906                 case "\$1" in
3907                 */*)
3908                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3909                         ;;
3910                 *)
3911                         echo \$dir
3912                         ;;
3913                 esac
3914         fi
3915         ;;
3916 *)
3917         echo \$1
3918         ;;
3919 esac
3920 EOSS
3921 chmod +x filexp
3922 $eunicefix filexp
3923
3924 : now set up to get a file name
3925 cat <<EOS >getfile
3926 $startsh
3927 EOS
3928 cat <<'EOSC' >>getfile
3929 tilde=''
3930 fullpath=''
3931 already=''
3932 skip=''
3933 none_ok=''
3934 exp_file=''
3935 nopath_ok=''
3936 orig_rp="$rp"
3937 orig_dflt="$dflt"
3938 case "$gfpth" in
3939 '') gfpth='.' ;;
3940 esac
3941
3942 case "$fn" in
3943 *\(*)
3944         : getfile will accept an answer from the comma-separated list
3945         : enclosed in parentheses even if it does not meet other criteria.
3946         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3947         fn=`echo $fn | sed 's/(.*)//'`
3948         ;;
3949 esac
3950
3951 case "$fn" in
3952 *:*)
3953         loc_file=`expr $fn : '.*:\(.*\)'`
3954         fn=`expr $fn : '\(.*\):.*'`
3955         ;;
3956 esac
3957
3958 case "$fn" in
3959 *~*) tilde=true;;
3960 esac
3961 case "$fn" in
3962 */*) fullpath=true;;
3963 esac
3964 case "$fn" in
3965 *+*) skip=true;;
3966 esac
3967 case "$fn" in
3968 *n*) none_ok=true;;
3969 esac
3970 case "$fn" in
3971 *e*) exp_file=true;;
3972 esac
3973 case "$fn" in
3974 *p*) nopath_ok=true;;
3975 esac
3976
3977 case "$fn" in
3978 *f*) type='File';;
3979 *d*) type='Directory';;
3980 *l*) type='Locate';;
3981 esac
3982
3983 what="$type"
3984 case "$what" in
3985 Locate) what='File';;
3986 esac
3987
3988 case "$exp_file" in
3989 '')
3990         case "$d_portable" in
3991         "$define") ;;
3992         *) exp_file=true;;
3993         esac
3994         ;;
3995 esac
3996
3997 cd ..
3998 while test "$type"; do
3999         redo=''
4000         rp="$orig_rp"
4001         dflt="$orig_dflt"
4002         case "$tilde" in
4003         true) rp="$rp (~name ok)";;
4004         esac
4005         . UU/myread
4006         if test -f UU/getfile.ok && \
4007                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4008         then
4009                 value="$ans"
4010                 ansexp="$ans"
4011                 break
4012         fi
4013         case "$ans" in
4014         none)
4015                 value=''
4016                 ansexp=''
4017                 case "$none_ok" in
4018                 true) type='';;
4019                 esac
4020                 ;;
4021         *)
4022                 case "$tilde" in
4023                 '') value="$ans"
4024                         ansexp="$ans";;
4025                 *)
4026                         value=`UU/filexp $ans`
4027                         case $? in
4028                         0)
4029                                 if test "$ans" != "$value"; then
4030                                         echo "(That expands to $value on this system.)"
4031                                 fi
4032                                 ;;
4033                         *) value="$ans";;
4034                         esac
4035                         ansexp="$value"
4036                         case "$exp_file" in
4037                         '') value="$ans";;
4038                         esac
4039                         ;;
4040                 esac
4041                 case "$fullpath" in
4042                 true)
4043                         case "$ansexp" in
4044                         /*) value="$ansexp" ;;
4045                         [a-zA-Z]:/*) value="$ansexp" ;;
4046                         *)
4047                                 redo=true
4048                                 case "$already" in
4049                                 true)
4050                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4051                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4052                                         ;;
4053                                 *)
4054                                 echo "Please give a full path name, starting with slash." >&4
4055                                         case "$tilde" in
4056                                         true)
4057                                 echo "Note that using ~name is ok provided it expands well." >&4
4058                                                 already=true
4059                                                 ;;
4060                                         esac
4061                                 esac
4062                                 ;;
4063                         esac
4064                         ;;
4065                 esac
4066                 case "$redo" in
4067                 '')
4068                         case "$type" in
4069                         File)
4070                                 for fp in $gfpth; do
4071                                         if test "X$fp" = X.; then
4072                                             pf="$ansexp"
4073                                         else    
4074                                             pf="$fp/$ansexp"
4075                                         fi
4076                                         if test -f "$pf"; then
4077                                                 type=''
4078                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4079                                         then
4080                                                 echo "($value is not a plain file, but that's ok.)"
4081                                                 type=''
4082                                         fi
4083                                         if test X"$type" = X; then
4084                                             value="$pf"
4085                                             break
4086                                         fi
4087                                 done
4088                                 ;;
4089                         Directory)
4090                                 for fp in $gfpth; do
4091                                         if test "X$fp" = X.; then
4092                                             dir="$ans"
4093                                             direxp="$ansexp"
4094                                         else    
4095                                             dir="$fp/$ansexp"
4096                                             direxp="$fp/$ansexp"
4097                                         fi
4098                                         if test -d "$direxp"; then
4099                                                 type=''
4100                                                 value="$dir"
4101                                                 break
4102                                         fi
4103                                 done
4104                                 ;;
4105                         Locate)
4106                                 if test -d "$ansexp"; then
4107                                         echo "(Looking for $loc_file in directory $value.)"
4108                                         value="$value/$loc_file"
4109                                         ansexp="$ansexp/$loc_file"
4110                                 fi
4111                                 if test -f "$ansexp"; then
4112                                         type=''
4113                                 fi
4114                                 case "$nopath_ok" in
4115                                 true)   case "$value" in
4116                                         */*) ;;
4117                                         *)      echo "Assuming $value will be in people's path."
4118                                                 type=''
4119                                                 ;;
4120                                         esac
4121                                         ;;
4122                                 esac
4123                                 ;;
4124                         esac
4125
4126                         case "$skip" in
4127                         true) type='';
4128                         esac
4129
4130                         case "$type" in
4131                         '') ;;
4132                         *)
4133                                 if test "$fastread" = yes; then
4134                                         dflt=y
4135                                 else
4136                                         dflt=n
4137                                 fi
4138                                 rp="$what $value doesn't exist.  Use that name anyway?"
4139                                 . UU/myread
4140                                 dflt=''
4141                                 case "$ans" in
4142                                 y*) type='';;
4143                                 *) echo " ";;
4144                                 esac
4145                                 ;;
4146                         esac
4147                         ;;
4148                 esac
4149                 ;;
4150         esac
4151 done
4152 cd UU
4153 ans="$value"
4154 rp="$orig_rp"
4155 dflt="$orig_dflt"
4156 rm -f getfile.ok
4157 test "X$gfpthkeep" != Xy && gfpth=""
4158 EOSC
4159
4160 : determine root of directory hierarchy where package will be installed.
4161 case "$prefix" in
4162 '')
4163         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4164         ;;
4165 *?/)
4166         dflt=`echo "$prefix" | sed 's/.$//'`
4167         ;;
4168 *)
4169         dflt="$prefix"
4170         ;;
4171 esac
4172 $cat <<EOM
4173
4174 By default, $package will be installed in $dflt/bin, manual pages
4175 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4176 installation directories. Typically this is something like /usr/local.
4177 If you wish to have binaries under /usr/bin but other parts of the
4178 installation under /usr/local, that's ok: you will be prompted
4179 separately for each of the installation directories, the prefix being
4180 only used to set the defaults.
4181
4182 EOM
4183 fn=d~
4184 rp='Installation prefix to use?'
4185 . ./getfile
4186 oldprefix=''
4187 case "$prefix" in
4188 '') ;;
4189 *)
4190         case "$ans" in
4191         "$prefix") ;;
4192         *) oldprefix="$prefix";;
4193         esac
4194         ;;
4195 esac
4196 prefix="$ans"
4197 prefixexp="$ansexp"
4198
4199 : allow them to override the AFS root
4200 case "$afsroot" in
4201 '')     afsroot=/afs ;;
4202 *)      afsroot=$afsroot ;;
4203 esac
4204
4205 : is AFS running?
4206 echo " "
4207 case "$afs" in
4208 $define|true)   afs=true ;;
4209 $undef|false)   afs=false ;;
4210 *)      if $test -d $afsroot; then
4211                 afs=true
4212         else
4213                 afs=false
4214         fi
4215         ;;
4216 esac
4217 if $afs; then
4218         echo "AFS may be running... I'll be extra cautious then..." >&4
4219 else
4220         echo "AFS does not seem to be running..." >&4
4221 fi
4222
4223 : determine installation prefix for where package is to be installed.
4224 if $afs; then
4225 $cat <<EOM
4226
4227 Since you are running AFS, I need to distinguish the directory in which
4228 files will reside from the directory in which they are installed (and from
4229 which they are presumably copied to the former directory by occult means).
4230
4231 EOM
4232         case "$installprefix" in
4233         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4234         *) dflt="$installprefix";;
4235         esac
4236 else
4237 $cat <<EOM
4238
4239 In some special cases, particularly when building $package for distribution,
4240 it is convenient to distinguish the directory in which files should be
4241 installed from the directory ($prefix) in which they will
4242 eventually reside.  For most users, these two directories are the same.
4243
4244 EOM
4245         case "$installprefix" in
4246         '') dflt=$prefix ;;
4247         *) dflt=$installprefix;;
4248         esac
4249 fi
4250 fn=d~
4251 rp='What installation prefix should I use for installing files?'
4252 . ./getfile
4253 installprefix="$ans"
4254 installprefixexp="$ansexp"
4255
4256 : Perform the prefixexp/installprefixexp correction if necessary
4257 cat <<EOS >installprefix
4258 $startsh
4259 EOS
4260 cat <<'EOSC' >>installprefix
4261 : Change installation prefix, if necessary.
4262 if $test X"$prefix" != X"$installprefix"; then
4263     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4264 else
4265     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4266 fi
4267 EOSC
4268 chmod +x installprefix
4269 $eunicefix installprefix
4270
4271 : Set variables such as privlib and privlibexp from the output of ./getfile
4272 : performing the prefixexp/installprefixexp correction if necessary.
4273 cat <<EOS >setprefixvar
4274 $startsh
4275 EOS
4276 cat <<'EOSC' >>setprefixvar
4277 eval "${prefixvar}=\"\$ans\""
4278 eval "${prefixvar}exp=\"\$ansexp\""
4279 . ./installprefix
4280 EOSC
4281 chmod +x setprefixvar
4282 $eunicefix setprefixvar
4283
4284 : set up the script used to warn in case of inconsistency
4285 cat <<EOS >whoa
4286 $startsh
4287 EOS
4288 cat <<'EOSC' >>whoa
4289 dflt=y
4290 case "$hint" in
4291     recommended)
4292         case "$hintfile" in
4293         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4294                 ;;
4295         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4296                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4297                 ;;
4298         esac
4299         ;;
4300     *)  echo " "
4301         echo "*** WHOA THERE!!! ***" >&4
4302         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4303         ;;
4304 esac
4305 rp="    Keep the $hint value?"
4306 . ./myread
4307 case "$ans" in
4308 y) td=$was; tu=$was;;
4309 esac
4310 EOSC
4311
4312 : function used to set '$1' to '$val'
4313 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4314 case "$val$was" in
4315 $define$undef) . ./whoa; eval "$var=\$td";;
4316 $undef$define) . ./whoa; eval "$var=\$tu";;
4317 *) eval "$var=$val";;
4318 esac'
4319
4320 : get the patchlevel
4321 echo " "
4322 echo "Getting the current patchlevel..." >&4
4323 if $test -r $rsrc/patchlevel.h;then
4324         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4325         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4326         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4327         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4328         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4329         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4330         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4331 else
4332         revision=0
4333         patchlevel=0
4334         subversion=0
4335         api_revision=0
4336         api_version=0
4337         api_subversion=0
4338         perl_patchlevel=0
4339         $echo "(You do not have patchlevel.h.  Eek.)"
4340 fi
4341 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4342 version_patchlevel_string="version $patchlevel subversion $subversion"
4343 case "$perl_patchlevel" in
4344 0|'') ;;
4345 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4346     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4347     ;;
4348 esac
4349
4350 $echo "(You have $package $version_patchlevel_string.)"
4351
4352 case "$osname" in
4353 dos|vms)
4354         : XXX Should be a Configure test for double-dots in filenames.
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 *)
4361         version=`echo $revision $patchlevel $subversion | \
4362                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4363         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4364                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4365         ;;
4366 esac
4367 : Special case the 5.005_xx maintenance series, which used 5.005
4368 : without any subversion label as a subdirectory in $sitelib
4369 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4370         api_versionstring='5.005'
4371 fi
4372
4373 : Do we want threads support and if so, what type
4374 case "$usethreads" in
4375 $define|true|[yY]*)     dflt='y';;
4376 *)     # Catch case where user specified ithreads or 5005threads but
4377        # forgot -Dusethreads (A.D. 4/2002)
4378        case "$useithreads$use5005threads" in
4379        *$define*)       dflt='y';;
4380        *)               dflt='n';;
4381        esac
4382        ;;
4383 esac
4384 cat <<EOM
4385
4386 Perl can be built to offer a form of threading support on some systems
4387 To do so, Configure can be run with -Dusethreads.
4388
4389 Note that Perl built with threading support runs slightly slower
4390 and uses slightly more memory than plain Perl.
4391
4392 If this doesn't make any sense to you, just accept the default '$dflt'.
4393 EOM
4394 rp='Build a threading Perl?'
4395 . ./myread
4396 case "$ans" in
4397 y|Y)    val="$define" ;;
4398 *)      val="$undef" ;;
4399 esac
4400 set usethreads
4401 eval $setvar
4402
4403 if $test $patchlevel -lt 9; then
4404     case "$usethreads" in
4405     $define)
4406         : Default to ithreads unless overridden on command line or with
4407         : old config.sh
4408         dflt='y'
4409         case "$use5005threads" in
4410                 $define|true|[yY]*)
4411                         echo "5.005 threads are no longer supported"
4412                         exit 1
4413                 ;;
4414         esac
4415         case "$useithreads" in
4416                 $undef|false|[nN]*) dflt='n';;
4417         esac
4418         rp='Use the newer interpreter-based ithreads?'
4419         . ./myread
4420         case "$ans" in
4421         y|Y)    val="$define" ;;
4422         *)      val="$undef" ;;
4423         esac
4424         set useithreads
4425         eval $setvar
4426         : Now set use5005threads to the opposite value.
4427         case "$useithreads" in
4428         $define) val="$undef" ;;
4429         *) val="$define" ;;
4430         esac
4431         set use5005threads
4432         eval $setvar
4433         ;;
4434     *)
4435         useithreads="$undef"
4436         use5005threads="$undef"
4437         ;;
4438     esac
4439
4440     case "$useithreads$use5005threads" in
4441     "$define$define")
4442         $cat >&4 <<EOM
4443
4444 You cannot have both the ithreads and the 5.005 threads enabled
4445 at the same time.  Disabling the 5.005 threads since they are
4446 much less stable than the ithreads.
4447
4448 EOM
4449         use5005threads="$undef"
4450         ;;
4451     esac
4452
4453 else
4454 : perl-5.9.x and later
4455
4456     if test X"$usethreads" = "X$define"; then
4457         case "$use5005threads" in
4458             $define|true|[yY]*)
4459                 $cat >&4 <<EOM
4460
4461 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4462
4463 EOM
4464             ;;
4465         esac
4466     fi
4467
4468     use5005threads="$undef"
4469     useithreads="$usethreads"
4470 fi
4471
4472 case "$d_oldpthreads" in
4473 '')     : Configure tests would be welcome here.  For now, assume undef.
4474         val="$undef" ;;
4475 *)      val="$d_oldpthreads" ;;
4476 esac
4477 set d_oldpthreads
4478 eval $setvar
4479
4480
4481 : Look for a hint-file generated 'call-back-unit'.  If the
4482 : user has specified that a threading perl is to be built,
4483 : we may need to set or change some other defaults.
4484 if $test -f usethreads.cbu; then
4485     echo "Your platform has some specific hints regarding threaded builds, using them..."
4486     . ./usethreads.cbu
4487 else
4488     case "$usethreads" in
4489         "$define"|true|[yY]*)
4490                 $cat <<EOM
4491 (Your platform does not have any specific hints for threaded builds.
4492  Assuming POSIX threads, then.)
4493 EOM
4494         ;;
4495     esac
4496 fi
4497
4498 : Check if multiplicity is required
4499 cat <<EOM
4500
4501 Perl can be built so that multiple Perl interpreters can coexist
4502 within the same Perl executable.
4503 EOM
4504
4505 case "$useithreads" in
4506 $define)
4507         cat <<EOM
4508 This multiple interpreter support is required for interpreter-based threads.
4509 EOM
4510         val="$define"
4511         ;;
4512 *)      case "$usemultiplicity" in
4513         $define|true|[yY]*)     dflt='y';;
4514         *) dflt='n';;
4515         esac
4516         echo " "
4517         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4518         rp='Build Perl for multiplicity?'
4519         . ./myread
4520         case "$ans" in
4521         y|Y)    val="$define" ;;
4522         *)      val="$undef" ;;
4523         esac
4524         ;;
4525 esac
4526 set usemultiplicity
4527 eval $setvar
4528
4529 : Check if morebits is requested
4530 case "$usemorebits" in
4531 "$define"|true|[yY]*)
4532         use64bitint="$define"
4533         uselongdouble="$define"
4534         usemorebits="$define"
4535         ;;
4536 *)      usemorebits="$undef"
4537         ;;
4538 esac
4539
4540 : Determine the C compiler to be used
4541 echo " "
4542 case "$cc" in
4543 '') dflt=cc;;
4544 *) dflt="$cc";;
4545 esac
4546 rp="Use which C compiler?"
4547 . ./myread
4548 cc="$ans"
4549
4550 : See whether they have no cc but they do have gcc
4551 . ./trygcc
4552 if $test -f cc.cbu; then
4553     . ./cc.cbu
4554 fi
4555 . ./checkcc
4556
4557 : make some quick guesses about what we are up against
4558 echo " "
4559 $echo $n "Hmm...  $c"
4560 echo exit 1 >bsd
4561 echo exit 1 >usg
4562 echo exit 1 >v7
4563 echo exit 1 >osf1
4564 echo exit 1 >eunice
4565 echo exit 1 >xenix
4566 echo exit 1 >venix
4567 echo exit 1 >os2
4568 d_bsd="$undef"
4569 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4570 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4571 then
4572         echo "Looks kind of like an OSF/1 system, but we'll see..."
4573         echo exit 0 >osf1
4574 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4575         xxx=`./loc addbib blurfl $pth`
4576         if $test -f $xxx; then
4577         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4578                 echo exit 0 >bsd
4579                 echo exit 0 >usg
4580         else
4581                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4582                         echo "Looks kind of like an extended USG system, but we'll see..."
4583                 else
4584                         echo "Looks kind of like a USG system, but we'll see..."
4585                 fi
4586                 echo exit 0 >usg
4587         fi
4588 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4589         echo "Looks kind of like a BSD system, but we'll see..."
4590         d_bsd="$define"
4591         echo exit 0 >bsd
4592 else
4593         echo "Looks kind of like a Version 7 system, but we'll see..."
4594         echo exit 0 >v7
4595 fi
4596 case "$eunicefix" in
4597 *unixtovms*)
4598         $cat <<'EOI'
4599 There is, however, a strange, musty smell in the air that reminds me of
4600 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4601 EOI
4602         echo exit 0 >eunice
4603         d_eunice="$define"
4604 : it so happens the Eunice I know will not run shell scripts in Unix format
4605         ;;
4606 *)
4607         echo " "
4608         echo "Congratulations.  You aren't running Eunice."
4609         d_eunice="$undef"
4610         ;;
4611 esac
4612 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4613 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4614 : semicolon as a patch separator
4615 case "$p_" in
4616 :) ;;
4617 *)
4618         $cat <<'EOI'
4619 I have the feeling something is not exactly right, however...don't tell me...
4620 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4621 (Or you may be running DOS with DJGPP.)
4622 EOI
4623         echo exit 0 >os2
4624         ;;
4625 esac
4626 if test -f /xenix; then
4627         echo "Actually, this looks more like a XENIX system..."
4628         echo exit 0 >xenix
4629         d_xenix="$define"
4630 else
4631         echo " "
4632         echo "It's not Xenix..."
4633         d_xenix="$undef"
4634 fi
4635 chmod +x xenix
4636 $eunicefix xenix
4637 if test -f /venix; then
4638         echo "Actually, this looks more like a VENIX system..."
4639         echo exit 0 >venix
4640 else
4641         echo " "
4642         if ./xenix; then
4643                 : null
4644         else
4645                 echo "Nor is it Venix..."
4646         fi
4647 fi
4648 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4649 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4650 $rm -f foo
4651
4652 : Check if we are using GNU gcc and what its version is
4653 echo " "
4654 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4655 $cat >try.c <<EOM
4656 #include <stdio.h>
4657 int main() {
4658 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4659 #ifdef __VERSION__
4660         printf("%s\n", __VERSION__);
4661 #else
4662         printf("%s\n", "1");
4663 #endif
4664 #endif
4665         return(0);
4666 }
4667 EOM
4668 if $cc -o try $ccflags $ldflags try.c; then
4669         gccversion=`$run ./try`
4670         case "$gccversion" in
4671         '') echo "You are not using GNU cc." ;;
4672         *)  echo "You are using GNU cc $gccversion."
4673             ccname=gcc
4674             ;;
4675         esac
4676 else
4677         echo " "
4678         echo "*** WHOA THERE!!! ***" >&4
4679         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4680         case "$knowitall" in
4681         '')
4682         echo "    You'd better start hunting for one and let me know about it." >&4
4683                 exit 1
4684                 ;;
4685         esac
4686 fi
4687 $rm -f try try.*
4688 case "$gccversion" in
4689 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4690 esac
4691 case "$gccversion" in
4692 '') gccosandvers='' ;;
4693 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4694    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4695    gccshortvers=''
4696    case "$gccosandvers" in
4697    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4698    $osname$osvers) ;; # looking good
4699    $osname*) cat <<EOM >&4
4700
4701 *** WHOA THERE!!! ***
4702
4703     Your gcc has not been compiled for the exact release of
4704     your operating system ($gccosandvers versus $osname$osvers).
4705
4706     In general it is a good idea to keep gcc synchronized with
4707     the operating system because otherwise serious problems
4708     may ensue when trying to compile software, like Perl.
4709
4710     I'm trying to be optimistic here, though, and will continue.
4711     If later during the configuration and build icky compilation
4712     problems appear (headerfile conflicts being the most common
4713     manifestation), I suggest reinstalling the gcc to match
4714     your operating system release.
4715
4716 EOM
4717       ;;
4718    *) gccosandvers='' ;; # failed to parse, better be silent
4719    esac
4720    ;;
4721 esac
4722 case "$ccname" in
4723 '') ccname="$cc" ;;
4724 esac
4725
4726 # gcc 3.* complain about adding -Idirectories that they already know about,
4727 # so we will take those off from locincpth.
4728 case "$gccversion" in
4729 3*)
4730     echo "main(){}">try.c
4731     for incdir in $locincpth; do
4732        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4733              grep '^c[cp]p*[01]: warning: changing search order '`
4734        if test "X$warn" != X; then
4735            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4736        fi
4737     done
4738     $rm -f try try.*
4739 esac
4740
4741 # gcc 4.9 by default does some optimizations that break perl.
4742 # see ticket 121505.
4743 #
4744 # The -fwrapv disables those optimizations (and probably others,) so
4745 # for gcc 4.9 (and later, since the optimizations probably won't go
4746 # away), add -fwrapv unless the user requests -fno-wrapv, which
4747 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4748 # which turns the overflows -fwrapv ignores into runtime errors.
4749 case "$gccversion" in
4750 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4751     case "$ccflags" in
4752     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4753     *) ccflags="$ccflags -fwrapv" ;;
4754     esac
4755 esac
4756
4757 : What should the include directory be ?
4758 : Use sysroot if set, so findhdr looks in the right place.
4759 echo " "
4760 $echo $n "Hmm...  $c"
4761 dflt="$sysroot/usr/include"
4762 incpath=''
4763 mips_type=''
4764 if $test -f /bin/mips && /bin/mips; then
4765         echo "Looks like a MIPS system..."
4766         $cat >usr.c <<'EOCP'
4767 #ifdef SYSTYPE_BSD43
4768 /bsd43
4769 #endif
4770 EOCP
4771         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4772                 dflt='/bsd43/usr/include'
4773                 incpath='/bsd43'
4774                 mips_type='BSD 4.3'
4775         else
4776                 mips_type='System V'
4777         fi
4778         $rm -f usr.c usr.out
4779         echo "and you're compiling with the $mips_type compiler and libraries."
4780         xxx_prompt=y
4781         echo "exit 0" >mips
4782 else
4783         echo "Doesn't look like a MIPS system."
4784         xxx_prompt=n
4785         echo "exit 1" >mips
4786 fi
4787 chmod +x mips
4788 $eunicefix mips
4789 case "$usrinc" in
4790 '') ;;
4791 *) dflt="$usrinc";;
4792 esac
4793 case "$xxx_prompt" in
4794 y)      fn=d/
4795         echo " "
4796         rp='Where are the include files you want to use?'
4797         . ./getfile
4798         usrinc="$ans"
4799         ;;
4800 *)      usrinc="$dflt"
4801         ;;
4802 esac
4803
4804 : see how we invoke the C preprocessor
4805 echo " "
4806 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4807 cat <<'EOT' >testcpp.c
4808 #define ABC abc
4809 #define XYZ xyz
4810 ABC.XYZ
4811 EOT
4812 cd ..
4813 if test ! -f cppstdin; then
4814         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4815                 # AIX cc -E doesn't show the absolute headerfile
4816                 # locations but we'll cheat by using the -M flag.
4817                 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
4818         else
4819                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4820         fi
4821 else
4822         echo "Keeping your $hint cppstdin wrapper."
4823 fi
4824 chmod 755 cppstdin
4825 wrapper=`pwd`/cppstdin
4826 ok='false'
4827 cd UU
4828
4829 if $test "X$cppstdin" != "X" && \
4830         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4831         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4832 then
4833         echo "You used to use $cppstdin $cppminus so we'll use that again."
4834         case "$cpprun" in
4835         '') echo "But let's see if we can live without a wrapper..." ;;
4836         *)
4837                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4838                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4839                 then
4840                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4841                         ok='true'
4842                 else
4843                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4844                 fi
4845                 ;;
4846         esac
4847 else
4848         case "$cppstdin" in
4849         '') ;;
4850         *)
4851                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4852                 ;;
4853         esac
4854 fi
4855
4856 if $ok; then
4857         : nothing
4858 elif echo '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"' -E -" will work...'; \
4865         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4866         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4867         echo "Yup, it does."
4868         x_cpp="$cc $cppflags -E"
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 "Yipee, that works!"
4874         x_cpp="$cc $cppflags -P"
4875         x_minus='';
4876 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4877         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4878         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4879         echo "At long last!"
4880         x_cpp="$cc $cppflags -P"
4881         x_minus='-';
4882 elif echo 'No such luck, 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 "It works!"
4886         x_cpp="$cpp $cppflags"
4887         x_minus='';
4888 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4889         $cpp - <testcpp.c >testcpp.out 2>&1; \
4890         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4891         echo "Hooray, it works!  I was beginning to wonder."
4892         x_cpp="$cpp $cppflags"
4893         x_minus='-';
4894 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4895         $wrapper <testcpp.c >testcpp.out 2>&1; \
4896         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4897         x_cpp="$wrapper"
4898         x_minus=''
4899         echo "Eureka!"
4900 else
4901         dflt=''
4902         rp="No dice.  I can't find a C preprocessor.  Name one:"
4903         . ./myread
4904         x_cpp="$ans"
4905         x_minus=''
4906         $x_cpp <testcpp.c >testcpp.out 2>&1
4907         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4908                 echo "OK, that will do." >&4
4909         else
4910 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4911                 exit 1
4912         fi
4913 fi
4914
4915 case "$ok" in
4916 false)
4917         cppstdin="$x_cpp"
4918         cppminus="$x_minus"
4919         cpprun="$x_cpp"
4920         cpplast="$x_minus"
4921         set X $x_cpp
4922         shift
4923         case "$1" in
4924         "$cpp")
4925                 echo "Perhaps can we force $cc -E using a wrapper..."
4926                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4927                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4928                 then
4929                         echo "Yup, we can."
4930                         cppstdin="$wrapper"
4931                         cppminus='';
4932                 else
4933                         echo "Nope, we'll have to live without it..."
4934                 fi
4935                 ;;
4936         esac
4937         case "$cpprun" in
4938         "$wrapper")
4939                 cpprun=''
4940                 cpplast=''
4941                 ;;
4942         esac
4943         ;;
4944 esac
4945
4946 case "$cppstdin" in
4947 "$wrapper"|'cppstdin') ;;
4948 *) $rm -f $wrapper;;
4949 esac
4950 $rm -f testcpp.c testcpp.out
4951
4952 : Adjust cppfilter for path component separator
4953 case "$osname" in
4954 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4955 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4956 *)   cppfilter='' ;;
4957 esac
4958
4959 : Use gcc to determine libpth and incpth
4960 # If using gcc or clang, we can get better values for libpth, incpth
4961 # and usrinc directly from the compiler.
4962 # Note that ccname for clang is also gcc.
4963 case "$ccname" in
4964     gcc)
4965         $echo 'extern int foo;' > try.c
4966         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4967         shift
4968         if $test $# -gt 0; then
4969             incpth="$incpth $*"
4970             incpth="`$echo $incpth|$sed 's/^ //'`"
4971             for i in $*; do
4972                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4973                 if $test -d $j; then
4974                     libpth="$libpth $j"
4975                 fi
4976             done
4977             libpth="`$echo $libpth|$sed 's/^ //'`"
4978             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4979                 if $test -d $xxx; then
4980                     case " $libpth " in
4981                     *" $xxx "*) ;;
4982                     *) libpth="$libpth $xxx";;
4983                     esac
4984                 fi
4985             done
4986         fi
4987         $rm -f try.c
4988         case "$usrinc" in
4989         '') for i in $incpth; do
4990                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4991                     usrinc="$i"
4992                     break
4993                 fi
4994             done
4995             ;;
4996         esac
4997
4998         case "$usecrosscompile" in
4999         $define|true|[yY]*)
5000             case "$incpth" in
5001                 '') echo "Incpth not defined." >&4; croak=y ;;
5002                 *)  echo "Using incpth '$incpth'." >&4 ;;
5003             esac
5004             case "$libpth" in
5005                 '') echo "Libpth not defined." >&4; croak=y ;;
5006                 *)  echo "Using libpth '$libpth'." >&4 ;;
5007             esac
5008             case "$usrinc" in
5009                 '') echo "Usrinc not defined." >&4; croak=y ;;
5010                 *)  echo "Using usrinc $usrinc." >&4 ;;
5011             esac
5012             case "$croak" in
5013                 y)
5014                 if test "X$sysroot" = X; then
5015                     echo "Cannot continue, aborting." >&4; exit 1
5016                 else
5017                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5018                 fi
5019                 ;;
5020             esac
5021             ;;
5022         esac
5023     ;;
5024 esac
5025
5026 : Default value for incpth is just usrinc
5027 case "$incpth" in
5028 '') incpth="$usrinc";;
5029 esac
5030
5031 : Set private lib path
5032 case "$plibpth" in
5033 '') if ./mips; then
5034         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5035     fi;;
5036 esac
5037 case "$libpth" in
5038 ' ') dlist='';;
5039 '') dlist="$loclibpth $plibpth $glibpth";;
5040 *) dlist="$libpth";;
5041 esac
5042
5043 : Now check and see which directories actually exist, avoiding duplicates
5044 for xxx in $dlist
5045 do
5046     if $test -d $xxx; then
5047                 case " $libpth " in
5048                 *" $xxx "*) ;;
5049                 *) libpth="$libpth $xxx";;
5050                 esac
5051     fi
5052 done
5053 $cat <<'EOM'
5054
5055 Some systems have incompatible or broken versions of libraries.  Among
5056 the directories listed in the question below, please remove any you
5057 know not to be holding relevant libraries, and add any that are needed.
5058 Say "none" for none.
5059
5060 EOM
5061
5062 if test "X$sysroot" != X; then
5063     $cat <<EOM
5064 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5065
5066 EOM
5067 fi
5068
5069 case "$libpth" in
5070 '') dflt='none';;
5071 *)
5072         set X $libpth
5073         shift
5074         dflt=${1+"$@"}
5075         ;;
5076 esac
5077 rp="Directories to use for library searches?"
5078 . ./myread
5079 case "$ans" in
5080 none) libpth=' ';;
5081 *) libpth="$ans";;
5082 esac
5083
5084 : compute shared library extension
5085 case "$so" in
5086 '')
5087         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5088                 dflt='sl'
5089         else
5090                 dflt='so'
5091         fi
5092         ;;
5093 *) dflt="$so";;
5094 esac
5095 $cat <<EOM
5096
5097 On some systems, shared libraries may be available.  Answer 'none' if
5098 you want to suppress searching of shared libraries for the remainder
5099 of this configuration.
5100
5101 EOM
5102 rp='What is the file extension used for shared libraries?'
5103 . ./myread
5104 so="$ans"
5105
5106 : Does target system insist that shared library basenames are unique
5107 $cat << EOM
5108
5109 Some dynamic loaders assume that the *basename* of shared library filenames
5110 are globally unique.  We'll default this to undef as we assume your system
5111 is not this weird. Set to defined if you're on one of them.
5112
5113 EOM
5114
5115 dflt='n'
5116 rp='Make shared library basenames unique?'
5117 . ./myread
5118 case "$ans" in
5119 y|Y) val="$define" ;;
5120 *)   val="$undef"  ;;
5121 esac
5122 set d_libname_unique
5123 eval $setvar
5124
5125 : Define several unixisms.
5126 : Hints files or command line option can be used to override them.
5127 : The convoluted testing is in case hints files set either the old
5128 : or the new name.
5129 case "$_exe" in
5130 '')     case "$exe_ext" in
5131         '')     ;;
5132         *)      _exe="$exe_ext" ;;
5133         esac
5134         ;;
5135 esac
5136 case "$_a" in
5137 '')     case "$lib_ext" in
5138     '') _a='.a';;
5139         *)      _a="$lib_ext" ;;
5140         esac
5141         ;;
5142 esac
5143 case "$_o" in
5144 '') case "$obj_ext" in
5145         '')     _o='.o';;
5146         *)      _o="$obj_ext";;
5147         esac
5148         ;;
5149 esac
5150 case "$p_" in
5151 '') case "$path_sep" in
5152         '')     p_=':';;
5153         *)      p_="$path_sep";;
5154         esac
5155         ;;
5156 esac
5157 exe_ext=$_exe
5158 lib_ext=$_a
5159 obj_ext=$_o
5160 path_sep=$p_
5161
5162 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5163
5164 : Which makefile gets called first.  This is used by make depend.
5165 case "$firstmakefile" in
5166 '') firstmakefile='makefile';;
5167 esac
5168
5169 : Check is we will use socks
5170 case "$usesocks" in
5171 $define|true|[yY]*)     dflt='y';;
5172 *) dflt='n';;
5173 esac
5174 cat <<EOM
5175
5176 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5177 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5178 to use the PerlIO abstraction layer, this will be implicitly selected.
5179
5180 If this doesn't make any sense to you, just accept the default '$dflt'.
5181 EOM
5182 rp='Build Perl for SOCKS?'
5183 . ./myread
5184 case "$ans" in
5185 y|Y)    val="$define" ;;
5186 *)      val="$undef" ;;
5187 esac
5188 set usesocks
5189 eval $setvar
5190
5191 : Check for uselongdouble support
5192 case "$ccflags" in
5193 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5194 esac
5195
5196 case "$uselongdouble" in
5197 $define|true|[yY]*)     dflt='y';;
5198 *) dflt='n';;
5199 esac
5200 cat <<EOM
5201
5202 Perl can be built to take advantage of long doubles which
5203 (if available) may give more accuracy and range for floating point numbers.
5204
5205 If this doesn't make any sense to you, just accept the default '$dflt'.
5206 EOM
5207 rp='Try to use long doubles if available?'
5208 . ./myread
5209 case "$ans" in
5210 y|Y)    val="$define"   ;;
5211 *)      val="$undef"    ;;
5212 esac
5213 set uselongdouble
5214 eval $setvar
5215
5216 case "$uselongdouble" in
5217 true|[yY]*) uselongdouble="$define" ;;
5218 esac
5219
5220 : Look for a hint-file generated 'call-back-unit'.  If the
5221 : user has specified that long doubles should be used,
5222 : we may need to set or change some other defaults.
5223 if $test -f uselongdouble.cbu; then
5224     echo "Your platform has some specific hints regarding long doubles, using them..."
5225     . ./uselongdouble.cbu
5226 else
5227     case "$uselongdouble" in
5228         $define)
5229                 $cat <<EOM
5230 (Your platform does not have any specific hints for long doubles.)
5231 EOM
5232         ;;
5233     esac
5234 fi
5235
5236 : Check if quadmath is requested
5237 case "$usequadmath" in
5238 "$define"|true|[yY]*) usequadmath="$define" ;;
5239 *)                    usequadmath="$undef"  ;;
5240 esac
5241
5242 : Looking for optional libraries
5243 echo " "
5244 echo "Checking for optional libraries..." >&4
5245 case "$libs" in
5246 ' '|'') dflt='';;
5247 *) dflt="$libs";;
5248 esac
5249 case "$libswanted" in
5250 '') libswanted='c_s';;
5251 esac
5252 case "$usesocks" in
5253 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5254 esac
5255 case "$usecbacktrace" in
5256 "$define") libswanted="$libswanted bfd" ;;
5257 esac
5258 case "$usequadmath" in
5259 "$define") libswanted="$libswanted quadmath" ;;
5260 esac
5261 libsfound=''
5262 libsfiles=''
5263 libsdirs=''
5264 libspath=''
5265 for thisdir in $libpth $xlibpth; do
5266   test -d $thisdir && libspath="$libspath $thisdir"
5267 done
5268 for thislib in $libswanted; do
5269         for thisdir in $libspath; do
5270             xxx=''
5271             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5272                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5273                 $test -f "$xxx" && eval $libscheck
5274                 $test -f "$xxx" && libstyle=shared
5275                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5276                 $test -f "$xxx" && eval $libscheck
5277                 $test -f "$xxx" && libstyle=shared
5278             fi
5279             if test ! -f "$xxx"; then
5280                 xxx=$thisdir/lib$thislib.$so
5281                 $test -f "$xxx" && eval $libscheck
5282                 $test -f "$xxx" && libstyle=shared
5283             fi
5284             if test ! -f "$xxx"; then
5285                 xxx=$thisdir/lib$thislib$_a
5286                 $test -f "$xxx" && eval $libscheck
5287                 $test -f "$xxx" && libstyle=static
5288             fi
5289             if test ! -f "$xxx"; then
5290                 xxx=$thisdir/$thislib$_a
5291                 $test -f "$xxx" && eval $libscheck
5292                 $test -f "$xxx" && libstyle=static
5293             fi
5294             if test ! -f "$xxx"; then
5295                 xxx=$thisdir/lib${thislib}_s$_a
5296                 $test -f "$xxx" && eval $libscheck
5297                 $test -f "$xxx" && libstyle=static
5298                 $test -f "$xxx" && thislib=${thislib}_s
5299             fi
5300             if test ! -f "$xxx"; then
5301                 xxx=$thisdir/Slib$thislib$_a
5302                 $test -f "$xxx" && eval $libscheck
5303                 $test -f "$xxx" && libstyle=static
5304             fi
5305             if $test -f "$xxx"; then
5306                 case "$libstyle" in
5307                 shared) echo "Found -l$thislib (shared)." ;;
5308                 static) echo "Found -l$thislib." ;;
5309                 *)      echo "Found -l$thislib ($libstyle)." ;;
5310                 esac
5311                 case " $dflt " in
5312                 *"-l$thislib "*);;
5313                 *) dflt="$dflt -l$thislib"
5314                    libsfound="$libsfound $xxx"
5315                    yyy=`basename $xxx`
5316                    libsfiles="$libsfiles $yyy"
5317                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5318                    case " $libsdirs " in
5319                    *" $yyy "*) ;;
5320                    *) libsdirs="$libsdirs $yyy" ;;
5321                    esac
5322                    ;;
5323                 esac
5324                 break
5325             fi
5326         done
5327         if $test ! -f "$xxx"; then
5328             echo "No -l$thislib."
5329         fi
5330 done
5331 set X $dflt
5332 shift
5333 dflt="$*"
5334 case "$libs" in
5335 '') dflt="$dflt";;
5336 *) dflt="$libs";;
5337 esac
5338 case "$dflt" in
5339 ' '|'') dflt='none';;
5340 esac
5341
5342 $cat <<EOM
5343
5344 In order to compile $package on your machine, a number of libraries
5345 are usually needed.  Include any other special libraries here as well.
5346 Say "none" for none.  The default list is almost always right.
5347 EOM
5348
5349 echo " "
5350 rp="What libraries to use?"
5351 . ./myread
5352 case "$ans" in
5353 none) libs=' ';;
5354 *) libs="$ans";;
5355 esac
5356
5357 : determine optimization, if desired, or use for debug flag also
5358 case "$optimize" in
5359 ' '|$undef) dflt='none';;
5360 '') dflt='-O';;
5361 *) dflt="$optimize";;
5362 esac
5363 $cat <<EOH
5364
5365 By default, $package compiles with the -O flag to use the optimizer.
5366 Alternately, you might want to use the symbolic debugger, which uses
5367 the -g flag (on traditional Unix systems).  Either flag can be
5368 specified here.  To use neither flag, specify the word "none".
5369
5370 EOH
5371 rp="What optimizer/debugger flag should be used?"
5372 . ./myread
5373 optimize="$ans"
5374 case "$optimize" in
5375 'none') optimize=" ";;
5376 esac
5377
5378 : Check what DEBUGGING is required from the command line
5379 : -DEBUGGING      or -DDEBUGGING or
5380 : -DEBUGGING=both                       = -g + -DDEBUGGING
5381 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5382 : -DEBUGGING=none or -UDEBUGGING        =
5383 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5384 case "$EBUGGING" in
5385 '')     ;;
5386 *)      DEBUGGING=$EBUGGING ;;
5387 esac
5388
5389 case "$DEBUGGING" in
5390 -g|both|$define)
5391     case "$optimize" in
5392         *-g*) ;;
5393         *)    optimize="$optimize -g" ;;
5394     esac ;;
5395 none|$undef)
5396     case "$optimize" in
5397         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5398                 shift
5399                 optimize="$*"
5400                 ;;
5401     esac ;;
5402 esac
5403
5404 dflt=''
5405 case "$DEBUGGING" in
5406 both|$define) dflt='-DDEBUGGING'
5407 esac
5408
5409 : argument order is deliberate, as the flag will start with - which set could
5410 : think is an option
5411 checkccflag='check=$1; flag=$2; callback=$3;
5412 echo " ";
5413 echo "Checking if your compiler accepts $flag" 2>&1;
5414 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5415 echo "int main(void) { return 0; }" > gcctest.c;
5416 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5417     echo "Yes, it does." 2>&1;
5418     if $test -s gcctest.out ; then
5419         echo "But your platform does not like it:";
5420         cat gcctest.out;
5421     else
5422         case "$ccflags" in
5423         *$check*)
5424             echo "Leaving current flags $ccflags alone." 2>&1
5425             ;;
5426         *) dflt="$dflt $flag";
5427             eval $callback
5428             ;;
5429         esac
5430     fi
5431 else
5432     echo "Nope, it does not, but that is ok." 2>&1;
5433 fi
5434 '
5435
5436 : We will not override a previous value, but we might want to
5437 : augment a hint file
5438 case "$hint" in
5439 default|recommended)
5440         case "$gccversion" in
5441         1*) dflt="$dflt -fpcc-struct-return" ;;
5442         esac
5443         case "$optimize:$DEBUGGING" in
5444         *-g*:old) dflt="$dflt -DDEBUGGING";;
5445         esac
5446         case "$gccversion" in
5447         2*) if $test -d /etc/conf/kconfig.d &&
5448                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5449                 then
5450                         # Interactive Systems (ISC) POSIX mode.
5451                         dflt="$dflt -posix"
5452                 fi
5453                 ;;
5454         esac
5455         case "$gccversion" in
5456         1*) ;;
5457         2.[0-8]*) ;;
5458         ?*)     set strict-aliasing -fno-strict-aliasing
5459                 eval $checkccflag
5460                 ;;
5461         esac
5462         # For gcc, adding -pipe speeds up compilations for some, but apparently
5463         # some assemblers can't read from stdin.  (It also slows down compilations
5464         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5465         case "$gccversion" in
5466         ?*)     set pipe -pipe
5467                 eval $checkccflag
5468                 ;;
5469         esac
5470
5471         # on x86_64 (at least) we require an extra library (libssp) in the
5472         # link command line. This library is not named, so I infer that it is
5473         # an implementation detail that may change. Hence the safest approach
5474         # is to add the flag to the flags passed to the compiler at link time,
5475         # as that way the compiler can do the right implementation dependant
5476         # thing. (NWC)
5477         case "$osname" in
5478         amigaos) ;; # -fstack-protector builds but doesn't work
5479         *)      case "$gccversion" in
5480                 ?*)     set stack-protector-strong -fstack-protector-strong
5481                         eval $checkccflag
5482                         case "$dflt" in
5483                         *-fstack-protector-strong*) ;; # It got added.
5484                         *) # Try the plain/older -fstack-protector.
5485                            set stack-protector -fstack-protector
5486                            eval $checkccflag
5487                            ;;
5488                         esac
5489                         ;;
5490                 esac
5491                 ;;
5492         esac
5493         ;;
5494 esac
5495
5496 case "$mips_type" in
5497 *BSD*|'') inclwanted="$locincpth $usrinc";;
5498 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5499 esac
5500 for thisincl in $inclwanted; do
5501         if $test -d $thisincl; then
5502                 if $test x$thisincl != x$usrinc; then
5503                         case "$dflt" in
5504                         *" -I$thisincl "*);;
5505                         *) dflt="$dflt -I$thisincl ";;
5506                         esac
5507                 fi
5508         fi
5509 done
5510
5511 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5512         xxx=true;
5513 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5514         xxx=true;
5515 else
5516         xxx=false;
5517 fi;
5518 if $xxx; then
5519         case "$dflt" in
5520         *$2*);;
5521         *) dflt="$dflt -D$2";;
5522         esac;
5523 fi'
5524
5525 set signal.h LANGUAGE_C; eval $inctest
5526
5527 case "$usesocks" in
5528 $define)
5529         ccflags="$ccflags -DSOCKS"
5530         ;;
5531 esac
5532
5533 case "$hint" in
5534 default|recommended) dflt="$ccflags $dflt" ;;
5535 *) dflt="$ccflags";;
5536 esac
5537
5538 case "$dflt" in
5539 ''|' ') dflt=none;;
5540 esac
5541
5542 $cat <<EOH
5543
5544 Your C compiler may want other flags.  For this question you should include
5545 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5546 but you should NOT include libraries or ld flags like -lwhatever.  If you
5547 want $package to honor its debug switch, you should include -DDEBUGGING here.
5548 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5549
5550 To use no flags, specify the word "none".
5551
5552 EOH
5553 set X $dflt
5554 shift
5555 dflt=${1+"$@"}
5556 rp="Any additional cc flags?"
5557 . ./myread
5558 case "$ans" in
5559 none) ccflags='';;
5560 *) ccflags="$ans";;
5561 esac
5562
5563 : the following weeds options from ccflags that are of no interest to cpp
5564 case "$cppflags" in
5565 '') cppflags="$ccflags" ;;
5566 *)  set X $ccflags; shift
5567     case " $cppflags " in
5568     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5569     *) cppflags="$cppflags $ccflags" ;;
5570     esac
5571     ;;
5572 esac
5573 case "$gccversion" in
5574 1*) cppflags="$cppflags -D__GNUC__"
5575 esac
5576 case "$mips_type" in
5577 '');;
5578 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5579 esac
5580 case "$cppflags" in
5581 '');;
5582 *)
5583         echo " "
5584         echo "Let me guess what the preprocessor flags are..." >&4
5585         set X $cppflags
5586         shift
5587         cppflags=''
5588         $cat >cpp.c <<'EOM'
5589 #define BLURFL foo
5590
5591 BLURFL xx LFRULB
5592 EOM
5593         previous=''
5594         for flag in $*
5595         do
5596                 case "$flag" in
5597                 -*) ftry="$flag";;
5598                 *) ftry="$previous $flag";;
5599                 esac
5600                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5601                         >cpp1.out 2>/dev/null && \
5602                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5603                         >cpp2.out 2>/dev/null && \
5604                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5605                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5606                 then
5607                         cppflags="$cppflags $ftry"
5608                         previous=''
5609                 else
5610                         previous="$flag"
5611                 fi
5612         done
5613         set X $cppflags
5614         shift
5615         cppflags=${1+"$@"}
5616         case "$cppflags" in
5617         *-*)  echo "They appear to be: $cppflags";;
5618         esac
5619         $rm -f cpp.c cpp?.out
5620         ;;
5621 esac
5622
5623 : flags used in final linking phase
5624 case "$ldflags" in
5625 '') if ./venix; then
5626                 dflt='-i -z'
5627         else
5628                 dflt=''
5629         fi
5630         case "$ccflags" in
5631         *-posix*) dflt="$dflt -posix" ;;
5632         esac
5633         ;;
5634 *) dflt="$ldflags";;
5635 esac
5636 # See note above about -fstack-protector
5637 case "$ccflags" in
5638 *-fstack-protector-strong*)
5639         case "$dflt" in
5640         *-fstack-protector-strong*) ;; # Don't add it again
5641         *) dflt="$dflt -fstack-protector-strong" ;;
5642         esac
5643         ;;
5644 *-fstack-protector*)
5645         case "$dflt" in
5646         *-fstack-protector*) ;; # Don't add it again
5647         *) dflt="$dflt -fstack-protector" ;;
5648         esac
5649         ;;
5650 esac
5651
5652 : Try to guess additional flags to pick up local libraries.
5653 for thislibdir in $libpth; do
5654         case " $loclibpth " in
5655         *" $thislibdir "*)
5656                 case "$dflt " in
5657                 *"-L$thislibdir "*) ;;
5658                 *)  dflt="$dflt -L$thislibdir" ;;
5659                 esac
5660                 ;;
5661         esac
5662 done
5663
5664 case "$dflt" in
5665 '') dflt='none' ;;
5666 esac
5667
5668 $cat <<EOH
5669
5670 Your C linker may need flags.  For this question you should
5671 include -L/whatever and any other flags used by the C linker, but you
5672 should NOT include libraries like -lwhatever.
5673
5674 Make sure you include the appropriate -L/path flags if your C linker
5675 does not normally search all of the directories you specified above,
5676 namely
5677         $libpth
5678 To use no flags, specify the word "none".
5679
5680 EOH
5681
5682 rp="Any additional ld flags (NOT including libraries)?"
5683 . ./myread
5684 case "$ans" in
5685 none) ldflags='';;
5686 *) ldflags="$ans";;
5687 esac
5688 rmlist="$rmlist pdp11"
5689
5690 : coherency check
5691 echo " "
5692 echo "Checking your choice of C compiler and flags for coherency..." >&4
5693 $cat > try.c <<'EOF'
5694 #include <stdio.h>
5695 int main() { printf("Ok\n"); return(0); }
5696 EOF
5697 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5698 shift
5699 $cat >try.msg <<'EOM'
5700 I've tried to compile and run the following simple program:
5701
5702 EOM
5703 $cat try.c >> try.msg
5704
5705 $cat >> try.msg <<EOM
5706
5707 I used the command:
5708
5709         $*
5710         $run ./try
5711
5712 and I got the following output:
5713
5714 EOM
5715 dflt=y
5716 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5717         if $sh -c "$run ./try " >>try.msg 2>&1; then
5718                 xxx=`$run ./try`
5719                 case "$xxx" in
5720                 "Ok") dflt=n ;;
5721                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5722                 esac
5723         else
5724                 echo "The program compiled OK, but exited with status $?." >>try.msg
5725                 rp="You have a problem.  Shall I abort Configure"
5726                 dflt=y
5727         fi
5728 else
5729         echo "I can't compile the test program." >>try.msg
5730         rp="You have a BIG problem.  Shall I abort Configure"
5731         dflt=y
5732 fi
5733 case "$dflt" in
5734 y)
5735         $cat try.msg >&4
5736         case "$knowitall" in
5737         '')
5738                 echo "(The supplied flags or libraries might be incorrect.)"
5739                 ;;
5740         *) dflt=n;;
5741         esac
5742         echo " "
5743         . ./myread
5744         case "$ans" in
5745         n*|N*) ;;
5746         *)      echo "Ok.  Stopping Configure." >&4
5747                 exit 1
5748                 ;;
5749         esac
5750         ;;
5751 n) echo "OK, that should do.";;
5752 esac
5753 $rm_try gcctest gcctest.out
5754
5755 : define a shorthand compile call
5756 compile='
5757 mc_file=$1;
5758 shift;
5759 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5760 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5761 exit 1;
5762 fi;
5763 esac;
5764 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5765 : define a shorthand compile call for compilations that should be ok.
5766 compile_ok='
5767 mc_file=$1;
5768 shift;
5769 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5770
5771 : determine filename position in cpp output
5772 echo " "
5773 echo "Computing filename position in cpp output for #include directives..." >&4
5774 case "$osname" in
5775 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5776 esac
5777 case "$fieldn" in
5778 '')
5779 case "$osname" in
5780 vos) testaccess=-e ;;
5781 *)   testaccess=-r ;;
5782 esac
5783 echo '#include <stdio.h>' > foo.c
5784 $cat >fieldn <<EOF
5785 $startsh
5786 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5787 $grep '^[       ]*#.*stdio\.h' | \
5788 while read cline; do
5789         pos=1
5790         set \$cline
5791         while $test \$# -gt 0; do
5792                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5793                         echo "\$pos"
5794                         exit 0
5795                 fi
5796                 shift
5797                 pos=\`expr \$pos + 1\`
5798         done
5799 done
5800 EOF
5801 chmod +x fieldn
5802 fieldn=`./fieldn`
5803 $rm -f foo.c fieldn
5804 ;;
5805 esac
5806 case $fieldn in
5807 '') pos='???';;
5808 1) pos=first;;
5809 2) pos=second;;
5810 3) pos=third;;
5811 *) pos="${fieldn}th";;
5812 esac
5813 echo "Your cpp writes the filename in the $pos field of the line."
5814
5815 : locate header file
5816 $cat >findhdr <<EOF
5817 $startsh
5818 wanted=\$1
5819 name=''
5820 for usrincdir in $incpth
5821 do
5822         if test -f \$usrincdir/\$wanted; then
5823                 echo "\$usrincdir/\$wanted"
5824                 exit 0
5825         fi
5826 done
5827 awkprg='{ print \$$fieldn }'
5828 echo "#include <\$wanted>" > foo\$\$.c
5829 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5830 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5831 while read cline; do
5832         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5833         case "\$name" in
5834         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5835         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5836         *) exit 2;;
5837         esac;
5838 done;
5839 #
5840 # status = 0: grep returned 0 lines, case statement not executed
5841 # status = 1: headerfile found
5842 # status = 2: while loop executed, no headerfile found
5843 #
5844 status=\$?
5845 $rm -f foo\$\$.c;
5846 if test \$status -eq 1; then
5847         exit 0;
5848 fi
5849 exit 1
5850 EOF
5851 chmod +x findhdr
5852
5853 : define an alternate in-header-list? function
5854 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5855 cont=true; xxf="echo \"<\$1> found.\" >&4";
5856 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5857 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5858 esac;
5859 case $# in 4) instead=instead;; *) instead="at last";; esac;
5860 while $test "$cont"; do
5861         xxx=`./findhdr $1`
5862         var=$2; eval "was=\$$2";
5863         if $test "$xxx" && $test -r "$xxx";
5864         then eval $xxf;
5865         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5866                 cont="";
5867         else eval $xxnf;
5868         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5869         set $yyy; shift; shift; yyy=$@;
5870         case $# in 0) cont="";;
5871         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5872                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5873         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5874                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5875         esac;
5876 done;
5877 while $test "$yyy";
5878 do set $yyy; var=$2; eval "was=\$$2";
5879         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5880         set $yyy; shift; shift; yyy=$@;
5881 done'
5882
5883 : see if stdlib is available
5884 set stdlib.h i_stdlib
5885 eval $inhdr
5886
5887 : check for lengths of integral types
5888 echo " "
5889 case "$intsize" in
5890 '')
5891         echo "Checking to see how big your integers are..." >&4
5892         $cat >try.c <<EOCP
5893 #include <stdio.h>
5894 #$i_stdlib I_STDLIB
5895 #ifdef I_STDLIB
5896 #include <stdlib.h>
5897 #endif
5898 int main()
5899 {
5900         printf("intsize=%d;\n", (int)sizeof(int));
5901         printf("longsize=%d;\n", (int)sizeof(long));
5902         printf("shortsize=%d;\n", (int)sizeof(short));
5903         exit(0);
5904 }
5905 EOCP
5906         set try
5907         if eval $compile_ok && $run ./try > /dev/null; then
5908                 eval `$run ./try`
5909                 echo "Your integers are $intsize bytes long."
5910                 echo "Your long integers are $longsize bytes long."
5911                 echo "Your short integers are $shortsize bytes long."
5912         else
5913                 $cat >&4 <<EOM
5914 !
5915 Help! I can't compile and run the intsize test program: please enlighten me!
5916 (This is probably a misconfiguration in your system or libraries, and
5917 you really ought to fix it.  Still, I'll try anyway.)
5918 !
5919 EOM
5920                 dflt=4
5921                 rp="What is the size of an integer (in bytes)?"
5922                 . ./myread
5923                 intsize="$ans"
5924                 dflt=$intsize
5925                 rp="What is the size of a long integer (in bytes)?"
5926                 . ./myread
5927                 longsize="$ans"
5928                 dflt=2
5929                 rp="What is the size of a short integer (in bytes)?"
5930                 . ./myread
5931                 shortsize="$ans"
5932         fi
5933         ;;
5934 esac
5935 $rm_try
5936
5937 : check for long long
5938 echo " "
5939 echo "Checking to see if you have long long..." >&4
5940 echo 'int main() { long long x = 7; return 0; }' > try.c
5941 set try
5942 if eval $compile; then
5943         val="$define"
5944         echo "You have long long."
5945 else
5946         val="$undef"
5947         echo "You do not have long long."
5948 fi
5949 $rm_try
5950 set d_longlong
5951 eval $setvar
5952
5953 : check for length of long long
5954 case "${d_longlong}${longlongsize}" in
5955 $define)
5956         echo " "
5957         echo "Checking to see how big your long longs are..." >&4
5958         $cat >try.c <<'EOCP'
5959 #include <stdio.h>
5960 int main()
5961 {
5962     printf("%d\n", (int)sizeof(long long));
5963     return(0);
5964 }
5965 EOCP
5966         set try
5967         if eval $compile_ok; then
5968                 longlongsize=`$run ./try`
5969                 echo "Your long longs are $longlongsize bytes long."
5970         else
5971                 dflt='8'
5972                 echo " "
5973                 echo "(I can't seem to compile the test program.  Guessing...)"
5974                 rp="What is the size of a long long (in bytes)?"
5975                 . ./myread
5976                 longlongsize="$ans"
5977         fi
5978         if $test "X$longsize" = "X$longlongsize"; then
5979                 echo "(That isn't any different from an ordinary long.)"
5980         fi
5981         ;;
5982 esac
5983 $rm_try
5984
5985 : see if inttypes.h is available
5986 : we want a real compile instead of Inhdr because some systems
5987 : have an inttypes.h which includes non-existent headers
5988 echo " "
5989 $cat >try.c <<EOCP
5990 #include <inttypes.h>
5991 int main() {
5992         static int32_t foo32 = 0x12345678;
5993 }
5994 EOCP
5995 set try
5996 if eval $compile; then
5997         echo "<inttypes.h> found." >&4
5998         val="$define"
5999 else
6000         echo "<inttypes.h> NOT found." >&4
6001         val="$undef"
6002 fi
6003 $rm_try
6004 set i_inttypes
6005 eval $setvar
6006
6007 : check for int64_t
6008 echo " "
6009 echo "Checking to see if you have int64_t..." >&4
6010 $cat >try.c <<EOCP
6011 #include <sys/types.h>
6012 #$i_inttypes I_INTTYPES
6013 #ifdef I_INTTYPES
6014 #include <inttypes.h>
6015 #endif
6016 int main() { int64_t x = 7; }
6017 EOCP
6018 set try
6019 if eval $compile; then
6020         val="$define"
6021         echo "You have int64_t."
6022 else
6023         val="$undef"
6024         echo "You do not have int64_t."
6025 fi
6026 $rm_try
6027 set d_int64_t
6028 eval $setvar
6029
6030 : Check if 64bit ints have a quad type
6031 echo " "
6032 echo "Checking which 64-bit integer type we could use..." >&4
6033
6034 case "$intsize" in
6035 8) val=int
6036    set quadtype
6037    eval $setvar
6038    val='"unsigned int"'
6039    set uquadtype
6040    eval $setvar
6041    quadkind=1
6042    ;;
6043 *) case "$longsize" in
6044    8) val=long
6045       set quadtype
6046       eval $setvar
6047       val='"unsigned long"'
6048       set uquadtype
6049       eval $setvar
6050       quadkind=2
6051       ;;
6052    *) case "$d_longlong:$longlongsize" in
6053       define:8)
6054         val='"long long"'
6055         set quadtype
6056         eval $setvar
6057         val='"unsigned long long"'
6058         set uquadtype
6059         eval $setvar
6060         quadkind=3
6061         ;;
6062       *) case "$d_int64_t" in
6063          define)
6064            val=int64_t
6065            set quadtype
6066            eval $setvar
6067            val=uint64_t
6068            set uquadtype
6069            eval $setvar
6070            quadkind=4
6071            ;;
6072          esac
6073          ;;
6074       esac
6075       ;;
6076    esac
6077    ;;
6078 esac
6079
6080 case "$quadtype" in
6081 '')     echo "Alas, no 64-bit integer types in sight." >&4
6082         d_quad="$undef"
6083         ;;
6084 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6085         d_quad="$define"
6086         ;;
6087 esac
6088
6089 : Do we want 64bit support
6090 case "$uselonglong" in
6091 "$define"|true|[yY]*)
6092         cat <<EOM >&4
6093
6094 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6095 EOM
6096         use64bitint="$define"
6097         ;;
6098 esac
6099 case "$use64bits" in
6100 "$define"|true|[yY]*)
6101         cat <<EOM >&4
6102
6103 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6104 EOM
6105         use64bitint="$define"
6106         ;;
6107 esac
6108 case "$use64bitints" in
6109 "$define"|true|[yY]*)
6110         cat <<EOM >&4
6111
6112 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6113 EOM
6114         use64bitint="$define"
6115         ;;
6116 esac
6117 case "$use64bitsint" in
6118 "$define"|true|[yY]*)
6119         cat <<EOM >&4
6120
6121 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6122 EOM
6123         use64bitint="$define"
6124         ;;
6125 esac
6126 case "$uselonglongs" in
6127 "$define"|true|[yY]*)
6128         cat <<EOM >&4
6129
6130 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6131 EOM
6132         use64bitint="$define"
6133         ;;
6134 esac
6135 case "$use64bitsall" in
6136 "$define"|true|[yY]*)
6137         cat <<EOM >&4
6138
6139 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6140 EOM
6141         use64bitall="$define"
6142         ;;
6143 esac
6144
6145 case "$ccflags" in
6146 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6147 esac
6148 case "$use64bitall" in
6149 "$define"|true|[yY]*) use64bitint="$define" ;;
6150 esac
6151
6152 case "$longsize" in
6153 8) cat <<EOM
6154
6155 You have natively 64-bit long integers.
6156 EOM
6157    val="$define"
6158    ;;
6159 *) case "$use64bitint" in
6160    "$define"|true|[yY]*) dflt='y';;
6161    *) dflt='n';;
6162    esac
6163    case "$d_quad" in
6164    "$define") ;;
6165    *) dflt='n' ;;
6166    esac
6167    cat <<EOM
6168
6169 Perl can be built to take advantage of 64-bit integer types
6170 on some systems.  To do so, Configure can be run with -Duse64bitint.
6171 Choosing this option will most probably introduce binary incompatibilities.
6172
6173 If this doesn't make any sense to you, just accept the default '$dflt'.
6174 (The default has been chosen based on your configuration.)
6175 EOM
6176    rp='Try to use 64-bit integers, if available?'
6177    . ./myread
6178    case "$ans" in
6179    [yY]*) val="$define" ;;
6180    *)     val="$undef"  ;;
6181    esac
6182    ;;
6183 esac
6184 set use64bitint
6185 eval $setvar
6186
6187 case "$use64bitall" in
6188 "$define"|true|[yY]*) dflt='y' ;;
6189 *) case "$longsize" in
6190    8) dflt='y' ;;
6191    *) dflt='n' ;;
6192    esac
6193    ;;
6194 esac
6195 cat <<EOM
6196
6197 You may also choose to try maximal 64-bitness.  It means using as much
6198 64-bitness as possible on the platform.  This in turn means even more
6199 binary incompatibilities.  On the other hand, your platform may not
6200 have any more 64-bitness available than what you already have chosen.
6201
6202 If this doesn't make any sense to you, just accept the default '$dflt'.
6203 (The default has been chosen based on your configuration.)
6204 EOM
6205 rp='Try to use maximal 64-bit support, if available?'
6206 . ./myread
6207 case "$ans" in
6208 [yY]*) val="$define" ;;
6209 *)     val="$undef"  ;;
6210 esac
6211 set use64bitall
6212 eval $setvar
6213 case "$use64bitall" in
6214 "$define")
6215         case "$use64bitint" in
6216         "$undef")
6217                 cat <<EOM
6218
6219 Since you have chosen a maximally 64-bit build, I'm also turning on
6220 the use of 64-bit integers.
6221 EOM
6222                 use64bitint="$define" ;;
6223         esac
6224         ;;
6225 esac
6226
6227 : Look for a hint-file generated 'call-back-unit'.  If the
6228 : user has specified that a 64-bit perl is to be built,
6229 : we may need to set or change some other defaults.
6230 if $test -f use64bitint.cbu; then
6231         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6232         . ./use64bitint.cbu
6233 fi
6234 case "$use64bitint" in
6235 "$define"|true|[yY]*)
6236         : This test was common to all the OpenBSD forks, and seems harmless for
6237         : other platforms:
6238         echo " "
6239         echo "Checking if your C library has broken 64-bit functions..." >&4
6240         cat >try.c <<EOCP
6241 #include <stdio.h>
6242 typedef $uquadtype myULL;
6243 int main (void)
6244 {
6245     struct {
6246         double d;
6247         myULL  u;
6248     } *p, test[] = {
6249         {4294967303.15, 4294967303ULL},
6250         {4294967294.2,  4294967294ULL},
6251         {4294967295.7,  4294967295ULL},
6252         {0.0, 0ULL}
6253     };
6254     for (p = test; p->u; p++) {
6255         myULL x = (myULL)p->d;
6256         if (x != p->u) {
6257             printf("buggy\n");
6258             return 0;
6259         }
6260     }
6261     printf("ok\n");
6262     return 0;
6263 }
6264 EOCP
6265         set try
6266         if eval $compile_ok; then
6267             libcquad=`$run ./try`
6268             echo "Your C library's 64-bit functions are $libcquad."
6269         else
6270             echo "(I can't seem to compile the test program.)"
6271             echo "Assuming that your C library's 64-bit functions are ok."
6272             libcquad="ok"
6273         fi
6274         $rm_try
6275
6276         case "$libcquad" in
6277             buggy*)
6278                 cat >&4 <<EOM
6279
6280 *** You have a C library with broken 64-bit functions.
6281 *** 64-bit support does not work reliably in this configuration.
6282 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6283 *** Cannot continue, aborting.
6284
6285 EOM
6286                 exit 1
6287                 ;;
6288         esac
6289         case "$longsize" in
6290         4) case "$archname64" in
6291            '') archname64=64int ;;
6292            esac
6293            ;;
6294         esac
6295         ;;
6296 esac
6297
6298 : Look for a hint-file generated 'call-back-unit'.  If the
6299 : user has specified that a maximally 64-bit perl is to be built,
6300 : we may need to set or change some other defaults.
6301 if $test -f use64bitall.cbu; then
6302         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6303         . ./use64bitall.cbu
6304 fi
6305 case "$use64bitall" in
6306 "$define"|true|[yY]*)
6307         case "$longsize" in
6308         4) case "$archname64" in
6309            ''|64int) archname64=64all ;;
6310            esac
6311            ;;
6312         esac
6313         ;;
6314 esac
6315
6316 case "$d_quad:$use64bitint" in
6317 $undef:$define)
6318         cat >&4 <<EOF
6319
6320 *** You have chosen to use 64-bit integers,
6321 *** but none can be found.
6322 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6323 *** Cannot continue, aborting.
6324
6325 EOF
6326         exit 1
6327         ;;
6328 esac
6329
6330 : Check if we are using the GNU C library
6331 echo " "
6332 echo "Checking for GNU C Library..." >&4
6333 cat >try.c <<'EOCP'
6334 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6335    alone are insufficient to distinguish different versions, such as
6336    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6337    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6338 */
6339 #include <stdio.h>
6340 int main(void)
6341 {
6342 #ifdef __GLIBC__
6343 #   ifdef __GLIBC_MINOR__
6344 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6345 #           include <gnu/libc-version.h>
6346             printf("%s\n",  gnu_get_libc_version());
6347 #       else
6348             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6349 #       endif
6350 #   else
6351         printf("%d\n",  __GLIBC__);
6352 #   endif
6353     return 0;
6354 #else
6355     return 1;
6356 #endif
6357 }
6358 EOCP
6359 set try
6360 if eval $compile_ok && $run ./try > glibc.ver; then
6361         val="$define"
6362         gnulibc_version=`$cat glibc.ver`
6363         echo "You are using the GNU C Library version $gnulibc_version"
6364 else
6365         val="$undef"
6366         gnulibc_version=''
6367         echo "You are not using the GNU C Library"
6368 fi
6369 $rm_try glibc.ver
6370 set d_gnulibc
6371 eval $setvar
6372
6373 : see if nm is to be used to determine whether a symbol is defined or not
6374 case "$usenm" in
6375 '')
6376         dflt=''
6377         case "$d_gnulibc" in
6378         "$define")
6379                 echo " "
6380                 echo "nm probably won't work on the GNU C Library." >&4
6381                 dflt=n
6382                 ;;
6383         esac
6384         case "$dflt" in
6385         '')
6386                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6387                         echo " "
6388                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6389                         echo "'nm' won't be sufficient on this system." >&4
6390                         dflt=n
6391                 fi
6392                 ;;
6393         esac
6394         case "$dflt" in
6395         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6396                 if $test $dflt -gt 20; then
6397                         dflt=y
6398                 else
6399                         dflt=n
6400                 fi
6401                 ;;
6402         esac
6403         ;;
6404 *)
6405         case "$usenm" in
6406         true|$define) dflt=y;;
6407         *) dflt=n;;
6408         esac
6409         ;;
6410 esac
6411 $cat <<EOM
6412
6413 I can use $nm to extract the symbols from your C libraries. This
6414 is a time consuming task which may generate huge output on the disk (up
6415 to 3 megabytes) but that should make the symbols extraction faster. The
6416 alternative is to skip the 'nm' extraction part and to compile a small
6417 test program instead to determine whether each symbol is present. If
6418 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6419 this may be the best solution.
6420
6421 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6422
6423 EOM
6424 rp="Shall I use $nm to extract C symbols from the libraries?"
6425 . ./myread
6426 case "$ans" in
6427 [Nn]*) usenm=false;;
6428 *) usenm=true;;
6429 esac
6430
6431 runnm=$usenm
6432 case "$reuseval" in
6433 true) runnm=false;;
6434 esac
6435
6436 : nm options which may be necessary
6437 case "$nm_opt" in
6438 '') if $test -f /mach_boot; then
6439                 nm_opt=''       # Mach
6440         elif $test -d /usr/ccs/lib; then
6441                 nm_opt='-p'     # Solaris (and SunOS?)
6442         elif $test -f /dgux; then
6443                 nm_opt='-p'     # DG-UX
6444         elif $test -f /lib64/rld; then
6445                 nm_opt='-p'     # 64-bit Irix
6446         else
6447                 nm_opt=''
6448         fi;;
6449 esac
6450
6451 : nm options which may be necessary for shared libraries but illegal
6452 : for archive libraries.  Thank you, Linux.
6453 case "$nm_so_opt" in
6454 '')     case "$myuname" in
6455         *linux*|gnu*)
6456                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6457                         nm_so_opt='--dynamic'
6458                 fi
6459                 ;;
6460         esac
6461         ;;
6462 esac
6463
6464 : Figure out where the libc is located
6465 case "$runnm" in
6466 true)
6467 : get list of predefined functions in a handy place
6468 echo " "
6469 case "$libc" in
6470 '') libc=unknown
6471         case "$libs" in
6472         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6473         esac
6474         ;;
6475 esac
6476 case "$libs" in
6477 '') ;;
6478 *)  for thislib in $libs; do
6479         case "$thislib" in
6480         -lc|-lc_s)
6481                 : Handle C library specially below.
6482                 ;;
6483         -l*)
6484                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6485                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6486                         :
6487                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6488                         :
6489                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6490                         :
6491                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6492                         :
6493                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6494                         :
6495                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6496                         :
6497                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6498                         :
6499                 else
6500                         try=''
6501                 fi
6502                 libnames="$libnames $try"
6503                 ;;
6504         *) libnames="$libnames $thislib" ;;
6505         esac
6506         done
6507         ;;
6508 esac
6509 xxx=normal
6510 case "$libc" in
6511 unknown)
6512         set /lib/libc.$so
6513         for xxx in $libpth; do
6514                 $test -r $1 || set $xxx/libc.$so
6515                 : The messy sed command sorts on library version numbers.
6516                 $test -r $1 || \
6517                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6518                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6519                                 h
6520                                 s/[0-9][0-9]*/0000&/g
6521                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6522                                 G
6523                                 s/\n/ /' | \
6524                          $sort | $sed -e 's/^.* //'`
6525                 eval set \$$#
6526         done
6527         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6528         $test -r $1 || set $sysroot/lib/libsys_s$_a
6529         ;;
6530 *)
6531         set blurfl
6532         ;;
6533 esac
6534 if $test -r "$1"; then
6535         echo "Your (shared) C library seems to be in $1."
6536         libc="$1"
6537 elif $test -r /lib/libc && $test -r /lib/clib; then
6538         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6539         xxx=apollo
6540         libc='/lib/clib /lib/libc'
6541         if $test -r /lib/syslib; then
6542                 echo "(Your math library is in /lib/syslib.)"
6543                 libc="$libc /lib/syslib"
6544         fi
6545 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6546         echo "Your C library seems to be in $libc, as you said before."
6547 elif $test -r $incpath/usr/lib/libc$_a; then
6548         libc=$incpath/usr/lib/libc$_a;
6549         echo "Your C library seems to be in $libc.  That's fine."
6550 elif $test -r /lib/libc$_a; then
6551         libc=/lib/libc$_a;
6552         echo "Your C library seems to be in $libc.  You're normal."
6553 else
6554         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6555                 :
6556         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6557                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6558         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6559                 :
6560         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6561                 :
6562         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6563                 :
6564         else
6565                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6566         fi
6567         if $test -r "$tans"; then
6568                 echo "Your C library seems to be in $tans, of all places."
6569                 libc=$tans
6570         else
6571                 libc='blurfl'
6572         fi
6573 fi
6574 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6575         dflt="$libc"
6576         cat <<EOM
6577
6578 If the guess above is wrong (which it might be if you're using a strange
6579 compiler, or your machine supports multiple models), you can override it here.
6580
6581 EOM
6582 else
6583         dflt=''
6584         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6585         cat >&4 <<EOM
6586 I can't seem to find your C library.  I've looked in the following places:
6587
6588 EOM
6589         $sed 's/^/      /' libpath
6590         cat <<EOM
6591
6592 None of these seems to contain your C library. I need to get its name...
6593
6594 EOM
6595 fi
6596 fn=f
6597 rp='Where is your C library?'
6598 . ./getfile
6599 libc="$ans"
6600
6601 echo " "
6602 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6603 set X `cat libnames`
6604 shift
6605 xxx=files
6606 case $# in 1) xxx=file; esac
6607 echo "Extracting names from the following $xxx for later perusal:" >&4
6608 echo " "
6609 $sed 's/^/      /' libnames >&4
6610 echo " "
6611 $echo $n "This may take a while...$c" >&4
6612
6613 for file in $*; do
6614         case $file in
6615         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6616         *) $nm $nm_opt $file 2>/dev/null;;
6617         esac
6618 done >libc.tmp
6619
6620 $echo $n ".$c"
6621 $grep fprintf libc.tmp > libc.ptf
6622 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6623 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6624 xxx='[ADTSIWi]'
6625 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6626         eval $xscan;\
6627         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6628                 eval $xrun
6629 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6630         eval $xscan;\
6631         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6632                 eval $xrun
6633 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6634         eval $xscan;\
6635         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6636                 eval $xrun
6637 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6638         eval $xscan;\
6639         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6640                 eval $xrun
6641 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6642         eval $xscan;\
6643         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6644                 eval $xrun
6645 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6646         eval $xscan;\
6647         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6648                 eval $xrun
6649 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6650                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6651         eval $xscan;\
6652         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6653                 eval $xrun
6654 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6655         eval $xscan;\
6656         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6657                 eval $xrun
6658 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6659         eval $xscan;\
6660         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6661                 eval $xrun
6662 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6663         eval $xscan;\
6664         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6665                 eval $xrun
6666 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6667         eval $xscan;\
6668         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6669                 eval $xrun
6670 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6671         eval $xscan;\
6672         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6673                 eval $xrun
6674 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6675         eval $xscan;\
6676         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6677                 eval $xrun
6678 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6679         eval $xscan;\
6680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6681                 eval $xrun
6682 else
6683         $nm -p $* 2>/dev/null >libc.tmp
6684         $grep fprintf libc.tmp > libc.ptf
6685         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6686                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6687         then
6688                 nm_opt='-p'
6689                 eval $xrun
6690         else
6691                 echo " "
6692                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6693                 com=''
6694                 if $ar t $libc > libc.tmp && \
6695                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6696                 then
6697                         for thisname in $libnames $libc; do
6698                                 $ar t $thisname >>libc.tmp
6699                         done
6700                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6701                         echo "Ok." >&4
6702                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6703                         for thisname in $libnames $libc; do
6704                                 $ar tv $thisname >>libc.tmp
6705                                 emximp -o tmp.imp $thisname \
6706                                     2>/dev/null && \
6707                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6708                                     < tmp.imp >>libc.tmp
6709                                 $rm -f tmp.imp
6710                         done
6711                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6712                         echo "Ok." >&4
6713                 else
6714                         echo "$ar didn't seem to work right." >&4
6715                         echo "Maybe this is a Cray...trying bld instead..." >&4
6716                         if  bld t $libc | \
6717                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6718                                 $test -s libc.list
6719                         then
6720                                 for thisname in $libnames; do
6721                                         bld t $libnames | \
6722                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6723                                         $ar t $thisname >>libc.tmp
6724                                 done
6725                                 echo "Ok." >&4
6726                         else
6727                                 echo "That didn't work either.  Giving up." >&4
6728                                 exit 1
6729                         fi
6730                 fi
6731         fi
6732 fi
6733 nm_extract="$com"
6734 case "$PASE" in
6735 define)
6736     echo " "
6737     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6738     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6739     ;;
6740 *)  if $test -f /lib/syscalls.exp; then
6741         echo " "
6742         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6743         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6744                 /lib/syscalls.exp >>libc.list
6745     fi
6746     ;;
6747 esac
6748 ;;
6749 esac
6750 $rm -f libnames libpath
6751
6752 : Check if we are using C++
6753 echo " "
6754 echo "Checking for C++..." >&4
6755 $cat >try.c <<'EOCP'
6756 #include <stdio.h>
6757 int main(void)
6758 {
6759 #ifdef __cplusplus
6760     return 0;
6761 #else
6762     return 1;
6763 #endif
6764 }
6765 EOCP
6766 set try
6767 if eval $compile_ok && $run ./try; then
6768         val="$define"
6769         echo "You are using a C++ compiler."
6770 else
6771         val="$undef"
6772         echo "You are not using a C++ compiler."
6773 fi
6774 $rm_try cplusplus$$
6775 set d_cplusplus
6776 eval $setvar
6777
6778 : is a C symbol defined?
6779 csym='tlook=$1;
6780 case "$3" in
6781 -v) tf=libc.tmp; tdc="";;
6782 -a) tf=libc.tmp; tdc="[]";;
6783 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6784 esac;
6785 case "$d_cplusplus" in
6786     $define)    extern_C="extern \"C\"" ;;
6787     *)          extern_C="extern"       ;;
6788 esac;
6789 tx=yes;
6790 case "$reuseval-$4" in
6791 true-) ;;
6792 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6793 esac;
6794 case "$tx" in
6795 yes)
6796         tval=false;
6797         if $test "$runnm" = true; then
6798                 if $contains $tlook $tf >/dev/null 2>&1; then
6799                         tval=true;
6800                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6801                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6802                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6803                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6804                         $rm_try;
6805                 fi;
6806         else
6807                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6808                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6809                 $rm_try;
6810         fi;
6811         ;;
6812 *)
6813         case "$tval" in
6814         $define) tval=true;;
6815         *) tval=false;;
6816         esac;
6817         ;;
6818 esac;
6819 eval "$2=$tval"'
6820
6821 : define an is-in-libc? function
6822 inlibc='echo " "; td=$define; tu=$undef;
6823 sym=$1; var=$2; eval "was=\$$2";
6824 tx=yes;
6825 case "$reuseval$was" in
6826 true) ;;
6827 true*) tx=no;;
6828 esac;
6829 case "$tx" in
6830 yes)
6831         set $sym tres -f;
6832         eval $csym;
6833         case "$tres" in
6834         true)
6835                 echo "$sym() found." >&4;
6836                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6837         *)
6838                 echo "$sym() NOT found." >&4;
6839                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6840         esac;;
6841 *)
6842         case "$was" in
6843         $define) echo "$sym() found." >&4;;
6844         *) echo "$sym() NOT found." >&4;;
6845         esac;;
6846 esac'
6847
6848 : check for length of double
6849 echo " "
6850 case "$doublesize" in
6851 '')
6852         echo "Checking to see how big your double precision numbers are..." >&4
6853         $cat >try.c <<EOCP
6854 #include <stdio.h>
6855 #$i_stdlib I_STDLIB
6856 #ifdef I_STDLIB
6857 #include <stdlib.h>
6858 #endif
6859 int main()
6860 {
6861     printf("%d\n", (int)sizeof(double));
6862     exit(0);
6863 }
6864 EOCP
6865         set try
6866         if eval $compile_ok; then
6867                 doublesize=`$run ./try`
6868                 echo "Your double is $doublesize bytes long."
6869         else
6870                 dflt='8'
6871                 echo "(I can't seem to compile the test program.  Guessing...)"
6872                 rp="What is the size of a double precision number (in bytes)?"
6873                 . ./myread
6874                 doublesize="$ans"
6875         fi
6876         ;;
6877 esac
6878 $rm_try
6879
6880 : see if this is a float.h system
6881 set float.h i_float
6882 eval $inhdr
6883
6884 : check for long doubles
6885 echo " "
6886 echo "Checking to see if you have long double..." >&4
6887 echo 'int main() { long double x = 7.0; }' > try.c
6888 set try
6889 if eval $compile; then
6890         val="$define"
6891         echo "You have long double."
6892 else
6893         val="$undef"
6894         echo "You do not have long double."
6895 fi
6896 $rm_try
6897 set d_longdbl
6898 eval $setvar
6899
6900 : see if ldexpl exists
6901 set ldexpl d_ldexpl
6902 eval $inlibc
6903
6904 : check for length of long double
6905 case "${d_longdbl}${longdblsize}" in
6906 $define)
6907         echo " "
6908         echo "Checking to see how big your long doubles are..." >&4
6909         $cat >try.c <<'EOCP'
6910 #include <stdio.h>
6911 int main()
6912 {
6913         printf("%d\n", sizeof(long double));
6914 }
6915 EOCP
6916         set try
6917         set try
6918         if eval $compile; then
6919                 longdblsize=`$run ./try`
6920                 echo "Your long doubles are $longdblsize bytes long."
6921         else
6922                 dflt='8'
6923                 echo " "
6924                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6925                 rp="What is the size of a long double (in bytes)?"
6926                 . ./myread
6927                 longdblsize="$ans"
6928         fi
6929         if $test "X$doublesize" = "X$longdblsize"; then
6930                 echo "That isn't any different from an ordinary double."
6931                 echo "I'll keep your setting anyway, but you may see some"
6932                 echo "harmless compilation warnings."
6933         fi
6934         ;;
6935 esac
6936 $rm_try
6937
6938 $echo "Checking the kind of long doubles you have..." >&4
6939 case "$d_longdbl" in
6940 define)
6941 $cat <<EOP >try.c
6942 #$i_float I_FLOAT
6943 #$i_stdlib I_STDLIB
6944 #define LONGDBLSIZE $longdblsize
6945 #define DOUBLESIZE $doublesize
6946 #ifdef I_FLOAT
6947 #include <float.h>
6948 #endif
6949 #ifdef I_STDLIB
6950 #include <stdlib.h>
6951 #endif
6952 #include <stdio.h>
6953 static const long double d = -0.1L;
6954 int main() {
6955   unsigned const char* b = (unsigned const char*)(&d);
6956 #if DOUBLESIZE == LONGDBLSIZE
6957   printf("0\n"); /* if it floats like double */
6958   exit(0);
6959 #endif
6960 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6961   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6962     /* IEEE 754 128-bit little-endian */
6963     printf("1\n");
6964     exit(0);
6965   }
6966   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6967     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6968     printf("2\n");
6969     exit(0);
6970   }
6971 #endif
6972 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6973  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6974  * cannot be trusted. */
6975 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6976   if (b[0] == 0xCD && b[9] == 0xBF) {
6977     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6978      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6979      * Also known as "extended precision". */
6980     printf("3\n");
6981     exit(0);
6982   }
6983   if (b[0] == 0xBF && b[9] == 0xCD) {
6984     /* Is there ever big-endian 80-bit, really?
6985      *
6986      * The Motorola 68881 had another "extended precision" format:
6987      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6988      * for total of 96 bits of bytes.  The zero bits were unused.
6989      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
6990      * If it ever becomes relevant, this format should be allocated
6991      * a new doublekind code since it's quite different from the Intel x87.
6992      */
6993     printf("4\n");
6994     exit(0);
6995   }
6996 #endif
6997 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6998   /* software "double double", the 106 is 53+53.
6999    * but irix thinks it is 107. */
7000   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7001     /* double double 128-bit fully little-endian,
7002      * little-endian doubles in little-endian order,
7003      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7004     printf("5\n");
7005     exit(0);
7006   }
7007   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7008     /* double double 128-bit fully big-endian,
7009      * big-endian doubles in big-endian order,
7010      * e.g. PPC/Power and MIPS:
7011      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7012     printf("6\n");
7013     exit(0);
7014   }
7015   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7016     /* double double 128-bit mixed endian.
7017      * little-endian doubles in big-endian order,
7018      * e.g. ppc64el,
7019      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7020     printf("7\n");
7021     exit(0);
7022   }
7023   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7024     /* double double 128-bit mixed endian,
7025      * big-endian doubles in little-endian order,
7026      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7027     printf("8\n");
7028     exit(0);
7029   }
7030 #endif
7031   printf("-1\n"); /* unknown */
7032   exit(0);
7033 }
7034 EOP
7035 set try
7036 if eval $compile; then
7037     longdblkind=`$run ./try`
7038 else
7039     longdblkind=-1
7040 fi
7041 ;;
7042 *) longdblkind=0 ;;
7043 esac
7044 case "$longdblkind" in
7045 0) echo "Your long doubles are doubles." >&4 ;;
7046 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7047 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7048 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7049 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7050 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7051 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7052 7) echo "You have 128-bit mixed double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7053 8) echo "You have 128-bit mixed double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7054 *) echo "Cannot figure out your long double." >&4 ;;
7055 esac
7056 $rm_try
7057
7058 : determine the architecture name
7059 echo " "
7060 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7061         tarch=`arch`"-$osname"
7062 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7063         if uname -m > tmparch 2>&1 ; then
7064                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7065                         -e 's/$/'"-$osname/" tmparch`
7066         else
7067                 tarch="$osname"
7068         fi
7069         $rm -f tmparch
7070 else
7071         tarch="$osname"
7072 fi
7073 case "$myarchname" in
7074 ''|"$tarch") ;;
7075 *)
7076         echo "(Your architecture name used to be $myarchname.)"
7077         archname=''
7078         ;;
7079 esac
7080 case "$targetarch" in
7081 '') ;;
7082 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7083 esac
7084 myarchname="$tarch"
7085 case "$archname" in
7086 '') dflt="$tarch";;
7087 *) dflt="$archname";;
7088 esac
7089 rp='What is your architecture name'
7090 . ./myread
7091 archname="$ans"
7092
7093 : optionally add API version to the architecture for versioned archlibs
7094 case "$useversionedarchname" in
7095 $define|true|[yY]*) dflt='y';;
7096 *)                  dflt='n';;
7097 esac
7098 rp='Add the Perl API version to your archname?'
7099 . ./myread
7100 case "$ans" in
7101 y|Y)    useversionedarchname="$define" ;;
7102 *)      useversionedarchname="$undef" ;;
7103 esac
7104 case "$useversionedarchname" in
7105 $define)
7106         case "$archname" in
7107         *-$api_versionstring)
7108                 echo "...and architecture name already has -$api_versionstring" >&4
7109                 ;;
7110         *)
7111                 archname="$archname-$api_versionstring"
7112                 echo "...setting architecture name to $archname." >&4
7113                 ;;
7114         esac
7115         ;;
7116 esac
7117
7118 case "$usethreads" in
7119 $define)
7120         echo "Threads selected." >&4
7121         case "$archname" in
7122         *-thread*) echo "...and architecture name already has -thread." >&4
7123                 ;;
7124         *)      archname="$archname-thread"
7125                 echo "...setting architecture name to $archname." >&4
7126                 ;;
7127         esac
7128         ;;
7129 esac
7130 case "$usemultiplicity" in
7131 $define)
7132         echo "Multiplicity selected." >&4
7133         case "$archname" in
7134         *-multi*) echo "...and architecture name already has -multi." >&4
7135                 ;;
7136         *)      archname="$archname-multi"
7137                 echo "...setting architecture name to $archname." >&4
7138                 ;;
7139         esac
7140         ;;
7141 esac
7142 case "$use64bitint$use64bitall" in
7143 *"$define"*)
7144         case "$archname64" in
7145         '')
7146                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7147                 ;;
7148         *)
7149                 case "$use64bitint" in
7150                 "$define") echo "64 bit integers selected." >&4 ;;
7151                 esac
7152                 case "$use64bitall" in
7153                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7154                 esac
7155                 case "$archname" in
7156                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7157                         ;;
7158                 *)      archname="$archname-$archname64"
7159                         echo "...setting architecture name to $archname." >&4
7160                         ;;
7161                 esac
7162                 ;;
7163         esac
7164 esac
7165 case "$uselongdouble" in
7166 $define)
7167         echo "Long doubles selected." >&4
7168         case "$longdblsize" in
7169         $doublesize)
7170                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7171                 ;;
7172         *)
7173                 case "$archname" in
7174                 *-ld*) echo "...and architecture name already has -ld." >&4
7175                         ;;
7176                 *)      archname="$archname-ld"
7177                         echo "...setting architecture name to $archname." >&4
7178                         ;;
7179                 esac
7180                 ;;
7181         esac
7182         ;;
7183 esac
7184 case "$usequadmath" in
7185 $define)
7186         echo "quadmath selected." >&4
7187         case "$archname" in
7188         *-ld*) echo "...and architecture name already has -quadmath." >&4
7189                 ;;
7190         *)      archname="$archname-quadmath"
7191                 echo "...setting architecture name to $archname." >&4
7192                 ;;
7193         esac
7194         ;;
7195 esac
7196 if $test -f archname.cbu; then
7197         echo "Your platform has some specific hints for architecture name, using them..."
7198         . ./archname.cbu
7199 fi
7200
7201 : set the prefixit variable, to compute a suitable default value
7202 prefixit='case "$3" in
7203 ""|none)
7204         case "$oldprefix" in
7205         "") eval "$1=\"\$$2\"";;
7206         *)
7207                 case "$3" in
7208                 "") eval "$1=";;
7209                 none)
7210                         eval "tp=\"\$$2\"";
7211                         case "$tp" in
7212                         ""|" ") eval "$1=\"\$$2\"";;
7213                         *) eval "$1=";;
7214                         esac;;
7215                 esac;;
7216         esac;;
7217 *)
7218         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7219         case "$tp" in
7220         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7221         /*-$oldprefix/*|\~*-$oldprefix/*)
7222                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7223         *) eval "$1=\"\$$2\"";;
7224         esac;;
7225 esac'
7226
7227 : determine installation style
7228 : For now, try to deduce it from prefix unless it is already set.
7229 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7230 case "$installstyle" in
7231 '')     case "$prefix" in
7232                 *perl*) dflt='lib';;
7233                 *) dflt='lib/perl5' ;;
7234         esac
7235         ;;
7236 *)      dflt="$installstyle" ;;
7237 esac
7238 : Probably not worth prompting for this since we prompt for all
7239 : the directories individually, and the prompt would be too long and
7240 : confusing anyway.
7241 installstyle=$dflt
7242
7243 : determine where public executables go
7244 echo " "
7245 set dflt bin bin
7246 eval $prefixit
7247 fn=d~
7248 rp='Pathname where the public executables will reside?'
7249 . ./getfile
7250 if $test "X$ansexp" != "X$binexp"; then
7251         installbin=''
7252 fi
7253 prefixvar=bin
7254 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7255 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7256 :     this via initialinstalllocation
7257 . ./setprefixvar
7258
7259 case "$userelocatableinc" in
7260 $define|true|[yY]*)     dflt='y' ;;
7261 *)                      dflt='n' ;;
7262 esac
7263 cat <<EOM
7264
7265 Would you like to build Perl so that the installation is relocatable, so that
7266 library paths in @INC are determined relative to the path of the perl binary?
7267 This is not advised for system Perl installs, or if you need to run setid
7268 scripts or scripts under taint mode.
7269
7270 If this doesn't make any sense to you, just accept the default '$dflt'.
7271 EOM
7272 rp='Use relocatable @INC?'
7273 . ./myread
7274 case "$ans" in
7275 y|Y)    val="$define" ;;
7276 *)      val="$undef"  ;;
7277 esac
7278 set userelocatableinc
7279 eval $setvar
7280
7281 initialinstalllocation="$binexp"
7282 : Default prefix is now "up one level from where the binaries are"
7283 case "$userelocatableinc" in
7284 $define|true|[yY]*)
7285     bin=".../"
7286     binexp=".../"
7287     prefix=".../.."
7288     prefixexp=".../.."
7289     installprefixexp=".../.."
7290     ;;
7291 esac
7292
7293 : determine where private library files go
7294 : Usual default is /usr/local/lib/perl5/$version.
7295 : Also allow things like /opt/perl/lib/$version, since
7296 : /opt/perl/lib/perl5... would be redundant.
7297 : The default "style" setting is made in installstyle.U
7298 case "$installstyle" in
7299 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7300 *)       set dflt privlib lib/$version ;;
7301 esac
7302 eval $prefixit
7303 $cat <<EOM
7304
7305 There are some auxiliary files for $package that need to be put into a
7306 private library directory that is accessible by everyone.
7307
7308 EOM
7309 fn=$binexp
7310 fn=d~+
7311 rp='Pathname where the private library files will reside?'
7312 . ./getfile
7313 prefixvar=privlib
7314 . ./setprefixvar
7315
7316 : set the prefixup variable, to restore leading tilda escape
7317 prefixup='case "$prefixexp" in
7318 "$prefix") ;;
7319 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7320 esac'
7321
7322 : determine where public architecture dependent libraries go
7323 set archlib archlib
7324 eval $prefixit
7325 : privlib default is /usr/local/lib/$package/$version
7326 : archlib default is /usr/local/lib/$package/$version/$archname
7327 : privlib may have an optional trailing /share.
7328 tdflt=`echo $privlib | $sed 's,/share$,,'`
7329 tdflt=$tdflt/$archname
7330 case "$archlib" in
7331 '')     dflt=$tdflt
7332         ;;
7333 *)      dflt="$archlib"
7334     ;;
7335 esac
7336 $cat <<EOM
7337
7338 $spackage contains architecture-dependent library files.  If you are
7339 sharing libraries in a heterogeneous environment, you might store
7340 these files in a separate location.  Otherwise, you can just include
7341 them with the rest of the public library files.
7342
7343 EOM
7344 fn=$binexp
7345 fn=d+~
7346 rp='Where do you want to put the public architecture-dependent libraries?'
7347 . ./getfile
7348 prefixvar=archlib
7349 . ./setprefixvar
7350 if $test X"$archlib" = X"$privlib"; then
7351         d_archlib="$undef"
7352 else
7353         d_archlib="$define"
7354 fi
7355
7356 : see if setuid scripts can be secure
7357 $cat <<EOM
7358
7359 Some kernels have a bug that prevents setuid #! scripts from being
7360 secure.  Some sites have disabled setuid #! scripts because of this.
7361
7362 First let's decide if your kernel supports secure setuid #! scripts.
7363 (If setuid #! scripts would be secure but have been disabled anyway,
7364 don't say that they are secure if asked.)
7365
7366 EOM
7367
7368 val="$undef"
7369 if $test -d /dev/fd; then
7370         echo "#!$ls" >reflect
7371         chmod +x,u+s reflect
7372         ./reflect >flect 2>&1
7373         if $contains "/dev/fd" flect >/dev/null; then
7374                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7375                 val="$define"
7376         else
7377                 $cat <<EOM
7378 If you are not sure if they are secure, I can check but I'll need a
7379 username and password different from the one you are using right now.
7380 If you don't have such a username or don't want me to test, simply
7381 enter 'none'.
7382
7383 EOM
7384                 rp='Other username to test security of setuid scripts with?'
7385                 dflt='none'
7386                 . ./myread
7387                 case "$ans" in
7388                 n|none)
7389                         case "$d_suidsafe" in
7390                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7391                                 dflt=n;;
7392                         "$undef")
7393                                 echo "Well, the $hint value is *not* secure." >&4
7394                                 dflt=n;;
7395                         *)      echo "Well, the $hint value *is* secure." >&4
7396                                 dflt=y;;
7397                         esac
7398                         ;;
7399                 *)
7400                         $rm -f reflect flect
7401                         echo "#!$ls" >reflect
7402                         chmod +x,u+s reflect
7403                         echo >flect
7404                         chmod a+w flect
7405                         echo '"su" will (probably) prompt you for '"$ans's password."
7406                         su $ans -c './reflect >flect'
7407                         if $contains "/dev/fd" flect >/dev/null; then
7408                                 echo "Okay, it looks like setuid scripts are secure." >&4
7409                                 dflt=y
7410                         else
7411                                 echo "I don't think setuid scripts are secure." >&4
7412                                 dflt=n
7413                         fi
7414                         ;;
7415                 esac
7416                 rp='Does your kernel have *secure* setuid scripts?'
7417                 . ./myread
7418                 case "$ans" in
7419                 [yY]*)  val="$define";;
7420                 *)      val="$undef";;
7421                 esac
7422         fi
7423 else
7424         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7425         echo "(That's for file descriptors, not floppy disks.)"
7426         val="$undef"
7427 fi
7428 set d_suidsafe
7429 eval $setvar
7430
7431 $rm -f reflect flect
7432
7433 : now see if they want to do setuid emulation
7434 if $test $patchlevel -lt 11; then
7435 echo " "
7436 val="$undef"
7437 case "$d_suidsafe" in
7438 "$define")
7439         val="$undef"
7440         echo "No need to emulate SUID scripts since they are secure here." >&4
7441         ;;
7442 *)
7443         $cat <<EOM
7444 Some systems have disabled setuid scripts, especially systems where
7445 setuid scripts cannot be secure.  On systems where setuid scripts have
7446 been disabled, the setuid/setgid bits on scripts are currently
7447 useless.  It is possible for $package to detect those bits and emulate
7448 setuid/setgid in a secure fashion.  This emulation will only work if
7449 setuid scripts have been disabled in your kernel.
7450
7451 EOM
7452         case "$d_dosuid" in
7453         "$define") dflt=y ;;
7454         *) dflt=n ;;
7455         esac
7456         rp="Do you want to do setuid/setgid emulation?"
7457         . ./myread
7458         case "$ans" in
7459         [yY]*)  val="$define";;
7460         *)      val="$undef";;
7461         esac
7462         ;;
7463 esac
7464 set d_dosuid
7465 eval $setvar
7466 else
7467     case "$d_dosuid" in
7468         "$define")
7469         cat >&4 <<EOH
7470
7471 SUID emulation has been removed for 5.12
7472 Please re-run Configure without -Dd_dosuid
7473
7474 EOH
7475         exit 1;
7476         ;;
7477     esac
7478     d_dosuid=undef
7479 fi
7480
7481 : Find perl5.005 or later.
7482 echo "Looking for a previously installed perl5.005 or later... "
7483 case "$perl5" in
7484 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7485                 : Check if this perl is recent and can load a simple module
7486                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7487                         perl5=$tdir/perl
7488                         break;
7489                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7490                         perl5=$tdir/perl5
7491                         break;
7492                 fi
7493         done
7494         ;;
7495 *)      perl5="$perl5"
7496         ;;
7497 esac
7498 case "$perl5" in
7499 '')     echo "None found.  That's ok.";;
7500 *)      echo "Using $perl5." ;;
7501 esac
7502
7503 : Set the siteprefix variables
7504 $cat <<EOM
7505
7506 After $package is installed, you may wish to install various
7507 add-on modules and utilities.  Typically, these add-ons will
7508 be installed under $prefix with the rest
7509 of this package.  However, you may wish to install such add-ons
7510 elsewhere under a different prefix.
7511
7512 If you do not wish to put everything under a single prefix, that's
7513 ok.  You will be prompted for the individual locations; this siteprefix
7514 is only used to suggest the defaults.
7515
7516 The default should be fine for most people.
7517
7518 EOM
7519 fn=d~+
7520 rp='Installation prefix to use for add-on modules and utilities?'
7521 : XXX Here might be another good place for an installstyle setting.
7522 case "$siteprefix" in
7523 '') dflt=$prefix ;;
7524 *)  dflt=$siteprefix ;;
7525 esac
7526 . ./getfile
7527 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7528 oldsiteprefix=''
7529 case "$siteprefix" in
7530 '') ;;
7531 *)      case "$ans" in
7532         "$prefix") ;;
7533         *) oldsiteprefix="$prefix";;
7534         esac
7535         ;;
7536 esac
7537 siteprefix="$ans"
7538 siteprefixexp="$ansexp"
7539
7540 : determine where site specific libraries go.
7541 : Usual default is /usr/local/lib/perl5/site_perl/$version
7542 : The default "style" setting is made in installstyle.U
7543 : XXX No longer works with Prefixit stuff.
7544 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7545 case "$sitelib" in
7546 '') case "$installstyle" in
7547         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7548         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7549         esac
7550         ;;
7551 *)      dflt="$sitelib"
7552         ;;
7553 esac
7554 $cat <<EOM
7555
7556 The installation process will create a directory for
7557 site-specific extensions and modules.  Most users find it convenient
7558 to place all site-specific files in this directory rather than in the
7559 main distribution directory.
7560
7561 EOM
7562 fn=d~+
7563 rp='Pathname for the site-specific library files?'
7564 . ./getfile
7565 prefixvar=sitelib
7566 . ./setprefixvar
7567 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7568
7569 : Determine list of previous versions to include in @INC
7570 $cat > getverlist <<EOPL
7571 #!$perl5 -w
7572 use File::Basename;
7573 \$api_versionstring = "$api_versionstring";
7574 \$version = "$version";
7575 \$stem = "$sitelib_stem";
7576 \$archname = "$archname";
7577 EOPL
7578         $cat >> getverlist <<'EOPL'
7579 # The list found is store twice for each entry: the original name, and
7580 # the binary broken down version as pack "sss", so sorting is easy and
7581 # unambiguous. This will work for all versions that have a maximum of
7582 # three digit groups, separate by '.'s or '_'s. Names are extended with
7583 # ".0.0" to ensure at least three elements for the pack.
7584 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7585
7586 # Can't have leading @ because metaconfig interprets it as a command!
7587 ;@inc_version_list=();
7588 # XXX Redo to do opendir/readdir?
7589 if (-d $stem) {
7590     chdir($stem);
7591     ;@candidates = map {
7592         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7593     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7594 }
7595 else {
7596     ;@candidates = ();
7597 }
7598
7599 ($pversion, $aversion, $vsn5005) = map {
7600     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7601 foreach $d (@candidates) {
7602     if ($d->[1] lt $pversion) {
7603         if ($d->[1] ge $aversion) {
7604             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7605         }
7606         elsif ($d->[1] ge $vsn5005) {
7607             unshift(@inc_version_list, grep { -d } $d->[0]);
7608         }
7609     }
7610     else {
7611         # Skip newer version.  I.e. don't look in
7612         # 5.7.0 if we're installing 5.6.1.
7613     }
7614 }
7615
7616 if (@inc_version_list) {
7617     print join(' ', @inc_version_list);
7618 }
7619 else {
7620     # Blank space to preserve value for next Configure run.
7621     print " ";
7622 }
7623 EOPL
7624 chmod +x getverlist
7625 case "$inc_version_list" in
7626 '')     if test -x "$perl5$exe_ext"; then
7627                 dflt=`$perl5 getverlist`
7628         else
7629                 dflt='none'
7630         fi
7631         ;;
7632 $undef) dflt='none' ;;
7633 *)  eval dflt=\"$inc_version_list\" ;;
7634 esac
7635 case "$dflt" in
7636 ''|' ') dflt=none ;;
7637 esac
7638 case "$dflt" in
7639 5.005) dflt=none ;;
7640 esac
7641 $cat <<EOM
7642
7643 In order to ease the process of upgrading, this version of perl
7644 can be configured to use modules built and installed with earlier
7645 versions of perl that were installed under $prefix.  Specify here
7646 the list of earlier versions that this version of perl should check.
7647 If Configure detected no earlier versions of perl installed under
7648 $prefix, then the list will be empty.  Answer 'none' to tell perl
7649 to not search earlier versions.
7650
7651 The default should almost always be sensible, so if you're not sure,
7652 just accept the default.
7653 EOM
7654
7655 rp='List of earlier versions to include in @INC?'
7656 . ./myread
7657 case "$ans" in
7658 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7659 *) inc_version_list="$ans" ;;
7660 esac
7661 case "$inc_version_list" in
7662 ''|' ')
7663         inc_version_list_init='0'
7664         d_inc_version_list="$undef"
7665         ;;
7666 *)      inc_version_list_init=`echo $inc_version_list |
7667                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7668         d_inc_version_list="$define"
7669         ;;
7670 esac
7671 $rm -f getverlist
7672
7673 : see if malloc/malloc.h has to be included
7674 set malloc/malloc.h i_mallocmalloc
7675 eval $inhdr
7676
7677 : see if this is a malloc.h system
7678 : we want a real compile instead of Inhdr because some systems have a
7679 : malloc.h that just gives a compile error saying to use stdlib.h instead
7680 echo " "
7681 $cat >try.c <<EOCP
7682 #include <stdlib.h>
7683 #include <malloc.h>
7684 #$i_mallocmalloc I_MALLOCMALLOC
7685 #ifdef I_MALLOCMALLOC
7686 # include <malloc/malloc.h>
7687 #endif
7688
7689 int main () { return 0; }
7690 EOCP
7691 set try
7692 if eval $compile; then
7693     echo "<malloc.h> found." >&4
7694     val="$define"
7695 else
7696     echo "<malloc.h> NOT found." >&4
7697     val="$undef"
7698 fi
7699 $rm_try
7700 set i_malloc
7701 eval $setvar
7702
7703 : check for length of pointer
7704 echo " "
7705 case "$ptrsize" in
7706 '')
7707         echo "Checking to see how big your pointers are..." >&4
7708         $cat >try.c <<EOCP
7709 #include <stdio.h>
7710 #$i_stdlib I_STDLIB
7711 #ifdef I_STDLIB
7712 #include <stdlib.h>
7713 #endif
7714 int main()
7715 {
7716     printf("%d\n", (int)sizeof(void *));
7717     exit(0);
7718 }
7719 EOCP
7720         set try
7721         if eval $compile_ok; then
7722                 ptrsize=`$run ./try`
7723                 echo "Your pointers are $ptrsize bytes long."
7724         else
7725                 dflt='4'
7726                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7727                 rp="What is the size of a pointer (in bytes)?"
7728                 . ./myread
7729                 ptrsize="$ans"
7730         fi
7731         ;;
7732 esac
7733 $rm_try
7734 case "$use64bitall" in
7735 "$define"|true|[yY]*)
7736         case "$ptrsize" in
7737         4)      cat <<EOM >&4
7738
7739 *** You have chosen a maximally 64-bit build,
7740 *** but your pointers are only 4 bytes wide.
7741 *** Please rerun Configure without -Duse64bitall.
7742 EOM
7743                 case "$d_quad" in
7744                 define)
7745                         cat <<EOM >&4
7746 *** Since you have quads, you could possibly try with -Duse64bitint.
7747 EOM
7748                         ;;
7749                 esac
7750                 cat <<EOM >&4
7751 *** Cannot continue, aborting.
7752
7753 EOM
7754
7755                 exit 1
7756                 ;;
7757         esac
7758         ;;
7759 esac
7760
7761
7762 : determine whether to use malloc wrapping
7763 echo " "
7764 case "$usemallocwrap" in
7765 [yY]*|true|$define)     dflt='y' ;;
7766 [nN]*|false|$undef)     dflt='n' ;;
7767 *)      case "$usedevel" in
7768         [yY]*|true|$define)     dflt='y' ;;
7769         *) dflt='n' ;;
7770         esac
7771         ;;
7772 esac
7773 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7774 . ./myread
7775 usemallocwrap="$ans"
7776 case "$ans" in
7777 y*|true)
7778         usemallocwrap="$define" ;;
7779 *)
7780         usemallocwrap="$undef" ;;
7781 esac
7782
7783 : determine which malloc to compile in
7784 echo " "
7785 case "$usemymalloc" in
7786 [yY]*|true|$define)     dflt='y' ;;
7787 [nN]*|false|$undef)     dflt='n' ;;
7788 *)      case "$ptrsize" in
7789         4) dflt='y' ;;
7790         *) dflt='n' ;;
7791         esac
7792         if test "$useithreads" = "$define"; then dflt='n'; fi
7793         ;;
7794 esac
7795 rp="Do you wish to attempt to use the malloc that comes with $package?"
7796 . ./myread
7797 usemymalloc="$ans"
7798 case "$ans" in
7799 y*|true)
7800         usemymalloc='y'
7801         mallocsrc='malloc.c'
7802         mallocobj="malloc$_o"
7803         d_mymalloc="$define"
7804         case "$libs" in
7805         *-lmalloc*)
7806                 : Remove malloc from list of libraries to use
7807                 echo "Removing unneeded -lmalloc from library list" >&4
7808                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7809                 shift
7810                 libs="$*"
7811                 echo "libs = $libs" >&4
7812                 ;;
7813         esac
7814         ;;
7815 *)
7816         usemymalloc='n'
7817         mallocsrc=''
7818         mallocobj=''
7819         d_mymalloc="$undef"
7820         ;;
7821 esac
7822
7823 : compute the return types of malloc and free
7824 echo " "
7825 $cat >malloc.c <<END
7826 #$i_malloc I_MALLOC
7827 #$i_stdlib I_STDLIB
7828 #include <stdio.h>
7829 #include <sys/types.h>
7830 #ifdef I_MALLOC
7831 #include <malloc.h>
7832 #endif
7833 #ifdef I_STDLIB
7834 #include <stdlib.h>
7835 #endif
7836 #ifdef TRY_MALLOC
7837 void *malloc();
7838 #endif
7839 #ifdef TRY_FREE
7840 void free();
7841 #endif
7842 END
7843 case "$malloctype" in
7844 '')
7845         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7846                 malloctype='void *'
7847         else
7848                 malloctype='char *'
7849         fi
7850         ;;
7851 esac
7852 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7853
7854 case "$freetype" in
7855 '')
7856         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7857                 freetype='void'
7858         else
7859                 freetype='int'
7860         fi
7861         ;;
7862 esac
7863 echo "Your system uses $freetype free(), it would seem." >&4
7864 $rm -f malloc.[co]
7865 : determine where site specific architecture-dependent libraries go.
7866 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7867 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7868 : sitelib may have an optional trailing /share.
7869 case "$sitearch" in
7870 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7871         dflt="$dflt/$archname"
7872         ;;
7873 *)      dflt="$sitearch"
7874         ;;
7875 esac
7876 set sitearch sitearch none
7877 eval $prefixit
7878 $cat <<EOM
7879
7880 The installation process will also create a directory for
7881 architecture-dependent site-specific extensions and modules.
7882
7883 EOM
7884 fn=d~+
7885 rp='Pathname for the site-specific architecture-dependent library files?'
7886 . ./getfile
7887 prefixvar=sitearch
7888 . ./setprefixvar
7889 if $test X"$sitearch" = X"$sitelib"; then
7890         d_sitearch="$undef"
7891 else
7892         d_sitearch="$define"
7893 fi
7894
7895 : Set the vendorprefix variables
7896 $cat <<EOM
7897
7898 The installation process will also create a directory for
7899 vendor-supplied add-ons.  Vendors who supply perl with their system
7900 may find it convenient to place all vendor-supplied files in this
7901 directory rather than in the main distribution directory.  This will
7902 ease upgrades between binary-compatible maintenance versions of perl.
7903
7904 Of course you may also use these directories in whatever way you see
7905 fit.  For example, you might use them to access modules shared over a
7906 company-wide network.
7907
7908 The default answer should be fine for most people.
7909 This causes further questions about vendor add-ons to be skipped
7910 and no vendor-specific directories will be configured for perl.
7911
7912 EOM
7913 rp='Do you want to configure vendor-specific add-on directories?'
7914 case "$usevendorprefix" in
7915 define|true|[yY]*) dflt=y ;;
7916 *)      : User may have set vendorprefix directly on Configure command line.
7917         case "$vendorprefix" in
7918         ''|' ') dflt=n ;;
7919         *)      dflt=y ;;
7920         esac
7921         ;;
7922 esac
7923 . ./myread
7924 case "$ans" in
7925 [yY]*)  fn=d~+
7926         rp='Installation prefix to use for vendor-supplied add-ons?'
7927         case "$vendorprefix" in
7928         '') dflt="$prefix" ;;
7929         *)  dflt=$vendorprefix ;;
7930         esac
7931         . ./getfile
7932         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7933         oldvendorprefix=''
7934         case "$vendorprefix" in
7935         '') ;;
7936         *)      case "$ans" in
7937                 "$prefix") ;;
7938                 *) oldvendorprefix="$prefix";;
7939                 esac
7940                 ;;
7941         esac
7942         usevendorprefix="$define"
7943         vendorprefix="$ans"
7944         vendorprefixexp="$ansexp"
7945         ;;
7946 *)      usevendorprefix="$undef"
7947         vendorprefix=''
7948         vendorprefixexp=''
7949         ;;
7950 esac
7951
7952 : Set the vendorlib variables
7953 case "$vendorprefix" in
7954 '')     d_vendorlib="$undef"
7955         vendorlib=''
7956         vendorlibexp=''
7957         ;;
7958 *)      d_vendorlib="$define"
7959         : determine where vendor-supplied modules go.
7960         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7961         case "$vendorlib" in
7962         '')
7963                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7964                 case "$installstyle" in
7965                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7966                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7967                 esac
7968                 ;;
7969         *)      dflt="$vendorlib"
7970                 ;;
7971         esac
7972         fn=d~+
7973         rp='Pathname for the vendor-supplied library files?'
7974         . ./getfile
7975         vendorlib="$ans"
7976         vendorlibexp="$ansexp"
7977         ;;
7978 esac
7979 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7980 prefixvar=vendorlib
7981 . ./installprefix
7982
7983 : Set the vendorarch variables
7984 case "$vendorprefix" in
7985 '')     d_vendorarch="$undef"
7986         vendorarch=''
7987         vendorarchexp=''
7988         ;;
7989 *)      d_vendorarch="$define"
7990         : determine where vendor-supplied architecture-dependent libraries go.
7991         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7992         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7993         : vendorlib may have an optional trailing /share.
7994         case "$vendorarch" in
7995         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7996                 dflt="$dflt/$archname"
7997                 ;;
7998         *)      dflt="$vendorarch" ;;
7999         esac
8000         fn=d~+
8001         rp='Pathname for vendor-supplied architecture-dependent files?'
8002         . ./getfile
8003         vendorarch="$ans"
8004         vendorarchexp="$ansexp"
8005         ;;
8006 esac
8007 prefixvar=vendorarch
8008 . ./installprefix
8009 if $test X"$vendorarch" = X"$vendorlib"; then
8010         d_vendorarch="$undef"
8011 else
8012         d_vendorarch="$define"
8013 fi
8014
8015 : Final catch-all directories to search
8016 $cat <<EOM
8017
8018 Lastly, you can have perl look in other directories for extensions and
8019 modules in addition to those already specified.
8020 These directories will be searched after
8021         $sitearch
8022         $sitelib
8023 EOM
8024 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8025 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8026 echo ' '
8027 case "$otherlibdirs" in
8028 ''|' ') dflt='none' ;;
8029 *)      dflt="$otherlibdirs" ;;
8030 esac
8031 $cat <<EOM
8032 Enter a colon-separated set of extra paths to include in perl's @INC
8033 search path, or enter 'none' for no extra paths.
8034
8035 EOM
8036
8037 rp='Colon-separated list of additional directories for perl to search?'
8038 . ./myread
8039 case "$ans" in
8040 ' '|''|none)    otherlibdirs=' ' ;;
8041 *)      otherlibdirs="$ans" ;;
8042 esac
8043 case "$otherlibdirs" in
8044 ' ') val=$undef ;;
8045 *)      val=$define ;;
8046 esac
8047 set d_perl_otherlibdirs
8048 eval $setvar
8049
8050 : Cruising for prototypes
8051 echo " "
8052 echo "Checking out function prototypes..." >&4
8053 $cat >prototype.c <<EOCP
8054 #$i_stdlib I_STDLIB
8055 #ifdef I_STDLIB
8056 #include <stdlib.h>
8057 #endif
8058 int main(int argc, char *argv[]) {
8059         exit(0);}
8060 EOCP
8061 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8062         echo "Your C compiler appears to support function prototypes."
8063         val="$define"
8064 else
8065         echo "Your C compiler doesn't seem to understand function prototypes."
8066         val="$undef"
8067 fi
8068 set prototype
8069 eval $setvar
8070 $rm -f prototype*
8071
8072 : Check if ansi2knr is required
8073 case "$prototype" in
8074 "$define") ;;
8075 *)      ansi2knr='ansi2knr'
8076         echo " "
8077         cat <<EOM >&4
8078
8079 $me:  FATAL ERROR:
8080 This version of $package can only be compiled by a compiler that
8081 understands function prototypes.  Unfortunately, your C compiler
8082         $cc $ccflags
8083 doesn't seem to understand them.  Sorry about that.
8084
8085 If GNU cc is available for your system, perhaps you could try that instead.
8086
8087 Eventually, we hope to support building Perl with pre-ANSI compilers.
8088 If you would like to help in that effort, please contact <perlbug@perl.org>.
8089
8090 Aborting Configure now.
8091 EOM
8092         exit 2
8093         ;;
8094 esac
8095
8096 : DTrace support
8097 dflt_dtrace='/usr/sbin/dtrace'
8098 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8099
8100 cat <<EOM
8101
8102 Perl can be built to support DTrace on platforms that support it.
8103 DTrace is a diagnosis and performance analysis tool from Sun.
8104
8105 If this doesn't make any sense to you, just accept the default.
8106 EOM
8107
8108 while $test 1 ; do
8109         case "$usedtrace" in
8110         $define|true|[yY]*)
8111                 dflt='y'
8112                 ;;
8113         ?*)
8114                 dflt='y'
8115                 dflt_dtrace=$usedtrace
8116                 ;;
8117         *)
8118                 dflt='n'
8119                 ;;
8120         esac
8121
8122         rp='Support DTrace if available?'
8123         . ./myread
8124         case "$ans" in
8125         y|Y)    val="$define" ;;
8126         *)      val="$undef" ;;
8127         esac
8128         set usedtrace
8129         eval $setvar
8130
8131         test "X$usedtrace" != "X$define" && break
8132
8133         echo " "
8134         rp='Where is the dtrace executable?'
8135         dflt=$dflt_dtrace
8136         . ./getfile
8137         val="$ans"
8138         set dtrace
8139         eval $setvar
8140
8141         if $test -f $dtrace
8142         then
8143                 if $dtrace -h -s ../perldtrace.d \
8144                         -o perldtrace.tmp >/dev/null 2>&1 \
8145                         && rm -f perldtrace.tmp
8146                 then
8147                         echo " "
8148                         echo "Good: your $dtrace knows about the -h flag."
8149                 else
8150                         cat >&2 <<EOM
8151
8152 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8153 ***
8154 *** Your installed dtrace doesn't support the -h switch to compile a D
8155 *** program into a C header. Can't continue.
8156
8157 EOM
8158                         exit 1
8159                 fi
8160                 break;
8161         fi
8162
8163         case "$fastread" in
8164         yes)
8165                 cat >&2 <<EOM
8166
8167 *** $me:  Fatal Error:  $dtrace not found.
8168 *** Can't continue.
8169
8170 EOM
8171                 exit 1
8172                 ;;
8173         *)
8174                 echo "*** $dtrace was not found."
8175                 echo " "
8176                 ;;
8177         esac
8178 done
8179
8180 : See if we want extra modules installed
8181 echo " "
8182 case "$extras" in
8183 '') dflt='n';;
8184 *) dflt='y';;
8185 esac
8186 cat <<EOM
8187 Perl can be built with extra modules or bundles of modules which
8188 will be fetched from the CPAN and installed alongside Perl.
8189
8190 Notice that you will need access to the CPAN; either via the Internet,
8191 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8192 be asked later to configure the CPAN.pm module which will in turn do
8193 the installation of the rest of the extra modules or bundles.)
8194
8195 Notice also that if the modules require any external software such as
8196 libraries and headers (the libz library and the zlib.h header for the
8197 Compress::Zlib module, for example) you MUST have any such software
8198 already installed, this configuration process will NOT install such
8199 things for you.
8200
8201 If this doesn't make any sense to you, just accept the default '$dflt'.
8202 EOM
8203 rp='Install any extra modules (y or n)?'
8204 . ./myread
8205 case "$ans" in
8206 y|Y)
8207         cat <<EOM
8208
8209 Please list any extra modules or bundles to be installed from CPAN,
8210 with spaces between the names.  The names can be in any format the
8211 'install' command of CPAN.pm will understand.  (Answer 'none',
8212 without the quotes, to install no extra modules or bundles.)
8213 EOM
8214         rp='Extras?'
8215         dflt="$extras"
8216         . ./myread
8217         extras="$ans"
8218 esac
8219 case "$extras" in
8220 ''|'none')
8221         val=''
8222         $rm -f ../extras.lst
8223         ;;
8224 *)      echo "(Saving the list of extras for later...)"
8225         echo "$extras" > ../extras.lst
8226         val="'$extras'"
8227         ;;
8228 esac
8229 set extras
8230 eval $setvar
8231 echo " "
8232
8233 : determine where html pages for programs go
8234 set html1dir html1dir none
8235 eval $prefixit
8236 $cat <<EOM
8237
8238 If you wish to install html files for programs in $spackage, indicate
8239 the appropriate directory here.  To skip installing html files,
8240 answer "none".
8241 EOM
8242 case "$html1dir" in
8243 ''|none|$undef|' ') dflt=none ;;
8244 *) dflt=$html1dir ;;
8245 esac
8246 fn=dn+~
8247 rp="Directory for the main $spackage html pages?"
8248 . ./getfile
8249 prefixvar=html1dir
8250 . ./setprefixvar
8251 : Use ' ' for none so value is preserved next time through Configure
8252 $test X"$html1dir" = "X" && html1dir=' '
8253
8254 : determine where html pages for libraries and modules go
8255 set html3dir html3dir none
8256 eval $prefixit
8257 $cat <<EOM
8258
8259 If you wish to install html files for modules associated with $spackage,
8260 indicate the appropriate directory here.  To skip installing html files,
8261 answer "none".
8262 EOM
8263 : There is no obvious default.  If they have specified html1dir, then
8264 : try to key off that, possibly changing .../html1 into .../html3.
8265 case "$html3dir" in
8266 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8267 *) dflt=$html3dir ;;
8268 esac
8269 fn=dn+~
8270 rp="Directory for the $spackage module html pages?"
8271 . ./getfile
8272 prefixvar=html3dir
8273 . ./setprefixvar
8274 : Use ' ' for none so value is preserved next time through Configure
8275 $test X"$html3dir" = "X" && html3dir=' '
8276
8277 : determine whether to install perl also as /usr/bin/perl
8278
8279 echo " "
8280 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8281         $cat <<EOM
8282 Many scripts expect perl to be installed as /usr/bin/perl.
8283
8284 If you want to, I can install the perl you are about to compile
8285 as /usr/bin/perl (in addition to $bin/perl).
8286 EOM
8287         if test -f /usr/bin/perl; then
8288             $cat <<EOM
8289
8290 However, please note that because you already have a /usr/bin/perl,
8291 overwriting that with a new Perl would very probably cause problems.
8292 Therefore I'm assuming you don't want to do that (unless you insist).
8293
8294 EOM
8295             case "$installusrbinperl" in
8296             "$define"|[yY]*)    dflt='y';;
8297             *)                  dflt='n';;
8298             esac
8299         else
8300             $cat <<EOM
8301
8302 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8303
8304 EOM
8305             case "$installusrbinperl" in
8306             "$undef"|[nN]*)     dflt='n';;
8307             *)                  dflt='y';;
8308             esac
8309         fi
8310         rp="Do you want to install perl as /usr/bin/perl?"
8311         . ./myread
8312         case "$ans" in
8313         [yY]*)  val="$define";;
8314         *)      val="$undef" ;;
8315         esac
8316 else
8317         val="$undef"
8318 fi
8319 set installusrbinperl
8320 eval $setvar
8321
8322 : see if dlopen exists
8323 xxx_runnm="$runnm"
8324 xxx_ccflags="$ccflags"
8325 runnm=false
8326 : with g++ one needs -shared to get is-in-libc to work for dlopen
8327 case "$gccversion" in
8328 '')     ;;
8329 *Clang*)        ;;
8330 *)      case "$d_cplusplus" in
8331         "$define") ccflags="$ccflags -shared" ;;
8332         esac
8333         ;;
8334 esac
8335 set dlopen d_dlopen
8336 eval $inlibc
8337 runnm="$xxx_runnm"
8338 ccflags="$xxx_ccflags"
8339
8340 : see if this is a unistd.h system
8341 set unistd.h i_unistd
8342 eval $inhdr
8343
8344 : determine which dynamic loading, if any, to compile in
8345 echo " "
8346 dldir="ext/DynaLoader"
8347 case "$usedl" in
8348     $define|y|true)
8349         dflt='y'
8350         usedl="$define"
8351         ;;
8352     $undef|n|false)
8353         dflt='n'
8354         usedl="$undef"
8355         ;;
8356     *)
8357         dflt='n'
8358         case "$d_dlopen" in
8359             $define) dflt='y' ;;
8360         esac
8361         : Does a dl_xxx.xs file exist for this operating system
8362         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8363         ;;
8364 esac
8365 rp="Do you wish to use dynamic loading?"
8366 . ./myread
8367 usedl="$ans"
8368 bin_ELF="$undef"
8369 case "$ans" in
8370     y*) usedl="$define"
8371         case "$dlsrc" in
8372             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8373                     dflt="$dldir/dl_${osname}.xs"
8374                 elif $test "$d_dlopen" = "$define" ; then
8375                     dflt="$dldir/dl_dlopen.xs"
8376                 else
8377                     dflt=''
8378                 fi
8379                 ;;
8380             *)  dflt="$dldir/$dlsrc"
8381                 ;;
8382         esac
8383         echo "The following dynamic loading files are available:"
8384         : Can not go over to $dldir because getfile has path hard-coded in.
8385         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8386         rp="Source file to use for dynamic loading"
8387         fn="fne"
8388         gfpth="$src"
8389         . ./getfile
8390         usedl="$define"
8391         : emulate basename
8392         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8393
8394         $cat << EOM
8395
8396 Some systems may require passing special flags to $cc -c to
8397 compile modules that will be used to create a shared library.
8398 To use no flags, say "none".
8399
8400 EOM
8401         case "$cccdlflags" in
8402             '') case "$gccversion" in
8403                 '') case "$osname" in
8404                         hpux)   dflt='+z' ;;
8405                         irix*)  dflt='-KPIC' ;;
8406                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8407                         sunos)  dflt='-pic' ;;
8408                         *)      dflt='none' ;;
8409                     esac
8410                     ;;
8411                 *)  case "$osname" in
8412                         darwin) dflt='none' ;;
8413                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8414                         *)      dflt='-fpic' ;;
8415                     esac ;;
8416                 esac ;;
8417             ' ') dflt='none' ;;
8418             *)   dflt="$cccdlflags" ;;
8419         esac
8420
8421         case "$dflt" in
8422             none) dflt='' ;;
8423         esac
8424
8425         # If -Dsysroot was specified, now's the time to add it
8426         # to cccdlflags
8427         if test "X$sysroot" != X; then
8428             case "$gccversion" in
8429                 '') ;;
8430                 *)  case "$dflt" in
8431                         *sysroot*) ;;
8432                         'undef'|*)
8433                             dflt="$dflt --sysroot=$sysroot" ;;
8434                     esac
8435                     ;;
8436             esac
8437         fi
8438
8439         case "$dflt" in
8440             '') dflt='none';;
8441         esac
8442
8443         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8444         . ./myread
8445         case "$ans" in
8446             none) cccdlflags=' ' ;;
8447             *)    cccdlflags="$ans" ;;
8448         esac
8449
8450         cat << EOM
8451
8452 Some systems use ld to create libraries that can be dynamically loaded,
8453 while other systems (such as those using ELF) use $cc.
8454
8455 EOM
8456
8457 : Determine if this is ELF
8458         $cat >try.c <<EOM
8459 /* Test for whether ELF binaries are produced */
8460 #include <fcntl.h>
8461 #$i_stdlib I_STDLIB
8462 #ifdef I_STDLIB
8463 #include <stdlib.h>
8464 #endif
8465 #$i_unistd I_UNISTD
8466 #ifdef I_UNISTD
8467 #include <unistd.h>
8468 #endif
8469 int main() {
8470     char b[4];
8471     int i = open("a.out",O_RDONLY);
8472     if(i == -1)
8473         exit(1); /* fail */
8474     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8475         exit(0); /* succeed (yes, it is ELF) */
8476     exit(1); /* fail */
8477 }
8478 EOM
8479         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8480             bin_ELF="$define"
8481         fi
8482         $rm_try
8483
8484         case "$ld" in
8485             '') if $test $bin_ELF = "$define"; then
8486                     cat <<EOM
8487 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8488 EOM
8489                     dflt="$cc"
8490                 else
8491                     echo "I'll use ld to build dynamic libraries."
8492                     dflt='ld'
8493                 fi
8494                 ;;
8495             *)  dflt="$ld"
8496                 ;;
8497         esac
8498
8499         rp="What command should be used to create dynamic libraries?"
8500         . ./myread
8501         ld="$ans"
8502
8503         cat << EOM
8504
8505 Some systems may require passing special flags to $ld to create a
8506 library that can be dynamically loaded.  If your ld flags include
8507 -L/other/path options to locate libraries outside your loader's normal
8508 search path, you may need to specify those -L options here as well.  To
8509 use no flags, say "none".
8510
8511 EOM
8512         case "$lddlflags" in
8513             '') case "$osname" in
8514                     haiku) dflt='-shared' ;;
8515                     hpux) dflt='-b';
8516                           case "$gccversion" in
8517                               '') dflt="$dflt +vnocompatwarnings" ;;
8518                           esac
8519                           ;;
8520                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8521                     solaris) # See [perl #66604].
8522                             # On Solaris 11, gcc -m64 on amd64
8523                             # appears not to understand -G.  gcc versions at
8524                             # least as old as 3.4.3 support -shared, so just
8525                             # use that with Solaris 11 and later, but keep
8526                             # the old behavior for older Solaris versions.
8527                             case "$gccversion" in
8528                                 '') dflt='-G' ;;
8529                                 *)  case "$osvers" in
8530                                         2.?|2.10) dflt='-G' ;;
8531                                         *) dflt='-shared' ;;
8532                                     esac
8533                                     ;;
8534                             esac
8535                             ;;
8536                     sunos) dflt='-assert nodefinitions' ;;
8537                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8538                     *)     dflt='none' ;;
8539                 esac
8540                 ;;
8541             *) dflt="$lddlflags" ;;
8542         esac
8543
8544         : Only do this for gcc, since, for example, qcc has no concept
8545         : of --sysroot.
8546         if $test "X$sysroot" != X; then
8547             case "$gccversion" in
8548                 '') ;;
8549                 *)  dflt="$dflt --sysroot $sysroot" ;;
8550             esac
8551         fi
8552
8553         : Try to guess additional flags to pick up local libraries.
8554         : Be careful not to append to a plain 'none'
8555         case "$dflt" in
8556             none) dflt='' ;;
8557         esac
8558         for thisflag in $ldflags; do
8559             case "$thisflag" in
8560                 -L*|-R*|-Wl,-R*)
8561                     case " $dflt " in
8562                         *" $thisflag "*) ;;
8563                         *) dflt="$dflt $thisflag" ;;
8564                     esac
8565                     ;;
8566             esac
8567         done
8568
8569         case "$dflt" in
8570             ''|' ') dflt='none' ;;
8571         esac
8572
8573         case "$ldflags" in
8574             *-fstack-protector-strong*)
8575                 case "$dflt" in
8576                     *-fstack-protector-strong*) ;; # Don't add it again
8577                     *) dflt="$dflt -fstack-protector-strong" ;;
8578                 esac
8579                 ;;
8580             *-fstack-protector*)
8581                 case "$dflt" in
8582                     *-fstack-protector*) ;; # Don't add it again
8583                     *) dflt="$dflt -fstack-protector" ;;
8584                 esac
8585                 ;;
8586         esac
8587
8588         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8589         . ./myread
8590         case "$ans" in
8591             none) lddlflags=' ' ;;
8592             *) lddlflags="$ans" ;;
8593         esac
8594
8595         cat <<EOM
8596
8597 Some systems may require passing special flags to $cc to indicate that
8598 the resulting executable will use dynamic linking.  To use no flags,
8599 say "none".
8600
8601 EOM
8602         case "$ccdlflags" in
8603             '') case "$osname" in
8604                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8605                     sunos)             dflt='none'   ;;
8606                     *)                 dflt='none'   ;;
8607                 esac ;;
8608             ' ') dflt='none' ;;
8609             *)   dflt="$ccdlflags" ;;
8610         esac
8611         rp="Any special flags to pass to $cc to use dynamic linking?"
8612         . ./myread
8613         case "$ans" in
8614             none) ccdlflags=' ' ;;
8615             *)    ccdlflags="$ans" ;;
8616         esac
8617         ;;
8618
8619     *)  usedl="$undef"
8620         ld='ld'
8621         dlsrc='dl_none.xs'
8622         lddlflags=''
8623         ccdlflags=''
8624         ;;
8625 esac
8626
8627 ld_can_script="$undef"
8628 case "$bin_ELF$usedl" in
8629     $define$define)
8630         # Abuse try.h and a.out names for neat cleanup
8631         $cat >try.c <<EOM
8632 void foo() {}
8633 void bar() {}
8634 EOM
8635         $cat >try.h <<EOM
8636 LIBTEST_42 {
8637  global:
8638   foo;
8639  local: *;
8640  };
8641 EOM
8642         if $cc $cccdlflags $ccdlflags $ccflags \
8643                $ldflags $lddlflags -o a.out try.c \
8644                -Wl,--version-script=try.h >/dev/null 2>&1 \
8645            &&  $test -s a.out ; then
8646             echo "ld supports scripting" >&4
8647             ld_can_script="$define"
8648         else
8649             echo "ld does not support scripting" >&4
8650         fi
8651         $rm_try
8652         ;;
8653 esac
8654
8655 : Do we want a shared libperl?
8656 also=''
8657 case "$usedl" in
8658 $undef)
8659         # No dynamic loading being used, so don't bother even to prompt.
8660         useshrplib='false'
8661         ;;
8662 *)      case "$useshrplib" in
8663         '')     case "$osname" in
8664                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8665                         dflt=y
8666                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8667                         ;;
8668                 *)      dflt=n
8669                         ;;
8670                 esac
8671                 ;;
8672         $define|true|[Yy]*)
8673                 dflt=y
8674                 ;;
8675         *)      dflt=n
8676                 ;;
8677         esac
8678         $cat << EOM
8679
8680 The perl executable is normally obtained by linking perlmain.c with
8681 libperl${_a}, any static extensions (usually just DynaLoader), and
8682 any other libraries needed on this system (such as -lm, etc.).  Since
8683 your system supports dynamic loading, it is probably possible to build
8684 a shared libperl.$so.  If you will have more than one executable linked
8685 to libperl.$so, this will significantly reduce the size of each
8686 executable, but it may have a noticeable effect on performance.  The
8687 default is probably sensible for your system.
8688 $also
8689
8690 EOM
8691         rp="Build a shared libperl.$so (y/n)"
8692         . ./myread
8693         case "$ans" in
8694         true|$define|[Yy]*)
8695                 useshrplib='true'  ;;
8696         *)      useshrplib='false' ;;
8697         esac
8698         ;;
8699 esac
8700
8701 case "$useshrplib" in
8702 true)
8703         case "$userelocatableinc" in
8704         true|define)
8705                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8706                 echo "See INSTALL for an explanation why that won't work." >&4
8707                 exit 4
8708                 ;;
8709         esac
8710         case "$libperl" in
8711         '')
8712                 # Figure out a good name for libperl.so.  Since it gets stored in
8713                 # a version-specific architecture-dependent library, the version
8714                 # number isn't really that important, except for making cc/ld happy.
8715                 #
8716                 # A name such as libperl.so.10.1
8717                 majmin="libperl.$so.$patchlevel.$subversion"
8718                 # A name such as libperl.so.100
8719                 majonly=`echo $patchlevel $subversion |
8720                         $awk '{printf "%d%02d", $1, $2}'`
8721                 majonly=libperl.$so.$majonly
8722                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8723                 # rely on figuring it out from the naming of libc.
8724                 case "${osname}${osvers}" in
8725                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8726                         dflt=libperl.$so
8727                         ;;
8728                 cygwin*) # ld links now against the dll directly
8729                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8730                         majonly=`echo $patchlevel $subversion |
8731                                 $awk '{printf "%03d%03d", $1, $2}'`
8732                         majonly=cygperl5.$majonly.$so
8733                         dflt=$majmin
8734                         ;;
8735                 *)      # Try to guess based on whether libc has major.minor.
8736                         case "$libc" in
8737                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8738                         *libc.$so.[0-9]*) dflt=$majonly ;;
8739                         *)      dflt=libperl.$so ;;
8740                         esac
8741                         ;;
8742                 esac
8743                 ;;
8744         *)      dflt=$libperl
8745                 ;;
8746         esac
8747         cat << EOM
8748
8749 I need to select a good name for the shared libperl.  If your system uses
8750 library names with major and minor numbers, then you might want something
8751 like $majmin.  Alternatively, if your system uses a single version
8752 number for shared libraries, then you might want to use $majonly.
8753 Or, your system might be quite happy with a simple libperl.$so.
8754
8755 Since the shared libperl will get installed into a version-specific
8756 architecture-dependent directory, the version number of the shared perl
8757 library probably isn't important, so the default should be o.k.
8758
8759 EOM
8760         rp='What name do you want to give to the shared libperl?'
8761         . ./myread
8762         libperl=$ans
8763         echo "Ok, I'll use $libperl"
8764         ;;
8765 *)
8766         libperl="libperl${_a}"
8767         ;;
8768 esac
8769
8770 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8771 case "$shrpdir" in
8772 '') ;;
8773 *)      $cat >&4 <<EOM
8774 WARNING:  Use of the shrpdir variable for the installation location of
8775 the shared $libperl is not supported.  It was never documented and
8776 will not work in this version.  Let me (perlbug@perl.org)
8777 know of any problems this may cause.
8778
8779 EOM
8780         case "$shrpdir" in
8781         "$archlibexp/CORE")
8782                 $cat >&4 <<EOM
8783 But your current setting of $shrpdir is
8784 the default anyway, so it's harmless.
8785 EOM
8786                 ;;
8787         *)
8788                 $cat >&4 <<EOM
8789 Further, your current attempted setting of $shrpdir
8790 conflicts with the value of $archlibexp/CORE
8791 that installperl will use.
8792 EOM
8793                 ;;
8794         esac
8795         ;;
8796 esac
8797
8798 # How will the perl executable find the installed shared $libperl?
8799 # Add $xxx to ccdlflags.
8800 # If we can't figure out a command-line option, use $shrpenv to
8801 # set env LD_RUN_PATH.  The main perl makefile uses this.
8802 shrpdir=$archlibexp/CORE
8803 xxx=''
8804 tmp_shrpenv=''
8805 if "$useshrplib"; then
8806     case "$osname" in
8807         aix)
8808                 # We'll set it in Makefile.SH...
8809                 ;;
8810         solaris)
8811                 xxx="-R $shrpdir"
8812                 ;;
8813         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8814                 xxx="-Wl,-R$shrpdir"
8815                 ;;
8816         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8817                 xxx="-Wl,-rpath,$shrpdir"
8818                 ;;
8819         hpux*)
8820                 # hpux doesn't like the default, either.
8821                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8822                 ;;
8823         cygwin)
8824                 # cygwin needs only ldlibpth
8825                 ;;
8826         *)
8827                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8828                 ;;
8829         esac
8830         case "$xxx" in
8831         '') ;;
8832         *)
8833                 # Only add $xxx if it isn't already in ccdlflags.
8834                 case " $ccdlflags " in
8835                 *" $xxx "*)     ;;
8836                 *)      ccdlflags="$ccdlflags $xxx"
8837                         cat <<EOM >&4
8838
8839 Adding $xxx to the flags
8840 passed to $ld so that the perl executable will find the
8841 installed shared $libperl.
8842
8843 EOM
8844                         ;;
8845                 esac
8846                 ;;
8847         esac
8848 fi
8849 # Fix ccdlflags in AIX for building external extensions.
8850 # (For building Perl itself bare -bE:perl.exp is needed,
8851 #  Makefile.SH takes care of this.)
8852 case "$osname" in
8853 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8854 esac
8855 # Respect a hint or command-line value.
8856 case "$shrpenv" in
8857 '') shrpenv="$tmp_shrpenv" ;;
8858 esac
8859 case "$ldlibpthname" in
8860 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8861 none)   ldlibpthname='' ;;
8862 esac
8863
8864 : determine where manual pages are on this system
8865 echo " "
8866 case "$sysman" in
8867 '')
8868         syspath='/usr/share/man/man1 /usr/man/man1'
8869         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8870         syspath="$syspath /usr/man/u_man/man1"
8871         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8872         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8873         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8874         sysman=`./loc . /usr/man/man1 $syspath`
8875         ;;
8876 esac
8877 if $test -d "$sysman"; then
8878         echo "System manual is in $sysman." >&4
8879 else
8880         echo "Could not find manual pages in source form." >&4
8881 fi
8882
8883 : determine where manual pages go
8884 set man1dir man1dir none
8885 eval $prefixit
8886 $cat <<EOM
8887
8888 $spackage has manual pages available in source form.
8889 EOM
8890 case "$nroff" in
8891 nroff)
8892         echo "However, you don't have nroff, so they're probably useless to you."
8893         case "$man1dir" in
8894         '') man1dir="none";;
8895         esac;;
8896 esac
8897 echo "If you don't want the manual sources installed, answer 'none'."
8898 case "$man1dir" in
8899 ' ') dflt=none
8900         ;;
8901 '')
8902         lookpath="$prefixexp/share/man/man1"
8903         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8904         lookpath="$lookpath $prefixexp/man/p_man/man1"
8905         lookpath="$lookpath $prefixexp/man/u_man/man1"
8906         lookpath="$lookpath $prefixexp/man/man.1"
8907         case "$sysman" in
8908         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8909         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8910         esac
8911         set dflt
8912         eval $prefixup
8913         ;;
8914 *)  dflt="$man1dir"
8915         ;;
8916 esac
8917 echo " "
8918 fn=dn+~
8919 rp="Where do the main $spackage manual pages (source) go?"
8920 . ./getfile
8921 if $test "X$man1direxp" != "X$ansexp"; then
8922         installman1dir=''
8923 fi
8924 prefixvar=man1dir
8925 . ./setprefixvar
8926
8927 case "$man1dir" in
8928 '')     man1dir=' '
8929         installman1dir='';;
8930 esac
8931
8932 : What suffix to use on installed man pages
8933
8934 case "$man1dir" in
8935 ' ')
8936         man1ext='0'
8937         ;;
8938 *)
8939         rp="What suffix should be used for the main $spackage man pages?"
8940         case "$man1ext" in
8941         '')     case "$man1dir" in
8942                 *1)  dflt=1 ;;
8943                 *1p) dflt=1p ;;
8944                 *1pm) dflt=1pm ;;
8945                 *l) dflt=l;;
8946                 *n) dflt=n;;
8947                 *o) dflt=o;;
8948                 *p) dflt=p;;
8949                 *C) dflt=C;;
8950                 *L) dflt=L;;
8951                 *L1) dflt=L1;;
8952                 *) dflt=1;;
8953                 esac
8954                 ;;
8955         *)      dflt="$man1ext";;
8956         esac
8957         . ./myread
8958         man1ext="$ans"
8959         ;;
8960 esac
8961
8962 : see if we can have long filenames
8963 echo " "
8964 first=123456789abcdef
8965 $rm -f $first
8966 if (echo hi >$first) 2>/dev/null; then
8967         if $test -f 123456789abcde; then
8968                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8969                 val="$undef"
8970         else
8971                 echo 'You can have filenames longer than 14 characters.'>&4
8972                 val="$define"
8973         fi
8974 else
8975         $cat <<'EOM'
8976 You can't have filenames longer than 14 chars.
8977 You can't even think about them!
8978 EOM
8979         val="$undef"
8980 fi
8981 set d_flexfnam
8982 eval $setvar
8983 $rm -rf 123456789abcde*
8984
8985 : determine where library module manual pages go
8986 set man3dir man3dir none
8987 eval $prefixit
8988 $cat <<EOM
8989
8990 $spackage has manual pages for many of the library modules.
8991 EOM
8992
8993 case "$nroff" in
8994 nroff)
8995         $cat <<'EOM'
8996 However, you don't have nroff, so they're probably useless to you.
8997 EOM
8998         case "$man3dir" in
8999         '') man3dir="none";;
9000         esac;;
9001 esac
9002
9003 case "$d_flexfnam" in
9004 undef)
9005         $cat <<'EOM'
9006 However, your system can't handle the long file names like File::Basename.3.
9007 EOM
9008         case "$man3dir" in
9009         '') man3dir="none";;
9010         esac;;
9011 esac
9012
9013 echo "If you don't want the manual sources installed, answer 'none'."
9014 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9015 case "$man3dir" in
9016 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9017         if $test -d "$privlib/man/man3"; then
9018                 cat <<EOM >&4
9019
9020 WARNING:  Previous versions of perl installed man3 pages into
9021 $privlib/man/man3.  This version will suggest a
9022 new default of $dflt.
9023 EOM
9024                 tdflt=$dflt
9025                 dflt='n'
9026                 rp='Do you wish to preserve the old behavior?(y/n)'
9027                 . ./myread
9028                 case "$ans" in
9029                 y*) dflt="$privlib/man/man3" ;;
9030                 *)  dflt=$tdflt ;;
9031                 esac
9032     fi
9033         ;;
9034 *)      dflt="$man3dir" ;;
9035 esac
9036 case "$dflt" in
9037 ' ') dflt=none ;;
9038 esac
9039 echo " "
9040 fn=dn+~
9041 rp="Where do the $package library man pages (source) go?"
9042 . ./getfile
9043 prefixvar=man3dir
9044 . ./setprefixvar
9045
9046 case "$man3dir" in
9047 '')     man3dir=' '
9048         installman3dir='';;
9049 esac
9050
9051 : What suffix to use on installed man pages
9052 case "$man3dir" in
9053 ' ')
9054         man3ext='0'
9055         ;;
9056 *)
9057         rp="What suffix should be used for the $package library man pages?"
9058         case "$man3ext" in
9059         '')     case "$man3dir" in
9060                 *3)  dflt=3 ;;
9061                 *3p) dflt=3p ;;
9062                 *3pm) dflt=3pm ;;
9063                 *l) dflt=l;;
9064                 *n) dflt=n;;
9065                 *o) dflt=o;;
9066                 *p) dflt=p;;
9067                 *C) dflt=C;;
9068                 *L) dflt=L;;
9069                 *L3) dflt=L3;;
9070                 *) dflt=3;;
9071                 esac
9072                 ;;
9073         *)      dflt="$man3ext";;
9074         esac
9075         . ./myread
9076         man3ext="$ans"
9077         ;;
9078 esac
9079
9080 : see if we have to deal with yellow pages, now NIS.
9081 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9082         case "$hostcat" in
9083         nidump*) ;;
9084         *)
9085                 case "$hostcat" in
9086                 *ypcat*) dflt=y;;
9087                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9088                                 dflt=y
9089                         else
9090                                 dflt=n
9091                         fi;;
9092                 *) dflt=n;;
9093                 esac
9094                 echo " "
9095                 rp='Are you getting the hosts file via yellow pages?'
9096                 . ./myread
9097                 case "$ans" in
9098                 y*) hostcat='ypcat hosts';;
9099                 *) hostcat='cat /etc/hosts';;
9100                 esac
9101                 ;;
9102         esac
9103 fi
9104 case "$hostcat" in
9105 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9106 esac
9107 case "$groupcat" in
9108 '') test -f /etc/group && groupcat='cat /etc/group';;
9109 esac
9110 case "$passcat" in
9111 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9112 esac
9113
9114 : now get the host name
9115 echo " "
9116 echo "Figuring out host name..." >&4
9117 case "$myhostname" in
9118 '') cont=true
9119         echo 'Maybe "hostname" will work...'
9120         if tans=`sh -c hostname 2>&1` ; then
9121                 myhostname=$tans
9122                 phostname=hostname
9123                 cont=''
9124         fi
9125         ;;
9126 *) cont='';;
9127 esac
9128 if $test "$cont"; then
9129         if ./xenix; then
9130                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9131                 if tans=`cat /etc/systemid 2>&1` ; then
9132                         myhostname=$tans
9133                         phostname='cat /etc/systemid'
9134                         echo "Whadyaknow.  Xenix always was a bit strange..."
9135                         cont=''
9136                 fi
9137         elif $test -r /etc/systemid; then
9138                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9139         fi
9140 fi
9141 if $test "$cont"; then
9142         echo 'No, maybe "uuname -l" will work...'
9143         if tans=`sh -c 'uuname -l' 2>&1` ; then
9144                 myhostname=$tans
9145                 phostname='uuname -l'
9146         else
9147                 echo 'Strange.  Maybe "uname -n" will work...'
9148                 if tans=`sh -c 'uname -n' 2>&1` ; then
9149                         myhostname=$tans
9150                         phostname='uname -n'
9151                 else
9152                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9153                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9154                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9155                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9156                         else
9157                                 case "$myhostname" in
9158                                 '') echo "Does this machine have an identity crisis or something?"
9159                                         phostname='';;
9160                                 *)
9161                                         echo "Well, you said $myhostname before..."
9162                                         phostname='echo $myhostname';;
9163                                 esac
9164                         fi
9165                 fi
9166         fi
9167 fi
9168 case "$myhostname" in
9169 '') myhostname=noname ;;
9170 esac
9171 : you do not want to know about this
9172 set $myhostname
9173 myhostname=$1
9174
9175 : verify guess
9176 if $test "$myhostname" ; then
9177         dflt=y
9178         rp='Your host name appears to be "'$myhostname'".'" Right?"
9179         . ./myread
9180         case "$ans" in
9181         y*) ;;
9182         *) myhostname='';;
9183         esac
9184 fi
9185
9186 : bad guess or no guess
9187 while $test "X$myhostname" = X ; do
9188         dflt=''
9189         rp="Please type the (one word) name of your host:"
9190         . ./myread
9191         myhostname="$ans"
9192 done
9193
9194 : translate upper to lower if necessary
9195 case "$myhostname" in
9196 *[A-Z]*)
9197         echo "(Normalizing case in your host name)"
9198         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9199         ;;
9200 esac
9201
9202 case "$myhostname" in
9203 *.*)
9204         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9205         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9206         echo "(Trimming domain name from host name--host name is now $myhostname)"
9207         ;;
9208 *) case "$mydomain" in
9209         '')
9210                 {
9211                         test "X$hostcat" = "Xypcat hosts" &&
9212                         ypmatch "$myhostname" hosts 2>/dev/null |\
9213                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9214                         $test -s hosts
9215                 } || {
9216                         test "X$hostcat" != "X" &&
9217                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9218                                         /[       ]$myhostname[  . ]/p" > hosts
9219                 }
9220                 tmp_re="[       . ]"
9221                 if $test -f hosts; then
9222                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9223                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9224                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9225                                 hosts | $sort | $uniq | \
9226                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9227                         case `$echo X$dflt` in
9228                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9229                                 dflt=.
9230                                 ;;
9231                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9232                                 ;;
9233                         esac
9234                 else
9235                         echo "(I cannot locate a hosts database anywhere)"
9236                         dflt=.
9237                 fi
9238                 case "$dflt" in
9239                 .)
9240                         tans=`./loc resolv.conf X /etc /usr/etc`
9241                         if $test -f "$tans"; then
9242                                 echo "(Attempting domain name extraction from $tans)"
9243                                 dflt=.`$sed -n -e 's/   / /g' \
9244                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9245                                   -e 1q 2>/dev/null`
9246                                 case "$dflt" in
9247                                 .) dflt=.`$sed -n -e 's/        / /g' \
9248                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9249                                      -e 1q 2>/dev/null`
9250                                         ;;
9251                                 esac
9252                         fi
9253                         ;;
9254                 esac
9255                 case "$dflt" in
9256                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9257                         dflt=.`sh -c domainname 2>/dev/null`
9258                         case "$dflt" in
9259                         '') dflt='.';;
9260                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9261                         esac
9262                         ;;
9263                 esac
9264                 case "$dflt$osname" in
9265                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9266                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9267                         ;;
9268                 esac
9269                 case "$dflt" in
9270                 .) echo "(Lost all hope -- silly guess then)"
9271                         dflt='.nonet'
9272                         ;;
9273                 esac
9274                 $rm -f hosts
9275                 ;;
9276         *) dflt="$mydomain";;
9277         esac;;
9278 esac
9279 echo " "
9280 rp="What is your domain name?"
9281 . ./myread
9282 tans="$ans"
9283 case "$ans" in
9284 '') ;;
9285 .*) ;;
9286 *) tans=".$tans";;
9287 esac
9288 mydomain="$tans"
9289
9290 : translate upper to lower if necessary
9291 case "$mydomain" in
9292 *[A-Z]*)
9293         echo "(Normalizing case in your domain name)"
9294         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9295         ;;
9296 esac
9297
9298 : a little sanity check here
9299 case "$phostname" in
9300 '') ;;
9301 *)
9302         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9303         $myhostname$mydomain|$myhostname) ;;
9304         *)
9305                 case "$phostname" in
9306                 sed*)
9307                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9308                         ;;
9309                 *)
9310                         echo "(That doesn't agree with your $phostname command, by the way.)"
9311                         ;;
9312                 esac
9313         ;;
9314         esac
9315         ;;
9316 esac
9317
9318 : determine the e-mail address of the user who is running us
9319 $cat <<EOM
9320
9321 I need to get your e-mail address in Internet format if possible, i.e.
9322 something like user@host.domain. Please answer accurately since I have
9323 no easy means to double check it. The default value provided below
9324 is most probably close to reality but may not be valid from outside
9325 your organization...
9326
9327 EOM
9328 cont=x
9329 while test "$cont"; do
9330         case "$MAILDOMAIN" in
9331         '')
9332                 if $test -s /etc/mailname; then
9333                         maildomain=`$cat /etc/mailname`
9334                 else
9335                         maildomain="$myhostname$mydomain"
9336                 fi
9337                 ;;
9338         *)  maildomain="$MAILDOMAIN";;
9339         esac
9340         case "$cf_email" in
9341         '') dflt="$cf_by@$maildomain";;
9342         *)  dflt="$cf_email";;
9343         esac
9344         rp='What is your e-mail address?'
9345         . ./myread
9346         cf_email="$ans"
9347         case "$cf_email" in
9348         *@*.*) cont='' ;;
9349         *)
9350                 rp='Address does not look like an Internet one.  Use it anyway?'
9351                 case "$fastread" in
9352                 yes) dflt=y ;;
9353                 *) dflt=n ;;
9354                 esac
9355                 . ./myread
9356                 case "$ans" in
9357                 y*) cont='' ;;
9358                 *) echo " " ;;
9359                 esac
9360                 ;;
9361         esac
9362 done
9363
9364 : Ask e-mail of administrator
9365 $cat <<EOM
9366
9367 If you or somebody else will be maintaining perl at your site, please
9368 fill in the correct e-mail address here so that they may be contacted
9369 if necessary. Currently, the "perlbug" program included with perl
9370 will send mail to this address in addition to perlbug@perl.org. You may
9371 enter "none" for no administrator.
9372
9373 EOM
9374 case "$perladmin" in
9375 '') dflt="$cf_email";;
9376 *) dflt="$perladmin";;
9377 esac
9378 rp='Perl administrator e-mail address'
9379 . ./myread
9380 perladmin="$ans"
9381
9382 : determine whether to only install version-specific parts.
9383 echo " "
9384 $cat <<EOM
9385 Do you want to install only the version-specific parts of the perl
9386 distribution?  Usually you do *not* want to do this.
9387 EOM
9388 case "$versiononly" in
9389 "$define"|[Yy]*|true) dflt='y' ;;
9390 *) dflt='n';
9391 esac
9392 rp="Do you want to install only the version-specific parts of perl?"
9393 . ./myread
9394 case "$ans" in
9395 [yY]*)  val="$define";;
9396 *)      val="$undef" ;;
9397 esac
9398 set versiononly
9399 eval $setvar
9400
9401 case "$versiononly" in
9402 "$define") inc_version_list=''
9403            inc_version_list_init=0
9404            ;;
9405 esac
9406
9407 : figure out how to guarantee perl startup
9408 : XXX Note that this currently takes advantage of the bug that binexp ignores
9409 :     the Configure -Dinstallprefix setting, which in turn means that under
9410 :     relocatable @INC, initialinstalllocation is what binexp started as.
9411 case "$startperl" in
9412 '')
9413         case "$sharpbang" in
9414         *!)
9415                 $cat <<EOH
9416
9417 I can use the #! construct to start perl on your system. This will
9418 make startup of perl scripts faster, but may cause problems if you
9419 want to share those scripts and perl is not in a standard place
9420 ($initialinstalllocation/perl) on all your platforms. The alternative
9421 is to force a shell by starting the script with a single ':' character.
9422
9423 EOH
9424                 case "$versiononly" in
9425                 "$define")      dflt="$initialinstalllocation/perl$version";;
9426                 *)              dflt="$initialinstalllocation/perl";;
9427                 esac
9428                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9429                 . ./myread
9430                 case "$ans" in
9431                 none)   startperl=": # use perl";;
9432                 *)      startperl="#!$ans"
9433                         if $test 30 -lt `echo "$ans" | wc -c`; then
9434                                 $cat >&4 <<EOM
9435
9436 WARNING:  Some systems limit the #! command to 32 characters.
9437 If you experience difficulty running Perl scripts with #!, try
9438 installing Perl in a directory with a shorter pathname.
9439
9440 EOM
9441                         fi ;;
9442                 esac
9443                 ;;
9444         *) startperl=": # use perl"
9445                 ;;
9446         esac
9447         ;;
9448 esac
9449 echo "I'll use $startperl to start perl scripts."
9450
9451 : figure best path for perl in scripts
9452 case "$perlpath" in
9453 '')
9454         case "$versiononly" in
9455         "$define")      perlpath="$initialinstalllocation/perl$version";;
9456         *)              perlpath="$initialinstalllocation/perl";;
9457         esac
9458         case "$startperl" in
9459         *!*) ;;
9460         *)
9461                 $cat <<EOH
9462
9463 I will use the "eval 'exec'" idiom to start Perl on your system.
9464 I can use the full path of your Perl binary for this purpose, but
9465 doing so may cause problems if you want to share those scripts and
9466 Perl is not always in a standard place ($initialinstalllocation/perl).
9467
9468 EOH
9469                 dflt="$initialinstalllocation/perl"
9470                 rp="What path shall I use in \"eval 'exec'\"?"
9471                 . ./myread
9472                 perlpath="$ans"
9473                 ;;
9474         esac
9475         ;;
9476 esac
9477 case "$startperl" in
9478 *!*)    ;;
9479 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9480 esac
9481
9482 : determine where public executable scripts go
9483 set scriptdir scriptdir
9484 eval $prefixit
9485 case "$scriptdir" in
9486 '')
9487         dflt="$bin"
9488         : guess some guesses
9489         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9490         $test -d /usr/share/bin     && dflt=/usr/share/bin
9491         $test -d /usr/local/script  && dflt=/usr/local/script
9492         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9493         $test -d $prefixexp/script  && dflt=$prefixexp/script
9494         set dflt
9495         eval $prefixup
9496         ;;
9497 *)  dflt="$scriptdir"
9498         ;;
9499 esac
9500 $cat <<EOM
9501
9502 Some installations have a separate directory just for executable scripts so
9503 that they can mount it across multiple architectures but keep the scripts in
9504 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9505 Or you might just lump your scripts in with all your other executables.
9506
9507 EOM
9508 fn=d~
9509 rp='Where do you keep publicly executable scripts?'
9510 . ./getfile
9511 if $test "X$ansexp" != "X$scriptdirexp"; then
9512         installscript=''
9513 fi
9514 installscriptdir=''
9515 prefixvar=scriptdir
9516 . ./setprefixvar
9517 : A little fix up for an irregularly named variable.
9518 installscript="$installscriptdir"
9519
9520 : determine where add-on public executables go
9521 case "$sitebin" in
9522 '')     dflt=$siteprefix/bin ;;
9523 *)      dflt=$sitebin ;;
9524 esac
9525 fn=d~
9526 rp='Pathname where the add-on public executables should be installed?'
9527 . ./getfile
9528 prefixvar=sitebin
9529 . ./setprefixvar
9530
9531 : determine where add-on html pages go
9532 : There is no standard location, so try to copy the previously-selected
9533 : directory structure for the core html pages.
9534 case "$sitehtml1dir" in
9535 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9536 *)     dflt=$sitehtml1dir ;;
9537 esac
9538 case "$dflt" in
9539 ''|' ') dflt=none ;;
9540 esac
9541 fn=dn+~
9542 rp='Pathname where the site-specific html pages should be installed?'
9543 . ./getfile
9544 prefixvar=sitehtml1dir
9545 . ./setprefixvar
9546
9547 : determine where add-on library html pages go
9548 : There is no standard location, so try to copy the previously-selected
9549 : directory structure for the core html pages.
9550 case "$sitehtml3dir" in
9551 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9552 *)     dflt=$sitehtml3dir ;;
9553 esac
9554 case "$dflt" in
9555 ''|' ') dflt=none ;;
9556 esac
9557 fn=dn+~
9558 rp='Pathname where the site-specific library html pages should be installed?'
9559 . ./getfile
9560 prefixvar=sitehtml3dir
9561 . ./setprefixvar
9562
9563 : determine where add-on manual pages go
9564 case "$siteman1dir" in
9565 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9566 *)      dflt=$siteman1dir ;;
9567 esac
9568 case "$dflt" in
9569 ''|' ') dflt=none ;;
9570 esac
9571 fn=dn+~
9572 rp='Pathname where the site-specific manual pages should be installed?'
9573 . ./getfile
9574 prefixvar=siteman1dir
9575 . ./setprefixvar
9576
9577 : determine where add-on library man pages go
9578 case "$siteman3dir" in
9579 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9580 *)      dflt=$siteman3dir ;;
9581 esac
9582 case "$dflt" in
9583 ''|' ') dflt=none ;;
9584 esac
9585 fn=dn+~
9586 rp='Pathname where the site-specific library manual pages should be installed?'
9587 . ./getfile
9588 prefixvar=siteman3dir
9589 . ./setprefixvar
9590
9591 : determine where add-on public executable scripts go
9592 case "$sitescript" in
9593 '')     dflt=$siteprefix/script
9594         $test -d $dflt || dflt=$sitebin ;;
9595 *)  dflt="$sitescript" ;;
9596 esac
9597 fn=d~+
9598 rp='Pathname where add-on public executable scripts should be installed?'
9599 . ./getfile
9600 prefixvar=sitescript
9601 . ./setprefixvar
9602
9603 : see if backtrace exists
9604 set backtrace d_backtrace
9605 eval $inlibc
9606
9607 : add flags if using c backtrace
9608 case "$usecbacktrace" in
9609   "") usecbacktrace=$undef ;;
9610   [yY]*|true|$define)
9611     case "$d_backtrace" in
9612       [yY]*|true|$define)
9613         case " $ccflags " in
9614           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9615           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9616           esac
9617         ;;
9618       *)
9619         echo "This system does not support backtrace" >&4
9620         usecbacktrace=$undef
9621         ;;
9622       esac
9623     ;;
9624   esac
9625
9626 : Check if faststdio is requested and available
9627 case "$usefaststdio" in
9628 $define|true|[yY]*|'')
9629         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9630         case "$xversion" in
9631         [68])   dflt='y' ;;
9632         *)      dflt='n' ;;
9633         esac
9634         ;;
9635 *) dflt='n';;
9636 esac
9637 cat <<EOM
9638
9639 Perl can be built to use 'fast stdio', which means using the stdio
9640 library but also directly manipulating the stdio buffers to enable
9641 faster I/O.  Using stdio is better for backward compatibility (especially
9642 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9643 interface has been preferred instead of stdio.
9644
9645 If this doesn't make any sense to you, just accept the default '$dflt'.
9646 EOM
9647 rp='Use the "fast stdio" if available?'
9648 . ./myread
9649 case "$ans" in
9650 y|Y)    val="$define" ;;
9651 *)      val="$undef" ;;
9652 esac
9653 set usefaststdio
9654 eval $setvar
9655
9656
9657 : define an is-a-typedef? function
9658 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9659 case "$inclist" in
9660 "") inclist="sys/types.h";;
9661 esac;
9662 eval "varval=\$$var";
9663 case "$varval" in
9664 "")
9665         $rm -f temp.c;
9666         for inc in $inclist; do
9667                 echo "#include <$inc>" >>temp.c;
9668         done;
9669         echo "#ifdef $type" >> temp.c;
9670         echo "printf(\"We have $type\");" >> temp.c;
9671         echo "#endif" >> temp.c;
9672         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9673         if $contains $type temp.E >/dev/null 2>&1; then
9674                 eval "$var=\$type";
9675         else
9676                 eval "$var=\$def";
9677         fi;
9678         $rm -f temp.?;;
9679 *) eval "$var=\$varval";;
9680 esac'
9681
9682 : define an is-a-typedef? function that prompts if the type is not available.
9683 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9684 case "$inclist" in
9685 "") inclist="sys/types.h";;
9686 esac;
9687 eval "varval=\$$var";
9688 case "$varval" in
9689 "")
9690         $rm -f temp.c;
9691         for inc in $inclist; do
9692                 echo "#include <$inc>" >>temp.c;
9693         done;
9694         echo "#ifdef $type" >> temp.c;
9695         echo "printf(\"We have $type\");" >> temp.c;
9696         echo "#endif" >> temp.c;
9697         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9698         echo " " ;
9699         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9700         if $contains $type temp.E >/dev/null 2>&1; then
9701                 echo "$type found." >&4;
9702                 eval "$var=\$type";
9703         else
9704                 echo "$type NOT found." >&4;
9705                 dflt="$def";
9706                 . ./myread ;
9707                 eval "$var=\$ans";
9708         fi;
9709         $rm -f temp.?;;
9710 *) eval "$var=\$varval";;
9711 esac'
9712
9713 : see what type lseek is declared as in the kernel
9714 rp="What is the type used for lseek's offset on this system?"
9715 set off_t lseektype long stdio.h sys/types.h
9716 eval $typedef_ask
9717
9718 echo " "
9719 echo "Checking to see how big your file offsets are..." >&4
9720 $cat >try.c <<EOCP
9721 #include <sys/types.h>
9722 #include <stdio.h>
9723 int main()
9724 {
9725     printf("%d\n", (int)sizeof($lseektype));
9726     return(0);
9727 }
9728 EOCP
9729 set try
9730 if eval $compile_ok; then
9731         lseeksize=`$run ./try`
9732         echo "Your file offsets are $lseeksize bytes long."
9733 else
9734         dflt=$longsize
9735         echo " "
9736         echo "(I can't seem to compile the test program.  Guessing...)"
9737         rp="What is the size of your file offsets (in bytes)?"
9738         . ./myread
9739         lseeksize="$ans"
9740 fi
9741 $rm_try
9742
9743 : see what type file positions are declared as in the library
9744 rp="What is the type for file position used by fsetpos()?"
9745 set fpos_t fpostype long stdio.h sys/types.h
9746 eval $typedef_ask
9747
9748 : Check size for Fpos_t
9749 echo " "
9750 case "$fpostype" in
9751 *_t) zzz="$fpostype"    ;;
9752 *)   zzz="fpos_t"       ;;
9753 esac
9754 echo "Checking the size of $zzz..." >&4
9755 cat > try.c <<EOCP
9756 #include <sys/types.h>
9757 #include <stdio.h>
9758 #$i_stdlib I_STDLIB
9759 #ifdef I_STDLIB
9760 #include <stdlib.h>
9761 #endif
9762 int main() {
9763     printf("%d\n", (int)sizeof($fpostype));
9764     exit(0);
9765 }
9766 EOCP
9767 set try
9768 if eval $compile_ok; then
9769         yyy=`$run ./try`
9770         case "$yyy" in
9771         '')     fpossize=4
9772                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9773                 ;;
9774         *)      fpossize=$yyy
9775                 echo "Your $zzz is $fpossize bytes long."
9776                 ;;
9777         esac
9778 else
9779         dflt="$longsize"
9780         echo " " >&4
9781         echo "(I can't compile the test program.  Guessing...)" >&4
9782         rp="What is the size of your file positions (in bytes)?"
9783         . ./myread
9784         fpossize="$ans"
9785 fi
9786
9787 : Check for large file support
9788 # Backward compatibility (uselfs is deprecated).
9789 case "$uselfs" in
9790 "$define"|true|[yY]*)
9791         cat <<EOM >&4
9792
9793 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9794 EOM
9795         uselargefiles="$define"
9796         ;;
9797 esac
9798
9799 case "$lseeksize:$fpossize" in
9800 8:8) cat <<EOM
9801
9802 You can have files larger than 2 gigabytes.
9803 EOM
9804    val="$define" ;;
9805 *)    case "$uselargefiles" in
9806    "$undef"|false|[nN]*) dflt='n' ;;
9807    *)   dflt='y' ;;
9808    esac
9809    cat <<EOM
9810
9811 Perl can be built to understand large files (files larger than 2 gigabytes)
9812 on some systems.  To do so, Configure can be run with -Duselargefiles.
9813
9814 If this doesn't make any sense to you, just accept the default '$dflt'.
9815 EOM
9816    rp='Try to understand large files, if available?'
9817    . ./myread
9818    case "$ans" in
9819    y|Y)         val="$define" ;;
9820    *)           val="$undef"  ;;
9821    esac
9822    ;;
9823 esac
9824 set uselargefiles
9825 eval $setvar
9826 : Look for a hint-file generated 'call-back-unit'.  If the
9827 : user has specified that a large files perl is to be built,
9828 : we may need to set or change some other defaults.
9829 if $test -f uselargefiles.cbu; then
9830         echo "Your platform has some specific hints regarding large file builds, using them..."
9831         . ./uselargefiles.cbu
9832 fi
9833 case "$uselargefiles" in
9834 "$define")
9835         if $test -f uselargefiles.cbu; then
9836                 echo " "
9837                 echo "Rechecking to see how big your file offsets are..." >&4
9838                 $cat >try.c <<EOCP
9839 #include <sys/types.h>
9840 #include <stdio.h>
9841 int main()
9842 {
9843     printf("%d\n", (int)sizeof($lseektype));
9844     return(0);
9845 }
9846 EOCP
9847                 set try
9848                 if eval $compile_ok; then
9849                         lseeksize=`$run ./try`
9850                         $echo "Your file offsets are now $lseeksize bytes long."
9851                 else
9852                         dflt="$lseeksize"
9853                         echo " "
9854                         echo "(I can't seem to compile the test program.  Guessing...)"
9855                         rp="What is the size of your file offsets (in bytes)?"
9856                         . ./myread
9857                         lseeksize="$ans"
9858                 fi
9859                 case "$fpostype" in
9860                 *_t) zzz="$fpostype"    ;;
9861                 *)   zzz="fpos_t"       ;;
9862                 esac
9863                 $echo $n "Rechecking the size of $zzz...$c" >&4
9864                 $cat > try.c <<EOCP
9865 #include <sys/types.h>
9866 #include <stdio.h>
9867 #$i_stdlib I_STDLIB
9868 #ifdef I_STDLIB
9869 #include <stdlib.h>
9870 #endif
9871 int main() {
9872     printf("%d\n", (int)sizeof($fpostype));
9873     return(0);
9874 }
9875 EOCP
9876                 set try
9877                 if eval $compile_ok; then
9878                         yyy=`$run ./try`
9879                         dflt="$lseeksize"
9880                         case "$yyy" in
9881                         '')     echo " "
9882                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9883                                 ;;
9884                         *)      fpossize=$yyy
9885                                 echo " $fpossize bytes." >&4
9886                                 ;;
9887                         esac
9888                 else
9889                         dflt="$fpossize"
9890                         echo " "
9891                         echo "(I can't compile the test program.  Guessing...)" >&4
9892                         rp="What is the size of your file positions (in bytes)?"
9893                         . ./myread
9894                         fpossize="$ans"
9895                 fi
9896                 $rm_try
9897         fi
9898         ;;
9899 esac
9900
9901 : Check if we want perlio
9902 useperlio="$define"
9903
9904 : Set the vendorbin variables
9905 case "$vendorprefix" in
9906 '')     d_vendorbin="$undef"
9907         vendorbin=''
9908         vendorbinexp=''
9909         ;;
9910 *)      d_vendorbin="$define"
9911         : determine where vendor-supplied executables go.
9912         case "$vendorbin" in
9913         '') dflt=$vendorprefix/bin ;;
9914         *)      dflt="$vendorbin" ;;
9915         esac
9916         fn=d~+
9917         rp='Pathname for the vendor-supplied executables directory?'
9918         . ./getfile
9919         vendorbin="$ans"
9920         vendorbinexp="$ansexp"
9921         ;;
9922 esac
9923 prefixvar=vendorbin
9924 . ./installprefix
9925
9926 : Set the vendorhtml1dir variables
9927 case "$vendorprefix" in
9928 '')     vendorhtml1dir=''
9929         vendorhtml1direxp=''
9930         ;;
9931 *)      : determine where vendor-supplied html pages go.
9932         : There is no standard location, so try to copy the previously-selected
9933         : directory structure for the core html pages.
9934         : XXX Better default suggestions would be welcome.
9935         case "$vendorhtml1dir" in
9936         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9937         *)      dflt=$vendorhtml1dir ;;
9938         esac
9939         case "$dflt" in
9940         ''|' ') dflt=none ;;
9941         esac
9942         fn=dn+~
9943         rp='Pathname for the vendor-supplied html pages?'
9944         . ./getfile
9945         vendorhtml1dir="$ans"
9946         vendorhtml1direxp="$ansexp"
9947         ;;
9948 esac
9949 : Use ' ' for none so value is preserved next time through Configure
9950 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9951 prefixvar=vendorhtml1dir
9952 . ./installprefix
9953
9954 : Set the vendorhtml3dir variables
9955 case "$vendorprefix" in
9956 '')     vendorhtml3dir=''
9957         vendorhtml3direxp=''
9958         ;;
9959 *)      : determine where vendor-supplied module html pages go.
9960         : There is no standard location, so try to copy the previously-selected
9961         : directory structure for the core html pages.
9962         : XXX Better default suggestions would be welcome.
9963         case "$vendorhtml3dir" in
9964         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9965         *)      dflt=$vendorhtml3dir ;;
9966         esac
9967         case "$dflt" in
9968         ''|' ') dflt=none ;;
9969         esac
9970         fn=dn+~
9971         rp='Pathname for the vendor-supplied html pages?'
9972         . ./getfile
9973         vendorhtml3dir="$ans"
9974         vendorhtml3direxp="$ansexp"
9975         ;;
9976 esac
9977 : Use ' ' for none so value is preserved next time through Configure
9978 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9979 prefixvar=vendorhtml3dir
9980 . ./installprefix
9981
9982 : Set the vendorman1dir variables
9983 case "$vendorprefix" in
9984 '')     vendorman1dir=''
9985         vendorman1direxp=''
9986         ;;
9987 *)      : determine where vendor-supplied manual pages go.
9988         case "$vendorman1dir" in
9989         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9990         *)      dflt=$vendorman1dir ;;
9991         esac
9992         case "$dflt" in
9993         ''|' ') dflt=none ;;
9994         esac
9995         fn=nd~+
9996         rp='Pathname for the vendor-supplied manual section 1 pages?'
9997         . ./getfile
9998         vendorman1dir="$ans"
9999         vendorman1direxp="$ansexp"
10000         ;;
10001 esac
10002 : Use ' ' for none so value is preserved next time through Configure
10003 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10004 prefixvar=vendorman1dir
10005 . ./installprefix
10006
10007 : Set the vendorman3dir variables
10008 case "$vendorprefix" in
10009 '')     vendorman3dir=''
10010         vendorman3direxp=''
10011         ;;
10012 *)      : determine where vendor-supplied module manual pages go.
10013         case "$vendorman3dir" in
10014         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10015         *)      dflt=$vendorman3dir ;;
10016         esac
10017         case "$dflt" in
10018         ''|' ') dflt=none ;;
10019         esac
10020         fn=nd~+
10021         rp='Pathname for the vendor-supplied manual section 3 pages?'
10022         . ./getfile
10023         vendorman3dir="$ans"
10024         vendorman3direxp="$ansexp"
10025         ;;
10026 esac
10027 : Use ' ' for none so value is preserved next time through Configure
10028 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10029 prefixvar=vendorman3dir
10030 . ./installprefix
10031
10032 : Set the vendorscript variables
10033 case "$vendorprefix" in
10034 '')     d_vendorscript="$undef"
10035         vendorscript=''
10036         vendorscriptexp=''
10037         ;;
10038 *)      d_vendorscript="$define"
10039         : determine where vendor-supplied scripts go.
10040         case "$vendorscript" in
10041         '')     dflt=$vendorprefix/script
10042                 $test -d $dflt || dflt=$vendorbin ;;
10043         *)  dflt="$vendorscript" ;;
10044         esac
10045         $cat <<EOM
10046
10047 The installation process will create a directory for
10048 vendor-supplied scripts.
10049
10050 EOM
10051         fn=d~+
10052         rp='Pathname for the vendor-supplied scripts directory?'
10053         . ./getfile
10054         vendorscript="$ans"
10055         vendorscriptexp="$ansexp"
10056         ;;
10057 esac
10058 prefixvar=vendorscript
10059 . ./installprefix
10060
10061 : script used to emit important warnings
10062 cat >warn <<EOS
10063 $startsh
10064 if test \$# -gt 0; then
10065         echo "\$@" >msg
10066 else
10067         cat >msg
10068 fi
10069 echo "*** WARNING:" >&4
10070 sed -e 's/^/*** /' <msg >&4
10071 echo "*** " >&4
10072 cat msg >>config.msg
10073 echo " " >>config.msg
10074 rm -f msg
10075 EOS
10076 chmod +x warn
10077 $eunicefix warn
10078
10079 : see which of string.h or strings.h is needed
10080 echo " "
10081 strings=`./findhdr string.h`
10082 if $test "$strings" && $test -r "$strings"; then
10083         echo "Using <string.h> instead of <strings.h>." >&4
10084         val="$define"
10085 else
10086         val="$undef"
10087         strings=`./findhdr strings.h`
10088         if $test "$strings" && $test -r "$strings"; then
10089                 echo "Using <strings.h> instead of <string.h>." >&4
10090         else
10091                 ./warn "No string header found -- You'll surely have problems."
10092         fi
10093 fi
10094 set i_string
10095 eval $setvar
10096 case "$i_string" in
10097 "$undef") strings=`./findhdr strings.h`;;
10098 *)        strings=`./findhdr string.h`;;
10099 esac
10100
10101 : see if qgcvt exists
10102 set qgcvt d_qgcvt
10103 eval $inlibc
10104
10105 : Check what kind of doubles your system has
10106 $echo "Checking the kind of doubles you have..." >&4
10107 $cat >try.c <<EOP
10108 #$i_stdlib I_STDLIB
10109 #define DOUBLESIZE $doublesize
10110 #ifdef I_STDLIB
10111 #include <stdlib.h>
10112 #endif
10113 #include <stdio.h>
10114 static const double d = -0.1;
10115 int main() {
10116   unsigned const char* b = (unsigned const char*)(&d);
10117 #if DOUBLESIZE == 4
10118   if (b[0] == 0xCD && b[3] == 0xBD) {
10119     /* IEEE 754 32-bit little-endian */
10120     printf("1\n");
10121     exit(0);
10122   }
10123   if (b[0] == 0xBD && b[3] == 0xCD) {
10124     /* IEEE 754 32-bit big-endian */
10125     printf("2\n");
10126     exit(0);
10127   }
10128 #endif
10129 #if DOUBLESIZE == 8
10130   if (b[0] == 0x9A && b[7] == 0xBF) {
10131     /* IEEE 754 64-bit little-endian */
10132     printf("3\n");
10133     exit(0);
10134   }
10135   if (b[0] == 0xBF && b[7] == 0x9A) {
10136     /* IEEE 754 64-bit big-endian */
10137     printf("4\n");
10138     exit(0);
10139   }
10140   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10141    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10142     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10143     * 99 99 b9 bf 9a 99 99 99 */
10144     printf("7\n");
10145     exit(0);
10146   }
10147   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10148    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10149     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10150     * 99 99 99 9a bf b9 99 99 */
10151     printf("8\n");
10152     exit(0);
10153   }
10154 #endif
10155 #if DOUBLESIZE == 16
10156   if (b[0] == 0x9A && b[15] == 0xBF) {
10157     /* IEEE 754 128-bit little-endian */
10158     printf("5\n");
10159     exit(0);
10160   }
10161   if (b[0] == 0xBF && b[15] == 0x9A) {
10162     /* IEEE 754 128-bit big-endian */
10163     printf("6\n");
10164     exit(0);
10165   }
10166 #endif
10167   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
10168    * Whether those environments can still build Perl is debatable. */
10169   printf("-1\n"); /* unknown */
10170   exit(0);
10171 }
10172 EOP
10173 set try
10174 if eval $compile; then
10175     doublekind=`$run ./try`
10176 else
10177     doublekind=-1
10178 fi
10179 case "$doublekind" in
10180 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10181 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10182 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10183 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10184 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10185 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10186 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10187 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10188 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
10189 esac
10190 $rm_try
10191
10192 : Check print/scan long double stuff
10193 echo " "
10194
10195 if $test X"$d_longdbl" = X"$define"; then
10196
10197 echo "Checking how to print long doubles..." >&4
10198
10199 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10200         $cat >try.c <<'EOCP'
10201 #include <sys/types.h>
10202 #include <stdio.h>
10203 int main() {
10204   double d = 123.456;
10205   printf("%.3f\n", d);
10206 }
10207 EOCP
10208         set try
10209         if eval $compile; then
10210                 yyy=`$run ./try`
10211                 case "$yyy" in
10212                 123.456)
10213                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10214                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10215                         echo "We will use %f."
10216                         ;;
10217                 esac
10218         fi
10219 fi
10220
10221 if $test X"$sPRIfldbl" = X; then
10222         $cat >try.c <<'EOCP'
10223 #include <sys/types.h>
10224 #include <stdio.h>
10225 int main() {
10226   long double d = 123.456;
10227   printf("%.3Lf\n", d);
10228 }
10229 EOCP
10230         set try
10231         if eval $compile; then
10232                 yyy=`$run ./try`
10233                 case "$yyy" in
10234                 123.456)
10235                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10236                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10237                         echo "We will use %Lf."
10238                         ;;
10239                 esac
10240         fi
10241 fi
10242
10243 if $test X"$sPRIfldbl" = X; then
10244         $cat >try.c <<'EOCP'
10245 #include <sys/types.h>
10246 #include <stdio.h>
10247 int main() {
10248   long double d = 123.456;
10249   printf("%.3llf\n", d);
10250 }
10251 EOCP
10252         set try
10253         if eval $compile; then
10254                 yyy=`$run ./try`
10255                 case "$yyy" in
10256                 123.456)
10257                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10258                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10259                         echo "We will use %llf."
10260                         ;;
10261                 esac
10262         fi
10263 fi
10264
10265 if $test X"$sPRIfldbl" = X; then
10266         $cat >try.c <<'EOCP'
10267 #include <sys/types.h>
10268 #include <stdio.h>
10269 int main() {
10270   long double d = 123.456;
10271   printf("%.3lf\n", d);
10272 }
10273 EOCP
10274         set try
10275         if eval $compile; then
10276                 yyy=`$run ./try`
10277                 case "$yyy" in
10278                 123.456)
10279                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10280                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10281                         echo "We will use %lf."
10282                         ;;
10283                 esac
10284         fi
10285 fi
10286
10287 if $test X"$sPRIfldbl" = X; then
10288         echo "Cannot figure out how to print long doubles." >&4
10289 else
10290         sSCNfldbl=$sPRIfldbl    # expect consistency
10291 fi
10292
10293 $rm_try
10294
10295 fi # d_longdbl
10296
10297 case "$sPRIfldbl" in
10298 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10299         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10300         d_SCNfldbl="$undef";
10301         ;;
10302 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10303         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10304         d_SCNfldbl="$define";
10305         ;;
10306 esac
10307
10308 : Before committing on uselongdouble, see whether that looks sane.
10309 if $test "$uselongdouble" = "$define"; then
10310     message=""
10311     echo " "
10312     echo "Checking if your long double math functions work right..." >&4
10313     $cat > try.c <<EOF
10314 #include <math.h>
10315 #include <stdio.h>
10316 int main() {
10317   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10318 }
10319 EOF
10320     case "$osname:$gccversion" in
10321     aix:)       saveccflags="$ccflags"
10322                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10323     esac
10324     set try
10325     if eval $compile_ok; then
10326       yyy=`$run ./try`
10327     fi
10328     case "$yyy" in
10329     3) echo "Your long double math functions are working correctly." >&4 ;;
10330     *) echo "Your long double math functions are broken, not using long doubles." >&4
10331        uselongdouble=$undef
10332        ;;
10333     esac
10334     $rm_try
10335     case "$osname:$gccversion" in
10336     aix:)       ccflags="$saveccflags" ;; # restore
10337     esac
10338 fi
10339
10340 : Check how to convert floats to strings.
10341
10342 if test "X$d_Gconvert" = X; then
10343
10344 echo " "
10345 echo "Checking for an efficient way to convert floats to strings."
10346 echo " " > try.c
10347 case "$uselongdouble" in
10348 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10349 esac
10350 case "$d_longdbl" in
10351 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10352 esac
10353 case "$d_PRIgldbl" in
10354 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10355 esac
10356 $cat >>try.c <<EOP
10357 #ifdef TRY_gconvert
10358 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10359 char *myname = "gconvert";
10360 #endif
10361 #ifdef TRY_gcvt
10362 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10363 char *myname = "gcvt";
10364 #endif
10365 #ifdef TRY_qgcvt
10366 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10367 char *myname = "qgcvt";
10368 #define DOUBLETYPE long double
10369 #endif
10370 #ifdef TRY_sprintf
10371 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10372 #ifdef HAS_PRIgldbl
10373 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10374 #else
10375 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10376 #endif
10377 #else
10378 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10379 #endif
10380 char *myname = "sprintf";
10381 #endif
10382
10383 #ifndef DOUBLETYPE
10384 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10385 #define DOUBLETYPE long double
10386 #else
10387 #define DOUBLETYPE double
10388 #endif
10389 #endif
10390
10391 #include <stdio.h>
10392
10393 #$i_stdlib I_STDLIB
10394 #ifdef I_STDLIB
10395 #include <stdlib.h>
10396 #endif
10397 #$i_string I_STRING
10398 #ifdef I_STRING
10399 #  include <string.h>
10400 #else
10401 #  include <strings.h>
10402 #endif
10403
10404 int checkit(char *expect, char *got)
10405 {
10406     if (strcmp(expect, got)) {
10407                 printf("%s oddity:  Expected %s, got %s\n",
10408                         myname, expect, got);
10409                 exit(1);
10410         }
10411 }
10412
10413 int main()
10414 {
10415         char buf[64];
10416         buf[63] = '\0';
10417
10418         /* This must be 1st test on (which?) platform */
10419         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10420         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10421         checkit("0.1", buf);
10422
10423         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10424         checkit("0.01", buf);
10425
10426         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10427         checkit("0.001", buf);
10428
10429         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10430         checkit("0.0001", buf);
10431
10432         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10433         if (strlen(buf) > 5)
10434             checkit("9e-005", buf); /* for Microsoft ?? */
10435         else
10436             checkit("9e-05", buf);
10437
10438         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10439         checkit("1", buf);
10440
10441         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10442         checkit("1.1", buf);
10443
10444         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10445         checkit("1.01", buf);
10446
10447         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10448         checkit("1.001", buf);
10449
10450         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10451         checkit("1.0001", buf);
10452
10453         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10454         checkit("1.00001", buf);
10455
10456         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10457         checkit("1.000001", buf);
10458
10459         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10460         checkit("0", buf);
10461
10462         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10463         checkit("-1", buf);
10464
10465         /* Some Linux gcvt's give 1.e+5 here. */
10466         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10467         checkit("100000", buf);
10468
10469         /* Some Linux gcvt's give -1.e+5 here. */
10470         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10471         checkit("-100000", buf);
10472
10473         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10474         checkit("123.456", buf);
10475
10476         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10477         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10478         /* 34 should be enough to scare even long double
10479          * places into using the e notation. */
10480         if (strlen(buf) > 5)
10481             checkit("1e+034", buf); /* for Microsoft */
10482         else
10483             checkit("1e+34", buf);
10484
10485         /* For Perl, if you add additional tests here, also add them to
10486          * t/base/num.t for benefit of platforms not using Configure or
10487          * overriding d_Gconvert */
10488
10489         exit(0);
10490 }
10491 EOP
10492 : first add preferred functions to our list
10493 xxx_list=""
10494 for xxx_convert in $gconvert_preference; do
10495     case $xxx_convert in
10496     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10497     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10498     esac
10499 done
10500 : then add any others
10501 for xxx_convert in gconvert gcvt sprintf; do
10502     case "$xxx_list" in
10503     *$xxx_convert*) ;;
10504     *) xxx_list="$xxx_list $xxx_convert" ;;
10505     esac
10506 done
10507
10508 case "$d_longdbl$uselongdouble" in
10509 "$define$define")
10510     : again, add preferred functions to our list first
10511     xxx_ld_list=""
10512     for xxx_convert in $gconvert_ld_preference; do
10513         case $xxx_convert in
10514         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10515         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10516         esac
10517     done
10518     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10519     for xxx_convert in qgcvt sprintf $xxx_list; do
10520         case "$xxx_ld_list" in
10521         $xxx_convert*|*" $xxx_convert"*) ;;
10522         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10523         esac
10524     done
10525     : if sprintf cannot do long doubles, move it to the end
10526     if test "$d_PRIgldbl" != "$define"; then
10527         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10528     fi
10529     : if no qgcvt, remove it
10530     if test "$d_qgcvt" != "$define"; then
10531         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10532     fi
10533     : use the ld_list
10534     xxx_list="$xxx_ld_list"
10535     ;;
10536 esac
10537
10538 for xxx_convert in $xxx_list; do
10539         echo "Trying $xxx_convert..."
10540         $rm -f try try$_o core
10541         set try -DTRY_$xxx_convert
10542         if eval $compile; then
10543                 echo "$xxx_convert() found." >&4
10544                 if $run ./try; then
10545                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10546                         break;
10547                 else
10548                         echo "...But $xxx_convert didn't work as I expected."
10549                         xxx_convert=''
10550                 fi
10551         else
10552                 echo "$xxx_convert NOT found." >&4
10553         fi
10554 done
10555
10556 if test X$xxx_convert = X; then
10557     echo "*** WHOA THERE!!! ***" >&4
10558     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10559     xxx_convert=sprintf
10560 fi
10561
10562 case "$xxx_convert" in
10563 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10564 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10565 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10566 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10567    "$define$define$define")
10568       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10569    "$define$define$undef")
10570       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10571    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10572    esac
10573    ;;
10574 esac
10575
10576 fi
10577 $rm_try
10578
10579 : see if _fwalk exists
10580 set fwalk d__fwalk
10581 eval $inlibc
10582
10583 : Initialize h_fcntl
10584 h_fcntl=false
10585
10586 : Initialize h_sysfile
10587 h_sysfile=false
10588
10589 : access call always available on UNIX
10590 set access d_access
10591 eval $inlibc
10592
10593 : locate the flags for 'access()'
10594 case "$d_access" in
10595 "$define")
10596         echo " "
10597         $cat >access.c <<EOCP
10598 #include <sys/types.h>
10599 #ifdef I_FCNTL
10600 #include <fcntl.h>
10601 #endif
10602 #ifdef I_SYS_FILE
10603 #include <sys/file.h>
10604 #endif
10605 #ifdef I_UNISTD
10606 #include <unistd.h>
10607 #endif
10608 #$i_stdlib I_STDLIB
10609 #ifdef I_STDLIB
10610 #include <stdlib.h>
10611 #endif
10612 int main() {
10613         exit(R_OK);
10614 }
10615 EOCP
10616         : check sys/file.h first, no particular reason here
10617         if $test `./findhdr sys/file.h` && \
10618                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10619                 h_sysfile=true;
10620                 echo "<sys/file.h> defines the *_OK access constants." >&4
10621         elif $test `./findhdr fcntl.h` && \
10622                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10623                 h_fcntl=true;
10624                 echo "<fcntl.h> defines the *_OK access constants." >&4
10625         elif $test `./findhdr unistd.h` && \
10626                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10627                 echo "<unistd.h> defines the *_OK access constants." >&4
10628         else
10629                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10630         fi
10631         ;;
10632 esac
10633 $rm -f access*
10634
10635 : see if accessx exists
10636 set accessx d_accessx
10637 eval $inlibc
10638
10639 : see if acosh exists
10640 set acosh d_acosh
10641 eval $inlibc
10642
10643 : see if aintl exists
10644 set aintl d_aintl
10645 eval $inlibc
10646
10647 : see if alarm exists
10648 set alarm d_alarm
10649 eval $inlibc
10650
10651 : see if 64bit time functions exists
10652
10653 set ctime64 d_ctime64
10654 eval $inlibc
10655
10656 set localtime64 d_localtime64
10657 eval $inlibc
10658
10659 set gmtime64 d_gmtime64
10660 eval $inlibc
10661
10662 set mktime64 d_mktime64
10663 eval $inlibc
10664
10665 set difftime64 d_difftime64
10666 eval $inlibc
10667
10668 set asctime64 d_asctime64
10669 eval $inlibc
10670
10671 : see if POSIX threads are available
10672 set pthread.h i_pthread
10673 eval $inhdr
10674
10675 : define a function to check prototypes
10676 $cat > protochk <<EOSH
10677 $startsh
10678 cc="$cc"
10679 optimize="$optimize"
10680 ccflags="$ccflags"
10681 prototype="$prototype"
10682 define="$define"
10683 rm_try="$rm_try"
10684 usethreads=$usethreads
10685 i_pthread=$i_pthread
10686 pthread_h_first=$pthread_h_first
10687 EOSH
10688
10689 $cat >> protochk <<'EOSH'
10690
10691 $rm_try
10692 foo="$1"
10693 shift
10694 while test $# -ge 2; do
10695         case "$1" in
10696                 $define) echo "#include <$2>" >> try.c ;;
10697                 literal) echo "$2" >> try.c ;;
10698         esac
10699     # Extra magic for the benefit of systems that need pthread.h
10700     # to be included early to correctly detect threadsafe functions.
10701     # Such functions must guarantee themselves, though, that the usethreads
10702     # and i_pthread have been defined, before calling protochk.
10703     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10704         echo "#include <pthread.h>" >> try.c
10705         pthread_h_done=yes
10706     fi
10707     shift 2
10708 done
10709 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10710 cat >> try.c <<'EOCP'
10711 #ifdef CAN_PROTOTYPE
10712 #define _(args) args
10713 #else
10714 #define _(args) ()
10715 #endif
10716 EOCP
10717 echo "$foo" >> try.c
10718 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10719 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10720 status=$?
10721 $rm_try
10722 exit $status
10723 EOSH
10724 chmod +x protochk
10725 $eunicefix protochk
10726
10727 : Define hasproto macro for Configure internal use
10728 hasproto='varname=$1; func=$2; shift; shift;
10729 while $test $# -ge 2; do
10730         case "$1" in
10731         $define) echo "#include <$2>";;
10732         esac ;
10733     shift 2;
10734 done > try.c;
10735 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10736 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10737         echo "$func() prototype found.";
10738         val="$define";
10739 else
10740         echo "$func() prototype NOT found.";
10741         val="$undef";
10742 fi;
10743 set $varname;
10744 eval $setvar;
10745 $rm_try tryout.c'
10746
10747 : see if sys/types.h has to be included
10748 set sys/types.h i_systypes
10749 eval $inhdr
10750
10751 : see if sys/select.h has to be included
10752 set sys/select.h i_sysselct
10753 eval $inhdr
10754
10755 : Define hasfield macro for Configure internal use
10756 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10757 while $test $# -ge 2; do
10758         case "$1" in
10759         $define) echo "#include <$2>";;
10760         esac ;
10761     shift 2;
10762 done > try.c;
10763 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10764 set try;
10765 if eval $compile; then
10766         val="$define";
10767 else
10768         val="$undef";
10769 fi;
10770 set $varname;
10771 eval $setvar;
10772 $rm_try'
10773
10774 : see if we should include time.h, sys/time.h, or both
10775 echo " "
10776 if test "X$timeincl" = X; then
10777         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10778         $echo $n "I'm now running the test program...$c"
10779         $cat >try.c <<EOCP
10780 #include <sys/types.h>
10781 #ifdef I_TIME
10782 #include <time.h>
10783 #endif
10784 #ifdef I_SYSTIME
10785 #ifdef SYSTIMEKERNEL
10786 #define KERNEL
10787 #endif
10788 #include <sys/time.h>
10789 #endif
10790 #ifdef I_SYSSELECT
10791 #include <sys/select.h>
10792 #endif
10793 #$i_stdlib I_STDLIB
10794 #ifdef I_STDLIB
10795 #include <stdlib.h>
10796 #endif
10797 int main()
10798 {
10799         struct tm foo;
10800 #ifdef S_TIMEVAL
10801         struct timeval bar;
10802 #endif
10803 #ifdef S_TIMEZONE
10804         struct timezone tzp;
10805 #endif
10806         if (foo.tm_sec == foo.tm_sec)
10807                 exit(0);
10808 #ifdef S_TIMEVAL
10809         if (bar.tv_sec == bar.tv_sec)
10810                 exit(0);
10811 #endif
10812         exit(1);
10813 }
10814 EOCP
10815         flags=''
10816         for s_timezone in '-DS_TIMEZONE' ''; do
10817         sysselect=''
10818         for s_timeval in '-DS_TIMEVAL' ''; do
10819         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10820         for i_time in '' '-DI_TIME'; do
10821         for i_systime in '-DI_SYSTIME' ''; do
10822                 case "$flags" in
10823                 '') $echo $n ".$c"
10824                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10825                         if eval $compile; then
10826                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10827                                 shift
10828                                 flags="$*"
10829                                 echo " "
10830                                 $echo $n "Succeeded with $flags$c"
10831                         fi
10832                         ;;
10833                 esac
10834         done
10835         done
10836         done
10837         done
10838         done
10839         timeincl=''
10840         echo " "
10841         case "$flags" in
10842         *SYSTIMEKERNEL*) i_systimek="$define"
10843                 timeincl=`./findhdr sys/time.h`
10844                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10845         *) i_systimek="$undef";;
10846         esac
10847         case "$flags" in
10848         *I_TIME*) i_time="$define"
10849                 timeincl=`./findhdr time.h`" $timeincl"
10850                 echo "We'll include <time.h>." >&4;;
10851         *) i_time="$undef";;
10852         esac
10853         case "$flags" in
10854         *I_SYSTIME*) i_systime="$define"
10855                 timeincl=`./findhdr sys/time.h`" $timeincl"
10856                 echo "We'll include <sys/time.h>." >&4;;
10857         *) i_systime="$undef";;
10858         esac
10859         $rm_try
10860 fi
10861 : see if struct tm knows about tm_zone
10862 case "$i_systime$i_time" in
10863 *$define*)
10864         echo " "
10865         echo "Checking to see if your struct tm has tm_zone field..." >&4
10866         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10867         eval $hasfield
10868         ;;
10869 *)      val="$undef"
10870         set d_tm_tm_zone
10871         eval $setvar
10872         ;;
10873 esac
10874 case "$d_tm_tm_zone" in
10875 "$define")      echo "Yes, it does."   ;;
10876 *)              echo "No, it doesn't." ;;
10877 esac
10878 : see if struct tm knows about tm_gmtoff
10879 case "$i_systime$i_time" in
10880 *$define*)
10881         echo " "
10882         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10883         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10884         eval $hasfield
10885         ;;
10886 *)      val="$undef"
10887         set d_tm_tm_gmtoff
10888         eval $setvar
10889         ;;
10890 esac
10891 case "$d_tm_tm_gmtoff" in
10892 "$define")      echo "Yes, it does."   ;;
10893 *)              echo "No, it doesn't." ;;
10894 esac
10895
10896 : see if asctime_r exists
10897 set asctime_r d_asctime_r
10898 eval $inlibc
10899 case "$d_asctime_r" in
10900 "$define")
10901         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10902         case "$d_asctime_r_proto:$usethreads" in
10903         ":define")      d_asctime_r_proto=define
10904                 set d_asctime_r_proto asctime_r $hdrs
10905                 eval $hasproto ;;
10906         *)      ;;
10907         esac
10908         case "$d_asctime_r_proto" in
10909         define)
10910         case "$asctime_r_proto" in
10911         ''|0) try='char* asctime_r(const struct tm*, char*);'
10912         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10913         esac
10914         case "$asctime_r_proto" in
10915         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10916         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10917         esac
10918         case "$asctime_r_proto" in
10919         ''|0) try='int asctime_r(const struct tm*, char*);'
10920         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10921         esac
10922         case "$asctime_r_proto" in
10923         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10924         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10925         esac
10926         case "$asctime_r_proto" in
10927         ''|0)   d_asctime_r=undef
10928                 asctime_r_proto=0
10929                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10930         * )     case "$asctime_r_proto" in
10931                 REENTRANT_PROTO*) ;;
10932                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10933                 esac
10934                 echo "Prototype: $try" ;;
10935         esac
10936         ;;
10937         *)      case "$usethreads" in
10938                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10939                 esac
10940                 d_asctime_r=undef
10941                 asctime_r_proto=0
10942                 ;;
10943         esac
10944         ;;
10945 *)      asctime_r_proto=0
10946         ;;
10947 esac
10948
10949 : see if asinh exists
10950 set asinh d_asinh
10951 eval $inlibc
10952
10953 : see if atanh exists
10954 set atanh d_atanh
10955 eval $inlibc
10956
10957 : see if atolf exists
10958 set atolf d_atolf
10959 eval $inlibc
10960
10961 : see if atoll exists
10962 set atoll d_atoll
10963 eval $inlibc
10964
10965 : Look for GCC-style attribute format
10966 case "$d_attribute_format" in
10967 '')
10968 echo " "
10969 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10970 $cat >attrib.c <<'EOCP'
10971 #include <stdio.h>
10972 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10973 EOCP
10974 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10975         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10976                 echo "Your C compiler doesn't support __attribute__((format))."
10977                 val="$undef"
10978         else
10979                 echo "Your C compiler supports __attribute__((format))."
10980                 val="$define"
10981         fi
10982 else
10983         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10984         val="$undef"
10985 fi
10986 ;;
10987 *) val="$d_attribute_format" ;;
10988 esac
10989 set d_attribute_format
10990 eval $setvar
10991 $rm -f attrib*
10992
10993 : Look for GCC-style attribute format with null format allowed
10994 case "$d_printf_format_null" in
10995 '') case "$d_attribute_format" in
10996     $define)
10997         echo " "
10998         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10999 $cat >attrib.c <<EOCP
11000 #include <stdio.h>
11001 #$i_stdlib I_STDLIB
11002 #ifdef I_STDLIB
11003 #include <stdlib.h>
11004 #endif
11005 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11006 int null_printf (char* pat,...) { return (int)pat; }
11007 int main () { exit(null_printf(NULL)); }
11008 EOCP
11009         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11010             : run the executable in case it produces a run-time warning
11011             if $run ./attrib >>attrib.out 2>&1; then
11012                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11013                     echo "Your C compiler doesn't allow __printf__ format to be null."
11014                     val="$undef"
11015                 else
11016                     echo "Your C compiler allows __printf__ format to be null."
11017                     val="$define"
11018                 fi
11019             else
11020             echo "Your C compiler executable failed with __printf__ format null."
11021             val="$undef"
11022         fi
11023     else
11024         echo "Your C compiler fails with __printf__ format null."
11025         val="$undef"
11026     fi
11027     ;;
11028     *)  val="$undef" ;;
11029     esac
11030 ;;
11031 *)  val="$d_printf_format_null" ;;
11032 esac
11033 set d_printf_format_null
11034 eval $setvar
11035 $rm -f attrib*
11036
11037 : Look for GCC-style attribute malloc
11038 case "$d_attribute_malloc" in
11039 '')
11040 echo " "
11041 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11042 $cat >attrib.c <<'EOCP'
11043 #include <stdio.h>
11044 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11045 EOCP
11046 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11047         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11048                 echo "Your C compiler doesn't support __attribute__((malloc))."
11049                 val="$undef"
11050         else
11051                 echo "Your C compiler supports __attribute__((malloc))."
11052                 val="$define"
11053         fi
11054 else
11055         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11056         val="$undef"
11057 fi
11058 ;;
11059 *) val="$d_attribute_malloc" ;;
11060 esac
11061 set d_attribute_malloc
11062 eval $setvar
11063 $rm -f attrib*
11064
11065 : Look for GCC-style attribute nonnull
11066 case "$d_attribute_nonnull" in
11067 '')
11068 echo " "
11069 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11070 $cat >attrib.c <<'EOCP'
11071 #include <stdio.h>
11072 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11073 EOCP
11074 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11075         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11076                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11077                 val="$undef"
11078         else
11079                 echo "Your C compiler supports __attribute__((nonnull))."
11080                 val="$define"
11081         fi
11082 else
11083         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11084         val="$undef"
11085 fi
11086 ;;
11087 *) val="$d_attribute_nonnull" ;;
11088 esac
11089 set d_attribute_nonnull
11090 eval $setvar
11091 $rm -f attrib*
11092
11093 : Look for GCC-style attribute noreturn
11094 case "$d_attribute_noreturn" in
11095 '')
11096 echo " "
11097 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11098 $cat >attrib.c <<'EOCP'
11099 #include <stdio.h>
11100 void fall_over_dead( void ) __attribute__((noreturn));
11101 EOCP
11102 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11103         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11104                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11105                 val="$undef"
11106         else
11107                 echo "Your C compiler supports __attribute__((noreturn))."
11108                 val="$define"
11109         fi
11110 else
11111         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11112         val="$undef"
11113 fi
11114 ;;
11115 *) val="$d_attribute_noreturn" ;;
11116 esac
11117 set d_attribute_noreturn
11118 eval $setvar
11119 $rm -f attrib*
11120
11121 : Look for GCC-style attribute pure
11122 case "$d_attribute_pure" in
11123 '')
11124 echo " "
11125 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11126 $cat >attrib.c <<'EOCP'
11127 #include <stdio.h>
11128 int square( int n ) __attribute__((pure));
11129 EOCP
11130 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11131         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11132                 echo "Your C compiler doesn't support __attribute__((pure))."
11133                 val="$undef"
11134         else
11135                 echo "Your C compiler supports __attribute__((pure))."
11136                 val="$define"
11137         fi
11138 else
11139         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11140         val="$undef"
11141 fi
11142 ;;
11143 *) val="$d_attribute_pure" ;;
11144 esac
11145 set d_attribute_pure
11146 eval $setvar
11147 $rm -f attrib*
11148
11149 : Look for GCC-style attribute unused
11150 case "$d_attribute_unused" in
11151 '')
11152 echo " "
11153 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11154 $cat >attrib.c <<'EOCP'
11155 #include <stdio.h>
11156 int do_something( int dummy __attribute__((unused)), int n );
11157 EOCP
11158 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11159         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11160                 echo "Your C compiler doesn't support __attribute__((unused))."
11161                 val="$undef"
11162         else
11163                 echo "Your C compiler supports __attribute__((unused))."
11164                 val="$define"
11165         fi
11166 else
11167         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11168         val="$undef"
11169 fi
11170 ;;
11171 *) val="$d_attribute_unused" ;;
11172 esac
11173 set d_attribute_unused
11174 eval $setvar
11175 $rm -f attrib*
11176
11177 : Look for GCC-style attribute deprecated
11178 case "$d_attribute_deprecated" in
11179 '')
11180 echo " "
11181 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11182 $cat >attrib.c <<'EOCP'
11183 #include <stdio.h>
11184 int I_am_deprecated(void) __attribute__((deprecated));
11185 EOCP
11186 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11187         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11188                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11189                 val="$undef"
11190         else
11191                 echo "Your C compiler supports __attribute__((deprecated))."
11192                 val="$define"
11193         fi
11194 else
11195         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11196         val="$undef"
11197 fi
11198 ;;
11199 *) val="$d_attribute_deprecated" ;;
11200 esac
11201 set d_attribute_deprecated
11202 eval $setvar
11203 $rm -f attrib*
11204
11205 : Look for GCC-style attribute warn_unused_result
11206 case "$d_attribute_warn_unused_result" in
11207 '')
11208 echo " "
11209 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11210 $cat >attrib.c <<'EOCP'
11211 #include <stdio.h>
11212 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11213 EOCP
11214 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11215         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11216                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11217                 val="$undef"
11218         else
11219                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11220                 val="$define"
11221         fi
11222 else
11223         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11224         val="$undef"
11225 fi
11226 ;;
11227 *) val="$d_attribute_warn_unused_result" ;;
11228 esac
11229 set d_attribute_warn_unused_result
11230 eval $setvar
11231 $rm -f attrib*
11232
11233 : see if bcmp exists
11234 set bcmp d_bcmp
11235 eval $inlibc
11236
11237 : see if bcopy exists
11238 set bcopy d_bcopy
11239 eval $inlibc
11240
11241 : see if getpgrp exists
11242 set getpgrp d_getpgrp
11243 eval $inlibc
11244
11245 case "$d_getpgrp" in
11246 "$define")
11247         echo " "
11248         echo "Checking to see which flavor of getpgrp is in use..."
11249         $cat >try.c <<EOP
11250 #$i_unistd I_UNISTD
11251 #include <sys/types.h>
11252 #ifdef I_UNISTD
11253 #  include <unistd.h>
11254 #endif
11255 #$i_stdlib I_STDLIB
11256 #ifdef I_STDLIB
11257 #include <stdlib.h>
11258 #endif
11259 int main()
11260 {
11261         if (getuid() == 0) {
11262                 printf("(I see you are running Configure as super-user...)\n");
11263                 setuid(1);
11264         }
11265 #ifdef TRY_BSD_PGRP
11266         if (getpgrp(1) == 0)
11267                 exit(0);
11268 #else
11269         if (getpgrp() > 0)
11270                 exit(0);
11271 #endif
11272         exit(1);
11273 }
11274 EOP
11275         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11276                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11277                 val="$define"
11278         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11279                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11280                 val="$undef"
11281         else
11282                 echo "I can't seem to compile and run the test program."
11283                 if ./usg; then
11284                         xxx="a USG one, i.e. you use getpgrp()."
11285                 else
11286                         # SVR4 systems can appear rather BSD-ish.
11287                         case "$i_unistd" in
11288                         $undef)
11289                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11290                                 val="$define"
11291                                 ;;
11292                         $define)
11293                                 xxx="probably a USG one, i.e. you use getpgrp()."
11294                                 val="$undef"
11295                                 ;;
11296                         esac
11297                 fi
11298                 echo "Assuming your getpgrp is $xxx" >&4
11299         fi
11300         ;;
11301 *) val="$undef";;
11302 esac
11303 set d_bsdgetpgrp
11304 eval $setvar
11305 $rm_try
11306
11307 : see if setpgrp exists
11308 set setpgrp d_setpgrp
11309 eval $inlibc
11310
11311 case "$d_setpgrp" in
11312 "$define")
11313         echo " "
11314         echo "Checking to see which flavor of setpgrp is in use..."
11315         $cat >try.c <<EOP
11316 #$i_unistd I_UNISTD
11317 #include <sys/types.h>
11318 #ifdef I_UNISTD
11319 #  include <unistd.h>
11320 #endif
11321 #$i_stdlib I_STDLIB
11322 #ifdef I_STDLIB
11323 #include <stdlib.h>
11324 #endif
11325 int main()
11326 {
11327         if (getuid() == 0) {
11328                 printf("(I see you are running Configure as super-user...)\n");
11329                 setuid(1);
11330         }
11331 #ifdef TRY_BSD_PGRP
11332         if (-1 == setpgrp(1, 1))
11333                 exit(0);
11334 #else
11335         if (setpgrp() != -1)
11336                 exit(0);
11337 #endif
11338         exit(1);
11339 }
11340 EOP
11341         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11342                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11343                 val="$define"
11344         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11345                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11346                 val="$undef"
11347         else
11348                 echo "(I can't seem to compile and run the test program.)"
11349                 if ./usg; then
11350                         xxx="a USG one, i.e. you use setpgrp()."
11351                 else
11352                         # SVR4 systems can appear rather BSD-ish.
11353                         case "$i_unistd" in
11354                         $undef)
11355                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11356                                 val="$define"
11357                                 ;;
11358                         $define)
11359                                 xxx="probably a USG one, i.e. you use setpgrp()."
11360                                 val="$undef"
11361                                 ;;
11362                         esac
11363                 fi
11364                 echo "Assuming your setpgrp is $xxx" >&4
11365         fi
11366         ;;
11367 *) val="$undef";;
11368 esac
11369 set d_bsdsetpgrp
11370 eval $setvar
11371 $rm_try
11372
11373 : Look for GCC-style __builtin_choose_expr
11374 case "$d_builtin_choose_expr" in
11375 '')
11376     echo " "
11377     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11378     $cat >try.c <<'EOCP'
11379 #include <assert.h>
11380 #include <stdlib.h>
11381 #include <stdio.h>
11382
11383 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11384
11385 int main(void) {
11386     assert( SYRINX(1) == 2112 );
11387     assert( SYRINX(1) != 5150 );
11388     assert( SYRINX(0) == 5150 );
11389     assert( SYRINX(0) != 2112 );
11390     puts( "All good!" );
11391     exit(0);
11392 }
11393
11394 EOCP
11395     set try
11396     if eval $compile && $run ./try; then
11397         echo "Your C compiler supports __builtin_choose_expr."
11398         val="$define"
11399     else
11400         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11401         val="$undef"
11402     fi
11403 ;;
11404 *) val="$d_builtin_choose_expr" ;;
11405 esac
11406
11407 set d_builtin_choose_expr
11408 eval $setvar
11409 $rm_try
11410
11411 : Look for GCC-style __builtin_expect
11412 case "$d_builtin_expect" in
11413 '')
11414     echo " "
11415     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11416     $cat >try.c <<'EOCP'
11417 int main(void) {
11418     int n = 50;
11419     if ( __builtin_expect(n, 0) ) n = 1;
11420     /* Remember shell exit code truth is 0, C truth is non-zero */
11421     return !(n == 1);
11422 }
11423 EOCP
11424     set try
11425     if eval $compile && $run ./try; then
11426         echo "Your C compiler supports __builtin_expect."
11427         val="$define"
11428     else
11429         echo "Your C compiler doesn't seem to understand __builtin_expect."
11430         val="$undef"
11431     fi
11432     ;;
11433 *) val="$d_builtin_expect" ;;
11434 esac
11435
11436 set d_builtin_expect
11437 eval $setvar
11438 $rm_try
11439
11440 : see if bzero exists
11441 set bzero d_bzero
11442 eval $inlibc
11443
11444 : see if stdarg is available
11445 echo " "
11446 if $test `./findhdr stdarg.h`; then
11447         echo "<stdarg.h> found." >&4
11448         valstd="$define"
11449 else
11450         echo "<stdarg.h> NOT found." >&4
11451         valstd="$undef"
11452 fi
11453
11454 : see if varargs is available
11455 echo " "
11456 if $test `./findhdr varargs.h`; then
11457         echo "<varargs.h> found." >&4
11458 else
11459         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11460 fi
11461
11462 : set up the varargs testing programs
11463 $cat > varargs.c <<EOP
11464 #ifdef I_STDARG
11465 #include <stdarg.h>
11466 #endif
11467 #ifdef I_VARARGS
11468 #include <varargs.h>
11469 #endif
11470
11471 #ifdef I_STDARG
11472 int f(char *p, ...)
11473 #else
11474 int f(va_alist)
11475 va_dcl
11476 #endif
11477 {
11478         va_list ap;
11479 #ifndef I_STDARG
11480         char *p;
11481 #endif
11482 #ifdef I_STDARG
11483         va_start(ap,p);
11484 #else
11485         va_start(ap);
11486         p = va_arg(ap, char *);
11487 #endif
11488         va_end(ap);
11489         return 0;
11490 }
11491 EOP
11492 $cat > varargs <<EOP
11493 $startsh
11494 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11495         echo "true"
11496 else
11497         echo "false"
11498 fi
11499 $rm -f varargs$_o
11500 EOP
11501 chmod +x varargs
11502
11503 : now check which varargs header should be included
11504 echo " "
11505 i_varhdr=''
11506 val=''
11507 case "$valstd" in
11508 "$define")
11509         if `./varargs I_STDARG`; then
11510                 val='stdarg.h'
11511         elif `./varargs I_VARARGS`; then
11512                 val='varargs.h'
11513         fi
11514         ;;
11515 *)
11516         if `./varargs I_VARARGS`; then
11517                 val='varargs.h'
11518         fi
11519         ;;
11520 esac
11521 case "$val" in
11522 '')
11523         echo " "
11524         echo "*** WHOA THERE!!! ***" >&4
11525         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11526         case "$knowitall" in
11527         '')
11528         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11529                 exit 1
11530                 ;;
11531         esac
11532 echo "I could not find the definition for va_dcl... You have problems..." >&4
11533         val="$undef"; set i_stdarg; eval $setvar
11534         val="$undef"; set i_varargs; eval $setvar
11535         ;;
11536 *)
11537         set i_varhdr
11538         eval $setvar
11539         case "$i_varhdr" in
11540         stdarg.h)
11541                 val="$define"; set i_stdarg; eval $setvar
11542                 val="$undef"; set i_varargs; eval $setvar
11543                 ;;
11544         varargs.h)
11545                 val="$undef"; set i_stdarg; eval $setvar
11546                 val="$define"; set i_varargs; eval $setvar
11547                 ;;
11548         esac
11549         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11550 esac
11551 $rm -f varargs*
11552
11553 : see if the Compiler supports C99 variadic macros
11554 case "$i_stdarg$i_stdlib" in
11555     "$define$define")
11556     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11557     $cat >try.c <<EOCP
11558 #include <stdio.h>
11559 #include <stdarg.h>
11560
11561 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11562
11563 int main() {
11564   char buf[20];
11565   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11566   puts(buf);
11567   return 0;
11568 }
11569 EOCP
11570     set try
11571     if eval $compile && $run ./try 2>&1 >/dev/null; then
11572         case "`$run ./try`" in
11573             "123 456 789")
11574             echo "You have C99 variadic macros." >&4
11575             d_c99_variadic_macros="$define"
11576             ;;
11577             *)
11578             echo "You don't have functional C99 variadic macros." >&4
11579             d_c99_variadic_macros="$undef"
11580             ;;
11581         esac
11582     else
11583         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11584         d_c99_variadic_macros="$undef"
11585     fi
11586     $rm_try
11587     ;;
11588     *)
11589     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11590     d_c99_variadic_macros="$undef"
11591     ;;
11592 esac
11593
11594 : see if signal is declared as pointer to function returning int or void
11595 echo " "
11596 xxx=`./findhdr signal.h`
11597 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11598 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11599         echo "You have int (*signal())() instead of void." >&4
11600         val="$undef"
11601 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11602         echo "You have void (*signal())()." >&4
11603         val="$define"
11604 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11605         echo "You have int (*signal())() instead of void." >&4
11606         val="$undef"
11607 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11608         echo "You have void (*signal())()." >&4
11609         val="$define"
11610 else
11611         case "$d_voidsig" in
11612         '')
11613         echo "I can't determine whether signal handler returns void or int..." >&4
11614                 dflt=void
11615                 rp="What type does your signal handler return?"
11616                 . ./myread
11617                 case "$ans" in
11618                 v*) val="$define";;
11619                 *) val="$undef";;
11620                 esac;;
11621         "$define")
11622                 echo "As you already told me, signal handler returns void." >&4
11623                 val="$define"
11624                 ;;
11625         *)      echo "As you already told me, signal handler returns int." >&4
11626                 val="$undef"
11627                 ;;
11628         esac
11629 fi
11630 set d_voidsig
11631 eval $setvar
11632 case "$d_voidsig" in
11633 "$define") signal_t="void";;
11634 *) signal_t="int";;
11635 esac
11636 $rm -f $$.tmp
11637
11638 : check for ability to cast large floats to 32-bit ints.
11639 echo " "
11640 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11641 if $test "$intsize" -ge 4; then
11642         xxx=int
11643 else
11644         xxx=long
11645 fi
11646 $cat >try.c <<EOCP
11647 #include <stdio.h>
11648 #$i_stdlib I_STDLIB
11649 #ifdef I_STDLIB
11650 #include <stdlib.h>
11651 #endif
11652 #include <sys/types.h>
11653 #include <signal.h>
11654 $signal_t blech(int s) { exit(3); }
11655 int main()
11656 {
11657         $xxx i32;
11658         double f, g;
11659         int result = 0;
11660         char str[16];
11661         signal(SIGFPE, blech);
11662
11663         /* Don't let compiler optimize the test away.  Store the number
11664            in a writable string for gcc to pass to sscanf under HP-UX.
11665         */
11666         sprintf(str, "2147483647");
11667         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11668         g = 10 * f;
11669         i32  = ($xxx) g;
11670
11671         /* x86 processors will probably give 0x8000 0000, which is a
11672            sign change.  We don't want that.  We want to mimic SPARC
11673            behavior here, which is to preserve the sign and give
11674            back 0x7fff ffff.
11675         */
11676         if (i32 != ($xxx) f)
11677                 result |= 1;
11678         exit(result);
11679 }
11680 EOCP
11681 set try
11682 if eval $compile_ok; then
11683         $run ./try 2>/dev/null
11684         yyy=$?
11685 else
11686         echo "(I can't seem to compile the test program--assuming it can't)"
11687         yyy=1
11688 fi
11689 case "$yyy" in
11690 0)      val="$define"
11691         echo "Yup, it can."
11692         ;;
11693 *)      val="$undef"
11694         echo "Nope, it can't."
11695         ;;
11696 esac
11697 set d_casti32
11698 eval $setvar
11699 $rm_try
11700
11701 : check for ability to cast negative floats to unsigned
11702 echo " "
11703 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11704 $cat >try.c <<EOCP
11705 #include <stdio.h>
11706 #$i_stdlib I_STDLIB
11707 #ifdef I_STDLIB
11708 #include <stdlib.h>
11709 #endif
11710 #include <sys/types.h>
11711 #include <signal.h>
11712 $signal_t blech(int s) { exit(7); }
11713 $signal_t blech_in_list(int s) { exit(4); }
11714 unsigned long dummy_long(unsigned long p) { return p; }
11715 unsigned int dummy_int(unsigned int p) { return p; }
11716 unsigned short dummy_short(unsigned short p) { return p; }
11717 int main()
11718 {
11719         double f;
11720         unsigned long along;
11721         unsigned int aint;
11722         unsigned short ashort;
11723         int result = 0;
11724         char str[16];
11725
11726         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11727            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11728            optimized the whole file away
11729         */
11730         /* Store the number in a writable string for gcc to pass to
11731            sscanf under HP-UX.
11732         */
11733         sprintf(str, "-123");
11734         sscanf(str, "%lf", &f);  /* f = -123.; */
11735
11736         signal(SIGFPE, blech);
11737         along = (unsigned long)f;
11738         aint = (unsigned int)f;
11739         ashort = (unsigned short)f;
11740         if (along != (unsigned long)-123)
11741                 result |= 1;
11742         if (aint != (unsigned int)-123)
11743                 result |= 1;
11744         if (ashort != (unsigned short)-123)
11745                 result |= 1;
11746         sprintf(str, "1073741824.");
11747         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11748         f = f + f;
11749         along = 0;
11750         along = (unsigned long)f;
11751         if (along != 0x80000000)
11752                 result |= 2;
11753         f -= 1.;
11754         along = 0;
11755         along = (unsigned long)f;
11756         if (along != 0x7fffffff)
11757                 result |= 1;
11758         f += 2.;
11759         along = 0;
11760         along = (unsigned long)f;
11761         if (along != 0x80000001)
11762                 result |= 2;
11763         if (result)
11764                 exit(result);
11765         signal(SIGFPE, blech_in_list);
11766         sprintf(str, "123.");
11767         sscanf(str, "%lf", &f);  /* f = 123.; */
11768         along = dummy_long((unsigned long)f);
11769         aint = dummy_int((unsigned int)f);
11770         ashort = dummy_short((unsigned short)f);
11771         if (along != (unsigned long)123)
11772                 result |= 4;
11773         if (aint != (unsigned int)123)
11774                 result |= 4;
11775         if (ashort != (unsigned short)123)
11776                 result |= 4;
11777         exit(result);
11778
11779 }
11780 EOCP
11781 set try
11782 if eval $compile_ok; then
11783         $run ./try 2>/dev/null
11784         castflags=$?
11785 else
11786         echo "(I can't seem to compile the test program--assuming it can't)"
11787         castflags=7
11788 fi
11789 case "$castflags" in
11790 0)      val="$define"
11791         echo "Yup, it can."
11792         ;;
11793 *)      val="$undef"
11794         echo "Nope, it can't."
11795         ;;
11796 esac
11797 set d_castneg
11798 eval $setvar
11799 $rm_try
11800
11801 : see if cbrt exists
11802 set cbrt d_cbrt
11803 eval $inlibc
11804
11805 : see if vprintf exists
11806 echo " "
11807 if set vprintf val -f d_vprintf; eval $csym; $val; then
11808         echo 'vprintf() found.' >&4
11809         val="$define"
11810         $cat >try.c <<EOF
11811 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11812 #$i_varargs I_VARARGS
11813
11814 #$i_stdlib I_STDLIB
11815 #$i_unistd I_UNISTD
11816
11817 #ifdef I_STDARG
11818 #  include <stdarg.h>
11819 #else /* I_VARARGS */
11820 #  include <varargs.h>
11821 #endif
11822
11823 #ifdef I_UNISTD
11824 #  include <unistd.h>
11825 #endif
11826
11827 #ifdef I_STDLIB
11828 #  include <stdlib.h>
11829 #endif
11830
11831 #include <stdio.h> /* vsprintf prototype */
11832
11833 #ifdef I_STDARG
11834 void xxx(int n, ...)
11835 {
11836     va_list args;
11837     char buf[10];
11838     va_start(args, n);
11839     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11840 }
11841 int main() { xxx(1, "foo"); }
11842
11843 #else /* I_VARARGS */
11844
11845 xxx(va_alist)
11846 va_dcl
11847 {
11848     va_list args;
11849     char buf[10];
11850     va_start(args);
11851     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11852 }
11853 int main() { xxx("foo"); }
11854
11855 #endif
11856
11857 EOF
11858         set try
11859         if eval $compile_ok; then
11860                 if $run ./try; then
11861                         echo "Your vsprintf() returns (int)." >&4
11862                         val2="$undef"
11863                 else
11864                         echo "Your vsprintf() returns (char*)." >&4
11865                         val2="$define"
11866                 fi
11867         else
11868                 echo 'I am unable to compile the vsprintf() test program.' >&4
11869                 # We shouldn't get here.  If we do, assume the standard signature,
11870                 # not the old BSD one.
11871                 echo 'Guessing that vsprintf() returns (int).' >&4
11872                 val2="$undef"
11873         fi
11874 else
11875         echo 'vprintf() NOT found.' >&4
11876         val="$undef"
11877         val2="$undef"
11878 fi
11879 $rm_try
11880 set d_vprintf
11881 eval $setvar
11882 val=$val2
11883 set d_charvspr
11884 eval $setvar
11885
11886 : see if chown exists
11887 set chown d_chown
11888 eval $inlibc
11889
11890 : see if chroot exists
11891 set chroot d_chroot
11892 eval $inlibc
11893
11894 : see if chsize exists
11895 set chsize d_chsize
11896 eval $inlibc
11897
11898 : see if class exists
11899 set class d_class
11900 eval $inlibc
11901
11902 : see if clearenv exists
11903 set clearenv d_clearenv
11904 eval $inlibc
11905
11906 : Define hasstruct macro for Configure internal use
11907 hasstruct='varname=$1; struct=$2; shift; shift;
11908 while $test $# -ge 2; do
11909         case "$1" in
11910         $define) echo "#include <$2>";;
11911         esac ;
11912     shift 2;
11913 done > try.c;
11914 echo "int main () { struct $struct foo; }" >> try.c;
11915 set try;
11916 if eval $compile; then
11917         val="$define";
11918 else
11919         val="$undef";
11920 fi;
11921 set $varname;
11922 eval $setvar;
11923 $rm_try'
11924
11925 : see whether socket exists
11926 socketlib=''
11927 sockethdr=''
11928 echo " "
11929 $echo $n "Hmm... $c" >&4
11930 if set socket val -f d_socket; eval $csym; $val; then
11931     echo "Looks like you have Berkeley networking support." >&4
11932     d_socket="$define"
11933     if set setsockopt val -f; eval $csym; $val; then
11934         d_oldsock="$undef"
11935     else
11936         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11937         d_oldsock="$define"
11938     fi
11939 else
11940     if $contains socklib libc.list >/dev/null 2>&1; then
11941         echo "Looks like you have Berkeley networking support." >&4
11942         d_socket="$define"
11943         : we will have to assume that it supports the 4.2 BSD interface
11944         d_oldsock="$undef"
11945     else
11946         echo "You don't have Berkeley networking in libc$_a..." >&4
11947         if test "X$d_socket" = "X$define"; then
11948             echo "...but you seem to believe that you have sockets." >&4
11949         else
11950             for net in net socket
11951             do
11952                 if test -f $sysroot/usr/lib/lib$net$_a; then
11953                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11954                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11955                     if $contains socket libc.list >/dev/null 2>&1; then
11956                         d_socket="$define"
11957                         socketlib="-l$net"
11958                         case "$net" in
11959                         net)
11960                             echo "...but the Wollongong group seems to have hacked it in." >&4
11961                             sockethdr="-I$sysroot/usr/netinclude"
11962                             ;;
11963                         esac
11964                         echo "Found Berkeley sockets interface in lib$net." >&4
11965                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11966                             d_oldsock="$undef"
11967                         else
11968                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11969                             d_oldsock="$define"
11970                         fi
11971                         break
11972                     fi
11973                 fi
11974             done
11975             if test "X$d_socket" != "X$define"; then
11976                echo "or anywhere else I see." >&4
11977                d_socket="$undef"
11978                d_oldsock="$undef"
11979             fi
11980         fi
11981     fi
11982 fi
11983
11984 : see if socketpair exists
11985 set socketpair d_sockpair
11986 eval $inlibc
11987
11988
11989 echo " "
11990 echo "Checking the availability sa_len in the sock struct ..." >&4
11991 $cat >try.c <<EOF
11992 #include <sys/types.h>
11993 #include <sys/socket.h>
11994 int main() {
11995 struct sockaddr sa;
11996 return (sa.sa_len);
11997 }
11998 EOF
11999 val="$undef"
12000 set try; if eval $compile; then
12001     val="$define"
12002 fi
12003 set d_sockaddr_sa_len; eval $setvar
12004 $rm_try
12005
12006 echo " "
12007 echo "Checking the availability struct sockaddr_in6 ..." >&4
12008 $cat >try.c <<EOF
12009 #include <sys/types.h>
12010 #include <sys/socket.h>
12011 #include <netinet/in.h>
12012 int main() {
12013 struct sockaddr_in6 sin6;
12014 return (sin6.sin6_family);
12015 }
12016 EOF
12017 val="$undef"
12018 set try; if eval $compile; then
12019     val="$define"
12020 fi
12021 set d_sockaddr_in6; eval $setvar
12022 $rm_try
12023
12024 echo " "
12025 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12026 $cat >try.c <<EOF
12027 #include <sys/types.h>
12028 #include <sys/socket.h>
12029 #include <netinet/in.h>
12030 int main() {
12031 struct sockaddr_in6 sin6;
12032 return (sin6.sin6_scope_id);
12033 }
12034 EOF
12035 val="$undef"
12036 set try; if eval $compile; then
12037     val="$define"
12038 fi
12039 set d_sin6_scope_id; eval $setvar
12040 $rm_try
12041
12042 echo " "
12043 echo "Checking the availability struct ip_mreq ..." >&4
12044 $cat >try.c <<EOF
12045 #include <sys/types.h>
12046 #include <sys/socket.h>
12047 #include <netinet/in.h>
12048 int main() {
12049 struct ip_mreq mreq;
12050 return (mreq.imr_multiaddr.s_addr);
12051 }
12052 EOF
12053 val="$undef"
12054 set try; if eval $compile; then
12055        val="$define"
12056 fi
12057 set d_ip_mreq; eval $setvar
12058 $rm_try
12059
12060 echo " "
12061 echo "Checking the availability struct ip_mreq_source ..." >&4
12062 $cat >try.c <<EOF
12063 #include <sys/types.h>
12064 #include <sys/socket.h>
12065 #include <netinet/in.h>
12066 int main() {
12067 struct ip_mreq_source mreq;
12068 return (mreq.imr_multiaddr.s_addr);
12069 }
12070 EOF
12071 val="$undef"
12072 set try; if eval $compile; then
12073        val="$define"
12074 fi
12075 set d_ip_mreq_source; eval $setvar
12076 $rm_try
12077
12078 echo " "
12079 echo "Checking the availability struct ipv6_mreq ..." >&4
12080 $cat >try.c <<EOF
12081 #include <sys/types.h>
12082 #include <sys/socket.h>
12083 #include <netinet/in.h>
12084 int main() {
12085 struct ipv6_mreq mreq;
12086 return (mreq.ipv6mr_interface);
12087 }
12088 EOF
12089 val="$undef"
12090 set try; if eval $compile; then
12091     val="$define"
12092 fi
12093 set d_ipv6_mreq; eval $setvar
12094 $rm_try
12095
12096 echo " "
12097 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12098 $cat >try.c <<EOF
12099 #include <sys/types.h>
12100 #include <sys/socket.h>
12101 #include <netinet/in.h>
12102 int main() {
12103 struct ipv6_mreq_source mreq;
12104 return (mreq.imr_multiaddr.s_addr);
12105 }
12106 EOF
12107 val="$undef"
12108 set try; if eval $compile; then
12109        val="$define"
12110 fi
12111 set d_ipv6_mreq_source; eval $setvar
12112 $rm_try
12113
12114 echo " "
12115 echo "Checking the availability of certain socket constants..." >&4
12116 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12117     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12118     $cat >try.c <<EOF
12119 #include <sys/types.h>
12120 #include <sys/socket.h>
12121 int main() {
12122     int i = $ENUM;
12123 }
12124 EOF
12125     val="$undef"
12126     set try; if eval $compile; then
12127         val="$define"
12128     fi
12129     set d_${enum}; eval $setvar
12130     $rm_try
12131 done
12132
12133 : see if this is a sys/uio.h system
12134 set sys/uio.h i_sysuio
12135 eval $inhdr
12136
12137 : Check for cmsghdr support
12138 echo " "
12139 echo "Checking to see if your system supports struct cmsghdr..." >&4
12140 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12141 eval $hasstruct
12142 case "$d_cmsghdr_s" in
12143 "$define")      echo "Yes, it does."   ;;
12144 *)              echo "No, it doesn't." ;;
12145 esac
12146
12147
12148 : check for const keyword
12149 echo " "
12150 echo 'Checking to see if your C compiler knows about "const"...' >&4
12151 $cat >const.c <<'EOCP'
12152 typedef struct spug { int drokk; } spug;
12153 int main()
12154 {
12155         const char *foo;
12156         const spug y = { 0 };
12157 }
12158 EOCP
12159 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12160         val="$define"
12161         echo "Yup, it does."
12162 else
12163         val="$undef"
12164         echo "Nope, it doesn't."
12165 fi
12166 set d_const
12167 eval $setvar
12168
12169 : see if copysign exists
12170 set copysign d_copysign
12171 eval $inlibc
12172
12173 : see if copysignl exists
12174 set copysignl d_copysignl
12175 eval $inlibc
12176
12177 : see if crypt exists
12178 echo " "
12179 set crypt d_crypt
12180 eval $inlibc
12181 case "$d_crypt" in
12182 $define) cryptlib='' ;;
12183 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12184                 echo 'crypt() found.' >&4
12185                 val="$define"
12186                 cryptlib=''
12187         else
12188                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12189                 if $test -z "$cryptlib"; then
12190                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12191                 else
12192                         cryptlib=-lcrypt
12193                 fi
12194                 if $test -z "$cryptlib"; then
12195                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12196                 else
12197                         cryptlib=-lcrypt
12198                 fi
12199                 if $test -z "$cryptlib"; then
12200                         cryptlib=`./loc libcrypt$_a "" $libpth`
12201                 else
12202                         cryptlib=-lcrypt
12203                 fi
12204                 if $test -z "$cryptlib"; then
12205                         echo 'crypt() NOT found.' >&4
12206                         val="$undef"
12207                 else
12208                         val="$define"
12209                 fi
12210         fi
12211         set d_crypt
12212         eval $setvar
12213         ;;
12214 esac
12215
12216 : see if this is a crypt.h system
12217 set crypt.h i_crypt
12218 eval $inhdr
12219
12220 : see if crypt_r exists
12221 set crypt_r d_crypt_r
12222 eval $inlibc
12223 case "$d_crypt_r" in
12224 "$define")
12225         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12226         case "$d_crypt_r_proto:$usethreads" in
12227         ":define")      d_crypt_r_proto=define
12228                 set d_crypt_r_proto crypt_r $hdrs
12229                 eval $hasproto ;;
12230         *)      ;;
12231         esac
12232         case "$d_crypt_r_proto" in
12233         define)
12234         case "$crypt_r_proto" in
12235         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12236         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12237         esac
12238         case "$crypt_r_proto" in
12239         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12240         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12241         esac
12242         case "$crypt_r_proto" in
12243         ''|0)   d_crypt_r=undef
12244                 crypt_r_proto=0
12245                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12246         * )     case "$crypt_r_proto" in
12247                 REENTRANT_PROTO*) ;;
12248                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12249                 esac
12250                 echo "Prototype: $try" ;;
12251         esac
12252         ;;
12253         *)      case "$usethreads" in
12254                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12255                 esac
12256                 d_crypt_r=undef
12257                 crypt_r_proto=0
12258                 ;;
12259         esac
12260         ;;
12261 *)      crypt_r_proto=0
12262         ;;
12263 esac
12264
12265 : get csh whereabouts
12266 case "$csh" in
12267 'csh') val="$undef" ;;
12268 *) val="$define" ;;
12269 esac
12270 set d_csh
12271 eval $setvar
12272 : Respect a hint or command line value for full_csh.
12273 case "$full_csh" in
12274 '') full_csh=$csh ;;
12275 esac
12276
12277 : see if ctermid exists
12278 set ctermid d_ctermid
12279 eval $inlibc
12280
12281 : see if ctermid_r exists
12282 set ctermid_r d_ctermid_r
12283 eval $inlibc
12284 case "$d_ctermid_r" in
12285 "$define")
12286         hdrs="$i_systypes sys/types.h define stdio.h "
12287         case "$d_ctermid_r_proto:$usethreads" in
12288         ":define")      d_ctermid_r_proto=define
12289                 set d_ctermid_r_proto ctermid_r $hdrs
12290                 eval $hasproto ;;
12291         *)      ;;
12292         esac
12293         case "$d_ctermid_r_proto" in
12294         define)
12295         case "$ctermid_r_proto" in
12296         ''|0) try='char* ctermid_r(char*);'
12297         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12298         esac
12299         case "$ctermid_r_proto" in
12300         ''|0)   d_ctermid_r=undef
12301                 ctermid_r_proto=0
12302                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12303         * )     case "$ctermid_r_proto" in
12304                 REENTRANT_PROTO*) ;;
12305                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12306                 esac
12307                 echo "Prototype: $try" ;;
12308         esac
12309         ;;
12310         *)      case "$usethreads" in
12311                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12312                 esac
12313                 d_ctermid_r=undef
12314                 ctermid_r_proto=0
12315                 ;;
12316         esac
12317         ;;
12318 *)      ctermid_r_proto=0
12319         ;;
12320 esac
12321
12322 : see if ctime_r exists
12323 set ctime_r d_ctime_r
12324 eval $inlibc
12325 case "$d_ctime_r" in
12326 "$define")
12327         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12328         case "$d_ctime_r_proto:$usethreads" in
12329         ":define")      d_ctime_r_proto=define
12330                 set d_ctime_r_proto ctime_r $hdrs
12331                 eval $hasproto ;;
12332         *)      ;;
12333         esac
12334         case "$d_ctime_r_proto" in
12335         define)
12336         case "$ctime_r_proto" in
12337         ''|0) try='char* ctime_r(const time_t*, char*);'
12338         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12339         esac
12340         case "$ctime_r_proto" in
12341         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12342         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12343         esac
12344         case "$ctime_r_proto" in
12345         ''|0) try='int ctime_r(const time_t*, char*);'
12346         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12347         esac
12348         case "$ctime_r_proto" in
12349         ''|0) try='int ctime_r(const time_t*, char*, int);'
12350         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12351         esac
12352         case "$ctime_r_proto" in
12353         ''|0)   d_ctime_r=undef
12354                 ctime_r_proto=0
12355                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12356         * )     case "$ctime_r_proto" in
12357                 REENTRANT_PROTO*) ;;
12358                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12359                 esac
12360                 echo "Prototype: $try" ;;
12361         esac
12362         ;;
12363         *)      case "$usethreads" in
12364                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12365                 esac
12366                 d_ctime_r=undef
12367                 ctime_r_proto=0
12368                 ;;
12369         esac
12370         ;;
12371 *)      ctime_r_proto=0
12372         ;;
12373 esac
12374
12375 : see if cuserid exists
12376 set cuserid d_cuserid
12377 eval $inlibc
12378
12379 : see if this is a limits.h system
12380 set limits.h i_limits
12381 eval $inhdr
12382
12383 : See if number of significant digits in a double precision number is known
12384 echo " "
12385 $cat >dbl_dig.c <<EOM
12386 #$i_limits I_LIMITS
12387 #$i_float I_FLOAT
12388 #ifdef I_LIMITS
12389 #include <limits.h>
12390 #endif
12391 #ifdef I_FLOAT
12392 #include <float.h>
12393 #endif
12394 #ifdef DBL_DIG
12395 printf("Contains DBL_DIG");
12396 #endif
12397 EOM
12398 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12399 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12400         echo "DBL_DIG found." >&4
12401         val="$define"
12402 else
12403         echo "DBL_DIG NOT found." >&4
12404         val="$undef"
12405 fi
12406 $rm -f dbl_dig.?
12407 set d_dbl_dig
12408 eval $setvar
12409
12410 : see if dbm.h is available
12411 : see if dbmclose exists
12412 set dbmclose d_dbmclose
12413 eval $inlibc
12414
12415 case "$d_dbmclose" in
12416 $define)
12417         set dbm.h i_dbm
12418         eval $inhdr
12419         case "$i_dbm" in
12420         $define)
12421                 val="$undef"
12422                 set i_rpcsvcdbm
12423                 eval $setvar
12424                 ;;
12425         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12426                 eval $inhdr
12427                 ;;
12428         esac
12429         ;;
12430 *)      echo "We won't be including <dbm.h>"
12431         val="$undef"
12432         set i_dbm
12433         eval $setvar
12434         val="$undef"
12435         set i_rpcsvcdbm
12436         eval $setvar
12437         ;;
12438 esac
12439
12440 : see if prototype for dbminit is available
12441 echo " "
12442 set d_dbminitproto dbminit $i_dbm dbm.h
12443 eval $hasproto
12444
12445 : see if difftime exists
12446 set difftime d_difftime
12447 eval $inlibc
12448
12449 : see if this is a dirent system
12450 echo " "
12451 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12452         val="$define"
12453         echo "<dirent.h> found." >&4
12454 else
12455         val="$undef"
12456         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12457                 echo "<sys/dir.h> found." >&4
12458                 echo " "
12459         else
12460                 xinc=`./findhdr sys/ndir.h`
12461         fi
12462         echo "<dirent.h> NOT found." >&4
12463 fi
12464 set i_dirent
12465 eval $setvar
12466
12467 : Look for type of directory structure.
12468 echo " "
12469 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12470
12471 case "$direntrytype" in
12472 ''|' ')
12473         case "$i_dirent" in
12474         $define) guess1='struct dirent' ;;
12475         *) guess1='struct direct'  ;;
12476         esac
12477         ;;
12478 *)      guess1="$direntrytype"
12479         ;;
12480 esac
12481
12482 case "$guess1" in
12483 'struct dirent') guess2='struct direct' ;;
12484 *) guess2='struct dirent' ;;
12485 esac
12486
12487 if $contains "$guess1" try.c >/dev/null 2>&1; then
12488         direntrytype="$guess1"
12489         echo "Your directory entries are $direntrytype." >&4
12490 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12491         direntrytype="$guess2"
12492         echo "Your directory entries seem to be $direntrytype." >&4
12493 else
12494         echo "I don't recognize your system's directory entries." >&4
12495         rp="What type is used for directory entries on this system?"
12496         dflt="$guess1"
12497         . ./myread
12498         direntrytype="$ans"
12499 fi
12500 $rm_try
12501
12502 : see if the directory entry stores field length
12503 echo " "
12504 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12505 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12506         echo "Good, your directory entry keeps length information in d_namlen." >&4
12507         val="$define"
12508 else
12509         echo "Your directory entry does not know about the d_namlen field." >&4
12510         val="$undef"
12511 fi
12512 set d_dirnamlen
12513 eval $setvar
12514 $rm_try
12515
12516 : Look for DIR.dd_fd
12517 case "$i_dirent" in
12518 "$define")
12519     echo "Checking to see if DIR has a dd_fd member variable" >&4
12520     $cat >try.c <<EOCP
12521 #$i_stdlib I_STDLIB
12522 #ifdef I_STDLIB
12523 #include <stdlib.h>
12524 #endif
12525 #include <dirent.h>
12526
12527 int main() {
12528     DIR dir;
12529     dir.dd_fd = 1;
12530     return 0;
12531 }
12532 EOCP
12533     val=$undef
12534     set try
12535     if eval $compile; then
12536         echo "Yes, it does."
12537         val="$define"
12538     else
12539         echo "No, it does not."
12540         val="$undef"
12541     fi
12542     ;;
12543 *)
12544     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12545     val="$undef"
12546     ;;
12547 esac
12548 set d_dir_dd_fd
12549 eval $setvar
12550 $rm_try
12551
12552 : see if this is an sysdir system
12553 set sys/dir.h i_sysdir
12554 eval $inhdr
12555
12556 : see if this is an sysndir system
12557 set sys/ndir.h i_sysndir
12558 eval $inhdr
12559
12560 : Look for dirfd
12561 echo " "
12562 $cat >dirfd.c <<EOM
12563 #include <stdio.h>
12564 #$i_stdlib I_STDLIB
12565 #ifdef I_STDLIB
12566 #include <stdlib.h>
12567 #endif
12568 #$i_dirent I_DIRENT             /**/
12569 #$i_sysdir I_SYS_DIR            /**/
12570 #$i_sysndir I_SYS_NDIR          /**/
12571 #$i_systypes I_SYS_TYPES        /**/
12572 #if defined(I_SYS_TYPES)
12573 #include <sys/types.h>
12574 #endif
12575 #if defined(I_DIRENT)
12576 #include <dirent.h>
12577 #else
12578 #ifdef I_SYS_NDIR
12579 #include <sys/ndir.h>
12580 #else
12581 #ifdef I_SYS_DIR
12582 #ifdef hp9000s500
12583 #include <ndir.h>       /* may be wrong in the future */
12584 #else
12585 #include <sys/dir.h>
12586 #endif
12587 #endif
12588 #endif
12589 #endif
12590 int main() {
12591         DIR *dirp = opendir(".");
12592         if (dirfd(dirp) >= 0)
12593                 exit(0);
12594         else
12595                 exit(1);
12596 }
12597 EOM
12598 val=$undef
12599 set dirfd
12600 if eval $compile; then
12601         val="$define"
12602 fi
12603 case "$val" in
12604 $define)        echo "dirfd() found." >&4       ;;
12605 *)              echo "dirfd() NOT found." >&4   ;;
12606 esac
12607 set d_dirfd
12608 eval $setvar
12609 $rm -f dirfd*
12610
12611 : see if dladdr exists
12612 set dladdr d_dladdr
12613 eval $inlibc
12614
12615 : see if dlerror exists
12616 xxx_runnm="$runnm"
12617 runnm=false
12618 set dlerror d_dlerror
12619 eval $inlibc
12620 runnm="$xxx_runnm"
12621
12622 : see if dlfcn is available
12623 set dlfcn.h i_dlfcn
12624 eval $inhdr
12625
12626 : Check what extension to use for shared libs
12627 case "$usedl" in
12628 $define|y|true)
12629         $cat << EOM
12630
12631 On a few systems, the dynamically loaded modules that perl generates and uses
12632 will need a different extension than shared libs. The default will probably
12633 be appropriate.
12634
12635 EOM
12636         case "$dlext" in
12637         '')     dflt="$so" ;;
12638         *)      dflt="$dlext" ;;
12639         esac
12640         rp='What is the extension of dynamically loaded modules'
12641         . ./myread
12642         dlext="$ans"
12643         ;;
12644 *)
12645         dlext="none"
12646         ;;
12647 esac
12648
12649 : Check if dlsym need a leading underscore
12650 echo " "
12651 val="$undef"
12652
12653 case "$dlsrc" in
12654 dl_dlopen.xs)
12655         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12656         $cat >dyna.c <<'EOM'
12657 fred () { }
12658 EOM
12659
12660 $cat >fred.c<<EOM
12661
12662 #include <stdio.h>
12663 #$i_stdlib I_STDLIB
12664 #ifdef I_STDLIB
12665 #include <stdlib.h>
12666 #endif
12667 #$i_dlfcn I_DLFCN
12668 #ifdef I_DLFCN
12669 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12670 #else
12671 #include <sys/types.h>
12672 #include <nlist.h>
12673 #include <link.h>
12674 #endif
12675
12676 extern int fred() ;
12677
12678 int main()
12679 {
12680     void * handle ;
12681     void * symbol ;
12682 #ifndef RTLD_LAZY
12683     int mode = 1 ;
12684 #else
12685     int mode = RTLD_LAZY ;
12686 #endif
12687     handle = dlopen("./dyna.$dlext", mode) ;
12688     if (handle == NULL) {
12689         printf ("1\n") ;
12690         fflush (stdout) ;
12691         exit(0);
12692     }
12693     symbol = dlsym(handle, "fred") ;
12694     if (symbol == NULL) {
12695         /* try putting a leading underscore */
12696         symbol = dlsym(handle, "_fred") ;
12697         if (symbol == NULL) {
12698             printf ("2\n") ;
12699             fflush (stdout) ;
12700             exit(0);
12701         }
12702         printf ("3\n") ;
12703     }
12704     else
12705         printf ("4\n") ;
12706     fflush (stdout) ;
12707     exit(0);
12708 }
12709 EOM
12710         : Call the object file tmp-dyna.o in case dlext=o.
12711         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12712                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12713                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12714                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12715                 xxx=`$run ./fred`
12716                 case $xxx in
12717                 1)      echo "Test program failed using dlopen." >&4
12718                         echo "Perhaps you should not use dynamic loading." >&4;;
12719                 2)      echo "Test program failed using dlsym." >&4
12720                         echo "Perhaps you should not use dynamic loading." >&4;;
12721                 3)      echo "dlsym needs a leading underscore" >&4
12722                         val="$define" ;;
12723                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12724                 esac
12725         else
12726                 echo "I can't compile and run the test program." >&4
12727                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12728         fi
12729         ;;
12730 esac
12731
12732 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12733
12734 set d_dlsymun
12735 eval $setvar
12736
12737 : see if drand48_r exists
12738 set drand48_r d_drand48_r
12739 eval $inlibc
12740 case "$d_drand48_r" in
12741 "$define")
12742         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12743         case "$d_drand48_r_proto:$usethreads" in
12744         ":define")      d_drand48_r_proto=define
12745                 set d_drand48_r_proto drand48_r $hdrs
12746                 eval $hasproto ;;
12747         *)      ;;
12748         esac
12749         case "$d_drand48_r_proto" in
12750         define)
12751         case "$drand48_r_proto" in
12752         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12753         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12754         esac
12755         case "$drand48_r_proto" in
12756         ''|0)   d_drand48_r=undef
12757                 drand48_r_proto=0
12758                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12759         * )     case "$drand48_r_proto" in
12760                 REENTRANT_PROTO*) ;;
12761                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12762                 esac
12763                 echo "Prototype: $try" ;;
12764         esac
12765         ;;
12766         *)      case "$usethreads" in
12767                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12768                 esac
12769                 d_drand48_r=undef
12770                 drand48_r_proto=0
12771                 ;;
12772         esac
12773         ;;
12774 *)      drand48_r_proto=0
12775         ;;
12776 esac
12777
12778 : see if prototype for drand48 is available
12779 echo " "
12780 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12781 eval $hasproto
12782
12783 : see if dup2 exists
12784 set dup2 d_dup2
12785 eval $inlibc
12786
12787 : see if eaccess exists
12788 set eaccess d_eaccess
12789 eval $inlibc
12790
12791 : see if endgrent exists
12792 set endgrent d_endgrent
12793 eval $inlibc
12794
12795 : see if this is an grp system
12796 set grp.h i_grp
12797 eval $inhdr
12798
12799 case "$i_grp" in
12800 $define)
12801         xxx=`./findhdr grp.h`
12802         $cppstdin $cppflags $cppminus < $xxx >$$.h
12803
12804         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12805                 val="$define"
12806         else
12807                 val="$undef"
12808         fi
12809         set d_grpasswd
12810         eval $setvar
12811
12812         $rm -f $$.h
12813         ;;
12814 *)
12815         val="$undef";
12816         set d_grpasswd; eval $setvar
12817         ;;
12818 esac
12819
12820 : see if endgrent_r exists
12821 set endgrent_r d_endgrent_r
12822 eval $inlibc
12823 case "$d_endgrent_r" in
12824 "$define")
12825         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12826         case "$d_endgrent_r_proto:$usethreads" in
12827         ":define")      d_endgrent_r_proto=define
12828                 set d_endgrent_r_proto endgrent_r $hdrs
12829                 eval $hasproto ;;
12830         *)      ;;
12831         esac
12832         case "$d_endgrent_r_proto" in
12833         define)
12834         case "$endgrent_r_proto" in
12835         ''|0) try='int endgrent_r(FILE**);'
12836         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12837         esac
12838         case "$endgrent_r_proto" in
12839         ''|0) try='void endgrent_r(FILE**);'
12840         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12841         esac
12842         case "$endgrent_r_proto" in
12843         ''|0)   d_endgrent_r=undef
12844                 endgrent_r_proto=0
12845                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12846         * )     case "$endgrent_r_proto" in
12847                 REENTRANT_PROTO*) ;;
12848                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12849                 esac
12850                 echo "Prototype: $try" ;;
12851         esac
12852         ;;
12853         *)      case "$usethreads" in
12854                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12855                 esac
12856                 d_endgrent_r=undef
12857                 endgrent_r_proto=0
12858                 ;;
12859         esac
12860         ;;
12861 *)      endgrent_r_proto=0
12862         ;;
12863 esac
12864
12865 : see if endhostent exists
12866 set endhostent d_endhent
12867 eval $inlibc
12868
12869 : see if this is a netdb.h system
12870 set netdb.h i_netdb
12871 eval $inhdr
12872
12873 : see if endhostent_r exists
12874 set endhostent_r d_endhostent_r
12875 eval $inlibc
12876 case "$d_endhostent_r" in
12877 "$define")
12878         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12879         case "$d_endhostent_r_proto:$usethreads" in
12880         ":define")      d_endhostent_r_proto=define
12881                 set d_endhostent_r_proto endhostent_r $hdrs
12882                 eval $hasproto ;;
12883         *)      ;;
12884         esac
12885         case "$d_endhostent_r_proto" in
12886         define)
12887         case "$endhostent_r_proto" in
12888         ''|0) try='int endhostent_r(struct hostent_data*);'
12889         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12890         esac
12891         case "$endhostent_r_proto" in
12892         ''|0) try='void endhostent_r(struct hostent_data*);'
12893         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12894         esac
12895         case "$endhostent_r_proto" in
12896         ''|0)   d_endhostent_r=undef
12897                 endhostent_r_proto=0
12898                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12899         * )     case "$endhostent_r_proto" in
12900                 REENTRANT_PROTO*) ;;
12901                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12902                 esac
12903                 echo "Prototype: $try" ;;
12904         esac
12905         ;;
12906         *)      case "$usethreads" in
12907                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12908                 esac
12909                 d_endhostent_r=undef
12910                 endhostent_r_proto=0
12911                 ;;
12912         esac
12913         ;;
12914 *)      endhostent_r_proto=0
12915         ;;
12916 esac
12917
12918 : see if endnetent exists
12919 set endnetent d_endnent
12920 eval $inlibc
12921
12922 : see if endnetent_r exists
12923 set endnetent_r d_endnetent_r
12924 eval $inlibc
12925 case "$d_endnetent_r" in
12926 "$define")
12927         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12928         case "$d_endnetent_r_proto:$usethreads" in
12929         ":define")      d_endnetent_r_proto=define
12930                 set d_endnetent_r_proto endnetent_r $hdrs
12931                 eval $hasproto ;;
12932         *)      ;;
12933         esac
12934         case "$d_endnetent_r_proto" in
12935         define)
12936         case "$endnetent_r_proto" in
12937         ''|0) try='int endnetent_r(struct netent_data*);'
12938         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12939         esac
12940         case "$endnetent_r_proto" in
12941         ''|0) try='void endnetent_r(struct netent_data*);'
12942         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12943         esac
12944         case "$endnetent_r_proto" in
12945         ''|0)   d_endnetent_r=undef
12946                 endnetent_r_proto=0
12947                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12948         * )     case "$endnetent_r_proto" in
12949                 REENTRANT_PROTO*) ;;
12950                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12951                 esac
12952                 echo "Prototype: $try" ;;
12953         esac
12954         ;;
12955         *)      case "$usethreads" in
12956                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12957                 esac
12958                 d_endnetent_r=undef
12959                 endnetent_r_proto=0
12960                 ;;
12961         esac
12962         ;;
12963 *)      endnetent_r_proto=0
12964         ;;
12965 esac
12966
12967 : see if endprotoent exists
12968 set endprotoent d_endpent
12969 eval $inlibc
12970
12971 : see if endprotoent_r exists
12972 set endprotoent_r d_endprotoent_r
12973 eval $inlibc
12974 case "$d_endprotoent_r" in
12975 "$define")
12976         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12977         case "$d_endprotoent_r_proto:$usethreads" in
12978         ":define")      d_endprotoent_r_proto=define
12979                 set d_endprotoent_r_proto endprotoent_r $hdrs
12980                 eval $hasproto ;;
12981         *)      ;;
12982         esac
12983         case "$d_endprotoent_r_proto" in
12984         define)
12985         case "$endprotoent_r_proto" in
12986         ''|0) try='int endprotoent_r(struct protoent_data*);'
12987         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12988         esac
12989         case "$endprotoent_r_proto" in
12990         ''|0) try='void endprotoent_r(struct protoent_data*);'
12991         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12992         esac
12993         case "$endprotoent_r_proto" in
12994         ''|0)   d_endprotoent_r=undef
12995                 endprotoent_r_proto=0
12996                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12997         * )     case "$endprotoent_r_proto" in
12998                 REENTRANT_PROTO*) ;;
12999                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13000                 esac
13001                 echo "Prototype: $try" ;;
13002         esac
13003         ;;
13004         *)      case "$usethreads" in
13005                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13006                 esac
13007                 d_endprotoent_r=undef
13008                 endprotoent_r_proto=0
13009                 ;;
13010         esac
13011         ;;
13012 *)      endprotoent_r_proto=0
13013         ;;
13014 esac
13015
13016 : see if endpwent exists
13017 set endpwent d_endpwent
13018 eval $inlibc
13019
13020 : see if this is a pwd.h system
13021 set pwd.h i_pwd
13022 eval $inhdr
13023
13024 case "$i_pwd" in
13025 $define)
13026         xxx=`./findhdr pwd.h`
13027         $cppstdin $cppflags $cppminus < $xxx >$$.h
13028
13029         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13030                 val="$define"
13031         else
13032                 val="$undef"
13033         fi
13034         set d_pwquota
13035         eval $setvar
13036
13037         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13038                 val="$define"
13039         else
13040                 val="$undef"
13041         fi
13042         set d_pwage
13043         eval $setvar
13044
13045         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13046                 val="$define"
13047         else
13048                 val="$undef"
13049         fi
13050         set d_pwchange
13051         eval $setvar
13052
13053         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13054                 val="$define"
13055         else
13056                 val="$undef"
13057         fi
13058         set d_pwclass
13059         eval $setvar
13060
13061         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13062                 val="$define"
13063         else
13064                 val="$undef"
13065         fi
13066         set d_pwexpire
13067         eval $setvar
13068
13069         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13070                 val="$define"
13071         else
13072                 val="$undef"
13073         fi
13074         set d_pwcomment
13075         eval $setvar
13076
13077         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13078                 val="$define"
13079         else
13080                 val="$undef"
13081         fi
13082         set d_pwgecos
13083         eval $setvar
13084
13085         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13086                 val="$define"
13087         else
13088                 val="$undef"
13089         fi
13090         set d_pwpasswd
13091         eval $setvar
13092
13093         $rm -f $$.h
13094         ;;
13095 *)
13096         val="$undef";
13097         set d_pwquota; eval $setvar
13098         set d_pwage; eval $setvar
13099         set d_pwchange; eval $setvar
13100         set d_pwclass; eval $setvar
13101         set d_pwexpire; eval $setvar
13102         set d_pwcomment; eval $setvar
13103         set d_pwgecos; eval $setvar
13104         set d_pwpasswd; eval $setvar
13105         ;;
13106 esac
13107
13108 : see if endpwent_r exists
13109 set endpwent_r d_endpwent_r
13110 eval $inlibc
13111 case "$d_endpwent_r" in
13112 "$define")
13113         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13114         case "$d_endpwent_r_proto:$usethreads" in
13115         ":define")      d_endpwent_r_proto=define
13116                 set d_endpwent_r_proto endpwent_r $hdrs
13117                 eval $hasproto ;;
13118         *)      ;;
13119         esac
13120         case "$d_endpwent_r_proto" in
13121         define)
13122         case "$endpwent_r_proto" in
13123         ''|0) try='int endpwent_r(FILE**);'
13124         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13125         esac
13126         case "$endpwent_r_proto" in
13127         ''|0) try='void endpwent_r(FILE**);'
13128         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13129         esac
13130         case "$endpwent_r_proto" in
13131         ''|0)   d_endpwent_r=undef
13132                 endpwent_r_proto=0
13133                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13134         * )     case "$endpwent_r_proto" in
13135                 REENTRANT_PROTO*) ;;
13136                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13137                 esac
13138                 echo "Prototype: $try" ;;
13139         esac
13140         ;;
13141         *)      case "$usethreads" in
13142                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13143                 esac
13144                 d_endpwent_r=undef
13145                 endpwent_r_proto=0
13146                 ;;
13147         esac
13148         ;;
13149 *)      endpwent_r_proto=0
13150         ;;
13151 esac
13152
13153 : see if endservent exists
13154 set endservent d_endsent
13155 eval $inlibc
13156
13157 : see if endservent_r exists
13158 set endservent_r d_endservent_r
13159 eval $inlibc
13160 case "$d_endservent_r" in
13161 "$define")
13162         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13163         case "$d_endservent_r_proto:$usethreads" in
13164         ":define")      d_endservent_r_proto=define
13165                 set d_endservent_r_proto endservent_r $hdrs
13166                 eval $hasproto ;;
13167         *)      ;;
13168         esac
13169         case "$d_endservent_r_proto" in
13170         define)
13171         case "$endservent_r_proto" in
13172         ''|0) try='int endservent_r(struct servent_data*);'
13173         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13174         esac
13175         case "$endservent_r_proto" in
13176         ''|0) try='void endservent_r(struct servent_data*);'
13177         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13178         esac
13179         case "$endservent_r_proto" in
13180         ''|0)   d_endservent_r=undef
13181                 endservent_r_proto=0
13182                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13183         * )     case "$endservent_r_proto" in
13184                 REENTRANT_PROTO*) ;;
13185                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13186                 esac
13187                 echo "Prototype: $try" ;;
13188         esac
13189         ;;
13190         *)      case "$usethreads" in
13191                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13192                 esac
13193                 d_endservent_r=undef
13194                 endservent_r_proto=0
13195                 ;;
13196         esac
13197         ;;
13198 *)      endservent_r_proto=0
13199         ;;
13200 esac
13201
13202 : Locate the flags for 'open()'
13203 echo " "
13204 $cat >try.c <<EOCP
13205 #include <sys/types.h>
13206 #ifdef I_FCNTL
13207 #include <fcntl.h>
13208 #endif
13209 #ifdef I_SYS_FILE
13210 #include <sys/file.h>
13211 #endif
13212 #$i_stdlib I_STDLIB
13213 #ifdef I_STDLIB
13214 #include <stdlib.h>
13215 #endif
13216 int main() {
13217         if(O_RDONLY);
13218 #ifdef O_TRUNC
13219         exit(0);
13220 #else
13221         exit(1);
13222 #endif
13223 }
13224 EOCP
13225 : check sys/file.h first to get FREAD on Sun
13226 if $test `./findhdr sys/file.h` && \
13227                 set try -DI_SYS_FILE && eval $compile; then
13228         h_sysfile=true;
13229         echo "<sys/file.h> defines the O_* constants..." >&4
13230         if $run ./try; then
13231                 echo "and you have the 3 argument form of open()." >&4
13232                 val="$define"
13233         else
13234                 echo "but not the 3 argument form of open().  Oh, well." >&4
13235                 val="$undef"
13236         fi
13237 elif $test `./findhdr fcntl.h` && \
13238                 set try -DI_FCNTL && eval $compile; then
13239         h_fcntl=true;
13240         echo "<fcntl.h> defines the O_* constants..." >&4
13241         if $run ./try; then
13242                 echo "and you have the 3 argument form of open()." >&4
13243                 val="$define"
13244         else
13245                 echo "but not the 3 argument form of open().  Oh, well." >&4
13246                 val="$undef"
13247         fi
13248 else
13249         val="$undef"
13250         echo "I can't find the O_* constant definitions!  You got problems." >&4
13251 fi
13252 set d_open3
13253 eval $setvar
13254 $rm_try
13255
13256 : see if this is a sys/file.h system
13257 val=''
13258 set sys/file.h val
13259 eval $inhdr
13260
13261 : do we need to include sys/file.h ?
13262 case "$val" in
13263 "$define")
13264         echo " "
13265         if $h_sysfile; then
13266                 val="$define"
13267                 echo "We'll be including <sys/file.h>." >&4
13268         else
13269                 val="$undef"
13270                 echo "We won't be including <sys/file.h>." >&4
13271         fi
13272         ;;
13273 *)
13274         h_sysfile=false
13275         ;;
13276 esac
13277 set i_sysfile
13278 eval $setvar
13279
13280 : see if fcntl.h is there
13281 val=''
13282 set fcntl.h val
13283 eval $inhdr
13284
13285 : see if we can include fcntl.h
13286 case "$val" in
13287 "$define")
13288         echo " "
13289         if $h_fcntl; then
13290                 val="$define"
13291                 echo "We'll be including <fcntl.h>." >&4
13292         else
13293                 val="$undef"
13294                 if $h_sysfile; then
13295         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13296                 else
13297                         echo "We won't be including <fcntl.h>." >&4
13298                 fi
13299         fi
13300         ;;
13301 *)
13302         h_fcntl=false
13303         val="$undef"
13304         ;;
13305 esac
13306 set i_fcntl
13307 eval $setvar
13308
13309 : see if fork exists
13310 set fork d_fork
13311 eval $inlibc
13312
13313 : see if pipe exists
13314 set pipe d_pipe
13315 eval $inlibc
13316
13317 : check for non-blocking I/O stuff
13318 case "$h_sysfile" in
13319 true) echo "#include <sys/file.h>" > head.c;;
13320 *)
13321        case "$h_fcntl" in
13322        true) echo "#include <fcntl.h>" > head.c;;
13323        *) echo "#include <sys/fcntl.h>" > head.c;;
13324        esac
13325        ;;
13326 esac
13327 echo " "
13328 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13329 case "$o_nonblock" in
13330 '')
13331         $cat head.c > try.c
13332         $cat >>try.c <<EOCP
13333 #include <stdio.h>
13334 #$i_stdlib I_STDLIB
13335 #ifdef I_STDLIB
13336 #include <stdlib.h>
13337 #endif
13338 #$i_fcntl I_FCNTL
13339 #ifdef I_FCNTL
13340 #include <fcntl.h>
13341 #endif
13342 int main() {
13343 #ifdef O_NONBLOCK
13344         printf("O_NONBLOCK\n");
13345         exit(0);
13346 #endif
13347 #ifdef O_NDELAY
13348         printf("O_NDELAY\n");
13349         exit(0);
13350 #endif
13351 #ifdef FNDELAY
13352         printf("FNDELAY\n");
13353         exit(0);
13354 #endif
13355         exit(0);
13356 }
13357 EOCP
13358         set try
13359         if eval $compile_ok; then
13360                 o_nonblock=`$run ./try`
13361                 case "$o_nonblock" in
13362                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13363                 *) echo "Seems like we can use $o_nonblock.";;
13364                 esac
13365         else
13366                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13367         fi
13368         ;;
13369 *) echo "Using $hint value $o_nonblock.";;
13370 esac
13371 $rm_try
13372
13373 echo " "
13374 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13375 case "$eagain" in
13376 '')
13377         case "$d_fork:$d_pipe:$d_alarm" in
13378         define:define:define)
13379         $cat head.c > try.c
13380         $cat >>try.c <<EOCP
13381 #include <errno.h>
13382 #include <sys/types.h>
13383 #include <signal.h>
13384 #include <stdio.h>
13385 #$i_stdlib I_STDLIB
13386 #ifdef I_STDLIB
13387 #include <stdlib.h>
13388 #endif
13389 #$i_fcntl I_FCNTL
13390 #ifdef I_FCNTL
13391 #include <fcntl.h>
13392 #endif
13393 #define MY_O_NONBLOCK $o_nonblock
13394 #ifndef errno  /* XXX need better Configure test */
13395 extern int errno;
13396 #endif
13397 #$i_unistd I_UNISTD
13398 #ifdef I_UNISTD
13399 #include <unistd.h>
13400 #endif
13401 #$i_string I_STRING
13402 #ifdef I_STRING
13403 #include <string.h>
13404 #else
13405 #include <strings.h>
13406 #endif
13407 $signal_t blech(int x) { exit(3); }
13408 EOCP
13409         $cat >> try.c <<'EOCP'
13410 int main()
13411 {
13412         int pd[2];
13413         int pu[2];
13414         char buf[1];
13415         char string[100];
13416         int ret;
13417
13418         ret = pipe(pd); /* Down: child -> parent */
13419         if (ret != 0)
13420                 exit(3);
13421         ret = pipe(pu); /* Up: parent -> child */
13422         if (ret != 0)
13423                 exit(3);
13424         if (0 != fork()) {
13425                 close(pd[1]);   /* Parent reads from pd[0] */
13426                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13427 #ifdef F_SETFL
13428                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13429                         exit(1);
13430 #else
13431                 exit(4);
13432 #endif
13433                 signal(SIGALRM, blech);
13434                 alarm(5);
13435                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13436                         exit(2);
13437                 sprintf(string, "%d\n", ret);
13438                 ret = write(2, string, strlen(string));
13439                 if (ret != strlen(string))
13440                         exit(3);
13441                 alarm(0);
13442 #ifdef EAGAIN
13443                 if (errno == EAGAIN) {
13444                         printf("EAGAIN\n");
13445                         goto ok;
13446                 }
13447 #endif
13448 #ifdef EWOULDBLOCK
13449                 if (errno == EWOULDBLOCK)
13450                         printf("EWOULDBLOCK\n");
13451 #endif
13452         ok:
13453                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13454                 if (ret != 1)
13455                         exit(3);
13456                 sleep(2);                               /* Give it time to close our pipe */
13457                 alarm(5);
13458                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13459                 alarm(0);
13460                 sprintf(string, "%d\n", ret);
13461                 ret = write(4, string, strlen(string));
13462                 if (ret != strlen(string))
13463                         exit(3);
13464                 exit(0);
13465         }
13466
13467         close(pd[0]);                   /* We write to pd[1] */
13468         close(pu[1]);                   /* We read from pu[0] */
13469         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13470         if (ret != 1)
13471                 exit(3);
13472         close(pd[1]);                   /* Pipe pd is now fully closed! */
13473         exit(0);                                /* Bye bye, thank you for playing! */
13474 }
13475 EOCP
13476         set try
13477         if eval $compile_ok; then
13478                 echo "$startsh" >mtry
13479                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13480                 chmod +x mtry
13481                 $run ./mtry >/dev/null 2>&1
13482                 case $? in
13483                 0) eagain=`$cat try.out`;;
13484                 1) echo "Could not perform non-blocking setting!";;
13485                 2) echo "I did a successful read() for something that was not there!";;
13486                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13487                 4) echo "Could not find F_SETFL!";;
13488                 *) echo "Something terribly wrong happened during testing.";;
13489                 esac
13490                 rd_nodata=`$cat try.ret`
13491                 echo "A read() system call with no data present returns $rd_nodata."
13492                 case "$rd_nodata" in
13493                 0|-1) ;;
13494                 *)
13495                         echo "(That's peculiar, fixing that to be -1.)"
13496                         rd_nodata=-1
13497                         ;;
13498                 esac
13499                 case "$eagain" in
13500                 '')
13501                         echo "Forcing errno EAGAIN on read() with no data available."
13502                         eagain=EAGAIN
13503                         ;;
13504                 *)
13505                         echo "Your read() sets errno to $eagain when no data is available."
13506                         ;;
13507                 esac
13508                 status=`$cat try.err`
13509                 case "$status" in
13510                 0) echo "And it correctly returns 0 to signal EOF.";;
13511                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13512                 *) echo "However, your read() returns '$status' on EOF??";;
13513                 esac
13514                 val="$define"
13515                 if test "$status" = "$rd_nodata"; then
13516                         echo "WARNING: you can't distinguish between EOF and no data!"
13517                         val="$undef"
13518                 fi
13519         else
13520                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13521                 eagain=EAGAIN
13522         fi
13523         ;;
13524         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13525                 eagain=EAGAIN
13526                 val="$define"
13527                 ;;
13528         esac
13529         set d_eofnblk
13530         eval $setvar
13531         ;;
13532 *)
13533         echo "Using $hint value $eagain."
13534         echo "Your read() returns $rd_nodata when no data is present."
13535         case "$d_eofnblk" in
13536         "$define") echo "And you can see EOF because read() returns 0.";;
13537         "$undef") echo "But you can't see EOF status from read() returned value.";;
13538         *)
13539                 echo "(Assuming you can't see EOF status from read anyway.)"
13540                 d_eofnblk=$undef
13541                 ;;
13542         esac
13543         ;;
13544 esac
13545 $rm_try head.c mtry
13546
13547 : see if erf exists
13548 set erf d_erf
13549 eval $inlibc
13550
13551 : see if erfc exists
13552 set erfc d_erfc
13553 eval $inlibc
13554
13555 : see if exp2 exists
13556 set exp2 d_exp2
13557 eval $inlibc
13558
13559 : see if expm1 exists
13560 set expm1 d_expm1
13561 eval $inlibc
13562
13563 : see if _ptr and _cnt from stdio act std
13564 echo " "
13565
13566 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13567         echo "(Looks like you have stdio.h from BSD.)"
13568         case "$stdio_ptr" in
13569         '') stdio_ptr='((fp)->_p)'
13570                 ptr_lval=$define
13571                 ;;
13572         *)      ptr_lval=$d_stdio_ptr_lval;;
13573         esac
13574         case "$stdio_cnt" in
13575         '') stdio_cnt='((fp)->_r)'
13576                 cnt_lval=$define
13577                 ;;
13578         *)      cnt_lval=$d_stdio_cnt_lval;;
13579         esac
13580         case "$stdio_base" in
13581         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13582         esac
13583         case "$stdio_bufsiz" in
13584         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13585         esac
13586 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13587         echo "(Looks like you have stdio.h from Linux.)"
13588         case "$stdio_ptr" in
13589         '') stdio_ptr='((fp)->_IO_read_ptr)'
13590                 ptr_lval=$define
13591                 ;;
13592         *)      ptr_lval=$d_stdio_ptr_lval;;
13593         esac
13594         case "$stdio_cnt" in
13595         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13596                 cnt_lval=$undef
13597                 ;;
13598         *)      cnt_lval=$d_stdio_cnt_lval;;
13599         esac
13600         case "$stdio_base" in
13601         '') stdio_base='((fp)->_IO_read_base)';;
13602         esac
13603         case "$stdio_bufsiz" in
13604         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13605         esac
13606 else
13607         case "$stdio_ptr" in
13608         '') stdio_ptr='((fp)->_ptr)'
13609                 ptr_lval=$define
13610                 ;;
13611         *)      ptr_lval=$d_stdio_ptr_lval;;
13612         esac
13613         case "$stdio_cnt" in
13614         '') stdio_cnt='((fp)->_cnt)'
13615                 cnt_lval=$define
13616                 ;;
13617         *)      cnt_lval=$d_stdio_cnt_lval;;
13618         esac
13619         case "$stdio_base" in
13620         '') stdio_base='((fp)->_base)';;
13621         esac
13622         case "$stdio_bufsiz" in
13623         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13624         esac
13625 fi
13626
13627 : test whether _ptr and _cnt really work
13628 echo "Checking how std your stdio is..." >&4
13629 $cat >try.c <<EOP
13630 #include <stdio.h>
13631 #$i_stdlib I_STDLIB
13632 #ifdef I_STDLIB
13633 #include <stdlib.h>
13634 #endif
13635 #define FILE_ptr(fp)    $stdio_ptr
13636 #define FILE_cnt(fp)    $stdio_cnt
13637 int main() {
13638         FILE *fp = fopen("try.c", "r");
13639         char c = getc(fp);
13640         if (
13641                 18 <= FILE_cnt(fp) &&
13642                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13643         )
13644                 exit(0);
13645         exit(1);
13646 }
13647 EOP
13648 val="$undef"
13649 set try
13650 if eval $compile && $to try.c; then
13651         if $run ./try; then
13652                 echo "Your stdio acts pretty std."
13653                 val="$define"
13654         else
13655                 echo "Your stdio isn't very std."
13656         fi
13657 else
13658         echo "Your stdio doesn't appear very std."
13659 fi
13660 $rm_try
13661
13662 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13663 # direct buffer manipulation no longer works.  The Configure tests
13664 # should be changed to correctly detect this, but until then,
13665 # the following check should at least let perl compile and run.
13666 # (This quick fix should be updated before 5.8.1.)
13667 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13668 # A. Dougherty, June 3, 2002.
13669 case "$d_gnulibc" in
13670 $define)
13671         case "$gnulibc_version" in
13672         2.[01]*)  ;;
13673         2.2) ;;
13674         2.2.[0-9]) ;;
13675         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13676                 val="$undef"
13677                 ;;
13678         esac
13679         ;;
13680 esac
13681 set d_stdstdio
13682 eval $setvar
13683
13684 : Can _ptr be used as an lvalue?
13685 case "$d_stdstdio$ptr_lval" in
13686 $define$define) val=$define ;;
13687 *) val=$undef ;;
13688 esac
13689 set d_stdio_ptr_lval
13690 eval $setvar
13691
13692 : Can _cnt be used as an lvalue?
13693 case "$d_stdstdio$cnt_lval" in
13694 $define$define) val=$define ;;
13695 *) val=$undef ;;
13696 esac
13697 set d_stdio_cnt_lval
13698 eval $setvar
13699
13700
13701 : test whether setting _ptr sets _cnt as a side effect
13702 d_stdio_ptr_lval_sets_cnt="$undef"
13703 d_stdio_ptr_lval_nochange_cnt="$undef"
13704 case "$d_stdio_ptr_lval$d_stdstdio" in
13705 $define$define)
13706         echo "Checking to see what happens if we set the stdio ptr..." >&4
13707 $cat >try.c <<EOP
13708 #include <stdio.h>
13709 /* Can we scream? */
13710 /* Eat dust sed :-) */
13711 /* In the buffer space, no one can hear you scream. */
13712 #$i_stdlib I_STDLIB
13713 #ifdef I_STDLIB
13714 #include <stdlib.h>
13715 #endif
13716 #define FILE_ptr(fp)    $stdio_ptr
13717 #define FILE_cnt(fp)    $stdio_cnt
13718 #include <sys/types.h>
13719 int main() {
13720         FILE *fp = fopen("try.c", "r");
13721         int c;
13722         char *ptr;
13723         size_t cnt;
13724         if (!fp) {
13725             puts("Fail even to read");
13726             exit(1);
13727         }
13728         c = getc(fp); /* Read away the first # */
13729         if (c == EOF) {
13730             puts("Fail even to read");
13731             exit(1);
13732         }
13733         if (!(
13734                 18 <= FILE_cnt(fp) &&
13735                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13736         )) {
13737                 puts("Fail even to read");
13738                 exit (1);
13739         }
13740         ptr = (char*) FILE_ptr(fp);
13741         cnt = (size_t)FILE_cnt(fp);
13742
13743         FILE_ptr(fp) += 42;
13744
13745         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13746                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13747                 exit (1);
13748         }
13749         if (FILE_cnt(fp) <= 20) {
13750                 printf ("Fail (<20 chars to test)");
13751                 exit (1);
13752         }
13753         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13754                 puts("Fail compare");
13755                 exit (1);
13756         }
13757         if (cnt == FILE_cnt(fp)) {
13758                 puts("Pass_unchanged");
13759                 exit (0);
13760         }
13761         if (FILE_cnt(fp) == (cnt - 42)) {
13762                 puts("Pass_changed");
13763                 exit (0);
13764         }
13765         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13766         return 1;
13767
13768 }
13769 EOP
13770         set try
13771         if eval $compile && $to try.c; then
13772                 case `$run ./try` in
13773                 Pass_changed)
13774                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13775                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13776                 Pass_unchanged)
13777                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13778                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13779                 Fail*)
13780                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13781                 *)
13782                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13783         esac
13784         else
13785                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13786         fi
13787         $rm_try
13788         ;;
13789 esac
13790
13791 : see if _base is also standard
13792 val="$undef"
13793 case "$d_stdstdio" in
13794 $define)
13795         $cat >try.c <<EOP
13796 #include <stdio.h>
13797 #$i_stdlib I_STDLIB
13798 #ifdef I_STDLIB
13799 #include <stdlib.h>
13800 #endif
13801 #define FILE_base(fp)   $stdio_base
13802 #define FILE_bufsiz(fp) $stdio_bufsiz
13803 int main() {
13804         FILE *fp = fopen("try.c", "r");
13805         char c = getc(fp);
13806         if (
13807                 19 <= FILE_bufsiz(fp) &&
13808                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13809         )
13810                 exit(0);
13811         exit(1);
13812 }
13813 EOP
13814         set try
13815         if eval $compile && $to try.c; then
13816                 if $run ./try; then
13817                         echo "And its _base field acts std."
13818                         val="$define"
13819                 else
13820                         echo "But its _base field isn't std."
13821                 fi
13822         else
13823                 echo "However, it seems to be lacking the _base field."
13824         fi
13825         $rm_try
13826         ;;
13827 esac
13828 set d_stdiobase
13829 eval $setvar
13830
13831 : see if fast_stdio exists
13832 val="$undef"
13833 case "$d_stdstdio:$d_stdio_ptr_lval" in
13834 "$define:$define")
13835         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13836         *$define*)
13837                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13838                 val="$define"
13839                 ;;
13840         esac
13841         ;;
13842 esac
13843 set d_faststdio
13844 eval $setvar
13845
13846
13847
13848 : see if fchdir exists
13849 set fchdir d_fchdir
13850 eval $inlibc
13851
13852 : see if fchmod exists
13853 set fchmod d_fchmod
13854 eval $inlibc
13855
13856 : see if fchown exists
13857 set fchown d_fchown
13858 eval $inlibc
13859
13860 : see if this is an fcntl system
13861 set fcntl d_fcntl
13862 eval $inlibc
13863
13864 : See if fcntl-based locking works.
13865 echo " "
13866 $cat >try.c <<EOCP
13867 #$i_stdlib I_STDLIB
13868 #ifdef I_STDLIB
13869 #include <stdlib.h>
13870 #endif
13871 #include <unistd.h>
13872 #include <fcntl.h>
13873 #include <signal.h>
13874 $signal_t blech(int x) { exit(3); }
13875 int main() {
13876 #if defined(F_SETLK) && defined(F_SETLKW)
13877      struct flock flock;
13878      int retval, fd;
13879      fd = open("try.c", O_RDONLY);
13880      flock.l_type = F_RDLCK;
13881      flock.l_whence = SEEK_SET;
13882      flock.l_start = flock.l_len = 0;
13883      signal(SIGALRM, blech);
13884      alarm(10);
13885      retval = fcntl(fd, F_SETLK, &flock);
13886      close(fd);
13887      (retval < 0 ? exit(2) : exit(0));
13888 #else
13889      exit(2);
13890 #endif
13891 }
13892 EOCP
13893 echo "Checking if fcntl-based file locking works... "
13894 case "$d_fcntl" in
13895 "$define")
13896         set try
13897         if eval $compile_ok; then
13898                 if $run ./try; then
13899                         echo "Yes, it seems to work."
13900                         val="$define"
13901                 else
13902                         echo "Nope, it didn't work."
13903                         val="$undef"
13904                         case "$?" in
13905                         3) $cat >&4 <<EOM
13906 ***
13907 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13908 *** This is (almost) impossible.
13909 *** If your NFS lock daemons are not feeling well, something like
13910 *** this may happen, please investigate.  Cannot continue, aborting.
13911 ***
13912 EOM
13913                                 exit 1
13914                                 ;;
13915                         esac
13916                 fi
13917         else
13918                 echo "I'm unable to compile the test program, so I'll assume not."
13919                 val="$undef"
13920         fi
13921         ;;
13922 *) val="$undef";
13923         echo "Nope, since you don't even have fcntl()."
13924         ;;
13925 esac
13926 set d_fcntl_can_lock
13927 eval $setvar
13928 $rm_try
13929
13930 : check for fd_set items
13931 $cat <<EOM
13932
13933 Checking to see how well your C compiler handles fd_set and friends ...
13934 EOM
13935 $cat >try.c <<EOCP
13936 #$i_stdlib I_STDLIB
13937 #ifdef I_STDLIB
13938 #include <stdlib.h>
13939 #endif
13940 #$i_systime I_SYS_TIME
13941 #$i_sysselct I_SYS_SELECT
13942 #$d_socket HAS_SOCKET
13943 #include <sys/types.h>
13944 #ifdef HAS_SOCKET
13945 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13946 #endif
13947 #ifdef I_SYS_TIME
13948 #include <sys/time.h>
13949 #endif
13950 #ifdef I_SYS_SELECT
13951 #include <sys/select.h>
13952 #endif
13953 int main() {
13954         fd_set fds;
13955
13956 #ifdef TRYBITS
13957         if(fds.fds_bits);
13958 #endif
13959
13960 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13961         exit(0);
13962 #else
13963         exit(1);
13964 #endif
13965 }
13966 EOCP
13967 set try -DTRYBITS
13968 if eval $compile; then
13969         d_fds_bits="$define"
13970         d_fd_set="$define"
13971         echo "Well, your system knows about the normal fd_set typedef..." >&4
13972         if $run ./try; then
13973                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13974                 d_fd_macros="$define"
13975         else
13976                 $cat >&4 <<'EOM'
13977 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13978 EOM
13979                 d_fd_macros="$undef"
13980         fi
13981 else
13982         $cat <<'EOM'
13983 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13984 EOM
13985         set try
13986         if eval $compile; then
13987                 d_fds_bits="$undef"
13988                 d_fd_set="$define"
13989                 echo "Well, your system has some sort of fd_set available..." >&4
13990                 if $run ./try; then
13991                         echo "and you have the normal fd_set macros." >&4
13992                         d_fd_macros="$define"
13993                 else
13994                         $cat <<'EOM'
13995 but not the normal fd_set macros!  Gross!  More work for me...
13996 EOM
13997                         d_fd_macros="$undef"
13998                 fi
13999         else
14000         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14001                 d_fd_set="$undef"
14002                 d_fds_bits="$undef"
14003                 d_fd_macros="$undef"
14004         fi
14005 fi
14006 $rm_try
14007
14008 : see if fdclose exists
14009 set fdclose d_fdclose
14010 eval $inlibc
14011
14012 : see if fdim exists
14013 set fdim d_fdim
14014 eval $inlibc
14015
14016 : see if fegetround exists
14017 set fegetround d_fegetround
14018 eval $inlibc
14019
14020 : see if fgetpos exists
14021 set fgetpos d_fgetpos
14022 eval $inlibc
14023
14024 : see if finite exists
14025 set finite d_finite
14026 eval $inlibc
14027
14028 : see if finitel exists
14029 set finitel d_finitel
14030 eval $inlibc
14031
14032 : see if flock exists
14033 set flock d_flock
14034 eval $inlibc
14035
14036 : see if prototype for flock is available
14037 echo " "
14038 set d_flockproto flock $i_sysfile sys/file.h
14039 eval $hasproto
14040
14041 : see if fma exists
14042 set fma d_fma
14043 eval $inlibc
14044
14045 : see if fmax exists
14046 set fmax d_fmax
14047 eval $inlibc
14048
14049 : see if fmin exists
14050 set fmin d_fmin
14051 eval $inlibc
14052
14053 : see if fp_class exists
14054 set fp_class d_fp_class
14055 eval $inlibc
14056
14057 : see if this is a math.h system
14058 set math.h i_math
14059 eval $inhdr
14060
14061 : check for fpclassify
14062 echo "Checking to see if you have fpclassify..." >&4
14063 $cat >try.c <<EOCP
14064 #$i_math I_MATH
14065 #ifdef I_MATH
14066 #include <math.h>
14067 #endif
14068 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14069 EOCP
14070 set try
14071 if eval $compile; then
14072         val="$define"
14073         echo "You have fpclassify."
14074 else
14075         val="$undef"
14076         echo "You do not have fpclassify."
14077 fi
14078 $rm_try
14079 set d_fpclassify
14080 eval $setvar
14081
14082 : see if fp_classify exists
14083 set fp_classify d_fp_classify
14084 eval $inlibc
14085
14086 : see if fp_classl exists
14087 set fp_classl d_fp_classl
14088 eval $inlibc
14089
14090 : see if pathconf exists
14091 set pathconf d_pathconf
14092 eval $inlibc
14093
14094 : see if fpathconf exists
14095 set fpathconf d_fpathconf
14096 eval $inlibc
14097
14098 : see if fpclass exists
14099 set fpclass d_fpclass
14100 eval $inlibc
14101
14102 : see if fpclassl exists
14103 set fpclassl d_fpclassl
14104 eval $inlibc
14105
14106 : see if fpgetround exists
14107 set fpgetround d_fpgetround
14108 eval $inlibc
14109
14110 : check for fpos64_t
14111 echo " "
14112 echo "Checking to see if you have fpos64_t..." >&4
14113 $cat >try.c <<EOCP
14114 #include <stdio.h>
14115 int main() { fpos64_t x = 7; }
14116 EOCP
14117 set try
14118 if eval $compile; then
14119         val="$define"
14120         echo "You have fpos64_t."
14121 else
14122         val="$undef"
14123         echo "You do not have fpos64_t."
14124         case "$fpossize" in
14125         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14126         esac
14127 fi
14128 $rm_try
14129 set d_fpos64_t
14130 eval $setvar
14131
14132 : see if this is an xlocale.h system
14133 set xlocale.h i_xlocale
14134 eval $inhdr
14135
14136 : see if newlocale exists
14137 set newlocale d_newlocale
14138 eval $inlibc
14139
14140 : see if freelocale exists
14141 set freelocale d_freelocale
14142 eval $inlibc
14143
14144 : see if uselocale exists
14145 set uselocale d_uselocale
14146 eval $inlibc
14147
14148 : see if duplocale exists
14149 set duplocale d_duplocale
14150 eval $inlibc
14151
14152 : see if frexpl exists
14153 set frexpl d_frexpl
14154 eval $inlibc
14155
14156 : see if this is a sys/param system
14157 set sys/param.h i_sysparam
14158 eval $inhdr
14159
14160 : see if this is a sys/mount.h system
14161 set sys/mount.h i_sysmount
14162 eval $inhdr
14163
14164 : Check for fs_data_s
14165 echo " "
14166 echo "Checking to see if your system supports struct fs_data..." >&4
14167 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14168 eval $hasstruct
14169 case "$d_fs_data_s" in
14170 "$define")      echo "Yes, it does."   ;;
14171 *)              echo "No, it doesn't." ;;
14172 esac
14173
14174 : see if fseeko exists
14175 set fseeko d_fseeko
14176 eval $inlibc
14177 case "$longsize" in
14178 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14179 esac
14180
14181 : see if fsetpos exists
14182 set fsetpos d_fsetpos
14183 eval $inlibc
14184
14185 : see if fstatfs exists
14186 set fstatfs d_fstatfs
14187 eval $inlibc
14188
14189 : see if statvfs exists
14190 set statvfs d_statvfs
14191 eval $inlibc
14192
14193 : see if fstatvfs exists
14194 set fstatvfs d_fstatvfs
14195 eval $inlibc
14196
14197
14198 : see if fsync exists
14199 set fsync d_fsync
14200 eval $inlibc
14201
14202 : see if ftello exists
14203 set ftello d_ftello
14204 eval $inlibc
14205 case "$longsize" in
14206 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14207 esac
14208
14209 : check for a working futimes
14210 d_futimes="$undef"
14211 echo " "
14212 echo "Checking if you have a working futimes()" >&4
14213 $cat >try.c <<EOCP
14214 #include <stdio.h>
14215 #include <sys/time.h>
14216 #include <errno.h>
14217 #include <fcntl.h>
14218
14219 int main ()
14220 {
14221     int fd, rv;
14222     fd = open ("try.c", O_RDWR);
14223     if (-1 == fd) exit (1);
14224     rv = futimes (fd, NULL);
14225     exit (rv == -1 ? errno : 0);
14226 }
14227 EOCP
14228 set try
14229 if eval $compile; then
14230     `$run ./try`
14231     rc=$?
14232     case "$rc" in
14233         0)  echo "Yes, you have" >&4
14234             d_futimes="$define"
14235             ;;
14236         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14237             ;;
14238     esac
14239 else
14240     echo "No, it does not (probably harmless)" >&4
14241 fi
14242 $rm_try
14243
14244 : see if ndbm.h is available
14245 set ndbm.h i_ndbm
14246 eval $inhdr
14247 : Compatibility location for RedHat 7.1
14248 set gdbm/ndbm.h i_gdbmndbm
14249 eval $inhdr
14250 : Compatibility location for Debian 4.0
14251 set gdbm-ndbm.h i_gdbm_ndbm
14252 eval $inhdr
14253
14254 val="$undef"
14255 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14256         : see if dbm_open exists
14257         set dbm_open d_dbm_open
14258         eval $inlibc
14259         case "$d_dbm_open" in
14260         $undef)
14261                 i_ndbm="$undef"
14262                 i_gdbmndbm="$undef"
14263                 i_gdbm_ndbm="$undef"
14264                 echo "We won't be including <ndbm.h>"
14265                 val="$undef"
14266                 ;;
14267         *) val="$define"
14268            ;;
14269         esac
14270 fi
14271 set d_ndbm
14272 eval $setvar
14273
14274 ndbm_hdr_protochk='name=$1; hdr=$2;
14275 eval "ihdr=\$""i_$name";
14276 val="$undef";
14277 if $test "$ihdr" = "$define"; then
14278         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14279         case "$d_cplusplus" in
14280         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14281         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14282         esac;
14283         case "$val" in
14284         $define) $echo "Your <$hdr> seems to have prototypes";;
14285         *) $echo "Your <$hdr> does not seem to have prototypes";;
14286         esac;
14287 fi;
14288 set "d_${name}_h_uses_prototypes";
14289 eval $setvar'
14290
14291 set ndbm ndbm.h
14292 eval $ndbm_hdr_protochk
14293 set gdbmndbm gdbm/ndbm.h
14294 eval $ndbm_hdr_protochk
14295 set gdbm_ndbm gdbm-ndbm.h
14296 eval $ndbm_hdr_protochk
14297
14298 : see if getaddrinfo exists
14299 set getaddrinfo d_getaddrinfo
14300 eval $inlibc
14301
14302 : see if getcwd exists
14303 set getcwd d_getcwd
14304 eval $inlibc
14305
14306 : see if getespwnam exists
14307 set getespwnam d_getespwnam
14308 eval $inlibc
14309
14310 : see if getfsstat exists
14311 set getfsstat d_getfsstat
14312 eval $inlibc
14313
14314 : see if getgrent exists
14315 set getgrent d_getgrent
14316 eval $inlibc
14317
14318 : see if getgrent_r exists
14319 set getgrent_r d_getgrent_r
14320 eval $inlibc
14321 case "$d_getgrent_r" in
14322 "$define")
14323         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14324         case "$d_getgrent_r_proto:$usethreads" in
14325         ":define")      d_getgrent_r_proto=define
14326                 set d_getgrent_r_proto getgrent_r $hdrs
14327                 eval $hasproto ;;
14328         *)      ;;
14329         esac
14330         case "$d_getgrent_r_proto" in
14331         define)
14332         case "$getgrent_r_proto" in
14333         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14334         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14335         esac
14336         case "$getgrent_r_proto" in
14337         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14338         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14339         esac
14340         case "$getgrent_r_proto" in
14341         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14342         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14343         esac
14344         case "$getgrent_r_proto" in
14345         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14346         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14347         esac
14348         case "$getgrent_r_proto" in
14349         ''|0) try='int getgrent_r(struct group*, char*, int);'
14350         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14351         esac
14352         case "$getgrent_r_proto" in
14353         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14354         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14355         esac
14356         case "$getgrent_r_proto" in
14357         ''|0)   d_getgrent_r=undef
14358                 getgrent_r_proto=0
14359                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14360         * )     case "$getgrent_r_proto" in
14361                 REENTRANT_PROTO*) ;;
14362                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14363                 esac
14364                 echo "Prototype: $try" ;;
14365         esac
14366         ;;
14367         *)      case "$usethreads" in
14368                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14369                 esac
14370                 d_getgrent_r=undef
14371                 getgrent_r_proto=0
14372                 ;;
14373         esac
14374         ;;
14375 *)      getgrent_r_proto=0
14376         ;;
14377 esac
14378
14379 : see if getgrgid_r exists
14380 set getgrgid_r d_getgrgid_r
14381 eval $inlibc
14382 case "$d_getgrgid_r" in
14383 "$define")
14384         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14385         case "$d_getgrgid_r_proto:$usethreads" in
14386         ":define")      d_getgrgid_r_proto=define
14387                 set d_getgrgid_r_proto getgrgid_r $hdrs
14388                 eval $hasproto ;;
14389         *)      ;;
14390         esac
14391         case "$d_getgrgid_r_proto" in
14392         define)
14393         case "$getgrgid_r_proto" in
14394         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14395         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14396         esac
14397         case "$getgrgid_r_proto" in
14398         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14399         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14400         esac
14401         case "$getgrgid_r_proto" in
14402         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14403         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14404         esac
14405         case "$getgrgid_r_proto" in
14406         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14407         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14408         esac
14409         case "$getgrgid_r_proto" in
14410         ''|0)   d_getgrgid_r=undef
14411                 getgrgid_r_proto=0
14412                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14413         * )     case "$getgrgid_r_proto" in
14414                 REENTRANT_PROTO*) ;;
14415                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14416                 esac
14417                 echo "Prototype: $try" ;;
14418         esac
14419         ;;
14420         *)      case "$usethreads" in
14421                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14422                 esac
14423                 d_getgrgid_r=undef
14424                 getgrgid_r_proto=0
14425                 ;;
14426         esac
14427         ;;
14428 *)      getgrgid_r_proto=0
14429         ;;
14430 esac
14431
14432 : see if getgrnam_r exists
14433 set getgrnam_r d_getgrnam_r
14434 eval $inlibc
14435 case "$d_getgrnam_r" in
14436 "$define")
14437         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14438         case "$d_getgrnam_r_proto:$usethreads" in
14439         ":define")      d_getgrnam_r_proto=define
14440                 set d_getgrnam_r_proto getgrnam_r $hdrs
14441                 eval $hasproto ;;
14442         *)      ;;
14443         esac
14444         case "$d_getgrnam_r_proto" in
14445         define)
14446         case "$getgrnam_r_proto" in
14447         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14448         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14449         esac
14450         case "$getgrnam_r_proto" in
14451         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14452         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14453         esac
14454         case "$getgrnam_r_proto" in
14455         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14456         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14457         esac
14458         case "$getgrnam_r_proto" in
14459         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14460         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14461         esac
14462         case "$getgrnam_r_proto" in
14463         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14464         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14465         esac
14466         case "$getgrnam_r_proto" in
14467         ''|0)   d_getgrnam_r=undef
14468                 getgrnam_r_proto=0
14469                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14470         * )     case "$getgrnam_r_proto" in
14471                 REENTRANT_PROTO*) ;;
14472                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14473                 esac
14474                 echo "Prototype: $try" ;;
14475         esac
14476         ;;
14477         *)      case "$usethreads" in
14478                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14479                 esac
14480                 d_getgrnam_r=undef
14481                 getgrnam_r_proto=0
14482                 ;;
14483         esac
14484         ;;
14485 *)      getgrnam_r_proto=0
14486         ;;
14487 esac
14488
14489 : see if gethostbyaddr exists
14490 set gethostbyaddr d_gethbyaddr
14491 eval $inlibc
14492
14493 : see if gethostbyname exists
14494 set gethostbyname d_gethbyname
14495 eval $inlibc
14496
14497 : see if gethostent exists
14498 set gethostent d_gethent
14499 eval $inlibc
14500
14501 : see how we will look up host name
14502 echo " "
14503 call=''
14504 if set gethostname val -f d_gethname; eval $csym; $val; then
14505         echo 'gethostname() found.' >&4
14506         d_gethname="$define"
14507         call=gethostname
14508 fi
14509 if set uname val -f d_uname; eval $csym; $val; then
14510         if ./xenix; then
14511                 $cat <<'EOM'
14512 uname() was found, but you're running xenix, and older versions of xenix
14513 have a broken uname(). If you don't really know whether your xenix is old
14514 enough to have a broken system call, use the default answer.
14515
14516 EOM
14517                 dflt=y
14518                 case "$d_uname" in
14519                 "$define") dflt=n;;
14520                 esac
14521                 rp='Is your uname() broken?'
14522                 . ./myread
14523                 case "$ans" in
14524                 n*) d_uname="$define"; call=uname;;
14525                 esac
14526         else
14527                 echo 'uname() found.' >&4
14528                 d_uname="$define"
14529                 case "$call" in
14530                 '') call=uname ;;
14531                 esac
14532         fi
14533 fi
14534 case "$d_gethname" in
14535 '') d_gethname="$undef";;
14536 esac
14537 case "$d_uname" in
14538 '') d_uname="$undef";;
14539 esac
14540 case "$d_uname$d_gethname" in
14541 *define*)
14542         dflt=n
14543         cat <<EOM
14544
14545 Every now and then someone has a $call() that lies about the hostname
14546 but can't be fixed for political or economic reasons.  If you wish, I can
14547 pretend $call() isn't there and maybe compute hostname at run-time
14548 thanks to the '$phostname' command.
14549
14550 EOM
14551         rp="Shall I ignore $call() from now on?"
14552         . ./myread
14553         case "$ans" in
14554         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14555         esac;;
14556 esac
14557 case "$phostname" in
14558 '') aphostname='';;
14559 *) case "$aphostname" in
14560         /*) ;;
14561         *) set X $phostname
14562                 shift
14563                 file=$1
14564                 shift
14565                 file=`./loc $file $file $pth`
14566                 aphostname=`echo $file $*`
14567                 ;;
14568         esac
14569         ;;
14570 esac
14571 case "$d_uname$d_gethname" in
14572 *define*) ;;
14573 *)
14574         case "$phostname" in
14575         '')
14576                 echo "There will be no way for $package to get your hostname." >&4;;
14577         *)
14578         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14579                 ;;
14580         esac;;
14581 esac
14582 case "$d_phostname" in
14583 '') d_phostname="$undef";;
14584 esac
14585
14586 : see if gethostbyaddr_r exists
14587 set gethostbyaddr_r d_gethostbyaddr_r
14588 eval $inlibc
14589 case "$d_gethostbyaddr_r" in
14590 "$define")
14591         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14592         case "$d_gethostbyaddr_r_proto:$usethreads" in
14593         ":define")      d_gethostbyaddr_r_proto=define
14594                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14595                 eval $hasproto ;;
14596         *)      ;;
14597         esac
14598         case "$d_gethostbyaddr_r_proto" in
14599         define)
14600         case "$gethostbyaddr_r_proto" in
14601         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14602         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14603         esac
14604         case "$gethostbyaddr_r_proto" in
14605         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14606         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14607         esac
14608         case "$gethostbyaddr_r_proto" in
14609         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14610         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14611         esac
14612         case "$gethostbyaddr_r_proto" in
14613         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14614         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14615         esac
14616         case "$gethostbyaddr_r_proto" in
14617         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14618         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14619         esac
14620         case "$gethostbyaddr_r_proto" in
14621         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14622         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14623         esac
14624         case "$gethostbyaddr_r_proto" in
14625         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14626         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14627         esac
14628         case "$gethostbyaddr_r_proto" in
14629         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14630         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14631         esac
14632         case "$gethostbyaddr_r_proto" in
14633         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14634         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14635         esac
14636         case "$gethostbyaddr_r_proto" in
14637         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14638         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14639         esac
14640         case "$gethostbyaddr_r_proto" in
14641         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14642         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14643         esac
14644         case "$gethostbyaddr_r_proto" in
14645         ''|0)   d_gethostbyaddr_r=undef
14646                 gethostbyaddr_r_proto=0
14647                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14648         * )     case "$gethostbyaddr_r_proto" in
14649                 REENTRANT_PROTO*) ;;
14650                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14651                 esac
14652                 echo "Prototype: $try" ;;
14653         esac
14654         ;;
14655         *)      case "$usethreads" in
14656                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14657                 esac
14658                 d_gethostbyaddr_r=undef
14659                 gethostbyaddr_r_proto=0
14660                 ;;
14661         esac
14662         ;;
14663 *)      gethostbyaddr_r_proto=0
14664         ;;
14665 esac
14666
14667 : see if gethostbyname_r exists
14668 set gethostbyname_r d_gethostbyname_r
14669 eval $inlibc
14670 case "$d_gethostbyname_r" in
14671 "$define")
14672         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14673         case "$d_gethostbyname_r_proto:$usethreads" in
14674         ":define")      d_gethostbyname_r_proto=define
14675                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14676                 eval $hasproto ;;
14677         *)      ;;
14678         esac
14679         case "$d_gethostbyname_r_proto" in
14680         define)
14681         case "$gethostbyname_r_proto" in
14682         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14683         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14684         esac
14685         case "$gethostbyname_r_proto" in
14686         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14687         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14688         esac
14689         case "$gethostbyname_r_proto" in
14690         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14691         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14692         esac
14693         case "$gethostbyname_r_proto" in
14694         ''|0)   d_gethostbyname_r=undef
14695                 gethostbyname_r_proto=0
14696                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14697         * )     case "$gethostbyname_r_proto" in
14698                 REENTRANT_PROTO*) ;;
14699                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14700                 esac
14701                 echo "Prototype: $try" ;;
14702         esac
14703         ;;
14704         *)      case "$usethreads" in
14705                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14706                 esac
14707                 d_gethostbyname_r=undef
14708                 gethostbyname_r_proto=0
14709                 ;;
14710         esac
14711         ;;
14712 *)      gethostbyname_r_proto=0
14713         ;;
14714 esac
14715
14716 : see if gethostent_r exists
14717 set gethostent_r d_gethostent_r
14718 eval $inlibc
14719 case "$d_gethostent_r" in
14720 "$define")
14721         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14722         case "$d_gethostent_r_proto:$usethreads" in
14723         ":define")      d_gethostent_r_proto=define
14724                 set d_gethostent_r_proto gethostent_r $hdrs
14725                 eval $hasproto ;;
14726         *)      ;;
14727         esac
14728         case "$d_gethostent_r_proto" in
14729         define)
14730         case "$gethostent_r_proto" in
14731         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14732         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14733         esac
14734         case "$gethostent_r_proto" in
14735         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14736         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14737         esac
14738         case "$gethostent_r_proto" in
14739         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14740         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14741         esac
14742         case "$gethostent_r_proto" in
14743         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14744         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14745         esac
14746         case "$gethostent_r_proto" in
14747         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14748         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14749         esac
14750         case "$gethostent_r_proto" in
14751         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14752         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14753         esac
14754         case "$gethostent_r_proto" in
14755         ''|0)   d_gethostent_r=undef
14756                 gethostent_r_proto=0
14757                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14758         * )     case "$gethostent_r_proto" in
14759                 REENTRANT_PROTO*) ;;
14760                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14761                 esac
14762                 echo "Prototype: $try" ;;
14763         esac
14764         ;;
14765         *)      case "$usethreads" in
14766                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14767                 esac
14768                 d_gethostent_r=undef
14769                 gethostent_r_proto=0
14770                 ;;
14771         esac
14772         ;;
14773 *)      gethostent_r_proto=0
14774         ;;
14775 esac
14776
14777 : see if prototypes for various gethostxxx netdb.h functions are available
14778 echo " "
14779 set d_gethostprotos gethostent $i_netdb netdb.h
14780 eval $hasproto
14781
14782 : see if getitimer exists
14783 set getitimer d_getitimer
14784 eval $inlibc
14785
14786 : see if getlogin exists
14787 set getlogin d_getlogin
14788 eval $inlibc
14789
14790 : see if getlogin_r exists
14791 set getlogin_r d_getlogin_r
14792 eval $inlibc
14793 case "$d_getlogin_r" in
14794 "$define")
14795         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14796         case "$d_getlogin_r_proto:$usethreads" in
14797         ":define")      d_getlogin_r_proto=define
14798                 set d_getlogin_r_proto getlogin_r $hdrs
14799                 eval $hasproto ;;
14800         *)      ;;
14801         esac
14802         case "$d_getlogin_r_proto" in
14803         define)
14804         case "$getlogin_r_proto" in
14805         ''|0) try='int getlogin_r(char*, size_t);'
14806         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14807         esac
14808         case "$getlogin_r_proto" in
14809         ''|0) try='int getlogin_r(char*, int);'
14810         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14811         esac
14812         case "$getlogin_r_proto" in
14813         ''|0) try='char* getlogin_r(char*, size_t);'
14814         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14815         esac
14816         case "$getlogin_r_proto" in
14817         ''|0) try='char* getlogin_r(char*, int);'
14818         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14819         esac
14820         case "$getlogin_r_proto" in
14821         ''|0)   d_getlogin_r=undef
14822                 getlogin_r_proto=0
14823                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14824         * )     case "$getlogin_r_proto" in
14825                 REENTRANT_PROTO*) ;;
14826                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14827                 esac
14828                 echo "Prototype: $try" ;;
14829         esac
14830         ;;
14831         *)      case "$usethreads" in
14832                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14833                 esac
14834                 d_getlogin_r=undef
14835                 getlogin_r_proto=0
14836                 ;;
14837         esac
14838         ;;
14839 *)      getlogin_r_proto=0
14840         ;;
14841 esac
14842
14843 : see if getmnt exists
14844 set getmnt d_getmnt
14845 eval $inlibc
14846
14847 : see if getmntent exists
14848 set getmntent d_getmntent
14849 eval $inlibc
14850
14851 : see if getnameinfo exists
14852 set getnameinfo d_getnameinfo
14853 eval $inlibc
14854
14855 : see if getnetbyaddr exists
14856 set getnetbyaddr d_getnbyaddr
14857 eval $inlibc
14858
14859 : see if getnetbyname exists
14860 set getnetbyname d_getnbyname
14861 eval $inlibc
14862
14863 : see if getnetent exists
14864 set getnetent d_getnent
14865 eval $inlibc
14866
14867 : see if getnetbyaddr_r exists
14868 set getnetbyaddr_r d_getnetbyaddr_r
14869 eval $inlibc
14870 case "$d_getnetbyaddr_r" in
14871 "$define")
14872         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14873         case "$d_getnetbyaddr_r_proto:$usethreads" in
14874         ":define")      d_getnetbyaddr_r_proto=define
14875                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14876                 eval $hasproto ;;
14877         *)      ;;
14878         esac
14879         case "$d_getnetbyaddr_r_proto" in
14880         define)
14881         case "$getnetbyaddr_r_proto" in
14882         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14883         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14884         esac
14885         case "$getnetbyaddr_r_proto" in
14886         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14887         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14888         esac
14889         case "$getnetbyaddr_r_proto" in
14890         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14891         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14892         esac
14893         case "$getnetbyaddr_r_proto" in
14894         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14895         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14896         esac
14897         case "$getnetbyaddr_r_proto" in
14898         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14899         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14900         esac
14901         case "$getnetbyaddr_r_proto" in
14902         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14903         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14904         esac
14905         case "$getnetbyaddr_r_proto" in
14906         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14907         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14908         esac
14909         case "$getnetbyaddr_r_proto" in
14910         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14911         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14912         esac
14913         case "$getnetbyaddr_r_proto" in
14914         ''|0)   d_getnetbyaddr_r=undef
14915                 getnetbyaddr_r_proto=0
14916                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14917         * )     case "$getnetbyaddr_r_proto" in
14918                 REENTRANT_PROTO*) ;;
14919                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14920                 esac
14921                 echo "Prototype: $try" ;;
14922         esac
14923         ;;
14924         *)      case "$usethreads" in
14925                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14926                 esac
14927                 d_getnetbyaddr_r=undef
14928                 getnetbyaddr_r_proto=0
14929                 ;;
14930         esac
14931         ;;
14932 *)      getnetbyaddr_r_proto=0
14933         ;;
14934 esac
14935
14936 : see if getnetbyname_r exists
14937 set getnetbyname_r d_getnetbyname_r
14938 eval $inlibc
14939 case "$d_getnetbyname_r" in
14940 "$define")
14941         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14942         case "$d_getnetbyname_r_proto:$usethreads" in
14943         ":define")      d_getnetbyname_r_proto=define
14944                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14945                 eval $hasproto ;;
14946         *)      ;;
14947         esac
14948         case "$d_getnetbyname_r_proto" in
14949         define)
14950         case "$getnetbyname_r_proto" in
14951         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14952         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14953         esac
14954         case "$getnetbyname_r_proto" in
14955         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14956         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14957         esac
14958         case "$getnetbyname_r_proto" in
14959         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14960         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14961         esac
14962         case "$getnetbyname_r_proto" in
14963         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14964         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14965         esac
14966         case "$getnetbyname_r_proto" in
14967         ''|0)   d_getnetbyname_r=undef
14968                 getnetbyname_r_proto=0
14969                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14970         * )     case "$getnetbyname_r_proto" in
14971                 REENTRANT_PROTO*) ;;
14972                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14973                 esac
14974                 echo "Prototype: $try" ;;
14975         esac
14976         ;;
14977         *)      case "$usethreads" in
14978                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14979                 esac
14980                 d_getnetbyname_r=undef
14981                 getnetbyname_r_proto=0
14982                 ;;
14983         esac
14984         ;;
14985 *)      getnetbyname_r_proto=0
14986         ;;
14987 esac
14988
14989 : see if getnetent_r exists
14990 set getnetent_r d_getnetent_r
14991 eval $inlibc
14992 case "$d_getnetent_r" in
14993 "$define")
14994         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14995         case "$d_getnetent_r_proto:$usethreads" in
14996         ":define")      d_getnetent_r_proto=define
14997                 set d_getnetent_r_proto getnetent_r $hdrs
14998                 eval $hasproto ;;
14999         *)      ;;
15000         esac
15001         case "$d_getnetent_r_proto" in
15002         define)
15003         case "$getnetent_r_proto" in
15004         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15005         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15006         esac
15007         case "$getnetent_r_proto" in
15008         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15009         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15010         esac
15011         case "$getnetent_r_proto" in
15012         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15013         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15014         esac
15015         case "$getnetent_r_proto" in
15016         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15017         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15018         esac
15019         case "$getnetent_r_proto" in
15020         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15021         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15022         esac
15023         case "$getnetent_r_proto" in
15024         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15025         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15026         esac
15027         case "$getnetent_r_proto" in
15028         ''|0)   d_getnetent_r=undef
15029                 getnetent_r_proto=0
15030                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15031         * )     case "$getnetent_r_proto" in
15032                 REENTRANT_PROTO*) ;;
15033                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15034                 esac
15035                 echo "Prototype: $try" ;;
15036         esac
15037         ;;
15038         *)      case "$usethreads" in
15039                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15040                 esac
15041                 d_getnetent_r=undef
15042                 getnetent_r_proto=0
15043                 ;;
15044         esac
15045         ;;
15046 *)      getnetent_r_proto=0
15047         ;;
15048 esac
15049
15050 : see if prototypes for various getnetxxx netdb.h functions are available
15051 echo " "
15052 set d_getnetprotos getnetent $i_netdb netdb.h
15053 eval $hasproto
15054
15055 : see if getpagesize exists
15056 set getpagesize d_getpagsz
15057 eval $inlibc
15058
15059 : Optional checks for getprotobyname and getprotobynumber
15060
15061 : see if getprotobyname exists
15062 set getprotobyname d_getpbyname
15063 eval $inlibc
15064
15065 : see if getprotobynumber exists
15066 set getprotobynumber d_getpbynumber
15067 eval $inlibc
15068
15069 : see if getprotoent exists
15070 set getprotoent d_getpent
15071 eval $inlibc
15072
15073 : see if getpgid exists
15074 set getpgid d_getpgid
15075 eval $inlibc
15076
15077 : see if getpgrp2 exists
15078 set getpgrp2 d_getpgrp2
15079 eval $inlibc
15080
15081 : see if getppid exists
15082 set getppid d_getppid
15083 eval $inlibc
15084
15085 : see if getpriority exists
15086 set getpriority d_getprior
15087 eval $inlibc
15088
15089 : see if getprotobyname_r exists
15090 set getprotobyname_r d_getprotobyname_r
15091 eval $inlibc
15092 case "$d_getprotobyname_r" in
15093 "$define")
15094         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15095         case "$d_getprotobyname_r_proto:$usethreads" in
15096         ":define")      d_getprotobyname_r_proto=define
15097                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15098                 eval $hasproto ;;
15099         *)      ;;
15100         esac
15101         case "$d_getprotobyname_r_proto" in
15102         define)
15103         case "$getprotobyname_r_proto" in
15104         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15105         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15106         esac
15107         case "$getprotobyname_r_proto" in
15108         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15109         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15110         esac
15111         case "$getprotobyname_r_proto" in
15112         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15113         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15114         esac
15115         case "$getprotobyname_r_proto" in
15116         ''|0)   d_getprotobyname_r=undef
15117                 getprotobyname_r_proto=0
15118                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15119         * )     case "$getprotobyname_r_proto" in
15120                 REENTRANT_PROTO*) ;;
15121                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15122                 esac
15123                 echo "Prototype: $try" ;;
15124         esac
15125         ;;
15126         *)      case "$usethreads" in
15127                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15128                 esac
15129                 d_getprotobyname_r=undef
15130                 getprotobyname_r_proto=0
15131                 ;;
15132         esac
15133         ;;
15134 *)      getprotobyname_r_proto=0
15135         ;;
15136 esac
15137
15138 : see if getprotobynumber_r exists
15139 set getprotobynumber_r d_getprotobynumber_r
15140 eval $inlibc
15141 case "$d_getprotobynumber_r" in
15142 "$define")
15143         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15144         case "$d_getprotobynumber_r_proto:$usethreads" in
15145         ":define")      d_getprotobynumber_r_proto=define
15146                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15147                 eval $hasproto ;;
15148         *)      ;;
15149         esac
15150         case "$d_getprotobynumber_r_proto" in
15151         define)
15152         case "$getprotobynumber_r_proto" in
15153         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15154         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15155         esac
15156         case "$getprotobynumber_r_proto" in
15157         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15158         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15159         esac
15160         case "$getprotobynumber_r_proto" in
15161         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15162         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15163         esac
15164         case "$getprotobynumber_r_proto" in
15165         ''|0)   d_getprotobynumber_r=undef
15166                 getprotobynumber_r_proto=0
15167                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15168         * )     case "$getprotobynumber_r_proto" in
15169                 REENTRANT_PROTO*) ;;
15170                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15171                 esac
15172                 echo "Prototype: $try" ;;
15173         esac
15174         ;;
15175         *)      case "$usethreads" in
15176                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15177                 esac
15178                 d_getprotobynumber_r=undef
15179                 getprotobynumber_r_proto=0
15180                 ;;
15181         esac
15182         ;;
15183 *)      getprotobynumber_r_proto=0
15184         ;;
15185 esac
15186
15187 : see if getprotoent_r exists
15188 set getprotoent_r d_getprotoent_r
15189 eval $inlibc
15190 case "$d_getprotoent_r" in
15191 "$define")
15192         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15193         case "$d_getprotoent_r_proto:$usethreads" in
15194         ":define")      d_getprotoent_r_proto=define
15195                 set d_getprotoent_r_proto getprotoent_r $hdrs
15196                 eval $hasproto ;;
15197         *)      ;;
15198         esac
15199         case "$d_getprotoent_r_proto" in
15200         define)
15201         case "$getprotoent_r_proto" in
15202         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15203         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15204         esac
15205         case "$getprotoent_r_proto" in
15206         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15207         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15208         esac
15209         case "$getprotoent_r_proto" in
15210         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15211         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15212         esac
15213         case "$getprotoent_r_proto" in
15214         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15215         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15216         esac
15217         case "$getprotoent_r_proto" in
15218         ''|0)   d_getprotoent_r=undef
15219                 getprotoent_r_proto=0
15220                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15221         * )     case "$getprotoent_r_proto" in
15222                 REENTRANT_PROTO*) ;;
15223                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15224                 esac
15225                 echo "Prototype: $try" ;;
15226         esac
15227         ;;
15228         *)      case "$usethreads" in
15229                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15230                 esac
15231                 d_getprotoent_r=undef
15232                 getprotoent_r_proto=0
15233                 ;;
15234         esac
15235         ;;
15236 *)      getprotoent_r_proto=0
15237         ;;
15238 esac
15239
15240 : see if prototypes for various getprotoxxx netdb.h functions are available
15241 echo " "
15242 set d_getprotoprotos getprotoent $i_netdb netdb.h
15243 eval $hasproto
15244
15245 : see if getprpwnam exists
15246 set getprpwnam d_getprpwnam
15247 eval $inlibc
15248
15249 : see if getpwent exists
15250 set getpwent d_getpwent
15251 eval $inlibc
15252
15253 : see if getpwent_r exists
15254 set getpwent_r d_getpwent_r
15255 eval $inlibc
15256 case "$d_getpwent_r" in
15257 "$define")
15258         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15259         case "$d_getpwent_r_proto:$usethreads" in
15260         ":define")      d_getpwent_r_proto=define
15261                 set d_getpwent_r_proto getpwent_r $hdrs
15262                 eval $hasproto ;;
15263         *)      ;;
15264         esac
15265         case "$d_getpwent_r_proto" in
15266         define)
15267         case "$getpwent_r_proto" in
15268         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15269         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15270         esac
15271         case "$getpwent_r_proto" in
15272         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15273         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15274         esac
15275         case "$getpwent_r_proto" in
15276         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15277         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15278         esac
15279         case "$getpwent_r_proto" in
15280         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15281         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15282         esac
15283         case "$getpwent_r_proto" in
15284         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15285         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15286         esac
15287         case "$getpwent_r_proto" in
15288         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15289         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15290         esac
15291         case "$getpwent_r_proto" in
15292         ''|0)   d_getpwent_r=undef
15293                 getpwent_r_proto=0
15294                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15295         * )     case "$getpwent_r_proto" in
15296                 REENTRANT_PROTO*) ;;
15297                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15298                 esac
15299                 echo "Prototype: $try" ;;
15300         esac
15301         ;;
15302         *)      case "$usethreads" in
15303                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15304                 esac
15305                 d_getpwent_r=undef
15306                 getpwent_r_proto=0
15307                 ;;
15308         esac
15309         ;;
15310 *)      getpwent_r_proto=0
15311         ;;
15312 esac
15313
15314 : see if getpwnam_r exists
15315 set getpwnam_r d_getpwnam_r
15316 eval $inlibc
15317 case "$d_getpwnam_r" in
15318 "$define")
15319         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15320         case "$d_getpwnam_r_proto:$usethreads" in
15321         ":define")      d_getpwnam_r_proto=define
15322                 set d_getpwnam_r_proto getpwnam_r $hdrs
15323                 eval $hasproto ;;
15324         *)      ;;
15325         esac
15326         case "$d_getpwnam_r_proto" in
15327         define)
15328         case "$getpwnam_r_proto" in
15329         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15330         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15331         esac
15332         case "$getpwnam_r_proto" in
15333         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15334         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15335         esac
15336         case "$getpwnam_r_proto" in
15337         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15338         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15339         esac
15340         case "$getpwnam_r_proto" in
15341         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15342         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15343         esac
15344         case "$getpwnam_r_proto" in
15345         ''|0)   d_getpwnam_r=undef
15346                 getpwnam_r_proto=0
15347                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15348         * )     case "$getpwnam_r_proto" in
15349                 REENTRANT_PROTO*) ;;
15350                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15351                 esac
15352                 echo "Prototype: $try" ;;
15353         esac
15354         ;;
15355         *)      case "$usethreads" in
15356                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15357                 esac
15358                 d_getpwnam_r=undef
15359                 getpwnam_r_proto=0
15360                 ;;
15361         esac
15362         ;;
15363 *)      getpwnam_r_proto=0
15364         ;;
15365 esac
15366
15367 : see if getpwuid_r exists
15368 set getpwuid_r d_getpwuid_r
15369 eval $inlibc
15370 case "$d_getpwuid_r" in
15371 "$define")
15372         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15373         case "$d_getpwuid_r_proto:$usethreads" in
15374         ":define")      d_getpwuid_r_proto=define
15375                 set d_getpwuid_r_proto getpwuid_r $hdrs
15376                 eval $hasproto ;;
15377         *)      ;;
15378         esac
15379         case "$d_getpwuid_r_proto" in
15380         define)
15381         case "$getpwuid_r_proto" in
15382         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15383         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15384         esac
15385         case "$getpwuid_r_proto" in
15386         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15387         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15388         esac
15389         case "$getpwuid_r_proto" in
15390         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15391         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15392         esac
15393         case "$getpwuid_r_proto" in
15394         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15395         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15396         esac
15397         case "$getpwuid_r_proto" in
15398         ''|0)   d_getpwuid_r=undef
15399                 getpwuid_r_proto=0
15400                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15401         * )     case "$getpwuid_r_proto" in
15402                 REENTRANT_PROTO*) ;;
15403                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15404                 esac
15405                 echo "Prototype: $try" ;;
15406         esac
15407         ;;
15408         *)      case "$usethreads" in
15409                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15410                 esac
15411                 d_getpwuid_r=undef
15412                 getpwuid_r_proto=0
15413                 ;;
15414         esac
15415         ;;
15416 *)      getpwuid_r_proto=0
15417         ;;
15418 esac
15419
15420 : Optional checks for getsbyname and getsbyport
15421
15422 : see if getservbyname exists
15423 set getservbyname d_getsbyname
15424 eval $inlibc
15425
15426 : see if getservbyport exists
15427 set getservbyport d_getsbyport
15428 eval $inlibc
15429
15430 : see if getservent exists
15431 set getservent d_getsent
15432 eval $inlibc
15433
15434 : see if getservbyname_r exists
15435 set getservbyname_r d_getservbyname_r
15436 eval $inlibc
15437 case "$d_getservbyname_r" in
15438 "$define")
15439         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15440         case "$d_getservbyname_r_proto:$usethreads" in
15441         ":define")      d_getservbyname_r_proto=define
15442                 set d_getservbyname_r_proto getservbyname_r $hdrs
15443                 eval $hasproto ;;
15444         *)      ;;
15445         esac
15446         case "$d_getservbyname_r_proto" in
15447         define)
15448         case "$getservbyname_r_proto" in
15449         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15450         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15451         esac
15452         case "$getservbyname_r_proto" in
15453         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15454         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15455         esac
15456         case "$getservbyname_r_proto" in
15457         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15458         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15459         esac
15460         case "$getservbyname_r_proto" in
15461         ''|0)   d_getservbyname_r=undef
15462                 getservbyname_r_proto=0
15463                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15464         * )     case "$getservbyname_r_proto" in
15465                 REENTRANT_PROTO*) ;;
15466                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15467                 esac
15468                 echo "Prototype: $try" ;;
15469         esac
15470         ;;
15471         *)      case "$usethreads" in
15472                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15473                 esac
15474                 d_getservbyname_r=undef
15475                 getservbyname_r_proto=0
15476                 ;;
15477         esac
15478         ;;
15479 *)      getservbyname_r_proto=0
15480         ;;
15481 esac
15482
15483 : see if getservbyport_r exists
15484 set getservbyport_r d_getservbyport_r
15485 eval $inlibc
15486 case "$d_getservbyport_r" in
15487 "$define")
15488         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15489         case "$d_getservbyport_r_proto:$usethreads" in
15490         ":define")      d_getservbyport_r_proto=define
15491                 set d_getservbyport_r_proto getservbyport_r $hdrs
15492                 eval $hasproto ;;
15493         *)      ;;
15494         esac
15495         case "$d_getservbyport_r_proto" in
15496         define)
15497         case "$getservbyport_r_proto" in
15498         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15499         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15500         esac
15501         case "$getservbyport_r_proto" in
15502         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15503         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15504         esac
15505         case "$getservbyport_r_proto" in
15506         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15507         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15508         esac
15509         case "$getservbyport_r_proto" in
15510         ''|0)   d_getservbyport_r=undef
15511                 getservbyport_r_proto=0
15512                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15513         * )     case "$getservbyport_r_proto" in
15514                 REENTRANT_PROTO*) ;;
15515                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15516                 esac
15517                 echo "Prototype: $try" ;;
15518         esac
15519         ;;
15520         *)      case "$usethreads" in
15521                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15522                 esac
15523                 d_getservbyport_r=undef
15524                 getservbyport_r_proto=0
15525                 ;;
15526         esac
15527         ;;
15528 *)      getservbyport_r_proto=0
15529         ;;
15530 esac
15531
15532 : see if getservent_r exists
15533 set getservent_r d_getservent_r
15534 eval $inlibc
15535 case "$d_getservent_r" in
15536 "$define")
15537         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15538         case "$d_getservent_r_proto:$usethreads" in
15539         ":define")      d_getservent_r_proto=define
15540                 set d_getservent_r_proto getservent_r $hdrs
15541                 eval $hasproto ;;
15542         *)      ;;
15543         esac
15544         case "$d_getservent_r_proto" in
15545         define)
15546         case "$getservent_r_proto" in
15547         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15548         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15549         esac
15550         case "$getservent_r_proto" in
15551         ''|0) try='int getservent_r(struct servent*, char*, int);'
15552         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15553         esac
15554         case "$getservent_r_proto" in
15555         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15556         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15557         esac
15558         case "$getservent_r_proto" in
15559         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15560         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15561         esac
15562         case "$getservent_r_proto" in
15563         ''|0)   d_getservent_r=undef
15564                 getservent_r_proto=0
15565                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15566         * )     case "$getservent_r_proto" in
15567                 REENTRANT_PROTO*) ;;
15568                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15569                 esac
15570                 echo "Prototype: $try" ;;
15571         esac
15572         ;;
15573         *)      case "$usethreads" in
15574                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15575                 esac
15576                 d_getservent_r=undef
15577                 getservent_r_proto=0
15578                 ;;
15579         esac
15580         ;;
15581 *)      getservent_r_proto=0
15582         ;;
15583 esac
15584
15585 : see if prototypes for various getservxxx netdb.h functions are available
15586 echo " "
15587 set d_getservprotos getservent $i_netdb netdb.h
15588 eval $hasproto
15589
15590 : see if getspnam exists
15591 set getspnam d_getspnam
15592 eval $inlibc
15593
15594 : see if this is a shadow.h system
15595 set shadow.h i_shadow
15596 eval $inhdr
15597
15598 : see if getspnam_r exists
15599 set getspnam_r d_getspnam_r
15600 eval $inlibc
15601 case "$d_getspnam_r" in
15602 "$define")
15603         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15604         case "$d_getspnam_r_proto:$usethreads" in
15605         ":define")      d_getspnam_r_proto=define
15606                 set d_getspnam_r_proto getspnam_r $hdrs
15607                 eval $hasproto ;;
15608         *)      ;;
15609         esac
15610         case "$d_getspnam_r_proto" in
15611         define)
15612         case "$getspnam_r_proto" in
15613         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15614         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15615         esac
15616         case "$getspnam_r_proto" in
15617         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15618         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15619         esac
15620         case "$getspnam_r_proto" in
15621         ''|0)   d_getspnam_r=undef
15622                 getspnam_r_proto=0
15623                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15624         * )     case "$getspnam_r_proto" in
15625                 REENTRANT_PROTO*) ;;
15626                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15627                 esac
15628                 echo "Prototype: $try" ;;
15629         esac
15630         ;;
15631         *)      case "$usethreads" in
15632                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15633                 esac
15634                 d_getspnam_r=undef
15635                 getspnam_r_proto=0
15636                 ;;
15637         esac
15638         ;;
15639 *)      getspnam_r_proto=0
15640         ;;
15641 esac
15642
15643 : see if gettimeofday or ftime exists
15644 set gettimeofday d_gettimeod
15645 eval $inlibc
15646 case "$d_gettimeod" in
15647 "$undef")
15648         set ftime d_ftime 
15649         eval $inlibc
15650         ;;
15651 *)
15652         val="$undef"; set d_ftime; eval $setvar
15653         ;;
15654 esac
15655 case "$d_gettimeod$d_ftime" in
15656 "$undef$undef")
15657         echo " "
15658         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15659         ;;
15660 esac
15661
15662 : see if gmtime_r exists
15663 set gmtime_r d_gmtime_r
15664 eval $inlibc
15665 case "$d_gmtime_r" in
15666 "$define")
15667         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15668         case "$d_gmtime_r_proto:$usethreads" in
15669         ":define")      d_gmtime_r_proto=define
15670                 set d_gmtime_r_proto gmtime_r $hdrs
15671                 eval $hasproto ;;
15672         *)      ;;
15673         esac
15674         case "$d_gmtime_r_proto" in
15675         define)
15676         case "$gmtime_r_proto" in
15677         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15678         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15679         esac
15680         case "$gmtime_r_proto" in
15681         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15682         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15683         esac
15684         case "$gmtime_r_proto" in
15685         ''|0)   d_gmtime_r=undef
15686                 gmtime_r_proto=0
15687                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15688         * )     case "$gmtime_r_proto" in
15689                 REENTRANT_PROTO*) ;;
15690                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15691                 esac
15692                 echo "Prototype: $try" ;;
15693         esac
15694         ;;
15695         *)      case "$usethreads" in
15696                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15697                 esac
15698                 d_gmtime_r=undef
15699                 gmtime_r_proto=0
15700                 ;;
15701         esac
15702         ;;
15703 *)      gmtime_r_proto=0
15704         ;;
15705 esac
15706
15707 : see if hasmntopt exists
15708 set hasmntopt d_hasmntopt
15709 eval $inlibc
15710
15711 : see if this is a netinet/in.h or sys/in.h system
15712 set netinet/in.h i_niin sys/in.h i_sysin
15713 eval $inhdr
15714
15715 : see if arpa/inet.h has to be included
15716 set arpa/inet.h i_arpainet
15717 eval $inhdr
15718
15719 : see if htonl --and friends-- exists
15720 val=''
15721 set htonl val
15722 eval $inlibc
15723
15724 : Maybe they are macros.
15725 case "$val" in
15726 $undef)
15727         $cat >htonl.c <<EOM
15728 #include <stdio.h>
15729 #include <sys/types.h>
15730 #$i_niin I_NETINET_IN
15731 #$i_sysin I_SYS_IN
15732 #$i_arpainet I_ARPA_INET
15733 #ifdef I_NETINET_IN
15734 #include <netinet/in.h>
15735 #endif
15736 #ifdef I_SYS_IN
15737 #include <sys/in.h>
15738 #endif
15739 #ifdef I_ARPA_INET
15740 #include <arpa/inet.h>
15741 #endif
15742 #ifdef htonl
15743 printf("Defined as a macro.");
15744 #endif
15745 EOM
15746         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15747         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15748                 val="$define"
15749                 echo "But it seems to be defined as a macro." >&4
15750         fi
15751         $rm -f htonl.?
15752         ;;
15753 esac
15754 set d_htonl
15755 eval $setvar
15756
15757 : see if hypot exists
15758 set hypot d_hypot
15759 eval $inlibc
15760
15761 : see if ilogb exists
15762 set ilogb d_ilogb
15763 eval $inlibc
15764
15765 : see if ilogbl exists
15766 set ilogbl d_ilogbl
15767 eval $inlibc
15768
15769 : index or strchr
15770 echo " "
15771 if set index val -f; eval $csym; $val; then
15772         if set strchr val -f d_strchr; eval $csym; $val; then
15773                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15774                         val="$define"
15775                         vali="$undef"
15776                         echo "strchr() found." >&4
15777                 else
15778                         val="$undef"
15779                         vali="$define"
15780                         echo "index() found." >&4
15781                 fi
15782         else
15783                 val="$undef"
15784                 vali="$define"
15785                 echo "index() found." >&4
15786         fi
15787 else
15788         if set strchr val -f d_strchr; eval $csym; $val; then
15789                 val="$define"
15790                 vali="$undef"
15791                 echo "strchr() found." >&4
15792         else
15793                 echo "No index() or strchr() found!" >&4
15794                 val="$undef"
15795                 vali="$undef"
15796         fi
15797 fi
15798 set d_strchr; eval $setvar
15799 val="$vali"
15800 set d_index; eval $setvar
15801
15802 : check whether inet_aton exists
15803 set inet_aton d_inetaton
15804 eval $inlibc
15805
15806 : see if inet_ntop exists
15807 set inet_ntop d_inetntop
15808 eval $inlibc
15809
15810 : see if inet_pton exists
15811 set inet_pton d_inetpton
15812 eval $inlibc
15813
15814 : Look for isascii
15815 echo " "
15816 $cat >isascii.c <<EOCP
15817 #include <stdio.h>
15818 #include <ctype.h>
15819 #$i_stdlib I_STDLIB
15820 #ifdef I_STDLIB
15821 #include <stdlib.h>
15822 #endif
15823 int main() {
15824         int c = 'A';
15825         if (isascii(c))
15826                 exit(0);
15827         else
15828                 exit(1);
15829 }
15830 EOCP
15831 set isascii
15832 if eval $compile; then
15833         echo "isascii() found." >&4
15834         val="$define"
15835 else
15836         echo "isascii() NOT found." >&4
15837         val="$undef"
15838 fi
15839 set d_isascii
15840 eval $setvar
15841 $rm -f isascii*
15842
15843 : Look for isblank
15844 echo " "
15845 $cat >isblank.c <<'EOCP'
15846 #include <stdio.h>
15847 #include <ctype.h>
15848 int main() {
15849         int c = ' ';
15850         if (isblank(c))
15851                 return 0 ;
15852         else
15853                 return 1 ;
15854 }
15855 EOCP
15856 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15857         echo "isblank() found." >&4
15858         val="$define"
15859 else
15860         echo "isblank() NOT found." >&4
15861         val="$undef"
15862 fi
15863 set d_isblank
15864 eval $setvar
15865 $rm -f isblank*
15866
15867 : check for isfinite
15868 echo "Checking to see if you have isfinite..." >&4
15869 $cat >try.c <<EOCP
15870 #$i_math I_MATH
15871 #ifdef I_MATH
15872 #include <math.h>
15873 #endif
15874 int main() { return isfinite(0.0); }
15875 EOCP
15876 set try
15877 if eval $compile; then
15878         val="$define"
15879         echo "You have isfinite."
15880 else
15881         val="$undef"
15882         echo "You do not have isfinite."
15883 fi
15884 $rm_try
15885 set d_isfinite
15886 eval $setvar
15887
15888 : see if isfinitel exists
15889 set isfinitel d_isfinitel
15890 eval $inlibc
15891
15892 : check for isinf
15893 echo "Checking to see if you have isinf..." >&4
15894 $cat >try.c <<EOCP
15895 #$i_math I_MATH
15896 #ifdef I_MATH
15897 #include <math.h>
15898 #endif
15899 int main() { return isinf(0.0); }
15900 EOCP
15901 set try
15902 if eval $compile; then
15903         val="$define"
15904         echo "You have isinf."
15905 else
15906         val="$undef"
15907         echo "You do not have isinf."
15908 fi
15909 $rm_try
15910 set d_isinf
15911 eval $setvar
15912
15913 : see if isinfl exists
15914 set isinfl d_isinfl
15915 eval $inlibc
15916
15917 : check for isless
15918 echo "Checking to see if you have isless..." >&4
15919 $cat >try.c <<EOCP
15920 #$i_math I_MATH
15921 #ifdef I_MATH
15922 #include <math.h>
15923 #endif
15924 int main() { return isless(0.0); }
15925 EOCP
15926 set try
15927 if eval $compile; then
15928         val="$define"
15929         echo "You have isless."
15930 else
15931         val="$undef"
15932         echo "You do not have isless."
15933 fi
15934 $rm_try
15935 set d_isless
15936 eval $setvar
15937
15938 : check for isnan
15939 echo "Checking to see if you have isnan..." >&4
15940 $cat >try.c <<EOCP
15941 #$i_math I_MATH
15942 #ifdef I_MATH
15943 #include <math.h>
15944 #endif
15945 int main() { return isnan(0.0); }
15946 EOCP
15947 set try
15948 if eval $compile; then
15949         val="$define"
15950         echo "You have isnan."
15951 else
15952         val="$undef"
15953         echo "You do not have isnan."
15954 fi
15955 $rm_try
15956 set d_isnan
15957 eval $setvar
15958
15959 : see if isnanl exists
15960 set isnanl d_isnanl
15961 eval $inlibc
15962
15963 : check for isnormal
15964 echo "Checking to see if you have isnormal..." >&4
15965 $cat >try.c <<EOCP
15966 #$i_math I_MATH
15967 #ifdef I_MATH
15968 #include <math.h>
15969 #endif
15970 int main() { return isnormal(0.0); }
15971 EOCP
15972 set try
15973 if eval $compile; then
15974         val="$define"
15975         echo "You have isnormal."
15976 else
15977         val="$undef"
15978         echo "You do not have isnormal."
15979 fi
15980 $rm_try
15981 set d_isnormal
15982 eval $setvar
15983
15984 : see if j0 exists
15985 set j0 d_j0
15986 eval $inlibc
15987
15988 : see if j0l exists
15989 set j0l d_j0l
15990 eval $inlibc
15991
15992 : see if killpg exists
15993 set killpg d_killpg
15994 eval $inlibc
15995
15996 : see if localeconv exists
15997 set localeconv d_locconv
15998 eval $inlibc
15999
16000 : see if libc has the POSIX.1-2008 currency locale rules
16001 case "$d_locconv:$d_lc_monetary_2008" in
16002 $define:)
16003         $cat >try.c <<EOCP
16004 #include <locale.h>
16005 int main() {
16006         struct lconv *lc = localeconv();
16007         char int_p_cs_precedes = lc->int_p_cs_precedes;
16008         return 0;
16009 }
16010 EOCP
16011         set try
16012         if eval $compile; then
16013                 d_lc_monetary_2008="$define"
16014         else
16015                 d_lc_monetary_2008="$undef"
16016         fi;
16017         $rm_try
16018         ;;
16019 esac
16020
16021 : see if lchown exists
16022 echo " "
16023 $cat > try.c <<'EOCP'
16024 /* System header to define __stub macros and hopefully few prototypes,
16025     which can conflict with char lchown(); below.  */
16026 #include <assert.h>
16027 /* Override any gcc2 internal prototype to avoid an error.  */
16028 /* We use char because int might match the return type of a gcc2
16029    builtin and then its argument prototype would still apply.  */
16030 char lchown();
16031 int main() {
16032     /*  The GNU C library defines this for functions which it implements
16033         to always fail with ENOSYS.  Some functions are actually named
16034         something starting with __ and the normal name is an alias.  */
16035 #if defined (__stub_lchown) || defined (__stub___lchown)
16036 choke me
16037 #else
16038 lchown();
16039 #endif
16040 ; return 0; }
16041 EOCP
16042 set try
16043 if eval $compile; then
16044     $echo "lchown() found." >&4
16045     val="$define"
16046 else
16047     $echo "lchown() NOT found." >&4
16048     val="$undef"
16049 fi
16050 set d_lchown
16051 eval $setvar
16052
16053 : See if number of significant digits in a double precision number is known
16054 echo " "
16055 $cat >ldbl_dig.c <<EOM
16056 #$i_limits I_LIMITS
16057 #$i_float I_FLOAT
16058 #ifdef I_LIMITS
16059 #include <limits.h>
16060 #endif
16061 #ifdef I_FLOAT
16062 #include <float.h>
16063 #endif
16064 #ifdef LDBL_DIG
16065 printf("Contains LDBL_DIG");
16066 #endif
16067 EOM
16068 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16069 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16070         echo "LDBL_DIG found." >&4
16071         val="$define"
16072 else
16073         echo "LDBL_DIG NOT found." >&4
16074         val="$undef"
16075 fi
16076 $rm -f ldbl_dig.?
16077 set d_ldbl_dig
16078 eval $setvar
16079
16080 : see if lgamma exists
16081 set lgamma d_lgamma
16082 eval $inlibc
16083
16084 : see if lgamma_r exists
16085 set lgamma_r d_lgamma_r
16086 eval $inlibc
16087
16088 : check to see if math.h defines _LIB_VERSION
16089 d_libm_lib_version="$undef"
16090 case $i_math in
16091     $define)
16092         echo " "
16093         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16094         $cat >try.c <<EOCP
16095 #include <unistd.h>
16096 #include <math.h>
16097 int main (int argc, char *argv[])
16098 {
16099     printf ("%d\n", _LIB_VERSION);
16100     return (0);
16101     } /* main */
16102 EOCP
16103         set try
16104         if eval $compile; then
16105             foo=`$run ./try`
16106             echo "Yes, it does ($foo)" >&4
16107             d_libm_lib_version="$define"
16108         else
16109             echo "No, it does not (probably harmless)" >&4
16110             fi
16111         $rm_try
16112         ;;
16113
16114     esac
16115
16116 : see if link exists
16117 set link d_link
16118 eval $inlibc
16119
16120 : see if llrint exists
16121 set llrint d_llrint
16122 eval $inlibc
16123
16124 : see if llrintl exists
16125 set llrintl d_llrintl
16126 eval $inlibc
16127
16128 : see if llround exists
16129 set llround d_llround
16130 eval $inlibc
16131
16132 : see if llroundl exists
16133 set llroundl d_llroundl
16134 eval $inlibc
16135
16136 : see if localtime_r exists
16137 set localtime_r d_localtime_r
16138 eval $inlibc
16139 case "$d_localtime_r" in
16140 "$define")
16141         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16142         case "$d_localtime_r_proto:$usethreads" in
16143         ":define")      d_localtime_r_proto=define
16144                 set d_localtime_r_proto localtime_r $hdrs
16145                 eval $hasproto ;;
16146         *)      ;;
16147         esac
16148         case "$d_localtime_r_proto" in
16149         define)
16150         case "$localtime_r_proto" in
16151         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16152         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16153         esac
16154         case "$localtime_r_proto" in
16155         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16156         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16157         esac
16158         case "$localtime_r_proto" in
16159         ''|0)   d_localtime_r=undef
16160                 localtime_r_proto=0
16161                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16162         * )     case "$localtime_r_proto" in
16163                 REENTRANT_PROTO*) ;;
16164                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16165                 esac
16166                 echo "Prototype: $try" ;;
16167         esac
16168         ;;
16169         *)      case "$usethreads" in
16170                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16171                 esac
16172                 d_localtime_r=undef
16173                 localtime_r_proto=0
16174                 ;;
16175         esac
16176         ;;
16177 *)      localtime_r_proto=0
16178         ;;
16179 esac
16180
16181 : see if localtime_r calls tzset
16182 case "$localtime_r_proto" in
16183 REENTRANT_PROTO*)
16184         $cat >try.c <<EOCP
16185 /*  Does our libc's localtime_r call tzset ?
16186  *  return 0 if so, 1 otherwise.
16187  */
16188 #$i_systypes    I_SYS_TYPES
16189 #$i_unistd      I_UNISTD
16190 #$i_time        I_TIME
16191 #$i_stdlib      I_STDLIB
16192 #$i_string      I_STRING
16193 #$i_malloc      I_MALLOC
16194 #ifdef I_SYS_TYPES
16195 #  include <sys/types.h>
16196 #endif
16197 #ifdef I_UNISTD
16198 #  include <unistd.h>
16199 #endif
16200 #ifdef I_TIME
16201 #  include <time.h>
16202 #endif
16203 #ifdef I_STDLIB
16204 #include <stdlib.h>
16205 #endif
16206 #ifdef I_STRING
16207 #  include <string.h>
16208 #else
16209 #  include <strings.h>
16210 #endif
16211 #ifdef I_MALLOC
16212 #  include <malloc.h>
16213 #endif
16214 int main()
16215 {
16216     time_t t = time(0L);
16217     char w_tz[]="TZ" "=GMT+5",
16218          e_tz[]="TZ" "=GMT-5",
16219         *tz_e = (char*)malloc(16),
16220         *tz_w = (char*)malloc(16);
16221     struct tm tm_e, tm_w;
16222     memset(&tm_e,'\0',sizeof(struct tm));
16223     memset(&tm_w,'\0',sizeof(struct tm));
16224     strcpy(tz_e,e_tz);
16225     strcpy(tz_w,w_tz);
16226
16227     putenv(tz_e);
16228     localtime_r(&t, &tm_e);
16229
16230     putenv(tz_w);
16231     localtime_r(&t, &tm_w);
16232
16233     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16234         return 1;
16235     return 0;
16236 }
16237 EOCP
16238         set try
16239         if eval $compile; then
16240             if $run ./try; then
16241                 d_localtime_r_needs_tzset=undef;
16242             else
16243                 d_localtime_r_needs_tzset=define;
16244             fi;
16245         else
16246             d_localtime_r_needs_tzset=undef;
16247         fi;
16248      ;;
16249   *)
16250      d_localtime_r_needs_tzset=undef;
16251      ;;
16252 esac
16253 $rm_try
16254
16255 : see if lockf exists
16256 set lockf d_lockf
16257 eval $inlibc
16258
16259 : see if log1p exists
16260 set log1p d_log1p
16261 eval $inlibc
16262
16263 : see if log2 exists
16264 set log2 d_log2
16265 eval $inlibc
16266
16267 : see if logb exists
16268 set logb d_logb
16269 eval $inlibc
16270
16271 : see if lrint exists
16272 set lrint d_lrint
16273 eval $inlibc
16274
16275 : see if lrintl exists
16276 set lrintl d_lrintl
16277 eval $inlibc
16278
16279 : see if lround exists
16280 set lround d_lround
16281 eval $inlibc
16282
16283 : see if lroundl exists
16284 set lroundl d_lroundl
16285 eval $inlibc
16286
16287 : see if prototype for lseek is available
16288 echo " "
16289 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16290 eval $hasproto
16291
16292 : see if lstat exists
16293 set lstat d_lstat
16294 eval $inlibc
16295
16296 : see if madvise exists
16297 set madvise d_madvise
16298 eval $inlibc
16299
16300 : see if malloc_size exists
16301 set malloc_size d_malloc_size
16302 eval $inlibc
16303
16304 : see if malloc_size_good exists
16305 set malloc_good_size d_malloc_good_size
16306 eval $inlibc
16307
16308 : see if mblen exists
16309 set mblen d_mblen
16310 eval $inlibc
16311
16312 : see if mbstowcs exists
16313 set mbstowcs d_mbstowcs
16314 eval $inlibc
16315
16316 : see if mbtowc exists
16317 set mbtowc d_mbtowc
16318 eval $inlibc
16319
16320 : see if memchr exists
16321 set memchr d_memchr
16322 eval $inlibc
16323
16324 : see if memcmp exists
16325 set memcmp d_memcmp
16326 eval $inlibc
16327
16328 : see if memcpy exists
16329 set memcpy d_memcpy
16330 eval $inlibc
16331
16332 : see if memmem exists
16333 set memmem d_memmem
16334 eval $inlibc
16335
16336 : see if memmove exists
16337 set memmove d_memmove
16338 eval $inlibc
16339
16340 : see if memset exists
16341 set memset d_memset
16342 eval $inlibc
16343
16344 : see if mkdir exists
16345 set mkdir d_mkdir
16346 eval $inlibc
16347
16348 : see if mkdtemp exists
16349 set mkdtemp d_mkdtemp
16350 eval $inlibc
16351
16352 : see if mkfifo exists
16353 set mkfifo d_mkfifo
16354 eval $inlibc
16355
16356 : see if mkstemp exists
16357 set mkstemp d_mkstemp
16358 eval $inlibc
16359
16360 : see if mkstemps exists
16361 set mkstemps d_mkstemps
16362 eval $inlibc
16363
16364 : see if mktime exists
16365 set mktime d_mktime
16366 eval $inlibc
16367
16368 : see if this is a sys/mman.h system
16369 set sys/mman.h i_sysmman
16370 eval $inhdr
16371
16372 : see if mmap exists
16373 set mmap d_mmap
16374 eval $inlibc
16375 : see what shmat returns
16376 : default to something harmless
16377 mmaptype='void *'
16378 case "$i_sysmman$d_mmap" in
16379 "$define$define")
16380         $cat >mmap.c <<'END'
16381 #include <sys/mman.h>
16382 void *mmap();
16383 END
16384         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16385                 mmaptype='void *'
16386         else
16387                 mmaptype='caddr_t'
16388         fi
16389         echo "and it returns ($mmaptype)." >&4
16390         ;;
16391 esac
16392
16393
16394
16395 : see if sqrtl exists
16396 set sqrtl d_sqrtl
16397 eval $inlibc
16398
16399 : see if scalbnl exists
16400 set scalbnl d_scalbnl
16401 eval $inlibc
16402
16403 : see if truncl exists
16404 set truncl d_truncl
16405 eval $inlibc
16406
16407 : see if modfl exists
16408 set modfl d_modfl
16409 eval $inlibc
16410
16411 : see if prototype for modfl is available
16412 echo " "
16413 set d_modflproto modfl $i_math math.h
16414 eval $hasproto
16415
16416 if $test "$uselongdouble" = "$define"; then
16417     message=""
16418     if $test "$d_sqrtl" != "$define"; then
16419         message="$message sqrtl"
16420     fi
16421     if $test "$d_modfl" != "$define"; then
16422         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16423             echo "You have both truncl and copysignl, so I can emulate modfl."
16424         else
16425             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16426                 echo "You have both aintl and copysignl, so I can emulate modfl."
16427             else
16428                 message="$message modfl"
16429             fi
16430         fi
16431     fi
16432     if $test "$d_frexpl" != "$define"; then
16433         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16434             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16435         else
16436             message="$message frexpl"
16437         fi
16438     fi
16439     if $test "$d_ldexpl" != "$define"; then
16440         message="$message ldexpl"
16441     fi
16442
16443     if $test "$message" != ""; then
16444         $cat <<EOM >&4
16445
16446 *** You requested the use of long doubles but you do not seem to have
16447 *** the following mathematical functions needed for long double support:
16448 ***    $message
16449 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16450 *** Cannot continue, aborting.
16451
16452 EOM
16453
16454         exit 1
16455     fi
16456 fi
16457
16458 : see if mprotect exists
16459 set mprotect d_mprotect
16460 eval $inlibc
16461
16462 : see if msgctl exists
16463 set msgctl d_msgctl
16464 eval $inlibc
16465
16466 : see if msgget exists
16467 set msgget d_msgget
16468 eval $inlibc
16469
16470 : see if msgsnd exists
16471 set msgsnd d_msgsnd
16472 eval $inlibc
16473
16474 : see if msgrcv exists
16475 set msgrcv d_msgrcv
16476 eval $inlibc
16477
16478 : see how much of the 'msg*(2)' library is present.
16479 h_msg=true
16480 echo " "
16481 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16482 *"$undef"*) h_msg=false;;
16483 esac
16484 case "$osname" in
16485 freebsd)
16486     case "`ipcs 2>&1`" in
16487     "SVID messages"*"not configured"*)
16488         echo "Your $osname does not have the msg*(2) configured." >&4
16489         h_msg=false
16490         val="$undef"
16491         set msgctl d_msgctl
16492         eval $setvar
16493         set msgget d_msgget
16494         eval $setvar
16495         set msgsnd d_msgsnd
16496         eval $setvar
16497         set msgrcv d_msgrcv
16498         eval $setvar
16499         ;;
16500     esac
16501     ;;
16502 esac
16503 : we could also check for sys/ipc.h ...
16504 if $h_msg && $test `./findhdr sys/msg.h`; then
16505         echo "You have the full msg*(2) library." >&4
16506         val="$define"
16507 else
16508         echo "You don't have the full msg*(2) library." >&4
16509         val="$undef"
16510 fi
16511 set d_msg
16512 eval $setvar
16513
16514 : Check for msghdr_s
16515 echo " "
16516 echo "Checking to see if your system supports struct msghdr..." >&4
16517 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16518 eval $hasstruct
16519 case "$d_msghdr_s" in
16520 "$define")      echo "Yes, it does."   ;;
16521 *)              echo "No, it doesn't." ;;
16522 esac
16523
16524
16525 : see if msync exists
16526 set msync d_msync
16527 eval $inlibc
16528
16529 : see if munmap exists
16530 set munmap d_munmap
16531 eval $inlibc
16532
16533 : see if nan exists
16534 set nan d_nan
16535 eval $inlibc
16536
16537 : see if nearbyint exists
16538 set nearbyint d_nearbyint
16539 eval $inlibc
16540
16541 : see if nextafter exists
16542 set nextafter d_nextafter
16543 eval $inlibc
16544
16545 : see if nexttoward exists
16546 set nexttoward d_nexttoward
16547 eval $inlibc
16548
16549 : see if nice exists
16550 set nice d_nice
16551 eval $inlibc
16552
16553 : see if this is a langinfo.h system
16554 set langinfo.h i_langinfo
16555 eval $inhdr
16556
16557 : see if nl_langinfo exists
16558 set nl_langinfo d_nl_langinfo
16559 eval $inlibc
16560
16561 : see if this is a quadmath.h system
16562 set quadmath.h i_quadmath
16563 eval $inhdr
16564
16565 : check for volatile keyword
16566 echo " "
16567 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16568 $cat >try.c <<'EOCP'
16569 int main()
16570 {
16571         typedef struct _goo_struct goo_struct;
16572         goo_struct * volatile goo = ((goo_struct *)0);
16573         struct _goo_struct {
16574                 long long_int;
16575                 int reg_int;
16576                 char char_var;
16577         };
16578         typedef unsigned short foo_t;
16579         char *volatile foo;
16580         volatile int bar;
16581         volatile foo_t blech;
16582         foo = foo;
16583 }
16584 EOCP
16585 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16586         val="$define"
16587         echo "Yup, it does."
16588 else
16589         val="$undef"
16590         echo "Nope, it doesn't."
16591 fi
16592 set d_volatile
16593 eval $setvar
16594 $rm_try
16595
16596 : Check basic sizes
16597 echo " "
16598 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16599
16600 case "$use64bitint:$d_quad:$quadtype" in
16601 define:define:?*)
16602         ivtype="$quadtype"
16603         uvtype="$uquadtype"
16604         ivsize=8
16605         uvsize=8
16606         ;;
16607 *)      ivtype="long"
16608         uvtype="unsigned long"
16609         ivsize=$longsize
16610         uvsize=$longsize
16611         ;;
16612 esac
16613
16614 case "$uselongdouble:$d_longdbl" in
16615 define:define)
16616         nvtype="long double"
16617         nvsize=$longdblsize
16618         ;;
16619 *)      nvtype=double
16620         nvsize=$doublesize
16621         ;;
16622 esac
16623
16624 case "$usequadmath:$i_quadmath" in
16625 define:define)
16626   nvtype="__float128"
16627   nvsize=16
16628   case "$libs" in
16629   *quadmath*) ;;
16630   *) $cat <<EOM >&4
16631
16632 *** You requested the use of the quadmath library, but you
16633 *** do not seem to have the quadmath library installed.
16634 *** Cannot continue, aborting.
16635 EOM
16636     exit 1
16637     ;;
16638   esac
16639   ;;
16640 define:*) $cat <<EOM >&4
16641
16642 *** You requested the use of the quadmath library, but you
16643 *** do not seem to have the required header, <quadmath.h>.
16644 EOM
16645   case "$gccversion" in
16646   [23].*|4.[0-5]*)
16647    $cat <<EOM >&4
16648 *** Your gcc looks a bit old:
16649 *** $gccversion
16650 EOM
16651     ;;
16652   '')
16653    $cat <<EOM >&4
16654 *** You are not running a gcc.
16655 EOM
16656     ;;
16657   esac
16658   $cat <<EOM >&4
16659 *** For the quadmath library you need at least gcc 4.6.
16660 *** Cannot continue, aborting.
16661 EOM
16662   exit 1
16663   ;;
16664 esac
16665
16666 $echo "(IV will be "$ivtype", $ivsize bytes)"
16667 $echo "(UV will be "$uvtype", $uvsize bytes)"
16668 $echo "(NV will be "$nvtype", $nvsize bytes)"
16669
16670 $cat >try.c <<EOCP
16671 #$i_inttypes I_INTTYPES
16672 #ifdef I_INTTYPES
16673 #include <inttypes.h>
16674 #endif
16675 #include <stdio.h>
16676 int main() {
16677 #ifdef INT8
16678    int8_t i =  INT8_MAX;
16679   uint8_t u = UINT8_MAX;
16680   printf("int8_t\n");
16681 #endif
16682 #ifdef INT16
16683    int16_t i =  INT16_MAX;
16684   uint16_t u = UINT16_MAX;
16685   printf("int16_t\n");
16686 #endif
16687 #ifdef INT32
16688    int32_t i =  INT32_MAX;
16689   uint32_t u = UINT32_MAX;
16690   printf("int32_t\n");
16691 #endif
16692 }
16693 EOCP
16694
16695 i8type="signed char"
16696 u8type="unsigned char"
16697 i8size=1
16698 u8size=1
16699
16700 case "$i16type" in
16701 '')     case "$shortsize" in
16702         2)      i16type=short
16703                 u16type="unsigned short"
16704                 i16size=$shortsize
16705                 u16size=$shortsize
16706                 ;;
16707         esac
16708         ;;
16709 esac
16710 case "$i16type" in
16711 '')     set try -DINT16
16712         if eval $compile; then
16713                 case "`$run ./try`" in
16714                 int16_t)
16715                         i16type=int16_t
16716                         u16type=uint16_t
16717                         i16size=2
16718                         u16size=2
16719                         ;;
16720                 esac
16721         fi
16722         ;;
16723 esac
16724 case "$i16type" in
16725 '')     if $test $shortsize -ge 2; then
16726                 i16type=short
16727                 u16type="unsigned short"
16728                 i16size=$shortsize
16729                 u16size=$shortsize
16730         fi
16731         ;;
16732 esac
16733
16734 case "$i32type" in
16735 '')     case "$longsize" in
16736         4)      i32type=long
16737                 u32type="unsigned long"
16738                 i32size=$longsize
16739                 u32size=$longsize
16740                 ;;
16741         *)      case "$intsize" in
16742                 4)      i32type=int
16743                         u32type="unsigned int"
16744                         i32size=$intsize
16745                         u32size=$intsize
16746                         ;;
16747                 esac
16748                 ;;
16749         esac
16750         ;;
16751 esac
16752 case "$i32type" in
16753 '')     set try -DINT32
16754         if eval $compile; then
16755                 case "`$run ./try`" in
16756                 int32_t)
16757                         i32type=int32_t
16758                         u32type=uint32_t
16759                         i32size=4
16760                         u32size=4
16761                         ;;
16762                 esac
16763         fi
16764         ;;
16765 esac
16766 case "$i32type" in
16767 '')     if $test $intsize -ge 4; then
16768                 i32type=int
16769                 u32type="unsigned int"
16770                 i32size=$intsize
16771                 u32size=$intsize
16772         fi
16773         ;;
16774 esac
16775
16776 case "$i64type" in
16777 '')     case "$d_quad:$quadtype" in
16778         define:?*)
16779                 i64type="$quadtype"
16780                 u64type="$uquadtype"
16781                 i64size=8
16782                 u64size=8
16783                 ;;
16784         esac
16785         ;;
16786 esac
16787
16788 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16789 : volatile so that the compiler has to store it out to memory.
16790 if test X"$d_volatile" = X"$define"; then
16791         volatile=volatile
16792 fi
16793 $cat <<EOP >try.c
16794 #include <stdio.h>
16795 #$i_stdlib I_STDLIB
16796 #ifdef I_STDLIB
16797 #include <stdlib.h>
16798 #endif
16799 #include <sys/types.h>
16800 #include <signal.h>
16801 #ifdef SIGFPE
16802 $volatile int bletched = 0;
16803 $signal_t blech(int s) { bletched = 1; }
16804 #endif
16805 int main() {
16806     $uvtype u = 0;
16807     $nvtype d;
16808     int     n = 8 * $uvsize;
16809     int     i;
16810 #ifdef SIGFPE
16811     signal(SIGFPE, blech);
16812 #endif
16813
16814     for (i = 0; i < n; i++) {
16815       u = u << 1 | ($uvtype)1;
16816       d = ($nvtype)u;
16817       if (($uvtype)d != u)
16818         break;
16819       if (d <= 0)
16820         break;
16821       d = ($nvtype)(u - 1);
16822       if (($uvtype)d != (u - 1))
16823         break;
16824 #ifdef SIGFPE
16825       if (bletched)
16826         break;
16827 #endif
16828     }
16829     printf("%d\n", ((i == n) ? -n : i));
16830     exit(0);
16831 }
16832 EOP
16833 set try
16834
16835 d_nv_preserves_uv="$undef"
16836 if eval $compile; then
16837         nv_preserves_uv_bits="`$run ./try`"
16838 fi
16839 case "$nv_preserves_uv_bits" in
16840 \-[1-9]*)
16841         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16842         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16843         d_nv_preserves_uv="$define"
16844         ;;
16845 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16846         d_nv_preserves_uv="$undef" ;;
16847 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16848         nv_preserves_uv_bits="0" ;;
16849 esac
16850 $rm_try
16851
16852 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16853 : volatile so that the compiler has to store it out to memory.
16854 if test X"$d_volatile" = X"$define"; then
16855         volatile=volatile
16856 fi
16857 $cat <<EOP >try.c
16858 #include <stdio.h>
16859
16860 typedef $nvtype NV;
16861
16862 int
16863 main() {
16864   NV value = 2;
16865   int count = 1;
16866
16867   while(count < 256) {
16868     $volatile NV up = value + 1.0;
16869     $volatile NV negated = -value;
16870     $volatile NV down = negated - 1.0;
16871     $volatile NV got_up = up - value;
16872     int up_good = got_up == 1.0;
16873     int got_down = down - negated;
16874     int down_good = got_down == -1.0;
16875
16876     if (down_good != up_good) {
16877       fprintf(stderr,
16878               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16879               up_good, (double) got_up, down_good, (double) got_down,
16880               count, (double) value);
16881       return 1;
16882     }
16883     if (!up_good) {
16884       while (1) {
16885         if (count > 8) {
16886           count -= 8;
16887           fputs("256.0", stdout);
16888         } else {
16889           count--;
16890           fputs("2.0", stdout);
16891         }
16892         if (!count) {
16893           puts("");
16894           return 0;
16895         }
16896         fputs("*", stdout);
16897       }
16898     }
16899     value *= 2;
16900     ++count;
16901   }
16902   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16903           count, (double) value);
16904   return 1;
16905 }
16906 EOP
16907 set try
16908
16909 nv_overflows_integers_at='0'
16910 if eval $compile; then
16911     xxx="`$run ./try`"
16912     case "$?" in
16913         0)
16914             case "$xxx" in
16915                 2*)  cat >&4 <<EOM
16916 The largest integer your NVs can preserve is equal to $xxx
16917 EOM
16918                     nv_overflows_integers_at="$xxx"
16919                     ;;
16920                 *)  cat >&4 <<EOM
16921 Cannot determine the largest integer value your NVs can hold, unexpected output
16922 '$xxx'
16923 EOM
16924                     ;;
16925             esac
16926             ;;
16927         *)  cat >&4 <<EOM
16928 Cannot determine the largest integer value your NVs can hold
16929 EOM
16930             ;;
16931     esac
16932 fi
16933 $rm_try
16934
16935 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16936 : volatile so that the compiler has to store it out to memory.
16937 if test X"$d_volatile" = X"$define"; then
16938         volatile=volatile
16939 fi
16940 $cat <<EOP >try.c
16941 #include <stdio.h>
16942 #$i_stdlib I_STDLIB
16943 #ifdef I_STDLIB
16944 #include <stdlib.h>
16945 #endif
16946 #$i_string I_STRING
16947 #ifdef I_STRING
16948 #  include <string.h>
16949 #else
16950 #  include <strings.h>
16951 #endif
16952 #include <sys/types.h>
16953 #include <signal.h>
16954 #ifdef SIGFPE
16955 $volatile int bletched = 0;
16956 $signal_t blech(int s) { bletched = 1; }
16957 #endif
16958
16959 int checkit($nvtype d, char *where) {
16960     unsigned char *p = (char *)&d;
16961     unsigned char *end = p + sizeof(d);
16962     int fail = 0;
16963
16964     while (p < end)
16965         fail += *p++;
16966
16967     if (!fail)
16968         return 0;
16969
16970     p = (char *)&d;
16971     printf("No - %s: 0x", where);
16972     while (p < end)
16973         printf ("%02X", *p++);
16974     printf("\n");
16975     return 1;
16976 }
16977
16978 int main(int argc, char **argv) {
16979     $nvtype d = 0.0;
16980     int fail = 0;
16981     fail += checkit(d, "0.0");
16982
16983     /* The compiler shouldn't be assuming that bletched is 0  */
16984     d = bletched;
16985
16986     fail += checkit(d, "bleched");
16987
16988 #ifdef SIGFPE
16989     signal(SIGFPE, blech);
16990 #endif
16991
16992     /* Paranoia - the compiler should have no way of knowing that ANSI says
16993        that argv[argc] will always be NULL.  Actually, if it did assume this it
16994        would be buggy, as this is C and main() can be called from elsewhere in
16995        the program.  */
16996     d = argv[argc] ? 1 : 0;
16997
16998     if (d) {
16999         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17000     }
17001
17002     fail += checkit(d, "ternary");
17003
17004     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17005
17006     if (d != 0.0) {
17007         printf("No - memset doesn't give 0.0\n");
17008         /* This might just blow up:  */
17009         printf("(gives %g)\n", d);
17010         return 1;
17011     }
17012
17013 #ifdef SIGFPE
17014     if (bletched) {
17015         printf("No - something bleched\n");
17016         return 1;
17017     }
17018 #endif
17019     if (fail) {
17020       printf("No - %d fail(s)\n", fail);
17021       return 1;
17022     }
17023     printf("Yes\n");
17024     return 0;
17025 }
17026 EOP
17027 set try
17028
17029 d_nv_zero_is_allbits_zero="$undef"
17030 if eval $compile; then
17031     xxx="`$run ./try`"
17032     case "$?" in
17033         0)
17034             case "$xxx" in
17035                 Yes)  cat >&4 <<EOM
17036 0.0 is represented as all bits zero in memory
17037 EOM
17038                     d_nv_zero_is_allbits_zero="$define"
17039                     ;;
17040                 *)  cat >&4 <<EOM
17041 0.0 is not represented as all bits zero in memory
17042 EOM
17043                     d_nv_zero_is_allbits_zero="$undef"
17044                     ;;
17045             esac
17046             ;;
17047         *)  cat >&4 <<EOM
17048 0.0 is not represented as all bits zero in memory
17049 EOM
17050             d_nv_zero_is_allbits_zero="$undef"
17051             ;;
17052     esac
17053 fi
17054 $rm_try
17055
17056 : check for off64_t
17057 echo " "
17058 echo "Checking to see if you have off64_t..." >&4
17059 $cat >try.c <<EOCP
17060 #include <sys/types.h>
17061 #include <unistd.h>
17062 int main() { off64_t x = 7; }
17063 EOCP
17064 set try
17065 if eval $compile; then
17066         val="$define"
17067         echo "You have off64_t."
17068 else
17069         val="$undef"
17070         echo "You do not have off64_t."
17071         case "$lseeksize" in
17072         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17073         esac
17074 fi
17075 $rm_try
17076 set d_off64_t
17077 eval $setvar
17078
17079 : how to create joinable pthreads
17080 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17081         echo " "
17082         echo "Checking what constant to use for creating joinable pthreads..." >&4
17083         $cat >try.c <<'EOCP'
17084 #include <pthread.h>
17085 int main() {
17086     int detachstate = JOINABLE;
17087 }
17088 EOCP
17089         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17090         if eval $compile; then
17091                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17092                 val="$undef" # Yes, undef.
17093                 set d_old_pthread_create_joinable
17094                 eval $setvar
17095                 val=""
17096                 set old_pthread_create_joinable
17097                 eval $setvar
17098         else
17099                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17100                 if eval $compile; then
17101                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17102                         val="$define"
17103                         set d_old_pthread_create_joinable
17104                         eval $setvar
17105                         val=PTHREAD_CREATE_UNDETACHED
17106                         set old_pthread_create_joinable
17107                         eval $setvar
17108                 else
17109                         set try -DJOINABLE=__UNDETACHED
17110                         if eval $compile; then
17111                                 echo "You seem to use __UNDETACHED." >&4
17112                                 val="$define"
17113                                 set d_old_pthread_create_joinable
17114                                 eval $setvar
17115                                 val=__UNDETACHED
17116                                 set old_pthread_create_joinable
17117                                 eval $setvar
17118                         else
17119                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17120                                 val="$define"
17121                                 set d_old_pthread_create_joinable
17122                                 eval $setvar
17123                                 val=0
17124                                 set old_pthread_create_joinable
17125                                 eval $setvar
17126                         fi
17127                 fi
17128         fi
17129         $rm_try
17130 else
17131     d_old_pthread_create_joinable="$undef"
17132     old_pthread_create_joinable=""
17133 fi
17134
17135 : see if pause exists
17136 set pause d_pause
17137 eval $inlibc
17138
17139 : see if poll exists
17140 set poll d_poll
17141 eval $inlibc
17142
17143 : see if prctl exists
17144 set prctl d_prctl
17145 eval $inlibc
17146
17147 : see if prctl supports PR_SET_NAME
17148 d_prctl_set_name=$undef
17149 case $d_prctl in
17150     $define)
17151         $cat >try.c <<EOM
17152 #ifdef __ANDROID__
17153 #include <unistd.h>
17154 #endif
17155 #include <sys/prctl.h>
17156
17157 int main (int argc, char *argv[])
17158 {
17159     return (prctl (PR_SET_NAME, "Test"));
17160     } /* main */
17161 EOM
17162         set try
17163         if eval $compile_ok && $run ./try; then
17164             echo "Your prctl (PR_SET_NAME, ...) works"
17165             d_prctl_set_name=$define
17166             fi
17167         $rm_try
17168         ;;
17169     esac
17170
17171 : see if readlink exists
17172 set readlink d_readlink
17173 eval $inlibc
17174
17175 : Check if there is a /proc symlink to the abs path of
17176 : the executing program.  We will honor hints of d_procselfexe=$undef
17177 : or procselfexe being non-empty, otherwise will try to determine both
17178 : if we have readlink.
17179 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17180 : referenced, and AmigaOS does not have a proc filesystem anyway.
17181 echo " "
17182 val="$undef"
17183 if $test "X$d_procselfexe" = Xundef; then
17184         procselfexe=''
17185 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17186         val="$define"
17187 elif $test "X$d_readlink" = Xdefine; then
17188         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17189         : and it feels more tidy to avoid an extra level of symlink
17190         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17191         while test $# -gt 0; do
17192             type=$1; try=$2
17193             shift; shift
17194             if $issymlink $try; then
17195                 $ls -l $try > reflect
17196                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17197                     echo "You have $type-like $try."
17198                     procselfexe='"'$try'"'
17199                     val="$define"
17200                     : This will break out of the loop
17201                     set X; shift
17202                 fi
17203             fi
17204         done
17205 fi
17206 $rm -f reflect
17207 set d_procselfexe
17208 eval $setvar
17209
17210 : backward compatibility for d_hvfork
17211 if test X$d_hvfork != X; then
17212         d_vfork="$d_hvfork"
17213         d_hvfork=''
17214 fi
17215 : see if there is a vfork
17216 val=''
17217 set vfork val
17218 eval $inlibc
17219
17220 d_pseudofork=$undef
17221
17222 : Ok, but do we want to use it. vfork is reportedly unreliable in
17223 : perl on Solaris 2.x, and probably elsewhere.
17224 case "$val" in
17225 $define)
17226         echo " "
17227         case "$usevfork" in
17228         false) dflt='n';;
17229         *) dflt='y';;
17230         esac
17231         cat <<'EOM'
17232
17233 Perl can only use a vfork() that doesn't suffer from strict
17234 restrictions on calling functions or modifying global data in
17235 the child.  For example, glibc-2.1 contains such a vfork()
17236 that is unsuitable.  If your system provides a proper fork()
17237 call, chances are that you do NOT want perl to use vfork().
17238
17239 EOM
17240         rp="Do you still want to use vfork()?"
17241         . ./myread
17242         case "$ans" in
17243         y|Y) ;;
17244         *)
17245                 echo "Ok, we won't use vfork()."
17246                 val="$undef"
17247                 ;;
17248         esac
17249         ;;
17250 esac
17251 set d_vfork
17252 eval $setvar
17253 case "$d_vfork" in
17254 $define) usevfork='true';;
17255 *) usevfork='false';;
17256 esac
17257
17258 : see whether the pthread_atfork exists
17259 $cat >try.c <<EOP
17260 #include <pthread.h>
17261 #include <stdio.h>
17262 int main() {
17263 #ifdef  PTHREAD_ATFORK
17264         pthread_atfork(NULL,NULL,NULL);
17265 #endif
17266 }
17267 EOP
17268
17269 : see if pthread_atfork exists
17270 set try -DPTHREAD_ATFORK
17271 if eval $compile; then
17272     val="$define"
17273 else
17274     val="$undef"
17275 fi
17276 case "$usethreads" in
17277 $define)
17278         case "$val" in
17279         $define) echo 'pthread_atfork found.' >&4        ;;
17280         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17281         esac
17282 esac
17283 set d_pthread_atfork
17284 eval $setvar
17285
17286 : see if pthread_attr_setscope exists
17287 set pthread_attr_setscope d_pthread_attr_setscope
17288 eval $inlibc
17289
17290 : see whether the various POSIXish _yields exist
17291 $cat >try.c <<EOP
17292 #include <pthread.h>
17293 #include <stdio.h>
17294 int main() {
17295 #ifdef SCHED_YIELD
17296         sched_yield();
17297 #else
17298 #ifdef PTHREAD_YIELD
17299         pthread_yield();
17300 #else
17301 #ifdef PTHREAD_YIELD_NULL
17302         pthread_yield(NULL);
17303 #endif
17304 #endif
17305 #endif
17306 }
17307 EOP
17308 : see if sched_yield exists
17309 set try -DSCHED_YIELD
17310 if eval $compile; then
17311     val="$define"
17312     sched_yield='sched_yield()'
17313 else
17314     val="$undef"
17315 fi
17316 case "$usethreads" in
17317 $define)
17318         case "$val" in
17319         $define) echo 'sched_yield() found.' >&4        ;;
17320         *)       echo 'sched_yield() NOT found.' >&4    ;;
17321         esac
17322 esac
17323 set d_sched_yield
17324 eval $setvar
17325
17326 : see if pthread_yield exists
17327 set try -DPTHREAD_YIELD
17328 if eval $compile; then
17329     val="$define"
17330     case "$sched_yield" in
17331     '') sched_yield='pthread_yield()' ;;
17332     esac
17333 else
17334     set try -DPTHREAD_YIELD_NULL
17335     if eval $compile; then
17336         val="$define"
17337         case "$sched_yield" in
17338         '') sched_yield='pthread_yield(NULL)' ;;
17339         esac
17340     else
17341         val="$undef"
17342     fi
17343 fi
17344 case "$usethreads" in
17345 $define)
17346         case "$val" in
17347         $define) echo 'pthread_yield() found.' >&4      ;;
17348         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17349         esac
17350         ;;
17351 esac
17352 set d_pthread_yield
17353 eval $setvar
17354 case "$sched_yield" in
17355 '') sched_yield=undef ;;
17356 esac
17357 $rm_try
17358
17359 : check for ptrdiff_t
17360 echo " "
17361 echo "Checking to see if you have ptrdiff_t..." >&4
17362 $cat >try.c <<EOCP
17363 #include <stddef.h>
17364 int main() { ptrdiff_t x = 7; }
17365 EOCP
17366 set try
17367 if eval $compile; then
17368         val="$define"
17369         echo "You have ptrdiff_t."
17370 else
17371         val="$undef"
17372         echo "You do not have ptrdiff_t."
17373 fi
17374 $rm_try
17375 set d_ptrdiff_t
17376 eval $setvar
17377
17378 : see if random_r exists
17379 set random_r d_random_r
17380 eval $inlibc
17381 case "$d_random_r" in
17382 "$define")
17383         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17384         case "$d_random_r_proto:$usethreads" in
17385         ":define")      d_random_r_proto=define
17386                 set d_random_r_proto random_r $hdrs
17387                 eval $hasproto ;;
17388         *)      ;;
17389         esac
17390         case "$d_random_r_proto" in
17391         define)
17392         case "$random_r_proto" in
17393         ''|0) try='int random_r(int*, struct random_data*);'
17394         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17395         esac
17396         case "$random_r_proto" in
17397         ''|0) try='int random_r(long*, struct random_data*);'
17398         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17399         esac
17400         case "$random_r_proto" in
17401         ''|0) try='int random_r(struct random_data*, int32_t*);'
17402         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17403         esac
17404         case "$random_r_proto" in
17405         ''|0)   d_random_r=undef
17406                 random_r_proto=0
17407                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17408         * )     case "$random_r_proto" in
17409                 REENTRANT_PROTO*) ;;
17410                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17411                 esac
17412                 echo "Prototype: $try" ;;
17413         esac
17414         ;;
17415         *)      case "$usethreads" in
17416                 define) echo "random_r has no prototype, not using it." >&4 ;;
17417                 esac
17418                 d_random_r=undef
17419                 random_r_proto=0
17420                 ;;
17421         esac
17422         ;;
17423 *)      random_r_proto=0
17424         ;;
17425 esac
17426
17427 : see if readdir and friends exist
17428 set readdir d_readdir
17429 eval $inlibc
17430 set seekdir d_seekdir
17431 eval $inlibc
17432 set telldir d_telldir
17433 eval $inlibc
17434 set rewinddir d_rewinddir
17435 eval $inlibc
17436
17437 : see if readdir64_r exists
17438 set readdir64_r d_readdir64_r
17439 eval $inlibc
17440 case "$d_readdir64_r" in
17441 "$define")
17442         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17443         case "$d_readdir64_r_proto:$usethreads" in
17444         ":define")      d_readdir64_r_proto=define
17445                 set d_readdir64_r_proto readdir64_r $hdrs
17446                 eval $hasproto ;;
17447         *)      ;;
17448         esac
17449         case "$d_readdir64_r_proto" in
17450         define)
17451         case "$readdir64_r_proto" in
17452         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17453         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17454         esac
17455         case "$readdir64_r_proto" in
17456         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17457         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17458         esac
17459         case "$readdir64_r_proto" in
17460         ''|0)   d_readdir64_r=undef
17461                 readdir64_r_proto=0
17462                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17463         * )     case "$readdir64_r_proto" in
17464                 REENTRANT_PROTO*) ;;
17465                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17466                 esac
17467                 echo "Prototype: $try" ;;
17468         esac
17469         ;;
17470         *)      case "$usethreads" in
17471                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17472                 esac
17473                 d_readdir64_r=undef
17474                 readdir64_r_proto=0
17475                 ;;
17476         esac
17477         ;;
17478 *)      readdir64_r_proto=0
17479         ;;
17480 esac
17481
17482 : see if readdir_r exists
17483 set readdir_r d_readdir_r
17484 eval $inlibc
17485 case "$d_readdir_r" in
17486 "$define")
17487         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17488         case "$d_readdir_r_proto:$usethreads" in
17489         ":define")      d_readdir_r_proto=define
17490                 set d_readdir_r_proto readdir_r $hdrs
17491                 eval $hasproto ;;
17492         *)      ;;
17493         esac
17494         case "$d_readdir_r_proto" in
17495         define)
17496         case "$readdir_r_proto" in
17497         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17498         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17499         esac
17500         case "$readdir_r_proto" in
17501         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17502         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17503         esac
17504         case "$readdir_r_proto" in
17505         ''|0)   d_readdir_r=undef
17506                 readdir_r_proto=0
17507                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17508         * )     case "$readdir_r_proto" in
17509                 REENTRANT_PROTO*) ;;
17510                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17511                 esac
17512                 echo "Prototype: $try" ;;
17513         esac
17514         ;;
17515         *)      case "$usethreads" in
17516                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17517                 esac
17518                 d_readdir_r=undef
17519                 readdir_r_proto=0
17520                 ;;
17521         esac
17522         ;;
17523 *)      readdir_r_proto=0
17524         ;;
17525 esac
17526
17527 : see if readv exists
17528 set readv d_readv
17529 eval $inlibc
17530
17531 : see if recvmsg exists
17532 set recvmsg d_recvmsg
17533 eval $inlibc
17534
17535 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17536 echo " "
17537 if set regcomp val -f d_regcomp; eval $csym; $val; then
17538         echo 'regcomp() found.' >&4
17539         d_regcomp="$define"
17540         d_regcmp="$undef"
17541         d_re_comp="$undef"
17542 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17543         echo 'regcmp() found.' >&4
17544         d_regcmp="$define"
17545         d_regcomp="$undef"
17546         d_re_comp="$undef"
17547 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17548         echo 're_comp() found, assuming re_exec() also exists.' >&4
17549         d_re_comp="$define"
17550         d_regcomp="$undef"
17551         d_regcmp="$undef"
17552 else
17553         $cat >&4 <<EOM
17554 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17555 EOM
17556         d_regcmp="$undef"
17557         d_re_comp="$undef"
17558         d_regcomp="$undef"
17559 fi
17560
17561 : see if remainder exists
17562 set remainder d_remainder
17563 eval $inlibc
17564
17565 : see if remquo exists
17566 set remquo d_remquo
17567 eval $inlibc
17568
17569 : see if rename exists
17570 set rename d_rename
17571 eval $inlibc
17572
17573 : see if rint exists
17574 set rint d_rint
17575 eval $inlibc
17576
17577 : see if rmdir exists
17578 set rmdir d_rmdir
17579 eval $inlibc
17580
17581 : see if round exists
17582 set round d_round
17583 eval $inlibc
17584
17585 : see if memory.h is available.
17586 val=''
17587 set memory.h val
17588 eval $inhdr
17589
17590 : See if it conflicts with string.h
17591 case "$val" in
17592 $define)
17593         case "$strings" in
17594         '') ;;
17595         *)
17596                 $cppstdin $cppflags $cppminus < $strings > mem.h
17597                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17598                         echo " "
17599                         echo "We won't be including <memory.h>."
17600                         val="$undef"
17601                 fi
17602                 $rm -f mem.h
17603                 ;;
17604         esac
17605 esac
17606 set i_memory
17607 eval $setvar
17608
17609 : can bcopy handle overlapping blocks?
17610 echo " "
17611 val="$undef"
17612 case "$d_memmove" in
17613 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17614 *)      case "$d_bcopy" in
17615         "$define")
17616                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17617                 $cat >try.c <<EOCP
17618 #$i_memory I_MEMORY
17619 #$i_stdlib I_STDLIB
17620 #$i_string I_STRING
17621 #$i_unistd I_UNISTD
17622 EOCP
17623         $cat >>try.c <<'EOCP'
17624 #include <stdio.h>
17625 #ifdef I_MEMORY
17626 #  include <memory.h>
17627 #endif
17628 #ifdef I_STDLIB
17629 #  include <stdlib.h>
17630 #endif
17631 #ifdef I_STRING
17632 #  include <string.h>
17633 #else
17634 #  include <strings.h>
17635 #endif
17636 #ifdef I_UNISTD
17637 #  include <unistd.h>  /* Needed for NetBSD */
17638 #endif
17639 int main()
17640 {
17641 char buf[128], abc[128];
17642 char *b;
17643 int len;
17644 int off;
17645 int align;
17646
17647 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17648    try to store the string in read-only memory. */
17649 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17650
17651 for (align = 7; align >= 0; align--) {
17652         for (len = 36; len; len--) {
17653                 b = buf+align;
17654                 bcopy(abc, b, len);
17655                 for (off = 1; off <= len; off++) {
17656                         bcopy(b, b+off, len);
17657                         bcopy(b+off, b, len);
17658                         if (bcmp(b, abc, len))
17659                                 exit(1);
17660                 }
17661         }
17662 }
17663 exit(0);
17664 }
17665 EOCP
17666                 set try
17667                 if eval $compile_ok; then
17668                         if $run ./try 2>/dev/null; then
17669                                 echo "Yes, it can."
17670                                 val="$define"
17671                         else
17672                                 echo "It can't, sorry."
17673                         fi
17674                 else
17675                         echo "(I can't compile the test program, so we'll assume not...)"
17676                 fi
17677                 ;;
17678         esac
17679         $rm_try
17680         ;;
17681 esac
17682 set d_safebcpy
17683 eval $setvar
17684
17685 : can memcpy handle overlapping blocks?
17686 echo " "
17687 val="$undef"
17688 case "$d_memmove" in
17689 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17690 *)      case "$d_memcpy" in
17691         "$define")
17692                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17693                 $cat >try.c <<EOCP
17694 #$i_memory I_MEMORY
17695 #$i_stdlib I_STDLIB
17696 #$i_string I_STRING
17697 #$i_unistd I_UNISTD
17698 EOCP
17699         $cat >>try.c <<'EOCP'
17700 #include <stdio.h>
17701 #ifdef I_MEMORY
17702 #  include <memory.h>
17703 #endif
17704 #ifdef I_STDLIB
17705 #  include <stdlib.h>
17706 #endif
17707 #ifdef I_STRING
17708 #  include <string.h>
17709 #else
17710 #  include <strings.h>
17711 #endif
17712 #ifdef I_UNISTD
17713 #  include <unistd.h>  /* Needed for NetBSD */
17714 #endif
17715 int main()
17716 {
17717 char buf[128], abc[128];
17718 char *b;
17719 int len;
17720 int off;
17721 int align;
17722
17723 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17724    try to store the string in read-only memory. */
17725 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17726
17727 for (align = 7; align >= 0; align--) {
17728         for (len = 36; len; len--) {
17729                 b = buf+align;
17730                 memcpy(b, abc, len);
17731                 for (off = 1; off <= len; off++) {
17732                         memcpy(b+off, b, len);
17733                         memcpy(b, b+off, len);
17734                         if (memcmp(b, abc, len))
17735                                 exit(1);
17736                 }
17737         }
17738 }
17739 exit(0);
17740 }
17741 EOCP
17742                 set try
17743                 if eval $compile_ok; then
17744                         if $run ./try 2>/dev/null; then
17745                                 echo "Yes, it can."
17746                                 val="$define"
17747                         else
17748                                 echo "It can't, sorry."
17749                         fi
17750                 else
17751                         echo "(I can't compile the test program, so we'll assume not...)"
17752                 fi
17753                 ;;
17754         esac
17755         $rm_try
17756         ;;
17757 esac
17758 set d_safemcpy
17759 eval $setvar
17760
17761 : can memcmp be trusted to compare relative magnitude?
17762 val="$undef"
17763 case "$d_memcmp" in
17764 "$define")
17765         echo " "
17766         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17767         $cat >try.c <<EOCP
17768 #$i_memory I_MEMORY
17769 #$i_stdlib I_STDLIB
17770 #$i_string I_STRING
17771 #$i_unistd I_UNISTD
17772 EOCP
17773         $cat >>try.c <<'EOCP'
17774 #include <stdio.h>
17775 #ifdef I_MEMORY
17776 #  include <memory.h>
17777 #endif
17778 #ifdef I_STDLIB
17779 #  include <stdlib.h>
17780 #endif
17781 #ifdef I_STRING
17782 #  include <string.h>
17783 #else
17784 #  include <strings.h>
17785 #endif
17786 #ifdef I_UNISTD
17787 #  include <unistd.h>  /* Needed for NetBSD */
17788 #endif
17789 int main()
17790 {
17791 char a = -1;
17792 char b = 0;
17793 if ((a < b) && memcmp(&a, &b, 1) < 0)
17794         exit(1);
17795 exit(0);
17796 }
17797 EOCP
17798         set try
17799         if eval $compile_ok; then
17800                 if $run ./try 2>/dev/null; then
17801                         echo "Yes, it can."
17802                         val="$define"
17803                 else
17804                         echo "No, it can't (it uses signed chars)."
17805                 fi
17806         else
17807                 echo "(I can't compile the test program, so we'll assume not...)"
17808         fi
17809         ;;
17810 esac
17811 $rm_try
17812 set d_sanemcmp
17813 eval $setvar
17814
17815 : see if prototype for sbrk is available
17816 echo " "
17817 set d_sbrkproto sbrk $i_unistd unistd.h
17818 eval $hasproto
17819
17820 : see if scalbn exists
17821 set scalbn d_scalbn
17822 eval $inlibc
17823
17824 : see if select exists
17825 set select d_select
17826 eval $inlibc
17827
17828 : see if semctl exists
17829 set semctl d_semctl
17830 eval $inlibc
17831
17832 : see if semget exists
17833 set semget d_semget
17834 eval $inlibc
17835
17836 : see if semop exists
17837 set semop d_semop
17838 eval $inlibc
17839
17840 : see how much of the 'sem*(2)' library is present.
17841 h_sem=true
17842 echo " "
17843 case "$d_semctl$d_semget$d_semop" in
17844 *"$undef"*) h_sem=false;;
17845 esac
17846 case "$osname" in
17847 freebsd)
17848     case "`ipcs 2>&1`" in
17849     "SVID messages"*"not configured"*)
17850         echo "Your $osname does not have the sem*(2) configured." >&4
17851         h_sem=false
17852         val="$undef"
17853         set semctl d_semctl
17854         eval $setvar
17855         set semget d_semget
17856         eval $setvar
17857         set semop d_semop
17858         eval $setvar
17859         ;;
17860     esac
17861     ;;
17862 esac
17863 : we could also check for sys/ipc.h ...
17864 if $h_sem && $test `./findhdr sys/sem.h`; then
17865         echo "You have the full sem*(2) library." >&4
17866         val="$define"
17867 else
17868         echo "You don't have the full sem*(2) library." >&4
17869         val="$undef"
17870 fi
17871 set d_sem
17872 eval $setvar
17873
17874 : see whether sys/sem.h defines union semun
17875 echo " "
17876 $cat > try.c <<'END'
17877 #include <sys/types.h>
17878 #include <sys/ipc.h>
17879 #include <sys/sem.h>
17880 int main () { union semun semun; semun.buf = 0; }
17881 END
17882 set try
17883 if eval $compile; then
17884     echo "You have union semun in <sys/sem.h>." >&4
17885     val="$define"
17886 else
17887     echo "You do not have union semun in <sys/sem.h>." >&4
17888     val="$undef"
17889 fi
17890 $rm_try
17891 set d_union_semun
17892 eval $setvar
17893
17894 : see how to do semctl IPC_STAT
17895 case "$d_sem" in
17896 $define)
17897     echo " "
17898     $cat > tryh.h <<END
17899 #ifndef S_IRUSR
17900 #   ifdef S_IREAD
17901 #       define S_IRUSR S_IREAD
17902 #       define S_IWUSR S_IWRITE
17903 #       define S_IXUSR S_IEXEC
17904 #   else
17905 #       define S_IRUSR 0400
17906 #       define S_IWUSR 0200
17907 #       define S_IXUSR 0100
17908 #   endif
17909 #   define S_IRGRP (S_IRUSR>>3)
17910 #   define S_IWGRP (S_IWUSR>>3)
17911 #   define S_IXGRP (S_IXUSR>>3)
17912 #   define S_IROTH (S_IRUSR>>6)
17913 #   define S_IWOTH (S_IWUSR>>6)
17914 #   define S_IXOTH (S_IXUSR>>6)
17915 #endif
17916 #ifndef S_IRWXU
17917 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17918 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17919 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17920 #endif
17921 END
17922     : see whether semctl IPC_STAT can use union semun
17923     case "$d_semctl_semun" in
17924     '')
17925       val="$undef"
17926       $cat > try.c <<END
17927 #include <sys/types.h>
17928 #include <sys/ipc.h>
17929 #include <sys/sem.h>
17930 #include <sys/stat.h>
17931 #include <stdio.h>
17932 #include <errno.h>
17933 #include "tryh.h"
17934 #ifndef errno
17935 extern int errno;
17936 #endif
17937 #$d_union_semun HAS_UNION_SEMUN
17938 int main() {
17939     union semun
17940 #ifndef HAS_UNION_SEMUN
17941     {
17942         int val;
17943         struct semid_ds *buf;
17944         unsigned short *array;
17945     }
17946 #endif
17947     arg;
17948     int sem, st;
17949
17950 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17951     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17952     if (sem > -1) {
17953         struct semid_ds argbuf;
17954         arg.buf = &argbuf;
17955 #       ifdef IPC_STAT
17956         st = semctl(sem, 0, IPC_STAT, arg);
17957         if (st == 0)
17958             printf("semun\n");
17959         else
17960 #       endif /* IPC_STAT */
17961             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17962 #       ifdef IPC_RMID
17963         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17964 #       endif /* IPC_RMID */
17965             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17966     } else
17967 #endif /* IPC_PRIVATE && ... */
17968         printf("semget failed: errno = %d\n", errno);
17969   return 0;
17970 }
17971 END
17972       set try
17973       if eval $compile; then
17974           xxx=`$run ./try`
17975           case "$xxx" in
17976           semun) val="$define" ;;
17977           esac
17978       fi
17979       $rm_try
17980       set d_semctl_semun
17981       eval $setvar
17982       ;;
17983     esac
17984     case "$d_semctl_semun" in
17985     $define)
17986         echo "You can use union semun for semctl IPC_STAT." >&4
17987         also='also'
17988         ;;
17989     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17990         also=''
17991         ;;
17992     esac
17993
17994     : see whether semctl IPC_STAT can use struct semid_ds pointer
17995     case "$d_semctl_semid_ds" in
17996     '')
17997       val="$undef"
17998       $cat > try.c <<'END'
17999 #include <sys/types.h>
18000 #include <sys/ipc.h>
18001 #include <sys/sem.h>
18002 #include <sys/stat.h>
18003 #include "tryh.h"
18004 #include <stdio.h>
18005 #include <errno.h>
18006 #ifndef errno
18007 extern int errno;
18008 #endif
18009 int main() {
18010     struct semid_ds arg;
18011     int sem, st;
18012
18013 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18014     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18015     if (sem > -1) {
18016 #       ifdef IPC_STAT
18017         st = semctl(sem, 0, IPC_STAT, &arg);
18018         if (st == 0)
18019             printf("semid_ds\n");
18020         else
18021 #       endif /* IPC_STAT */
18022             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18023 #       ifdef IPC_RMID
18024         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18025 #       endif /* IPC_RMID */
18026             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18027     } else
18028 #endif /* IPC_PRIVATE && ... */
18029         printf("semget failed: errno = %d\n", errno);
18030
18031     return 0;
18032 }
18033 END
18034       set try
18035       if eval $compile; then
18036           xxx=`$run ./try`
18037           case "$xxx" in
18038           semid_ds) val="$define" ;;
18039           esac
18040       fi
18041       $rm_try
18042       set d_semctl_semid_ds
18043       eval $setvar
18044       ;;
18045     esac
18046     case "$d_semctl_semid_ds" in
18047     $define)
18048         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18049         ;;
18050     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18051         ;;
18052     esac
18053     ;;
18054 *)  val="$undef"
18055
18056     # We do not have the full sem*(2) library, so assume we can not
18057     # use either.
18058
18059     set d_semctl_semun
18060     eval $setvar
18061
18062     set d_semctl_semid_ds
18063     eval $setvar
18064     ;;
18065 esac
18066 $rm_try tryh.h
18067
18068 : see if sendmsg exists
18069 set sendmsg d_sendmsg
18070 eval $inlibc
18071
18072 : see if setegid exists
18073 set setegid d_setegid
18074 eval $inlibc
18075
18076 : see if seteuid exists
18077 set seteuid d_seteuid
18078 eval $inlibc
18079
18080 : see if setgrent exists
18081 set setgrent d_setgrent
18082 eval $inlibc
18083
18084 : see if setgrent_r exists
18085 set setgrent_r d_setgrent_r
18086 eval $inlibc
18087 case "$d_setgrent_r" in
18088 "$define")
18089         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18090         case "$d_setgrent_r_proto:$usethreads" in
18091         ":define")      d_setgrent_r_proto=define
18092                 set d_setgrent_r_proto setgrent_r $hdrs
18093                 eval $hasproto ;;
18094         *)      ;;
18095         esac
18096         case "$d_setgrent_r_proto" in
18097         define)
18098         case "$setgrent_r_proto" in
18099         ''|0) try='int setgrent_r(FILE**);'
18100         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18101         esac
18102         case "$setgrent_r_proto" in
18103         ''|0) try='void setgrent_r(FILE**);'
18104         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18105         esac
18106         case "$setgrent_r_proto" in
18107         ''|0)   d_setgrent_r=undef
18108                 setgrent_r_proto=0
18109                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18110         * )     case "$setgrent_r_proto" in
18111                 REENTRANT_PROTO*) ;;
18112                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18113                 esac
18114                 echo "Prototype: $try" ;;
18115         esac
18116         ;;
18117         *)      case "$usethreads" in
18118                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18119                 esac
18120                 d_setgrent_r=undef
18121                 setgrent_r_proto=0
18122                 ;;
18123         esac
18124         ;;
18125 *)      setgrent_r_proto=0
18126         ;;
18127 esac
18128
18129 : see if sethostent exists
18130 set sethostent d_sethent
18131 eval $inlibc
18132
18133 : see if sethostent_r exists
18134 set sethostent_r d_sethostent_r
18135 eval $inlibc
18136 case "$d_sethostent_r" in
18137 "$define")
18138         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18139         case "$d_sethostent_r_proto:$usethreads" in
18140         ":define")      d_sethostent_r_proto=define
18141                 set d_sethostent_r_proto sethostent_r $hdrs
18142                 eval $hasproto ;;
18143         *)      ;;
18144         esac
18145         case "$d_sethostent_r_proto" in
18146         define)
18147         case "$sethostent_r_proto" in
18148         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18149         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18150         esac
18151         case "$sethostent_r_proto" in
18152         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18153         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18154         esac
18155         case "$sethostent_r_proto" in
18156         ''|0)   d_sethostent_r=undef
18157                 sethostent_r_proto=0
18158                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18159         * )     case "$sethostent_r_proto" in
18160                 REENTRANT_PROTO*) ;;
18161                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18162                 esac
18163                 echo "Prototype: $try" ;;
18164         esac
18165         ;;
18166         *)      case "$usethreads" in
18167                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18168                 esac
18169                 d_sethostent_r=undef
18170                 sethostent_r_proto=0
18171                 ;;
18172         esac
18173         ;;
18174 *)      sethostent_r_proto=0
18175         ;;
18176 esac
18177
18178 : see if setitimer exists
18179 set setitimer d_setitimer
18180 eval $inlibc
18181
18182 : see if setlinebuf exists
18183 set setlinebuf d_setlinebuf
18184 eval $inlibc
18185
18186 : see if setlocale exists
18187 set setlocale d_setlocale
18188 eval $inlibc
18189
18190 : see if locale.h is available
18191 set locale.h i_locale
18192 eval $inhdr
18193
18194 : see if setlocale_r exists
18195 set setlocale_r d_setlocale_r
18196 eval $inlibc
18197 case "$d_setlocale_r" in
18198 "$define")
18199         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18200         case "$d_setlocale_r_proto:$usethreads" in
18201         ":define")      d_setlocale_r_proto=define
18202                 set d_setlocale_r_proto setlocale_r $hdrs
18203                 eval $hasproto ;;
18204         *)      ;;
18205         esac
18206         case "$d_setlocale_r_proto" in
18207         define)
18208         case "$setlocale_r_proto" in
18209         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18210         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18211         esac
18212         case "$setlocale_r_proto" in
18213         ''|0)   d_setlocale_r=undef
18214                 setlocale_r_proto=0
18215                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18216         * )     case "$setlocale_r_proto" in
18217                 REENTRANT_PROTO*) ;;
18218                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18219                 esac
18220                 echo "Prototype: $try" ;;
18221         esac
18222         ;;
18223         *)      case "$usethreads" in
18224                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18225                 esac
18226                 d_setlocale_r=undef
18227                 setlocale_r_proto=0
18228                 ;;
18229         esac
18230         ;;
18231 *)      setlocale_r_proto=0
18232         ;;
18233 esac
18234
18235 : see if setnetent exists
18236 set setnetent d_setnent
18237 eval $inlibc
18238
18239 : see if setnetent_r exists
18240 set setnetent_r d_setnetent_r
18241 eval $inlibc
18242 case "$d_setnetent_r" in
18243 "$define")
18244         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18245         case "$d_setnetent_r_proto:$usethreads" in
18246         ":define")      d_setnetent_r_proto=define
18247                 set d_setnetent_r_proto setnetent_r $hdrs
18248                 eval $hasproto ;;
18249         *)      ;;
18250         esac
18251         case "$d_setnetent_r_proto" in
18252         define)
18253         case "$setnetent_r_proto" in
18254         ''|0) try='int setnetent_r(int, struct netent_data*);'
18255         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18256         esac
18257         case "$setnetent_r_proto" in
18258         ''|0) try='void setnetent_r(int, struct netent_data*);'
18259         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18260         esac
18261         case "$setnetent_r_proto" in
18262         ''|0)   d_setnetent_r=undef
18263                 setnetent_r_proto=0
18264                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18265         * )     case "$setnetent_r_proto" in
18266                 REENTRANT_PROTO*) ;;
18267                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18268                 esac
18269                 echo "Prototype: $try" ;;
18270         esac
18271         ;;
18272         *)      case "$usethreads" in
18273                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18274                 esac
18275                 d_setnetent_r=undef
18276                 setnetent_r_proto=0
18277                 ;;
18278         esac
18279         ;;
18280 *)      setnetent_r_proto=0
18281         ;;
18282 esac
18283
18284 : see if setprotoent exists
18285 set setprotoent d_setpent
18286 eval $inlibc
18287
18288 : see if setpgid exists
18289 set setpgid d_setpgid
18290 eval $inlibc
18291
18292 : see if setpgrp2 exists
18293 set setpgrp2 d_setpgrp2
18294 eval $inlibc
18295
18296 : see if setpriority exists
18297 set setpriority d_setprior
18298 eval $inlibc
18299
18300 : see if setproctitle exists
18301 set setproctitle d_setproctitle
18302 eval $inlibc
18303
18304 : see if setprotoent_r exists
18305 set setprotoent_r d_setprotoent_r
18306 eval $inlibc
18307 case "$d_setprotoent_r" in
18308 "$define")
18309         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18310         case "$d_setprotoent_r_proto:$usethreads" in
18311         ":define")      d_setprotoent_r_proto=define
18312                 set d_setprotoent_r_proto setprotoent_r $hdrs
18313                 eval $hasproto ;;
18314         *)      ;;
18315         esac
18316         case "$d_setprotoent_r_proto" in
18317         define)
18318         case "$setprotoent_r_proto" in
18319         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18320         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18321         esac
18322         case "$setprotoent_r_proto" in
18323         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18324         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18325         esac
18326         case "$setprotoent_r_proto" in
18327         ''|0)   d_setprotoent_r=undef
18328                 setprotoent_r_proto=0
18329                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18330         * )     case "$setprotoent_r_proto" in
18331                 REENTRANT_PROTO*) ;;
18332                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18333                 esac
18334                 echo "Prototype: $try" ;;
18335         esac
18336         ;;
18337         *)      case "$usethreads" in
18338                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18339                 esac
18340                 d_setprotoent_r=undef
18341                 setprotoent_r_proto=0
18342                 ;;
18343         esac
18344         ;;
18345 *)      setprotoent_r_proto=0
18346         ;;
18347 esac
18348
18349 : see if setpwent exists
18350 set setpwent d_setpwent
18351 eval $inlibc
18352
18353 : see if setpwent_r exists
18354 set setpwent_r d_setpwent_r
18355 eval $inlibc
18356 case "$d_setpwent_r" in
18357 "$define")
18358         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18359         case "$d_setpwent_r_proto:$usethreads" in
18360         ":define")      d_setpwent_r_proto=define
18361                 set d_setpwent_r_proto setpwent_r $hdrs
18362                 eval $hasproto ;;
18363         *)      ;;
18364         esac
18365         case "$d_setpwent_r_proto" in
18366         define)
18367         case "$setpwent_r_proto" in
18368         ''|0) try='int setpwent_r(FILE**);'
18369         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18370         esac
18371         case "$setpwent_r_proto" in
18372         ''|0) try='void setpwent_r(FILE**);'
18373         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18374         esac
18375         case "$setpwent_r_proto" in
18376         ''|0)   d_setpwent_r=undef
18377                 setpwent_r_proto=0
18378                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18379         * )     case "$setpwent_r_proto" in
18380                 REENTRANT_PROTO*) ;;
18381                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18382                 esac
18383                 echo "Prototype: $try" ;;
18384         esac
18385         ;;
18386         *)      case "$usethreads" in
18387                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18388                 esac
18389                 d_setpwent_r=undef
18390                 setpwent_r_proto=0
18391                 ;;
18392         esac
18393         ;;
18394 *)      setpwent_r_proto=0
18395         ;;
18396 esac
18397
18398 : see if setregid exists
18399 set setregid d_setregid
18400 eval $inlibc
18401 set setresgid d_setresgid
18402 eval $inlibc
18403
18404 : see if setreuid exists
18405 set setreuid d_setreuid
18406 eval $inlibc
18407 set setresuid d_setresuid
18408 eval $inlibc
18409
18410 : see if setrgid exists
18411 set setrgid d_setrgid
18412 eval $inlibc
18413
18414 : see if setruid exists
18415 set setruid d_setruid
18416 eval $inlibc
18417
18418 : see if setservent exists
18419 set setservent d_setsent
18420 eval $inlibc
18421
18422 : see if setservent_r exists
18423 set setservent_r d_setservent_r
18424 eval $inlibc
18425 case "$d_setservent_r" in
18426 "$define")
18427         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18428         case "$d_setservent_r_proto:$usethreads" in
18429         ":define")      d_setservent_r_proto=define
18430                 set d_setservent_r_proto setservent_r $hdrs
18431                 eval $hasproto ;;
18432         *)      ;;
18433         esac
18434         case "$d_setservent_r_proto" in
18435         define)
18436         case "$setservent_r_proto" in
18437         ''|0) try='int setservent_r(int, struct servent_data*);'
18438         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18439         esac
18440         case "$setservent_r_proto" in
18441         ''|0) try='void setservent_r(int, struct servent_data*);'
18442         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18443         esac
18444         case "$setservent_r_proto" in
18445         ''|0)   d_setservent_r=undef
18446                 setservent_r_proto=0
18447                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18448         * )     case "$setservent_r_proto" in
18449                 REENTRANT_PROTO*) ;;
18450                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18451                 esac
18452                 echo "Prototype: $try" ;;
18453         esac
18454         ;;
18455         *)      case "$usethreads" in
18456                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18457                 esac
18458                 d_setservent_r=undef
18459                 setservent_r_proto=0
18460                 ;;
18461         esac
18462         ;;
18463 *)      setservent_r_proto=0
18464         ;;
18465 esac
18466
18467 : see if setsid exists
18468 set setsid d_setsid
18469 eval $inlibc
18470
18471 : see if setvbuf exists
18472 set setvbuf d_setvbuf
18473 eval $inlibc
18474
18475 : see if shmctl exists
18476 set shmctl d_shmctl
18477 eval $inlibc
18478
18479 : see if shmget exists
18480 set shmget d_shmget
18481 eval $inlibc
18482
18483 : see if shmat exists
18484 set shmat d_shmat
18485 eval $inlibc
18486 : see what shmat returns
18487 case "$d_shmat" in
18488 "$define")
18489         $cat >shmat.c <<'END'
18490 #include <sys/shm.h>
18491 void *shmat();
18492 END
18493         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18494                 shmattype='void *'
18495         else
18496                 shmattype='char *'
18497         fi
18498         echo "and it returns ($shmattype)." >&4
18499         : see if a prototype for shmat is available
18500         xxx=`./findhdr sys/shm.h`
18501         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18502         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18503                 val="$define"
18504         else
18505                 val="$undef"
18506         fi
18507         $rm -f shmat.[co]
18508         ;;
18509 *)
18510         val="$undef"
18511         ;;
18512 esac
18513 set d_shmatprototype
18514 eval $setvar
18515
18516 : see if shmdt exists
18517 set shmdt d_shmdt
18518 eval $inlibc
18519
18520 : see how much of the 'shm*(2)' library is present.
18521 h_shm=true
18522 echo " "
18523 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18524 *"$undef"*) h_shm=false;;
18525 esac
18526 case "$osname" in
18527 freebsd)
18528     case "`ipcs 2>&1`" in
18529     "SVID shared memory"*"not configured"*)
18530         echo "Your $osname does not have the shm*(2) configured." >&4
18531         h_shm=false
18532         val="$undef"
18533         set shmctl d_shmctl
18534         eval $setvar
18535         set shmget d_shmget
18536         eval $setvar
18537         set shmat d_shmat
18538         eval $setvar
18539         set shmdt d_shmdt
18540         eval $setvar
18541         ;;
18542     esac
18543     ;;
18544 esac
18545 : we could also check for sys/ipc.h ...
18546 if $h_shm && $test `./findhdr sys/shm.h`; then
18547         echo "You have the full shm*(2) library." >&4
18548         val="$define"
18549 else
18550         echo "You don't have the full shm*(2) library." >&4
18551         val="$undef"
18552 fi
18553 set d_shm
18554 eval $setvar
18555
18556 : see if we have sigaction
18557 echo " "
18558 if set sigaction val -f d_sigaction; eval $csym; $val; then
18559         echo 'sigaction() found.' >&4
18560         $cat > try.c <<EOP
18561 #include <stdio.h>
18562 #include <sys/types.h>
18563 #include <signal.h>
18564 #$i_stdlib I_STDLIB
18565 #ifdef I_STDLIB
18566 #include <stdlib.h>
18567 #endif
18568 int main()
18569 {
18570     struct sigaction act, oact;
18571     act.sa_flags = 0;
18572     oact.sa_handler = 0;
18573     /* so that act and oact are used */
18574     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18575 }
18576 EOP
18577         set try
18578         if eval $compile_ok; then
18579                 val="$define"
18580         else
18581                 echo "But you don't seem to have a usable struct sigaction." >&4
18582                 val="$undef"
18583         fi
18584 else
18585         echo 'sigaction NOT found.' >&4
18586         val="$undef"
18587 fi
18588 set d_sigaction; eval $setvar
18589 $rm_try
18590
18591 : see what type pids are declared as in the kernel
18592 rp="What is the type of process ids on this system?"
18593 set pid_t pidtype int stdio.h sys/types.h
18594 eval $typedef_ask
18595
18596 : see what type uids are declared as in the kernel
18597 echo " "
18598 echo "Looking for the type for user ids returned by getuid()."
18599 set uid_t uidtype xxx stdio.h sys/types.h
18600 eval $typedef
18601 case "$uidtype" in
18602 xxx)
18603         xxx=`./findhdr sys/user.h`
18604         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18605         case $1 in
18606         unsigned) dflt="$1 $2" ;;
18607         *) dflt="$1" ;;
18608         esac
18609         ;;
18610 *) dflt="$uidtype";;
18611 esac
18612 case "$uidtype" in
18613 uid_t)  echo "uid_t found." ;;
18614 *)      rp="What is the type for user ids returned by getuid()?"
18615         . ./myread
18616         uidtype="$ans"
18617         ;;
18618 esac
18619
18620 : Define hasfield_t macro for Configure internal use
18621 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18622 while $test $# -ge 2; do
18623     case "$1" in
18624         $define) echo "#include <$2>";;
18625     esac ;
18626     shift 2;
18627 done > try.c;
18628 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18629 set try;
18630 if eval $compile; then
18631         val="$define";
18632 else
18633         val="$undef";
18634 fi;
18635 set $varname;
18636 eval $setvar;
18637 $rm_try'
18638
18639 : see what siginfo fields we have
18640 case "$d_sigaction" in
18641 "$define")
18642         echo "Checking if your siginfo_t has si_errno field...">&4
18643         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18644         eval $hasfield_t;
18645
18646         echo "Checking if your siginfo_t has si_pid field...">&4
18647         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18648         eval $hasfield_t;
18649
18650         echo "Checking if your siginfo_t has si_uid field...">&4
18651         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18652         eval $hasfield_t;
18653
18654         echo "Checking if your siginfo_t has si_addr field...">&4
18655         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18656         eval $hasfield_t;
18657
18658         echo "Checking if your siginfo_t has si_status field...">&4
18659         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18660         eval $hasfield_t;
18661
18662         echo "Checking if your siginfo_t has si_band field...">&4
18663         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18664         eval $hasfield_t;
18665
18666         echo "Checking if your siginfo_t has si_value field...">&4
18667         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18668         eval $hasfield_t;
18669
18670         echo "Checking if your siginfo_t has si_fd field...">&4
18671         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18672         eval $hasfield_t;
18673
18674         ;;
18675 *)
18676         d_siginfo_si_errno="$undef"
18677         d_siginfo_si_pid="$undef"
18678         d_siginfo_si_uid="$undef"
18679         d_siginfo_si_addr="$undef"
18680         d_siginfo_si_status="$undef"
18681         d_siginfo_si_band="$undef"
18682         d_siginfo_si_value="$undef"
18683         d_siginfo_si_fd="$undef"
18684         ;;
18685 esac
18686
18687 : see if this is a sunmath.h system
18688 set sunmath.h i_sunmath
18689 eval $inhdr
18690
18691 : see if signbit exists
18692 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18693 $cat >try.c <<EOCP
18694 #$i_math I_MATH
18695 #$i_sunmath I_SUNMATH
18696 #ifdef I_MATH
18697 #  include <math.h>
18698 #endif
18699 #ifdef I_SUNMATH  /* Solaris special math library */
18700 #  include <sunmath.h>
18701 #endif
18702 #define NV $nvtype
18703 int main(int argc, char **argv)
18704 {
18705     NV x = 0.0;
18706     NV y = -0.0;
18707     if ((signbit(x) == 0) && (signbit(y) != 0))
18708         return 0;
18709     else
18710         return 1;
18711 }
18712 EOCP
18713 val="$undef"
18714 set try
18715 if eval $compile; then
18716     if $run ./try; then
18717         $echo "Yes." >&4
18718         val="$define"
18719     else
18720         $echo "Signbit seems to be available, but doesn't work as I expected."
18721         $echo "I won't use it." >&4
18722         val="$undef"
18723     fi
18724 else
18725     $echo "Nope." >&4
18726     dflt="$undef"
18727 fi
18728 set d_signbit
18729 eval $setvar
18730 $rm_try
18731
18732 : see if sigprocmask exists
18733 set sigprocmask d_sigprocmask
18734 eval $inlibc
18735
18736 : see if sigsetjmp exists
18737 echo " "
18738 case "$d_sigsetjmp" in
18739 '')
18740         $cat >try.c <<EOP
18741 #include <setjmp.h>
18742 #$i_stdlib I_STDLIB
18743 #ifdef I_STDLIB
18744 #include <stdlib.h>
18745 #endif
18746 sigjmp_buf env;
18747 int set = 1;
18748 int main()
18749 {
18750         if (sigsetjmp(env,1))
18751                 exit(set);
18752         set = 0;
18753         siglongjmp(env, 1);
18754         exit(1);
18755 }
18756 EOP
18757         set try
18758         if eval $compile; then
18759                 if $run ./try >/dev/null 2>&1; then
18760                         echo "POSIX sigsetjmp found." >&4
18761                         val="$define"
18762                 else
18763                         $cat >&4 <<EOM
18764 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18765 I'll ignore them.
18766 EOM
18767                         val="$undef"
18768                 fi
18769         else
18770                 echo "sigsetjmp not found." >&4
18771                 val="$undef"
18772         fi
18773         ;;
18774 *) val="$d_sigsetjmp"
18775         case "$d_sigsetjmp" in
18776         $define) echo "POSIX sigsetjmp found." >&4;;
18777         $undef) echo "sigsetjmp not found." >&4;;
18778         esac
18779         ;;
18780 esac
18781 set d_sigsetjmp
18782 eval $setvar
18783 $rm_try
18784
18785 : see if snprintf exists
18786 set snprintf d_snprintf
18787 eval $inlibc
18788
18789 : see if vsnprintf exists
18790 set vsnprintf d_vsnprintf
18791 eval $inlibc
18792
18793 case "$d_snprintf-$d_vsnprintf" in
18794 "$define-$define")
18795     $cat <<EOM
18796 Checking whether your snprintf() and vsnprintf() work okay...
18797 EOM
18798     $cat >try.c <<'EOCP'
18799 /* v?snprintf testing logic courtesy of Russ Allbery.
18800  * According to C99:
18801  * - if the buffer is too short it still must be \0-terminated
18802  * - if the buffer is too short the potentially required length
18803  *   must be returned and not -1
18804  * - if the buffer is NULL the potentially required length
18805  *   must be returned and not -1 or core dump
18806  */
18807 #include <stdio.h>
18808 #include <stdarg.h>
18809
18810 char buf[2];
18811
18812 int test (char *format, ...)
18813 {
18814     va_list args;
18815     int count;
18816
18817     va_start (args, format);
18818     count = vsnprintf (buf, sizeof buf, format, args);
18819     va_end (args);
18820     return count;
18821 }
18822
18823 int main ()
18824 {
18825     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18826              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18827 }
18828 EOCP
18829     set try
18830     if eval $compile; then
18831         `$run ./try`
18832         case "$?" in
18833         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18834         *) cat <<EOM >&4
18835 Your snprintf() and snprintf() don't seem to be working okay.
18836 EOM
18837            d_snprintf="$undef"
18838            d_vsnprintf="$undef"
18839            ;;
18840         esac
18841     else
18842         echo "(I can't seem to compile the test program--assuming they don't)"
18843         d_snprintf="$undef"
18844         d_vsnprintf="$undef"
18845     fi
18846     $rm_try
18847     ;;
18848 esac
18849
18850 : see if sockatmark exists
18851 set sockatmark d_sockatmark
18852 eval $inlibc
18853
18854 : see if prototype for sockatmark is available
18855 echo " "
18856 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18857 eval $hasproto
18858
18859 : see if socks5_init exists
18860 set socks5_init d_socks5_init
18861 eval $inlibc
18862
18863 : see if sprintf returns the length of the string in the buffer as per ANSI
18864 $echo "Checking whether sprintf returns the length of the string..." >&4
18865 $cat <<EOP >try.c
18866 #include <stdio.h>
18867 #$i_stdlib I_STDLIB
18868 #ifdef I_STDLIB
18869 #include <stdlib.h>
18870 #endif
18871 #$i_string I_STRING
18872 #ifdef I_STRING
18873 #  include <string.h>
18874 #else
18875 #  include <strings.h>
18876 #endif
18877 #$i_math I_MATH
18878 #ifdef I_MATH
18879 #include <math.h>
18880 #endif
18881
18882 char buffer[256];
18883
18884 int check (size_t expect, int test) {
18885   size_t got = strlen(buffer);
18886   if (expect == got)
18887     return 0;
18888
18889   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18890        test, buffer);
18891   exit (test);
18892 }
18893
18894 int main(int argc, char **argv) {
18895   int test = 0;
18896
18897   check(sprintf(buffer, ""), ++test);
18898   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18899   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18900
18901   return 0;
18902 }
18903 EOP
18904 set try
18905
18906 if eval $compile; then
18907     xxx="`$run ./try`"
18908     case "$?" in
18909         0) cat >&4 <<EOM
18910 sprintf returns the length of the string (as ANSI says it should)
18911 EOM
18912         d_sprintf_returns_strlen="$define"
18913         ;;
18914         *) cat >&4 <<EOM
18915 sprintf does not return the length of the string (how old is this system?)
18916 EOM
18917         d_sprintf_returns_strlen="$undef"
18918         ;;
18919     esac
18920 else
18921     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18922     d_sprintf_returns_strlen="$undef"
18923 fi
18924 $rm_try
18925
18926 : see if srand48_r exists
18927 set srand48_r d_srand48_r
18928 eval $inlibc
18929 case "$d_srand48_r" in
18930 "$define")
18931         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18932         case "$d_srand48_r_proto:$usethreads" in
18933         ":define")      d_srand48_r_proto=define
18934                 set d_srand48_r_proto srand48_r $hdrs
18935                 eval $hasproto ;;
18936         *)      ;;
18937         esac
18938         case "$d_srand48_r_proto" in
18939         define)
18940         case "$srand48_r_proto" in
18941         ''|0) try='int srand48_r(long, struct drand48_data*);'
18942         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18943         esac
18944         case "$srand48_r_proto" in
18945         ''|0)   d_srand48_r=undef
18946                 srand48_r_proto=0
18947                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18948         * )     case "$srand48_r_proto" in
18949                 REENTRANT_PROTO*) ;;
18950                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18951                 esac
18952                 echo "Prototype: $try" ;;
18953         esac
18954         ;;
18955         *)      case "$usethreads" in
18956                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18957                 esac
18958                 d_srand48_r=undef
18959                 srand48_r_proto=0
18960                 ;;
18961         esac
18962         ;;
18963 *)      srand48_r_proto=0
18964         ;;
18965 esac
18966
18967 : see if srandom_r exists
18968 set srandom_r d_srandom_r
18969 eval $inlibc
18970 case "$d_srandom_r" in
18971 "$define")
18972         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18973         case "$d_srandom_r_proto:$usethreads" in
18974         ":define")      d_srandom_r_proto=define
18975                 set d_srandom_r_proto srandom_r $hdrs
18976                 eval $hasproto ;;
18977         *)      ;;
18978         esac
18979         case "$d_srandom_r_proto" in
18980         define)
18981         case "$srandom_r_proto" in
18982         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18983         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18984         esac
18985         case "$srandom_r_proto" in
18986         ''|0)   d_srandom_r=undef
18987                 srandom_r_proto=0
18988                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18989         * )     case "$srandom_r_proto" in
18990                 REENTRANT_PROTO*) ;;
18991                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18992                 esac
18993                 echo "Prototype: $try" ;;
18994         esac
18995         ;;
18996         *)      case "$usethreads" in
18997                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18998                 esac
18999                 d_srandom_r=undef
19000                 srandom_r_proto=0
19001                 ;;
19002         esac
19003         ;;
19004 *)      srandom_r_proto=0
19005         ;;
19006 esac
19007
19008 : see if prototype for setresgid is available
19009 echo " "
19010 set d_sresgproto setresgid $i_unistd unistd.h
19011 eval $hasproto
19012
19013 : see if prototype for setresuid is available
19014 echo " "
19015 set d_sresuproto setresuid $i_unistd unistd.h
19016 eval $hasproto
19017
19018 : see if stat exists
19019 set stat d_stat
19020 eval $inlibc
19021
19022 : see if sys/stat.h is available
19023 set sys/stat.h i_sysstat
19024 eval $inhdr
19025
19026 : see if stat knows about block sizes
19027 echo " "
19028 echo "Checking to see if your struct stat has st_blocks field..." >&4
19029 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19030 eval $hasfield
19031
19032 : see if this is a sys/vfs.h system
19033 set sys/vfs.h i_sysvfs
19034 eval $inhdr
19035
19036 : see if this is a sys/statfs.h system
19037 set sys/statfs.h i_sysstatfs
19038 eval $inhdr
19039
19040 : Check for statfs_s
19041 echo " "
19042 echo "Checking to see if your system supports struct statfs..." >&4
19043 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
19044 eval $hasstruct
19045 case "$d_statfs_s" in
19046 "$define")      echo "Yes, it does."   ;;
19047 *)              echo "No, it doesn't." ;;
19048 esac
19049
19050
19051 : see if struct statfs knows about f_flags
19052 case "$d_statfs_s" in
19053 define)
19054         echo " "
19055         echo "Checking to see if your struct statfs has f_flags field..." >&4
19056         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
19057         eval $hasfield
19058         ;;
19059 *)      val="$undef"
19060         set d_statfs_f_flags
19061         eval $setvar
19062         ;;
19063 esac
19064 case "$d_statfs_f_flags" in
19065 "$define")      echo "Yes, it does."   ;;
19066 *)              echo "No, it doesn't." ;;
19067 esac
19068
19069 : see what flavor, if any, of static inline is supported
19070 echo " "
19071 echo "Checking to see if your system supports static inline..."
19072 $cat > try.c <<'EOCP'
19073 #include <stdlib.h>
19074 extern int f_via_a(int x);
19075 extern int f_via_b(int x);
19076 int main(int argc, char **argv)
19077 {
19078     int y;
19079
19080     y = f_via_a(0);
19081 #ifdef USE_B
19082     y = f_via_b(0);
19083 #endif
19084     if (y == 42) {
19085         return EXIT_SUCCESS;
19086     }
19087     else {
19088         return EXIT_FAILURE;
19089     }
19090 }
19091 EOCP
19092 $cat > a.c <<'EOCP'
19093 static INLINE int f(int x) {
19094     int y;
19095     y = x + 42;
19096     return y;
19097 }
19098
19099 int f_via_a(int x)
19100 {
19101     return f(x);
19102 }
19103 EOCP
19104 $cat > b.c <<'EOCP'
19105 extern int f(int x);
19106
19107 int f_via_b(int x)
19108 {
19109     return f(x);
19110 }
19111 EOCP
19112
19113 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19114 case "$perl_static_inline" in
19115 '')     # Check the various possibilities, and break out on success.
19116         # For gcc, prefer __inline__, which will still permit
19117         # cflags.SH to add in -ansi.
19118         case "$gccversion" in
19119                 '') xxx="inline __inline__ __inline _inline";;
19120                 *)  xxx="__inline__ inline __inline _inline";;
19121         esac
19122         for inline in $xxx; do
19123                 set try -DINLINE=$inline a.c
19124                 if eval $compile && $run ./try; then
19125                         # Now make sure there is no external linkage of static
19126                         # functions
19127                         set try -DINLINE=$inline -DUSE_B a.c b.c
19128                         if eval $compile && $run ./try; then
19129                                 $echo "Your compiler supports static $inline, " >&4
19130                                 $echo "but it also creates an external definition," >&4
19131                                 $echo "so I won't use it." >&4
19132                                 val=$undef
19133                         else
19134                                 $echo "Your compiler supports static $inline." >&4
19135                                 val=$define
19136                                 perl_static_inline="static $inline";
19137                                 break;
19138                         fi
19139                 else
19140                         $echo "Your compiler does NOT support static $inline." >&4
19141                         val="$undef"
19142                 fi
19143         done
19144         ;;
19145 *inline*) # Some variant of inline exists.
19146         echo "Keeping your $hint value of $perl_static_inline."
19147         val=$define
19148         ;;
19149 static)  # No inline capabilities
19150         echo "Keeping your $hint value of $perl_static_inline."
19151         val=$undef
19152         ;;
19153 *)  # Unrecognized previous value -- blindly trust the supplied
19154         # value and hope it makes sense.  Use old value for
19155         # d_static_inline, if there is one.
19156         echo "Keeping your $hint value of $perl_static_inline."
19157         case "$d_static_inline" in
19158                 '') val=$define ;;
19159                 *)  val=$d_static_inline ;;
19160         esac
19161         ;;
19162 esac
19163 # Fallback to plain 'static' if nothing worked.
19164 case "$perl_static_inline" in
19165 '')
19166         perl_static_inline="static"
19167         val=$undef
19168         ;;
19169 esac
19170 set d_static_inline
19171 eval $setvar
19172 $rm -f a.[co] b.[co]
19173 $rm_try
19174
19175 : Check stream access
19176 $cat >&4 <<EOM
19177 Checking how to access stdio streams by file descriptor number...
19178 EOM
19179 case "$stdio_stream_array" in
19180 '')     $cat >try.c <<EOCP
19181 #include <stdio.h>
19182 int main() {
19183   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19184     printf("yes\n");
19185 }
19186 EOCP
19187         for s in _iob __iob __sF
19188         do
19189                 set try -DSTDIO_STREAM_ARRAY=$s
19190                 if eval $compile; then
19191                         case "`$run ./try`" in
19192                         yes)    stdio_stream_array=$s; break ;;
19193                         esac
19194                 fi
19195         done
19196         $rm_try
19197 esac
19198 case "$stdio_stream_array" in
19199 '')     $cat >&4 <<EOM
19200 I can't figure out how to access stdio streams by file descriptor number.
19201 EOM
19202         d_stdio_stream_array="$undef"
19203         ;;
19204 *)      $cat >&4 <<EOM
19205 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19206 EOM
19207         d_stdio_stream_array="$define"
19208         ;;
19209 esac
19210
19211 : see if strcoll exists
19212 set strcoll d_strcoll
19213 eval $inlibc
19214
19215 : check for structure copying
19216 echo " "
19217 echo "Checking to see if your C compiler can copy structs..." >&4
19218 $cat >try.c <<'EOCP'
19219 int main()
19220 {
19221         struct blurfl {
19222                 int dyick;
19223         } foo, bar;
19224
19225         foo = bar;
19226 }
19227 EOCP
19228 if $cc -c try.c >/dev/null 2>&1 ; then
19229         val="$define"
19230         echo "Yup, it can."
19231 else
19232         val="$undef"
19233         echo "Nope, it can't."
19234 fi
19235 set d_strctcpy
19236 eval $setvar
19237 $rm_try
19238
19239 : see if strerror and/or sys_errlist[] exist
19240 echo " "
19241 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19242     if set strerror val -f d_strerror; eval $csym; $val; then
19243                 echo 'strerror() found.' >&4
19244                 d_strerror="$define"
19245                 d_strerrm='strerror(e)'
19246                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19247                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19248                         d_syserrlst="$define"
19249                 else
19250                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19251                         d_syserrlst="$undef"
19252                 fi
19253     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19254                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19255                 echo 'strerror() found in string header.' >&4
19256                 d_strerror="$define"
19257                 d_strerrm='strerror(e)'
19258                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19259                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19260                                 d_syserrlst="$define"
19261                 else
19262                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19263                         d_syserrlst="$undef"
19264                 fi
19265     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19266                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19267                 d_strerror="$undef"
19268                 d_syserrlst="$define"
19269                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19270     else
19271                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19272                 d_strerror="$undef"
19273                 d_syserrlst="$undef"
19274                 d_strerrm='"unknown"'
19275     fi
19276 fi
19277
19278 : see if strerror_r exists
19279 set strerror_r d_strerror_r
19280 eval $inlibc
19281 case "$d_strerror_r" in
19282 "$define")
19283         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19284         case "$d_strerror_r_proto:$usethreads" in
19285         ":define")      d_strerror_r_proto=define
19286                 set d_strerror_r_proto strerror_r $hdrs
19287                 eval $hasproto ;;
19288         *)      ;;
19289         esac
19290         case "$d_strerror_r_proto" in
19291         define)
19292         case "$strerror_r_proto" in
19293         ''|0) try='int strerror_r(int, char*, size_t);'
19294         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19295         esac
19296         case "$strerror_r_proto" in
19297         ''|0) try='int strerror_r(int, char*, int);'
19298         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19299         esac
19300         case "$strerror_r_proto" in
19301         ''|0) try='char* strerror_r(int, char*, size_t);'
19302         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19303         esac
19304         case "$strerror_r_proto" in
19305         ''|0)   d_strerror_r=undef
19306                 strerror_r_proto=0
19307                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19308         * )     case "$strerror_r_proto" in
19309                 REENTRANT_PROTO*) ;;
19310                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19311                 esac
19312                 echo "Prototype: $try" ;;
19313         esac
19314         ;;
19315         *)      case "$usethreads" in
19316                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19317                 esac
19318                 d_strerror_r=undef
19319                 strerror_r_proto=0
19320                 ;;
19321         esac
19322         ;;
19323 *)      strerror_r_proto=0
19324         ;;
19325 esac
19326
19327 : see if strftime exists
19328 set strftime d_strftime
19329 eval $inlibc
19330
19331 : see if strlcat exists
19332 set strlcat d_strlcat
19333 eval $inlibc
19334
19335 : see if strlcpy exists
19336 set strlcpy d_strlcpy
19337 eval $inlibc
19338
19339 : see if strtod exists
19340 set strtod d_strtod
19341 eval $inlibc
19342
19343 : see if strtol exists
19344 set strtol d_strtol
19345 eval $inlibc
19346
19347 : see if strtold exists
19348 set strtold d_strtold
19349 eval $inlibc
19350
19351 : see if strtoll exists
19352 set strtoll d_strtoll
19353 eval $inlibc
19354
19355 case "$d_longlong-$d_strtoll" in
19356 "$define-$define")
19357         $cat <<EOM
19358 Checking whether your strtoll() works okay...
19359 EOM
19360         $cat >try.c <<'EOCP'
19361 #include <errno.h>
19362 #ifdef __hpux
19363 #define strtoll __strtoll
19364 #endif
19365 #ifdef __EMX__
19366 #define strtoll _strtoll
19367 #endif
19368 #include <stdio.h>
19369 extern long long int strtoll(char *s, char **, int);
19370 static int bad = 0;
19371 int check(char *s, long long ell, int een) {
19372         long long gll;
19373         errno = 0;
19374         gll = strtoll(s, 0, 10);
19375         if (!((gll == ell) && (errno == een)))
19376                 bad++;
19377 }
19378 int main() {
19379         check(" 1",                                      1LL, 0);
19380         check(" 0",                                      0LL, 0);
19381         check("-1",                                     -1LL, 0);
19382         check("-9223372036854775808", -9223372036854775808LL, 0);
19383         check("-9223372036854775808", -9223372036854775808LL, 0);
19384         check(" 9223372036854775807",  9223372036854775807LL, 0);
19385         check("-9223372036854775808", -9223372036854775808LL, 0);
19386         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19387         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19388         if (!bad)
19389                 printf("ok\n");
19390 }
19391 EOCP
19392         set try
19393         if eval $compile; then
19394                 yyy=`$run ./try`
19395                 case "$yyy" in
19396                 ok) echo "Your strtoll() seems to be working okay." ;;
19397                 *) cat <<EOM >&4
19398 Your strtoll() doesn't seem to be working okay.
19399 EOM
19400                    d_strtoll="$undef"
19401                    ;;
19402                 esac
19403         else
19404                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19405                 d_strtoll="$undef"
19406         fi
19407         ;;
19408 esac
19409
19410 : see if strtoq exists
19411 set strtoq d_strtoq
19412 eval $inlibc
19413
19414 : see if strtoul exists
19415 set strtoul d_strtoul
19416 eval $inlibc
19417
19418 case "$d_strtoul" in
19419 "$define")
19420         $cat <<EOM
19421 Checking whether your strtoul() works okay...
19422 EOM
19423         $cat >try.c <<'EOCP'
19424 #include <errno.h>
19425 #include <stdio.h>
19426 extern unsigned long int strtoul(char *s, char **, int);
19427 static int bad = 0;
19428 void check(char *s, unsigned long eul, int een) {
19429         unsigned long gul;
19430         errno = 0;
19431         gul = strtoul(s, 0, 10);
19432         if (!((gul == eul) && (errno == een)))
19433                 bad++;
19434 }
19435 int main() {
19436         check(" 1", 1L, 0);
19437         check(" 0", 0L, 0);
19438 EOCP
19439         case "$longsize" in
19440         8)
19441             $cat >>try.c <<'EOCP'
19442         check("18446744073709551615", 18446744073709551615UL, 0);
19443         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19444 #if 0 /* strtoul() for /^-/ strings is undefined. */
19445         check("-1", 18446744073709551615UL, 0);
19446         check("-18446744073709551614", 2, 0);
19447         check("-18446744073709551615", 1, 0);
19448         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19449         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19450 #endif
19451 EOCP
19452                 ;;
19453         4)
19454                     $cat >>try.c <<'EOCP'
19455         check("4294967295", 4294967295UL, 0);
19456         check("4294967296", 4294967295UL, ERANGE);
19457 #if 0 /* strtoul() for /^-/ strings is undefined. */
19458         check("-1", 4294967295UL, 0);
19459         check("-4294967294", 2, 0);
19460         check("-4294967295", 1, 0);
19461         check("-4294967296", 4294967295UL, ERANGE);
19462         check("-4294967297", 4294967295UL, ERANGE);
19463 #endif
19464 EOCP
19465                 ;;
19466         *)
19467 : Should we write these tests to be more portable by sprintf-ing
19468 : ~0 and then manipulating that char string as input for strtol?
19469                 ;;
19470         esac
19471         $cat >>try.c <<'EOCP'
19472         if (!bad)
19473                 printf("ok\n");
19474         return 0;
19475 }
19476 EOCP
19477         set try
19478         if eval $compile; then
19479                 case "`$run ./try`" in
19480                 ok) echo "Your strtoul() seems to be working okay." ;;
19481                 *) cat <<EOM >&4
19482 Your strtoul() doesn't seem to be working okay.
19483 EOM
19484                    d_strtoul="$undef"
19485                    ;;
19486                 esac
19487         else
19488                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19489                 d_strtoul="$undef"
19490         fi
19491         ;;
19492 esac
19493
19494 : see if strtoull exists
19495 set strtoull d_strtoull
19496 eval $inlibc
19497
19498 case "$d_longlong-$d_strtoull" in
19499 "$define-$define")
19500         $cat <<EOM
19501 Checking whether your strtoull() works okay...
19502 EOM
19503         $cat >try.c <<'EOCP'
19504 #include <errno.h>
19505 #ifdef __hpux
19506 #define strtoull __strtoull
19507 #endif
19508 #include <stdio.h>
19509 extern unsigned long long int strtoull(char *s, char **, int);
19510 static int bad = 0;
19511 int check(char *s, long long eull, int een) {
19512         long long gull;
19513         errno = 0;
19514         gull = strtoull(s, 0, 10);
19515         if (!((gull == eull) && (errno == een)))
19516                 bad++;
19517 }
19518 int main() {
19519         check(" 1",                                        1LL, 0);
19520         check(" 0",                                        0LL, 0);
19521         check("18446744073709551615",  18446744073709551615ULL, 0);
19522         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19523 #if 0 /* strtoull() for /^-/ strings is undefined. */
19524         check("-1",                    18446744073709551615ULL, 0);
19525         check("-18446744073709551614",                     2LL, 0);
19526         check("-18446744073709551615",                     1LL, 0);
19527         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19528         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19529 #endif
19530         if (!bad)
19531                 printf("ok\n");
19532 }
19533 EOCP
19534         set try
19535         if eval $compile; then
19536                 case "`$run ./try`" in
19537                 ok) echo "Your strtoull() seems to be working okay." ;;
19538                 *) cat <<EOM >&4
19539 Your strtoull() doesn't seem to be working okay.
19540 EOM
19541                    d_strtoull="$undef"
19542                    ;;
19543                 esac
19544         else
19545                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19546                 d_strtoull="$undef"
19547         fi
19548         ;;
19549 esac
19550
19551 : see if strtouq exists
19552 set strtouq d_strtouq
19553 eval $inlibc
19554
19555 case "$d_strtouq" in
19556 "$define")
19557         $cat <<EOM
19558 Checking whether your strtouq() works okay...
19559 EOM
19560         $cat >try.c <<'EOCP'
19561 #include <errno.h>
19562 #include <stdio.h>
19563 extern unsigned long long int strtouq(char *s, char **, int);
19564 static int bad = 0;
19565 void check(char *s, unsigned long long eull, int een) {
19566         unsigned long long gull;
19567         errno = 0;
19568         gull = strtouq(s, 0, 10);
19569         if (!((gull == eull) && (errno == een)))
19570                 bad++;
19571 }
19572 int main() {
19573         check(" 1",                                        1LL, 0);
19574         check(" 0",                                        0LL, 0);
19575         check("18446744073709551615",  18446744073709551615ULL, 0);
19576         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19577 #if 0 /* strtouq() for /^-/ strings is undefined. */
19578         check("-1",                    18446744073709551615ULL, 0);
19579         check("-18446744073709551614",                     2LL, 0);
19580         check("-18446744073709551615",                     1LL, 0);
19581         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19582         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19583 #endif
19584         if (!bad)
19585                 printf("ok\n");
19586         return 0;
19587 }
19588 EOCP
19589         set try
19590         if eval $compile; then
19591                 case "`$run ./try`" in
19592                 ok) echo "Your strtouq() seems to be working okay." ;;
19593                 *) cat <<EOM >&4
19594 Your strtouq() doesn't seem to be working okay.
19595 EOM
19596                    d_strtouq="$undef"
19597                    ;;
19598                 esac
19599         else
19600                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19601                 d_strtouq="$undef"
19602         fi
19603         ;;
19604 esac
19605
19606 : see if strxfrm exists
19607 set strxfrm d_strxfrm
19608 eval $inlibc
19609
19610 : see if symlink exists
19611 set symlink d_symlink
19612 eval $inlibc
19613
19614 : see if syscall exists
19615 set syscall d_syscall
19616 eval $inlibc
19617
19618 : see if prototype for syscall is available
19619 echo " "
19620 set d_syscallproto syscall $i_unistd unistd.h
19621 eval $hasproto
19622
19623 : see if sysconf exists
19624 set sysconf d_sysconf
19625 eval $inlibc
19626
19627 : see if system exists
19628 set system d_system
19629 eval $inlibc
19630
19631 : see if tcgetpgrp exists
19632 set tcgetpgrp d_tcgetpgrp
19633 eval $inlibc
19634
19635 : see if tcsetpgrp exists
19636 set tcsetpgrp d_tcsetpgrp
19637 eval $inlibc
19638
19639 : see if prototype for telldir is available
19640 echo " "
19641 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19642 eval $hasproto
19643
19644 : see if tgamma exists
19645 set tgamma d_tgamma
19646 eval $inlibc
19647
19648 : see if time exists
19649 echo " "
19650 if test "X$d_time" = X -o X"$timetype" = X; then
19651     if set time val -f d_time; eval $csym; $val; then
19652                 echo 'time() found.' >&4
19653                 val="$define"
19654                 rp="What is the type returned by time() on this system?"
19655                 set time_t timetype long stdio.h sys/types.h
19656                 eval $typedef_ask
19657     else
19658                 echo 'time() not found, hope that will do.' >&4
19659                 val="$undef"
19660                 timetype='int';
19661     fi
19662     set d_time
19663     eval $setvar
19664 fi
19665
19666 : see if timegm exists
19667 set timegm d_timegm
19668 eval $inlibc
19669
19670 : see if this is a sys/times.h system
19671 set sys/times.h i_systimes
19672 eval $inhdr
19673
19674 : see if times exists
19675 echo " "
19676 if set times val -f d_times; eval $csym; $val; then
19677         echo 'times() found.' >&4
19678         d_times="$define"
19679         inc=''
19680         case "$i_systimes" in
19681         "$define") inc='sys/times.h';;
19682         esac
19683         rp="What is the type returned by times() on this system?"
19684         set clock_t clocktype long stdio.h sys/types.h $inc
19685         eval $typedef_ask
19686 else
19687         echo 'times() NOT found, hope that will do.' >&4
19688         d_times="$undef"
19689         clocktype='int'
19690 fi
19691
19692 : see if tmpnam_r exists
19693 set tmpnam_r d_tmpnam_r
19694 eval $inlibc
19695 case "$d_tmpnam_r" in
19696 "$define")
19697         hdrs="$i_systypes sys/types.h define stdio.h "
19698         case "$d_tmpnam_r_proto:$usethreads" in
19699         ":define")      d_tmpnam_r_proto=define
19700                 set d_tmpnam_r_proto tmpnam_r $hdrs
19701                 eval $hasproto ;;
19702         *)      ;;
19703         esac
19704         case "$d_tmpnam_r_proto" in
19705         define)
19706         case "$tmpnam_r_proto" in
19707         ''|0) try='char* tmpnam_r(char*);'
19708         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19709         esac
19710         case "$tmpnam_r_proto" in
19711         ''|0)   d_tmpnam_r=undef
19712                 tmpnam_r_proto=0
19713                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19714         * )     case "$tmpnam_r_proto" in
19715                 REENTRANT_PROTO*) ;;
19716                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19717                 esac
19718                 echo "Prototype: $try" ;;
19719         esac
19720         ;;
19721         *)      case "$usethreads" in
19722                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19723                 esac
19724                 d_tmpnam_r=undef
19725                 tmpnam_r_proto=0
19726                 ;;
19727         esac
19728         ;;
19729 *)      tmpnam_r_proto=0
19730         ;;
19731 esac
19732
19733 : see if trunc exists
19734 set trunc d_trunc
19735 eval $inlibc
19736
19737 : see if truncate exists
19738 set truncate d_truncate
19739 eval $inlibc
19740
19741 : see if ttyname_r exists
19742 set ttyname_r d_ttyname_r
19743 eval $inlibc
19744 case "$d_ttyname_r" in
19745 "$define")
19746         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19747         case "$d_ttyname_r_proto:$usethreads" in
19748         ":define")      d_ttyname_r_proto=define
19749                 set d_ttyname_r_proto ttyname_r $hdrs
19750                 eval $hasproto ;;
19751         *)      ;;
19752         esac
19753         case "$d_ttyname_r_proto" in
19754         define)
19755         case "$ttyname_r_proto" in
19756         ''|0) try='int ttyname_r(int, char*, size_t);'
19757         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19758         esac
19759         case "$ttyname_r_proto" in
19760         ''|0) try='int ttyname_r(int, char*, int);'
19761         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19762         esac
19763         case "$ttyname_r_proto" in
19764         ''|0) try='char* ttyname_r(int, char*, int);'
19765         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19766         esac
19767         case "$ttyname_r_proto" in
19768         ''|0)   d_ttyname_r=undef
19769                 ttyname_r_proto=0
19770                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19771         * )     case "$ttyname_r_proto" in
19772                 REENTRANT_PROTO*) ;;
19773                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19774                 esac
19775                 echo "Prototype: $try" ;;
19776         esac
19777         ;;
19778         *)      case "$usethreads" in
19779                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19780                 esac
19781                 d_ttyname_r=undef
19782                 ttyname_r_proto=0
19783                 ;;
19784         esac
19785         ;;
19786 *)      ttyname_r_proto=0
19787         ;;
19788 esac
19789
19790 : see if tzname[] exists
19791 echo " "
19792 if set tzname val -a d_tzname; eval $csym; $val; then
19793         val="$define"
19794         echo 'tzname[] found.' >&4
19795 else
19796         val="$undef"
19797         echo 'tzname[] NOT found.' >&4
19798 fi
19799 set d_tzname
19800 eval $setvar
19801
19802 : Check if is a multiplatform env
19803 case "$osname" in
19804 darwin) multiarch="$define" ;;
19805 esac
19806 case "$multiarch" in
19807 ''|[nN]*) multiarch="$undef" ;;
19808 esac
19809
19810 : check for ordering of bytes in a UV
19811 echo " "
19812 case "$multiarch" in
19813 *$define*)
19814         $cat <<EOM
19815 You seem to be doing a multiarchitecture build,
19816 skipping the byteorder check.
19817
19818 EOM
19819         byteorder='ffff'
19820         ;;
19821 *)
19822         case "$byteorder" in
19823         '')
19824                 $cat <<'EOM'
19825 In the following, larger digits indicate more significance.  A big-endian
19826 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19827 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19828 machines may have weird orders like 3412.  A Cray will report 87654321,
19829 an Alpha will report 12345678. If the test program works the default is
19830 probably right.
19831 I'm now running the test program...
19832 EOM
19833                 $cat >try.c <<EOCP
19834 #include <stdio.h>
19835 #$i_stdlib I_STDLIB
19836 #ifdef I_STDLIB
19837 #include <stdlib.h>
19838 #endif
19839 #include <sys/types.h>
19840 typedef $uvtype UV;
19841 int main()
19842 {
19843         int i;
19844         union {
19845                 UV l;
19846                 char c[$uvsize];
19847         } u;
19848
19849         if ($uvsize > 4)
19850                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19851         else
19852                 u.l = (UV)0x04030201;
19853         for (i = 0; i < $uvsize; i++)
19854                 printf("%c", u.c[i]+'0');
19855         printf("\n");
19856         exit(0);
19857 }
19858 EOCP
19859                 xxx_prompt=y
19860                 set try
19861                 if eval $compile && $run ./try > /dev/null; then
19862                         dflt=`$run ./try`
19863                         case "$dflt" in
19864                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19865                                 echo "(The test program ran ok.)"
19866                                 echo "byteorder=$dflt"
19867                                 xxx_prompt=n
19868                         ;;
19869                         ????|????????) echo "(The test program ran ok.)" ;;
19870                         *) echo "(The test program didn't run right for some reason.)" ;;
19871                         esac
19872                 else
19873                         dflt='4321'
19874                         cat <<'EOM'
19875 (I can't seem to compile the test program.  Guessing big-endian...)
19876 EOM
19877                 fi
19878                 case "$xxx_prompt" in
19879                 y)
19880                         rp="What is the order of bytes in $uvtype?"
19881                         . ./myread
19882                         byteorder="$ans"
19883                         ;;
19884                 *)      byteorder=$dflt
19885                         ;;
19886                 esac
19887                 ;;
19888         esac
19889         $rm_try
19890         ;;
19891 esac
19892
19893 : Checking 32bit alignedness
19894 $cat <<EOM
19895
19896 Checking to see whether you can access character data unalignedly...
19897 EOM
19898 case "$d_u32align" in
19899 '')   $cat >try.c <<EOCP
19900 #include <stdio.h>
19901 #$i_stdlib I_STDLIB
19902 #ifdef I_STDLIB
19903 #include <stdlib.h>
19904 #endif
19905 #define U32 $u32type
19906 #define BYTEORDER 0x$byteorder
19907 #define U8 $u8type
19908 #include <signal.h>
19909 #ifdef SIGBUS
19910 $signal_t bletch(int s) { exit(4); }
19911 #endif
19912 int main() {
19913 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19914     volatile U8 buf[8];
19915     volatile U32 *up;
19916     int i;
19917
19918     if (sizeof(U32) != 4) {
19919         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19920         exit(1);
19921     }
19922
19923     fflush(stdout);
19924
19925 #ifdef SIGBUS
19926     signal(SIGBUS, bletch);
19927 #endif
19928
19929     buf[0] = 0;
19930     buf[1] = 0;
19931     buf[2] = 0;
19932     buf[3] = 1;
19933     buf[4] = 0;
19934     buf[5] = 0;
19935     buf[6] = 0;
19936     buf[7] = 1;
19937
19938     for (i = 0; i < 4; i++) {
19939         up = (U32*)(buf + i);
19940         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19941                (*up == 1 << (8*(3-i)))  /* little-endian */
19942               )
19943            )
19944         {
19945             printf("read failed (%x)\n", *up);
19946             exit(2);
19947         }
19948     }
19949
19950     /* write test */
19951     for (i = 0; i < 4; i++) {
19952         up = (U32*)(buf + i);
19953         *up = 0xBeef;
19954         if (*up != 0xBeef) {
19955             printf("write failed (%x)\n", *up);
19956             exit(3);
19957         }
19958     }
19959
19960     exit(0);
19961 #else
19962     printf("1\n");
19963     exit(1);
19964 #endif
19965     return 0;
19966 }
19967 EOCP
19968 set try
19969 if eval $compile_ok; then
19970         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19971         $run ./try 2>&1 >/dev/null
19972         case "$?" in
19973         0)      cat >&4 <<EOM
19974 You can access character data pretty unalignedly.
19975 EOM
19976                 d_u32align="$undef"
19977                 ;;
19978         *)      cat >&4 <<EOM
19979 It seems that you must access character data in an aligned manner.
19980 EOM
19981                 d_u32align="$define"
19982                 ;;
19983         esac
19984 else
19985         rp='Can you access character data at unaligned addresses?'
19986         dflt='n'
19987         . ./myread
19988         case "$ans" in
19989         [yY]*)  d_u32align="$undef"  ;;
19990         *)      d_u32align="$define" ;;
19991         esac
19992 fi
19993 $rm_try
19994 ;;
19995 esac
19996
19997 : see if ualarm exists
19998 set ualarm d_ualarm
19999 eval $inlibc
20000
20001 : see if umask exists
20002 set umask d_umask
20003 eval $inlibc
20004
20005 : see if unordered exists
20006 set unordered d_unordered
20007 eval $inlibc
20008
20009 : see if unsetenv exists
20010 set unsetenv d_unsetenv
20011 eval $inlibc
20012
20013 : see if usleep exists
20014 set usleep d_usleep
20015 eval $inlibc
20016
20017 : see if prototype for usleep is available
20018 echo " "
20019 set d_usleepproto usleep $i_unistd unistd.h
20020 eval $hasproto
20021
20022 : see if ustat exists
20023 set ustat d_ustat
20024 eval $inlibc
20025
20026 : see if closedir exists
20027 set closedir d_closedir
20028 eval $inlibc
20029
20030 case "$d_closedir" in
20031 "$define")
20032         echo " "
20033         echo "Checking whether closedir() returns a status..." >&4
20034         cat > try.c <<EOM
20035 #$i_dirent I_DIRENT             /**/
20036 #$i_sysdir I_SYS_DIR            /**/
20037 #$i_sysndir I_SYS_NDIR          /**/
20038 #$i_systypes I_SYS_TYPES        /**/
20039
20040 #if defined(I_SYS_TYPES)
20041 #include <sys/types.h>
20042 #endif
20043 #if defined(I_DIRENT)
20044 #include <dirent.h>
20045 #else
20046 #ifdef I_SYS_NDIR
20047 #include <sys/ndir.h>
20048 #else
20049 #ifdef I_SYS_DIR
20050 #ifdef hp9000s500
20051 #include <ndir.h>       /* may be wrong in the future */
20052 #else
20053 #include <sys/dir.h>
20054 #endif
20055 #endif
20056 #endif
20057 #endif
20058 int main() { return closedir(opendir(".")); }
20059 EOM
20060         set try
20061         if eval $compile_ok; then
20062                 if $run ./try > /dev/null 2>&1 ; then
20063                         echo "Yes, it does."
20064                         val="$undef"
20065                 else
20066                         echo "No, it doesn't."
20067                         val="$define"
20068                 fi
20069         else
20070                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20071                 val="$define"
20072         fi
20073         ;;
20074 *)
20075         val="$undef";
20076         ;;
20077 esac
20078 set d_void_closedir
20079 eval $setvar
20080 $rm_try
20081
20082 : see if there is a wait4
20083 set wait4 d_wait4
20084 eval $inlibc
20085
20086 : see if waitpid exists
20087 set waitpid d_waitpid
20088 eval $inlibc
20089
20090 : look for wcscmp
20091 echo " "
20092 $cat >try.c <<'EOCP'
20093 #include <stdio.h>
20094 #include <wchar.h>
20095 int main ()
20096 {
20097     wchar_t *s = L" ";
20098     return (wcscmp (s, s) ? 1 : 0);
20099     }
20100 EOCP
20101 set try
20102 val="$undef"
20103 if eval $compile; then
20104     `$run ./try`
20105     case "$?" in
20106         0)  echo "A working wcscmp() found." >&4
20107             val="$define" ;;
20108         *)  echo "wcscmp() found, but it doesn't work" >&4
20109             ;;
20110         esac
20111 else
20112     echo "wcscmp() NOT found." >&4
20113     fi
20114 set d_wcscmp
20115 eval $setvar
20116 $rm_try
20117
20118 : see if wcstombs exists
20119 set wcstombs d_wcstombs
20120 eval $inlibc
20121
20122 : look for wcsxfrm
20123 echo " "
20124 $cat >try.c <<'EOCP'
20125 #include <errno.h>
20126 #include <wchar.h>
20127 int main ()
20128 {
20129     wchar_t dst[4], *src = L" ";
20130     errno = 0;
20131     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20132     }
20133 EOCP
20134 set try
20135 val="$undef"
20136 if eval $compile; then
20137     `$run ./try`
20138     case "$?" in
20139         0)  echo "A working wcsxfrm() found." >&4
20140             val="$define" ;;
20141         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20142             ;;
20143         esac
20144 else
20145     echo "wcsxfrm() NOT found." >&4
20146     fi
20147 set d_wcsxfrm
20148 eval $setvar
20149 $rm_try
20150
20151 : see if wctomb exists
20152 set wctomb d_wctomb
20153 eval $inlibc
20154
20155 : see if writev exists
20156 set writev d_writev
20157 eval $inlibc
20158
20159 : check for alignment requirements
20160 echo " "
20161 case "$alignbytes" in
20162     '') echo "Checking alignment constraints..." >&4
20163         $cat >try.c <<EOCP
20164 #include <stdio.h>
20165 struct foobar {
20166     char foo;
20167     $nvtype bar;
20168 } try_algn;
20169 int main()
20170 {
20171     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20172     return(0);
20173 }
20174 EOCP
20175         set try
20176         if eval $compile_ok; then
20177             dflt=`$run ./try`
20178         else
20179             dflt='8'
20180             echo "(I can't seem to compile the test program...)"
20181         fi
20182         case "$multiarch" in
20183             *$define*)
20184                 : The usual safe value is 8, but Darwin with -Duselongdouble
20185                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20186                 : Configure to pick a larger value if needed.
20187                 if $test "$dflt" -lt 8; then
20188                     dflt='8'
20189                     echo "Setting alignment to 8 for multiarch support.">&4
20190                 fi
20191                 ;;
20192         esac
20193         ;;
20194     *) dflt="$alignbytes"
20195         ;;
20196 esac
20197 rp="Doubles must be aligned on a how-many-byte boundary?"
20198 . ./myread
20199 alignbytes="$ans"
20200 $rm_try
20201
20202 : set the base revision
20203 baserev=5.0
20204
20205 : length of character in bytes. Is always 1, otherwise it is not C
20206 : This used to be a test using sizeof
20207 charsize=1
20208
20209 : Check for the number of bits in a character
20210 case "$charbits" in
20211 '')     echo "Checking how long a character is (in bits)..." >&4
20212         $cat >try.c <<EOCP
20213 #include <stdio.h>
20214 int main ()
20215 {
20216     int n;
20217     unsigned char c;
20218     for (c = 1, n = 0; c; c <<= 1, n++) ;
20219     printf ("%d\n", n);
20220     return (0);
20221     }
20222 EOCP
20223         set try
20224         if eval $compile_ok; then
20225                 dflt=`$run ./try`
20226         else
20227                 dflt='8'
20228                 echo "(I can't seem to compile the test program.  Guessing...)"
20229         fi
20230         ;;
20231 *)
20232         dflt="$charbits"
20233         ;;
20234 esac
20235 rp="What is the length of a character (in bits)?"
20236 . ./myread
20237 charbits="$ans"
20238 $rm_try
20239 case "$charbits" in
20240 8)      ;;
20241 *)      cat >&4 << EOM
20242 Your system has an unsigned character size of $charbits bits, which
20243 is rather unusual (normally it is 8 bits).  Perl likely will not work
20244 correctly on your system, with subtle bugs in various places.
20245 EOM
20246         rp='Do you really want to continue?'
20247         dflt='n'
20248         . ./myread
20249         case "$ans" in
20250                 [yY])   echo >&4 "Okay, continuing."    ;;
20251                 *)      exit 1                          ;;
20252         esac
20253 esac
20254
20255 : how do we concatenate cpp tokens here?
20256 echo " "
20257 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20258 $cat >cpp_stuff.c <<'EOCP'
20259 #define RCAT(a,b)a/**/b
20260 #define ACAT(a,b)a ## b
20261 RCAT(Rei,ser)
20262 ACAT(Cir,cus)
20263 EOCP
20264 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20265 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20266         echo "Oh!  Smells like ANSI's been here." >&4
20267         echo "We can catify or stringify, separately or together!"
20268         cpp_stuff=42
20269 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20270         echo "Ah, yes!  The good old days!" >&4
20271         echo "However, in the good old days we don't know how to stringify and"
20272         echo "catify at the same time."
20273         cpp_stuff=1
20274 else
20275         $cat >&4 <<EOM
20276 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20277 You're going to have to edit the values of CAT[2-5] in config.h...
20278 EOM
20279         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20280 fi
20281 $rm -f cpp_stuff.*
20282
20283 : see if this is a db.h system
20284 set db.h i_db
20285 eval $inhdr
20286
20287 case "$i_db" in
20288 $define)
20289         : Check db version.
20290         echo " "
20291         echo "Checking Berkeley DB version ..." >&4
20292         $cat >try.c <<EOCP
20293 #$d_const HASCONST
20294 #ifndef HASCONST
20295 #define const
20296 #endif
20297 #include <sys/types.h>
20298 #include <stdio.h>
20299 #$i_stdlib I_STDLIB
20300 #ifdef I_STDLIB
20301 #include <stdlib.h>
20302 #endif
20303 #include <db.h>
20304 int main(int argc, char *argv[])
20305 {
20306 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20307     int Major, Minor, Patch ;
20308     unsigned long Version ;
20309     (void)db_version(&Major, &Minor, &Patch) ;
20310     if (argc == 2) {
20311         printf("%d %d %d %d %d %d\n",
20312                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20313                Major, Minor, Patch);
20314         exit(0);
20315     }
20316     printf("You have Berkeley DB Version 2 or greater.\n");
20317
20318     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20319                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20320     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20321                 Major, Minor, Patch) ;
20322
20323     /* check that db.h & libdb are compatible */
20324     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20325         printf("db.h and libdb are incompatible.\n") ;
20326         exit(3);
20327     }
20328
20329     printf("db.h and libdb are compatible.\n") ;
20330
20331     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20332                 + DB_VERSION_PATCH ;
20333
20334     /* needs to be >= 2.3.4 */
20335     if (Version < 2003004) {
20336     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20337         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20338         exit(2);
20339     }
20340
20341     exit(0);
20342 #else
20343 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20344     if (argc == 2) {
20345         printf("1 0 0\n");
20346         exit(0);
20347     }
20348     printf("You have Berkeley DB Version 1.\n");
20349     exit(0);    /* DB version < 2: the coast is clear. */
20350 #else
20351     exit(1);    /* <db.h> not Berkeley DB? */
20352 #endif
20353 #endif
20354 }
20355 EOCP
20356         set try
20357         if eval $compile_ok && $run ./try; then
20358                 echo 'Looks OK.' >&4
20359                 set `$run ./try 1`
20360                 db_version_major=$1
20361                 db_version_minor=$2
20362                 db_version_patch=$3
20363         else
20364                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20365                 i_db=$undef
20366                 case " $libs " in
20367                 *"-ldb "*)
20368                         : Remove db from list of libraries to use
20369                         echo "Removing unusable -ldb from library list" >&4
20370                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20371                         shift
20372                         libs="$*"
20373                         echo "libs = $libs" >&4
20374                         ;;
20375                 esac
20376         fi
20377         $rm_try
20378         ;;
20379 esac
20380
20381 case "$i_db" in
20382 define)
20383         : Check the return type needed for hash
20384         echo " "
20385         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20386         $cat >try.c <<EOCP
20387 #$d_const HASCONST
20388 #ifndef HASCONST
20389 #define const
20390 #endif
20391 #include <sys/types.h>
20392 #include <db.h>
20393
20394 #ifndef DB_VERSION_MAJOR
20395 u_int32_t hash_cb (const void* ptr, size_t size)
20396 {
20397 }
20398 HASHINFO info;
20399 int main()
20400 {
20401         info.hash = hash_cb;
20402 }
20403 #endif
20404 EOCP
20405         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20406                 if $contains warning try.out >>/dev/null 2>&1 ; then
20407                         db_hashtype='int'
20408                 else
20409                         db_hashtype='u_int32_t'
20410                 fi
20411         else
20412                 : XXX Maybe we should just give up here.
20413                 db_hashtype=u_int32_t
20414                 $cat try.out >&4
20415                 echo "Help:  I can't seem to compile the db test program." >&4
20416                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20417         fi
20418         $rm_try
20419         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20420         ;;
20421 *)      db_hashtype=u_int32_t
20422         ;;
20423 esac
20424 case "$i_db" in
20425 define)
20426         : Check the return type needed for prefix
20427         echo " "
20428         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20429         cat >try.c <<EOCP
20430 #$d_const HASCONST
20431 #ifndef HASCONST
20432 #define const
20433 #endif
20434 #include <sys/types.h>
20435 #include <db.h>
20436
20437 #ifndef DB_VERSION_MAJOR
20438 size_t prefix_cb (const DBT *key1, const DBT *key2)
20439 {
20440 }
20441 BTREEINFO info;
20442 int main()
20443 {
20444         info.prefix = prefix_cb;
20445 }
20446 #endif
20447 EOCP
20448         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20449                 if $contains warning try.out >>/dev/null 2>&1 ; then
20450                         db_prefixtype='int'
20451                 else
20452                         db_prefixtype='size_t'
20453                 fi
20454         else
20455                 db_prefixtype='size_t'
20456                 : XXX Maybe we should just give up here.
20457                 $cat try.out >&4
20458                 echo "Help:  I can't seem to compile the db test program." >&4
20459                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20460         fi
20461         $rm_try
20462         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20463         ;;
20464 *)      db_prefixtype='size_t'
20465         ;;
20466 esac
20467
20468 : Check what kind of inf/nan your system has
20469 $echo "Checking the kind of infinities and nans you have..." >&4
20470 $cat >try.c <<EOP
20471 #define DOUBLESIZE $doublesize
20472 #$d_longdbl HAS_LONG_DOUBLE
20473 #ifdef HAS_LONG_DOUBLE
20474 #define LONGDBLSIZE $longdblsize
20475 #define LONGDBLKIND $longdblkind
20476 #endif
20477 #$i_math I_MATH
20478 #ifdef I_MATH
20479 #include <math.h>
20480 #endif
20481 #include <stdio.h>
20482 /* Note that whether the sign bit is on or off
20483  * for NaN depends on the CPU/FPU, and possibly
20484  * can be affected by the build toolchain.
20485  *
20486  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20487  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20488  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20489  * (respectively) as opposed to the more usual
20490  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20491  */
20492 static void bytes(unsigned char *p, unsigned int n) {
20493   int i;
20494   for (i = 0; i < n; i++) {
20495     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20496   }
20497 }
20498 int main(int argc, char *argv[]) {
20499    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20500     * because some compilers are 'smart' and not only warn but refuse to
20501     * compile such 'illegal' values. */
20502    double dinf = exp(1e9);
20503    double dnan = sqrt(-1.0);
20504 #ifdef HAS_LONG_DOUBLE
20505    long double ldinf = (long double)exp(1e9);
20506    long double ldnan = (long double)sqrt(-1.0);
20507 #endif
20508   if (argc == 2) {
20509     switch (argv[1][0]) {
20510     case '1': bytes(&dinf, sizeof(dinf)); break;
20511     case '2': bytes(&dnan, sizeof(dnan)); break;
20512 #ifdef HAS_LONG_DOUBLE
20513 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20514 /* the 80-bit long doubles might have garbage in their excess bytes */
20515     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20516 # endif
20517     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20518     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20519 #endif
20520     }
20521   }
20522   return 0;
20523 }
20524 EOP
20525 set try
20526 if eval $compile; then
20527     doubleinfbytes=`$run ./try 1`
20528     doublenanbytes=`$run ./try 2`
20529     case "$d_longdbl" in
20530     $define)
20531       longdblinfbytes=`$run ./try 3`
20532       longdblnanbytes=`$run ./try 4`
20533       ;;
20534     esac
20535 else
20536     # Defaults in case the above test program failed.
20537     case "$doublekind" in
20538     1) # IEEE 754 32-bit LE
20539        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20540        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20541        ;;
20542     2) # IEEE 754 32-bit BE
20543        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20544        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20545        ;;
20546     3) # IEEE 754 64-bit LE
20547        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20548        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20549        ;;
20550     4) # IEEE 754 64-bit BE
20551        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20552        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20553        ;;
20554     5) # IEEE 754 128-bit LE
20555        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20556        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20557        ;;
20558     6) # IEEE 754 128-bit BE
20559        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20560        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20561        ;;
20562     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20563        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20564        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20565        ;;
20566     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20567        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20568        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20569        ;;
20570     *) # No idea.
20571        doubleinfbytes=$undef
20572        doublenanbytes=$undef
20573        ;;
20574     esac
20575     case "$longdblkind" in
20576     1) # IEEE 754 128-bit LE
20577        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20578        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20579        ;;
20580     2) # IEEE 754 128-bit BE
20581        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20582        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20583        ;;
20584     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20585        case "$longdblsize" in
20586        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20587            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20588            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20589            ;;
20590        16) # x86_64
20591            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20592            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20593            ;;
20594        *)  # No idea.
20595            longdblinfbytes=$undef
20596            longdblnanbytes=$undef
20597        ;;
20598        esac
20599        ;;
20600     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20601        case "$longdblsize" in
20602        12) # 32-bit system
20603            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20604            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20605            ;;
20606        16) # 64-bit system
20607            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20608            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20609            ;;
20610        *)  # No idea.
20611            longdblinfbytes=$undef
20612            longdblnanbytes=$undef
20613        ;;
20614        esac
20615        ;;
20616     5) # 128-bit LE-LE "double double"
20617        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20618        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20619        ;;
20620     6) # 128-bit BE-BE "double double"
20621        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20622        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20623        ;;
20624     7) # 128-bit LE-BE "double double"
20625        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20626        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20627        ;;
20628     8) # 128-bit BE-LE "double double"
20629        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20630        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20631        ;;
20632     *) # No idea.
20633        longdblinfbytes=$undef
20634        longdblnanbytes=$undef
20635        ;;
20636     esac
20637 fi
20638 $rm_try
20639
20640 : Check the length of the double mantissa
20641 $echo "Checking how many mantissa bits your doubles have..." >&4
20642 $cat >try.c <<EOP
20643 #$i_float I_FLOAT
20644 #$i_sunmath I_SUNMATH
20645 #ifdef I_FLOAT
20646 # include <float.h>
20647 #endif
20648 #ifdef I_SUNMATH
20649 # include <sunmath.h>
20650 #endif
20651 #ifdef DBL_MANT_DIG
20652 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20653 #endif
20654 #include <stdio.h>
20655 int main(int argc, char *argv[]) {
20656 #ifdef BITS
20657   printf("%d\n", BITS);
20658 #endif
20659   return 0;
20660 }
20661 EOP
20662 set try
20663 if eval $compile; then
20664     doublemantbits=`$run ./try`
20665 else
20666     doublemantbits="$undef"
20667 fi
20668 $rm_try
20669
20670 : Check the length of the longdouble mantissa
20671 $echo "Checking how many mantissa bits your long doubles have..." >&4
20672 $cat >try.c <<EOP
20673 #$i_float I_FLOAT
20674 #$i_sunmath I_SUNMATH
20675 #ifdef I_FLOAT
20676 # include <float.h>
20677 #endif
20678 #ifdef I_SUNMATH
20679 # include <sunmath.h>
20680 #endif
20681 #$d_longdbl HAS_LONG_DOUBLE
20682 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20683 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20684 /* This format has no implicit bit.  Beware, however, that for
20685  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20686  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20687  * and the top bit must have been one since 387, zero is plain invalid.
20688  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20689 #  define BITS LDBL_MANT_DIG
20690 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20691 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20692  * reason e.g. Irix thinks 107.  But in any case, we want only
20693  * the number of real bits, the implicit bits are of no interest.  */
20694 #  define BITS 2 * (DBL_MANT_DIG - 1)
20695 # else
20696 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20697 # endif
20698 #endif
20699 #include <stdio.h>
20700 int main(int argc, char *argv[]) {
20701 #ifdef BITS
20702   printf("%d\n", BITS);
20703 #endif
20704   return 0;
20705 }
20706 EOP
20707 set try
20708 if eval $compile; then
20709     longdblmantbits=`$run ./try`
20710 else
20711     longdblmantbits="$undef"
20712 fi
20713 $rm_try
20714
20715 : Check the length of the NV mantissa
20716 $echo "Checking how many mantissa bits your NVs have..." >&4
20717 if test "X$usequadmath" = "X$define"; then
20718   nvmantbits=112 # 128-1-15
20719 else
20720   if test "X$nvsize" = "X$doublesize"; then
20721     nvmantbits="$doublemantbits"
20722   else
20723      if test "X$nvsize" = "X$longdblsize"; then
20724        nvmantbits="$longdblmantbits"
20725      else
20726        nvmantbits="$undef"
20727      fi
20728   fi
20729 fi
20730
20731 : How can we generate normalized random numbers ?
20732 echo " "
20733 echo "Using our internal random number implementation..." >&4
20734
20735 case "$ccflags" in
20736 *-Dmy_rand=*|*-Dmy_srand=*)
20737         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20738         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20739         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20740         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20741         ;;
20742 esac
20743
20744 randfunc=Perl_drand48
20745 drand01="Perl_drand48()"
20746 seedfunc="Perl_drand48_init"
20747 randbits=48
20748 randseedtype=U32
20749
20750 : Probe whether dtrace builds an object, as newer Illumos requires an input
20751 : object file that uses at least one of the probes defined in the .d file
20752 case "$usedtrace" in
20753 $define)
20754     case "$dtraceobject" in
20755     $define|true|[yY]*)
20756         dtraceobject=$define
20757         ;;
20758     ' '|'')
20759         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20760         $cat >try.c <<EOM
20761 #include "perldtrace.h"
20762 int main(void) {
20763     PERL_LOADED_FILE("dummy");
20764     return 0;
20765 }
20766 EOM
20767         dtraceobject=$undef
20768         if $cc -c -o try.o $optimize $ccflags try.c \
20769                     && $dtrace -G -s ../perldtrace.d try.o >/dev/null 2>&1; then
20770                 dtraceobject=$define
20771             echo "Your dtrace builds an object file"
20772         fi
20773         $rm -f try.c try.o perldtrace.o
20774         ;;
20775     *) dtraceobject=$undef ;;
20776     esac
20777 esac
20778
20779 : Determine if this is an EBCDIC system
20780 echo " "
20781 echo "Determining whether or not we are on an EBCDIC system..." >&4
20782 $cat >try.c <<'EOM'
20783 int main()
20784 {
20785   if ('M'==0xd4) return 0;
20786   return 1;
20787 }
20788 EOM
20789
20790 val=$undef
20791 set try
20792 if eval $compile_ok; then
20793         if $run ./try; then
20794                 echo "You seem to speak EBCDIC." >&4
20795                 val="$define"
20796         else
20797                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20798         fi
20799 else
20800         echo "I'm unable to compile the test program." >&4
20801         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20802 fi
20803 $rm_try
20804 set ebcdic
20805 eval $setvar
20806
20807 : Check how to flush
20808 echo " "
20809 $cat >&4 <<EOM
20810 Checking how to flush all pending stdio output...
20811 EOM
20812 # I only know how to find the first 32 possibly open files on SunOS.
20813 # See also hints/sunos_4_1.sh and util.c  --AD
20814 case "$osname" in
20815 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20816 esac
20817 $cat >>try.c <<EOCP
20818 #include <stdio.h>
20819 #$i_stdlib I_STDLIB
20820 #ifdef I_STDLIB
20821 #include <stdlib.h>
20822 #endif
20823 #$i_unistd I_UNISTD
20824 #ifdef I_UNISTD
20825 # include <unistd.h>
20826 #endif
20827 #$d_sysconf HAS_SYSCONF
20828 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20829 #ifdef HAS_STDIO_STREAM_ARRAY
20830 # define STDIO_STREAM_ARRAY $stdio_stream_array
20831 #endif
20832 int main() {
20833   FILE* p;
20834   unlink("try.out");
20835   p = fopen("try.out", "w");
20836 #ifdef TRY_FPUTC
20837   fputc('x', p);
20838 #else
20839 # ifdef TRY_FPRINTF
20840   fprintf(p, "x");
20841 # endif
20842 #endif
20843 #ifdef TRY_FFLUSH_NULL
20844   fflush(NULL);
20845 #endif
20846 #ifdef TRY_FFLUSH_ALL
20847   {
20848     long open_max = -1;
20849 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20850     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20851 # else
20852 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20853     open_max = sysconf(_SC_OPEN_MAX);
20854 #  else
20855 #   ifdef FOPEN_MAX
20856     open_max = FOPEN_MAX;
20857 #   else
20858 #    ifdef OPEN_MAX
20859     open_max = OPEN_MAX;
20860 #    else
20861 #     ifdef _NFILE
20862     open_max = _NFILE;
20863 #     endif
20864 #    endif
20865 #   endif
20866 #  endif
20867 # endif
20868 # ifdef HAS_STDIO_STREAM_ARRAY
20869     if (open_max > 0) {
20870       long i;
20871       for (i = 0; i < open_max; i++)
20872             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20873                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20874                 STDIO_STREAM_ARRAY[i]._flag)
20875                 fflush(&STDIO_STREAM_ARRAY[i]);
20876     }
20877   }
20878 # endif
20879 #endif
20880   _exit(42);
20881 }
20882 EOCP
20883 : first we have to find out how _not_ to flush
20884 $to try.c
20885 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20886     output=''
20887     set try -DTRY_FPUTC
20888     if eval $compile; then
20889             $run ./try 2>/dev/null
20890             code="$?"
20891             $from try.out
20892             if $test ! -s try.out -a "X$code" = X42; then
20893                 output=-DTRY_FPUTC
20894             fi
20895     fi
20896     case "$output" in
20897     '')
20898             set try -DTRY_FPRINTF
20899             if eval $compile; then
20900                     $run ./try 2>/dev/null
20901                     code="$?"
20902                     $from try.out
20903                     if $test ! -s try.out -a "X$code" = X42; then
20904                         output=-DTRY_FPRINTF
20905                     fi
20906             fi
20907         ;;
20908     esac
20909 fi
20910 : check for fflush NULL behavior
20911 case "$fflushNULL" in
20912 '')     set try -DTRY_FFLUSH_NULL $output
20913         if eval $compile; then
20914                 $run ./try 2>/dev/null
20915                 code="$?"
20916                 $from try.out
20917                 if $test -s try.out -a "X$code" = X42; then
20918                         fflushNULL="`$cat try.out`"
20919                 else
20920                         if $test "X$code" != X42; then
20921                                 $cat >&4 <<EOM
20922 (If this test failed, don't worry, we'll try another method shortly.)
20923 EOM
20924                         fi
20925                 fi
20926         fi
20927         $rm -f core try.core core.try.*
20928         case "$fflushNULL" in
20929         x)      $cat >&4 <<EOM
20930 Your fflush(NULL) works okay for output streams.
20931 Let's see if it clobbers input pipes...
20932 EOM
20933 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20934 # bug that improperly flushes the input end of pipes.  So we avoid the
20935 # autoflush on fork/system/exec support for now. :-(
20936 $cat >tryp.c <<EOCP
20937 #include <stdio.h>
20938 int
20939 main(int argc, char **argv)
20940 {
20941     char buf[1024];
20942     int i;
20943     char *bp = buf;
20944     while (1) {
20945         while ((i = getc(stdin)) != -1
20946                && (*bp++ = i) != '\n'
20947                && bp < &buf[1024])
20948         /* DO NOTHING */ ;
20949         *bp = '\0';
20950         fprintf(stdout, "%s", buf);
20951         fflush(NULL);
20952         if (i == -1)
20953             return 0;
20954         bp = buf;
20955     }
20956 }
20957 EOCP
20958                 fflushNULL="$define"
20959                 set tryp
20960                 if eval $compile; then
20961                     $rm -f tryp.out
20962                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20963                     if $test "X$targethost" != X; then
20964                         $to tryp.c
20965                         $to tryp
20966                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20967                     else
20968                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20969                     fi
20970                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20971                        $cat >&4 <<EOM
20972 fflush(NULL) seems to behave okay with input streams.
20973 EOM
20974                         fflushNULL="$define"
20975                     else
20976                         $cat >&4 <<EOM
20977 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20978 EOM
20979                         fflushNULL="$undef"
20980                     fi
20981                 fi
20982                 $rm -f core tryp.c tryp.core core.tryp.*
20983                 ;;
20984         '')     $cat >&4 <<EOM
20985 Your fflush(NULL) isn't working (contrary to ANSI C).
20986 EOM
20987                 fflushNULL="$undef"
20988                 ;;
20989         *)      $cat >&4 <<EOM
20990 Cannot figure out whether your fflush(NULL) works or not.
20991 I'm assuming it doesn't (contrary to ANSI C).
20992 EOM
20993                 fflushNULL="$undef"
20994                 ;;
20995         esac
20996         ;;
20997 $define|true|[yY]*)
20998         fflushNULL="$define"
20999         ;;
21000 *)
21001         fflushNULL="$undef"
21002         ;;
21003 esac
21004 : check explicit looping only if NULL did not work, and if the pipe
21005 : bug does not show up on an explicit flush too
21006 case "$fflushNULL" in
21007 "$undef")
21008         $cat >tryp.c <<EOCP
21009 #include <stdio.h>
21010 int
21011 main(int argc, char **argv)
21012 {
21013     char buf[1024];
21014     int i;
21015     char *bp = buf;
21016     while (1) {
21017         while ((i = getc(stdin)) != -1
21018                && (*bp++ = i) != '\n'
21019                && bp < &buf[1024])
21020         /* DO NOTHING */ ;
21021         *bp = '\0';
21022         fprintf(stdout, "%s", buf);
21023         fflush(stdin);
21024         if (i == -1)
21025             return 0;
21026         bp = buf;
21027     }
21028 }
21029 EOCP
21030         set tryp
21031         if eval $compile; then
21032             $rm -f tryp.out
21033             if $test "X$targethost" != X; then
21034                 $to tryp.c
21035                 $to tryp
21036                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21037             else
21038                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21039             fi
21040             if cmp tryp.c tryp.out >/dev/null 2>&1; then
21041                $cat >&4 <<EOM
21042 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21043 EOM
21044                 : now check for fflushall behaviour
21045                 case "$fflushall" in
21046                 '')     set try -DTRY_FFLUSH_ALL $output
21047                         if eval $compile; then
21048                                 $cat >&4 <<EOM
21049 (Now testing the other method--but note that this also may fail.)
21050 EOM
21051                                 $run ./try 2>/dev/null
21052                                 code=$?
21053                                 $from try.out
21054                                 if $test -s try.out -a "X$code" = X42; then
21055                                         fflushall="`$cat try.out`"
21056                                 fi
21057                         fi
21058                         $rm_try
21059                         case "$fflushall" in
21060                         x)      $cat >&4 <<EOM
21061 Whew. Flushing explicitly all the stdio streams works.
21062 EOM
21063                                 fflushall="$define"
21064                                 ;;
21065                         '')     $cat >&4 <<EOM
21066 Sigh. Flushing explicitly all the stdio streams doesn't work.
21067 EOM
21068                                 fflushall="$undef"
21069                                 ;;
21070                         *)      $cat >&4 <<EOM
21071 Cannot figure out whether flushing stdio streams explicitly works or not.
21072 I'm assuming it doesn't.
21073 EOM
21074                                 fflushall="$undef"
21075                                 ;;
21076                         esac
21077                         ;;
21078                 "$define"|true|[yY]*)
21079                         fflushall="$define"
21080                         ;;
21081                 *)
21082                         fflushall="$undef"
21083                         ;;
21084                 esac
21085             else
21086                 $cat >&4 <<EOM
21087 All is futile.  Even fflush(stdin) clobbers input pipes!
21088 EOM
21089                 fflushall="$undef"
21090             fi
21091         else
21092             fflushall="$undef"
21093         fi
21094         $rm -f core tryp.c tryp.core core.tryp.*
21095         ;;
21096 *)      fflushall="$undef"
21097         ;;
21098 esac
21099
21100 case "$fflushNULL$fflushall" in
21101 undefundef)
21102         $cat <<EOM
21103 OK, I give up.  I cannot figure out how to flush pending stdio output.
21104 We won't be flushing handles at all before fork/exec/popen.
21105 EOM
21106         ;;
21107 esac
21108 $rm_try tryp
21109
21110 : Store the full pathname to the ar program for use in the C program
21111 : Respect a hint or command line value for full_ar.
21112 case "$full_ar" in
21113 '') full_ar=$ar ;;
21114 esac
21115
21116 : Store the full pathname to the sed program for use in the C program
21117 full_sed=$sed
21118
21119 : see what type gids are declared as in the kernel
21120 echo " "
21121 echo "Looking for the type for group ids returned by getgid()."
21122 set gid_t gidtype xxx stdio.h sys/types.h
21123 eval $typedef
21124 case "$gidtype" in
21125 xxx)
21126         xxx=`./findhdr sys/user.h`
21127         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21128         case $1 in
21129         unsigned) dflt="$1 $2" ;;
21130         *) dflt="$1" ;;
21131         esac
21132         ;;
21133 *) dflt="$gidtype";;
21134 esac
21135 case "$gidtype" in
21136 gid_t) echo "gid_t found." ;;
21137 *)      rp="What is the type for group ids returned by getgid()?"
21138         . ./myread
21139         gidtype="$ans"
21140         ;;
21141 esac
21142
21143 : Check the size of GID
21144 echo " "
21145 case "$gidtype" in
21146 *_t) zzz="$gidtype"     ;;
21147 *)   zzz="gid"          ;;
21148 esac
21149 echo "Checking the size of $zzz..." >&4
21150 cat > try.c <<EOCP
21151 #include <sys/types.h>
21152 #include <stdio.h>
21153 #$i_stdlib I_STDLIB
21154 #ifdef I_STDLIB
21155 #include <stdlib.h>
21156 #endif
21157 int main() {
21158     printf("%d\n", (int)sizeof($gidtype));
21159     exit(0);
21160 }
21161 EOCP
21162 set try
21163 if eval $compile_ok; then
21164         yyy=`$run ./try`
21165         case "$yyy" in
21166         '')     gidsize=4
21167                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21168                 ;;
21169         *)      gidsize=$yyy
21170                 echo "Your $zzz is $gidsize bytes long."
21171                 ;;
21172         esac
21173 else
21174         gidsize=4
21175         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21176 fi
21177
21178
21179 : Check if GID is signed
21180 echo " "
21181 case "$gidtype" in
21182 *_t) zzz="$gidtype"     ;;
21183 *)   zzz="gid"          ;;
21184 esac
21185 echo "Checking the sign of $zzz..." >&4
21186 cat > try.c <<EOCP
21187 #include <sys/types.h>
21188 #include <stdio.h>
21189 int main() {
21190         $gidtype foo = -1;
21191         if (foo < 0)
21192                 printf("-1\n");
21193         else
21194                 printf("1\n");
21195 }
21196 EOCP
21197 set try
21198 if eval $compile; then
21199         yyy=`$run ./try`
21200         case "$yyy" in
21201         '')     gidsign=1
21202                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21203                 ;;
21204         *)      gidsign=$yyy
21205                 case "$gidsign" in
21206                  1) echo "Your $zzz is unsigned." ;;
21207                 -1) echo "Your $zzz is signed."   ;;
21208                 esac
21209                 ;;
21210         esac
21211 else
21212         gidsign=1
21213         echo "(I can't compile the test program--guessing unsigned.)" >&4
21214 fi
21215
21216
21217 : Check 64bit sizes
21218 echo " "
21219
21220 if $test X"$quadtype" != X; then
21221
21222 echo "Checking how to print 64-bit integers..." >&4
21223
21224 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21225         $cat >try.c <<'EOCP'
21226 #include <sys/types.h>
21227 #include <stdio.h>
21228 int main() {
21229   int q = 12345678901;
21230   printf("%ld\n", q);
21231 }
21232 EOCP
21233         set try
21234         if eval $compile; then
21235                 yyy=`$run ./try`
21236                 case "$yyy" in
21237                 12345678901)
21238                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21239                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21240                         echo "We will use %d."
21241                         ;;
21242                 esac
21243         fi
21244 fi
21245
21246 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21247         $cat >try.c <<'EOCP'
21248 #include <sys/types.h>
21249 #include <stdio.h>
21250 int main() {
21251   long q = 12345678901;
21252   printf("%ld\n", q);
21253 }
21254 EOCP
21255         set try
21256         if eval $compile; then
21257                 yyy=`$run ./try`
21258                 case "$yyy" in
21259                 12345678901)
21260                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21261                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21262                         echo "We will use %ld."
21263                         ;;
21264                 esac
21265         fi
21266 fi
21267
21268 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21269         $cat >try.c <<'EOCP'
21270 #include <sys/types.h>
21271 #include <inttypes.h>
21272 #include <stdio.h>
21273 int main() {
21274   int64_t q = 12345678901;
21275   printf("%" PRId64 "\n", q);
21276 }
21277 EOCP
21278         set try
21279         if eval $compile; then
21280                 yyy=`$run ./try`
21281                 case "$yyy" in
21282                 12345678901)
21283                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21284                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21285                         echo "We will use the C9X style."
21286                         ;;
21287                 esac
21288         fi
21289 fi
21290
21291 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21292         $cat >try.c <<EOCP
21293 #include <sys/types.h>
21294 #include <stdio.h>
21295 int main() {
21296   $quadtype q = 12345678901;
21297   printf("%Ld\n", q);
21298 }
21299 EOCP
21300         set try
21301         if eval $compile; then
21302                 yyy=`$run ./try`
21303                 case "$yyy" in
21304                 12345678901)
21305                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21306                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21307                         echo "We will use %Ld."
21308                         ;;
21309                 esac
21310         fi
21311 fi
21312
21313 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21314         $cat >try.c <<'EOCP'
21315 #include <sys/types.h>
21316 #include <stdio.h>
21317 int main() {
21318   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21319   printf("%lld\n", q);
21320 }
21321 EOCP
21322         set try
21323         if eval $compile; then
21324                 yyy=`$run ./try`
21325                 case "$yyy" in
21326                 12345678901)
21327                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21328                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21329                         echo "We will use the %lld style."
21330                         ;;
21331                 esac
21332         fi
21333 fi
21334
21335 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21336         $cat >try.c <<EOCP
21337 #include <sys/types.h>
21338 #include <stdio.h>
21339 int main() {
21340   $quadtype q = 12345678901;
21341   printf("%qd\n", q);
21342 }
21343 EOCP
21344         set try
21345         if eval $compile; then
21346                 yyy=`$run ./try`
21347                 case "$yyy" in
21348                 12345678901)
21349                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21350                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21351                         echo "We will use %qd."
21352                         ;;
21353                 esac
21354         fi
21355 fi
21356
21357 if $test X"$sPRId64" = X; then
21358         echo "Cannot figure out how to print 64-bit integers." >&4
21359 fi
21360 $rm_try
21361
21362 fi
21363
21364 case "$sPRId64" in
21365 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21366         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21367         ;;
21368 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21369         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21370         ;;
21371 esac
21372
21373 : Check format strings for internal types
21374 echo " "
21375 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21376
21377 if $test X"$ivsize" = X8; then
21378         ivdformat="$sPRId64"
21379         uvuformat="$sPRIu64"
21380         uvoformat="$sPRIo64"
21381         uvxformat="$sPRIx64"
21382         uvXUformat="$sPRIXU64"
21383 else
21384         if $test X"$ivsize" = X"$longsize"; then
21385                 ivdformat='"ld"'
21386                 uvuformat='"lu"'
21387                 uvoformat='"lo"'
21388                 uvxformat='"lx"'
21389                 uvXUformat='"lX"'
21390         else
21391                 if $test X"$ivsize" = X"$intsize"; then
21392                         ivdformat='"d"'
21393                         uvuformat='"u"'
21394                         uvoformat='"o"'
21395                         uvxformat='"x"'
21396                         uvXUformat='"X"'
21397                 else
21398                         : far out
21399                         if $test X"$ivsize" = X"$shortsize"; then
21400                                 ivdformat='"hd"'
21401                                 uvuformat='"hu"'
21402                                 uvoformat='"ho"'
21403                                 uvxformat='"hx"'
21404                                 uvXUformat='"hX"'
21405                         fi
21406                 fi
21407         fi
21408 fi
21409
21410 if $test X"$usequadmath" = X"$define"; then
21411     nveformat='"Qe"'
21412     nvfformat='"Qf"'
21413     nvgformat='"Qg"'
21414     nvEUformat='"QE"'
21415     nvFUformat='"QF"'
21416     nvGUformat='"QG"'
21417 else
21418     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21419         nveformat="$sPRIeldbl"
21420         nvfformat="$sPRIfldbl"
21421         nvgformat="$sPRIgldbl"
21422         nvEUformat="$sPRIEUldbl"
21423         nvFUformat="$sPRIFUldbl"
21424         nvGUformat="$sPRIGUldbl"
21425     else
21426         nveformat='"e"'
21427         nvfformat='"f"'
21428         nvgformat='"g"'
21429         nvEUformat='"E"'
21430         nvFUformat='"F"'
21431         nvGUformat='"G"'
21432     fi
21433 fi
21434
21435 case "$ivdformat" in
21436 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21437     exit 1
21438     ;;
21439 esac
21440
21441 : Check format string for GID
21442
21443 echo " "
21444 $echo "Checking the format string to be used for gids..." >&4
21445
21446 case "$gidsign" in
21447 -1)     if $test X"$gidsize" = X"$ivsize"; then
21448                 gidformat="$ivdformat"
21449         else
21450                 if $test X"$gidsize" = X"$longsize"; then
21451                         gidformat='"ld"'
21452                 else
21453                         if $test X"$gidsize" = X"$intsize"; then
21454                                 gidformat='"d"'
21455                         else
21456                                 if $test X"$gidsize" = X"$shortsize"; then
21457                                         gidformat='"hd"'
21458                                 fi
21459                         fi
21460                 fi
21461         fi
21462         ;;
21463 *)      if $test X"$gidsize" = X"$uvsize"; then
21464                 gidformat="$uvuformat"
21465         else
21466                 if $test X"$gidsize" = X"$longsize"; then
21467                         gidformat='"lu"'
21468                 else
21469                         if $test X"$gidsize" = X"$intsize"; then
21470                                 gidformat='"u"'
21471                         else
21472                                 if $test X"$gidsize" = X"$shortsize"; then
21473                                         gidformat='"hu"'
21474                                 fi
21475                         fi
21476                 fi
21477         fi
21478         ;;
21479 esac
21480
21481 : see if getgroups exists
21482 set getgroups d_getgrps
21483 eval $inlibc
21484
21485 : see if setgroups exists
21486 set setgroups d_setgrps
21487 eval $inlibc
21488
21489 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21490 echo " "
21491 case "$d_getgrps$d_setgrps" in
21492 *define*)
21493         case "$groupstype" in
21494         '') dflt="$gidtype" ;;
21495         *)  dflt="$groupstype" ;;
21496         esac
21497         $cat <<EOM
21498 What type of pointer is the second argument to getgroups() and setgroups()?
21499 Usually this is the same as group ids, $gidtype, but not always.
21500
21501 EOM
21502         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21503         . ./myread
21504         groupstype="$ans"
21505         ;;
21506 *)  groupstype="$gidtype";;
21507 esac
21508
21509 : check whether make sets MAKE
21510 echo " "
21511 echo "Checking if your $make program sets \$(MAKE)..." >&4
21512 case "$make_set_make" in
21513 '')
21514         $sed 's/^X //' > testmake.mak << 'EOF'
21515 Xall:
21516 X       @echo 'maketemp="$(MAKE)"'
21517 EOF
21518         case "`$make -f testmake.mak 2>/dev/null`" in
21519         *maketemp=*) make_set_make='#' ;;
21520         *)      make_set_make="MAKE=$make" ;;
21521         esac
21522         $rm -f testmake.mak
21523         ;;
21524 esac
21525 case "$make_set_make" in
21526 '#') echo "Yup, it does.";;
21527 *) echo "Nope, it doesn't.";;
21528 esac
21529
21530 : see what type is used for mode_t
21531 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21532 set mode_t modetype int stdio.h sys/types.h
21533 eval $typedef_ask
21534
21535 : see if we need va_copy
21536 echo " "
21537 case "$i_stdarg" in
21538 "$define")
21539         $cat >try.c <<EOCP
21540 #include <stdarg.h>
21541 #include <stdio.h>
21542 #$i_stdlib I_STDLIB
21543 #ifdef I_STDLIB
21544 #include <stdlib.h>
21545 #endif
21546 #include <signal.h>
21547
21548 int
21549 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21550 {
21551   return vfprintf(f, fmt, *valp);
21552 }
21553
21554 int
21555 myvfprintf(FILE *f, const  char *fmt, va_list val)
21556 {
21557   return ivfprintf(f, fmt, &val);
21558 }
21559
21560 int
21561 myprintf(char *fmt, ...)
21562 {
21563   va_list val;
21564   va_start(val, fmt);
21565   return myvfprintf(stdout, fmt, val);
21566 }
21567
21568 int
21569 main(int ac, char **av)
21570 {
21571   signal(SIGSEGV, exit);
21572
21573   myprintf("%s%cs all right, then\n", "that", '\'');
21574   exit(0);
21575 }
21576 EOCP
21577         set try
21578         if eval $compile && $run ./try 2>&1 >/dev/null; then
21579                 case "`$run ./try`" in
21580                 "that's all right, then")
21581                         okay=yes
21582                         ;;
21583                 esac
21584         fi
21585         case "$okay" in
21586         yes)    echo "It seems that you don't need va_copy()." >&4
21587                 need_va_copy="$undef"
21588                 ;;
21589         *)      echo "It seems that va_copy() or similar will be needed." >&4
21590                 need_va_copy="$define"
21591                 ;;
21592         esac
21593         $rm_try
21594         ;;
21595 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21596         need_va_copy="$undef"
21597         ;;
21598 esac
21599
21600 : see what type is used for size_t
21601 rp="What is the type used for the length parameter for string functions?"
21602 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21603 eval $typedef_ask
21604
21605 : check for type of arguments to gethostbyaddr.
21606 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21607         case "$d_gethbyaddr" in
21608         $define)
21609                 $cat <<EOM
21610
21611 Checking to see what type of arguments are accepted by gethostbyaddr().
21612 EOM
21613                 hdrs="$define sys/types.h
21614                         $d_socket sys/socket.h
21615                         $i_niin netinet/in.h
21616                         $i_netdb netdb.h
21617                         $i_unistd unistd.h"
21618                 : The first arg can 'char *' or 'void *'
21619                 : The second arg is some of integral type
21620                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21621                         for yyy in size_t long int; do
21622                                 case "$netdb_host_type" in
21623                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21624                                         if ./protochk "$try" $hdrs; then
21625                                                 echo "Your system accepts $xxx for the first arg."
21626                                                 echo "...and $yyy for the second arg."
21627                                                 netdb_host_type="$xxx"
21628                                                 netdb_hlen_type="$yyy"
21629                                         fi
21630                                         ;;
21631                                 esac
21632                         done
21633                 done
21634                 : In case none of those worked, prompt the user.
21635                 case "$netdb_host_type" in
21636                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21637                         dflt='char *'
21638                         . ./myread
21639                         netdb_host_type=$ans
21640                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21641                         dflt="$sizetype"
21642                         . ./myread
21643                         netdb_hlen_type=$ans
21644                         ;;
21645                 esac
21646                 ;;
21647         *)      : no gethostbyaddr, so pick harmless defaults
21648                 netdb_host_type='char *'
21649                 netdb_hlen_type="$sizetype"
21650                 ;;
21651         esac
21652         # Remove the "const" if needed. -- but then we'll have a
21653         # prototype clash!
21654         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21655 fi
21656
21657 : check for type of argument to gethostbyname.
21658 if test "X$netdb_name_type" = X ; then
21659         case "$d_gethbyname" in
21660         $define)
21661                 $cat <<EOM
21662
21663 Checking to see what type of argument is accepted by gethostbyname().
21664 EOM
21665                 hdrs="$define sys/types.h
21666                         $d_socket sys/socket.h
21667                         $i_niin netinet/in.h
21668                         $i_netdb netdb.h
21669                         $i_unistd unistd.h"
21670                 for xxx in "const char *" "char *"; do
21671                         case "$netdb_name_type" in
21672                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21673                                 if ./protochk "$try" $hdrs; then
21674                                         echo "Your system accepts $xxx."
21675                                         netdb_name_type="$xxx"
21676                                 fi
21677                                 ;;
21678                         esac
21679                 done
21680                 : In case none of those worked, prompt the user.
21681                 case "$netdb_name_type" in
21682                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21683                         dflt='char *'
21684                         . ./myread
21685                         netdb_name_type=$ans
21686                         ;;
21687                 esac
21688                 ;;
21689         *)      : no gethostbyname, so pick harmless default
21690                 netdb_name_type='char *'
21691                 ;;
21692         esac
21693 fi
21694
21695 : check for type of 1st argument to getnetbyaddr.
21696 if test "X$netdb_net_type" = X ; then
21697         case "$d_getnbyaddr" in
21698         $define)
21699                 $cat <<EOM
21700
21701 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21702 EOM
21703                 hdrs="$define sys/types.h
21704                         $d_socket sys/socket.h
21705                         $i_niin netinet/in.h
21706                         $i_netdb netdb.h
21707                         $i_unistd unistd.h"
21708                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21709                         case "$netdb_net_type" in
21710                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21711                                 if ./protochk "$try" $hdrs; then
21712                                         echo "Your system accepts $xxx."
21713                                         netdb_net_type="$xxx"
21714                                 fi
21715                                 ;;
21716                         esac
21717                 done
21718                 : In case none of those worked, prompt the user.
21719                 case "$netdb_net_type" in
21720                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21721                         dflt='long'
21722                         . ./myread
21723                         netdb_net_type=$ans
21724                         ;;
21725                 esac
21726                 ;;
21727         *)      : no getnetbyaddr, so pick harmless default
21728                 netdb_net_type='long'
21729                 ;;
21730         esac
21731 fi
21732 : locate the preferred pager for this system
21733 fn=f/
21734 case "$pager" in
21735 '')
21736         dflt=''
21737         case "$pg" in
21738         /*) dflt=$pg;;
21739         [a-zA-Z]:/*) dflt=$pg;;
21740         esac
21741         case "$more" in
21742         /*) dflt=$more;;
21743         [a-zA-Z]:/*) dflt=$more;;
21744         esac
21745         case "$less" in
21746         /*) dflt=$less;;
21747         [a-zA-Z]:/*) dflt=$less;;
21748         esac
21749         case "$dflt" in
21750         '') dflt=/usr/ucb/more;;
21751         esac
21752         ;;
21753 *)      dflt="$pager"
21754         ;;
21755 esac
21756 fn="f/($dflt)"
21757 echo " "
21758 rp='What pager is used on your system?'
21759 . ./getfile
21760 pager="$ans"
21761
21762 : see if ar generates random libraries by itself
21763 echo " "
21764 echo "Checking how to generate random libraries on your machine..." >&4
21765 echo 'int bar1() { return bar2(); }' > bar1.c
21766 echo 'int bar2() { return 2; }' > bar2.c
21767 $cat > foo.c <<EOP
21768 #$i_stdlib I_STDLIB
21769 #ifdef I_STDLIB
21770 #include <stdlib.h>
21771 #endif
21772 int main() { printf("%d\n", bar1()); exit(0); }
21773 EOP
21774 $cc $ccflags -c bar1.c >/dev/null 2>&1
21775 $cc $ccflags -c bar2.c >/dev/null 2>&1
21776 $cc $ccflags -c foo.c >/dev/null 2>&1
21777 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21778 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21779         $run ./foobar >/dev/null 2>&1; then
21780         echo "$ar appears to generate random libraries itself."
21781         orderlib=false
21782         if [ "X$ranlib" = "X" ]; then
21783             ranlib=":"
21784         fi
21785 elif $ar s bar$_a >/dev/null 2>&1 &&
21786         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21787         $run ./foobar >/dev/null 2>&1; then
21788                 echo "a table of contents needs to be added with '$ar s'."
21789                 orderlib=false
21790                 ranlib="$ar s"
21791 elif $ar ts bar$_a >/dev/null 2>&1 &&
21792         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21793         $run ./foobar >/dev/null 2>&1; then
21794                 echo "a table of contents needs to be added with '$ar ts'."
21795                 orderlib=false
21796                 ranlib="$ar ts"
21797 else
21798         case "$ranlib" in
21799         :) ranlib='';;
21800         '')
21801                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21802                 $test -f $ranlib || ranlib=''
21803                 ;;
21804         esac
21805         if $test -n "$ranlib"; then
21806                 echo "your system has '$ranlib'; we'll use that."
21807                 orderlib=false
21808         else
21809                 echo "your system doesn't seem to support random libraries"
21810                 echo "so we'll use lorder and tsort to order the libraries."
21811                 orderlib=true
21812                 ranlib=":"
21813         fi
21814 fi
21815 $rm -f foo* bar*
21816
21817 : see if this is a values.h system
21818 set values.h i_values
21819 eval $inhdr
21820
21821 : Check the max offset that gmtime and localtime accept
21822 echo "Checking max offsets that gmtime () accepts"
21823
21824 case $i_values in
21825     define) yyy="#include <values.h>" ;;
21826     *)      yyy="" ;;
21827     esac
21828
21829 case "$sGMTIME_min/$sGMTIME_max" in
21830     0/0|/)
21831         $cat >try.c <<EOCP
21832 #include <sys/types.h>
21833 #include <stdio.h>
21834 #include <time.h>
21835 $yyy
21836
21837 int i;
21838 struct tm *tmp;
21839 time_t pt;
21840
21841 void gm_check (time_t t, int min_year, int max_year)
21842 {
21843     tmp = gmtime (&t);
21844     if ( tmp == NULL ||
21845         /* Check tm_year overflow */
21846          tmp->tm_year < min_year || tmp->tm_year > max_year)
21847         tmp = NULL;
21848     else
21849         pt = t;
21850     } /* gm_check */
21851
21852 int check_max ()
21853 {
21854     tmp = NULL;
21855     pt  = 0;
21856 #ifdef MAXLONG
21857     gm_check (MAXLONG, 69, 0x7fffffff);
21858 #endif
21859     if (tmp == NULL || tmp->tm_year < 0) {
21860         for (i = 63; i >= 0; i--) {
21861             time_t x = pt | ((time_t)1 << i);
21862             if (x < 0 || x < pt) continue;
21863             gm_check (x, 69, 0x7fffffff);
21864             }
21865         }
21866     printf ("sGMTIME_max=%ld\n", pt);
21867     return (0);
21868     } /* check_max */
21869
21870 int check_min ()
21871 {
21872     tmp = NULL;
21873     pt  = 0;
21874 #ifdef MINLONG
21875     gm_check (MINLONG, -1900, 70);
21876 #endif
21877     if (tmp == NULL) {
21878         for (i = 36; i >= 0; i--) {
21879             time_t x = pt - ((time_t)1 << i);
21880             if (x > 0) continue;
21881             gm_check (x, -1900, 70);
21882             }
21883         }
21884     printf ("sGMTIME_min=%ld\n", pt);
21885     return (0);
21886     } /* check_min */
21887
21888 int main (int argc, char *argv[])
21889 {
21890     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21891     check_max ();
21892     check_min ();
21893     return (0);
21894     } /* main */
21895 EOCP
21896         set try
21897         if eval $compile; then
21898             eval `$run ./try 2>/dev/null`
21899         else
21900             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21901             fi
21902         $rm_try
21903         ;;
21904     esac
21905
21906 echo "Checking max offsets that localtime () accepts"
21907
21908 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21909     0/0|/)
21910         $cat >try.c <<EOCP
21911 #include <sys/types.h>
21912 #include <stdio.h>
21913 #include <time.h>
21914 $yyy
21915
21916 int i;
21917 struct tm *tmp;
21918 time_t pt;
21919
21920 void local_check (time_t t, int min_year, int max_year)
21921 {
21922     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21923         tmp = NULL;
21924     else
21925         tmp = localtime (&t);
21926     if ( tmp == NULL ||
21927         /* Check tm_year overflow */
21928          tmp->tm_year < min_year || tmp->tm_year > max_year)
21929         tmp = NULL;
21930     else
21931         pt = t;
21932     } /* local_check */
21933
21934 int check_max ()
21935 {
21936     tmp = NULL;
21937     pt  = 0;
21938 #ifdef MAXLONG
21939     local_check (MAXLONG, 69, 0x7fffffff);
21940 #endif
21941     if (tmp == NULL || tmp->tm_year < 0) {
21942         for (i = 63; i >= 0; i--) {
21943             time_t x = pt | ((time_t)1 << i);
21944             if (x < 0 || x < pt) continue;
21945             local_check (x, 69, 0x7fffffff);
21946             }
21947         }
21948     printf ("sLOCALTIME_max=%ld\n", pt);
21949     return (0);
21950    } /* check_max */
21951
21952 int check_min ()
21953 {
21954     tmp = NULL;
21955     pt  = 0;
21956 #ifdef MINLONG
21957     local_check (MINLONG, -1900, 70);
21958 #endif
21959     if (tmp == NULL) {
21960         for (i = 36; i >= 0; i--) {
21961             time_t x = pt - ((time_t)1 << i);
21962             if (x > 0) continue;
21963             local_check (x, -1900, 70);
21964             }
21965         }
21966     printf ("sLOCALTIME_min=%ld\n", pt);
21967     return (0);
21968     } /* check_min */
21969
21970 int main (int argc, char *argv[])
21971 {
21972     check_max ();
21973     check_min ();
21974     return (0);
21975     } /* main */
21976 EOCP
21977         set try
21978         if eval $compile; then
21979             eval `$run ./try 2>/dev/null`
21980         else
21981             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21982             fi
21983         $rm_try
21984         ;;
21985     esac
21986
21987 : check for type of arguments to select.
21988 case "$selecttype" in
21989 '') case "$d_select" in
21990         $define)
21991                 echo " "
21992                 $cat <<EOM
21993 Checking to see what type of arguments are accepted by select().
21994 EOM
21995                 hdrs="$define sys/types.h
21996                         $i_systime sys/time.h
21997                         $i_sysselct sys/select.h
21998                         $d_socket sys/socket.h"
21999                 : The first arg can be int, unsigned, or size_t
22000                 : The last arg may or may not be 'const'
22001                 val=''
22002                 : void pointer has been seen but using that
22003                 : breaks the selectminbits test
22004                 for xxx in 'fd_set *' 'int *'; do
22005                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
22006                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
22007                                         case "$val" in
22008                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
22009                                                 if ./protochk "$try" $hdrs; then
22010                                                         echo "Your system accepts $xxx."
22011                                                         val="$xxx"
22012                                                 fi
22013                                                 ;;
22014                                         esac
22015                                 done
22016                         done
22017                 done
22018                 case "$val" in
22019                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22020                         case "$d_fd_set" in
22021                                 $define) dflt="fd_set *" ;;
22022                                 *)              dflt="int *" ;;
22023                         esac
22024                         . ./myread
22025                         val=$ans
22026                         ;;
22027                 esac
22028                 selecttype="$val"
22029                 ;;
22030         *)      : no select, so pick a harmless default
22031                 selecttype='int *'
22032                 ;;
22033         esac
22034         ;;
22035 esac
22036
22037 : check for the select 'width'
22038 case "$selectminbits" in
22039 '') safebits=`expr $ptrsize \* 8`
22040     case "$d_select" in
22041         $define)
22042                 $cat <<EOM
22043
22044 Checking to see on how many bits at a time your select() operates...
22045 EOM
22046                 $cat >try.c <<EOCP
22047 #include <sys/types.h>
22048 #$i_time I_TIME
22049 #$i_systime I_SYS_TIME
22050 #$i_systimek I_SYS_TIME_KERNEL
22051 #ifdef I_TIME
22052 #   include <time.h>
22053 #endif
22054 #ifdef I_SYS_TIME
22055 #   ifdef I_SYS_TIME_KERNEL
22056 #       define KERNEL
22057 #   endif
22058 #   include <sys/time.h>
22059 #   ifdef I_SYS_TIME_KERNEL
22060 #       undef KERNEL
22061 #   endif
22062 #endif
22063 #$i_sysselct I_SYS_SELECT
22064 #ifdef I_SYS_SELECT
22065 #include <sys/select.h>
22066 #endif
22067 #$d_socket HAS_SOCKET
22068 #ifdef HAS_SOCKET
22069 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22070 #endif
22071 #include <stdio.h>
22072 #$i_stdlib I_STDLIB
22073 #ifdef I_STDLIB
22074 #include <stdlib.h>
22075 #endif
22076 $selecttype b;
22077 #define S sizeof(*(b))
22078 #define MINBITS 64
22079 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22080 #define NBITS  (NBYTES * 8)
22081 int main() {
22082     char *s = (char *)malloc(NBYTES);
22083     struct timeval t;
22084     int i;
22085     FILE* fp;
22086     int fd;
22087
22088     if (!s)
22089         exit(1);
22090     fclose(stdin);
22091     fp = fopen("try.c", "r");
22092     if (fp == 0)
22093       exit(2);
22094     fd = fileno(fp);
22095     if (fd < 0)
22096       exit(3);
22097     b = ($selecttype)s;
22098     for (i = 0; i < NBITS; i++)
22099         FD_SET(i, b);
22100     t.tv_sec  = 0;
22101     t.tv_usec = 0;
22102     select(fd + 1, b, 0, 0, &t);
22103     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22104     free(s);
22105     printf("%d\n", i + 1);
22106     return 0;
22107 }
22108 EOCP
22109                 set try
22110                 if eval $compile_ok; then
22111                         selectminbits=`$run ./try 2>/dev/null`
22112                         case "$selectminbits" in
22113                         '')     cat >&4 <<EOM
22114 Cannot figure out on how many bits at a time your select() operates.
22115 I'll play safe and guess it is $safebits bits.
22116 EOM
22117                                 selectminbits=$safebits
22118                                 bits="$safebits bits"
22119                                 ;;
22120                         1)      bits="1 bit" ;;
22121                         *)      bits="$selectminbits bits" ;;
22122                         esac
22123                         echo "Your select() operates on $bits at a time." >&4
22124                 else
22125                         rp='What is the minimum number of bits your select() operates on?'
22126                         case "$byteorder" in
22127                         12345678)       dflt=64 ;;
22128                         1234)           dflt=32 ;;
22129                         *)              dflt=1  ;;
22130                         esac
22131                         . ./myread
22132                         val=$ans
22133                         selectminbits="$val"
22134                 fi
22135                 $rm_try
22136                 ;;
22137         *)      : no select, so pick a harmless default
22138                 selectminbits=$safebits
22139                 ;;
22140         esac
22141         ;;
22142 esac
22143
22144 : Trace out the files included by signal.h, then look for SIGxxx names.
22145 case "$sig_num_init" in
22146 '')
22147 if [ "X$fieldn" = X ]; then
22148         : Just make some guesses.  We check them later.
22149         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22150 else
22151         xxx=`echo '#include <signal.h>' |
22152         $cppstdin $cppminus $cppflags 2>/dev/null |
22153         $grep '^[       ]*#.*include' |
22154         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22155                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22156 fi
22157 xxxfiles=''
22158 for xx in $xxx /dev/null ; do
22159         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22160 done
22161 case "$xxxfiles" in
22162 '')     xxxfiles=`./findhdr signal.h` ;;
22163 esac
22164 xxx=`awk '
22165 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22166         print substr($2, 4, 20)
22167 }
22168 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22169         print substr($3, 4, 20)
22170 }' $xxxfiles`
22171 : Append some common names just in case the awk scan failed.
22172 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22173 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22174 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22175 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22176 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22177
22178 : generate a few handy files for later
22179 $cat > signal.c <<EOCP
22180 #include <sys/types.h>
22181 #include <signal.h>
22182 #$i_stdlib I_STDLIB
22183 #ifdef I_STDLIB
22184 #include <stdlib.h>
22185 #endif
22186 #include <stdio.h>
22187 int main() {
22188
22189 /* Strange style to avoid deeply-nested #if/#else/#endif */
22190 #ifndef NSIG
22191 #  ifdef _NSIG
22192 #    define NSIG (_NSIG)
22193 #  endif
22194 #endif
22195
22196 #ifndef NSIG
22197 #  ifdef SIGMAX
22198 #    define NSIG (SIGMAX+1)
22199 #  endif
22200 #endif
22201
22202 #ifndef NSIG
22203 #  ifdef SIG_MAX
22204 #    define NSIG (SIG_MAX+1)
22205 #  endif
22206 #endif
22207
22208 #ifndef NSIG
22209 #  ifdef _SIG_MAX
22210 #    define NSIG (_SIG_MAX+1)
22211 #  endif
22212 #endif
22213
22214 #ifndef NSIG
22215 #  ifdef MAXSIG
22216 #    define NSIG (MAXSIG+1)
22217 #  endif
22218 #endif
22219
22220 #ifndef NSIG
22221 #  ifdef MAX_SIG
22222 #    define NSIG (MAX_SIG+1)
22223 #  endif
22224 #endif
22225
22226 #ifndef NSIG
22227 #  ifdef SIGARRAYSIZE
22228 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22229 #  endif
22230 #endif
22231
22232 #ifndef NSIG
22233 #  ifdef _sys_nsig
22234 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22235 #  endif
22236 #endif
22237
22238 /* Default to some arbitrary number that's big enough to get most
22239    of the common signals.
22240 */
22241 #ifndef NSIG
22242 #    define NSIG 50
22243 #endif
22244
22245 printf("NSIG %d\n", NSIG);
22246
22247 #ifndef JUST_NSIG
22248
22249 EOCP
22250
22251 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22252 {
22253         printf "#ifdef SIG"; printf $1; printf "\n"
22254         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22255         printf $1; printf ");\n"
22256         printf "#endif\n"
22257 }
22258 END {
22259         printf "#endif /* JUST_NSIG */\n";
22260         printf "exit(0);\n}\n";
22261 }
22262 ' >>signal.c
22263 $cat >signal.awk <<'EOP'
22264 BEGIN { ndups = 0 }
22265 $1 ~ /^NSIG$/ { nsig = $2 }
22266 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22267     if ($2 > maxsig) { maxsig = $2 }
22268     if (sig_name[$2]) {
22269         dup_name[ndups] = $1
22270         dup_num[ndups] = $2
22271         ndups++
22272     }
22273     else {
22274         sig_name[$2] = $1
22275         sig_num[$2] = $2
22276     }
22277 }
22278 END {
22279     if (nsig == 0) {
22280         nsig = maxsig + 1
22281     }
22282     printf("NSIG %d\n", nsig);
22283     for (n = 1; n < nsig; n++) {
22284         if (sig_name[n]) {
22285             printf("%s %d\n", sig_name[n], sig_num[n])
22286         }
22287         else {
22288             printf("NUM%d %d\n", n, n)
22289         }
22290     }
22291     for (n = 0; n < ndups; n++) {
22292         printf("%s %d\n", dup_name[n], dup_num[n])
22293     }
22294 }
22295 EOP
22296 $cat >signal_cmd <<EOS
22297 $startsh
22298 if $test -s signal.lst; then
22299     echo "Using your existing signal.lst file"
22300         exit 0
22301 fi
22302 xxx="$xxx"
22303 EOS
22304 $cat >>signal_cmd <<'EOS'
22305
22306 set signal
22307 if eval $compile_ok; then
22308         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22309                 $uniq | $awk -f signal.awk >signal.lst
22310 else
22311         echo "(I can't seem be able to compile the whole test program)" >&4
22312         echo "(I'll try it in little pieces.)" >&4
22313         set signal -DJUST_NSIG
22314         if eval $compile_ok; then
22315                 $run ./signal$_exe > signal.nsg
22316                 $cat signal.nsg
22317         else
22318                 echo "I can't seem to figure out how many signals you have." >&4
22319                 echo "Guessing 50." >&4
22320                 echo 'NSIG 50' > signal.nsg
22321         fi
22322         : Now look at all the signal names, one at a time.
22323         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22324                 $cat > signal.c <<EOCP
22325 #include <sys/types.h>
22326 #include <signal.h>
22327 #include <stdio.h>
22328 int main() {
22329 printf("$xx %d\n", SIG${xx});
22330 return 0;
22331 }
22332 EOCP
22333                 set signal
22334                 if eval $compile; then
22335                         echo "SIG${xx} found."
22336                         $run ./signal$_exe  >> signal.ls1
22337                 else
22338                         echo "SIG${xx} NOT found."
22339                 fi
22340         done
22341         if $test -s signal.ls1; then
22342                 $cat signal.nsg signal.ls1 |
22343                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22344         fi
22345
22346 fi
22347 if $test -s signal.lst; then
22348         :
22349 else
22350         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22351         echo 'kill -l' >signal
22352         set X `csh -f <signal`
22353         $rm -f signal
22354         shift
22355         case $# in
22356         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22357         esac
22358         echo $@ | $tr ' ' $trnl | \
22359             $awk '{ printf "%s %d\n", $1, ++s; }
22360                   END { printf "NSIG %d\n", ++s }' >signal.lst
22361 fi
22362 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22363 EOS
22364 chmod a+x signal_cmd
22365 $eunicefix signal_cmd
22366 ;;
22367 esac
22368
22369 : generate list of signal names
22370 case "$sig_num_init" in
22371 '')
22372 echo " "
22373 case "$sig_name_init" in
22374 '') doinit=yes ;;
22375 *)  case "$sig_num_init" in
22376     ''|*,*) doinit=yes ;;
22377     esac ;;
22378 esac
22379 case "$doinit" in
22380 yes)
22381         echo "Generating a list of signal names and numbers..." >&4
22382         . ./signal_cmd
22383         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22384         sig_name=`$awk 'BEGIN { printf "ZERO " }
22385                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22386         sig_num=`$awk  'BEGIN { printf "0 " }
22387                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22388         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22389                              !/^NSIG/   { printf "\"%s\", ", $1 }
22390                              END        { printf "0\n" }' signal.lst`
22391         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22392                              !/^NSIG/   { printf "%d, ", $2}
22393                              END        { printf "0\n"}' signal.lst`
22394         ;;
22395 esac
22396 echo "The following $sig_count signals are available:"
22397 echo " "
22398 echo $sig_name | $awk \
22399 'BEGIN { linelen = 0 }
22400 {
22401         for (i = 1; i <= NF; i++) {
22402                 name = "SIG" $i " "
22403                 linelen = linelen + length(name)
22404                 if (linelen > 70) {
22405                         printf "\n"
22406                         linelen = length(name)
22407                 }
22408                 printf "%s", name
22409         }
22410         printf "\n"
22411 }'
22412 sig_size=`echo $sig_name | awk '{print NF}'`
22413 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22414 ;;
22415 esac
22416
22417 : Check size of size
22418 echo " "
22419 case "$sizetype" in
22420 *_t) zzz="$sizetype"    ;;
22421 *)   zzz="filesize"     ;;
22422 esac
22423 echo "Checking the size of $zzz..." >&4
22424 cat > try.c <<EOCP
22425 #include <sys/types.h>
22426 #include <stdio.h>
22427 #$i_stdlib I_STDLIB
22428 #ifdef I_STDLIB
22429 #include <stdlib.h>
22430 #endif
22431 int main() {
22432     printf("%d\n", (int)sizeof($sizetype));
22433     exit(0);
22434 }
22435 EOCP
22436 set try
22437 if eval $compile_ok; then
22438         yyy=`$run ./try`
22439         case "$yyy" in
22440         '')     sizesize=4
22441                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22442                 ;;
22443         *)      sizesize=$yyy
22444                 echo "Your $zzz size is $sizesize bytes."
22445                 ;;
22446         esac
22447 else
22448         sizesize=4
22449         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22450 fi
22451
22452
22453 : check for socklen_t
22454 echo " "
22455 echo "Checking to see if you have socklen_t..." >&4
22456 $cat >try.c <<EOCP
22457 #include <sys/types.h>
22458 #$d_socket HAS_SOCKET
22459 #ifdef HAS_SOCKET
22460 #include <sys/socket.h>
22461 #endif
22462 int main() { socklen_t x = 16; }
22463 EOCP
22464 set try
22465 if eval $compile; then
22466         val="$define"
22467         echo "You have socklen_t."
22468 else
22469         val="$undef"
22470         echo "You do not have socklen_t."
22471         case "$sizetype" in
22472         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22473         esac
22474 fi
22475 $rm_try
22476 set d_socklen_t
22477 eval $setvar
22478
22479 : see if this is a socks.h system
22480 set socks.h i_socks
22481 eval $inhdr
22482
22483 : check for type of the size argument to socket calls
22484 case "$d_socket" in
22485 "$define")
22486         $cat <<EOM
22487
22488 Checking to see what type is the last argument of accept().
22489 EOM
22490         yyy=''
22491         case "$d_socklen_t" in
22492         "$define") yyy="$yyy socklen_t"
22493         esac
22494         yyy="$yyy $sizetype int long unsigned"
22495         for xxx in $yyy; do
22496                 case "$socksizetype" in
22497                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22498                         case "$usesocks" in
22499                         "$define")
22500                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22501                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22502                                         socksizetype="$xxx"
22503                                 fi
22504                                 ;;
22505                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22506                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22507                                         socksizetype="$xxx"
22508                                 fi
22509                                 ;;
22510                         esac
22511                         ;;
22512                 esac
22513         done
22514 : In case none of those worked, prompt the user.
22515         case "$socksizetype" in
22516         '')     rp='What is the type for socket address structure sizes?'
22517                 dflt='int'
22518                 . ./myread
22519                 socksizetype=$ans
22520                 ;;
22521         esac
22522         ;;
22523 *)      : no sockets, so pick relatively harmless default
22524         socksizetype='int'
22525         ;;
22526 esac
22527
22528 : see what type is used for signed size_t
22529 set ssize_t ssizetype int stdio.h sys/types.h
22530 eval $typedef
22531 dflt="$ssizetype"
22532 $cat > try.c <<EOM
22533 #include <stdio.h>
22534 #$i_stdlib I_STDLIB
22535 #ifdef I_STDLIB
22536 #include <stdlib.h>
22537 #endif
22538 #include <sys/types.h>
22539 #define Size_t $sizetype
22540 #define SSize_t $dflt
22541 int main()
22542 {
22543         if (sizeof(Size_t) == sizeof(SSize_t))
22544                 printf("$dflt\n");
22545         else if (sizeof(Size_t) == sizeof(int))
22546                 printf("int\n");
22547         else
22548                 printf("long\n");
22549         exit(0);
22550 }
22551 EOM
22552 echo " "
22553 set try
22554 if eval $compile_ok && $run ./try > /dev/null; then
22555         ssizetype=`$run ./try`
22556         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22557 else
22558         $cat >&4 <<EOM
22559 Help! I can't compile and run the ssize_t test program: please enlighten me!
22560 (This is probably a misconfiguration in your system or libraries, and
22561 you really ought to fix it.  Still, I'll try anyway.)
22562
22563 I need a type that is the same size as $sizetype, but is guaranteed to
22564 be signed.  Common values are ssize_t, int and long.
22565
22566 EOM
22567         rp="What signed type is the same size as $sizetype?"
22568         . ./myread
22569         ssizetype="$ans"
22570 fi
22571 $rm_try
22572
22573 : Check the size of st_ino
22574 $echo " "
22575 $echo "Checking the size of st_ino..." >&4
22576 $cat > try.c <<EOCP
22577 #include <sys/stat.h>
22578 #include <stdio.h>
22579 #$i_stdlib I_STDLIB
22580 #ifdef I_STDLIB
22581 #include <stdlib.h>
22582 #endif
22583 int main() {
22584     struct stat st;
22585     printf("%d\n", (int)sizeof(st.st_ino));
22586     exit(0);
22587 }
22588 EOCP
22589 set try
22590 if eval $compile_ok; then
22591         val=`$run ./try`
22592         case "$val" in
22593         '')     st_ino_size=4
22594                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22595                 ;;
22596         *)      st_ino_size=$val
22597                 $echo "Your st_ino is $st_ino_size bytes long."
22598                 ;;
22599         esac
22600 else
22601         st_ino_size=4
22602         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22603 fi
22604 $rm_try
22605
22606 : Check if st_ino is signed
22607 $echo " "
22608 $echo "Checking the sign of st_ino..." >&4
22609 $cat > try.c <<EOCP
22610 #include <sys/stat.h>
22611 #include <stdio.h>
22612 int main() {
22613         struct stat foo;
22614         foo.st_ino = -1;
22615         if (foo.st_ino < 0)
22616                 printf("-1\n");
22617         else
22618                 printf("1\n");
22619 }
22620 EOCP
22621 set try
22622 if eval $compile; then
22623         val=`$run ./try`
22624         case "$val" in
22625         '')     st_ino_sign=1
22626                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22627                 ;;
22628         *)      st_ino_sign=$val
22629                 case "$st_ino_sign" in
22630                  1) $echo "Your st_ino is unsigned." ;;
22631                 -1) $echo "Your st_ino is signed."   ;;
22632                 esac
22633                 ;;
22634         esac
22635 else
22636         st_ino_sign=1
22637         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22638 fi
22639 $rm_try
22640
22641 : see what type of char stdio uses.
22642 echo " "
22643 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22644 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22645         echo "Your stdio uses unsigned chars." >&4
22646         stdchar="unsigned char"
22647 else
22648         echo "Your stdio uses signed chars." >&4
22649         stdchar="char"
22650 fi
22651 $rm -f stdioh
22652
22653 : Check size of UID
22654 echo " "
22655 case "$uidtype" in
22656 *_t) zzz="$uidtype"     ;;
22657 *)   zzz="uid"          ;;
22658 esac
22659 echo "Checking the size of $zzz..." >&4
22660 cat > try.c <<EOCP
22661 #include <sys/types.h>
22662 #include <stdio.h>
22663 #$i_stdlib I_STDLIB
22664 #ifdef I_STDLIB
22665 #include <stdlib.h>
22666 #endif
22667 int main() {
22668     printf("%d\n", (int)sizeof($uidtype));
22669     exit(0);
22670 }
22671 EOCP
22672 set try
22673 if eval $compile_ok; then
22674         yyy=`$run ./try`
22675         case "$yyy" in
22676         '')     uidsize=4
22677                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22678                 ;;
22679         *)      uidsize=$yyy
22680                 echo "Your $zzz is $uidsize bytes long."
22681                 ;;
22682         esac
22683 else
22684         uidsize=4
22685         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22686 fi
22687
22688 : Check if UID is signed
22689 echo " "
22690 case "$uidtype" in
22691 *_t) zzz="$uidtype"     ;;
22692 *)   zzz="uid"          ;;
22693 esac
22694 echo "Checking the sign of $zzz..." >&4
22695 cat > try.c <<EOCP
22696 #include <sys/types.h>
22697 #include <stdio.h>
22698 int main() {
22699         $uidtype foo = -1;
22700         if (foo < 0)
22701                 printf("-1\n");
22702         else
22703                 printf("1\n");
22704 }
22705 EOCP
22706 set try
22707 if eval $compile; then
22708         yyy=`$run ./try`
22709         case "$yyy" in
22710         '')     uidsign=1
22711                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22712                 ;;
22713         *)      uidsign=$yyy
22714                 case "$uidsign" in
22715                  1) echo "Your $zzz is unsigned." ;;
22716                 -1) echo "Your $zzz is signed."   ;;
22717                 esac
22718                 ;;
22719         esac
22720 else
22721         uidsign=1
22722         echo "(I can't compile the test program--guessing unsigned.)" >&4
22723 fi
22724
22725
22726 : Check format string for UID
22727 echo " "
22728 $echo "Checking the format string to be used for uids..." >&4
22729
22730 case "$uidsign" in
22731 -1)     if $test X"$uidsize" = X"$ivsize"; then
22732                 uidformat="$ivdformat"
22733         else
22734                 if $test X"$uidsize" = X"$longsize"; then
22735                         uidformat='"ld"'
22736                 else
22737                         if $test X"$uidsize" = X"$intsize"; then
22738                                 uidformat='"d"'
22739                         else
22740                                 if $test X"$uidsize" = X"$shortsize"; then
22741                                         uidformat='"hd"'
22742                                 fi
22743                         fi
22744                 fi
22745         fi
22746         ;;
22747 *)      if $test X"$uidsize" = X"$uvsize"; then
22748                 uidformat="$uvuformat"
22749         else
22750                 if $test X"$uidsize" = X"$longsize"; then
22751                         uidformat='"lu"'
22752                 else
22753                         if $test X"$uidsize" = X"$intsize"; then
22754                                 uidformat='"u"'
22755                         else
22756                                 if $test X"$uidsize" = X"$shortsize"; then
22757                                         uidformat='"hu"'
22758                                 fi
22759                         fi
22760                 fi
22761         fi
22762         ;;
22763 esac
22764
22765 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22766 echo " "
22767 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22768 $cat >try.c <<'EOM'
22769 /* Intentionally a long probe as I'd like to sanity check that the exact
22770    approach is going to work, as thinking it will work, but only having it
22771    part working at runtime is worse than not having it.  */
22772
22773 #include <sys/types.h>
22774 #include <sys/sysctl.h>
22775 #include <sys/param.h>
22776 #include <stdio.h>
22777 #include <string.h>
22778 #include <stdlib.h>
22779 #include <unistd.h>
22780
22781 int
22782 main(int argc, char **argv) {
22783     char *buffer;
22784     char *argv_leaf = strrchr(argv[0], '/');
22785     char *buffer_leaf;
22786     size_t size = 0;
22787     int mib[4];
22788
22789     mib[0] = CTL_KERN;
22790     mib[1] = KERN_PROC;
22791     mib[2] = KERN_PROC_PATHNAME;
22792     mib[3] = -1;
22793
22794     if (!argv_leaf) {
22795         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22796         return 1;
22797     }
22798
22799     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22800         perror("sysctl");
22801         return 2;
22802     }
22803
22804     if (size < strlen(argv_leaf) + 1) {
22805         fprintf(stderr, "size %lu is too short for a path\n",
22806                 (unsigned long) size);
22807         return 3;
22808     }
22809
22810     if (size > MAXPATHLEN * MAXPATHLEN) {
22811         fprintf(stderr, "size %lu is too long for a path\n",
22812                 (unsigned long) size);
22813         return 4;
22814     }
22815
22816     buffer = malloc(size);
22817     if (!buffer) {
22818         perror("malloc");
22819         return 5;
22820     }
22821
22822     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22823         perror("sysctl");
22824         return 6;
22825     }
22826
22827     if (strlen(buffer) + 1 != size) {
22828         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22829                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22830         return 7;
22831     }
22832
22833
22834     if (*buffer != '/') {
22835         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22836         return 8;
22837     }
22838
22839     if (strstr(buffer, "/./")) {
22840         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22841         return 9;
22842     }
22843
22844     if (strstr(buffer, "/../")) {
22845         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22846         return 10;
22847     }
22848
22849     buffer_leaf = strrchr(buffer, '/');
22850     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22851         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22852         return 11;
22853     }
22854
22855     free(buffer);
22856
22857     return 0;
22858 }
22859 EOM
22860
22861 val=$undef
22862 set try
22863 if eval $compile; then
22864         if $run ./try; then
22865                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22866                 val="$define"
22867         else
22868                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22869                 val="$undef"
22870         fi
22871 else
22872         echo "I'm unable to compile the test program." >&4
22873         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22874         val="$undef"
22875 fi
22876 $rm_try
22877 set usekernprocpathname
22878 eval $setvar
22879
22880 : Determine if we can use _NSGetExecutablePath to find executing program
22881 echo " "
22882 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22883 $cat >try.c <<'EOM'
22884 /* Intentionally a long probe as I'd like to sanity check that the exact
22885    approach is going to work, as thinking it will work, but only having it
22886    part working at runtime is worse than not having it.  */
22887 #include <mach-o/dyld.h>
22888 #include <stdio.h>
22889 #include <stdlib.h>
22890 #include <sys/param.h>
22891 #include <string.h>
22892
22893 int
22894 main(int argc, char **argv) {
22895     char buf[1];
22896     uint32_t size = sizeof(buf);
22897     int result;
22898     char *buffer;
22899     char *tidied;
22900     char *argv_leaf = strrchr(argv[0], '/');
22901     char *tidied_leaf;
22902
22903     if (!argv_leaf) {
22904         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22905         return 1;
22906     }
22907
22908     _NSGetExecutablePath(buf, &size);
22909     if (size > MAXPATHLEN * MAXPATHLEN) {
22910         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22911                 (unsigned int) size);
22912         return 2;
22913     }
22914
22915     buffer = malloc(size);
22916     if (!buffer) {
22917         perror("malloc");
22918         return 3;
22919     }
22920
22921     result = _NSGetExecutablePath(buffer, &size);
22922     if (result != 0) {
22923         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22924                 result, (unsigned int) size);
22925         return 4;
22926     }
22927
22928     tidied = realpath(buffer, NULL);
22929     if (!tidied) {
22930         perror("realpath");
22931         return 5;
22932     }
22933
22934     free(buffer);
22935
22936     if (*tidied != '/') {
22937         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22938         return 6;
22939     }
22940
22941     if (strstr(tidied, "/./")) {
22942         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22943         return 7;
22944     }
22945
22946     if (strstr(tidied, "/../")) {
22947         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22948         return 8;
22949     }
22950
22951     tidied_leaf = strrchr(tidied, '/');
22952     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22953         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22954         return 9;
22955     }
22956
22957     free(tidied);
22958
22959     return 0;
22960 }
22961 EOM
22962
22963 val=$undef
22964 set try
22965 if eval $compile; then
22966         if $run ./try; then
22967                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22968                 val="$define"
22969         else
22970                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22971         fi
22972 else
22973         echo "I'm unable to compile the test program." >&4
22974         echo "I'll assume no _NSGetExecutablePath here." >&4
22975 fi
22976 $rm_try
22977 set usensgetexecutablepath
22978 eval $setvar
22979
22980 : Check if site customization support was requested
22981 case "$usesitecustomize" in
22982     $define|true|[Yy]*)
22983         usesitecustomize="$define"
22984         ;;
22985     *)
22986         usesitecustomize="$undef"
22987         ;;
22988     esac
22989
22990 : see if prototypes support variable argument declarations
22991 echo " "
22992 case "$prototype$i_stdarg" in
22993 $define$define)
22994         echo "It appears we'll be able to prototype varargs functions." >&4
22995         val="$define"
22996         ;;
22997 *)
22998         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22999         val="$undef"
23000         ;;
23001 esac
23002 set vaproto
23003 eval $setvar
23004
23005 : determine compiler compiler
23006 case "$yacc" in
23007 '')
23008         dflt=yacc;;
23009 *)
23010         dflt="$yacc";;
23011 esac
23012 echo " "
23013 comp='yacc'
23014 if $test -f "$byacc$_exe"; then
23015         dflt="$byacc"
23016         comp="byacc or $comp"
23017 fi
23018 if $test -f "$bison$_exe"; then
23019         comp="$comp or bison -y"
23020 fi
23021 rp="Which compiler compiler ($comp) shall I use?"
23022 . ./myread
23023 yacc="$ans"
23024 case "$yacc" in
23025 *bis*)
23026         case "$yacc" in
23027         *-y*) ;;
23028         *)
23029                 yacc="$yacc -y"
23030                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23031                 ;;
23032         esac
23033         ;;
23034 esac
23035
23036 : see if this is a assert.h system
23037 set assert.h i_assert
23038 eval $inhdr
23039
23040 : see if this is a bfd.h system
23041 set bfd.h i_bfd
23042 eval $inhdr
23043
23044 : see if this is an execinfo.h system
23045 set execinfo.h i_execinfo
23046 eval $inhdr
23047
23048 : see if this is a fenv.h system
23049 set fenv.h i_fenv
23050 eval $inhdr
23051
23052 : see if this is a fp.h system
23053 set fp.h i_fp
23054 eval $inhdr
23055
23056 : see if this is a fp_class.h system
23057 set fp_class.h i_fp_class
23058 eval $inhdr
23059
23060 : see if gdbm.h is available
23061 set gdbm.h t_gdbm
23062 eval $inhdr
23063 case "$t_gdbm" in
23064 $define)
23065         : see if gdbm_open exists
23066         set gdbm_open d_gdbm_open
23067         eval $inlibc
23068         case "$d_gdbm_open" in
23069         $undef)
23070                 t_gdbm="$undef"
23071                 echo "We won't be including <gdbm.h>"
23072                 ;;
23073         esac
23074         ;;
23075 esac
23076 val="$t_gdbm"
23077 set i_gdbm
23078 eval $setvar
23079
23080 : see if this is a ieeefp.h system
23081 case "$i_ieeefp" in
23082 '' ) set ieeefp.h i_ieeefp
23083      eval $inhdr
23084      ;;
23085 esac
23086
23087 : see if this is a libutil.h system
23088 set libutil.h i_libutil
23089 eval $inhdr
23090
23091 : see if mach cthreads are available
23092 if test "X$usethreads" = "X$define"; then
23093         set mach/cthreads.h i_machcthr
23094         eval $inhdr
23095 else
23096         i_machcthr="$undef"
23097 fi
23098
23099 : see if this is a mntent.h system
23100 set mntent.h i_mntent
23101 eval $inhdr
23102
23103 : see if net/errno.h is available
23104 val=''
23105 set net/errno.h val
23106 eval $inhdr
23107
23108 : Unfortunately, it causes problems on some systems.  Arrgh.
23109 case "$val" in
23110 $define)
23111         cat > try.c <<'EOM'
23112 #include <stdio.h>
23113 #include <errno.h>
23114 #include <net/errno.h>
23115 int func()
23116 {
23117         return ENOTSOCK;
23118 }
23119 EOM
23120         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23121                 echo "We'll be including <net/errno.h>." >&4
23122         else
23123                 echo "We won't be including <net/errno.h>." >&4
23124                 val="$undef"
23125         fi
23126         $rm_try
23127         ;;
23128 esac
23129 set i_neterrno
23130 eval $setvar
23131
23132 : see if netinet/tcp.h is available
23133 set netinet/tcp.h i_netinettcp
23134 eval $inhdr
23135
23136 : see if this is a poll.h system
23137 set poll.h i_poll
23138 eval $inhdr
23139
23140 : see if this is a prot.h system
23141 set prot.h i_prot
23142 eval $inhdr
23143
23144 : Preprocessor symbols
23145 echo " "
23146 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23147 $cat <<'EOSH' > Cppsym.know
23148 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23149 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23150 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23151 arch_pwr ardent ARM ARM32 atarist att386 att3b
23152 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23153 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23154 byteorder byte_order
23155 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23156 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23157 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23158 ELF encore EPI EXTENSIONS
23159 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23160 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23161 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23162 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23163 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23164 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23165 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23166 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23167 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23168 ksr1
23169 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23170 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23171 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23172 luna88k Lynx
23173 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23174 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23175 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23176 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23177 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23178 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23179 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23180 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23181 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23182 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23183 ns32000 ns32016 ns32332 ns32k nsc32000
23184 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23185 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23186 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23187 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23188 QK_USER QNX
23189 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23190 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23191 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23192 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23193 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23194 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23195 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23196 SYSV4 SYSV5 sysV68 sysV88
23197 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23198 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23199 tower32_800 tower32_850 tss
23200 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23201 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23202 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23203 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23204 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23205 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23206 uxpm uxps
23207 vax venix VMESA vms
23208 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23209 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23210 z8000 zarch
23211 EOSH
23212 # Maybe put other stuff here too.
23213 ./tr '-' '_' <<EOSH >>Cppsym.know
23214 $osname
23215 EOSH
23216 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23217 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23218 $cat Cppsym.know > Cppsym.c
23219 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23220 $rm -f Cppsym.a Cppsym.b Cppsym.c
23221 cat <<EOSH > Cppsym
23222 $startsh
23223 if $test \$# -gt 0; then
23224     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23225     if $test -s Cppsym.got; then
23226         $rm -f Cppsym.got
23227         exit 0
23228     fi
23229     $rm -f Cppsym.got
23230     exit 1
23231 else
23232     $tr " " "$trnl" | ./Cppsym.try
23233     exit 0
23234 fi
23235 EOSH
23236 chmod +x Cppsym
23237 $eunicefix Cppsym
23238 cat <<EOSH > Cppsym.try
23239 $startsh
23240 cat <<'EOCP' > try.c
23241 #include <stdio.h>
23242 #if cpp_stuff == 1
23243 #define STRINGIFY(a)    "a"
23244 #endif
23245 #if cpp_stuff == 42
23246 #define StGiFy(a)  #a
23247 #define STRINGIFY(a)    StGiFy(a)
23248 #endif
23249 #if $cpp_stuff != 1 && $cpp_stuff != 42
23250 #   include "Bletch: How does this C preprocessor stringify macros?"
23251 #endif
23252 int main() {
23253 EOCP
23254 $awk \\
23255 EOSH
23256 cat <<'EOSH' >> Cppsym.try
23257 'length($1) > 0 {
23258     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23259     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23260     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23261     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23262 }'       >> try.c
23263 echo 'return 0;}' >> try.c
23264 EOSH
23265 cat <<EOSH >> Cppsym.try
23266 ccflags="$ccflags"
23267 case "$osname-$gccversion" in
23268 irix-) ccflags="\$ccflags -woff 1178" ;;
23269 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23270 esac
23271 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23272 EOSH
23273 chmod +x Cppsym.try
23274 $eunicefix Cppsym.try
23275 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23276 : Add in any Linux cpp "predefined macros":
23277 case "$osname::$gccversion" in
23278   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23279     tHdrH=_tmpHdr
23280     rm -f $tHdrH'.h' $tHdrH
23281     touch $tHdrH'.h'
23282     # Filter out macro arguments, such as Linux's __INT8_C(c)
23283     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23284        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23285        if [ -s $tHdrH'_cppsym.real' ]; then
23286           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23287        fi
23288     fi
23289     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23290   ;;
23291 esac
23292 : now check the C compiler for additional symbols
23293 postprocess_cc_v=''
23294 case "$osname" in
23295 aix) postprocess_cc_v="|$tr , ' '" ;;
23296 esac
23297 $cat >ccsym <<EOS
23298 $startsh
23299 $cat >tmp.c <<EOF
23300 extern int foo;
23301 EOF
23302 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23303 do
23304         case "\$i" in
23305         -D*) echo "\$i" | $sed 's/^-D//';;
23306         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23307         esac
23308 done
23309 $rm_try
23310 EOS
23311 postprocess_cc_v=''
23312 chmod +x ccsym
23313 $eunicefix ccsym
23314 ./ccsym > ccsym1.raw
23315 if $test -s ccsym1.raw; then
23316     $sort ccsym1.raw | $uniq >ccsym.raw
23317 else
23318     mv ccsym1.raw ccsym.raw
23319 fi
23320
23321 $awk '/\=/ { print $0; next }
23322         { print $0"=1" }' ccsym.raw >ccsym.list
23323 $comm -13 Cppsym.true ccsym.list >ccsym.own
23324 $comm -12 Cppsym.true ccsym.list >ccsym.com
23325 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23326 also=''
23327 if $test -z ccsym.raw; then
23328         echo "Your C compiler doesn't seem to define any symbols!" >&4
23329         echo " "
23330         echo "However, your C preprocessor defines the following symbols:"
23331         $cat Cppsym.true
23332         ccsymbols=''
23333         cppsymbols=`$cat Cppsym.true`
23334         cppsymbols=`echo $cppsymbols`
23335         cppccsymbols="$cppsymbols"
23336 else
23337         if $test -s ccsym.com; then
23338                 echo "Your C compiler and pre-processor define these symbols:"
23339                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23340                 also='also '
23341                 symbols='ones'
23342                 cppccsymbols=`$cat ccsym.com`
23343                 cppccsymbols=`echo $cppccsymbols`
23344                 $test "$silent" || sleep 1
23345         fi
23346         if $test -s ccsym.cpp; then
23347                 $test "$also" && echo " "
23348                 echo "Your C pre-processor ${also}defines the following symbols:"
23349                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23350                 also='further '
23351                 cppsymbols=`$cat ccsym.cpp`
23352                 cppsymbols=`echo $cppsymbols`
23353                 $test "$silent" || sleep 1
23354         fi
23355         if $test -s ccsym.own; then
23356                 $test "$also" && echo " "
23357                 echo "Your C compiler ${also}defines the following cpp symbols:"
23358                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23359                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23360                 ccsymbols=`$cat ccsym.own`
23361                 ccsymbols=`echo $ccsymbols`
23362                 $test "$silent" || sleep 1
23363         fi
23364 fi
23365
23366 : add -D_FORTIFY_SOURCE if feasible and not already there
23367 case "$gccversion" in
23368 [45].*) case "$optimize$ccflags" in
23369         *-O*)   case "$ccflags$cppsymbols" in
23370                 *_FORTIFY_SOURCE=*) # Don't add it again.
23371                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23372                         ;;
23373                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23374                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23375                         ;;
23376                 esac
23377                 ;;
23378         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23379                 ;;
23380         esac
23381         ;;
23382 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23383         ;;
23384 esac
23385
23386 : see if this is a termio system
23387 val="$undef"
23388 val2="$undef"
23389 val3="$undef"
23390 if $test `./findhdr termios.h`; then
23391     set tcsetattr i_termios
23392     eval $inlibc
23393     val3="$i_termios"
23394 fi
23395 echo " "
23396 case "$val3" in
23397     "$define") echo "You have POSIX termios.h... good!" >&4;;
23398     *)  if ./Cppsym pyr; then
23399             case "`$run /bin/universe`" in
23400                 ucb) if $test `./findhdr sgtty.h`; then
23401                         val2="$define"
23402                         echo "<sgtty.h> found." >&4
23403                     else
23404                         echo "System is pyramid with BSD universe."
23405                         ./warn "<sgtty.h> not found--you could have problems."
23406                     fi;;
23407                 *)  if $test `./findhdr termio.h`; then
23408                         val="$define"
23409                         echo "<termio.h> found." >&4
23410                     else
23411                         echo "System is pyramid with USG universe."
23412                         ./warn "<termio.h> not found--you could have problems."
23413                     fi;;
23414             esac
23415         elif ./usg; then
23416             if $test `./findhdr termio.h`; then
23417                 echo "<termio.h> found." >&4
23418                 val="$define"
23419             elif $test `./findhdr sgtty.h`; then
23420                 echo "<sgtty.h> found." >&4
23421                 val2="$define"
23422             else
23423                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23424             fi
23425         else
23426             if $test `./findhdr sgtty.h`; then
23427                 echo "<sgtty.h> found." >&4
23428                 val2="$define"
23429             elif $test `./findhdr termio.h`; then
23430                 echo "<termio.h> found." >&4
23431                 val="$define"
23432             else
23433                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23434             fi
23435         fi;;
23436 esac
23437 set i_termio; eval $setvar
23438 val=$val2; set i_sgtty; eval $setvar
23439 val=$val3; set i_termios; eval $setvar
23440
23441 : see if stdbool is available
23442 : we want a real compile instead of Inhdr because some Solaris systems
23443 : have stdbool.h, but it can only be used if the compiler indicates it
23444 : is sufficiently c99-compliant.
23445 echo " "
23446 $cat >try.c <<EOCP
23447 #include <stdio.h>
23448 #include <stdbool.h>
23449 int func(bool x)
23450 {
23451     return x ? 1 : 0;
23452 }
23453 int main(int argc, char **argv)
23454 {
23455     return func(0);
23456 }
23457 EOCP
23458 set try
23459 if eval $compile; then
23460         echo "<stdbool.h> found." >&4
23461         val="$define"
23462 else
23463         echo "<stdbool.h> NOT found." >&4
23464         val="$undef"
23465 fi
23466 $rm_try
23467 set i_stdbool
23468 eval $setvar
23469
23470 : see if stddef is available
23471 set stddef.h i_stddef
23472 eval $inhdr
23473
23474 : see if stdint is available
23475 set stdint.h i_stdint
23476 eval $inhdr
23477
23478 : see if sys/access.h is available
23479 set sys/access.h i_sysaccess
23480 eval $inhdr
23481
23482 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23483 set sys/filio.h i_sysfilio
23484 eval $inhdr
23485 echo " "
23486 if $test `./findhdr sys/ioctl.h`; then
23487         val="$define"
23488         echo '<sys/ioctl.h> found.' >&4
23489 else
23490         val="$undef"
23491         if $test $i_sysfilio = "$define"; then
23492             echo '<sys/ioctl.h> NOT found.' >&4
23493         else
23494                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23495                 $test $i_termio = "$define" && xxx="termio.h"
23496                 $test $i_termios = "$define" && xxx="termios.h"
23497 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23498         fi
23499 fi
23500 set i_sysioctl
23501 eval $setvar
23502
23503 : see if socket ioctl defs are in sys/sockio.h
23504 echo " "
23505 xxx=`./findhdr sys/sockio.h`
23506 if $test "$xxx"; then
23507         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23508                 val="$define"
23509                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23510         else
23511                 val="$undef"
23512                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23513         fi
23514 else
23515         val="$undef"
23516         $cat <<EOM
23517 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23518 EOM
23519 fi
23520 set i_syssockio
23521 eval $setvar
23522
23523 : see if this is a syslog.h system
23524 set syslog.h i_syslog
23525 eval $inhdr
23526
23527 : see if this is a sys/mode.h system
23528 set sys/mode.h i_sysmode
23529 eval $inhdr
23530
23531 : see if there is a sys/poll.h file
23532 set sys/poll.h i_syspoll
23533 eval $inhdr
23534
23535 : see if sys/resource.h has to be included
23536 set sys/resource.h i_sysresrc
23537 eval $inhdr
23538
23539 : see if sys/security.h is available
23540 set sys/security.h i_syssecrt
23541 eval $inhdr
23542
23543 : see if this is a sys/statvfs.h system
23544 set sys/statvfs.h i_sysstatvfs
23545 eval $inhdr
23546
23547 : see if this is a sys/un.h system
23548 set sys/un.h i_sysun
23549 eval $inhdr
23550
23551 : see if this is a sys/utsname.h system
23552 set sys/utsname.h i_sysutsname
23553 eval $inhdr
23554
23555 : see if this is a syswait system
23556 set sys/wait.h i_syswait
23557 eval $inhdr
23558
23559 : see if this is a ustat.h system
23560 set ustat.h i_ustat
23561 eval $inhdr
23562
23563 : see if this is an utime system
23564 set utime.h i_utime
23565 eval $inhdr
23566
23567 : see if this is a vfork system
23568 case "$d_vfork" in
23569 "$define")
23570         set vfork.h i_vfork
23571         eval $inhdr
23572         ;;
23573 *)
23574         i_vfork="$undef"
23575         ;;
23576 esac
23577
23578 : Check extensions
23579 echo " "
23580 echo "Looking for extensions..." >&4
23581 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23582 : contain old or inaccurate or duplicate values.
23583 nonxs_extensions=''
23584 xs_extensions=''
23585 : We do not use find because it might not be available.
23586 : We do not just use MANIFEST because the user may have dropped
23587 : some additional extensions into the source tree and expect them
23588 : to be built.
23589
23590 : Function to recursively find available extensions, ignoring DynaLoader
23591 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23592 : In 5.10.1 and later, extensions are stored in directories
23593 : like File-Glob instead of the older File/Glob/.
23594 find_extensions='
23595     for xxx in *; do
23596         case "$xxx" in
23597             DynaLoader|dynaload) ;;
23598             *)
23599             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23600             case "$this_ext" in
23601                 Scalar/List/Utils) this_ext="List/Util" ;;
23602                 PathTools)         this_ext="Cwd"       ;;
23603             esac;
23604             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23605             if $contains " $this_ext " "$tdir/$$.tmp"; then
23606                 echo >&4;
23607                 echo "Duplicate directories detected for extension $xxx" >&4;
23608                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23609                 case "$knowitall" in
23610                 "") dflt=y;;
23611                 *) dflt=n;;
23612                 esac;
23613                 . ../UU/myread;
23614                 case "$ans" in
23615                 n*|N*) ;;
23616                 *) echo >&4;
23617                     echo "Ok.  Stopping Configure." >&4;
23618                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23619                     exit 1;;
23620                 esac;
23621                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23622             fi;
23623             $ls -1 "$xxx" > "$tdir/$$.tmp";
23624             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23625                 xs_extensions="$xs_extensions $this_ext";
23626             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23627                 xs_extensions="$xs_extensions $this_ext";
23628             elif $test -d "$xxx"; then
23629                 nonxs_extensions="$nonxs_extensions $this_ext";
23630             fi;
23631             $rm -f "$tdir/$$.tmp";
23632             ;;
23633         esac;
23634     done'
23635 tdir=`pwd`
23636 cd "$rsrc/cpan"
23637 set X
23638 shift
23639 eval $find_extensions
23640 cd "$rsrc/dist"
23641 set X
23642 shift
23643 eval $find_extensions
23644 cd "$rsrc/ext"
23645 set X
23646 shift
23647 eval $find_extensions
23648 set X $xs_extensions
23649 shift
23650 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23651 set X $nonxs_extensions
23652 shift
23653 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23654 cd "$tdir"
23655 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23656
23657 : Now see which are supported on this system.
23658 avail_ext=''
23659 for xxx in $xs_extensions ; do
23660         case "$xxx" in
23661         Amiga*)
23662                 case "$osname" in
23663                 amigaos) avail_ext="$avail_ext $xxx" ;;
23664                 esac
23665                 ;;
23666         DB_File|db_file)
23667                 case "$i_db" in
23668                 $define) avail_ext="$avail_ext $xxx" ;;
23669                 esac
23670                 ;;
23671         GDBM_File|gdbm_fil)
23672                 case "$i_gdbm" in
23673                 $define) avail_ext="$avail_ext $xxx" ;;
23674                 esac
23675                 ;;
23676         I18N/Langinfo|i18n_lan)
23677                 case "$i_langinfo$d_nl_langinfo" in
23678                 $define$define) avail_ext="$avail_ext $xxx" ;;
23679                 esac
23680                 ;;
23681         IPC/SysV|ipc/sysv)
23682                 : XXX Do we need a useipcsysv variable here
23683                 case "${d_msg}${d_sem}${d_shm}" in
23684                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23685                 esac
23686                 ;;
23687         NDBM_File|ndbm_fil)
23688                 case "$d_ndbm" in
23689                 $define)
23690                     case "$osname-$use64bitint" in
23691                     hpux-define)
23692                         case "$libs" in
23693                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23694                         esac
23695                         ;;
23696                     *) avail_ext="$avail_ext $xxx" ;;
23697                     esac
23698                     ;;
23699                 esac
23700                 ;;
23701         ODBM_File|odbm_fil)
23702                 case "${i_dbm}${i_rpcsvcdbm}" in
23703                 *"${define}"*)
23704                     case "$d_cplusplus" in
23705                     define) ;; # delete as a function name will not work
23706                     *)  case "$osname-$use64bitint" in
23707                         hpux-define)
23708                             case "$libs" in
23709                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23710                             esac
23711                             ;;
23712                         *) avail_ext="$avail_ext $xxx" ;;
23713                         esac
23714                         ;;
23715                     esac
23716                     ;;
23717                 esac
23718                 ;;
23719         Opcode|opcode)
23720                 case "$useopcode" in
23721                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23722                 esac
23723                 ;;
23724         POSIX|posix)
23725                 case "$useposix" in
23726                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23727                 esac
23728                 ;;
23729         Socket|socket)
23730                 case "$d_socket" in
23731                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23732                 esac
23733                 ;;
23734         Sys/Syslog|sys/syslog)
23735                 case $osname in
23736                         amigaos) ;; # not really very useful on AmigaOS
23737                         *)
23738                         : XXX syslog requires socket
23739                         case "$d_socket" in
23740                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23741                         esac
23742                         ;;
23743                 esac
23744                 ;;
23745         Thread|thread)
23746                 case "$usethreads" in
23747                 true|$define|y)
23748                         case "$use5005threads" in
23749                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23750                         esac
23751                 esac
23752                 ;;
23753         threads|threads/shared)
23754                 # threads and threads::shared are special cases.
23755                 # To stop people from asking "Perl 5.8.0 was supposed
23756                 # to have this new fancy threads implementation but my
23757                 # perl doesn't have it" and from people trying to
23758                 # (re)install the threads module using CPAN.pm and
23759                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23760                 # the threads.pm and threads/shared.pm will always be
23761                 # there, croaking informatively ("you need to rebuild
23762                 # all of Perl with threads, sorry") when threads haven't
23763                 # been compiled in.
23764                 # --jhi
23765                 avail_ext="$avail_ext $xxx"
23766                 ;;
23767         VMS*)
23768                 ;;
23769         Win32*)
23770                 case "$osname" in
23771                 cygwin) avail_ext="$avail_ext $xxx" ;;
23772                 esac
23773                 ;;
23774         XS/APItest|xs/apitest)
23775                 # This is just for testing.  Skip it unless we have dynamic loading.
23776
23777                 case "$usedl" in
23778                 $define) avail_ext="$avail_ext $xxx" ;;
23779                 esac
23780                 ;;
23781         XS/Typemap|xs/typemap)
23782                 # This is just for testing.  Skip it unless we have dynamic loading.
23783                 case "$usedl" in
23784                 $define) avail_ext="$avail_ext $xxx" ;;
23785                 esac
23786                 ;;
23787         *)      avail_ext="$avail_ext $xxx"
23788                 ;;
23789         esac
23790 done
23791
23792 set X $avail_ext
23793 shift
23794 avail_ext="$*"
23795
23796 case "$onlyextensions" in
23797 '') ;;
23798 *)  keepextensions=''
23799     echo "You have requested that only certain extensions be included..." >&4
23800     for i in $onlyextensions; do
23801         case " $avail_ext " in
23802         *" $i "*)
23803             echo "Keeping extension $i."
23804             keepextensions="$keepextensions $i"
23805             ;;
23806         *) echo "Ignoring extension $i." ;;
23807         esac
23808     done
23809     avail_ext="$keepextensions"
23810     ;;
23811 esac
23812
23813 case "$noextensions" in
23814 '') ;;
23815 *)  keepextensions=''
23816     echo "You have requested that certain extensions be ignored..." >&4
23817     for i in $avail_ext; do
23818         case " $noextensions " in
23819         *" $i "*) echo "Ignoring extension $i." ;;
23820         *) echo "Keeping extension $i.";
23821            keepextensions="$keepextensions $i"
23822            ;;
23823         esac
23824     done
23825     avail_ext="$keepextensions"
23826     ;;
23827 esac
23828
23829 : Now see which nonxs extensions are supported on this system.
23830 : For now assume all are.
23831 nonxs_ext=''
23832 for xxx in $nonxs_extensions ; do
23833         case "$xxx" in
23834         VMS*)
23835                 ;;
23836         *)      nonxs_ext="$nonxs_ext $xxx"
23837                 ;;
23838         esac
23839 done
23840
23841 set X $nonxs_ext
23842 shift
23843 nonxs_ext="$*"
23844
23845 case $usedl in
23846 $define)
23847         $cat <<EOM
23848 A number of extensions are supplied with $package.  You may choose to
23849 compile these extensions for dynamic loading (the default), compile
23850 them into the $package executable (static loading), or not include
23851 them at all.  Answer "none" to include no extensions.
23852 Note that DynaLoader is always built and need not be mentioned here.
23853
23854 EOM
23855         case "$dynamic_ext" in
23856         '')
23857                 : Exclude those listed in static_ext
23858                 dflt=''
23859                 for xxx in $avail_ext; do
23860                         case " $static_ext " in
23861                         *" $xxx "*) ;;
23862                         *) dflt="$dflt $xxx" ;;
23863                         esac
23864                 done
23865                 set X $dflt
23866                 shift
23867                 dflt="$*"
23868                 ;;
23869         *)      dflt="$dynamic_ext"
23870                 # Perhaps we are reusing an old out-of-date config.sh.
23871                 case "$hint" in
23872                 previous)
23873                         if test X"$dynamic_ext" != X"$avail_ext"; then
23874                                 $cat <<EOM
23875 NOTICE:  Your previous config.sh list may be incorrect.
23876 The extensions now available to you are
23877         ${avail_ext}
23878 but the default list from your previous config.sh is
23879         ${dynamic_ext}
23880
23881 EOM
23882                         fi
23883                         ;;
23884                 esac
23885                 ;;
23886         esac
23887         case "$dflt" in
23888         '')     dflt=none;;
23889         esac
23890         rp="What extensions do you wish to load dynamically?"
23891         . ./myread
23892         case "$ans" in
23893         none) dynamic_ext=' ' ;;
23894         *) dynamic_ext="$ans" ;;
23895         esac
23896
23897         case "$static_ext" in
23898         '')
23899                 : Exclude those already listed in dynamic linking
23900                 dflt=''
23901                 for xxx in $avail_ext; do
23902                         case " $dynamic_ext " in
23903                         *" $xxx "*) ;;
23904                         *) dflt="$dflt $xxx" ;;
23905                         esac
23906                 done
23907                 set X $dflt
23908                 shift
23909                 dflt="$*"
23910                 ;;
23911         *)  dflt="$static_ext"
23912                 ;;
23913         esac
23914
23915         case "$dflt" in
23916         '')     dflt=none;;
23917         esac
23918         rp="What extensions do you wish to load statically?"
23919         . ./myread
23920         case "$ans" in
23921         none) static_ext=' ' ;;
23922         *) static_ext="$ans" ;;
23923         esac
23924         ;;
23925 *)
23926         $cat <<EOM
23927 A number of extensions are supplied with $package.  Answer "none"
23928 to include no extensions.
23929 Note that DynaLoader is always built and need not be mentioned here.
23930
23931 EOM
23932         case "$static_ext" in
23933         '') dflt="$avail_ext" ;;
23934         *)      dflt="$static_ext"
23935                 # Perhaps we are reusing an old out-of-date config.sh.
23936                 case "$hint" in
23937                 previous)
23938                         if test X"$static_ext" != X"$avail_ext"; then
23939                                 $cat <<EOM
23940 NOTICE:  Your previous config.sh list may be incorrect.
23941 The extensions now available to you are
23942         ${avail_ext}
23943 but the default list from your previous config.sh is
23944         ${static_ext}
23945
23946 EOM
23947                         fi
23948                         ;;
23949                 esac
23950                 ;;
23951         esac
23952         : Exclude those that are not xs extensions
23953         case "$dflt" in
23954         '')     dflt=none;;
23955         esac
23956         rp="What extensions do you wish to include?"
23957         . ./myread
23958         case "$ans" in
23959         none) static_ext=' ' ;;
23960         *) static_ext="$ans" ;;
23961         esac
23962         ;;
23963 esac
23964 #
23965 # Encode is a special case.  If we are building Encode as a static
23966 # extension, we need to explicitly list its subextensions as well.
23967 # For other nested extensions, this is handled automatically by
23968 # the appropriate Makefile.PL.
23969 case " $static_ext " in
23970         *" Encode "*) # Add the subextensions of Encode
23971         cd "$rsrc/cpan"
23972         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23973                 static_ext="$static_ext Encode/$xxx"
23974                 known_extensions="$known_extensions Encode/$xxx"
23975         done
23976         cd "$tdir"
23977         ;;
23978 esac
23979
23980 set X $dynamic_ext $static_ext $nonxs_ext
23981 shift
23982 extensions="$*"
23983
23984 # Sanity check:  We require an extension suitable for use with
23985 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23986 # should show up as failures in the test suite, but it's helpful to
23987 # catch them now.) The 'extensions' list is normally sorted
23988 # alphabetically, so we need to accept either
23989 #    DB_File ... Fcntl ... IO  ....
23990 # or something like
23991 #    Fcntl ... NDBM_File ... IO  ....
23992 case " $extensions"  in
23993 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23994 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23995 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23996 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23997    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23998    ;;
23999 esac
24000
24001 : Remove libraries needed only for extensions
24002 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24003 : The exception is SunOS 4.x, which needs them.
24004 case "${osname}X${osvers}" in
24005 sunos*X4*)
24006     perllibs="$libs"
24007     ;;
24008 *) case "$usedl" in
24009     $define|true|[yY]*)
24010             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24011             shift
24012             perllibs="$*"
24013             ;;
24014     *)  perllibs="$libs"
24015             ;;
24016     esac
24017     ;;
24018 esac
24019
24020 : Remove build directory name from cppstdin so it can be used from
24021 : either the present location or the final installed location.
24022 echo " "
24023 : Get out of the UU directory to get correct path name.
24024 cd ..
24025 case "$cppstdin" in
24026 `pwd`/cppstdin)
24027         echo "Stripping down cppstdin path name"
24028         cppstdin=cppstdin
24029         ;;
24030 esac
24031 cd UU
24032
24033 : end of configuration questions
24034 echo " "
24035 echo "End of configuration questions."
24036 echo " "
24037
24038 : back to where it started
24039 if test -d ../UU; then
24040         cd ..
24041 fi
24042
24043 : configuration may be unconditionally patched via a 'config.arch' file
24044 if $test -f config.arch; then
24045         echo "I see a config.arch file, loading it." >&4
24046         . ./config.arch
24047 fi
24048
24049 : configuration may be patched via a 'config.over' file
24050 if $test -f config.over; then
24051         echo " "
24052         dflt=y
24053         rp='I see a config.over file.  Do you wish to load it?'
24054         . UU/myread
24055         case "$ans" in
24056         n*) echo "OK, I'll ignore it.";;
24057         *)      . ./config.over
24058                 echo "Configuration override changes have been loaded."
24059                 ;;
24060         esac
24061 fi
24062
24063 : in case they want portability, strip down executable paths
24064 case "$d_portable" in
24065 "$define")
24066         echo " "
24067         echo "Stripping down executable paths..." >&4
24068         for file in $loclist $trylist; do
24069                 eval temp=\$$file
24070                 eval $file=`basename $temp`
24071         done
24072         ;;
24073 esac
24074
24075 : create config.sh file
24076 echo " "
24077 echo "Creating config.sh..." >&4
24078 $spitshell <<EOT >config.sh
24079 $startsh
24080 #
24081 # This file was produced by running the Configure script. It holds all the
24082 # definitions figured out by Configure. Should you modify one of these values,
24083 # do not forget to propagate your changes by running "Configure -der". You may
24084 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24085 #
24086
24087 # Package name      : $package
24088 # Source directory  : $src
24089 # Configuration time: $cf_time
24090 # Configured by     : $cf_by
24091 # Target system     : $myuname
24092
24093 EOT
24094 : Add in command line options if available
24095 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24096
24097 $spitshell <<EOT >>config.sh
24098
24099 Author='$Author'
24100 Date='$Date'
24101 Header='$Header'
24102 Id='$Id'
24103 Locker='$Locker'
24104 Log='$Log'
24105 RCSfile='$RCSfile'
24106 Revision='$Revision'
24107 Source='$Source'
24108 State='$State'
24109 _a='$_a'
24110 _exe='$_exe'
24111 _o='$_o'
24112 afs='$afs'
24113 afsroot='$afsroot'
24114 alignbytes='$alignbytes'
24115 ansi2knr='$ansi2knr'
24116 aphostname='$aphostname'
24117 api_revision='$api_revision'
24118 api_subversion='$api_subversion'
24119 api_version='$api_version'
24120 api_versionstring='$api_versionstring'
24121 ar='$ar'
24122 archlib='$archlib'
24123 archlibexp='$archlibexp'
24124 archname64='$archname64'
24125 archname='$archname'
24126 archobjs='$archobjs'
24127 asctime_r_proto='$asctime_r_proto'
24128 awk='$awk'
24129 baserev='$baserev'
24130 bash='$bash'
24131 bin='$bin'
24132 bin_ELF='$bin_ELF'
24133 binexp='$binexp'
24134 bison='$bison'
24135 byacc='$byacc'
24136 byteorder='$byteorder'
24137 c='$c'
24138 castflags='$castflags'
24139 cat='$cat'
24140 cc='$cc'
24141 cccdlflags='$cccdlflags'
24142 ccdlflags='$ccdlflags'
24143 ccflags='$ccflags'
24144 ccflags_uselargefiles='$ccflags_uselargefiles'
24145 ccname='$ccname'
24146 ccsymbols='$ccsymbols'
24147 ccversion='$ccversion'
24148 cf_by='$cf_by'
24149 cf_email='$cf_email'
24150 cf_time='$cf_time'
24151 charbits='$charbits'
24152 charsize='$charsize'
24153 chgrp='$chgrp'
24154 chmod='$chmod'
24155 chown='$chown'
24156 clocktype='$clocktype'
24157 comm='$comm'
24158 compress='$compress'
24159 contains='$contains'
24160 cp='$cp'
24161 cpio='$cpio'
24162 cpp='$cpp'
24163 cpp_stuff='$cpp_stuff'
24164 cppccsymbols='$cppccsymbols'
24165 cppflags='$cppflags'
24166 cpplast='$cpplast'
24167 cppminus='$cppminus'
24168 cpprun='$cpprun'
24169 cppstdin='$cppstdin'
24170 cppsymbols='$cppsymbols'
24171 crypt_r_proto='$crypt_r_proto'
24172 cryptlib='$cryptlib'
24173 csh='$csh'
24174 ctermid_r_proto='$ctermid_r_proto'
24175 ctime_r_proto='$ctime_r_proto'
24176 d_Gconvert='$d_Gconvert'
24177 d_PRIEUldbl='$d_PRIEUldbl'
24178 d_PRIFUldbl='$d_PRIFUldbl'
24179 d_PRIGUldbl='$d_PRIGUldbl'
24180 d_PRIXU64='$d_PRIXU64'
24181 d_PRId64='$d_PRId64'
24182 d_PRIeldbl='$d_PRIeldbl'
24183 d_PRIfldbl='$d_PRIfldbl'
24184 d_PRIgldbl='$d_PRIgldbl'
24185 d_PRIi64='$d_PRIi64'
24186 d_PRIo64='$d_PRIo64'
24187 d_PRIu64='$d_PRIu64'
24188 d_PRIx64='$d_PRIx64'
24189 d_SCNfldbl='$d_SCNfldbl'
24190 d__fwalk='$d__fwalk'
24191 d_access='$d_access'
24192 d_accessx='$d_accessx'
24193 d_acosh='$d_acosh'
24194 d_aintl='$d_aintl'
24195 d_alarm='$d_alarm'
24196 d_archlib='$d_archlib'
24197 d_asctime64='$d_asctime64'
24198 d_asctime_r='$d_asctime_r'
24199 d_asinh='$d_asinh'
24200 d_atanh='$d_atanh'
24201 d_atolf='$d_atolf'
24202 d_atoll='$d_atoll'
24203 d_attribute_deprecated='$d_attribute_deprecated'
24204 d_attribute_format='$d_attribute_format'
24205 d_attribute_malloc='$d_attribute_malloc'
24206 d_attribute_nonnull='$d_attribute_nonnull'
24207 d_attribute_noreturn='$d_attribute_noreturn'
24208 d_attribute_pure='$d_attribute_pure'
24209 d_attribute_unused='$d_attribute_unused'
24210 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24211 d_backtrace='$d_backtrace'
24212 d_bcmp='$d_bcmp'
24213 d_bcopy='$d_bcopy'
24214 d_bsd='$d_bsd'
24215 d_bsdgetpgrp='$d_bsdgetpgrp'
24216 d_bsdsetpgrp='$d_bsdsetpgrp'
24217 d_builtin_choose_expr='$d_builtin_choose_expr'
24218 d_builtin_expect='$d_builtin_expect'
24219 d_bzero='$d_bzero'
24220 d_c99_variadic_macros='$d_c99_variadic_macros'
24221 d_casti32='$d_casti32'
24222 d_castneg='$d_castneg'
24223 d_cbrt='$d_cbrt'
24224 d_charvspr='$d_charvspr'
24225 d_chown='$d_chown'
24226 d_chroot='$d_chroot'
24227 d_chsize='$d_chsize'
24228 d_class='$d_class'
24229 d_clearenv='$d_clearenv'
24230 d_closedir='$d_closedir'
24231 d_cmsghdr_s='$d_cmsghdr_s'
24232 d_const='$d_const'
24233 d_copysign='$d_copysign'
24234 d_copysignl='$d_copysignl'
24235 d_cplusplus='$d_cplusplus'
24236 d_crypt='$d_crypt'
24237 d_crypt_r='$d_crypt_r'
24238 d_csh='$d_csh'
24239 d_ctermid='$d_ctermid'
24240 d_ctermid_r='$d_ctermid_r'
24241 d_ctime64='$d_ctime64'
24242 d_ctime_r='$d_ctime_r'
24243 d_cuserid='$d_cuserid'
24244 d_dbl_dig='$d_dbl_dig'
24245 d_dbminitproto='$d_dbminitproto'
24246 d_difftime64='$d_difftime64'
24247 d_difftime='$d_difftime'
24248 d_dir_dd_fd='$d_dir_dd_fd'
24249 d_dirfd='$d_dirfd'
24250 d_dirnamlen='$d_dirnamlen'
24251 d_dladdr='$d_dladdr'
24252 d_dlerror='$d_dlerror'
24253 d_dlopen='$d_dlopen'
24254 d_dlsymun='$d_dlsymun'
24255 d_dosuid='$d_dosuid'
24256 d_drand48_r='$d_drand48_r'
24257 d_drand48proto='$d_drand48proto'
24258 d_dup2='$d_dup2'
24259 d_duplocale='$d_duplocale'
24260 d_eaccess='$d_eaccess'
24261 d_endgrent='$d_endgrent'
24262 d_endgrent_r='$d_endgrent_r'
24263 d_endhent='$d_endhent'
24264 d_endhostent_r='$d_endhostent_r'
24265 d_endnent='$d_endnent'
24266 d_endnetent_r='$d_endnetent_r'
24267 d_endpent='$d_endpent'
24268 d_endprotoent_r='$d_endprotoent_r'
24269 d_endpwent='$d_endpwent'
24270 d_endpwent_r='$d_endpwent_r'
24271 d_endsent='$d_endsent'
24272 d_endservent_r='$d_endservent_r'
24273 d_eofnblk='$d_eofnblk'
24274 d_erf='$d_erf'
24275 d_erfc='$d_erfc'
24276 d_eunice='$d_eunice'
24277 d_exp2='$d_exp2'
24278 d_expm1='$d_expm1'
24279 d_faststdio='$d_faststdio'
24280 d_fchdir='$d_fchdir'
24281 d_fchmod='$d_fchmod'
24282 d_fchown='$d_fchown'
24283 d_fcntl='$d_fcntl'
24284 d_fcntl_can_lock='$d_fcntl_can_lock'
24285 d_fd_macros='$d_fd_macros'
24286 d_fd_set='$d_fd_set'
24287 d_fdclose='$d_fdclose'
24288 d_fdim='$d_fdim'
24289 d_fds_bits='$d_fds_bits'
24290 d_fegetround='$d_fegetround'
24291 d_fgetpos='$d_fgetpos'
24292 d_finite='$d_finite'
24293 d_finitel='$d_finitel'
24294 d_flexfnam='$d_flexfnam'
24295 d_flock='$d_flock'
24296 d_flockproto='$d_flockproto'
24297 d_fma='$d_fma'
24298 d_fmax='$d_fmax'
24299 d_fmin='$d_fmin'
24300 d_fork='$d_fork'
24301 d_fp_class='$d_fp_class'
24302 d_fp_classify='$d_fp_classify'
24303 d_fp_classl='$d_fp_classl'
24304 d_fpathconf='$d_fpathconf'
24305 d_fpclass='$d_fpclass'
24306 d_fpclassify='$d_fpclassify'
24307 d_fpclassl='$d_fpclassl'
24308 d_fpgetround='$d_fpgetround'
24309 d_fpos64_t='$d_fpos64_t'
24310 d_freelocale='$d_freelocale'
24311 d_frexpl='$d_frexpl'
24312 d_fs_data_s='$d_fs_data_s'
24313 d_fseeko='$d_fseeko'
24314 d_fsetpos='$d_fsetpos'
24315 d_fstatfs='$d_fstatfs'
24316 d_fstatvfs='$d_fstatvfs'
24317 d_fsync='$d_fsync'
24318 d_ftello='$d_ftello'
24319 d_ftime='$d_ftime'
24320 d_futimes='$d_futimes'
24321 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24322 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24323 d_getaddrinfo='$d_getaddrinfo'
24324 d_getcwd='$d_getcwd'
24325 d_getespwnam='$d_getespwnam'
24326 d_getfsstat='$d_getfsstat'
24327 d_getgrent='$d_getgrent'
24328 d_getgrent_r='$d_getgrent_r'
24329 d_getgrgid_r='$d_getgrgid_r'
24330 d_getgrnam_r='$d_getgrnam_r'
24331 d_getgrps='$d_getgrps'
24332 d_gethbyaddr='$d_gethbyaddr'
24333 d_gethbyname='$d_gethbyname'
24334 d_gethent='$d_gethent'
24335 d_gethname='$d_gethname'
24336 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24337 d_gethostbyname_r='$d_gethostbyname_r'
24338 d_gethostent_r='$d_gethostent_r'
24339 d_gethostprotos='$d_gethostprotos'
24340 d_getitimer='$d_getitimer'
24341 d_getlogin='$d_getlogin'
24342 d_getlogin_r='$d_getlogin_r'
24343 d_getmnt='$d_getmnt'
24344 d_getmntent='$d_getmntent'
24345 d_getnameinfo='$d_getnameinfo'
24346 d_getnbyaddr='$d_getnbyaddr'
24347 d_getnbyname='$d_getnbyname'
24348 d_getnent='$d_getnent'
24349 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24350 d_getnetbyname_r='$d_getnetbyname_r'
24351 d_getnetent_r='$d_getnetent_r'
24352 d_getnetprotos='$d_getnetprotos'
24353 d_getpagsz='$d_getpagsz'
24354 d_getpbyname='$d_getpbyname'
24355 d_getpbynumber='$d_getpbynumber'
24356 d_getpent='$d_getpent'
24357 d_getpgid='$d_getpgid'
24358 d_getpgrp2='$d_getpgrp2'
24359 d_getpgrp='$d_getpgrp'
24360 d_getppid='$d_getppid'
24361 d_getprior='$d_getprior'
24362 d_getprotobyname_r='$d_getprotobyname_r'
24363 d_getprotobynumber_r='$d_getprotobynumber_r'
24364 d_getprotoent_r='$d_getprotoent_r'
24365 d_getprotoprotos='$d_getprotoprotos'
24366 d_getprpwnam='$d_getprpwnam'
24367 d_getpwent='$d_getpwent'
24368 d_getpwent_r='$d_getpwent_r'
24369 d_getpwnam_r='$d_getpwnam_r'
24370 d_getpwuid_r='$d_getpwuid_r'
24371 d_getsbyname='$d_getsbyname'
24372 d_getsbyport='$d_getsbyport'
24373 d_getsent='$d_getsent'
24374 d_getservbyname_r='$d_getservbyname_r'
24375 d_getservbyport_r='$d_getservbyport_r'
24376 d_getservent_r='$d_getservent_r'
24377 d_getservprotos='$d_getservprotos'
24378 d_getspnam='$d_getspnam'
24379 d_getspnam_r='$d_getspnam_r'
24380 d_gettimeod='$d_gettimeod'
24381 d_gmtime64='$d_gmtime64'
24382 d_gmtime_r='$d_gmtime_r'
24383 d_gnulibc='$d_gnulibc'
24384 d_grpasswd='$d_grpasswd'
24385 d_hasmntopt='$d_hasmntopt'
24386 d_htonl='$d_htonl'
24387 d_hypot='$d_hypot'
24388 d_ilogb='$d_ilogb'
24389 d_ilogbl='$d_ilogbl'
24390 d_inc_version_list='$d_inc_version_list'
24391 d_index='$d_index'
24392 d_inetaton='$d_inetaton'
24393 d_inetntop='$d_inetntop'
24394 d_inetpton='$d_inetpton'
24395 d_int64_t='$d_int64_t'
24396 d_ip_mreq='$d_ip_mreq'
24397 d_ip_mreq_source='$d_ip_mreq_source'
24398 d_ipv6_mreq='$d_ipv6_mreq'
24399 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24400 d_isascii='$d_isascii'
24401 d_isblank='$d_isblank'
24402 d_isfinite='$d_isfinite'
24403 d_isfinitel='$d_isfinitel'
24404 d_isinf='$d_isinf'
24405 d_isinfl='$d_isinfl'
24406 d_isless='$d_isless'
24407 d_isnan='$d_isnan'
24408 d_isnanl='$d_isnanl'
24409 d_isnormal='$d_isnormal'
24410 d_j0='$d_j0'
24411 d_j0l='$d_j0l'
24412 d_killpg='$d_killpg'
24413 d_lc_monetary_2008='$d_lc_monetary_2008'
24414 d_lchown='$d_lchown'
24415 d_ldbl_dig='$d_ldbl_dig'
24416 d_ldexpl='$d_ldexpl'
24417 d_lgamma='$d_lgamma'
24418 d_lgamma_r='$d_lgamma_r'
24419 d_libm_lib_version='$d_libm_lib_version'
24420 d_libname_unique='$d_libname_unique'
24421 d_link='$d_link'
24422 d_llrint='$d_llrint'
24423 d_llrintl='$d_llrintl'
24424 d_llround='$d_llround'
24425 d_llroundl='$d_llroundl'
24426 d_localtime64='$d_localtime64'
24427 d_localtime_r='$d_localtime_r'
24428 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24429 d_locconv='$d_locconv'
24430 d_lockf='$d_lockf'
24431 d_log1p='$d_log1p'
24432 d_log2='$d_log2'
24433 d_logb='$d_logb'
24434 d_longdbl='$d_longdbl'
24435 d_longlong='$d_longlong'
24436 d_lrint='$d_lrint'
24437 d_lrintl='$d_lrintl'
24438 d_lround='$d_lround'
24439 d_lroundl='$d_lroundl'
24440 d_lseekproto='$d_lseekproto'
24441 d_lstat='$d_lstat'
24442 d_madvise='$d_madvise'
24443 d_malloc_good_size='$d_malloc_good_size'
24444 d_malloc_size='$d_malloc_size'
24445 d_mblen='$d_mblen'
24446 d_mbstowcs='$d_mbstowcs'
24447 d_mbtowc='$d_mbtowc'
24448 d_memchr='$d_memchr'
24449 d_memcmp='$d_memcmp'
24450 d_memcpy='$d_memcpy'
24451 d_memmem='$d_memmem'
24452 d_memmove='$d_memmove'
24453 d_memset='$d_memset'
24454 d_mkdir='$d_mkdir'
24455 d_mkdtemp='$d_mkdtemp'
24456 d_mkfifo='$d_mkfifo'
24457 d_mkstemp='$d_mkstemp'
24458 d_mkstemps='$d_mkstemps'
24459 d_mktime64='$d_mktime64'
24460 d_mktime='$d_mktime'
24461 d_mmap='$d_mmap'
24462 d_modfl='$d_modfl'
24463 d_modflproto='$d_modflproto'
24464 d_mprotect='$d_mprotect'
24465 d_msg='$d_msg'
24466 d_msg_ctrunc='$d_msg_ctrunc'
24467 d_msg_dontroute='$d_msg_dontroute'
24468 d_msg_oob='$d_msg_oob'
24469 d_msg_peek='$d_msg_peek'
24470 d_msg_proxy='$d_msg_proxy'
24471 d_msgctl='$d_msgctl'
24472 d_msgget='$d_msgget'
24473 d_msghdr_s='$d_msghdr_s'
24474 d_msgrcv='$d_msgrcv'
24475 d_msgsnd='$d_msgsnd'
24476 d_msync='$d_msync'
24477 d_munmap='$d_munmap'
24478 d_mymalloc='$d_mymalloc'
24479 d_nan='$d_nan'
24480 d_ndbm='$d_ndbm'
24481 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24482 d_nearbyint='$d_nearbyint'
24483 d_newlocale='$d_newlocale'
24484 d_nextafter='$d_nextafter'
24485 d_nexttoward='$d_nexttoward'
24486 d_nice='$d_nice'
24487 d_nl_langinfo='$d_nl_langinfo'
24488 d_nv_preserves_uv='$d_nv_preserves_uv'
24489 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24490 d_off64_t='$d_off64_t'
24491 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24492 d_oldpthreads='$d_oldpthreads'
24493 d_oldsock='$d_oldsock'
24494 d_open3='$d_open3'
24495 d_pathconf='$d_pathconf'
24496 d_pause='$d_pause'
24497 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24498 d_phostname='$d_phostname'
24499 d_pipe='$d_pipe'
24500 d_poll='$d_poll'
24501 d_portable='$d_portable'
24502 d_prctl='$d_prctl'
24503 d_prctl_set_name='$d_prctl_set_name'
24504 d_printf_format_null='$d_printf_format_null'
24505 d_procselfexe='$d_procselfexe'
24506 d_pseudofork='$d_pseudofork'
24507 d_pthread_atfork='$d_pthread_atfork'
24508 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24509 d_pthread_yield='$d_pthread_yield'
24510 d_ptrdiff_t='$d_ptrdiff_t'
24511 d_pwage='$d_pwage'
24512 d_pwchange='$d_pwchange'
24513 d_pwclass='$d_pwclass'
24514 d_pwcomment='$d_pwcomment'
24515 d_pwexpire='$d_pwexpire'
24516 d_pwgecos='$d_pwgecos'
24517 d_pwpasswd='$d_pwpasswd'
24518 d_pwquota='$d_pwquota'
24519 d_qgcvt='$d_qgcvt'
24520 d_quad='$d_quad'
24521 d_random_r='$d_random_r'
24522 d_re_comp='$d_re_comp'
24523 d_readdir64_r='$d_readdir64_r'
24524 d_readdir='$d_readdir'
24525 d_readdir_r='$d_readdir_r'
24526 d_readlink='$d_readlink'
24527 d_readv='$d_readv'
24528 d_recvmsg='$d_recvmsg'
24529 d_regcmp='$d_regcmp'
24530 d_regcomp='$d_regcomp'
24531 d_remainder='$d_remainder'
24532 d_remquo='$d_remquo'
24533 d_rename='$d_rename'
24534 d_rewinddir='$d_rewinddir'
24535 d_rint='$d_rint'
24536 d_rmdir='$d_rmdir'
24537 d_round='$d_round'
24538 d_safebcpy='$d_safebcpy'
24539 d_safemcpy='$d_safemcpy'
24540 d_sanemcmp='$d_sanemcmp'
24541 d_sbrkproto='$d_sbrkproto'
24542 d_scalbn='$d_scalbn'
24543 d_scalbnl='$d_scalbnl'
24544 d_sched_yield='$d_sched_yield'
24545 d_scm_rights='$d_scm_rights'
24546 d_seekdir='$d_seekdir'
24547 d_select='$d_select'
24548 d_sem='$d_sem'
24549 d_semctl='$d_semctl'
24550 d_semctl_semid_ds='$d_semctl_semid_ds'
24551 d_semctl_semun='$d_semctl_semun'
24552 d_semget='$d_semget'
24553 d_semop='$d_semop'
24554 d_sendmsg='$d_sendmsg'
24555 d_setegid='$d_setegid'
24556 d_seteuid='$d_seteuid'
24557 d_setgrent='$d_setgrent'
24558 d_setgrent_r='$d_setgrent_r'
24559 d_setgrps='$d_setgrps'
24560 d_sethent='$d_sethent'
24561 d_sethostent_r='$d_sethostent_r'
24562 d_setitimer='$d_setitimer'
24563 d_setlinebuf='$d_setlinebuf'
24564 d_setlocale='$d_setlocale'
24565 d_setlocale_r='$d_setlocale_r'
24566 d_setnent='$d_setnent'
24567 d_setnetent_r='$d_setnetent_r'
24568 d_setpent='$d_setpent'
24569 d_setpgid='$d_setpgid'
24570 d_setpgrp2='$d_setpgrp2'
24571 d_setpgrp='$d_setpgrp'
24572 d_setprior='$d_setprior'
24573 d_setproctitle='$d_setproctitle'
24574 d_setprotoent_r='$d_setprotoent_r'
24575 d_setpwent='$d_setpwent'
24576 d_setpwent_r='$d_setpwent_r'
24577 d_setregid='$d_setregid'
24578 d_setresgid='$d_setresgid'
24579 d_setresuid='$d_setresuid'
24580 d_setreuid='$d_setreuid'
24581 d_setrgid='$d_setrgid'
24582 d_setruid='$d_setruid'
24583 d_setsent='$d_setsent'
24584 d_setservent_r='$d_setservent_r'
24585 d_setsid='$d_setsid'
24586 d_setvbuf='$d_setvbuf'
24587 d_shm='$d_shm'
24588 d_shmat='$d_shmat'
24589 d_shmatprototype='$d_shmatprototype'
24590 d_shmctl='$d_shmctl'
24591 d_shmdt='$d_shmdt'
24592 d_shmget='$d_shmget'
24593 d_sigaction='$d_sigaction'
24594 d_siginfo_si_addr='$d_siginfo_si_addr'
24595 d_siginfo_si_band='$d_siginfo_si_band'
24596 d_siginfo_si_errno='$d_siginfo_si_errno'
24597 d_siginfo_si_fd='$d_siginfo_si_fd'
24598 d_siginfo_si_pid='$d_siginfo_si_pid'
24599 d_siginfo_si_status='$d_siginfo_si_status'
24600 d_siginfo_si_uid='$d_siginfo_si_uid'
24601 d_siginfo_si_value='$d_siginfo_si_value'
24602 d_signbit='$d_signbit'
24603 d_sigprocmask='$d_sigprocmask'
24604 d_sigsetjmp='$d_sigsetjmp'
24605 d_sin6_scope_id='$d_sin6_scope_id'
24606 d_sitearch='$d_sitearch'
24607 d_snprintf='$d_snprintf'
24608 d_sockaddr_in6='$d_sockaddr_in6'
24609 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24610 d_sockatmark='$d_sockatmark'
24611 d_sockatmarkproto='$d_sockatmarkproto'
24612 d_socket='$d_socket'
24613 d_socklen_t='$d_socklen_t'
24614 d_sockpair='$d_sockpair'
24615 d_socks5_init='$d_socks5_init'
24616 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24617 d_sqrtl='$d_sqrtl'
24618 d_srand48_r='$d_srand48_r'
24619 d_srandom_r='$d_srandom_r'
24620 d_sresgproto='$d_sresgproto'
24621 d_sresuproto='$d_sresuproto'
24622 d_stat='$d_stat'
24623 d_statblks='$d_statblks'
24624 d_statfs_f_flags='$d_statfs_f_flags'
24625 d_statfs_s='$d_statfs_s'
24626 d_static_inline='$d_static_inline'
24627 d_statvfs='$d_statvfs'
24628 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24629 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24630 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24631 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24632 d_stdio_stream_array='$d_stdio_stream_array'
24633 d_stdiobase='$d_stdiobase'
24634 d_stdstdio='$d_stdstdio'
24635 d_strchr='$d_strchr'
24636 d_strcoll='$d_strcoll'
24637 d_strctcpy='$d_strctcpy'
24638 d_strerrm='$d_strerrm'
24639 d_strerror='$d_strerror'
24640 d_strerror_r='$d_strerror_r'
24641 d_strftime='$d_strftime'
24642 d_strlcat='$d_strlcat'
24643 d_strlcpy='$d_strlcpy'
24644 d_strtod='$d_strtod'
24645 d_strtol='$d_strtol'
24646 d_strtold='$d_strtold'
24647 d_strtoll='$d_strtoll'
24648 d_strtoq='$d_strtoq'
24649 d_strtoul='$d_strtoul'
24650 d_strtoull='$d_strtoull'
24651 d_strtouq='$d_strtouq'
24652 d_strxfrm='$d_strxfrm'
24653 d_suidsafe='$d_suidsafe'
24654 d_symlink='$d_symlink'
24655 d_syscall='$d_syscall'
24656 d_syscallproto='$d_syscallproto'
24657 d_sysconf='$d_sysconf'
24658 d_sysernlst='$d_sysernlst'
24659 d_syserrlst='$d_syserrlst'
24660 d_system='$d_system'
24661 d_tcgetpgrp='$d_tcgetpgrp'
24662 d_tcsetpgrp='$d_tcsetpgrp'
24663 d_telldir='$d_telldir'
24664 d_telldirproto='$d_telldirproto'
24665 d_tgamma='$d_tgamma'
24666 d_time='$d_time'
24667 d_timegm='$d_timegm'
24668 d_times='$d_times'
24669 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24670 d_tm_tm_zone='$d_tm_tm_zone'
24671 d_tmpnam_r='$d_tmpnam_r'
24672 d_trunc='$d_trunc'
24673 d_truncate='$d_truncate'
24674 d_truncl='$d_truncl'
24675 d_ttyname_r='$d_ttyname_r'
24676 d_tzname='$d_tzname'
24677 d_u32align='$d_u32align'
24678 d_ualarm='$d_ualarm'
24679 d_umask='$d_umask'
24680 d_uname='$d_uname'
24681 d_union_semun='$d_union_semun'
24682 d_unordered='$d_unordered'
24683 d_unsetenv='$d_unsetenv'
24684 d_uselocale='$d_uselocale'
24685 d_usleep='$d_usleep'
24686 d_usleepproto='$d_usleepproto'
24687 d_ustat='$d_ustat'
24688 d_vendorarch='$d_vendorarch'
24689 d_vendorbin='$d_vendorbin'
24690 d_vendorlib='$d_vendorlib'
24691 d_vendorscript='$d_vendorscript'
24692 d_vfork='$d_vfork'
24693 d_void_closedir='$d_void_closedir'
24694 d_voidsig='$d_voidsig'
24695 d_voidtty='$d_voidtty'
24696 d_volatile='$d_volatile'
24697 d_vprintf='$d_vprintf'
24698 d_vsnprintf='$d_vsnprintf'
24699 d_wait4='$d_wait4'
24700 d_waitpid='$d_waitpid'
24701 d_wcscmp='$d_wcscmp'
24702 d_wcstombs='$d_wcstombs'
24703 d_wcsxfrm='$d_wcsxfrm'
24704 d_wctomb='$d_wctomb'
24705 d_writev='$d_writev'
24706 d_xenix='$d_xenix'
24707 date='$date'
24708 db_hashtype='$db_hashtype'
24709 db_prefixtype='$db_prefixtype'
24710 db_version_major='$db_version_major'
24711 db_version_minor='$db_version_minor'
24712 db_version_patch='$db_version_patch'
24713 direntrytype='$direntrytype'
24714 dlext='$dlext'
24715 dlsrc='$dlsrc'
24716 doubleinfbytes='$doubleinfbytes'
24717 doublekind='$doublekind'
24718 doublemantbits='$doublemantbits'
24719 doublenanbytes='$doublenanbytes'
24720 doublesize='$doublesize'
24721 drand01='$drand01'
24722 drand48_r_proto='$drand48_r_proto'
24723 dtrace='$dtrace'
24724 dtraceobject='$dtraceobject'
24725 dynamic_ext='$dynamic_ext'
24726 eagain='$eagain'
24727 ebcdic='$ebcdic'
24728 echo='$echo'
24729 egrep='$egrep'
24730 emacs='$emacs'
24731 endgrent_r_proto='$endgrent_r_proto'
24732 endhostent_r_proto='$endhostent_r_proto'
24733 endnetent_r_proto='$endnetent_r_proto'
24734 endprotoent_r_proto='$endprotoent_r_proto'
24735 endpwent_r_proto='$endpwent_r_proto'
24736 endservent_r_proto='$endservent_r_proto'
24737 eunicefix='$eunicefix'
24738 exe_ext='$exe_ext'
24739 expr='$expr'
24740 extensions='$extensions'
24741 extern_C='$extern_C'
24742 extras='$extras'
24743 fflushNULL='$fflushNULL'
24744 fflushall='$fflushall'
24745 find='$find'
24746 firstmakefile='$firstmakefile'
24747 flex='$flex'
24748 fpossize='$fpossize'
24749 fpostype='$fpostype'
24750 freetype='$freetype'
24751 from='$from'
24752 full_ar='$full_ar'
24753 full_csh='$full_csh'
24754 full_sed='$full_sed'
24755 gccansipedantic='$gccansipedantic'
24756 gccosandvers='$gccosandvers'
24757 gccversion='$gccversion'
24758 getgrent_r_proto='$getgrent_r_proto'
24759 getgrgid_r_proto='$getgrgid_r_proto'
24760 getgrnam_r_proto='$getgrnam_r_proto'
24761 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24762 gethostbyname_r_proto='$gethostbyname_r_proto'
24763 gethostent_r_proto='$gethostent_r_proto'
24764 getlogin_r_proto='$getlogin_r_proto'
24765 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24766 getnetbyname_r_proto='$getnetbyname_r_proto'
24767 getnetent_r_proto='$getnetent_r_proto'
24768 getprotobyname_r_proto='$getprotobyname_r_proto'
24769 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24770 getprotoent_r_proto='$getprotoent_r_proto'
24771 getpwent_r_proto='$getpwent_r_proto'
24772 getpwnam_r_proto='$getpwnam_r_proto'
24773 getpwuid_r_proto='$getpwuid_r_proto'
24774 getservbyname_r_proto='$getservbyname_r_proto'
24775 getservbyport_r_proto='$getservbyport_r_proto'
24776 getservent_r_proto='$getservent_r_proto'
24777 getspnam_r_proto='$getspnam_r_proto'
24778 gidformat='$gidformat'
24779 gidsign='$gidsign'
24780 gidsize='$gidsize'
24781 gidtype='$gidtype'
24782 glibpth='$glibpth'
24783 gmake='$gmake'
24784 gmtime_r_proto='$gmtime_r_proto'
24785 gnulibc_version='$gnulibc_version'
24786 grep='$grep'
24787 groupcat='$groupcat'
24788 groupstype='$groupstype'
24789 gzip='$gzip'
24790 h_fcntl='$h_fcntl'
24791 h_sysfile='$h_sysfile'
24792 hint='$hint'
24793 hostcat='$hostcat'
24794 hostgenerate='$hostgenerate'
24795 hostosname='$hostosname'
24796 hostperl='$hostperl'
24797 html1dir='$html1dir'
24798 html1direxp='$html1direxp'
24799 html3dir='$html3dir'
24800 html3direxp='$html3direxp'
24801 i16size='$i16size'
24802 i16type='$i16type'
24803 i32size='$i32size'
24804 i32type='$i32type'
24805 i64size='$i64size'
24806 i64type='$i64type'
24807 i8size='$i8size'
24808 i8type='$i8type'
24809 i_arpainet='$i_arpainet'
24810 i_assert='$i_assert'
24811 i_bfd='$i_bfd'
24812 i_bsdioctl='$i_bsdioctl'
24813 i_crypt='$i_crypt'
24814 i_db='$i_db'
24815 i_dbm='$i_dbm'
24816 i_dirent='$i_dirent'
24817 i_dlfcn='$i_dlfcn'
24818 i_execinfo='$i_execinfo'
24819 i_fcntl='$i_fcntl'
24820 i_fenv='$i_fenv'
24821 i_float='$i_float'
24822 i_fp='$i_fp'
24823 i_fp_class='$i_fp_class'
24824 i_gdbm='$i_gdbm'
24825 i_gdbm_ndbm='$i_gdbm_ndbm'
24826 i_gdbmndbm='$i_gdbmndbm'
24827 i_grp='$i_grp'
24828 i_ieeefp='$i_ieeefp'
24829 i_inttypes='$i_inttypes'
24830 i_langinfo='$i_langinfo'
24831 i_libutil='$i_libutil'
24832 i_limits='$i_limits'
24833 i_locale='$i_locale'
24834 i_machcthr='$i_machcthr'
24835 i_malloc='$i_malloc'
24836 i_mallocmalloc='$i_mallocmalloc'
24837 i_math='$i_math'
24838 i_memory='$i_memory'
24839 i_mntent='$i_mntent'
24840 i_ndbm='$i_ndbm'
24841 i_netdb='$i_netdb'
24842 i_neterrno='$i_neterrno'
24843 i_netinettcp='$i_netinettcp'
24844 i_niin='$i_niin'
24845 i_poll='$i_poll'
24846 i_prot='$i_prot'
24847 i_pthread='$i_pthread'
24848 i_pwd='$i_pwd'
24849 i_quadmath='$i_quadmath'
24850 i_rpcsvcdbm='$i_rpcsvcdbm'
24851 i_sgtty='$i_sgtty'
24852 i_shadow='$i_shadow'
24853 i_socks='$i_socks'
24854 i_stdarg='$i_stdarg'
24855 i_stdbool='$i_stdbool'
24856 i_stddef='$i_stddef'
24857 i_stdint='$i_stdint'
24858 i_stdlib='$i_stdlib'
24859 i_string='$i_string'
24860 i_sunmath='$i_sunmath'
24861 i_sysaccess='$i_sysaccess'
24862 i_sysdir='$i_sysdir'
24863 i_sysfile='$i_sysfile'
24864 i_sysfilio='$i_sysfilio'
24865 i_sysin='$i_sysin'
24866 i_sysioctl='$i_sysioctl'
24867 i_syslog='$i_syslog'
24868 i_sysmman='$i_sysmman'
24869 i_sysmode='$i_sysmode'
24870 i_sysmount='$i_sysmount'
24871 i_sysndir='$i_sysndir'
24872 i_sysparam='$i_sysparam'
24873 i_syspoll='$i_syspoll'
24874 i_sysresrc='$i_sysresrc'
24875 i_syssecrt='$i_syssecrt'
24876 i_sysselct='$i_sysselct'
24877 i_syssockio='$i_syssockio'
24878 i_sysstat='$i_sysstat'
24879 i_sysstatfs='$i_sysstatfs'
24880 i_sysstatvfs='$i_sysstatvfs'
24881 i_systime='$i_systime'
24882 i_systimek='$i_systimek'
24883 i_systimes='$i_systimes'
24884 i_systypes='$i_systypes'
24885 i_sysuio='$i_sysuio'
24886 i_sysun='$i_sysun'
24887 i_sysutsname='$i_sysutsname'
24888 i_sysvfs='$i_sysvfs'
24889 i_syswait='$i_syswait'
24890 i_termio='$i_termio'
24891 i_termios='$i_termios'
24892 i_time='$i_time'
24893 i_unistd='$i_unistd'
24894 i_ustat='$i_ustat'
24895 i_utime='$i_utime'
24896 i_values='$i_values'
24897 i_varargs='$i_varargs'
24898 i_varhdr='$i_varhdr'
24899 i_vfork='$i_vfork'
24900 i_xlocale='$i_xlocale'
24901 ignore_versioned_solibs='$ignore_versioned_solibs'
24902 inc_version_list='$inc_version_list'
24903 inc_version_list_init='$inc_version_list_init'
24904 incpath='$incpath'
24905 incpth='$incpth'
24906 inews='$inews'
24907 initialinstalllocation='$initialinstalllocation'
24908 installarchlib='$installarchlib'
24909 installbin='$installbin'
24910 installhtml1dir='$installhtml1dir'
24911 installhtml3dir='$installhtml3dir'
24912 installman1dir='$installman1dir'
24913 installman3dir='$installman3dir'
24914 installprefix='$installprefix'
24915 installprefixexp='$installprefixexp'
24916 installprivlib='$installprivlib'
24917 installscript='$installscript'
24918 installsitearch='$installsitearch'
24919 installsitebin='$installsitebin'
24920 installsitehtml1dir='$installsitehtml1dir'
24921 installsitehtml3dir='$installsitehtml3dir'
24922 installsitelib='$installsitelib'
24923 installsiteman1dir='$installsiteman1dir'
24924 installsiteman3dir='$installsiteman3dir'
24925 installsitescript='$installsitescript'
24926 installstyle='$installstyle'
24927 installusrbinperl='$installusrbinperl'
24928 installvendorarch='$installvendorarch'
24929 installvendorbin='$installvendorbin'
24930 installvendorhtml1dir='$installvendorhtml1dir'
24931 installvendorhtml3dir='$installvendorhtml3dir'
24932 installvendorlib='$installvendorlib'
24933 installvendorman1dir='$installvendorman1dir'
24934 installvendorman3dir='$installvendorman3dir'
24935 installvendorscript='$installvendorscript'
24936 intsize='$intsize'
24937 issymlink='$issymlink'
24938 ivdformat='$ivdformat'
24939 ivsize='$ivsize'
24940 ivtype='$ivtype'
24941 known_extensions='$known_extensions'
24942 ksh='$ksh'
24943 ld='$ld'
24944 ld_can_script='$ld_can_script'
24945 lddlflags='$lddlflags'
24946 ldflags='$ldflags'
24947 ldflags_uselargefiles='$ldflags_uselargefiles'
24948 ldlibpthname='$ldlibpthname'
24949 less='$less'
24950 lib_ext='$lib_ext'
24951 libc='$libc'
24952 libperl='$libperl'
24953 libpth='$libpth'
24954 libs='$libs'
24955 libsdirs='$libsdirs'
24956 libsfiles='$libsfiles'
24957 libsfound='$libsfound'
24958 libspath='$libspath'
24959 libswanted='$libswanted'
24960 libswanted_uselargefiles='$libswanted_uselargefiles'
24961 line='$line'
24962 lint='$lint'
24963 lkflags='$lkflags'
24964 ln='$ln'
24965 lns='$lns'
24966 localtime_r_proto='$localtime_r_proto'
24967 locincpth='$locincpth'
24968 loclibpth='$loclibpth'
24969 longdblinfbytes='$longdblinfbytes'
24970 longdblkind='$longdblkind'
24971 longdblmantbits='$longdblmantbits'
24972 longdblnanbytes='$longdblnanbytes'
24973 longdblsize='$longdblsize'
24974 longlongsize='$longlongsize'
24975 longsize='$longsize'
24976 lp='$lp'
24977 lpr='$lpr'
24978 ls='$ls'
24979 lseeksize='$lseeksize'
24980 lseektype='$lseektype'
24981 mail='$mail'
24982 mailx='$mailx'
24983 make='$make'
24984 make_set_make='$make_set_make'
24985 mallocobj='$mallocobj'
24986 mallocsrc='$mallocsrc'
24987 malloctype='$malloctype'
24988 man1dir='$man1dir'
24989 man1direxp='$man1direxp'
24990 man1ext='$man1ext'
24991 man3dir='$man3dir'
24992 man3direxp='$man3direxp'
24993 man3ext='$man3ext'
24994 mips_type='$mips_type'
24995 mistrustnm='$mistrustnm'
24996 mkdir='$mkdir'
24997 mmaptype='$mmaptype'
24998 modetype='$modetype'
24999 more='$more'
25000 multiarch='$multiarch'
25001 mv='$mv'
25002 myarchname='$myarchname'
25003 mydomain='$mydomain'
25004 myhostname='$myhostname'
25005 myuname='$myuname'
25006 n='$n'
25007 need_va_copy='$need_va_copy'
25008 netdb_hlen_type='$netdb_hlen_type'
25009 netdb_host_type='$netdb_host_type'
25010 netdb_name_type='$netdb_name_type'
25011 netdb_net_type='$netdb_net_type'
25012 nm='$nm'
25013 nm_opt='$nm_opt'
25014 nm_so_opt='$nm_so_opt'
25015 nonxs_ext='$nonxs_ext'
25016 nroff='$nroff'
25017 nvEUformat='$nvEUformat'
25018 nvFUformat='$nvFUformat'
25019 nvGUformat='$nvGUformat'
25020 nv_overflows_integers_at='$nv_overflows_integers_at'
25021 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25022 nveformat='$nveformat'
25023 nvfformat='$nvfformat'
25024 nvgformat='$nvgformat'
25025 nvmantbits='$nvmantbits'
25026 nvsize='$nvsize'
25027 nvtype='$nvtype'
25028 o_nonblock='$o_nonblock'
25029 obj_ext='$obj_ext'
25030 old_pthread_create_joinable='$old_pthread_create_joinable'
25031 optimize='$optimize'
25032 orderlib='$orderlib'
25033 osname='$osname'
25034 osvers='$osvers'
25035 otherlibdirs='$otherlibdirs'
25036 package='$package'
25037 pager='$pager'
25038 passcat='$passcat'
25039 patchlevel='$patchlevel'
25040 path_sep='$path_sep'
25041 perl5='$perl5'
25042 perl='$perl'
25043 perl_patchlevel='$perl_patchlevel'
25044 perl_static_inline='$perl_static_inline'
25045 perladmin='$perladmin'
25046 perllibs='$perllibs'
25047 perlpath='$perlpath'
25048 pg='$pg'
25049 phostname='$phostname'
25050 pidtype='$pidtype'
25051 plibpth='$plibpth'
25052 pmake='$pmake'
25053 pr='$pr'
25054 prefix='$prefix'
25055 prefixexp='$prefixexp'
25056 privlib='$privlib'
25057 privlibexp='$privlibexp'
25058 procselfexe='$procselfexe'
25059 prototype='$prototype'
25060 ptrsize='$ptrsize'
25061 quadkind='$quadkind'
25062 quadtype='$quadtype'
25063 randbits='$randbits'
25064 randfunc='$randfunc'
25065 random_r_proto='$random_r_proto'
25066 randseedtype='$randseedtype'
25067 ranlib='$ranlib'
25068 rd_nodata='$rd_nodata'
25069 readdir64_r_proto='$readdir64_r_proto'
25070 readdir_r_proto='$readdir_r_proto'
25071 revision='$revision'
25072 rm='$rm'
25073 rm_try='$rm_try'
25074 rmail='$rmail'
25075 run='$run'
25076 runnm='$runnm'
25077 sGMTIME_max='$sGMTIME_max'
25078 sGMTIME_min='$sGMTIME_min'
25079 sLOCALTIME_max='$sLOCALTIME_max'
25080 sLOCALTIME_min='$sLOCALTIME_min'
25081 sPRIEUldbl='$sPRIEUldbl'
25082 sPRIFUldbl='$sPRIFUldbl'
25083 sPRIGUldbl='$sPRIGUldbl'
25084 sPRIXU64='$sPRIXU64'
25085 sPRId64='$sPRId64'
25086 sPRIeldbl='$sPRIeldbl'
25087 sPRIfldbl='$sPRIfldbl'
25088 sPRIgldbl='$sPRIgldbl'
25089 sPRIi64='$sPRIi64'
25090 sPRIo64='$sPRIo64'
25091 sPRIu64='$sPRIu64'
25092 sPRIx64='$sPRIx64'
25093 sSCNfldbl='$sSCNfldbl'
25094 sched_yield='$sched_yield'
25095 scriptdir='$scriptdir'
25096 scriptdirexp='$scriptdirexp'
25097 sed='$sed'
25098 seedfunc='$seedfunc'
25099 selectminbits='$selectminbits'
25100 selecttype='$selecttype'
25101 sendmail='$sendmail'
25102 setgrent_r_proto='$setgrent_r_proto'
25103 sethostent_r_proto='$sethostent_r_proto'
25104 setlocale_r_proto='$setlocale_r_proto'
25105 setnetent_r_proto='$setnetent_r_proto'
25106 setprotoent_r_proto='$setprotoent_r_proto'
25107 setpwent_r_proto='$setpwent_r_proto'
25108 setservent_r_proto='$setservent_r_proto'
25109 sh='$sh'
25110 shar='$shar'
25111 sharpbang='$sharpbang'
25112 shmattype='$shmattype'
25113 shortsize='$shortsize'
25114 shrpenv='$shrpenv'
25115 shsharp='$shsharp'
25116 sig_count='$sig_count'
25117 sig_name='$sig_name'
25118 sig_name_init='$sig_name_init'
25119 sig_num='$sig_num'
25120 sig_num_init='$sig_num_init'
25121 sig_size='$sig_size'
25122 signal_t='$signal_t'
25123 sitearch='$sitearch'
25124 sitearchexp='$sitearchexp'
25125 sitebin='$sitebin'
25126 sitebinexp='$sitebinexp'
25127 sitehtml1dir='$sitehtml1dir'
25128 sitehtml1direxp='$sitehtml1direxp'
25129 sitehtml3dir='$sitehtml3dir'
25130 sitehtml3direxp='$sitehtml3direxp'
25131 sitelib='$sitelib'
25132 sitelib_stem='$sitelib_stem'
25133 sitelibexp='$sitelibexp'
25134 siteman1dir='$siteman1dir'
25135 siteman1direxp='$siteman1direxp'
25136 siteman3dir='$siteman3dir'
25137 siteman3direxp='$siteman3direxp'
25138 siteprefix='$siteprefix'
25139 siteprefixexp='$siteprefixexp'
25140 sitescript='$sitescript'
25141 sitescriptexp='$sitescriptexp'
25142 sizesize='$sizesize'
25143 sizetype='$sizetype'
25144 sleep='$sleep'
25145 smail='$smail'
25146 so='$so'
25147 sockethdr='$sockethdr'
25148 socketlib='$socketlib'
25149 socksizetype='$socksizetype'
25150 sort='$sort'
25151 spackage='$spackage'
25152 spitshell='$spitshell'
25153 srand48_r_proto='$srand48_r_proto'
25154 srandom_r_proto='$srandom_r_proto'
25155 src='$src'
25156 ssizetype='$ssizetype'
25157 st_ino_sign='$st_ino_sign'
25158 st_ino_size='$st_ino_size'
25159 startperl='$startperl'
25160 startsh='$startsh'
25161 static_ext='$static_ext'
25162 stdchar='$stdchar'
25163 stdio_base='$stdio_base'
25164 stdio_bufsiz='$stdio_bufsiz'
25165 stdio_cnt='$stdio_cnt'
25166 stdio_filbuf='$stdio_filbuf'
25167 stdio_ptr='$stdio_ptr'
25168 stdio_stream_array='$stdio_stream_array'
25169 strerror_r_proto='$strerror_r_proto'
25170 strings='$strings'
25171 submit='$submit'
25172 subversion='$subversion'
25173 sysman='$sysman'
25174 sysroot='$sysroot'
25175 tail='$tail'
25176 tar='$tar'
25177 targetarch='$targetarch'
25178 targetdir='$targetdir'
25179 targetenv='$targetenv'
25180 targethost='$targethost'
25181 targetmkdir='$targetmkdir'
25182 targetport='$targetport'
25183 targetsh='$targetsh'
25184 tbl='$tbl'
25185 tee='$tee'
25186 test='$test'
25187 timeincl='$timeincl'
25188 timetype='$timetype'
25189 tmpnam_r_proto='$tmpnam_r_proto'
25190 to='$to'
25191 touch='$touch'
25192 tr='$tr'
25193 trnl='$trnl'
25194 troff='$troff'
25195 ttyname_r_proto='$ttyname_r_proto'
25196 u16size='$u16size'
25197 u16type='$u16type'
25198 u32size='$u32size'
25199 u32type='$u32type'
25200 u64size='$u64size'
25201 u64type='$u64type'
25202 u8size='$u8size'
25203 u8type='$u8type'
25204 uidformat='$uidformat'
25205 uidsign='$uidsign'
25206 uidsize='$uidsize'
25207 uidtype='$uidtype'
25208 uname='$uname'
25209 uniq='$uniq'
25210 uquadtype='$uquadtype'
25211 use5005threads='$use5005threads'
25212 use64bitall='$use64bitall'
25213 use64bitint='$use64bitint'
25214 usecbacktrace='$usecbacktrace'
25215 usecrosscompile='$usecrosscompile'
25216 usedevel='$usedevel'
25217 usedl='$usedl'
25218 usedtrace='$usedtrace'
25219 usefaststdio='$usefaststdio'
25220 useithreads='$useithreads'
25221 usekernprocpathname='$usekernprocpathname'
25222 uselargefiles='$uselargefiles'
25223 uselongdouble='$uselongdouble'
25224 usemallocwrap='$usemallocwrap'
25225 usemorebits='$usemorebits'
25226 usemultiplicity='$usemultiplicity'
25227 usemymalloc='$usemymalloc'
25228 usenm='$usenm'
25229 usensgetexecutablepath='$usensgetexecutablepath'
25230 useopcode='$useopcode'
25231 useperlio='$useperlio'
25232 useposix='$useposix'
25233 usequadmath='$usequadmath'
25234 usereentrant='$usereentrant'
25235 userelocatableinc='$userelocatableinc'
25236 useshrplib='$useshrplib'
25237 usesitecustomize='$usesitecustomize'
25238 usesocks='$usesocks'
25239 usethreads='$usethreads'
25240 usevendorprefix='$usevendorprefix'
25241 useversionedarchname='$useversionedarchname'
25242 usevfork='$usevfork'
25243 usrinc='$usrinc'
25244 uuname='$uuname'
25245 uvXUformat='$uvXUformat'
25246 uvoformat='$uvoformat'
25247 uvsize='$uvsize'
25248 uvtype='$uvtype'
25249 uvuformat='$uvuformat'
25250 uvxformat='$uvxformat'
25251 vaproto='$vaproto'
25252 vendorarch='$vendorarch'
25253 vendorarchexp='$vendorarchexp'
25254 vendorbin='$vendorbin'
25255 vendorbinexp='$vendorbinexp'
25256 vendorhtml1dir='$vendorhtml1dir'
25257 vendorhtml1direxp='$vendorhtml1direxp'
25258 vendorhtml3dir='$vendorhtml3dir'
25259 vendorhtml3direxp='$vendorhtml3direxp'
25260 vendorlib='$vendorlib'
25261 vendorlib_stem='$vendorlib_stem'
25262 vendorlibexp='$vendorlibexp'
25263 vendorman1dir='$vendorman1dir'
25264 vendorman1direxp='$vendorman1direxp'
25265 vendorman3dir='$vendorman3dir'
25266 vendorman3direxp='$vendorman3direxp'
25267 vendorprefix='$vendorprefix'
25268 vendorprefixexp='$vendorprefixexp'
25269 vendorscript='$vendorscript'
25270 vendorscriptexp='$vendorscriptexp'
25271 version='$version'
25272 version_patchlevel_string='$version_patchlevel_string'
25273 versiononly='$versiononly'
25274 vi='$vi'
25275 xlibpth='$xlibpth'
25276 yacc='$yacc'
25277 yaccflags='$yaccflags'
25278 zcat='$zcat'
25279 zip='$zip'
25280 EOT
25281
25282 : add special variables
25283 $test -f $src/patchlevel.h && \
25284 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25285 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25286 echo "PERL_CONFIG_SH=true" >>config.sh
25287
25288 : propagate old symbols
25289 if $test -f UU/config.sh; then
25290         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25291         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25292                 config.sh config.sh UU/oldconfig.sh |\
25293                 $sort | $uniq -u >UU/oldsyms
25294         set X `$cat UU/oldsyms`
25295         shift
25296         case $# in
25297         0) ;;
25298         *)
25299                 $cat <<EOM
25300 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25301 EOM
25302                 echo ": Variables propagated from previous config.sh file." >>config.sh
25303                 for sym in `$cat UU/oldsyms`; do
25304                         echo "    Propagating $hint variable "'$'"$sym..."
25305                         eval 'tmp="$'"${sym}"'"'
25306                         echo "$tmp" | \
25307                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25308                 done
25309                 ;;
25310         esac
25311 fi
25312
25313 : preserve RCS keywords in files with variable substitution, grrr
25314 Id='$Id'
25315
25316 : Finish up by extracting the .SH files
25317 case "$alldone" in
25318 exit)
25319         $rm -rf UU
25320         echo "Extraction done."
25321         exit 0
25322         ;;
25323 cont)
25324         ;;
25325 '')
25326         dflt=''
25327         nostick=true
25328         $cat <<EOM
25329
25330 If you'd like to make any changes to the config.sh file before I begin
25331 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25332
25333 EOM
25334         rp="Press return or use a shell escape to edit config.sh:"
25335         . UU/myread
25336         nostick=''
25337         case "$ans" in
25338         '') ;;
25339         *) : in case they cannot read
25340                 sh 1>&4 -c "$ans";;
25341         esac
25342         ;;
25343 esac
25344
25345 : if this fails, just run all the .SH files by hand
25346 . ./config.sh
25347
25348 echo " "
25349 exec 1>&4
25350 pwd=`pwd`
25351 . ./UU/extract
25352 cd "$pwd"
25353
25354 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25355         dflt=y
25356         case "$silent" in
25357         true) ;;
25358         *)
25359                 $cat <<EOM
25360
25361 Now you need to generate make dependencies by running "$make depend".
25362 You might prefer to run it in background: "$make depend > makedepend.out &"
25363 It can take a while, so you might not want to run it right now.
25364
25365 EOM
25366                 ;;
25367         esac
25368         rp="Run $make depend now?"
25369         . UU/myread
25370         case "$ans" in
25371         y*)
25372                 $make depend && echo "Now you must run '$make'."
25373                 ;;
25374         *)
25375                 echo "You must run '$make depend' then '$make'."
25376                 ;;
25377         esac
25378 elif test -f [Mm]akefile; then
25379         echo " "
25380         echo "Now you must run a $make."
25381 else
25382         echo "Configure done."
25383 fi
25384
25385 if $test -f Policy.sh; then
25386     $cat <<EOM
25387
25388 If you compile $package on a different machine or from a different object
25389 directory, copy the Policy.sh file from this object directory to the
25390 new one before you run Configure -- this will help you with most of
25391 the policy defaults.
25392
25393 EOM
25394 fi
25395 if $test -f config.msg; then
25396     echo "Hmm.  I also noted the following information while running:"
25397     echo " "
25398     $cat config.msg >&4
25399     $rm -f config.msg
25400 fi
25401 $rm -f kit*isdone ark*isdone
25402 $rm -rf UU
25403
25404 : End of Configure
25405