This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Exempt intrpvar.h from bump-perl-version changes
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically by the tool
15 # called "metaconfig". Rather than working with this copy of Configure,
16 # you may wish to get metaconfig. Perl uses a modified version of this
17 # tool, available in the "dist" folder in the checkout of the git repo
18 #    $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
19 # The original dist package (including metaconfig) is available via SVN:
20 #    $ svn co https://svn.code.sf.net/p/dist/code/trunk/dist
21 #
22 # Though this script was generated by metaconfig from metaunits, it is
23 # OK to send patches against Configure itself. It's up to the Configure
24 # pumpkin to backport the patch to the metaunits if it is accepted.
25 # For more information on patching Configure, see pod/perlhack.pod
26 #
27 # The metaunits are also available from the public git repository:
28 #     http://perl5.git.perl.org/metaconfig.git/ or
29 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
30 #
31 # See Porting/pumpkin.pod for more information on metaconfig.
32
33 # Generated using [metaconfig 3.5 PL0]
34 # (with additional metaconfig patches by perlbug@perl.org)
35
36 cat >c1$$ <<EOF
37 ARGGGHHHH!!!!!
38
39 SCO csh still thinks true is false.  Write to SCO today and tell them that next
40 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43 we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45 [End of diatribe. We now return you to your regularly scheduled programming...]
46 EOF
47 cat >c2$$ <<EOF
48
49 OOPS!  You naughty creature!  You didn't run Configure with sh!
50 I will attempt to remedy the situation by running sh for you...
51 EOF
52
53 true || cat c1$$ c2$$
54 true || exec sh $0 $argv:q
55
56 (exit $?0) || cat c2$$
57 (exit $?0) || exec sh $0 $argv:q
58 rm -f c1$$ c2$$
59
60 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61         cat <<EOF
62 ***
63 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65 *** Please read the README.plan9 for further instructions.
66 *** Cannot continue, aborting.
67 ***
68 EOF
69         exit 1
70 fi
71
72 if test -f /sys/utilities/MultiView ; then
73         # AmigaOS, test -c for /dev/null is not useful
74         :
75 elif test ! -c /dev/null ; then
76         cat <<EOF
77 ***
78 *** I'm sorry, but /dev/null appears to be a file rather than a device.
79 *** Please consult your operating sytem's notes for making a device
80 *** in /dev.
81 *** Cannot continue, aborting.
82 ***
83 EOF
84         exit 1
85 fi
86
87 : compute my invocation name
88 me=$0
89 case "$0" in
90 */*)
91         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
92         test "$me" || me=$0
93         ;;
94 esac
95
96 : Proper separator for the PATH environment variable
97 p_=:
98 : On OS/2 this directory should exist if this is not floppy only system ":-]"
99 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
100         if test -n "$OS2_SHELL"; then
101                 p_=\;
102                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
103                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
104                 is_os2=yes
105         elif test -n "$DJGPP"; then
106                 case "X${MACHTYPE:-nonesuchmach}" in
107                 *cygwin|*msys) ;;
108                 *) p_=\; ;;
109                 esac
110         fi
111 fi
112
113 : Proper PATH setting
114 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
115 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
116 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
117 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
118 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
119 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
120 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
121 paths="$paths /sbin /usr/sbin /usr/libexec"
122 paths="$paths /system/gnu_library/bin"
123
124 for p in $paths
125 do
126         case "$p_$PATH$p_" in
127         *$p_$p$p_*) ;;
128         *) test -d $p && PATH=$PATH$p_$p ;;
129         esac
130 done
131
132 PATH=.$p_$PATH
133 export PATH
134
135 : shall we be using ksh?
136 inksh=''
137 needksh=''
138 avoidksh=''
139 newsh=/bin/ksh
140 changesh=''
141 if (PATH=.; alias -x) >/dev/null 2>&1; then
142                 inksh=true
143 fi
144 if test -f /hp-ux -a -f /bin/ksh; then
145         needksh='to avoid sh bug in "here document" expansion'
146 fi
147 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
148         if test X`/usr/bin/uname -v` = X4; then
149                 avoidksh="to avoid AIX 4's /bin/sh"
150                 newsh=/usr/bin/bsh
151         fi
152 fi
153 if test -f /osf_boot -a -f /usr/sbin/setld; then
154         if test X`/usr/bin/uname -s` = XOSF1; then
155                 avoidksh="to avoid Digital UNIX' ksh"
156                 newsh=/bin/sh
157                 unset BIN_SH
158         fi
159 fi
160 case "$inksh/$needksh" in
161 /[a-z]*)
162                 ENV=''
163                 changesh=true
164                 reason="$needksh"
165         ;;
166 esac
167 case "$inksh/$avoidksh" in
168 true/[a-z]*)
169         changesh=true
170         reason="$avoidksh"
171         ;;
172 esac
173 case "$inksh/$needksh-$avoidksh-" in
174 true/--)
175                 cat <<EOM
176 (I see you are using the Korn shell.  Some ksh's blow up on $me,
177 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
178 EOM
179         ;;
180 esac
181 case "$changesh" in
182 true)
183         export newsh
184         echo "(Feeding myself to $newsh $reason.)"
185         case "$0" in
186         Configure|*/Configure) exec $newsh $0 "$@";;
187         *) exec $newsh Configure "$@";;
188         esac
189         ;;
190 esac
191 test -x "${newsh}" || unset newsh
192
193 : if needed, set CDPATH to a harmless value that is not chatty
194 : avoid bash 2.02 problems with empty CDPATH.
195 case "$CDPATH" in
196 '')     ;;
197 *)      case "$SHELL" in
198         *bash*) CDPATH='.' ;;
199         *) CDPATH='' ;;
200         esac
201         ;;
202 esac
203
204 : Configure runs within the UU subdirectory
205 test -d UU || mkdir UU
206 cd UU && rm -f ./*
207
208 ccname=''
209 ccversion=''
210 ccsymbols=''
211 cppccsymbols=''
212 cppsymbols=''
213 from=''
214 hostgenerate=''
215 hostosname=''
216 hostperl=''
217 run=''
218 targetarch=''
219 targetdir=''
220 targetenv=''
221 targethost=''
222 targetmkdir=''
223 targetport=''
224 to=''
225 usecrosscompile=''
226 extern_C=''
227 mistrustnm=''
228 usedevel=''
229 perllibs=''
230 dynamic_ext=''
231 extensions=''
232 known_extensions=''
233 nonxs_ext=''
234 static_ext=''
235 useopcode=''
236 useposix=''
237 extras=''
238 d_bsd=''
239 d_eunice=''
240 d_xenix=''
241 eunicefix=''
242 ar=''
243 awk=''
244 bash=''
245 bison=''
246 byacc=''
247 cat=''
248 chgrp=''
249 chmod=''
250 chown=''
251 comm=''
252 compress=''
253 cp=''
254 cpio=''
255 cpp=''
256 csh=''
257 date=''
258 echo=''
259 egrep=''
260 emacs=''
261 expr=''
262 find=''
263 flex=''
264 gmake=''
265 grep=''
266 gzip=''
267 inews=''
268 ksh=''
269 less=''
270 line=''
271 lint=''
272 ln=''
273 lp=''
274 lpr=''
275 ls=''
276 mail=''
277 mailx=''
278 make=''
279 mkdir=''
280 more=''
281 mv=''
282 nm=''
283 nroff=''
284 perl=''
285 pg=''
286 pmake=''
287 pr=''
288 rm=''
289 rmail=''
290 sed=''
291 sendmail=''
292 shar=''
293 sleep=''
294 smail=''
295 sort=''
296 submit=''
297 tail=''
298 tar=''
299 tbl=''
300 tee=''
301 test=''
302 touch=''
303 tr=''
304 troff=''
305 uname=''
306 uniq=''
307 uuname=''
308 vi=''
309 zcat=''
310 zip=''
311 full_ar=''
312 full_sed=''
313 libswanted=''
314 hint=''
315 myuname=''
316 osname=''
317 osvers=''
318 Author=''
319 Date=''
320 Header=''
321 Id=''
322 Locker=''
323 Log=''
324 RCSfile=''
325 Revision=''
326 Source=''
327 State=''
328 sysroot=''
329 _a=''
330 _exe=''
331 _o=''
332 archobjs=''
333 exe_ext=''
334 firstmakefile=''
335 lib_ext=''
336 obj_ext=''
337 path_sep=''
338 rm_try=''
339 afs=''
340 afsroot=''
341 alignbytes=''
342 ansi2knr=''
343 archlib=''
344 archlibexp=''
345 d_archlib=''
346 installarchlib=''
347 archname=''
348 myarchname=''
349 useversionedarchname=''
350 d_atolf=''
351 d_atoll=''
352 baserev=''
353 bin=''
354 binexp=''
355 initialinstalllocation=''
356 installbin=''
357 userelocatableinc=''
358 byteorder=''
359 cc=''
360 ccflags=''
361 cppflags=''
362 ldflags=''
363 lkflags=''
364 locincpth=''
365 optimize=''
366 cf_email=''
367 cf_by=''
368 cf_time=''
369 charbits=''
370 charsize=''
371 contains=''
372 cpp_stuff=''
373 cpplast=''
374 cppminus=''
375 cpprun=''
376 cppstdin=''
377 d__fwalk=''
378 d_access=''
379 d_accessx=''
380 d_acosh=''
381 d_aintl=''
382 d_alarm=''
383 asctime_r_proto=''
384 d_asctime_r=''
385 d_asinh=''
386 d_atanh=''
387 d_attribute_deprecated=''
388 d_attribute_format=''
389 d_attribute_malloc=''
390 d_attribute_nonnull=''
391 d_attribute_noreturn=''
392 d_attribute_pure=''
393 d_attribute_unused=''
394 d_attribute_warn_unused_result=''
395 d_printf_format_null=''
396 d_backtrace=''
397 d_bcmp=''
398 d_bcopy=''
399 d_builtin_choose_expr=''
400 d_builtin_expect=''
401 d_bzero=''
402 d_c99_variadic_macros=''
403 d_casti32=''
404 castflags=''
405 d_castneg=''
406 d_cbrt=''
407 d_chown=''
408 d_chroot=''
409 d_chsize=''
410 d_class=''
411 d_clearenv=''
412 d_closedir=''
413 d_void_closedir=''
414 d_cmsghdr_s=''
415 d_const=''
416 d_copysign=''
417 d_copysignl=''
418 d_cplusplus=''
419 cryptlib=''
420 d_crypt=''
421 crypt_r_proto=''
422 d_crypt_r=''
423 d_csh=''
424 full_csh=''
425 d_ctermid=''
426 ctermid_r_proto=''
427 d_ctermid_r=''
428 ctime_r_proto=''
429 d_ctime_r=''
430 d_cuserid=''
431 d_dbl_dig=''
432 d_dbminitproto=''
433 d_difftime=''
434 d_dir_dd_fd=''
435 d_dirfd=''
436 d_dladdr=''
437 d_dlerror=''
438 d_dlopen=''
439 d_dlsymun=''
440 d_dosuid=''
441 d_suidsafe=''
442 d_drand48_r=''
443 drand48_r_proto=''
444 d_drand48proto=''
445 d_dup2=''
446 d_eaccess=''
447 d_endgrent=''
448 d_endgrent_r=''
449 endgrent_r_proto=''
450 d_endhent=''
451 d_endhostent_r=''
452 endhostent_r_proto=''
453 d_endnent=''
454 d_endnetent_r=''
455 endnetent_r_proto=''
456 d_endpent=''
457 d_endprotoent_r=''
458 endprotoent_r_proto=''
459 d_endpwent=''
460 d_endpwent_r=''
461 endpwent_r_proto=''
462 d_endsent=''
463 d_endservent_r=''
464 endservent_r_proto=''
465 d_erf=''
466 d_erfc=''
467 d_exp2=''
468 d_expm1=''
469 d_faststdio=''
470 d_fchdir=''
471 d_fchmod=''
472 d_fchown=''
473 d_fcntl=''
474 d_fcntl_can_lock=''
475 d_fd_macros=''
476 d_fd_set=''
477 d_fds_bits=''
478 d_fdclose=''
479 d_fdim=''
480 d_fegetround=''
481 d_fgetpos=''
482 d_finite=''
483 d_finitel=''
484 d_flexfnam=''
485 d_flock=''
486 d_flockproto=''
487 d_fma=''
488 d_fmax=''
489 d_fmin=''
490 d_fork=''
491 d_fp_class=''
492 d_fp_classl=''
493 d_fpclass=''
494 d_fp_classify=''
495 d_fpclassify=''
496 d_fpclassl=''
497 d_fpgetround=''
498 d_fpos64_t=''
499 d_frexpl=''
500 d_fs_data_s=''
501 d_fseeko=''
502 d_fsetpos=''
503 d_fstatfs=''
504 d_fsync=''
505 d_ftello=''
506 d_ftime=''
507 d_gettimeod=''
508 d_futimes=''
509 d_Gconvert=''
510 d_getaddrinfo=''
511 d_getcwd=''
512 d_getespwnam=''
513 d_getfsstat=''
514 d_getgrent=''
515 d_getgrent_r=''
516 getgrent_r_proto=''
517 d_getgrgid_r=''
518 getgrgid_r_proto=''
519 d_getgrnam_r=''
520 getgrnam_r_proto=''
521 d_getgrps=''
522 d_gethbyaddr=''
523 d_gethbyname=''
524 d_gethent=''
525 aphostname=''
526 d_gethname=''
527 d_phostname=''
528 d_uname=''
529 d_gethostbyaddr_r=''
530 gethostbyaddr_r_proto=''
531 d_gethostbyname_r=''
532 gethostbyname_r_proto=''
533 d_gethostent_r=''
534 gethostent_r_proto=''
535 d_gethostprotos=''
536 d_getitimer=''
537 d_getlogin=''
538 d_getlogin_r=''
539 getlogin_r_proto=''
540 d_getmnt=''
541 d_getmntent=''
542 d_getnameinfo=''
543 d_getnbyaddr=''
544 d_getnbyname=''
545 d_getnent=''
546 d_getnetbyaddr_r=''
547 getnetbyaddr_r_proto=''
548 d_getnetbyname_r=''
549 getnetbyname_r_proto=''
550 d_getnetent_r=''
551 getnetent_r_proto=''
552 d_getnetprotos=''
553 d_getpagsz=''
554 d_getpent=''
555 d_getpgid=''
556 d_getpgrp2=''
557 d_bsdgetpgrp=''
558 d_getpgrp=''
559 d_getppid=''
560 d_getprior=''
561 d_getpbyname=''
562 d_getpbynumber=''
563 d_getprotobyname_r=''
564 getprotobyname_r_proto=''
565 d_getprotobynumber_r=''
566 getprotobynumber_r_proto=''
567 d_getprotoent_r=''
568 getprotoent_r_proto=''
569 d_getprotoprotos=''
570 d_getprpwnam=''
571 d_getpwent=''
572 d_getpwent_r=''
573 getpwent_r_proto=''
574 d_getpwnam_r=''
575 getpwnam_r_proto=''
576 d_getpwuid_r=''
577 getpwuid_r_proto=''
578 d_getsent=''
579 d_getservbyname_r=''
580 getservbyname_r_proto=''
581 d_getservbyport_r=''
582 getservbyport_r_proto=''
583 d_getservent_r=''
584 getservent_r_proto=''
585 d_getservprotos=''
586 d_getspnam=''
587 d_getspnam_r=''
588 getspnam_r_proto=''
589 d_getsbyname=''
590 d_getsbyport=''
591 d_gmtime_r=''
592 gmtime_r_proto=''
593 d_gnulibc=''
594 gnulibc_version=''
595 d_hasmntopt=''
596 d_htonl=''
597 d_hypot=''
598 d_ilogb=''
599 d_ilogbl=''
600 d_inetaton=''
601 d_inetntop=''
602 d_inetpton=''
603 d_int64_t=''
604 d_isascii=''
605 d_isblank=''
606 d_isfinite=''
607 d_isfinitel=''
608 d_isinf=''
609 d_isinfl=''
610 d_isless=''
611 d_isnan=''
612 d_isnanl=''
613 d_isnormal=''
614 d_j0=''
615 d_j0l=''
616 d_killpg=''
617 d_lc_monetary_2008=''
618 d_lchown=''
619 d_ldbl_dig=''
620 d_lgamma=''
621 d_lgamma_r=''
622 d_libm_lib_version=''
623 d_link=''
624 d_llrint=''
625 d_llrintl=''
626 d_llround=''
627 d_llroundl=''
628 d_localtime_r=''
629 d_localtime_r_needs_tzset=''
630 localtime_r_proto=''
631 d_locconv=''
632 d_lockf=''
633 d_log1p=''
634 d_log2=''
635 d_logb=''
636 d_ldexpl=''
637 d_longdbl=''
638 longdblkind=''
639 longdblsize=''
640 d_longlong=''
641 longlongsize=''
642 d_lrint=''
643 d_lrintl=''
644 d_lround=''
645 d_lroundl=''
646 d_lseekproto=''
647 d_lstat=''
648 d_madvise=''
649 d_malloc_good_size=''
650 d_malloc_size=''
651 d_mblen=''
652 d_mbstowcs=''
653 d_mbtowc=''
654 d_memchr=''
655 d_memcmp=''
656 d_memcpy=''
657 d_memmove=''
658 d_memset=''
659 d_mkdir=''
660 d_mkdtemp=''
661 d_mkfifo=''
662 d_mkstemp=''
663 d_mkstemps=''
664 d_mktime=''
665 d_mmap=''
666 mmaptype=''
667 d_modfl=''
668 d_modfl_pow32_bug=''
669 d_modflproto=''
670 d_mprotect=''
671 d_msg=''
672 d_msgctl=''
673 d_msgget=''
674 d_msghdr_s=''
675 d_msgrcv=''
676 d_msgsnd=''
677 d_msync=''
678 d_munmap=''
679 d_nan=''
680 d_nearbyint=''
681 d_nextafter=''
682 d_nexttoward=''
683 d_nice=''
684 d_nl_langinfo=''
685 d_off64_t=''
686 d_open3=''
687 d_fpathconf=''
688 d_pathconf=''
689 d_pause=''
690 d_pipe=''
691 d_poll=''
692 d_portable=''
693 d_prctl=''
694 d_prctl_set_name=''
695 d_procselfexe=''
696 procselfexe=''
697 d_old_pthread_create_joinable=''
698 old_pthread_create_joinable=''
699 d_pthread_atfork=''
700 d_pthread_attr_setscope=''
701 d_pthread_yield=''
702 d_sched_yield=''
703 sched_yield=''
704 d_ptrdiff_t=''
705 d_qgcvt=''
706 d_random_r=''
707 random_r_proto=''
708 d_readdir64_r=''
709 readdir64_r_proto=''
710 d_readdir=''
711 d_rewinddir=''
712 d_seekdir=''
713 d_telldir=''
714 d_readdir_r=''
715 readdir_r_proto=''
716 d_readlink=''
717 d_readv=''
718 d_recvmsg=''
719 d_re_comp=''
720 d_regcmp=''
721 d_regcomp=''
722 d_remainder=''
723 d_remquo=''
724 d_rename=''
725 d_rint=''
726 d_rmdir=''
727 d_round=''
728 d_safebcpy=''
729 d_safemcpy=''
730 d_sanemcmp=''
731 d_sbrkproto=''
732 d_scalbn=''
733 d_scalbnl=''
734 d_select=''
735 d_sem=''
736 d_semctl=''
737 d_semget=''
738 d_semop=''
739 d_sendmsg=''
740 d_setegid=''
741 d_seteuid=''
742 d_setgrent=''
743 d_setgrent_r=''
744 setgrent_r_proto=''
745 d_setgrps=''
746 d_sethent=''
747 d_sethostent_r=''
748 sethostent_r_proto=''
749 d_setitimer=''
750 d_setlinebuf=''
751 d_setlocale=''
752 d_setlocale_r=''
753 setlocale_r_proto=''
754 d_setnent=''
755 d_setnetent_r=''
756 setnetent_r_proto=''
757 d_setpent=''
758 d_setpgid=''
759 d_setpgrp2=''
760 d_bsdsetpgrp=''
761 d_setpgrp=''
762 d_setprior=''
763 d_setproctitle=''
764 d_setprotoent_r=''
765 setprotoent_r_proto=''
766 d_setpwent=''
767 d_setpwent_r=''
768 setpwent_r_proto=''
769 d_setregid=''
770 d_setresgid=''
771 d_setresuid=''
772 d_setreuid=''
773 d_setrgid=''
774 d_setruid=''
775 d_setsent=''
776 d_setservent_r=''
777 setservent_r_proto=''
778 d_setsid=''
779 d_setvbuf=''
780 d_shm=''
781 d_shmat=''
782 d_shmatprototype=''
783 shmattype=''
784 d_shmctl=''
785 d_shmdt=''
786 d_shmget=''
787 d_sigaction=''
788 d_signbit=''
789 d_sigprocmask=''
790 d_sigsetjmp=''
791 usesitecustomize=''
792 d_snprintf=''
793 d_vsnprintf=''
794 d_sockatmark=''
795 d_sockatmarkproto=''
796 d_ip_mreq=''
797 d_ip_mreq_source=''
798 d_ipv6_mreq=''
799 d_ipv6_mreq_source=''
800 d_msg_ctrunc=''
801 d_msg_dontroute=''
802 d_msg_oob=''
803 d_msg_peek=''
804 d_msg_proxy=''
805 d_oldsock=''
806 d_scm_rights=''
807 d_sin6_scope_id=''
808 d_sockaddr_in6=''
809 d_sockaddr_sa_len=''
810 d_socket=''
811 d_sockpair=''
812 sockethdr=''
813 socketlib=''
814 d_socklen_t=''
815 d_socks5_init=''
816 d_sprintf_returns_strlen=''
817 d_sqrtl=''
818 d_srand48_r=''
819 srand48_r_proto=''
820 d_srandom_r=''
821 srandom_r_proto=''
822 d_sresgproto=''
823 d_sresuproto=''
824 d_stat=''
825 d_statblks=''
826 d_statfs_f_flags=''
827 d_statfs_s=''
828 d_static_inline=''
829 perl_static_inline=''
830 d_fstatvfs=''
831 d_statvfs=''
832 d_stdio_cnt_lval=''
833 d_stdio_ptr_lval=''
834 d_stdio_ptr_lval_nochange_cnt=''
835 d_stdio_ptr_lval_sets_cnt=''
836 d_stdiobase=''
837 d_stdstdio=''
838 stdio_base=''
839 stdio_bufsiz=''
840 stdio_cnt=''
841 stdio_filbuf=''
842 stdio_ptr=''
843 d_index=''
844 d_strchr=''
845 d_strcoll=''
846 d_strctcpy=''
847 d_strerrm=''
848 d_strerror=''
849 d_sysernlst=''
850 d_syserrlst=''
851 d_strerror_r=''
852 strerror_r_proto=''
853 d_strftime=''
854 d_strlcat=''
855 d_strlcpy=''
856 d_strtod=''
857 d_strtol=''
858 d_strtold=''
859 d_strtoll=''
860 d_strtoq=''
861 d_strtoul=''
862 d_strtoull=''
863 d_strtouq=''
864 d_strxfrm=''
865 d_symlink=''
866 d_syscall=''
867 d_syscallproto=''
868 d_sysconf=''
869 d_system=''
870 d_tcgetpgrp=''
871 d_tcsetpgrp=''
872 d_telldirproto=''
873 d_tgamma=''
874 d_time=''
875 timetype=''
876 d_asctime64=''
877 d_ctime64=''
878 d_difftime64=''
879 d_gmtime64=''
880 d_localtime64=''
881 d_mktime64=''
882 d_timegm=''
883 clocktype=''
884 d_times=''
885 d_tmpnam_r=''
886 tmpnam_r_proto=''
887 d_trunc=''
888 d_truncate=''
889 d_truncl=''
890 d_ttyname_r=''
891 ttyname_r_proto=''
892 d_tzname=''
893 d_u32align=''
894 d_ualarm=''
895 d_umask=''
896 d_semctl_semid_ds=''
897 d_semctl_semun=''
898 d_union_semun=''
899 d_unordered=''
900 d_unsetenv=''
901 d_usleep=''
902 d_usleepproto=''
903 d_ustat=''
904 d_pseudofork=''
905 d_vfork=''
906 usevfork=''
907 d_voidsig=''
908 signal_t=''
909 d_volatile=''
910 d_charvspr=''
911 d_vprintf=''
912 d_wait4=''
913 d_waitpid=''
914 d_wcscmp=''
915 d_wcstombs=''
916 d_wcsxfrm=''
917 d_wctomb=''
918 d_writev=''
919 dlext=''
920 bin_ELF=''
921 cccdlflags=''
922 ccdlflags=''
923 dlsrc=''
924 ld=''
925 ld_can_script=''
926 lddlflags=''
927 usedl=''
928 doublesize=''
929 ebcdic=''
930 fflushNULL=''
931 fflushall=''
932 fpossize=''
933 fpostype=''
934 gccansipedantic=''
935 gccosandvers=''
936 gccversion=''
937 gidformat=''
938 gidsign=''
939 gidsize=''
940 gidtype=''
941 groupstype=''
942 h_fcntl=''
943 h_sysfile=''
944 html1dir=''
945 html1direxp=''
946 installhtml1dir=''
947 html3dir=''
948 html3direxp=''
949 installhtml3dir=''
950 i_arpainet=''
951 i_assert=''
952 i_bfd=''
953 i_crypt=''
954 db_hashtype=''
955 db_prefixtype=''
956 db_version_major=''
957 db_version_minor=''
958 db_version_patch=''
959 i_db=''
960 i_dbm=''
961 i_rpcsvcdbm=''
962 d_dirnamlen=''
963 direntrytype=''
964 i_dirent=''
965 i_dlfcn=''
966 i_execinfo=''
967 i_fcntl=''
968 i_fenv=''
969 i_float=''
970 i_fp=''
971 i_fp_class=''
972 i_gdbm=''
973 d_grpasswd=''
974 i_grp=''
975 i_ieeefp=''
976 i_inttypes=''
977 i_langinfo=''
978 i_libutil=''
979 i_limits=''
980 i_locale=''
981 i_machcthr=''
982 i_malloc=''
983 i_mallocmalloc=''
984 i_math=''
985 i_memory=''
986 i_mntent=''
987 d_gdbm_ndbm_h_uses_prototypes=''
988 d_gdbmndbm_h_uses_prototypes=''
989 d_ndbm=''
990 d_ndbm_h_uses_prototypes=''
991 i_gdbm_ndbm=''
992 i_gdbmndbm=''
993 i_ndbm=''
994 i_netdb=''
995 i_neterrno=''
996 i_netinettcp=''
997 i_niin=''
998 i_sysin=''
999 i_poll=''
1000 i_prot=''
1001 i_pthread=''
1002 d_pwage=''
1003 d_pwchange=''
1004 d_pwclass=''
1005 d_pwcomment=''
1006 d_pwexpire=''
1007 d_pwgecos=''
1008 d_pwpasswd=''
1009 d_pwquota=''
1010 i_pwd=''
1011 i_quadmath=''
1012 i_shadow=''
1013 i_socks=''
1014 i_stdbool=''
1015 i_stddef=''
1016 i_stdint=''
1017 i_stdlib=''
1018 i_string=''
1019 strings=''
1020 i_sunmath=''
1021 i_sysaccess=''
1022 i_sysdir=''
1023 i_sysfile=''
1024 d_voidtty=''
1025 i_bsdioctl=''
1026 i_sysfilio=''
1027 i_sysioctl=''
1028 i_syssockio=''
1029 i_syslog=''
1030 i_sysmman=''
1031 i_sysmode=''
1032 i_sysmount=''
1033 i_sysndir=''
1034 i_sysparam=''
1035 i_syspoll=''
1036 i_sysresrc=''
1037 i_syssecrt=''
1038 i_sysselct=''
1039 i_sysstat=''
1040 i_sysstatfs=''
1041 i_sysstatvfs=''
1042 i_systimes=''
1043 i_systypes=''
1044 i_sysuio=''
1045 i_sysun=''
1046 i_sysutsname=''
1047 i_sysvfs=''
1048 i_syswait=''
1049 i_sgtty=''
1050 i_termio=''
1051 i_termios=''
1052 d_tm_tm_gmtoff=''
1053 d_tm_tm_zone=''
1054 i_systime=''
1055 i_systimek=''
1056 i_time=''
1057 timeincl=''
1058 i_unistd=''
1059 i_ustat=''
1060 i_utime=''
1061 i_values=''
1062 i_stdarg=''
1063 i_varargs=''
1064 i_varhdr=''
1065 i_vfork=''
1066 d_inc_version_list=''
1067 inc_version_list=''
1068 inc_version_list_init=''
1069 doubleinfbytes=''
1070 doublenanbytes=''
1071 longdblinfbytes=''
1072 longdblnanbytes=''
1073 installprefix=''
1074 installprefixexp=''
1075 installstyle=''
1076 installusrbinperl=''
1077 intsize=''
1078 longsize=''
1079 shortsize=''
1080 issymlink=''
1081 libc=''
1082 ldlibpthname=''
1083 libperl=''
1084 shrpenv=''
1085 useshrplib=''
1086 glibpth=''
1087 incpth=''
1088 libpth=''
1089 loclibpth=''
1090 plibpth=''
1091 xlibpth=''
1092 ignore_versioned_solibs=''
1093 libs=''
1094 libsdirs=''
1095 libsfiles=''
1096 libsfound=''
1097 libspath=''
1098 lns=''
1099 d_PRIEUldbl=''
1100 d_PRIFUldbl=''
1101 d_PRIGUldbl=''
1102 d_PRIeldbl=''
1103 d_PRIfldbl=''
1104 d_PRIgldbl=''
1105 d_SCNfldbl=''
1106 doublekind=''
1107 sPRIEUldbl=''
1108 sPRIFUldbl=''
1109 sPRIGUldbl=''
1110 sPRIeldbl=''
1111 sPRIfldbl=''
1112 sPRIgldbl=''
1113 sSCNfldbl=''
1114 lseeksize=''
1115 lseektype=''
1116 make_set_make=''
1117 d_mymalloc=''
1118 freetype=''
1119 mallocobj=''
1120 mallocsrc=''
1121 malloctype=''
1122 usemallocwrap=''
1123 usemymalloc=''
1124 installman1dir=''
1125 man1dir=''
1126 man1direxp=''
1127 man1ext=''
1128 installman3dir=''
1129 man3dir=''
1130 man3direxp=''
1131 man3ext=''
1132 doublemantbits=''
1133 longdblmantbits=''
1134 nvmantbits=''
1135 modetype=''
1136 multiarch=''
1137 mydomain=''
1138 myhostname=''
1139 phostname=''
1140 c=''
1141 n=''
1142 d_eofnblk=''
1143 eagain=''
1144 o_nonblock=''
1145 rd_nodata=''
1146 need_va_copy=''
1147 netdb_hlen_type=''
1148 netdb_host_type=''
1149 netdb_name_type=''
1150 netdb_net_type=''
1151 groupcat=''
1152 hostcat=''
1153 passcat=''
1154 orderlib=''
1155 ranlib=''
1156 d_perl_otherlibdirs=''
1157 otherlibdirs=''
1158 package=''
1159 spackage=''
1160 pager=''
1161 api_revision=''
1162 api_subversion=''
1163 api_version=''
1164 api_versionstring=''
1165 patchlevel=''
1166 perl_patchlevel=''
1167 revision=''
1168 subversion=''
1169 version=''
1170 version_patchlevel_string=''
1171 perl5=''
1172 perladmin=''
1173 perlpath=''
1174 d_nv_preserves_uv=''
1175 d_nv_zero_is_allbits_zero=''
1176 i16size=''
1177 i16type=''
1178 i32size=''
1179 i32type=''
1180 i64size=''
1181 i64type=''
1182 i8size=''
1183 i8type=''
1184 ivsize=''
1185 ivtype=''
1186 nv_overflows_integers_at=''
1187 nv_preserves_uv_bits=''
1188 nvsize=''
1189 nvtype=''
1190 u16size=''
1191 u16type=''
1192 u32size=''
1193 u32type=''
1194 u64size=''
1195 u64type=''
1196 u8size=''
1197 u8type=''
1198 uvsize=''
1199 uvtype=''
1200 ivdformat=''
1201 nvEUformat=''
1202 nvFUformat=''
1203 nvGUformat=''
1204 nveformat=''
1205 nvfformat=''
1206 nvgformat=''
1207 uvXUformat=''
1208 uvoformat=''
1209 uvuformat=''
1210 uvxformat=''
1211 pidtype=''
1212 prefix=''
1213 prefixexp=''
1214 installprivlib=''
1215 privlib=''
1216 privlibexp=''
1217 prototype=''
1218 ptrsize=''
1219 d_PRIXU64=''
1220 d_PRId64=''
1221 d_PRIi64=''
1222 d_PRIo64=''
1223 d_PRIu64=''
1224 d_PRIx64=''
1225 sPRIXU64=''
1226 sPRId64=''
1227 sPRIi64=''
1228 sPRIo64=''
1229 sPRIu64=''
1230 sPRIx64=''
1231 d_quad=''
1232 quadkind=''
1233 quadtype=''
1234 uquadtype=''
1235 drand01=''
1236 randbits=''
1237 randfunc=''
1238 randseedtype=''
1239 seedfunc=''
1240 installscript=''
1241 scriptdir=''
1242 scriptdirexp=''
1243 selectminbits=''
1244 selecttype=''
1245 sh=''
1246 targetsh=''
1247 sig_count=''
1248 sig_name=''
1249 sig_name_init=''
1250 sig_num=''
1251 sig_num_init=''
1252 sig_size=''
1253 d_sitearch=''
1254 installsitearch=''
1255 sitearch=''
1256 sitearchexp=''
1257 installsitebin=''
1258 sitebin=''
1259 sitebinexp=''
1260 installsitehtml1dir=''
1261 sitehtml1dir=''
1262 sitehtml1direxp=''
1263 installsitehtml3dir=''
1264 sitehtml3dir=''
1265 sitehtml3direxp=''
1266 installsitelib=''
1267 sitelib=''
1268 sitelib_stem=''
1269 sitelibexp=''
1270 installsiteman1dir=''
1271 siteman1dir=''
1272 siteman1direxp=''
1273 installsiteman3dir=''
1274 siteman3dir=''
1275 siteman3direxp=''
1276 siteprefix=''
1277 siteprefixexp=''
1278 installsitescript=''
1279 sitescript=''
1280 sitescriptexp=''
1281 sizesize=''
1282 sizetype=''
1283 d_libname_unique=''
1284 so=''
1285 socksizetype=''
1286 sharpbang=''
1287 shsharp=''
1288 spitshell=''
1289 src=''
1290 ssizetype=''
1291 st_ino_sign=''
1292 st_ino_size=''
1293 startperl=''
1294 startsh=''
1295 stdchar=''
1296 d_stdio_stream_array=''
1297 stdio_stream_array=''
1298 sysman=''
1299 sGMTIME_max=''
1300 sGMTIME_min=''
1301 sLOCALTIME_max=''
1302 sLOCALTIME_min=''
1303 trnl=''
1304 uidformat=''
1305 uidsign=''
1306 uidsize=''
1307 uidtype=''
1308 archname64=''
1309 use64bitall=''
1310 use64bitint=''
1311 usecbacktrace=''
1312 dtrace=''
1313 usedtrace=''
1314 usefaststdio=''
1315 usekernprocpathname=''
1316 ccflags_uselargefiles=''
1317 ldflags_uselargefiles=''
1318 libswanted_uselargefiles=''
1319 uselargefiles=''
1320 uselongdouble=''
1321 usemorebits=''
1322 usemultiplicity=''
1323 nm_opt=''
1324 nm_so_opt=''
1325 runnm=''
1326 usenm=''
1327 usensgetexecutablepath=''
1328 useperlio=''
1329 usequadmath=''
1330 usesocks=''
1331 d_oldpthreads=''
1332 use5005threads=''
1333 useithreads=''
1334 usereentrant=''
1335 usethreads=''
1336 incpath=''
1337 mips_type=''
1338 usrinc=''
1339 vaproto=''
1340 d_vendorarch=''
1341 installvendorarch=''
1342 vendorarch=''
1343 vendorarchexp=''
1344 d_vendorbin=''
1345 installvendorbin=''
1346 vendorbin=''
1347 vendorbinexp=''
1348 installvendorhtml1dir=''
1349 vendorhtml1dir=''
1350 vendorhtml1direxp=''
1351 installvendorhtml3dir=''
1352 vendorhtml3dir=''
1353 vendorhtml3direxp=''
1354 d_vendorlib=''
1355 installvendorlib=''
1356 vendorlib=''
1357 vendorlib_stem=''
1358 vendorlibexp=''
1359 installvendorman1dir=''
1360 vendorman1dir=''
1361 vendorman1direxp=''
1362 installvendorman3dir=''
1363 vendorman3dir=''
1364 vendorman3direxp=''
1365 usevendorprefix=''
1366 vendorprefix=''
1367 vendorprefixexp=''
1368 d_vendorscript=''
1369 installvendorscript=''
1370 vendorscript=''
1371 vendorscriptexp=''
1372 versiononly=''
1373 yacc=''
1374 yaccflags=''
1375 CONFIG=''
1376
1377 : Detect odd OSs
1378 define='define'
1379 undef='undef'
1380 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1381 rmlist=''
1382
1383 : We must find out about Eunice early
1384 eunicefix=':'
1385 if test -f /etc/unixtovms; then
1386         eunicefix=/etc/unixtovms
1387 fi
1388 if test -f /etc/unixtovms.exe; then
1389         eunicefix=/etc/unixtovms.exe
1390 fi
1391
1392 : Set executable suffix now -- needed before hints available
1393 if test -f "/libs/version.library"; then
1394 : Amiga OS
1395     _exe=""
1396 elif test -f "/system/gnu_library/bin/ar.pm"; then
1397 : Stratus VOS
1398     _exe=".pm"
1399 elif test -n "$DJGPP"; then
1400 : DOS DJGPP
1401     _exe=".exe"
1402 elif test -f /kern/cookiejar; then
1403 : MiNT
1404     _exe=""
1405 elif test -d c:/. -o -n "$is_os2" ; then
1406 : OS/2 or cygwin
1407     _exe=".exe"
1408 fi
1409
1410 groupstype=''
1411 i_whoami=''
1412 : Trailing extension.  Override this in a hint file, if needed.
1413 : Extra object files, if any, needed on this platform.
1414 archobjs=''
1415 archname=''
1416 : Possible local include directories to search.
1417 : Set locincpth to "" in a hint file to defeat local include searches.
1418 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1419 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1420 :
1421 : no include file wanted by default
1422 inclwanted=''
1423
1424 : Enable -DEBUGGING and -DDEBUGGING from the command line
1425 EBUGGING=''
1426 DEBUGGING=''
1427
1428 libnames=''
1429 : change the next line if compiling for Xenix/286 on Xenix/386
1430 xlibpth='/usr/lib/386 /lib/386'
1431 : Possible local library directories to search.
1432 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1433 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1434
1435 : general looking path for locating libraries
1436 glibpth="/lib /usr/lib $xlibpth"
1437 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1438 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1439 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1440 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1441
1442 : Private path used by Configure to find libraries.  Its value
1443 : is prepended to libpth. This variable takes care of special
1444 : machines, like the mips.  Usually, it should be empty.
1445 plibpth=''
1446
1447 : default library list
1448 libswanted=''
1449 : some systems want to use only the non-versioned libso:s
1450 ignore_versioned_solibs=''
1451 : set usethreads on the Configure command line to enable threads.
1452 usereentrant='undef'
1453 ccname=''
1454 ccversion=''
1455 perllibs=''
1456 : set useposix=false in your hint file to disable the POSIX extension.
1457 useposix=true
1458 : set useopcode=false in your hint file to disable the Opcode extension.
1459 useopcode=true
1460 archname64=''
1461 ccflags_uselargefiles=''
1462 ldflags_uselargefiles=''
1463 libswanted_uselargefiles=''
1464 : set usemultiplicity on the Configure command line to enable multiplicity.
1465 : set usesocks on the Configure command line to enable socks.
1466 : List of libraries we want.
1467 : If anyone needs extra -lxxx, put those in a hint file.
1468 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1469 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1470 : We probably want to search /usr/shlib before most other libraries.
1471 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1472 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1473 glibpth="/usr/shlib $glibpth"
1474 : Do not use vfork unless overridden by a hint file.
1475 usevfork=false
1476
1477 : Find the basic shell for Bourne shell scripts
1478 case "$sh" in
1479 '')
1480         case "$SYSTYPE" in
1481         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1482         *) xxx='/bin/sh';;
1483         esac
1484         if test -f "$xxx"; then
1485                 sh="$xxx"
1486         else
1487                 : Build up a list and do a single loop so we can 'break' out.
1488                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1489                 for xxx in sh bash ksh pdksh ash; do
1490                         for p in $pth; do
1491                                 try="$try ${p}/${xxx}"
1492                         done
1493                 done
1494                 for xxx in $try; do
1495                         if test -f "$xxx"; then
1496                                 sh="$xxx";
1497                                 break
1498                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1499                                 sh="$xxx";
1500                                 break
1501                         elif test -f "$xxx.exe"; then
1502                                 sh="$xxx";
1503                                 break
1504                         fi
1505                 done
1506         fi
1507         ;;
1508 esac
1509
1510 case "$sh" in
1511 '')     cat >&2 <<EOM
1512 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1513
1514 Usually it's in /bin/sh.  How did you even get this far?
1515 Please contact me (Perl Maintainers) at perlbug@perl.org and
1516 we'll try to straighten this all out.
1517 EOM
1518         exit 1
1519         ;;
1520 esac
1521
1522 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1523 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1524 targetsh=$sh
1525
1526 : see if sh knows # comments
1527 if `$sh -c '#' >/dev/null 2>&1`; then
1528         shsharp=true
1529         spitshell=cat
1530         xcat=/bin/cat
1531         test -f $xcat$_exe || xcat=/usr/bin/cat
1532         if test ! -f $xcat$_exe; then
1533                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1534                         if test -f $p/cat$_exe; then
1535                                 xcat=$p/cat
1536                                 break
1537                         fi
1538                 done
1539                 if test ! -f $xcat$_exe; then
1540                         echo "Can't find cat anywhere!"
1541                         exit 1
1542                 fi
1543         fi
1544         echo "#!$xcat" >sharp
1545         $eunicefix sharp
1546         chmod +x sharp
1547         ./sharp > today 2>/dev/null
1548         if test -s today; then
1549                 sharpbang='#!'
1550         else
1551                 echo "#! $xcat" > sharp
1552                 $eunicefix sharp
1553                 chmod +x sharp
1554                 ./sharp > today 2>/dev/null
1555                 if test -s today; then
1556                         sharpbang='#! '
1557                 else
1558                         sharpbang=': use '
1559                 fi
1560         fi
1561 else
1562         echo " "
1563         echo "Your $sh doesn't grok # comments--I will strip them later on."
1564         shsharp=false
1565         cd ..
1566         echo "exec grep -v '^[  ]*#'" >spitshell
1567         chmod +x spitshell
1568         $eunicefix spitshell
1569         spitshell=`pwd`/spitshell
1570         cd UU
1571         echo "I presume that if # doesn't work, #! won't work either!"
1572         sharpbang=': use '
1573 fi
1574 rm -f sharp today
1575
1576 : figure out how to guarantee sh startup
1577 case "$startsh" in
1578 '') startsh=${sharpbang}${sh} ;;
1579 *)
1580 esac
1581 cat >sharp <<EOSS
1582 $startsh
1583 set abc
1584 test "$?abc" != 1
1585 EOSS
1586
1587 chmod +x sharp
1588 $eunicefix sharp
1589 if ./sharp; then
1590         : echo "Yup, it does."
1591 else
1592         echo "Hmm... '$startsh' does not guarantee sh startup..."
1593         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1594 fi
1595 rm -f sharp
1596
1597 : Save command line options in file UU/cmdline.opt for later use in
1598 : generating config.sh.
1599 cat > cmdline.opt <<EOSH
1600 : Configure command line arguments.
1601 config_arg0='$0'
1602 config_args='$*'
1603 config_argc=$#
1604 EOSH
1605 argn=1
1606 args_exp=''
1607 args_sep=''
1608 for arg in "$@"; do
1609         cat >>cmdline.opt <<EOSH
1610 config_arg$argn='$arg'
1611 EOSH
1612         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1613 $arg
1614 EOC
1615         arg_exp=`cat cmdl.opt`
1616         args_exp="$args_exp$args_sep'$arg_exp'"
1617         argn=`expr $argn + 1`
1618         args_sep=' '
1619 done
1620 rm -f cmdl.opt
1621
1622 : produce awk script to parse command line options
1623 cat >options.awk <<'EOF'
1624 BEGIN {
1625         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1626
1627         len = length(optstr);
1628         for (i = 1; i <= len; i++) {
1629                 c = substr(optstr, i, 1);
1630                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1631                 if (a == ":") {
1632                         arg[c] = 1;
1633                         i++;
1634                 }
1635                 opt[c] = 1;
1636         }
1637 }
1638 {
1639         expect = 0;
1640         str = $0;
1641         if (substr(str, 1, 1) != "-") {
1642                 printf("'%s'\n", str);
1643                 next;
1644         }
1645         len = length($0);
1646         for (i = 2; i <= len; i++) {
1647                 c = substr(str, i, 1);
1648                 if (!opt[c]) {
1649                         printf("-%s\n", substr(str, i));
1650                         next;
1651                 }
1652                 printf("-%s\n", c);
1653                 if (arg[c]) {
1654                         if (i < len)
1655                                 printf("'%s'\n", substr(str, i + 1));
1656                         else
1657                                 expect = 1;
1658                         next;
1659                 }
1660         }
1661 }
1662 END {
1663         if (expect)
1664                 print "?";
1665 }
1666 EOF
1667
1668 : process the command line options
1669 set X `for arg in "$@"; do echo "X$arg"; done |
1670         sed -e s/X// | awk -f options.awk`
1671 eval "set $*"
1672 shift
1673 rm -f options.awk
1674
1675 : set up default values
1676 fastread=''
1677 reuseval=false
1678 config_sh=''
1679 alldone=''
1680 error=''
1681 silent=''
1682 extractsh=''
1683 knowitall=''
1684 rm -f optdef.sh posthint.sh
1685 cat >optdef.sh <<EOS
1686 $startsh
1687 EOS
1688
1689
1690 : option parsing
1691 while test $# -gt 0; do
1692         case "$1" in
1693         -d) shift; fastread=yes;;
1694         -e) shift; alldone=cont;;
1695         -f)
1696                 shift
1697                 cd ..
1698                 if test -r "$1"; then
1699                         config_sh="$1"
1700                 else
1701                         echo "$me: cannot read config file $1." >&2
1702                         error=true
1703                 fi
1704                 cd UU
1705                 shift;;
1706         --help|\
1707         -h) shift; error=true;;
1708         -r) shift; reuseval=true;;
1709         -s) shift; silent=true; realsilent=true;;
1710         -E) shift; alldone=exit;;
1711         -K) shift; knowitall=true;;
1712         -O) shift;;
1713         -S) shift; silent=true; extractsh=true;;
1714         -D)
1715                 shift
1716                 case "$1" in
1717                 *=)
1718                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1719                         echo "$me: ignoring -D $1" >&2
1720                         ;;
1721                 *=*) echo "$1" | \
1722                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1723                 *) echo "$1='define'" >> optdef.sh;;
1724                 esac
1725                 shift
1726                 ;;
1727         -U)
1728                 shift
1729                 case "$1" in
1730                 *=) echo "$1" >> optdef.sh;;
1731                 *=*)
1732                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1733                         echo "$me: ignoring -U $1" >&2
1734                         ;;
1735                 *) echo "$1='undef'" >> optdef.sh;;
1736                 esac
1737                 shift
1738                 ;;
1739         -A)
1740             shift
1741             xxx=''
1742             yyy="$1"
1743             zzz=''
1744             uuu=undef
1745             case "$yyy" in
1746             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1747                  case "$zzz" in
1748                  *:*) zzz='' ;;
1749                  *)   xxx=append
1750                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1751                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1752                  esac
1753                  ;;
1754             esac
1755             case "$xxx" in
1756             '')  case "$yyy" in
1757                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1758                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1759                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1760                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1761                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1762                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1763                  esac
1764                  ;;
1765             esac
1766             case "$xxx" in
1767             append)
1768                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1769             clear)
1770                 echo "$yyy=''"                  >> posthint.sh ;;
1771             define)
1772                 case "$zzz" in
1773                 '') zzz=define ;;
1774                 esac
1775                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1776             eval)
1777                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1778             prepend)
1779                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1780             undef)
1781                 case "$zzz" in
1782                 '') zzz="$uuu" ;;
1783                 esac
1784                 echo "$yyy=$zzz"                >> posthint.sh ;;
1785             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1786             esac
1787             shift
1788             ;;
1789         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1790             exit 0;;
1791         --) break;;
1792         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1793         *) break;;
1794         esac
1795 done
1796
1797 case "$error" in
1798 true)
1799         cat >&2 <<EOM
1800 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1801                  [-U symbol] [-U symbol=] [-A command:symbol...]
1802   -d : use defaults for all answers.
1803   -e : go on without questioning past the production of config.sh.
1804   -f : specify an alternate default configuration file.
1805   -h : print this help message and exit (with an error status).
1806   -r : reuse C symbols value if possible (skips costly nm extraction).
1807   -s : silent mode, only echoes questions and essential information.
1808   -D : define symbol to have some value:
1809          -D symbol         symbol gets the value 'define'
1810          -D symbol=value   symbol gets the value 'value'
1811        common used examples (see INSTALL for more info):
1812          -Duse64bitint            use 64bit integers
1813          -Duse64bitall            use 64bit integers and pointers
1814          -Dusethreads             use thread support
1815          -Dinc_version_list=none  do not include older perl trees in @INC
1816          -DEBUGGING=none          DEBUGGING options
1817          -Dcc=gcc                 choose your compiler
1818          -Dprefix=/opt/perl5      choose your destination
1819   -E : stop at the end of questions, after having produced config.sh.
1820   -K : do not use unless you know what you are doing.
1821   -O : ignored for backward compatibility
1822   -S : perform variable substitutions on all .SH files (can mix with -f)
1823   -U : undefine symbol:
1824          -U symbol    symbol gets the value 'undef'
1825          -U symbol=   symbol gets completely empty
1826        e.g.:  -Uversiononly
1827   -A : manipulate symbol after the platform specific hints have been applied:
1828          -A append:symbol=value   append value to symbol
1829          -A symbol=value          like append:, but with a separating space
1830          -A define:symbol=value   define symbol to have value
1831          -A clear:symbol          define symbol to be ''
1832          -A define:symbol         define symbol to be 'define'
1833          -A eval:symbol=value     define symbol to be eval of value
1834          -A prepend:symbol=value  prepend value to symbol
1835          -A undef:symbol          define symbol to be 'undef'
1836          -A undef:symbol=         define symbol to be ''
1837        e.g.:  -A prepend:libswanted='cl pthread '
1838               -A ccflags=-DSOME_MACRO
1839   -V : print version number and exit (with a zero status).
1840 EOM
1841         exit 1
1842         ;;
1843 esac
1844
1845 : Sanity checks
1846 case "$fastread$alldone" in
1847 yescont|yesexit) ;;
1848 *)
1849         case "$extractsh" in
1850         true) ;;
1851         *)
1852                 if test ! -t 0; then
1853                         echo "Say 'sh Configure', not 'sh <Configure'"
1854                         exit 1
1855                 fi
1856                 ;;
1857         esac
1858         ;;
1859 esac
1860
1861 exec 4>&1
1862 case "$silent" in
1863 true) exec 1>/dev/null;;
1864 esac
1865
1866 : run the defines and the undefines, if any, but leave the file out there...
1867 touch optdef.sh
1868 grep '\\' optdef.sh >/dev/null 2>&1
1869 if test $? = 0; then
1870     echo "Configure does not support \\ in -D arguments"
1871     exit 1
1872 fi
1873 . ./optdef.sh
1874 : create the posthint manipulation script and leave the file out there...
1875 touch posthint.sh
1876
1877 : set package name
1878 package='perl5'
1879 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1880 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1881 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1882 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1883 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1884 esac
1885
1886 : Some greps do not return status, grrr.
1887 echo "grimblepritz" >grimble
1888 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1889         contains=contains
1890 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1891         contains=grep
1892 else
1893         contains=contains
1894 fi
1895 rm -f grimble
1896 : the following should work in any shell
1897 case "$contains" in
1898 contains*)
1899         echo " "
1900         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1901         cat >contains <<'EOSS'
1902 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1903 EOSS
1904 chmod +x contains
1905 esac
1906
1907 : Find the path to the source tree
1908 case "$src" in
1909 '') case "$0" in
1910     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1911          case "$src" in
1912          /*)    ;;
1913          .)     ;;
1914          *)     src=`cd ../$src && pwd` ;;
1915          esac
1916          ;;
1917     *)   src='.';;
1918     esac;;
1919 esac
1920 case "$src" in
1921 '')     src=/
1922         rsrc=/
1923         ;;
1924 /*)     rsrc="$src";;
1925 *)      rsrc="../$src";;
1926 esac
1927 if test -f $rsrc/Configure && \
1928         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1929 then
1930    : found it, so we are ok.
1931 else
1932         rsrc=''
1933         for src in . .. ../.. ../../.. ../../../..; do
1934                 if test -f ../$src/Configure && \
1935                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1936                 then
1937                         rsrc=../$src
1938                         break
1939                 fi
1940         done
1941 fi
1942 case "$rsrc" in
1943 '')
1944         cat <<EOM >&4
1945
1946 Sorry, I can't seem to locate the source dir for $package.  Please start
1947 Configure with an explicit path -- i.e. /some/path/Configure.
1948
1949 EOM
1950         exit 1
1951         ;;
1952 ../.)   rsrc='..';;
1953 *)
1954         echo " "
1955         echo "Sources for $package found in \"$src\"." >&4
1956         ;;
1957 esac
1958
1959 : script used to extract .SH files with variable substitutions
1960 cat >extract <<'EOS'
1961 PERL_CONFIG_SH=true
1962 echo "Doing variable substitutions on .SH files..."
1963 if test -f MANIFEST; then
1964         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1965 else
1966         echo "(Looking for .SH files under the source directory.)"
1967         set x `(cd "$src"; find . -name "*.SH" -print)`
1968 fi
1969 shift
1970 case $# in
1971 0) set x `(cd "$src"; echo *.SH)`; shift;;
1972 esac
1973 if test ! -f "$src/$1"; then
1974         shift
1975 fi
1976 mkdir_p='
1977 name=$1;
1978 create="";
1979 while test $name; do
1980         if test ! -d "$name"; then
1981                 create="$name $create";
1982                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1983                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1984         else
1985                 name="";
1986         fi;
1987 done;
1988 for file in $create; do
1989         mkdir $file;
1990 done
1991 '
1992 for file in $*; do
1993         case "$src" in
1994         ".")
1995                 case "$file" in
1996                 */*)
1997                         dir=`expr X$file : 'X\(.*\)/'`
1998                         file=`expr X$file : 'X.*/\(.*\)'`
1999                         (cd "$dir" && . ./$file)
2000                         ;;
2001                 *)
2002                         . ./$file
2003                         ;;
2004                 esac
2005                 ;;
2006         *)
2007                 case "$file" in
2008                 */*)
2009                         dir=`expr X$file : 'X\(.*\)/'`
2010                         file=`expr X$file : 'X.*/\(.*\)'`
2011                         (set x $dir; shift; eval $mkdir_p)
2012                         sh <"$src/$dir/$file"
2013                         ;;
2014                 *)
2015                         sh <"$src/$file"
2016                         ;;
2017                 esac
2018                 ;;
2019         esac
2020 done
2021 if test -f "$src/config_h.SH"; then
2022         if test ! -f config.h; then
2023         : oops, they left it out of MANIFEST, probably, so do it anyway.
2024         . "$src/config_h.SH"
2025         fi
2026 fi
2027 EOS
2028
2029 : extract files and exit if asked to do so
2030 case "$extractsh" in
2031 true)
2032         case "$realsilent" in
2033         true) ;;
2034         *) exec 1>&4;;
2035         esac
2036         case "$config_sh" in
2037         '') config_sh='config.sh';;
2038         esac
2039         echo " "
2040         echo "Fetching answers from $config_sh..."
2041         cd ..
2042         . $config_sh
2043         . UU/optdef.sh
2044         echo " "
2045         . UU/extract
2046         rm -rf UU
2047         echo "Extraction done."
2048         exit 0
2049         ;;
2050 esac
2051
2052 : Eunice requires " " instead of "", can you believe it
2053 echo " "
2054 : Here we go...
2055 echo "Beginning of configuration questions for $package."
2056
2057 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2058
2059 : first determine how to suppress newline on echo command
2060 echo " "
2061 echo "Checking echo to see how to suppress newlines..."
2062 (echo "hi there\c" ; echo " ") >.echotmp
2063 if $contains c .echotmp >/dev/null 2>&1 ; then
2064         echo "...using -n."
2065         n='-n'
2066         c=''
2067 else
2068         cat <<'EOM'
2069 ...using \c
2070 EOM
2071         n=''
2072         c='\c'
2073 fi
2074 echo $n "The star should be here-->$c"
2075 echo '*'
2076 rm -f .echotmp
2077
2078 : Now test for existence of everything in MANIFEST
2079 echo " "
2080 if test -f "$rsrc/MANIFEST"; then
2081         echo "First let's make sure your kit is complete.  Checking..." >&4
2082         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2083                 (split -l 50 2>/dev/null || split -50)
2084         rm -f missing
2085         tmppwd=`pwd`
2086         for filelist in x??; do
2087                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2088                         >/dev/null 2>>"$tmppwd/missing")
2089         done
2090         if test -s missing; then
2091                 cat missing >&4
2092                 cat >&4 <<'EOM'
2093
2094 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2095
2096 You have the option of continuing the configuration process, despite the
2097 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2098 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2099 and contact the author (perlbug@perl.org).
2100
2101 EOM
2102                 echo $n "Continue? [n] $c" >&4
2103                 read ans
2104                 case "$ans" in
2105                 y*)
2106                         echo "Continuing..." >&4
2107                         rm -f missing
2108                         ;;
2109                 *)
2110                         echo "ABORTING..." >&4
2111                         kill $$
2112                         ;;
2113                 esac
2114         else
2115                 echo "Looks good..."
2116         fi
2117 else
2118         echo "There is no MANIFEST file.  I hope your kit is complete !"
2119 fi
2120 rm -f missing x??
2121
2122 : Find the appropriate value for a newline for tr
2123 echo " "
2124 if test -n "$DJGPP"; then
2125        trnl='\012'
2126 fi
2127 if test X"$trnl" = X; then
2128         case "`echo foo|tr '\n' x 2>/dev/null`" in
2129         foox) trnl='\n' ;;
2130         esac
2131 fi
2132 if test X"$trnl" = X; then
2133         case "`echo foo|tr '\012' x 2>/dev/null`" in
2134         foox) trnl='\012' ;;
2135         esac
2136 fi
2137 if test X"$trnl" = X; then
2138        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2139        fooxy) trnl='\n\r' ;;
2140        esac
2141 fi
2142 if test X"$trnl" = X; then
2143         cat <<EOM >&2
2144
2145 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2146
2147 EOM
2148         exit 1
2149 fi
2150
2151 : compute the number of columns on the terminal for proper question formatting
2152 case "$COLUMNS" in
2153 '') COLUMNS='80';;
2154 esac
2155
2156 : set up the echo used in my read
2157 myecho="case \"\$xxxm\" in
2158 '') echo $n \"\$rp $c\" >&4;;
2159 *) case \"\$rp\" in
2160         '') echo $n \"[\$xxxm] $c\";;
2161         *)
2162                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2163                         echo \"\$rp\" >&4
2164                         echo $n \"[\$xxxm] $c\" >&4
2165                 else
2166                         echo $n \"\$rp [\$xxxm] $c\" >&4
2167                 fi
2168                 ;;
2169         esac;;
2170 esac"
2171
2172 : now set up to do reads with possible shell escape and default assignment
2173 cat <<EOSC >myread
2174 $startsh
2175 xxxm=\$dflt
2176 $myecho
2177 ans='!'
2178 case "\$fastread" in
2179 yes) case "\$dflt" in
2180         '') ;;
2181         *) ans='';
2182                 case "\$silent-\$rp" in
2183                 true-) ;;
2184                 *) echo " " >&4;;
2185                 esac;;
2186         esac;;
2187 *) case "\$silent" in
2188         true) case "\$rp" in
2189                 '') ans='';;
2190                 esac;;
2191         esac;;
2192 esac
2193 while expr "X\$ans" : "X!" >/dev/null; do
2194         read answ
2195         set x \$xxxm
2196         shift
2197         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2198         case  "\$answ" in
2199         "!")
2200                 sh 1>&4
2201                 echo " "
2202                 $myecho
2203                 ;;
2204         !*)
2205                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2206                 shift
2207                 sh 1>&4 -c "\$*"
2208                 echo " "
2209                 $myecho
2210                 ;;
2211         "\$ans")
2212                 case "\$ans" in
2213                 \\&*)
2214                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2215                         shift
2216                         case "\$1" in
2217                         -d)
2218                                 fastread=yes
2219                                 echo "(OK, I'll run with -d after this question.)" >&4
2220                                 ;;
2221                         -*)
2222                                 echo "*** Sorry, \$1 not supported yet." >&4
2223                                 ;;
2224                         esac
2225                         $myecho
2226                         ans=!
2227                         ;;
2228                 esac;;
2229         *)
2230                 case "\$aok" in
2231                 y)
2232                         echo "*** Substitution done -- please confirm."
2233                         xxxm="\$ans"
2234                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2235                         xxxm="\$ans"
2236                         ans=!
2237                         ;;
2238                 *)
2239                         echo "*** Error -- try again."
2240                         ans=!
2241                         ;;
2242                 esac
2243                 $myecho
2244                 ;;
2245         esac
2246         case "\$ans\$xxxm\$nostick" in
2247         '')
2248                 ans=!
2249                 $myecho
2250                 ;;
2251         esac
2252 done
2253 case "\$ans" in
2254 '') ans="\$xxxm";;
2255 esac
2256 EOSC
2257
2258 : create .config dir to save info across Configure sessions
2259 test -d ../.config || mkdir ../.config
2260 cat >../.config/README <<EOF
2261 This directory created by Configure to save information that should
2262 persist across sessions for $package.
2263
2264 You may safely delete it if you wish.
2265 EOF
2266
2267 : See if we are using a devel version and want that
2268 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2269 case "$usedevel" in
2270 $define|true|[yY]*)
2271     usedevel="$define" ;;
2272 *) case "$xversion" in
2273    *[13579])
2274         cat >&4 <<EOH
2275 *** WHOA THERE!!! ***
2276
2277     This is an UNSTABLE DEVELOPMENT release.
2278     The version of this $package distribution is $xversion, that is, odd,
2279     (as opposed to even) and that signifies a development release.
2280     If you want a maintenance release, you want an even-numbered version.
2281
2282     Do ***NOT*** install this into production use.
2283     Data corruption and crashes are possible.
2284
2285     It is most seriously suggested that you do not continue any further
2286     unless you want to help in developing and debugging Perl.
2287
2288     If you *still* want to build perl, you can answer 'y' now,
2289     or pass -Dusedevel to Configure.
2290
2291 EOH
2292         rp='Do you really want to continue?'
2293         dflt='n'
2294         . ./myread
2295         case "$ans" in
2296         [yY]) echo >&4 "Okay, continuing."
2297               usedevel="$define" ;;
2298         *) echo >&4 "Okay, bye."
2299            exit 1
2300            ;;
2301         esac
2302         ;;
2303     esac
2304     usedevel="$undef"
2305     ;;
2306 esac
2307 case "$usedevel" in
2308 $define|true|[yY]*)
2309         case "$versiononly" in
2310         '') versiononly="$define" ;;
2311         esac
2312         case "$installusrbinperl" in
2313         '') installusrbinperl="$undef" ;;
2314         esac
2315         ;;
2316 esac
2317
2318 : general instructions
2319 needman=true
2320 firsttime=true
2321 user=`(logname) 2>/dev/null`
2322 case "$user" in
2323 '') user=`whoami 2>&1`;;
2324 esac
2325 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2326         firsttime=false
2327         echo " "
2328         rp='Would you like to see the instructions?'
2329         dflt=n
2330         . ./myread
2331         case "$ans" in
2332         [yY]*) ;;
2333         *) needman=false;;
2334         esac
2335 fi
2336 if $needman; then
2337         cat <<EOH
2338
2339 This installation shell script will examine your system and ask you questions
2340 to determine how the perl5 package should be installed. If you get
2341 stuck on a question, you may use a ! shell escape to start a subshell or
2342 execute a command.  Many of the questions will have default answers in square
2343 brackets; typing carriage return will give you the default.
2344
2345 On some of the questions which ask for file or directory names you are allowed
2346 to use the ~name construct to specify the login directory belonging to "name",
2347 even if you don't have a shell which knows about that.  Questions where this is
2348 allowed will be marked "(~name ok)".
2349
2350 EOH
2351         rp=''
2352         dflt='Type carriage return to continue'
2353         . ./myread
2354         cat <<'EOH'
2355
2356 The prompter used in this script allows you to use shell variables and
2357 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2358 in the default answer, as if the default line was a set of arguments given to a
2359 script shell.  This means you may also use $* to repeat the whole default line,
2360 so you do not have to re-type everything to add something to the default.
2361
2362 Every time there is a substitution, you will have to confirm.  If there is an
2363 error (e.g. an unmatched backtick), the default answer will remain unchanged
2364 and you will be prompted again.
2365
2366 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2367 the questions and use the computed defaults (or the previous answers if there
2368 was already a config.sh file). Type 'Configure -h' for a list of options.
2369 You may also start interactively and then answer '& -d' at any prompt to turn
2370 on the non-interactive behaviour for the remainder of the execution.
2371
2372 EOH
2373         . ./myread
2374         cat <<EOH
2375
2376 Much effort has been expended to ensure that this shell script will run on any
2377 Unix system.  If despite that it blows up on yours, your best bet is to edit
2378 Configure and run it again.  If you can't run Configure for some reason,
2379 you'll have to generate a config.sh file by hand.  Whatever problems you
2380 have, let me (perlbug@perl.org) know how I blew it.
2381
2382 This installation script affects things in two ways:
2383
2384 1) it may do direct variable substitutions on some of the files included
2385    in this kit.
2386 2) it builds a config.h file for inclusion in C programs.  You may edit
2387    any of these files as the need arises after running this script.
2388
2389 If you make a mistake on a question, there is no easy way to back up to it
2390 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2391 files.  Configure will offer to let you do this before it runs the SH files.
2392
2393 EOH
2394         dflt='Type carriage return to continue'
2395         . ./myread
2396         case "$firsttime" in
2397         true) echo $user >>../.config/instruct;;
2398         esac
2399 fi
2400
2401 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2402 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2403 if test "X$sysroot" = X; then
2404     sysroot=""
2405 else
2406     case "$cc" in
2407         *gcc*|*g++*)
2408             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2409             # _sysroot is used in places where we need --sysroot=foo
2410             # but using the rest of the flags could cause issues.
2411             _sysroot="--sysroot=$sysroot";
2412             case "$ccflags" in
2413                 *sysroot*) ;;
2414                 'undef'|*)
2415                 ccflags="$ccflags $_sysroot"
2416             esac
2417             case "$ldflags" in
2418                 *sysroot*) ;;
2419                 'undef'|*)
2420                 ldflags="$ldflags $_sysroot"
2421             esac
2422             case "$cppflags" in
2423                 *sysroot*) ;;
2424                 'undef'|*)
2425                 cppflags="$cppflags $_sysroot"
2426             esac
2427             # lddlflags updated below in lddlflags section;
2428             # same with cccdlflags
2429             ;;
2430     esac
2431
2432     # Adjust some defaults to also use $sysroot
2433     for var in xlibpth loclibpth locincpth glibpth; do
2434         eval xxx=\$$var
2435         eval $var=''
2436         for path in $xxx; do
2437             eval $var=\"\$$var $sysroot$path\"
2438         done
2439     done
2440
2441 fi
2442
2443 : find out where common programs are
2444 echo " "
2445 echo "Locating common programs..." >&4
2446 cat <<EOSC >loc
2447 $startsh
2448 case \$# in
2449 0) exit 1;;
2450 esac
2451 thing=\$1
2452 shift
2453 dflt=\$1
2454 shift
2455 for dir in \$*; do
2456         case "\$thing" in
2457         .)
2458         if test -d \$dir/\$thing; then
2459                 echo \$dir
2460                 exit 0
2461         fi
2462         ;;
2463         *)
2464         for thisthing in \$dir/\$thing; do
2465                 : just loop through to pick last item
2466         done
2467         if test -f \$thisthing; then
2468                 echo \$thisthing
2469                 exit 0
2470         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2471                 echo \$thisthing
2472                 exit 0
2473         elif test -f \$dir/\$thing.exe; then
2474                 if test -n "$DJGPP"; then
2475                         echo \$dir/\$thing.exe
2476                 elif test "$eunicefix" != ":"; then
2477                         : on Eunice apparently
2478                         echo \$dir/\$thing
2479                 fi
2480                 exit 0
2481         fi
2482         ;;
2483         esac
2484 done
2485 echo \$dflt
2486 exit 1
2487 EOSC
2488 chmod +x loc
2489 $eunicefix loc
2490 loclist="
2491 awk
2492 cat
2493 chmod
2494 comm
2495 cp
2496 echo
2497 expr
2498 grep
2499 ls
2500 mkdir
2501 rm
2502 sed
2503 sort
2504 touch
2505 tr
2506 uniq
2507 "
2508 trylist="
2509 ar
2510 bison
2511 byacc
2512 cpp
2513 csh
2514 date
2515 egrep
2516 gmake
2517 gzip
2518 less
2519 ln
2520 make
2521 more
2522 nm
2523 nroff
2524 perl
2525 pg
2526 test
2527 uname
2528 zip
2529 "
2530 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2531 pth="$pth $sysroot/lib $sysroot/usr/lib"
2532 for file in $loclist; do
2533         eval xxx=\$$file
2534         case "$xxx" in
2535         /*|?:[\\/]*)
2536                 if test -f "$xxx"; then
2537                         : ok
2538                 else
2539                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2540                         xxx=`./loc $file $file $pth`
2541                 fi
2542                 ;;
2543         '') xxx=`./loc $file $file $pth`;;
2544         *) xxx=`./loc $xxx $xxx $pth`;;
2545         esac
2546         eval $file=$xxx$_exe
2547         eval _$file=$xxx
2548         case "$xxx" in
2549         /*)
2550                 echo $file is in $xxx.
2551                 ;;
2552         ?:[\\/]*)
2553                 echo $file is in $xxx.
2554                 ;;
2555         *)
2556                 echo "I don't know where '$file' is, and my life depends on it." >&4
2557                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2558                 exit 1
2559                 ;;
2560         esac
2561 done
2562 echo " "
2563 echo "Don't worry if any of the following aren't found..."
2564 say=offhand
2565 for file in $trylist; do
2566         eval xxx=\$$file
2567         case "$xxx" in
2568         /*|?:[\\/]*)
2569                 if test -f "$xxx"; then
2570                         : ok
2571                 else
2572                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2573                         xxx=`./loc $file $file $pth`
2574                 fi
2575                 ;;
2576         '') xxx=`./loc $file $file $pth`;;
2577         *) xxx=`./loc $xxx $xxx $pth`;;
2578         esac
2579         eval $file=$xxx$_exe
2580         eval _$file=$xxx
2581         case "$xxx" in
2582         /*)
2583                 echo $file is in $xxx.
2584                 ;;
2585         ?:[\\/]*)
2586                 echo $file is in $xxx.
2587                 ;;
2588         *)
2589                 echo "I don't see $file out there, $say."
2590                 say=either
2591                 ;;
2592         esac
2593 done
2594 case "$egrep" in
2595 egrep)
2596         echo "Substituting grep for egrep."
2597         egrep=$grep
2598         _egrep=$grep
2599         ;;
2600 esac
2601 case "$less" in
2602 '')     ;;
2603 *)      if $less -R </dev/null >/dev/null 2>&1; then
2604                echo "Substituting less -R for less."
2605                less="$less -R"
2606                _less=$less
2607         fi
2608         ;;
2609 esac
2610 case "$ln" in
2611 ln)
2612         echo "Substituting cp for ln."
2613         ln=$cp
2614         _ln=$cp
2615         ;;
2616 esac
2617 case "$make" in
2618 make)
2619         case "$gmake" in
2620         gmake)
2621         echo "I can't find make or gmake, and my life depends on it." >&4
2622         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2623         exit 1
2624         ;;
2625         esac
2626         ;;
2627 esac
2628 case "$gmake" in
2629 gmake)  ;;
2630 *)      # We can't have osname yet.
2631         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2632                 # Assume that gmake, if found, is definitely GNU make
2633                 # and prefer it over the system make.
2634                 echo "Substituting gmake for make."
2635                 make=$gmake
2636                 _make=$gmake
2637         fi
2638         ;;
2639 esac
2640 case "$test" in
2641 test)
2642         echo "Hopefully test is built into your sh."
2643         ;;
2644 *)
2645         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2646                 echo "Using the test built into your sh."
2647                 test=test
2648                 _test=test
2649         fi
2650         ;;
2651 esac
2652 case "$echo" in
2653 echo)
2654         echo "Hopefully echo is built into your sh."
2655         ;;
2656 '') ;;
2657 *)
2658         echo " "
2659 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2660         $echo $n "hi there$c" >foo1
2661         echo $n "hi there$c" >foo2
2662         if cmp foo1 foo2 >/dev/null 2>&1; then
2663                 echo "They are compatible.  In fact, they may be identical."
2664         else
2665                 case "$n" in
2666                 '-n') n='' c='\c';;
2667                 *) n='-n' c='';;
2668                 esac
2669                 cat <<FOO
2670 They are not compatible!  You are probably running ksh on a non-USG system.
2671 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2672 have echo built in and we may have to run some Bourne shell scripts.  That
2673 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2674
2675 FOO
2676                 $echo $n "The star should be here-->$c"
2677                 $echo "*"
2678         fi
2679         $rm -f foo1 foo2
2680         ;;
2681 esac
2682
2683 # This question was auctioned at YAPC::Europe-2007 in Vienna
2684 # I never promised you could answer it. I only auctioned the question.
2685 cat <<FOO
2686 The following message is sponsored by
2687
2688   Dresden.pm<--The stars should be here.
2689
2690 Dear Perl user, system administrator or package
2691 maintainer, the Perl community sends greetings to
2692 you. Do you (emblematical) greet back [Y/n]? n
2693
2694 FOO
2695
2696 : Check what type of C compiler we use
2697 cat <<EOS >trygcc
2698 $startsh
2699 EOS
2700 cat <<'EOSC' >>trygcc
2701 case "$cc" in
2702 '') ;;
2703 *)  $rm -f try try.*
2704     $cat >try.c <<EOM
2705 int main(int argc, char *argv[]) {
2706   return 0;
2707 }
2708 EOM
2709     if $cc -o try $ccflags $ldflags try.c; then
2710        :
2711     else
2712         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2713         despair=yes
2714         trygcc=yes
2715         case "$cc" in
2716         *gcc*) trygcc=no ;;
2717         esac
2718         # Skip this test because it gives a false match on output like:
2719         #    ./trygcc: line 23: cc: command not found
2720         # case "`$cc -v -c try.c 2>&1`" in
2721         # *gcc*) trygcc=no ;;
2722         # esac
2723         if $test X"$trygcc" = Xyes; then
2724             if gcc -o try -c try.c; then
2725                 echo " "
2726                 echo "You seem to have a working gcc, though." >&4
2727                 # Switching compilers may undo the work of hints files.
2728                 # The most common problem is -D_REENTRANT for threads.
2729                 # This heuristic catches that case, but gets false positives
2730                 # if -Dusethreads was not actually specified.  Better to
2731                 # bail out here with a useful message than fail
2732                 # mysteriously later. Should we perhaps just try to
2733                 # re-invoke Configure -Dcc=gcc config_args ?
2734                 if $test -f usethreads.cbu; then
2735                         $cat >&4 <<EOM
2736
2737 *** However, any setting of the C compiler flags (e.g. for thread support)
2738 *** will be lost.  It may be necessary for you to restart Configure and
2739 *** add -Dcc=gcc to your Configure command line.
2740
2741 EOM
2742                         rp="Would you like to go ahead and try gcc anyway?"
2743                         dflt=n
2744                 else
2745                         rp="Would you like to use it?"
2746                         dflt=y
2747                 fi
2748                 if $test -f myread; then
2749                     . ./myread
2750                 else
2751                     if $test -f UU/myread; then
2752                         . ./UU/myread
2753                     else
2754                         echo "Cannot find myread, sorry.  Aborting." >&2
2755                         exit 1
2756                     fi
2757                 fi
2758                 case "$ans" in
2759                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2760                 esac
2761             fi
2762         fi
2763     fi
2764     $rm -f try try.*
2765     ;;
2766 esac
2767 EOSC
2768
2769 cat <<EOS >checkcc
2770 $startsh
2771 EOS
2772 cat <<'EOSC' >>checkcc
2773 case "$cc" in
2774 '') ;;
2775 *)  $rm -f try try.*
2776     $cat >try.c <<EOM
2777 int main(int argc, char *argv[]) {
2778   return 0;
2779 }
2780 EOM
2781     if $cc -o try $ccflags $ldflags try.c; then
2782        :
2783     else
2784         if $test X"$despair" = Xyes; then
2785            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2786         fi
2787         $cat >&4 <<EOM
2788 You need to find a working C compiler.
2789 Either (purchase and) install the C compiler supplied by your OS vendor,
2790 or for a free C compiler try http://gcc.gnu.org/
2791 I cannot continue any further, aborting.
2792 EOM
2793         exit 1
2794     fi
2795     $rm -f try try.*
2796     ;;
2797 esac
2798 EOSC
2799
2800 : determine whether symbolic links are supported
2801 echo " "
2802 $touch blurfl
2803 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2804         echo "Symbolic links are supported." >&4
2805         lns="$ln -s"
2806 else
2807         echo "Symbolic links are NOT supported." >&4
2808         lns="$ln"
2809 fi
2810 $rm -f blurfl sym
2811
2812 : determine whether symbolic links are supported
2813 echo " "
2814 case "$lns" in
2815 *"ln"*" -s")
2816         echo "Checking how to test for symbolic links..." >&4
2817         $lns blurfl sym
2818         if $test "X$issymlink" = X; then
2819                 case "$newsh" in
2820                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2821                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2822                 esac
2823                 if test $? = 0; then
2824                         issymlink="test -h"
2825                 else
2826                         echo "Your builtin 'test -h' may be broken." >&4
2827                         case "$test" in
2828                         /*)     ;;
2829                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2830                                 for p in $pth
2831                                 do
2832                                         if test -f "$p/$test"; then
2833                                                 test="$p/$test"
2834                                                 break
2835                                         fi
2836                                 done
2837                                 ;;
2838                         esac
2839                         case "$test" in
2840                         /*)
2841                                 echo "Trying external '$test -h'." >&4
2842                                 issymlink="$test -h"
2843                                 if $test ! -h sym >/dev/null 2>&1; then
2844                                         echo "External '$test -h' is broken, too." >&4
2845                                         issymlink=''
2846                                 fi
2847                                 ;;
2848                         *)      issymlink='' ;;
2849                         esac
2850                 fi
2851         fi
2852         if $test "X$issymlink" = X; then
2853                 if $test -L sym 2>/dev/null; then
2854                         issymlink="$test -L"
2855                         echo "The builtin '$test -L' worked." >&4
2856                 fi
2857         fi
2858         if $test "X$issymlink" != X; then
2859                 echo "You can test for symbolic links with '$issymlink'." >&4
2860         else
2861                 echo "I do not know how you can test for symbolic links." >&4
2862         fi
2863         $rm -f blurfl sym
2864         ;;
2865 *)      echo "No symbolic links, so not testing for their testing..." >&4
2866         ;;
2867 esac
2868 echo " "
2869
2870 : Make symlinks util
2871 case "$mksymlinks" in
2872 $define|true|[yY]*)
2873         case "$src" in
2874         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2875                 exit 1
2876                 ;;
2877         *)      case "$lns:$issymlink" in
2878                 *"ln"*" -s:"*"test -"?)
2879                         echo "Creating the symbolic links..." >&4
2880                         cd ..
2881                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2882                         awk 'NF == 1 {
2883                                 dir=".";
2884                                 file=$1 "";
2885                              }
2886                              NF == 2 {
2887                                 dir=$1 "";
2888                                 file=$2 "";
2889                              }
2890                              {
2891                                  print "# dir = ", dir, "file = ", file
2892                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2893                              } END {
2894                                  for (d in mf) {
2895                                      if (d != ".") { print("mkdir -p "d) }
2896                                      print("ln -sf "mf[d]" "d);
2897                                  }
2898                              }' source="$src" > UU/mksymlinks.$$
2899                         sh UU/mksymlinks.$$
2900                         rm UU/mksymlinks.$$
2901                         # Sanity check 1.
2902                         if test ! -d t/base; then
2903                                 echo "Failed to create the subdirectories.  Aborting." >&4
2904                                 exit 1
2905                         fi
2906                         # Sanity check 2.
2907                         if test ! -f t/base/lex.t; then
2908                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2909                                 exit 1
2910                         fi
2911                         if test ! -f win32/win32.c; then
2912                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2913                                 exit 1
2914                         fi
2915                         cd UU
2916                         ;;
2917                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2918                         ;;
2919                 esac
2920                 ;;
2921         esac
2922         ;;
2923 esac
2924
2925 : Check for Cross-Compilation
2926 if $test "X$targethost" = "X"; then
2927     targethost=""
2928 fi
2929 if $test "X$targetenv" = "X"; then
2930     targetenv=""
2931 fi
2932 case "$usecrosscompile" in
2933 $define|true|[yY]*)
2934         $echo "Cross-compiling..."
2935         croak=''
2936         case "$cc" in
2937         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2938             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2939             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2940             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2941             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2942             # leave out ld, choosing it is more complex
2943             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2944             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2945             # We are in a weird spot. Just before us, some values
2946             # were 'saved', to be restored after the hints are
2947             # run.  This means that the changes we made to ar,
2948             # nm and ranlib will get reverted.
2949             # To avoid that, we hijack the saving mechanism and
2950             # have it save our new values.
2951             for file in ar nm ranlib; do
2952                 eval xxx=\$$file
2953                 eval $file=$xxx$_exe
2954                 eval _$file=$xxx
2955             done
2956         ;;
2957         esac
2958         case "$targetarch" in
2959         '') echo "Targetarch not defined." >&4; croak=y ;;
2960         *)  echo "Using targetarch $targetarch." >&4 ;;
2961         esac
2962         case "$targethost" in
2963         '') echo "Targethost not defined." >&4; croak=y ;;
2964         *)  echo "Using targethost $targethost." >&4
2965         esac
2966         locincpth=' '
2967         loclibpth=' '
2968         case "$croak" in
2969         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2970         esac
2971     : compile a host miniperl and generate_uudmap, unless we got passed them
2972     if $test "X$hostperl" = X; then
2973       echo "Building host miniperl and generate_uudmap binaries" >&4
2974       before_host=`pwd`
2975       cd ..
2976       cd $src
2977       src=`pwd`
2978       rm -rf $src/host
2979       mkdir $src/host
2980       cd $src/host
2981       $src/Configure -des -Dusedevel -Dmksymlinks
2982       $make miniperl
2983       case "$hostgenerate" in
2984       '') $make generate_uudmap
2985           hostgenerate=$src/host/generate_uudmap
2986           ;;
2987        "$undef") hostgenerate=''
2988           ;;
2989       esac
2990       hostperl=$src/host/miniperl
2991       cd $before_host
2992     fi
2993     hostosname=`$hostperl -le 'print $^O'`
2994     ;;
2995 *)
2996     usecrosscompile="$undef"
2997     ;;
2998 esac
2999
3000 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3001 case "$targethost" in
3002     '') echo "Checking for cross-compile" >&4
3003     case "$usecrosscompile$multiarch" in
3004        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3005          if [ -f Makefile ]; then
3006            echo " "
3007            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3008          else
3009            echo "Configure done."
3010          fi
3011        exit 0
3012        ;;
3013      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3014         run=''
3015         to=:
3016         from=:
3017         ;;
3018     esac
3019     ;;
3020     *) echo "Using targethost $targethost." >&4
3021         case "$src" in
3022         /*) run=$src/Cross/run
3023             targetmkdir=$src/Cross/mkdir
3024             to=$src/Cross/to
3025             from=$src/Cross/from
3026             ;;
3027         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3028             run=$pwd/Cross/run
3029             targetmkdir=$pwd/Cross/mkdir
3030             to=$pwd/Cross/to
3031             from=$pwd/Cross/from
3032             ;;
3033         esac
3034         case "$targetrun" in
3035         '') targetrun=ssh ;;
3036         esac
3037         case "$targetto" in
3038         '') targetto=scp ;;
3039         esac
3040         case "$targetfrom" in
3041         '') targetfrom=scp ;;
3042         esac
3043         run=$run-$targetrun
3044         to=$to-$targetto
3045         from=$from-$targetfrom
3046         case "$targetdir" in
3047         '')  targetdir=/tmp
3048              echo "Guessing targetdir $targetdir." >&4
3049              ;;
3050         esac
3051         case "$targetuser" in
3052         '')  targetuser=root
3053              echo "Guessing targetuser $targetuser." >&4
3054              ;;
3055         esac
3056         case "$targetport" in
3057         '')  targetport=22
3058              echo "Guessing targetport $targetport." >&4
3059              ;;
3060         esac
3061         case "$targetfrom" in
3062         scp)    q=-q ;;
3063         *)      q='' ;;
3064         esac
3065         case "$targetrun" in
3066         ssh|rsh)
3067             cat >$run <<EOF
3068 #!/bin/sh
3069 env=''
3070 case "\$1" in
3071 -cwd)
3072   shift
3073   cwd=\$1
3074   shift
3075   ;;
3076 esac
3077 case "\$1" in
3078 -env)
3079   shift
3080   env=\$1
3081   shift
3082   ;;
3083 esac
3084 case "\$cwd" in
3085 '') cwd=$targetdir ;;
3086 esac
3087 exe=\$1
3088 shift
3089 $to \$exe
3090 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3091 EOF
3092             ;;
3093         adb)
3094             $touch $run
3095             ;;
3096         *)  echo "Unknown targetrun '$targetrun'" >&4
3097             exit 1
3098             ;;
3099         esac
3100         case "$targetmkdir" in
3101         */Cross/mkdir)
3102             cat >$targetmkdir <<EOF
3103 #!/bin/sh
3104 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3105 EOF
3106             $chmod a+rx $targetmkdir
3107             ;;
3108         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3109             exit 1
3110             ;;
3111         esac
3112         case "$targetto" in
3113         scp|rcp)
3114             cat >$to <<EOF
3115 #!/bin/sh
3116 for f in \$@
3117 do
3118   case "\$f" in
3119   /*)
3120     $targetmkdir \`dirname \$f\`
3121     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3122     ;;
3123   *)
3124     $targetmkdir $targetdir/\`dirname \$f\`
3125     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3126     ;;
3127   esac
3128 done
3129 exit 0
3130 EOF
3131             ;;
3132         cp) cat >$to <<EOF
3133 #!/bin/sh
3134 for f in \$@
3135 do
3136   case "\$f" in
3137   /*)
3138     $mkdir -p $targetdir/\`dirname \$f\`
3139     $cp \$f $targetdir/\$f || exit 1
3140     ;;
3141   *)
3142     $targetmkdir $targetdir/\`dirname \$f\`
3143     $cp \$f $targetdir/\$f || exit 1
3144     ;;
3145   esac
3146 done
3147 exit 0
3148 EOF
3149             ;;
3150         *)  echo "Unknown targetto '$targetto'" >&4
3151             exit 1
3152             ;;
3153         esac
3154         case "$targetfrom" in
3155         scp|rcp)
3156           cat >$from <<EOF
3157 #!/bin/sh
3158 for f in \$@
3159 do
3160   $rm -f \$f
3161   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3162 done
3163 exit 0
3164 EOF
3165             ;;
3166         cp) cat >$from <<EOF
3167 #!/bin/sh
3168 for f in \$@
3169 do
3170   $rm -f \$f
3171   cp $targetdir/\$f . || exit 1
3172 done
3173 exit 0
3174 EOF
3175             ;;
3176         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3177             exit 1
3178             ;;
3179         esac
3180         if $test ! -f $run; then
3181             echo "Target 'run' script '$run' not found." >&4
3182         else
3183             $chmod a+rx $run
3184         fi
3185         if $test ! -f $to; then
3186             echo "Target 'to' script '$to' not found." >&4
3187         else
3188             $chmod a+rx $to
3189         fi
3190         if $test ! -f $from; then
3191             echo "Target 'from' script '$from' not found." >&4
3192         else
3193             $chmod a+rx $from
3194         fi
3195         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3196             exit 1
3197         fi
3198         cat >&4 <<EOF
3199 Using '$run' for remote execution,
3200 and '$from' and '$to'
3201 for remote file transfer.
3202 EOF
3203         ;;
3204 *)      run=''
3205         to=:
3206         from=:
3207         usecrosscompile="$undef"
3208         targetarch=''
3209         ;;
3210 esac
3211
3212 : see whether [:lower:] and [:upper:] are supported character classes
3213 echo " "
3214 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3215 ABYZ-abyz)
3216         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3217         up='[:upper:]'
3218         low='[:lower:]'
3219         ;;
3220 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3221         # (0xd9 and 0xe2), therefore that is a nice testing point.
3222         if test "X$up" = X -o "X$low" = X; then
3223             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3224             rs) up='[A-Z]'
3225                 low='[a-z]'
3226                 ;;
3227             esac
3228         fi
3229         if test "X$up" = X -o "X$low" = X; then
3230             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3231             rs) up='A-Z'
3232                 low='a-z'
3233                 ;;
3234             esac
3235         fi
3236         if test "X$up" = X -o "X$low" = X; then
3237             case "`echo RS | od -x 2>/dev/null`" in
3238             *D9E2*|*d9e2*)
3239                 echo "Hey, this might be EBCDIC." >&4
3240                 if test "X$up" = X -o "X$low" = X; then
3241                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3242                     rs) up='[A-IJ-RS-Z]'
3243                         low='[a-ij-rs-z]'
3244                         ;;
3245                     esac
3246                 fi
3247                 if test "X$up" = X -o "X$low" = X; then
3248                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3249                     rs) up='A-IJ-RS-Z'
3250                         low='a-ij-rs-z'
3251                         ;;
3252                     esac
3253                 fi
3254                 ;;
3255             esac
3256         fi
3257 esac
3258 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3259 rs)
3260     echo "Using $up and $low to convert case." >&4
3261     ;;
3262 *)
3263     echo "I don't know how to translate letters from upper to lower case." >&4
3264     echo "Your tr is not acting any way I know of." >&4
3265     exit 1
3266     ;;
3267 esac
3268 : set up the translation script tr, must be called with ./tr of course
3269 cat >tr <<EOSC
3270 $startsh
3271 case "\$1\$2" in
3272 '[A-Z][a-z]') exec $tr '$up' '$low';;
3273 '[a-z][A-Z]') exec $tr '$low' '$up';;
3274 esac
3275 exec $tr "\$@"
3276 EOSC
3277 chmod +x tr
3278 $eunicefix tr
3279
3280 : Try to determine whether config.sh was made on this system
3281 case "$config_sh" in
3282 '')
3283 myuname=`$uname -a 2>/dev/null`
3284 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3285 # Downcase everything to avoid ambiguity.
3286 # Remove slashes and single quotes so we can use parts of this in
3287 # directory and file names.
3288 # Remove newlines so myuname is sane to use elsewhere.
3289 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3290 # because the A-Z/a-z are not consecutive.
3291 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3292         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3293 newmyuname="$myuname"
3294 dflt=n
3295 case "$knowitall" in
3296 '')
3297         if test -f ../config.sh; then
3298                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3299                         eval "`grep myuname= ../config.sh`"
3300                 fi
3301                 if test "X$myuname" = "X$newmyuname"; then
3302                         dflt=y
3303                 fi
3304         fi
3305         ;;
3306 *) dflt=y;;
3307 esac
3308
3309 : Get old answers from old config file if Configure was run on the
3310 : same system, otherwise use the hints.
3311 hint=default
3312 cd ..
3313 if test -f config.sh; then
3314         echo " "
3315         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3316         . UU/myread
3317         case "$ans" in
3318         n*|N*) echo "OK, I'll ignore it."
3319                 mv config.sh config.sh.old
3320                 myuname="$newmyuname"
3321                 ;;
3322         *)  echo "Fetching default answers from your old config.sh file..." >&4
3323                 tmp_n="$n"
3324                 tmp_c="$c"
3325                 tmp_sh="$sh"
3326                 . ./config.sh
3327                 cp config.sh UU
3328                 n="$tmp_n"
3329                 c="$tmp_c"
3330                 : Older versions did not always set $sh.  Catch re-use of such
3331                 : an old config.sh.
3332                 case "$sh" in
3333                 '') sh="$tmp_sh" ;;
3334                 esac
3335                 hint=previous
3336                 ;;
3337         esac
3338 fi
3339 . ./UU/checkcc
3340 if test ! -f config.sh; then
3341         $cat <<EOM
3342
3343 First time through, eh?  I have some defaults handy for some systems
3344 that need some extra help getting the Configure answers right:
3345
3346 EOM
3347         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3348         dflt=''
3349         : Half the following guesses are probably wrong... If you have better
3350         : tests or hints, please send them to perlbug@perl.org
3351         : The metaconfig authors would also appreciate a copy...
3352         $test -f /irix && osname=irix
3353         $test -f /xenix && osname=sco_xenix
3354         $test -f /dynix && osname=dynix
3355         $test -f /dnix && osname=dnix
3356         $test -f /lynx.os && osname=lynxos
3357         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3358         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3359         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3360         $test -f /bin/mips && /bin/mips && osname=mips
3361         $test -d /usr/apollo/bin && osname=apollo
3362         $test -f /etc/saf/_sactab && osname=svr4
3363         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3364         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3365         $test -f /sys/utilities/MultiView && osname=amigaos
3366         if $test -d /MachTen -o -d /MachTen_Folder; then
3367                 osname=machten
3368                 if $test -x /sbin/version; then
3369                         osvers=`/sbin/version | $awk '{print $2}' |
3370                         $sed -e 's/[A-Za-z]$//'`
3371                 elif $test -x /usr/etc/version; then
3372                         osvers=`/usr/etc/version | $awk '{print $2}' |
3373                         $sed -e 's/[A-Za-z]$//'`
3374                 else
3375                         osvers="$2.$3"
3376                 fi
3377         fi
3378
3379         $test -f /sys/posix.dll &&
3380                 $test -f /usr/bin/what &&
3381                 set X `/usr/bin/what /sys/posix.dll` &&
3382                 $test "$3" = UWIN &&
3383                 osname=uwin &&
3384                 osvers="$5"
3385
3386         if $test -f $uname; then
3387                 set X $myuname
3388                 shift
3389
3390                 case "$5" in
3391                 fps*) osname=fps ;;
3392                 mips*)
3393                         case "$4" in
3394                         umips) osname=umips ;;
3395                         *) osname=mips ;;
3396                         esac;;
3397                 [23]100) osname=mips ;;
3398                 i386*)
3399                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3400                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3401                                 osname='sco'
3402                                 osvers=$tmp
3403                         elif $test -f /etc/kconfig; then
3404                                 osname=isc
3405                                 if test "$lns" = "$ln -s"; then
3406                                         osvers=4
3407                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3408                                         osvers=3
3409                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3410                                         osvers=2
3411                                 fi
3412                         fi
3413                         tmp=''
3414                         ;;
3415                 pc*)
3416                         if test -n "$DJGPP"; then
3417                                 osname=dos
3418                                 osvers=djgpp
3419                         fi
3420                         ;;
3421                 esac
3422
3423                 case "$1" in
3424                 aix) osname=aix
3425                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3426                         case "$tmp" in
3427                         # oslevel can fail with:
3428                         # oslevel: Unable to acquire lock.
3429                         *not\ found) osvers="$4"."$3" ;;
3430                         '<3240'|'<>3240') osvers=3.2.0 ;;
3431                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3432                         '=3250'|'>3250') osvers=3.2.5 ;;
3433                         *) osvers=$tmp;;
3434                         esac
3435                         ;;
3436                 bitrig) osname=bitrig
3437                         osvers="$3"
3438                         ;;
3439                 bsd386) osname=bsd386
3440                         osvers=`$uname -r`
3441                         ;;
3442                 cygwin*) osname=cygwin
3443                         osvers="$3"
3444                         ;;
3445                 *dc.osx) osname=dcosx
3446                         osvers="$3"
3447                         ;;
3448                 dnix) osname=dnix
3449                         osvers="$3"
3450                         ;;
3451                 domainos) osname=apollo
3452                         osvers="$3"
3453                         ;;
3454                 dgux)   osname=dgux
3455                         osvers="$3"
3456                         ;;
3457                 dragonfly) osname=dragonfly
3458                         osvers="$3"
3459                         ;;
3460                 dynixptx*) osname=dynixptx
3461                         osvers=`echo "$4"|sed 's/^v//'`
3462                         ;;
3463                 freebsd) osname=freebsd
3464                         osvers="$3" ;;
3465                 genix)  osname=genix ;;
3466                 gnu)    osname=gnu
3467                         osvers="$3" ;;
3468                 hp*)    osname=hpux
3469                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3470                         ;;
3471                 irix*)  osname=irix
3472                         case "$3" in
3473                         4*) osvers=4 ;;
3474                         5*) osvers=5 ;;
3475                         *)      osvers="$3" ;;
3476                         esac
3477                         ;;
3478                 linux)  osname=linux
3479                         case "$3" in
3480                         *)      osvers="$3" ;;
3481                         esac
3482                         $test -f /system/lib/libandroid.so && osname=linux-android
3483                         ;;
3484                 MiNT)   osname=mint
3485                         ;;
3486                 netbsd*) osname=netbsd
3487                         osvers="$3"
3488                         ;;
3489                 news-os) osvers="$3"
3490                         case "$3" in
3491                         4*) osname=newsos4 ;;
3492                         *) osname=newsos ;;
3493                         esac
3494                         ;;
3495                 nonstop-ux) osname=nonstopux ;;
3496                 openbsd) osname=openbsd
3497                         osvers="$3"
3498                         ;;
3499                 os2)    osname=os2
3500                         osvers="$4"
3501                         ;;
3502                 POSIX-BC | posix-bc ) osname=posix-bc
3503                         osvers="$3"
3504                         ;;
3505                 powerux | power_ux | powermax_os | powermaxos | \
3506                 powerunix | power_unix) osname=powerux
3507                         osvers="$3"
3508                         ;;
3509                 qnx) osname=qnx
3510                         osvers="$4"
3511                         ;;
3512                 solaris) osname=solaris
3513                         case "$3" in
3514                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3515                         *)      osvers="$3" ;;
3516                         esac
3517                         ;;
3518                 sunos) osname=sunos
3519                         case "$3" in
3520                         5*) osname=solaris
3521                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3522                         *)      osvers="$3" ;;
3523                         esac
3524                         ;;
3525                 titanos) osname=titanos
3526                         case "$3" in
3527                         1*) osvers=1 ;;
3528                         2*) osvers=2 ;;
3529                         3*) osvers=3 ;;
3530                         4*) osvers=4 ;;
3531                         *)      osvers="$3" ;;
3532                         esac
3533                         ;;
3534                 ultrix) osname=ultrix
3535                         osvers="$3"
3536                         ;;
3537                 osf1|mls+)      case "$5" in
3538                                 alpha)
3539                                         osname=dec_osf
3540                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3541                                         case "$osvers" in
3542                                         [1-9].[0-9]*) ;;
3543                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3544                                         esac
3545                                         ;;
3546                         hp*)    osname=hp_osf1  ;;
3547                         mips)   osname=mips_osf1 ;;
3548                         esac
3549                         ;;
3550                 # UnixWare 7.1.2 is known as Open UNIX 8
3551                 openunix|unixware) osname=svr5
3552                         osvers="$4"
3553                         ;;
3554                 uts)    osname=uts
3555                         osvers="$3"
3556                         ;;
3557                 vos) osvers="$3"
3558                         ;;
3559                 $2) case "$osname" in
3560                         *isc*) ;;
3561                         *freebsd*) ;;
3562                         svr*)
3563                                 : svr4.x or possibly later
3564                                 case "svr$3" in
3565                                 ${osname}*)
3566                                         osname=svr$3
3567                                         osvers=$4
3568                                         ;;
3569                                 esac
3570                                 case "$osname" in
3571                                 svr4.0)
3572                                         : Check for ESIX
3573                                         if test -f /stand/boot ; then
3574                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3575                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3576                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3577                                                         if test -n "$isesix"; then
3578                                                                 osname=esix4
3579                                                         fi
3580                                                 fi
3581                                         fi
3582                                         ;;
3583                                 esac
3584                                 ;;
3585                         *)      if test -f /etc/systemid; then
3586                                         osname=sco
3587                                         set `echo $3 | $sed 's/\./ /g'` $4
3588                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3589                                                 osvers=$1.$2.$3
3590                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3591                                                 osvers=$1.$2
3592                                         elif $test -f $src/hints/sco_$1.sh; then
3593                                                 osvers=$1
3594                                         fi
3595                                 else
3596                                         case "$osname" in
3597                                         '') : Still unknown.  Probably a generic Sys V.
3598                                                 osname="sysv"
3599                                                 osvers="$3"
3600                                                 ;;
3601                                         esac
3602                                 fi
3603                                 ;;
3604                         esac
3605                         ;;
3606                 *)      case "$osname" in
3607                         '') : Still unknown.  Probably a generic BSD.
3608                                 osname="$1"
3609                                 osvers="$3"
3610                                 ;;
3611                         esac
3612                         ;;
3613                 esac
3614         else
3615                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3616                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3617                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3618                                 osname=news_os
3619                         fi
3620                         $rm -f UU/kernel.what
3621                 elif test -d c:/. -o -n "$is_os2" ; then
3622                         set X $myuname
3623                         osname=os2
3624                         osvers="$5"
3625                 fi
3626         fi
3627
3628         case "$targetarch" in
3629         '') ;;
3630         *)  hostarch=$osname
3631             case "$targetarch" in
3632                 nto*|*-nto-*)
3633                     # Will load qnx.sh, which should change osname to nto
3634                     osname=qnx
3635                     osvers=''
3636                     ;;
3637                 *linux-android*)
3638                     # Catch arm-linux-androideabi, mipsel-linux-android,
3639                     # and i686-linux-android
3640                     osname=linux-android
3641                     osvers=''
3642                     ;;
3643                 *linux*)
3644                     # Something like arm-linux-gnueabihf is really just
3645                     # plain linux.
3646                     osname=linux
3647                     osvers=''
3648                     ;;
3649                 *solaris*|*sunos*)
3650                     osname=solaris
3651                     # XXX perhaps we should just assume
3652                     # osvers to be 2, or maybe take the value
3653                     # from targetarch. Using $run before the
3654                     # hints are run is somewhat icky.
3655                     set X `$run $uname -a 2>/dev/null`
3656                     shift
3657                     case "$3" in
3658                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3659                         *)  osvers="$3" ;;
3660                     esac
3661                     ;;
3662                 *)
3663                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3664                     osvers=''
3665                 ;;
3666             esac
3667             ;;
3668         esac
3669
3670         : Now look for a hint file osname_osvers, unless one has been
3671         : specified already.
3672         case "$hintfile" in
3673         ''|' ')
3674                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3675                 : Also try without trailing minor version numbers.
3676                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3677                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3678                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3679                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3680                 case "$file" in
3681                 '') dflt=none ;;
3682                 *)  case "$osvers" in
3683                         '') dflt=$file
3684                                 ;;
3685                         *)  if $test -f $src/hints/$file.sh ; then
3686                                         dflt=$file
3687                                 elif $test -f $src/hints/$xfile.sh ; then
3688                                         dflt=$xfile
3689                                 elif $test -f $src/hints/$xxfile.sh ; then
3690                                         dflt=$xxfile
3691                                 elif $test -f $src/hints/$xxxfile.sh ; then
3692                                         dflt=$xxxfile
3693                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3694                                         dflt=$xxxxfile
3695                                 elif $test -f "$src/hints/${osname}.sh" ; then
3696                                         dflt="${osname}"
3697                                 else
3698                                         dflt=none
3699                                 fi
3700                                 ;;
3701                         esac
3702                         ;;
3703                 esac
3704                 if $test -f Policy.sh ; then
3705                         case "$dflt" in
3706                         *Policy*) ;;
3707                         none) dflt="Policy" ;;
3708                         *) dflt="Policy $dflt" ;;
3709                         esac
3710                 fi
3711                 ;;
3712         *)
3713                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3714                 ;;
3715         esac
3716
3717         if $test -f Policy.sh ; then
3718                 $cat <<EOM
3719
3720 There's also a Policy hint file available, which should make the
3721 site-specific (policy) questions easier to answer.
3722 EOM
3723
3724         fi
3725
3726         $cat <<EOM
3727
3728 You may give one or more space-separated answers, or "none" if appropriate.
3729 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3730 previous run of Configure, you may specify it as well as or instead of
3731 OS-specific hints.  If hints are provided for your OS, you should use them:
3732 although Perl can probably be built without hints on many platforms, using
3733 hints often improve performance and may enable features that Configure can't
3734 set up on its own. If there are no hints that match your OS, specify "none";
3735 DO NOT give a wrong version or a wrong OS.
3736
3737 EOM
3738
3739         rp="Which of these apply, if any?"
3740         . UU/myread
3741         tans=$ans
3742         for file in $tans; do
3743                 if $test X$file = XPolicy -a -f Policy.sh; then
3744                         . Policy.sh
3745                         $cat Policy.sh >> UU/config.sh
3746                 elif $test -f $src/hints/$file.sh; then
3747                         . $src/hints/$file.sh
3748                         $cat $src/hints/$file.sh >> UU/config.sh
3749                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3750                         : nothing
3751                 else
3752                         : Give one chance to correct a possible typo.
3753                         echo "$file.sh does not exist"
3754                         dflt=$file
3755                         rp="hint to use instead?"
3756                         . UU/myread
3757                         for file in $ans; do
3758                                 if $test -f "$src/hints/$file.sh"; then
3759                                         . $src/hints/$file.sh
3760                                         $cat $src/hints/$file.sh >> UU/config.sh
3761                                 elif $test X$ans = X -o X$ans = Xnone ; then
3762                                         : nothing
3763                                 else
3764                                         echo "$file.sh does not exist -- ignored."
3765                                 fi
3766                         done
3767                 fi
3768         done
3769
3770         hint=recommended
3771         : Remember our hint file for later.
3772         if $test -f "$src/hints/$file.sh" ; then
3773                 hintfile="$file"
3774         else
3775                 hintfile=''
3776         fi
3777 fi
3778 cd UU
3779 ;;
3780 *)
3781         echo " "
3782         echo "Fetching default answers from $config_sh..." >&4
3783         tmp_n="$n"
3784         tmp_c="$c"
3785         cd ..
3786         cp $config_sh config.sh 2>/dev/null
3787         chmod +w config.sh
3788         . ./config.sh
3789         cd UU
3790         cp ../config.sh .
3791         n="$tmp_n"
3792         c="$tmp_c"
3793         hint=previous
3794         ;;
3795 esac
3796 . ./optdef.sh
3797
3798 : Restore computed paths
3799 for file in $loclist $trylist; do
3800         eval $file="\$_$file"
3801 done
3802
3803 cat << EOM
3804
3805 Configure uses the operating system name and version to set some defaults.
3806 The default value is probably right if the name rings a bell. Otherwise,
3807 since spelling matters for me, either accept the default or answer "none"
3808 to leave it blank.
3809
3810 EOM
3811 case "$osname" in
3812         ''|' ')
3813                 case "$hintfile" in
3814                 ''|' '|none) dflt=none ;;
3815                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3816                 esac
3817                 ;;
3818         *) dflt="$osname" ;;
3819 esac
3820 rp="Operating system name?"
3821 . ./myread
3822 case "$ans" in
3823 none)  osname='' ;;
3824 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3825 esac
3826 echo " "
3827 case "$osvers" in
3828         ''|' ')
3829                 case "$hintfile" in
3830                 ''|' '|none) dflt=none ;;
3831                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3832                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3833                         case "$dflt" in
3834                         ''|' ') dflt=none ;;
3835                         esac
3836                         ;;
3837                 esac
3838                 ;;
3839         *) dflt="$osvers" ;;
3840 esac
3841 rp="Operating system version?"
3842 . ./myread
3843 case "$ans" in
3844 none)  osvers='' ;;
3845 *) osvers="$ans" ;;
3846 esac
3847
3848
3849 . ./posthint.sh
3850
3851 : who configured the system
3852 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3853 case "$cf_by" in
3854 "")
3855         cf_by=`(logname) 2>/dev/null`
3856         case "$cf_by" in
3857         "")
3858                 cf_by=`(whoami) 2>/dev/null`
3859                 case "$cf_by" in
3860                 "") cf_by=unknown ;;
3861                 esac ;;
3862         esac ;;
3863 esac
3864
3865 : decide how portable to be.  Allow command line overrides.
3866 case "$d_portable" in
3867 "$undef") ;;
3868 *)      d_portable="$define" ;;
3869 esac
3870
3871 : set up shell script to do ~ expansion
3872 cat >filexp <<EOSS
3873 $startsh
3874 : expand filename
3875 case "\$1" in
3876  \~/*|\~)
3877         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3878         ;;
3879  \~*)
3880         if $test -f /bin/csh; then
3881                 /bin/csh -f -c "glob \$1"
3882                 failed=\$?
3883                 echo ""
3884                 exit \$failed
3885         else
3886                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3887                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3888                 if $test ! -d "\$dir"; then
3889                         me=\`basename \$0\`
3890                         echo "\$me: can't locate home directory for: \$name" >&2
3891                         exit 1
3892                 fi
3893                 case "\$1" in
3894                 */*)
3895                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3896                         ;;
3897                 *)
3898                         echo \$dir
3899                         ;;
3900                 esac
3901         fi
3902         ;;
3903 *)
3904         echo \$1
3905         ;;
3906 esac
3907 EOSS
3908 chmod +x filexp
3909 $eunicefix filexp
3910
3911 : now set up to get a file name
3912 cat <<EOS >getfile
3913 $startsh
3914 EOS
3915 cat <<'EOSC' >>getfile
3916 tilde=''
3917 fullpath=''
3918 already=''
3919 skip=''
3920 none_ok=''
3921 exp_file=''
3922 nopath_ok=''
3923 orig_rp="$rp"
3924 orig_dflt="$dflt"
3925 case "$gfpth" in
3926 '') gfpth='.' ;;
3927 esac
3928
3929 case "$fn" in
3930 *\(*)
3931         : getfile will accept an answer from the comma-separated list
3932         : enclosed in parentheses even if it does not meet other criteria.
3933         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3934         fn=`echo $fn | sed 's/(.*)//'`
3935         ;;
3936 esac
3937
3938 case "$fn" in
3939 *:*)
3940         loc_file=`expr $fn : '.*:\(.*\)'`
3941         fn=`expr $fn : '\(.*\):.*'`
3942         ;;
3943 esac
3944
3945 case "$fn" in
3946 *~*) tilde=true;;
3947 esac
3948 case "$fn" in
3949 */*) fullpath=true;;
3950 esac
3951 case "$fn" in
3952 *+*) skip=true;;
3953 esac
3954 case "$fn" in
3955 *n*) none_ok=true;;
3956 esac
3957 case "$fn" in
3958 *e*) exp_file=true;;
3959 esac
3960 case "$fn" in
3961 *p*) nopath_ok=true;;
3962 esac
3963
3964 case "$fn" in
3965 *f*) type='File';;
3966 *d*) type='Directory';;
3967 *l*) type='Locate';;
3968 esac
3969
3970 what="$type"
3971 case "$what" in
3972 Locate) what='File';;
3973 esac
3974
3975 case "$exp_file" in
3976 '')
3977         case "$d_portable" in
3978         "$define") ;;
3979         *) exp_file=true;;
3980         esac
3981         ;;
3982 esac
3983
3984 cd ..
3985 while test "$type"; do
3986         redo=''
3987         rp="$orig_rp"
3988         dflt="$orig_dflt"
3989         case "$tilde" in
3990         true) rp="$rp (~name ok)";;
3991         esac
3992         . UU/myread
3993         if test -f UU/getfile.ok && \
3994                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3995         then
3996                 value="$ans"
3997                 ansexp="$ans"
3998                 break
3999         fi
4000         case "$ans" in
4001         none)
4002                 value=''
4003                 ansexp=''
4004                 case "$none_ok" in
4005                 true) type='';;
4006                 esac
4007                 ;;
4008         *)
4009                 case "$tilde" in
4010                 '') value="$ans"
4011                         ansexp="$ans";;
4012                 *)
4013                         value=`UU/filexp $ans`
4014                         case $? in
4015                         0)
4016                                 if test "$ans" != "$value"; then
4017                                         echo "(That expands to $value on this system.)"
4018                                 fi
4019                                 ;;
4020                         *) value="$ans";;
4021                         esac
4022                         ansexp="$value"
4023                         case "$exp_file" in
4024                         '') value="$ans";;
4025                         esac
4026                         ;;
4027                 esac
4028                 case "$fullpath" in
4029                 true)
4030                         case "$ansexp" in
4031                         /*) value="$ansexp" ;;
4032                         [a-zA-Z]:/*) value="$ansexp" ;;
4033                         *)
4034                                 redo=true
4035                                 case "$already" in
4036                                 true)
4037                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4038                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4039                                         ;;
4040                                 *)
4041                                 echo "Please give a full path name, starting with slash." >&4
4042                                         case "$tilde" in
4043                                         true)
4044                                 echo "Note that using ~name is ok provided it expands well." >&4
4045                                                 already=true
4046                                                 ;;
4047                                         esac
4048                                 esac
4049                                 ;;
4050                         esac
4051                         ;;
4052                 esac
4053                 case "$redo" in
4054                 '')
4055                         case "$type" in
4056                         File)
4057                                 for fp in $gfpth; do
4058                                         if test "X$fp" = X.; then
4059                                             pf="$ansexp"
4060                                         else    
4061                                             pf="$fp/$ansexp"
4062                                         fi
4063                                         if test -f "$pf"; then
4064                                                 type=''
4065                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4066                                         then
4067                                                 echo "($value is not a plain file, but that's ok.)"
4068                                                 type=''
4069                                         fi
4070                                         if test X"$type" = X; then
4071                                             value="$pf"
4072                                             break
4073                                         fi
4074                                 done
4075                                 ;;
4076                         Directory)
4077                                 for fp in $gfpth; do
4078                                         if test "X$fp" = X.; then
4079                                             dir="$ans"
4080                                             direxp="$ansexp"
4081                                         else    
4082                                             dir="$fp/$ansexp"
4083                                             direxp="$fp/$ansexp"
4084                                         fi
4085                                         if test -d "$direxp"; then
4086                                                 type=''
4087                                                 value="$dir"
4088                                                 break
4089                                         fi
4090                                 done
4091                                 ;;
4092                         Locate)
4093                                 if test -d "$ansexp"; then
4094                                         echo "(Looking for $loc_file in directory $value.)"
4095                                         value="$value/$loc_file"
4096                                         ansexp="$ansexp/$loc_file"
4097                                 fi
4098                                 if test -f "$ansexp"; then
4099                                         type=''
4100                                 fi
4101                                 case "$nopath_ok" in
4102                                 true)   case "$value" in
4103                                         */*) ;;
4104                                         *)      echo "Assuming $value will be in people's path."
4105                                                 type=''
4106                                                 ;;
4107                                         esac
4108                                         ;;
4109                                 esac
4110                                 ;;
4111                         esac
4112
4113                         case "$skip" in
4114                         true) type='';
4115                         esac
4116
4117                         case "$type" in
4118                         '') ;;
4119                         *)
4120                                 if test "$fastread" = yes; then
4121                                         dflt=y
4122                                 else
4123                                         dflt=n
4124                                 fi
4125                                 rp="$what $value doesn't exist.  Use that name anyway?"
4126                                 . UU/myread
4127                                 dflt=''
4128                                 case "$ans" in
4129                                 y*) type='';;
4130                                 *) echo " ";;
4131                                 esac
4132                                 ;;
4133                         esac
4134                         ;;
4135                 esac
4136                 ;;
4137         esac
4138 done
4139 cd UU
4140 ans="$value"
4141 rp="$orig_rp"
4142 dflt="$orig_dflt"
4143 rm -f getfile.ok
4144 test "X$gfpthkeep" != Xy && gfpth=""
4145 EOSC
4146
4147 : determine root of directory hierarchy where package will be installed.
4148 case "$prefix" in
4149 '')
4150         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4151         ;;
4152 *?/)
4153         dflt=`echo "$prefix" | sed 's/.$//'`
4154         ;;
4155 *)
4156         dflt="$prefix"
4157         ;;
4158 esac
4159 $cat <<EOM
4160
4161 By default, $package will be installed in $dflt/bin, manual pages
4162 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4163 installation directories. Typically this is something like /usr/local.
4164 If you wish to have binaries under /usr/bin but other parts of the
4165 installation under /usr/local, that's ok: you will be prompted
4166 separately for each of the installation directories, the prefix being
4167 only used to set the defaults.
4168
4169 EOM
4170 fn=d~
4171 rp='Installation prefix to use?'
4172 . ./getfile
4173 oldprefix=''
4174 case "$prefix" in
4175 '') ;;
4176 *)
4177         case "$ans" in
4178         "$prefix") ;;
4179         *) oldprefix="$prefix";;
4180         esac
4181         ;;
4182 esac
4183 prefix="$ans"
4184 prefixexp="$ansexp"
4185
4186 : allow them to override the AFS root
4187 case "$afsroot" in
4188 '')     afsroot=/afs ;;
4189 *)      afsroot=$afsroot ;;
4190 esac
4191
4192 : is AFS running?
4193 echo " "
4194 case "$afs" in
4195 $define|true)   afs=true ;;
4196 $undef|false)   afs=false ;;
4197 *)      if $test -d $afsroot; then
4198                 afs=true
4199         else
4200                 afs=false
4201         fi
4202         ;;
4203 esac
4204 if $afs; then
4205         echo "AFS may be running... I'll be extra cautious then..." >&4
4206 else
4207         echo "AFS does not seem to be running..." >&4
4208 fi
4209
4210 : determine installation prefix for where package is to be installed.
4211 if $afs; then
4212 $cat <<EOM
4213
4214 Since you are running AFS, I need to distinguish the directory in which
4215 files will reside from the directory in which they are installed (and from
4216 which they are presumably copied to the former directory by occult means).
4217
4218 EOM
4219         case "$installprefix" in
4220         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4221         *) dflt="$installprefix";;
4222         esac
4223 else
4224 $cat <<EOM
4225
4226 In some special cases, particularly when building $package for distribution,
4227 it is convenient to distinguish the directory in which files should be
4228 installed from the directory ($prefix) in which they will
4229 eventually reside.  For most users, these two directories are the same.
4230
4231 EOM
4232         case "$installprefix" in
4233         '') dflt=$prefix ;;
4234         *) dflt=$installprefix;;
4235         esac
4236 fi
4237 fn=d~
4238 rp='What installation prefix should I use for installing files?'
4239 . ./getfile
4240 installprefix="$ans"
4241 installprefixexp="$ansexp"
4242
4243 : Perform the prefixexp/installprefixexp correction if necessary
4244 cat <<EOS >installprefix
4245 $startsh
4246 EOS
4247 cat <<'EOSC' >>installprefix
4248 : Change installation prefix, if necessary.
4249 if $test X"$prefix" != X"$installprefix"; then
4250     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4251 else
4252     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4253 fi
4254 EOSC
4255 chmod +x installprefix
4256 $eunicefix installprefix
4257
4258 : Set variables such as privlib and privlibexp from the output of ./getfile
4259 : performing the prefixexp/installprefixexp correction if necessary.
4260 cat <<EOS >setprefixvar
4261 $startsh
4262 EOS
4263 cat <<'EOSC' >>setprefixvar
4264 eval "${prefixvar}=\"\$ans\""
4265 eval "${prefixvar}exp=\"\$ansexp\""
4266 . ./installprefix
4267 EOSC
4268 chmod +x setprefixvar
4269 $eunicefix setprefixvar
4270
4271 : set up the script used to warn in case of inconsistency
4272 cat <<EOS >whoa
4273 $startsh
4274 EOS
4275 cat <<'EOSC' >>whoa
4276 dflt=y
4277 case "$hint" in
4278     recommended)
4279         case "$hintfile" in
4280         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4281                 ;;
4282         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4283                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4284                 ;;
4285         esac
4286         ;;
4287     *)  echo " "
4288         echo "*** WHOA THERE!!! ***" >&4
4289         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4290         ;;
4291 esac
4292 rp="    Keep the $hint value?"
4293 . ./myread
4294 case "$ans" in
4295 y) td=$was; tu=$was;;
4296 esac
4297 EOSC
4298
4299 : function used to set '$1' to '$val'
4300 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4301 case "$val$was" in
4302 $define$undef) . ./whoa; eval "$var=\$td";;
4303 $undef$define) . ./whoa; eval "$var=\$tu";;
4304 *) eval "$var=$val";;
4305 esac'
4306
4307 : get the patchlevel
4308 echo " "
4309 echo "Getting the current patchlevel..." >&4
4310 if $test -r $rsrc/patchlevel.h;then
4311         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4312         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4313         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4314         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4315         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4316         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4317         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4318 else
4319         revision=0
4320         patchlevel=0
4321         subversion=0
4322         api_revision=0
4323         api_version=0
4324         api_subversion=0
4325         perl_patchlevel=0
4326         $echo "(You do not have patchlevel.h.  Eek.)"
4327 fi
4328 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4329 version_patchlevel_string="version $patchlevel subversion $subversion"
4330 case "$perl_patchlevel" in
4331 0|'') ;;
4332 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4333     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4334     ;;
4335 esac
4336
4337 $echo "(You have $package $version_patchlevel_string.)"
4338
4339 case "$osname" in
4340 dos|vms)
4341         : XXX Should be a Configure test for double-dots in filenames.
4342         version=`echo $revision $patchlevel $subversion | \
4343                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4344         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4345                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4346         ;;
4347 *)
4348         version=`echo $revision $patchlevel $subversion | \
4349                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4350         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4351                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4352         ;;
4353 esac
4354 : Special case the 5.005_xx maintenance series, which used 5.005
4355 : without any subversion label as a subdirectory in $sitelib
4356 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4357         api_versionstring='5.005'
4358 fi
4359
4360 : Do we want threads support and if so, what type
4361 case "$usethreads" in
4362 $define|true|[yY]*)     dflt='y';;
4363 *)     # Catch case where user specified ithreads or 5005threads but
4364        # forgot -Dusethreads (A.D. 4/2002)
4365        case "$useithreads$use5005threads" in
4366        *$define*)       dflt='y';;
4367        *)               dflt='n';;
4368        esac
4369        ;;
4370 esac
4371 cat <<EOM
4372
4373 Perl can be built to offer a form of threading support on some systems
4374 To do so, Configure can be run with -Dusethreads.
4375
4376 Note that Perl built with threading support runs slightly slower
4377 and uses slightly more memory than plain Perl.
4378
4379 If this doesn't make any sense to you, just accept the default '$dflt'.
4380 EOM
4381 rp='Build a threading Perl?'
4382 . ./myread
4383 case "$ans" in
4384 y|Y)    val="$define" ;;
4385 *)      val="$undef" ;;
4386 esac
4387 set usethreads
4388 eval $setvar
4389
4390 if $test $patchlevel -lt 9; then
4391     case "$usethreads" in
4392     $define)
4393         : Default to ithreads unless overridden on command line or with
4394         : old config.sh
4395         dflt='y'
4396         case "$use5005threads" in
4397                 $define|true|[yY]*)
4398                         echo "5.005 threads are no longer supported"
4399                         exit 1
4400                 ;;
4401         esac
4402         case "$useithreads" in
4403                 $undef|false|[nN]*) dflt='n';;
4404         esac
4405         rp='Use the newer interpreter-based ithreads?'
4406         . ./myread
4407         case "$ans" in
4408         y|Y)    val="$define" ;;
4409         *)      val="$undef" ;;
4410         esac
4411         set useithreads
4412         eval $setvar
4413         : Now set use5005threads to the opposite value.
4414         case "$useithreads" in
4415         $define) val="$undef" ;;
4416         *) val="$define" ;;
4417         esac
4418         set use5005threads
4419         eval $setvar
4420         ;;
4421     *)
4422         useithreads="$undef"
4423         use5005threads="$undef"
4424         ;;
4425     esac
4426
4427     case "$useithreads$use5005threads" in
4428     "$define$define")
4429         $cat >&4 <<EOM
4430
4431 You cannot have both the ithreads and the 5.005 threads enabled
4432 at the same time.  Disabling the 5.005 threads since they are
4433 much less stable than the ithreads.
4434
4435 EOM
4436         use5005threads="$undef"
4437         ;;
4438     esac
4439
4440 else
4441 : perl-5.9.x and later
4442
4443     if test X"$usethreads" = "X$define"; then
4444         case "$use5005threads" in
4445             $define|true|[yY]*)
4446                 $cat >&4 <<EOM
4447
4448 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4449
4450 EOM
4451             ;;
4452         esac
4453     fi
4454
4455     use5005threads="$undef"
4456     useithreads="$usethreads"
4457 fi
4458
4459 case "$d_oldpthreads" in
4460 '')     : Configure tests would be welcome here.  For now, assume undef.
4461         val="$undef" ;;
4462 *)      val="$d_oldpthreads" ;;
4463 esac
4464 set d_oldpthreads
4465 eval $setvar
4466
4467
4468 : Look for a hint-file generated 'call-back-unit'.  If the
4469 : user has specified that a threading perl is to be built,
4470 : we may need to set or change some other defaults.
4471 if $test -f usethreads.cbu; then
4472     echo "Your platform has some specific hints regarding threaded builds, using them..."
4473     . ./usethreads.cbu
4474 else
4475     case "$usethreads" in
4476         "$define"|true|[yY]*)
4477                 $cat <<EOM
4478 (Your platform does not have any specific hints for threaded builds.
4479  Assuming POSIX threads, then.)
4480 EOM
4481         ;;
4482     esac
4483 fi
4484
4485 : Check if multiplicity is required
4486 cat <<EOM
4487
4488 Perl can be built so that multiple Perl interpreters can coexist
4489 within the same Perl executable.
4490 EOM
4491
4492 case "$useithreads" in
4493 $define)
4494         cat <<EOM
4495 This multiple interpreter support is required for interpreter-based threads.
4496 EOM
4497         val="$define"
4498         ;;
4499 *)      case "$usemultiplicity" in
4500         $define|true|[yY]*)     dflt='y';;
4501         *) dflt='n';;
4502         esac
4503         echo " "
4504         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4505         rp='Build Perl for multiplicity?'
4506         . ./myread
4507         case "$ans" in
4508         y|Y)    val="$define" ;;
4509         *)      val="$undef" ;;
4510         esac
4511         ;;
4512 esac
4513 set usemultiplicity
4514 eval $setvar
4515
4516 : Check if morebits is requested
4517 case "$usemorebits" in
4518 "$define"|true|[yY]*)
4519         use64bitint="$define"
4520         uselongdouble="$define"
4521         usemorebits="$define"
4522         ;;
4523 *)      usemorebits="$undef"
4524         ;;
4525 esac
4526
4527 : Determine the C compiler to be used
4528 echo " "
4529 case "$cc" in
4530 '') dflt=cc;;
4531 *) dflt="$cc";;
4532 esac
4533 rp="Use which C compiler?"
4534 . ./myread
4535 cc="$ans"
4536
4537 : See whether they have no cc but they do have gcc
4538 . ./trygcc
4539 if $test -f cc.cbu; then
4540     . ./cc.cbu
4541 fi
4542 . ./checkcc
4543
4544 : make some quick guesses about what we are up against
4545 echo " "
4546 $echo $n "Hmm...  $c"
4547 echo exit 1 >bsd
4548 echo exit 1 >usg
4549 echo exit 1 >v7
4550 echo exit 1 >osf1
4551 echo exit 1 >eunice
4552 echo exit 1 >xenix
4553 echo exit 1 >venix
4554 echo exit 1 >os2
4555 d_bsd="$undef"
4556 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4557 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4558 then
4559         echo "Looks kind of like an OSF/1 system, but we'll see..."
4560         echo exit 0 >osf1
4561 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4562         xxx=`./loc addbib blurfl $pth`
4563         if $test -f $xxx; then
4564         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4565                 echo exit 0 >bsd
4566                 echo exit 0 >usg
4567         else
4568                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4569                         echo "Looks kind of like an extended USG system, but we'll see..."
4570                 else
4571                         echo "Looks kind of like a USG system, but we'll see..."
4572                 fi
4573                 echo exit 0 >usg
4574         fi
4575 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4576         echo "Looks kind of like a BSD system, but we'll see..."
4577         d_bsd="$define"
4578         echo exit 0 >bsd
4579 else
4580         echo "Looks kind of like a Version 7 system, but we'll see..."
4581         echo exit 0 >v7
4582 fi
4583 case "$eunicefix" in
4584 *unixtovms*)
4585         $cat <<'EOI'
4586 There is, however, a strange, musty smell in the air that reminds me of
4587 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4588 EOI
4589         echo exit 0 >eunice
4590         d_eunice="$define"
4591 : it so happens the Eunice I know will not run shell scripts in Unix format
4592         ;;
4593 *)
4594         echo " "
4595         echo "Congratulations.  You aren't running Eunice."
4596         d_eunice="$undef"
4597         ;;
4598 esac
4599 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4600 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4601 : semicolon as a patch separator
4602 case "$p_" in
4603 :) ;;
4604 *)
4605         $cat <<'EOI'
4606 I have the feeling something is not exactly right, however...don't tell me...
4607 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4608 (Or you may be running DOS with DJGPP.)
4609 EOI
4610         echo exit 0 >os2
4611         ;;
4612 esac
4613 if test -f /xenix; then
4614         echo "Actually, this looks more like a XENIX system..."
4615         echo exit 0 >xenix
4616         d_xenix="$define"
4617 else
4618         echo " "
4619         echo "It's not Xenix..."
4620         d_xenix="$undef"
4621 fi
4622 chmod +x xenix
4623 $eunicefix xenix
4624 if test -f /venix; then
4625         echo "Actually, this looks more like a VENIX system..."
4626         echo exit 0 >venix
4627 else
4628         echo " "
4629         if ./xenix; then
4630                 : null
4631         else
4632                 echo "Nor is it Venix..."
4633         fi
4634 fi
4635 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4636 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4637 $rm -f foo
4638
4639 : Check if we are using GNU gcc and what its version is
4640 echo " "
4641 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4642 $cat >try.c <<EOM
4643 #include <stdio.h>
4644 int main() {
4645 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4646 #ifdef __VERSION__
4647         printf("%s\n", __VERSION__);
4648 #else
4649         printf("%s\n", "1");
4650 #endif
4651 #endif
4652         return(0);
4653 }
4654 EOM
4655 if $cc -o try $ccflags $ldflags try.c; then
4656         gccversion=`$run ./try`
4657         case "$gccversion" in
4658         '') echo "You are not using GNU cc." ;;
4659         *)  echo "You are using GNU cc $gccversion."
4660             ccname=gcc
4661             ;;
4662         esac
4663 else
4664         echo " "
4665         echo "*** WHOA THERE!!! ***" >&4
4666         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4667         case "$knowitall" in
4668         '')
4669         echo "    You'd better start hunting for one and let me know about it." >&4
4670                 exit 1
4671                 ;;
4672         esac
4673 fi
4674 $rm -f try try.*
4675 case "$gccversion" in
4676 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4677 esac
4678 case "$gccversion" in
4679 '') gccosandvers='' ;;
4680 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4681    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4682    gccshortvers=''
4683    case "$gccosandvers" in
4684    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4685    $osname$osvers) ;; # looking good
4686    $osname*) cat <<EOM >&4
4687
4688 *** WHOA THERE!!! ***
4689
4690     Your gcc has not been compiled for the exact release of
4691     your operating system ($gccosandvers versus $osname$osvers).
4692
4693     In general it is a good idea to keep gcc synchronized with
4694     the operating system because otherwise serious problems
4695     may ensue when trying to compile software, like Perl.
4696
4697     I'm trying to be optimistic here, though, and will continue.
4698     If later during the configuration and build icky compilation
4699     problems appear (headerfile conflicts being the most common
4700     manifestation), I suggest reinstalling the gcc to match
4701     your operating system release.
4702
4703 EOM
4704       ;;
4705    *) gccosandvers='' ;; # failed to parse, better be silent
4706    esac
4707    ;;
4708 esac
4709 case "$ccname" in
4710 '') ccname="$cc" ;;
4711 esac
4712
4713 # gcc 3.* complain about adding -Idirectories that they already know about,
4714 # so we will take those off from locincpth.
4715 case "$gccversion" in
4716 3*)
4717     echo "main(){}">try.c
4718     for incdir in $locincpth; do
4719        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4720              grep '^c[cp]p*[01]: warning: changing search order '`
4721        if test "X$warn" != X; then
4722            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4723        fi
4724     done
4725     $rm -f try try.*
4726 esac
4727
4728 # gcc 4.9 by default does some optimizations that break perl.
4729 # see ticket 121505.
4730 #
4731 # The -fwrapv disables those optimizations (and probably others,) so
4732 # for gcc 4.9 (and later, since the optimizations probably won't go
4733 # away), add -fwrapv unless the user requests -fno-wrapv, which
4734 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4735 # which turns the overflows -fwrapv ignores into runtime errors.
4736 case "$gccversion" in
4737 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4738     case "$ccflags" in
4739     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4740     *) ccflags="$ccflags -fwrapv" ;;
4741     esac
4742 esac
4743
4744 : What should the include directory be ?
4745 : Use sysroot if set, so findhdr looks in the right place.
4746 echo " "
4747 $echo $n "Hmm...  $c"
4748 dflt="$sysroot/usr/include"
4749 incpath=''
4750 mips_type=''
4751 if $test -f /bin/mips && /bin/mips; then
4752         echo "Looks like a MIPS system..."
4753         $cat >usr.c <<'EOCP'
4754 #ifdef SYSTYPE_BSD43
4755 /bsd43
4756 #endif
4757 EOCP
4758         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4759                 dflt='/bsd43/usr/include'
4760                 incpath='/bsd43'
4761                 mips_type='BSD 4.3'
4762         else
4763                 mips_type='System V'
4764         fi
4765         $rm -f usr.c usr.out
4766         echo "and you're compiling with the $mips_type compiler and libraries."
4767         xxx_prompt=y
4768         echo "exit 0" >mips
4769 else
4770         echo "Doesn't look like a MIPS system."
4771         xxx_prompt=n
4772         echo "exit 1" >mips
4773 fi
4774 chmod +x mips
4775 $eunicefix mips
4776 case "$usrinc" in
4777 '') ;;
4778 *) dflt="$usrinc";;
4779 esac
4780 case "$xxx_prompt" in
4781 y)      fn=d/
4782         echo " "
4783         rp='Where are the include files you want to use?'
4784         . ./getfile
4785         usrinc="$ans"
4786         ;;
4787 *)      usrinc="$dflt"
4788         ;;
4789 esac
4790
4791 : see how we invoke the C preprocessor
4792 echo " "
4793 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4794 cat <<'EOT' >testcpp.c
4795 #define ABC abc
4796 #define XYZ xyz
4797 ABC.XYZ
4798 EOT
4799 cd ..
4800 if test ! -f cppstdin; then
4801         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4802                 # AIX cc -E doesn't show the absolute headerfile
4803                 # locations but we'll cheat by using the -M flag.
4804                 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
4805         else
4806                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4807         fi
4808 else
4809         echo "Keeping your $hint cppstdin wrapper."
4810 fi
4811 chmod 755 cppstdin
4812 wrapper=`pwd`/cppstdin
4813 ok='false'
4814 cd UU
4815
4816 if $test "X$cppstdin" != "X" && \
4817         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4818         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4819 then
4820         echo "You used to use $cppstdin $cppminus so we'll use that again."
4821         case "$cpprun" in
4822         '') echo "But let's see if we can live without a wrapper..." ;;
4823         *)
4824                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4825                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4826                 then
4827                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4828                         ok='true'
4829                 else
4830                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4831                 fi
4832                 ;;
4833         esac
4834 else
4835         case "$cppstdin" in
4836         '') ;;
4837         *)
4838                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4839                 ;;
4840         esac
4841 fi
4842
4843 if $ok; then
4844         : nothing
4845 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4846         $cc -E <testcpp.c >testcpp.out 2>&1; \
4847         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4848         echo "Yup, it does."
4849         x_cpp="$cc $cppflags -E"
4850         x_minus='';
4851 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4852         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4853         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4854         echo "Yup, it does."
4855         x_cpp="$cc $cppflags -E"
4856         x_minus='-';
4857 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4858         $cc -P <testcpp.c >testcpp.out 2>&1; \
4859         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4860         echo "Yipee, that works!"
4861         x_cpp="$cc $cppflags -P"
4862         x_minus='';
4863 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4864         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4865         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4866         echo "At long last!"
4867         x_cpp="$cc $cppflags -P"
4868         x_minus='-';
4869 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4870         $cpp <testcpp.c >testcpp.out 2>&1; \
4871         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4872         echo "It works!"
4873         x_cpp="$cpp $cppflags"
4874         x_minus='';
4875 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4876         $cpp - <testcpp.c >testcpp.out 2>&1; \
4877         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4878         echo "Hooray, it works!  I was beginning to wonder."
4879         x_cpp="$cpp $cppflags"
4880         x_minus='-';
4881 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4882         $wrapper <testcpp.c >testcpp.out 2>&1; \
4883         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4884         x_cpp="$wrapper"
4885         x_minus=''
4886         echo "Eureka!"
4887 else
4888         dflt=''
4889         rp="No dice.  I can't find a C preprocessor.  Name one:"
4890         . ./myread
4891         x_cpp="$ans"
4892         x_minus=''
4893         $x_cpp <testcpp.c >testcpp.out 2>&1
4894         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4895                 echo "OK, that will do." >&4
4896         else
4897 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4898                 exit 1
4899         fi
4900 fi
4901
4902 case "$ok" in
4903 false)
4904         cppstdin="$x_cpp"
4905         cppminus="$x_minus"
4906         cpprun="$x_cpp"
4907         cpplast="$x_minus"
4908         set X $x_cpp
4909         shift
4910         case "$1" in
4911         "$cpp")
4912                 echo "Perhaps can we force $cc -E using a wrapper..."
4913                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4914                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4915                 then
4916                         echo "Yup, we can."
4917                         cppstdin="$wrapper"
4918                         cppminus='';
4919                 else
4920                         echo "Nope, we'll have to live without it..."
4921                 fi
4922                 ;;
4923         esac
4924         case "$cpprun" in
4925         "$wrapper")
4926                 cpprun=''
4927                 cpplast=''
4928                 ;;
4929         esac
4930         ;;
4931 esac
4932
4933 case "$cppstdin" in
4934 "$wrapper"|'cppstdin') ;;
4935 *) $rm -f $wrapper;;
4936 esac
4937 $rm -f testcpp.c testcpp.out
4938
4939 : Adjust cppfilter for path component separator
4940 case "$osname" in
4941 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4942 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4943 *)   cppfilter='' ;;
4944 esac
4945
4946 : Use gcc to determine libpth and incpth
4947 # If using gcc or clang, we can get better values for libpth, incpth
4948 # and usrinc directly from the compiler.
4949 # Note that ccname for clang is also gcc.
4950 case "$ccname" in
4951     gcc)
4952         $echo 'extern int foo;' > try.c
4953         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4954         shift
4955         if $test $# -gt 0; then
4956             incpth="$incpth $*"
4957             incpth="`$echo $incpth|$sed 's/^ //'`"
4958             for i in $*; do
4959                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4960                 if $test -d $j; then
4961                     libpth="$libpth $j"
4962                 fi
4963             done
4964             libpth="`$echo $libpth|$sed 's/^ //'`"
4965             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4966                 if $test -d $xxx; then
4967                     case " $libpth " in
4968                     *" $xxx "*) ;;
4969                     *) libpth="$libpth $xxx";;
4970                     esac
4971                 fi
4972             done
4973         fi
4974         $rm -f try.c
4975         case "$usrinc" in
4976         '') for i in $incpth; do
4977                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4978                     usrinc="$i"
4979                     break
4980                 fi
4981             done
4982             ;;
4983         esac
4984
4985         case "$usecrosscompile" in
4986         $define|true|[yY]*)
4987             case "$incpth" in
4988                 '') echo "Incpth not defined." >&4; croak=y ;;
4989                 *)  echo "Using incpth '$incpth'." >&4 ;;
4990             esac
4991             case "$libpth" in
4992                 '') echo "Libpth not defined." >&4; croak=y ;;
4993                 *)  echo "Using libpth '$libpth'." >&4 ;;
4994             esac
4995             case "$usrinc" in
4996                 '') echo "Usrinc not defined." >&4; croak=y ;;
4997                 *)  echo "Using usrinc $usrinc." >&4 ;;
4998             esac
4999             case "$croak" in
5000                 y)
5001                 if test "X$sysroot" = X; then
5002                     echo "Cannot continue, aborting." >&4; exit 1
5003                 else
5004                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5005                 fi
5006                 ;;
5007             esac
5008             ;;
5009         esac
5010     ;;
5011 esac
5012
5013 : Default value for incpth is just usrinc
5014 case "$incpth" in
5015 '') incpth="$usrinc";;
5016 esac
5017
5018 : Set private lib path
5019 case "$plibpth" in
5020 '') if ./mips; then
5021         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5022     fi;;
5023 esac
5024 case "$libpth" in
5025 ' ') dlist='';;
5026 '') dlist="$loclibpth $plibpth $glibpth";;
5027 *) dlist="$libpth";;
5028 esac
5029
5030 : Now check and see which directories actually exist, avoiding duplicates
5031 for xxx in $dlist
5032 do
5033     if $test -d $xxx; then
5034                 case " $libpth " in
5035                 *" $xxx "*) ;;
5036                 *) libpth="$libpth $xxx";;
5037                 esac
5038     fi
5039 done
5040 $cat <<'EOM'
5041
5042 Some systems have incompatible or broken versions of libraries.  Among
5043 the directories listed in the question below, please remove any you
5044 know not to be holding relevant libraries, and add any that are needed.
5045 Say "none" for none.
5046
5047 EOM
5048
5049 if test "X$sysroot" != X; then
5050     $cat <<EOM
5051 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5052
5053 EOM
5054 fi
5055
5056 case "$libpth" in
5057 '') dflt='none';;
5058 *)
5059         set X $libpth
5060         shift
5061         dflt=${1+"$@"}
5062         ;;
5063 esac
5064 rp="Directories to use for library searches?"
5065 . ./myread
5066 case "$ans" in
5067 none) libpth=' ';;
5068 *) libpth="$ans";;
5069 esac
5070
5071 : compute shared library extension
5072 case "$so" in
5073 '')
5074         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5075                 dflt='sl'
5076         else
5077                 dflt='so'
5078         fi
5079         ;;
5080 *) dflt="$so";;
5081 esac
5082 $cat <<EOM
5083
5084 On some systems, shared libraries may be available.  Answer 'none' if
5085 you want to suppress searching of shared libraries for the remainder
5086 of this configuration.
5087
5088 EOM
5089 rp='What is the file extension used for shared libraries?'
5090 . ./myread
5091 so="$ans"
5092
5093 : Does target system insist that shared library basenames are unique
5094 $cat << EOM
5095
5096 Some dynamic loaders assume that the *basename* of shared library filenames
5097 are globally unique.  We'll default this to undef as we assume your system
5098 is not this weird. Set to defined if you're on one of them.
5099
5100 EOM
5101
5102 dflt='n'
5103 rp='Make shared library basenames unique?'
5104 . ./myread
5105 case "$ans" in
5106 y|Y) val="$define" ;;
5107 *)   val="$undef"  ;;
5108 esac
5109 set d_libname_unique
5110 eval $setvar
5111
5112 : Define several unixisms.
5113 : Hints files or command line option can be used to override them.
5114 : The convoluted testing is in case hints files set either the old
5115 : or the new name.
5116 case "$_exe" in
5117 '')     case "$exe_ext" in
5118         '')     ;;
5119         *)      _exe="$exe_ext" ;;
5120         esac
5121         ;;
5122 esac
5123 case "$_a" in
5124 '')     case "$lib_ext" in
5125     '') _a='.a';;
5126         *)      _a="$lib_ext" ;;
5127         esac
5128         ;;
5129 esac
5130 case "$_o" in
5131 '') case "$obj_ext" in
5132         '')     _o='.o';;
5133         *)      _o="$obj_ext";;
5134         esac
5135         ;;
5136 esac
5137 case "$p_" in
5138 '') case "$path_sep" in
5139         '')     p_=':';;
5140         *)      p_="$path_sep";;
5141         esac
5142         ;;
5143 esac
5144 exe_ext=$_exe
5145 lib_ext=$_a
5146 obj_ext=$_o
5147 path_sep=$p_
5148
5149 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5150
5151 : Which makefile gets called first.  This is used by make depend.
5152 case "$firstmakefile" in
5153 '') firstmakefile='makefile';;
5154 esac
5155
5156 : Check is we will use socks
5157 case "$usesocks" in
5158 $define|true|[yY]*)     dflt='y';;
5159 *) dflt='n';;
5160 esac
5161 cat <<EOM
5162
5163 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5164 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5165 to use the PerlIO abstraction layer, this will be implicitly selected.
5166
5167 If this doesn't make any sense to you, just accept the default '$dflt'.
5168 EOM
5169 rp='Build Perl for SOCKS?'
5170 . ./myread
5171 case "$ans" in
5172 y|Y)    val="$define" ;;
5173 *)      val="$undef" ;;
5174 esac
5175 set usesocks
5176 eval $setvar
5177
5178 : Check for uselongdouble support
5179 case "$ccflags" in
5180 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5181 esac
5182
5183 case "$uselongdouble" in
5184 $define|true|[yY]*)     dflt='y';;
5185 *) dflt='n';;
5186 esac
5187 cat <<EOM
5188
5189 Perl can be built to take advantage of long doubles which
5190 (if available) may give more accuracy and range for floating point numbers.
5191
5192 If this doesn't make any sense to you, just accept the default '$dflt'.
5193 EOM
5194 rp='Try to use long doubles if available?'
5195 . ./myread
5196 case "$ans" in
5197 y|Y)    val="$define"   ;;
5198 *)      val="$undef"    ;;
5199 esac
5200 set uselongdouble
5201 eval $setvar
5202
5203 case "$uselongdouble" in
5204 true|[yY]*) uselongdouble="$define" ;;
5205 esac
5206
5207 : Look for a hint-file generated 'call-back-unit'.  If the
5208 : user has specified that long doubles should be used,
5209 : we may need to set or change some other defaults.
5210 if $test -f uselongdouble.cbu; then
5211     echo "Your platform has some specific hints regarding long doubles, using them..."
5212     . ./uselongdouble.cbu
5213 else
5214     case "$uselongdouble" in
5215         $define)
5216                 $cat <<EOM
5217 (Your platform does not have any specific hints for long doubles.)
5218 EOM
5219         ;;
5220     esac
5221 fi
5222
5223 : Check if quadmath is requested
5224 case "$usequadmath" in
5225 "$define"|true|[yY]*) usequadmath="$define" ;;
5226 *)                    usequadmath="$undef"  ;;
5227 esac
5228
5229 : Looking for optional libraries
5230 echo " "
5231 echo "Checking for optional libraries..." >&4
5232 case "$libs" in
5233 ' '|'') dflt='';;
5234 *) dflt="$libs";;
5235 esac
5236 case "$libswanted" in
5237 '') libswanted='c_s';;
5238 esac
5239 case "$usesocks" in
5240 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5241 esac
5242 case "$usecbacktrace" in
5243 "$define") libswanted="$libswanted bfd" ;;
5244 esac
5245 case "$usequadmath" in
5246 "$define") libswanted="$libswanted quadmath" ;;
5247 esac
5248 libsfound=''
5249 libsfiles=''
5250 libsdirs=''
5251 libspath=''
5252 for thisdir in $libpth $xlibpth; do
5253   test -d $thisdir && libspath="$libspath $thisdir"
5254 done
5255 for thislib in $libswanted; do
5256         for thisdir in $libspath; do
5257             xxx=''
5258             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5259                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5260                 $test -f "$xxx" && eval $libscheck
5261                 $test -f "$xxx" && libstyle=shared
5262                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5263                 $test -f "$xxx" && eval $libscheck
5264                 $test -f "$xxx" && libstyle=shared
5265             fi
5266             if test ! -f "$xxx"; then
5267                 xxx=$thisdir/lib$thislib.$so
5268                 $test -f "$xxx" && eval $libscheck
5269                 $test -f "$xxx" && libstyle=shared
5270             fi
5271             if test ! -f "$xxx"; then
5272                 xxx=$thisdir/lib$thislib$_a
5273                 $test -f "$xxx" && eval $libscheck
5274                 $test -f "$xxx" && libstyle=static
5275             fi
5276             if test ! -f "$xxx"; then
5277                 xxx=$thisdir/$thislib$_a
5278                 $test -f "$xxx" && eval $libscheck
5279                 $test -f "$xxx" && libstyle=static
5280             fi
5281             if test ! -f "$xxx"; then
5282                 xxx=$thisdir/lib${thislib}_s$_a
5283                 $test -f "$xxx" && eval $libscheck
5284                 $test -f "$xxx" && libstyle=static
5285                 $test -f "$xxx" && thislib=${thislib}_s
5286             fi
5287             if test ! -f "$xxx"; then
5288                 xxx=$thisdir/Slib$thislib$_a
5289                 $test -f "$xxx" && eval $libscheck
5290                 $test -f "$xxx" && libstyle=static
5291             fi
5292             if $test -f "$xxx"; then
5293                 case "$libstyle" in
5294                 shared) echo "Found -l$thislib (shared)." ;;
5295                 static) echo "Found -l$thislib." ;;
5296                 *)      echo "Found -l$thislib ($libstyle)." ;;
5297                 esac
5298                 case " $dflt " in
5299                 *"-l$thislib "*);;
5300                 *) dflt="$dflt -l$thislib"
5301                    libsfound="$libsfound $xxx"
5302                    yyy=`basename $xxx`
5303                    libsfiles="$libsfiles $yyy"
5304                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5305                    case " $libsdirs " in
5306                    *" $yyy "*) ;;
5307                    *) libsdirs="$libsdirs $yyy" ;;
5308                    esac
5309                    ;;
5310                 esac
5311                 break
5312             fi
5313         done
5314         if $test ! -f "$xxx"; then
5315             echo "No -l$thislib."
5316         fi
5317 done
5318 set X $dflt
5319 shift
5320 dflt="$*"
5321 case "$libs" in
5322 '') dflt="$dflt";;
5323 *) dflt="$libs";;
5324 esac
5325 case "$dflt" in
5326 ' '|'') dflt='none';;
5327 esac
5328
5329 $cat <<EOM
5330
5331 In order to compile $package on your machine, a number of libraries
5332 are usually needed.  Include any other special libraries here as well.
5333 Say "none" for none.  The default list is almost always right.
5334 EOM
5335
5336 echo " "
5337 rp="What libraries to use?"
5338 . ./myread
5339 case "$ans" in
5340 none) libs=' ';;
5341 *) libs="$ans";;
5342 esac
5343
5344 : determine optimization, if desired, or use for debug flag also
5345 case "$optimize" in
5346 ' '|$undef) dflt='none';;
5347 '') dflt='-O';;
5348 *) dflt="$optimize";;
5349 esac
5350 $cat <<EOH
5351
5352 By default, $package compiles with the -O flag to use the optimizer.
5353 Alternately, you might want to use the symbolic debugger, which uses
5354 the -g flag (on traditional Unix systems).  Either flag can be
5355 specified here.  To use neither flag, specify the word "none".
5356
5357 EOH
5358 rp="What optimizer/debugger flag should be used?"
5359 . ./myread
5360 optimize="$ans"
5361 case "$optimize" in
5362 'none') optimize=" ";;
5363 esac
5364
5365 : Check what DEBUGGING is required from the command line
5366 : -DEBUGGING      or -DDEBUGGING or
5367 : -DEBUGGING=both                       = -g + -DDEBUGGING
5368 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5369 : -DEBUGGING=none or -UDEBUGGING        =
5370 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5371 case "$EBUGGING" in
5372 '')     ;;
5373 *)      DEBUGGING=$EBUGGING ;;
5374 esac
5375
5376 case "$DEBUGGING" in
5377 -g|both|$define)
5378     case "$optimize" in
5379         *-g*) ;;
5380         *)    optimize="$optimize -g" ;;
5381     esac ;;
5382 none|$undef)
5383     case "$optimize" in
5384         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5385                 shift
5386                 optimize="$*"
5387                 ;;
5388     esac ;;
5389 esac
5390
5391 dflt=''
5392 case "$DEBUGGING" in
5393 both|$define) dflt='-DDEBUGGING'
5394 esac
5395
5396 : argument order is deliberate, as the flag will start with - which set could
5397 : think is an option
5398 checkccflag='check=$1; flag=$2; callback=$3;
5399 echo " ";
5400 echo "Checking if your compiler accepts $flag" 2>&1;
5401 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5402 echo "int main(void) { return 0; }" > gcctest.c;
5403 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5404     echo "Yes, it does." 2>&1;
5405     if $test -s gcctest.out ; then
5406         echo "But your platform does not like it:";
5407         cat gcctest.out;
5408     else
5409         case "$ccflags" in
5410         *$check*)
5411             echo "Leaving current flags $ccflags alone." 2>&1
5412             ;;
5413         *) dflt="$dflt $flag";
5414             eval $callback
5415             ;;
5416         esac
5417     fi
5418 else
5419     echo "Nope, it does not, but that is ok." 2>&1;
5420 fi
5421 '
5422
5423 : We will not override a previous value, but we might want to
5424 : augment a hint file
5425 case "$hint" in
5426 default|recommended)
5427         case "$gccversion" in
5428         1*) dflt="$dflt -fpcc-struct-return" ;;
5429         esac
5430         case "$optimize:$DEBUGGING" in
5431         *-g*:old) dflt="$dflt -DDEBUGGING";;
5432         esac
5433         case "$gccversion" in
5434         2*) if $test -d /etc/conf/kconfig.d &&
5435                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5436                 then
5437                         # Interactive Systems (ISC) POSIX mode.
5438                         dflt="$dflt -posix"
5439                 fi
5440                 ;;
5441         esac
5442         case "$gccversion" in
5443         1*) ;;
5444         2.[0-8]*) ;;
5445         ?*)     set strict-aliasing -fno-strict-aliasing
5446                 eval $checkccflag
5447                 ;;
5448         esac
5449         # For gcc, adding -pipe speeds up compilations for some, but apparently
5450         # some assemblers can't read from stdin.  (It also slows down compilations
5451         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5452         case "$gccversion" in
5453         ?*)     set pipe -pipe
5454                 eval $checkccflag
5455                 ;;
5456         esac
5457
5458         # on x86_64 (at least) we require an extra library (libssp) in the
5459         # link command line. This library is not named, so I infer that it is
5460         # an implementation detail that may change. Hence the safest approach
5461         # is to add the flag to the flags passed to the compiler at link time,
5462         # as that way the compiler can do the right implementation dependant
5463         # thing. (NWC)
5464         case "$osname" in
5465         amigaos) ;; # -fstack-protector builds but doesn't work
5466         *)      case "$gccversion" in
5467                 ?*)     set stack-protector-strong -fstack-protector-strong
5468                         eval $checkccflag
5469                         case "$dflt" in
5470                         *-fstack-protector-strong*) ;; # It got added.
5471                         *) # Try the plain/older -fstack-protector.
5472                            set stack-protector -fstack-protector
5473                            eval $checkccflag
5474                            ;;
5475                         esac
5476                         ;;
5477                 esac
5478                 ;;
5479         esac
5480         ;;
5481 esac
5482
5483 case "$mips_type" in
5484 *BSD*|'') inclwanted="$locincpth $usrinc";;
5485 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5486 esac
5487 for thisincl in $inclwanted; do
5488         if $test -d $thisincl; then
5489                 if $test x$thisincl != x$usrinc; then
5490                         case "$dflt" in
5491                         *" -I$thisincl "*);;
5492                         *) dflt="$dflt -I$thisincl ";;
5493                         esac
5494                 fi
5495         fi
5496 done
5497
5498 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5499         xxx=true;
5500 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5501         xxx=true;
5502 else
5503         xxx=false;
5504 fi;
5505 if $xxx; then
5506         case "$dflt" in
5507         *$2*);;
5508         *) dflt="$dflt -D$2";;
5509         esac;
5510 fi'
5511
5512 set signal.h LANGUAGE_C; eval $inctest
5513
5514 case "$usesocks" in
5515 $define)
5516         ccflags="$ccflags -DSOCKS"
5517         ;;
5518 esac
5519
5520 case "$hint" in
5521 default|recommended) dflt="$ccflags $dflt" ;;
5522 *) dflt="$ccflags";;
5523 esac
5524
5525 case "$dflt" in
5526 ''|' ') dflt=none;;
5527 esac
5528
5529 $cat <<EOH
5530
5531 Your C compiler may want other flags.  For this question you should include
5532 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5533 but you should NOT include libraries or ld flags like -lwhatever.  If you
5534 want $package to honor its debug switch, you should include -DDEBUGGING here.
5535 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5536
5537 To use no flags, specify the word "none".
5538
5539 EOH
5540 set X $dflt
5541 shift
5542 dflt=${1+"$@"}
5543 rp="Any additional cc flags?"
5544 . ./myread
5545 case "$ans" in
5546 none) ccflags='';;
5547 *) ccflags="$ans";;
5548 esac
5549
5550 : the following weeds options from ccflags that are of no interest to cpp
5551 case "$cppflags" in
5552 '') cppflags="$ccflags" ;;
5553 *)  set X $ccflags; shift
5554     case " $cppflags " in
5555     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5556     *) cppflags="$cppflags $ccflags" ;;
5557     esac
5558     ;;
5559 esac
5560 case "$gccversion" in
5561 1*) cppflags="$cppflags -D__GNUC__"
5562 esac
5563 case "$mips_type" in
5564 '');;
5565 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5566 esac
5567 case "$cppflags" in
5568 '');;
5569 *)
5570         echo " "
5571         echo "Let me guess what the preprocessor flags are..." >&4
5572         set X $cppflags
5573         shift
5574         cppflags=''
5575         $cat >cpp.c <<'EOM'
5576 #define BLURFL foo
5577
5578 BLURFL xx LFRULB
5579 EOM
5580         previous=''
5581         for flag in $*
5582         do
5583                 case "$flag" in
5584                 -*) ftry="$flag";;
5585                 *) ftry="$previous $flag";;
5586                 esac
5587                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5588                         >cpp1.out 2>/dev/null && \
5589                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5590                         >cpp2.out 2>/dev/null && \
5591                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5592                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5593                 then
5594                         cppflags="$cppflags $ftry"
5595                         previous=''
5596                 else
5597                         previous="$flag"
5598                 fi
5599         done
5600         set X $cppflags
5601         shift
5602         cppflags=${1+"$@"}
5603         case "$cppflags" in
5604         *-*)  echo "They appear to be: $cppflags";;
5605         esac
5606         $rm -f cpp.c cpp?.out
5607         ;;
5608 esac
5609
5610 : flags used in final linking phase
5611 case "$ldflags" in
5612 '') if ./venix; then
5613                 dflt='-i -z'
5614         else
5615                 dflt=''
5616         fi
5617         case "$ccflags" in
5618         *-posix*) dflt="$dflt -posix" ;;
5619         esac
5620         ;;
5621 *) dflt="$ldflags";;
5622 esac
5623 # See note above about -fstack-protector
5624 case "$ccflags" in
5625 *-fstack-protector-strong*)
5626         case "$dflt" in
5627         *-fstack-protector-strong*) ;; # Don't add it again
5628         *) dflt="$dflt -fstack-protector-strong" ;;
5629         esac
5630         ;;
5631 *-fstack-protector*)
5632         case "$dflt" in
5633         *-fstack-protector*) ;; # Don't add it again
5634         *) dflt="$dflt -fstack-protector" ;;
5635         esac
5636         ;;
5637 esac
5638
5639 : Try to guess additional flags to pick up local libraries.
5640 for thislibdir in $libpth; do
5641         case " $loclibpth " in
5642         *" $thislibdir "*)
5643                 case "$dflt " in
5644                 *"-L$thislibdir "*) ;;
5645                 *)  dflt="$dflt -L$thislibdir" ;;
5646                 esac
5647                 ;;
5648         esac
5649 done
5650
5651 case "$dflt" in
5652 '') dflt='none' ;;
5653 esac
5654
5655 $cat <<EOH
5656
5657 Your C linker may need flags.  For this question you should
5658 include -L/whatever and any other flags used by the C linker, but you
5659 should NOT include libraries like -lwhatever.
5660
5661 Make sure you include the appropriate -L/path flags if your C linker
5662 does not normally search all of the directories you specified above,
5663 namely
5664         $libpth
5665 To use no flags, specify the word "none".
5666
5667 EOH
5668
5669 rp="Any additional ld flags (NOT including libraries)?"
5670 . ./myread
5671 case "$ans" in
5672 none) ldflags='';;
5673 *) ldflags="$ans";;
5674 esac
5675 rmlist="$rmlist pdp11"
5676
5677 : coherency check
5678 echo " "
5679 echo "Checking your choice of C compiler and flags for coherency..." >&4
5680 $cat > try.c <<'EOF'
5681 #include <stdio.h>
5682 int main() { printf("Ok\n"); return(0); }
5683 EOF
5684 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5685 shift
5686 $cat >try.msg <<'EOM'
5687 I've tried to compile and run the following simple program:
5688
5689 EOM
5690 $cat try.c >> try.msg
5691
5692 $cat >> try.msg <<EOM
5693
5694 I used the command:
5695
5696         $*
5697         $run ./try
5698
5699 and I got the following output:
5700
5701 EOM
5702 dflt=y
5703 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5704         if $sh -c "$run ./try " >>try.msg 2>&1; then
5705                 xxx=`$run ./try`
5706                 case "$xxx" in
5707                 "Ok") dflt=n ;;
5708                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5709                 esac
5710         else
5711                 echo "The program compiled OK, but exited with status $?." >>try.msg
5712                 rp="You have a problem.  Shall I abort Configure"
5713                 dflt=y
5714         fi
5715 else
5716         echo "I can't compile the test program." >>try.msg
5717         rp="You have a BIG problem.  Shall I abort Configure"
5718         dflt=y
5719 fi
5720 case "$dflt" in
5721 y)
5722         $cat try.msg >&4
5723         case "$knowitall" in
5724         '')
5725                 echo "(The supplied flags or libraries might be incorrect.)"
5726                 ;;
5727         *) dflt=n;;
5728         esac
5729         echo " "
5730         . ./myread
5731         case "$ans" in
5732         n*|N*) ;;
5733         *)      echo "Ok.  Stopping Configure." >&4
5734                 exit 1
5735                 ;;
5736         esac
5737         ;;
5738 n) echo "OK, that should do.";;
5739 esac
5740 $rm_try gcctest gcctest.out
5741
5742 : define a shorthand compile call
5743 compile='
5744 mc_file=$1;
5745 shift;
5746 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5747 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5748 exit 1;
5749 fi;
5750 esac;
5751 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5752 : define a shorthand compile call for compilations that should be ok.
5753 compile_ok='
5754 mc_file=$1;
5755 shift;
5756 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5757
5758 : determine filename position in cpp output
5759 echo " "
5760 echo "Computing filename position in cpp output for #include directives..." >&4
5761 case "$osname" in
5762 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5763 esac
5764 case "$fieldn" in
5765 '')
5766 case "$osname" in
5767 vos) testaccess=-e ;;
5768 *)   testaccess=-r ;;
5769 esac
5770 echo '#include <stdio.h>' > foo.c
5771 $cat >fieldn <<EOF
5772 $startsh
5773 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5774 $grep '^[       ]*#.*stdio\.h' | \
5775 while read cline; do
5776         pos=1
5777         set \$cline
5778         while $test \$# -gt 0; do
5779                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5780                         echo "\$pos"
5781                         exit 0
5782                 fi
5783                 shift
5784                 pos=\`expr \$pos + 1\`
5785         done
5786 done
5787 EOF
5788 chmod +x fieldn
5789 fieldn=`./fieldn`
5790 $rm -f foo.c fieldn
5791 ;;
5792 esac
5793 case $fieldn in
5794 '') pos='???';;
5795 1) pos=first;;
5796 2) pos=second;;
5797 3) pos=third;;
5798 *) pos="${fieldn}th";;
5799 esac
5800 echo "Your cpp writes the filename in the $pos field of the line."
5801
5802 : locate header file
5803 $cat >findhdr <<EOF
5804 $startsh
5805 wanted=\$1
5806 name=''
5807 for usrincdir in $incpth
5808 do
5809         if test -f \$usrincdir/\$wanted; then
5810                 echo "\$usrincdir/\$wanted"
5811                 exit 0
5812         fi
5813 done
5814 awkprg='{ print \$$fieldn }'
5815 echo "#include <\$wanted>" > foo\$\$.c
5816 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5817 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5818 while read cline; do
5819         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5820         case "\$name" in
5821         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5822         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5823         *) exit 2;;
5824         esac;
5825 done;
5826 #
5827 # status = 0: grep returned 0 lines, case statement not executed
5828 # status = 1: headerfile found
5829 # status = 2: while loop executed, no headerfile found
5830 #
5831 status=\$?
5832 $rm -f foo\$\$.c;
5833 if test \$status -eq 1; then
5834         exit 0;
5835 fi
5836 exit 1
5837 EOF
5838 chmod +x findhdr
5839
5840 : define an alternate in-header-list? function
5841 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5842 cont=true; xxf="echo \"<\$1> found.\" >&4";
5843 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5844 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5845 esac;
5846 case $# in 4) instead=instead;; *) instead="at last";; esac;
5847 while $test "$cont"; do
5848         xxx=`./findhdr $1`
5849         var=$2; eval "was=\$$2";
5850         if $test "$xxx" && $test -r "$xxx";
5851         then eval $xxf;
5852         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5853                 cont="";
5854         else eval $xxnf;
5855         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5856         set $yyy; shift; shift; yyy=$@;
5857         case $# in 0) cont="";;
5858         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5859                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5860         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5861                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5862         esac;
5863 done;
5864 while $test "$yyy";
5865 do set $yyy; var=$2; eval "was=\$$2";
5866         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5867         set $yyy; shift; shift; yyy=$@;
5868 done'
5869
5870 : see if stdlib is available
5871 set stdlib.h i_stdlib
5872 eval $inhdr
5873
5874 : check for lengths of integral types
5875 echo " "
5876 case "$intsize" in
5877 '')
5878         echo "Checking to see how big your integers are..." >&4
5879         $cat >try.c <<EOCP
5880 #include <stdio.h>
5881 #$i_stdlib I_STDLIB
5882 #ifdef I_STDLIB
5883 #include <stdlib.h>
5884 #endif
5885 int main()
5886 {
5887         printf("intsize=%d;\n", (int)sizeof(int));
5888         printf("longsize=%d;\n", (int)sizeof(long));
5889         printf("shortsize=%d;\n", (int)sizeof(short));
5890         exit(0);
5891 }
5892 EOCP
5893         set try
5894         if eval $compile_ok && $run ./try > /dev/null; then
5895                 eval `$run ./try`
5896                 echo "Your integers are $intsize bytes long."
5897                 echo "Your long integers are $longsize bytes long."
5898                 echo "Your short integers are $shortsize bytes long."
5899         else
5900                 $cat >&4 <<EOM
5901 !
5902 Help! I can't compile and run the intsize test program: please enlighten me!
5903 (This is probably a misconfiguration in your system or libraries, and
5904 you really ought to fix it.  Still, I'll try anyway.)
5905 !
5906 EOM
5907                 dflt=4
5908                 rp="What is the size of an integer (in bytes)?"
5909                 . ./myread
5910                 intsize="$ans"
5911                 dflt=$intsize
5912                 rp="What is the size of a long integer (in bytes)?"
5913                 . ./myread
5914                 longsize="$ans"
5915                 dflt=2
5916                 rp="What is the size of a short integer (in bytes)?"
5917                 . ./myread
5918                 shortsize="$ans"
5919         fi
5920         ;;
5921 esac
5922 $rm_try
5923
5924 : check for long long
5925 echo " "
5926 echo "Checking to see if you have long long..." >&4
5927 echo 'int main() { long long x = 7; return 0; }' > try.c
5928 set try
5929 if eval $compile; then
5930         val="$define"
5931         echo "You have long long."
5932 else
5933         val="$undef"
5934         echo "You do not have long long."
5935 fi
5936 $rm_try
5937 set d_longlong
5938 eval $setvar
5939
5940 : check for length of long long
5941 case "${d_longlong}${longlongsize}" in
5942 $define)
5943         echo " "
5944         echo "Checking to see how big your long longs are..." >&4
5945         $cat >try.c <<'EOCP'
5946 #include <stdio.h>
5947 int main()
5948 {
5949     printf("%d\n", (int)sizeof(long long));
5950     return(0);
5951 }
5952 EOCP
5953         set try
5954         if eval $compile_ok; then
5955                 longlongsize=`$run ./try`
5956                 echo "Your long longs are $longlongsize bytes long."
5957         else
5958                 dflt='8'
5959                 echo " "
5960                 echo "(I can't seem to compile the test program.  Guessing...)"
5961                 rp="What is the size of a long long (in bytes)?"
5962                 . ./myread
5963                 longlongsize="$ans"
5964         fi
5965         if $test "X$longsize" = "X$longlongsize"; then
5966                 echo "(That isn't any different from an ordinary long.)"
5967         fi
5968         ;;
5969 esac
5970 $rm_try
5971
5972 : see if inttypes.h is available
5973 : we want a real compile instead of Inhdr because some systems
5974 : have an inttypes.h which includes non-existent headers
5975 echo " "
5976 $cat >try.c <<EOCP
5977 #include <inttypes.h>
5978 int main() {
5979         static int32_t foo32 = 0x12345678;
5980 }
5981 EOCP
5982 set try
5983 if eval $compile; then
5984         echo "<inttypes.h> found." >&4
5985         val="$define"
5986 else
5987         echo "<inttypes.h> NOT found." >&4
5988         val="$undef"
5989 fi
5990 $rm_try
5991 set i_inttypes
5992 eval $setvar
5993
5994 : check for int64_t
5995 echo " "
5996 echo "Checking to see if you have int64_t..." >&4
5997 $cat >try.c <<EOCP
5998 #include <sys/types.h>
5999 #$i_inttypes I_INTTYPES
6000 #ifdef I_INTTYPES
6001 #include <inttypes.h>
6002 #endif
6003 int main() { int64_t x = 7; }
6004 EOCP
6005 set try
6006 if eval $compile; then
6007         val="$define"
6008         echo "You have int64_t."
6009 else
6010         val="$undef"
6011         echo "You do not have int64_t."
6012 fi
6013 $rm_try
6014 set d_int64_t
6015 eval $setvar
6016
6017 : Check if 64bit ints have a quad type
6018 echo " "
6019 echo "Checking which 64-bit integer type we could use..." >&4
6020
6021 case "$intsize" in
6022 8) val=int
6023    set quadtype
6024    eval $setvar
6025    val='"unsigned int"'
6026    set uquadtype
6027    eval $setvar
6028    quadkind=1
6029    ;;
6030 *) case "$longsize" in
6031    8) val=long
6032       set quadtype
6033       eval $setvar
6034       val='"unsigned long"'
6035       set uquadtype
6036       eval $setvar
6037       quadkind=2
6038       ;;
6039    *) case "$d_longlong:$longlongsize" in
6040       define:8)
6041         val='"long long"'
6042         set quadtype
6043         eval $setvar
6044         val='"unsigned long long"'
6045         set uquadtype
6046         eval $setvar
6047         quadkind=3
6048         ;;
6049       *) case "$d_int64_t" in
6050          define)
6051            val=int64_t
6052            set quadtype
6053            eval $setvar
6054            val=uint64_t
6055            set uquadtype
6056            eval $setvar
6057            quadkind=4
6058            ;;
6059          esac
6060          ;;
6061       esac
6062       ;;
6063    esac
6064    ;;
6065 esac
6066
6067 case "$quadtype" in
6068 '')     echo "Alas, no 64-bit integer types in sight." >&4
6069         d_quad="$undef"
6070         ;;
6071 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6072         d_quad="$define"
6073         ;;
6074 esac
6075
6076 : Do we want 64bit support
6077 case "$uselonglong" in
6078 "$define"|true|[yY]*)
6079         cat <<EOM >&4
6080
6081 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6082 EOM
6083         use64bitint="$define"
6084         ;;
6085 esac
6086 case "$use64bits" in
6087 "$define"|true|[yY]*)
6088         cat <<EOM >&4
6089
6090 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6091 EOM
6092         use64bitint="$define"
6093         ;;
6094 esac
6095 case "$use64bitints" in
6096 "$define"|true|[yY]*)
6097         cat <<EOM >&4
6098
6099 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6100 EOM
6101         use64bitint="$define"
6102         ;;
6103 esac
6104 case "$use64bitsint" in
6105 "$define"|true|[yY]*)
6106         cat <<EOM >&4
6107
6108 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6109 EOM
6110         use64bitint="$define"
6111         ;;
6112 esac
6113 case "$uselonglongs" in
6114 "$define"|true|[yY]*)
6115         cat <<EOM >&4
6116
6117 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6118 EOM
6119         use64bitint="$define"
6120         ;;
6121 esac
6122 case "$use64bitsall" in
6123 "$define"|true|[yY]*)
6124         cat <<EOM >&4
6125
6126 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6127 EOM
6128         use64bitall="$define"
6129         ;;
6130 esac
6131
6132 case "$ccflags" in
6133 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6134 esac
6135 case "$use64bitall" in
6136 "$define"|true|[yY]*) use64bitint="$define" ;;
6137 esac
6138
6139 case "$longsize" in
6140 8) cat <<EOM
6141
6142 You have natively 64-bit long integers.
6143 EOM
6144    val="$define"
6145    ;;
6146 *) case "$use64bitint" in
6147    "$define"|true|[yY]*) dflt='y';;
6148    *) dflt='n';;
6149    esac
6150    case "$d_quad" in
6151    "$define") ;;
6152    *) dflt='n' ;;
6153    esac
6154    cat <<EOM
6155
6156 Perl can be built to take advantage of 64-bit integer types
6157 on some systems.  To do so, Configure can be run with -Duse64bitint.
6158 Choosing this option will most probably introduce binary incompatibilities.
6159
6160 If this doesn't make any sense to you, just accept the default '$dflt'.
6161 (The default has been chosen based on your configuration.)
6162 EOM
6163    rp='Try to use 64-bit integers, if available?'
6164    . ./myread
6165    case "$ans" in
6166    [yY]*) val="$define" ;;
6167    *)     val="$undef"  ;;
6168    esac
6169    ;;
6170 esac
6171 set use64bitint
6172 eval $setvar
6173
6174 case "$use64bitall" in
6175 "$define"|true|[yY]*) dflt='y' ;;
6176 *) case "$longsize" in
6177    8) dflt='y' ;;
6178    *) dflt='n' ;;
6179    esac
6180    ;;
6181 esac
6182 cat <<EOM
6183
6184 You may also choose to try maximal 64-bitness.  It means using as much
6185 64-bitness as possible on the platform.  This in turn means even more
6186 binary incompatibilities.  On the other hand, your platform may not
6187 have any more 64-bitness available than what you already have chosen.
6188
6189 If this doesn't make any sense to you, just accept the default '$dflt'.
6190 (The default has been chosen based on your configuration.)
6191 EOM
6192 rp='Try to use maximal 64-bit support, if available?'
6193 . ./myread
6194 case "$ans" in
6195 [yY]*) val="$define" ;;
6196 *)     val="$undef"  ;;
6197 esac
6198 set use64bitall
6199 eval $setvar
6200 case "$use64bitall" in
6201 "$define")
6202         case "$use64bitint" in
6203         "$undef")
6204                 cat <<EOM
6205
6206 Since you have chosen a maximally 64-bit build, I'm also turning on
6207 the use of 64-bit integers.
6208 EOM
6209                 use64bitint="$define" ;;
6210         esac
6211         ;;
6212 esac
6213
6214 : Look for a hint-file generated 'call-back-unit'.  If the
6215 : user has specified that a 64-bit perl is to be built,
6216 : we may need to set or change some other defaults.
6217 if $test -f use64bitint.cbu; then
6218         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6219         . ./use64bitint.cbu
6220 fi
6221 case "$use64bitint" in
6222 "$define"|true|[yY]*)
6223         : This test was common to all the OpenBSD forks, and seems harmless for
6224         : other platforms:
6225         echo " "
6226         echo "Checking if your C library has broken 64-bit functions..." >&4
6227         cat >try.c <<EOCP
6228 #include <stdio.h>
6229 typedef $uquadtype myULL;
6230 int main (void)
6231 {
6232     struct {
6233         double d;
6234         myULL  u;
6235     } *p, test[] = {
6236         {4294967303.15, 4294967303ULL},
6237         {4294967294.2,  4294967294ULL},
6238         {4294967295.7,  4294967295ULL},
6239         {0.0, 0ULL}
6240     };
6241     for (p = test; p->u; p++) {
6242         myULL x = (myULL)p->d;
6243         if (x != p->u) {
6244             printf("buggy\n");
6245             return 0;
6246         }
6247     }
6248     printf("ok\n");
6249     return 0;
6250 }
6251 EOCP
6252         set try
6253         if eval $compile_ok; then
6254             libcquad=`$run ./try`
6255             echo "Your C library's 64-bit functions are $libcquad."
6256         else
6257             echo "(I can't seem to compile the test program.)"
6258             echo "Assuming that your C library's 64-bit functions are ok."
6259             libcquad="ok"
6260         fi
6261         $rm_try
6262
6263         case "$libcquad" in
6264             buggy*)
6265                 cat >&4 <<EOM
6266
6267 *** You have a C library with broken 64-bit functions.
6268 *** 64-bit support does not work reliably in this configuration.
6269 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6270 *** Cannot continue, aborting.
6271
6272 EOM
6273                 exit 1
6274                 ;;
6275         esac
6276         case "$longsize" in
6277         4) case "$archname64" in
6278            '') archname64=64int ;;
6279            esac
6280            ;;
6281         esac
6282         ;;
6283 esac
6284
6285 : Look for a hint-file generated 'call-back-unit'.  If the
6286 : user has specified that a maximally 64-bit perl is to be built,
6287 : we may need to set or change some other defaults.
6288 if $test -f use64bitall.cbu; then
6289         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6290         . ./use64bitall.cbu
6291 fi
6292 case "$use64bitall" in
6293 "$define"|true|[yY]*)
6294         case "$longsize" in
6295         4) case "$archname64" in
6296            ''|64int) archname64=64all ;;
6297            esac
6298            ;;
6299         esac
6300         ;;
6301 esac
6302
6303 case "$d_quad:$use64bitint" in
6304 $undef:$define)
6305         cat >&4 <<EOF
6306
6307 *** You have chosen to use 64-bit integers,
6308 *** but none can be found.
6309 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6310 *** Cannot continue, aborting.
6311
6312 EOF
6313         exit 1
6314         ;;
6315 esac
6316
6317 : Check if we are using the GNU C library
6318 echo " "
6319 echo "Checking for GNU C Library..." >&4
6320 cat >try.c <<'EOCP'
6321 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6322    alone are insufficient to distinguish different versions, such as
6323    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6324    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6325 */
6326 #include <stdio.h>
6327 int main(void)
6328 {
6329 #ifdef __GLIBC__
6330 #   ifdef __GLIBC_MINOR__
6331 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6332 #           include <gnu/libc-version.h>
6333             printf("%s\n",  gnu_get_libc_version());
6334 #       else
6335             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6336 #       endif
6337 #   else
6338         printf("%d\n",  __GLIBC__);
6339 #   endif
6340     return 0;
6341 #else
6342     return 1;
6343 #endif
6344 }
6345 EOCP
6346 set try
6347 if eval $compile_ok && $run ./try > glibc.ver; then
6348         val="$define"
6349         gnulibc_version=`$cat glibc.ver`
6350         echo "You are using the GNU C Library version $gnulibc_version"
6351 else
6352         val="$undef"
6353         gnulibc_version=''
6354         echo "You are not using the GNU C Library"
6355 fi
6356 $rm_try glibc.ver
6357 set d_gnulibc
6358 eval $setvar
6359
6360 : see if nm is to be used to determine whether a symbol is defined or not
6361 case "$usenm" in
6362 '')
6363         dflt=''
6364         case "$d_gnulibc" in
6365         "$define")
6366                 echo " "
6367                 echo "nm probably won't work on the GNU C Library." >&4
6368                 dflt=n
6369                 ;;
6370         esac
6371         case "$dflt" in
6372         '')
6373                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6374                         echo " "
6375                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6376                         echo "'nm' won't be sufficient on this system." >&4
6377                         dflt=n
6378                 fi
6379                 ;;
6380         esac
6381         case "$dflt" in
6382         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6383                 if $test $dflt -gt 20; then
6384                         dflt=y
6385                 else
6386                         dflt=n
6387                 fi
6388                 ;;
6389         esac
6390         ;;
6391 *)
6392         case "$usenm" in
6393         true|$define) dflt=y;;
6394         *) dflt=n;;
6395         esac
6396         ;;
6397 esac
6398 $cat <<EOM
6399
6400 I can use $nm to extract the symbols from your C libraries. This
6401 is a time consuming task which may generate huge output on the disk (up
6402 to 3 megabytes) but that should make the symbols extraction faster. The
6403 alternative is to skip the 'nm' extraction part and to compile a small
6404 test program instead to determine whether each symbol is present. If
6405 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6406 this may be the best solution.
6407
6408 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6409
6410 EOM
6411 rp="Shall I use $nm to extract C symbols from the libraries?"
6412 . ./myread
6413 case "$ans" in
6414 [Nn]*) usenm=false;;
6415 *) usenm=true;;
6416 esac
6417
6418 runnm=$usenm
6419 case "$reuseval" in
6420 true) runnm=false;;
6421 esac
6422
6423 : nm options which may be necessary
6424 case "$nm_opt" in
6425 '') if $test -f /mach_boot; then
6426                 nm_opt=''       # Mach
6427         elif $test -d /usr/ccs/lib; then
6428                 nm_opt='-p'     # Solaris (and SunOS?)
6429         elif $test -f /dgux; then
6430                 nm_opt='-p'     # DG-UX
6431         elif $test -f /lib64/rld; then
6432                 nm_opt='-p'     # 64-bit Irix
6433         else
6434                 nm_opt=''
6435         fi;;
6436 esac
6437
6438 : nm options which may be necessary for shared libraries but illegal
6439 : for archive libraries.  Thank you, Linux.
6440 case "$nm_so_opt" in
6441 '')     case "$myuname" in
6442         *linux*|gnu*)
6443                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6444                         nm_so_opt='--dynamic'
6445                 fi
6446                 ;;
6447         esac
6448         ;;
6449 esac
6450
6451 : Figure out where the libc is located
6452 case "$runnm" in
6453 true)
6454 : get list of predefined functions in a handy place
6455 echo " "
6456 case "$libc" in
6457 '') libc=unknown
6458         case "$libs" in
6459         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6460         esac
6461         ;;
6462 esac
6463 case "$libs" in
6464 '') ;;
6465 *)  for thislib in $libs; do
6466         case "$thislib" in
6467         -lc|-lc_s)
6468                 : Handle C library specially below.
6469                 ;;
6470         -l*)
6471                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6472                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6473                         :
6474                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6475                         :
6476                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6477                         :
6478                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6479                         :
6480                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6481                         :
6482                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6483                         :
6484                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6485                         :
6486                 else
6487                         try=''
6488                 fi
6489                 libnames="$libnames $try"
6490                 ;;
6491         *) libnames="$libnames $thislib" ;;
6492         esac
6493         done
6494         ;;
6495 esac
6496 xxx=normal
6497 case "$libc" in
6498 unknown)
6499         set /lib/libc.$so
6500         for xxx in $libpth; do
6501                 $test -r $1 || set $xxx/libc.$so
6502                 : The messy sed command sorts on library version numbers.
6503                 $test -r $1 || \
6504                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6505                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6506                                 h
6507                                 s/[0-9][0-9]*/0000&/g
6508                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6509                                 G
6510                                 s/\n/ /' | \
6511                          $sort | $sed -e 's/^.* //'`
6512                 eval set \$$#
6513         done
6514         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6515         $test -r $1 || set $sysroot/lib/libsys_s$_a
6516         ;;
6517 *)
6518         set blurfl
6519         ;;
6520 esac
6521 if $test -r "$1"; then
6522         echo "Your (shared) C library seems to be in $1."
6523         libc="$1"
6524 elif $test -r /lib/libc && $test -r /lib/clib; then
6525         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6526         xxx=apollo
6527         libc='/lib/clib /lib/libc'
6528         if $test -r /lib/syslib; then
6529                 echo "(Your math library is in /lib/syslib.)"
6530                 libc="$libc /lib/syslib"
6531         fi
6532 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6533         echo "Your C library seems to be in $libc, as you said before."
6534 elif $test -r $incpath/usr/lib/libc$_a; then
6535         libc=$incpath/usr/lib/libc$_a;
6536         echo "Your C library seems to be in $libc.  That's fine."
6537 elif $test -r /lib/libc$_a; then
6538         libc=/lib/libc$_a;
6539         echo "Your C library seems to be in $libc.  You're normal."
6540 else
6541         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6542                 :
6543         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6544                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6545         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6546                 :
6547         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6548                 :
6549         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6550                 :
6551         else
6552                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6553         fi
6554         if $test -r "$tans"; then
6555                 echo "Your C library seems to be in $tans, of all places."
6556                 libc=$tans
6557         else
6558                 libc='blurfl'
6559         fi
6560 fi
6561 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6562         dflt="$libc"
6563         cat <<EOM
6564
6565 If the guess above is wrong (which it might be if you're using a strange
6566 compiler, or your machine supports multiple models), you can override it here.
6567
6568 EOM
6569 else
6570         dflt=''
6571         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6572         cat >&4 <<EOM
6573 I can't seem to find your C library.  I've looked in the following places:
6574
6575 EOM
6576         $sed 's/^/      /' libpath
6577         cat <<EOM
6578
6579 None of these seems to contain your C library. I need to get its name...
6580
6581 EOM
6582 fi
6583 fn=f
6584 rp='Where is your C library?'
6585 . ./getfile
6586 libc="$ans"
6587
6588 echo " "
6589 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6590 set X `cat libnames`
6591 shift
6592 xxx=files
6593 case $# in 1) xxx=file; esac
6594 echo "Extracting names from the following $xxx for later perusal:" >&4
6595 echo " "
6596 $sed 's/^/      /' libnames >&4
6597 echo " "
6598 $echo $n "This may take a while...$c" >&4
6599
6600 for file in $*; do
6601         case $file in
6602         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6603         *) $nm $nm_opt $file 2>/dev/null;;
6604         esac
6605 done >libc.tmp
6606
6607 $echo $n ".$c"
6608 $grep fprintf libc.tmp > libc.ptf
6609 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6610 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6611 xxx='[ADTSIWi]'
6612 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6613         eval $xscan;\
6614         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6615                 eval $xrun
6616 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6617         eval $xscan;\
6618         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6619                 eval $xrun
6620 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6621         eval $xscan;\
6622         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6623                 eval $xrun
6624 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6625         eval $xscan;\
6626         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6627                 eval $xrun
6628 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6629         eval $xscan;\
6630         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6631                 eval $xrun
6632 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6633         eval $xscan;\
6634         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6635                 eval $xrun
6636 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6637                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6638         eval $xscan;\
6639         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6640                 eval $xrun
6641 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6642         eval $xscan;\
6643         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6644                 eval $xrun
6645 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6646         eval $xscan;\
6647         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6648                 eval $xrun
6649 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6650         eval $xscan;\
6651         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6652                 eval $xrun
6653 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6654         eval $xscan;\
6655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6656                 eval $xrun
6657 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6658         eval $xscan;\
6659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6660                 eval $xrun
6661 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6662         eval $xscan;\
6663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6664                 eval $xrun
6665 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6666         eval $xscan;\
6667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6668                 eval $xrun
6669 else
6670         $nm -p $* 2>/dev/null >libc.tmp
6671         $grep fprintf libc.tmp > libc.ptf
6672         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6673                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6674         then
6675                 nm_opt='-p'
6676                 eval $xrun
6677         else
6678                 echo " "
6679                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6680                 com=''
6681                 if $ar t $libc > libc.tmp && \
6682                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6683                 then
6684                         for thisname in $libnames $libc; do
6685                                 $ar t $thisname >>libc.tmp
6686                         done
6687                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6688                         echo "Ok." >&4
6689                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6690                         for thisname in $libnames $libc; do
6691                                 $ar tv $thisname >>libc.tmp
6692                                 emximp -o tmp.imp $thisname \
6693                                     2>/dev/null && \
6694                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6695                                     < tmp.imp >>libc.tmp
6696                                 $rm -f tmp.imp
6697                         done
6698                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6699                         echo "Ok." >&4
6700                 else
6701                         echo "$ar didn't seem to work right." >&4
6702                         echo "Maybe this is a Cray...trying bld instead..." >&4
6703                         if  bld t $libc | \
6704                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6705                                 $test -s libc.list
6706                         then
6707                                 for thisname in $libnames; do
6708                                         bld t $libnames | \
6709                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6710                                         $ar t $thisname >>libc.tmp
6711                                 done
6712                                 echo "Ok." >&4
6713                         else
6714                                 echo "That didn't work either.  Giving up." >&4
6715                                 exit 1
6716                         fi
6717                 fi
6718         fi
6719 fi
6720 nm_extract="$com"
6721 case "$PASE" in
6722 define)
6723     echo " "
6724     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6725     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6726     ;;
6727 *)  if $test -f /lib/syscalls.exp; then
6728         echo " "
6729         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6730         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6731                 /lib/syscalls.exp >>libc.list
6732     fi
6733     ;;
6734 esac
6735 ;;
6736 esac
6737 $rm -f libnames libpath
6738
6739 : Check if we are using C++
6740 echo " "
6741 echo "Checking for C++..." >&4
6742 $cat >try.c <<'EOCP'
6743 #include <stdio.h>
6744 int main(void)
6745 {
6746 #ifdef __cplusplus
6747     return 0;
6748 #else
6749     return 1;
6750 #endif
6751 }
6752 EOCP
6753 set try
6754 if eval $compile_ok && $run ./try; then
6755         val="$define"
6756         echo "You are using a C++ compiler."
6757 else
6758         val="$undef"
6759         echo "You are not using a C++ compiler."
6760 fi
6761 $rm_try cplusplus$$
6762 set d_cplusplus
6763 eval $setvar
6764
6765 : is a C symbol defined?
6766 csym='tlook=$1;
6767 case "$3" in
6768 -v) tf=libc.tmp; tdc="";;
6769 -a) tf=libc.tmp; tdc="[]";;
6770 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6771 esac;
6772 case "$d_cplusplus" in
6773     $define)    extern_C="extern \"C\"" ;;
6774     *)          extern_C="extern"       ;;
6775 esac;
6776 tx=yes;
6777 case "$reuseval-$4" in
6778 true-) ;;
6779 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6780 esac;
6781 case "$tx" in
6782 yes)
6783         tval=false;
6784         if $test "$runnm" = true; then
6785                 if $contains $tlook $tf >/dev/null 2>&1; then
6786                         tval=true;
6787                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6788                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6789                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6790                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6791                         $rm_try;
6792                 fi;
6793         else
6794                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6795                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6796                 $rm_try;
6797         fi;
6798         ;;
6799 *)
6800         case "$tval" in
6801         $define) tval=true;;
6802         *) tval=false;;
6803         esac;
6804         ;;
6805 esac;
6806 eval "$2=$tval"'
6807
6808 : define an is-in-libc? function
6809 inlibc='echo " "; td=$define; tu=$undef;
6810 sym=$1; var=$2; eval "was=\$$2";
6811 tx=yes;
6812 case "$reuseval$was" in
6813 true) ;;
6814 true*) tx=no;;
6815 esac;
6816 case "$tx" in
6817 yes)
6818         set $sym tres -f;
6819         eval $csym;
6820         case "$tres" in
6821         true)
6822                 echo "$sym() found." >&4;
6823                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6824         *)
6825                 echo "$sym() NOT found." >&4;
6826                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6827         esac;;
6828 *)
6829         case "$was" in
6830         $define) echo "$sym() found." >&4;;
6831         *) echo "$sym() NOT found." >&4;;
6832         esac;;
6833 esac'
6834
6835 : check for length of double
6836 echo " "
6837 case "$doublesize" in
6838 '')
6839         echo "Checking to see how big your double precision numbers are..." >&4
6840         $cat >try.c <<EOCP
6841 #include <stdio.h>
6842 #$i_stdlib I_STDLIB
6843 #ifdef I_STDLIB
6844 #include <stdlib.h>
6845 #endif
6846 int main()
6847 {
6848     printf("%d\n", (int)sizeof(double));
6849     exit(0);
6850 }
6851 EOCP
6852         set try
6853         if eval $compile_ok; then
6854                 doublesize=`$run ./try`
6855                 echo "Your double is $doublesize bytes long."
6856         else
6857                 dflt='8'
6858                 echo "(I can't seem to compile the test program.  Guessing...)"
6859                 rp="What is the size of a double precision number (in bytes)?"
6860                 . ./myread
6861                 doublesize="$ans"
6862         fi
6863         ;;
6864 esac
6865 $rm_try
6866
6867 : see if this is a float.h system
6868 set float.h i_float
6869 eval $inhdr
6870
6871 : check for long doubles
6872 echo " "
6873 echo "Checking to see if you have long double..." >&4
6874 echo 'int main() { long double x = 7.0; }' > try.c
6875 set try
6876 if eval $compile; then
6877         val="$define"
6878         echo "You have long double."
6879 else
6880         val="$undef"
6881         echo "You do not have long double."
6882 fi
6883 $rm_try
6884 set d_longdbl
6885 eval $setvar
6886
6887 : see if ldexpl exists
6888 set ldexpl d_ldexpl
6889 eval $inlibc
6890
6891 : check for length of long double
6892 case "${d_longdbl}${longdblsize}" in
6893 $define)
6894         echo " "
6895         echo "Checking to see how big your long doubles are..." >&4
6896         $cat >try.c <<'EOCP'
6897 #include <stdio.h>
6898 int main()
6899 {
6900         printf("%d\n", sizeof(long double));
6901 }
6902 EOCP
6903         set try
6904         set try
6905         if eval $compile; then
6906                 longdblsize=`$run ./try`
6907                 echo "Your long doubles are $longdblsize bytes long."
6908         else
6909                 dflt='8'
6910                 echo " "
6911                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6912                 rp="What is the size of a long double (in bytes)?"
6913                 . ./myread
6914                 longdblsize="$ans"
6915         fi
6916         if $test "X$doublesize" = "X$longdblsize"; then
6917                 echo "That isn't any different from an ordinary double."
6918                 echo "I'll keep your setting anyway, but you may see some"
6919                 echo "harmless compilation warnings."
6920         fi
6921         ;;
6922 esac
6923 $rm_try
6924
6925 $echo "Checking the kind of long doubles you have..." >&4
6926 case "$d_longdbl" in
6927 define)
6928 $cat <<EOP >try.c
6929 #$i_float I_FLOAT
6930 #$i_stdlib I_STDLIB
6931 #define LONGDBLSIZE $longdblsize
6932 #define DOUBLESIZE $doublesize
6933 #ifdef I_FLOAT
6934 #include <float.h>
6935 #endif
6936 #ifdef I_STDLIB
6937 #include <stdlib.h>
6938 #endif
6939 #include <stdio.h>
6940 static const long double d = -0.1L;
6941 int main() {
6942   unsigned const char* b = (unsigned const char*)(&d);
6943 #if DOUBLESIZE == LONGDBLSIZE
6944   printf("0\n"); /* if it floats like double */
6945   exit(0);
6946 #endif
6947 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6948   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6949     /* IEEE 754 128-bit little-endian */
6950     printf("1\n");
6951     exit(0);
6952   }
6953   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6954     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6955     printf("2\n");
6956     exit(0);
6957   }
6958 #endif
6959 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6960  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6961  * cannot be trusted. */
6962 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6963   if (b[0] == 0xCD && b[9] == 0xBF) {
6964     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6965      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6966      * Also known as "extended precision". */
6967     printf("3\n");
6968     exit(0);
6969   }
6970   if (b[0] == 0xBF && b[9] == 0xCD) {
6971     /* Is there ever big-endian 80-bit, really?
6972      *
6973      * The Motorola 68881 had another "extended precision" format:
6974      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6975      * for total of 96 bits of bytes.  The zero bits were unused.
6976      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
6977      * If it ever becomes relevant, this format should be allocated
6978      * a new doublekind code since it's quite different from the Intel x87.
6979      */
6980     printf("4\n");
6981     exit(0);
6982   }
6983 #endif
6984 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6985   /* software "double double", the 106 is 53+53.
6986    * but irix thinks it is 107. */
6987   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6988     /* double double 128-bit fully little-endian,
6989      * little-endian doubles in little-endian order,
6990      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6991     printf("5\n");
6992     exit(0);
6993   }
6994   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
6995     /* double double 128-bit fully big-endian,
6996      * big-endian doubles in big-endian order,
6997      * e.g. PPC/Power and MIPS:
6998      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
6999     printf("6\n");
7000     exit(0);
7001   }
7002   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7003     /* double double 128-bit mixed endian.
7004      * little-endian doubles in big-endian order,
7005      * e.g. ppc64el,
7006      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7007     printf("7\n");
7008     exit(0);
7009   }
7010   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7011     /* double double 128-bit mixed endian,
7012      * big-endian doubles in little-endian order,
7013      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7014     printf("8\n");
7015     exit(0);
7016   }
7017 #endif
7018   printf("-1\n"); /* unknown */
7019   exit(0);
7020 }
7021 EOP
7022 set try
7023 if eval $compile; then
7024     longdblkind=`$run ./try`
7025 else
7026     longdblkind=-1
7027 fi
7028 ;;
7029 *) longdblkind=0 ;;
7030 esac
7031 case "$longdblkind" in
7032 0) echo "Your long doubles are doubles." >&4 ;;
7033 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7034 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7035 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7036 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7037 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7038 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7039 7) echo "You have 128-bit mixed double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7040 8) echo "You have 128-bit mixed double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7041 *) echo "Cannot figure out your long double." >&4 ;;
7042 esac
7043 $rm_try
7044
7045 : determine the architecture name
7046 echo " "
7047 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7048         tarch=`arch`"-$osname"
7049 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7050         if uname -m > tmparch 2>&1 ; then
7051                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7052                         -e 's/$/'"-$osname/" tmparch`
7053         else
7054                 tarch="$osname"
7055         fi
7056         $rm -f tmparch
7057 else
7058         tarch="$osname"
7059 fi
7060 case "$myarchname" in
7061 ''|"$tarch") ;;
7062 *)
7063         echo "(Your architecture name used to be $myarchname.)"
7064         archname=''
7065         ;;
7066 esac
7067 case "$targetarch" in
7068 '') ;;
7069 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7070 esac
7071 myarchname="$tarch"
7072 case "$archname" in
7073 '') dflt="$tarch";;
7074 *) dflt="$archname";;
7075 esac
7076 rp='What is your architecture name'
7077 . ./myread
7078 archname="$ans"
7079
7080 : optionally add API version to the architecture for versioned archlibs
7081 case "$useversionedarchname" in
7082 $define|true|[yY]*) dflt='y';;
7083 *)                  dflt='n';;
7084 esac
7085 rp='Add the Perl API version to your archname?'
7086 . ./myread
7087 case "$ans" in
7088 y|Y)    useversionedarchname="$define" ;;
7089 *)      useversionedarchname="$undef" ;;
7090 esac
7091 case "$useversionedarchname" in
7092 $define)
7093         case "$archname" in
7094         *-$api_versionstring)
7095                 echo "...and architecture name already has -$api_versionstring" >&4
7096                 ;;
7097         *)
7098                 archname="$archname-$api_versionstring"
7099                 echo "...setting architecture name to $archname." >&4
7100                 ;;
7101         esac
7102         ;;
7103 esac
7104
7105 case "$usethreads" in
7106 $define)
7107         echo "Threads selected." >&4
7108         case "$archname" in
7109         *-thread*) echo "...and architecture name already has -thread." >&4
7110                 ;;
7111         *)      archname="$archname-thread"
7112                 echo "...setting architecture name to $archname." >&4
7113                 ;;
7114         esac
7115         ;;
7116 esac
7117 case "$usemultiplicity" in
7118 $define)
7119         echo "Multiplicity selected." >&4
7120         case "$archname" in
7121         *-multi*) echo "...and architecture name already has -multi." >&4
7122                 ;;
7123         *)      archname="$archname-multi"
7124                 echo "...setting architecture name to $archname." >&4
7125                 ;;
7126         esac
7127         ;;
7128 esac
7129 case "$use64bitint$use64bitall" in
7130 *"$define"*)
7131         case "$archname64" in
7132         '')
7133                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7134                 ;;
7135         *)
7136                 case "$use64bitint" in
7137                 "$define") echo "64 bit integers selected." >&4 ;;
7138                 esac
7139                 case "$use64bitall" in
7140                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7141                 esac
7142                 case "$archname" in
7143                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7144                         ;;
7145                 *)      archname="$archname-$archname64"
7146                         echo "...setting architecture name to $archname." >&4
7147                         ;;
7148                 esac
7149                 ;;
7150         esac
7151 esac
7152 case "$uselongdouble" in
7153 $define)
7154         echo "Long doubles selected." >&4
7155         case "$longdblsize" in
7156         $doublesize)
7157                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7158                 ;;
7159         *)
7160                 case "$archname" in
7161                 *-ld*) echo "...and architecture name already has -ld." >&4
7162                         ;;
7163                 *)      archname="$archname-ld"
7164                         echo "...setting architecture name to $archname." >&4
7165                         ;;
7166                 esac
7167                 ;;
7168         esac
7169         ;;
7170 esac
7171 case "$usequadmath" in
7172 $define)
7173         echo "quadmath selected." >&4
7174         case "$archname" in
7175         *-ld*) echo "...and architecture name already has -quadmath." >&4
7176                 ;;
7177         *)      archname="$archname-quadmath"
7178                 echo "...setting architecture name to $archname." >&4
7179                 ;;
7180         esac
7181         ;;
7182 esac
7183 if $test -f archname.cbu; then
7184         echo "Your platform has some specific hints for architecture name, using them..."
7185         . ./archname.cbu
7186 fi
7187
7188 : set the prefixit variable, to compute a suitable default value
7189 prefixit='case "$3" in
7190 ""|none)
7191         case "$oldprefix" in
7192         "") eval "$1=\"\$$2\"";;
7193         *)
7194                 case "$3" in
7195                 "") eval "$1=";;
7196                 none)
7197                         eval "tp=\"\$$2\"";
7198                         case "$tp" in
7199                         ""|" ") eval "$1=\"\$$2\"";;
7200                         *) eval "$1=";;
7201                         esac;;
7202                 esac;;
7203         esac;;
7204 *)
7205         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7206         case "$tp" in
7207         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7208         /*-$oldprefix/*|\~*-$oldprefix/*)
7209                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7210         *) eval "$1=\"\$$2\"";;
7211         esac;;
7212 esac'
7213
7214 : determine installation style
7215 : For now, try to deduce it from prefix unless it is already set.
7216 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7217 case "$installstyle" in
7218 '')     case "$prefix" in
7219                 *perl*) dflt='lib';;
7220                 *) dflt='lib/perl5' ;;
7221         esac
7222         ;;
7223 *)      dflt="$installstyle" ;;
7224 esac
7225 : Probably not worth prompting for this since we prompt for all
7226 : the directories individually, and the prompt would be too long and
7227 : confusing anyway.
7228 installstyle=$dflt
7229
7230 : determine where public executables go
7231 echo " "
7232 set dflt bin bin
7233 eval $prefixit
7234 fn=d~
7235 rp='Pathname where the public executables will reside?'
7236 . ./getfile
7237 if $test "X$ansexp" != "X$binexp"; then
7238         installbin=''
7239 fi
7240 prefixvar=bin
7241 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7242 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7243 :     this via initialinstalllocation
7244 . ./setprefixvar
7245
7246 case "$userelocatableinc" in
7247 $define|true|[yY]*)     dflt='y' ;;
7248 *)                      dflt='n' ;;
7249 esac
7250 cat <<EOM
7251
7252 Would you like to build Perl so that the installation is relocatable, so that
7253 library paths in @INC are determined relative to the path of the perl binary?
7254 This is not advised for system Perl installs, or if you need to run setid
7255 scripts or scripts under taint mode.
7256
7257 If this doesn't make any sense to you, just accept the default '$dflt'.
7258 EOM
7259 rp='Use relocatable @INC?'
7260 . ./myread
7261 case "$ans" in
7262 y|Y)    val="$define" ;;
7263 *)      val="$undef"  ;;
7264 esac
7265 set userelocatableinc
7266 eval $setvar
7267
7268 initialinstalllocation="$binexp"
7269 : Default prefix is now "up one level from where the binaries are"
7270 case "$userelocatableinc" in
7271 $define|true|[yY]*)
7272     bin=".../"
7273     binexp=".../"
7274     prefix=".../.."
7275     prefixexp=".../.."
7276     installprefixexp=".../.."
7277     ;;
7278 esac
7279
7280 : determine where private library files go
7281 : Usual default is /usr/local/lib/perl5/$version.
7282 : Also allow things like /opt/perl/lib/$version, since
7283 : /opt/perl/lib/perl5... would be redundant.
7284 : The default "style" setting is made in installstyle.U
7285 case "$installstyle" in
7286 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7287 *)       set dflt privlib lib/$version ;;
7288 esac
7289 eval $prefixit
7290 $cat <<EOM
7291
7292 There are some auxiliary files for $package that need to be put into a
7293 private library directory that is accessible by everyone.
7294
7295 EOM
7296 fn=$binexp
7297 fn=d~+
7298 rp='Pathname where the private library files will reside?'
7299 . ./getfile
7300 prefixvar=privlib
7301 . ./setprefixvar
7302
7303 : set the prefixup variable, to restore leading tilda escape
7304 prefixup='case "$prefixexp" in
7305 "$prefix") ;;
7306 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7307 esac'
7308
7309 : determine where public architecture dependent libraries go
7310 set archlib archlib
7311 eval $prefixit
7312 : privlib default is /usr/local/lib/$package/$version
7313 : archlib default is /usr/local/lib/$package/$version/$archname
7314 : privlib may have an optional trailing /share.
7315 tdflt=`echo $privlib | $sed 's,/share$,,'`
7316 tdflt=$tdflt/$archname
7317 case "$archlib" in
7318 '')     dflt=$tdflt
7319         ;;
7320 *)      dflt="$archlib"
7321     ;;
7322 esac
7323 $cat <<EOM
7324
7325 $spackage contains architecture-dependent library files.  If you are
7326 sharing libraries in a heterogeneous environment, you might store
7327 these files in a separate location.  Otherwise, you can just include
7328 them with the rest of the public library files.
7329
7330 EOM
7331 fn=$binexp
7332 fn=d+~
7333 rp='Where do you want to put the public architecture-dependent libraries?'
7334 . ./getfile
7335 prefixvar=archlib
7336 . ./setprefixvar
7337 if $test X"$archlib" = X"$privlib"; then
7338         d_archlib="$undef"
7339 else
7340         d_archlib="$define"
7341 fi
7342
7343 : see if setuid scripts can be secure
7344 $cat <<EOM
7345
7346 Some kernels have a bug that prevents setuid #! scripts from being
7347 secure.  Some sites have disabled setuid #! scripts because of this.
7348
7349 First let's decide if your kernel supports secure setuid #! scripts.
7350 (If setuid #! scripts would be secure but have been disabled anyway,
7351 don't say that they are secure if asked.)
7352
7353 EOM
7354
7355 val="$undef"
7356 if $test -d /dev/fd; then
7357         echo "#!$ls" >reflect
7358         chmod +x,u+s reflect
7359         ./reflect >flect 2>&1
7360         if $contains "/dev/fd" flect >/dev/null; then
7361                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7362                 val="$define"
7363         else
7364                 $cat <<EOM
7365 If you are not sure if they are secure, I can check but I'll need a
7366 username and password different from the one you are using right now.
7367 If you don't have such a username or don't want me to test, simply
7368 enter 'none'.
7369
7370 EOM
7371                 rp='Other username to test security of setuid scripts with?'
7372                 dflt='none'
7373                 . ./myread
7374                 case "$ans" in
7375                 n|none)
7376                         case "$d_suidsafe" in
7377                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7378                                 dflt=n;;
7379                         "$undef")
7380                                 echo "Well, the $hint value is *not* secure." >&4
7381                                 dflt=n;;
7382                         *)      echo "Well, the $hint value *is* secure." >&4
7383                                 dflt=y;;
7384                         esac
7385                         ;;
7386                 *)
7387                         $rm -f reflect flect
7388                         echo "#!$ls" >reflect
7389                         chmod +x,u+s reflect
7390                         echo >flect
7391                         chmod a+w flect
7392                         echo '"su" will (probably) prompt you for '"$ans's password."
7393                         su $ans -c './reflect >flect'
7394                         if $contains "/dev/fd" flect >/dev/null; then
7395                                 echo "Okay, it looks like setuid scripts are secure." >&4
7396                                 dflt=y
7397                         else
7398                                 echo "I don't think setuid scripts are secure." >&4
7399                                 dflt=n
7400                         fi
7401                         ;;
7402                 esac
7403                 rp='Does your kernel have *secure* setuid scripts?'
7404                 . ./myread
7405                 case "$ans" in
7406                 [yY]*)  val="$define";;
7407                 *)      val="$undef";;
7408                 esac
7409         fi
7410 else
7411         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7412         echo "(That's for file descriptors, not floppy disks.)"
7413         val="$undef"
7414 fi
7415 set d_suidsafe
7416 eval $setvar
7417
7418 $rm -f reflect flect
7419
7420 : now see if they want to do setuid emulation
7421 if $test $patchlevel -lt 11; then
7422 echo " "
7423 val="$undef"
7424 case "$d_suidsafe" in
7425 "$define")
7426         val="$undef"
7427         echo "No need to emulate SUID scripts since they are secure here." >&4
7428         ;;
7429 *)
7430         $cat <<EOM
7431 Some systems have disabled setuid scripts, especially systems where
7432 setuid scripts cannot be secure.  On systems where setuid scripts have
7433 been disabled, the setuid/setgid bits on scripts are currently
7434 useless.  It is possible for $package to detect those bits and emulate
7435 setuid/setgid in a secure fashion.  This emulation will only work if
7436 setuid scripts have been disabled in your kernel.
7437
7438 EOM
7439         case "$d_dosuid" in
7440         "$define") dflt=y ;;
7441         *) dflt=n ;;
7442         esac
7443         rp="Do you want to do setuid/setgid emulation?"
7444         . ./myread
7445         case "$ans" in
7446         [yY]*)  val="$define";;
7447         *)      val="$undef";;
7448         esac
7449         ;;
7450 esac
7451 set d_dosuid
7452 eval $setvar
7453 else
7454     case "$d_dosuid" in
7455         "$define")
7456         cat >&4 <<EOH
7457
7458 SUID emulation has been removed for 5.12
7459 Please re-run Configure without -Dd_dosuid
7460
7461 EOH
7462         exit 1;
7463         ;;
7464     esac
7465     d_dosuid=undef
7466 fi
7467
7468 : Find perl5.005 or later.
7469 echo "Looking for a previously installed perl5.005 or later... "
7470 case "$perl5" in
7471 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7472                 : Check if this perl is recent and can load a simple module
7473                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7474                         perl5=$tdir/perl
7475                         break;
7476                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7477                         perl5=$tdir/perl5
7478                         break;
7479                 fi
7480         done
7481         ;;
7482 *)      perl5="$perl5"
7483         ;;
7484 esac
7485 case "$perl5" in
7486 '')     echo "None found.  That's ok.";;
7487 *)      echo "Using $perl5." ;;
7488 esac
7489
7490 : Set the siteprefix variables
7491 $cat <<EOM
7492
7493 After $package is installed, you may wish to install various
7494 add-on modules and utilities.  Typically, these add-ons will
7495 be installed under $prefix with the rest
7496 of this package.  However, you may wish to install such add-ons
7497 elsewhere under a different prefix.
7498
7499 If you do not wish to put everything under a single prefix, that's
7500 ok.  You will be prompted for the individual locations; this siteprefix
7501 is only used to suggest the defaults.
7502
7503 The default should be fine for most people.
7504
7505 EOM
7506 fn=d~+
7507 rp='Installation prefix to use for add-on modules and utilities?'
7508 : XXX Here might be another good place for an installstyle setting.
7509 case "$siteprefix" in
7510 '') dflt=$prefix ;;
7511 *)  dflt=$siteprefix ;;
7512 esac
7513 . ./getfile
7514 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7515 oldsiteprefix=''
7516 case "$siteprefix" in
7517 '') ;;
7518 *)      case "$ans" in
7519         "$prefix") ;;
7520         *) oldsiteprefix="$prefix";;
7521         esac
7522         ;;
7523 esac
7524 siteprefix="$ans"
7525 siteprefixexp="$ansexp"
7526
7527 : determine where site specific libraries go.
7528 : Usual default is /usr/local/lib/perl5/site_perl/$version
7529 : The default "style" setting is made in installstyle.U
7530 : XXX No longer works with Prefixit stuff.
7531 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7532 case "$sitelib" in
7533 '') case "$installstyle" in
7534         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7535         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7536         esac
7537         ;;
7538 *)      dflt="$sitelib"
7539         ;;
7540 esac
7541 $cat <<EOM
7542
7543 The installation process will create a directory for
7544 site-specific extensions and modules.  Most users find it convenient
7545 to place all site-specific files in this directory rather than in the
7546 main distribution directory.
7547
7548 EOM
7549 fn=d~+
7550 rp='Pathname for the site-specific library files?'
7551 . ./getfile
7552 prefixvar=sitelib
7553 . ./setprefixvar
7554 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7555
7556 : Determine list of previous versions to include in @INC
7557 $cat > getverlist <<EOPL
7558 #!$perl5 -w
7559 use File::Basename;
7560 \$api_versionstring = "$api_versionstring";
7561 \$version = "$version";
7562 \$stem = "$sitelib_stem";
7563 \$archname = "$archname";
7564 EOPL
7565         $cat >> getverlist <<'EOPL'
7566 # The list found is store twice for each entry: the original name, and
7567 # the binary broken down version as pack "sss", so sorting is easy and
7568 # unambiguous. This will work for all versions that have a maximum of
7569 # three digit groups, separate by '.'s or '_'s. Names are extended with
7570 # ".0.0" to ensure at least three elements for the pack.
7571 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7572
7573 # Can't have leading @ because metaconfig interprets it as a command!
7574 ;@inc_version_list=();
7575 # XXX Redo to do opendir/readdir?
7576 if (-d $stem) {
7577     chdir($stem);
7578     ;@candidates = map {
7579         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7580     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7581 }
7582 else {
7583     ;@candidates = ();
7584 }
7585
7586 ($pversion, $aversion, $vsn5005) = map {
7587     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7588 foreach $d (@candidates) {
7589     if ($d->[1] lt $pversion) {
7590         if ($d->[1] ge $aversion) {
7591             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7592         }
7593         elsif ($d->[1] ge $vsn5005) {
7594             unshift(@inc_version_list, grep { -d } $d->[0]);
7595         }
7596     }
7597     else {
7598         # Skip newer version.  I.e. don't look in
7599         # 5.7.0 if we're installing 5.6.1.
7600     }
7601 }
7602
7603 if (@inc_version_list) {
7604     print join(' ', @inc_version_list);
7605 }
7606 else {
7607     # Blank space to preserve value for next Configure run.
7608     print " ";
7609 }
7610 EOPL
7611 chmod +x getverlist
7612 case "$inc_version_list" in
7613 '')     if test -x "$perl5$exe_ext"; then
7614                 dflt=`$perl5 getverlist`
7615         else
7616                 dflt='none'
7617         fi
7618         ;;
7619 $undef) dflt='none' ;;
7620 *)  eval dflt=\"$inc_version_list\" ;;
7621 esac
7622 case "$dflt" in
7623 ''|' ') dflt=none ;;
7624 esac
7625 case "$dflt" in
7626 5.005) dflt=none ;;
7627 esac
7628 $cat <<EOM
7629
7630 In order to ease the process of upgrading, this version of perl
7631 can be configured to use modules built and installed with earlier
7632 versions of perl that were installed under $prefix.  Specify here
7633 the list of earlier versions that this version of perl should check.
7634 If Configure detected no earlier versions of perl installed under
7635 $prefix, then the list will be empty.  Answer 'none' to tell perl
7636 to not search earlier versions.
7637
7638 The default should almost always be sensible, so if you're not sure,
7639 just accept the default.
7640 EOM
7641
7642 rp='List of earlier versions to include in @INC?'
7643 . ./myread
7644 case "$ans" in
7645 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7646 *) inc_version_list="$ans" ;;
7647 esac
7648 case "$inc_version_list" in
7649 ''|' ')
7650         inc_version_list_init='0'
7651         d_inc_version_list="$undef"
7652         ;;
7653 *)      inc_version_list_init=`echo $inc_version_list |
7654                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7655         d_inc_version_list="$define"
7656         ;;
7657 esac
7658 $rm -f getverlist
7659
7660 : see if malloc/malloc.h has to be included
7661 set malloc/malloc.h i_mallocmalloc
7662 eval $inhdr
7663
7664 : see if this is a malloc.h system
7665 : we want a real compile instead of Inhdr because some systems have a
7666 : malloc.h that just gives a compile error saying to use stdlib.h instead
7667 echo " "
7668 $cat >try.c <<EOCP
7669 #include <stdlib.h>
7670 #include <malloc.h>
7671 #$i_mallocmalloc I_MALLOCMALLOC
7672 #ifdef I_MALLOCMALLOC
7673 # include <malloc/malloc.h>
7674 #endif
7675
7676 int main () { return 0; }
7677 EOCP
7678 set try
7679 if eval $compile; then
7680     echo "<malloc.h> found." >&4
7681     val="$define"
7682 else
7683     echo "<malloc.h> NOT found." >&4
7684     val="$undef"
7685 fi
7686 $rm_try
7687 set i_malloc
7688 eval $setvar
7689
7690 : check for length of pointer
7691 echo " "
7692 case "$ptrsize" in
7693 '')
7694         echo "Checking to see how big your pointers are..." >&4
7695         $cat >try.c <<EOCP
7696 #include <stdio.h>
7697 #$i_stdlib I_STDLIB
7698 #ifdef I_STDLIB
7699 #include <stdlib.h>
7700 #endif
7701 int main()
7702 {
7703     printf("%d\n", (int)sizeof(void *));
7704     exit(0);
7705 }
7706 EOCP
7707         set try
7708         if eval $compile_ok; then
7709                 ptrsize=`$run ./try`
7710                 echo "Your pointers are $ptrsize bytes long."
7711         else
7712                 dflt='4'
7713                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7714                 rp="What is the size of a pointer (in bytes)?"
7715                 . ./myread
7716                 ptrsize="$ans"
7717         fi
7718         ;;
7719 esac
7720 $rm_try
7721 case "$use64bitall" in
7722 "$define"|true|[yY]*)
7723         case "$ptrsize" in
7724         4)      cat <<EOM >&4
7725
7726 *** You have chosen a maximally 64-bit build,
7727 *** but your pointers are only 4 bytes wide.
7728 *** Please rerun Configure without -Duse64bitall.
7729 EOM
7730                 case "$d_quad" in
7731                 define)
7732                         cat <<EOM >&4
7733 *** Since you have quads, you could possibly try with -Duse64bitint.
7734 EOM
7735                         ;;
7736                 esac
7737                 cat <<EOM >&4
7738 *** Cannot continue, aborting.
7739
7740 EOM
7741
7742                 exit 1
7743                 ;;
7744         esac
7745         ;;
7746 esac
7747
7748
7749 : determine whether to use malloc wrapping
7750 echo " "
7751 case "$usemallocwrap" in
7752 [yY]*|true|$define)     dflt='y' ;;
7753 [nN]*|false|$undef)     dflt='n' ;;
7754 *)      case "$usedevel" in
7755         [yY]*|true|$define)     dflt='y' ;;
7756         *) dflt='n' ;;
7757         esac
7758         ;;
7759 esac
7760 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7761 . ./myread
7762 usemallocwrap="$ans"
7763 case "$ans" in
7764 y*|true)
7765         usemallocwrap="$define" ;;
7766 *)
7767         usemallocwrap="$undef" ;;
7768 esac
7769
7770 : determine which malloc to compile in
7771 echo " "
7772 case "$usemymalloc" in
7773 [yY]*|true|$define)     dflt='y' ;;
7774 [nN]*|false|$undef)     dflt='n' ;;
7775 *)      case "$ptrsize" in
7776         4) dflt='y' ;;
7777         *) dflt='n' ;;
7778         esac
7779         if test "$useithreads" = "$define"; then dflt='n'; fi
7780         ;;
7781 esac
7782 rp="Do you wish to attempt to use the malloc that comes with $package?"
7783 . ./myread
7784 usemymalloc="$ans"
7785 case "$ans" in
7786 y*|true)
7787         usemymalloc='y'
7788         mallocsrc='malloc.c'
7789         mallocobj="malloc$_o"
7790         d_mymalloc="$define"
7791         case "$libs" in
7792         *-lmalloc*)
7793                 : Remove malloc from list of libraries to use
7794                 echo "Removing unneeded -lmalloc from library list" >&4
7795                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7796                 shift
7797                 libs="$*"
7798                 echo "libs = $libs" >&4
7799                 ;;
7800         esac
7801         ;;
7802 *)
7803         usemymalloc='n'
7804         mallocsrc=''
7805         mallocobj=''
7806         d_mymalloc="$undef"
7807         ;;
7808 esac
7809
7810 : compute the return types of malloc and free
7811 echo " "
7812 $cat >malloc.c <<END
7813 #$i_malloc I_MALLOC
7814 #$i_stdlib I_STDLIB
7815 #include <stdio.h>
7816 #include <sys/types.h>
7817 #ifdef I_MALLOC
7818 #include <malloc.h>
7819 #endif
7820 #ifdef I_STDLIB
7821 #include <stdlib.h>
7822 #endif
7823 #ifdef TRY_MALLOC
7824 void *malloc();
7825 #endif
7826 #ifdef TRY_FREE
7827 void free();
7828 #endif
7829 END
7830 case "$malloctype" in
7831 '')
7832         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7833                 malloctype='void *'
7834         else
7835                 malloctype='char *'
7836         fi
7837         ;;
7838 esac
7839 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7840
7841 case "$freetype" in
7842 '')
7843         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7844                 freetype='void'
7845         else
7846                 freetype='int'
7847         fi
7848         ;;
7849 esac
7850 echo "Your system uses $freetype free(), it would seem." >&4
7851 $rm -f malloc.[co]
7852 : determine where site specific architecture-dependent libraries go.
7853 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7854 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7855 : sitelib may have an optional trailing /share.
7856 case "$sitearch" in
7857 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7858         dflt="$dflt/$archname"
7859         ;;
7860 *)      dflt="$sitearch"
7861         ;;
7862 esac
7863 set sitearch sitearch none
7864 eval $prefixit
7865 $cat <<EOM
7866
7867 The installation process will also create a directory for
7868 architecture-dependent site-specific extensions and modules.
7869
7870 EOM
7871 fn=d~+
7872 rp='Pathname for the site-specific architecture-dependent library files?'
7873 . ./getfile
7874 prefixvar=sitearch
7875 . ./setprefixvar
7876 if $test X"$sitearch" = X"$sitelib"; then
7877         d_sitearch="$undef"
7878 else
7879         d_sitearch="$define"
7880 fi
7881
7882 : Set the vendorprefix variables
7883 $cat <<EOM
7884
7885 The installation process will also create a directory for
7886 vendor-supplied add-ons.  Vendors who supply perl with their system
7887 may find it convenient to place all vendor-supplied files in this
7888 directory rather than in the main distribution directory.  This will
7889 ease upgrades between binary-compatible maintenance versions of perl.
7890
7891 Of course you may also use these directories in whatever way you see
7892 fit.  For example, you might use them to access modules shared over a
7893 company-wide network.
7894
7895 The default answer should be fine for most people.
7896 This causes further questions about vendor add-ons to be skipped
7897 and no vendor-specific directories will be configured for perl.
7898
7899 EOM
7900 rp='Do you want to configure vendor-specific add-on directories?'
7901 case "$usevendorprefix" in
7902 define|true|[yY]*) dflt=y ;;
7903 *)      : User may have set vendorprefix directly on Configure command line.
7904         case "$vendorprefix" in
7905         ''|' ') dflt=n ;;
7906         *)      dflt=y ;;
7907         esac
7908         ;;
7909 esac
7910 . ./myread
7911 case "$ans" in
7912 [yY]*)  fn=d~+
7913         rp='Installation prefix to use for vendor-supplied add-ons?'
7914         case "$vendorprefix" in
7915         '') dflt="$prefix" ;;
7916         *)  dflt=$vendorprefix ;;
7917         esac
7918         . ./getfile
7919         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7920         oldvendorprefix=''
7921         case "$vendorprefix" in
7922         '') ;;
7923         *)      case "$ans" in
7924                 "$prefix") ;;
7925                 *) oldvendorprefix="$prefix";;
7926                 esac
7927                 ;;
7928         esac
7929         usevendorprefix="$define"
7930         vendorprefix="$ans"
7931         vendorprefixexp="$ansexp"
7932         ;;
7933 *)      usevendorprefix="$undef"
7934         vendorprefix=''
7935         vendorprefixexp=''
7936         ;;
7937 esac
7938
7939 : Set the vendorlib variables
7940 case "$vendorprefix" in
7941 '')     d_vendorlib="$undef"
7942         vendorlib=''
7943         vendorlibexp=''
7944         ;;
7945 *)      d_vendorlib="$define"
7946         : determine where vendor-supplied modules go.
7947         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7948         case "$vendorlib" in
7949         '')
7950                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7951                 case "$installstyle" in
7952                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7953                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7954                 esac
7955                 ;;
7956         *)      dflt="$vendorlib"
7957                 ;;
7958         esac
7959         fn=d~+
7960         rp='Pathname for the vendor-supplied library files?'
7961         . ./getfile
7962         vendorlib="$ans"
7963         vendorlibexp="$ansexp"
7964         ;;
7965 esac
7966 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7967 prefixvar=vendorlib
7968 . ./installprefix
7969
7970 : Set the vendorarch variables
7971 case "$vendorprefix" in
7972 '')     d_vendorarch="$undef"
7973         vendorarch=''
7974         vendorarchexp=''
7975         ;;
7976 *)      d_vendorarch="$define"
7977         : determine where vendor-supplied architecture-dependent libraries go.
7978         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7979         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7980         : vendorlib may have an optional trailing /share.
7981         case "$vendorarch" in
7982         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7983                 dflt="$dflt/$archname"
7984                 ;;
7985         *)      dflt="$vendorarch" ;;
7986         esac
7987         fn=d~+
7988         rp='Pathname for vendor-supplied architecture-dependent files?'
7989         . ./getfile
7990         vendorarch="$ans"
7991         vendorarchexp="$ansexp"
7992         ;;
7993 esac
7994 prefixvar=vendorarch
7995 . ./installprefix
7996 if $test X"$vendorarch" = X"$vendorlib"; then
7997         d_vendorarch="$undef"
7998 else
7999         d_vendorarch="$define"
8000 fi
8001
8002 : Final catch-all directories to search
8003 $cat <<EOM
8004
8005 Lastly, you can have perl look in other directories for extensions and
8006 modules in addition to those already specified.
8007 These directories will be searched after
8008         $sitearch
8009         $sitelib
8010 EOM
8011 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8012 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8013 echo ' '
8014 case "$otherlibdirs" in
8015 ''|' ') dflt='none' ;;
8016 *)      dflt="$otherlibdirs" ;;
8017 esac
8018 $cat <<EOM
8019 Enter a colon-separated set of extra paths to include in perl's @INC
8020 search path, or enter 'none' for no extra paths.
8021
8022 EOM
8023
8024 rp='Colon-separated list of additional directories for perl to search?'
8025 . ./myread
8026 case "$ans" in
8027 ' '|''|none)    otherlibdirs=' ' ;;
8028 *)      otherlibdirs="$ans" ;;
8029 esac
8030 case "$otherlibdirs" in
8031 ' ') val=$undef ;;
8032 *)      val=$define ;;
8033 esac
8034 set d_perl_otherlibdirs
8035 eval $setvar
8036
8037 : Cruising for prototypes
8038 echo " "
8039 echo "Checking out function prototypes..." >&4
8040 $cat >prototype.c <<EOCP
8041 #$i_stdlib I_STDLIB
8042 #ifdef I_STDLIB
8043 #include <stdlib.h>
8044 #endif
8045 int main(int argc, char *argv[]) {
8046         exit(0);}
8047 EOCP
8048 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8049         echo "Your C compiler appears to support function prototypes."
8050         val="$define"
8051 else
8052         echo "Your C compiler doesn't seem to understand function prototypes."
8053         val="$undef"
8054 fi
8055 set prototype
8056 eval $setvar
8057 $rm -f prototype*
8058
8059 : Check if ansi2knr is required
8060 case "$prototype" in
8061 "$define") ;;
8062 *)      ansi2knr='ansi2knr'
8063         echo " "
8064         cat <<EOM >&4
8065
8066 $me:  FATAL ERROR:
8067 This version of $package can only be compiled by a compiler that
8068 understands function prototypes.  Unfortunately, your C compiler
8069         $cc $ccflags
8070 doesn't seem to understand them.  Sorry about that.
8071
8072 If GNU cc is available for your system, perhaps you could try that instead.
8073
8074 Eventually, we hope to support building Perl with pre-ANSI compilers.
8075 If you would like to help in that effort, please contact <perlbug@perl.org>.
8076
8077 Aborting Configure now.
8078 EOM
8079         exit 2
8080         ;;
8081 esac
8082
8083 : DTrace support
8084 dflt_dtrace='/usr/sbin/dtrace'
8085 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8086
8087 cat <<EOM
8088
8089 Perl can be built to support DTrace on platforms that support it.
8090 DTrace is a diagnosis and performance analysis tool from Sun.
8091
8092 If this doesn't make any sense to you, just accept the default.
8093 EOM
8094
8095 while $test 1 ; do
8096         case "$usedtrace" in
8097         $define|true|[yY]*)
8098                 dflt='y'
8099                 ;;
8100         ?*)
8101                 dflt='y'
8102                 dflt_dtrace=$usedtrace
8103                 ;;
8104         *)
8105                 dflt='n'
8106                 ;;
8107         esac
8108
8109         rp='Support DTrace if available?'
8110         . ./myread
8111         case "$ans" in
8112         y|Y)    val="$define" ;;
8113         *)      val="$undef" ;;
8114         esac
8115         set usedtrace
8116         eval $setvar
8117
8118         test "X$usedtrace" != "X$define" && break
8119
8120         echo " "
8121         rp='Where is the dtrace executable?'
8122         dflt=$dflt_dtrace
8123         . ./getfile
8124         val="$ans"
8125         set dtrace
8126         eval $setvar
8127
8128         if $test -f $dtrace
8129         then
8130                 if $dtrace -h -s ../perldtrace.d \
8131                         -o perldtrace.tmp >/dev/null 2>&1 \
8132                         && rm -f perldtrace.tmp
8133                 then
8134                         echo " "
8135                         echo "Good: your $dtrace knows about the -h flag."
8136                 else
8137                         cat >&2 <<EOM
8138
8139 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8140 ***
8141 *** Your installed dtrace doesn't support the -h switch to compile a D
8142 *** program into a C header. Can't continue.
8143
8144 EOM
8145                         exit 1
8146                 fi
8147                 break;
8148         fi
8149
8150         case "$fastread" in
8151         yes)
8152                 cat >&2 <<EOM
8153
8154 *** $me:  Fatal Error:  $dtrace not found.
8155 *** Can't continue.
8156
8157 EOM
8158                 exit 1
8159                 ;;
8160         *)
8161                 echo "*** $dtrace was not found."
8162                 echo " "
8163                 ;;
8164         esac
8165 done
8166
8167 : See if we want extra modules installed
8168 echo " "
8169 case "$extras" in
8170 '') dflt='n';;
8171 *) dflt='y';;
8172 esac
8173 cat <<EOM
8174 Perl can be built with extra modules or bundles of modules which
8175 will be fetched from the CPAN and installed alongside Perl.
8176
8177 Notice that you will need access to the CPAN; either via the Internet,
8178 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8179 be asked later to configure the CPAN.pm module which will in turn do
8180 the installation of the rest of the extra modules or bundles.)
8181
8182 Notice also that if the modules require any external software such as
8183 libraries and headers (the libz library and the zlib.h header for the
8184 Compress::Zlib module, for example) you MUST have any such software
8185 already installed, this configuration process will NOT install such
8186 things for you.
8187
8188 If this doesn't make any sense to you, just accept the default '$dflt'.
8189 EOM
8190 rp='Install any extra modules (y or n)?'
8191 . ./myread
8192 case "$ans" in
8193 y|Y)
8194         cat <<EOM
8195
8196 Please list any extra modules or bundles to be installed from CPAN,
8197 with spaces between the names.  The names can be in any format the
8198 'install' command of CPAN.pm will understand.  (Answer 'none',
8199 without the quotes, to install no extra modules or bundles.)
8200 EOM
8201         rp='Extras?'
8202         dflt="$extras"
8203         . ./myread
8204         extras="$ans"
8205 esac
8206 case "$extras" in
8207 ''|'none')
8208         val=''
8209         $rm -f ../extras.lst
8210         ;;
8211 *)      echo "(Saving the list of extras for later...)"
8212         echo "$extras" > ../extras.lst
8213         val="'$extras'"
8214         ;;
8215 esac
8216 set extras
8217 eval $setvar
8218 echo " "
8219
8220 : determine where html pages for programs go
8221 set html1dir html1dir none
8222 eval $prefixit
8223 $cat <<EOM
8224
8225 If you wish to install html files for programs in $spackage, indicate
8226 the appropriate directory here.  To skip installing html files,
8227 answer "none".
8228 EOM
8229 case "$html1dir" in
8230 ''|none|$undef|' ') dflt=none ;;
8231 *) dflt=$html1dir ;;
8232 esac
8233 fn=dn+~
8234 rp="Directory for the main $spackage html pages?"
8235 . ./getfile
8236 prefixvar=html1dir
8237 . ./setprefixvar
8238 : Use ' ' for none so value is preserved next time through Configure
8239 $test X"$html1dir" = "X" && html1dir=' '
8240
8241 : determine where html pages for libraries and modules go
8242 set html3dir html3dir none
8243 eval $prefixit
8244 $cat <<EOM
8245
8246 If you wish to install html files for modules associated with $spackage,
8247 indicate the appropriate directory here.  To skip installing html files,
8248 answer "none".
8249 EOM
8250 : There is no obvious default.  If they have specified html1dir, then
8251 : try to key off that, possibly changing .../html1 into .../html3.
8252 case "$html3dir" in
8253 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8254 *) dflt=$html3dir ;;
8255 esac
8256 fn=dn+~
8257 rp="Directory for the $spackage module html pages?"
8258 . ./getfile
8259 prefixvar=html3dir
8260 . ./setprefixvar
8261 : Use ' ' for none so value is preserved next time through Configure
8262 $test X"$html3dir" = "X" && html3dir=' '
8263
8264 : determine whether to install perl also as /usr/bin/perl
8265
8266 echo " "
8267 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8268         $cat <<EOM
8269 Many scripts expect perl to be installed as /usr/bin/perl.
8270
8271 If you want to, I can install the perl you are about to compile
8272 as /usr/bin/perl (in addition to $bin/perl).
8273 EOM
8274         if test -f /usr/bin/perl; then
8275             $cat <<EOM
8276
8277 However, please note that because you already have a /usr/bin/perl,
8278 overwriting that with a new Perl would very probably cause problems.
8279 Therefore I'm assuming you don't want to do that (unless you insist).
8280
8281 EOM
8282             case "$installusrbinperl" in
8283             "$define"|[yY]*)    dflt='y';;
8284             *)                  dflt='n';;
8285             esac
8286         else
8287             $cat <<EOM
8288
8289 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8290
8291 EOM
8292             case "$installusrbinperl" in
8293             "$undef"|[nN]*)     dflt='n';;
8294             *)                  dflt='y';;
8295             esac
8296         fi
8297         rp="Do you want to install perl as /usr/bin/perl?"
8298         . ./myread
8299         case "$ans" in
8300         [yY]*)  val="$define";;
8301         *)      val="$undef" ;;
8302         esac
8303 else
8304         val="$undef"
8305 fi
8306 set installusrbinperl
8307 eval $setvar
8308
8309 : see if dlopen exists
8310 xxx_runnm="$runnm"
8311 xxx_ccflags="$ccflags"
8312 runnm=false
8313 : with g++ one needs -shared to get is-in-libc to work for dlopen
8314 case "$gccversion" in
8315 '')     ;;
8316 *Clang*)        ;;
8317 *)      case "$d_cplusplus" in
8318         "$define") ccflags="$ccflags -shared" ;;
8319         esac
8320         ;;
8321 esac
8322 set dlopen d_dlopen
8323 eval $inlibc
8324 runnm="$xxx_runnm"
8325 ccflags="$xxx_ccflags"
8326
8327 : see if this is a unistd.h system
8328 set unistd.h i_unistd
8329 eval $inhdr
8330
8331 : determine which dynamic loading, if any, to compile in
8332 echo " "
8333 dldir="ext/DynaLoader"
8334 case "$usedl" in
8335     $define|y|true)
8336         dflt='y'
8337         usedl="$define"
8338         ;;
8339     $undef|n|false)
8340         dflt='n'
8341         usedl="$undef"
8342         ;;
8343     *)
8344         dflt='n'
8345         case "$d_dlopen" in
8346             $define) dflt='y' ;;
8347         esac
8348         : Does a dl_xxx.xs file exist for this operating system
8349         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8350         ;;
8351 esac
8352 rp="Do you wish to use dynamic loading?"
8353 . ./myread
8354 usedl="$ans"
8355 bin_ELF="$undef"
8356 case "$ans" in
8357     y*) usedl="$define"
8358         case "$dlsrc" in
8359             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8360                     dflt="$dldir/dl_${osname}.xs"
8361                 elif $test "$d_dlopen" = "$define" ; then
8362                     dflt="$dldir/dl_dlopen.xs"
8363                 else
8364                     dflt=''
8365                 fi
8366                 ;;
8367             *)  dflt="$dldir/$dlsrc"
8368                 ;;
8369         esac
8370         echo "The following dynamic loading files are available:"
8371         : Can not go over to $dldir because getfile has path hard-coded in.
8372         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8373         rp="Source file to use for dynamic loading"
8374         fn="fne"
8375         gfpth="$src"
8376         . ./getfile
8377         usedl="$define"
8378         : emulate basename
8379         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8380
8381         $cat << EOM
8382
8383 Some systems may require passing special flags to $cc -c to
8384 compile modules that will be used to create a shared library.
8385 To use no flags, say "none".
8386
8387 EOM
8388         case "$cccdlflags" in
8389             '') case "$gccversion" in
8390                 '') case "$osname" in
8391                         hpux)   dflt='+z' ;;
8392                         irix*)  dflt='-KPIC' ;;
8393                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8394                         sunos)  dflt='-pic' ;;
8395                         *)      dflt='none' ;;
8396                     esac
8397                     ;;
8398                 *)  case "$osname" in
8399                         darwin) dflt='none' ;;
8400                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8401                         *)      dflt='-fpic' ;;
8402                     esac ;;
8403                 esac ;;
8404             ' ') dflt='none' ;;
8405             *)   dflt="$cccdlflags" ;;
8406         esac
8407
8408         case "$dflt" in
8409             none) dflt='' ;;
8410         esac
8411
8412         # If -Dsysroot was specified, now's the time to add it
8413         # to cccdlflags
8414         if test "X$sysroot" != X; then
8415             case "$gccversion" in
8416                 '') ;;
8417                 *)  case "$dflt" in
8418                         *sysroot*) ;;
8419                         'undef'|*)
8420                             dflt="$dflt --sysroot=$sysroot" ;;
8421                     esac
8422                     ;;
8423             esac
8424         fi
8425
8426         case "$dflt" in
8427             '') dflt='none';;
8428         esac
8429
8430         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8431         . ./myread
8432         case "$ans" in
8433             none) cccdlflags=' ' ;;
8434             *)    cccdlflags="$ans" ;;
8435         esac
8436
8437         cat << EOM
8438
8439 Some systems use ld to create libraries that can be dynamically loaded,
8440 while other systems (such as those using ELF) use $cc.
8441
8442 EOM
8443
8444 : Determine if this is ELF
8445         $cat >try.c <<EOM
8446 /* Test for whether ELF binaries are produced */
8447 #include <fcntl.h>
8448 #$i_stdlib I_STDLIB
8449 #ifdef I_STDLIB
8450 #include <stdlib.h>
8451 #endif
8452 #$i_unistd I_UNISTD
8453 #ifdef I_UNISTD
8454 #include <unistd.h>
8455 #endif
8456 int main() {
8457     char b[4];
8458     int i = open("a.out",O_RDONLY);
8459     if(i == -1)
8460         exit(1); /* fail */
8461     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8462         exit(0); /* succeed (yes, it is ELF) */
8463     exit(1); /* fail */
8464 }
8465 EOM
8466         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8467             bin_ELF="$define"
8468         fi
8469         $rm_try
8470
8471         case "$ld" in
8472             '') if $test $bin_ELF = "$define"; then
8473                     cat <<EOM
8474 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8475 EOM
8476                     dflt="$cc"
8477                 else
8478                     echo "I'll use ld to build dynamic libraries."
8479                     dflt='ld'
8480                 fi
8481                 ;;
8482             *)  dflt="$ld"
8483                 ;;
8484         esac
8485
8486         rp="What command should be used to create dynamic libraries?"
8487         . ./myread
8488         ld="$ans"
8489
8490         cat << EOM
8491
8492 Some systems may require passing special flags to $ld to create a
8493 library that can be dynamically loaded.  If your ld flags include
8494 -L/other/path options to locate libraries outside your loader's normal
8495 search path, you may need to specify those -L options here as well.  To
8496 use no flags, say "none".
8497
8498 EOM
8499         case "$lddlflags" in
8500             '') case "$osname" in
8501                     haiku) dflt='-shared' ;;
8502                     hpux) dflt='-b';
8503                           case "$gccversion" in
8504                               '') dflt="$dflt +vnocompatwarnings" ;;
8505                           esac
8506                           ;;
8507                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8508                     solaris) # See [perl #66604].
8509                             # On Solaris 11, gcc -m64 on amd64
8510                             # appears not to understand -G.  gcc versions at
8511                             # least as old as 3.4.3 support -shared, so just
8512                             # use that with Solaris 11 and later, but keep
8513                             # the old behavior for older Solaris versions.
8514                             case "$gccversion" in
8515                                 '') dflt='-G' ;;
8516                                 *)  case "$osvers" in
8517                                         2.?|2.10) dflt='-G' ;;
8518                                         *) dflt='-shared' ;;
8519                                     esac
8520                                     ;;
8521                             esac
8522                             ;;
8523                     sunos) dflt='-assert nodefinitions' ;;
8524                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8525                     *)     dflt='none' ;;
8526                 esac
8527                 ;;
8528             *) dflt="$lddlflags" ;;
8529         esac
8530
8531         : Only do this for gcc, since, for example, qcc has no concept
8532         : of --sysroot.
8533         if $test "X$sysroot" != X; then
8534             case "$gccversion" in
8535                 '') ;;
8536                 *)  dflt="$dflt --sysroot $sysroot" ;;
8537             esac
8538         fi
8539
8540         : Try to guess additional flags to pick up local libraries.
8541         : Be careful not to append to a plain 'none'
8542         case "$dflt" in
8543             none) dflt='' ;;
8544         esac
8545         for thisflag in $ldflags; do
8546             case "$thisflag" in
8547                 -L*|-R*|-Wl,-R*)
8548                     case " $dflt " in
8549                         *" $thisflag "*) ;;
8550                         *) dflt="$dflt $thisflag" ;;
8551                     esac
8552                     ;;
8553             esac
8554         done
8555
8556         case "$dflt" in
8557             ''|' ') dflt='none' ;;
8558         esac
8559
8560         case "$ldflags" in
8561             *-fstack-protector-strong*)
8562                 case "$dflt" in
8563                     *-fstack-protector-strong*) ;; # Don't add it again
8564                     *) dflt="$dflt -fstack-protector-strong" ;;
8565                 esac
8566                 ;;
8567             *-fstack-protector*)
8568                 case "$dflt" in
8569                     *-fstack-protector*) ;; # Don't add it again
8570                     *) dflt="$dflt -fstack-protector" ;;
8571                 esac
8572                 ;;
8573         esac
8574
8575         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8576         . ./myread
8577         case "$ans" in
8578             none) lddlflags=' ' ;;
8579             *) lddlflags="$ans" ;;
8580         esac
8581
8582         cat <<EOM
8583
8584 Some systems may require passing special flags to $cc to indicate that
8585 the resulting executable will use dynamic linking.  To use no flags,
8586 say "none".
8587
8588 EOM
8589         case "$ccdlflags" in
8590             '') case "$osname" in
8591                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8592                     sunos)             dflt='none'   ;;
8593                     *)                 dflt='none'   ;;
8594                 esac ;;
8595             ' ') dflt='none' ;;
8596             *)   dflt="$ccdlflags" ;;
8597         esac
8598         rp="Any special flags to pass to $cc to use dynamic linking?"
8599         . ./myread
8600         case "$ans" in
8601             none) ccdlflags=' ' ;;
8602             *)    ccdlflags="$ans" ;;
8603         esac
8604         ;;
8605
8606     *)  usedl="$undef"
8607         ld='ld'
8608         dlsrc='dl_none.xs'
8609         lddlflags=''
8610         ccdlflags=''
8611         ;;
8612 esac
8613
8614 ld_can_script="$undef"
8615 case "$bin_ELF$usedl" in
8616     $define$define)
8617         # Abuse try.h and a.out names for neat cleanup
8618         $cat >try.c <<EOM
8619 void foo() {}
8620 void bar() {}
8621 EOM
8622         $cat >try.h <<EOM
8623 LIBTEST_42 {
8624  global:
8625   foo;
8626  local: *;
8627  };
8628 EOM
8629         if $cc $cccdlflags $ccdlflags $ccflags \
8630                $ldflags $lddlflags -o a.out try.c \
8631                -Wl,--version-script=try.h >/dev/null 2>&1 \
8632            &&  $test -s a.out ; then
8633             echo "ld supports scripting" >&4
8634             ld_can_script="$define"
8635         else
8636             echo "ld does not support scripting" >&4
8637         fi
8638         $rm_try
8639         ;;
8640 esac
8641
8642 : Do we want a shared libperl?
8643 also=''
8644 case "$usedl" in
8645 $undef)
8646         # No dynamic loading being used, so don't bother even to prompt.
8647         useshrplib='false'
8648         ;;
8649 *)      case "$useshrplib" in
8650         '')     case "$osname" in
8651                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8652                         dflt=y
8653                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8654                         ;;
8655                 *)      dflt=n
8656                         ;;
8657                 esac
8658                 ;;
8659         $define|true|[Yy]*)
8660                 dflt=y
8661                 ;;
8662         *)      dflt=n
8663                 ;;
8664         esac
8665         $cat << EOM
8666
8667 The perl executable is normally obtained by linking perlmain.c with
8668 libperl${_a}, any static extensions (usually just DynaLoader), and
8669 any other libraries needed on this system (such as -lm, etc.).  Since
8670 your system supports dynamic loading, it is probably possible to build
8671 a shared libperl.$so.  If you will have more than one executable linked
8672 to libperl.$so, this will significantly reduce the size of each
8673 executable, but it may have a noticeable effect on performance.  The
8674 default is probably sensible for your system.
8675 $also
8676
8677 EOM
8678         rp="Build a shared libperl.$so (y/n)"
8679         . ./myread
8680         case "$ans" in
8681         true|$define|[Yy]*)
8682                 useshrplib='true'  ;;
8683         *)      useshrplib='false' ;;
8684         esac
8685         ;;
8686 esac
8687
8688 case "$useshrplib" in
8689 true)
8690         case "$userelocatableinc" in
8691         true|define)
8692                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8693                 echo "See INSTALL for an explanation why that won't work." >&4
8694                 exit 4
8695                 ;;
8696         esac
8697         case "$libperl" in
8698         '')
8699                 # Figure out a good name for libperl.so.  Since it gets stored in
8700                 # a version-specific architecture-dependent library, the version
8701                 # number isn't really that important, except for making cc/ld happy.
8702                 #
8703                 # A name such as libperl.so.10.1
8704                 majmin="libperl.$so.$patchlevel.$subversion"
8705                 # A name such as libperl.so.100
8706                 majonly=`echo $patchlevel $subversion |
8707                         $awk '{printf "%d%02d", $1, $2}'`
8708                 majonly=libperl.$so.$majonly
8709                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8710                 # rely on figuring it out from the naming of libc.
8711                 case "${osname}${osvers}" in
8712                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8713                         dflt=libperl.$so
8714                         ;;
8715                 cygwin*) # ld links now against the dll directly
8716                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8717                         majonly=`echo $patchlevel $subversion |
8718                                 $awk '{printf "%03d%03d", $1, $2}'`
8719                         majonly=cygperl5.$majonly.$so
8720                         dflt=$majmin
8721                         ;;
8722                 *)      # Try to guess based on whether libc has major.minor.
8723                         case "$libc" in
8724                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8725                         *libc.$so.[0-9]*) dflt=$majonly ;;
8726                         *)      dflt=libperl.$so ;;
8727                         esac
8728                         ;;
8729                 esac
8730                 ;;
8731         *)      dflt=$libperl
8732                 ;;
8733         esac
8734         cat << EOM
8735
8736 I need to select a good name for the shared libperl.  If your system uses
8737 library names with major and minor numbers, then you might want something
8738 like $majmin.  Alternatively, if your system uses a single version
8739 number for shared libraries, then you might want to use $majonly.
8740 Or, your system might be quite happy with a simple libperl.$so.
8741
8742 Since the shared libperl will get installed into a version-specific
8743 architecture-dependent directory, the version number of the shared perl
8744 library probably isn't important, so the default should be o.k.
8745
8746 EOM
8747         rp='What name do you want to give to the shared libperl?'
8748         . ./myread
8749         libperl=$ans
8750         echo "Ok, I'll use $libperl"
8751         ;;
8752 *)
8753         libperl="libperl${_a}"
8754         ;;
8755 esac
8756
8757 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8758 case "$shrpdir" in
8759 '') ;;
8760 *)      $cat >&4 <<EOM
8761 WARNING:  Use of the shrpdir variable for the installation location of
8762 the shared $libperl is not supported.  It was never documented and
8763 will not work in this version.  Let me (perlbug@perl.org)
8764 know of any problems this may cause.
8765
8766 EOM
8767         case "$shrpdir" in
8768         "$archlibexp/CORE")
8769                 $cat >&4 <<EOM
8770 But your current setting of $shrpdir is
8771 the default anyway, so it's harmless.
8772 EOM
8773                 ;;
8774         *)
8775                 $cat >&4 <<EOM
8776 Further, your current attempted setting of $shrpdir
8777 conflicts with the value of $archlibexp/CORE
8778 that installperl will use.
8779 EOM
8780                 ;;
8781         esac
8782         ;;
8783 esac
8784
8785 # How will the perl executable find the installed shared $libperl?
8786 # Add $xxx to ccdlflags.
8787 # If we can't figure out a command-line option, use $shrpenv to
8788 # set env LD_RUN_PATH.  The main perl makefile uses this.
8789 shrpdir=$archlibexp/CORE
8790 xxx=''
8791 tmp_shrpenv=''
8792 if "$useshrplib"; then
8793     case "$osname" in
8794         aix)
8795                 # We'll set it in Makefile.SH...
8796                 ;;
8797         solaris)
8798                 xxx="-R $shrpdir"
8799                 ;;
8800         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8801                 xxx="-Wl,-R$shrpdir"
8802                 ;;
8803         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8804                 xxx="-Wl,-rpath,$shrpdir"
8805                 ;;
8806         hpux*)
8807                 # hpux doesn't like the default, either.
8808                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8809                 ;;
8810         cygwin)
8811                 # cygwin needs only ldlibpth
8812                 ;;
8813         *)
8814                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8815                 ;;
8816         esac
8817         case "$xxx" in
8818         '') ;;
8819         *)
8820                 # Only add $xxx if it isn't already in ccdlflags.
8821                 case " $ccdlflags " in
8822                 *" $xxx "*)     ;;
8823                 *)      ccdlflags="$ccdlflags $xxx"
8824                         cat <<EOM >&4
8825
8826 Adding $xxx to the flags
8827 passed to $ld so that the perl executable will find the
8828 installed shared $libperl.
8829
8830 EOM
8831                         ;;
8832                 esac
8833                 ;;
8834         esac
8835 fi
8836 # Fix ccdlflags in AIX for building external extensions.
8837 # (For building Perl itself bare -bE:perl.exp is needed,
8838 #  Makefile.SH takes care of this.)
8839 case "$osname" in
8840 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8841 esac
8842 # Respect a hint or command-line value.
8843 case "$shrpenv" in
8844 '') shrpenv="$tmp_shrpenv" ;;
8845 esac
8846 case "$ldlibpthname" in
8847 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8848 none)   ldlibpthname='' ;;
8849 esac
8850
8851 : determine where manual pages are on this system
8852 echo " "
8853 case "$sysman" in
8854 '')
8855         syspath='/usr/share/man/man1 /usr/man/man1'
8856         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8857         syspath="$syspath /usr/man/u_man/man1"
8858         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8859         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8860         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8861         sysman=`./loc . /usr/man/man1 $syspath`
8862         ;;
8863 esac
8864 if $test -d "$sysman"; then
8865         echo "System manual is in $sysman." >&4
8866 else
8867         echo "Could not find manual pages in source form." >&4
8868 fi
8869
8870 : determine where manual pages go
8871 set man1dir man1dir none
8872 eval $prefixit
8873 $cat <<EOM
8874
8875 $spackage has manual pages available in source form.
8876 EOM
8877 case "$nroff" in
8878 nroff)
8879         echo "However, you don't have nroff, so they're probably useless to you."
8880         case "$man1dir" in
8881         '') man1dir="none";;
8882         esac;;
8883 esac
8884 echo "If you don't want the manual sources installed, answer 'none'."
8885 case "$man1dir" in
8886 ' ') dflt=none
8887         ;;
8888 '')
8889         lookpath="$prefixexp/share/man/man1"
8890         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8891         lookpath="$lookpath $prefixexp/man/p_man/man1"
8892         lookpath="$lookpath $prefixexp/man/u_man/man1"
8893         lookpath="$lookpath $prefixexp/man/man.1"
8894         case "$sysman" in
8895         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8896         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8897         esac
8898         set dflt
8899         eval $prefixup
8900         ;;
8901 *)  dflt="$man1dir"
8902         ;;
8903 esac
8904 echo " "
8905 fn=dn+~
8906 rp="Where do the main $spackage manual pages (source) go?"
8907 . ./getfile
8908 if $test "X$man1direxp" != "X$ansexp"; then
8909         installman1dir=''
8910 fi
8911 prefixvar=man1dir
8912 . ./setprefixvar
8913
8914 case "$man1dir" in
8915 '')     man1dir=' '
8916         installman1dir='';;
8917 esac
8918
8919 : What suffix to use on installed man pages
8920
8921 case "$man1dir" in
8922 ' ')
8923         man1ext='0'
8924         ;;
8925 *)
8926         rp="What suffix should be used for the main $spackage man pages?"
8927         case "$man1ext" in
8928         '')     case "$man1dir" in
8929                 *1)  dflt=1 ;;
8930                 *1p) dflt=1p ;;
8931                 *1pm) dflt=1pm ;;
8932                 *l) dflt=l;;
8933                 *n) dflt=n;;
8934                 *o) dflt=o;;
8935                 *p) dflt=p;;
8936                 *C) dflt=C;;
8937                 *L) dflt=L;;
8938                 *L1) dflt=L1;;
8939                 *) dflt=1;;
8940                 esac
8941                 ;;
8942         *)      dflt="$man1ext";;
8943         esac
8944         . ./myread
8945         man1ext="$ans"
8946         ;;
8947 esac
8948
8949 : see if we can have long filenames
8950 echo " "
8951 first=123456789abcdef
8952 $rm -f $first
8953 if (echo hi >$first) 2>/dev/null; then
8954         if $test -f 123456789abcde; then
8955                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8956                 val="$undef"
8957         else
8958                 echo 'You can have filenames longer than 14 characters.'>&4
8959                 val="$define"
8960         fi
8961 else
8962         $cat <<'EOM'
8963 You can't have filenames longer than 14 chars.
8964 You can't even think about them!
8965 EOM
8966         val="$undef"
8967 fi
8968 set d_flexfnam
8969 eval $setvar
8970 $rm -rf 123456789abcde*
8971
8972 : determine where library module manual pages go
8973 set man3dir man3dir none
8974 eval $prefixit
8975 $cat <<EOM
8976
8977 $spackage has manual pages for many of the library modules.
8978 EOM
8979
8980 case "$nroff" in
8981 nroff)
8982         $cat <<'EOM'
8983 However, you don't have nroff, so they're probably useless to you.
8984 EOM
8985         case "$man3dir" in
8986         '') man3dir="none";;
8987         esac;;
8988 esac
8989
8990 case "$d_flexfnam" in
8991 undef)
8992         $cat <<'EOM'
8993 However, your system can't handle the long file names like File::Basename.3.
8994 EOM
8995         case "$man3dir" in
8996         '') man3dir="none";;
8997         esac;;
8998 esac
8999
9000 echo "If you don't want the manual sources installed, answer 'none'."
9001 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9002 case "$man3dir" in
9003 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9004         if $test -d "$privlib/man/man3"; then
9005                 cat <<EOM >&4
9006
9007 WARNING:  Previous versions of perl installed man3 pages into
9008 $privlib/man/man3.  This version will suggest a
9009 new default of $dflt.
9010 EOM
9011                 tdflt=$dflt
9012                 dflt='n'
9013                 rp='Do you wish to preserve the old behavior?(y/n)'
9014                 . ./myread
9015                 case "$ans" in
9016                 y*) dflt="$privlib/man/man3" ;;
9017                 *)  dflt=$tdflt ;;
9018                 esac
9019     fi
9020         ;;
9021 *)      dflt="$man3dir" ;;
9022 esac
9023 case "$dflt" in
9024 ' ') dflt=none ;;
9025 esac
9026 echo " "
9027 fn=dn+~
9028 rp="Where do the $package library man pages (source) go?"
9029 . ./getfile
9030 prefixvar=man3dir
9031 . ./setprefixvar
9032
9033 case "$man3dir" in
9034 '')     man3dir=' '
9035         installman3dir='';;
9036 esac
9037
9038 : What suffix to use on installed man pages
9039 case "$man3dir" in
9040 ' ')
9041         man3ext='0'
9042         ;;
9043 *)
9044         rp="What suffix should be used for the $package library man pages?"
9045         case "$man3ext" in
9046         '')     case "$man3dir" in
9047                 *3)  dflt=3 ;;
9048                 *3p) dflt=3p ;;
9049                 *3pm) dflt=3pm ;;
9050                 *l) dflt=l;;
9051                 *n) dflt=n;;
9052                 *o) dflt=o;;
9053                 *p) dflt=p;;
9054                 *C) dflt=C;;
9055                 *L) dflt=L;;
9056                 *L3) dflt=L3;;
9057                 *) dflt=3;;
9058                 esac
9059                 ;;
9060         *)      dflt="$man3ext";;
9061         esac
9062         . ./myread
9063         man3ext="$ans"
9064         ;;
9065 esac
9066
9067 : see if we have to deal with yellow pages, now NIS.
9068 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9069         case "$hostcat" in
9070         nidump*) ;;
9071         *)
9072                 case "$hostcat" in
9073                 *ypcat*) dflt=y;;
9074                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9075                                 dflt=y
9076                         else
9077                                 dflt=n
9078                         fi;;
9079                 *) dflt=n;;
9080                 esac
9081                 echo " "
9082                 rp='Are you getting the hosts file via yellow pages?'
9083                 . ./myread
9084                 case "$ans" in
9085                 y*) hostcat='ypcat hosts';;
9086                 *) hostcat='cat /etc/hosts';;
9087                 esac
9088                 ;;
9089         esac
9090 fi
9091 case "$hostcat" in
9092 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9093 esac
9094 case "$groupcat" in
9095 '') test -f /etc/group && groupcat='cat /etc/group';;
9096 esac
9097 case "$passcat" in
9098 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9099 esac
9100
9101 : now get the host name
9102 echo " "
9103 echo "Figuring out host name..." >&4
9104 case "$myhostname" in
9105 '') cont=true
9106         echo 'Maybe "hostname" will work...'
9107         if tans=`sh -c hostname 2>&1` ; then
9108                 myhostname=$tans
9109                 phostname=hostname
9110                 cont=''
9111         fi
9112         ;;
9113 *) cont='';;
9114 esac
9115 if $test "$cont"; then
9116         if ./xenix; then
9117                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9118                 if tans=`cat /etc/systemid 2>&1` ; then
9119                         myhostname=$tans
9120                         phostname='cat /etc/systemid'
9121                         echo "Whadyaknow.  Xenix always was a bit strange..."
9122                         cont=''
9123                 fi
9124         elif $test -r /etc/systemid; then
9125                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9126         fi
9127 fi
9128 if $test "$cont"; then
9129         echo 'No, maybe "uuname -l" will work...'
9130         if tans=`sh -c 'uuname -l' 2>&1` ; then
9131                 myhostname=$tans
9132                 phostname='uuname -l'
9133         else
9134                 echo 'Strange.  Maybe "uname -n" will work...'
9135                 if tans=`sh -c 'uname -n' 2>&1` ; then
9136                         myhostname=$tans
9137                         phostname='uname -n'
9138                 else
9139                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9140                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9141                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9142                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9143                         else
9144                                 case "$myhostname" in
9145                                 '') echo "Does this machine have an identity crisis or something?"
9146                                         phostname='';;
9147                                 *)
9148                                         echo "Well, you said $myhostname before..."
9149                                         phostname='echo $myhostname';;
9150                                 esac
9151                         fi
9152                 fi
9153         fi
9154 fi
9155 case "$myhostname" in
9156 '') myhostname=noname ;;
9157 esac
9158 : you do not want to know about this
9159 set $myhostname
9160 myhostname=$1
9161
9162 : verify guess
9163 if $test "$myhostname" ; then
9164         dflt=y
9165         rp='Your host name appears to be "'$myhostname'".'" Right?"
9166         . ./myread
9167         case "$ans" in
9168         y*) ;;
9169         *) myhostname='';;
9170         esac
9171 fi
9172
9173 : bad guess or no guess
9174 while $test "X$myhostname" = X ; do
9175         dflt=''
9176         rp="Please type the (one word) name of your host:"
9177         . ./myread
9178         myhostname="$ans"
9179 done
9180
9181 : translate upper to lower if necessary
9182 case "$myhostname" in
9183 *[A-Z]*)
9184         echo "(Normalizing case in your host name)"
9185         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9186         ;;
9187 esac
9188
9189 case "$myhostname" in
9190 *.*)
9191         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9192         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9193         echo "(Trimming domain name from host name--host name is now $myhostname)"
9194         ;;
9195 *) case "$mydomain" in
9196         '')
9197                 {
9198                         test "X$hostcat" = "Xypcat hosts" &&
9199                         ypmatch "$myhostname" hosts 2>/dev/null |\
9200                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9201                         $test -s hosts
9202                 } || {
9203                         test "X$hostcat" != "X" &&
9204                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9205                                         /[       ]$myhostname[  . ]/p" > hosts
9206                 }
9207                 tmp_re="[       . ]"
9208                 if $test -f hosts; then
9209                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9210                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9211                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9212                                 hosts | $sort | $uniq | \
9213                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9214                         case `$echo X$dflt` in
9215                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9216                                 dflt=.
9217                                 ;;
9218                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9219                                 ;;
9220                         esac
9221                 else
9222                         echo "(I cannot locate a hosts database anywhere)"
9223                         dflt=.
9224                 fi
9225                 case "$dflt" in
9226                 .)
9227                         tans=`./loc resolv.conf X /etc /usr/etc`
9228                         if $test -f "$tans"; then
9229                                 echo "(Attempting domain name extraction from $tans)"
9230                                 dflt=.`$sed -n -e 's/   / /g' \
9231                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9232                                   -e 1q 2>/dev/null`
9233                                 case "$dflt" in
9234                                 .) dflt=.`$sed -n -e 's/        / /g' \
9235                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9236                                      -e 1q 2>/dev/null`
9237                                         ;;
9238                                 esac
9239                         fi
9240                         ;;
9241                 esac
9242                 case "$dflt" in
9243                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9244                         dflt=.`sh -c domainname 2>/dev/null`
9245                         case "$dflt" in
9246                         '') dflt='.';;
9247                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9248                         esac
9249                         ;;
9250                 esac
9251                 case "$dflt$osname" in
9252                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9253                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9254                         ;;
9255                 esac
9256                 case "$dflt" in
9257                 .) echo "(Lost all hope -- silly guess then)"
9258                         dflt='.nonet'
9259                         ;;
9260                 esac
9261                 $rm -f hosts
9262                 ;;
9263         *) dflt="$mydomain";;
9264         esac;;
9265 esac
9266 echo " "
9267 rp="What is your domain name?"
9268 . ./myread
9269 tans="$ans"
9270 case "$ans" in
9271 '') ;;
9272 .*) ;;
9273 *) tans=".$tans";;
9274 esac
9275 mydomain="$tans"
9276
9277 : translate upper to lower if necessary
9278 case "$mydomain" in
9279 *[A-Z]*)
9280         echo "(Normalizing case in your domain name)"
9281         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9282         ;;
9283 esac
9284
9285 : a little sanity check here
9286 case "$phostname" in
9287 '') ;;
9288 *)
9289         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9290         $myhostname$mydomain|$myhostname) ;;
9291         *)
9292                 case "$phostname" in
9293                 sed*)
9294                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9295                         ;;
9296                 *)
9297                         echo "(That doesn't agree with your $phostname command, by the way.)"
9298                         ;;
9299                 esac
9300         ;;
9301         esac
9302         ;;
9303 esac
9304
9305 : determine the e-mail address of the user who is running us
9306 $cat <<EOM
9307
9308 I need to get your e-mail address in Internet format if possible, i.e.
9309 something like user@host.domain. Please answer accurately since I have
9310 no easy means to double check it. The default value provided below
9311 is most probably close to reality but may not be valid from outside
9312 your organization...
9313
9314 EOM
9315 cont=x
9316 while test "$cont"; do
9317         case "$MAILDOMAIN" in
9318         '')
9319                 if $test -s /etc/mailname; then
9320                         maildomain=`$cat /etc/mailname`
9321                 else
9322                         maildomain="$myhostname$mydomain"
9323                 fi
9324                 ;;
9325         *)  maildomain="$MAILDOMAIN";;
9326         esac
9327         case "$cf_email" in
9328         '') dflt="$cf_by@$maildomain";;
9329         *)  dflt="$cf_email";;
9330         esac
9331         rp='What is your e-mail address?'
9332         . ./myread
9333         cf_email="$ans"
9334         case "$cf_email" in
9335         *@*.*) cont='' ;;
9336         *)
9337                 rp='Address does not look like an Internet one.  Use it anyway?'
9338                 case "$fastread" in
9339                 yes) dflt=y ;;
9340                 *) dflt=n ;;
9341                 esac
9342                 . ./myread
9343                 case "$ans" in
9344                 y*) cont='' ;;
9345                 *) echo " " ;;
9346                 esac
9347                 ;;
9348         esac
9349 done
9350
9351 : Ask e-mail of administrator
9352 $cat <<EOM
9353
9354 If you or somebody else will be maintaining perl at your site, please
9355 fill in the correct e-mail address here so that they may be contacted
9356 if necessary. Currently, the "perlbug" program included with perl
9357 will send mail to this address in addition to perlbug@perl.org. You may
9358 enter "none" for no administrator.
9359
9360 EOM
9361 case "$perladmin" in
9362 '') dflt="$cf_email";;
9363 *) dflt="$perladmin";;
9364 esac
9365 rp='Perl administrator e-mail address'
9366 . ./myread
9367 perladmin="$ans"
9368
9369 : determine whether to only install version-specific parts.
9370 echo " "
9371 $cat <<EOM
9372 Do you want to install only the version-specific parts of the perl
9373 distribution?  Usually you do *not* want to do this.
9374 EOM
9375 case "$versiononly" in
9376 "$define"|[Yy]*|true) dflt='y' ;;
9377 *) dflt='n';
9378 esac
9379 rp="Do you want to install only the version-specific parts of perl?"
9380 . ./myread
9381 case "$ans" in
9382 [yY]*)  val="$define";;
9383 *)      val="$undef" ;;
9384 esac
9385 set versiononly
9386 eval $setvar
9387
9388 case "$versiononly" in
9389 "$define") inc_version_list=''
9390            inc_version_list_init=0
9391            ;;
9392 esac
9393
9394 : figure out how to guarantee perl startup
9395 : XXX Note that this currently takes advantage of the bug that binexp ignores
9396 :     the Configure -Dinstallprefix setting, which in turn means that under
9397 :     relocatable @INC, initialinstalllocation is what binexp started as.
9398 case "$startperl" in
9399 '')
9400         case "$sharpbang" in
9401         *!)
9402                 $cat <<EOH
9403
9404 I can use the #! construct to start perl on your system. This will
9405 make startup of perl scripts faster, but may cause problems if you
9406 want to share those scripts and perl is not in a standard place
9407 ($initialinstalllocation/perl) on all your platforms. The alternative
9408 is to force a shell by starting the script with a single ':' character.
9409
9410 EOH
9411                 case "$versiononly" in
9412                 "$define")      dflt="$initialinstalllocation/perl$version";;
9413                 *)              dflt="$initialinstalllocation/perl";;
9414                 esac
9415                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9416                 . ./myread
9417                 case "$ans" in
9418                 none)   startperl=": # use perl";;
9419                 *)      startperl="#!$ans"
9420                         if $test 30 -lt `echo "$ans" | wc -c`; then
9421                                 $cat >&4 <<EOM
9422
9423 WARNING:  Some systems limit the #! command to 32 characters.
9424 If you experience difficulty running Perl scripts with #!, try
9425 installing Perl in a directory with a shorter pathname.
9426
9427 EOM
9428                         fi ;;
9429                 esac
9430                 ;;
9431         *) startperl=": # use perl"
9432                 ;;
9433         esac
9434         ;;
9435 esac
9436 echo "I'll use $startperl to start perl scripts."
9437
9438 : figure best path for perl in scripts
9439 case "$perlpath" in
9440 '')
9441         case "$versiononly" in
9442         "$define")      perlpath="$initialinstalllocation/perl$version";;
9443         *)              perlpath="$initialinstalllocation/perl";;
9444         esac
9445         case "$startperl" in
9446         *!*) ;;
9447         *)
9448                 $cat <<EOH
9449
9450 I will use the "eval 'exec'" idiom to start Perl on your system.
9451 I can use the full path of your Perl binary for this purpose, but
9452 doing so may cause problems if you want to share those scripts and
9453 Perl is not always in a standard place ($initialinstalllocation/perl).
9454
9455 EOH
9456                 dflt="$initialinstalllocation/perl"
9457                 rp="What path shall I use in \"eval 'exec'\"?"
9458                 . ./myread
9459                 perlpath="$ans"
9460                 ;;
9461         esac
9462         ;;
9463 esac
9464 case "$startperl" in
9465 *!*)    ;;
9466 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9467 esac
9468
9469 : determine where public executable scripts go
9470 set scriptdir scriptdir
9471 eval $prefixit
9472 case "$scriptdir" in
9473 '')
9474         dflt="$bin"
9475         : guess some guesses
9476         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9477         $test -d /usr/share/bin     && dflt=/usr/share/bin
9478         $test -d /usr/local/script  && dflt=/usr/local/script
9479         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9480         $test -d $prefixexp/script  && dflt=$prefixexp/script
9481         set dflt
9482         eval $prefixup
9483         ;;
9484 *)  dflt="$scriptdir"
9485         ;;
9486 esac
9487 $cat <<EOM
9488
9489 Some installations have a separate directory just for executable scripts so
9490 that they can mount it across multiple architectures but keep the scripts in
9491 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9492 Or you might just lump your scripts in with all your other executables.
9493
9494 EOM
9495 fn=d~
9496 rp='Where do you keep publicly executable scripts?'
9497 . ./getfile
9498 if $test "X$ansexp" != "X$scriptdirexp"; then
9499         installscript=''
9500 fi
9501 installscriptdir=''
9502 prefixvar=scriptdir
9503 . ./setprefixvar
9504 : A little fix up for an irregularly named variable.
9505 installscript="$installscriptdir"
9506
9507 : determine where add-on public executables go
9508 case "$sitebin" in
9509 '')     dflt=$siteprefix/bin ;;
9510 *)      dflt=$sitebin ;;
9511 esac
9512 fn=d~
9513 rp='Pathname where the add-on public executables should be installed?'
9514 . ./getfile
9515 prefixvar=sitebin
9516 . ./setprefixvar
9517
9518 : determine where add-on html pages go
9519 : There is no standard location, so try to copy the previously-selected
9520 : directory structure for the core html pages.
9521 case "$sitehtml1dir" in
9522 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9523 *)     dflt=$sitehtml1dir ;;
9524 esac
9525 case "$dflt" in
9526 ''|' ') dflt=none ;;
9527 esac
9528 fn=dn+~
9529 rp='Pathname where the site-specific html pages should be installed?'
9530 . ./getfile
9531 prefixvar=sitehtml1dir
9532 . ./setprefixvar
9533
9534 : determine where add-on library html pages go
9535 : There is no standard location, so try to copy the previously-selected
9536 : directory structure for the core html pages.
9537 case "$sitehtml3dir" in
9538 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9539 *)     dflt=$sitehtml3dir ;;
9540 esac
9541 case "$dflt" in
9542 ''|' ') dflt=none ;;
9543 esac
9544 fn=dn+~
9545 rp='Pathname where the site-specific library html pages should be installed?'
9546 . ./getfile
9547 prefixvar=sitehtml3dir
9548 . ./setprefixvar
9549
9550 : determine where add-on manual pages go
9551 case "$siteman1dir" in
9552 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9553 *)      dflt=$siteman1dir ;;
9554 esac
9555 case "$dflt" in
9556 ''|' ') dflt=none ;;
9557 esac
9558 fn=dn+~
9559 rp='Pathname where the site-specific manual pages should be installed?'
9560 . ./getfile
9561 prefixvar=siteman1dir
9562 . ./setprefixvar
9563
9564 : determine where add-on library man pages go
9565 case "$siteman3dir" in
9566 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9567 *)      dflt=$siteman3dir ;;
9568 esac
9569 case "$dflt" in
9570 ''|' ') dflt=none ;;
9571 esac
9572 fn=dn+~
9573 rp='Pathname where the site-specific library manual pages should be installed?'
9574 . ./getfile
9575 prefixvar=siteman3dir
9576 . ./setprefixvar
9577
9578 : determine where add-on public executable scripts go
9579 case "$sitescript" in
9580 '')     dflt=$siteprefix/script
9581         $test -d $dflt || dflt=$sitebin ;;
9582 *)  dflt="$sitescript" ;;
9583 esac
9584 fn=d~+
9585 rp='Pathname where add-on public executable scripts should be installed?'
9586 . ./getfile
9587 prefixvar=sitescript
9588 . ./setprefixvar
9589
9590 : see if backtrace exists
9591 set backtrace d_backtrace
9592 eval $inlibc
9593
9594 : add flags if using c backtrace
9595 case "$usecbacktrace" in
9596   "") usecbacktrace=$undef ;;
9597   [yY]*|true|$define)
9598     case "$d_backtrace" in
9599       [yY]*|true|$define)
9600         case " $ccflags " in
9601           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9602           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9603           esac
9604         ;;
9605       *)
9606         echo "This system does not support backtrace" >&4
9607         usecbacktrace=$undef
9608         ;;
9609       esac
9610     ;;
9611   esac
9612
9613 : Check if faststdio is requested and available
9614 case "$usefaststdio" in
9615 $define|true|[yY]*|'')
9616         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9617         case "$xversion" in
9618         [68])   dflt='y' ;;
9619         *)      dflt='n' ;;
9620         esac
9621         ;;
9622 *) dflt='n';;
9623 esac
9624 cat <<EOM
9625
9626 Perl can be built to use 'fast stdio', which means using the stdio
9627 library but also directly manipulating the stdio buffers to enable
9628 faster I/O.  Using stdio is better for backward compatibility (especially
9629 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9630 interface has been preferred instead of stdio.
9631
9632 If this doesn't make any sense to you, just accept the default '$dflt'.
9633 EOM
9634 rp='Use the "fast stdio" if available?'
9635 . ./myread
9636 case "$ans" in
9637 y|Y)    val="$define" ;;
9638 *)      val="$undef" ;;
9639 esac
9640 set usefaststdio
9641 eval $setvar
9642
9643
9644 : define an is-a-typedef? function
9645 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9646 case "$inclist" in
9647 "") inclist="sys/types.h";;
9648 esac;
9649 eval "varval=\$$var";
9650 case "$varval" in
9651 "")
9652         $rm -f temp.c;
9653         for inc in $inclist; do
9654                 echo "#include <$inc>" >>temp.c;
9655         done;
9656         echo "#ifdef $type" >> temp.c;
9657         echo "printf(\"We have $type\");" >> temp.c;
9658         echo "#endif" >> temp.c;
9659         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9660         if $contains $type temp.E >/dev/null 2>&1; then
9661                 eval "$var=\$type";
9662         else
9663                 eval "$var=\$def";
9664         fi;
9665         $rm -f temp.?;;
9666 *) eval "$var=\$varval";;
9667 esac'
9668
9669 : define an is-a-typedef? function that prompts if the type is not available.
9670 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9671 case "$inclist" in
9672 "") inclist="sys/types.h";;
9673 esac;
9674 eval "varval=\$$var";
9675 case "$varval" in
9676 "")
9677         $rm -f temp.c;
9678         for inc in $inclist; do
9679                 echo "#include <$inc>" >>temp.c;
9680         done;
9681         echo "#ifdef $type" >> temp.c;
9682         echo "printf(\"We have $type\");" >> temp.c;
9683         echo "#endif" >> temp.c;
9684         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9685         echo " " ;
9686         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9687         if $contains $type temp.E >/dev/null 2>&1; then
9688                 echo "$type found." >&4;
9689                 eval "$var=\$type";
9690         else
9691                 echo "$type NOT found." >&4;
9692                 dflt="$def";
9693                 . ./myread ;
9694                 eval "$var=\$ans";
9695         fi;
9696         $rm -f temp.?;;
9697 *) eval "$var=\$varval";;
9698 esac'
9699
9700 : see what type lseek is declared as in the kernel
9701 rp="What is the type used for lseek's offset on this system?"
9702 set off_t lseektype long stdio.h sys/types.h
9703 eval $typedef_ask
9704
9705 echo " "
9706 echo "Checking to see how big your file offsets are..." >&4
9707 $cat >try.c <<EOCP
9708 #include <sys/types.h>
9709 #include <stdio.h>
9710 int main()
9711 {
9712     printf("%d\n", (int)sizeof($lseektype));
9713     return(0);
9714 }
9715 EOCP
9716 set try
9717 if eval $compile_ok; then
9718         lseeksize=`$run ./try`
9719         echo "Your file offsets are $lseeksize bytes long."
9720 else
9721         dflt=$longsize
9722         echo " "
9723         echo "(I can't seem to compile the test program.  Guessing...)"
9724         rp="What is the size of your file offsets (in bytes)?"
9725         . ./myread
9726         lseeksize="$ans"
9727 fi
9728 $rm_try
9729
9730 : see what type file positions are declared as in the library
9731 rp="What is the type for file position used by fsetpos()?"
9732 set fpos_t fpostype long stdio.h sys/types.h
9733 eval $typedef_ask
9734
9735 : Check size for Fpos_t
9736 echo " "
9737 case "$fpostype" in
9738 *_t) zzz="$fpostype"    ;;
9739 *)   zzz="fpos_t"       ;;
9740 esac
9741 echo "Checking the size of $zzz..." >&4
9742 cat > try.c <<EOCP
9743 #include <sys/types.h>
9744 #include <stdio.h>
9745 #$i_stdlib I_STDLIB
9746 #ifdef I_STDLIB
9747 #include <stdlib.h>
9748 #endif
9749 int main() {
9750     printf("%d\n", (int)sizeof($fpostype));
9751     exit(0);
9752 }
9753 EOCP
9754 set try
9755 if eval $compile_ok; then
9756         yyy=`$run ./try`
9757         case "$yyy" in
9758         '')     fpossize=4
9759                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9760                 ;;
9761         *)      fpossize=$yyy
9762                 echo "Your $zzz is $fpossize bytes long."
9763                 ;;
9764         esac
9765 else
9766         dflt="$longsize"
9767         echo " " >&4
9768         echo "(I can't compile the test program.  Guessing...)" >&4
9769         rp="What is the size of your file positions (in bytes)?"
9770         . ./myread
9771         fpossize="$ans"
9772 fi
9773
9774 : Check for large file support
9775 # Backward compatibility (uselfs is deprecated).
9776 case "$uselfs" in
9777 "$define"|true|[yY]*)
9778         cat <<EOM >&4
9779
9780 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9781 EOM
9782         uselargefiles="$define"
9783         ;;
9784 esac
9785
9786 case "$lseeksize:$fpossize" in
9787 8:8) cat <<EOM
9788
9789 You can have files larger than 2 gigabytes.
9790 EOM
9791    val="$define" ;;
9792 *)    case "$uselargefiles" in
9793    "$undef"|false|[nN]*) dflt='n' ;;
9794    *)   dflt='y' ;;
9795    esac
9796    cat <<EOM
9797
9798 Perl can be built to understand large files (files larger than 2 gigabytes)
9799 on some systems.  To do so, Configure can be run with -Duselargefiles.
9800
9801 If this doesn't make any sense to you, just accept the default '$dflt'.
9802 EOM
9803    rp='Try to understand large files, if available?'
9804    . ./myread
9805    case "$ans" in
9806    y|Y)         val="$define" ;;
9807    *)           val="$undef"  ;;
9808    esac
9809    ;;
9810 esac
9811 set uselargefiles
9812 eval $setvar
9813 : Look for a hint-file generated 'call-back-unit'.  If the
9814 : user has specified that a large files perl is to be built,
9815 : we may need to set or change some other defaults.
9816 if $test -f uselargefiles.cbu; then
9817         echo "Your platform has some specific hints regarding large file builds, using them..."
9818         . ./uselargefiles.cbu
9819 fi
9820 case "$uselargefiles" in
9821 "$define")
9822         if $test -f uselargefiles.cbu; then
9823                 echo " "
9824                 echo "Rechecking to see how big your file offsets are..." >&4
9825                 $cat >try.c <<EOCP
9826 #include <sys/types.h>
9827 #include <stdio.h>
9828 int main()
9829 {
9830     printf("%d\n", (int)sizeof($lseektype));
9831     return(0);
9832 }
9833 EOCP
9834                 set try
9835                 if eval $compile_ok; then
9836                         lseeksize=`$run ./try`
9837                         $echo "Your file offsets are now $lseeksize bytes long."
9838                 else
9839                         dflt="$lseeksize"
9840                         echo " "
9841                         echo "(I can't seem to compile the test program.  Guessing...)"
9842                         rp="What is the size of your file offsets (in bytes)?"
9843                         . ./myread
9844                         lseeksize="$ans"
9845                 fi
9846                 case "$fpostype" in
9847                 *_t) zzz="$fpostype"    ;;
9848                 *)   zzz="fpos_t"       ;;
9849                 esac
9850                 $echo $n "Rechecking the size of $zzz...$c" >&4
9851                 $cat > try.c <<EOCP
9852 #include <sys/types.h>
9853 #include <stdio.h>
9854 #$i_stdlib I_STDLIB
9855 #ifdef I_STDLIB
9856 #include <stdlib.h>
9857 #endif
9858 int main() {
9859     printf("%d\n", (int)sizeof($fpostype));
9860     return(0);
9861 }
9862 EOCP
9863                 set try
9864                 if eval $compile_ok; then
9865                         yyy=`$run ./try`
9866                         dflt="$lseeksize"
9867                         case "$yyy" in
9868                         '')     echo " "
9869                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9870                                 ;;
9871                         *)      fpossize=$yyy
9872                                 echo " $fpossize bytes." >&4
9873                                 ;;
9874                         esac
9875                 else
9876                         dflt="$fpossize"
9877                         echo " "
9878                         echo "(I can't compile the test program.  Guessing...)" >&4
9879                         rp="What is the size of your file positions (in bytes)?"
9880                         . ./myread
9881                         fpossize="$ans"
9882                 fi
9883                 $rm_try
9884         fi
9885         ;;
9886 esac
9887
9888 : Check if we want perlio
9889 useperlio="$define"
9890
9891 : Set the vendorbin variables
9892 case "$vendorprefix" in
9893 '')     d_vendorbin="$undef"
9894         vendorbin=''
9895         vendorbinexp=''
9896         ;;
9897 *)      d_vendorbin="$define"
9898         : determine where vendor-supplied executables go.
9899         case "$vendorbin" in
9900         '') dflt=$vendorprefix/bin ;;
9901         *)      dflt="$vendorbin" ;;
9902         esac
9903         fn=d~+
9904         rp='Pathname for the vendor-supplied executables directory?'
9905         . ./getfile
9906         vendorbin="$ans"
9907         vendorbinexp="$ansexp"
9908         ;;
9909 esac
9910 prefixvar=vendorbin
9911 . ./installprefix
9912
9913 : Set the vendorhtml1dir variables
9914 case "$vendorprefix" in
9915 '')     vendorhtml1dir=''
9916         vendorhtml1direxp=''
9917         ;;
9918 *)      : determine where vendor-supplied html pages go.
9919         : There is no standard location, so try to copy the previously-selected
9920         : directory structure for the core html pages.
9921         : XXX Better default suggestions would be welcome.
9922         case "$vendorhtml1dir" in
9923         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9924         *)      dflt=$vendorhtml1dir ;;
9925         esac
9926         case "$dflt" in
9927         ''|' ') dflt=none ;;
9928         esac
9929         fn=dn+~
9930         rp='Pathname for the vendor-supplied html pages?'
9931         . ./getfile
9932         vendorhtml1dir="$ans"
9933         vendorhtml1direxp="$ansexp"
9934         ;;
9935 esac
9936 : Use ' ' for none so value is preserved next time through Configure
9937 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9938 prefixvar=vendorhtml1dir
9939 . ./installprefix
9940
9941 : Set the vendorhtml3dir variables
9942 case "$vendorprefix" in
9943 '')     vendorhtml3dir=''
9944         vendorhtml3direxp=''
9945         ;;
9946 *)      : determine where vendor-supplied module html pages go.
9947         : There is no standard location, so try to copy the previously-selected
9948         : directory structure for the core html pages.
9949         : XXX Better default suggestions would be welcome.
9950         case "$vendorhtml3dir" in
9951         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9952         *)      dflt=$vendorhtml3dir ;;
9953         esac
9954         case "$dflt" in
9955         ''|' ') dflt=none ;;
9956         esac
9957         fn=dn+~
9958         rp='Pathname for the vendor-supplied html pages?'
9959         . ./getfile
9960         vendorhtml3dir="$ans"
9961         vendorhtml3direxp="$ansexp"
9962         ;;
9963 esac
9964 : Use ' ' for none so value is preserved next time through Configure
9965 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9966 prefixvar=vendorhtml3dir
9967 . ./installprefix
9968
9969 : Set the vendorman1dir variables
9970 case "$vendorprefix" in
9971 '')     vendorman1dir=''
9972         vendorman1direxp=''
9973         ;;
9974 *)      : determine where vendor-supplied manual pages go.
9975         case "$vendorman1dir" in
9976         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9977         *)      dflt=$vendorman1dir ;;
9978         esac
9979         case "$dflt" in
9980         ''|' ') dflt=none ;;
9981         esac
9982         fn=nd~+
9983         rp='Pathname for the vendor-supplied manual section 1 pages?'
9984         . ./getfile
9985         vendorman1dir="$ans"
9986         vendorman1direxp="$ansexp"
9987         ;;
9988 esac
9989 : Use ' ' for none so value is preserved next time through Configure
9990 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9991 prefixvar=vendorman1dir
9992 . ./installprefix
9993
9994 : Set the vendorman3dir variables
9995 case "$vendorprefix" in
9996 '')     vendorman3dir=''
9997         vendorman3direxp=''
9998         ;;
9999 *)      : determine where vendor-supplied module manual pages go.
10000         case "$vendorman3dir" in
10001         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10002         *)      dflt=$vendorman3dir ;;
10003         esac
10004         case "$dflt" in
10005         ''|' ') dflt=none ;;
10006         esac
10007         fn=nd~+
10008         rp='Pathname for the vendor-supplied manual section 3 pages?'
10009         . ./getfile
10010         vendorman3dir="$ans"
10011         vendorman3direxp="$ansexp"
10012         ;;
10013 esac
10014 : Use ' ' for none so value is preserved next time through Configure
10015 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10016 prefixvar=vendorman3dir
10017 . ./installprefix
10018
10019 : Set the vendorscript variables
10020 case "$vendorprefix" in
10021 '')     d_vendorscript="$undef"
10022         vendorscript=''
10023         vendorscriptexp=''
10024         ;;
10025 *)      d_vendorscript="$define"
10026         : determine where vendor-supplied scripts go.
10027         case "$vendorscript" in
10028         '')     dflt=$vendorprefix/script
10029                 $test -d $dflt || dflt=$vendorbin ;;
10030         *)  dflt="$vendorscript" ;;
10031         esac
10032         $cat <<EOM
10033
10034 The installation process will create a directory for
10035 vendor-supplied scripts.
10036
10037 EOM
10038         fn=d~+
10039         rp='Pathname for the vendor-supplied scripts directory?'
10040         . ./getfile
10041         vendorscript="$ans"
10042         vendorscriptexp="$ansexp"
10043         ;;
10044 esac
10045 prefixvar=vendorscript
10046 . ./installprefix
10047
10048 : script used to emit important warnings
10049 cat >warn <<EOS
10050 $startsh
10051 if test \$# -gt 0; then
10052         echo "\$@" >msg
10053 else
10054         cat >msg
10055 fi
10056 echo "*** WARNING:" >&4
10057 sed -e 's/^/*** /' <msg >&4
10058 echo "*** " >&4
10059 cat msg >>config.msg
10060 echo " " >>config.msg
10061 rm -f msg
10062 EOS
10063 chmod +x warn
10064 $eunicefix warn
10065
10066 : see which of string.h or strings.h is needed
10067 echo " "
10068 strings=`./findhdr string.h`
10069 if $test "$strings" && $test -r "$strings"; then
10070         echo "Using <string.h> instead of <strings.h>." >&4
10071         val="$define"
10072 else
10073         val="$undef"
10074         strings=`./findhdr strings.h`
10075         if $test "$strings" && $test -r "$strings"; then
10076                 echo "Using <strings.h> instead of <string.h>." >&4
10077         else
10078                 ./warn "No string header found -- You'll surely have problems."
10079         fi
10080 fi
10081 set i_string
10082 eval $setvar
10083 case "$i_string" in
10084 "$undef") strings=`./findhdr strings.h`;;
10085 *)        strings=`./findhdr string.h`;;
10086 esac
10087
10088 : see if qgcvt exists
10089 set qgcvt d_qgcvt
10090 eval $inlibc
10091
10092 : Check what kind of doubles your system has
10093 $echo "Checking the kind of doubles you have..." >&4
10094 $cat >try.c <<EOP
10095 #$i_stdlib I_STDLIB
10096 #define DOUBLESIZE $doublesize
10097 #ifdef I_STDLIB
10098 #include <stdlib.h>
10099 #endif
10100 #include <stdio.h>
10101 static const double d = -0.1;
10102 int main() {
10103   unsigned const char* b = (unsigned const char*)(&d);
10104 #if DOUBLESIZE == 4
10105   if (b[0] == 0xCD && b[3] == 0xBD) {
10106     /* IEEE 754 32-bit little-endian */
10107     printf("1\n");
10108     exit(0);
10109   }
10110   if (b[0] == 0xBD && b[3] == 0xCD) {
10111     /* IEEE 754 32-bit big-endian */
10112     printf("2\n");
10113     exit(0);
10114   }
10115 #endif
10116 #if DOUBLESIZE == 8
10117   if (b[0] == 0x9A && b[7] == 0xBF) {
10118     /* IEEE 754 64-bit little-endian */
10119     printf("3\n");
10120     exit(0);
10121   }
10122   if (b[0] == 0xBF && b[7] == 0x9A) {
10123     /* IEEE 754 64-bit big-endian */
10124     printf("4\n");
10125     exit(0);
10126   }
10127   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10128    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10129     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10130     * 99 99 b9 bf 9a 99 99 99 */
10131     printf("7\n");
10132     exit(0);
10133   }
10134   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10135    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10136     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10137     * 99 99 99 9a bf b9 99 99 */
10138     printf("8\n");
10139     exit(0);
10140   }
10141 #endif
10142 #if DOUBLESIZE == 16
10143   if (b[0] == 0x9A && b[15] == 0xBF) {
10144     /* IEEE 754 128-bit little-endian */
10145     printf("5\n");
10146     exit(0);
10147   }
10148   if (b[0] == 0xBF && b[15] == 0x9A) {
10149     /* IEEE 754 128-bit big-endian */
10150     printf("6\n");
10151     exit(0);
10152   }
10153 #endif
10154   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
10155    * Whether those environments can still build Perl is debatable. */
10156   printf("-1\n"); /* unknown */
10157   exit(0);
10158 }
10159 EOP
10160 set try
10161 if eval $compile; then
10162     doublekind=`$run ./try`
10163 else
10164     doublekind=-1
10165 fi
10166 case "$doublekind" in
10167 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10168 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10169 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10170 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10171 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10172 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10173 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10174 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10175 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
10176 esac
10177 $rm_try
10178
10179 : Check print/scan long double stuff
10180 echo " "
10181
10182 if $test X"$d_longdbl" = X"$define"; then
10183
10184 echo "Checking how to print long doubles..." >&4
10185
10186 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10187         $cat >try.c <<'EOCP'
10188 #include <sys/types.h>
10189 #include <stdio.h>
10190 int main() {
10191   double d = 123.456;
10192   printf("%.3f\n", d);
10193 }
10194 EOCP
10195         set try
10196         if eval $compile; then
10197                 yyy=`$run ./try`
10198                 case "$yyy" in
10199                 123.456)
10200                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10201                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10202                         echo "We will use %f."
10203                         ;;
10204                 esac
10205         fi
10206 fi
10207
10208 if $test X"$sPRIfldbl" = X; then
10209         $cat >try.c <<'EOCP'
10210 #include <sys/types.h>
10211 #include <stdio.h>
10212 int main() {
10213   long double d = 123.456;
10214   printf("%.3Lf\n", d);
10215 }
10216 EOCP
10217         set try
10218         if eval $compile; then
10219                 yyy=`$run ./try`
10220                 case "$yyy" in
10221                 123.456)
10222                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10223                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10224                         echo "We will use %Lf."
10225                         ;;
10226                 esac
10227         fi
10228 fi
10229
10230 if $test X"$sPRIfldbl" = X; then
10231         $cat >try.c <<'EOCP'
10232 #include <sys/types.h>
10233 #include <stdio.h>
10234 int main() {
10235   long double d = 123.456;
10236   printf("%.3llf\n", d);
10237 }
10238 EOCP
10239         set try
10240         if eval $compile; then
10241                 yyy=`$run ./try`
10242                 case "$yyy" in
10243                 123.456)
10244                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10245                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10246                         echo "We will use %llf."
10247                         ;;
10248                 esac
10249         fi
10250 fi
10251
10252 if $test X"$sPRIfldbl" = X; then
10253         $cat >try.c <<'EOCP'
10254 #include <sys/types.h>
10255 #include <stdio.h>
10256 int main() {
10257   long double d = 123.456;
10258   printf("%.3lf\n", d);
10259 }
10260 EOCP
10261         set try
10262         if eval $compile; then
10263                 yyy=`$run ./try`
10264                 case "$yyy" in
10265                 123.456)
10266                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10267                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10268                         echo "We will use %lf."
10269                         ;;
10270                 esac
10271         fi
10272 fi
10273
10274 if $test X"$sPRIfldbl" = X; then
10275         echo "Cannot figure out how to print long doubles." >&4
10276 else
10277         sSCNfldbl=$sPRIfldbl    # expect consistency
10278 fi
10279
10280 $rm_try
10281
10282 fi # d_longdbl
10283
10284 case "$sPRIfldbl" in
10285 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10286         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10287         d_SCNfldbl="$undef";
10288         ;;
10289 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10290         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10291         d_SCNfldbl="$define";
10292         ;;
10293 esac
10294
10295 : Before committing on uselongdouble, see whether that looks sane.
10296 if $test "$uselongdouble" = "$define"; then
10297     message=""
10298     echo " "
10299     echo "Checking if your long double math functions work right..." >&4
10300     $cat > try.c <<EOF
10301 #include <math.h>
10302 #include <stdio.h>
10303 int main() {
10304   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10305 }
10306 EOF
10307     case "$osname:$gccversion" in
10308     aix:)       saveccflags="$ccflags"
10309                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10310     esac
10311     set try
10312     if eval $compile_ok; then
10313       yyy=`$run ./try`
10314     fi
10315     case "$yyy" in
10316     3) echo "Your long double math functions are working correctly." >&4 ;;
10317     *) echo "Your long double math functions are broken, not using long doubles." >&4
10318        uselongdouble=$undef
10319        ;;
10320     esac
10321     $rm_try
10322     case "$osname:$gccversion" in
10323     aix:)       ccflags="$saveccflags" ;; # restore
10324     esac
10325 fi
10326
10327 : Check how to convert floats to strings.
10328
10329 if test "X$d_Gconvert" = X; then
10330
10331 echo " "
10332 echo "Checking for an efficient way to convert floats to strings."
10333 echo " " > try.c
10334 case "$uselongdouble" in
10335 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10336 esac
10337 case "$d_longdbl" in
10338 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10339 esac
10340 case "$d_PRIgldbl" in
10341 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10342 esac
10343 $cat >>try.c <<EOP
10344 #ifdef TRY_gconvert
10345 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10346 char *myname = "gconvert";
10347 #endif
10348 #ifdef TRY_gcvt
10349 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10350 char *myname = "gcvt";
10351 #endif
10352 #ifdef TRY_qgcvt
10353 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10354 char *myname = "qgcvt";
10355 #define DOUBLETYPE long double
10356 #endif
10357 #ifdef TRY_sprintf
10358 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10359 #ifdef HAS_PRIgldbl
10360 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10361 #else
10362 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10363 #endif
10364 #else
10365 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10366 #endif
10367 char *myname = "sprintf";
10368 #endif
10369
10370 #ifndef DOUBLETYPE
10371 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10372 #define DOUBLETYPE long double
10373 #else
10374 #define DOUBLETYPE double
10375 #endif
10376 #endif
10377
10378 #include <stdio.h>
10379
10380 #$i_stdlib I_STDLIB
10381 #ifdef I_STDLIB
10382 #include <stdlib.h>
10383 #endif
10384 #$i_string I_STRING
10385 #ifdef I_STRING
10386 #  include <string.h>
10387 #else
10388 #  include <strings.h>
10389 #endif
10390
10391 int checkit(char *expect, char *got)
10392 {
10393     if (strcmp(expect, got)) {
10394                 printf("%s oddity:  Expected %s, got %s\n",
10395                         myname, expect, got);
10396                 exit(1);
10397         }
10398 }
10399
10400 int main()
10401 {
10402         char buf[64];
10403         buf[63] = '\0';
10404
10405         /* This must be 1st test on (which?) platform */
10406         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10407         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10408         checkit("0.1", buf);
10409
10410         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10411         checkit("0.01", buf);
10412
10413         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10414         checkit("0.001", buf);
10415
10416         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10417         checkit("0.0001", buf);
10418
10419         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10420         if (strlen(buf) > 5)
10421             checkit("9e-005", buf); /* for Microsoft ?? */
10422         else
10423             checkit("9e-05", buf);
10424
10425         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10426         checkit("1", buf);
10427
10428         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10429         checkit("1.1", buf);
10430
10431         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10432         checkit("1.01", buf);
10433
10434         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10435         checkit("1.001", buf);
10436
10437         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10438         checkit("1.0001", buf);
10439
10440         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10441         checkit("1.00001", buf);
10442
10443         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10444         checkit("1.000001", buf);
10445
10446         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10447         checkit("0", buf);
10448
10449         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10450         checkit("-1", buf);
10451
10452         /* Some Linux gcvt's give 1.e+5 here. */
10453         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10454         checkit("100000", buf);
10455
10456         /* Some Linux gcvt's give -1.e+5 here. */
10457         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10458         checkit("-100000", buf);
10459
10460         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10461         checkit("123.456", buf);
10462
10463         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10464         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10465         /* 34 should be enough to scare even long double
10466          * places into using the e notation. */
10467         if (strlen(buf) > 5)
10468             checkit("1e+034", buf); /* for Microsoft */
10469         else
10470             checkit("1e+34", buf);
10471
10472         /* For Perl, if you add additional tests here, also add them to
10473          * t/base/num.t for benefit of platforms not using Configure or
10474          * overriding d_Gconvert */
10475
10476         exit(0);
10477 }
10478 EOP
10479 : first add preferred functions to our list
10480 xxx_list=""
10481 for xxx_convert in $gconvert_preference; do
10482     case $xxx_convert in
10483     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10484     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10485     esac
10486 done
10487 : then add any others
10488 for xxx_convert in gconvert gcvt sprintf; do
10489     case "$xxx_list" in
10490     *$xxx_convert*) ;;
10491     *) xxx_list="$xxx_list $xxx_convert" ;;
10492     esac
10493 done
10494
10495 case "$d_longdbl$uselongdouble" in
10496 "$define$define")
10497     : again, add preferred functions to our list first
10498     xxx_ld_list=""
10499     for xxx_convert in $gconvert_ld_preference; do
10500         case $xxx_convert in
10501         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10502         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10503         esac
10504     done
10505     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10506     for xxx_convert in qgcvt sprintf $xxx_list; do
10507         case "$xxx_ld_list" in
10508         $xxx_convert*|*" $xxx_convert"*) ;;
10509         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10510         esac
10511     done
10512     : if sprintf cannot do long doubles, move it to the end
10513     if test "$d_PRIgldbl" != "$define"; then
10514         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10515     fi
10516     : if no qgcvt, remove it
10517     if test "$d_qgcvt" != "$define"; then
10518         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10519     fi
10520     : use the ld_list
10521     xxx_list="$xxx_ld_list"
10522     ;;
10523 esac
10524
10525 for xxx_convert in $xxx_list; do
10526         echo "Trying $xxx_convert..."
10527         $rm -f try try$_o core
10528         set try -DTRY_$xxx_convert
10529         if eval $compile; then
10530                 echo "$xxx_convert() found." >&4
10531                 if $run ./try; then
10532                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10533                         break;
10534                 else
10535                         echo "...But $xxx_convert didn't work as I expected."
10536                         xxx_convert=''
10537                 fi
10538         else
10539                 echo "$xxx_convert NOT found." >&4
10540         fi
10541 done
10542
10543 if test X$xxx_convert = X; then
10544     echo "*** WHOA THERE!!! ***" >&4
10545     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10546     xxx_convert=sprintf
10547 fi
10548
10549 case "$xxx_convert" in
10550 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10551 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10552 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10553 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10554    "$define$define$define")
10555       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10556    "$define$define$undef")
10557       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10558    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10559    esac
10560    ;;
10561 esac
10562
10563 fi
10564 $rm_try
10565
10566 : see if _fwalk exists
10567 set fwalk d__fwalk
10568 eval $inlibc
10569
10570 : Initialize h_fcntl
10571 h_fcntl=false
10572
10573 : Initialize h_sysfile
10574 h_sysfile=false
10575
10576 : access call always available on UNIX
10577 set access d_access
10578 eval $inlibc
10579
10580 : locate the flags for 'access()'
10581 case "$d_access" in
10582 "$define")
10583         echo " "
10584         $cat >access.c <<EOCP
10585 #include <sys/types.h>
10586 #ifdef I_FCNTL
10587 #include <fcntl.h>
10588 #endif
10589 #ifdef I_SYS_FILE
10590 #include <sys/file.h>
10591 #endif
10592 #ifdef I_UNISTD
10593 #include <unistd.h>
10594 #endif
10595 #$i_stdlib I_STDLIB
10596 #ifdef I_STDLIB
10597 #include <stdlib.h>
10598 #endif
10599 int main() {
10600         exit(R_OK);
10601 }
10602 EOCP
10603         : check sys/file.h first, no particular reason here
10604         if $test `./findhdr sys/file.h` && \
10605                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10606                 h_sysfile=true;
10607                 echo "<sys/file.h> defines the *_OK access constants." >&4
10608         elif $test `./findhdr fcntl.h` && \
10609                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10610                 h_fcntl=true;
10611                 echo "<fcntl.h> defines the *_OK access constants." >&4
10612         elif $test `./findhdr unistd.h` && \
10613                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10614                 echo "<unistd.h> defines the *_OK access constants." >&4
10615         else
10616                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10617         fi
10618         ;;
10619 esac
10620 $rm -f access*
10621
10622 : see if accessx exists
10623 set accessx d_accessx
10624 eval $inlibc
10625
10626 : see if acosh exists
10627 set acosh d_acosh
10628 eval $inlibc
10629
10630 : see if aintl exists
10631 set aintl d_aintl
10632 eval $inlibc
10633
10634 : see if alarm exists
10635 set alarm d_alarm
10636 eval $inlibc
10637
10638 : see if 64bit time functions exists
10639
10640 set ctime64 d_ctime64
10641 eval $inlibc
10642
10643 set localtime64 d_localtime64
10644 eval $inlibc
10645
10646 set gmtime64 d_gmtime64
10647 eval $inlibc
10648
10649 set mktime64 d_mktime64
10650 eval $inlibc
10651
10652 set difftime64 d_difftime64
10653 eval $inlibc
10654
10655 set asctime64 d_asctime64
10656 eval $inlibc
10657
10658 : see if POSIX threads are available
10659 set pthread.h i_pthread
10660 eval $inhdr
10661
10662 : define a function to check prototypes
10663 $cat > protochk <<EOSH
10664 $startsh
10665 cc="$cc"
10666 optimize="$optimize"
10667 ccflags="$ccflags"
10668 prototype="$prototype"
10669 define="$define"
10670 rm_try="$rm_try"
10671 usethreads=$usethreads
10672 i_pthread=$i_pthread
10673 pthread_h_first=$pthread_h_first
10674 EOSH
10675
10676 $cat >> protochk <<'EOSH'
10677
10678 $rm_try
10679 foo="$1"
10680 shift
10681 while test $# -ge 2; do
10682         case "$1" in
10683                 $define) echo "#include <$2>" >> try.c ;;
10684                 literal) echo "$2" >> try.c ;;
10685         esac
10686     # Extra magic for the benefit of systems that need pthread.h
10687     # to be included early to correctly detect threadsafe functions.
10688     # Such functions must guarantee themselves, though, that the usethreads
10689     # and i_pthread have been defined, before calling protochk.
10690     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10691         echo "#include <pthread.h>" >> try.c
10692         pthread_h_done=yes
10693     fi
10694     shift 2
10695 done
10696 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10697 cat >> try.c <<'EOCP'
10698 #ifdef CAN_PROTOTYPE
10699 #define _(args) args
10700 #else
10701 #define _(args) ()
10702 #endif
10703 EOCP
10704 echo "$foo" >> try.c
10705 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10706 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10707 status=$?
10708 $rm_try
10709 exit $status
10710 EOSH
10711 chmod +x protochk
10712 $eunicefix protochk
10713
10714 : Define hasproto macro for Configure internal use
10715 hasproto='varname=$1; func=$2; shift; shift;
10716 while $test $# -ge 2; do
10717         case "$1" in
10718         $define) echo "#include <$2>";;
10719         esac ;
10720     shift 2;
10721 done > try.c;
10722 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10723 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10724         echo "$func() prototype found.";
10725         val="$define";
10726 else
10727         echo "$func() prototype NOT found.";
10728         val="$undef";
10729 fi;
10730 set $varname;
10731 eval $setvar;
10732 $rm_try tryout.c'
10733
10734 : see if sys/types.h has to be included
10735 set sys/types.h i_systypes
10736 eval $inhdr
10737
10738 : see if sys/select.h has to be included
10739 set sys/select.h i_sysselct
10740 eval $inhdr
10741
10742 : Define hasfield macro for Configure internal use
10743 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10744 while $test $# -ge 2; do
10745         case "$1" in
10746         $define) echo "#include <$2>";;
10747         esac ;
10748     shift 2;
10749 done > try.c;
10750 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10751 set try;
10752 if eval $compile; then
10753         val="$define";
10754 else
10755         val="$undef";
10756 fi;
10757 set $varname;
10758 eval $setvar;
10759 $rm_try'
10760
10761 : see if we should include time.h, sys/time.h, or both
10762 echo " "
10763 if test "X$timeincl" = X; then
10764         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10765         $echo $n "I'm now running the test program...$c"
10766         $cat >try.c <<EOCP
10767 #include <sys/types.h>
10768 #ifdef I_TIME
10769 #include <time.h>
10770 #endif
10771 #ifdef I_SYSTIME
10772 #ifdef SYSTIMEKERNEL
10773 #define KERNEL
10774 #endif
10775 #include <sys/time.h>
10776 #endif
10777 #ifdef I_SYSSELECT
10778 #include <sys/select.h>
10779 #endif
10780 #$i_stdlib I_STDLIB
10781 #ifdef I_STDLIB
10782 #include <stdlib.h>
10783 #endif
10784 int main()
10785 {
10786         struct tm foo;
10787 #ifdef S_TIMEVAL
10788         struct timeval bar;
10789 #endif
10790 #ifdef S_TIMEZONE
10791         struct timezone tzp;
10792 #endif
10793         if (foo.tm_sec == foo.tm_sec)
10794                 exit(0);
10795 #ifdef S_TIMEVAL
10796         if (bar.tv_sec == bar.tv_sec)
10797                 exit(0);
10798 #endif
10799         exit(1);
10800 }
10801 EOCP
10802         flags=''
10803         for s_timezone in '-DS_TIMEZONE' ''; do
10804         sysselect=''
10805         for s_timeval in '-DS_TIMEVAL' ''; do
10806         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10807         for i_time in '' '-DI_TIME'; do
10808         for i_systime in '-DI_SYSTIME' ''; do
10809                 case "$flags" in
10810                 '') $echo $n ".$c"
10811                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10812                         if eval $compile; then
10813                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10814                                 shift
10815                                 flags="$*"
10816                                 echo " "
10817                                 $echo $n "Succeeded with $flags$c"
10818                         fi
10819                         ;;
10820                 esac
10821         done
10822         done
10823         done
10824         done
10825         done
10826         timeincl=''
10827         echo " "
10828         case "$flags" in
10829         *SYSTIMEKERNEL*) i_systimek="$define"
10830                 timeincl=`./findhdr sys/time.h`
10831                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10832         *) i_systimek="$undef";;
10833         esac
10834         case "$flags" in
10835         *I_TIME*) i_time="$define"
10836                 timeincl=`./findhdr time.h`" $timeincl"
10837                 echo "We'll include <time.h>." >&4;;
10838         *) i_time="$undef";;
10839         esac
10840         case "$flags" in
10841         *I_SYSTIME*) i_systime="$define"
10842                 timeincl=`./findhdr sys/time.h`" $timeincl"
10843                 echo "We'll include <sys/time.h>." >&4;;
10844         *) i_systime="$undef";;
10845         esac
10846         $rm_try
10847 fi
10848 : see if struct tm knows about tm_zone
10849 case "$i_systime$i_time" in
10850 *$define*)
10851         echo " "
10852         echo "Checking to see if your struct tm has tm_zone field..." >&4
10853         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10854         eval $hasfield
10855         ;;
10856 *)      val="$undef"
10857         set d_tm_tm_zone
10858         eval $setvar
10859         ;;
10860 esac
10861 case "$d_tm_tm_zone" in
10862 "$define")      echo "Yes, it does."   ;;
10863 *)              echo "No, it doesn't." ;;
10864 esac
10865 : see if struct tm knows about tm_gmtoff
10866 case "$i_systime$i_time" in
10867 *$define*)
10868         echo " "
10869         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10870         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10871         eval $hasfield
10872         ;;
10873 *)      val="$undef"
10874         set d_tm_tm_gmtoff
10875         eval $setvar
10876         ;;
10877 esac
10878 case "$d_tm_tm_gmtoff" in
10879 "$define")      echo "Yes, it does."   ;;
10880 *)              echo "No, it doesn't." ;;
10881 esac
10882
10883 : see if asctime_r exists
10884 set asctime_r d_asctime_r
10885 eval $inlibc
10886 case "$d_asctime_r" in
10887 "$define")
10888         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10889         case "$d_asctime_r_proto:$usethreads" in
10890         ":define")      d_asctime_r_proto=define
10891                 set d_asctime_r_proto asctime_r $hdrs
10892                 eval $hasproto ;;
10893         *)      ;;
10894         esac
10895         case "$d_asctime_r_proto" in
10896         define)
10897         case "$asctime_r_proto" in
10898         ''|0) try='char* asctime_r(const struct tm*, char*);'
10899         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10900         esac
10901         case "$asctime_r_proto" in
10902         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10903         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10904         esac
10905         case "$asctime_r_proto" in
10906         ''|0) try='int asctime_r(const struct tm*, char*);'
10907         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10908         esac
10909         case "$asctime_r_proto" in
10910         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10911         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10912         esac
10913         case "$asctime_r_proto" in
10914         ''|0)   d_asctime_r=undef
10915                 asctime_r_proto=0
10916                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10917         * )     case "$asctime_r_proto" in
10918                 REENTRANT_PROTO*) ;;
10919                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10920                 esac
10921                 echo "Prototype: $try" ;;
10922         esac
10923         ;;
10924         *)      case "$usethreads" in
10925                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10926                 esac
10927                 d_asctime_r=undef
10928                 asctime_r_proto=0
10929                 ;;
10930         esac
10931         ;;
10932 *)      asctime_r_proto=0
10933         ;;
10934 esac
10935
10936 : see if asinh exists
10937 set asinh d_asinh
10938 eval $inlibc
10939
10940 : see if atanh exists
10941 set atanh d_atanh
10942 eval $inlibc
10943
10944 : see if atolf exists
10945 set atolf d_atolf
10946 eval $inlibc
10947
10948 : see if atoll exists
10949 set atoll d_atoll
10950 eval $inlibc
10951
10952 : Look for GCC-style attribute format
10953 case "$d_attribute_format" in
10954 '')
10955 echo " "
10956 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10957 $cat >attrib.c <<'EOCP'
10958 #include <stdio.h>
10959 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10960 EOCP
10961 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10962         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10963                 echo "Your C compiler doesn't support __attribute__((format))."
10964                 val="$undef"
10965         else
10966                 echo "Your C compiler supports __attribute__((format))."
10967                 val="$define"
10968         fi
10969 else
10970         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10971         val="$undef"
10972 fi
10973 ;;
10974 *) val="$d_attribute_format" ;;
10975 esac
10976 set d_attribute_format
10977 eval $setvar
10978 $rm -f attrib*
10979
10980 : Look for GCC-style attribute format with null format allowed
10981 case "$d_printf_format_null" in
10982 '') case "$d_attribute_format" in
10983     $define)
10984         echo " "
10985         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10986 $cat >attrib.c <<EOCP
10987 #include <stdio.h>
10988 #$i_stdlib I_STDLIB
10989 #ifdef I_STDLIB
10990 #include <stdlib.h>
10991 #endif
10992 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10993 int null_printf (char* pat,...) { return (int)pat; }
10994 int main () { exit(null_printf(NULL)); }
10995 EOCP
10996         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10997             : run the executable in case it produces a run-time warning
10998             if $run ./attrib >>attrib.out 2>&1; then
10999                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11000                     echo "Your C compiler doesn't allow __printf__ format to be null."
11001                     val="$undef"
11002                 else
11003                     echo "Your C compiler allows __printf__ format to be null."
11004                     val="$define"
11005                 fi
11006             else
11007             echo "Your C compiler executable failed with __printf__ format null."
11008             val="$undef"
11009         fi
11010     else
11011         echo "Your C compiler fails with __printf__ format null."
11012         val="$undef"
11013     fi
11014     ;;
11015     *)  val="$undef" ;;
11016     esac
11017 ;;
11018 *)  val="$d_printf_format_null" ;;
11019 esac
11020 set d_printf_format_null
11021 eval $setvar
11022 $rm -f attrib*
11023
11024 : Look for GCC-style attribute malloc
11025 case "$d_attribute_malloc" in
11026 '')
11027 echo " "
11028 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11029 $cat >attrib.c <<'EOCP'
11030 #include <stdio.h>
11031 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11032 EOCP
11033 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11034         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11035                 echo "Your C compiler doesn't support __attribute__((malloc))."
11036                 val="$undef"
11037         else
11038                 echo "Your C compiler supports __attribute__((malloc))."
11039                 val="$define"
11040         fi
11041 else
11042         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11043         val="$undef"
11044 fi
11045 ;;
11046 *) val="$d_attribute_malloc" ;;
11047 esac
11048 set d_attribute_malloc
11049 eval $setvar
11050 $rm -f attrib*
11051
11052 : Look for GCC-style attribute nonnull
11053 case "$d_attribute_nonnull" in
11054 '')
11055 echo " "
11056 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11057 $cat >attrib.c <<'EOCP'
11058 #include <stdio.h>
11059 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11060 EOCP
11061 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11062         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11063                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11064                 val="$undef"
11065         else
11066                 echo "Your C compiler supports __attribute__((nonnull))."
11067                 val="$define"
11068         fi
11069 else
11070         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11071         val="$undef"
11072 fi
11073 ;;
11074 *) val="$d_attribute_nonnull" ;;
11075 esac
11076 set d_attribute_nonnull
11077 eval $setvar
11078 $rm -f attrib*
11079
11080 : Look for GCC-style attribute noreturn
11081 case "$d_attribute_noreturn" in
11082 '')
11083 echo " "
11084 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11085 $cat >attrib.c <<'EOCP'
11086 #include <stdio.h>
11087 void fall_over_dead( void ) __attribute__((noreturn));
11088 EOCP
11089 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11090         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11091                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11092                 val="$undef"
11093         else
11094                 echo "Your C compiler supports __attribute__((noreturn))."
11095                 val="$define"
11096         fi
11097 else
11098         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11099         val="$undef"
11100 fi
11101 ;;
11102 *) val="$d_attribute_noreturn" ;;
11103 esac
11104 set d_attribute_noreturn
11105 eval $setvar
11106 $rm -f attrib*
11107
11108 : Look for GCC-style attribute pure
11109 case "$d_attribute_pure" in
11110 '')
11111 echo " "
11112 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11113 $cat >attrib.c <<'EOCP'
11114 #include <stdio.h>
11115 int square( int n ) __attribute__((pure));
11116 EOCP
11117 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11118         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11119                 echo "Your C compiler doesn't support __attribute__((pure))."
11120                 val="$undef"
11121         else
11122                 echo "Your C compiler supports __attribute__((pure))."
11123                 val="$define"
11124         fi
11125 else
11126         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11127         val="$undef"
11128 fi
11129 ;;
11130 *) val="$d_attribute_pure" ;;
11131 esac
11132 set d_attribute_pure
11133 eval $setvar
11134 $rm -f attrib*
11135
11136 : Look for GCC-style attribute unused
11137 case "$d_attribute_unused" in
11138 '')
11139 echo " "
11140 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11141 $cat >attrib.c <<'EOCP'
11142 #include <stdio.h>
11143 int do_something( int dummy __attribute__((unused)), int n );
11144 EOCP
11145 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11146         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11147                 echo "Your C compiler doesn't support __attribute__((unused))."
11148                 val="$undef"
11149         else
11150                 echo "Your C compiler supports __attribute__((unused))."
11151                 val="$define"
11152         fi
11153 else
11154         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11155         val="$undef"
11156 fi
11157 ;;
11158 *) val="$d_attribute_unused" ;;
11159 esac
11160 set d_attribute_unused
11161 eval $setvar
11162 $rm -f attrib*
11163
11164 : Look for GCC-style attribute deprecated
11165 case "$d_attribute_deprecated" in
11166 '')
11167 echo " "
11168 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11169 $cat >attrib.c <<'EOCP'
11170 #include <stdio.h>
11171 int I_am_deprecated(void) __attribute__((deprecated));
11172 EOCP
11173 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11174         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11175                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11176                 val="$undef"
11177         else
11178                 echo "Your C compiler supports __attribute__((deprecated))."
11179                 val="$define"
11180         fi
11181 else
11182         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11183         val="$undef"
11184 fi
11185 ;;
11186 *) val="$d_attribute_deprecated" ;;
11187 esac
11188 set d_attribute_deprecated
11189 eval $setvar
11190 $rm -f attrib*
11191
11192 : Look for GCC-style attribute warn_unused_result
11193 case "$d_attribute_warn_unused_result" in
11194 '')
11195 echo " "
11196 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11197 $cat >attrib.c <<'EOCP'
11198 #include <stdio.h>
11199 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11200 EOCP
11201 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11202         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11203                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11204                 val="$undef"
11205         else
11206                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11207                 val="$define"
11208         fi
11209 else
11210         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11211         val="$undef"
11212 fi
11213 ;;
11214 *) val="$d_attribute_warn_unused_result" ;;
11215 esac
11216 set d_attribute_warn_unused_result
11217 eval $setvar
11218 $rm -f attrib*
11219
11220 : see if bcmp exists
11221 set bcmp d_bcmp
11222 eval $inlibc
11223
11224 : see if bcopy exists
11225 set bcopy d_bcopy
11226 eval $inlibc
11227
11228 : see if getpgrp exists
11229 set getpgrp d_getpgrp
11230 eval $inlibc
11231
11232 case "$d_getpgrp" in
11233 "$define")
11234         echo " "
11235         echo "Checking to see which flavor of getpgrp is in use..."
11236         $cat >try.c <<EOP
11237 #$i_unistd I_UNISTD
11238 #include <sys/types.h>
11239 #ifdef I_UNISTD
11240 #  include <unistd.h>
11241 #endif
11242 #$i_stdlib I_STDLIB
11243 #ifdef I_STDLIB
11244 #include <stdlib.h>
11245 #endif
11246 int main()
11247 {
11248         if (getuid() == 0) {
11249                 printf("(I see you are running Configure as super-user...)\n");
11250                 setuid(1);
11251         }
11252 #ifdef TRY_BSD_PGRP
11253         if (getpgrp(1) == 0)
11254                 exit(0);
11255 #else
11256         if (getpgrp() > 0)
11257                 exit(0);
11258 #endif
11259         exit(1);
11260 }
11261 EOP
11262         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11263                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11264                 val="$define"
11265         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11266                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11267                 val="$undef"
11268         else
11269                 echo "I can't seem to compile and run the test program."
11270                 if ./usg; then
11271                         xxx="a USG one, i.e. you use getpgrp()."
11272                 else
11273                         # SVR4 systems can appear rather BSD-ish.
11274                         case "$i_unistd" in
11275                         $undef)
11276                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11277                                 val="$define"
11278                                 ;;
11279                         $define)
11280                                 xxx="probably a USG one, i.e. you use getpgrp()."
11281                                 val="$undef"
11282                                 ;;
11283                         esac
11284                 fi
11285                 echo "Assuming your getpgrp is $xxx" >&4
11286         fi
11287         ;;
11288 *) val="$undef";;
11289 esac
11290 set d_bsdgetpgrp
11291 eval $setvar
11292 $rm_try
11293
11294 : see if setpgrp exists
11295 set setpgrp d_setpgrp
11296 eval $inlibc
11297
11298 case "$d_setpgrp" in
11299 "$define")
11300         echo " "
11301         echo "Checking to see which flavor of setpgrp is in use..."
11302         $cat >try.c <<EOP
11303 #$i_unistd I_UNISTD
11304 #include <sys/types.h>
11305 #ifdef I_UNISTD
11306 #  include <unistd.h>
11307 #endif
11308 #$i_stdlib I_STDLIB
11309 #ifdef I_STDLIB
11310 #include <stdlib.h>
11311 #endif
11312 int main()
11313 {
11314         if (getuid() == 0) {
11315                 printf("(I see you are running Configure as super-user...)\n");
11316                 setuid(1);
11317         }
11318 #ifdef TRY_BSD_PGRP
11319         if (-1 == setpgrp(1, 1))
11320                 exit(0);
11321 #else
11322         if (setpgrp() != -1)
11323                 exit(0);
11324 #endif
11325         exit(1);
11326 }
11327 EOP
11328         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11329                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11330                 val="$define"
11331         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11332                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11333                 val="$undef"
11334         else
11335                 echo "(I can't seem to compile and run the test program.)"
11336                 if ./usg; then
11337                         xxx="a USG one, i.e. you use setpgrp()."
11338                 else
11339                         # SVR4 systems can appear rather BSD-ish.
11340                         case "$i_unistd" in
11341                         $undef)
11342                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11343                                 val="$define"
11344                                 ;;
11345                         $define)
11346                                 xxx="probably a USG one, i.e. you use setpgrp()."
11347                                 val="$undef"
11348                                 ;;
11349                         esac
11350                 fi
11351                 echo "Assuming your setpgrp is $xxx" >&4
11352         fi
11353         ;;
11354 *) val="$undef";;
11355 esac
11356 set d_bsdsetpgrp
11357 eval $setvar
11358 $rm_try
11359
11360 : Look for GCC-style __builtin_choose_expr
11361 case "$d_builtin_choose_expr" in
11362 '')
11363     echo " "
11364     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11365     $cat >try.c <<'EOCP'
11366 #include <assert.h>
11367 #include <stdlib.h>
11368 #include <stdio.h>
11369
11370 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11371
11372 int main(void) {
11373     assert( SYRINX(1) == 2112 );
11374     assert( SYRINX(1) != 5150 );
11375     assert( SYRINX(0) == 5150 );
11376     assert( SYRINX(0) != 2112 );
11377     puts( "All good!" );
11378     exit(0);
11379 }
11380
11381 EOCP
11382     set try
11383     if eval $compile && $run ./try; then
11384         echo "Your C compiler supports __builtin_choose_expr."
11385         val="$define"
11386     else
11387         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11388         val="$undef"
11389     fi
11390 ;;
11391 *) val="$d_builtin_choose_expr" ;;
11392 esac
11393
11394 set d_builtin_choose_expr
11395 eval $setvar
11396 $rm_try
11397
11398 : Look for GCC-style __builtin_expect
11399 case "$d_builtin_expect" in
11400 '')
11401     echo " "
11402     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11403     $cat >try.c <<'EOCP'
11404 int main(void) {
11405     int n = 50;
11406     if ( __builtin_expect(n, 0) ) n = 1;
11407     /* Remember shell exit code truth is 0, C truth is non-zero */
11408     return !(n == 1);
11409 }
11410 EOCP
11411     set try
11412     if eval $compile && $run ./try; then
11413         echo "Your C compiler supports __builtin_expect."
11414         val="$define"
11415     else
11416         echo "Your C compiler doesn't seem to understand __builtin_expect."
11417         val="$undef"
11418     fi
11419     ;;
11420 *) val="$d_builtin_expect" ;;
11421 esac
11422
11423 set d_builtin_expect
11424 eval $setvar
11425 $rm_try
11426
11427 : see if bzero exists
11428 set bzero d_bzero
11429 eval $inlibc
11430
11431 : see if stdarg is available
11432 echo " "
11433 if $test `./findhdr stdarg.h`; then
11434         echo "<stdarg.h> found." >&4
11435         valstd="$define"
11436 else
11437         echo "<stdarg.h> NOT found." >&4
11438         valstd="$undef"
11439 fi
11440
11441 : see if varargs is available
11442 echo " "
11443 if $test `./findhdr varargs.h`; then
11444         echo "<varargs.h> found." >&4
11445 else
11446         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11447 fi
11448
11449 : set up the varargs testing programs
11450 $cat > varargs.c <<EOP
11451 #ifdef I_STDARG
11452 #include <stdarg.h>
11453 #endif
11454 #ifdef I_VARARGS
11455 #include <varargs.h>
11456 #endif
11457
11458 #ifdef I_STDARG
11459 int f(char *p, ...)
11460 #else
11461 int f(va_alist)
11462 va_dcl
11463 #endif
11464 {
11465         va_list ap;
11466 #ifndef I_STDARG
11467         char *p;
11468 #endif
11469 #ifdef I_STDARG
11470         va_start(ap,p);
11471 #else
11472         va_start(ap);
11473         p = va_arg(ap, char *);
11474 #endif
11475         va_end(ap);
11476         return 0;
11477 }
11478 EOP
11479 $cat > varargs <<EOP
11480 $startsh
11481 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11482         echo "true"
11483 else
11484         echo "false"
11485 fi
11486 $rm -f varargs$_o
11487 EOP
11488 chmod +x varargs
11489
11490 : now check which varargs header should be included
11491 echo " "
11492 i_varhdr=''
11493 val=''
11494 case "$valstd" in
11495 "$define")
11496         if `./varargs I_STDARG`; then
11497                 val='stdarg.h'
11498         elif `./varargs I_VARARGS`; then
11499                 val='varargs.h'
11500         fi
11501         ;;
11502 *)
11503         if `./varargs I_VARARGS`; then
11504                 val='varargs.h'
11505         fi
11506         ;;
11507 esac
11508 case "$val" in
11509 '')
11510         echo " "
11511         echo "*** WHOA THERE!!! ***" >&4
11512         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11513         case "$knowitall" in
11514         '')
11515         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11516                 exit 1
11517                 ;;
11518         esac
11519 echo "I could not find the definition for va_dcl... You have problems..." >&4
11520         val="$undef"; set i_stdarg; eval $setvar
11521         val="$undef"; set i_varargs; eval $setvar
11522         ;;
11523 *)
11524         set i_varhdr
11525         eval $setvar
11526         case "$i_varhdr" in
11527         stdarg.h)
11528                 val="$define"; set i_stdarg; eval $setvar
11529                 val="$undef"; set i_varargs; eval $setvar
11530                 ;;
11531         varargs.h)
11532                 val="$undef"; set i_stdarg; eval $setvar
11533                 val="$define"; set i_varargs; eval $setvar
11534                 ;;
11535         esac
11536         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11537 esac
11538 $rm -f varargs*
11539
11540 : see if the Compiler supports C99 variadic macros
11541 case "$i_stdarg$i_stdlib" in
11542     "$define$define")
11543     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11544     $cat >try.c <<EOCP
11545 #include <stdio.h>
11546 #include <stdarg.h>
11547
11548 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11549
11550 int main() {
11551   char buf[20];
11552   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11553   puts(buf);
11554   return 0;
11555 }
11556 EOCP
11557     set try
11558     if eval $compile && $run ./try 2>&1 >/dev/null; then
11559         case "`$run ./try`" in
11560             "123 456 789")
11561             echo "You have C99 variadic macros." >&4
11562             d_c99_variadic_macros="$define"
11563             ;;
11564             *)
11565             echo "You don't have functional C99 variadic macros." >&4
11566             d_c99_variadic_macros="$undef"
11567             ;;
11568         esac
11569     else
11570         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11571         d_c99_variadic_macros="$undef"
11572     fi
11573     $rm_try
11574     ;;
11575     *)
11576     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11577     d_c99_variadic_macros="$undef"
11578     ;;
11579 esac
11580
11581 : see if signal is declared as pointer to function returning int or void
11582 echo " "
11583 xxx=`./findhdr signal.h`
11584 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11585 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11586         echo "You have int (*signal())() instead of void." >&4
11587         val="$undef"
11588 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11589         echo "You have void (*signal())()." >&4
11590         val="$define"
11591 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11592         echo "You have int (*signal())() instead of void." >&4
11593         val="$undef"
11594 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11595         echo "You have void (*signal())()." >&4
11596         val="$define"
11597 else
11598         case "$d_voidsig" in
11599         '')
11600         echo "I can't determine whether signal handler returns void or int..." >&4
11601                 dflt=void
11602                 rp="What type does your signal handler return?"
11603                 . ./myread
11604                 case "$ans" in
11605                 v*) val="$define";;
11606                 *) val="$undef";;
11607                 esac;;
11608         "$define")
11609                 echo "As you already told me, signal handler returns void." >&4
11610                 val="$define"
11611                 ;;
11612         *)      echo "As you already told me, signal handler returns int." >&4
11613                 val="$undef"
11614                 ;;
11615         esac
11616 fi
11617 set d_voidsig
11618 eval $setvar
11619 case "$d_voidsig" in
11620 "$define") signal_t="void";;
11621 *) signal_t="int";;
11622 esac
11623 $rm -f $$.tmp
11624
11625 : check for ability to cast large floats to 32-bit ints.
11626 echo " "
11627 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11628 if $test "$intsize" -ge 4; then
11629         xxx=int
11630 else
11631         xxx=long
11632 fi
11633 $cat >try.c <<EOCP
11634 #include <stdio.h>
11635 #$i_stdlib I_STDLIB
11636 #ifdef I_STDLIB
11637 #include <stdlib.h>
11638 #endif
11639 #include <sys/types.h>
11640 #include <signal.h>
11641 $signal_t blech(int s) { exit(3); }
11642 int main()
11643 {
11644         $xxx i32;
11645         double f, g;
11646         int result = 0;
11647         char str[16];
11648         signal(SIGFPE, blech);
11649
11650         /* Don't let compiler optimize the test away.  Store the number
11651            in a writable string for gcc to pass to sscanf under HP-UX.
11652         */
11653         sprintf(str, "2147483647");
11654         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11655         g = 10 * f;
11656         i32  = ($xxx) g;
11657
11658         /* x86 processors will probably give 0x8000 0000, which is a
11659            sign change.  We don't want that.  We want to mimic SPARC
11660            behavior here, which is to preserve the sign and give
11661            back 0x7fff ffff.
11662         */
11663         if (i32 != ($xxx) f)
11664                 result |= 1;
11665         exit(result);
11666 }
11667 EOCP
11668 set try
11669 if eval $compile_ok; then
11670         $run ./try 2>/dev/null
11671         yyy=$?
11672 else
11673         echo "(I can't seem to compile the test program--assuming it can't)"
11674         yyy=1
11675 fi
11676 case "$yyy" in
11677 0)      val="$define"
11678         echo "Yup, it can."
11679         ;;
11680 *)      val="$undef"
11681         echo "Nope, it can't."
11682         ;;
11683 esac
11684 set d_casti32
11685 eval $setvar
11686 $rm_try
11687
11688 : check for ability to cast negative floats to unsigned
11689 echo " "
11690 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11691 $cat >try.c <<EOCP
11692 #include <stdio.h>
11693 #$i_stdlib I_STDLIB
11694 #ifdef I_STDLIB
11695 #include <stdlib.h>
11696 #endif
11697 #include <sys/types.h>
11698 #include <signal.h>
11699 $signal_t blech(int s) { exit(7); }
11700 $signal_t blech_in_list(int s) { exit(4); }
11701 unsigned long dummy_long(unsigned long p) { return p; }
11702 unsigned int dummy_int(unsigned int p) { return p; }
11703 unsigned short dummy_short(unsigned short p) { return p; }
11704 int main()
11705 {
11706         double f;
11707         unsigned long along;
11708         unsigned int aint;
11709         unsigned short ashort;
11710         int result = 0;
11711         char str[16];
11712
11713         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11714            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11715            optimized the whole file away
11716         */
11717         /* Store the number in a writable string for gcc to pass to
11718            sscanf under HP-UX.
11719         */
11720         sprintf(str, "-123");
11721         sscanf(str, "%lf", &f);  /* f = -123.; */
11722
11723         signal(SIGFPE, blech);
11724         along = (unsigned long)f;
11725         aint = (unsigned int)f;
11726         ashort = (unsigned short)f;
11727         if (along != (unsigned long)-123)
11728                 result |= 1;
11729         if (aint != (unsigned int)-123)
11730                 result |= 1;
11731         if (ashort != (unsigned short)-123)
11732                 result |= 1;
11733         sprintf(str, "1073741824.");
11734         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11735         f = f + f;
11736         along = 0;
11737         along = (unsigned long)f;
11738         if (along != 0x80000000)
11739                 result |= 2;
11740         f -= 1.;
11741         along = 0;
11742         along = (unsigned long)f;
11743         if (along != 0x7fffffff)
11744                 result |= 1;
11745         f += 2.;
11746         along = 0;
11747         along = (unsigned long)f;
11748         if (along != 0x80000001)
11749                 result |= 2;
11750         if (result)
11751                 exit(result);
11752         signal(SIGFPE, blech_in_list);
11753         sprintf(str, "123.");
11754         sscanf(str, "%lf", &f);  /* f = 123.; */
11755         along = dummy_long((unsigned long)f);
11756         aint = dummy_int((unsigned int)f);
11757         ashort = dummy_short((unsigned short)f);
11758         if (along != (unsigned long)123)
11759                 result |= 4;
11760         if (aint != (unsigned int)123)
11761                 result |= 4;
11762         if (ashort != (unsigned short)123)
11763                 result |= 4;
11764         exit(result);
11765
11766 }
11767 EOCP
11768 set try
11769 if eval $compile_ok; then
11770         $run ./try 2>/dev/null
11771         castflags=$?
11772 else
11773         echo "(I can't seem to compile the test program--assuming it can't)"
11774         castflags=7
11775 fi
11776 case "$castflags" in
11777 0)      val="$define"
11778         echo "Yup, it can."
11779         ;;
11780 *)      val="$undef"
11781         echo "Nope, it can't."
11782         ;;
11783 esac
11784 set d_castneg
11785 eval $setvar
11786 $rm_try
11787
11788 : see if cbrt exists
11789 set cbrt d_cbrt
11790 eval $inlibc
11791
11792 : see if vprintf exists
11793 echo " "
11794 if set vprintf val -f d_vprintf; eval $csym; $val; then
11795         echo 'vprintf() found.' >&4
11796         val="$define"
11797         $cat >try.c <<EOF
11798 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11799 #$i_varargs I_VARARGS
11800
11801 #$i_stdlib I_STDLIB
11802 #$i_unistd I_UNISTD
11803
11804 #ifdef I_STDARG
11805 #  include <stdarg.h>
11806 #else /* I_VARARGS */
11807 #  include <varargs.h>
11808 #endif
11809
11810 #ifdef I_UNISTD
11811 #  include <unistd.h>
11812 #endif
11813
11814 #ifdef I_STDLIB
11815 #  include <stdlib.h>
11816 #endif
11817
11818 #include <stdio.h> /* vsprintf prototype */
11819
11820 #ifdef I_STDARG
11821 void xxx(int n, ...)
11822 {
11823     va_list args;
11824     char buf[10];
11825     va_start(args, n);
11826     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11827 }
11828 int main() { xxx(1, "foo"); }
11829
11830 #else /* I_VARARGS */
11831
11832 xxx(va_alist)
11833 va_dcl
11834 {
11835     va_list args;
11836     char buf[10];
11837     va_start(args);
11838     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11839 }
11840 int main() { xxx("foo"); }
11841
11842 #endif
11843
11844 EOF
11845         set try
11846         if eval $compile_ok; then
11847                 if $run ./try; then
11848                         echo "Your vsprintf() returns (int)." >&4
11849                         val2="$undef"
11850                 else
11851                         echo "Your vsprintf() returns (char*)." >&4
11852                         val2="$define"
11853                 fi
11854         else
11855                 echo 'I am unable to compile the vsprintf() test program.' >&4
11856                 # We shouldn't get here.  If we do, assume the standard signature,
11857                 # not the old BSD one.
11858                 echo 'Guessing that vsprintf() returns (int).' >&4
11859                 val2="$undef"
11860         fi
11861 else
11862         echo 'vprintf() NOT found.' >&4
11863         val="$undef"
11864         val2="$undef"
11865 fi
11866 $rm_try
11867 set d_vprintf
11868 eval $setvar
11869 val=$val2
11870 set d_charvspr
11871 eval $setvar
11872
11873 : see if chown exists
11874 set chown d_chown
11875 eval $inlibc
11876
11877 : see if chroot exists
11878 set chroot d_chroot
11879 eval $inlibc
11880
11881 : see if chsize exists
11882 set chsize d_chsize
11883 eval $inlibc
11884
11885 : see if class exists
11886 set class d_class
11887 eval $inlibc
11888
11889 : see if clearenv exists
11890 set clearenv d_clearenv
11891 eval $inlibc
11892
11893 : Define hasstruct macro for Configure internal use
11894 hasstruct='varname=$1; struct=$2; shift; shift;
11895 while $test $# -ge 2; do
11896         case "$1" in
11897         $define) echo "#include <$2>";;
11898         esac ;
11899     shift 2;
11900 done > try.c;
11901 echo "int main () { struct $struct foo; }" >> try.c;
11902 set try;
11903 if eval $compile; then
11904         val="$define";
11905 else
11906         val="$undef";
11907 fi;
11908 set $varname;
11909 eval $setvar;
11910 $rm_try'
11911
11912 : see whether socket exists
11913 socketlib=''
11914 sockethdr=''
11915 echo " "
11916 $echo $n "Hmm... $c" >&4
11917 if set socket val -f d_socket; eval $csym; $val; then
11918     echo "Looks like you have Berkeley networking support." >&4
11919     d_socket="$define"
11920     if set setsockopt val -f; eval $csym; $val; then
11921         d_oldsock="$undef"
11922     else
11923         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11924         d_oldsock="$define"
11925     fi
11926 else
11927     if $contains socklib libc.list >/dev/null 2>&1; then
11928         echo "Looks like you have Berkeley networking support." >&4
11929         d_socket="$define"
11930         : we will have to assume that it supports the 4.2 BSD interface
11931         d_oldsock="$undef"
11932     else
11933         echo "You don't have Berkeley networking in libc$_a..." >&4
11934         if test "X$d_socket" = "X$define"; then
11935             echo "...but you seem to believe that you have sockets." >&4
11936         else
11937             for net in net socket
11938             do
11939                 if test -f $sysroot/usr/lib/lib$net$_a; then
11940                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11941                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11942                     if $contains socket libc.list >/dev/null 2>&1; then
11943                         d_socket="$define"
11944                         socketlib="-l$net"
11945                         case "$net" in
11946                         net)
11947                             echo "...but the Wollongong group seems to have hacked it in." >&4
11948                             sockethdr="-I$sysroot/usr/netinclude"
11949                             ;;
11950                         esac
11951                         echo "Found Berkeley sockets interface in lib$net." >&4
11952                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11953                             d_oldsock="$undef"
11954                         else
11955                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11956                             d_oldsock="$define"
11957                         fi
11958                         break
11959                     fi
11960                 fi
11961             done
11962             if test "X$d_socket" != "X$define"; then
11963                echo "or anywhere else I see." >&4
11964                d_socket="$undef"
11965                d_oldsock="$undef"
11966             fi
11967         fi
11968     fi
11969 fi
11970
11971 : see if socketpair exists
11972 set socketpair d_sockpair
11973 eval $inlibc
11974
11975
11976 echo " "
11977 echo "Checking the availability sa_len in the sock struct ..." >&4
11978 $cat >try.c <<EOF
11979 #include <sys/types.h>
11980 #include <sys/socket.h>
11981 int main() {
11982 struct sockaddr sa;
11983 return (sa.sa_len);
11984 }
11985 EOF
11986 val="$undef"
11987 set try; if eval $compile; then
11988     val="$define"
11989 fi
11990 set d_sockaddr_sa_len; eval $setvar
11991 $rm_try
11992
11993 echo " "
11994 echo "Checking the availability struct sockaddr_in6 ..." >&4
11995 $cat >try.c <<EOF
11996 #include <sys/types.h>
11997 #include <sys/socket.h>
11998 #include <netinet/in.h>
11999 int main() {
12000 struct sockaddr_in6 sin6;
12001 return (sin6.sin6_family);
12002 }
12003 EOF
12004 val="$undef"
12005 set try; if eval $compile; then
12006     val="$define"
12007 fi
12008 set d_sockaddr_in6; eval $setvar
12009 $rm_try
12010
12011 echo " "
12012 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12013 $cat >try.c <<EOF
12014 #include <sys/types.h>
12015 #include <sys/socket.h>
12016 #include <netinet/in.h>
12017 int main() {
12018 struct sockaddr_in6 sin6;
12019 return (sin6.sin6_scope_id);
12020 }
12021 EOF
12022 val="$undef"
12023 set try; if eval $compile; then
12024     val="$define"
12025 fi
12026 set d_sin6_scope_id; eval $setvar
12027 $rm_try
12028
12029 echo " "
12030 echo "Checking the availability struct ip_mreq ..." >&4
12031 $cat >try.c <<EOF
12032 #include <sys/types.h>
12033 #include <sys/socket.h>
12034 #include <netinet/in.h>
12035 int main() {
12036 struct ip_mreq mreq;
12037 return (mreq.imr_multiaddr.s_addr);
12038 }
12039 EOF
12040 val="$undef"
12041 set try; if eval $compile; then
12042        val="$define"
12043 fi
12044 set d_ip_mreq; eval $setvar
12045 $rm_try
12046
12047 echo " "
12048 echo "Checking the availability struct ip_mreq_source ..." >&4
12049 $cat >try.c <<EOF
12050 #include <sys/types.h>
12051 #include <sys/socket.h>
12052 #include <netinet/in.h>
12053 int main() {
12054 struct ip_mreq_source mreq;
12055 return (mreq.imr_multiaddr.s_addr);
12056 }
12057 EOF
12058 val="$undef"
12059 set try; if eval $compile; then
12060        val="$define"
12061 fi
12062 set d_ip_mreq_source; eval $setvar
12063 $rm_try
12064
12065 echo " "
12066 echo "Checking the availability struct ipv6_mreq ..." >&4
12067 $cat >try.c <<EOF
12068 #include <sys/types.h>
12069 #include <sys/socket.h>
12070 #include <netinet/in.h>
12071 int main() {
12072 struct ipv6_mreq mreq;
12073 return (mreq.ipv6mr_interface);
12074 }
12075 EOF
12076 val="$undef"
12077 set try; if eval $compile; then
12078     val="$define"
12079 fi
12080 set d_ipv6_mreq; eval $setvar
12081 $rm_try
12082
12083 echo " "
12084 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12085 $cat >try.c <<EOF
12086 #include <sys/types.h>
12087 #include <sys/socket.h>
12088 #include <netinet/in.h>
12089 int main() {
12090 struct ipv6_mreq_source mreq;
12091 return (mreq.imr_multiaddr.s_addr);
12092 }
12093 EOF
12094 val="$undef"
12095 set try; if eval $compile; then
12096        val="$define"
12097 fi
12098 set d_ipv6_mreq_source; eval $setvar
12099 $rm_try
12100
12101 echo " "
12102 echo "Checking the availability of certain socket constants..." >&4
12103 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12104     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12105     $cat >try.c <<EOF
12106 #include <sys/types.h>
12107 #include <sys/socket.h>
12108 int main() {
12109     int i = $ENUM;
12110 }
12111 EOF
12112     val="$undef"
12113     set try; if eval $compile; then
12114         val="$define"
12115     fi
12116     set d_${enum}; eval $setvar
12117     $rm_try
12118 done
12119
12120 : see if this is a sys/uio.h system
12121 set sys/uio.h i_sysuio
12122 eval $inhdr
12123
12124 : Check for cmsghdr support
12125 echo " "
12126 echo "Checking to see if your system supports struct cmsghdr..." >&4
12127 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12128 eval $hasstruct
12129 case "$d_cmsghdr_s" in
12130 "$define")      echo "Yes, it does."   ;;
12131 *)              echo "No, it doesn't." ;;
12132 esac
12133
12134
12135 : check for const keyword
12136 echo " "
12137 echo 'Checking to see if your C compiler knows about "const"...' >&4
12138 $cat >const.c <<'EOCP'
12139 typedef struct spug { int drokk; } spug;
12140 int main()
12141 {
12142         const char *foo;
12143         const spug y = { 0 };
12144 }
12145 EOCP
12146 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12147         val="$define"
12148         echo "Yup, it does."
12149 else
12150         val="$undef"
12151         echo "Nope, it doesn't."
12152 fi
12153 set d_const
12154 eval $setvar
12155
12156 : see if copysign exists
12157 set copysign d_copysign
12158 eval $inlibc
12159
12160 : see if copysignl exists
12161 set copysignl d_copysignl
12162 eval $inlibc
12163
12164 : see if crypt exists
12165 echo " "
12166 set crypt d_crypt
12167 eval $inlibc
12168 case "$d_crypt" in
12169 $define) cryptlib='' ;;
12170 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12171                 echo 'crypt() found.' >&4
12172                 val="$define"
12173                 cryptlib=''
12174         else
12175                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12176                 if $test -z "$cryptlib"; then
12177                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12178                 else
12179                         cryptlib=-lcrypt
12180                 fi
12181                 if $test -z "$cryptlib"; then
12182                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12183                 else
12184                         cryptlib=-lcrypt
12185                 fi
12186                 if $test -z "$cryptlib"; then
12187                         cryptlib=`./loc libcrypt$_a "" $libpth`
12188                 else
12189                         cryptlib=-lcrypt
12190                 fi
12191                 if $test -z "$cryptlib"; then
12192                         echo 'crypt() NOT found.' >&4
12193                         val="$undef"
12194                 else
12195                         val="$define"
12196                 fi
12197         fi
12198         set d_crypt
12199         eval $setvar
12200         ;;
12201 esac
12202
12203 : see if this is a crypt.h system
12204 set crypt.h i_crypt
12205 eval $inhdr
12206
12207 : see if crypt_r exists
12208 set crypt_r d_crypt_r
12209 eval $inlibc
12210 case "$d_crypt_r" in
12211 "$define")
12212         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12213         case "$d_crypt_r_proto:$usethreads" in
12214         ":define")      d_crypt_r_proto=define
12215                 set d_crypt_r_proto crypt_r $hdrs
12216                 eval $hasproto ;;
12217         *)      ;;
12218         esac
12219         case "$d_crypt_r_proto" in
12220         define)
12221         case "$crypt_r_proto" in
12222         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12223         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12224         esac
12225         case "$crypt_r_proto" in
12226         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12227         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12228         esac
12229         case "$crypt_r_proto" in
12230         ''|0)   d_crypt_r=undef
12231                 crypt_r_proto=0
12232                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12233         * )     case "$crypt_r_proto" in
12234                 REENTRANT_PROTO*) ;;
12235                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12236                 esac
12237                 echo "Prototype: $try" ;;
12238         esac
12239         ;;
12240         *)      case "$usethreads" in
12241                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12242                 esac
12243                 d_crypt_r=undef
12244                 crypt_r_proto=0
12245                 ;;
12246         esac
12247         ;;
12248 *)      crypt_r_proto=0
12249         ;;
12250 esac
12251
12252 : get csh whereabouts
12253 case "$csh" in
12254 'csh') val="$undef" ;;
12255 *) val="$define" ;;
12256 esac
12257 set d_csh
12258 eval $setvar
12259 : Respect a hint or command line value for full_csh.
12260 case "$full_csh" in
12261 '') full_csh=$csh ;;
12262 esac
12263
12264 : see if ctermid exists
12265 set ctermid d_ctermid
12266 eval $inlibc
12267
12268 : see if ctermid_r exists
12269 set ctermid_r d_ctermid_r
12270 eval $inlibc
12271 case "$d_ctermid_r" in
12272 "$define")
12273         hdrs="$i_systypes sys/types.h define stdio.h "
12274         case "$d_ctermid_r_proto:$usethreads" in
12275         ":define")      d_ctermid_r_proto=define
12276                 set d_ctermid_r_proto ctermid_r $hdrs
12277                 eval $hasproto ;;
12278         *)      ;;
12279         esac
12280         case "$d_ctermid_r_proto" in
12281         define)
12282         case "$ctermid_r_proto" in
12283         ''|0) try='char* ctermid_r(char*);'
12284         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12285         esac
12286         case "$ctermid_r_proto" in
12287         ''|0)   d_ctermid_r=undef
12288                 ctermid_r_proto=0
12289                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12290         * )     case "$ctermid_r_proto" in
12291                 REENTRANT_PROTO*) ;;
12292                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12293                 esac
12294                 echo "Prototype: $try" ;;
12295         esac
12296         ;;
12297         *)      case "$usethreads" in
12298                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12299                 esac
12300                 d_ctermid_r=undef
12301                 ctermid_r_proto=0
12302                 ;;
12303         esac
12304         ;;
12305 *)      ctermid_r_proto=0
12306         ;;
12307 esac
12308
12309 : see if ctime_r exists
12310 set ctime_r d_ctime_r
12311 eval $inlibc
12312 case "$d_ctime_r" in
12313 "$define")
12314         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12315         case "$d_ctime_r_proto:$usethreads" in
12316         ":define")      d_ctime_r_proto=define
12317                 set d_ctime_r_proto ctime_r $hdrs
12318                 eval $hasproto ;;
12319         *)      ;;
12320         esac
12321         case "$d_ctime_r_proto" in
12322         define)
12323         case "$ctime_r_proto" in
12324         ''|0) try='char* ctime_r(const time_t*, char*);'
12325         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12326         esac
12327         case "$ctime_r_proto" in
12328         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12329         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12330         esac
12331         case "$ctime_r_proto" in
12332         ''|0) try='int ctime_r(const time_t*, char*);'
12333         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12334         esac
12335         case "$ctime_r_proto" in
12336         ''|0) try='int ctime_r(const time_t*, char*, int);'
12337         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12338         esac
12339         case "$ctime_r_proto" in
12340         ''|0)   d_ctime_r=undef
12341                 ctime_r_proto=0
12342                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12343         * )     case "$ctime_r_proto" in
12344                 REENTRANT_PROTO*) ;;
12345                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12346                 esac
12347                 echo "Prototype: $try" ;;
12348         esac
12349         ;;
12350         *)      case "$usethreads" in
12351                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12352                 esac
12353                 d_ctime_r=undef
12354                 ctime_r_proto=0
12355                 ;;
12356         esac
12357         ;;
12358 *)      ctime_r_proto=0
12359         ;;
12360 esac
12361
12362 : see if cuserid exists
12363 set cuserid d_cuserid
12364 eval $inlibc
12365
12366 : see if this is a limits.h system
12367 set limits.h i_limits
12368 eval $inhdr
12369
12370 : See if number of significant digits in a double precision number is known
12371 echo " "
12372 $cat >dbl_dig.c <<EOM
12373 #$i_limits I_LIMITS
12374 #$i_float I_FLOAT
12375 #ifdef I_LIMITS
12376 #include <limits.h>
12377 #endif
12378 #ifdef I_FLOAT
12379 #include <float.h>
12380 #endif
12381 #ifdef DBL_DIG
12382 printf("Contains DBL_DIG");
12383 #endif
12384 EOM
12385 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12386 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12387         echo "DBL_DIG found." >&4
12388         val="$define"
12389 else
12390         echo "DBL_DIG NOT found." >&4
12391         val="$undef"
12392 fi
12393 $rm -f dbl_dig.?
12394 set d_dbl_dig
12395 eval $setvar
12396
12397 : see if dbm.h is available
12398 : see if dbmclose exists
12399 set dbmclose d_dbmclose
12400 eval $inlibc
12401
12402 case "$d_dbmclose" in
12403 $define)
12404         set dbm.h i_dbm
12405         eval $inhdr
12406         case "$i_dbm" in
12407         $define)
12408                 val="$undef"
12409                 set i_rpcsvcdbm
12410                 eval $setvar
12411                 ;;
12412         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12413                 eval $inhdr
12414                 ;;
12415         esac
12416         ;;
12417 *)      echo "We won't be including <dbm.h>"
12418         val="$undef"
12419         set i_dbm
12420         eval $setvar
12421         val="$undef"
12422         set i_rpcsvcdbm
12423         eval $setvar
12424         ;;
12425 esac
12426
12427 : see if prototype for dbminit is available
12428 echo " "
12429 set d_dbminitproto dbminit $i_dbm dbm.h
12430 eval $hasproto
12431
12432 : see if difftime exists
12433 set difftime d_difftime
12434 eval $inlibc
12435
12436 : see if this is a dirent system
12437 echo " "
12438 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12439         val="$define"
12440         echo "<dirent.h> found." >&4
12441 else
12442         val="$undef"
12443         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12444                 echo "<sys/dir.h> found." >&4
12445                 echo " "
12446         else
12447                 xinc=`./findhdr sys/ndir.h`
12448         fi
12449         echo "<dirent.h> NOT found." >&4
12450 fi
12451 set i_dirent
12452 eval $setvar
12453
12454 : Look for type of directory structure.
12455 echo " "
12456 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12457
12458 case "$direntrytype" in
12459 ''|' ')
12460         case "$i_dirent" in
12461         $define) guess1='struct dirent' ;;
12462         *) guess1='struct direct'  ;;
12463         esac
12464         ;;
12465 *)      guess1="$direntrytype"
12466         ;;
12467 esac
12468
12469 case "$guess1" in
12470 'struct dirent') guess2='struct direct' ;;
12471 *) guess2='struct dirent' ;;
12472 esac
12473
12474 if $contains "$guess1" try.c >/dev/null 2>&1; then
12475         direntrytype="$guess1"
12476         echo "Your directory entries are $direntrytype." >&4
12477 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12478         direntrytype="$guess2"
12479         echo "Your directory entries seem to be $direntrytype." >&4
12480 else
12481         echo "I don't recognize your system's directory entries." >&4
12482         rp="What type is used for directory entries on this system?"
12483         dflt="$guess1"
12484         . ./myread
12485         direntrytype="$ans"
12486 fi
12487 $rm_try
12488
12489 : see if the directory entry stores field length
12490 echo " "
12491 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12492 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12493         echo "Good, your directory entry keeps length information in d_namlen." >&4
12494         val="$define"
12495 else
12496         echo "Your directory entry does not know about the d_namlen field." >&4
12497         val="$undef"
12498 fi
12499 set d_dirnamlen
12500 eval $setvar
12501 $rm_try
12502
12503 : Look for DIR.dd_fd
12504 case "$i_dirent" in
12505 "$define")
12506     echo "Checking to see if DIR has a dd_fd member variable" >&4
12507     $cat >try.c <<EOCP
12508 #$i_stdlib I_STDLIB
12509 #ifdef I_STDLIB
12510 #include <stdlib.h>
12511 #endif
12512 #include <dirent.h>
12513
12514 int main() {
12515     DIR dir;
12516     dir.dd_fd = 1;
12517     return 0;
12518 }
12519 EOCP
12520     val=$undef
12521     set try
12522     if eval $compile; then
12523         echo "Yes, it does."
12524         val="$define"
12525     else
12526         echo "No, it does not."
12527         val="$undef"
12528     fi
12529     ;;
12530 *)
12531     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12532     val="$undef"
12533     ;;
12534 esac
12535 set d_dir_dd_fd
12536 eval $setvar
12537 $rm_try
12538
12539 : see if this is an sysdir system
12540 set sys/dir.h i_sysdir
12541 eval $inhdr
12542
12543 : see if this is an sysndir system
12544 set sys/ndir.h i_sysndir
12545 eval $inhdr
12546
12547 : Look for dirfd
12548 echo " "
12549 $cat >dirfd.c <<EOM
12550 #include <stdio.h>
12551 #$i_stdlib I_STDLIB
12552 #ifdef I_STDLIB
12553 #include <stdlib.h>
12554 #endif
12555 #$i_dirent I_DIRENT             /**/
12556 #$i_sysdir I_SYS_DIR            /**/
12557 #$i_sysndir I_SYS_NDIR          /**/
12558 #$i_systypes I_SYS_TYPES        /**/
12559 #if defined(I_SYS_TYPES)
12560 #include <sys/types.h>
12561 #endif
12562 #if defined(I_DIRENT)
12563 #include <dirent.h>
12564 #else
12565 #ifdef I_SYS_NDIR
12566 #include <sys/ndir.h>
12567 #else
12568 #ifdef I_SYS_DIR
12569 #ifdef hp9000s500
12570 #include <ndir.h>       /* may be wrong in the future */
12571 #else
12572 #include <sys/dir.h>
12573 #endif
12574 #endif
12575 #endif
12576 #endif
12577 int main() {
12578         DIR *dirp = opendir(".");
12579         if (dirfd(dirp) >= 0)
12580                 exit(0);
12581         else
12582                 exit(1);
12583 }
12584 EOM
12585 val=$undef
12586 set dirfd
12587 if eval $compile; then
12588         val="$define"
12589 fi
12590 case "$val" in
12591 $define)        echo "dirfd() found." >&4       ;;
12592 *)              echo "dirfd() NOT found." >&4   ;;
12593 esac
12594 set d_dirfd
12595 eval $setvar
12596 $rm -f dirfd*
12597
12598 : see if dladdr exists
12599 set dladdr d_dladdr
12600 eval $inlibc
12601
12602 : see if dlerror exists
12603 xxx_runnm="$runnm"
12604 runnm=false
12605 set dlerror d_dlerror
12606 eval $inlibc
12607 runnm="$xxx_runnm"
12608
12609 : see if dlfcn is available
12610 set dlfcn.h i_dlfcn
12611 eval $inhdr
12612
12613 : Check what extension to use for shared libs
12614 case "$usedl" in
12615 $define|y|true)
12616         $cat << EOM
12617
12618 On a few systems, the dynamically loaded modules that perl generates and uses
12619 will need a different extension than shared libs. The default will probably
12620 be appropriate.
12621
12622 EOM
12623         case "$dlext" in
12624         '')     dflt="$so" ;;
12625         *)      dflt="$dlext" ;;
12626         esac
12627         rp='What is the extension of dynamically loaded modules'
12628         . ./myread
12629         dlext="$ans"
12630         ;;
12631 *)
12632         dlext="none"
12633         ;;
12634 esac
12635
12636 : Check if dlsym need a leading underscore
12637 echo " "
12638 val="$undef"
12639
12640 case "$dlsrc" in
12641 dl_dlopen.xs)
12642         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12643         $cat >dyna.c <<'EOM'
12644 fred () { }
12645 EOM
12646
12647 $cat >fred.c<<EOM
12648
12649 #include <stdio.h>
12650 #$i_stdlib I_STDLIB
12651 #ifdef I_STDLIB
12652 #include <stdlib.h>
12653 #endif
12654 #$i_dlfcn I_DLFCN
12655 #ifdef I_DLFCN
12656 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12657 #else
12658 #include <sys/types.h>
12659 #include <nlist.h>
12660 #include <link.h>
12661 #endif
12662
12663 extern int fred() ;
12664
12665 int main()
12666 {
12667     void * handle ;
12668     void * symbol ;
12669 #ifndef RTLD_LAZY
12670     int mode = 1 ;
12671 #else
12672     int mode = RTLD_LAZY ;
12673 #endif
12674     handle = dlopen("./dyna.$dlext", mode) ;
12675     if (handle == NULL) {
12676         printf ("1\n") ;
12677         fflush (stdout) ;
12678         exit(0);
12679     }
12680     symbol = dlsym(handle, "fred") ;
12681     if (symbol == NULL) {
12682         /* try putting a leading underscore */
12683         symbol = dlsym(handle, "_fred") ;
12684         if (symbol == NULL) {
12685             printf ("2\n") ;
12686             fflush (stdout) ;
12687             exit(0);
12688         }
12689         printf ("3\n") ;
12690     }
12691     else
12692         printf ("4\n") ;
12693     fflush (stdout) ;
12694     exit(0);
12695 }
12696 EOM
12697         : Call the object file tmp-dyna.o in case dlext=o.
12698         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12699                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12700                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12701                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12702                 xxx=`$run ./fred`
12703                 case $xxx in
12704                 1)      echo "Test program failed using dlopen." >&4
12705                         echo "Perhaps you should not use dynamic loading." >&4;;
12706                 2)      echo "Test program failed using dlsym." >&4
12707                         echo "Perhaps you should not use dynamic loading." >&4;;
12708                 3)      echo "dlsym needs a leading underscore" >&4
12709                         val="$define" ;;
12710                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12711                 esac
12712         else
12713                 echo "I can't compile and run the test program." >&4
12714                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12715         fi
12716         ;;
12717 esac
12718
12719 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12720
12721 set d_dlsymun
12722 eval $setvar
12723
12724 : see if drand48_r exists
12725 set drand48_r d_drand48_r
12726 eval $inlibc
12727 case "$d_drand48_r" in
12728 "$define")
12729         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12730         case "$d_drand48_r_proto:$usethreads" in
12731         ":define")      d_drand48_r_proto=define
12732                 set d_drand48_r_proto drand48_r $hdrs
12733                 eval $hasproto ;;
12734         *)      ;;
12735         esac
12736         case "$d_drand48_r_proto" in
12737         define)
12738         case "$drand48_r_proto" in
12739         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12740         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12741         esac
12742         case "$drand48_r_proto" in
12743         ''|0)   d_drand48_r=undef
12744                 drand48_r_proto=0
12745                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12746         * )     case "$drand48_r_proto" in
12747                 REENTRANT_PROTO*) ;;
12748                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12749                 esac
12750                 echo "Prototype: $try" ;;
12751         esac
12752         ;;
12753         *)      case "$usethreads" in
12754                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12755                 esac
12756                 d_drand48_r=undef
12757                 drand48_r_proto=0
12758                 ;;
12759         esac
12760         ;;
12761 *)      drand48_r_proto=0
12762         ;;
12763 esac
12764
12765 : see if prototype for drand48 is available
12766 echo " "
12767 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12768 eval $hasproto
12769
12770 : see if dup2 exists
12771 set dup2 d_dup2
12772 eval $inlibc
12773
12774 : see if eaccess exists
12775 set eaccess d_eaccess
12776 eval $inlibc
12777
12778 : see if endgrent exists
12779 set endgrent d_endgrent
12780 eval $inlibc
12781
12782 : see if this is an grp system
12783 set grp.h i_grp
12784 eval $inhdr
12785
12786 case "$i_grp" in
12787 $define)
12788         xxx=`./findhdr grp.h`
12789         $cppstdin $cppflags $cppminus < $xxx >$$.h
12790
12791         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12792                 val="$define"
12793         else
12794                 val="$undef"
12795         fi
12796         set d_grpasswd
12797         eval $setvar
12798
12799         $rm -f $$.h
12800         ;;
12801 *)
12802         val="$undef";
12803         set d_grpasswd; eval $setvar
12804         ;;
12805 esac
12806
12807 : see if endgrent_r exists
12808 set endgrent_r d_endgrent_r
12809 eval $inlibc
12810 case "$d_endgrent_r" in
12811 "$define")
12812         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12813         case "$d_endgrent_r_proto:$usethreads" in
12814         ":define")      d_endgrent_r_proto=define
12815                 set d_endgrent_r_proto endgrent_r $hdrs
12816                 eval $hasproto ;;
12817         *)      ;;
12818         esac
12819         case "$d_endgrent_r_proto" in
12820         define)
12821         case "$endgrent_r_proto" in
12822         ''|0) try='int endgrent_r(FILE**);'
12823         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12824         esac
12825         case "$endgrent_r_proto" in
12826         ''|0) try='void endgrent_r(FILE**);'
12827         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12828         esac
12829         case "$endgrent_r_proto" in
12830         ''|0)   d_endgrent_r=undef
12831                 endgrent_r_proto=0
12832                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12833         * )     case "$endgrent_r_proto" in
12834                 REENTRANT_PROTO*) ;;
12835                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12836                 esac
12837                 echo "Prototype: $try" ;;
12838         esac
12839         ;;
12840         *)      case "$usethreads" in
12841                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12842                 esac
12843                 d_endgrent_r=undef
12844                 endgrent_r_proto=0
12845                 ;;
12846         esac
12847         ;;
12848 *)      endgrent_r_proto=0
12849         ;;
12850 esac
12851
12852 : see if endhostent exists
12853 set endhostent d_endhent
12854 eval $inlibc
12855
12856 : see if this is a netdb.h system
12857 set netdb.h i_netdb
12858 eval $inhdr
12859
12860 : see if endhostent_r exists
12861 set endhostent_r d_endhostent_r
12862 eval $inlibc
12863 case "$d_endhostent_r" in
12864 "$define")
12865         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12866         case "$d_endhostent_r_proto:$usethreads" in
12867         ":define")      d_endhostent_r_proto=define
12868                 set d_endhostent_r_proto endhostent_r $hdrs
12869                 eval $hasproto ;;
12870         *)      ;;
12871         esac
12872         case "$d_endhostent_r_proto" in
12873         define)
12874         case "$endhostent_r_proto" in
12875         ''|0) try='int endhostent_r(struct hostent_data*);'
12876         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12877         esac
12878         case "$endhostent_r_proto" in
12879         ''|0) try='void endhostent_r(struct hostent_data*);'
12880         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12881         esac
12882         case "$endhostent_r_proto" in
12883         ''|0)   d_endhostent_r=undef
12884                 endhostent_r_proto=0
12885                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12886         * )     case "$endhostent_r_proto" in
12887                 REENTRANT_PROTO*) ;;
12888                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12889                 esac
12890                 echo "Prototype: $try" ;;
12891         esac
12892         ;;
12893         *)      case "$usethreads" in
12894                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12895                 esac
12896                 d_endhostent_r=undef
12897                 endhostent_r_proto=0
12898                 ;;
12899         esac
12900         ;;
12901 *)      endhostent_r_proto=0
12902         ;;
12903 esac
12904
12905 : see if endnetent exists
12906 set endnetent d_endnent
12907 eval $inlibc
12908
12909 : see if endnetent_r exists
12910 set endnetent_r d_endnetent_r
12911 eval $inlibc
12912 case "$d_endnetent_r" in
12913 "$define")
12914         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12915         case "$d_endnetent_r_proto:$usethreads" in
12916         ":define")      d_endnetent_r_proto=define
12917                 set d_endnetent_r_proto endnetent_r $hdrs
12918                 eval $hasproto ;;
12919         *)      ;;
12920         esac
12921         case "$d_endnetent_r_proto" in
12922         define)
12923         case "$endnetent_r_proto" in
12924         ''|0) try='int endnetent_r(struct netent_data*);'
12925         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12926         esac
12927         case "$endnetent_r_proto" in
12928         ''|0) try='void endnetent_r(struct netent_data*);'
12929         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12930         esac
12931         case "$endnetent_r_proto" in
12932         ''|0)   d_endnetent_r=undef
12933                 endnetent_r_proto=0
12934                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12935         * )     case "$endnetent_r_proto" in
12936                 REENTRANT_PROTO*) ;;
12937                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12938                 esac
12939                 echo "Prototype: $try" ;;
12940         esac
12941         ;;
12942         *)      case "$usethreads" in
12943                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12944                 esac
12945                 d_endnetent_r=undef
12946                 endnetent_r_proto=0
12947                 ;;
12948         esac
12949         ;;
12950 *)      endnetent_r_proto=0
12951         ;;
12952 esac
12953
12954 : see if endprotoent exists
12955 set endprotoent d_endpent
12956 eval $inlibc
12957
12958 : see if endprotoent_r exists
12959 set endprotoent_r d_endprotoent_r
12960 eval $inlibc
12961 case "$d_endprotoent_r" in
12962 "$define")
12963         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12964         case "$d_endprotoent_r_proto:$usethreads" in
12965         ":define")      d_endprotoent_r_proto=define
12966                 set d_endprotoent_r_proto endprotoent_r $hdrs
12967                 eval $hasproto ;;
12968         *)      ;;
12969         esac
12970         case "$d_endprotoent_r_proto" in
12971         define)
12972         case "$endprotoent_r_proto" in
12973         ''|0) try='int endprotoent_r(struct protoent_data*);'
12974         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12975         esac
12976         case "$endprotoent_r_proto" in
12977         ''|0) try='void endprotoent_r(struct protoent_data*);'
12978         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12979         esac
12980         case "$endprotoent_r_proto" in
12981         ''|0)   d_endprotoent_r=undef
12982                 endprotoent_r_proto=0
12983                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12984         * )     case "$endprotoent_r_proto" in
12985                 REENTRANT_PROTO*) ;;
12986                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12987                 esac
12988                 echo "Prototype: $try" ;;
12989         esac
12990         ;;
12991         *)      case "$usethreads" in
12992                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12993                 esac
12994                 d_endprotoent_r=undef
12995                 endprotoent_r_proto=0
12996                 ;;
12997         esac
12998         ;;
12999 *)      endprotoent_r_proto=0
13000         ;;
13001 esac
13002
13003 : see if endpwent exists
13004 set endpwent d_endpwent
13005 eval $inlibc
13006
13007 : see if this is a pwd.h system
13008 set pwd.h i_pwd
13009 eval $inhdr
13010
13011 case "$i_pwd" in
13012 $define)
13013         xxx=`./findhdr pwd.h`
13014         $cppstdin $cppflags $cppminus < $xxx >$$.h
13015
13016         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13017                 val="$define"
13018         else
13019                 val="$undef"
13020         fi
13021         set d_pwquota
13022         eval $setvar
13023
13024         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13025                 val="$define"
13026         else
13027                 val="$undef"
13028         fi
13029         set d_pwage
13030         eval $setvar
13031
13032         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13033                 val="$define"
13034         else
13035                 val="$undef"
13036         fi
13037         set d_pwchange
13038         eval $setvar
13039
13040         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13041                 val="$define"
13042         else
13043                 val="$undef"
13044         fi
13045         set d_pwclass
13046         eval $setvar
13047
13048         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13049                 val="$define"
13050         else
13051                 val="$undef"
13052         fi
13053         set d_pwexpire
13054         eval $setvar
13055
13056         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13057                 val="$define"
13058         else
13059                 val="$undef"
13060         fi
13061         set d_pwcomment
13062         eval $setvar
13063
13064         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13065                 val="$define"
13066         else
13067                 val="$undef"
13068         fi
13069         set d_pwgecos
13070         eval $setvar
13071
13072         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13073                 val="$define"
13074         else
13075                 val="$undef"
13076         fi
13077         set d_pwpasswd
13078         eval $setvar
13079
13080         $rm -f $$.h
13081         ;;
13082 *)
13083         val="$undef";
13084         set d_pwquota; eval $setvar
13085         set d_pwage; eval $setvar
13086         set d_pwchange; eval $setvar
13087         set d_pwclass; eval $setvar
13088         set d_pwexpire; eval $setvar
13089         set d_pwcomment; eval $setvar
13090         set d_pwgecos; eval $setvar
13091         set d_pwpasswd; eval $setvar
13092         ;;
13093 esac
13094
13095 : see if endpwent_r exists
13096 set endpwent_r d_endpwent_r
13097 eval $inlibc
13098 case "$d_endpwent_r" in
13099 "$define")
13100         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13101         case "$d_endpwent_r_proto:$usethreads" in
13102         ":define")      d_endpwent_r_proto=define
13103                 set d_endpwent_r_proto endpwent_r $hdrs
13104                 eval $hasproto ;;
13105         *)      ;;
13106         esac
13107         case "$d_endpwent_r_proto" in
13108         define)
13109         case "$endpwent_r_proto" in
13110         ''|0) try='int endpwent_r(FILE**);'
13111         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13112         esac
13113         case "$endpwent_r_proto" in
13114         ''|0) try='void endpwent_r(FILE**);'
13115         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13116         esac
13117         case "$endpwent_r_proto" in
13118         ''|0)   d_endpwent_r=undef
13119                 endpwent_r_proto=0
13120                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13121         * )     case "$endpwent_r_proto" in
13122                 REENTRANT_PROTO*) ;;
13123                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13124                 esac
13125                 echo "Prototype: $try" ;;
13126         esac
13127         ;;
13128         *)      case "$usethreads" in
13129                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13130                 esac
13131                 d_endpwent_r=undef
13132                 endpwent_r_proto=0
13133                 ;;
13134         esac
13135         ;;
13136 *)      endpwent_r_proto=0
13137         ;;
13138 esac
13139
13140 : see if endservent exists
13141 set endservent d_endsent
13142 eval $inlibc
13143
13144 : see if endservent_r exists
13145 set endservent_r d_endservent_r
13146 eval $inlibc
13147 case "$d_endservent_r" in
13148 "$define")
13149         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13150         case "$d_endservent_r_proto:$usethreads" in
13151         ":define")      d_endservent_r_proto=define
13152                 set d_endservent_r_proto endservent_r $hdrs
13153                 eval $hasproto ;;
13154         *)      ;;
13155         esac
13156         case "$d_endservent_r_proto" in
13157         define)
13158         case "$endservent_r_proto" in
13159         ''|0) try='int endservent_r(struct servent_data*);'
13160         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13161         esac
13162         case "$endservent_r_proto" in
13163         ''|0) try='void endservent_r(struct servent_data*);'
13164         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13165         esac
13166         case "$endservent_r_proto" in
13167         ''|0)   d_endservent_r=undef
13168                 endservent_r_proto=0
13169                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13170         * )     case "$endservent_r_proto" in
13171                 REENTRANT_PROTO*) ;;
13172                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13173                 esac
13174                 echo "Prototype: $try" ;;
13175         esac
13176         ;;
13177         *)      case "$usethreads" in
13178                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13179                 esac
13180                 d_endservent_r=undef
13181                 endservent_r_proto=0
13182                 ;;
13183         esac
13184         ;;
13185 *)      endservent_r_proto=0
13186         ;;
13187 esac
13188
13189 : Locate the flags for 'open()'
13190 echo " "
13191 $cat >try.c <<EOCP
13192 #include <sys/types.h>
13193 #ifdef I_FCNTL
13194 #include <fcntl.h>
13195 #endif
13196 #ifdef I_SYS_FILE
13197 #include <sys/file.h>
13198 #endif
13199 #$i_stdlib I_STDLIB
13200 #ifdef I_STDLIB
13201 #include <stdlib.h>
13202 #endif
13203 int main() {
13204         if(O_RDONLY);
13205 #ifdef O_TRUNC
13206         exit(0);
13207 #else
13208         exit(1);
13209 #endif
13210 }
13211 EOCP
13212 : check sys/file.h first to get FREAD on Sun
13213 if $test `./findhdr sys/file.h` && \
13214                 set try -DI_SYS_FILE && eval $compile; then
13215         h_sysfile=true;
13216         echo "<sys/file.h> defines the O_* constants..." >&4
13217         if $run ./try; then
13218                 echo "and you have the 3 argument form of open()." >&4
13219                 val="$define"
13220         else
13221                 echo "but not the 3 argument form of open().  Oh, well." >&4
13222                 val="$undef"
13223         fi
13224 elif $test `./findhdr fcntl.h` && \
13225                 set try -DI_FCNTL && eval $compile; then
13226         h_fcntl=true;
13227         echo "<fcntl.h> defines the O_* constants..." >&4
13228         if $run ./try; then
13229                 echo "and you have the 3 argument form of open()." >&4
13230                 val="$define"
13231         else
13232                 echo "but not the 3 argument form of open().  Oh, well." >&4
13233                 val="$undef"
13234         fi
13235 else
13236         val="$undef"
13237         echo "I can't find the O_* constant definitions!  You got problems." >&4
13238 fi
13239 set d_open3
13240 eval $setvar
13241 $rm_try
13242
13243 : see if this is a sys/file.h system
13244 val=''
13245 set sys/file.h val
13246 eval $inhdr
13247
13248 : do we need to include sys/file.h ?
13249 case "$val" in
13250 "$define")
13251         echo " "
13252         if $h_sysfile; then
13253                 val="$define"
13254                 echo "We'll be including <sys/file.h>." >&4
13255         else
13256                 val="$undef"
13257                 echo "We won't be including <sys/file.h>." >&4
13258         fi
13259         ;;
13260 *)
13261         h_sysfile=false
13262         ;;
13263 esac
13264 set i_sysfile
13265 eval $setvar
13266
13267 : see if fcntl.h is there
13268 val=''
13269 set fcntl.h val
13270 eval $inhdr
13271
13272 : see if we can include fcntl.h
13273 case "$val" in
13274 "$define")
13275         echo " "
13276         if $h_fcntl; then
13277                 val="$define"
13278                 echo "We'll be including <fcntl.h>." >&4
13279         else
13280                 val="$undef"
13281                 if $h_sysfile; then
13282         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13283                 else
13284                         echo "We won't be including <fcntl.h>." >&4
13285                 fi
13286         fi
13287         ;;
13288 *)
13289         h_fcntl=false
13290         val="$undef"
13291         ;;
13292 esac
13293 set i_fcntl
13294 eval $setvar
13295
13296 : see if fork exists
13297 set fork d_fork
13298 eval $inlibc
13299
13300 : see if pipe exists
13301 set pipe d_pipe
13302 eval $inlibc
13303
13304 : check for non-blocking I/O stuff
13305 case "$h_sysfile" in
13306 true) echo "#include <sys/file.h>" > head.c;;
13307 *)
13308        case "$h_fcntl" in
13309        true) echo "#include <fcntl.h>" > head.c;;
13310        *) echo "#include <sys/fcntl.h>" > head.c;;
13311        esac
13312        ;;
13313 esac
13314 echo " "
13315 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13316 case "$o_nonblock" in
13317 '')
13318         $cat head.c > try.c
13319         $cat >>try.c <<EOCP
13320 #include <stdio.h>
13321 #$i_stdlib I_STDLIB
13322 #ifdef I_STDLIB
13323 #include <stdlib.h>
13324 #endif
13325 #$i_fcntl I_FCNTL
13326 #ifdef I_FCNTL
13327 #include <fcntl.h>
13328 #endif
13329 int main() {
13330 #ifdef O_NONBLOCK
13331         printf("O_NONBLOCK\n");
13332         exit(0);
13333 #endif
13334 #ifdef O_NDELAY
13335         printf("O_NDELAY\n");
13336         exit(0);
13337 #endif
13338 #ifdef FNDELAY
13339         printf("FNDELAY\n");
13340         exit(0);
13341 #endif
13342         exit(0);
13343 }
13344 EOCP
13345         set try
13346         if eval $compile_ok; then
13347                 o_nonblock=`$run ./try`
13348                 case "$o_nonblock" in
13349                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13350                 *) echo "Seems like we can use $o_nonblock.";;
13351                 esac
13352         else
13353                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13354         fi
13355         ;;
13356 *) echo "Using $hint value $o_nonblock.";;
13357 esac
13358 $rm_try
13359
13360 echo " "
13361 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13362 case "$eagain" in
13363 '')
13364         case "$d_fork:$d_pipe:$d_alarm" in
13365         define:define:define)
13366         $cat head.c > try.c
13367         $cat >>try.c <<EOCP
13368 #include <errno.h>
13369 #include <sys/types.h>
13370 #include <signal.h>
13371 #include <stdio.h>
13372 #$i_stdlib I_STDLIB
13373 #ifdef I_STDLIB
13374 #include <stdlib.h>
13375 #endif
13376 #$i_fcntl I_FCNTL
13377 #ifdef I_FCNTL
13378 #include <fcntl.h>
13379 #endif
13380 #define MY_O_NONBLOCK $o_nonblock
13381 #ifndef errno  /* XXX need better Configure test */
13382 extern int errno;
13383 #endif
13384 #$i_unistd I_UNISTD
13385 #ifdef I_UNISTD
13386 #include <unistd.h>
13387 #endif
13388 #$i_string I_STRING
13389 #ifdef I_STRING
13390 #include <string.h>
13391 #else
13392 #include <strings.h>
13393 #endif
13394 $signal_t blech(int x) { exit(3); }
13395 EOCP
13396         $cat >> try.c <<'EOCP'
13397 int main()
13398 {
13399         int pd[2];
13400         int pu[2];
13401         char buf[1];
13402         char string[100];
13403         int ret;
13404
13405         ret = pipe(pd); /* Down: child -> parent */
13406         if (ret != 0)
13407                 exit(3);
13408         ret = pipe(pu); /* Up: parent -> child */
13409         if (ret != 0)
13410                 exit(3);
13411         if (0 != fork()) {
13412                 close(pd[1]);   /* Parent reads from pd[0] */
13413                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13414 #ifdef F_SETFL
13415                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13416                         exit(1);
13417 #else
13418                 exit(4);
13419 #endif
13420                 signal(SIGALRM, blech);
13421                 alarm(5);
13422                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13423                         exit(2);
13424                 sprintf(string, "%d\n", ret);
13425                 ret = write(2, string, strlen(string));
13426                 if (ret != strlen(string))
13427                         exit(3);
13428                 alarm(0);
13429 #ifdef EAGAIN
13430                 if (errno == EAGAIN) {
13431                         printf("EAGAIN\n");
13432                         goto ok;
13433                 }
13434 #endif
13435 #ifdef EWOULDBLOCK
13436                 if (errno == EWOULDBLOCK)
13437                         printf("EWOULDBLOCK\n");
13438 #endif
13439         ok:
13440                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13441                 if (ret != 1)
13442                         exit(3);
13443                 sleep(2);                               /* Give it time to close our pipe */
13444                 alarm(5);
13445                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13446                 alarm(0);
13447                 sprintf(string, "%d\n", ret);
13448                 ret = write(4, string, strlen(string));
13449                 if (ret != strlen(string))
13450                         exit(3);
13451                 exit(0);
13452         }
13453
13454         close(pd[0]);                   /* We write to pd[1] */
13455         close(pu[1]);                   /* We read from pu[0] */
13456         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13457         if (ret != 1)
13458                 exit(3);
13459         close(pd[1]);                   /* Pipe pd is now fully closed! */
13460         exit(0);                                /* Bye bye, thank you for playing! */
13461 }
13462 EOCP
13463         set try
13464         if eval $compile_ok; then
13465                 echo "$startsh" >mtry
13466                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13467                 chmod +x mtry
13468                 $run ./mtry >/dev/null 2>&1
13469                 case $? in
13470                 0) eagain=`$cat try.out`;;
13471                 1) echo "Could not perform non-blocking setting!";;
13472                 2) echo "I did a successful read() for something that was not there!";;
13473                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13474                 4) echo "Could not find F_SETFL!";;
13475                 *) echo "Something terribly wrong happened during testing.";;
13476                 esac
13477                 rd_nodata=`$cat try.ret`
13478                 echo "A read() system call with no data present returns $rd_nodata."
13479                 case "$rd_nodata" in
13480                 0|-1) ;;
13481                 *)
13482                         echo "(That's peculiar, fixing that to be -1.)"
13483                         rd_nodata=-1
13484                         ;;
13485                 esac
13486                 case "$eagain" in
13487                 '')
13488                         echo "Forcing errno EAGAIN on read() with no data available."
13489                         eagain=EAGAIN
13490                         ;;
13491                 *)
13492                         echo "Your read() sets errno to $eagain when no data is available."
13493                         ;;
13494                 esac
13495                 status=`$cat try.err`
13496                 case "$status" in
13497                 0) echo "And it correctly returns 0 to signal EOF.";;
13498                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13499                 *) echo "However, your read() returns '$status' on EOF??";;
13500                 esac
13501                 val="$define"
13502                 if test "$status" = "$rd_nodata"; then
13503                         echo "WARNING: you can't distinguish between EOF and no data!"
13504                         val="$undef"
13505                 fi
13506         else
13507                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13508                 eagain=EAGAIN
13509         fi
13510         ;;
13511         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13512                 eagain=EAGAIN
13513                 val="$define"
13514                 ;;
13515         esac
13516         set d_eofnblk
13517         eval $setvar
13518         ;;
13519 *)
13520         echo "Using $hint value $eagain."
13521         echo "Your read() returns $rd_nodata when no data is present."
13522         case "$d_eofnblk" in
13523         "$define") echo "And you can see EOF because read() returns 0.";;
13524         "$undef") echo "But you can't see EOF status from read() returned value.";;
13525         *)
13526                 echo "(Assuming you can't see EOF status from read anyway.)"
13527                 d_eofnblk=$undef
13528                 ;;
13529         esac
13530         ;;
13531 esac
13532 $rm_try head.c mtry
13533
13534 : see if erf exists
13535 set erf d_erf
13536 eval $inlibc
13537
13538 : see if erfc exists
13539 set erfc d_erfc
13540 eval $inlibc
13541
13542 : see if exp2 exists
13543 set exp2 d_exp2
13544 eval $inlibc
13545
13546 : see if expm1 exists
13547 set expm1 d_expm1
13548 eval $inlibc
13549
13550 : see if _ptr and _cnt from stdio act std
13551 echo " "
13552
13553 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13554         echo "(Looks like you have stdio.h from BSD.)"
13555         case "$stdio_ptr" in
13556         '') stdio_ptr='((fp)->_p)'
13557                 ptr_lval=$define
13558                 ;;
13559         *)      ptr_lval=$d_stdio_ptr_lval;;
13560         esac
13561         case "$stdio_cnt" in
13562         '') stdio_cnt='((fp)->_r)'
13563                 cnt_lval=$define
13564                 ;;
13565         *)      cnt_lval=$d_stdio_cnt_lval;;
13566         esac
13567         case "$stdio_base" in
13568         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13569         esac
13570         case "$stdio_bufsiz" in
13571         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13572         esac
13573 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13574         echo "(Looks like you have stdio.h from Linux.)"
13575         case "$stdio_ptr" in
13576         '') stdio_ptr='((fp)->_IO_read_ptr)'
13577                 ptr_lval=$define
13578                 ;;
13579         *)      ptr_lval=$d_stdio_ptr_lval;;
13580         esac
13581         case "$stdio_cnt" in
13582         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13583                 cnt_lval=$undef
13584                 ;;
13585         *)      cnt_lval=$d_stdio_cnt_lval;;
13586         esac
13587         case "$stdio_base" in
13588         '') stdio_base='((fp)->_IO_read_base)';;
13589         esac
13590         case "$stdio_bufsiz" in
13591         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13592         esac
13593 else
13594         case "$stdio_ptr" in
13595         '') stdio_ptr='((fp)->_ptr)'
13596                 ptr_lval=$define
13597                 ;;
13598         *)      ptr_lval=$d_stdio_ptr_lval;;
13599         esac
13600         case "$stdio_cnt" in
13601         '') stdio_cnt='((fp)->_cnt)'
13602                 cnt_lval=$define
13603                 ;;
13604         *)      cnt_lval=$d_stdio_cnt_lval;;
13605         esac
13606         case "$stdio_base" in
13607         '') stdio_base='((fp)->_base)';;
13608         esac
13609         case "$stdio_bufsiz" in
13610         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13611         esac
13612 fi
13613
13614 : test whether _ptr and _cnt really work
13615 echo "Checking how std your stdio is..." >&4
13616 $cat >try.c <<EOP
13617 #include <stdio.h>
13618 #$i_stdlib I_STDLIB
13619 #ifdef I_STDLIB
13620 #include <stdlib.h>
13621 #endif
13622 #define FILE_ptr(fp)    $stdio_ptr
13623 #define FILE_cnt(fp)    $stdio_cnt
13624 int main() {
13625         FILE *fp = fopen("try.c", "r");
13626         char c = getc(fp);
13627         if (
13628                 18 <= FILE_cnt(fp) &&
13629                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13630         )
13631                 exit(0);
13632         exit(1);
13633 }
13634 EOP
13635 val="$undef"
13636 set try
13637 if eval $compile && $to try.c; then
13638         if $run ./try; then
13639                 echo "Your stdio acts pretty std."
13640                 val="$define"
13641         else
13642                 echo "Your stdio isn't very std."
13643         fi
13644 else
13645         echo "Your stdio doesn't appear very std."
13646 fi
13647 $rm_try
13648
13649 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13650 # direct buffer manipulation no longer works.  The Configure tests
13651 # should be changed to correctly detect this, but until then,
13652 # the following check should at least let perl compile and run.
13653 # (This quick fix should be updated before 5.8.1.)
13654 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13655 # A. Dougherty, June 3, 2002.
13656 case "$d_gnulibc" in
13657 $define)
13658         case "$gnulibc_version" in
13659         2.[01]*)  ;;
13660         2.2) ;;
13661         2.2.[0-9]) ;;
13662         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13663                 val="$undef"
13664                 ;;
13665         esac
13666         ;;
13667 esac
13668 set d_stdstdio
13669 eval $setvar
13670
13671 : Can _ptr be used as an lvalue?
13672 case "$d_stdstdio$ptr_lval" in
13673 $define$define) val=$define ;;
13674 *) val=$undef ;;
13675 esac
13676 set d_stdio_ptr_lval
13677 eval $setvar
13678
13679 : Can _cnt be used as an lvalue?
13680 case "$d_stdstdio$cnt_lval" in
13681 $define$define) val=$define ;;
13682 *) val=$undef ;;
13683 esac
13684 set d_stdio_cnt_lval
13685 eval $setvar
13686
13687
13688 : test whether setting _ptr sets _cnt as a side effect
13689 d_stdio_ptr_lval_sets_cnt="$undef"
13690 d_stdio_ptr_lval_nochange_cnt="$undef"
13691 case "$d_stdio_ptr_lval$d_stdstdio" in
13692 $define$define)
13693         echo "Checking to see what happens if we set the stdio ptr..." >&4
13694 $cat >try.c <<EOP
13695 #include <stdio.h>
13696 /* Can we scream? */
13697 /* Eat dust sed :-) */
13698 /* In the buffer space, no one can hear you scream. */
13699 #$i_stdlib I_STDLIB
13700 #ifdef I_STDLIB
13701 #include <stdlib.h>
13702 #endif
13703 #define FILE_ptr(fp)    $stdio_ptr
13704 #define FILE_cnt(fp)    $stdio_cnt
13705 #include <sys/types.h>
13706 int main() {
13707         FILE *fp = fopen("try.c", "r");
13708         int c;
13709         char *ptr;
13710         size_t cnt;
13711         if (!fp) {
13712             puts("Fail even to read");
13713             exit(1);
13714         }
13715         c = getc(fp); /* Read away the first # */
13716         if (c == EOF) {
13717             puts("Fail even to read");
13718             exit(1);
13719         }
13720         if (!(
13721                 18 <= FILE_cnt(fp) &&
13722                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13723         )) {
13724                 puts("Fail even to read");
13725                 exit (1);
13726         }
13727         ptr = (char*) FILE_ptr(fp);
13728         cnt = (size_t)FILE_cnt(fp);
13729
13730         FILE_ptr(fp) += 42;
13731
13732         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13733                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13734                 exit (1);
13735         }
13736         if (FILE_cnt(fp) <= 20) {
13737                 printf ("Fail (<20 chars to test)");
13738                 exit (1);
13739         }
13740         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13741                 puts("Fail compare");
13742                 exit (1);
13743         }
13744         if (cnt == FILE_cnt(fp)) {
13745                 puts("Pass_unchanged");
13746                 exit (0);
13747         }
13748         if (FILE_cnt(fp) == (cnt - 42)) {
13749                 puts("Pass_changed");
13750                 exit (0);
13751         }
13752         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13753         return 1;
13754
13755 }
13756 EOP
13757         set try
13758         if eval $compile && $to try.c; then
13759                 case `$run ./try` in
13760                 Pass_changed)
13761                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13762                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13763                 Pass_unchanged)
13764                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13765                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13766                 Fail*)
13767                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13768                 *)
13769                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13770         esac
13771         else
13772                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13773         fi
13774         $rm_try
13775         ;;
13776 esac
13777
13778 : see if _base is also standard
13779 val="$undef"
13780 case "$d_stdstdio" in
13781 $define)
13782         $cat >try.c <<EOP
13783 #include <stdio.h>
13784 #$i_stdlib I_STDLIB
13785 #ifdef I_STDLIB
13786 #include <stdlib.h>
13787 #endif
13788 #define FILE_base(fp)   $stdio_base
13789 #define FILE_bufsiz(fp) $stdio_bufsiz
13790 int main() {
13791         FILE *fp = fopen("try.c", "r");
13792         char c = getc(fp);
13793         if (
13794                 19 <= FILE_bufsiz(fp) &&
13795                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13796         )
13797                 exit(0);
13798         exit(1);
13799 }
13800 EOP
13801         set try
13802         if eval $compile && $to try.c; then
13803                 if $run ./try; then
13804                         echo "And its _base field acts std."
13805                         val="$define"
13806                 else
13807                         echo "But its _base field isn't std."
13808                 fi
13809         else
13810                 echo "However, it seems to be lacking the _base field."
13811         fi
13812         $rm_try
13813         ;;
13814 esac
13815 set d_stdiobase
13816 eval $setvar
13817
13818 : see if fast_stdio exists
13819 val="$undef"
13820 case "$d_stdstdio:$d_stdio_ptr_lval" in
13821 "$define:$define")
13822         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13823         *$define*)
13824                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13825                 val="$define"
13826                 ;;
13827         esac
13828         ;;
13829 esac
13830 set d_faststdio
13831 eval $setvar
13832
13833
13834
13835 : see if fchdir exists
13836 set fchdir d_fchdir
13837 eval $inlibc
13838
13839 : see if fchmod exists
13840 set fchmod d_fchmod
13841 eval $inlibc
13842
13843 : see if fchown exists
13844 set fchown d_fchown
13845 eval $inlibc
13846
13847 : see if this is an fcntl system
13848 set fcntl d_fcntl
13849 eval $inlibc
13850
13851 : See if fcntl-based locking works.
13852 echo " "
13853 $cat >try.c <<EOCP
13854 #$i_stdlib I_STDLIB
13855 #ifdef I_STDLIB
13856 #include <stdlib.h>
13857 #endif
13858 #include <unistd.h>
13859 #include <fcntl.h>
13860 #include <signal.h>
13861 $signal_t blech(int x) { exit(3); }
13862 int main() {
13863 #if defined(F_SETLK) && defined(F_SETLKW)
13864      struct flock flock;
13865      int retval, fd;
13866      fd = open("try.c", O_RDONLY);
13867      flock.l_type = F_RDLCK;
13868      flock.l_whence = SEEK_SET;
13869      flock.l_start = flock.l_len = 0;
13870      signal(SIGALRM, blech);
13871      alarm(10);
13872      retval = fcntl(fd, F_SETLK, &flock);
13873      close(fd);
13874      (retval < 0 ? exit(2) : exit(0));
13875 #else
13876      exit(2);
13877 #endif
13878 }
13879 EOCP
13880 echo "Checking if fcntl-based file locking works... "
13881 case "$d_fcntl" in
13882 "$define")
13883         set try
13884         if eval $compile_ok; then
13885                 if $run ./try; then
13886                         echo "Yes, it seems to work."
13887                         val="$define"
13888                 else
13889                         echo "Nope, it didn't work."
13890                         val="$undef"
13891                         case "$?" in
13892                         3) $cat >&4 <<EOM
13893 ***
13894 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13895 *** This is (almost) impossible.
13896 *** If your NFS lock daemons are not feeling well, something like
13897 *** this may happen, please investigate.  Cannot continue, aborting.
13898 ***
13899 EOM
13900                                 exit 1
13901                                 ;;
13902                         esac
13903                 fi
13904         else
13905                 echo "I'm unable to compile the test program, so I'll assume not."
13906                 val="$undef"
13907         fi
13908         ;;
13909 *) val="$undef";
13910         echo "Nope, since you don't even have fcntl()."
13911         ;;
13912 esac
13913 set d_fcntl_can_lock
13914 eval $setvar
13915 $rm_try
13916
13917 : check for fd_set items
13918 $cat <<EOM
13919
13920 Checking to see how well your C compiler handles fd_set and friends ...
13921 EOM
13922 $cat >try.c <<EOCP
13923 #$i_stdlib I_STDLIB
13924 #ifdef I_STDLIB
13925 #include <stdlib.h>
13926 #endif
13927 #$i_systime I_SYS_TIME
13928 #$i_sysselct I_SYS_SELECT
13929 #$d_socket HAS_SOCKET
13930 #include <sys/types.h>
13931 #ifdef HAS_SOCKET
13932 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13933 #endif
13934 #ifdef I_SYS_TIME
13935 #include <sys/time.h>
13936 #endif
13937 #ifdef I_SYS_SELECT
13938 #include <sys/select.h>
13939 #endif
13940 int main() {
13941         fd_set fds;
13942
13943 #ifdef TRYBITS
13944         if(fds.fds_bits);
13945 #endif
13946
13947 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13948         exit(0);
13949 #else
13950         exit(1);
13951 #endif
13952 }
13953 EOCP
13954 set try -DTRYBITS
13955 if eval $compile; then
13956         d_fds_bits="$define"
13957         d_fd_set="$define"
13958         echo "Well, your system knows about the normal fd_set typedef..." >&4
13959         if $run ./try; then
13960                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13961                 d_fd_macros="$define"
13962         else
13963                 $cat >&4 <<'EOM'
13964 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13965 EOM
13966                 d_fd_macros="$undef"
13967         fi
13968 else
13969         $cat <<'EOM'
13970 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13971 EOM
13972         set try
13973         if eval $compile; then
13974                 d_fds_bits="$undef"
13975                 d_fd_set="$define"
13976                 echo "Well, your system has some sort of fd_set available..." >&4
13977                 if $run ./try; then
13978                         echo "and you have the normal fd_set macros." >&4
13979                         d_fd_macros="$define"
13980                 else
13981                         $cat <<'EOM'
13982 but not the normal fd_set macros!  Gross!  More work for me...
13983 EOM
13984                         d_fd_macros="$undef"
13985                 fi
13986         else
13987         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13988                 d_fd_set="$undef"
13989                 d_fds_bits="$undef"
13990                 d_fd_macros="$undef"
13991         fi
13992 fi
13993 $rm_try
13994
13995 : see if fdclose exists
13996 set fdclose d_fdclose
13997 eval $inlibc
13998
13999 : see if fdim exists
14000 set fdim d_fdim
14001 eval $inlibc
14002
14003 : see if fegetround exists
14004 set fegetround d_fegetround
14005 eval $inlibc
14006
14007 : see if fgetpos exists
14008 set fgetpos d_fgetpos
14009 eval $inlibc
14010
14011 : see if finite exists
14012 set finite d_finite
14013 eval $inlibc
14014
14015 : see if finitel exists
14016 set finitel d_finitel
14017 eval $inlibc
14018
14019 : see if flock exists
14020 set flock d_flock
14021 eval $inlibc
14022
14023 : see if prototype for flock is available
14024 echo " "
14025 set d_flockproto flock $i_sysfile sys/file.h
14026 eval $hasproto
14027
14028 : see if fma exists
14029 set fma d_fma
14030 eval $inlibc
14031
14032 : see if fmax exists
14033 set fmax d_fmax
14034 eval $inlibc
14035
14036 : see if fmin exists
14037 set fmin d_fmin
14038 eval $inlibc
14039
14040 : see if fp_class exists
14041 set fp_class d_fp_class
14042 eval $inlibc
14043
14044 : see if this is a math.h system
14045 set math.h i_math
14046 eval $inhdr
14047
14048 : check for fpclassify
14049 echo "Checking to see if you have fpclassify..." >&4
14050 $cat >try.c <<EOCP
14051 #$i_math I_MATH
14052 #ifdef I_MATH
14053 #include <math.h>
14054 #endif
14055 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14056 EOCP
14057 set try
14058 if eval $compile; then
14059         val="$define"
14060         echo "You have fpclassify."
14061 else
14062         val="$undef"
14063         echo "You do not have fpclassify."
14064 fi
14065 $rm_try
14066 set d_fpclassify
14067 eval $setvar
14068
14069 : see if fp_classify exists
14070 set fp_classify d_fp_classify
14071 eval $inlibc
14072
14073 : see if fp_classl exists
14074 set fp_classl d_fp_classl
14075 eval $inlibc
14076
14077 : see if pathconf exists
14078 set pathconf d_pathconf
14079 eval $inlibc
14080
14081 : see if fpathconf exists
14082 set fpathconf d_fpathconf
14083 eval $inlibc
14084
14085 : see if fpclass exists
14086 set fpclass d_fpclass
14087 eval $inlibc
14088
14089 : see if fpclassl exists
14090 set fpclassl d_fpclassl
14091 eval $inlibc
14092
14093 : see if fpgetround exists
14094 set fpgetround d_fpgetround
14095 eval $inlibc
14096
14097 : check for fpos64_t
14098 echo " "
14099 echo "Checking to see if you have fpos64_t..." >&4
14100 $cat >try.c <<EOCP
14101 #include <stdio.h>
14102 int main() { fpos64_t x = 7; }
14103 EOCP
14104 set try
14105 if eval $compile; then
14106         val="$define"
14107         echo "You have fpos64_t."
14108 else
14109         val="$undef"
14110         echo "You do not have fpos64_t."
14111         case "$fpossize" in
14112         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14113         esac
14114 fi
14115 $rm_try
14116 set d_fpos64_t
14117 eval $setvar
14118
14119 : see if frexpl exists
14120 set frexpl d_frexpl
14121 eval $inlibc
14122
14123 : see if this is a sys/param system
14124 set sys/param.h i_sysparam
14125 eval $inhdr
14126
14127 : see if this is a sys/mount.h system
14128 set sys/mount.h i_sysmount
14129 eval $inhdr
14130
14131 : Check for fs_data_s
14132 echo " "
14133 echo "Checking to see if your system supports struct fs_data..." >&4
14134 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14135 eval $hasstruct
14136 case "$d_fs_data_s" in
14137 "$define")      echo "Yes, it does."   ;;
14138 *)              echo "No, it doesn't." ;;
14139 esac
14140
14141 : see if fseeko exists
14142 set fseeko d_fseeko
14143 eval $inlibc
14144 case "$longsize" in
14145 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14146 esac
14147
14148 : see if fsetpos exists
14149 set fsetpos d_fsetpos
14150 eval $inlibc
14151
14152 : see if fstatfs exists
14153 set fstatfs d_fstatfs
14154 eval $inlibc
14155
14156 : see if statvfs exists
14157 set statvfs d_statvfs
14158 eval $inlibc
14159
14160 : see if fstatvfs exists
14161 set fstatvfs d_fstatvfs
14162 eval $inlibc
14163
14164
14165 : see if fsync exists
14166 set fsync d_fsync
14167 eval $inlibc
14168
14169 : see if ftello exists
14170 set ftello d_ftello
14171 eval $inlibc
14172 case "$longsize" in
14173 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14174 esac
14175
14176 : check for a working futimes
14177 d_futimes="$undef"
14178 echo " "
14179 echo "Checking if you have a working futimes()" >&4
14180 $cat >try.c <<EOCP
14181 #include <stdio.h>
14182 #include <sys/time.h>
14183 #include <errno.h>
14184 #include <fcntl.h>
14185
14186 int main ()
14187 {
14188     int fd, rv;
14189     fd = open ("try.c", O_RDWR);
14190     if (-1 == fd) exit (1);
14191     rv = futimes (fd, NULL);
14192     exit (rv == -1 ? errno : 0);
14193 }
14194 EOCP
14195 set try
14196 if eval $compile; then
14197     `$run ./try`
14198     rc=$?
14199     case "$rc" in
14200         0)  echo "Yes, you have" >&4
14201             d_futimes="$define"
14202             ;;
14203         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14204             ;;
14205     esac
14206 else
14207     echo "No, it does not (probably harmless)" >&4
14208 fi
14209 $rm_try
14210
14211 : see if ndbm.h is available
14212 set ndbm.h i_ndbm
14213 eval $inhdr
14214 : Compatibility location for RedHat 7.1
14215 set gdbm/ndbm.h i_gdbmndbm
14216 eval $inhdr
14217 : Compatibility location for Debian 4.0
14218 set gdbm-ndbm.h i_gdbm_ndbm
14219 eval $inhdr
14220
14221 val="$undef"
14222 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14223         : see if dbm_open exists
14224         set dbm_open d_dbm_open
14225         eval $inlibc
14226         case "$d_dbm_open" in
14227         $undef)
14228                 i_ndbm="$undef"
14229                 i_gdbmndbm="$undef"
14230                 i_gdbm_ndbm="$undef"
14231                 echo "We won't be including <ndbm.h>"
14232                 val="$undef"
14233                 ;;
14234         *) val="$define"
14235            ;;
14236         esac
14237 fi
14238 set d_ndbm
14239 eval $setvar
14240
14241 ndbm_hdr_protochk='name=$1; hdr=$2;
14242 eval "ihdr=\$""i_$name";
14243 val="$undef";
14244 if $test "$ihdr" = "$define"; then
14245         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14246         case "$d_cplusplus" in
14247         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14248         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14249         esac;
14250         case "$val" in
14251         $define) $echo "Your <$hdr> seems to have prototypes";;
14252         *) $echo "Your <$hdr> does not seem to have prototypes";;
14253         esac;
14254 fi;
14255 set "d_${name}_h_uses_prototypes";
14256 eval $setvar'
14257
14258 set ndbm ndbm.h
14259 eval $ndbm_hdr_protochk
14260 set gdbmndbm gdbm/ndbm.h
14261 eval $ndbm_hdr_protochk
14262 set gdbm_ndbm gdbm-ndbm.h
14263 eval $ndbm_hdr_protochk
14264
14265 : see if getaddrinfo exists
14266 set getaddrinfo d_getaddrinfo
14267 eval $inlibc
14268
14269 : see if getcwd exists
14270 set getcwd d_getcwd
14271 eval $inlibc
14272
14273 : see if getespwnam exists
14274 set getespwnam d_getespwnam
14275 eval $inlibc
14276
14277 : see if getfsstat exists
14278 set getfsstat d_getfsstat
14279 eval $inlibc
14280
14281 : see if getgrent exists
14282 set getgrent d_getgrent
14283 eval $inlibc
14284
14285 : see if getgrent_r exists
14286 set getgrent_r d_getgrent_r
14287 eval $inlibc
14288 case "$d_getgrent_r" in
14289 "$define")
14290         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14291         case "$d_getgrent_r_proto:$usethreads" in
14292         ":define")      d_getgrent_r_proto=define
14293                 set d_getgrent_r_proto getgrent_r $hdrs
14294                 eval $hasproto ;;
14295         *)      ;;
14296         esac
14297         case "$d_getgrent_r_proto" in
14298         define)
14299         case "$getgrent_r_proto" in
14300         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14301         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14302         esac
14303         case "$getgrent_r_proto" in
14304         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14305         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14306         esac
14307         case "$getgrent_r_proto" in
14308         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14309         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14310         esac
14311         case "$getgrent_r_proto" in
14312         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14313         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14314         esac
14315         case "$getgrent_r_proto" in
14316         ''|0) try='int getgrent_r(struct group*, char*, int);'
14317         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14318         esac
14319         case "$getgrent_r_proto" in
14320         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14321         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14322         esac
14323         case "$getgrent_r_proto" in
14324         ''|0)   d_getgrent_r=undef
14325                 getgrent_r_proto=0
14326                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14327         * )     case "$getgrent_r_proto" in
14328                 REENTRANT_PROTO*) ;;
14329                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14330                 esac
14331                 echo "Prototype: $try" ;;
14332         esac
14333         ;;
14334         *)      case "$usethreads" in
14335                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14336                 esac
14337                 d_getgrent_r=undef
14338                 getgrent_r_proto=0
14339                 ;;
14340         esac
14341         ;;
14342 *)      getgrent_r_proto=0
14343         ;;
14344 esac
14345
14346 : see if getgrgid_r exists
14347 set getgrgid_r d_getgrgid_r
14348 eval $inlibc
14349 case "$d_getgrgid_r" in
14350 "$define")
14351         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14352         case "$d_getgrgid_r_proto:$usethreads" in
14353         ":define")      d_getgrgid_r_proto=define
14354                 set d_getgrgid_r_proto getgrgid_r $hdrs
14355                 eval $hasproto ;;
14356         *)      ;;
14357         esac
14358         case "$d_getgrgid_r_proto" in
14359         define)
14360         case "$getgrgid_r_proto" in
14361         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14362         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14363         esac
14364         case "$getgrgid_r_proto" in
14365         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14366         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14367         esac
14368         case "$getgrgid_r_proto" in
14369         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14370         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14371         esac
14372         case "$getgrgid_r_proto" in
14373         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14374         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14375         esac
14376         case "$getgrgid_r_proto" in
14377         ''|0)   d_getgrgid_r=undef
14378                 getgrgid_r_proto=0
14379                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14380         * )     case "$getgrgid_r_proto" in
14381                 REENTRANT_PROTO*) ;;
14382                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14383                 esac
14384                 echo "Prototype: $try" ;;
14385         esac
14386         ;;
14387         *)      case "$usethreads" in
14388                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14389                 esac
14390                 d_getgrgid_r=undef
14391                 getgrgid_r_proto=0
14392                 ;;
14393         esac
14394         ;;
14395 *)      getgrgid_r_proto=0
14396         ;;
14397 esac
14398
14399 : see if getgrnam_r exists
14400 set getgrnam_r d_getgrnam_r
14401 eval $inlibc
14402 case "$d_getgrnam_r" in
14403 "$define")
14404         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14405         case "$d_getgrnam_r_proto:$usethreads" in
14406         ":define")      d_getgrnam_r_proto=define
14407                 set d_getgrnam_r_proto getgrnam_r $hdrs
14408                 eval $hasproto ;;
14409         *)      ;;
14410         esac
14411         case "$d_getgrnam_r_proto" in
14412         define)
14413         case "$getgrnam_r_proto" in
14414         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14415         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14416         esac
14417         case "$getgrnam_r_proto" in
14418         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14419         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14420         esac
14421         case "$getgrnam_r_proto" in
14422         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14423         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14424         esac
14425         case "$getgrnam_r_proto" in
14426         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14427         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14428         esac
14429         case "$getgrnam_r_proto" in
14430         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14431         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14432         esac
14433         case "$getgrnam_r_proto" in
14434         ''|0)   d_getgrnam_r=undef
14435                 getgrnam_r_proto=0
14436                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14437         * )     case "$getgrnam_r_proto" in
14438                 REENTRANT_PROTO*) ;;
14439                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14440                 esac
14441                 echo "Prototype: $try" ;;
14442         esac
14443         ;;
14444         *)      case "$usethreads" in
14445                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14446                 esac
14447                 d_getgrnam_r=undef
14448                 getgrnam_r_proto=0
14449                 ;;
14450         esac
14451         ;;
14452 *)      getgrnam_r_proto=0
14453         ;;
14454 esac
14455
14456 : see if gethostbyaddr exists
14457 set gethostbyaddr d_gethbyaddr
14458 eval $inlibc
14459
14460 : see if gethostbyname exists
14461 set gethostbyname d_gethbyname
14462 eval $inlibc
14463
14464 : see if gethostent exists
14465 set gethostent d_gethent
14466 eval $inlibc
14467
14468 : see how we will look up host name
14469 echo " "
14470 call=''
14471 if set gethostname val -f d_gethname; eval $csym; $val; then
14472         echo 'gethostname() found.' >&4
14473         d_gethname="$define"
14474         call=gethostname
14475 fi
14476 if set uname val -f d_uname; eval $csym; $val; then
14477         if ./xenix; then
14478                 $cat <<'EOM'
14479 uname() was found, but you're running xenix, and older versions of xenix
14480 have a broken uname(). If you don't really know whether your xenix is old
14481 enough to have a broken system call, use the default answer.
14482
14483 EOM
14484                 dflt=y
14485                 case "$d_uname" in
14486                 "$define") dflt=n;;
14487                 esac
14488                 rp='Is your uname() broken?'
14489                 . ./myread
14490                 case "$ans" in
14491                 n*) d_uname="$define"; call=uname;;
14492                 esac
14493         else
14494                 echo 'uname() found.' >&4
14495                 d_uname="$define"
14496                 case "$call" in
14497                 '') call=uname ;;
14498                 esac
14499         fi
14500 fi
14501 case "$d_gethname" in
14502 '') d_gethname="$undef";;
14503 esac
14504 case "$d_uname" in
14505 '') d_uname="$undef";;
14506 esac
14507 case "$d_uname$d_gethname" in
14508 *define*)
14509         dflt=n
14510         cat <<EOM
14511
14512 Every now and then someone has a $call() that lies about the hostname
14513 but can't be fixed for political or economic reasons.  If you wish, I can
14514 pretend $call() isn't there and maybe compute hostname at run-time
14515 thanks to the '$phostname' command.
14516
14517 EOM
14518         rp="Shall I ignore $call() from now on?"
14519         . ./myread
14520         case "$ans" in
14521         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14522         esac;;
14523 esac
14524 case "$phostname" in
14525 '') aphostname='';;
14526 *) case "$aphostname" in
14527         /*) ;;
14528         *) set X $phostname
14529                 shift
14530                 file=$1
14531                 shift
14532                 file=`./loc $file $file $pth`
14533                 aphostname=`echo $file $*`
14534                 ;;
14535         esac
14536         ;;
14537 esac
14538 case "$d_uname$d_gethname" in
14539 *define*) ;;
14540 *)
14541         case "$phostname" in
14542         '')
14543                 echo "There will be no way for $package to get your hostname." >&4;;
14544         *)
14545         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14546                 ;;
14547         esac;;
14548 esac
14549 case "$d_phostname" in
14550 '') d_phostname="$undef";;
14551 esac
14552
14553 : see if gethostbyaddr_r exists
14554 set gethostbyaddr_r d_gethostbyaddr_r
14555 eval $inlibc
14556 case "$d_gethostbyaddr_r" in
14557 "$define")
14558         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14559         case "$d_gethostbyaddr_r_proto:$usethreads" in
14560         ":define")      d_gethostbyaddr_r_proto=define
14561                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14562                 eval $hasproto ;;
14563         *)      ;;
14564         esac
14565         case "$d_gethostbyaddr_r_proto" in
14566         define)
14567         case "$gethostbyaddr_r_proto" in
14568         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14569         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14570         esac
14571         case "$gethostbyaddr_r_proto" in
14572         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14573         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14574         esac
14575         case "$gethostbyaddr_r_proto" in
14576         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14577         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14578         esac
14579         case "$gethostbyaddr_r_proto" in
14580         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14581         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14582         esac
14583         case "$gethostbyaddr_r_proto" in
14584         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14585         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14586         esac
14587         case "$gethostbyaddr_r_proto" in
14588         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14589         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14590         esac
14591         case "$gethostbyaddr_r_proto" in
14592         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14593         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14594         esac
14595         case "$gethostbyaddr_r_proto" in
14596         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14597         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14598         esac
14599         case "$gethostbyaddr_r_proto" in
14600         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14601         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14602         esac
14603         case "$gethostbyaddr_r_proto" in
14604         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14605         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14606         esac
14607         case "$gethostbyaddr_r_proto" in
14608         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14609         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14610         esac
14611         case "$gethostbyaddr_r_proto" in
14612         ''|0)   d_gethostbyaddr_r=undef
14613                 gethostbyaddr_r_proto=0
14614                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14615         * )     case "$gethostbyaddr_r_proto" in
14616                 REENTRANT_PROTO*) ;;
14617                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14618                 esac
14619                 echo "Prototype: $try" ;;
14620         esac
14621         ;;
14622         *)      case "$usethreads" in
14623                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14624                 esac
14625                 d_gethostbyaddr_r=undef
14626                 gethostbyaddr_r_proto=0
14627                 ;;
14628         esac
14629         ;;
14630 *)      gethostbyaddr_r_proto=0
14631         ;;
14632 esac
14633
14634 : see if gethostbyname_r exists
14635 set gethostbyname_r d_gethostbyname_r
14636 eval $inlibc
14637 case "$d_gethostbyname_r" in
14638 "$define")
14639         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14640         case "$d_gethostbyname_r_proto:$usethreads" in
14641         ":define")      d_gethostbyname_r_proto=define
14642                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14643                 eval $hasproto ;;
14644         *)      ;;
14645         esac
14646         case "$d_gethostbyname_r_proto" in
14647         define)
14648         case "$gethostbyname_r_proto" in
14649         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14650         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14651         esac
14652         case "$gethostbyname_r_proto" in
14653         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14654         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14655         esac
14656         case "$gethostbyname_r_proto" in
14657         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14658         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14659         esac
14660         case "$gethostbyname_r_proto" in
14661         ''|0)   d_gethostbyname_r=undef
14662                 gethostbyname_r_proto=0
14663                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14664         * )     case "$gethostbyname_r_proto" in
14665                 REENTRANT_PROTO*) ;;
14666                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14667                 esac
14668                 echo "Prototype: $try" ;;
14669         esac
14670         ;;
14671         *)      case "$usethreads" in
14672                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14673                 esac
14674                 d_gethostbyname_r=undef
14675                 gethostbyname_r_proto=0
14676                 ;;
14677         esac
14678         ;;
14679 *)      gethostbyname_r_proto=0
14680         ;;
14681 esac
14682
14683 : see if gethostent_r exists
14684 set gethostent_r d_gethostent_r
14685 eval $inlibc
14686 case "$d_gethostent_r" in
14687 "$define")
14688         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14689         case "$d_gethostent_r_proto:$usethreads" in
14690         ":define")      d_gethostent_r_proto=define
14691                 set d_gethostent_r_proto gethostent_r $hdrs
14692                 eval $hasproto ;;
14693         *)      ;;
14694         esac
14695         case "$d_gethostent_r_proto" in
14696         define)
14697         case "$gethostent_r_proto" in
14698         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14699         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14700         esac
14701         case "$gethostent_r_proto" in
14702         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14703         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14704         esac
14705         case "$gethostent_r_proto" in
14706         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14707         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14708         esac
14709         case "$gethostent_r_proto" in
14710         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14711         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14712         esac
14713         case "$gethostent_r_proto" in
14714         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14715         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14716         esac
14717         case "$gethostent_r_proto" in
14718         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14719         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14720         esac
14721         case "$gethostent_r_proto" in
14722         ''|0)   d_gethostent_r=undef
14723                 gethostent_r_proto=0
14724                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14725         * )     case "$gethostent_r_proto" in
14726                 REENTRANT_PROTO*) ;;
14727                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14728                 esac
14729                 echo "Prototype: $try" ;;
14730         esac
14731         ;;
14732         *)      case "$usethreads" in
14733                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14734                 esac
14735                 d_gethostent_r=undef
14736                 gethostent_r_proto=0
14737                 ;;
14738         esac
14739         ;;
14740 *)      gethostent_r_proto=0
14741         ;;
14742 esac
14743
14744 : see if prototypes for various gethostxxx netdb.h functions are available
14745 echo " "
14746 set d_gethostprotos gethostent $i_netdb netdb.h
14747 eval $hasproto
14748
14749 : see if getitimer exists
14750 set getitimer d_getitimer
14751 eval $inlibc
14752
14753 : see if getlogin exists
14754 set getlogin d_getlogin
14755 eval $inlibc
14756
14757 : see if getlogin_r exists
14758 set getlogin_r d_getlogin_r
14759 eval $inlibc
14760 case "$d_getlogin_r" in
14761 "$define")
14762         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14763         case "$d_getlogin_r_proto:$usethreads" in
14764         ":define")      d_getlogin_r_proto=define
14765                 set d_getlogin_r_proto getlogin_r $hdrs
14766                 eval $hasproto ;;
14767         *)      ;;
14768         esac
14769         case "$d_getlogin_r_proto" in
14770         define)
14771         case "$getlogin_r_proto" in
14772         ''|0) try='int getlogin_r(char*, size_t);'
14773         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14774         esac
14775         case "$getlogin_r_proto" in
14776         ''|0) try='int getlogin_r(char*, int);'
14777         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14778         esac
14779         case "$getlogin_r_proto" in
14780         ''|0) try='char* getlogin_r(char*, size_t);'
14781         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14782         esac
14783         case "$getlogin_r_proto" in
14784         ''|0) try='char* getlogin_r(char*, int);'
14785         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14786         esac
14787         case "$getlogin_r_proto" in
14788         ''|0)   d_getlogin_r=undef
14789                 getlogin_r_proto=0
14790                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14791         * )     case "$getlogin_r_proto" in
14792                 REENTRANT_PROTO*) ;;
14793                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14794                 esac
14795                 echo "Prototype: $try" ;;
14796         esac
14797         ;;
14798         *)      case "$usethreads" in
14799                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14800                 esac
14801                 d_getlogin_r=undef
14802                 getlogin_r_proto=0
14803                 ;;
14804         esac
14805         ;;
14806 *)      getlogin_r_proto=0
14807         ;;
14808 esac
14809
14810 : see if getmnt exists
14811 set getmnt d_getmnt
14812 eval $inlibc
14813
14814 : see if getmntent exists
14815 set getmntent d_getmntent
14816 eval $inlibc
14817
14818 : see if getnameinfo exists
14819 set getnameinfo d_getnameinfo
14820 eval $inlibc
14821
14822 : see if getnetbyaddr exists
14823 set getnetbyaddr d_getnbyaddr
14824 eval $inlibc
14825
14826 : see if getnetbyname exists
14827 set getnetbyname d_getnbyname
14828 eval $inlibc
14829
14830 : see if getnetent exists
14831 set getnetent d_getnent
14832 eval $inlibc
14833
14834 : see if getnetbyaddr_r exists
14835 set getnetbyaddr_r d_getnetbyaddr_r
14836 eval $inlibc
14837 case "$d_getnetbyaddr_r" in
14838 "$define")
14839         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14840         case "$d_getnetbyaddr_r_proto:$usethreads" in
14841         ":define")      d_getnetbyaddr_r_proto=define
14842                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14843                 eval $hasproto ;;
14844         *)      ;;
14845         esac
14846         case "$d_getnetbyaddr_r_proto" in
14847         define)
14848         case "$getnetbyaddr_r_proto" in
14849         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14850         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14851         esac
14852         case "$getnetbyaddr_r_proto" in
14853         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14854         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14855         esac
14856         case "$getnetbyaddr_r_proto" in
14857         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14858         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14859         esac
14860         case "$getnetbyaddr_r_proto" in
14861         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14862         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14863         esac
14864         case "$getnetbyaddr_r_proto" in
14865         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14866         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14867         esac
14868         case "$getnetbyaddr_r_proto" in
14869         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14870         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14871         esac
14872         case "$getnetbyaddr_r_proto" in
14873         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14874         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14875         esac
14876         case "$getnetbyaddr_r_proto" in
14877         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14878         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14879         esac
14880         case "$getnetbyaddr_r_proto" in
14881         ''|0)   d_getnetbyaddr_r=undef
14882                 getnetbyaddr_r_proto=0
14883                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14884         * )     case "$getnetbyaddr_r_proto" in
14885                 REENTRANT_PROTO*) ;;
14886                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14887                 esac
14888                 echo "Prototype: $try" ;;
14889         esac
14890         ;;
14891         *)      case "$usethreads" in
14892                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14893                 esac
14894                 d_getnetbyaddr_r=undef
14895                 getnetbyaddr_r_proto=0
14896                 ;;
14897         esac
14898         ;;
14899 *)      getnetbyaddr_r_proto=0
14900         ;;
14901 esac
14902
14903 : see if getnetbyname_r exists
14904 set getnetbyname_r d_getnetbyname_r
14905 eval $inlibc
14906 case "$d_getnetbyname_r" in
14907 "$define")
14908         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14909         case "$d_getnetbyname_r_proto:$usethreads" in
14910         ":define")      d_getnetbyname_r_proto=define
14911                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14912                 eval $hasproto ;;
14913         *)      ;;
14914         esac
14915         case "$d_getnetbyname_r_proto" in
14916         define)
14917         case "$getnetbyname_r_proto" in
14918         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14919         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14920         esac
14921         case "$getnetbyname_r_proto" in
14922         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14923         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14924         esac
14925         case "$getnetbyname_r_proto" in
14926         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14927         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14928         esac
14929         case "$getnetbyname_r_proto" in
14930         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14931         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14932         esac
14933         case "$getnetbyname_r_proto" in
14934         ''|0)   d_getnetbyname_r=undef
14935                 getnetbyname_r_proto=0
14936                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14937         * )     case "$getnetbyname_r_proto" in
14938                 REENTRANT_PROTO*) ;;
14939                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14940                 esac
14941                 echo "Prototype: $try" ;;
14942         esac
14943         ;;
14944         *)      case "$usethreads" in
14945                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14946                 esac
14947                 d_getnetbyname_r=undef
14948                 getnetbyname_r_proto=0
14949                 ;;
14950         esac
14951         ;;
14952 *)      getnetbyname_r_proto=0
14953         ;;
14954 esac
14955
14956 : see if getnetent_r exists
14957 set getnetent_r d_getnetent_r
14958 eval $inlibc
14959 case "$d_getnetent_r" in
14960 "$define")
14961         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14962         case "$d_getnetent_r_proto:$usethreads" in
14963         ":define")      d_getnetent_r_proto=define
14964                 set d_getnetent_r_proto getnetent_r $hdrs
14965                 eval $hasproto ;;
14966         *)      ;;
14967         esac
14968         case "$d_getnetent_r_proto" in
14969         define)
14970         case "$getnetent_r_proto" in
14971         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14972         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14973         esac
14974         case "$getnetent_r_proto" in
14975         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14976         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14977         esac
14978         case "$getnetent_r_proto" in
14979         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14980         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14981         esac
14982         case "$getnetent_r_proto" in
14983         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14984         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14985         esac
14986         case "$getnetent_r_proto" in
14987         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14988         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14989         esac
14990         case "$getnetent_r_proto" in
14991         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14992         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14993         esac
14994         case "$getnetent_r_proto" in
14995         ''|0)   d_getnetent_r=undef
14996                 getnetent_r_proto=0
14997                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14998         * )     case "$getnetent_r_proto" in
14999                 REENTRANT_PROTO*) ;;
15000                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15001                 esac
15002                 echo "Prototype: $try" ;;
15003         esac
15004         ;;
15005         *)      case "$usethreads" in
15006                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15007                 esac
15008                 d_getnetent_r=undef
15009                 getnetent_r_proto=0
15010                 ;;
15011         esac
15012         ;;
15013 *)      getnetent_r_proto=0
15014         ;;
15015 esac
15016
15017 : see if prototypes for various getnetxxx netdb.h functions are available
15018 echo " "
15019 set d_getnetprotos getnetent $i_netdb netdb.h
15020 eval $hasproto
15021
15022 : see if getpagesize exists
15023 set getpagesize d_getpagsz
15024 eval $inlibc
15025
15026 : Optional checks for getprotobyname and getprotobynumber
15027
15028 : see if getprotobyname exists
15029 set getprotobyname d_getpbyname
15030 eval $inlibc
15031
15032 : see if getprotobynumber exists
15033 set getprotobynumber d_getpbynumber
15034 eval $inlibc
15035
15036 : see if getprotoent exists
15037 set getprotoent d_getpent
15038 eval $inlibc
15039
15040 : see if getpgid exists
15041 set getpgid d_getpgid
15042 eval $inlibc
15043
15044 : see if getpgrp2 exists
15045 set getpgrp2 d_getpgrp2
15046 eval $inlibc
15047
15048 : see if getppid exists
15049 set getppid d_getppid
15050 eval $inlibc
15051
15052 : see if getpriority exists
15053 set getpriority d_getprior
15054 eval $inlibc
15055
15056 : see if getprotobyname_r exists
15057 set getprotobyname_r d_getprotobyname_r
15058 eval $inlibc
15059 case "$d_getprotobyname_r" in
15060 "$define")
15061         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15062         case "$d_getprotobyname_r_proto:$usethreads" in
15063         ":define")      d_getprotobyname_r_proto=define
15064                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15065                 eval $hasproto ;;
15066         *)      ;;
15067         esac
15068         case "$d_getprotobyname_r_proto" in
15069         define)
15070         case "$getprotobyname_r_proto" in
15071         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15072         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15073         esac
15074         case "$getprotobyname_r_proto" in
15075         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15076         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15077         esac
15078         case "$getprotobyname_r_proto" in
15079         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15080         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15081         esac
15082         case "$getprotobyname_r_proto" in
15083         ''|0)   d_getprotobyname_r=undef
15084                 getprotobyname_r_proto=0
15085                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15086         * )     case "$getprotobyname_r_proto" in
15087                 REENTRANT_PROTO*) ;;
15088                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15089                 esac
15090                 echo "Prototype: $try" ;;
15091         esac
15092         ;;
15093         *)      case "$usethreads" in
15094                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15095                 esac
15096                 d_getprotobyname_r=undef
15097                 getprotobyname_r_proto=0
15098                 ;;
15099         esac
15100         ;;
15101 *)      getprotobyname_r_proto=0
15102         ;;
15103 esac
15104
15105 : see if getprotobynumber_r exists
15106 set getprotobynumber_r d_getprotobynumber_r
15107 eval $inlibc
15108 case "$d_getprotobynumber_r" in
15109 "$define")
15110         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15111         case "$d_getprotobynumber_r_proto:$usethreads" in
15112         ":define")      d_getprotobynumber_r_proto=define
15113                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15114                 eval $hasproto ;;
15115         *)      ;;
15116         esac
15117         case "$d_getprotobynumber_r_proto" in
15118         define)
15119         case "$getprotobynumber_r_proto" in
15120         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15121         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15122         esac
15123         case "$getprotobynumber_r_proto" in
15124         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15125         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15126         esac
15127         case "$getprotobynumber_r_proto" in
15128         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15129         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15130         esac
15131         case "$getprotobynumber_r_proto" in
15132         ''|0)   d_getprotobynumber_r=undef
15133                 getprotobynumber_r_proto=0
15134                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15135         * )     case "$getprotobynumber_r_proto" in
15136                 REENTRANT_PROTO*) ;;
15137                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15138                 esac
15139                 echo "Prototype: $try" ;;
15140         esac
15141         ;;
15142         *)      case "$usethreads" in
15143                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15144                 esac
15145                 d_getprotobynumber_r=undef
15146                 getprotobynumber_r_proto=0
15147                 ;;
15148         esac
15149         ;;
15150 *)      getprotobynumber_r_proto=0
15151         ;;
15152 esac
15153
15154 : see if getprotoent_r exists
15155 set getprotoent_r d_getprotoent_r
15156 eval $inlibc
15157 case "$d_getprotoent_r" in
15158 "$define")
15159         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15160         case "$d_getprotoent_r_proto:$usethreads" in
15161         ":define")      d_getprotoent_r_proto=define
15162                 set d_getprotoent_r_proto getprotoent_r $hdrs
15163                 eval $hasproto ;;
15164         *)      ;;
15165         esac
15166         case "$d_getprotoent_r_proto" in
15167         define)
15168         case "$getprotoent_r_proto" in
15169         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15170         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15171         esac
15172         case "$getprotoent_r_proto" in
15173         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15174         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15175         esac
15176         case "$getprotoent_r_proto" in
15177         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15178         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15179         esac
15180         case "$getprotoent_r_proto" in
15181         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15182         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15183         esac
15184         case "$getprotoent_r_proto" in
15185         ''|0)   d_getprotoent_r=undef
15186                 getprotoent_r_proto=0
15187                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15188         * )     case "$getprotoent_r_proto" in
15189                 REENTRANT_PROTO*) ;;
15190                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15191                 esac
15192                 echo "Prototype: $try" ;;
15193         esac
15194         ;;
15195         *)      case "$usethreads" in
15196                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15197                 esac
15198                 d_getprotoent_r=undef
15199                 getprotoent_r_proto=0
15200                 ;;
15201         esac
15202         ;;
15203 *)      getprotoent_r_proto=0
15204         ;;
15205 esac
15206
15207 : see if prototypes for various getprotoxxx netdb.h functions are available
15208 echo " "
15209 set d_getprotoprotos getprotoent $i_netdb netdb.h
15210 eval $hasproto
15211
15212 : see if getprpwnam exists
15213 set getprpwnam d_getprpwnam
15214 eval $inlibc
15215
15216 : see if getpwent exists
15217 set getpwent d_getpwent
15218 eval $inlibc
15219
15220 : see if getpwent_r exists
15221 set getpwent_r d_getpwent_r
15222 eval $inlibc
15223 case "$d_getpwent_r" in
15224 "$define")
15225         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15226         case "$d_getpwent_r_proto:$usethreads" in
15227         ":define")      d_getpwent_r_proto=define
15228                 set d_getpwent_r_proto getpwent_r $hdrs
15229                 eval $hasproto ;;
15230         *)      ;;
15231         esac
15232         case "$d_getpwent_r_proto" in
15233         define)
15234         case "$getpwent_r_proto" in
15235         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15236         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15237         esac
15238         case "$getpwent_r_proto" in
15239         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15240         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15241         esac
15242         case "$getpwent_r_proto" in
15243         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15244         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15245         esac
15246         case "$getpwent_r_proto" in
15247         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15248         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15249         esac
15250         case "$getpwent_r_proto" in
15251         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15252         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15253         esac
15254         case "$getpwent_r_proto" in
15255         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15256         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15257         esac
15258         case "$getpwent_r_proto" in
15259         ''|0)   d_getpwent_r=undef
15260                 getpwent_r_proto=0
15261                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15262         * )     case "$getpwent_r_proto" in
15263                 REENTRANT_PROTO*) ;;
15264                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15265                 esac
15266                 echo "Prototype: $try" ;;
15267         esac
15268         ;;
15269         *)      case "$usethreads" in
15270                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15271                 esac
15272                 d_getpwent_r=undef
15273                 getpwent_r_proto=0
15274                 ;;
15275         esac
15276         ;;
15277 *)      getpwent_r_proto=0
15278         ;;
15279 esac
15280
15281 : see if getpwnam_r exists
15282 set getpwnam_r d_getpwnam_r
15283 eval $inlibc
15284 case "$d_getpwnam_r" in
15285 "$define")
15286         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15287         case "$d_getpwnam_r_proto:$usethreads" in
15288         ":define")      d_getpwnam_r_proto=define
15289                 set d_getpwnam_r_proto getpwnam_r $hdrs
15290                 eval $hasproto ;;
15291         *)      ;;
15292         esac
15293         case "$d_getpwnam_r_proto" in
15294         define)
15295         case "$getpwnam_r_proto" in
15296         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15297         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15298         esac
15299         case "$getpwnam_r_proto" in
15300         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15301         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15302         esac
15303         case "$getpwnam_r_proto" in
15304         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15305         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15306         esac
15307         case "$getpwnam_r_proto" in
15308         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15309         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15310         esac
15311         case "$getpwnam_r_proto" in
15312         ''|0)   d_getpwnam_r=undef
15313                 getpwnam_r_proto=0
15314                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15315         * )     case "$getpwnam_r_proto" in
15316                 REENTRANT_PROTO*) ;;
15317                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15318                 esac
15319                 echo "Prototype: $try" ;;
15320         esac
15321         ;;
15322         *)      case "$usethreads" in
15323                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15324                 esac
15325                 d_getpwnam_r=undef
15326                 getpwnam_r_proto=0
15327                 ;;
15328         esac
15329         ;;
15330 *)      getpwnam_r_proto=0
15331         ;;
15332 esac
15333
15334 : see if getpwuid_r exists
15335 set getpwuid_r d_getpwuid_r
15336 eval $inlibc
15337 case "$d_getpwuid_r" in
15338 "$define")
15339         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15340         case "$d_getpwuid_r_proto:$usethreads" in
15341         ":define")      d_getpwuid_r_proto=define
15342                 set d_getpwuid_r_proto getpwuid_r $hdrs
15343                 eval $hasproto ;;
15344         *)      ;;
15345         esac
15346         case "$d_getpwuid_r_proto" in
15347         define)
15348         case "$getpwuid_r_proto" in
15349         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15350         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15351         esac
15352         case "$getpwuid_r_proto" in
15353         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15354         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15355         esac
15356         case "$getpwuid_r_proto" in
15357         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15358         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15359         esac
15360         case "$getpwuid_r_proto" in
15361         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15362         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15363         esac
15364         case "$getpwuid_r_proto" in
15365         ''|0)   d_getpwuid_r=undef
15366                 getpwuid_r_proto=0
15367                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15368         * )     case "$getpwuid_r_proto" in
15369                 REENTRANT_PROTO*) ;;
15370                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15371                 esac
15372                 echo "Prototype: $try" ;;
15373         esac
15374         ;;
15375         *)      case "$usethreads" in
15376                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15377                 esac
15378                 d_getpwuid_r=undef
15379                 getpwuid_r_proto=0
15380                 ;;
15381         esac
15382         ;;
15383 *)      getpwuid_r_proto=0
15384         ;;
15385 esac
15386
15387 : Optional checks for getsbyname and getsbyport
15388
15389 : see if getservbyname exists
15390 set getservbyname d_getsbyname
15391 eval $inlibc
15392
15393 : see if getservbyport exists
15394 set getservbyport d_getsbyport
15395 eval $inlibc
15396
15397 : see if getservent exists
15398 set getservent d_getsent
15399 eval $inlibc
15400
15401 : see if getservbyname_r exists
15402 set getservbyname_r d_getservbyname_r
15403 eval $inlibc
15404 case "$d_getservbyname_r" in
15405 "$define")
15406         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15407         case "$d_getservbyname_r_proto:$usethreads" in
15408         ":define")      d_getservbyname_r_proto=define
15409                 set d_getservbyname_r_proto getservbyname_r $hdrs
15410                 eval $hasproto ;;
15411         *)      ;;
15412         esac
15413         case "$d_getservbyname_r_proto" in
15414         define)
15415         case "$getservbyname_r_proto" in
15416         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15417         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15418         esac
15419         case "$getservbyname_r_proto" in
15420         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15421         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15422         esac
15423         case "$getservbyname_r_proto" in
15424         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15425         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15426         esac
15427         case "$getservbyname_r_proto" in
15428         ''|0)   d_getservbyname_r=undef
15429                 getservbyname_r_proto=0
15430                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15431         * )     case "$getservbyname_r_proto" in
15432                 REENTRANT_PROTO*) ;;
15433                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15434                 esac
15435                 echo "Prototype: $try" ;;
15436         esac
15437         ;;
15438         *)      case "$usethreads" in
15439                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15440                 esac
15441                 d_getservbyname_r=undef
15442                 getservbyname_r_proto=0
15443                 ;;
15444         esac
15445         ;;
15446 *)      getservbyname_r_proto=0
15447         ;;
15448 esac
15449
15450 : see if getservbyport_r exists
15451 set getservbyport_r d_getservbyport_r
15452 eval $inlibc
15453 case "$d_getservbyport_r" in
15454 "$define")
15455         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15456         case "$d_getservbyport_r_proto:$usethreads" in
15457         ":define")      d_getservbyport_r_proto=define
15458                 set d_getservbyport_r_proto getservbyport_r $hdrs
15459                 eval $hasproto ;;
15460         *)      ;;
15461         esac
15462         case "$d_getservbyport_r_proto" in
15463         define)
15464         case "$getservbyport_r_proto" in
15465         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15466         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15467         esac
15468         case "$getservbyport_r_proto" in
15469         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15470         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15471         esac
15472         case "$getservbyport_r_proto" in
15473         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15474         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15475         esac
15476         case "$getservbyport_r_proto" in
15477         ''|0)   d_getservbyport_r=undef
15478                 getservbyport_r_proto=0
15479                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15480         * )     case "$getservbyport_r_proto" in
15481                 REENTRANT_PROTO*) ;;
15482                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15483                 esac
15484                 echo "Prototype: $try" ;;
15485         esac
15486         ;;
15487         *)      case "$usethreads" in
15488                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15489                 esac
15490                 d_getservbyport_r=undef
15491                 getservbyport_r_proto=0
15492                 ;;
15493         esac
15494         ;;
15495 *)      getservbyport_r_proto=0
15496         ;;
15497 esac
15498
15499 : see if getservent_r exists
15500 set getservent_r d_getservent_r
15501 eval $inlibc
15502 case "$d_getservent_r" in
15503 "$define")
15504         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15505         case "$d_getservent_r_proto:$usethreads" in
15506         ":define")      d_getservent_r_proto=define
15507                 set d_getservent_r_proto getservent_r $hdrs
15508                 eval $hasproto ;;
15509         *)      ;;
15510         esac
15511         case "$d_getservent_r_proto" in
15512         define)
15513         case "$getservent_r_proto" in
15514         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15515         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15516         esac
15517         case "$getservent_r_proto" in
15518         ''|0) try='int getservent_r(struct servent*, char*, int);'
15519         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15520         esac
15521         case "$getservent_r_proto" in
15522         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15523         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15524         esac
15525         case "$getservent_r_proto" in
15526         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15527         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15528         esac
15529         case "$getservent_r_proto" in
15530         ''|0)   d_getservent_r=undef
15531                 getservent_r_proto=0
15532                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15533         * )     case "$getservent_r_proto" in
15534                 REENTRANT_PROTO*) ;;
15535                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15536                 esac
15537                 echo "Prototype: $try" ;;
15538         esac
15539         ;;
15540         *)      case "$usethreads" in
15541                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15542                 esac
15543                 d_getservent_r=undef
15544                 getservent_r_proto=0
15545                 ;;
15546         esac
15547         ;;
15548 *)      getservent_r_proto=0
15549         ;;
15550 esac
15551
15552 : see if prototypes for various getservxxx netdb.h functions are available
15553 echo " "
15554 set d_getservprotos getservent $i_netdb netdb.h
15555 eval $hasproto
15556
15557 : see if getspnam exists
15558 set getspnam d_getspnam
15559 eval $inlibc
15560
15561 : see if this is a shadow.h system
15562 set shadow.h i_shadow
15563 eval $inhdr
15564
15565 : see if getspnam_r exists
15566 set getspnam_r d_getspnam_r
15567 eval $inlibc
15568 case "$d_getspnam_r" in
15569 "$define")
15570         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15571         case "$d_getspnam_r_proto:$usethreads" in
15572         ":define")      d_getspnam_r_proto=define
15573                 set d_getspnam_r_proto getspnam_r $hdrs
15574                 eval $hasproto ;;
15575         *)      ;;
15576         esac
15577         case "$d_getspnam_r_proto" in
15578         define)
15579         case "$getspnam_r_proto" in
15580         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15581         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15582         esac
15583         case "$getspnam_r_proto" in
15584         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15585         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15586         esac
15587         case "$getspnam_r_proto" in
15588         ''|0)   d_getspnam_r=undef
15589                 getspnam_r_proto=0
15590                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15591         * )     case "$getspnam_r_proto" in
15592                 REENTRANT_PROTO*) ;;
15593                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15594                 esac
15595                 echo "Prototype: $try" ;;
15596         esac
15597         ;;
15598         *)      case "$usethreads" in
15599                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15600                 esac
15601                 d_getspnam_r=undef
15602                 getspnam_r_proto=0
15603                 ;;
15604         esac
15605         ;;
15606 *)      getspnam_r_proto=0
15607         ;;
15608 esac
15609
15610 : see if gettimeofday or ftime exists
15611 set gettimeofday d_gettimeod
15612 eval $inlibc
15613 case "$d_gettimeod" in
15614 "$undef")
15615         set ftime d_ftime 
15616         eval $inlibc
15617         ;;
15618 *)
15619         val="$undef"; set d_ftime; eval $setvar
15620         ;;
15621 esac
15622 case "$d_gettimeod$d_ftime" in
15623 "$undef$undef")
15624         echo " "
15625         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15626         ;;
15627 esac
15628
15629 : see if gmtime_r exists
15630 set gmtime_r d_gmtime_r
15631 eval $inlibc
15632 case "$d_gmtime_r" in
15633 "$define")
15634         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15635         case "$d_gmtime_r_proto:$usethreads" in
15636         ":define")      d_gmtime_r_proto=define
15637                 set d_gmtime_r_proto gmtime_r $hdrs
15638                 eval $hasproto ;;
15639         *)      ;;
15640         esac
15641         case "$d_gmtime_r_proto" in
15642         define)
15643         case "$gmtime_r_proto" in
15644         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15645         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15646         esac
15647         case "$gmtime_r_proto" in
15648         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15649         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15650         esac
15651         case "$gmtime_r_proto" in
15652         ''|0)   d_gmtime_r=undef
15653                 gmtime_r_proto=0
15654                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15655         * )     case "$gmtime_r_proto" in
15656                 REENTRANT_PROTO*) ;;
15657                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15658                 esac
15659                 echo "Prototype: $try" ;;
15660         esac
15661         ;;
15662         *)      case "$usethreads" in
15663                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15664                 esac
15665                 d_gmtime_r=undef
15666                 gmtime_r_proto=0
15667                 ;;
15668         esac
15669         ;;
15670 *)      gmtime_r_proto=0
15671         ;;
15672 esac
15673
15674 : see if hasmntopt exists
15675 set hasmntopt d_hasmntopt
15676 eval $inlibc
15677
15678 : see if this is a netinet/in.h or sys/in.h system
15679 set netinet/in.h i_niin sys/in.h i_sysin
15680 eval $inhdr
15681
15682 : see if arpa/inet.h has to be included
15683 set arpa/inet.h i_arpainet
15684 eval $inhdr
15685
15686 : see if htonl --and friends-- exists
15687 val=''
15688 set htonl val
15689 eval $inlibc
15690
15691 : Maybe they are macros.
15692 case "$val" in
15693 $undef)
15694         $cat >htonl.c <<EOM
15695 #include <stdio.h>
15696 #include <sys/types.h>
15697 #$i_niin I_NETINET_IN
15698 #$i_sysin I_SYS_IN
15699 #$i_arpainet I_ARPA_INET
15700 #ifdef I_NETINET_IN
15701 #include <netinet/in.h>
15702 #endif
15703 #ifdef I_SYS_IN
15704 #include <sys/in.h>
15705 #endif
15706 #ifdef I_ARPA_INET
15707 #include <arpa/inet.h>
15708 #endif
15709 #ifdef htonl
15710 printf("Defined as a macro.");
15711 #endif
15712 EOM
15713         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15714         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15715                 val="$define"
15716                 echo "But it seems to be defined as a macro." >&4
15717         fi
15718         $rm -f htonl.?
15719         ;;
15720 esac
15721 set d_htonl
15722 eval $setvar
15723
15724 : see if hypot exists
15725 set hypot d_hypot
15726 eval $inlibc
15727
15728 : see if ilogb exists
15729 set ilogb d_ilogb
15730 eval $inlibc
15731
15732 : see if ilogbl exists
15733 set ilogbl d_ilogbl
15734 eval $inlibc
15735
15736 : index or strchr
15737 echo " "
15738 if set index val -f; eval $csym; $val; then
15739         if set strchr val -f d_strchr; eval $csym; $val; then
15740                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15741                         val="$define"
15742                         vali="$undef"
15743                         echo "strchr() found." >&4
15744                 else
15745                         val="$undef"
15746                         vali="$define"
15747                         echo "index() found." >&4
15748                 fi
15749         else
15750                 val="$undef"
15751                 vali="$define"
15752                 echo "index() found." >&4
15753         fi
15754 else
15755         if set strchr val -f d_strchr; eval $csym; $val; then
15756                 val="$define"
15757                 vali="$undef"
15758                 echo "strchr() found." >&4
15759         else
15760                 echo "No index() or strchr() found!" >&4
15761                 val="$undef"
15762                 vali="$undef"
15763         fi
15764 fi
15765 set d_strchr; eval $setvar
15766 val="$vali"
15767 set d_index; eval $setvar
15768
15769 : check whether inet_aton exists
15770 set inet_aton d_inetaton
15771 eval $inlibc
15772
15773 : see if inet_ntop exists
15774 set inet_ntop d_inetntop
15775 eval $inlibc
15776
15777 : see if inet_pton exists
15778 set inet_pton d_inetpton
15779 eval $inlibc
15780
15781 : Look for isascii
15782 echo " "
15783 $cat >isascii.c <<EOCP
15784 #include <stdio.h>
15785 #include <ctype.h>
15786 #$i_stdlib I_STDLIB
15787 #ifdef I_STDLIB
15788 #include <stdlib.h>
15789 #endif
15790 int main() {
15791         int c = 'A';
15792         if (isascii(c))
15793                 exit(0);
15794         else
15795                 exit(1);
15796 }
15797 EOCP
15798 set isascii
15799 if eval $compile; then
15800         echo "isascii() found." >&4
15801         val="$define"
15802 else
15803         echo "isascii() NOT found." >&4
15804         val="$undef"
15805 fi
15806 set d_isascii
15807 eval $setvar
15808 $rm -f isascii*
15809
15810 : Look for isblank
15811 echo " "
15812 $cat >isblank.c <<'EOCP'
15813 #include <stdio.h>
15814 #include <ctype.h>
15815 int main() {
15816         int c = ' ';
15817         if (isblank(c))
15818                 return 0 ;
15819         else
15820                 return 1 ;
15821 }
15822 EOCP
15823 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15824         echo "isblank() found." >&4
15825         val="$define"
15826 else
15827         echo "isblank() NOT found." >&4
15828         val="$undef"
15829 fi
15830 set d_isblank
15831 eval $setvar
15832 $rm -f isblank*
15833
15834 : check for isfinite
15835 echo "Checking to see if you have isfinite..." >&4
15836 $cat >try.c <<EOCP
15837 #$i_math I_MATH
15838 #ifdef I_MATH
15839 #include <math.h>
15840 #endif
15841 int main() { return isfinite(0.0); }
15842 EOCP
15843 set try
15844 if eval $compile; then
15845         val="$define"
15846         echo "You have isfinite."
15847 else
15848         val="$undef"
15849         echo "You do not have isfinite."
15850 fi
15851 $rm_try
15852 set d_isfinite
15853 eval $setvar
15854
15855 : see if isfinitel exists
15856 set isfinitel d_isfinitel
15857 eval $inlibc
15858
15859 : check for isinf
15860 echo "Checking to see if you have isinf..." >&4
15861 $cat >try.c <<EOCP
15862 #$i_math I_MATH
15863 #ifdef I_MATH
15864 #include <math.h>
15865 #endif
15866 int main() { return isinf(0.0); }
15867 EOCP
15868 set try
15869 if eval $compile; then
15870         val="$define"
15871         echo "You have isinf."
15872 else
15873         val="$undef"
15874         echo "You do not have isinf."
15875 fi
15876 $rm_try
15877 set d_isinf
15878 eval $setvar
15879
15880 : see if isinfl exists
15881 set isinfl d_isinfl
15882 eval $inlibc
15883
15884 : check for isless
15885 echo "Checking to see if you have isless..." >&4
15886 $cat >try.c <<EOCP
15887 #$i_math I_MATH
15888 #ifdef I_MATH
15889 #include <math.h>
15890 #endif
15891 int main() { return isless(0.0); }
15892 EOCP
15893 set try
15894 if eval $compile; then
15895         val="$define"
15896         echo "You have isless."
15897 else
15898         val="$undef"
15899         echo "You do not have isless."
15900 fi
15901 $rm_try
15902 set d_isless
15903 eval $setvar
15904
15905 : check for isnan
15906 echo "Checking to see if you have isnan..." >&4
15907 $cat >try.c <<EOCP
15908 #$i_math I_MATH
15909 #ifdef I_MATH
15910 #include <math.h>
15911 #endif
15912 int main() { return isnan(0.0); }
15913 EOCP
15914 set try
15915 if eval $compile; then
15916         val="$define"
15917         echo "You have isnan."
15918 else
15919         val="$undef"
15920         echo "You do not have isnan."
15921 fi
15922 $rm_try
15923 set d_isnan
15924 eval $setvar
15925
15926 : see if isnanl exists
15927 set isnanl d_isnanl
15928 eval $inlibc
15929
15930 : check for isnormal
15931 echo "Checking to see if you have isnormal..." >&4
15932 $cat >try.c <<EOCP
15933 #$i_math I_MATH
15934 #ifdef I_MATH
15935 #include <math.h>
15936 #endif
15937 int main() { return isnormal(0.0); }
15938 EOCP
15939 set try
15940 if eval $compile; then
15941         val="$define"
15942         echo "You have isnormal."
15943 else
15944         val="$undef"
15945         echo "You do not have isnormal."
15946 fi
15947 $rm_try
15948 set d_isnormal
15949 eval $setvar
15950
15951 : see if j0 exists
15952 set j0 d_j0
15953 eval $inlibc
15954
15955 : see if j0l exists
15956 set j0l d_j0l
15957 eval $inlibc
15958
15959 : see if killpg exists
15960 set killpg d_killpg
15961 eval $inlibc
15962
15963 : see if localeconv exists
15964 set localeconv d_locconv
15965 eval $inlibc
15966
15967 : see if libc has the POSIX.1-2008 currency locale rules
15968 case "$d_locconv:$d_lc_monetary_2008" in
15969 $define:)
15970         $cat >try.c <<EOCP
15971 #include <locale.h>
15972 int main() {
15973         struct lconv *lc = localeconv();
15974         char int_p_cs_precedes = lc->int_p_cs_precedes;
15975         return 0;
15976 }
15977 EOCP
15978         set try
15979         if eval $compile; then
15980                 d_lc_monetary_2008="$define"
15981         else
15982                 d_lc_monetary_2008="$undef"
15983         fi;
15984         $rm_try
15985         ;;
15986 esac
15987
15988 : see if lchown exists
15989 echo " "
15990 $cat > try.c <<'EOCP'
15991 /* System header to define __stub macros and hopefully few prototypes,
15992     which can conflict with char lchown(); below.  */
15993 #include <assert.h>
15994 /* Override any gcc2 internal prototype to avoid an error.  */
15995 /* We use char because int might match the return type of a gcc2
15996    builtin and then its argument prototype would still apply.  */
15997 char lchown();
15998 int main() {
15999     /*  The GNU C library defines this for functions which it implements
16000         to always fail with ENOSYS.  Some functions are actually named
16001         something starting with __ and the normal name is an alias.  */
16002 #if defined (__stub_lchown) || defined (__stub___lchown)
16003 choke me
16004 #else
16005 lchown();
16006 #endif
16007 ; return 0; }
16008 EOCP
16009 set try
16010 if eval $compile; then
16011     $echo "lchown() found." >&4
16012     val="$define"
16013 else
16014     $echo "lchown() NOT found." >&4
16015     val="$undef"
16016 fi
16017 set d_lchown
16018 eval $setvar
16019
16020 : See if number of significant digits in a double precision number is known
16021 echo " "
16022 $cat >ldbl_dig.c <<EOM
16023 #$i_limits I_LIMITS
16024 #$i_float I_FLOAT
16025 #ifdef I_LIMITS
16026 #include <limits.h>
16027 #endif
16028 #ifdef I_FLOAT
16029 #include <float.h>
16030 #endif
16031 #ifdef LDBL_DIG
16032 printf("Contains LDBL_DIG");
16033 #endif
16034 EOM
16035 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16036 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16037         echo "LDBL_DIG found." >&4
16038         val="$define"
16039 else
16040         echo "LDBL_DIG NOT found." >&4
16041         val="$undef"
16042 fi
16043 $rm -f ldbl_dig.?
16044 set d_ldbl_dig
16045 eval $setvar
16046
16047 : see if lgamma exists
16048 set lgamma d_lgamma
16049 eval $inlibc
16050
16051 : see if lgamma_r exists
16052 set lgamma_r d_lgamma_r
16053 eval $inlibc
16054
16055 : check to see if math.h defines _LIB_VERSION
16056 d_libm_lib_version="$undef"
16057 case $i_math in
16058     $define)
16059         echo " "
16060         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16061         $cat >try.c <<EOCP
16062 #include <unistd.h>
16063 #include <math.h>
16064 int main (int argc, char *argv[])
16065 {
16066     printf ("%d\n", _LIB_VERSION);
16067     return (0);
16068     } /* main */
16069 EOCP
16070         set try
16071         if eval $compile; then
16072             foo=`$run ./try`
16073             echo "Yes, it does ($foo)" >&4
16074             d_libm_lib_version="$define"
16075         else
16076             echo "No, it does not (probably harmless)" >&4
16077             fi
16078         $rm_try
16079         ;;
16080
16081     esac
16082
16083 : see if link exists
16084 set link d_link
16085 eval $inlibc
16086
16087 : see if llrint exists
16088 set llrint d_llrint
16089 eval $inlibc
16090
16091 : see if llrintl exists
16092 set llrintl d_llrintl
16093 eval $inlibc
16094
16095 : see if llround exists
16096 set llround d_llround
16097 eval $inlibc
16098
16099 : see if llroundl exists
16100 set llroundl d_llroundl
16101 eval $inlibc
16102
16103 : see if localtime_r exists
16104 set localtime_r d_localtime_r
16105 eval $inlibc
16106 case "$d_localtime_r" in
16107 "$define")
16108         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16109         case "$d_localtime_r_proto:$usethreads" in
16110         ":define")      d_localtime_r_proto=define
16111                 set d_localtime_r_proto localtime_r $hdrs
16112                 eval $hasproto ;;
16113         *)      ;;
16114         esac
16115         case "$d_localtime_r_proto" in
16116         define)
16117         case "$localtime_r_proto" in
16118         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16119         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16120         esac
16121         case "$localtime_r_proto" in
16122         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16123         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16124         esac
16125         case "$localtime_r_proto" in
16126         ''|0)   d_localtime_r=undef
16127                 localtime_r_proto=0
16128                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16129         * )     case "$localtime_r_proto" in
16130                 REENTRANT_PROTO*) ;;
16131                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16132                 esac
16133                 echo "Prototype: $try" ;;
16134         esac
16135         ;;
16136         *)      case "$usethreads" in
16137                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16138                 esac
16139                 d_localtime_r=undef
16140                 localtime_r_proto=0
16141                 ;;
16142         esac
16143         ;;
16144 *)      localtime_r_proto=0
16145         ;;
16146 esac
16147
16148 : see if localtime_r calls tzset
16149 case "$localtime_r_proto" in
16150 REENTRANT_PROTO*)
16151         $cat >try.c <<EOCP
16152 /*  Does our libc's localtime_r call tzset ?
16153  *  return 0 if so, 1 otherwise.
16154  */
16155 #$i_systypes    I_SYS_TYPES
16156 #$i_unistd      I_UNISTD
16157 #$i_time        I_TIME
16158 #$i_stdlib      I_STDLIB
16159 #$i_string      I_STRING
16160 #$i_malloc      I_MALLOC
16161 #ifdef I_SYS_TYPES
16162 #  include <sys/types.h>
16163 #endif
16164 #ifdef I_UNISTD
16165 #  include <unistd.h>
16166 #endif
16167 #ifdef I_TIME
16168 #  include <time.h>
16169 #endif
16170 #ifdef I_STDLIB
16171 #include <stdlib.h>
16172 #endif
16173 #ifdef I_STRING
16174 #  include <string.h>
16175 #else
16176 #  include <strings.h>
16177 #endif
16178 #ifdef I_MALLOC
16179 #  include <malloc.h>
16180 #endif
16181 int main()
16182 {
16183     time_t t = time(0L);
16184     char w_tz[]="TZ" "=GMT+5",
16185          e_tz[]="TZ" "=GMT-5",
16186         *tz_e = (char*)malloc(16),
16187         *tz_w = (char*)malloc(16);
16188     struct tm tm_e, tm_w;
16189     memset(&tm_e,'\0',sizeof(struct tm));
16190     memset(&tm_w,'\0',sizeof(struct tm));
16191     strcpy(tz_e,e_tz);
16192     strcpy(tz_w,w_tz);
16193
16194     putenv(tz_e);
16195     localtime_r(&t, &tm_e);
16196
16197     putenv(tz_w);
16198     localtime_r(&t, &tm_w);
16199
16200     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16201         return 1;
16202     return 0;
16203 }
16204 EOCP
16205         set try
16206         if eval $compile; then
16207             if $run ./try; then
16208                 d_localtime_r_needs_tzset=undef;
16209             else
16210                 d_localtime_r_needs_tzset=define;
16211             fi;
16212         else
16213             d_localtime_r_needs_tzset=undef;
16214         fi;
16215      ;;
16216   *)
16217      d_localtime_r_needs_tzset=undef;
16218      ;;
16219 esac
16220 $rm_try
16221
16222 : see if lockf exists
16223 set lockf d_lockf
16224 eval $inlibc
16225
16226 : see if log1p exists
16227 set log1p d_log1p
16228 eval $inlibc
16229
16230 : see if log2 exists
16231 set log2 d_log2
16232 eval $inlibc
16233
16234 : see if logb exists
16235 set logb d_logb
16236 eval $inlibc
16237
16238 : see if lrint exists
16239 set lrint d_lrint
16240 eval $inlibc
16241
16242 : see if lrintl exists
16243 set lrintl d_lrintl
16244 eval $inlibc
16245
16246 : see if lround exists
16247 set lround d_lround
16248 eval $inlibc
16249
16250 : see if lroundl exists
16251 set lroundl d_lroundl
16252 eval $inlibc
16253
16254 : see if prototype for lseek is available
16255 echo " "
16256 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16257 eval $hasproto
16258
16259 : see if lstat exists
16260 set lstat d_lstat
16261 eval $inlibc
16262
16263 : see if madvise exists
16264 set madvise d_madvise
16265 eval $inlibc
16266
16267 : see if malloc_size exists
16268 set malloc_size d_malloc_size
16269 eval $inlibc
16270
16271 : see if malloc_size_good exists
16272 set malloc_good_size d_malloc_good_size
16273 eval $inlibc
16274
16275 : see if mblen exists
16276 set mblen d_mblen
16277 eval $inlibc
16278
16279 : see if mbstowcs exists
16280 set mbstowcs d_mbstowcs
16281 eval $inlibc
16282
16283 : see if mbtowc exists
16284 set mbtowc d_mbtowc
16285 eval $inlibc
16286
16287 : see if memchr exists
16288 set memchr d_memchr
16289 eval $inlibc
16290
16291 : see if memcmp exists
16292 set memcmp d_memcmp
16293 eval $inlibc
16294
16295 : see if memcpy exists
16296 set memcpy d_memcpy
16297 eval $inlibc
16298
16299 : see if memmove exists
16300 set memmove d_memmove
16301 eval $inlibc
16302
16303 : see if memset exists
16304 set memset d_memset
16305 eval $inlibc
16306
16307 : see if mkdir exists
16308 set mkdir d_mkdir
16309 eval $inlibc
16310
16311 : see if mkdtemp exists
16312 set mkdtemp d_mkdtemp
16313 eval $inlibc
16314
16315 : see if mkfifo exists
16316 set mkfifo d_mkfifo
16317 eval $inlibc
16318
16319 : see if mkstemp exists
16320 set mkstemp d_mkstemp
16321 eval $inlibc
16322
16323 : see if mkstemps exists
16324 set mkstemps d_mkstemps
16325 eval $inlibc
16326
16327 : see if mktime exists
16328 set mktime d_mktime
16329 eval $inlibc
16330
16331 : see if this is a sys/mman.h system
16332 set sys/mman.h i_sysmman
16333 eval $inhdr
16334
16335 : see if mmap exists
16336 set mmap d_mmap
16337 eval $inlibc
16338 : see what shmat returns
16339 : default to something harmless
16340 mmaptype='void *'
16341 case "$i_sysmman$d_mmap" in
16342 "$define$define")
16343         $cat >mmap.c <<'END'
16344 #include <sys/mman.h>
16345 void *mmap();
16346 END
16347         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16348                 mmaptype='void *'
16349         else
16350                 mmaptype='caddr_t'
16351         fi
16352         echo "and it returns ($mmaptype)." >&4
16353         ;;
16354 esac
16355
16356
16357
16358 : see if sqrtl exists
16359 set sqrtl d_sqrtl
16360 eval $inlibc
16361
16362 : see if scalbnl exists
16363 set scalbnl d_scalbnl
16364 eval $inlibc
16365
16366 : see if truncl exists
16367 set truncl d_truncl
16368 eval $inlibc
16369
16370 : see if modfl exists
16371 set modfl d_modfl
16372 eval $inlibc
16373
16374 : see if prototype for modfl is available
16375 echo " "
16376 set d_modflproto modfl $i_math math.h
16377 eval $hasproto
16378
16379 d_modfl_pow32_bug="$undef"
16380
16381 case "$d_longdbl$d_modfl" in
16382 $define$define)
16383         $cat <<EOM
16384 Checking to see whether your modfl() is okay for large values...
16385 EOM
16386 $cat >try.c <<EOCP
16387 #include <math.h>
16388 #include <stdio.h>
16389 EOCP
16390 if $test "X$d_modflproto" != "X$define"; then
16391         $cat >>try.c <<EOCP
16392 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16393 long double modfl (long double, long double *);
16394 EOCP
16395 fi
16396 $cat >>try.c <<EOCP
16397 int main() {
16398     long double nv = 4294967303.15;
16399     long double v, w;
16400     v = modfl(nv, &w);
16401 #ifdef __GLIBC__
16402     printf("glibc");
16403 #endif
16404     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16405     return 0;
16406 }
16407 EOCP
16408         case "$osname:$gccversion" in
16409         aix:)   saveccflags="$ccflags"
16410                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16411         esac
16412         set try
16413         if eval $compile; then
16414                 foo=`$run ./try`
16415                 case "$foo" in
16416                 *" 4294967303.150000 1.150000 4294967302.000000")
16417                         echo >&4 "Your modfl() is broken for large values."
16418                         d_modfl_pow32_bug="$define"
16419                         case "$foo" in
16420                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16421                         ;;
16422                         esac
16423                         ;;
16424                 *" 4294967303.150000 0.150000 4294967303.000000")
16425                         echo >&4 "Your modfl() seems okay for large values."
16426                         ;;
16427                 *)      echo >&4 "I don't understand your modfl() at all."
16428                         d_modfl="$undef"
16429                         ;;
16430                 esac
16431                 $rm_try
16432         else
16433                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16434                 d_modfl="$undef"
16435         fi
16436         case "$osname:$gccversion" in
16437         aix:)   ccflags="$saveccflags" ;; # restore
16438         esac
16439         ;;
16440 esac
16441
16442 if $test "$uselongdouble" = "$define"; then
16443     message=""
16444     if $test "$d_sqrtl" != "$define"; then
16445         message="$message sqrtl"
16446     fi
16447     if $test "$d_modfl" != "$define"; then
16448         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16449             echo "You have both truncl and copysignl, so I can emulate modfl."
16450         else
16451             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16452                 echo "You have both aintl and copysignl, so I can emulate modfl."
16453             else
16454                 message="$message modfl"
16455             fi
16456         fi
16457     fi
16458     if $test "$d_frexpl" != "$define"; then
16459         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16460             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16461         else
16462             message="$message frexpl"
16463         fi
16464     fi
16465     if $test "$d_ldexpl" != "$define"; then
16466         message="$message ldexpl"
16467     fi
16468
16469     if $test "$message" != ""; then
16470         $cat <<EOM >&4
16471
16472 *** You requested the use of long doubles but you do not seem to have
16473 *** the following mathematical functions needed for long double support:
16474 ***    $message
16475 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16476 *** Cannot continue, aborting.
16477
16478 EOM
16479
16480         exit 1
16481     fi
16482 fi
16483
16484 : see if mprotect exists
16485 set mprotect d_mprotect
16486 eval $inlibc
16487
16488 : see if msgctl exists
16489 set msgctl d_msgctl
16490 eval $inlibc
16491
16492 : see if msgget exists
16493 set msgget d_msgget
16494 eval $inlibc
16495
16496 : see if msgsnd exists
16497 set msgsnd d_msgsnd
16498 eval $inlibc
16499
16500 : see if msgrcv exists
16501 set msgrcv d_msgrcv
16502 eval $inlibc
16503
16504 : see how much of the 'msg*(2)' library is present.
16505 h_msg=true
16506 echo " "
16507 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16508 *"$undef"*) h_msg=false;;
16509 esac
16510 case "$osname" in
16511 freebsd)
16512     case "`ipcs 2>&1`" in
16513     "SVID messages"*"not configured"*)
16514         echo "Your $osname does not have the msg*(2) configured." >&4
16515         h_msg=false
16516         val="$undef"
16517         set msgctl d_msgctl
16518         eval $setvar
16519         set msgget d_msgget
16520         eval $setvar
16521         set msgsnd d_msgsnd
16522         eval $setvar
16523         set msgrcv d_msgrcv
16524         eval $setvar
16525         ;;
16526     esac
16527     ;;
16528 esac
16529 : we could also check for sys/ipc.h ...
16530 if $h_msg && $test `./findhdr sys/msg.h`; then
16531         echo "You have the full msg*(2) library." >&4
16532         val="$define"
16533 else
16534         echo "You don't have the full msg*(2) library." >&4
16535         val="$undef"
16536 fi
16537 set d_msg
16538 eval $setvar
16539
16540 : Check for msghdr_s
16541 echo " "
16542 echo "Checking to see if your system supports struct msghdr..." >&4
16543 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16544 eval $hasstruct
16545 case "$d_msghdr_s" in
16546 "$define")      echo "Yes, it does."   ;;
16547 *)              echo "No, it doesn't." ;;
16548 esac
16549
16550
16551 : see if msync exists
16552 set msync d_msync
16553 eval $inlibc
16554
16555 : see if munmap exists
16556 set munmap d_munmap
16557 eval $inlibc
16558
16559 : see if nan exists
16560 set nan d_nan
16561 eval $inlibc
16562
16563 : see if nearbyint exists
16564 set nearbyint d_nearbyint
16565 eval $inlibc
16566
16567 : see if nextafter exists
16568 set nextafter d_nextafter
16569 eval $inlibc
16570
16571 : see if nexttoward exists
16572 set nexttoward d_nexttoward
16573 eval $inlibc
16574
16575 : see if nice exists
16576 set nice d_nice
16577 eval $inlibc
16578
16579 : see if this is a langinfo.h system
16580 set langinfo.h i_langinfo
16581 eval $inhdr
16582
16583 : see if nl_langinfo exists
16584 set nl_langinfo d_nl_langinfo
16585 eval $inlibc
16586
16587 : see if this is a quadmath.h system
16588 set quadmath.h i_quadmath
16589 eval $inhdr
16590
16591 : check for volatile keyword
16592 echo " "
16593 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16594 $cat >try.c <<'EOCP'
16595 int main()
16596 {
16597         typedef struct _goo_struct goo_struct;
16598         goo_struct * volatile goo = ((goo_struct *)0);
16599         struct _goo_struct {
16600                 long long_int;
16601                 int reg_int;
16602                 char char_var;
16603         };
16604         typedef unsigned short foo_t;
16605         char *volatile foo;
16606         volatile int bar;
16607         volatile foo_t blech;
16608         foo = foo;
16609 }
16610 EOCP
16611 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16612         val="$define"
16613         echo "Yup, it does."
16614 else
16615         val="$undef"
16616         echo "Nope, it doesn't."
16617 fi
16618 set d_volatile
16619 eval $setvar
16620 $rm_try
16621
16622 : Check basic sizes
16623 echo " "
16624 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16625
16626 case "$use64bitint:$d_quad:$quadtype" in
16627 define:define:?*)
16628         ivtype="$quadtype"
16629         uvtype="$uquadtype"
16630         ivsize=8
16631         uvsize=8
16632         ;;
16633 *)      ivtype="long"
16634         uvtype="unsigned long"
16635         ivsize=$longsize
16636         uvsize=$longsize
16637         ;;
16638 esac
16639
16640 case "$uselongdouble:$d_longdbl" in
16641 define:define)
16642         nvtype="long double"
16643         nvsize=$longdblsize
16644         ;;
16645 *)      nvtype=double
16646         nvsize=$doublesize
16647         ;;
16648 esac
16649
16650 case "$usequadmath:$i_quadmath" in
16651 define:define)
16652   nvtype="__float128"
16653   nvsize=16
16654   case "$libs" in
16655   *quadmath*) ;;
16656   *) $cat <<EOM >&4
16657
16658 *** You requested the use of the quadmath library, but you
16659 *** do not seem to have the quadmath library installed.
16660 *** Cannot continue, aborting.
16661 EOM
16662     exit 1
16663     ;;
16664   esac
16665   ;;
16666 define:*) $cat <<EOM >&4
16667
16668 *** You requested the use of the quadmath library, but you
16669 *** do not seem to have the required header, <quadmath.h>.
16670 EOM
16671   case "$gccversion" in
16672   [23].*|4.[0-5]*)
16673    $cat <<EOM >&4
16674 *** Your gcc looks a bit old:
16675 *** $gccversion
16676 EOM
16677     ;;
16678   '')
16679    $cat <<EOM >&4
16680 *** You are not running a gcc.
16681 EOM
16682     ;;
16683   esac
16684   $cat <<EOM >&4
16685 *** For the quadmath library you need at least gcc 4.6.
16686 *** Cannot continue, aborting.
16687 EOM
16688   exit 1
16689   ;;
16690 esac
16691
16692 $echo "(IV will be "$ivtype", $ivsize bytes)"
16693 $echo "(UV will be "$uvtype", $uvsize bytes)"
16694 $echo "(NV will be "$nvtype", $nvsize bytes)"
16695
16696 $cat >try.c <<EOCP
16697 #$i_inttypes I_INTTYPES
16698 #ifdef I_INTTYPES
16699 #include <inttypes.h>
16700 #endif
16701 #include <stdio.h>
16702 int main() {
16703 #ifdef INT8
16704    int8_t i =  INT8_MAX;
16705   uint8_t u = UINT8_MAX;
16706   printf("int8_t\n");
16707 #endif
16708 #ifdef INT16
16709    int16_t i =  INT16_MAX;
16710   uint16_t u = UINT16_MAX;
16711   printf("int16_t\n");
16712 #endif
16713 #ifdef INT32
16714    int32_t i =  INT32_MAX;
16715   uint32_t u = UINT32_MAX;
16716   printf("int32_t\n");
16717 #endif
16718 }
16719 EOCP
16720
16721 i8type="signed char"
16722 u8type="unsigned char"
16723 i8size=1
16724 u8size=1
16725
16726 case "$i16type" in
16727 '')     case "$shortsize" in
16728         2)      i16type=short
16729                 u16type="unsigned short"
16730                 i16size=$shortsize
16731                 u16size=$shortsize
16732                 ;;
16733         esac
16734         ;;
16735 esac
16736 case "$i16type" in
16737 '')     set try -DINT16
16738         if eval $compile; then
16739                 case "`$run ./try`" in
16740                 int16_t)
16741                         i16type=int16_t
16742                         u16type=uint16_t
16743                         i16size=2
16744                         u16size=2
16745                         ;;
16746                 esac
16747         fi
16748         ;;
16749 esac
16750 case "$i16type" in
16751 '')     if $test $shortsize -ge 2; then
16752                 i16type=short
16753                 u16type="unsigned short"
16754                 i16size=$shortsize
16755                 u16size=$shortsize
16756         fi
16757         ;;
16758 esac
16759
16760 case "$i32type" in
16761 '')     case "$longsize" in
16762         4)      i32type=long
16763                 u32type="unsigned long"
16764                 i32size=$longsize
16765                 u32size=$longsize
16766                 ;;
16767         *)      case "$intsize" in
16768                 4)      i32type=int
16769                         u32type="unsigned int"
16770                         i32size=$intsize
16771                         u32size=$intsize
16772                         ;;
16773                 esac
16774                 ;;
16775         esac
16776         ;;
16777 esac
16778 case "$i32type" in
16779 '')     set try -DINT32
16780         if eval $compile; then
16781                 case "`$run ./try`" in
16782                 int32_t)
16783                         i32type=int32_t
16784                         u32type=uint32_t
16785                         i32size=4
16786                         u32size=4
16787                         ;;
16788                 esac
16789         fi
16790         ;;
16791 esac
16792 case "$i32type" in
16793 '')     if $test $intsize -ge 4; then
16794                 i32type=int
16795                 u32type="unsigned int"
16796                 i32size=$intsize
16797                 u32size=$intsize
16798         fi
16799         ;;
16800 esac
16801
16802 case "$i64type" in
16803 '')     case "$d_quad:$quadtype" in
16804         define:?*)
16805                 i64type="$quadtype"
16806                 u64type="$uquadtype"
16807                 i64size=8
16808                 u64size=8
16809                 ;;
16810         esac
16811         ;;
16812 esac
16813
16814 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16815 : volatile so that the compiler has to store it out to memory.
16816 if test X"$d_volatile" = X"$define"; then
16817         volatile=volatile
16818 fi
16819 $cat <<EOP >try.c
16820 #include <stdio.h>
16821 #$i_stdlib I_STDLIB
16822 #ifdef I_STDLIB
16823 #include <stdlib.h>
16824 #endif
16825 #include <sys/types.h>
16826 #include <signal.h>
16827 #ifdef SIGFPE
16828 $volatile int bletched = 0;
16829 $signal_t blech(int s) { bletched = 1; }
16830 #endif
16831 int main() {
16832     $uvtype u = 0;
16833     $nvtype d;
16834     int     n = 8 * $uvsize;
16835     int     i;
16836 #ifdef SIGFPE
16837     signal(SIGFPE, blech);
16838 #endif
16839
16840     for (i = 0; i < n; i++) {
16841       u = u << 1 | ($uvtype)1;
16842       d = ($nvtype)u;
16843       if (($uvtype)d != u)
16844         break;
16845       if (d <= 0)
16846         break;
16847       d = ($nvtype)(u - 1);
16848       if (($uvtype)d != (u - 1))
16849         break;
16850 #ifdef SIGFPE
16851       if (bletched)
16852         break;
16853 #endif
16854     }
16855     printf("%d\n", ((i == n) ? -n : i));
16856     exit(0);
16857 }
16858 EOP
16859 set try
16860
16861 d_nv_preserves_uv="$undef"
16862 if eval $compile; then
16863         nv_preserves_uv_bits="`$run ./try`"
16864 fi
16865 case "$nv_preserves_uv_bits" in
16866 \-[1-9]*)
16867         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16868         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16869         d_nv_preserves_uv="$define"
16870         ;;
16871 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16872         d_nv_preserves_uv="$undef" ;;
16873 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16874         nv_preserves_uv_bits="0" ;;
16875 esac
16876 $rm_try
16877
16878 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16879 : volatile so that the compiler has to store it out to memory.
16880 if test X"$d_volatile" = X"$define"; then
16881         volatile=volatile
16882 fi
16883 $cat <<EOP >try.c
16884 #include <stdio.h>
16885
16886 typedef $nvtype NV;
16887
16888 int
16889 main() {
16890   NV value = 2;
16891   int count = 1;
16892
16893   while(count < 256) {
16894     $volatile NV up = value + 1.0;
16895     $volatile NV negated = -value;
16896     $volatile NV down = negated - 1.0;
16897     $volatile NV got_up = up - value;
16898     int up_good = got_up == 1.0;
16899     int got_down = down - negated;
16900     int down_good = got_down == -1.0;
16901
16902     if (down_good != up_good) {
16903       fprintf(stderr,
16904               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16905               up_good, (double) got_up, down_good, (double) got_down,
16906               count, (double) value);
16907       return 1;
16908     }
16909     if (!up_good) {
16910       while (1) {
16911         if (count > 8) {
16912           count -= 8;
16913           fputs("256.0", stdout);
16914         } else {
16915           count--;
16916           fputs("2.0", stdout);
16917         }
16918         if (!count) {
16919           puts("");
16920           return 0;
16921         }
16922         fputs("*", stdout);
16923       }
16924     }
16925     value *= 2;
16926     ++count;
16927   }
16928   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16929           count, (double) value);
16930   return 1;
16931 }
16932 EOP
16933 set try
16934
16935 nv_overflows_integers_at='0'
16936 if eval $compile; then
16937     xxx="`$run ./try`"
16938     case "$?" in
16939         0)
16940             case "$xxx" in
16941                 2*)  cat >&4 <<EOM
16942 The largest integer your NVs can preserve is equal to $xxx
16943 EOM
16944                     nv_overflows_integers_at="$xxx"
16945                     ;;
16946                 *)  cat >&4 <<EOM
16947 Cannot determine the largest integer value your NVs can hold, unexpected output
16948 '$xxx'
16949 EOM
16950                     ;;
16951             esac
16952             ;;
16953         *)  cat >&4 <<EOM
16954 Cannot determine the largest integer value your NVs can hold
16955 EOM
16956             ;;
16957     esac
16958 fi
16959 $rm_try
16960
16961 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16962 : volatile so that the compiler has to store it out to memory.
16963 if test X"$d_volatile" = X"$define"; then
16964         volatile=volatile
16965 fi
16966 $cat <<EOP >try.c
16967 #include <stdio.h>
16968 #$i_stdlib I_STDLIB
16969 #ifdef I_STDLIB
16970 #include <stdlib.h>
16971 #endif
16972 #$i_string I_STRING
16973 #ifdef I_STRING
16974 #  include <string.h>
16975 #else
16976 #  include <strings.h>
16977 #endif
16978 #include <sys/types.h>
16979 #include <signal.h>
16980 #ifdef SIGFPE
16981 $volatile int bletched = 0;
16982 $signal_t blech(int s) { bletched = 1; }
16983 #endif
16984
16985 int checkit($nvtype d, char *where) {
16986     unsigned char *p = (char *)&d;
16987     unsigned char *end = p + sizeof(d);
16988     int fail = 0;
16989
16990     while (p < end)
16991         fail += *p++;
16992
16993     if (!fail)
16994         return 0;
16995
16996     p = (char *)&d;
16997     printf("No - %s: 0x", where);
16998     while (p < end)
16999         printf ("%02X", *p++);
17000     printf("\n");
17001     return 1;
17002 }
17003
17004 int main(int argc, char **argv) {
17005     $nvtype d = 0.0;
17006     int fail = 0;
17007     fail += checkit(d, "0.0");
17008
17009     /* The compiler shouldn't be assuming that bletched is 0  */
17010     d = bletched;
17011
17012     fail += checkit(d, "bleched");
17013
17014 #ifdef SIGFPE
17015     signal(SIGFPE, blech);
17016 #endif
17017
17018     /* Paranoia - the compiler should have no way of knowing that ANSI says
17019        that argv[argc] will always be NULL.  Actually, if it did assume this it
17020        would be buggy, as this is C and main() can be called from elsewhere in
17021        the program.  */
17022     d = argv[argc] ? 1 : 0;
17023
17024     if (d) {
17025         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17026     }
17027
17028     fail += checkit(d, "ternary");
17029
17030     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17031
17032     if (d != 0.0) {
17033         printf("No - memset doesn't give 0.0\n");
17034         /* This might just blow up:  */
17035         printf("(gives %g)\n", d);
17036         return 1;
17037     }
17038
17039 #ifdef SIGFPE
17040     if (bletched) {
17041         printf("No - something bleched\n");
17042         return 1;
17043     }
17044 #endif
17045     if (fail) {
17046       printf("No - %d fail(s)\n", fail);
17047       return 1;
17048     }
17049     printf("Yes\n");
17050     return 0;
17051 }
17052 EOP
17053 set try
17054
17055 d_nv_zero_is_allbits_zero="$undef"
17056 if eval $compile; then
17057     xxx="`$run ./try`"
17058     case "$?" in
17059         0)
17060             case "$xxx" in
17061                 Yes)  cat >&4 <<EOM
17062 0.0 is represented as all bits zero in memory
17063 EOM
17064                     d_nv_zero_is_allbits_zero="$define"
17065                     ;;
17066                 *)  cat >&4 <<EOM
17067 0.0 is not represented as all bits zero in memory
17068 EOM
17069                     d_nv_zero_is_allbits_zero="$undef"
17070                     ;;
17071             esac
17072             ;;
17073         *)  cat >&4 <<EOM
17074 0.0 is not represented as all bits zero in memory
17075 EOM
17076             d_nv_zero_is_allbits_zero="$undef"
17077             ;;
17078     esac
17079 fi
17080 $rm_try
17081
17082 : check for off64_t
17083 echo " "
17084 echo "Checking to see if you have off64_t..." >&4
17085 $cat >try.c <<EOCP
17086 #include <sys/types.h>
17087 #include <unistd.h>
17088 int main() { off64_t x = 7; }
17089 EOCP
17090 set try
17091 if eval $compile; then
17092         val="$define"
17093         echo "You have off64_t."
17094 else
17095         val="$undef"
17096         echo "You do not have off64_t."
17097         case "$lseeksize" in
17098         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17099         esac
17100 fi
17101 $rm_try
17102 set d_off64_t
17103 eval $setvar
17104
17105 : how to create joinable pthreads
17106 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17107         echo " "
17108         echo "Checking what constant to use for creating joinable pthreads..." >&4
17109         $cat >try.c <<'EOCP'
17110 #include <pthread.h>
17111 int main() {
17112     int detachstate = JOINABLE;
17113 }
17114 EOCP
17115         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17116         if eval $compile; then
17117                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17118                 val="$undef" # Yes, undef.
17119                 set d_old_pthread_create_joinable
17120                 eval $setvar
17121                 val=""
17122                 set old_pthread_create_joinable
17123                 eval $setvar
17124         else
17125                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17126                 if eval $compile; then
17127                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17128                         val="$define"
17129                         set d_old_pthread_create_joinable
17130                         eval $setvar
17131                         val=PTHREAD_CREATE_UNDETACHED
17132                         set old_pthread_create_joinable
17133                         eval $setvar
17134                 else
17135                         set try -DJOINABLE=__UNDETACHED
17136                         if eval $compile; then
17137                                 echo "You seem to use __UNDETACHED." >&4
17138                                 val="$define"
17139                                 set d_old_pthread_create_joinable
17140                                 eval $setvar
17141                                 val=__UNDETACHED
17142                                 set old_pthread_create_joinable
17143                                 eval $setvar
17144                         else
17145                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17146                                 val="$define"
17147                                 set d_old_pthread_create_joinable
17148                                 eval $setvar
17149                                 val=0
17150                                 set old_pthread_create_joinable
17151                                 eval $setvar
17152                         fi
17153                 fi
17154         fi
17155         $rm_try
17156 else
17157     d_old_pthread_create_joinable="$undef"
17158     old_pthread_create_joinable=""
17159 fi
17160
17161 : see if pause exists
17162 set pause d_pause
17163 eval $inlibc
17164
17165 : see if poll exists
17166 set poll d_poll
17167 eval $inlibc
17168
17169 : see if prctl exists
17170 set prctl d_prctl
17171 eval $inlibc
17172
17173 : see if prctl supports PR_SET_NAME
17174 d_prctl_set_name=$undef
17175 case $d_prctl in
17176     $define)
17177         $cat >try.c <<EOM
17178 #ifdef __ANDROID__
17179 #include <unistd.h>
17180 #endif
17181 #include <sys/prctl.h>
17182
17183 int main (int argc, char *argv[])
17184 {
17185     return (prctl (PR_SET_NAME, "Test"));
17186     } /* main */
17187 EOM
17188         set try
17189         if eval $compile_ok && $run ./try; then
17190             echo "Your prctl (PR_SET_NAME, ...) works"
17191             d_prctl_set_name=$define
17192             fi
17193         $rm_try
17194         ;;
17195     esac
17196
17197 : see if readlink exists
17198 set readlink d_readlink
17199 eval $inlibc
17200
17201 : Check if there is a /proc symlink to the abs path of
17202 : the executing program.  We will honor hints of d_procselfexe=$undef
17203 : or procselfexe being non-empty, otherwise will try to determine both
17204 : if we have readlink.
17205 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17206 : referenced, and AmigaOS does not have a proc filesystem anyway.
17207 echo " "
17208 val="$undef"
17209 if $test "X$d_procselfexe" = Xundef; then
17210         procselfexe=''
17211 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17212         val="$define"
17213 elif $test "X$d_readlink" = Xdefine; then
17214         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17215         : and it feels more tidy to avoid an extra level of symlink
17216         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17217         while test $# -gt 0; do
17218             type=$1; try=$2
17219             shift; shift
17220             if $issymlink $try; then
17221                 $ls -l $try > reflect
17222                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17223                     echo "You have $type-like $try."
17224                     procselfexe='"'$try'"'
17225                     val="$define"
17226                     : This will break out of the loop
17227                     set X; shift
17228                 fi
17229             fi
17230         done
17231 fi
17232 $rm -f reflect
17233 set d_procselfexe
17234 eval $setvar
17235
17236 : backward compatibility for d_hvfork
17237 if test X$d_hvfork != X; then
17238         d_vfork="$d_hvfork"
17239         d_hvfork=''
17240 fi
17241 : see if there is a vfork
17242 val=''
17243 set vfork val
17244 eval $inlibc
17245
17246 d_pseudofork=$undef
17247
17248 : Ok, but do we want to use it. vfork is reportedly unreliable in
17249 : perl on Solaris 2.x, and probably elsewhere.
17250 case "$val" in
17251 $define)
17252         echo " "
17253         case "$usevfork" in
17254         false) dflt='n';;
17255         *) dflt='y';;
17256         esac
17257         cat <<'EOM'
17258
17259 Perl can only use a vfork() that doesn't suffer from strict
17260 restrictions on calling functions or modifying global data in
17261 the child.  For example, glibc-2.1 contains such a vfork()
17262 that is unsuitable.  If your system provides a proper fork()
17263 call, chances are that you do NOT want perl to use vfork().
17264
17265 EOM
17266         rp="Do you still want to use vfork()?"
17267         . ./myread
17268         case "$ans" in
17269         y|Y) ;;
17270         *)
17271                 echo "Ok, we won't use vfork()."
17272                 val="$undef"
17273                 ;;
17274         esac
17275         ;;
17276 esac
17277 set d_vfork
17278 eval $setvar
17279 case "$d_vfork" in
17280 $define) usevfork='true';;
17281 *) usevfork='false';;
17282 esac
17283
17284 : see whether the pthread_atfork exists
17285 $cat >try.c <<EOP
17286 #include <pthread.h>
17287 #include <stdio.h>
17288 int main() {
17289 #ifdef  PTHREAD_ATFORK
17290         pthread_atfork(NULL,NULL,NULL);
17291 #endif
17292 }
17293 EOP
17294
17295 : see if pthread_atfork exists
17296 set try -DPTHREAD_ATFORK
17297 if eval $compile; then
17298     val="$define"
17299 else
17300     val="$undef"
17301 fi
17302 case "$usethreads" in
17303 $define)
17304         case "$val" in
17305         $define) echo 'pthread_atfork found.' >&4        ;;
17306         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17307         esac
17308 esac
17309 set d_pthread_atfork
17310 eval $setvar
17311
17312 : see if pthread_attr_setscope exists
17313 set pthread_attr_setscope d_pthread_attr_setscope
17314 eval $inlibc
17315
17316 : see whether the various POSIXish _yields exist
17317 $cat >try.c <<EOP
17318 #include <pthread.h>
17319 #include <stdio.h>
17320 int main() {
17321 #ifdef SCHED_YIELD
17322         sched_yield();
17323 #else
17324 #ifdef PTHREAD_YIELD
17325         pthread_yield();
17326 #else
17327 #ifdef PTHREAD_YIELD_NULL
17328         pthread_yield(NULL);
17329 #endif
17330 #endif
17331 #endif
17332 }
17333 EOP
17334 : see if sched_yield exists
17335 set try -DSCHED_YIELD
17336 if eval $compile; then
17337     val="$define"
17338     sched_yield='sched_yield()'
17339 else
17340     val="$undef"
17341 fi
17342 case "$usethreads" in
17343 $define)
17344         case "$val" in
17345         $define) echo 'sched_yield() found.' >&4        ;;
17346         *)       echo 'sched_yield() NOT found.' >&4    ;;
17347         esac
17348 esac
17349 set d_sched_yield
17350 eval $setvar
17351
17352 : see if pthread_yield exists
17353 set try -DPTHREAD_YIELD
17354 if eval $compile; then
17355     val="$define"
17356     case "$sched_yield" in
17357     '') sched_yield='pthread_yield()' ;;
17358     esac
17359 else
17360     set try -DPTHREAD_YIELD_NULL
17361     if eval $compile; then
17362         val="$define"
17363         case "$sched_yield" in
17364         '') sched_yield='pthread_yield(NULL)' ;;
17365         esac
17366     else
17367         val="$undef"
17368     fi
17369 fi
17370 case "$usethreads" in
17371 $define)
17372         case "$val" in
17373         $define) echo 'pthread_yield() found.' >&4      ;;
17374         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17375         esac
17376         ;;
17377 esac
17378 set d_pthread_yield
17379 eval $setvar
17380 case "$sched_yield" in
17381 '') sched_yield=undef ;;
17382 esac
17383 $rm_try
17384
17385 : check for ptrdiff_t
17386 echo " "
17387 echo "Checking to see if you have ptrdiff_t..." >&4
17388 $cat >try.c <<EOCP
17389 #include <stddef.h>
17390 int main() { ptrdiff_t x = 7; }
17391 EOCP
17392 set try
17393 if eval $compile; then
17394         val="$define"
17395         echo "You have ptrdiff_t."
17396 else
17397         val="$undef"
17398         echo "You do not have ptrdiff_t."
17399 fi
17400 $rm_try
17401 set d_ptrdiff_t
17402 eval $setvar
17403
17404 : see if random_r exists
17405 set random_r d_random_r
17406 eval $inlibc
17407 case "$d_random_r" in
17408 "$define")
17409         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17410         case "$d_random_r_proto:$usethreads" in
17411         ":define")      d_random_r_proto=define
17412                 set d_random_r_proto random_r $hdrs
17413                 eval $hasproto ;;
17414         *)      ;;
17415         esac
17416         case "$d_random_r_proto" in
17417         define)
17418         case "$random_r_proto" in
17419         ''|0) try='int random_r(int*, struct random_data*);'
17420         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17421         esac
17422         case "$random_r_proto" in
17423         ''|0) try='int random_r(long*, struct random_data*);'
17424         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17425         esac
17426         case "$random_r_proto" in
17427         ''|0) try='int random_r(struct random_data*, int32_t*);'
17428         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17429         esac
17430         case "$random_r_proto" in
17431         ''|0)   d_random_r=undef
17432                 random_r_proto=0
17433                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17434         * )     case "$random_r_proto" in
17435                 REENTRANT_PROTO*) ;;
17436                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17437                 esac
17438                 echo "Prototype: $try" ;;
17439         esac
17440         ;;
17441         *)      case "$usethreads" in
17442                 define) echo "random_r has no prototype, not using it." >&4 ;;
17443                 esac
17444                 d_random_r=undef
17445                 random_r_proto=0
17446                 ;;
17447         esac
17448         ;;
17449 *)      random_r_proto=0
17450         ;;
17451 esac
17452
17453 : see if readdir and friends exist
17454 set readdir d_readdir
17455 eval $inlibc
17456 set seekdir d_seekdir
17457 eval $inlibc
17458 set telldir d_telldir
17459 eval $inlibc
17460 set rewinddir d_rewinddir
17461 eval $inlibc
17462
17463 : see if readdir64_r exists
17464 set readdir64_r d_readdir64_r
17465 eval $inlibc
17466 case "$d_readdir64_r" in
17467 "$define")
17468         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17469         case "$d_readdir64_r_proto:$usethreads" in
17470         ":define")      d_readdir64_r_proto=define
17471                 set d_readdir64_r_proto readdir64_r $hdrs
17472                 eval $hasproto ;;
17473         *)      ;;
17474         esac
17475         case "$d_readdir64_r_proto" in
17476         define)
17477         case "$readdir64_r_proto" in
17478         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17479         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17480         esac
17481         case "$readdir64_r_proto" in
17482         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17483         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17484         esac
17485         case "$readdir64_r_proto" in
17486         ''|0)   d_readdir64_r=undef
17487                 readdir64_r_proto=0
17488                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17489         * )     case "$readdir64_r_proto" in
17490                 REENTRANT_PROTO*) ;;
17491                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17492                 esac
17493                 echo "Prototype: $try" ;;
17494         esac
17495         ;;
17496         *)      case "$usethreads" in
17497                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17498                 esac
17499                 d_readdir64_r=undef
17500                 readdir64_r_proto=0
17501                 ;;
17502         esac
17503         ;;
17504 *)      readdir64_r_proto=0
17505         ;;
17506 esac
17507
17508 : see if readdir_r exists
17509 set readdir_r d_readdir_r
17510 eval $inlibc
17511 case "$d_readdir_r" in
17512 "$define")
17513         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17514         case "$d_readdir_r_proto:$usethreads" in
17515         ":define")      d_readdir_r_proto=define
17516                 set d_readdir_r_proto readdir_r $hdrs
17517                 eval $hasproto ;;
17518         *)      ;;
17519         esac
17520         case "$d_readdir_r_proto" in
17521         define)
17522         case "$readdir_r_proto" in
17523         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17524         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17525         esac
17526         case "$readdir_r_proto" in
17527         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17528         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17529         esac
17530         case "$readdir_r_proto" in
17531         ''|0)   d_readdir_r=undef
17532                 readdir_r_proto=0
17533                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17534         * )     case "$readdir_r_proto" in
17535                 REENTRANT_PROTO*) ;;
17536                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17537                 esac
17538                 echo "Prototype: $try" ;;
17539         esac
17540         ;;
17541         *)      case "$usethreads" in
17542                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17543                 esac
17544                 d_readdir_r=undef
17545                 readdir_r_proto=0
17546                 ;;
17547         esac
17548         ;;
17549 *)      readdir_r_proto=0
17550         ;;
17551 esac
17552
17553 : see if readv exists
17554 set readv d_readv
17555 eval $inlibc
17556
17557 : see if recvmsg exists
17558 set recvmsg d_recvmsg
17559 eval $inlibc
17560
17561 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17562 echo " "
17563 if set regcomp val -f d_regcomp; eval $csym; $val; then
17564         echo 'regcomp() found.' >&4
17565         d_regcomp="$define"
17566         d_regcmp="$undef"
17567         d_re_comp="$undef"
17568 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17569         echo 'regcmp() found.' >&4
17570         d_regcmp="$define"
17571         d_regcomp="$undef"
17572         d_re_comp="$undef"
17573 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17574         echo 're_comp() found, assuming re_exec() also exists.' >&4
17575         d_re_comp="$define"
17576         d_regcomp="$undef"
17577         d_regcmp="$undef"
17578 else
17579         $cat >&4 <<EOM
17580 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17581 EOM
17582         d_regcmp="$undef"
17583         d_re_comp="$undef"
17584         d_regcomp="$undef"
17585 fi
17586
17587 : see if remainder exists
17588 set remainder d_remainder
17589 eval $inlibc
17590
17591 : see if remquo exists
17592 set remquo d_remquo
17593 eval $inlibc
17594
17595 : see if rename exists
17596 set rename d_rename
17597 eval $inlibc
17598
17599 : see if rint exists
17600 set rint d_rint
17601 eval $inlibc
17602
17603 : see if rmdir exists
17604 set rmdir d_rmdir
17605 eval $inlibc
17606
17607 : see if round exists
17608 set round d_round
17609 eval $inlibc
17610
17611 : see if memory.h is available.
17612 val=''
17613 set memory.h val
17614 eval $inhdr
17615
17616 : See if it conflicts with string.h
17617 case "$val" in
17618 $define)
17619         case "$strings" in
17620         '') ;;
17621         *)
17622                 $cppstdin $cppflags $cppminus < $strings > mem.h
17623                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17624                         echo " "
17625                         echo "We won't be including <memory.h>."
17626                         val="$undef"
17627                 fi
17628                 $rm -f mem.h
17629                 ;;
17630         esac
17631 esac
17632 set i_memory
17633 eval $setvar
17634
17635 : can bcopy handle overlapping blocks?
17636 echo " "
17637 val="$undef"
17638 case "$d_memmove" in
17639 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17640 *)      case "$d_bcopy" in
17641         "$define")
17642                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17643                 $cat >try.c <<EOCP
17644 #$i_memory I_MEMORY
17645 #$i_stdlib I_STDLIB
17646 #$i_string I_STRING
17647 #$i_unistd I_UNISTD
17648 EOCP
17649         $cat >>try.c <<'EOCP'
17650 #include <stdio.h>
17651 #ifdef I_MEMORY
17652 #  include <memory.h>
17653 #endif
17654 #ifdef I_STDLIB
17655 #  include <stdlib.h>
17656 #endif
17657 #ifdef I_STRING
17658 #  include <string.h>
17659 #else
17660 #  include <strings.h>
17661 #endif
17662 #ifdef I_UNISTD
17663 #  include <unistd.h>  /* Needed for NetBSD */
17664 #endif
17665 int main()
17666 {
17667 char buf[128], abc[128];
17668 char *b;
17669 int len;
17670 int off;
17671 int align;
17672
17673 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17674    try to store the string in read-only memory. */
17675 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17676
17677 for (align = 7; align >= 0; align--) {
17678         for (len = 36; len; len--) {
17679                 b = buf+align;
17680                 bcopy(abc, b, len);
17681                 for (off = 1; off <= len; off++) {
17682                         bcopy(b, b+off, len);
17683                         bcopy(b+off, b, len);
17684                         if (bcmp(b, abc, len))
17685                                 exit(1);
17686                 }
17687         }
17688 }
17689 exit(0);
17690 }
17691 EOCP
17692                 set try
17693                 if eval $compile_ok; then
17694                         if $run ./try 2>/dev/null; then
17695                                 echo "Yes, it can."
17696                                 val="$define"
17697                         else
17698                                 echo "It can't, sorry."
17699                         fi
17700                 else
17701                         echo "(I can't compile the test program, so we'll assume not...)"
17702                 fi
17703                 ;;
17704         esac
17705         $rm_try
17706         ;;
17707 esac
17708 set d_safebcpy
17709 eval $setvar
17710
17711 : can memcpy handle overlapping blocks?
17712 echo " "
17713 val="$undef"
17714 case "$d_memmove" in
17715 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17716 *)      case "$d_memcpy" in
17717         "$define")
17718                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17719                 $cat >try.c <<EOCP
17720 #$i_memory I_MEMORY
17721 #$i_stdlib I_STDLIB
17722 #$i_string I_STRING
17723 #$i_unistd I_UNISTD
17724 EOCP
17725         $cat >>try.c <<'EOCP'
17726 #include <stdio.h>
17727 #ifdef I_MEMORY
17728 #  include <memory.h>
17729 #endif
17730 #ifdef I_STDLIB
17731 #  include <stdlib.h>
17732 #endif
17733 #ifdef I_STRING
17734 #  include <string.h>
17735 #else
17736 #  include <strings.h>
17737 #endif
17738 #ifdef I_UNISTD
17739 #  include <unistd.h>  /* Needed for NetBSD */
17740 #endif
17741 int main()
17742 {
17743 char buf[128], abc[128];
17744 char *b;
17745 int len;
17746 int off;
17747 int align;
17748
17749 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17750    try to store the string in read-only memory. */
17751 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17752
17753 for (align = 7; align >= 0; align--) {
17754         for (len = 36; len; len--) {
17755                 b = buf+align;
17756                 memcpy(b, abc, len);
17757                 for (off = 1; off <= len; off++) {
17758                         memcpy(b+off, b, len);
17759                         memcpy(b, b+off, len);
17760                         if (memcmp(b, abc, len))
17761                                 exit(1);
17762                 }
17763         }
17764 }
17765 exit(0);
17766 }
17767 EOCP
17768                 set try
17769                 if eval $compile_ok; then
17770                         if $run ./try 2>/dev/null; then
17771                                 echo "Yes, it can."
17772                                 val="$define"
17773                         else
17774                                 echo "It can't, sorry."
17775                         fi
17776                 else
17777                         echo "(I can't compile the test program, so we'll assume not...)"
17778                 fi
17779                 ;;
17780         esac
17781         $rm_try
17782         ;;
17783 esac
17784 set d_safemcpy
17785 eval $setvar
17786
17787 : can memcmp be trusted to compare relative magnitude?
17788 val="$undef"
17789 case "$d_memcmp" in
17790 "$define")
17791         echo " "
17792         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17793         $cat >try.c <<EOCP
17794 #$i_memory I_MEMORY
17795 #$i_stdlib I_STDLIB
17796 #$i_string I_STRING
17797 #$i_unistd I_UNISTD
17798 EOCP
17799         $cat >>try.c <<'EOCP'
17800 #include <stdio.h>
17801 #ifdef I_MEMORY
17802 #  include <memory.h>
17803 #endif
17804 #ifdef I_STDLIB
17805 #  include <stdlib.h>
17806 #endif
17807 #ifdef I_STRING
17808 #  include <string.h>
17809 #else
17810 #  include <strings.h>
17811 #endif
17812 #ifdef I_UNISTD
17813 #  include <unistd.h>  /* Needed for NetBSD */
17814 #endif
17815 int main()
17816 {
17817 char a = -1;
17818 char b = 0;
17819 if ((a < b) && memcmp(&a, &b, 1) < 0)
17820         exit(1);
17821 exit(0);
17822 }
17823 EOCP
17824         set try
17825         if eval $compile_ok; then
17826                 if $run ./try 2>/dev/null; then
17827                         echo "Yes, it can."
17828                         val="$define"
17829                 else
17830                         echo "No, it can't (it uses signed chars)."
17831                 fi
17832         else
17833                 echo "(I can't compile the test program, so we'll assume not...)"
17834         fi
17835         ;;
17836 esac
17837 $rm_try
17838 set d_sanemcmp
17839 eval $setvar
17840
17841 : see if prototype for sbrk is available
17842 echo " "
17843 set d_sbrkproto sbrk $i_unistd unistd.h
17844 eval $hasproto
17845
17846 : see if scalbn exists
17847 set scalbn d_scalbn
17848 eval $inlibc
17849
17850 : see if select exists
17851 set select d_select
17852 eval $inlibc
17853
17854 : see if semctl exists
17855 set semctl d_semctl
17856 eval $inlibc
17857
17858 : see if semget exists
17859 set semget d_semget
17860 eval $inlibc
17861
17862 : see if semop exists
17863 set semop d_semop
17864 eval $inlibc
17865
17866 : see how much of the 'sem*(2)' library is present.
17867 h_sem=true
17868 echo " "
17869 case "$d_semctl$d_semget$d_semop" in
17870 *"$undef"*) h_sem=false;;
17871 esac
17872 case "$osname" in
17873 freebsd)
17874     case "`ipcs 2>&1`" in
17875     "SVID messages"*"not configured"*)
17876         echo "Your $osname does not have the sem*(2) configured." >&4
17877         h_sem=false
17878         val="$undef"
17879         set semctl d_semctl
17880         eval $setvar
17881         set semget d_semget
17882         eval $setvar
17883         set semop d_semop
17884         eval $setvar
17885         ;;
17886     esac
17887     ;;
17888 esac
17889 : we could also check for sys/ipc.h ...
17890 if $h_sem && $test `./findhdr sys/sem.h`; then
17891         echo "You have the full sem*(2) library." >&4
17892         val="$define"
17893 else
17894         echo "You don't have the full sem*(2) library." >&4
17895         val="$undef"
17896 fi
17897 set d_sem
17898 eval $setvar
17899
17900 : see whether sys/sem.h defines union semun
17901 echo " "
17902 $cat > try.c <<'END'
17903 #include <sys/types.h>
17904 #include <sys/ipc.h>
17905 #include <sys/sem.h>
17906 int main () { union semun semun; semun.buf = 0; }
17907 END
17908 set try
17909 if eval $compile; then
17910     echo "You have union semun in <sys/sem.h>." >&4
17911     val="$define"
17912 else
17913     echo "You do not have union semun in <sys/sem.h>." >&4
17914     val="$undef"
17915 fi
17916 $rm_try
17917 set d_union_semun
17918 eval $setvar
17919
17920 : see how to do semctl IPC_STAT
17921 case "$d_sem" in
17922 $define)
17923     echo " "
17924     $cat > tryh.h <<END
17925 #ifndef S_IRUSR
17926 #   ifdef S_IREAD
17927 #       define S_IRUSR S_IREAD
17928 #       define S_IWUSR S_IWRITE
17929 #       define S_IXUSR S_IEXEC
17930 #   else
17931 #       define S_IRUSR 0400
17932 #       define S_IWUSR 0200
17933 #       define S_IXUSR 0100
17934 #   endif
17935 #   define S_IRGRP (S_IRUSR>>3)
17936 #   define S_IWGRP (S_IWUSR>>3)
17937 #   define S_IXGRP (S_IXUSR>>3)
17938 #   define S_IROTH (S_IRUSR>>6)
17939 #   define S_IWOTH (S_IWUSR>>6)
17940 #   define S_IXOTH (S_IXUSR>>6)
17941 #endif
17942 #ifndef S_IRWXU
17943 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17944 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17945 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17946 #endif
17947 END
17948     : see whether semctl IPC_STAT can use union semun
17949     case "$d_semctl_semun" in
17950     '')
17951       val="$undef"
17952       $cat > try.c <<END
17953 #include <sys/types.h>
17954 #include <sys/ipc.h>
17955 #include <sys/sem.h>
17956 #include <sys/stat.h>
17957 #include <stdio.h>
17958 #include <errno.h>
17959 #include "tryh.h"
17960 #ifndef errno
17961 extern int errno;
17962 #endif
17963 #$d_union_semun HAS_UNION_SEMUN
17964 int main() {
17965     union semun
17966 #ifndef HAS_UNION_SEMUN
17967     {
17968         int val;
17969         struct semid_ds *buf;
17970         unsigned short *array;
17971     }
17972 #endif
17973     arg;
17974     int sem, st;
17975
17976 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17977     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17978     if (sem > -1) {
17979         struct semid_ds argbuf;
17980         arg.buf = &argbuf;
17981 #       ifdef IPC_STAT
17982         st = semctl(sem, 0, IPC_STAT, arg);
17983         if (st == 0)
17984             printf("semun\n");
17985         else
17986 #       endif /* IPC_STAT */
17987             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17988 #       ifdef IPC_RMID
17989         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17990 #       endif /* IPC_RMID */
17991             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17992     } else
17993 #endif /* IPC_PRIVATE && ... */
17994         printf("semget failed: errno = %d\n", errno);
17995   return 0;
17996 }
17997 END
17998       set try
17999       if eval $compile; then
18000           xxx=`$run ./try`
18001           case "$xxx" in
18002           semun) val="$define" ;;
18003           esac
18004       fi
18005       $rm_try
18006       set d_semctl_semun
18007       eval $setvar
18008       ;;
18009     esac
18010     case "$d_semctl_semun" in
18011     $define)
18012         echo "You can use union semun for semctl IPC_STAT." >&4
18013         also='also'
18014         ;;
18015     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
18016         also=''
18017         ;;
18018     esac
18019
18020     : see whether semctl IPC_STAT can use struct semid_ds pointer
18021     case "$d_semctl_semid_ds" in
18022     '')
18023       val="$undef"
18024       $cat > try.c <<'END'
18025 #include <sys/types.h>
18026 #include <sys/ipc.h>
18027 #include <sys/sem.h>
18028 #include <sys/stat.h>
18029 #include "tryh.h"
18030 #include <stdio.h>
18031 #include <errno.h>
18032 #ifndef errno
18033 extern int errno;
18034 #endif
18035 int main() {
18036     struct semid_ds arg;
18037     int sem, st;
18038
18039 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18040     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18041     if (sem > -1) {
18042 #       ifdef IPC_STAT
18043         st = semctl(sem, 0, IPC_STAT, &arg);
18044         if (st == 0)
18045             printf("semid_ds\n");
18046         else
18047 #       endif /* IPC_STAT */
18048             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18049 #       ifdef IPC_RMID
18050         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18051 #       endif /* IPC_RMID */
18052             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18053     } else
18054 #endif /* IPC_PRIVATE && ... */
18055         printf("semget failed: errno = %d\n", errno);
18056
18057     return 0;
18058 }
18059 END
18060       set try
18061       if eval $compile; then
18062           xxx=`$run ./try`
18063           case "$xxx" in
18064           semid_ds) val="$define" ;;
18065           esac
18066       fi
18067       $rm_try
18068       set d_semctl_semid_ds
18069       eval $setvar
18070       ;;
18071     esac
18072     case "$d_semctl_semid_ds" in
18073     $define)
18074         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18075         ;;
18076     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18077         ;;
18078     esac
18079     ;;
18080 *)  val="$undef"
18081
18082     # We do not have the full sem*(2) library, so assume we can not
18083     # use either.
18084
18085     set d_semctl_semun
18086     eval $setvar
18087
18088     set d_semctl_semid_ds
18089     eval $setvar
18090     ;;
18091 esac
18092 $rm_try tryh.h
18093
18094 : see if sendmsg exists
18095 set sendmsg d_sendmsg
18096 eval $inlibc
18097
18098 : see if setegid exists
18099 set setegid d_setegid
18100 eval $inlibc
18101
18102 : see if seteuid exists
18103 set seteuid d_seteuid
18104 eval $inlibc
18105
18106 : see if setgrent exists
18107 set setgrent d_setgrent
18108 eval $inlibc
18109
18110 : see if setgrent_r exists
18111 set setgrent_r d_setgrent_r
18112 eval $inlibc
18113 case "$d_setgrent_r" in
18114 "$define")
18115         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18116         case "$d_setgrent_r_proto:$usethreads" in
18117         ":define")      d_setgrent_r_proto=define
18118                 set d_setgrent_r_proto setgrent_r $hdrs
18119                 eval $hasproto ;;
18120         *)      ;;
18121         esac
18122         case "$d_setgrent_r_proto" in
18123         define)
18124         case "$setgrent_r_proto" in
18125         ''|0) try='int setgrent_r(FILE**);'
18126         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18127         esac
18128         case "$setgrent_r_proto" in
18129         ''|0) try='void setgrent_r(FILE**);'
18130         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18131         esac
18132         case "$setgrent_r_proto" in
18133         ''|0)   d_setgrent_r=undef
18134                 setgrent_r_proto=0
18135                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18136         * )     case "$setgrent_r_proto" in
18137                 REENTRANT_PROTO*) ;;
18138                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18139                 esac
18140                 echo "Prototype: $try" ;;
18141         esac
18142         ;;
18143         *)      case "$usethreads" in
18144                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18145                 esac
18146                 d_setgrent_r=undef
18147                 setgrent_r_proto=0
18148                 ;;
18149         esac
18150         ;;
18151 *)      setgrent_r_proto=0
18152         ;;
18153 esac
18154
18155 : see if sethostent exists
18156 set sethostent d_sethent
18157 eval $inlibc
18158
18159 : see if sethostent_r exists
18160 set sethostent_r d_sethostent_r
18161 eval $inlibc
18162 case "$d_sethostent_r" in
18163 "$define")
18164         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18165         case "$d_sethostent_r_proto:$usethreads" in
18166         ":define")      d_sethostent_r_proto=define
18167                 set d_sethostent_r_proto sethostent_r $hdrs
18168                 eval $hasproto ;;
18169         *)      ;;
18170         esac
18171         case "$d_sethostent_r_proto" in
18172         define)
18173         case "$sethostent_r_proto" in
18174         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18175         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18176         esac
18177         case "$sethostent_r_proto" in
18178         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18179         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18180         esac
18181         case "$sethostent_r_proto" in
18182         ''|0)   d_sethostent_r=undef
18183                 sethostent_r_proto=0
18184                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18185         * )     case "$sethostent_r_proto" in
18186                 REENTRANT_PROTO*) ;;
18187                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18188                 esac
18189                 echo "Prototype: $try" ;;
18190         esac
18191         ;;
18192         *)      case "$usethreads" in
18193                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18194                 esac
18195                 d_sethostent_r=undef
18196                 sethostent_r_proto=0
18197                 ;;
18198         esac
18199         ;;
18200 *)      sethostent_r_proto=0
18201         ;;
18202 esac
18203
18204 : see if setitimer exists
18205 set setitimer d_setitimer
18206 eval $inlibc
18207
18208 : see if setlinebuf exists
18209 set setlinebuf d_setlinebuf
18210 eval $inlibc
18211
18212 : see if setlocale exists
18213 set setlocale d_setlocale
18214 eval $inlibc
18215
18216 : see if locale.h is available
18217 set locale.h i_locale
18218 eval $inhdr
18219
18220 : see if setlocale_r exists
18221 set setlocale_r d_setlocale_r
18222 eval $inlibc
18223 case "$d_setlocale_r" in
18224 "$define")
18225         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18226         case "$d_setlocale_r_proto:$usethreads" in
18227         ":define")      d_setlocale_r_proto=define
18228                 set d_setlocale_r_proto setlocale_r $hdrs
18229                 eval $hasproto ;;
18230         *)      ;;
18231         esac
18232         case "$d_setlocale_r_proto" in
18233         define)
18234         case "$setlocale_r_proto" in
18235         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18236         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18237         esac
18238         case "$setlocale_r_proto" in
18239         ''|0)   d_setlocale_r=undef
18240                 setlocale_r_proto=0
18241                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18242         * )     case "$setlocale_r_proto" in
18243                 REENTRANT_PROTO*) ;;
18244                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18245                 esac
18246                 echo "Prototype: $try" ;;
18247         esac
18248         ;;
18249         *)      case "$usethreads" in
18250                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18251                 esac
18252                 d_setlocale_r=undef
18253                 setlocale_r_proto=0
18254                 ;;
18255         esac
18256         ;;
18257 *)      setlocale_r_proto=0
18258         ;;
18259 esac
18260
18261 : see if setnetent exists
18262 set setnetent d_setnent
18263 eval $inlibc
18264
18265 : see if setnetent_r exists
18266 set setnetent_r d_setnetent_r
18267 eval $inlibc
18268 case "$d_setnetent_r" in
18269 "$define")
18270         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18271         case "$d_setnetent_r_proto:$usethreads" in
18272         ":define")      d_setnetent_r_proto=define
18273                 set d_setnetent_r_proto setnetent_r $hdrs
18274                 eval $hasproto ;;
18275         *)      ;;
18276         esac
18277         case "$d_setnetent_r_proto" in
18278         define)
18279         case "$setnetent_r_proto" in
18280         ''|0) try='int setnetent_r(int, struct netent_data*);'
18281         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18282         esac
18283         case "$setnetent_r_proto" in
18284         ''|0) try='void setnetent_r(int, struct netent_data*);'
18285         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18286         esac
18287         case "$setnetent_r_proto" in
18288         ''|0)   d_setnetent_r=undef
18289                 setnetent_r_proto=0
18290                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18291         * )     case "$setnetent_r_proto" in
18292                 REENTRANT_PROTO*) ;;
18293                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18294                 esac
18295                 echo "Prototype: $try" ;;
18296         esac
18297         ;;
18298         *)      case "$usethreads" in
18299                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18300                 esac
18301                 d_setnetent_r=undef
18302                 setnetent_r_proto=0
18303                 ;;
18304         esac
18305         ;;
18306 *)      setnetent_r_proto=0
18307         ;;
18308 esac
18309
18310 : see if setprotoent exists
18311 set setprotoent d_setpent
18312 eval $inlibc
18313
18314 : see if setpgid exists
18315 set setpgid d_setpgid
18316 eval $inlibc
18317
18318 : see if setpgrp2 exists
18319 set setpgrp2 d_setpgrp2
18320 eval $inlibc
18321
18322 : see if setpriority exists
18323 set setpriority d_setprior
18324 eval $inlibc
18325
18326 : see if setproctitle exists
18327 set setproctitle d_setproctitle
18328 eval $inlibc
18329
18330 : see if setprotoent_r exists
18331 set setprotoent_r d_setprotoent_r
18332 eval $inlibc
18333 case "$d_setprotoent_r" in
18334 "$define")
18335         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18336         case "$d_setprotoent_r_proto:$usethreads" in
18337         ":define")      d_setprotoent_r_proto=define
18338                 set d_setprotoent_r_proto setprotoent_r $hdrs
18339                 eval $hasproto ;;
18340         *)      ;;
18341         esac
18342         case "$d_setprotoent_r_proto" in
18343         define)
18344         case "$setprotoent_r_proto" in
18345         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18346         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18347         esac
18348         case "$setprotoent_r_proto" in
18349         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18350         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18351         esac
18352         case "$setprotoent_r_proto" in
18353         ''|0)   d_setprotoent_r=undef
18354                 setprotoent_r_proto=0
18355                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18356         * )     case "$setprotoent_r_proto" in
18357                 REENTRANT_PROTO*) ;;
18358                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18359                 esac
18360                 echo "Prototype: $try" ;;
18361         esac
18362         ;;
18363         *)      case "$usethreads" in
18364                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18365                 esac
18366                 d_setprotoent_r=undef
18367                 setprotoent_r_proto=0
18368                 ;;
18369         esac
18370         ;;
18371 *)      setprotoent_r_proto=0
18372         ;;
18373 esac
18374
18375 : see if setpwent exists
18376 set setpwent d_setpwent
18377 eval $inlibc
18378
18379 : see if setpwent_r exists
18380 set setpwent_r d_setpwent_r
18381 eval $inlibc
18382 case "$d_setpwent_r" in
18383 "$define")
18384         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18385         case "$d_setpwent_r_proto:$usethreads" in
18386         ":define")      d_setpwent_r_proto=define
18387                 set d_setpwent_r_proto setpwent_r $hdrs
18388                 eval $hasproto ;;
18389         *)      ;;
18390         esac
18391         case "$d_setpwent_r_proto" in
18392         define)
18393         case "$setpwent_r_proto" in
18394         ''|0) try='int setpwent_r(FILE**);'
18395         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18396         esac
18397         case "$setpwent_r_proto" in
18398         ''|0) try='void setpwent_r(FILE**);'
18399         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18400         esac
18401         case "$setpwent_r_proto" in
18402         ''|0)   d_setpwent_r=undef
18403                 setpwent_r_proto=0
18404                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18405         * )     case "$setpwent_r_proto" in
18406                 REENTRANT_PROTO*) ;;
18407                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18408                 esac
18409                 echo "Prototype: $try" ;;
18410         esac
18411         ;;
18412         *)      case "$usethreads" in
18413                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18414                 esac
18415                 d_setpwent_r=undef
18416                 setpwent_r_proto=0
18417                 ;;
18418         esac
18419         ;;
18420 *)      setpwent_r_proto=0
18421         ;;
18422 esac
18423
18424 : see if setregid exists
18425 set setregid d_setregid
18426 eval $inlibc
18427 set setresgid d_setresgid
18428 eval $inlibc
18429
18430 : see if setreuid exists
18431 set setreuid d_setreuid
18432 eval $inlibc
18433 set setresuid d_setresuid
18434 eval $inlibc
18435
18436 : see if setrgid exists
18437 set setrgid d_setrgid
18438 eval $inlibc
18439
18440 : see if setruid exists
18441 set setruid d_setruid
18442 eval $inlibc
18443
18444 : see if setservent exists
18445 set setservent d_setsent
18446 eval $inlibc
18447
18448 : see if setservent_r exists
18449 set setservent_r d_setservent_r
18450 eval $inlibc
18451 case "$d_setservent_r" in
18452 "$define")
18453         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18454         case "$d_setservent_r_proto:$usethreads" in
18455         ":define")      d_setservent_r_proto=define
18456                 set d_setservent_r_proto setservent_r $hdrs
18457                 eval $hasproto ;;
18458         *)      ;;
18459         esac
18460         case "$d_setservent_r_proto" in
18461         define)
18462         case "$setservent_r_proto" in
18463         ''|0) try='int setservent_r(int, struct servent_data*);'
18464         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18465         esac
18466         case "$setservent_r_proto" in
18467         ''|0) try='void setservent_r(int, struct servent_data*);'
18468         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18469         esac
18470         case "$setservent_r_proto" in
18471         ''|0)   d_setservent_r=undef
18472                 setservent_r_proto=0
18473                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18474         * )     case "$setservent_r_proto" in
18475                 REENTRANT_PROTO*) ;;
18476                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18477                 esac
18478                 echo "Prototype: $try" ;;
18479         esac
18480         ;;
18481         *)      case "$usethreads" in
18482                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18483                 esac
18484                 d_setservent_r=undef
18485                 setservent_r_proto=0
18486                 ;;
18487         esac
18488         ;;
18489 *)      setservent_r_proto=0
18490         ;;
18491 esac
18492
18493 : see if setsid exists
18494 set setsid d_setsid
18495 eval $inlibc
18496
18497 : see if setvbuf exists
18498 set setvbuf d_setvbuf
18499 eval $inlibc
18500
18501 : see if shmctl exists
18502 set shmctl d_shmctl
18503 eval $inlibc
18504
18505 : see if shmget exists
18506 set shmget d_shmget
18507 eval $inlibc
18508
18509 : see if shmat exists
18510 set shmat d_shmat
18511 eval $inlibc
18512 : see what shmat returns
18513 case "$d_shmat" in
18514 "$define")
18515         $cat >shmat.c <<'END'
18516 #include <sys/shm.h>
18517 void *shmat();
18518 END
18519         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18520                 shmattype='void *'
18521         else
18522                 shmattype='char *'
18523         fi
18524         echo "and it returns ($shmattype)." >&4
18525         : see if a prototype for shmat is available
18526         xxx=`./findhdr sys/shm.h`
18527         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18528         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18529                 val="$define"
18530         else
18531                 val="$undef"
18532         fi
18533         $rm -f shmat.[co]
18534         ;;
18535 *)
18536         val="$undef"
18537         ;;
18538 esac
18539 set d_shmatprototype
18540 eval $setvar
18541
18542 : see if shmdt exists
18543 set shmdt d_shmdt
18544 eval $inlibc
18545
18546 : see how much of the 'shm*(2)' library is present.
18547 h_shm=true
18548 echo " "
18549 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18550 *"$undef"*) h_shm=false;;
18551 esac
18552 case "$osname" in
18553 freebsd)
18554     case "`ipcs 2>&1`" in
18555     "SVID shared memory"*"not configured"*)
18556         echo "Your $osname does not have the shm*(2) configured." >&4
18557         h_shm=false
18558         val="$undef"
18559         set shmctl d_shmctl
18560         eval $setvar
18561         set shmget d_shmget
18562         eval $setvar
18563         set shmat d_shmat
18564         eval $setvar
18565         set shmdt d_shmdt
18566         eval $setvar
18567         ;;
18568     esac
18569     ;;
18570 esac
18571 : we could also check for sys/ipc.h ...
18572 if $h_shm && $test `./findhdr sys/shm.h`; then
18573         echo "You have the full shm*(2) library." >&4
18574         val="$define"
18575 else
18576         echo "You don't have the full shm*(2) library." >&4
18577         val="$undef"
18578 fi
18579 set d_shm
18580 eval $setvar
18581
18582 : see if we have sigaction
18583 echo " "
18584 if set sigaction val -f d_sigaction; eval $csym; $val; then
18585         echo 'sigaction() found.' >&4
18586         $cat > try.c <<EOP
18587 #include <stdio.h>
18588 #include <sys/types.h>
18589 #include <signal.h>
18590 #$i_stdlib I_STDLIB
18591 #ifdef I_STDLIB
18592 #include <stdlib.h>
18593 #endif
18594 int main()
18595 {
18596     struct sigaction act, oact;
18597     act.sa_flags = 0;
18598     oact.sa_handler = 0;
18599     /* so that act and oact are used */
18600     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18601 }
18602 EOP
18603         set try
18604         if eval $compile_ok; then
18605                 val="$define"
18606         else
18607                 echo "But you don't seem to have a usable struct sigaction." >&4
18608                 val="$undef"
18609         fi
18610 else
18611         echo 'sigaction NOT found.' >&4
18612         val="$undef"
18613 fi
18614 set d_sigaction; eval $setvar
18615 $rm_try
18616
18617 : see if this is a sunmath.h system
18618 set sunmath.h i_sunmath
18619 eval $inhdr
18620
18621 : see if signbit exists
18622 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18623 $cat >try.c <<EOCP
18624 #$i_math I_MATH
18625 #$i_sunmath I_SUNMATH
18626 #ifdef I_MATH
18627 #  include <math.h>
18628 #endif
18629 #ifdef I_SUNMATH  /* Solaris special math library */
18630 #  include <sunmath.h>
18631 #endif
18632 #define NV $nvtype
18633 int main(int argc, char **argv)
18634 {
18635     NV x = 0.0;
18636     NV y = -0.0;
18637     if ((signbit(x) == 0) && (signbit(y) != 0))
18638         return 0;
18639     else
18640         return 1;
18641 }
18642 EOCP
18643 val="$undef"
18644 set try
18645 if eval $compile; then
18646     if $run ./try; then
18647         $echo "Yes." >&4
18648         val="$define"
18649     else
18650         $echo "Signbit seems to be available, but doesn't work as I expected."
18651         $echo "I won't use it." >&4
18652         val="$undef"
18653     fi
18654 else
18655     $echo "Nope." >&4
18656     dflt="$undef"
18657 fi
18658 set d_signbit
18659 eval $setvar
18660 $rm_try
18661
18662 : see if sigprocmask exists
18663 set sigprocmask d_sigprocmask
18664 eval $inlibc
18665
18666 : see if sigsetjmp exists
18667 echo " "
18668 case "$d_sigsetjmp" in
18669 '')
18670         $cat >try.c <<EOP
18671 #include <setjmp.h>
18672 #$i_stdlib I_STDLIB
18673 #ifdef I_STDLIB
18674 #include <stdlib.h>
18675 #endif
18676 sigjmp_buf env;
18677 int set = 1;
18678 int main()
18679 {
18680         if (sigsetjmp(env,1))
18681                 exit(set);
18682         set = 0;
18683         siglongjmp(env, 1);
18684         exit(1);
18685 }
18686 EOP
18687         set try
18688         if eval $compile; then
18689                 if $run ./try >/dev/null 2>&1; then
18690                         echo "POSIX sigsetjmp found." >&4
18691                         val="$define"
18692                 else
18693                         $cat >&4 <<EOM
18694 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18695 I'll ignore them.
18696 EOM
18697                         val="$undef"
18698                 fi
18699         else
18700                 echo "sigsetjmp not found." >&4
18701                 val="$undef"
18702         fi
18703         ;;
18704 *) val="$d_sigsetjmp"
18705         case "$d_sigsetjmp" in
18706         $define) echo "POSIX sigsetjmp found." >&4;;
18707         $undef) echo "sigsetjmp not found." >&4;;
18708         esac
18709         ;;
18710 esac
18711 set d_sigsetjmp
18712 eval $setvar
18713 $rm_try
18714
18715 : see if snprintf exists
18716 set snprintf d_snprintf
18717 eval $inlibc
18718
18719 : see if vsnprintf exists
18720 set vsnprintf d_vsnprintf
18721 eval $inlibc
18722
18723 case "$d_snprintf-$d_vsnprintf" in
18724 "$define-$define")
18725     $cat <<EOM
18726 Checking whether your snprintf() and vsnprintf() work okay...
18727 EOM
18728     $cat >try.c <<'EOCP'
18729 /* v?snprintf testing logic courtesy of Russ Allbery.
18730  * According to C99:
18731  * - if the buffer is too short it still must be \0-terminated
18732  * - if the buffer is too short the potentially required length
18733  *   must be returned and not -1
18734  * - if the buffer is NULL the potentially required length
18735  *   must be returned and not -1 or core dump
18736  */
18737 #include <stdio.h>
18738 #include <stdarg.h>
18739
18740 char buf[2];
18741
18742 int test (char *format, ...)
18743 {
18744     va_list args;
18745     int count;
18746
18747     va_start (args, format);
18748     count = vsnprintf (buf, sizeof buf, format, args);
18749     va_end (args);
18750     return count;
18751 }
18752
18753 int main ()
18754 {
18755     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18756              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18757 }
18758 EOCP
18759     set try
18760     if eval $compile; then
18761         `$run ./try`
18762         case "$?" in
18763         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18764         *) cat <<EOM >&4
18765 Your snprintf() and snprintf() don't seem to be working okay.
18766 EOM
18767            d_snprintf="$undef"
18768            d_vsnprintf="$undef"
18769            ;;
18770         esac
18771     else
18772         echo "(I can't seem to compile the test program--assuming they don't)"
18773         d_snprintf="$undef"
18774         d_vsnprintf="$undef"
18775     fi
18776     $rm_try
18777     ;;
18778 esac
18779
18780 : see if sockatmark exists
18781 set sockatmark d_sockatmark
18782 eval $inlibc
18783
18784 : see if prototype for sockatmark is available
18785 echo " "
18786 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18787 eval $hasproto
18788
18789 : see if socks5_init exists
18790 set socks5_init d_socks5_init
18791 eval $inlibc
18792
18793 : see if sprintf returns the length of the string in the buffer as per ANSI
18794 $echo "Checking whether sprintf returns the length of the string..." >&4
18795 $cat <<EOP >try.c
18796 #include <stdio.h>
18797 #$i_stdlib I_STDLIB
18798 #ifdef I_STDLIB
18799 #include <stdlib.h>
18800 #endif
18801 #$i_string I_STRING
18802 #ifdef I_STRING
18803 #  include <string.h>
18804 #else
18805 #  include <strings.h>
18806 #endif
18807 #$i_math I_MATH
18808 #ifdef I_MATH
18809 #include <math.h>
18810 #endif
18811
18812 char buffer[256];
18813
18814 int check (size_t expect, int test) {
18815   size_t got = strlen(buffer);
18816   if (expect == got)
18817     return 0;
18818
18819   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18820        test, buffer);
18821   exit (test);
18822 }
18823
18824 int main(int argc, char **argv) {
18825   int test = 0;
18826
18827   check(sprintf(buffer, ""), ++test);
18828   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18829   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18830
18831   return 0;
18832 }
18833 EOP
18834 set try
18835
18836 if eval $compile; then
18837     xxx="`$run ./try`"
18838     case "$?" in
18839         0) cat >&4 <<EOM
18840 sprintf returns the length of the string (as ANSI says it should)
18841 EOM
18842         d_sprintf_returns_strlen="$define"
18843         ;;
18844         *) cat >&4 <<EOM
18845 sprintf does not return the length of the string (how old is this system?)
18846 EOM
18847         d_sprintf_returns_strlen="$undef"
18848         ;;
18849     esac
18850 else
18851     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18852     d_sprintf_returns_strlen="$undef"
18853 fi
18854 $rm_try
18855
18856 : see if srand48_r exists
18857 set srand48_r d_srand48_r
18858 eval $inlibc
18859 case "$d_srand48_r" in
18860 "$define")
18861         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18862         case "$d_srand48_r_proto:$usethreads" in
18863         ":define")      d_srand48_r_proto=define
18864                 set d_srand48_r_proto srand48_r $hdrs
18865                 eval $hasproto ;;
18866         *)      ;;
18867         esac
18868         case "$d_srand48_r_proto" in
18869         define)
18870         case "$srand48_r_proto" in
18871         ''|0) try='int srand48_r(long, struct drand48_data*);'
18872         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18873         esac
18874         case "$srand48_r_proto" in
18875         ''|0)   d_srand48_r=undef
18876                 srand48_r_proto=0
18877                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18878         * )     case "$srand48_r_proto" in
18879                 REENTRANT_PROTO*) ;;
18880                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18881                 esac
18882                 echo "Prototype: $try" ;;
18883         esac
18884         ;;
18885         *)      case "$usethreads" in
18886                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18887                 esac
18888                 d_srand48_r=undef
18889                 srand48_r_proto=0
18890                 ;;
18891         esac
18892         ;;
18893 *)      srand48_r_proto=0
18894         ;;
18895 esac
18896
18897 : see if srandom_r exists
18898 set srandom_r d_srandom_r
18899 eval $inlibc
18900 case "$d_srandom_r" in
18901 "$define")
18902         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18903         case "$d_srandom_r_proto:$usethreads" in
18904         ":define")      d_srandom_r_proto=define
18905                 set d_srandom_r_proto srandom_r $hdrs
18906                 eval $hasproto ;;
18907         *)      ;;
18908         esac
18909         case "$d_srandom_r_proto" in
18910         define)
18911         case "$srandom_r_proto" in
18912         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18913         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18914         esac
18915         case "$srandom_r_proto" in
18916         ''|0)   d_srandom_r=undef
18917                 srandom_r_proto=0
18918                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18919         * )     case "$srandom_r_proto" in
18920                 REENTRANT_PROTO*) ;;
18921                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18922                 esac
18923                 echo "Prototype: $try" ;;
18924         esac
18925         ;;
18926         *)      case "$usethreads" in
18927                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18928                 esac
18929                 d_srandom_r=undef
18930                 srandom_r_proto=0
18931                 ;;
18932         esac
18933         ;;
18934 *)      srandom_r_proto=0
18935         ;;
18936 esac
18937
18938 : see if prototype for setresgid is available
18939 echo " "
18940 set d_sresgproto setresgid $i_unistd unistd.h
18941 eval $hasproto
18942
18943 : see if prototype for setresuid is available
18944 echo " "
18945 set d_sresuproto setresuid $i_unistd unistd.h
18946 eval $hasproto
18947
18948 : see if stat exists
18949 set stat d_stat
18950 eval $inlibc
18951
18952 : see if sys/stat.h is available
18953 set sys/stat.h i_sysstat
18954 eval $inhdr
18955
18956 : see if stat knows about block sizes
18957 echo " "
18958 echo "Checking to see if your struct stat has st_blocks field..." >&4
18959 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18960 eval $hasfield
18961
18962 : see if this is a sys/vfs.h system
18963 set sys/vfs.h i_sysvfs
18964 eval $inhdr
18965
18966 : see if this is a sys/statfs.h system
18967 set sys/statfs.h i_sysstatfs
18968 eval $inhdr
18969
18970 : Check for statfs_s
18971 echo " "
18972 echo "Checking to see if your system supports struct statfs..." >&4
18973 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
18974 eval $hasstruct
18975 case "$d_statfs_s" in
18976 "$define")      echo "Yes, it does."   ;;
18977 *)              echo "No, it doesn't." ;;
18978 esac
18979
18980
18981 : see if struct statfs knows about f_flags
18982 case "$d_statfs_s" in
18983 define)
18984         echo " "
18985         echo "Checking to see if your struct statfs has f_flags field..." >&4
18986         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
18987         eval $hasfield
18988         ;;
18989 *)      val="$undef"
18990         set d_statfs_f_flags
18991         eval $setvar
18992         ;;
18993 esac
18994 case "$d_statfs_f_flags" in
18995 "$define")      echo "Yes, it does."   ;;
18996 *)              echo "No, it doesn't." ;;
18997 esac
18998
18999 : see what flavor, if any, of static inline is supported
19000 echo " "
19001 echo "Checking to see if your system supports static inline..."
19002 $cat > try.c <<'EOCP'
19003 #include <stdlib.h>
19004 extern int f_via_a(int x);
19005 extern int f_via_b(int x);
19006 int main(int argc, char **argv)
19007 {
19008     int y;
19009
19010     y = f_via_a(0);
19011 #ifdef USE_B
19012     y = f_via_b(0);
19013 #endif
19014     if (y == 42) {
19015         return EXIT_SUCCESS;
19016     }
19017     else {
19018         return EXIT_FAILURE;
19019     }
19020 }
19021 EOCP
19022 $cat > a.c <<'EOCP'
19023 static INLINE int f(int x) {
19024     int y;
19025     y = x + 42;
19026     return y;
19027 }
19028
19029 int f_via_a(int x)
19030 {
19031     return f(x);
19032 }
19033 EOCP
19034 $cat > b.c <<'EOCP'
19035 extern int f(int x);
19036
19037 int f_via_b(int x)
19038 {
19039     return f(x);
19040 }
19041 EOCP
19042
19043 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19044 case "$perl_static_inline" in
19045 '')     # Check the various possibilities, and break out on success.
19046         # For gcc, prefer __inline__, which will still permit
19047         # cflags.SH to add in -ansi.
19048         case "$gccversion" in
19049                 '') xxx="inline __inline__ __inline _inline";;
19050                 *)  xxx="__inline__ inline __inline _inline";;
19051         esac
19052         for inline in $xxx; do
19053                 set try -DINLINE=$inline a.c
19054                 if eval $compile && $run ./try; then
19055                         # Now make sure there is no external linkage of static
19056                         # functions
19057                         set try -DINLINE=$inline -DUSE_B a.c b.c
19058                         if eval $compile && $run ./try; then
19059                                 $echo "Your compiler supports static $inline, " >&4
19060                                 $echo "but it also creates an external definition," >&4
19061                                 $echo "so I won't use it." >&4
19062                                 val=$undef
19063                         else
19064                                 $echo "Your compiler supports static $inline." >&4
19065                                 val=$define
19066                                 perl_static_inline="static $inline";
19067                                 break;
19068                         fi
19069                 else
19070                         $echo "Your compiler does NOT support static $inline." >&4
19071                         val="$undef"
19072                 fi
19073         done
19074         ;;
19075 *inline*) # Some variant of inline exists.
19076         echo "Keeping your $hint value of $perl_static_inline."
19077         val=$define
19078         ;;
19079 static)  # No inline capabilities
19080         echo "Keeping your $hint value of $perl_static_inline."
19081         val=$undef
19082         ;;
19083 *)  # Unrecognized previous value -- blindly trust the supplied
19084         # value and hope it makes sense.  Use old value for
19085         # d_static_inline, if there is one.
19086         echo "Keeping your $hint value of $perl_static_inline."
19087         case "$d_static_inline" in
19088                 '') val=$define ;;
19089                 *)  val=$d_static_inline ;;
19090         esac
19091         ;;
19092 esac
19093 # Fallback to plain 'static' if nothing worked.
19094 case "$perl_static_inline" in
19095 '')
19096         perl_static_inline="static"
19097         val=$undef
19098         ;;
19099 esac
19100 set d_static_inline
19101 eval $setvar
19102 $rm -f a.[co] b.[co]
19103 $rm_try
19104
19105 : Check stream access
19106 $cat >&4 <<EOM
19107 Checking how to access stdio streams by file descriptor number...
19108 EOM
19109 case "$stdio_stream_array" in
19110 '')     $cat >try.c <<EOCP
19111 #include <stdio.h>
19112 int main() {
19113   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19114     printf("yes\n");
19115 }
19116 EOCP
19117         for s in _iob __iob __sF
19118         do
19119                 set try -DSTDIO_STREAM_ARRAY=$s
19120                 if eval $compile; then
19121                         case "`$run ./try`" in
19122                         yes)    stdio_stream_array=$s; break ;;
19123                         esac
19124                 fi
19125         done
19126         $rm_try
19127 esac
19128 case "$stdio_stream_array" in
19129 '')     $cat >&4 <<EOM
19130 I can't figure out how to access stdio streams by file descriptor number.
19131 EOM
19132         d_stdio_stream_array="$undef"
19133         ;;
19134 *)      $cat >&4 <<EOM
19135 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19136 EOM
19137         d_stdio_stream_array="$define"
19138         ;;
19139 esac
19140
19141 : see if strcoll exists
19142 set strcoll d_strcoll
19143 eval $inlibc
19144
19145 : check for structure copying
19146 echo " "
19147 echo "Checking to see if your C compiler can copy structs..." >&4
19148 $cat >try.c <<'EOCP'
19149 int main()
19150 {
19151         struct blurfl {
19152                 int dyick;
19153         } foo, bar;
19154
19155         foo = bar;
19156 }
19157 EOCP
19158 if $cc -c try.c >/dev/null 2>&1 ; then
19159         val="$define"
19160         echo "Yup, it can."
19161 else
19162         val="$undef"
19163         echo "Nope, it can't."
19164 fi
19165 set d_strctcpy
19166 eval $setvar
19167 $rm_try
19168
19169 : see if strerror and/or sys_errlist[] exist
19170 echo " "
19171 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19172     if set strerror val -f d_strerror; eval $csym; $val; then
19173                 echo 'strerror() found.' >&4
19174                 d_strerror="$define"
19175                 d_strerrm='strerror(e)'
19176                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19177                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19178                         d_syserrlst="$define"
19179                 else
19180                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19181                         d_syserrlst="$undef"
19182                 fi
19183     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19184                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19185                 echo 'strerror() found in string header.' >&4
19186                 d_strerror="$define"
19187                 d_strerrm='strerror(e)'
19188                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19189                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19190                                 d_syserrlst="$define"
19191                 else
19192                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19193                         d_syserrlst="$undef"
19194                 fi
19195     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19196                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19197                 d_strerror="$undef"
19198                 d_syserrlst="$define"
19199                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19200     else
19201                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19202                 d_strerror="$undef"
19203                 d_syserrlst="$undef"
19204                 d_strerrm='"unknown"'
19205     fi
19206 fi
19207
19208 : see if strerror_r exists
19209 set strerror_r d_strerror_r
19210 eval $inlibc
19211 case "$d_strerror_r" in
19212 "$define")
19213         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19214         case "$d_strerror_r_proto:$usethreads" in
19215         ":define")      d_strerror_r_proto=define
19216                 set d_strerror_r_proto strerror_r $hdrs
19217                 eval $hasproto ;;
19218         *)      ;;
19219         esac
19220         case "$d_strerror_r_proto" in
19221         define)
19222         case "$strerror_r_proto" in
19223         ''|0) try='int strerror_r(int, char*, size_t);'
19224         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19225         esac
19226         case "$strerror_r_proto" in
19227         ''|0) try='int strerror_r(int, char*, int);'
19228         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19229         esac
19230         case "$strerror_r_proto" in
19231         ''|0) try='char* strerror_r(int, char*, size_t);'
19232         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19233         esac
19234         case "$strerror_r_proto" in
19235         ''|0)   d_strerror_r=undef
19236                 strerror_r_proto=0
19237                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19238         * )     case "$strerror_r_proto" in
19239                 REENTRANT_PROTO*) ;;
19240                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19241                 esac
19242                 echo "Prototype: $try" ;;
19243         esac
19244         ;;
19245         *)      case "$usethreads" in
19246                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19247                 esac
19248                 d_strerror_r=undef
19249                 strerror_r_proto=0
19250                 ;;
19251         esac
19252         ;;
19253 *)      strerror_r_proto=0
19254         ;;
19255 esac
19256
19257 : see if strftime exists
19258 set strftime d_strftime
19259 eval $inlibc
19260
19261 : see if strlcat exists
19262 set strlcat d_strlcat
19263 eval $inlibc
19264
19265 : see if strlcpy exists
19266 set strlcpy d_strlcpy
19267 eval $inlibc
19268
19269 : see if strtod exists
19270 set strtod d_strtod
19271 eval $inlibc
19272
19273 : see if strtol exists
19274 set strtol d_strtol
19275 eval $inlibc
19276
19277 : see if strtold exists
19278 set strtold d_strtold
19279 eval $inlibc
19280
19281 : see if strtoll exists
19282 set strtoll d_strtoll
19283 eval $inlibc
19284
19285 case "$d_longlong-$d_strtoll" in
19286 "$define-$define")
19287         $cat <<EOM
19288 Checking whether your strtoll() works okay...
19289 EOM
19290         $cat >try.c <<'EOCP'
19291 #include <errno.h>
19292 #ifdef __hpux
19293 #define strtoll __strtoll
19294 #endif
19295 #ifdef __EMX__
19296 #define strtoll _strtoll
19297 #endif
19298 #include <stdio.h>
19299 extern long long int strtoll(char *s, char **, int);
19300 static int bad = 0;
19301 int check(char *s, long long ell, int een) {
19302         long long gll;
19303         errno = 0;
19304         gll = strtoll(s, 0, 10);
19305         if (!((gll == ell) && (errno == een)))
19306                 bad++;
19307 }
19308 int main() {
19309         check(" 1",                                      1LL, 0);
19310         check(" 0",                                      0LL, 0);
19311         check("-1",                                     -1LL, 0);
19312         check("-9223372036854775808", -9223372036854775808LL, 0);
19313         check("-9223372036854775808", -9223372036854775808LL, 0);
19314         check(" 9223372036854775807",  9223372036854775807LL, 0);
19315         check("-9223372036854775808", -9223372036854775808LL, 0);
19316         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19317         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19318         if (!bad)
19319                 printf("ok\n");
19320 }
19321 EOCP
19322         set try
19323         if eval $compile; then
19324                 yyy=`$run ./try`
19325                 case "$yyy" in
19326                 ok) echo "Your strtoll() seems to be working okay." ;;
19327                 *) cat <<EOM >&4
19328 Your strtoll() doesn't seem to be working okay.
19329 EOM
19330                    d_strtoll="$undef"
19331                    ;;
19332                 esac
19333         else
19334                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19335                 d_strtoll="$undef"
19336         fi
19337         ;;
19338 esac
19339
19340 : see if strtoq exists
19341 set strtoq d_strtoq
19342 eval $inlibc
19343
19344 : see if strtoul exists
19345 set strtoul d_strtoul
19346 eval $inlibc
19347
19348 case "$d_strtoul" in
19349 "$define")
19350         $cat <<EOM
19351 Checking whether your strtoul() works okay...
19352 EOM
19353         $cat >try.c <<'EOCP'
19354 #include <errno.h>
19355 #include <stdio.h>
19356 extern unsigned long int strtoul(char *s, char **, int);
19357 static int bad = 0;
19358 void check(char *s, unsigned long eul, int een) {
19359         unsigned long gul;
19360         errno = 0;
19361         gul = strtoul(s, 0, 10);
19362         if (!((gul == eul) && (errno == een)))
19363                 bad++;
19364 }
19365 int main() {
19366         check(" 1", 1L, 0);
19367         check(" 0", 0L, 0);
19368 EOCP
19369         case "$longsize" in
19370         8)
19371             $cat >>try.c <<'EOCP'
19372         check("18446744073709551615", 18446744073709551615UL, 0);
19373         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19374 #if 0 /* strtoul() for /^-/ strings is undefined. */
19375         check("-1", 18446744073709551615UL, 0);
19376         check("-18446744073709551614", 2, 0);
19377         check("-18446744073709551615", 1, 0);
19378         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19379         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19380 #endif
19381 EOCP
19382                 ;;
19383         4)
19384                     $cat >>try.c <<'EOCP'
19385         check("4294967295", 4294967295UL, 0);
19386         check("4294967296", 4294967295UL, ERANGE);
19387 #if 0 /* strtoul() for /^-/ strings is undefined. */
19388         check("-1", 4294967295UL, 0);
19389         check("-4294967294", 2, 0);
19390         check("-4294967295", 1, 0);
19391         check("-4294967296", 4294967295UL, ERANGE);
19392         check("-4294967297", 4294967295UL, ERANGE);
19393 #endif
19394 EOCP
19395                 ;;
19396         *)
19397 : Should we write these tests to be more portable by sprintf-ing
19398 : ~0 and then manipulating that char string as input for strtol?
19399                 ;;
19400         esac
19401         $cat >>try.c <<'EOCP'
19402         if (!bad)
19403                 printf("ok\n");
19404         return 0;
19405 }
19406 EOCP
19407         set try
19408         if eval $compile; then
19409                 case "`$run ./try`" in
19410                 ok) echo "Your strtoul() seems to be working okay." ;;
19411                 *) cat <<EOM >&4
19412 Your strtoul() doesn't seem to be working okay.
19413 EOM
19414                    d_strtoul="$undef"
19415                    ;;
19416                 esac
19417         else
19418                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19419                 d_strtoul="$undef"
19420         fi
19421         ;;
19422 esac
19423
19424 : see if strtoull exists
19425 set strtoull d_strtoull
19426 eval $inlibc
19427
19428 case "$d_longlong-$d_strtoull" in
19429 "$define-$define")
19430         $cat <<EOM
19431 Checking whether your strtoull() works okay...
19432 EOM
19433         $cat >try.c <<'EOCP'
19434 #include <errno.h>
19435 #ifdef __hpux
19436 #define strtoull __strtoull
19437 #endif
19438 #include <stdio.h>
19439 extern unsigned long long int strtoull(char *s, char **, int);
19440 static int bad = 0;
19441 int check(char *s, long long eull, int een) {
19442         long long gull;
19443         errno = 0;
19444         gull = strtoull(s, 0, 10);
19445         if (!((gull == eull) && (errno == een)))
19446                 bad++;
19447 }
19448 int main() {
19449         check(" 1",                                        1LL, 0);
19450         check(" 0",                                        0LL, 0);
19451         check("18446744073709551615",  18446744073709551615ULL, 0);
19452         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19453 #if 0 /* strtoull() for /^-/ strings is undefined. */
19454         check("-1",                    18446744073709551615ULL, 0);
19455         check("-18446744073709551614",                     2LL, 0);
19456         check("-18446744073709551615",                     1LL, 0);
19457         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19458         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19459 #endif
19460         if (!bad)
19461                 printf("ok\n");
19462 }
19463 EOCP
19464         set try
19465         if eval $compile; then
19466                 case "`$run ./try`" in
19467                 ok) echo "Your strtoull() seems to be working okay." ;;
19468                 *) cat <<EOM >&4
19469 Your strtoull() doesn't seem to be working okay.
19470 EOM
19471                    d_strtoull="$undef"
19472                    ;;
19473                 esac
19474         else
19475                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19476                 d_strtoull="$undef"
19477         fi
19478         ;;
19479 esac
19480
19481 : see if strtouq exists
19482 set strtouq d_strtouq
19483 eval $inlibc
19484
19485 case "$d_strtouq" in
19486 "$define")
19487         $cat <<EOM
19488 Checking whether your strtouq() works okay...
19489 EOM
19490         $cat >try.c <<'EOCP'
19491 #include <errno.h>
19492 #include <stdio.h>
19493 extern unsigned long long int strtouq(char *s, char **, int);
19494 static int bad = 0;
19495 void check(char *s, unsigned long long eull, int een) {
19496         unsigned long long gull;
19497         errno = 0;
19498         gull = strtouq(s, 0, 10);
19499         if (!((gull == eull) && (errno == een)))
19500                 bad++;
19501 }
19502 int main() {
19503         check(" 1",                                        1LL, 0);
19504         check(" 0",                                        0LL, 0);
19505         check("18446744073709551615",  18446744073709551615ULL, 0);
19506         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19507 #if 0 /* strtouq() for /^-/ strings is undefined. */
19508         check("-1",                    18446744073709551615ULL, 0);
19509         check("-18446744073709551614",                     2LL, 0);
19510         check("-18446744073709551615",                     1LL, 0);
19511         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19512         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19513 #endif
19514         if (!bad)
19515                 printf("ok\n");
19516         return 0;
19517 }
19518 EOCP
19519         set try
19520         if eval $compile; then
19521                 case "`$run ./try`" in
19522                 ok) echo "Your strtouq() seems to be working okay." ;;
19523                 *) cat <<EOM >&4
19524 Your strtouq() doesn't seem to be working okay.
19525 EOM
19526                    d_strtouq="$undef"
19527                    ;;
19528                 esac
19529         else
19530                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19531                 d_strtouq="$undef"
19532         fi
19533         ;;
19534 esac
19535
19536 : see if strxfrm exists
19537 set strxfrm d_strxfrm
19538 eval $inlibc
19539
19540 : see if symlink exists
19541 set symlink d_symlink
19542 eval $inlibc
19543
19544 : see if syscall exists
19545 set syscall d_syscall
19546 eval $inlibc
19547
19548 : see if prototype for syscall is available
19549 echo " "
19550 set d_syscallproto syscall $i_unistd unistd.h
19551 eval $hasproto
19552
19553 : see if sysconf exists
19554 set sysconf d_sysconf
19555 eval $inlibc
19556
19557 : see if system exists
19558 set system d_system
19559 eval $inlibc
19560
19561 : see if tcgetpgrp exists
19562 set tcgetpgrp d_tcgetpgrp
19563 eval $inlibc
19564
19565 : see if tcsetpgrp exists
19566 set tcsetpgrp d_tcsetpgrp
19567 eval $inlibc
19568
19569 : see if prototype for telldir is available
19570 echo " "
19571 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19572 eval $hasproto
19573
19574 : see if tgamma exists
19575 set tgamma d_tgamma
19576 eval $inlibc
19577
19578 : see if time exists
19579 echo " "
19580 if test "X$d_time" = X -o X"$timetype" = X; then
19581     if set time val -f d_time; eval $csym; $val; then
19582                 echo 'time() found.' >&4
19583                 val="$define"
19584                 rp="What is the type returned by time() on this system?"
19585                 set time_t timetype long stdio.h sys/types.h
19586                 eval $typedef_ask
19587     else
19588                 echo 'time() not found, hope that will do.' >&4
19589                 val="$undef"
19590                 timetype='int';
19591     fi
19592     set d_time
19593     eval $setvar
19594 fi
19595
19596 : see if timegm exists
19597 set timegm d_timegm
19598 eval $inlibc
19599
19600 : see if this is a sys/times.h system
19601 set sys/times.h i_systimes
19602 eval $inhdr
19603
19604 : see if times exists
19605 echo " "
19606 if set times val -f d_times; eval $csym; $val; then
19607         echo 'times() found.' >&4
19608         d_times="$define"
19609         inc=''
19610         case "$i_systimes" in
19611         "$define") inc='sys/times.h';;
19612         esac
19613         rp="What is the type returned by times() on this system?"
19614         set clock_t clocktype long stdio.h sys/types.h $inc
19615         eval $typedef_ask
19616 else
19617         echo 'times() NOT found, hope that will do.' >&4
19618         d_times="$undef"
19619         clocktype='int'
19620 fi
19621
19622 : see if tmpnam_r exists
19623 set tmpnam_r d_tmpnam_r
19624 eval $inlibc
19625 case "$d_tmpnam_r" in
19626 "$define")
19627         hdrs="$i_systypes sys/types.h define stdio.h "
19628         case "$d_tmpnam_r_proto:$usethreads" in
19629         ":define")      d_tmpnam_r_proto=define
19630                 set d_tmpnam_r_proto tmpnam_r $hdrs
19631                 eval $hasproto ;;
19632         *)      ;;
19633         esac
19634         case "$d_tmpnam_r_proto" in
19635         define)
19636         case "$tmpnam_r_proto" in
19637         ''|0) try='char* tmpnam_r(char*);'
19638         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19639         esac
19640         case "$tmpnam_r_proto" in
19641         ''|0)   d_tmpnam_r=undef
19642                 tmpnam_r_proto=0
19643                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19644         * )     case "$tmpnam_r_proto" in
19645                 REENTRANT_PROTO*) ;;
19646                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19647                 esac
19648                 echo "Prototype: $try" ;;
19649         esac
19650         ;;
19651         *)      case "$usethreads" in
19652                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19653                 esac
19654                 d_tmpnam_r=undef
19655                 tmpnam_r_proto=0
19656                 ;;
19657         esac
19658         ;;
19659 *)      tmpnam_r_proto=0
19660         ;;
19661 esac
19662
19663 : see if trunc exists
19664 set trunc d_trunc
19665 eval $inlibc
19666
19667 : see if truncate exists
19668 set truncate d_truncate
19669 eval $inlibc
19670
19671 : see if ttyname_r exists
19672 set ttyname_r d_ttyname_r
19673 eval $inlibc
19674 case "$d_ttyname_r" in
19675 "$define")
19676         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19677         case "$d_ttyname_r_proto:$usethreads" in
19678         ":define")      d_ttyname_r_proto=define
19679                 set d_ttyname_r_proto ttyname_r $hdrs
19680                 eval $hasproto ;;
19681         *)      ;;
19682         esac
19683         case "$d_ttyname_r_proto" in
19684         define)
19685         case "$ttyname_r_proto" in
19686         ''|0) try='int ttyname_r(int, char*, size_t);'
19687         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19688         esac
19689         case "$ttyname_r_proto" in
19690         ''|0) try='int ttyname_r(int, char*, int);'
19691         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19692         esac
19693         case "$ttyname_r_proto" in
19694         ''|0) try='char* ttyname_r(int, char*, int);'
19695         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19696         esac
19697         case "$ttyname_r_proto" in
19698         ''|0)   d_ttyname_r=undef
19699                 ttyname_r_proto=0
19700                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19701         * )     case "$ttyname_r_proto" in
19702                 REENTRANT_PROTO*) ;;
19703                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19704                 esac
19705                 echo "Prototype: $try" ;;
19706         esac
19707         ;;
19708         *)      case "$usethreads" in
19709                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19710                 esac
19711                 d_ttyname_r=undef
19712                 ttyname_r_proto=0
19713                 ;;
19714         esac
19715         ;;
19716 *)      ttyname_r_proto=0
19717         ;;
19718 esac
19719
19720 : see if tzname[] exists
19721 echo " "
19722 if set tzname val -a d_tzname; eval $csym; $val; then
19723         val="$define"
19724         echo 'tzname[] found.' >&4
19725 else
19726         val="$undef"
19727         echo 'tzname[] NOT found.' >&4
19728 fi
19729 set d_tzname
19730 eval $setvar
19731
19732 : Check if is a multiplatform env
19733 case "$osname" in
19734 darwin) multiarch="$define" ;;
19735 esac
19736 case "$multiarch" in
19737 ''|[nN]*) multiarch="$undef" ;;
19738 esac
19739
19740 : check for ordering of bytes in a UV
19741 echo " "
19742 case "$multiarch" in
19743 *$define*)
19744         $cat <<EOM
19745 You seem to be doing a multiarchitecture build,
19746 skipping the byteorder check.
19747
19748 EOM
19749         byteorder='ffff'
19750         ;;
19751 *)
19752         case "$byteorder" in
19753         '')
19754                 $cat <<'EOM'
19755 In the following, larger digits indicate more significance.  A big-endian
19756 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19757 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19758 machines may have weird orders like 3412.  A Cray will report 87654321,
19759 an Alpha will report 12345678. If the test program works the default is
19760 probably right.
19761 I'm now running the test program...
19762 EOM
19763                 $cat >try.c <<EOCP
19764 #include <stdio.h>
19765 #$i_stdlib I_STDLIB
19766 #ifdef I_STDLIB
19767 #include <stdlib.h>
19768 #endif
19769 #include <sys/types.h>
19770 typedef $uvtype UV;
19771 int main()
19772 {
19773         int i;
19774         union {
19775                 UV l;
19776                 char c[$uvsize];
19777         } u;
19778
19779         if ($uvsize > 4)
19780                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19781         else
19782                 u.l = (UV)0x04030201;
19783         for (i = 0; i < $uvsize; i++)
19784                 printf("%c", u.c[i]+'0');
19785         printf("\n");
19786         exit(0);
19787 }
19788 EOCP
19789                 xxx_prompt=y
19790                 set try
19791                 if eval $compile && $run ./try > /dev/null; then
19792                         dflt=`$run ./try`
19793                         case "$dflt" in
19794                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19795                                 echo "(The test program ran ok.)"
19796                                 echo "byteorder=$dflt"
19797                                 xxx_prompt=n
19798                         ;;
19799                         ????|????????) echo "(The test program ran ok.)" ;;
19800                         *) echo "(The test program didn't run right for some reason.)" ;;
19801                         esac
19802                 else
19803                         dflt='4321'
19804                         cat <<'EOM'
19805 (I can't seem to compile the test program.  Guessing big-endian...)
19806 EOM
19807                 fi
19808                 case "$xxx_prompt" in
19809                 y)
19810                         rp="What is the order of bytes in $uvtype?"
19811                         . ./myread
19812                         byteorder="$ans"
19813                         ;;
19814                 *)      byteorder=$dflt
19815                         ;;
19816                 esac
19817                 ;;
19818         esac
19819         $rm_try
19820         ;;
19821 esac
19822
19823 : Checking 32bit alignedness
19824 $cat <<EOM
19825
19826 Checking to see whether you can access character data unalignedly...
19827 EOM
19828 case "$d_u32align" in
19829 '')   $cat >try.c <<EOCP
19830 #include <stdio.h>
19831 #$i_stdlib I_STDLIB
19832 #ifdef I_STDLIB
19833 #include <stdlib.h>
19834 #endif
19835 #define U32 $u32type
19836 #define BYTEORDER 0x$byteorder
19837 #define U8 $u8type
19838 #include <signal.h>
19839 #ifdef SIGBUS
19840 $signal_t bletch(int s) { exit(4); }
19841 #endif
19842 int main() {
19843 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19844     volatile U8 buf[8];
19845     volatile U32 *up;
19846     int i;
19847
19848     if (sizeof(U32) != 4) {
19849         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19850         exit(1);
19851     }
19852
19853     fflush(stdout);
19854
19855 #ifdef SIGBUS
19856     signal(SIGBUS, bletch);
19857 #endif
19858
19859     buf[0] = 0;
19860     buf[1] = 0;
19861     buf[2] = 0;
19862     buf[3] = 1;
19863     buf[4] = 0;
19864     buf[5] = 0;
19865     buf[6] = 0;
19866     buf[7] = 1;
19867
19868     for (i = 0; i < 4; i++) {
19869         up = (U32*)(buf + i);
19870         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19871                (*up == 1 << (8*(3-i)))  /* little-endian */
19872               )
19873            )
19874         {
19875             printf("read failed (%x)\n", *up);
19876             exit(2);
19877         }
19878     }
19879
19880     /* write test */
19881     for (i = 0; i < 4; i++) {
19882         up = (U32*)(buf + i);
19883         *up = 0xBeef;
19884         if (*up != 0xBeef) {
19885             printf("write failed (%x)\n", *up);
19886             exit(3);
19887         }
19888     }
19889
19890     exit(0);
19891 #else
19892     printf("1\n");
19893     exit(1);
19894 #endif
19895     return 0;
19896 }
19897 EOCP
19898 set try
19899 if eval $compile_ok; then
19900         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19901         $run ./try 2>&1 >/dev/null
19902         case "$?" in
19903         0)      cat >&4 <<EOM
19904 You can access character data pretty unalignedly.
19905 EOM
19906                 d_u32align="$undef"
19907                 ;;
19908         *)      cat >&4 <<EOM
19909 It seems that you must access character data in an aligned manner.
19910 EOM
19911                 d_u32align="$define"
19912                 ;;
19913         esac
19914 else
19915         rp='Can you access character data at unaligned addresses?'
19916         dflt='n'
19917         . ./myread
19918         case "$ans" in
19919         [yY]*)  d_u32align="$undef"  ;;
19920         *)      d_u32align="$define" ;;
19921         esac
19922 fi
19923 $rm_try
19924 ;;
19925 esac
19926
19927 : see if ualarm exists
19928 set ualarm d_ualarm
19929 eval $inlibc
19930
19931 : see if umask exists
19932 set umask d_umask
19933 eval $inlibc
19934
19935 : see if unordered exists
19936 set unordered d_unordered
19937 eval $inlibc
19938
19939 : see if unsetenv exists
19940 set unsetenv d_unsetenv
19941 eval $inlibc
19942
19943 : see if usleep exists
19944 set usleep d_usleep
19945 eval $inlibc
19946
19947 : see if prototype for usleep is available
19948 echo " "
19949 set d_usleepproto usleep $i_unistd unistd.h
19950 eval $hasproto
19951
19952 : see if ustat exists
19953 set ustat d_ustat
19954 eval $inlibc
19955
19956 : see if closedir exists
19957 set closedir d_closedir
19958 eval $inlibc
19959
19960 case "$d_closedir" in
19961 "$define")
19962         echo " "
19963         echo "Checking whether closedir() returns a status..." >&4
19964         cat > try.c <<EOM
19965 #$i_dirent I_DIRENT             /**/
19966 #$i_sysdir I_SYS_DIR            /**/
19967 #$i_sysndir I_SYS_NDIR          /**/
19968 #$i_systypes I_SYS_TYPES        /**/
19969
19970 #if defined(I_SYS_TYPES)
19971 #include <sys/types.h>
19972 #endif
19973 #if defined(I_DIRENT)
19974 #include <dirent.h>
19975 #else
19976 #ifdef I_SYS_NDIR
19977 #include <sys/ndir.h>
19978 #else
19979 #ifdef I_SYS_DIR
19980 #ifdef hp9000s500
19981 #include <ndir.h>       /* may be wrong in the future */
19982 #else
19983 #include <sys/dir.h>
19984 #endif
19985 #endif
19986 #endif
19987 #endif
19988 int main() { return closedir(opendir(".")); }
19989 EOM
19990         set try
19991         if eval $compile_ok; then
19992                 if $run ./try > /dev/null 2>&1 ; then
19993                         echo "Yes, it does."
19994                         val="$undef"
19995                 else
19996                         echo "No, it doesn't."
19997                         val="$define"
19998                 fi
19999         else
20000                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20001                 val="$define"
20002         fi
20003         ;;
20004 *)
20005         val="$undef";
20006         ;;
20007 esac
20008 set d_void_closedir
20009 eval $setvar
20010 $rm_try
20011
20012 : see if there is a wait4
20013 set wait4 d_wait4
20014 eval $inlibc
20015
20016 : see if waitpid exists
20017 set waitpid d_waitpid
20018 eval $inlibc
20019
20020 : look for wcscmp
20021 echo " "
20022 $cat >try.c <<'EOCP'
20023 #include <stdio.h>
20024 #include <wchar.h>
20025 int main ()
20026 {
20027     wchar_t *s = L" ";
20028     return (wcscmp (s, s) ? 1 : 0);
20029     }
20030 EOCP
20031 set try
20032 val="$undef"
20033 if eval $compile; then
20034     `$run ./try`
20035     case "$?" in
20036         0)  echo "A working wcscmp() found." >&4
20037             val="$define" ;;
20038         *)  echo "wcscmp() found, but it doesn't work" >&4
20039             ;;
20040         esac
20041 else
20042     echo "wcscmp() NOT found." >&4
20043     fi
20044 set d_wcscmp
20045 eval $setvar
20046 $rm_try
20047
20048 : see if wcstombs exists
20049 set wcstombs d_wcstombs
20050 eval $inlibc
20051
20052 : look for wcsxfrm
20053 echo " "
20054 $cat >try.c <<'EOCP'
20055 #include <errno.h>
20056 #include <wchar.h>
20057 int main ()
20058 {
20059     wchar_t dst[4], *src = L" ";
20060     errno = 0;
20061     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20062     }
20063 EOCP
20064 set try
20065 val="$undef"
20066 if eval $compile; then
20067     `$run ./try`
20068     case "$?" in
20069         0)  echo "A working wcsxfrm() found." >&4
20070             val="$define" ;;
20071         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20072             ;;
20073         esac
20074 else
20075     echo "wcsxfrm() NOT found." >&4
20076     fi
20077 set d_wcsxfrm
20078 eval $setvar
20079 $rm_try
20080
20081 : see if wctomb exists
20082 set wctomb d_wctomb
20083 eval $inlibc
20084
20085 : see if writev exists
20086 set writev d_writev
20087 eval $inlibc
20088
20089 : check for alignment requirements
20090 echo " "
20091 case "$alignbytes" in
20092     '') echo "Checking alignment constraints..." >&4
20093         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
20094             $cat >try.c <<'EOCP'
20095 typedef long double NV;
20096 EOCP
20097         else
20098             $cat >try.c <<'EOCP'
20099 typedef double NV;
20100 EOCP
20101         fi
20102         $cat >>try.c <<'EOCP'
20103 #include <stdio.h>
20104 struct foobar {
20105     char foo;
20106     NV bar;
20107 } try_algn;
20108 int main()
20109 {
20110     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20111     return(0);
20112 }
20113 EOCP
20114         set try
20115         if eval $compile_ok; then
20116             dflt=`$run ./try`
20117         else
20118             dflt='8'
20119             echo "(I can't seem to compile the test program...)"
20120         fi
20121         case "$multiarch" in
20122             *$define*)
20123                 : The usual safe value is 8, but Darwin with -Duselongdouble
20124                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20125                 : Configure to pick a larger value if needed.
20126                 if $test "$dflt" -lt 8; then
20127                     dflt='8'
20128                     echo "Setting alignment to 8 for multiarch support.">&4
20129                 fi
20130                 ;;
20131         esac
20132         ;;
20133     *) dflt="$alignbytes"
20134         ;;
20135 esac
20136 rp="Doubles must be aligned on a how-many-byte boundary?"
20137 . ./myread
20138 alignbytes="$ans"
20139 $rm_try
20140
20141 : set the base revision
20142 baserev=5.0
20143
20144 : length of character in bytes. Is always 1, otherwise it is not C
20145 : This used to be a test using sizeof
20146 charsize=1
20147
20148 : Check for the number of bits in a character
20149 case "$charbits" in
20150 '')     echo "Checking how long a character is (in bits)..." >&4
20151         $cat >try.c <<EOCP
20152 #include <stdio.h>
20153 int main ()
20154 {
20155     int n;
20156     unsigned char c;
20157     for (c = 1, n = 0; c; c <<= 1, n++) ;
20158     printf ("%d\n", n);
20159     return (0);
20160     }
20161 EOCP
20162         set try
20163         if eval $compile_ok; then
20164                 dflt=`$run ./try`
20165         else
20166                 dflt='8'
20167                 echo "(I can't seem to compile the test program.  Guessing...)"
20168         fi
20169         ;;
20170 *)
20171         dflt="$charbits"
20172         ;;
20173 esac
20174 rp="What is the length of a character (in bits)?"
20175 . ./myread
20176 charbits="$ans"
20177 $rm_try
20178 case "$charbits" in
20179 8)      ;;
20180 *)      cat >&4 << EOM
20181 Your system has an unsigned character size of $charbits bits, which
20182 is rather unusual (normally it is 8 bits).  Perl likely will not work
20183 correctly on your system, with subtle bugs in various places.
20184 EOM
20185         rp='Do you really want to continue?'
20186         dflt='n'
20187         . ./myread
20188         case "$ans" in
20189                 [yY])   echo >&4 "Okay, continuing."    ;;
20190                 *)      exit 1                          ;;
20191         esac
20192 esac
20193
20194 : how do we concatenate cpp tokens here?
20195 echo " "
20196 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20197 $cat >cpp_stuff.c <<'EOCP'
20198 #define RCAT(a,b)a/**/b
20199 #define ACAT(a,b)a ## b
20200 RCAT(Rei,ser)
20201 ACAT(Cir,cus)
20202 EOCP
20203 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20204 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20205         echo "Oh!  Smells like ANSI's been here." >&4
20206         echo "We can catify or stringify, separately or together!"
20207         cpp_stuff=42
20208 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20209         echo "Ah, yes!  The good old days!" >&4
20210         echo "However, in the good old days we don't know how to stringify and"
20211         echo "catify at the same time."
20212         cpp_stuff=1
20213 else
20214         $cat >&4 <<EOM
20215 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20216 You're going to have to edit the values of CAT[2-5] in config.h...
20217 EOM
20218         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20219 fi
20220 $rm -f cpp_stuff.*
20221
20222 : see if this is a db.h system
20223 set db.h i_db
20224 eval $inhdr
20225
20226 case "$i_db" in
20227 $define)
20228         : Check db version.
20229         echo " "
20230         echo "Checking Berkeley DB version ..." >&4
20231         $cat >try.c <<EOCP
20232 #$d_const HASCONST
20233 #ifndef HASCONST
20234 #define const
20235 #endif
20236 #include <sys/types.h>
20237 #include <stdio.h>
20238 #$i_stdlib I_STDLIB
20239 #ifdef I_STDLIB
20240 #include <stdlib.h>
20241 #endif
20242 #include <db.h>
20243 int main(int argc, char *argv[])
20244 {
20245 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20246     int Major, Minor, Patch ;
20247     unsigned long Version ;
20248     (void)db_version(&Major, &Minor, &Patch) ;
20249     if (argc == 2) {
20250         printf("%d %d %d %d %d %d\n",
20251                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20252                Major, Minor, Patch);
20253         exit(0);
20254     }
20255     printf("You have Berkeley DB Version 2 or greater.\n");
20256
20257     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20258                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20259     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20260                 Major, Minor, Patch) ;
20261
20262     /* check that db.h & libdb are compatible */
20263     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20264         printf("db.h and libdb are incompatible.\n") ;
20265         exit(3);
20266     }
20267
20268     printf("db.h and libdb are compatible.\n") ;
20269
20270     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20271                 + DB_VERSION_PATCH ;
20272
20273     /* needs to be >= 2.3.4 */
20274     if (Version < 2003004) {
20275     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20276         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20277         exit(2);
20278     }
20279
20280     exit(0);
20281 #else
20282 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20283     if (argc == 2) {
20284         printf("1 0 0\n");
20285         exit(0);
20286     }
20287     printf("You have Berkeley DB Version 1.\n");
20288     exit(0);    /* DB version < 2: the coast is clear. */
20289 #else
20290     exit(1);    /* <db.h> not Berkeley DB? */
20291 #endif
20292 #endif
20293 }
20294 EOCP
20295         set try
20296         if eval $compile_ok && $run ./try; then
20297                 echo 'Looks OK.' >&4
20298                 set `$run ./try 1`
20299                 db_version_major=$1
20300                 db_version_minor=$2
20301                 db_version_patch=$3
20302         else
20303                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20304                 i_db=$undef
20305                 case " $libs " in
20306                 *"-ldb "*)
20307                         : Remove db from list of libraries to use
20308                         echo "Removing unusable -ldb from library list" >&4
20309                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20310                         shift
20311                         libs="$*"
20312                         echo "libs = $libs" >&4
20313                         ;;
20314                 esac
20315         fi
20316         $rm_try
20317         ;;
20318 esac
20319
20320 case "$i_db" in
20321 define)
20322         : Check the return type needed for hash
20323         echo " "
20324         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20325         $cat >try.c <<EOCP
20326 #$d_const HASCONST
20327 #ifndef HASCONST
20328 #define const
20329 #endif
20330 #include <sys/types.h>
20331 #include <db.h>
20332
20333 #ifndef DB_VERSION_MAJOR
20334 u_int32_t hash_cb (const void* ptr, size_t size)
20335 {
20336 }
20337 HASHINFO info;
20338 int main()
20339 {
20340         info.hash = hash_cb;
20341 }
20342 #endif
20343 EOCP
20344         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20345                 if $contains warning try.out >>/dev/null 2>&1 ; then
20346                         db_hashtype='int'
20347                 else
20348                         db_hashtype='u_int32_t'
20349                 fi
20350         else
20351                 : XXX Maybe we should just give up here.
20352                 db_hashtype=u_int32_t
20353                 $cat try.out >&4
20354                 echo "Help:  I can't seem to compile the db test program." >&4
20355                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20356         fi
20357         $rm_try
20358         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20359         ;;
20360 *)      db_hashtype=u_int32_t
20361         ;;
20362 esac
20363 case "$i_db" in
20364 define)
20365         : Check the return type needed for prefix
20366         echo " "
20367         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20368         cat >try.c <<EOCP
20369 #$d_const HASCONST
20370 #ifndef HASCONST
20371 #define const
20372 #endif
20373 #include <sys/types.h>
20374 #include <db.h>
20375
20376 #ifndef DB_VERSION_MAJOR
20377 size_t prefix_cb (const DBT *key1, const DBT *key2)
20378 {
20379 }
20380 BTREEINFO info;
20381 int main()
20382 {
20383         info.prefix = prefix_cb;
20384 }
20385 #endif
20386 EOCP
20387         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20388                 if $contains warning try.out >>/dev/null 2>&1 ; then
20389                         db_prefixtype='int'
20390                 else
20391                         db_prefixtype='size_t'
20392                 fi
20393         else
20394                 db_prefixtype='size_t'
20395                 : XXX Maybe we should just give up here.
20396                 $cat try.out >&4
20397                 echo "Help:  I can't seem to compile the db test program." >&4
20398                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20399         fi
20400         $rm_try
20401         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20402         ;;
20403 *)      db_prefixtype='size_t'
20404         ;;
20405 esac
20406
20407 : Check what kind of inf/nan your system has
20408 $echo "Checking the kind of infinities and nans you have..." >&4
20409 $cat >try.c <<EOP
20410 #define DOUBLESIZE $doublesize
20411 #$d_longdbl HAS_LONG_DOUBLE
20412 #ifdef HAS_LONG_DOUBLE
20413 #define LONGDBLSIZE $longdblsize
20414 #define LONGDBLKIND $longdblkind
20415 #endif
20416 #$i_math I_MATH
20417 #ifdef I_MATH
20418 #include <math.h>
20419 #endif
20420 #include <stdio.h>
20421 /* Note that whether the sign bit is on or off
20422  * for NaN depends on the CPU/FPU, and possibly
20423  * can be affected by the build toolchain.
20424  *
20425  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20426  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20427  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20428  * (respectively) as opposed to the more usual
20429  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20430  */
20431 static void bytes(unsigned char *p, unsigned int n) {
20432   int i;
20433   for (i = 0; i < n; i++) {
20434     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20435   }
20436 }
20437 int main(int argc, char *argv[]) {
20438    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20439     * because some compilers are 'smart' and not only warn but refuse to
20440     * compile such 'illegal' values. */
20441    double dinf = exp(1e9);
20442    double dnan = sqrt(-1.0);
20443 #ifdef HAS_LONG_DOUBLE
20444    long double ldinf = (long double)exp(1e9);
20445    long double ldnan = (long double)sqrt(-1.0);
20446 #endif
20447   if (argc == 2) {
20448     switch (argv[1][0]) {
20449     case '1': bytes(&dinf, sizeof(dinf)); break;
20450     case '2': bytes(&dnan, sizeof(dnan)); break;
20451 #ifdef HAS_LONG_DOUBLE
20452 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20453 /* the 80-bit long doubles might have garbage in their excess bytes */
20454     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20455 # endif
20456     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20457     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20458 #endif
20459     }
20460   }
20461   return 0;
20462 }
20463 EOP
20464 set try
20465 if eval $compile; then
20466     doubleinfbytes=`$run ./try 1`
20467     doublenanbytes=`$run ./try 2`
20468     case "$d_longdbl" in
20469     $define)
20470       longdblinfbytes=`$run ./try 3`
20471       longdblnanbytes=`$run ./try 4`
20472       ;;
20473     esac
20474 else
20475     # Defaults in case the above test program failed.
20476     case "$doublekind" in
20477     1) # IEEE 754 32-bit LE
20478        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20479        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20480        ;;
20481     2) # IEEE 754 32-bit BE
20482        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20483        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20484        ;;
20485     3) # IEEE 754 64-bit LE
20486        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20487        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20488        ;;
20489     4) # IEEE 754 64-bit BE
20490        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20491        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20492        ;;
20493     5) # IEEE 754 128-bit LE
20494        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20495        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20496        ;;
20497     6) # IEEE 754 128-bit BE
20498        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20499        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20500        ;;
20501     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20502        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20503        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20504        ;;
20505     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20506        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20507        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20508        ;;
20509     *) # No idea.
20510        doubleinfbytes=$undef
20511        doublenanbytes=$undef
20512        ;;
20513     esac
20514     case "$longdblkind" in
20515     1) # IEEE 754 128-bit LE
20516        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20517        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20518        ;;
20519     2) # IEEE 754 128-bit BE
20520        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20521        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20522        ;;
20523     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20524        case "$longdblsize" in
20525        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20526            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20527            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20528            ;;
20529        16) # x86_64
20530            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20531            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20532            ;;
20533        *)  # No idea.
20534            longdblinfbytes=$undef
20535            longdblnanbytes=$undef
20536        ;;
20537        esac
20538        ;;
20539     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20540        case "$longdblsize" in
20541        12) # 32-bit system
20542            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20543            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20544            ;;
20545        16) # 64-bit system
20546            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20547            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20548            ;;
20549        *)  # No idea.
20550            longdblinfbytes=$undef
20551            longdblnanbytes=$undef
20552        ;;
20553        esac
20554        ;;
20555     5) # 128-bit LE-LE "double double"
20556        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20557        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20558        ;;
20559     6) # 128-bit BE-BE "double double"
20560        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20561        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20562        ;;
20563     7) # 128-bit LE-BE "double double"
20564        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20565        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20566        ;;
20567     8) # 128-bit BE-LE "double double"
20568        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20569        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20570        ;;
20571     *) # No idea.
20572        longdblinfbytes=$undef
20573        longdblnanbytes=$undef
20574        ;;
20575     esac
20576 fi
20577 $rm_try
20578
20579 : Check the length of the double mantissa
20580 $echo "Checking how many mantissa bits your doubles have..." >&4
20581 $cat >try.c <<EOP
20582 #$i_float I_FLOAT
20583 #$i_sunmath I_SUNMATH
20584 #ifdef I_FLOAT
20585 # include <float.h>
20586 #endif
20587 #ifdef I_SUNMATH
20588 # include <sunmath.h>
20589 #endif
20590 #ifdef DBL_MANT_DIG
20591 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20592 #endif
20593 #include <stdio.h>
20594 int main(int argc, char *argv[]) {
20595 #ifdef BITS
20596   printf("%d\n", BITS);
20597 #endif
20598   return 0;
20599 }
20600 EOP
20601 set try
20602 if eval $compile; then
20603     doublemantbits=`$run ./try`
20604 else
20605     doublemantbits="$undef"
20606 fi
20607 $rm_try
20608
20609 : Check the length of the longdouble mantissa
20610 $echo "Checking how many mantissa bits your long doubles have..." >&4
20611 $cat >try.c <<EOP
20612 #$i_float I_FLOAT
20613 #$i_sunmath I_SUNMATH
20614 #ifdef I_FLOAT
20615 # include <float.h>
20616 #endif
20617 #ifdef I_SUNMATH
20618 # include <sunmath.h>
20619 #endif
20620 #$d_longdbl HAS_LONG_DOUBLE
20621 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20622 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20623 /* This format has no implicit bit.  Beware, however, that for
20624  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20625  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20626  * and the top bit must have been one since 387, zero is plain invalid.
20627  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20628 #  define BITS LDBL_MANT_DIG
20629 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20630 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20631  * reason e.g. Irix thinks 107.  But in any case, we want only
20632  * the number of real bits, the implicit bits are of no interest.  */
20633 #  define BITS 2 * (DBL_MANT_DIG - 1)
20634 # else
20635 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20636 # endif
20637 #endif
20638 #include <stdio.h>
20639 int main(int argc, char *argv[]) {
20640 #ifdef BITS
20641   printf("%d\n", BITS);
20642 #endif
20643   return 0;
20644 }
20645 EOP
20646 set try
20647 if eval $compile; then
20648     longdblmantbits=`$run ./try`
20649 else
20650     longdblmantbits="$undef"
20651 fi
20652 $rm_try
20653
20654 : Check the length of the NV mantissa
20655 $echo "Checking how many mantissa bits your NVs have..." >&4
20656 if test "X$usequadmath" = "X$define"; then
20657   nvmantbits=112 # 128-1-15
20658 else
20659   if test "X$nvsize" = "X$doublesize"; then
20660     nvmantbits="$doublemantbits"
20661   else
20662      if test "X$nvsize" = "X$longdblsize"; then
20663        nvmantbits="$longdblmantbits"
20664      else
20665        nvmantbits="$undef"
20666      fi
20667   fi
20668 fi
20669
20670 : How can we generate normalized random numbers ?
20671 echo " "
20672 echo "Using our internal random number implementation..." >&4
20673
20674 case "$ccflags" in
20675 *-Dmy_rand=*|*-Dmy_srand=*)
20676         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20677         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20678         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20679         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20680         ;;
20681 esac
20682
20683 randfunc=Perl_drand48
20684 drand01="Perl_drand48()"
20685 seedfunc="Perl_drand48_init"
20686 randbits=48
20687 randseedtype=U32
20688
20689 : Determine if this is an EBCDIC system
20690 echo " "
20691 echo "Determining whether or not we are on an EBCDIC system..." >&4
20692 $cat >try.c <<'EOM'
20693 int main()
20694 {
20695   if ('M'==0xd4) return 0;
20696   return 1;
20697 }
20698 EOM
20699
20700 val=$undef
20701 set try
20702 if eval $compile_ok; then
20703         if $run ./try; then
20704                 echo "You seem to speak EBCDIC." >&4
20705                 val="$define"
20706         else
20707                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20708         fi
20709 else
20710         echo "I'm unable to compile the test program." >&4
20711         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20712 fi
20713 $rm_try
20714 set ebcdic
20715 eval $setvar
20716
20717 : Check how to flush
20718 echo " "
20719 $cat >&4 <<EOM
20720 Checking how to flush all pending stdio output...
20721 EOM
20722 # I only know how to find the first 32 possibly open files on SunOS.
20723 # See also hints/sunos_4_1.sh and util.c  --AD
20724 case "$osname" in
20725 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20726 esac
20727 $cat >>try.c <<EOCP
20728 #include <stdio.h>
20729 #$i_stdlib I_STDLIB
20730 #ifdef I_STDLIB
20731 #include <stdlib.h>
20732 #endif
20733 #$i_unistd I_UNISTD
20734 #ifdef I_UNISTD
20735 # include <unistd.h>
20736 #endif
20737 #$d_sysconf HAS_SYSCONF
20738 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20739 #ifdef HAS_STDIO_STREAM_ARRAY
20740 # define STDIO_STREAM_ARRAY $stdio_stream_array
20741 #endif
20742 int main() {
20743   FILE* p;
20744   unlink("try.out");
20745   p = fopen("try.out", "w");
20746 #ifdef TRY_FPUTC
20747   fputc('x', p);
20748 #else
20749 # ifdef TRY_FPRINTF
20750   fprintf(p, "x");
20751 # endif
20752 #endif
20753 #ifdef TRY_FFLUSH_NULL
20754   fflush(NULL);
20755 #endif
20756 #ifdef TRY_FFLUSH_ALL
20757   {
20758     long open_max = -1;
20759 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20760     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20761 # else
20762 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20763     open_max = sysconf(_SC_OPEN_MAX);
20764 #  else
20765 #   ifdef FOPEN_MAX
20766     open_max = FOPEN_MAX;
20767 #   else
20768 #    ifdef OPEN_MAX
20769     open_max = OPEN_MAX;
20770 #    else
20771 #     ifdef _NFILE
20772     open_max = _NFILE;
20773 #     endif
20774 #    endif
20775 #   endif
20776 #  endif
20777 # endif
20778 # ifdef HAS_STDIO_STREAM_ARRAY
20779     if (open_max > 0) {
20780       long i;
20781       for (i = 0; i < open_max; i++)
20782             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20783                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20784                 STDIO_STREAM_ARRAY[i]._flag)
20785                 fflush(&STDIO_STREAM_ARRAY[i]);
20786     }
20787   }
20788 # endif
20789 #endif
20790   _exit(42);
20791 }
20792 EOCP
20793 : first we have to find out how _not_ to flush
20794 $to try.c
20795 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20796     output=''
20797     set try -DTRY_FPUTC
20798     if eval $compile; then
20799             $run ./try 2>/dev/null
20800             code="$?"
20801             $from try.out
20802             if $test ! -s try.out -a "X$code" = X42; then
20803                 output=-DTRY_FPUTC
20804             fi
20805     fi
20806     case "$output" in
20807     '')
20808             set try -DTRY_FPRINTF
20809             if eval $compile; then
20810                     $run ./try 2>/dev/null
20811                     code="$?"
20812                     $from try.out
20813                     if $test ! -s try.out -a "X$code" = X42; then
20814                         output=-DTRY_FPRINTF
20815                     fi
20816             fi
20817         ;;
20818     esac
20819 fi
20820 : check for fflush NULL behavior
20821 case "$fflushNULL" in
20822 '')     set try -DTRY_FFLUSH_NULL $output
20823         if eval $compile; then
20824                 $run ./try 2>/dev/null
20825                 code="$?"
20826                 $from try.out
20827                 if $test -s try.out -a "X$code" = X42; then
20828                         fflushNULL="`$cat try.out`"
20829                 else
20830                         if $test "X$code" != X42; then
20831                                 $cat >&4 <<EOM
20832 (If this test failed, don't worry, we'll try another method shortly.)
20833 EOM
20834                         fi
20835                 fi
20836         fi
20837         $rm -f core try.core core.try.*
20838         case "$fflushNULL" in
20839         x)      $cat >&4 <<EOM
20840 Your fflush(NULL) works okay for output streams.
20841 Let's see if it clobbers input pipes...
20842 EOM
20843 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20844 # bug that improperly flushes the input end of pipes.  So we avoid the
20845 # autoflush on fork/system/exec support for now. :-(
20846 $cat >tryp.c <<EOCP
20847 #include <stdio.h>
20848 int
20849 main(int argc, char **argv)
20850 {
20851     char buf[1024];
20852     int i;
20853     char *bp = buf;
20854     while (1) {
20855         while ((i = getc(stdin)) != -1
20856                && (*bp++ = i) != '\n'
20857                && bp < &buf[1024])
20858         /* DO NOTHING */ ;
20859         *bp = '\0';
20860         fprintf(stdout, "%s", buf);
20861         fflush(NULL);
20862         if (i == -1)
20863             return 0;
20864         bp = buf;
20865     }
20866 }
20867 EOCP
20868                 fflushNULL="$define"
20869                 set tryp
20870                 if eval $compile; then
20871                     $rm -f tryp.out
20872                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20873                     if $test "X$targethost" != X; then
20874                         $to tryp.c
20875                         $to tryp
20876                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20877                     else
20878                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20879                     fi
20880                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20881                        $cat >&4 <<EOM
20882 fflush(NULL) seems to behave okay with input streams.
20883 EOM
20884                         fflushNULL="$define"
20885                     else
20886                         $cat >&4 <<EOM
20887 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20888 EOM
20889                         fflushNULL="$undef"
20890                     fi
20891                 fi
20892                 $rm -f core tryp.c tryp.core core.tryp.*
20893                 ;;
20894         '')     $cat >&4 <<EOM
20895 Your fflush(NULL) isn't working (contrary to ANSI C).
20896 EOM
20897                 fflushNULL="$undef"
20898                 ;;
20899         *)      $cat >&4 <<EOM
20900 Cannot figure out whether your fflush(NULL) works or not.
20901 I'm assuming it doesn't (contrary to ANSI C).
20902 EOM
20903                 fflushNULL="$undef"
20904                 ;;
20905         esac
20906         ;;
20907 $define|true|[yY]*)
20908         fflushNULL="$define"
20909         ;;
20910 *)
20911         fflushNULL="$undef"
20912         ;;
20913 esac
20914 : check explicit looping only if NULL did not work, and if the pipe
20915 : bug does not show up on an explicit flush too
20916 case "$fflushNULL" in
20917 "$undef")
20918         $cat >tryp.c <<EOCP
20919 #include <stdio.h>
20920 int
20921 main(int argc, char **argv)
20922 {
20923     char buf[1024];
20924     int i;
20925     char *bp = buf;
20926     while (1) {
20927         while ((i = getc(stdin)) != -1
20928                && (*bp++ = i) != '\n'
20929                && bp < &buf[1024])
20930         /* DO NOTHING */ ;
20931         *bp = '\0';
20932         fprintf(stdout, "%s", buf);
20933         fflush(stdin);
20934         if (i == -1)
20935             return 0;
20936         bp = buf;
20937     }
20938 }
20939 EOCP
20940         set tryp
20941         if eval $compile; then
20942             $rm -f tryp.out
20943             if $test "X$targethost" != X; then
20944                 $to tryp.c
20945                 $to tryp
20946                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20947             else
20948                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20949             fi
20950             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20951                $cat >&4 <<EOM
20952 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20953 EOM
20954                 : now check for fflushall behaviour
20955                 case "$fflushall" in
20956                 '')     set try -DTRY_FFLUSH_ALL $output
20957                         if eval $compile; then
20958                                 $cat >&4 <<EOM
20959 (Now testing the other method--but note that this also may fail.)
20960 EOM
20961                                 $run ./try 2>/dev/null
20962                                 code=$?
20963                                 $from try.out
20964                                 if $test -s try.out -a "X$code" = X42; then
20965                                         fflushall="`$cat try.out`"
20966                                 fi
20967                         fi
20968                         $rm_try
20969                         case "$fflushall" in
20970                         x)      $cat >&4 <<EOM
20971 Whew. Flushing explicitly all the stdio streams works.
20972 EOM
20973                                 fflushall="$define"
20974                                 ;;
20975                         '')     $cat >&4 <<EOM
20976 Sigh. Flushing explicitly all the stdio streams doesn't work.
20977 EOM
20978                                 fflushall="$undef"
20979                                 ;;
20980                         *)      $cat >&4 <<EOM
20981 Cannot figure out whether flushing stdio streams explicitly works or not.
20982 I'm assuming it doesn't.
20983 EOM
20984                                 fflushall="$undef"
20985                                 ;;
20986                         esac
20987                         ;;
20988                 "$define"|true|[yY]*)
20989                         fflushall="$define"
20990                         ;;
20991                 *)
20992                         fflushall="$undef"
20993                         ;;
20994                 esac
20995             else
20996                 $cat >&4 <<EOM
20997 All is futile.  Even fflush(stdin) clobbers input pipes!
20998 EOM
20999                 fflushall="$undef"
21000             fi
21001         else
21002             fflushall="$undef"
21003         fi
21004         $rm -f core tryp.c tryp.core core.tryp.*
21005         ;;
21006 *)      fflushall="$undef"
21007         ;;
21008 esac
21009
21010 case "$fflushNULL$fflushall" in
21011 undefundef)
21012         $cat <<EOM
21013 OK, I give up.  I cannot figure out how to flush pending stdio output.
21014 We won't be flushing handles at all before fork/exec/popen.
21015 EOM
21016         ;;
21017 esac
21018 $rm_try tryp
21019
21020 : Store the full pathname to the ar program for use in the C program
21021 : Respect a hint or command line value for full_ar.
21022 case "$full_ar" in
21023 '') full_ar=$ar ;;
21024 esac
21025
21026 : Store the full pathname to the sed program for use in the C program
21027 full_sed=$sed
21028
21029 : see what type gids are declared as in the kernel
21030 echo " "
21031 echo "Looking for the type for group ids returned by getgid()."
21032 set gid_t gidtype xxx stdio.h sys/types.h
21033 eval $typedef
21034 case "$gidtype" in
21035 xxx)
21036         xxx=`./findhdr sys/user.h`
21037         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21038         case $1 in
21039         unsigned) dflt="$1 $2" ;;
21040         *) dflt="$1" ;;
21041         esac
21042         ;;
21043 *) dflt="$gidtype";;
21044 esac
21045 case "$gidtype" in
21046 gid_t) echo "gid_t found." ;;
21047 *)      rp="What is the type for group ids returned by getgid()?"
21048         . ./myread
21049         gidtype="$ans"
21050         ;;
21051 esac
21052
21053 : Check the size of GID
21054 echo " "
21055 case "$gidtype" in
21056 *_t) zzz="$gidtype"     ;;
21057 *)   zzz="gid"          ;;
21058 esac
21059 echo "Checking the size of $zzz..." >&4
21060 cat > try.c <<EOCP
21061 #include <sys/types.h>
21062 #include <stdio.h>
21063 #$i_stdlib I_STDLIB
21064 #ifdef I_STDLIB
21065 #include <stdlib.h>
21066 #endif
21067 int main() {
21068     printf("%d\n", (int)sizeof($gidtype));
21069     exit(0);
21070 }
21071 EOCP
21072 set try
21073 if eval $compile_ok; then
21074         yyy=`$run ./try`
21075         case "$yyy" in
21076         '')     gidsize=4
21077                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21078                 ;;
21079         *)      gidsize=$yyy
21080                 echo "Your $zzz is $gidsize bytes long."
21081                 ;;
21082         esac
21083 else
21084         gidsize=4
21085         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21086 fi
21087
21088
21089 : Check if GID is signed
21090 echo " "
21091 case "$gidtype" in
21092 *_t) zzz="$gidtype"     ;;
21093 *)   zzz="gid"          ;;
21094 esac
21095 echo "Checking the sign of $zzz..." >&4
21096 cat > try.c <<EOCP
21097 #include <sys/types.h>
21098 #include <stdio.h>
21099 int main() {
21100         $gidtype foo = -1;
21101         if (foo < 0)
21102                 printf("-1\n");
21103         else
21104                 printf("1\n");
21105 }
21106 EOCP
21107 set try
21108 if eval $compile; then
21109         yyy=`$run ./try`
21110         case "$yyy" in
21111         '')     gidsign=1
21112                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21113                 ;;
21114         *)      gidsign=$yyy
21115                 case "$gidsign" in
21116                  1) echo "Your $zzz is unsigned." ;;
21117                 -1) echo "Your $zzz is signed."   ;;
21118                 esac
21119                 ;;
21120         esac
21121 else
21122         gidsign=1
21123         echo "(I can't compile the test program--guessing unsigned.)" >&4
21124 fi
21125
21126
21127 : Check 64bit sizes
21128 echo " "
21129
21130 if $test X"$quadtype" != X; then
21131
21132 echo "Checking how to print 64-bit integers..." >&4
21133
21134 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21135         $cat >try.c <<'EOCP'
21136 #include <sys/types.h>
21137 #include <stdio.h>
21138 int main() {
21139   int q = 12345678901;
21140   printf("%ld\n", q);
21141 }
21142 EOCP
21143         set try
21144         if eval $compile; then
21145                 yyy=`$run ./try`
21146                 case "$yyy" in
21147                 12345678901)
21148                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21149                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21150                         echo "We will use %d."
21151                         ;;
21152                 esac
21153         fi
21154 fi
21155
21156 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21157         $cat >try.c <<'EOCP'
21158 #include <sys/types.h>
21159 #include <stdio.h>
21160 int main() {
21161   long q = 12345678901;
21162   printf("%ld\n", q);
21163 }
21164 EOCP
21165         set try
21166         if eval $compile; then
21167                 yyy=`$run ./try`
21168                 case "$yyy" in
21169                 12345678901)
21170                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21171                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21172                         echo "We will use %ld."
21173                         ;;
21174                 esac
21175         fi
21176 fi
21177
21178 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21179         $cat >try.c <<'EOCP'
21180 #include <sys/types.h>
21181 #include <inttypes.h>
21182 #include <stdio.h>
21183 int main() {
21184   int64_t q = 12345678901;
21185   printf("%" PRId64 "\n", q);
21186 }
21187 EOCP
21188         set try
21189         if eval $compile; then
21190                 yyy=`$run ./try`
21191                 case "$yyy" in
21192                 12345678901)
21193                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21194                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21195                         echo "We will use the C9X style."
21196                         ;;
21197                 esac
21198         fi
21199 fi
21200
21201 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21202         $cat >try.c <<EOCP
21203 #include <sys/types.h>
21204 #include <stdio.h>
21205 int main() {
21206   $quadtype q = 12345678901;
21207   printf("%Ld\n", q);
21208 }
21209 EOCP
21210         set try
21211         if eval $compile; then
21212                 yyy=`$run ./try`
21213                 case "$yyy" in
21214                 12345678901)
21215                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21216                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21217                         echo "We will use %Ld."
21218                         ;;
21219                 esac
21220         fi
21221 fi
21222
21223 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21224         $cat >try.c <<'EOCP'
21225 #include <sys/types.h>
21226 #include <stdio.h>
21227 int main() {
21228   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21229   printf("%lld\n", q);
21230 }
21231 EOCP
21232         set try
21233         if eval $compile; then
21234                 yyy=`$run ./try`
21235                 case "$yyy" in
21236                 12345678901)
21237                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21238                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21239                         echo "We will use the %lld style."
21240                         ;;
21241                 esac
21242         fi
21243 fi
21244
21245 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21246         $cat >try.c <<EOCP
21247 #include <sys/types.h>
21248 #include <stdio.h>
21249 int main() {
21250   $quadtype q = 12345678901;
21251   printf("%qd\n", q);
21252 }
21253 EOCP
21254         set try
21255         if eval $compile; then
21256                 yyy=`$run ./try`
21257                 case "$yyy" in
21258                 12345678901)
21259                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21260                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21261                         echo "We will use %qd."
21262                         ;;
21263                 esac
21264         fi
21265 fi
21266
21267 if $test X"$sPRId64" = X; then
21268         echo "Cannot figure out how to print 64-bit integers." >&4
21269 fi
21270 $rm_try
21271
21272 fi
21273
21274 case "$sPRId64" in
21275 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21276         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21277         ;;
21278 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21279         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21280         ;;
21281 esac
21282
21283 : Check format strings for internal types
21284 echo " "
21285 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21286
21287 if $test X"$ivsize" = X8; then
21288         ivdformat="$sPRId64"
21289         uvuformat="$sPRIu64"
21290         uvoformat="$sPRIo64"
21291         uvxformat="$sPRIx64"
21292         uvXUformat="$sPRIXU64"
21293 else
21294         if $test X"$ivsize" = X"$longsize"; then
21295                 ivdformat='"ld"'
21296                 uvuformat='"lu"'
21297                 uvoformat='"lo"'
21298                 uvxformat='"lx"'
21299                 uvXUformat='"lX"'
21300         else
21301                 if $test X"$ivsize" = X"$intsize"; then
21302                         ivdformat='"d"'
21303                         uvuformat='"u"'
21304                         uvoformat='"o"'
21305                         uvxformat='"x"'
21306                         uvXUformat='"X"'
21307                 else
21308                         : far out
21309                         if $test X"$ivsize" = X"$shortsize"; then
21310                                 ivdformat='"hd"'
21311                                 uvuformat='"hu"'
21312                                 uvoformat='"ho"'
21313                                 uvxformat='"hx"'
21314                                 uvXUformat='"hX"'
21315                         fi
21316                 fi
21317         fi
21318 fi
21319
21320 if $test X"$usequadmath" = X"$define"; then
21321     nveformat='"Qe"'
21322     nvfformat='"Qf"'
21323     nvgformat='"Qg"'
21324     nvEUformat='"QE"'
21325     nvFUformat='"QF"'
21326     nvGUformat='"QG"'
21327 else
21328     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21329         nveformat="$sPRIeldbl"
21330         nvfformat="$sPRIfldbl"
21331         nvgformat="$sPRIgldbl"
21332         nvEUformat="$sPRIEUldbl"
21333         nvFUformat="$sPRIFUldbl"
21334         nvGUformat="$sPRIGUldbl"
21335     else
21336         nveformat='"e"'
21337         nvfformat='"f"'
21338         nvgformat='"g"'
21339         nvEUformat='"E"'
21340         nvFUformat='"F"'
21341         nvGUformat='"G"'
21342     fi
21343 fi
21344
21345 case "$ivdformat" in
21346 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21347     exit 1
21348     ;;
21349 esac
21350
21351 : Check format string for GID
21352
21353 echo " "
21354 $echo "Checking the format string to be used for gids..." >&4
21355
21356 case "$gidsign" in
21357 -1)     if $test X"$gidsize" = X"$ivsize"; then
21358                 gidformat="$ivdformat"
21359         else
21360                 if $test X"$gidsize" = X"$longsize"; then
21361                         gidformat='"ld"'
21362                 else
21363                         if $test X"$gidsize" = X"$intsize"; then
21364                                 gidformat='"d"'
21365                         else
21366                                 if $test X"$gidsize" = X"$shortsize"; then
21367                                         gidformat='"hd"'
21368                                 fi
21369                         fi
21370                 fi
21371         fi
21372         ;;
21373 *)      if $test X"$gidsize" = X"$uvsize"; then
21374                 gidformat="$uvuformat"
21375         else
21376                 if $test X"$gidsize" = X"$longsize"; then
21377                         gidformat='"lu"'
21378                 else
21379                         if $test X"$gidsize" = X"$intsize"; then
21380                                 gidformat='"u"'
21381                         else
21382                                 if $test X"$gidsize" = X"$shortsize"; then
21383                                         gidformat='"hu"'
21384                                 fi
21385                         fi
21386                 fi
21387         fi
21388         ;;
21389 esac
21390
21391 : see if getgroups exists
21392 set getgroups d_getgrps
21393 eval $inlibc
21394
21395 : see if setgroups exists
21396 set setgroups d_setgrps
21397 eval $inlibc
21398
21399 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21400 echo " "
21401 case "$d_getgrps$d_setgrps" in
21402 *define*)
21403         case "$groupstype" in
21404         '') dflt="$gidtype" ;;
21405         *)  dflt="$groupstype" ;;
21406         esac
21407         $cat <<EOM
21408 What type of pointer is the second argument to getgroups() and setgroups()?
21409 Usually this is the same as group ids, $gidtype, but not always.
21410
21411 EOM
21412         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21413         . ./myread
21414         groupstype="$ans"
21415         ;;
21416 *)  groupstype="$gidtype";;
21417 esac
21418
21419 : check whether make sets MAKE
21420 echo " "
21421 echo "Checking if your $make program sets \$(MAKE)..." >&4
21422 case "$make_set_make" in
21423 '')
21424         $sed 's/^X //' > testmake.mak << 'EOF'
21425 Xall:
21426 X       @echo 'maketemp="$(MAKE)"'
21427 EOF
21428         case "`$make -f testmake.mak 2>/dev/null`" in
21429         *maketemp=*) make_set_make='#' ;;
21430         *)      make_set_make="MAKE=$make" ;;
21431         esac
21432         $rm -f testmake.mak
21433         ;;
21434 esac
21435 case "$make_set_make" in
21436 '#') echo "Yup, it does.";;
21437 *) echo "Nope, it doesn't.";;
21438 esac
21439
21440 : see what type is used for mode_t
21441 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21442 set mode_t modetype int stdio.h sys/types.h
21443 eval $typedef_ask
21444
21445 : see if we need va_copy
21446 echo " "
21447 case "$i_stdarg" in
21448 "$define")
21449         $cat >try.c <<EOCP
21450 #include <stdarg.h>
21451 #include <stdio.h>
21452 #$i_stdlib I_STDLIB
21453 #ifdef I_STDLIB
21454 #include <stdlib.h>
21455 #endif
21456 #include <signal.h>
21457
21458 int
21459 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21460 {
21461   return vfprintf(f, fmt, *valp);
21462 }
21463
21464 int
21465 myvfprintf(FILE *f, const  char *fmt, va_list val)
21466 {
21467   return ivfprintf(f, fmt, &val);
21468 }
21469
21470 int
21471 myprintf(char *fmt, ...)
21472 {
21473   va_list val;
21474   va_start(val, fmt);
21475   return myvfprintf(stdout, fmt, val);
21476 }
21477
21478 int
21479 main(int ac, char **av)
21480 {
21481   signal(SIGSEGV, exit);
21482
21483   myprintf("%s%cs all right, then\n", "that", '\'');
21484   exit(0);
21485 }
21486 EOCP
21487         set try
21488         if eval $compile && $run ./try 2>&1 >/dev/null; then
21489                 case "`$run ./try`" in
21490                 "that's all right, then")
21491                         okay=yes
21492                         ;;
21493                 esac
21494         fi
21495         case "$okay" in
21496         yes)    echo "It seems that you don't need va_copy()." >&4
21497                 need_va_copy="$undef"
21498                 ;;
21499         *)      echo "It seems that va_copy() or similar will be needed." >&4
21500                 need_va_copy="$define"
21501                 ;;
21502         esac
21503         $rm_try
21504         ;;
21505 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21506         need_va_copy="$undef"
21507         ;;
21508 esac
21509
21510 : see what type is used for size_t
21511 rp="What is the type used for the length parameter for string functions?"
21512 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21513 eval $typedef_ask
21514
21515 : check for type of arguments to gethostbyaddr.
21516 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21517         case "$d_gethbyaddr" in
21518         $define)
21519                 $cat <<EOM
21520
21521 Checking to see what type of arguments are accepted by gethostbyaddr().
21522 EOM
21523                 hdrs="$define sys/types.h
21524                         $d_socket sys/socket.h
21525                         $i_niin netinet/in.h
21526                         $i_netdb netdb.h
21527                         $i_unistd unistd.h"
21528                 : The first arg can 'char *' or 'void *'
21529                 : The second arg is some of integral type
21530                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21531                         for yyy in size_t long int; do
21532                                 case "$netdb_host_type" in
21533                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21534                                         if ./protochk "$try" $hdrs; then
21535                                                 echo "Your system accepts $xxx for the first arg."
21536                                                 echo "...and $yyy for the second arg."
21537                                                 netdb_host_type="$xxx"
21538                                                 netdb_hlen_type="$yyy"
21539                                         fi
21540                                         ;;
21541                                 esac
21542                         done
21543                 done
21544                 : In case none of those worked, prompt the user.
21545                 case "$netdb_host_type" in
21546                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21547                         dflt='char *'
21548                         . ./myread
21549                         netdb_host_type=$ans
21550                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21551                         dflt="$sizetype"
21552                         . ./myread
21553                         netdb_hlen_type=$ans
21554                         ;;
21555                 esac
21556                 ;;
21557         *)      : no gethostbyaddr, so pick harmless defaults
21558                 netdb_host_type='char *'
21559                 netdb_hlen_type="$sizetype"
21560                 ;;
21561         esac
21562         # Remove the "const" if needed. -- but then we'll have a
21563         # prototype clash!
21564         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21565 fi
21566
21567 : check for type of argument to gethostbyname.
21568 if test "X$netdb_name_type" = X ; then
21569         case "$d_gethbyname" in
21570         $define)
21571                 $cat <<EOM
21572
21573 Checking to see what type of argument is accepted by gethostbyname().
21574 EOM
21575                 hdrs="$define sys/types.h
21576                         $d_socket sys/socket.h
21577                         $i_niin netinet/in.h
21578                         $i_netdb netdb.h
21579                         $i_unistd unistd.h"
21580                 for xxx in "const char *" "char *"; do
21581                         case "$netdb_name_type" in
21582                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21583                                 if ./protochk "$try" $hdrs; then
21584                                         echo "Your system accepts $xxx."
21585                                         netdb_name_type="$xxx"
21586                                 fi
21587                                 ;;
21588                         esac
21589                 done
21590                 : In case none of those worked, prompt the user.
21591                 case "$netdb_name_type" in
21592                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21593                         dflt='char *'
21594                         . ./myread
21595                         netdb_name_type=$ans
21596                         ;;
21597                 esac
21598                 ;;
21599         *)      : no gethostbyname, so pick harmless default
21600                 netdb_name_type='char *'
21601                 ;;
21602         esac
21603 fi
21604
21605 : check for type of 1st argument to getnetbyaddr.
21606 if test "X$netdb_net_type" = X ; then
21607         case "$d_getnbyaddr" in
21608         $define)
21609                 $cat <<EOM
21610
21611 Checking to see what type of 1st argument is accepted by getnetbyaddr().
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                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21619                         case "$netdb_net_type" in
21620                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21621                                 if ./protochk "$try" $hdrs; then
21622                                         echo "Your system accepts $xxx."
21623                                         netdb_net_type="$xxx"
21624                                 fi
21625                                 ;;
21626                         esac
21627                 done
21628                 : In case none of those worked, prompt the user.
21629                 case "$netdb_net_type" in
21630                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21631                         dflt='long'
21632                         . ./myread
21633                         netdb_net_type=$ans
21634                         ;;
21635                 esac
21636                 ;;
21637         *)      : no getnetbyaddr, so pick harmless default
21638                 netdb_net_type='long'
21639                 ;;
21640         esac
21641 fi
21642 : locate the preferred pager for this system
21643 fn=f/
21644 case "$pager" in
21645 '')
21646         dflt=''
21647         case "$pg" in
21648         /*) dflt=$pg;;
21649         [a-zA-Z]:/*) dflt=$pg;;
21650         esac
21651         case "$more" in
21652         /*) dflt=$more;;
21653         [a-zA-Z]:/*) dflt=$more;;
21654         esac
21655         case "$less" in
21656         /*) dflt=$less;;
21657         [a-zA-Z]:/*) dflt=$less;;
21658         esac
21659         case "$dflt" in
21660         '') dflt=/usr/ucb/more;;
21661         esac
21662         ;;
21663 *)      dflt="$pager"
21664         ;;
21665 esac
21666 fn="f/($dflt)"
21667 echo " "
21668 rp='What pager is used on your system?'
21669 . ./getfile
21670 pager="$ans"
21671
21672 : see what type pids are declared as in the kernel
21673 rp="What is the type of process ids on this system?"
21674 set pid_t pidtype int stdio.h sys/types.h
21675 eval $typedef_ask
21676
21677 : see if ar generates random libraries by itself
21678 echo " "
21679 echo "Checking how to generate random libraries on your machine..." >&4
21680 echo 'int bar1() { return bar2(); }' > bar1.c
21681 echo 'int bar2() { return 2; }' > bar2.c
21682 $cat > foo.c <<EOP
21683 #$i_stdlib I_STDLIB
21684 #ifdef I_STDLIB
21685 #include <stdlib.h>
21686 #endif
21687 int main() { printf("%d\n", bar1()); exit(0); }
21688 EOP
21689 $cc $ccflags -c bar1.c >/dev/null 2>&1
21690 $cc $ccflags -c bar2.c >/dev/null 2>&1
21691 $cc $ccflags -c foo.c >/dev/null 2>&1
21692 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21693 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21694         $run ./foobar >/dev/null 2>&1; then
21695         echo "$ar appears to generate random libraries itself."
21696         orderlib=false
21697         if [ "X$ranlib" = "X" ]; then
21698             ranlib=":"
21699         fi
21700 elif $ar s bar$_a >/dev/null 2>&1 &&
21701         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21702         $run ./foobar >/dev/null 2>&1; then
21703                 echo "a table of contents needs to be added with '$ar s'."
21704                 orderlib=false
21705                 ranlib="$ar s"
21706 elif $ar ts bar$_a >/dev/null 2>&1 &&
21707         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21708         $run ./foobar >/dev/null 2>&1; then
21709                 echo "a table of contents needs to be added with '$ar ts'."
21710                 orderlib=false
21711                 ranlib="$ar ts"
21712 else
21713         case "$ranlib" in
21714         :) ranlib='';;
21715         '')
21716                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21717                 $test -f $ranlib || ranlib=''
21718                 ;;
21719         esac
21720         if $test -n "$ranlib"; then
21721                 echo "your system has '$ranlib'; we'll use that."
21722                 orderlib=false
21723         else
21724                 echo "your system doesn't seem to support random libraries"
21725                 echo "so we'll use lorder and tsort to order the libraries."
21726                 orderlib=true
21727                 ranlib=":"
21728         fi
21729 fi
21730 $rm -f foo* bar*
21731
21732 : see if this is a values.h system
21733 set values.h i_values
21734 eval $inhdr
21735
21736 : Check the max offset that gmtime and localtime accept
21737 echo "Checking max offsets that gmtime () accepts"
21738
21739 case $i_values in
21740     define) yyy="#include <values.h>" ;;
21741     *)      yyy="" ;;
21742     esac
21743
21744 case "$sGMTIME_min/$sGMTIME_max" in
21745     0/0|/)
21746         $cat >try.c <<EOCP
21747 #include <sys/types.h>
21748 #include <stdio.h>
21749 #include <time.h>
21750 $yyy
21751
21752 int i;
21753 struct tm *tmp;
21754 time_t pt;
21755
21756 void gm_check (time_t t, int min_year, int max_year)
21757 {
21758     tmp = gmtime (&t);
21759     if ( tmp == NULL ||
21760         /* Check tm_year overflow */
21761          tmp->tm_year < min_year || tmp->tm_year > max_year)
21762         tmp = NULL;
21763     else
21764         pt = t;
21765     } /* gm_check */
21766
21767 int check_max ()
21768 {
21769     tmp = NULL;
21770     pt  = 0;
21771 #ifdef MAXLONG
21772     gm_check (MAXLONG, 69, 0x7fffffff);
21773 #endif
21774     if (tmp == NULL || tmp->tm_year < 0) {
21775         for (i = 63; i >= 0; i--) {
21776             time_t x = pt | ((time_t)1 << i);
21777             if (x < 0 || x < pt) continue;
21778             gm_check (x, 69, 0x7fffffff);
21779             }
21780         }
21781     printf ("sGMTIME_max=%ld\n", pt);
21782     return (0);
21783     } /* check_max */
21784
21785 int check_min ()
21786 {
21787     tmp = NULL;
21788     pt  = 0;
21789 #ifdef MINLONG
21790     gm_check (MINLONG, -1900, 70);
21791 #endif
21792     if (tmp == NULL) {
21793         for (i = 36; i >= 0; i--) {
21794             time_t x = pt - ((time_t)1 << i);
21795             if (x > 0) continue;
21796             gm_check (x, -1900, 70);
21797             }
21798         }
21799     printf ("sGMTIME_min=%ld\n", pt);
21800     return (0);
21801     } /* check_min */
21802
21803 int main (int argc, char *argv[])
21804 {
21805     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21806     check_max ();
21807     check_min ();
21808     return (0);
21809     } /* main */
21810 EOCP
21811         set try
21812         if eval $compile; then
21813             eval `$run ./try 2>/dev/null`
21814         else
21815             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21816             fi
21817         $rm_try
21818         ;;
21819     esac
21820
21821 echo "Checking max offsets that localtime () accepts"
21822
21823 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21824     0/0|/)
21825         $cat >try.c <<EOCP
21826 #include <sys/types.h>
21827 #include <stdio.h>
21828 #include <time.h>
21829 $yyy
21830
21831 int i;
21832 struct tm *tmp;
21833 time_t pt;
21834
21835 void local_check (time_t t, int min_year, int max_year)
21836 {
21837     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21838         tmp = NULL;
21839     else
21840         tmp = localtime (&t);
21841     if ( tmp == NULL ||
21842         /* Check tm_year overflow */
21843          tmp->tm_year < min_year || tmp->tm_year > max_year)
21844         tmp = NULL;
21845     else
21846         pt = t;
21847     } /* local_check */
21848
21849 int check_max ()
21850 {
21851     tmp = NULL;
21852     pt  = 0;
21853 #ifdef MAXLONG
21854     local_check (MAXLONG, 69, 0x7fffffff);
21855 #endif
21856     if (tmp == NULL || tmp->tm_year < 0) {
21857         for (i = 63; i >= 0; i--) {
21858             time_t x = pt | ((time_t)1 << i);
21859             if (x < 0 || x < pt) continue;
21860             local_check (x, 69, 0x7fffffff);
21861             }
21862         }
21863     printf ("sLOCALTIME_max=%ld\n", pt);
21864     return (0);
21865    } /* check_max */
21866
21867 int check_min ()
21868 {
21869     tmp = NULL;
21870     pt  = 0;
21871 #ifdef MINLONG
21872     local_check (MINLONG, -1900, 70);
21873 #endif
21874     if (tmp == NULL) {
21875         for (i = 36; i >= 0; i--) {
21876             time_t x = pt - ((time_t)1 << i);
21877             if (x > 0) continue;
21878             local_check (x, -1900, 70);
21879             }
21880         }
21881     printf ("sLOCALTIME_min=%ld\n", pt);
21882     return (0);
21883     } /* check_min */
21884
21885 int main (int argc, char *argv[])
21886 {
21887     check_max ();
21888     check_min ();
21889     return (0);
21890     } /* main */
21891 EOCP
21892         set try
21893         if eval $compile; then
21894             eval `$run ./try 2>/dev/null`
21895         else
21896             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21897             fi
21898         $rm_try
21899         ;;
21900     esac
21901
21902 : check for type of arguments to select.
21903 case "$selecttype" in
21904 '') case "$d_select" in
21905         $define)
21906                 echo " "
21907                 $cat <<EOM
21908 Checking to see what type of arguments are accepted by select().
21909 EOM
21910                 hdrs="$define sys/types.h
21911                         $i_systime sys/time.h
21912                         $i_sysselct sys/select.h
21913                         $d_socket sys/socket.h"
21914                 : The first arg can be int, unsigned, or size_t
21915                 : The last arg may or may not be 'const'
21916                 val=''
21917                 : void pointer has been seen but using that
21918                 : breaks the selectminbits test
21919                 for xxx in 'fd_set *' 'int *'; do
21920                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21921                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21922                                         case "$val" in
21923                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21924                                                 if ./protochk "$try" $hdrs; then
21925                                                         echo "Your system accepts $xxx."
21926                                                         val="$xxx"
21927                                                 fi
21928                                                 ;;
21929                                         esac
21930                                 done
21931                         done
21932                 done
21933                 case "$val" in
21934                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21935                         case "$d_fd_set" in
21936                                 $define) dflt="fd_set *" ;;
21937                                 *)              dflt="int *" ;;
21938                         esac
21939                         . ./myread
21940                         val=$ans
21941                         ;;
21942                 esac
21943                 selecttype="$val"
21944                 ;;
21945         *)      : no select, so pick a harmless default
21946                 selecttype='int *'
21947                 ;;
21948         esac
21949         ;;
21950 esac
21951
21952 : check for the select 'width'
21953 case "$selectminbits" in
21954 '') safebits=`expr $ptrsize \* 8`
21955     case "$d_select" in
21956         $define)
21957                 $cat <<EOM
21958
21959 Checking to see on how many bits at a time your select() operates...
21960 EOM
21961                 $cat >try.c <<EOCP
21962 #include <sys/types.h>
21963 #$i_time I_TIME
21964 #$i_systime I_SYS_TIME
21965 #$i_systimek I_SYS_TIME_KERNEL
21966 #ifdef I_TIME
21967 #   include <time.h>
21968 #endif
21969 #ifdef I_SYS_TIME
21970 #   ifdef I_SYS_TIME_KERNEL
21971 #       define KERNEL
21972 #   endif
21973 #   include <sys/time.h>
21974 #   ifdef I_SYS_TIME_KERNEL
21975 #       undef KERNEL
21976 #   endif
21977 #endif
21978 #$i_sysselct I_SYS_SELECT
21979 #ifdef I_SYS_SELECT
21980 #include <sys/select.h>
21981 #endif
21982 #$d_socket HAS_SOCKET
21983 #ifdef HAS_SOCKET
21984 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21985 #endif
21986 #include <stdio.h>
21987 #$i_stdlib I_STDLIB
21988 #ifdef I_STDLIB
21989 #include <stdlib.h>
21990 #endif
21991 $selecttype b;
21992 #define S sizeof(*(b))
21993 #define MINBITS 64
21994 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21995 #define NBITS  (NBYTES * 8)
21996 int main() {
21997     char *s = (char *)malloc(NBYTES);
21998     struct timeval t;
21999     int i;
22000     FILE* fp;
22001     int fd;
22002
22003     if (!s)
22004         exit(1);
22005     fclose(stdin);
22006     fp = fopen("try.c", "r");
22007     if (fp == 0)
22008       exit(2);
22009     fd = fileno(fp);
22010     if (fd < 0)
22011       exit(3);
22012     b = ($selecttype)s;
22013     for (i = 0; i < NBITS; i++)
22014         FD_SET(i, b);
22015     t.tv_sec  = 0;
22016     t.tv_usec = 0;
22017     select(fd + 1, b, 0, 0, &t);
22018     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22019     free(s);
22020     printf("%d\n", i + 1);
22021     return 0;
22022 }
22023 EOCP
22024                 set try
22025                 if eval $compile_ok; then
22026                         selectminbits=`$run ./try 2>/dev/null`
22027                         case "$selectminbits" in
22028                         '')     cat >&4 <<EOM
22029 Cannot figure out on how many bits at a time your select() operates.
22030 I'll play safe and guess it is $safebits bits.
22031 EOM
22032                                 selectminbits=$safebits
22033                                 bits="$safebits bits"
22034                                 ;;
22035                         1)      bits="1 bit" ;;
22036                         *)      bits="$selectminbits bits" ;;
22037                         esac
22038                         echo "Your select() operates on $bits at a time." >&4
22039                 else
22040                         rp='What is the minimum number of bits your select() operates on?'
22041                         case "$byteorder" in
22042                         12345678)       dflt=64 ;;
22043                         1234)           dflt=32 ;;
22044                         *)              dflt=1  ;;
22045                         esac
22046                         . ./myread
22047                         val=$ans
22048                         selectminbits="$val"
22049                 fi
22050                 $rm_try
22051                 ;;
22052         *)      : no select, so pick a harmless default
22053                 selectminbits=$safebits
22054                 ;;
22055         esac
22056         ;;
22057 esac
22058
22059 : Trace out the files included by signal.h, then look for SIGxxx names.
22060 case "$sig_num_init" in
22061 '')
22062 if [ "X$fieldn" = X ]; then
22063         : Just make some guesses.  We check them later.
22064         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22065 else
22066         xxx=`echo '#include <signal.h>' |
22067         $cppstdin $cppminus $cppflags 2>/dev/null |
22068         $grep '^[       ]*#.*include' |
22069         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22070                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22071 fi
22072 xxxfiles=''
22073 for xx in $xxx /dev/null ; do
22074         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22075 done
22076 case "$xxxfiles" in
22077 '')     xxxfiles=`./findhdr signal.h` ;;
22078 esac
22079 xxx=`awk '
22080 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22081         print substr($2, 4, 20)
22082 }
22083 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22084         print substr($3, 4, 20)
22085 }' $xxxfiles`
22086 : Append some common names just in case the awk scan failed.
22087 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22088 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22089 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22090 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22091 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22092
22093 : generate a few handy files for later
22094 $cat > signal.c <<EOCP
22095 #include <sys/types.h>
22096 #include <signal.h>
22097 #$i_stdlib I_STDLIB
22098 #ifdef I_STDLIB
22099 #include <stdlib.h>
22100 #endif
22101 #include <stdio.h>
22102 int main() {
22103
22104 /* Strange style to avoid deeply-nested #if/#else/#endif */
22105 #ifndef NSIG
22106 #  ifdef _NSIG
22107 #    define NSIG (_NSIG)
22108 #  endif
22109 #endif
22110
22111 #ifndef NSIG
22112 #  ifdef SIGMAX
22113 #    define NSIG (SIGMAX+1)
22114 #  endif
22115 #endif
22116
22117 #ifndef NSIG
22118 #  ifdef SIG_MAX
22119 #    define NSIG (SIG_MAX+1)
22120 #  endif
22121 #endif
22122
22123 #ifndef NSIG
22124 #  ifdef _SIG_MAX
22125 #    define NSIG (_SIG_MAX+1)
22126 #  endif
22127 #endif
22128
22129 #ifndef NSIG
22130 #  ifdef MAXSIG
22131 #    define NSIG (MAXSIG+1)
22132 #  endif
22133 #endif
22134
22135 #ifndef NSIG
22136 #  ifdef MAX_SIG
22137 #    define NSIG (MAX_SIG+1)
22138 #  endif
22139 #endif
22140
22141 #ifndef NSIG
22142 #  ifdef SIGARRAYSIZE
22143 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22144 #  endif
22145 #endif
22146
22147 #ifndef NSIG
22148 #  ifdef _sys_nsig
22149 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22150 #  endif
22151 #endif
22152
22153 /* Default to some arbitrary number that's big enough to get most
22154    of the common signals.
22155 */
22156 #ifndef NSIG
22157 #    define NSIG 50
22158 #endif
22159
22160 printf("NSIG %d\n", NSIG);
22161
22162 #ifndef JUST_NSIG
22163
22164 EOCP
22165
22166 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22167 {
22168         printf "#ifdef SIG"; printf $1; printf "\n"
22169         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22170         printf $1; printf ");\n"
22171         printf "#endif\n"
22172 }
22173 END {
22174         printf "#endif /* JUST_NSIG */\n";
22175         printf "exit(0);\n}\n";
22176 }
22177 ' >>signal.c
22178 $cat >signal.awk <<'EOP'
22179 BEGIN { ndups = 0 }
22180 $1 ~ /^NSIG$/ { nsig = $2 }
22181 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22182     if ($2 > maxsig) { maxsig = $2 }
22183     if (sig_name[$2]) {
22184         dup_name[ndups] = $1
22185         dup_num[ndups] = $2
22186         ndups++
22187     }
22188     else {
22189         sig_name[$2] = $1
22190         sig_num[$2] = $2
22191     }
22192 }
22193 END {
22194     if (nsig == 0) {
22195         nsig = maxsig + 1
22196     }
22197     printf("NSIG %d\n", nsig);
22198     for (n = 1; n < nsig; n++) {
22199         if (sig_name[n]) {
22200             printf("%s %d\n", sig_name[n], sig_num[n])
22201         }
22202         else {
22203             printf("NUM%d %d\n", n, n)
22204         }
22205     }
22206     for (n = 0; n < ndups; n++) {
22207         printf("%s %d\n", dup_name[n], dup_num[n])
22208     }
22209 }
22210 EOP
22211 $cat >signal_cmd <<EOS
22212 $startsh
22213 if $test -s signal.lst; then
22214     echo "Using your existing signal.lst file"
22215         exit 0
22216 fi
22217 xxx="$xxx"
22218 EOS
22219 $cat >>signal_cmd <<'EOS'
22220
22221 set signal
22222 if eval $compile_ok; then
22223         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22224                 $uniq | $awk -f signal.awk >signal.lst
22225 else
22226         echo "(I can't seem be able to compile the whole test program)" >&4
22227         echo "(I'll try it in little pieces.)" >&4
22228         set signal -DJUST_NSIG
22229         if eval $compile_ok; then
22230                 $run ./signal$_exe > signal.nsg
22231                 $cat signal.nsg
22232         else
22233                 echo "I can't seem to figure out how many signals you have." >&4
22234                 echo "Guessing 50." >&4
22235                 echo 'NSIG 50' > signal.nsg
22236         fi
22237         : Now look at all the signal names, one at a time.
22238         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22239                 $cat > signal.c <<EOCP
22240 #include <sys/types.h>
22241 #include <signal.h>
22242 #include <stdio.h>
22243 int main() {
22244 printf("$xx %d\n", SIG${xx});
22245 return 0;
22246 }
22247 EOCP
22248                 set signal
22249                 if eval $compile; then
22250                         echo "SIG${xx} found."
22251                         $run ./signal$_exe  >> signal.ls1
22252                 else
22253                         echo "SIG${xx} NOT found."
22254                 fi
22255         done
22256         if $test -s signal.ls1; then
22257                 $cat signal.nsg signal.ls1 |
22258                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22259         fi
22260
22261 fi
22262 if $test -s signal.lst; then
22263         :
22264 else
22265         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22266         echo 'kill -l' >signal
22267         set X `csh -f <signal`
22268         $rm -f signal
22269         shift
22270         case $# in
22271         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22272         esac
22273         echo $@ | $tr ' ' $trnl | \
22274             $awk '{ printf "%s %d\n", $1, ++s; }
22275                   END { printf "NSIG %d\n", ++s }' >signal.lst
22276 fi
22277 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22278 EOS
22279 chmod a+x signal_cmd
22280 $eunicefix signal_cmd
22281
22282 : generate list of signal names
22283 echo " "
22284 case "$sig_name_init" in
22285 '') doinit=yes ;;
22286 *)  case "$sig_num_init" in
22287     ''|*,*) doinit=yes ;;
22288     esac ;;
22289 esac
22290 case "$doinit" in
22291 yes)
22292         echo "Generating a list of signal names and numbers..." >&4
22293         . ./signal_cmd
22294         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22295         sig_name=`$awk 'BEGIN { printf "ZERO " }
22296                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22297         sig_num=`$awk  'BEGIN { printf "0 " }
22298                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22299         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22300                              !/^NSIG/   { printf "\"%s\", ", $1 }
22301                              END        { printf "0\n" }' signal.lst`
22302         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22303                              !/^NSIG/   { printf "%d, ", $2}
22304                              END        { printf "0\n"}' signal.lst`
22305         ;;
22306 esac
22307 echo "The following $sig_count signals are available:"
22308 echo " "
22309 echo $sig_name | $awk \
22310 'BEGIN { linelen = 0 }
22311 {
22312         for (i = 1; i <= NF; i++) {
22313                 name = "SIG" $i " "
22314                 linelen = linelen + length(name)
22315                 if (linelen > 70) {
22316                         printf "\n"
22317                         linelen = length(name)
22318                 }
22319                 printf "%s", name
22320         }
22321         printf "\n"
22322 }'
22323 sig_size=`echo $sig_name | awk '{print NF}'`
22324 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22325 ;;
22326 esac
22327
22328 : Check size of size
22329 echo " "
22330 case "$sizetype" in
22331 *_t) zzz="$sizetype"    ;;
22332 *)   zzz="filesize"     ;;
22333 esac
22334 echo "Checking the size of $zzz..." >&4
22335 cat > try.c <<EOCP
22336 #include <sys/types.h>
22337 #include <stdio.h>
22338 #$i_stdlib I_STDLIB
22339 #ifdef I_STDLIB
22340 #include <stdlib.h>
22341 #endif
22342 int main() {
22343     printf("%d\n", (int)sizeof($sizetype));
22344     exit(0);
22345 }
22346 EOCP
22347 set try
22348 if eval $compile_ok; then
22349         yyy=`$run ./try`
22350         case "$yyy" in
22351         '')     sizesize=4
22352                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22353                 ;;
22354         *)      sizesize=$yyy
22355                 echo "Your $zzz size is $sizesize bytes."
22356                 ;;
22357         esac
22358 else
22359         sizesize=4
22360         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22361 fi
22362
22363
22364 : check for socklen_t
22365 echo " "
22366 echo "Checking to see if you have socklen_t..." >&4
22367 $cat >try.c <<EOCP
22368 #include <sys/types.h>
22369 #$d_socket HAS_SOCKET
22370 #ifdef HAS_SOCKET
22371 #include <sys/socket.h>
22372 #endif
22373 int main() { socklen_t x = 16; }
22374 EOCP
22375 set try
22376 if eval $compile; then
22377         val="$define"
22378         echo "You have socklen_t."
22379 else
22380         val="$undef"
22381         echo "You do not have socklen_t."
22382         case "$sizetype" in
22383         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22384         esac
22385 fi
22386 $rm_try
22387 set d_socklen_t
22388 eval $setvar
22389
22390 : see if this is a socks.h system
22391 set socks.h i_socks
22392 eval $inhdr
22393
22394 : check for type of the size argument to socket calls
22395 case "$d_socket" in
22396 "$define")
22397         $cat <<EOM
22398
22399 Checking to see what type is the last argument of accept().
22400 EOM
22401         yyy=''
22402         case "$d_socklen_t" in
22403         "$define") yyy="$yyy socklen_t"
22404         esac
22405         yyy="$yyy $sizetype int long unsigned"
22406         for xxx in $yyy; do
22407                 case "$socksizetype" in
22408                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22409                         case "$usesocks" in
22410                         "$define")
22411                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22412                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22413                                         socksizetype="$xxx"
22414                                 fi
22415                                 ;;
22416                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22417                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22418                                         socksizetype="$xxx"
22419                                 fi
22420                                 ;;
22421                         esac
22422                         ;;
22423                 esac
22424         done
22425 : In case none of those worked, prompt the user.
22426         case "$socksizetype" in
22427         '')     rp='What is the type for socket address structure sizes?'
22428                 dflt='int'
22429                 . ./myread
22430                 socksizetype=$ans
22431                 ;;
22432         esac
22433         ;;
22434 *)      : no sockets, so pick relatively harmless default
22435         socksizetype='int'
22436         ;;
22437 esac
22438
22439 : see what type is used for signed size_t
22440 set ssize_t ssizetype int stdio.h sys/types.h
22441 eval $typedef
22442 dflt="$ssizetype"
22443 $cat > try.c <<EOM
22444 #include <stdio.h>
22445 #$i_stdlib I_STDLIB
22446 #ifdef I_STDLIB
22447 #include <stdlib.h>
22448 #endif
22449 #include <sys/types.h>
22450 #define Size_t $sizetype
22451 #define SSize_t $dflt
22452 int main()
22453 {
22454         if (sizeof(Size_t) == sizeof(SSize_t))
22455                 printf("$dflt\n");
22456         else if (sizeof(Size_t) == sizeof(int))
22457                 printf("int\n");
22458         else
22459                 printf("long\n");
22460         exit(0);
22461 }
22462 EOM
22463 echo " "
22464 set try
22465 if eval $compile_ok && $run ./try > /dev/null; then
22466         ssizetype=`$run ./try`
22467         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22468 else
22469         $cat >&4 <<EOM
22470 Help! I can't compile and run the ssize_t test program: please enlighten me!
22471 (This is probably a misconfiguration in your system or libraries, and
22472 you really ought to fix it.  Still, I'll try anyway.)
22473
22474 I need a type that is the same size as $sizetype, but is guaranteed to
22475 be signed.  Common values are ssize_t, int and long.
22476
22477 EOM
22478         rp="What signed type is the same size as $sizetype?"
22479         . ./myread
22480         ssizetype="$ans"
22481 fi
22482 $rm_try
22483
22484 : Check the size of st_ino
22485 $echo " "
22486 $echo "Checking the size of st_ino..." >&4
22487 $cat > try.c <<EOCP
22488 #include <sys/stat.h>
22489 #include <stdio.h>
22490 #$i_stdlib I_STDLIB
22491 #ifdef I_STDLIB
22492 #include <stdlib.h>
22493 #endif
22494 int main() {
22495     struct stat st;
22496     printf("%d\n", (int)sizeof(st.st_ino));
22497     exit(0);
22498 }
22499 EOCP
22500 set try
22501 if eval $compile_ok; then
22502         val=`$run ./try`
22503         case "$val" in
22504         '')     st_ino_size=4
22505                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22506                 ;;
22507         *)      st_ino_size=$val
22508                 $echo "Your st_ino is $st_ino_size bytes long."
22509                 ;;
22510         esac
22511 else
22512         st_ino_size=4
22513         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22514 fi
22515 $rm_try
22516
22517 : Check if st_ino is signed
22518 $echo " "
22519 $echo "Checking the sign of st_ino..." >&4
22520 $cat > try.c <<EOCP
22521 #include <sys/stat.h>
22522 #include <stdio.h>
22523 int main() {
22524         struct stat foo;
22525         foo.st_ino = -1;
22526         if (foo.st_ino < 0)
22527                 printf("-1\n");
22528         else
22529                 printf("1\n");
22530 }
22531 EOCP
22532 set try
22533 if eval $compile; then
22534         val=`$run ./try`
22535         case "$val" in
22536         '')     st_ino_sign=1
22537                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22538                 ;;
22539         *)      st_ino_sign=$val
22540                 case "$st_ino_sign" in
22541                  1) $echo "Your st_ino is unsigned." ;;
22542                 -1) $echo "Your st_ino is signed."   ;;
22543                 esac
22544                 ;;
22545         esac
22546 else
22547         st_ino_sign=1
22548         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22549 fi
22550 $rm_try
22551
22552 : see what type of char stdio uses.
22553 echo " "
22554 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22555 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22556         echo "Your stdio uses unsigned chars." >&4
22557         stdchar="unsigned char"
22558 else
22559         echo "Your stdio uses signed chars." >&4
22560         stdchar="char"
22561 fi
22562 $rm -f stdioh
22563
22564 : see what type uids are declared as in the kernel
22565 echo " "
22566 echo "Looking for the type for user ids returned by getuid()."
22567 set uid_t uidtype xxx stdio.h sys/types.h
22568 eval $typedef
22569 case "$uidtype" in
22570 xxx)
22571         xxx=`./findhdr sys/user.h`
22572         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22573         case $1 in
22574         unsigned) dflt="$1 $2" ;;
22575         *) dflt="$1" ;;
22576         esac
22577         ;;
22578 *) dflt="$uidtype";;
22579 esac
22580 case "$uidtype" in
22581 uid_t)  echo "uid_t found." ;;
22582 *)      rp="What is the type for user ids returned by getuid()?"
22583         . ./myread
22584         uidtype="$ans"
22585         ;;
22586 esac
22587
22588 : Check size of UID
22589 echo " "
22590 case "$uidtype" in
22591 *_t) zzz="$uidtype"     ;;
22592 *)   zzz="uid"          ;;
22593 esac
22594 echo "Checking the size of $zzz..." >&4
22595 cat > try.c <<EOCP
22596 #include <sys/types.h>
22597 #include <stdio.h>
22598 #$i_stdlib I_STDLIB
22599 #ifdef I_STDLIB
22600 #include <stdlib.h>
22601 #endif
22602 int main() {
22603     printf("%d\n", (int)sizeof($uidtype));
22604     exit(0);
22605 }
22606 EOCP
22607 set try
22608 if eval $compile_ok; then
22609         yyy=`$run ./try`
22610         case "$yyy" in
22611         '')     uidsize=4
22612                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22613                 ;;
22614         *)      uidsize=$yyy
22615                 echo "Your $zzz is $uidsize bytes long."
22616                 ;;
22617         esac
22618 else
22619         uidsize=4
22620         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22621 fi
22622
22623 : Check if UID is signed
22624 echo " "
22625 case "$uidtype" in
22626 *_t) zzz="$uidtype"     ;;
22627 *)   zzz="uid"          ;;
22628 esac
22629 echo "Checking the sign of $zzz..." >&4
22630 cat > try.c <<EOCP
22631 #include <sys/types.h>
22632 #include <stdio.h>
22633 int main() {
22634         $uidtype foo = -1;
22635         if (foo < 0)
22636                 printf("-1\n");
22637         else
22638                 printf("1\n");
22639 }
22640 EOCP
22641 set try
22642 if eval $compile; then
22643         yyy=`$run ./try`
22644         case "$yyy" in
22645         '')     uidsign=1
22646                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22647                 ;;
22648         *)      uidsign=$yyy
22649                 case "$uidsign" in
22650                  1) echo "Your $zzz is unsigned." ;;
22651                 -1) echo "Your $zzz is signed."   ;;
22652                 esac
22653                 ;;
22654         esac
22655 else
22656         uidsign=1
22657         echo "(I can't compile the test program--guessing unsigned.)" >&4
22658 fi
22659
22660
22661 : Check format string for UID
22662 echo " "
22663 $echo "Checking the format string to be used for uids..." >&4
22664
22665 case "$uidsign" in
22666 -1)     if $test X"$uidsize" = X"$ivsize"; then
22667                 uidformat="$ivdformat"
22668         else
22669                 if $test X"$uidsize" = X"$longsize"; then
22670                         uidformat='"ld"'
22671                 else
22672                         if $test X"$uidsize" = X"$intsize"; then
22673                                 uidformat='"d"'
22674                         else
22675                                 if $test X"$uidsize" = X"$shortsize"; then
22676                                         uidformat='"hd"'
22677                                 fi
22678                         fi
22679                 fi
22680         fi
22681         ;;
22682 *)      if $test X"$uidsize" = X"$uvsize"; then
22683                 uidformat="$uvuformat"
22684         else
22685                 if $test X"$uidsize" = X"$longsize"; then
22686                         uidformat='"lu"'
22687                 else
22688                         if $test X"$uidsize" = X"$intsize"; then
22689                                 uidformat='"u"'
22690                         else
22691                                 if $test X"$uidsize" = X"$shortsize"; then
22692                                         uidformat='"hu"'
22693                                 fi
22694                         fi
22695                 fi
22696         fi
22697         ;;
22698 esac
22699
22700 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22701 echo " "
22702 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22703 $cat >try.c <<'EOM'
22704 /* Intentionally a long probe as I'd like to sanity check that the exact
22705    approach is going to work, as thinking it will work, but only having it
22706    part working at runtime is worse than not having it.  */
22707
22708 #include <sys/types.h>
22709 #include <sys/sysctl.h>
22710 #include <sys/param.h>
22711 #include <stdio.h>
22712 #include <string.h>
22713 #include <stdlib.h>
22714 #include <unistd.h>
22715
22716 int
22717 main(int argc, char **argv) {
22718     char *buffer;
22719     char *argv_leaf = strrchr(argv[0], '/');
22720     char *buffer_leaf;
22721     size_t size = 0;
22722     int mib[4];
22723
22724     mib[0] = CTL_KERN;
22725     mib[1] = KERN_PROC;
22726     mib[2] = KERN_PROC_PATHNAME;
22727     mib[3] = -1;
22728
22729     if (!argv_leaf) {
22730         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22731         return 1;
22732     }
22733
22734     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22735         perror("sysctl");
22736         return 2;
22737     }
22738
22739     if (size < strlen(argv_leaf) + 1) {
22740         fprintf(stderr, "size %lu is too short for a path\n",
22741                 (unsigned long) size);
22742         return 3;
22743     }
22744
22745     if (size > MAXPATHLEN * MAXPATHLEN) {
22746         fprintf(stderr, "size %lu is too long for a path\n",
22747                 (unsigned long) size);
22748         return 4;
22749     }
22750
22751     buffer = malloc(size);
22752     if (!buffer) {
22753         perror("malloc");
22754         return 5;
22755     }
22756
22757     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22758         perror("sysctl");
22759         return 6;
22760     }
22761
22762     if (strlen(buffer) + 1 != size) {
22763         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22764                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22765         return 7;
22766     }
22767
22768
22769     if (*buffer != '/') {
22770         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22771         return 8;
22772     }
22773
22774     if (strstr(buffer, "/./")) {
22775         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22776         return 9;
22777     }
22778
22779     if (strstr(buffer, "/../")) {
22780         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22781         return 10;
22782     }
22783
22784     buffer_leaf = strrchr(buffer, '/');
22785     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22786         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22787         return 11;
22788     }
22789
22790     free(buffer);
22791
22792     return 0;
22793 }
22794 EOM
22795
22796 val=$undef
22797 set try
22798 if eval $compile; then
22799         if $run ./try; then
22800                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22801                 val="$define"
22802         else
22803                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22804                 val="$undef"
22805         fi
22806 else
22807         echo "I'm unable to compile the test program." >&4
22808         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22809         val="$undef"
22810 fi
22811 $rm_try
22812 set usekernprocpathname
22813 eval $setvar
22814
22815 : Determine if we can use _NSGetExecutablePath to find executing program
22816 echo " "
22817 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22818 $cat >try.c <<'EOM'
22819 /* Intentionally a long probe as I'd like to sanity check that the exact
22820    approach is going to work, as thinking it will work, but only having it
22821    part working at runtime is worse than not having it.  */
22822 #include <mach-o/dyld.h>
22823 #include <stdio.h>
22824 #include <stdlib.h>
22825 #include <sys/param.h>
22826 #include <string.h>
22827
22828 int
22829 main(int argc, char **argv) {
22830     char buf[1];
22831     uint32_t size = sizeof(buf);
22832     int result;
22833     char *buffer;
22834     char *tidied;
22835     char *argv_leaf = strrchr(argv[0], '/');
22836     char *tidied_leaf;
22837
22838     if (!argv_leaf) {
22839         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22840         return 1;
22841     }
22842
22843     _NSGetExecutablePath(buf, &size);
22844     if (size > MAXPATHLEN * MAXPATHLEN) {
22845         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22846                 (unsigned int) size);
22847         return 2;
22848     }
22849
22850     buffer = malloc(size);
22851     if (!buffer) {
22852         perror("malloc");
22853         return 3;
22854     }
22855
22856     result = _NSGetExecutablePath(buffer, &size);
22857     if (result != 0) {
22858         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22859                 result, (unsigned int) size);
22860         return 4;
22861     }
22862
22863     tidied = realpath(buffer, NULL);
22864     if (!tidied) {
22865         perror("realpath");
22866         return 5;
22867     }
22868
22869     free(buffer);
22870
22871     if (*tidied != '/') {
22872         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22873         return 6;
22874     }
22875
22876     if (strstr(tidied, "/./")) {
22877         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22878         return 7;
22879     }
22880
22881     if (strstr(tidied, "/../")) {
22882         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22883         return 8;
22884     }
22885
22886     tidied_leaf = strrchr(tidied, '/');
22887     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22888         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22889         return 9;
22890     }
22891
22892     free(tidied);
22893
22894     return 0;
22895 }
22896 EOM
22897
22898 val=$undef
22899 set try
22900 if eval $compile; then
22901         if $run ./try; then
22902                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22903                 val="$define"
22904         else
22905                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22906         fi
22907 else
22908         echo "I'm unable to compile the test program." >&4
22909         echo "I'll assume no _NSGetExecutablePath here." >&4
22910 fi
22911 $rm_try
22912 set usensgetexecutablepath
22913 eval $setvar
22914
22915 : Check if site customization support was requested
22916 case "$usesitecustomize" in
22917     $define|true|[Yy]*)
22918         usesitecustomize="$define"
22919         ;;
22920     *)
22921         usesitecustomize="$undef"
22922         ;;
22923     esac
22924
22925 : see if prototypes support variable argument declarations
22926 echo " "
22927 case "$prototype$i_stdarg" in
22928 $define$define)
22929         echo "It appears we'll be able to prototype varargs functions." >&4
22930         val="$define"
22931         ;;
22932 *)
22933         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22934         val="$undef"
22935         ;;
22936 esac
22937 set vaproto
22938 eval $setvar
22939
22940 : determine compiler compiler
22941 case "$yacc" in
22942 '')
22943         dflt=yacc;;
22944 *)
22945         dflt="$yacc";;
22946 esac
22947 echo " "
22948 comp='yacc'
22949 if $test -f "$byacc$_exe"; then
22950         dflt="$byacc"
22951         comp="byacc or $comp"
22952 fi
22953 if $test -f "$bison$_exe"; then
22954         comp="$comp or bison -y"
22955 fi
22956 rp="Which compiler compiler ($comp) shall I use?"
22957 . ./myread
22958 yacc="$ans"
22959 case "$yacc" in
22960 *bis*)
22961         case "$yacc" in
22962         *-y*) ;;
22963         *)
22964                 yacc="$yacc -y"
22965                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22966                 ;;
22967         esac
22968         ;;
22969 esac
22970
22971 : see if this is a assert.h system
22972 set assert.h i_assert
22973 eval $inhdr
22974
22975 : see if this is a bfd.h system
22976 set bfd.h i_bfd
22977 eval $inhdr
22978
22979 : see if this is an execinfo.h system
22980 set execinfo.h i_execinfo
22981 eval $inhdr
22982
22983 : see if this is a fenv.h system
22984 set fenv.h i_fenv
22985 eval $inhdr
22986
22987 : see if this is a fp.h system
22988 set fp.h i_fp
22989 eval $inhdr
22990
22991 : see if this is a fp_class.h system
22992 set fp_class.h i_fp_class
22993 eval $inhdr
22994
22995 : see if gdbm.h is available
22996 set gdbm.h t_gdbm
22997 eval $inhdr
22998 case "$t_gdbm" in
22999 $define)
23000         : see if gdbm_open exists
23001         set gdbm_open d_gdbm_open
23002         eval $inlibc
23003         case "$d_gdbm_open" in
23004         $undef)
23005                 t_gdbm="$undef"
23006                 echo "We won't be including <gdbm.h>"
23007                 ;;
23008         esac
23009         ;;
23010 esac
23011 val="$t_gdbm"
23012 set i_gdbm
23013 eval $setvar
23014
23015 : see if this is a ieeefp.h system
23016 case "$i_ieeefp" in
23017 '' ) set ieeefp.h i_ieeefp
23018      eval $inhdr
23019      ;;
23020 esac
23021
23022 : see if this is a libutil.h system
23023 set libutil.h i_libutil
23024 eval $inhdr
23025
23026 : see if mach cthreads are available
23027 if test "X$usethreads" = "X$define"; then
23028         set mach/cthreads.h i_machcthr
23029         eval $inhdr
23030 else
23031         i_machcthr="$undef"
23032 fi
23033
23034 : see if this is a mntent.h system
23035 set mntent.h i_mntent
23036 eval $inhdr
23037
23038 : see if net/errno.h is available
23039 val=''
23040 set net/errno.h val
23041 eval $inhdr
23042
23043 : Unfortunately, it causes problems on some systems.  Arrgh.
23044 case "$val" in
23045 $define)
23046         cat > try.c <<'EOM'
23047 #include <stdio.h>
23048 #include <errno.h>
23049 #include <net/errno.h>
23050 int func()
23051 {
23052         return ENOTSOCK;
23053 }
23054 EOM
23055         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23056                 echo "We'll be including <net/errno.h>." >&4
23057         else
23058                 echo "We won't be including <net/errno.h>." >&4
23059                 val="$undef"
23060         fi
23061         $rm_try
23062         ;;
23063 esac
23064 set i_neterrno
23065 eval $setvar
23066
23067 : see if netinet/tcp.h is available
23068 set netinet/tcp.h i_netinettcp
23069 eval $inhdr
23070
23071 : see if this is a poll.h system
23072 set poll.h i_poll
23073 eval $inhdr
23074
23075 : see if this is a prot.h system
23076 set prot.h i_prot
23077 eval $inhdr
23078
23079 : Preprocessor symbols
23080 echo " "
23081 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23082 $cat <<'EOSH' > Cppsym.know
23083 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23084 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23085 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23086 arch_pwr ardent ARM ARM32 atarist att386 att3b
23087 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23088 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23089 byteorder byte_order
23090 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23091 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23092 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23093 ELF encore EPI EXTENSIONS
23094 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23095 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23096 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23097 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23098 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23099 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23100 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23101 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23102 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23103 ksr1
23104 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23105 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23106 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23107 luna88k Lynx
23108 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23109 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23110 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23111 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23112 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23113 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23114 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23115 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23116 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23117 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23118 ns32000 ns32016 ns32332 ns32k nsc32000
23119 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23120 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23121 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23122 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23123 QK_USER QNX
23124 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23125 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23126 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23127 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23128 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23129 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23130 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23131 SYSV4 SYSV5 sysV68 sysV88
23132 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23133 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23134 tower32_800 tower32_850 tss
23135 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23136 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23137 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23138 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23139 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23140 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23141 uxpm uxps
23142 vax venix VMESA vms
23143 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23144 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23145 z8000 zarch
23146 EOSH
23147 # Maybe put other stuff here too.
23148 ./tr '-' '_' <<EOSH >>Cppsym.know
23149 $osname
23150 EOSH
23151 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23152 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23153 $cat Cppsym.know > Cppsym.c
23154 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23155 $rm -f Cppsym.a Cppsym.b Cppsym.c
23156 cat <<EOSH > Cppsym
23157 $startsh
23158 if $test \$# -gt 0; then
23159     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23160     if $test -s Cppsym.got; then
23161         $rm -f Cppsym.got
23162         exit 0
23163     fi
23164     $rm -f Cppsym.got
23165     exit 1
23166 else
23167     $tr " " "$trnl" | ./Cppsym.try
23168     exit 0
23169 fi
23170 EOSH
23171 chmod +x Cppsym
23172 $eunicefix Cppsym
23173 cat <<EOSH > Cppsym.try
23174 $startsh
23175 cat <<'EOCP' > try.c
23176 #include <stdio.h>
23177 #if cpp_stuff == 1
23178 #define STRINGIFY(a)    "a"
23179 #endif
23180 #if cpp_stuff == 42
23181 #define StGiFy(a)  #a
23182 #define STRINGIFY(a)    StGiFy(a)
23183 #endif
23184 #if $cpp_stuff != 1 && $cpp_stuff != 42
23185 #   include "Bletch: How does this C preprocessor stringify macros?"
23186 #endif
23187 int main() {
23188 EOCP
23189 $awk \\
23190 EOSH
23191 cat <<'EOSH' >> Cppsym.try
23192 'length($1) > 0 {
23193     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23194     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23195     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23196     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23197 }'       >> try.c
23198 echo 'return 0;}' >> try.c
23199 EOSH
23200 cat <<EOSH >> Cppsym.try
23201 ccflags="$ccflags"
23202 case "$osname-$gccversion" in
23203 irix-) ccflags="\$ccflags -woff 1178" ;;
23204 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23205 esac
23206 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
23207 EOSH
23208 chmod +x Cppsym.try
23209 $eunicefix Cppsym.try
23210 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23211 : Add in any Linux cpp "predefined macros":
23212 case "$osname::$gccversion" in
23213   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23214     tHdrH=_tmpHdr
23215     rm -f $tHdrH'.h' $tHdrH
23216     touch $tHdrH'.h'
23217     # Filter out macro arguments, such as Linux's __INT8_C(c)
23218     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23219        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23220        if [ -s $tHdrH'_cppsym.real' ]; then
23221           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23222        fi
23223     fi
23224     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23225   ;;
23226 esac
23227 : now check the C compiler for additional symbols
23228 postprocess_cc_v=''
23229 case "$osname" in
23230 aix) postprocess_cc_v="|$tr , ' '" ;;
23231 esac
23232 $cat >ccsym <<EOS
23233 $startsh
23234 $cat >tmp.c <<EOF
23235 extern int foo;
23236 EOF
23237 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23238 do
23239         case "\$i" in
23240         -D*) echo "\$i" | $sed 's/^-D//';;
23241         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23242         esac
23243 done
23244 $rm_try
23245 EOS
23246 postprocess_cc_v=''
23247 chmod +x ccsym
23248 $eunicefix ccsym
23249 ./ccsym > ccsym1.raw
23250 if $test -s ccsym1.raw; then
23251     $sort ccsym1.raw | $uniq >ccsym.raw
23252 else
23253     mv ccsym1.raw ccsym.raw
23254 fi
23255
23256 $awk '/\=/ { print $0; next }
23257         { print $0"=1" }' ccsym.raw >ccsym.list
23258 $comm -13 Cppsym.true ccsym.list >ccsym.own
23259 $comm -12 Cppsym.true ccsym.list >ccsym.com
23260 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23261 also=''
23262 if $test -z ccsym.raw; then
23263         echo "Your C compiler doesn't seem to define any symbols!" >&4
23264         echo " "
23265         echo "However, your C preprocessor defines the following symbols:"
23266         $cat Cppsym.true
23267         ccsymbols=''
23268         cppsymbols=`$cat Cppsym.true`
23269         cppsymbols=`echo $cppsymbols`
23270         cppccsymbols="$cppsymbols"
23271 else
23272         if $test -s ccsym.com; then
23273                 echo "Your C compiler and pre-processor define these symbols:"
23274                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23275                 also='also '
23276                 symbols='ones'
23277                 cppccsymbols=`$cat ccsym.com`
23278                 cppccsymbols=`echo $cppccsymbols`
23279                 $test "$silent" || sleep 1
23280         fi
23281         if $test -s ccsym.cpp; then
23282                 $test "$also" && echo " "
23283                 echo "Your C pre-processor ${also}defines the following symbols:"
23284                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23285                 also='further '
23286                 cppsymbols=`$cat ccsym.cpp`
23287                 cppsymbols=`echo $cppsymbols`
23288                 $test "$silent" || sleep 1
23289         fi
23290         if $test -s ccsym.own; then
23291                 $test "$also" && echo " "
23292                 echo "Your C compiler ${also}defines the following cpp symbols:"
23293                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23294                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23295                 ccsymbols=`$cat ccsym.own`
23296                 ccsymbols=`echo $ccsymbols`
23297                 $test "$silent" || sleep 1
23298         fi
23299 fi
23300
23301 : add -D_FORTIFY_SOURCE if feasible and not already there
23302 case "$gccversion" in
23303 [45].*) case "$optimize$ccflags" in
23304         *-O*)   case "$ccflags$cppsymbols" in
23305                 *_FORTIFY_SOURCE=*) # Don't add it again.
23306                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23307                         ;;
23308                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23309                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23310                         ;;
23311                 esac
23312                 ;;
23313         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23314                 ;;
23315         esac
23316         ;;
23317 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23318         ;;
23319 esac
23320
23321 : see if this is a termio system
23322 val="$undef"
23323 val2="$undef"
23324 val3="$undef"
23325 if $test `./findhdr termios.h`; then
23326     set tcsetattr i_termios
23327     eval $inlibc
23328     val3="$i_termios"
23329 fi
23330 echo " "
23331 case "$val3" in
23332     "$define") echo "You have POSIX termios.h... good!" >&4;;
23333     *)  if ./Cppsym pyr; then
23334             case "`$run /bin/universe`" in
23335                 ucb) if $test `./findhdr sgtty.h`; then
23336                         val2="$define"
23337                         echo "<sgtty.h> found." >&4
23338                     else
23339                         echo "System is pyramid with BSD universe."
23340                         ./warn "<sgtty.h> not found--you could have problems."
23341                     fi;;
23342                 *)  if $test `./findhdr termio.h`; then
23343                         val="$define"
23344                         echo "<termio.h> found." >&4
23345                     else
23346                         echo "System is pyramid with USG universe."
23347                         ./warn "<termio.h> not found--you could have problems."
23348                     fi;;
23349             esac
23350         elif ./usg; then
23351             if $test `./findhdr termio.h`; then
23352                 echo "<termio.h> found." >&4
23353                 val="$define"
23354             elif $test `./findhdr sgtty.h`; then
23355                 echo "<sgtty.h> found." >&4
23356                 val2="$define"
23357             else
23358                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23359             fi
23360         else
23361             if $test `./findhdr sgtty.h`; then
23362                 echo "<sgtty.h> found." >&4
23363                 val2="$define"
23364             elif $test `./findhdr termio.h`; then
23365                 echo "<termio.h> found." >&4
23366                 val="$define"
23367             else
23368                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23369             fi
23370         fi;;
23371 esac
23372 set i_termio; eval $setvar
23373 val=$val2; set i_sgtty; eval $setvar
23374 val=$val3; set i_termios; eval $setvar
23375
23376 : see if stdbool is available
23377 : we want a real compile instead of Inhdr because some Solaris systems
23378 : have stdbool.h, but it can only be used if the compiler indicates it
23379 : is sufficiently c99-compliant.
23380 echo " "
23381 $cat >try.c <<EOCP
23382 #include <stdio.h>
23383 #include <stdbool.h>
23384 int func(bool x)
23385 {
23386     return x ? 1 : 0;
23387 }
23388 int main(int argc, char **argv)
23389 {
23390     return func(0);
23391 }
23392 EOCP
23393 set try
23394 if eval $compile; then
23395         echo "<stdbool.h> found." >&4
23396         val="$define"
23397 else
23398         echo "<stdbool.h> NOT found." >&4
23399         val="$undef"
23400 fi
23401 $rm_try
23402 set i_stdbool
23403 eval $setvar
23404
23405 : see if stddef is available
23406 set stddef.h i_stddef
23407 eval $inhdr
23408
23409 : see if stdint is available
23410 set stdint.h i_stdint
23411 eval $inhdr
23412
23413 : see if sys/access.h is available
23414 set sys/access.h i_sysaccess
23415 eval $inhdr
23416
23417 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23418 set sys/filio.h i_sysfilio
23419 eval $inhdr
23420 echo " "
23421 if $test `./findhdr sys/ioctl.h`; then
23422         val="$define"
23423         echo '<sys/ioctl.h> found.' >&4
23424 else
23425         val="$undef"
23426         if $test $i_sysfilio = "$define"; then
23427             echo '<sys/ioctl.h> NOT found.' >&4
23428         else
23429                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23430                 $test $i_termio = "$define" && xxx="termio.h"
23431                 $test $i_termios = "$define" && xxx="termios.h"
23432 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23433         fi
23434 fi
23435 set i_sysioctl
23436 eval $setvar
23437
23438 : see if socket ioctl defs are in sys/sockio.h
23439 echo " "
23440 xxx=`./findhdr sys/sockio.h`
23441 if $test "$xxx"; then
23442         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23443                 val="$define"
23444                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23445         else
23446                 val="$undef"
23447                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23448         fi
23449 else
23450         val="$undef"
23451         $cat <<EOM
23452 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23453 EOM
23454 fi
23455 set i_syssockio
23456 eval $setvar
23457
23458 : see if this is a syslog.h system
23459 set syslog.h i_syslog
23460 eval $inhdr
23461
23462 : see if this is a sys/mode.h system
23463 set sys/mode.h i_sysmode
23464 eval $inhdr
23465
23466 : see if there is a sys/poll.h file
23467 set sys/poll.h i_syspoll
23468 eval $inhdr
23469
23470 : see if sys/resource.h has to be included
23471 set sys/resource.h i_sysresrc
23472 eval $inhdr
23473
23474 : see if sys/security.h is available
23475 set sys/security.h i_syssecrt
23476 eval $inhdr
23477
23478 : see if this is a sys/statvfs.h system
23479 set sys/statvfs.h i_sysstatvfs
23480 eval $inhdr
23481
23482 : see if this is a sys/un.h system
23483 set sys/un.h i_sysun
23484 eval $inhdr
23485
23486 : see if this is a sys/utsname.h system
23487 set sys/utsname.h i_sysutsname
23488 eval $inhdr
23489
23490 : see if this is a syswait system
23491 set sys/wait.h i_syswait
23492 eval $inhdr
23493
23494 : see if this is a ustat.h system
23495 set ustat.h i_ustat
23496 eval $inhdr
23497
23498 : see if this is an utime system
23499 set utime.h i_utime
23500 eval $inhdr
23501
23502 : see if this is a vfork system
23503 case "$d_vfork" in
23504 "$define")
23505         set vfork.h i_vfork
23506         eval $inhdr
23507         ;;
23508 *)
23509         i_vfork="$undef"
23510         ;;
23511 esac
23512
23513 : Check extensions
23514 echo " "
23515 echo "Looking for extensions..." >&4
23516 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23517 : contain old or inaccurate or duplicate values.
23518 nonxs_extensions=''
23519 xs_extensions=''
23520 : We do not use find because it might not be available.
23521 : We do not just use MANIFEST because the user may have dropped
23522 : some additional extensions into the source tree and expect them
23523 : to be built.
23524
23525 : Function to recursively find available extensions, ignoring DynaLoader
23526 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23527 : In 5.10.1 and later, extensions are stored in directories
23528 : like File-Glob instead of the older File/Glob/.
23529 find_extensions='
23530     for xxx in *; do
23531         case "$xxx" in
23532             DynaLoader|dynaload) ;;
23533             *)
23534             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23535             case "$this_ext" in
23536                 Scalar/List/Utils) this_ext="List/Util" ;;
23537                 PathTools)         this_ext="Cwd"       ;;
23538             esac;
23539             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23540             if $contains " $this_ext " "$tdir/$$.tmp"; then
23541                 echo >&4;
23542                 echo "Duplicate directories detected for extension $xxx" >&4;
23543                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23544                 case "$knowitall" in
23545                 "") dflt=y;;
23546                 *) dflt=n;;
23547                 esac;
23548                 . ../UU/myread;
23549                 case "$ans" in
23550                 n*|N*) ;;
23551                 *) echo >&4;
23552                     echo "Ok.  Stopping Configure." >&4;
23553                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23554                     exit 1;;
23555                 esac;
23556                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23557             fi;
23558             $ls -1 "$xxx" > "$tdir/$$.tmp";
23559             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23560                 xs_extensions="$xs_extensions $this_ext";
23561             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23562                 xs_extensions="$xs_extensions $this_ext";
23563             elif $test -d "$xxx"; then
23564                 nonxs_extensions="$nonxs_extensions $this_ext";
23565             fi;
23566             $rm -f "$tdir/$$.tmp";
23567             ;;
23568         esac;
23569     done'
23570 tdir=`pwd`
23571 cd "$rsrc/cpan"
23572 set X
23573 shift
23574 eval $find_extensions
23575 cd "$rsrc/dist"
23576 set X
23577 shift
23578 eval $find_extensions
23579 cd "$rsrc/ext"
23580 set X
23581 shift
23582 eval $find_extensions
23583 set X $xs_extensions
23584 shift
23585 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23586 set X $nonxs_extensions
23587 shift
23588 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23589 cd "$tdir"
23590 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23591
23592 : Now see which are supported on this system.
23593 avail_ext=''
23594 for xxx in $xs_extensions ; do
23595         case "$xxx" in
23596         Amiga*)
23597                 case "$osname" in
23598                 amigaos) avail_ext="$avail_ext $xxx" ;;
23599                 esac
23600                 ;;
23601         DB_File|db_file)
23602                 case "$i_db" in
23603                 $define) avail_ext="$avail_ext $xxx" ;;
23604                 esac
23605                 ;;
23606         GDBM_File|gdbm_fil)
23607                 case "$i_gdbm" in
23608                 $define) avail_ext="$avail_ext $xxx" ;;
23609                 esac
23610                 ;;
23611         I18N/Langinfo|i18n_lan)
23612                 case "$i_langinfo$d_nl_langinfo" in
23613                 $define$define) avail_ext="$avail_ext $xxx" ;;
23614                 esac
23615                 ;;
23616         IPC/SysV|ipc/sysv)
23617                 : XXX Do we need a useipcsysv variable here
23618                 case "${d_msg}${d_sem}${d_shm}" in
23619                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23620                 esac
23621                 ;;
23622         NDBM_File|ndbm_fil)
23623                 case "$d_ndbm" in
23624                 $define)
23625                     case "$osname-$use64bitint" in
23626                     hpux-define)
23627                         case "$libs" in
23628                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23629                         esac
23630                         ;;
23631                     *) avail_ext="$avail_ext $xxx" ;;
23632                     esac
23633                     ;;
23634                 esac
23635                 ;;
23636         ODBM_File|odbm_fil)
23637                 case "${i_dbm}${i_rpcsvcdbm}" in
23638                 *"${define}"*)
23639                     case "$d_cplusplus" in
23640                     define) ;; # delete as a function name will not work
23641                     *)  case "$osname-$use64bitint" in
23642                         hpux-define)
23643                             case "$libs" in
23644                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23645                             esac
23646                             ;;
23647                         *) avail_ext="$avail_ext $xxx" ;;
23648                         esac
23649                         ;;
23650                     esac
23651                     ;;
23652                 esac
23653                 ;;
23654         Opcode|opcode)
23655                 case "$useopcode" in
23656                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23657                 esac
23658                 ;;
23659         POSIX|posix)
23660                 case "$useposix" in
23661                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23662                 esac
23663                 ;;
23664         Socket|socket)
23665                 case "$d_socket" in
23666                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23667                 esac
23668                 ;;
23669         Sys/Syslog|sys/syslog)
23670                 case $osname in
23671                         amigaos) ;; # not really very useful on AmigaOS
23672                         *)
23673                         : XXX syslog requires socket
23674                         case "$d_socket" in
23675                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23676                         esac
23677                         ;;
23678                 esac
23679                 ;;
23680         Thread|thread)
23681                 case "$usethreads" in
23682                 true|$define|y)
23683                         case "$use5005threads" in
23684                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23685                         esac
23686                 esac
23687                 ;;
23688         threads|threads/shared)
23689                 # threads and threads::shared are special cases.
23690                 # To stop people from asking "Perl 5.8.0 was supposed
23691                 # to have this new fancy threads implementation but my
23692                 # perl doesn't have it" and from people trying to
23693                 # (re)install the threads module using CPAN.pm and
23694                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23695                 # the threads.pm and threads/shared.pm will always be
23696                 # there, croaking informatively ("you need to rebuild
23697                 # all of Perl with threads, sorry") when threads haven't
23698                 # been compiled in.
23699                 # --jhi
23700                 avail_ext="$avail_ext $xxx"
23701                 ;;
23702         VMS*)
23703                 ;;
23704         Win32*)
23705                 case "$osname" in
23706                 cygwin) avail_ext="$avail_ext $xxx" ;;
23707                 esac
23708                 ;;
23709         XS/APItest|xs/apitest)
23710                 # This is just for testing.  Skip it unless we have dynamic loading.
23711
23712                 case "$usedl" in
23713                 $define) avail_ext="$avail_ext $xxx" ;;
23714                 esac
23715                 ;;
23716         XS/Typemap|xs/typemap)
23717                 # This is just for testing.  Skip it unless we have dynamic loading.
23718                 case "$usedl" in
23719                 $define) avail_ext="$avail_ext $xxx" ;;
23720                 esac
23721                 ;;
23722         *)      avail_ext="$avail_ext $xxx"
23723                 ;;
23724         esac
23725 done
23726
23727 set X $avail_ext
23728 shift
23729 avail_ext="$*"
23730
23731 case "$onlyextensions" in
23732 '') ;;
23733 *)  keepextensions=''
23734     echo "You have requested that only certain extensions be included..." >&4
23735     for i in $onlyextensions; do
23736         case " $avail_ext " in
23737         *" $i "*)
23738             echo "Keeping extension $i."
23739             keepextensions="$keepextensions $i"
23740             ;;
23741         *) echo "Ignoring extension $i." ;;
23742         esac
23743     done
23744     avail_ext="$keepextensions"
23745     ;;
23746 esac
23747
23748 case "$noextensions" in
23749 '') ;;
23750 *)  keepextensions=''
23751     echo "You have requested that certain extensions be ignored..." >&4
23752     for i in $avail_ext; do
23753         case " $noextensions " in
23754         *" $i "*) echo "Ignoring extension $i." ;;
23755         *) echo "Keeping extension $i.";
23756            keepextensions="$keepextensions $i"
23757            ;;
23758         esac
23759     done
23760     avail_ext="$keepextensions"
23761     ;;
23762 esac
23763
23764 : Now see which nonxs extensions are supported on this system.
23765 : For now assume all are.
23766 nonxs_ext=''
23767 for xxx in $nonxs_extensions ; do
23768         case "$xxx" in
23769         VMS*)
23770                 ;;
23771         *)      nonxs_ext="$nonxs_ext $xxx"
23772                 ;;
23773         esac
23774 done
23775
23776 set X $nonxs_ext
23777 shift
23778 nonxs_ext="$*"
23779
23780 case $usedl in
23781 $define)
23782         $cat <<EOM
23783 A number of extensions are supplied with $package.  You may choose to
23784 compile these extensions for dynamic loading (the default), compile
23785 them into the $package executable (static loading), or not include
23786 them at all.  Answer "none" to include no extensions.
23787 Note that DynaLoader is always built and need not be mentioned here.
23788
23789 EOM
23790         case "$dynamic_ext" in
23791         '')
23792                 : Exclude those listed in static_ext
23793                 dflt=''
23794                 for xxx in $avail_ext; do
23795                         case " $static_ext " in
23796                         *" $xxx "*) ;;
23797                         *) dflt="$dflt $xxx" ;;
23798                         esac
23799                 done
23800                 set X $dflt
23801                 shift
23802                 dflt="$*"
23803                 ;;
23804         *)      dflt="$dynamic_ext"
23805                 # Perhaps we are reusing an old out-of-date config.sh.
23806                 case "$hint" in
23807                 previous)
23808                         if test X"$dynamic_ext" != X"$avail_ext"; then
23809                                 $cat <<EOM
23810 NOTICE:  Your previous config.sh list may be incorrect.
23811 The extensions now available to you are
23812         ${avail_ext}
23813 but the default list from your previous config.sh is
23814         ${dynamic_ext}
23815
23816 EOM
23817                         fi
23818                         ;;
23819                 esac
23820                 ;;
23821         esac
23822         case "$dflt" in
23823         '')     dflt=none;;
23824         esac
23825         rp="What extensions do you wish to load dynamically?"
23826         . ./myread
23827         case "$ans" in
23828         none) dynamic_ext=' ' ;;
23829         *) dynamic_ext="$ans" ;;
23830         esac
23831
23832         case "$static_ext" in
23833         '')
23834                 : Exclude those already listed in dynamic linking
23835                 dflt=''
23836                 for xxx in $avail_ext; do
23837                         case " $dynamic_ext " in
23838                         *" $xxx "*) ;;
23839                         *) dflt="$dflt $xxx" ;;
23840                         esac
23841                 done
23842                 set X $dflt
23843                 shift
23844                 dflt="$*"
23845                 ;;
23846         *)  dflt="$static_ext"
23847                 ;;
23848         esac
23849
23850         case "$dflt" in
23851         '')     dflt=none;;
23852         esac
23853         rp="What extensions do you wish to load statically?"
23854         . ./myread
23855         case "$ans" in
23856         none) static_ext=' ' ;;
23857         *) static_ext="$ans" ;;
23858         esac
23859         ;;
23860 *)
23861         $cat <<EOM
23862 A number of extensions are supplied with $package.  Answer "none"
23863 to include no extensions.
23864 Note that DynaLoader is always built and need not be mentioned here.
23865
23866 EOM
23867         case "$static_ext" in
23868         '') dflt="$avail_ext" ;;
23869         *)      dflt="$static_ext"
23870                 # Perhaps we are reusing an old out-of-date config.sh.
23871                 case "$hint" in
23872                 previous)
23873                         if test X"$static_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         ${static_ext}
23880
23881 EOM
23882                         fi
23883                         ;;
23884                 esac
23885                 ;;
23886         esac
23887         : Exclude those that are not xs extensions
23888         case "$dflt" in
23889         '')     dflt=none;;
23890         esac
23891         rp="What extensions do you wish to include?"
23892         . ./myread
23893         case "$ans" in
23894         none) static_ext=' ' ;;
23895         *) static_ext="$ans" ;;
23896         esac
23897         ;;
23898 esac
23899 #
23900 # Encode is a special case.  If we are building Encode as a static
23901 # extension, we need to explicitly list its subextensions as well.
23902 # For other nested extensions, this is handled automatically by
23903 # the appropriate Makefile.PL.
23904 case " $static_ext " in
23905         *" Encode "*) # Add the subextensions of Encode
23906         cd "$rsrc/cpan"
23907         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23908                 static_ext="$static_ext Encode/$xxx"
23909                 known_extensions="$known_extensions Encode/$xxx"
23910         done
23911         cd "$tdir"
23912         ;;
23913 esac
23914
23915 set X $dynamic_ext $static_ext $nonxs_ext
23916 shift
23917 extensions="$*"
23918
23919 # Sanity check:  We require an extension suitable for use with
23920 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23921 # should show up as failures in the test suite, but it's helpful to
23922 # catch them now.) The 'extensions' list is normally sorted
23923 # alphabetically, so we need to accept either
23924 #    DB_File ... Fcntl ... IO  ....
23925 # or something like
23926 #    Fcntl ... NDBM_File ... IO  ....
23927 case " $extensions"  in
23928 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23929 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23930 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23931 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23932    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23933    ;;
23934 esac
23935
23936 : Remove libraries needed only for extensions
23937 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23938 : The exception is SunOS 4.x, which needs them.
23939 case "${osname}X${osvers}" in
23940 sunos*X4*)
23941     perllibs="$libs"
23942     ;;
23943 *) case "$usedl" in
23944     $define|true|[yY]*)
23945             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23946             shift
23947             perllibs="$*"
23948             ;;
23949     *)  perllibs="$libs"
23950             ;;
23951     esac
23952     ;;
23953 esac
23954
23955 : Remove build directory name from cppstdin so it can be used from
23956 : either the present location or the final installed location.
23957 echo " "
23958 : Get out of the UU directory to get correct path name.
23959 cd ..
23960 case "$cppstdin" in
23961 `pwd`/cppstdin)
23962         echo "Stripping down cppstdin path name"
23963         cppstdin=cppstdin
23964         ;;
23965 esac
23966 cd UU
23967
23968 : end of configuration questions
23969 echo " "
23970 echo "End of configuration questions."
23971 echo " "
23972
23973 : back to where it started
23974 if test -d ../UU; then
23975         cd ..
23976 fi
23977
23978 : configuration may be unconditionally patched via a 'config.arch' file
23979 if $test -f config.arch; then
23980         echo "I see a config.arch file, loading it." >&4
23981         . ./config.arch
23982 fi
23983
23984 : configuration may be patched via a 'config.over' file
23985 if $test -f config.over; then
23986         echo " "
23987         dflt=y
23988         rp='I see a config.over file.  Do you wish to load it?'
23989         . UU/myread
23990         case "$ans" in
23991         n*) echo "OK, I'll ignore it.";;
23992         *)      . ./config.over
23993                 echo "Configuration override changes have been loaded."
23994                 ;;
23995         esac
23996 fi
23997
23998 : in case they want portability, strip down executable paths
23999 case "$d_portable" in
24000 "$define")
24001         echo " "
24002         echo "Stripping down executable paths..." >&4
24003         for file in $loclist $trylist; do
24004                 eval temp=\$$file
24005                 eval $file=`basename $temp`
24006         done
24007         ;;
24008 esac
24009
24010 : create config.sh file
24011 echo " "
24012 echo "Creating config.sh..." >&4
24013 $spitshell <<EOT >config.sh
24014 $startsh
24015 #
24016 # This file was produced by running the Configure script. It holds all the
24017 # definitions figured out by Configure. Should you modify one of these values,
24018 # do not forget to propagate your changes by running "Configure -der". You may
24019 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24020 #
24021
24022 # Package name      : $package
24023 # Source directory  : $src
24024 # Configuration time: $cf_time
24025 # Configured by     : $cf_by
24026 # Target system     : $myuname
24027
24028 EOT
24029 : Add in command line options if available
24030 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24031
24032 $spitshell <<EOT >>config.sh
24033
24034 Author='$Author'
24035 Date='$Date'
24036 Header='$Header'
24037 Id='$Id'
24038 Locker='$Locker'
24039 Log='$Log'
24040 RCSfile='$RCSfile'
24041 Revision='$Revision'
24042 Source='$Source'
24043 State='$State'
24044 _a='$_a'
24045 _exe='$_exe'
24046 _o='$_o'
24047 afs='$afs'
24048 afsroot='$afsroot'
24049 alignbytes='$alignbytes'
24050 ansi2knr='$ansi2knr'
24051 aphostname='$aphostname'
24052 api_revision='$api_revision'
24053 api_subversion='$api_subversion'
24054 api_version='$api_version'
24055 api_versionstring='$api_versionstring'
24056 ar='$ar'
24057 archlib='$archlib'
24058 archlibexp='$archlibexp'
24059 archname64='$archname64'
24060 archname='$archname'
24061 archobjs='$archobjs'
24062 asctime_r_proto='$asctime_r_proto'
24063 awk='$awk'
24064 baserev='$baserev'
24065 bash='$bash'
24066 bin='$bin'
24067 bin_ELF='$bin_ELF'
24068 binexp='$binexp'
24069 bison='$bison'
24070 byacc='$byacc'
24071 byteorder='$byteorder'
24072 c='$c'
24073 castflags='$castflags'
24074 cat='$cat'
24075 cc='$cc'
24076 cccdlflags='$cccdlflags'
24077 ccdlflags='$ccdlflags'
24078 ccflags='$ccflags'
24079 ccflags_uselargefiles='$ccflags_uselargefiles'
24080 ccname='$ccname'
24081 ccsymbols='$ccsymbols'
24082 ccversion='$ccversion'
24083 cf_by='$cf_by'
24084 cf_email='$cf_email'
24085 cf_time='$cf_time'
24086 charbits='$charbits'
24087 charsize='$charsize'
24088 chgrp='$chgrp'
24089 chmod='$chmod'
24090 chown='$chown'
24091 clocktype='$clocktype'
24092 comm='$comm'
24093 compress='$compress'
24094 contains='$contains'
24095 cp='$cp'
24096 cpio='$cpio'
24097 cpp='$cpp'
24098 cpp_stuff='$cpp_stuff'
24099 cppccsymbols='$cppccsymbols'
24100 cppflags='$cppflags'
24101 cpplast='$cpplast'
24102 cppminus='$cppminus'
24103 cpprun='$cpprun'
24104 cppstdin='$cppstdin'
24105 cppsymbols='$cppsymbols'
24106 crypt_r_proto='$crypt_r_proto'
24107 cryptlib='$cryptlib'
24108 csh='$csh'
24109 ctermid_r_proto='$ctermid_r_proto'
24110 ctime_r_proto='$ctime_r_proto'
24111 d_Gconvert='$d_Gconvert'
24112 d_PRIEUldbl='$d_PRIEUldbl'
24113 d_PRIFUldbl='$d_PRIFUldbl'
24114 d_PRIGUldbl='$d_PRIGUldbl'
24115 d_PRIXU64='$d_PRIXU64'
24116 d_PRId64='$d_PRId64'
24117 d_PRIeldbl='$d_PRIeldbl'
24118 d_PRIfldbl='$d_PRIfldbl'
24119 d_PRIgldbl='$d_PRIgldbl'
24120 d_PRIi64='$d_PRIi64'
24121 d_PRIo64='$d_PRIo64'
24122 d_PRIu64='$d_PRIu64'
24123 d_PRIx64='$d_PRIx64'
24124 d_SCNfldbl='$d_SCNfldbl'
24125 d__fwalk='$d__fwalk'
24126 d_access='$d_access'
24127 d_accessx='$d_accessx'
24128 d_acosh='$d_acosh'
24129 d_aintl='$d_aintl'
24130 d_alarm='$d_alarm'
24131 d_archlib='$d_archlib'
24132 d_asctime64='$d_asctime64'
24133 d_asctime_r='$d_asctime_r'
24134 d_asinh='$d_asinh'
24135 d_atanh='$d_atanh'
24136 d_atolf='$d_atolf'
24137 d_atoll='$d_atoll'
24138 d_attribute_deprecated='$d_attribute_deprecated'
24139 d_attribute_format='$d_attribute_format'
24140 d_attribute_malloc='$d_attribute_malloc'
24141 d_attribute_nonnull='$d_attribute_nonnull'
24142 d_attribute_noreturn='$d_attribute_noreturn'
24143 d_attribute_pure='$d_attribute_pure'
24144 d_attribute_unused='$d_attribute_unused'
24145 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24146 d_backtrace='$d_backtrace'
24147 d_bcmp='$d_bcmp'
24148 d_bcopy='$d_bcopy'
24149 d_bsd='$d_bsd'
24150 d_bsdgetpgrp='$d_bsdgetpgrp'
24151 d_bsdsetpgrp='$d_bsdsetpgrp'
24152 d_builtin_choose_expr='$d_builtin_choose_expr'
24153 d_builtin_expect='$d_builtin_expect'
24154 d_bzero='$d_bzero'
24155 d_c99_variadic_macros='$d_c99_variadic_macros'
24156 d_casti32='$d_casti32'
24157 d_castneg='$d_castneg'
24158 d_cbrt='$d_cbrt'
24159 d_charvspr='$d_charvspr'
24160 d_chown='$d_chown'
24161 d_chroot='$d_chroot'
24162 d_chsize='$d_chsize'
24163 d_class='$d_class'
24164 d_clearenv='$d_clearenv'
24165 d_closedir='$d_closedir'
24166 d_cmsghdr_s='$d_cmsghdr_s'
24167 d_const='$d_const'
24168 d_copysign='$d_copysign'
24169 d_copysignl='$d_copysignl'
24170 d_cplusplus='$d_cplusplus'
24171 d_crypt='$d_crypt'
24172 d_crypt_r='$d_crypt_r'
24173 d_csh='$d_csh'
24174 d_ctermid='$d_ctermid'
24175 d_ctermid_r='$d_ctermid_r'
24176 d_ctime64='$d_ctime64'
24177 d_ctime_r='$d_ctime_r'
24178 d_cuserid='$d_cuserid'
24179 d_dbl_dig='$d_dbl_dig'
24180 d_dbminitproto='$d_dbminitproto'
24181 d_difftime64='$d_difftime64'
24182 d_difftime='$d_difftime'
24183 d_dir_dd_fd='$d_dir_dd_fd'
24184 d_dirfd='$d_dirfd'
24185 d_dirnamlen='$d_dirnamlen'
24186 d_dladdr='$d_dladdr'
24187 d_dlerror='$d_dlerror'
24188 d_dlopen='$d_dlopen'
24189 d_dlsymun='$d_dlsymun'
24190 d_dosuid='$d_dosuid'
24191 d_drand48_r='$d_drand48_r'
24192 d_drand48proto='$d_drand48proto'
24193 d_dup2='$d_dup2'
24194 d_eaccess='$d_eaccess'
24195 d_endgrent='$d_endgrent'
24196 d_endgrent_r='$d_endgrent_r'
24197 d_endhent='$d_endhent'
24198 d_endhostent_r='$d_endhostent_r'
24199 d_endnent='$d_endnent'
24200 d_endnetent_r='$d_endnetent_r'
24201 d_endpent='$d_endpent'
24202 d_endprotoent_r='$d_endprotoent_r'
24203 d_endpwent='$d_endpwent'
24204 d_endpwent_r='$d_endpwent_r'
24205 d_endsent='$d_endsent'
24206 d_endservent_r='$d_endservent_r'
24207 d_eofnblk='$d_eofnblk'
24208 d_erf='$d_erf'
24209 d_erfc='$d_erfc'
24210 d_eunice='$d_eunice'
24211 d_exp2='$d_exp2'
24212 d_expm1='$d_expm1'
24213 d_faststdio='$d_faststdio'
24214 d_fchdir='$d_fchdir'
24215 d_fchmod='$d_fchmod'
24216 d_fchown='$d_fchown'
24217 d_fcntl='$d_fcntl'
24218 d_fcntl_can_lock='$d_fcntl_can_lock'
24219 d_fd_macros='$d_fd_macros'
24220 d_fd_set='$d_fd_set'
24221 d_fdclose='$d_fdclose'
24222 d_fdim='$d_fdim'
24223 d_fds_bits='$d_fds_bits'
24224 d_fegetround='$d_fegetround'
24225 d_fgetpos='$d_fgetpos'
24226 d_finite='$d_finite'
24227 d_finitel='$d_finitel'
24228 d_flexfnam='$d_flexfnam'
24229 d_flock='$d_flock'
24230 d_flockproto='$d_flockproto'
24231 d_fma='$d_fma'
24232 d_fmax='$d_fmax'
24233 d_fmin='$d_fmin'
24234 d_fork='$d_fork'
24235 d_fp_class='$d_fp_class'
24236 d_fp_classify='$d_fp_classify'
24237 d_fp_classl='$d_fp_classl'
24238 d_fpathconf='$d_fpathconf'
24239 d_fpclass='$d_fpclass'
24240 d_fpclassify='$d_fpclassify'
24241 d_fpclassl='$d_fpclassl'
24242 d_fpgetround='$d_fpgetround'
24243 d_fpos64_t='$d_fpos64_t'
24244 d_frexpl='$d_frexpl'
24245 d_fs_data_s='$d_fs_data_s'
24246 d_fseeko='$d_fseeko'
24247 d_fsetpos='$d_fsetpos'
24248 d_fstatfs='$d_fstatfs'
24249 d_fstatvfs='$d_fstatvfs'
24250 d_fsync='$d_fsync'
24251 d_ftello='$d_ftello'
24252 d_ftime='$d_ftime'
24253 d_futimes='$d_futimes'
24254 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24255 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24256 d_getaddrinfo='$d_getaddrinfo'
24257 d_getcwd='$d_getcwd'
24258 d_getespwnam='$d_getespwnam'
24259 d_getfsstat='$d_getfsstat'
24260 d_getgrent='$d_getgrent'
24261 d_getgrent_r='$d_getgrent_r'
24262 d_getgrgid_r='$d_getgrgid_r'
24263 d_getgrnam_r='$d_getgrnam_r'
24264 d_getgrps='$d_getgrps'
24265 d_gethbyaddr='$d_gethbyaddr'
24266 d_gethbyname='$d_gethbyname'
24267 d_gethent='$d_gethent'
24268 d_gethname='$d_gethname'
24269 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24270 d_gethostbyname_r='$d_gethostbyname_r'
24271 d_gethostent_r='$d_gethostent_r'
24272 d_gethostprotos='$d_gethostprotos'
24273 d_getitimer='$d_getitimer'
24274 d_getlogin='$d_getlogin'
24275 d_getlogin_r='$d_getlogin_r'
24276 d_getmnt='$d_getmnt'
24277 d_getmntent='$d_getmntent'
24278 d_getnameinfo='$d_getnameinfo'
24279 d_getnbyaddr='$d_getnbyaddr'
24280 d_getnbyname='$d_getnbyname'
24281 d_getnent='$d_getnent'
24282 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24283 d_getnetbyname_r='$d_getnetbyname_r'
24284 d_getnetent_r='$d_getnetent_r'
24285 d_getnetprotos='$d_getnetprotos'
24286 d_getpagsz='$d_getpagsz'
24287 d_getpbyname='$d_getpbyname'
24288 d_getpbynumber='$d_getpbynumber'
24289 d_getpent='$d_getpent'
24290 d_getpgid='$d_getpgid'
24291 d_getpgrp2='$d_getpgrp2'
24292 d_getpgrp='$d_getpgrp'
24293 d_getppid='$d_getppid'
24294 d_getprior='$d_getprior'
24295 d_getprotobyname_r='$d_getprotobyname_r'
24296 d_getprotobynumber_r='$d_getprotobynumber_r'
24297 d_getprotoent_r='$d_getprotoent_r'
24298 d_getprotoprotos='$d_getprotoprotos'
24299 d_getprpwnam='$d_getprpwnam'
24300 d_getpwent='$d_getpwent'
24301 d_getpwent_r='$d_getpwent_r'
24302 d_getpwnam_r='$d_getpwnam_r'
24303 d_getpwuid_r='$d_getpwuid_r'
24304 d_getsbyname='$d_getsbyname'
24305 d_getsbyport='$d_getsbyport'
24306 d_getsent='$d_getsent'
24307 d_getservbyname_r='$d_getservbyname_r'
24308 d_getservbyport_r='$d_getservbyport_r'
24309 d_getservent_r='$d_getservent_r'
24310 d_getservprotos='$d_getservprotos'
24311 d_getspnam='$d_getspnam'
24312 d_getspnam_r='$d_getspnam_r'
24313 d_gettimeod='$d_gettimeod'
24314 d_gmtime64='$d_gmtime64'
24315 d_gmtime_r='$d_gmtime_r'
24316 d_gnulibc='$d_gnulibc'
24317 d_grpasswd='$d_grpasswd'
24318 d_hasmntopt='$d_hasmntopt'
24319 d_htonl='$d_htonl'
24320 d_hypot='$d_hypot'
24321 d_ilogb='$d_ilogb'
24322 d_ilogbl='$d_ilogbl'
24323 d_inc_version_list='$d_inc_version_list'
24324 d_index='$d_index'
24325 d_inetaton='$d_inetaton'
24326 d_inetntop='$d_inetntop'
24327 d_inetpton='$d_inetpton'
24328 d_int64_t='$d_int64_t'
24329 d_ip_mreq='$d_ip_mreq'
24330 d_ip_mreq_source='$d_ip_mreq_source'
24331 d_ipv6_mreq='$d_ipv6_mreq'
24332 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24333 d_isascii='$d_isascii'
24334 d_isblank='$d_isblank'
24335 d_isfinite='$d_isfinite'
24336 d_isfinitel='$d_isfinitel'
24337 d_isinf='$d_isinf'
24338 d_isinfl='$d_isinfl'
24339 d_isless='$d_isless'
24340 d_isnan='$d_isnan'
24341 d_isnanl='$d_isnanl'
24342 d_isnormal='$d_isnormal'
24343 d_j0='$d_j0'
24344 d_j0l='$d_j0l'
24345 d_killpg='$d_killpg'
24346 d_lc_monetary_2008='$d_lc_monetary_2008'
24347 d_lchown='$d_lchown'
24348 d_ldbl_dig='$d_ldbl_dig'
24349 d_ldexpl='$d_ldexpl'
24350 d_lgamma='$d_lgamma'
24351 d_lgamma_r='$d_lgamma_r'
24352 d_libm_lib_version='$d_libm_lib_version'
24353 d_libname_unique='$d_libname_unique'
24354 d_link='$d_link'
24355 d_llrint='$d_llrint'
24356 d_llrintl='$d_llrintl'
24357 d_llround='$d_llround'
24358 d_llroundl='$d_llroundl'
24359 d_localtime64='$d_localtime64'
24360 d_localtime_r='$d_localtime_r'
24361 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24362 d_locconv='$d_locconv'
24363 d_lockf='$d_lockf'
24364 d_log1p='$d_log1p'
24365 d_log2='$d_log2'
24366 d_logb='$d_logb'
24367 d_longdbl='$d_longdbl'
24368 d_longlong='$d_longlong'
24369 d_lrint='$d_lrint'
24370 d_lrintl='$d_lrintl'
24371 d_lround='$d_lround'
24372 d_lroundl='$d_lroundl'
24373 d_lseekproto='$d_lseekproto'
24374 d_lstat='$d_lstat'
24375 d_madvise='$d_madvise'
24376 d_malloc_good_size='$d_malloc_good_size'
24377 d_malloc_size='$d_malloc_size'
24378 d_mblen='$d_mblen'
24379 d_mbstowcs='$d_mbstowcs'
24380 d_mbtowc='$d_mbtowc'
24381 d_memchr='$d_memchr'
24382 d_memcmp='$d_memcmp'
24383 d_memcpy='$d_memcpy'
24384 d_memmove='$d_memmove'
24385 d_memset='$d_memset'
24386 d_mkdir='$d_mkdir'
24387 d_mkdtemp='$d_mkdtemp'
24388 d_mkfifo='$d_mkfifo'
24389 d_mkstemp='$d_mkstemp'
24390 d_mkstemps='$d_mkstemps'
24391 d_mktime64='$d_mktime64'
24392 d_mktime='$d_mktime'
24393 d_mmap='$d_mmap'
24394 d_modfl='$d_modfl'
24395 d_modfl_pow32_bug='$d_modfl_pow32_bug'
24396 d_modflproto='$d_modflproto'
24397 d_mprotect='$d_mprotect'
24398 d_msg='$d_msg'
24399 d_msg_ctrunc='$d_msg_ctrunc'
24400 d_msg_dontroute='$d_msg_dontroute'
24401 d_msg_oob='$d_msg_oob'
24402 d_msg_peek='$d_msg_peek'
24403 d_msg_proxy='$d_msg_proxy'
24404 d_msgctl='$d_msgctl'
24405 d_msgget='$d_msgget'
24406 d_msghdr_s='$d_msghdr_s'
24407 d_msgrcv='$d_msgrcv'
24408 d_msgsnd='$d_msgsnd'
24409 d_msync='$d_msync'
24410 d_munmap='$d_munmap'
24411 d_mymalloc='$d_mymalloc'
24412 d_nan='$d_nan'
24413 d_ndbm='$d_ndbm'
24414 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24415 d_nearbyint='$d_nearbyint'
24416 d_nextafter='$d_nextafter'
24417 d_nexttoward='$d_nexttoward'
24418 d_nice='$d_nice'
24419 d_nl_langinfo='$d_nl_langinfo'
24420 d_nv_preserves_uv='$d_nv_preserves_uv'
24421 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24422 d_off64_t='$d_off64_t'
24423 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24424 d_oldpthreads='$d_oldpthreads'
24425 d_oldsock='$d_oldsock'
24426 d_open3='$d_open3'
24427 d_pathconf='$d_pathconf'
24428 d_pause='$d_pause'
24429 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24430 d_phostname='$d_phostname'
24431 d_pipe='$d_pipe'
24432 d_poll='$d_poll'
24433 d_portable='$d_portable'
24434 d_prctl='$d_prctl'
24435 d_prctl_set_name='$d_prctl_set_name'
24436 d_printf_format_null='$d_printf_format_null'
24437 d_procselfexe='$d_procselfexe'
24438 d_pseudofork='$d_pseudofork'
24439 d_pthread_atfork='$d_pthread_atfork'
24440 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24441 d_pthread_yield='$d_pthread_yield'
24442 d_ptrdiff_t='$d_ptrdiff_t'
24443 d_pwage='$d_pwage'
24444 d_pwchange='$d_pwchange'
24445 d_pwclass='$d_pwclass'
24446 d_pwcomment='$d_pwcomment'
24447 d_pwexpire='$d_pwexpire'
24448 d_pwgecos='$d_pwgecos'
24449 d_pwpasswd='$d_pwpasswd'
24450 d_pwquota='$d_pwquota'
24451 d_qgcvt='$d_qgcvt'
24452 d_quad='$d_quad'
24453 d_random_r='$d_random_r'
24454 d_re_comp='$d_re_comp'
24455 d_readdir64_r='$d_readdir64_r'
24456 d_readdir='$d_readdir'
24457 d_readdir_r='$d_readdir_r'
24458 d_readlink='$d_readlink'
24459 d_readv='$d_readv'
24460 d_recvmsg='$d_recvmsg'
24461 d_regcmp='$d_regcmp'
24462 d_regcomp='$d_regcomp'
24463 d_remainder='$d_remainder'
24464 d_remquo='$d_remquo'
24465 d_rename='$d_rename'
24466 d_rewinddir='$d_rewinddir'
24467 d_rint='$d_rint'
24468 d_rmdir='$d_rmdir'
24469 d_round='$d_round'
24470 d_safebcpy='$d_safebcpy'
24471 d_safemcpy='$d_safemcpy'
24472 d_sanemcmp='$d_sanemcmp'
24473 d_sbrkproto='$d_sbrkproto'
24474 d_scalbn='$d_scalbn'
24475 d_scalbnl='$d_scalbnl'
24476 d_sched_yield='$d_sched_yield'
24477 d_scm_rights='$d_scm_rights'
24478 d_seekdir='$d_seekdir'
24479 d_select='$d_select'
24480 d_sem='$d_sem'
24481 d_semctl='$d_semctl'
24482 d_semctl_semid_ds='$d_semctl_semid_ds'
24483 d_semctl_semun='$d_semctl_semun'
24484 d_semget='$d_semget'
24485 d_semop='$d_semop'
24486 d_sendmsg='$d_sendmsg'
24487 d_setegid='$d_setegid'
24488 d_seteuid='$d_seteuid'
24489 d_setgrent='$d_setgrent'
24490 d_setgrent_r='$d_setgrent_r'
24491 d_setgrps='$d_setgrps'
24492 d_sethent='$d_sethent'
24493 d_sethostent_r='$d_sethostent_r'
24494 d_setitimer='$d_setitimer'
24495 d_setlinebuf='$d_setlinebuf'
24496 d_setlocale='$d_setlocale'
24497 d_setlocale_r='$d_setlocale_r'
24498 d_setnent='$d_setnent'
24499 d_setnetent_r='$d_setnetent_r'
24500 d_setpent='$d_setpent'
24501 d_setpgid='$d_setpgid'
24502 d_setpgrp2='$d_setpgrp2'
24503 d_setpgrp='$d_setpgrp'
24504 d_setprior='$d_setprior'
24505 d_setproctitle='$d_setproctitle'
24506 d_setprotoent_r='$d_setprotoent_r'
24507 d_setpwent='$d_setpwent'
24508 d_setpwent_r='$d_setpwent_r'
24509 d_setregid='$d_setregid'
24510 d_setresgid='$d_setresgid'
24511 d_setresuid='$d_setresuid'
24512 d_setreuid='$d_setreuid'
24513 d_setrgid='$d_setrgid'
24514 d_setruid='$d_setruid'
24515 d_setsent='$d_setsent'
24516 d_setservent_r='$d_setservent_r'
24517 d_setsid='$d_setsid'
24518 d_setvbuf='$d_setvbuf'
24519 d_shm='$d_shm'
24520 d_shmat='$d_shmat'
24521 d_shmatprototype='$d_shmatprototype'
24522 d_shmctl='$d_shmctl'
24523 d_shmdt='$d_shmdt'
24524 d_shmget='$d_shmget'
24525 d_sigaction='$d_sigaction'
24526 d_signbit='$d_signbit'
24527 d_sigprocmask='$d_sigprocmask'
24528 d_sigsetjmp='$d_sigsetjmp'
24529 d_sin6_scope_id='$d_sin6_scope_id'
24530 d_sitearch='$d_sitearch'
24531 d_snprintf='$d_snprintf'
24532 d_sockaddr_in6='$d_sockaddr_in6'
24533 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24534 d_sockatmark='$d_sockatmark'
24535 d_sockatmarkproto='$d_sockatmarkproto'
24536 d_socket='$d_socket'
24537 d_socklen_t='$d_socklen_t'
24538 d_sockpair='$d_sockpair'
24539 d_socks5_init='$d_socks5_init'
24540 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24541 d_sqrtl='$d_sqrtl'
24542 d_srand48_r='$d_srand48_r'
24543 d_srandom_r='$d_srandom_r'
24544 d_sresgproto='$d_sresgproto'
24545 d_sresuproto='$d_sresuproto'
24546 d_stat='$d_stat'
24547 d_statblks='$d_statblks'
24548 d_statfs_f_flags='$d_statfs_f_flags'
24549 d_statfs_s='$d_statfs_s'
24550 d_static_inline='$d_static_inline'
24551 d_statvfs='$d_statvfs'
24552 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24553 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24554 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24555 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24556 d_stdio_stream_array='$d_stdio_stream_array'
24557 d_stdiobase='$d_stdiobase'
24558 d_stdstdio='$d_stdstdio'
24559 d_strchr='$d_strchr'
24560 d_strcoll='$d_strcoll'
24561 d_strctcpy='$d_strctcpy'
24562 d_strerrm='$d_strerrm'
24563 d_strerror='$d_strerror'
24564 d_strerror_r='$d_strerror_r'
24565 d_strftime='$d_strftime'
24566 d_strlcat='$d_strlcat'
24567 d_strlcpy='$d_strlcpy'
24568 d_strtod='$d_strtod'
24569 d_strtol='$d_strtol'
24570 d_strtold='$d_strtold'
24571 d_strtoll='$d_strtoll'
24572 d_strtoq='$d_strtoq'
24573 d_strtoul='$d_strtoul'
24574 d_strtoull='$d_strtoull'
24575 d_strtouq='$d_strtouq'
24576 d_strxfrm='$d_strxfrm'
24577 d_suidsafe='$d_suidsafe'
24578 d_symlink='$d_symlink'
24579 d_syscall='$d_syscall'
24580 d_syscallproto='$d_syscallproto'
24581 d_sysconf='$d_sysconf'
24582 d_sysernlst='$d_sysernlst'
24583 d_syserrlst='$d_syserrlst'
24584 d_system='$d_system'
24585 d_tcgetpgrp='$d_tcgetpgrp'
24586 d_tcsetpgrp='$d_tcsetpgrp'
24587 d_telldir='$d_telldir'
24588 d_telldirproto='$d_telldirproto'
24589 d_tgamma='$d_tgamma'
24590 d_time='$d_time'
24591 d_timegm='$d_timegm'
24592 d_times='$d_times'
24593 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24594 d_tm_tm_zone='$d_tm_tm_zone'
24595 d_tmpnam_r='$d_tmpnam_r'
24596 d_trunc='$d_trunc'
24597 d_truncate='$d_truncate'
24598 d_truncl='$d_truncl'
24599 d_ttyname_r='$d_ttyname_r'
24600 d_tzname='$d_tzname'
24601 d_u32align='$d_u32align'
24602 d_ualarm='$d_ualarm'
24603 d_umask='$d_umask'
24604 d_uname='$d_uname'
24605 d_union_semun='$d_union_semun'
24606 d_unordered='$d_unordered'
24607 d_unsetenv='$d_unsetenv'
24608 d_usleep='$d_usleep'
24609 d_usleepproto='$d_usleepproto'
24610 d_ustat='$d_ustat'
24611 d_vendorarch='$d_vendorarch'
24612 d_vendorbin='$d_vendorbin'
24613 d_vendorlib='$d_vendorlib'
24614 d_vendorscript='$d_vendorscript'
24615 d_vfork='$d_vfork'
24616 d_void_closedir='$d_void_closedir'
24617 d_voidsig='$d_voidsig'
24618 d_voidtty='$d_voidtty'
24619 d_volatile='$d_volatile'
24620 d_vprintf='$d_vprintf'
24621 d_vsnprintf='$d_vsnprintf'
24622 d_wait4='$d_wait4'
24623 d_waitpid='$d_waitpid'
24624 d_wcscmp='$d_wcscmp'
24625 d_wcstombs='$d_wcstombs'
24626 d_wcsxfrm='$d_wcsxfrm'
24627 d_wctomb='$d_wctomb'
24628 d_writev='$d_writev'
24629 d_xenix='$d_xenix'
24630 date='$date'
24631 db_hashtype='$db_hashtype'
24632 db_prefixtype='$db_prefixtype'
24633 db_version_major='$db_version_major'
24634 db_version_minor='$db_version_minor'
24635 db_version_patch='$db_version_patch'
24636 direntrytype='$direntrytype'
24637 dlext='$dlext'
24638 dlsrc='$dlsrc'
24639 doubleinfbytes='$doubleinfbytes'
24640 doublekind='$doublekind'
24641 doublemantbits='$doublemantbits'
24642 doublenanbytes='$doublenanbytes'
24643 doublesize='$doublesize'
24644 drand01='$drand01'
24645 drand48_r_proto='$drand48_r_proto'
24646 dtrace='$dtrace'
24647 dynamic_ext='$dynamic_ext'
24648 eagain='$eagain'
24649 ebcdic='$ebcdic'
24650 echo='$echo'
24651 egrep='$egrep'
24652 emacs='$emacs'
24653 endgrent_r_proto='$endgrent_r_proto'
24654 endhostent_r_proto='$endhostent_r_proto'
24655 endnetent_r_proto='$endnetent_r_proto'
24656 endprotoent_r_proto='$endprotoent_r_proto'
24657 endpwent_r_proto='$endpwent_r_proto'
24658 endservent_r_proto='$endservent_r_proto'
24659 eunicefix='$eunicefix'
24660 exe_ext='$exe_ext'
24661 expr='$expr'
24662 extensions='$extensions'
24663 extern_C='$extern_C'
24664 extras='$extras'
24665 fflushNULL='$fflushNULL'
24666 fflushall='$fflushall'
24667 find='$find'
24668 firstmakefile='$firstmakefile'
24669 flex='$flex'
24670 fpossize='$fpossize'
24671 fpostype='$fpostype'
24672 freetype='$freetype'
24673 from='$from'
24674 full_ar='$full_ar'
24675 full_csh='$full_csh'
24676 full_sed='$full_sed'
24677 gccansipedantic='$gccansipedantic'
24678 gccosandvers='$gccosandvers'
24679 gccversion='$gccversion'
24680 getgrent_r_proto='$getgrent_r_proto'
24681 getgrgid_r_proto='$getgrgid_r_proto'
24682 getgrnam_r_proto='$getgrnam_r_proto'
24683 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24684 gethostbyname_r_proto='$gethostbyname_r_proto'
24685 gethostent_r_proto='$gethostent_r_proto'
24686 getlogin_r_proto='$getlogin_r_proto'
24687 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24688 getnetbyname_r_proto='$getnetbyname_r_proto'
24689 getnetent_r_proto='$getnetent_r_proto'
24690 getprotobyname_r_proto='$getprotobyname_r_proto'
24691 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24692 getprotoent_r_proto='$getprotoent_r_proto'
24693 getpwent_r_proto='$getpwent_r_proto'
24694 getpwnam_r_proto='$getpwnam_r_proto'
24695 getpwuid_r_proto='$getpwuid_r_proto'
24696 getservbyname_r_proto='$getservbyname_r_proto'
24697 getservbyport_r_proto='$getservbyport_r_proto'
24698 getservent_r_proto='$getservent_r_proto'
24699 getspnam_r_proto='$getspnam_r_proto'
24700 gidformat='$gidformat'
24701 gidsign='$gidsign'
24702 gidsize='$gidsize'
24703 gidtype='$gidtype'
24704 glibpth='$glibpth'
24705 gmake='$gmake'
24706 gmtime_r_proto='$gmtime_r_proto'
24707 gnulibc_version='$gnulibc_version'
24708 grep='$grep'
24709 groupcat='$groupcat'
24710 groupstype='$groupstype'
24711 gzip='$gzip'
24712 h_fcntl='$h_fcntl'
24713 h_sysfile='$h_sysfile'
24714 hint='$hint'
24715 hostcat='$hostcat'
24716 hostgenerate='$hostgenerate'
24717 hostosname='$hostosname'
24718 hostperl='$hostperl'
24719 html1dir='$html1dir'
24720 html1direxp='$html1direxp'
24721 html3dir='$html3dir'
24722 html3direxp='$html3direxp'
24723 i16size='$i16size'
24724 i16type='$i16type'
24725 i32size='$i32size'
24726 i32type='$i32type'
24727 i64size='$i64size'
24728 i64type='$i64type'
24729 i8size='$i8size'
24730 i8type='$i8type'
24731 i_arpainet='$i_arpainet'
24732 i_assert='$i_assert'
24733 i_bfd='$i_bfd'
24734 i_bsdioctl='$i_bsdioctl'
24735 i_crypt='$i_crypt'
24736 i_db='$i_db'
24737 i_dbm='$i_dbm'
24738 i_dirent='$i_dirent'
24739 i_dlfcn='$i_dlfcn'
24740 i_execinfo='$i_execinfo'
24741 i_fcntl='$i_fcntl'
24742 i_fenv='$i_fenv'
24743 i_float='$i_float'
24744 i_fp='$i_fp'
24745 i_fp_class='$i_fp_class'
24746 i_gdbm='$i_gdbm'
24747 i_gdbm_ndbm='$i_gdbm_ndbm'
24748 i_gdbmndbm='$i_gdbmndbm'
24749 i_grp='$i_grp'
24750 i_ieeefp='$i_ieeefp'
24751 i_inttypes='$i_inttypes'
24752 i_langinfo='$i_langinfo'
24753 i_libutil='$i_libutil'
24754 i_limits='$i_limits'
24755 i_locale='$i_locale'
24756 i_machcthr='$i_machcthr'
24757 i_malloc='$i_malloc'
24758 i_mallocmalloc='$i_mallocmalloc'
24759 i_math='$i_math'
24760 i_memory='$i_memory'
24761 i_mntent='$i_mntent'
24762 i_ndbm='$i_ndbm'
24763 i_netdb='$i_netdb'
24764 i_neterrno='$i_neterrno'
24765 i_netinettcp='$i_netinettcp'
24766 i_niin='$i_niin'
24767 i_poll='$i_poll'
24768 i_prot='$i_prot'
24769 i_pthread='$i_pthread'
24770 i_pwd='$i_pwd'
24771 i_quadmath='$i_quadmath'
24772 i_rpcsvcdbm='$i_rpcsvcdbm'
24773 i_sgtty='$i_sgtty'
24774 i_shadow='$i_shadow'
24775 i_socks='$i_socks'
24776 i_stdarg='$i_stdarg'
24777 i_stdbool='$i_stdbool'
24778 i_stddef='$i_stddef'
24779 i_stdint='$i_stdint'
24780 i_stdlib='$i_stdlib'
24781 i_string='$i_string'
24782 i_sunmath='$i_sunmath'
24783 i_sysaccess='$i_sysaccess'
24784 i_sysdir='$i_sysdir'
24785 i_sysfile='$i_sysfile'
24786 i_sysfilio='$i_sysfilio'
24787 i_sysin='$i_sysin'
24788 i_sysioctl='$i_sysioctl'
24789 i_syslog='$i_syslog'
24790 i_sysmman='$i_sysmman'
24791 i_sysmode='$i_sysmode'
24792 i_sysmount='$i_sysmount'
24793 i_sysndir='$i_sysndir'
24794 i_sysparam='$i_sysparam'
24795 i_syspoll='$i_syspoll'
24796 i_sysresrc='$i_sysresrc'
24797 i_syssecrt='$i_syssecrt'
24798 i_sysselct='$i_sysselct'
24799 i_syssockio='$i_syssockio'
24800 i_sysstat='$i_sysstat'
24801 i_sysstatfs='$i_sysstatfs'
24802 i_sysstatvfs='$i_sysstatvfs'
24803 i_systime='$i_systime'
24804 i_systimek='$i_systimek'
24805 i_systimes='$i_systimes'
24806 i_systypes='$i_systypes'
24807 i_sysuio='$i_sysuio'
24808 i_sysun='$i_sysun'
24809 i_sysutsname='$i_sysutsname'
24810 i_sysvfs='$i_sysvfs'
24811 i_syswait='$i_syswait'
24812 i_termio='$i_termio'
24813 i_termios='$i_termios'
24814 i_time='$i_time'
24815 i_unistd='$i_unistd'
24816 i_ustat='$i_ustat'
24817 i_utime='$i_utime'
24818 i_values='$i_values'
24819 i_varargs='$i_varargs'
24820 i_varhdr='$i_varhdr'
24821 i_vfork='$i_vfork'
24822 ignore_versioned_solibs='$ignore_versioned_solibs'
24823 inc_version_list='$inc_version_list'
24824 inc_version_list_init='$inc_version_list_init'
24825 incpath='$incpath'
24826 incpth='$incpth'
24827 inews='$inews'
24828 initialinstalllocation='$initialinstalllocation'
24829 installarchlib='$installarchlib'
24830 installbin='$installbin'
24831 installhtml1dir='$installhtml1dir'
24832 installhtml3dir='$installhtml3dir'
24833 installman1dir='$installman1dir'
24834 installman3dir='$installman3dir'
24835 installprefix='$installprefix'
24836 installprefixexp='$installprefixexp'
24837 installprivlib='$installprivlib'
24838 installscript='$installscript'
24839 installsitearch='$installsitearch'
24840 installsitebin='$installsitebin'
24841 installsitehtml1dir='$installsitehtml1dir'
24842 installsitehtml3dir='$installsitehtml3dir'
24843 installsitelib='$installsitelib'
24844 installsiteman1dir='$installsiteman1dir'
24845 installsiteman3dir='$installsiteman3dir'
24846 installsitescript='$installsitescript'
24847 installstyle='$installstyle'
24848 installusrbinperl='$installusrbinperl'
24849 installvendorarch='$installvendorarch'
24850 installvendorbin='$installvendorbin'
24851 installvendorhtml1dir='$installvendorhtml1dir'
24852 installvendorhtml3dir='$installvendorhtml3dir'
24853 installvendorlib='$installvendorlib'
24854 installvendorman1dir='$installvendorman1dir'
24855 installvendorman3dir='$installvendorman3dir'
24856 installvendorscript='$installvendorscript'
24857 intsize='$intsize'
24858 issymlink='$issymlink'
24859 ivdformat='$ivdformat'
24860 ivsize='$ivsize'
24861 ivtype='$ivtype'
24862 known_extensions='$known_extensions'
24863 ksh='$ksh'
24864 ld='$ld'
24865 ld_can_script='$ld_can_script'
24866 lddlflags='$lddlflags'
24867 ldflags='$ldflags'
24868 ldflags_uselargefiles='$ldflags_uselargefiles'
24869 ldlibpthname='$ldlibpthname'
24870 less='$less'
24871 lib_ext='$lib_ext'
24872 libc='$libc'
24873 libperl='$libperl'
24874 libpth='$libpth'
24875 libs='$libs'
24876 libsdirs='$libsdirs'
24877 libsfiles='$libsfiles'
24878 libsfound='$libsfound'
24879 libspath='$libspath'
24880 libswanted='$libswanted'
24881 libswanted_uselargefiles='$libswanted_uselargefiles'
24882 line='$line'
24883 lint='$lint'
24884 lkflags='$lkflags'
24885 ln='$ln'
24886 lns='$lns'
24887 localtime_r_proto='$localtime_r_proto'
24888 locincpth='$locincpth'
24889 loclibpth='$loclibpth'
24890 longdblinfbytes='$longdblinfbytes'
24891 longdblkind='$longdblkind'
24892 longdblmantbits='$longdblmantbits'
24893 longdblnanbytes='$longdblnanbytes'
24894 longdblsize='$longdblsize'
24895 longlongsize='$longlongsize'
24896 longsize='$longsize'
24897 lp='$lp'
24898 lpr='$lpr'
24899 ls='$ls'
24900 lseeksize='$lseeksize'
24901 lseektype='$lseektype'
24902 mail='$mail'
24903 mailx='$mailx'
24904 make='$make'
24905 make_set_make='$make_set_make'
24906 mallocobj='$mallocobj'
24907 mallocsrc='$mallocsrc'
24908 malloctype='$malloctype'
24909 man1dir='$man1dir'
24910 man1direxp='$man1direxp'
24911 man1ext='$man1ext'
24912 man3dir='$man3dir'
24913 man3direxp='$man3direxp'
24914 man3ext='$man3ext'
24915 mips_type='$mips_type'
24916 mistrustnm='$mistrustnm'
24917 mkdir='$mkdir'
24918 mmaptype='$mmaptype'
24919 modetype='$modetype'
24920 more='$more'
24921 multiarch='$multiarch'
24922 mv='$mv'
24923 myarchname='$myarchname'
24924 mydomain='$mydomain'
24925 myhostname='$myhostname'
24926 myuname='$myuname'
24927 n='$n'
24928 need_va_copy='$need_va_copy'
24929 netdb_hlen_type='$netdb_hlen_type'
24930 netdb_host_type='$netdb_host_type'
24931 netdb_name_type='$netdb_name_type'
24932 netdb_net_type='$netdb_net_type'
24933 nm='$nm'
24934 nm_opt='$nm_opt'
24935 nm_so_opt='$nm_so_opt'
24936 nonxs_ext='$nonxs_ext'
24937 nroff='$nroff'
24938 nvEUformat='$nvEUformat'
24939 nvFUformat='$nvFUformat'
24940 nvGUformat='$nvGUformat'
24941 nv_overflows_integers_at='$nv_overflows_integers_at'
24942 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24943 nveformat='$nveformat'
24944 nvfformat='$nvfformat'
24945 nvgformat='$nvgformat'
24946 nvmantbits='$nvmantbits'
24947 nvsize='$nvsize'
24948 nvtype='$nvtype'
24949 o_nonblock='$o_nonblock'
24950 obj_ext='$obj_ext'
24951 old_pthread_create_joinable='$old_pthread_create_joinable'
24952 optimize='$optimize'
24953 orderlib='$orderlib'
24954 osname='$osname'
24955 osvers='$osvers'
24956 otherlibdirs='$otherlibdirs'
24957 package='$package'
24958 pager='$pager'
24959 passcat='$passcat'
24960 patchlevel='$patchlevel'
24961 path_sep='$path_sep'
24962 perl5='$perl5'
24963 perl='$perl'
24964 perl_patchlevel='$perl_patchlevel'
24965 perl_static_inline='$perl_static_inline'
24966 perladmin='$perladmin'
24967 perllibs='$perllibs'
24968 perlpath='$perlpath'
24969 pg='$pg'
24970 phostname='$phostname'
24971 pidtype='$pidtype'
24972 plibpth='$plibpth'
24973 pmake='$pmake'
24974 pr='$pr'
24975 prefix='$prefix'
24976 prefixexp='$prefixexp'
24977 privlib='$privlib'
24978 privlibexp='$privlibexp'
24979 procselfexe='$procselfexe'
24980 prototype='$prototype'
24981 ptrsize='$ptrsize'
24982 quadkind='$quadkind'
24983 quadtype='$quadtype'
24984 randbits='$randbits'
24985 randfunc='$randfunc'
24986 random_r_proto='$random_r_proto'
24987 randseedtype='$randseedtype'
24988 ranlib='$ranlib'
24989 rd_nodata='$rd_nodata'
24990 readdir64_r_proto='$readdir64_r_proto'
24991 readdir_r_proto='$readdir_r_proto'
24992 revision='$revision'
24993 rm='$rm'
24994 rm_try='$rm_try'
24995 rmail='$rmail'
24996 run='$run'
24997 runnm='$runnm'
24998 sGMTIME_max='$sGMTIME_max'
24999 sGMTIME_min='$sGMTIME_min'
25000 sLOCALTIME_max='$sLOCALTIME_max'
25001 sLOCALTIME_min='$sLOCALTIME_min'
25002 sPRIEUldbl='$sPRIEUldbl'
25003 sPRIFUldbl='$sPRIFUldbl'
25004 sPRIGUldbl='$sPRIGUldbl'
25005 sPRIXU64='$sPRIXU64'
25006 sPRId64='$sPRId64'
25007 sPRIeldbl='$sPRIeldbl'
25008 sPRIfldbl='$sPRIfldbl'
25009 sPRIgldbl='$sPRIgldbl'
25010 sPRIi64='$sPRIi64'
25011 sPRIo64='$sPRIo64'
25012 sPRIu64='$sPRIu64'
25013 sPRIx64='$sPRIx64'
25014 sSCNfldbl='$sSCNfldbl'
25015 sched_yield='$sched_yield'
25016 scriptdir='$scriptdir'
25017 scriptdirexp='$scriptdirexp'
25018 sed='$sed'
25019 seedfunc='$seedfunc'
25020 selectminbits='$selectminbits'
25021 selecttype='$selecttype'
25022 sendmail='$sendmail'
25023 setgrent_r_proto='$setgrent_r_proto'
25024 sethostent_r_proto='$sethostent_r_proto'
25025 setlocale_r_proto='$setlocale_r_proto'
25026 setnetent_r_proto='$setnetent_r_proto'
25027 setprotoent_r_proto='$setprotoent_r_proto'
25028 setpwent_r_proto='$setpwent_r_proto'
25029 setservent_r_proto='$setservent_r_proto'
25030 sh='$sh'
25031 shar='$shar'
25032 sharpbang='$sharpbang'
25033 shmattype='$shmattype'
25034 shortsize='$shortsize'
25035 shrpenv='$shrpenv'
25036 shsharp='$shsharp'
25037 sig_count='$sig_count'
25038 sig_name='$sig_name'
25039 sig_name_init='$sig_name_init'
25040 sig_num='$sig_num'
25041 sig_num_init='$sig_num_init'
25042 sig_size='$sig_size'
25043 signal_t='$signal_t'
25044 sitearch='$sitearch'
25045 sitearchexp='$sitearchexp'
25046 sitebin='$sitebin'
25047 sitebinexp='$sitebinexp'
25048 sitehtml1dir='$sitehtml1dir'
25049 sitehtml1direxp='$sitehtml1direxp'
25050 sitehtml3dir='$sitehtml3dir'
25051 sitehtml3direxp='$sitehtml3direxp'
25052 sitelib='$sitelib'
25053 sitelib_stem='$sitelib_stem'
25054 sitelibexp='$sitelibexp'
25055 siteman1dir='$siteman1dir'
25056 siteman1direxp='$siteman1direxp'
25057 siteman3dir='$siteman3dir'
25058 siteman3direxp='$siteman3direxp'
25059 siteprefix='$siteprefix'
25060 siteprefixexp='$siteprefixexp'
25061 sitescript='$sitescript'
25062 sitescriptexp='$sitescriptexp'
25063 sizesize='$sizesize'
25064 sizetype='$sizetype'
25065 sleep='$sleep'
25066 smail='$smail'
25067 so='$so'
25068 sockethdr='$sockethdr'
25069 socketlib='$socketlib'
25070 socksizetype='$socksizetype'
25071 sort='$sort'
25072 spackage='$spackage'
25073 spitshell='$spitshell'
25074 srand48_r_proto='$srand48_r_proto'
25075 srandom_r_proto='$srandom_r_proto'
25076 src='$src'
25077 ssizetype='$ssizetype'
25078 st_ino_sign='$st_ino_sign'
25079 st_ino_size='$st_ino_size'
25080 startperl='$startperl'
25081 startsh='$startsh'
25082 static_ext='$static_ext'
25083 stdchar='$stdchar'
25084 stdio_base='$stdio_base'
25085 stdio_bufsiz='$stdio_bufsiz'
25086 stdio_cnt='$stdio_cnt'
25087 stdio_filbuf='$stdio_filbuf'
25088 stdio_ptr='$stdio_ptr'
25089 stdio_stream_array='$stdio_stream_array'
25090 strerror_r_proto='$strerror_r_proto'
25091 strings='$strings'
25092 submit='$submit'
25093 subversion='$subversion'
25094 sysman='$sysman'
25095 sysroot='$sysroot'
25096 tail='$tail'
25097 tar='$tar'
25098 targetarch='$targetarch'
25099 targetdir='$targetdir'
25100 targetenv='$targetenv'
25101 targethost='$targethost'
25102 targetmkdir='$targetmkdir'
25103 targetport='$targetport'
25104 targetsh='$targetsh'
25105 tbl='$tbl'
25106 tee='$tee'
25107 test='$test'
25108 timeincl='$timeincl'
25109 timetype='$timetype'
25110 tmpnam_r_proto='$tmpnam_r_proto'
25111 to='$to'
25112 touch='$touch'
25113 tr='$tr'
25114 trnl='$trnl'
25115 troff='$troff'
25116 ttyname_r_proto='$ttyname_r_proto'
25117 u16size='$u16size'
25118 u16type='$u16type'
25119 u32size='$u32size'
25120 u32type='$u32type'
25121 u64size='$u64size'
25122 u64type='$u64type'
25123 u8size='$u8size'
25124 u8type='$u8type'
25125 uidformat='$uidformat'
25126 uidsign='$uidsign'
25127 uidsize='$uidsize'
25128 uidtype='$uidtype'
25129 uname='$uname'
25130 uniq='$uniq'
25131 uquadtype='$uquadtype'
25132 use5005threads='$use5005threads'
25133 use64bitall='$use64bitall'
25134 use64bitint='$use64bitint'
25135 usecbacktrace='$usecbacktrace'
25136 usecrosscompile='$usecrosscompile'
25137 usedevel='$usedevel'
25138 usedl='$usedl'
25139 usedtrace='$usedtrace'
25140 usefaststdio='$usefaststdio'
25141 useithreads='$useithreads'
25142 usekernprocpathname='$usekernprocpathname'
25143 uselargefiles='$uselargefiles'
25144 uselongdouble='$uselongdouble'
25145 usemallocwrap='$usemallocwrap'
25146 usemorebits='$usemorebits'
25147 usemultiplicity='$usemultiplicity'
25148 usemymalloc='$usemymalloc'
25149 usenm='$usenm'
25150 usensgetexecutablepath='$usensgetexecutablepath'
25151 useopcode='$useopcode'
25152 useperlio='$useperlio'
25153 useposix='$useposix'
25154 usequadmath='$usequadmath'
25155 usereentrant='$usereentrant'
25156 userelocatableinc='$userelocatableinc'
25157 useshrplib='$useshrplib'
25158 usesitecustomize='$usesitecustomize'
25159 usesocks='$usesocks'
25160 usethreads='$usethreads'
25161 usevendorprefix='$usevendorprefix'
25162 useversionedarchname='$useversionedarchname'
25163 usevfork='$usevfork'
25164 usrinc='$usrinc'
25165 uuname='$uuname'
25166 uvXUformat='$uvXUformat'
25167 uvoformat='$uvoformat'
25168 uvsize='$uvsize'
25169 uvtype='$uvtype'
25170 uvuformat='$uvuformat'
25171 uvxformat='$uvxformat'
25172 vaproto='$vaproto'
25173 vendorarch='$vendorarch'
25174 vendorarchexp='$vendorarchexp'
25175 vendorbin='$vendorbin'
25176 vendorbinexp='$vendorbinexp'
25177 vendorhtml1dir='$vendorhtml1dir'
25178 vendorhtml1direxp='$vendorhtml1direxp'
25179 vendorhtml3dir='$vendorhtml3dir'
25180 vendorhtml3direxp='$vendorhtml3direxp'
25181 vendorlib='$vendorlib'
25182 vendorlib_stem='$vendorlib_stem'
25183 vendorlibexp='$vendorlibexp'
25184 vendorman1dir='$vendorman1dir'
25185 vendorman1direxp='$vendorman1direxp'
25186 vendorman3dir='$vendorman3dir'
25187 vendorman3direxp='$vendorman3direxp'
25188 vendorprefix='$vendorprefix'
25189 vendorprefixexp='$vendorprefixexp'
25190 vendorscript='$vendorscript'
25191 vendorscriptexp='$vendorscriptexp'
25192 version='$version'
25193 version_patchlevel_string='$version_patchlevel_string'
25194 versiononly='$versiononly'
25195 vi='$vi'
25196 xlibpth='$xlibpth'
25197 yacc='$yacc'
25198 yaccflags='$yaccflags'
25199 zcat='$zcat'
25200 zip='$zip'
25201 EOT
25202
25203 : add special variables
25204 $test -f $src/patchlevel.h && \
25205 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25206 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25207 echo "PERL_CONFIG_SH=true" >>config.sh
25208
25209 : propagate old symbols
25210 if $test -f UU/config.sh; then
25211         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25212         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25213                 config.sh config.sh UU/oldconfig.sh |\
25214                 $sort | $uniq -u >UU/oldsyms
25215         set X `$cat UU/oldsyms`
25216         shift
25217         case $# in
25218         0) ;;
25219         *)
25220                 $cat <<EOM
25221 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25222 EOM
25223                 echo ": Variables propagated from previous config.sh file." >>config.sh
25224                 for sym in `$cat UU/oldsyms`; do
25225                         echo "    Propagating $hint variable "'$'"$sym..."
25226                         eval 'tmp="$'"${sym}"'"'
25227                         echo "$tmp" | \
25228                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25229                 done
25230                 ;;
25231         esac
25232 fi
25233
25234 : preserve RCS keywords in files with variable substitution, grrr
25235 Id='$Id'
25236
25237 : Finish up by extracting the .SH files
25238 case "$alldone" in
25239 exit)
25240         $rm -rf UU
25241         echo "Extraction done."
25242         exit 0
25243         ;;
25244 cont)
25245         ;;
25246 '')
25247         dflt=''
25248         nostick=true
25249         $cat <<EOM
25250
25251 If you'd like to make any changes to the config.sh file before I begin
25252 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25253
25254 EOM
25255         rp="Press return or use a shell escape to edit config.sh:"
25256         . UU/myread
25257         nostick=''
25258         case "$ans" in
25259         '') ;;
25260         *) : in case they cannot read
25261                 sh 1>&4 -c "$ans";;
25262         esac
25263         ;;
25264 esac
25265
25266 : if this fails, just run all the .SH files by hand
25267 . ./config.sh
25268
25269 echo " "
25270 exec 1>&4
25271 pwd=`pwd`
25272 . ./UU/extract
25273 cd "$pwd"
25274
25275 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25276         dflt=y
25277         case "$silent" in
25278         true) ;;
25279         *)
25280                 $cat <<EOM
25281
25282 Now you need to generate make dependencies by running "$make depend".
25283 You might prefer to run it in background: "$make depend > makedepend.out &"
25284 It can take a while, so you might not want to run it right now.
25285
25286 EOM
25287                 ;;
25288         esac
25289         rp="Run $make depend now?"
25290         . UU/myread
25291         case "$ans" in
25292         y*)
25293                 $make depend && echo "Now you must run '$make'."
25294                 ;;
25295         *)
25296                 echo "You must run '$make depend' then '$make'."
25297                 ;;
25298         esac
25299 elif test -f [Mm]akefile; then
25300         echo " "
25301         echo "Now you must run a $make."
25302 else
25303         echo "Configure done."
25304 fi
25305
25306 if $test -f Policy.sh; then
25307     $cat <<EOM
25308
25309 If you compile $package on a different machine or from a different object
25310 directory, copy the Policy.sh file from this object directory to the
25311 new one before you run Configure -- this will help you with most of
25312 the policy defaults.
25313
25314 EOM
25315 fi
25316 if $test -f config.msg; then
25317     echo "Hmm.  I also noted the following information while running:"
25318     echo " "
25319     $cat config.msg >&4
25320     $rm -f config.msg
25321 fi
25322 $rm -f kit*isdone ark*isdone
25323 $rm -rf UU
25324
25325 : End of Configure
25326