This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
update Maintainers.pl for new Module-Metadata
[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_fdim=''
479 d_fegetround=''
480 d_fgetpos=''
481 d_finite=''
482 d_finitel=''
483 d_flexfnam=''
484 d_flock=''
485 d_flockproto=''
486 d_fma=''
487 d_fmax=''
488 d_fmin=''
489 d_fork=''
490 d_fp_class=''
491 d_fp_classl=''
492 d_fpclass=''
493 d_fp_classify=''
494 d_fpclassify=''
495 d_fpclassl=''
496 d_fpgetround=''
497 d_fpos64_t=''
498 d_frexpl=''
499 d_fs_data_s=''
500 d_fseeko=''
501 d_fsetpos=''
502 d_fstatfs=''
503 d_fsync=''
504 d_ftello=''
505 d_ftime=''
506 d_gettimeod=''
507 d_futimes=''
508 d_Gconvert=''
509 d_getaddrinfo=''
510 d_getcwd=''
511 d_getespwnam=''
512 d_getfsstat=''
513 d_getgrent=''
514 d_getgrent_r=''
515 getgrent_r_proto=''
516 d_getgrgid_r=''
517 getgrgid_r_proto=''
518 d_getgrnam_r=''
519 getgrnam_r_proto=''
520 d_getgrps=''
521 d_gethbyaddr=''
522 d_gethbyname=''
523 d_gethent=''
524 aphostname=''
525 d_gethname=''
526 d_phostname=''
527 d_uname=''
528 d_gethostbyaddr_r=''
529 gethostbyaddr_r_proto=''
530 d_gethostbyname_r=''
531 gethostbyname_r_proto=''
532 d_gethostent_r=''
533 gethostent_r_proto=''
534 d_gethostprotos=''
535 d_getitimer=''
536 d_getlogin=''
537 d_getlogin_r=''
538 getlogin_r_proto=''
539 d_getmnt=''
540 d_getmntent=''
541 d_getnameinfo=''
542 d_getnbyaddr=''
543 d_getnbyname=''
544 d_getnent=''
545 d_getnetbyaddr_r=''
546 getnetbyaddr_r_proto=''
547 d_getnetbyname_r=''
548 getnetbyname_r_proto=''
549 d_getnetent_r=''
550 getnetent_r_proto=''
551 d_getnetprotos=''
552 d_getpagsz=''
553 d_getpent=''
554 d_getpgid=''
555 d_getpgrp2=''
556 d_bsdgetpgrp=''
557 d_getpgrp=''
558 d_getppid=''
559 d_getprior=''
560 d_getpbyname=''
561 d_getpbynumber=''
562 d_getprotobyname_r=''
563 getprotobyname_r_proto=''
564 d_getprotobynumber_r=''
565 getprotobynumber_r_proto=''
566 d_getprotoent_r=''
567 getprotoent_r_proto=''
568 d_getprotoprotos=''
569 d_getprpwnam=''
570 d_getpwent=''
571 d_getpwent_r=''
572 getpwent_r_proto=''
573 d_getpwnam_r=''
574 getpwnam_r_proto=''
575 d_getpwuid_r=''
576 getpwuid_r_proto=''
577 d_getsent=''
578 d_getservbyname_r=''
579 getservbyname_r_proto=''
580 d_getservbyport_r=''
581 getservbyport_r_proto=''
582 d_getservent_r=''
583 getservent_r_proto=''
584 d_getservprotos=''
585 d_getspnam=''
586 d_getspnam_r=''
587 getspnam_r_proto=''
588 d_getsbyname=''
589 d_getsbyport=''
590 d_gmtime_r=''
591 gmtime_r_proto=''
592 d_gnulibc=''
593 gnulibc_version=''
594 d_hasmntopt=''
595 d_htonl=''
596 d_hypot=''
597 d_ilogb=''
598 d_ilogbl=''
599 d_inetaton=''
600 d_inetntop=''
601 d_inetpton=''
602 d_int64_t=''
603 d_isascii=''
604 d_isblank=''
605 d_isfinite=''
606 d_isfinitel=''
607 d_isinf=''
608 d_isinfl=''
609 d_isless=''
610 d_isnan=''
611 d_isnanl=''
612 d_isnormal=''
613 d_j0=''
614 d_j0l=''
615 d_killpg=''
616 d_lc_monetary_2008=''
617 d_lchown=''
618 d_ldbl_dig=''
619 d_lgamma=''
620 d_lgamma_r=''
621 d_libm_lib_version=''
622 d_link=''
623 d_llrint=''
624 d_llrintl=''
625 d_llround=''
626 d_llroundl=''
627 d_localtime_r=''
628 d_localtime_r_needs_tzset=''
629 localtime_r_proto=''
630 d_locconv=''
631 d_lockf=''
632 d_log1p=''
633 d_log2=''
634 d_logb=''
635 d_ldexpl=''
636 d_longdbl=''
637 longdblkind=''
638 longdblsize=''
639 d_longlong=''
640 longlongsize=''
641 d_lrint=''
642 d_lrintl=''
643 d_lround=''
644 d_lroundl=''
645 d_lseekproto=''
646 d_lstat=''
647 d_madvise=''
648 d_malloc_good_size=''
649 d_malloc_size=''
650 d_mblen=''
651 d_mbstowcs=''
652 d_mbtowc=''
653 d_memchr=''
654 d_memcmp=''
655 d_memcpy=''
656 d_memmove=''
657 d_memset=''
658 d_mkdir=''
659 d_mkdtemp=''
660 d_mkfifo=''
661 d_mkstemp=''
662 d_mkstemps=''
663 d_mktime=''
664 d_mmap=''
665 mmaptype=''
666 d_modfl=''
667 d_modfl_pow32_bug=''
668 d_modflproto=''
669 d_mprotect=''
670 d_msg=''
671 d_msgctl=''
672 d_msgget=''
673 d_msghdr_s=''
674 d_msgrcv=''
675 d_msgsnd=''
676 d_msync=''
677 d_munmap=''
678 d_nan=''
679 d_nearbyint=''
680 d_nextafter=''
681 d_nexttoward=''
682 d_nice=''
683 d_nl_langinfo=''
684 d_off64_t=''
685 d_open3=''
686 d_fpathconf=''
687 d_pathconf=''
688 d_pause=''
689 d_pipe=''
690 d_poll=''
691 d_portable=''
692 d_prctl=''
693 d_prctl_set_name=''
694 d_procselfexe=''
695 procselfexe=''
696 d_old_pthread_create_joinable=''
697 old_pthread_create_joinable=''
698 d_pthread_atfork=''
699 d_pthread_attr_setscope=''
700 d_pthread_yield=''
701 d_sched_yield=''
702 sched_yield=''
703 d_ptrdiff_t=''
704 d_qgcvt=''
705 d_random_r=''
706 random_r_proto=''
707 d_readdir64_r=''
708 readdir64_r_proto=''
709 d_readdir=''
710 d_rewinddir=''
711 d_seekdir=''
712 d_telldir=''
713 d_readdir_r=''
714 readdir_r_proto=''
715 d_readlink=''
716 d_readv=''
717 d_recvmsg=''
718 d_re_comp=''
719 d_regcmp=''
720 d_regcomp=''
721 d_remainder=''
722 d_remquo=''
723 d_rename=''
724 d_rint=''
725 d_rmdir=''
726 d_round=''
727 d_safebcpy=''
728 d_safemcpy=''
729 d_sanemcmp=''
730 d_sbrkproto=''
731 d_scalbn=''
732 d_scalbnl=''
733 d_select=''
734 d_sem=''
735 d_semctl=''
736 d_semget=''
737 d_semop=''
738 d_sendmsg=''
739 d_setegid=''
740 d_seteuid=''
741 d_setgrent=''
742 d_setgrent_r=''
743 setgrent_r_proto=''
744 d_setgrps=''
745 d_sethent=''
746 d_sethostent_r=''
747 sethostent_r_proto=''
748 d_setitimer=''
749 d_setlinebuf=''
750 d_setlocale=''
751 d_setlocale_r=''
752 setlocale_r_proto=''
753 d_setnent=''
754 d_setnetent_r=''
755 setnetent_r_proto=''
756 d_setpent=''
757 d_setpgid=''
758 d_setpgrp2=''
759 d_bsdsetpgrp=''
760 d_setpgrp=''
761 d_setprior=''
762 d_setproctitle=''
763 d_setprotoent_r=''
764 setprotoent_r_proto=''
765 d_setpwent=''
766 d_setpwent_r=''
767 setpwent_r_proto=''
768 d_setregid=''
769 d_setresgid=''
770 d_setresuid=''
771 d_setreuid=''
772 d_setrgid=''
773 d_setruid=''
774 d_setsent=''
775 d_setservent_r=''
776 setservent_r_proto=''
777 d_setsid=''
778 d_setvbuf=''
779 d_shm=''
780 d_shmat=''
781 d_shmatprototype=''
782 shmattype=''
783 d_shmctl=''
784 d_shmdt=''
785 d_shmget=''
786 d_sigaction=''
787 d_signbit=''
788 d_sigprocmask=''
789 d_sigsetjmp=''
790 usesitecustomize=''
791 d_snprintf=''
792 d_vsnprintf=''
793 d_sockatmark=''
794 d_sockatmarkproto=''
795 d_ip_mreq=''
796 d_ip_mreq_source=''
797 d_ipv6_mreq=''
798 d_ipv6_mreq_source=''
799 d_msg_ctrunc=''
800 d_msg_dontroute=''
801 d_msg_oob=''
802 d_msg_peek=''
803 d_msg_proxy=''
804 d_oldsock=''
805 d_scm_rights=''
806 d_sin6_scope_id=''
807 d_sockaddr_in6=''
808 d_sockaddr_sa_len=''
809 d_socket=''
810 d_sockpair=''
811 sockethdr=''
812 socketlib=''
813 d_socklen_t=''
814 d_socks5_init=''
815 d_sprintf_returns_strlen=''
816 d_sqrtl=''
817 d_srand48_r=''
818 srand48_r_proto=''
819 d_srandom_r=''
820 srandom_r_proto=''
821 d_sresgproto=''
822 d_sresuproto=''
823 d_stat=''
824 d_statblks=''
825 d_statfs_f_flags=''
826 d_statfs_s=''
827 d_static_inline=''
828 perl_static_inline=''
829 d_fstatvfs=''
830 d_statvfs=''
831 d_stdio_cnt_lval=''
832 d_stdio_ptr_lval=''
833 d_stdio_ptr_lval_nochange_cnt=''
834 d_stdio_ptr_lval_sets_cnt=''
835 d_stdiobase=''
836 d_stdstdio=''
837 stdio_base=''
838 stdio_bufsiz=''
839 stdio_cnt=''
840 stdio_filbuf=''
841 stdio_ptr=''
842 d_index=''
843 d_strchr=''
844 d_strcoll=''
845 d_strctcpy=''
846 d_strerrm=''
847 d_strerror=''
848 d_sysernlst=''
849 d_syserrlst=''
850 d_strerror_r=''
851 strerror_r_proto=''
852 d_strftime=''
853 d_strlcat=''
854 d_strlcpy=''
855 d_strtod=''
856 d_strtol=''
857 d_strtold=''
858 d_strtoll=''
859 d_strtoq=''
860 d_strtoul=''
861 d_strtoull=''
862 d_strtouq=''
863 d_strxfrm=''
864 d_symlink=''
865 d_syscall=''
866 d_syscallproto=''
867 d_sysconf=''
868 d_system=''
869 d_tcgetpgrp=''
870 d_tcsetpgrp=''
871 d_telldirproto=''
872 d_tgamma=''
873 d_time=''
874 timetype=''
875 d_asctime64=''
876 d_ctime64=''
877 d_difftime64=''
878 d_gmtime64=''
879 d_localtime64=''
880 d_mktime64=''
881 d_timegm=''
882 clocktype=''
883 d_times=''
884 d_tmpnam_r=''
885 tmpnam_r_proto=''
886 d_trunc=''
887 d_truncate=''
888 d_truncl=''
889 d_ttyname_r=''
890 ttyname_r_proto=''
891 d_tzname=''
892 d_u32align=''
893 d_ualarm=''
894 d_umask=''
895 d_semctl_semid_ds=''
896 d_semctl_semun=''
897 d_union_semun=''
898 d_unordered=''
899 d_unsetenv=''
900 d_usleep=''
901 d_usleepproto=''
902 d_ustat=''
903 d_pseudofork=''
904 d_vfork=''
905 usevfork=''
906 d_voidsig=''
907 signal_t=''
908 d_volatile=''
909 d_charvspr=''
910 d_vprintf=''
911 d_wait4=''
912 d_waitpid=''
913 d_wcscmp=''
914 d_wcstombs=''
915 d_wcsxfrm=''
916 d_wctomb=''
917 d_writev=''
918 dlext=''
919 bin_ELF=''
920 cccdlflags=''
921 ccdlflags=''
922 dlsrc=''
923 ld=''
924 ld_can_script=''
925 lddlflags=''
926 usedl=''
927 doublesize=''
928 ebcdic=''
929 fflushNULL=''
930 fflushall=''
931 fpossize=''
932 fpostype=''
933 gccansipedantic=''
934 gccosandvers=''
935 gccversion=''
936 gidformat=''
937 gidsign=''
938 gidsize=''
939 gidtype=''
940 groupstype=''
941 h_fcntl=''
942 h_sysfile=''
943 html1dir=''
944 html1direxp=''
945 installhtml1dir=''
946 html3dir=''
947 html3direxp=''
948 installhtml3dir=''
949 i_arpainet=''
950 i_assert=''
951 i_bfd=''
952 i_crypt=''
953 db_hashtype=''
954 db_prefixtype=''
955 db_version_major=''
956 db_version_minor=''
957 db_version_patch=''
958 i_db=''
959 i_dbm=''
960 i_rpcsvcdbm=''
961 d_dirnamlen=''
962 direntrytype=''
963 i_dirent=''
964 i_dlfcn=''
965 i_execinfo=''
966 i_fcntl=''
967 i_fenv=''
968 i_float=''
969 i_fp=''
970 i_fp_class=''
971 i_gdbm=''
972 d_grpasswd=''
973 i_grp=''
974 i_ieeefp=''
975 i_inttypes=''
976 i_langinfo=''
977 i_libutil=''
978 i_limits=''
979 i_locale=''
980 i_machcthr=''
981 i_malloc=''
982 i_mallocmalloc=''
983 i_math=''
984 i_memory=''
985 i_mntent=''
986 d_gdbm_ndbm_h_uses_prototypes=''
987 d_gdbmndbm_h_uses_prototypes=''
988 d_ndbm=''
989 d_ndbm_h_uses_prototypes=''
990 i_gdbm_ndbm=''
991 i_gdbmndbm=''
992 i_ndbm=''
993 i_netdb=''
994 i_neterrno=''
995 i_netinettcp=''
996 i_niin=''
997 i_sysin=''
998 i_poll=''
999 i_prot=''
1000 i_pthread=''
1001 d_pwage=''
1002 d_pwchange=''
1003 d_pwclass=''
1004 d_pwcomment=''
1005 d_pwexpire=''
1006 d_pwgecos=''
1007 d_pwpasswd=''
1008 d_pwquota=''
1009 i_pwd=''
1010 i_quadmath=''
1011 i_shadow=''
1012 i_socks=''
1013 i_stdbool=''
1014 i_stddef=''
1015 i_stdint=''
1016 i_stdlib=''
1017 i_string=''
1018 strings=''
1019 i_sunmath=''
1020 i_sysaccess=''
1021 i_sysdir=''
1022 i_sysfile=''
1023 d_voidtty=''
1024 i_bsdioctl=''
1025 i_sysfilio=''
1026 i_sysioctl=''
1027 i_syssockio=''
1028 i_syslog=''
1029 i_sysmman=''
1030 i_sysmode=''
1031 i_sysmount=''
1032 i_sysndir=''
1033 i_sysparam=''
1034 i_syspoll=''
1035 i_sysresrc=''
1036 i_syssecrt=''
1037 i_sysselct=''
1038 i_sysstat=''
1039 i_sysstatfs=''
1040 i_sysstatvfs=''
1041 i_systimes=''
1042 i_systypes=''
1043 i_sysuio=''
1044 i_sysun=''
1045 i_sysutsname=''
1046 i_sysvfs=''
1047 i_syswait=''
1048 i_sgtty=''
1049 i_termio=''
1050 i_termios=''
1051 d_tm_tm_gmtoff=''
1052 d_tm_tm_zone=''
1053 i_systime=''
1054 i_systimek=''
1055 i_time=''
1056 timeincl=''
1057 i_unistd=''
1058 i_ustat=''
1059 i_utime=''
1060 i_values=''
1061 i_stdarg=''
1062 i_varargs=''
1063 i_varhdr=''
1064 i_vfork=''
1065 d_inc_version_list=''
1066 inc_version_list=''
1067 inc_version_list_init=''
1068 doubleinfbytes=''
1069 doublenanbytes=''
1070 longdblinfbytes=''
1071 longdblnanbytes=''
1072 installprefix=''
1073 installprefixexp=''
1074 installstyle=''
1075 installusrbinperl=''
1076 intsize=''
1077 longsize=''
1078 shortsize=''
1079 issymlink=''
1080 libc=''
1081 ldlibpthname=''
1082 libperl=''
1083 shrpenv=''
1084 useshrplib=''
1085 glibpth=''
1086 incpth=''
1087 libpth=''
1088 loclibpth=''
1089 plibpth=''
1090 xlibpth=''
1091 ignore_versioned_solibs=''
1092 libs=''
1093 libsdirs=''
1094 libsfiles=''
1095 libsfound=''
1096 libspath=''
1097 lns=''
1098 d_PRIEUldbl=''
1099 d_PRIFUldbl=''
1100 d_PRIGUldbl=''
1101 d_PRIeldbl=''
1102 d_PRIfldbl=''
1103 d_PRIgldbl=''
1104 d_SCNfldbl=''
1105 doublekind=''
1106 sPRIEUldbl=''
1107 sPRIFUldbl=''
1108 sPRIGUldbl=''
1109 sPRIeldbl=''
1110 sPRIfldbl=''
1111 sPRIgldbl=''
1112 sSCNfldbl=''
1113 lseeksize=''
1114 lseektype=''
1115 make_set_make=''
1116 d_mymalloc=''
1117 freetype=''
1118 mallocobj=''
1119 mallocsrc=''
1120 malloctype=''
1121 usemallocwrap=''
1122 usemymalloc=''
1123 installman1dir=''
1124 man1dir=''
1125 man1direxp=''
1126 man1ext=''
1127 installman3dir=''
1128 man3dir=''
1129 man3direxp=''
1130 man3ext=''
1131 doublemantbits=''
1132 longdblmantbits=''
1133 nvmantbits=''
1134 modetype=''
1135 multiarch=''
1136 mydomain=''
1137 myhostname=''
1138 phostname=''
1139 c=''
1140 n=''
1141 d_eofnblk=''
1142 eagain=''
1143 o_nonblock=''
1144 rd_nodata=''
1145 need_va_copy=''
1146 netdb_hlen_type=''
1147 netdb_host_type=''
1148 netdb_name_type=''
1149 netdb_net_type=''
1150 groupcat=''
1151 hostcat=''
1152 passcat=''
1153 orderlib=''
1154 ranlib=''
1155 d_perl_otherlibdirs=''
1156 otherlibdirs=''
1157 package=''
1158 spackage=''
1159 pager=''
1160 api_revision=''
1161 api_subversion=''
1162 api_version=''
1163 api_versionstring=''
1164 patchlevel=''
1165 perl_patchlevel=''
1166 revision=''
1167 subversion=''
1168 version=''
1169 version_patchlevel_string=''
1170 perl5=''
1171 perladmin=''
1172 perlpath=''
1173 d_nv_preserves_uv=''
1174 d_nv_zero_is_allbits_zero=''
1175 i16size=''
1176 i16type=''
1177 i32size=''
1178 i32type=''
1179 i64size=''
1180 i64type=''
1181 i8size=''
1182 i8type=''
1183 ivsize=''
1184 ivtype=''
1185 nv_overflows_integers_at=''
1186 nv_preserves_uv_bits=''
1187 nvsize=''
1188 nvtype=''
1189 u16size=''
1190 u16type=''
1191 u32size=''
1192 u32type=''
1193 u64size=''
1194 u64type=''
1195 u8size=''
1196 u8type=''
1197 uvsize=''
1198 uvtype=''
1199 ivdformat=''
1200 nvEUformat=''
1201 nvFUformat=''
1202 nvGUformat=''
1203 nveformat=''
1204 nvfformat=''
1205 nvgformat=''
1206 uvXUformat=''
1207 uvoformat=''
1208 uvuformat=''
1209 uvxformat=''
1210 pidtype=''
1211 prefix=''
1212 prefixexp=''
1213 installprivlib=''
1214 privlib=''
1215 privlibexp=''
1216 prototype=''
1217 ptrsize=''
1218 d_PRIXU64=''
1219 d_PRId64=''
1220 d_PRIi64=''
1221 d_PRIo64=''
1222 d_PRIu64=''
1223 d_PRIx64=''
1224 sPRIXU64=''
1225 sPRId64=''
1226 sPRIi64=''
1227 sPRIo64=''
1228 sPRIu64=''
1229 sPRIx64=''
1230 d_quad=''
1231 quadkind=''
1232 quadtype=''
1233 uquadtype=''
1234 drand01=''
1235 randbits=''
1236 randfunc=''
1237 randseedtype=''
1238 seedfunc=''
1239 installscript=''
1240 scriptdir=''
1241 scriptdirexp=''
1242 selectminbits=''
1243 selecttype=''
1244 sh=''
1245 targetsh=''
1246 sig_count=''
1247 sig_name=''
1248 sig_name_init=''
1249 sig_num=''
1250 sig_num_init=''
1251 sig_size=''
1252 d_sitearch=''
1253 installsitearch=''
1254 sitearch=''
1255 sitearchexp=''
1256 installsitebin=''
1257 sitebin=''
1258 sitebinexp=''
1259 installsitehtml1dir=''
1260 sitehtml1dir=''
1261 sitehtml1direxp=''
1262 installsitehtml3dir=''
1263 sitehtml3dir=''
1264 sitehtml3direxp=''
1265 installsitelib=''
1266 sitelib=''
1267 sitelib_stem=''
1268 sitelibexp=''
1269 installsiteman1dir=''
1270 siteman1dir=''
1271 siteman1direxp=''
1272 installsiteman3dir=''
1273 siteman3dir=''
1274 siteman3direxp=''
1275 siteprefix=''
1276 siteprefixexp=''
1277 installsitescript=''
1278 sitescript=''
1279 sitescriptexp=''
1280 sizesize=''
1281 sizetype=''
1282 d_libname_unique=''
1283 so=''
1284 socksizetype=''
1285 sharpbang=''
1286 shsharp=''
1287 spitshell=''
1288 src=''
1289 ssizetype=''
1290 st_ino_sign=''
1291 st_ino_size=''
1292 startperl=''
1293 startsh=''
1294 stdchar=''
1295 d_stdio_stream_array=''
1296 stdio_stream_array=''
1297 sysman=''
1298 sGMTIME_max=''
1299 sGMTIME_min=''
1300 sLOCALTIME_max=''
1301 sLOCALTIME_min=''
1302 trnl=''
1303 uidformat=''
1304 uidsign=''
1305 uidsize=''
1306 uidtype=''
1307 archname64=''
1308 use64bitall=''
1309 use64bitint=''
1310 usecbacktrace=''
1311 dtrace=''
1312 usedtrace=''
1313 usefaststdio=''
1314 usekernprocpathname=''
1315 ccflags_uselargefiles=''
1316 ldflags_uselargefiles=''
1317 libswanted_uselargefiles=''
1318 uselargefiles=''
1319 uselongdouble=''
1320 usemorebits=''
1321 usemultiplicity=''
1322 nm_opt=''
1323 nm_so_opt=''
1324 runnm=''
1325 usenm=''
1326 usensgetexecutablepath=''
1327 useperlio=''
1328 usequadmath=''
1329 usesocks=''
1330 d_oldpthreads=''
1331 use5005threads=''
1332 useithreads=''
1333 usereentrant=''
1334 usethreads=''
1335 incpath=''
1336 mips_type=''
1337 usrinc=''
1338 vaproto=''
1339 d_vendorarch=''
1340 installvendorarch=''
1341 vendorarch=''
1342 vendorarchexp=''
1343 d_vendorbin=''
1344 installvendorbin=''
1345 vendorbin=''
1346 vendorbinexp=''
1347 installvendorhtml1dir=''
1348 vendorhtml1dir=''
1349 vendorhtml1direxp=''
1350 installvendorhtml3dir=''
1351 vendorhtml3dir=''
1352 vendorhtml3direxp=''
1353 d_vendorlib=''
1354 installvendorlib=''
1355 vendorlib=''
1356 vendorlib_stem=''
1357 vendorlibexp=''
1358 installvendorman1dir=''
1359 vendorman1dir=''
1360 vendorman1direxp=''
1361 installvendorman3dir=''
1362 vendorman3dir=''
1363 vendorman3direxp=''
1364 usevendorprefix=''
1365 vendorprefix=''
1366 vendorprefixexp=''
1367 d_vendorscript=''
1368 installvendorscript=''
1369 vendorscript=''
1370 vendorscriptexp=''
1371 versiononly=''
1372 yacc=''
1373 yaccflags=''
1374 CONFIG=''
1375
1376 : Detect odd OSs
1377 define='define'
1378 undef='undef'
1379 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1380 rmlist=''
1381
1382 : We must find out about Eunice early
1383 eunicefix=':'
1384 if test -f /etc/unixtovms; then
1385         eunicefix=/etc/unixtovms
1386 fi
1387 if test -f /etc/unixtovms.exe; then
1388         eunicefix=/etc/unixtovms.exe
1389 fi
1390
1391 : Set executable suffix now -- needed before hints available
1392 if test -f "/libs/version.library"; then
1393 : Amiga OS
1394     _exe=""
1395 elif test -f "/system/gnu_library/bin/ar.pm"; then
1396 : Stratus VOS
1397     _exe=".pm"
1398 elif test -n "$DJGPP"; then
1399 : DOS DJGPP
1400     _exe=".exe"
1401 elif test -f /kern/cookiejar; then
1402 : MiNT
1403     _exe=""
1404 elif test -d c:/. -o -n "$is_os2" ; then
1405 : OS/2 or cygwin
1406     _exe=".exe"
1407 fi
1408
1409 groupstype=''
1410 i_whoami=''
1411 : Trailing extension.  Override this in a hint file, if needed.
1412 : Extra object files, if any, needed on this platform.
1413 archobjs=''
1414 archname=''
1415 : Possible local include directories to search.
1416 : Set locincpth to "" in a hint file to defeat local include searches.
1417 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1418 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1419 :
1420 : no include file wanted by default
1421 inclwanted=''
1422
1423 : Enable -DEBUGGING and -DDEBUGGING from the command line
1424 EBUGGING=''
1425 DEBUGGING=''
1426
1427 libnames=''
1428 : change the next line if compiling for Xenix/286 on Xenix/386
1429 xlibpth='/usr/lib/386 /lib/386'
1430 : Possible local library directories to search.
1431 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1432 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1433
1434 : general looking path for locating libraries
1435 glibpth="/lib /usr/lib $xlibpth"
1436 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1437 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1438 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1439 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1440
1441 : Private path used by Configure to find libraries.  Its value
1442 : is prepended to libpth. This variable takes care of special
1443 : machines, like the mips.  Usually, it should be empty.
1444 plibpth=''
1445
1446 : default library list
1447 libswanted=''
1448 : some systems want to use only the non-versioned libso:s
1449 ignore_versioned_solibs=''
1450 : set usethreads on the Configure command line to enable threads.
1451 usereentrant='undef'
1452 ccname=''
1453 ccversion=''
1454 perllibs=''
1455 : set useposix=false in your hint file to disable the POSIX extension.
1456 useposix=true
1457 : set useopcode=false in your hint file to disable the Opcode extension.
1458 useopcode=true
1459 archname64=''
1460 ccflags_uselargefiles=''
1461 ldflags_uselargefiles=''
1462 libswanted_uselargefiles=''
1463 : set usemultiplicity on the Configure command line to enable multiplicity.
1464 : set usesocks on the Configure command line to enable socks.
1465 : List of libraries we want.
1466 : If anyone needs extra -lxxx, put those in a hint file.
1467 libswanted="cl pthread socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld"
1468 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1469 : We probably want to search /usr/shlib before most other libraries.
1470 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1471 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1472 glibpth="/usr/shlib $glibpth"
1473 : Do not use vfork unless overridden by a hint file.
1474 usevfork=false
1475
1476 : Find the basic shell for Bourne shell scripts
1477 case "$sh" in
1478 '')
1479         case "$SYSTYPE" in
1480         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1481         *) xxx='/bin/sh';;
1482         esac
1483         if test -f "$xxx"; then
1484                 sh="$xxx"
1485         else
1486                 : Build up a list and do a single loop so we can 'break' out.
1487                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1488                 for xxx in sh bash ksh pdksh ash; do
1489                         for p in $pth; do
1490                                 try="$try ${p}/${xxx}"
1491                         done
1492                 done
1493                 for xxx in $try; do
1494                         if test -f "$xxx"; then
1495                                 sh="$xxx";
1496                                 break
1497                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1498                                 sh="$xxx";
1499                                 break
1500                         elif test -f "$xxx.exe"; then
1501                                 sh="$xxx";
1502                                 break
1503                         fi
1504                 done
1505         fi
1506         ;;
1507 esac
1508
1509 case "$sh" in
1510 '')     cat >&2 <<EOM
1511 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1512
1513 Usually it's in /bin/sh.  How did you even get this far?
1514 Please contact me (Perl Maintainers) at perlbug@perl.org and
1515 we'll try to straighten this all out.
1516 EOM
1517         exit 1
1518         ;;
1519 esac
1520
1521 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1522 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1523 targetsh=$sh
1524
1525 : see if sh knows # comments
1526 if `$sh -c '#' >/dev/null 2>&1`; then
1527         shsharp=true
1528         spitshell=cat
1529         xcat=/bin/cat
1530         test -f $xcat$_exe || xcat=/usr/bin/cat
1531         if test ! -f $xcat$_exe; then
1532                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1533                         if test -f $p/cat$_exe; then
1534                                 xcat=$p/cat
1535                                 break
1536                         fi
1537                 done
1538                 if test ! -f $xcat$_exe; then
1539                         echo "Can't find cat anywhere!"
1540                         exit 1
1541                 fi
1542         fi
1543         echo "#!$xcat" >sharp
1544         $eunicefix sharp
1545         chmod +x sharp
1546         ./sharp > today 2>/dev/null
1547         if test -s today; then
1548                 sharpbang='#!'
1549         else
1550                 echo "#! $xcat" > sharp
1551                 $eunicefix sharp
1552                 chmod +x sharp
1553                 ./sharp > today 2>/dev/null
1554                 if test -s today; then
1555                         sharpbang='#! '
1556                 else
1557                         sharpbang=': use '
1558                 fi
1559         fi
1560 else
1561         echo " "
1562         echo "Your $sh doesn't grok # comments--I will strip them later on."
1563         shsharp=false
1564         cd ..
1565         echo "exec grep -v '^[  ]*#'" >spitshell
1566         chmod +x spitshell
1567         $eunicefix spitshell
1568         spitshell=`pwd`/spitshell
1569         cd UU
1570         echo "I presume that if # doesn't work, #! won't work either!"
1571         sharpbang=': use '
1572 fi
1573 rm -f sharp today
1574
1575 : figure out how to guarantee sh startup
1576 case "$startsh" in
1577 '') startsh=${sharpbang}${sh} ;;
1578 *)
1579 esac
1580 cat >sharp <<EOSS
1581 $startsh
1582 set abc
1583 test "$?abc" != 1
1584 EOSS
1585
1586 chmod +x sharp
1587 $eunicefix sharp
1588 if ./sharp; then
1589         : echo "Yup, it does."
1590 else
1591         echo "Hmm... '$startsh' does not guarantee sh startup..."
1592         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1593 fi
1594 rm -f sharp
1595
1596 : Save command line options in file UU/cmdline.opt for later use in
1597 : generating config.sh.
1598 cat > cmdline.opt <<EOSH
1599 : Configure command line arguments.
1600 config_arg0='$0'
1601 config_args='$*'
1602 config_argc=$#
1603 EOSH
1604 argn=1
1605 args_exp=''
1606 args_sep=''
1607 for arg in "$@"; do
1608         cat >>cmdline.opt <<EOSH
1609 config_arg$argn='$arg'
1610 EOSH
1611         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1612 $arg
1613 EOC
1614         arg_exp=`cat cmdl.opt`
1615         args_exp="$args_exp$args_sep'$arg_exp'"
1616         argn=`expr $argn + 1`
1617         args_sep=' '
1618 done
1619 rm -f cmdl.opt
1620
1621 : produce awk script to parse command line options
1622 cat >options.awk <<'EOF'
1623 BEGIN {
1624         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1625
1626         len = length(optstr);
1627         for (i = 1; i <= len; i++) {
1628                 c = substr(optstr, i, 1);
1629                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1630                 if (a == ":") {
1631                         arg[c] = 1;
1632                         i++;
1633                 }
1634                 opt[c] = 1;
1635         }
1636 }
1637 {
1638         expect = 0;
1639         str = $0;
1640         if (substr(str, 1, 1) != "-") {
1641                 printf("'%s'\n", str);
1642                 next;
1643         }
1644         len = length($0);
1645         for (i = 2; i <= len; i++) {
1646                 c = substr(str, i, 1);
1647                 if (!opt[c]) {
1648                         printf("-%s\n", substr(str, i));
1649                         next;
1650                 }
1651                 printf("-%s\n", c);
1652                 if (arg[c]) {
1653                         if (i < len)
1654                                 printf("'%s'\n", substr(str, i + 1));
1655                         else
1656                                 expect = 1;
1657                         next;
1658                 }
1659         }
1660 }
1661 END {
1662         if (expect)
1663                 print "?";
1664 }
1665 EOF
1666
1667 : process the command line options
1668 set X `for arg in "$@"; do echo "X$arg"; done |
1669         sed -e s/X// | awk -f options.awk`
1670 eval "set $*"
1671 shift
1672 rm -f options.awk
1673
1674 : set up default values
1675 fastread=''
1676 reuseval=false
1677 config_sh=''
1678 alldone=''
1679 error=''
1680 silent=''
1681 extractsh=''
1682 knowitall=''
1683 rm -f optdef.sh posthint.sh
1684 cat >optdef.sh <<EOS
1685 $startsh
1686 EOS
1687
1688
1689 : option parsing
1690 while test $# -gt 0; do
1691         case "$1" in
1692         -d) shift; fastread=yes;;
1693         -e) shift; alldone=cont;;
1694         -f)
1695                 shift
1696                 cd ..
1697                 if test -r "$1"; then
1698                         config_sh="$1"
1699                 else
1700                         echo "$me: cannot read config file $1." >&2
1701                         error=true
1702                 fi
1703                 cd UU
1704                 shift;;
1705         --help|\
1706         -h) shift; error=true;;
1707         -r) shift; reuseval=true;;
1708         -s) shift; silent=true; realsilent=true;;
1709         -E) shift; alldone=exit;;
1710         -K) shift; knowitall=true;;
1711         -O) shift;;
1712         -S) shift; silent=true; extractsh=true;;
1713         -D)
1714                 shift
1715                 case "$1" in
1716                 *=)
1717                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1718                         echo "$me: ignoring -D $1" >&2
1719                         ;;
1720                 *=*) echo "$1" | \
1721                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1722                 *) echo "$1='define'" >> optdef.sh;;
1723                 esac
1724                 shift
1725                 ;;
1726         -U)
1727                 shift
1728                 case "$1" in
1729                 *=) echo "$1" >> optdef.sh;;
1730                 *=*)
1731                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1732                         echo "$me: ignoring -U $1" >&2
1733                         ;;
1734                 *) echo "$1='undef'" >> optdef.sh;;
1735                 esac
1736                 shift
1737                 ;;
1738         -A)
1739             shift
1740             xxx=''
1741             yyy="$1"
1742             zzz=''
1743             uuu=undef
1744             case "$yyy" in
1745             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1746                  case "$zzz" in
1747                  *:*) zzz='' ;;
1748                  *)   xxx=append
1749                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1750                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1751                  esac
1752                  ;;
1753             esac
1754             case "$xxx" in
1755             '')  case "$yyy" in
1756                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1757                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1758                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1759                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1760                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1761                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1762                  esac
1763                  ;;
1764             esac
1765             case "$xxx" in
1766             append)
1767                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1768             clear)
1769                 echo "$yyy=''"                  >> posthint.sh ;;
1770             define)
1771                 case "$zzz" in
1772                 '') zzz=define ;;
1773                 esac
1774                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1775             eval)
1776                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1777             prepend)
1778                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1779             undef)
1780                 case "$zzz" in
1781                 '') zzz="$uuu" ;;
1782                 esac
1783                 echo "$yyy=$zzz"                >> posthint.sh ;;
1784             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1785             esac
1786             shift
1787             ;;
1788         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1789             exit 0;;
1790         --) break;;
1791         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1792         *) break;;
1793         esac
1794 done
1795
1796 case "$error" in
1797 true)
1798         cat >&2 <<EOM
1799 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1800                  [-U symbol] [-U symbol=] [-A command:symbol...]
1801   -d : use defaults for all answers.
1802   -e : go on without questioning past the production of config.sh.
1803   -f : specify an alternate default configuration file.
1804   -h : print this help message and exit (with an error status).
1805   -r : reuse C symbols value if possible (skips costly nm extraction).
1806   -s : silent mode, only echoes questions and essential information.
1807   -D : define symbol to have some value:
1808          -D symbol         symbol gets the value 'define'
1809          -D symbol=value   symbol gets the value 'value'
1810        common used examples (see INSTALL for more info):
1811          -Duse64bitint            use 64bit integers
1812          -Duse64bitall            use 64bit integers and pointers
1813          -Dusethreads             use thread support
1814          -Dinc_version_list=none  do not include older perl trees in @INC
1815          -DEBUGGING=none          DEBUGGING options
1816          -Dcc=gcc                 choose your compiler
1817          -Dprefix=/opt/perl5      choose your destination
1818   -E : stop at the end of questions, after having produced config.sh.
1819   -K : do not use unless you know what you are doing.
1820   -O : ignored for backward compatibility
1821   -S : perform variable substitutions on all .SH files (can mix with -f)
1822   -U : undefine symbol:
1823          -U symbol    symbol gets the value 'undef'
1824          -U symbol=   symbol gets completely empty
1825        e.g.:  -Uversiononly
1826   -A : manipulate symbol after the platform specific hints have been applied:
1827          -A append:symbol=value   append value to symbol
1828          -A symbol=value          like append:, but with a separating space
1829          -A define:symbol=value   define symbol to have value
1830          -A clear:symbol          define symbol to be ''
1831          -A define:symbol         define symbol to be 'define'
1832          -A eval:symbol=value     define symbol to be eval of value
1833          -A prepend:symbol=value  prepend value to symbol
1834          -A undef:symbol          define symbol to be 'undef'
1835          -A undef:symbol=         define symbol to be ''
1836        e.g.:  -A prepend:libswanted='cl pthread '
1837               -A ccflags=-DSOME_MACRO
1838   -V : print version number and exit (with a zero status).
1839 EOM
1840         exit 1
1841         ;;
1842 esac
1843
1844 : Sanity checks
1845 case "$fastread$alldone" in
1846 yescont|yesexit) ;;
1847 *)
1848         case "$extractsh" in
1849         true) ;;
1850         *)
1851                 if test ! -t 0; then
1852                         echo "Say 'sh Configure', not 'sh <Configure'"
1853                         exit 1
1854                 fi
1855                 ;;
1856         esac
1857         ;;
1858 esac
1859
1860 exec 4>&1
1861 case "$silent" in
1862 true) exec 1>/dev/null;;
1863 esac
1864
1865 : run the defines and the undefines, if any, but leave the file out there...
1866 touch optdef.sh
1867 grep -q '\\' optdef.sh
1868 if test $? = 0; then
1869     echo "Configure does not support \\ in -D arguments"
1870     exit 1
1871 fi
1872 . ./optdef.sh
1873 : create the posthint manipulation script and leave the file out there...
1874 touch posthint.sh
1875
1876 : set package name
1877 package='perl5'
1878 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1879 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1880 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1881 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1882 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1883 esac
1884
1885 : Some greps do not return status, grrr.
1886 echo "grimblepritz" >grimble
1887 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1888         contains=contains
1889 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1890         contains=grep
1891 else
1892         contains=contains
1893 fi
1894 rm -f grimble
1895 : the following should work in any shell
1896 case "$contains" in
1897 contains*)
1898         echo " "
1899         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1900         cat >contains <<'EOSS'
1901 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1902 EOSS
1903 chmod +x contains
1904 esac
1905
1906 : Find the path to the source tree
1907 case "$src" in
1908 '') case "$0" in
1909     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1910          case "$src" in
1911          /*)    ;;
1912          .)     ;;
1913          *)     src=`cd ../$src && pwd` ;;
1914          esac
1915          ;;
1916     *)   src='.';;
1917     esac;;
1918 esac
1919 case "$src" in
1920 '')     src=/
1921         rsrc=/
1922         ;;
1923 /*)     rsrc="$src";;
1924 *)      rsrc="../$src";;
1925 esac
1926 if test -f $rsrc/Configure && \
1927         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1928 then
1929    : found it, so we are ok.
1930 else
1931         rsrc=''
1932         for src in . .. ../.. ../../.. ../../../..; do
1933                 if test -f ../$src/Configure && \
1934                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1935                 then
1936                         rsrc=../$src
1937                         break
1938                 fi
1939         done
1940 fi
1941 case "$rsrc" in
1942 '')
1943         cat <<EOM >&4
1944
1945 Sorry, I can't seem to locate the source dir for $package.  Please start
1946 Configure with an explicit path -- i.e. /some/path/Configure.
1947
1948 EOM
1949         exit 1
1950         ;;
1951 ../.)   rsrc='..';;
1952 *)
1953         echo " "
1954         echo "Sources for $package found in \"$src\"." >&4
1955         ;;
1956 esac
1957
1958 : script used to extract .SH files with variable substitutions
1959 cat >extract <<'EOS'
1960 PERL_CONFIG_SH=true
1961 echo "Doing variable substitutions on .SH files..."
1962 if test -f MANIFEST; then
1963         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1964 else
1965         echo "(Looking for .SH files under the source directory.)"
1966         set x `(cd "$src"; find . -name "*.SH" -print)`
1967 fi
1968 shift
1969 case $# in
1970 0) set x `(cd "$src"; echo *.SH)`; shift;;
1971 esac
1972 if test ! -f "$src/$1"; then
1973         shift
1974 fi
1975 mkdir_p='
1976 name=$1;
1977 create="";
1978 while test $name; do
1979         if test ! -d "$name"; then
1980                 create="$name $create";
1981                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1982                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1983         else
1984                 name="";
1985         fi;
1986 done;
1987 for file in $create; do
1988         mkdir $file;
1989 done
1990 '
1991 for file in $*; do
1992         case "$src" in
1993         ".")
1994                 case "$file" in
1995                 */*)
1996                         dir=`expr X$file : 'X\(.*\)/'`
1997                         file=`expr X$file : 'X.*/\(.*\)'`
1998                         (cd "$dir" && . ./$file)
1999                         ;;
2000                 *)
2001                         . ./$file
2002                         ;;
2003                 esac
2004                 ;;
2005         *)
2006                 case "$file" in
2007                 */*)
2008                         dir=`expr X$file : 'X\(.*\)/'`
2009                         file=`expr X$file : 'X.*/\(.*\)'`
2010                         (set x $dir; shift; eval $mkdir_p)
2011                         sh <"$src/$dir/$file"
2012                         ;;
2013                 *)
2014                         sh <"$src/$file"
2015                         ;;
2016                 esac
2017                 ;;
2018         esac
2019 done
2020 if test -f "$src/config_h.SH"; then
2021         if test ! -f config.h; then
2022         : oops, they left it out of MANIFEST, probably, so do it anyway.
2023         . "$src/config_h.SH"
2024         fi
2025 fi
2026 EOS
2027
2028 : extract files and exit if asked to do so
2029 case "$extractsh" in
2030 true)
2031         case "$realsilent" in
2032         true) ;;
2033         *) exec 1>&4;;
2034         esac
2035         case "$config_sh" in
2036         '') config_sh='config.sh';;
2037         esac
2038         echo " "
2039         echo "Fetching answers from $config_sh..."
2040         cd ..
2041         . $config_sh
2042         . ./optdef.sh
2043         echo " "
2044         . UU/extract
2045         rm -rf UU
2046         echo "Extraction done."
2047         exit 0
2048         ;;
2049 esac
2050
2051 : Eunice requires " " instead of "", can you believe it
2052 echo " "
2053 : Here we go...
2054 echo "Beginning of configuration questions for $package."
2055
2056 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2057
2058 : first determine how to suppress newline on echo command
2059 echo " "
2060 echo "Checking echo to see how to suppress newlines..."
2061 (echo "hi there\c" ; echo " ") >.echotmp
2062 if $contains c .echotmp >/dev/null 2>&1 ; then
2063         echo "...using -n."
2064         n='-n'
2065         c=''
2066 else
2067         cat <<'EOM'
2068 ...using \c
2069 EOM
2070         n=''
2071         c='\c'
2072 fi
2073 echo $n "The star should be here-->$c"
2074 echo '*'
2075 rm -f .echotmp
2076
2077 : Now test for existence of everything in MANIFEST
2078 echo " "
2079 if test -f "$rsrc/MANIFEST"; then
2080         echo "First let's make sure your kit is complete.  Checking..." >&4
2081         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2082                 (split -l 50 2>/dev/null || split -50)
2083         rm -f missing
2084         tmppwd=`pwd`
2085         for filelist in x??; do
2086                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2087                         >/dev/null 2>>"$tmppwd/missing")
2088         done
2089         if test -s missing; then
2090                 cat missing >&4
2091                 cat >&4 <<'EOM'
2092
2093 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2094
2095 You have the option of continuing the configuration process, despite the
2096 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2097 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2098 and contact the author (perlbug@perl.org).
2099
2100 EOM
2101                 echo $n "Continue? [n] $c" >&4
2102                 read ans
2103                 case "$ans" in
2104                 y*)
2105                         echo "Continuing..." >&4
2106                         rm -f missing
2107                         ;;
2108                 *)
2109                         echo "ABORTING..." >&4
2110                         kill $$
2111                         ;;
2112                 esac
2113         else
2114                 echo "Looks good..."
2115         fi
2116 else
2117         echo "There is no MANIFEST file.  I hope your kit is complete !"
2118 fi
2119 rm -f missing x??
2120
2121 : Find the appropriate value for a newline for tr
2122 echo " "
2123 if test -n "$DJGPP"; then
2124        trnl='\012'
2125 fi
2126 if test X"$trnl" = X; then
2127         case "`echo foo|tr '\n' x 2>/dev/null`" in
2128         foox) trnl='\n' ;;
2129         esac
2130 fi
2131 if test X"$trnl" = X; then
2132         case "`echo foo|tr '\012' x 2>/dev/null`" in
2133         foox) trnl='\012' ;;
2134         esac
2135 fi
2136 if test X"$trnl" = X; then
2137        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2138        fooxy) trnl='\n\r' ;;
2139        esac
2140 fi
2141 if test X"$trnl" = X; then
2142         cat <<EOM >&2
2143
2144 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2145
2146 EOM
2147         exit 1
2148 fi
2149
2150 : compute the number of columns on the terminal for proper question formatting
2151 case "$COLUMNS" in
2152 '') COLUMNS='80';;
2153 esac
2154
2155 : set up the echo used in my read
2156 myecho="case \"\$xxxm\" in
2157 '') echo $n \"\$rp $c\" >&4;;
2158 *) case \"\$rp\" in
2159         '') echo $n \"[\$xxxm] $c\";;
2160         *)
2161                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2162                         echo \"\$rp\" >&4
2163                         echo $n \"[\$xxxm] $c\" >&4
2164                 else
2165                         echo $n \"\$rp [\$xxxm] $c\" >&4
2166                 fi
2167                 ;;
2168         esac;;
2169 esac"
2170
2171 : now set up to do reads with possible shell escape and default assignment
2172 cat <<EOSC >myread
2173 $startsh
2174 xxxm=\$dflt
2175 $myecho
2176 ans='!'
2177 case "\$fastread" in
2178 yes) case "\$dflt" in
2179         '') ;;
2180         *) ans='';
2181                 case "\$silent-\$rp" in
2182                 true-) ;;
2183                 *) echo " " >&4;;
2184                 esac;;
2185         esac;;
2186 *) case "\$silent" in
2187         true) case "\$rp" in
2188                 '') ans='';;
2189                 esac;;
2190         esac;;
2191 esac
2192 while expr "X\$ans" : "X!" >/dev/null; do
2193         read answ
2194         set x \$xxxm
2195         shift
2196         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2197         case  "\$answ" in
2198         "!")
2199                 sh 1>&4
2200                 echo " "
2201                 $myecho
2202                 ;;
2203         !*)
2204                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2205                 shift
2206                 sh 1>&4 -c "\$*"
2207                 echo " "
2208                 $myecho
2209                 ;;
2210         "\$ans")
2211                 case "\$ans" in
2212                 \\&*)
2213                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2214                         shift
2215                         case "\$1" in
2216                         -d)
2217                                 fastread=yes
2218                                 echo "(OK, I'll run with -d after this question.)" >&4
2219                                 ;;
2220                         -*)
2221                                 echo "*** Sorry, \$1 not supported yet." >&4
2222                                 ;;
2223                         esac
2224                         $myecho
2225                         ans=!
2226                         ;;
2227                 esac;;
2228         *)
2229                 case "\$aok" in
2230                 y)
2231                         echo "*** Substitution done -- please confirm."
2232                         xxxm="\$ans"
2233                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2234                         xxxm="\$ans"
2235                         ans=!
2236                         ;;
2237                 *)
2238                         echo "*** Error -- try again."
2239                         ans=!
2240                         ;;
2241                 esac
2242                 $myecho
2243                 ;;
2244         esac
2245         case "\$ans\$xxxm\$nostick" in
2246         '')
2247                 ans=!
2248                 $myecho
2249                 ;;
2250         esac
2251 done
2252 case "\$ans" in
2253 '') ans="\$xxxm";;
2254 esac
2255 EOSC
2256
2257 : create .config dir to save info across Configure sessions
2258 test -d ../.config || mkdir ../.config
2259 cat >../.config/README <<EOF
2260 This directory created by Configure to save information that should
2261 persist across sessions for $package.
2262
2263 You may safely delete it if you wish.
2264 EOF
2265
2266 : See if we are using a devel version and want that
2267 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2268 case "$usedevel" in
2269 $define|true|[yY]*)
2270     usedevel="$define" ;;
2271 *) case "$xversion" in
2272    *[13579])
2273         cat >&4 <<EOH
2274 *** WHOA THERE!!! ***
2275
2276     This is an UNSTABLE DEVELOPMENT release.
2277     The version of this $package distribution is $xversion, that is, odd,
2278     (as opposed to even) and that signifies a development release.
2279     If you want a maintenance release, you want an even-numbered version.
2280
2281     Do ***NOT*** install this into production use.
2282     Data corruption and crashes are possible.
2283
2284     It is most seriously suggested that you do not continue any further
2285     unless you want to help in developing and debugging Perl.
2286
2287     If you *still* want to build perl, you can answer 'y' now,
2288     or pass -Dusedevel to Configure.
2289
2290 EOH
2291         rp='Do you really want to continue?'
2292         dflt='n'
2293         . ./myread
2294         case "$ans" in
2295         [yY]) echo >&4 "Okay, continuing."
2296               usedevel="$define" ;;
2297         *) echo >&4 "Okay, bye."
2298            exit 1
2299            ;;
2300         esac
2301         ;;
2302     esac
2303     usedevel="$undef"
2304     ;;
2305 esac
2306 case "$usedevel" in
2307 $define|true|[yY]*)
2308         case "$versiononly" in
2309         '') versiononly="$define" ;;
2310         esac
2311         case "$installusrbinperl" in
2312         '') installusrbinperl="$undef" ;;
2313         esac
2314         ;;
2315 esac
2316
2317 : general instructions
2318 needman=true
2319 firsttime=true
2320 user=`(logname) 2>/dev/null`
2321 case "$user" in
2322 '') user=`whoami 2>&1`;;
2323 esac
2324 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2325         firsttime=false
2326         echo " "
2327         rp='Would you like to see the instructions?'
2328         dflt=n
2329         . ./myread
2330         case "$ans" in
2331         [yY]*) ;;
2332         *) needman=false;;
2333         esac
2334 fi
2335 if $needman; then
2336         cat <<EOH
2337
2338 This installation shell script will examine your system and ask you questions
2339 to determine how the perl5 package should be installed. If you get
2340 stuck on a question, you may use a ! shell escape to start a subshell or
2341 execute a command.  Many of the questions will have default answers in square
2342 brackets; typing carriage return will give you the default.
2343
2344 On some of the questions which ask for file or directory names you are allowed
2345 to use the ~name construct to specify the login directory belonging to "name",
2346 even if you don't have a shell which knows about that.  Questions where this is
2347 allowed will be marked "(~name ok)".
2348
2349 EOH
2350         rp=''
2351         dflt='Type carriage return to continue'
2352         . ./myread
2353         cat <<'EOH'
2354
2355 The prompter used in this script allows you to use shell variables and
2356 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2357 in the default answer, as if the default line was a set of arguments given to a
2358 script shell.  This means you may also use $* to repeat the whole default line,
2359 so you do not have to re-type everything to add something to the default.
2360
2361 Every time there is a substitution, you will have to confirm.  If there is an
2362 error (e.g. an unmatched backtick), the default answer will remain unchanged
2363 and you will be prompted again.
2364
2365 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2366 the questions and use the computed defaults (or the previous answers if there
2367 was already a config.sh file). Type 'Configure -h' for a list of options.
2368 You may also start interactively and then answer '& -d' at any prompt to turn
2369 on the non-interactive behaviour for the remainder of the execution.
2370
2371 EOH
2372         . ./myread
2373         cat <<EOH
2374
2375 Much effort has been expended to ensure that this shell script will run on any
2376 Unix system.  If despite that it blows up on yours, your best bet is to edit
2377 Configure and run it again.  If you can't run Configure for some reason,
2378 you'll have to generate a config.sh file by hand.  Whatever problems you
2379 have, let me (perlbug@perl.org) know how I blew it.
2380
2381 This installation script affects things in two ways:
2382
2383 1) it may do direct variable substitutions on some of the files included
2384    in this kit.
2385 2) it builds a config.h file for inclusion in C programs.  You may edit
2386    any of these files as the need arises after running this script.
2387
2388 If you make a mistake on a question, there is no easy way to back up to it
2389 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2390 files.  Configure will offer to let you do this before it runs the SH files.
2391
2392 EOH
2393         dflt='Type carriage return to continue'
2394         . ./myread
2395         case "$firsttime" in
2396         true) echo $user >>../.config/instruct;;
2397         esac
2398 fi
2399
2400 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2401 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2402 if test "X$sysroot" = X; then
2403     sysroot=""
2404 else
2405     case "$cc" in
2406         *gcc*|*g++*)
2407             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2408             # _sysroot is used in places where we need --sysroot=foo
2409             # but using the rest of the flags could cause issues.
2410             _sysroot="--sysroot=$sysroot";
2411             case "$ccflags" in
2412                 *sysroot*) ;;
2413                 'undef'|*)
2414                 ccflags="$ccflags $_sysroot"
2415             esac
2416             case "$ldflags" in
2417                 *sysroot*) ;;
2418                 'undef'|*)
2419                 ldflags="$ldflags $_sysroot"
2420             esac
2421             case "$cppflags" in
2422                 *sysroot*) ;;
2423                 'undef'|*)
2424                 cppflags="$cppflags $_sysroot"
2425             esac
2426             # lddlflags updated below in lddlflags section;
2427             # same with cccdlflags
2428             ;;
2429     esac
2430
2431     # Adjust some defaults to also use $sysroot
2432     for var in xlibpth loclibpth locincpth glibpth; do
2433         eval xxx=\$$var
2434         eval $var=''
2435         for path in $xxx; do
2436             eval $var=\"\$$var $sysroot$path\"
2437         done
2438     done
2439
2440 fi
2441
2442 : find out where common programs are
2443 echo " "
2444 echo "Locating common programs..." >&4
2445 cat <<EOSC >loc
2446 $startsh
2447 case \$# in
2448 0) exit 1;;
2449 esac
2450 thing=\$1
2451 shift
2452 dflt=\$1
2453 shift
2454 for dir in \$*; do
2455         case "\$thing" in
2456         .)
2457         if test -d \$dir/\$thing; then
2458                 echo \$dir
2459                 exit 0
2460         fi
2461         ;;
2462         *)
2463         for thisthing in \$dir/\$thing; do
2464                 : just loop through to pick last item
2465         done
2466         if test -f \$thisthing; then
2467                 echo \$thisthing
2468                 exit 0
2469         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2470                 echo \$thisthing
2471                 exit 0
2472         elif test -f \$dir/\$thing.exe; then
2473                 if test -n "$DJGPP"; then
2474                         echo \$dir/\$thing.exe
2475                 elif test "$eunicefix" != ":"; then
2476                         : on Eunice apparently
2477                         echo \$dir/\$thing
2478                 fi
2479                 exit 0
2480         fi
2481         ;;
2482         esac
2483 done
2484 echo \$dflt
2485 exit 1
2486 EOSC
2487 chmod +x loc
2488 $eunicefix loc
2489 loclist="
2490 awk
2491 cat
2492 chmod
2493 comm
2494 cp
2495 echo
2496 expr
2497 grep
2498 ls
2499 mkdir
2500 rm
2501 sed
2502 sort
2503 touch
2504 tr
2505 uniq
2506 "
2507 trylist="
2508 ar
2509 bison
2510 byacc
2511 cpp
2512 csh
2513 date
2514 egrep
2515 gmake
2516 gzip
2517 less
2518 ln
2519 make
2520 more
2521 nm
2522 nroff
2523 perl
2524 pg
2525 test
2526 uname
2527 zip
2528 "
2529 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2530 pth="$pth $sysroot/lib $sysroot/usr/lib"
2531 for file in $loclist; do
2532         eval xxx=\$$file
2533         case "$xxx" in
2534         /*|?:[\\/]*)
2535                 if test -f "$xxx"; then
2536                         : ok
2537                 else
2538                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2539                         xxx=`./loc $file $file $pth`
2540                 fi
2541                 ;;
2542         '') xxx=`./loc $file $file $pth`;;
2543         *) xxx=`./loc $xxx $xxx $pth`;;
2544         esac
2545         eval $file=$xxx$_exe
2546         eval _$file=$xxx
2547         case "$xxx" in
2548         /*)
2549                 echo $file is in $xxx.
2550                 ;;
2551         ?:[\\/]*)
2552                 echo $file is in $xxx.
2553                 ;;
2554         *)
2555                 echo "I don't know where '$file' is, and my life depends on it." >&4
2556                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2557                 exit 1
2558                 ;;
2559         esac
2560 done
2561 echo " "
2562 echo "Don't worry if any of the following aren't found..."
2563 say=offhand
2564 for file in $trylist; do
2565         eval xxx=\$$file
2566         case "$xxx" in
2567         /*|?:[\\/]*)
2568                 if test -f "$xxx"; then
2569                         : ok
2570                 else
2571                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2572                         xxx=`./loc $file $file $pth`
2573                 fi
2574                 ;;
2575         '') xxx=`./loc $file $file $pth`;;
2576         *) xxx=`./loc $xxx $xxx $pth`;;
2577         esac
2578         eval $file=$xxx$_exe
2579         eval _$file=$xxx
2580         case "$xxx" in
2581         /*)
2582                 echo $file is in $xxx.
2583                 ;;
2584         ?:[\\/]*)
2585                 echo $file is in $xxx.
2586                 ;;
2587         *)
2588                 echo "I don't see $file out there, $say."
2589                 say=either
2590                 ;;
2591         esac
2592 done
2593 case "$egrep" in
2594 egrep)
2595         echo "Substituting grep for egrep."
2596         egrep=$grep
2597         _egrep=$grep
2598         ;;
2599 esac
2600 case "$less" in
2601 '')     ;;
2602 *)      if $less -R </dev/null >/dev/null 2>&1; then
2603                echo "Substituting less -R for less."
2604                less="$less -R"
2605                _less=$less
2606         fi
2607         ;;
2608 esac
2609 case "$ln" in
2610 ln)
2611         echo "Substituting cp for ln."
2612         ln=$cp
2613         _ln=$cp
2614         ;;
2615 esac
2616 case "$make" in
2617 make)
2618         case "$gmake" in
2619         gmake)
2620         echo "I can't find make or gmake, and my life depends on it." >&4
2621         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2622         exit 1
2623         ;;
2624         esac
2625         ;;
2626 esac
2627 case "$gmake" in
2628 gmake)  ;;
2629 *)      # We can't have osname yet.
2630         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2631                 # Assume that gmake, if found, is definitely GNU make
2632                 # and prefer it over the system make.
2633                 echo "Substituting gmake for make."
2634                 make=$gmake
2635                 _make=$gmake
2636         fi
2637         ;;
2638 esac
2639 case "$test" in
2640 test)
2641         echo "Hopefully test is built into your sh."
2642         ;;
2643 *)
2644         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2645                 echo "Using the test built into your sh."
2646                 test=test
2647                 _test=test
2648         fi
2649         ;;
2650 esac
2651 case "$echo" in
2652 echo)
2653         echo "Hopefully echo is built into your sh."
2654         ;;
2655 '') ;;
2656 *)
2657         echo " "
2658 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2659         $echo $n "hi there$c" >foo1
2660         echo $n "hi there$c" >foo2
2661         if cmp foo1 foo2 >/dev/null 2>&1; then
2662                 echo "They are compatible.  In fact, they may be identical."
2663         else
2664                 case "$n" in
2665                 '-n') n='' c='\c';;
2666                 *) n='-n' c='';;
2667                 esac
2668                 cat <<FOO
2669 They are not compatible!  You are probably running ksh on a non-USG system.
2670 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2671 have echo built in and we may have to run some Bourne shell scripts.  That
2672 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2673
2674 FOO
2675                 $echo $n "The star should be here-->$c"
2676                 $echo "*"
2677         fi
2678         $rm -f foo1 foo2
2679         ;;
2680 esac
2681
2682 # This question was auctioned at YAPC::Europe-2007 in Vienna
2683 # I never promised you could answer it. I only auctioned the question.
2684 cat <<FOO
2685 The following message is sponsored by
2686
2687   Dresden.pm<--The stars should be here.
2688
2689 Dear Perl user, system administrator or package
2690 maintainer, the Perl community sends greetings to
2691 you. Do you (emblematical) greet back [Y/n]? n
2692
2693 FOO
2694
2695 : Check what type of C compiler we use
2696 cat <<EOS >trygcc
2697 $startsh
2698 EOS
2699 cat <<'EOSC' >>trygcc
2700 case "$cc" in
2701 '') ;;
2702 *)  $rm -f try try.*
2703     $cat >try.c <<EOM
2704 int main(int argc, char *argv[]) {
2705   return 0;
2706 }
2707 EOM
2708     if $cc -o try $ccflags $ldflags try.c; then
2709        :
2710     else
2711         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2712         despair=yes
2713         trygcc=yes
2714         case "$cc" in
2715         *gcc*) trygcc=no ;;
2716         esac
2717         # Skip this test because it gives a false match on output like:
2718         #    ./trygcc: line 23: cc: command not found
2719         # case "`$cc -v -c try.c 2>&1`" in
2720         # *gcc*) trygcc=no ;;
2721         # esac
2722         if $test X"$trygcc" = Xyes; then
2723             if gcc -o try -c try.c; then
2724                 echo " "
2725                 echo "You seem to have a working gcc, though." >&4
2726                 # Switching compilers may undo the work of hints files.
2727                 # The most common problem is -D_REENTRANT for threads.
2728                 # This heuristic catches that case, but gets false positives
2729                 # if -Dusethreads was not actually specified.  Better to
2730                 # bail out here with a useful message than fail
2731                 # mysteriously later. Should we perhaps just try to
2732                 # re-invoke Configure -Dcc=gcc config_args ?
2733                 if $test -f usethreads.cbu; then
2734                         $cat >&4 <<EOM
2735
2736 *** However, any setting of the C compiler flags (e.g. for thread support)
2737 *** will be lost.  It may be necessary for you to restart Configure and
2738 *** add -Dcc=gcc to your Configure command line.
2739
2740 EOM
2741                         rp="Would you like to go ahead and try gcc anyway?"
2742                         dflt=n
2743                 else
2744                         rp="Would you like to use it?"
2745                         dflt=y
2746                 fi
2747                 if $test -f myread; then
2748                     . ./myread
2749                 else
2750                     if $test -f UU/myread; then
2751                         . ./UU/myread
2752                     else
2753                         echo "Cannot find myread, sorry.  Aborting." >&2
2754                         exit 1
2755                     fi
2756                 fi
2757                 case "$ans" in
2758                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2759                 esac
2760             fi
2761         fi
2762     fi
2763     $rm -f try try.*
2764     ;;
2765 esac
2766 EOSC
2767
2768 cat <<EOS >checkcc
2769 $startsh
2770 EOS
2771 cat <<'EOSC' >>checkcc
2772 case "$cc" in
2773 '') ;;
2774 *)  $rm -f try try.*
2775     $cat >try.c <<EOM
2776 int main(int argc, char *argv[]) {
2777   return 0;
2778 }
2779 EOM
2780     if $cc -o try $ccflags $ldflags try.c; then
2781        :
2782     else
2783         if $test X"$despair" = Xyes; then
2784            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2785         fi
2786         $cat >&4 <<EOM
2787 You need to find a working C compiler.
2788 Either (purchase and) install the C compiler supplied by your OS vendor,
2789 or for a free C compiler try http://gcc.gnu.org/
2790 I cannot continue any further, aborting.
2791 EOM
2792         exit 1
2793     fi
2794     $rm -f try try.*
2795     ;;
2796 esac
2797 EOSC
2798
2799 : determine whether symbolic links are supported
2800 echo " "
2801 $touch blurfl
2802 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2803         echo "Symbolic links are supported." >&4
2804         lns="$ln -s"
2805 else
2806         echo "Symbolic links are NOT supported." >&4
2807         lns="$ln"
2808 fi
2809 $rm -f blurfl sym
2810
2811 : determine whether symbolic links are supported
2812 echo " "
2813 case "$lns" in
2814 *"ln"*" -s")
2815         echo "Checking how to test for symbolic links..." >&4
2816         $lns blurfl sym
2817         if $test "X$issymlink" = X; then
2818                 case "$newsh" in
2819                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2820                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2821                 esac
2822                 if test $? = 0; then
2823                         issymlink="test -h"
2824                 else
2825                         echo "Your builtin 'test -h' may be broken." >&4
2826                         case "$test" in
2827                         /*)     ;;
2828                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2829                                 for p in $pth
2830                                 do
2831                                         if test -f "$p/$test"; then
2832                                                 test="$p/$test"
2833                                                 break
2834                                         fi
2835                                 done
2836                                 ;;
2837                         esac
2838                         case "$test" in
2839                         /*)
2840                                 echo "Trying external '$test -h'." >&4
2841                                 issymlink="$test -h"
2842                                 if $test ! -h sym >/dev/null 2>&1; then
2843                                         echo "External '$test -h' is broken, too." >&4
2844                                         issymlink=''
2845                                 fi
2846                                 ;;
2847                         *)      issymlink='' ;;
2848                         esac
2849                 fi
2850         fi
2851         if $test "X$issymlink" = X; then
2852                 if $test -L sym 2>/dev/null; then
2853                         issymlink="$test -L"
2854                         echo "The builtin '$test -L' worked." >&4
2855                 fi
2856         fi
2857         if $test "X$issymlink" != X; then
2858                 echo "You can test for symbolic links with '$issymlink'." >&4
2859         else
2860                 echo "I do not know how you can test for symbolic links." >&4
2861         fi
2862         $rm -f blurfl sym
2863         ;;
2864 *)      echo "No symbolic links, so not testing for their testing..." >&4
2865         ;;
2866 esac
2867 echo " "
2868
2869 : Make symlinks util
2870 case "$mksymlinks" in
2871 $define|true|[yY]*)
2872         case "$src" in
2873         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2874                 exit 1
2875                 ;;
2876         *)      case "$lns:$issymlink" in
2877                 *"ln"*" -s:"*"test -"?)
2878                         echo "Creating the symbolic links..." >&4
2879                         cd ..
2880                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2881                         awk 'NF == 1 {
2882                                 dir=".";
2883                                 file=$1 "";
2884                              }
2885                              NF == 2 {
2886                                 dir=$1 "";
2887                                 file=$2 "";
2888                              }
2889                              {
2890                                  print "# dir = ", dir, "file = ", file
2891                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2892                              } END {
2893                                  for (d in mf) {
2894                                      if (d != ".") { print("mkdir -p "d) }
2895                                      print("ln -sf "mf[d]" "d);
2896                                  }
2897                              }' source="$src" > UU/mksymlinks.$$
2898                         sh UU/mksymlinks.$$
2899                         rm UU/mksymlinks.$$
2900                         # Sanity check 1.
2901                         if test ! -d t/base; then
2902                                 echo "Failed to create the subdirectories.  Aborting." >&4
2903                                 exit 1
2904                         fi
2905                         # Sanity check 2.
2906                         if test ! -f t/base/lex.t; then
2907                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2908                                 exit 1
2909                         fi
2910                         if test ! -f win32/win32.c; then
2911                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2912                                 exit 1
2913                         fi
2914                         cd UU
2915                         ;;
2916                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2917                         ;;
2918                 esac
2919                 ;;
2920         esac
2921         ;;
2922 esac
2923
2924 : Check for Cross-Compilation
2925 if $test "X$targethost" = "X"; then
2926     targethost=""
2927 fi
2928 if $test "X$targetenv" = "X"; then
2929     targetenv=""
2930 fi
2931 case "$usecrosscompile" in
2932 $define|true|[yY]*)
2933         $echo "Cross-compiling..."
2934         croak=''
2935         case "$cc" in
2936         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2937             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2938             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2939             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2940             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2941             # leave out ld, choosing it is more complex
2942             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2943             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2944             # We are in a weird spot. Just before us, some values
2945             # were 'saved', to be restored after the hints are
2946             # run.  This means that the changes we made to ar,
2947             # nm and ranlib will get reverted.
2948             # To avoid that, we hijack the saving mechanism and
2949             # have it save our new values.
2950             for file in ar nm ranlib; do
2951                 eval xxx=\$$file
2952                 eval $file=$xxx$_exe
2953                 eval _$file=$xxx
2954             done
2955         ;;
2956         esac
2957         case "$targetarch" in
2958         '') echo "Targetarch not defined." >&4; croak=y ;;
2959         *)  echo "Using targetarch $targetarch." >&4 ;;
2960         esac
2961         case "$targethost" in
2962         '') echo "Targethost not defined." >&4; croak=y ;;
2963         *)  echo "Using targethost $targethost." >&4
2964         esac
2965         locincpth=' '
2966         loclibpth=' '
2967         case "$croak" in
2968         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2969         esac
2970     : compile a host miniperl and generate_uudmap, unless we got passed them
2971     if $test "X$hostperl" = X; then
2972       echo "Building host miniperl and generate_uudmap binaries" >&4
2973       before_host=`pwd`
2974       cd ..
2975       cd $src
2976       src=`pwd`
2977       rm -rf $src/host
2978       mkdir $src/host
2979       cd $src/host
2980       $src/Configure -des -Dusedevel -Dmksymlinks
2981       $make miniperl
2982       case "$hostgenerate" in
2983       '') $make generate_uudmap
2984           hostgenerate=$src/host/generate_uudmap
2985           ;;
2986        "$undef") hostgenerate=''
2987           ;;
2988       esac
2989       hostperl=$src/host/miniperl
2990       cd $before_host
2991     fi
2992     hostosname=`$hostperl -le 'print $^O'`
2993     ;;
2994 *)
2995     usecrosscompile="$undef"
2996     ;;
2997 esac
2998
2999 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3000 case "$targethost" in
3001     '') echo "Checking for cross-compile" >&4
3002     case "$usecrosscompile$multiarch" in
3003        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3004          if [ -f Makefile ]; then
3005            echo " "
3006            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3007          else
3008            echo "Configure done."
3009          fi
3010        exit 0
3011        ;;
3012      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3013         run=''
3014         to=:
3015         from=:
3016         ;;
3017     esac
3018     ;;
3019     *) echo "Using targethost $targethost." >&4
3020         case "$src" in
3021         /*) run=$src/Cross/run
3022             targetmkdir=$src/Cross/mkdir
3023             to=$src/Cross/to
3024             from=$src/Cross/from
3025             ;;
3026         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3027             run=$pwd/Cross/run
3028             targetmkdir=$pwd/Cross/mkdir
3029             to=$pwd/Cross/to
3030             from=$pwd/Cross/from
3031             ;;
3032         esac
3033         case "$targetrun" in
3034         '') targetrun=ssh ;;
3035         esac
3036         case "$targetto" in
3037         '') targetto=scp ;;
3038         esac
3039         case "$targetfrom" in
3040         '') targetfrom=scp ;;
3041         esac
3042         run=$run-$targetrun
3043         to=$to-$targetto
3044         from=$from-$targetfrom
3045         case "$targetdir" in
3046         '')  targetdir=/tmp
3047              echo "Guessing targetdir $targetdir." >&4
3048              ;;
3049         esac
3050         case "$targetuser" in
3051         '')  targetuser=root
3052              echo "Guessing targetuser $targetuser." >&4
3053              ;;
3054         esac
3055         case "$targetport" in
3056         '')  targetport=22
3057              echo "Guessing targetport $targetport." >&4
3058              ;;
3059         esac
3060         case "$targetfrom" in
3061         scp)    q=-q ;;
3062         *)      q='' ;;
3063         esac
3064         case "$targetrun" in
3065         ssh|rsh)
3066             cat >$run <<EOF
3067 #!/bin/sh
3068 env=''
3069 case "\$1" in
3070 -cwd)
3071   shift
3072   cwd=\$1
3073   shift
3074   ;;
3075 esac
3076 case "\$1" in
3077 -env)
3078   shift
3079   env=\$1
3080   shift
3081   ;;
3082 esac
3083 case "\$cwd" in
3084 '') cwd=$targetdir ;;
3085 esac
3086 exe=\$1
3087 shift
3088 $to \$exe
3089 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3090 EOF
3091             ;;
3092         adb)
3093             $touch $run
3094             ;;
3095         *)  echo "Unknown targetrun '$targetrun'" >&4
3096             exit 1
3097             ;;
3098         esac
3099         case "$targetmkdir" in
3100         */Cross/mkdir)
3101             cat >$targetmkdir <<EOF
3102 #!/bin/sh
3103 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3104 EOF
3105             $chmod a+rx $targetmkdir
3106             ;;
3107         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3108             exit 1
3109             ;;
3110         esac
3111         case "$targetto" in
3112         scp|rcp)
3113             cat >$to <<EOF
3114 #!/bin/sh
3115 for f in \$@
3116 do
3117   case "\$f" in
3118   /*)
3119     $targetmkdir \`dirname \$f\`
3120     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3121     ;;
3122   *)
3123     $targetmkdir $targetdir/\`dirname \$f\`
3124     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3125     ;;
3126   esac
3127 done
3128 exit 0
3129 EOF
3130             ;;
3131         cp) cat >$to <<EOF
3132 #!/bin/sh
3133 for f in \$@
3134 do
3135   case "\$f" in
3136   /*)
3137     $mkdir -p $targetdir/\`dirname \$f\`
3138     $cp \$f $targetdir/\$f || exit 1
3139     ;;
3140   *)
3141     $targetmkdir $targetdir/\`dirname \$f\`
3142     $cp \$f $targetdir/\$f || exit 1
3143     ;;
3144   esac
3145 done
3146 exit 0
3147 EOF
3148             ;;
3149         *)  echo "Unknown targetto '$targetto'" >&4
3150             exit 1
3151             ;;
3152         esac
3153         case "$targetfrom" in
3154         scp|rcp)
3155           cat >$from <<EOF
3156 #!/bin/sh
3157 for f in \$@
3158 do
3159   $rm -f \$f
3160   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3161 done
3162 exit 0
3163 EOF
3164             ;;
3165         cp) cat >$from <<EOF
3166 #!/bin/sh
3167 for f in \$@
3168 do
3169   $rm -f \$f
3170   cp $targetdir/\$f . || exit 1
3171 done
3172 exit 0
3173 EOF
3174             ;;
3175         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3176             exit 1
3177             ;;
3178         esac
3179         if $test ! -f $run; then
3180             echo "Target 'run' script '$run' not found." >&4
3181         else
3182             $chmod a+rx $run
3183         fi
3184         if $test ! -f $to; then
3185             echo "Target 'to' script '$to' not found." >&4
3186         else
3187             $chmod a+rx $to
3188         fi
3189         if $test ! -f $from; then
3190             echo "Target 'from' script '$from' not found." >&4
3191         else
3192             $chmod a+rx $from
3193         fi
3194         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3195             exit 1
3196         fi
3197         cat >&4 <<EOF
3198 Using '$run' for remote execution,
3199 and '$from' and '$to'
3200 for remote file transfer.
3201 EOF
3202         ;;
3203 *)      run=''
3204         to=:
3205         from=:
3206         usecrosscompile="$undef"
3207         targetarch=''
3208         ;;
3209 esac
3210
3211 : see whether [:lower:] and [:upper:] are supported character classes
3212 echo " "
3213 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3214 ABYZ-abyz)
3215         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3216         up='[:upper:]'
3217         low='[:lower:]'
3218         ;;
3219 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3220         # (0xd9 and 0xe2), therefore that is a nice testing point.
3221         if test "X$up" = X -o "X$low" = X; then
3222             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3223             rs) up='[A-Z]'
3224                 low='[a-z]'
3225                 ;;
3226             esac
3227         fi
3228         if test "X$up" = X -o "X$low" = X; then
3229             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3230             rs) up='A-Z'
3231                 low='a-z'
3232                 ;;
3233             esac
3234         fi
3235         if test "X$up" = X -o "X$low" = X; then
3236             case "`echo RS | od -x 2>/dev/null`" in
3237             *D9E2*|*d9e2*)
3238                 echo "Hey, this might be EBCDIC." >&4
3239                 if test "X$up" = X -o "X$low" = X; then
3240                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3241                     rs) up='[A-IJ-RS-Z]'
3242                         low='[a-ij-rs-z]'
3243                         ;;
3244                     esac
3245                 fi
3246                 if test "X$up" = X -o "X$low" = X; then
3247                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3248                     rs) up='A-IJ-RS-Z'
3249                         low='a-ij-rs-z'
3250                         ;;
3251                     esac
3252                 fi
3253                 ;;
3254             esac
3255         fi
3256 esac
3257 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3258 rs)
3259     echo "Using $up and $low to convert case." >&4
3260     ;;
3261 *)
3262     echo "I don't know how to translate letters from upper to lower case." >&4
3263     echo "Your tr is not acting any way I know of." >&4
3264     exit 1
3265     ;;
3266 esac
3267 : set up the translation script tr, must be called with ./tr of course
3268 cat >tr <<EOSC
3269 $startsh
3270 case "\$1\$2" in
3271 '[A-Z][a-z]') exec $tr '$up' '$low';;
3272 '[a-z][A-Z]') exec $tr '$low' '$up';;
3273 esac
3274 exec $tr "\$@"
3275 EOSC
3276 chmod +x tr
3277 $eunicefix tr
3278
3279 : Try to determine whether config.sh was made on this system
3280 case "$config_sh" in
3281 '')
3282 myuname=`$uname -a 2>/dev/null`
3283 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3284 # Downcase everything to avoid ambiguity.
3285 # Remove slashes and single quotes so we can use parts of this in
3286 # directory and file names.
3287 # Remove newlines so myuname is sane to use elsewhere.
3288 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3289 # because the A-Z/a-z are not consecutive.
3290 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3291         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3292 newmyuname="$myuname"
3293 dflt=n
3294 case "$knowitall" in
3295 '')
3296         if test -f ../config.sh; then
3297                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3298                         eval "`grep myuname= ../config.sh`"
3299                 fi
3300                 if test "X$myuname" = "X$newmyuname"; then
3301                         dflt=y
3302                 fi
3303         fi
3304         ;;
3305 *) dflt=y;;
3306 esac
3307
3308 : Get old answers from old config file if Configure was run on the
3309 : same system, otherwise use the hints.
3310 hint=default
3311 cd ..
3312 if test -f config.sh; then
3313         echo " "
3314         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3315         . UU/myread
3316         case "$ans" in
3317         n*|N*) echo "OK, I'll ignore it."
3318                 mv config.sh config.sh.old
3319                 myuname="$newmyuname"
3320                 ;;
3321         *)  echo "Fetching default answers from your old config.sh file..." >&4
3322                 tmp_n="$n"
3323                 tmp_c="$c"
3324                 tmp_sh="$sh"
3325                 . ./config.sh
3326                 cp config.sh UU
3327                 n="$tmp_n"
3328                 c="$tmp_c"
3329                 : Older versions did not always set $sh.  Catch re-use of such
3330                 : an old config.sh.
3331                 case "$sh" in
3332                 '') sh="$tmp_sh" ;;
3333                 esac
3334                 hint=previous
3335                 ;;
3336         esac
3337 fi
3338 . ./UU/checkcc
3339 if test ! -f config.sh; then
3340         $cat <<EOM
3341
3342 First time through, eh?  I have some defaults handy for some systems
3343 that need some extra help getting the Configure answers right:
3344
3345 EOM
3346         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3347         dflt=''
3348         : Half the following guesses are probably wrong... If you have better
3349         : tests or hints, please send them to perlbug@perl.org
3350         : The metaconfig authors would also appreciate a copy...
3351         $test -f /irix && osname=irix
3352         $test -f /xenix && osname=sco_xenix
3353         $test -f /dynix && osname=dynix
3354         $test -f /dnix && osname=dnix
3355         $test -f /lynx.os && osname=lynxos
3356         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3357         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3358         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3359         $test -f /bin/mips && /bin/mips && osname=mips
3360         $test -d /usr/apollo/bin && osname=apollo
3361         $test -f /etc/saf/_sactab && osname=svr4
3362         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3363         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3364         $test -f /sys/utilities/MultiView && osname=amigaos
3365         if $test -d /MachTen -o -d /MachTen_Folder; then
3366                 osname=machten
3367                 if $test -x /sbin/version; then
3368                         osvers=`/sbin/version | $awk '{print $2}' |
3369                         $sed -e 's/[A-Za-z]$//'`
3370                 elif $test -x /usr/etc/version; then
3371                         osvers=`/usr/etc/version | $awk '{print $2}' |
3372                         $sed -e 's/[A-Za-z]$//'`
3373                 else
3374                         osvers="$2.$3"
3375                 fi
3376         fi
3377
3378         $test -f /sys/posix.dll &&
3379                 $test -f /usr/bin/what &&
3380                 set X `/usr/bin/what /sys/posix.dll` &&
3381                 $test "$3" = UWIN &&
3382                 osname=uwin &&
3383                 osvers="$5"
3384
3385         if $test -f $uname; then
3386                 set X $myuname
3387                 shift
3388
3389                 case "$5" in
3390                 fps*) osname=fps ;;
3391                 mips*)
3392                         case "$4" in
3393                         umips) osname=umips ;;
3394                         *) osname=mips ;;
3395                         esac;;
3396                 [23]100) osname=mips ;;
3397                 i386*)
3398                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3399                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3400                                 osname='sco'
3401                                 osvers=$tmp
3402                         elif $test -f /etc/kconfig; then
3403                                 osname=isc
3404                                 if test "$lns" = "$ln -s"; then
3405                                         osvers=4
3406                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3407                                         osvers=3
3408                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3409                                         osvers=2
3410                                 fi
3411                         fi
3412                         tmp=''
3413                         ;;
3414                 pc*)
3415                         if test -n "$DJGPP"; then
3416                                 osname=dos
3417                                 osvers=djgpp
3418                         fi
3419                         ;;
3420                 esac
3421
3422                 case "$1" in
3423                 aix) osname=aix
3424                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3425                         case "$tmp" in
3426                         # oslevel can fail with:
3427                         # oslevel: Unable to acquire lock.
3428                         *not\ found) osvers="$4"."$3" ;;
3429                         '<3240'|'<>3240') osvers=3.2.0 ;;
3430                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3431                         '=3250'|'>3250') osvers=3.2.5 ;;
3432                         *) osvers=$tmp;;
3433                         esac
3434                         ;;
3435                 bitrig) osname=bitrig
3436                         osvers="$3"
3437                         ;;
3438                 bsd386) osname=bsd386
3439                         osvers=`$uname -r`
3440                         ;;
3441                 cygwin*) osname=cygwin
3442                         osvers="$3"
3443                         ;;
3444                 *dc.osx) osname=dcosx
3445                         osvers="$3"
3446                         ;;
3447                 dnix) osname=dnix
3448                         osvers="$3"
3449                         ;;
3450                 domainos) osname=apollo
3451                         osvers="$3"
3452                         ;;
3453                 dgux)   osname=dgux
3454                         osvers="$3"
3455                         ;;
3456                 dragonfly) osname=dragonfly
3457                         osvers="$3"
3458                         ;;
3459                 dynixptx*) osname=dynixptx
3460                         osvers=`echo "$4"|sed 's/^v//'`
3461                         ;;
3462                 freebsd) osname=freebsd
3463                         osvers="$3" ;;
3464                 genix)  osname=genix ;;
3465                 gnu)    osname=gnu
3466                         osvers="$3" ;;
3467                 hp*)    osname=hpux
3468                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3469                         ;;
3470                 irix*)  osname=irix
3471                         case "$3" in
3472                         4*) osvers=4 ;;
3473                         5*) osvers=5 ;;
3474                         *)      osvers="$3" ;;
3475                         esac
3476                         ;;
3477                 linux)  osname=linux
3478                         case "$3" in
3479                         *)      osvers="$3" ;;
3480                         esac
3481                         $test -f /system/lib/libandroid.so && osname=linux-android
3482                         ;;
3483                 MiNT)   osname=mint
3484                         ;;
3485                 netbsd*) osname=netbsd
3486                         osvers="$3"
3487                         ;;
3488                 news-os) osvers="$3"
3489                         case "$3" in
3490                         4*) osname=newsos4 ;;
3491                         *) osname=newsos ;;
3492                         esac
3493                         ;;
3494                 nonstop-ux) osname=nonstopux ;;
3495                 openbsd) osname=openbsd
3496                         osvers="$3"
3497                         ;;
3498                 os2)    osname=os2
3499                         osvers="$4"
3500                         ;;
3501                 POSIX-BC | posix-bc ) osname=posix-bc
3502                         osvers="$3"
3503                         ;;
3504                 powerux | power_ux | powermax_os | powermaxos | \
3505                 powerunix | power_unix) osname=powerux
3506                         osvers="$3"
3507                         ;;
3508                 qnx) osname=qnx
3509                         osvers="$4"
3510                         ;;
3511                 solaris) osname=solaris
3512                         case "$3" in
3513                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3514                         *)      osvers="$3" ;;
3515                         esac
3516                         ;;
3517                 sunos) osname=sunos
3518                         case "$3" in
3519                         5*) osname=solaris
3520                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3521                         *)      osvers="$3" ;;
3522                         esac
3523                         ;;
3524                 titanos) osname=titanos
3525                         case "$3" in
3526                         1*) osvers=1 ;;
3527                         2*) osvers=2 ;;
3528                         3*) osvers=3 ;;
3529                         4*) osvers=4 ;;
3530                         *)      osvers="$3" ;;
3531                         esac
3532                         ;;
3533                 ultrix) osname=ultrix
3534                         osvers="$3"
3535                         ;;
3536                 osf1|mls+)      case "$5" in
3537                                 alpha)
3538                                         osname=dec_osf
3539                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3540                                         case "$osvers" in
3541                                         [1-9].[0-9]*) ;;
3542                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3543                                         esac
3544                                         ;;
3545                         hp*)    osname=hp_osf1  ;;
3546                         mips)   osname=mips_osf1 ;;
3547                         esac
3548                         ;;
3549                 # UnixWare 7.1.2 is known as Open UNIX 8
3550                 openunix|unixware) osname=svr5
3551                         osvers="$4"
3552                         ;;
3553                 uts)    osname=uts
3554                         osvers="$3"
3555                         ;;
3556                 vos) osvers="$3"
3557                         ;;
3558                 $2) case "$osname" in
3559                         *isc*) ;;
3560                         *freebsd*) ;;
3561                         svr*)
3562                                 : svr4.x or possibly later
3563                                 case "svr$3" in
3564                                 ${osname}*)
3565                                         osname=svr$3
3566                                         osvers=$4
3567                                         ;;
3568                                 esac
3569                                 case "$osname" in
3570                                 svr4.0)
3571                                         : Check for ESIX
3572                                         if test -f /stand/boot ; then
3573                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3574                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3575                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3576                                                         if test -n "$isesix"; then
3577                                                                 osname=esix4
3578                                                         fi
3579                                                 fi
3580                                         fi
3581                                         ;;
3582                                 esac
3583                                 ;;
3584                         *)      if test -f /etc/systemid; then
3585                                         osname=sco
3586                                         set `echo $3 | $sed 's/\./ /g'` $4
3587                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3588                                                 osvers=$1.$2.$3
3589                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3590                                                 osvers=$1.$2
3591                                         elif $test -f $src/hints/sco_$1.sh; then
3592                                                 osvers=$1
3593                                         fi
3594                                 else
3595                                         case "$osname" in
3596                                         '') : Still unknown.  Probably a generic Sys V.
3597                                                 osname="sysv"
3598                                                 osvers="$3"
3599                                                 ;;
3600                                         esac
3601                                 fi
3602                                 ;;
3603                         esac
3604                         ;;
3605                 *)      case "$osname" in
3606                         '') : Still unknown.  Probably a generic BSD.
3607                                 osname="$1"
3608                                 osvers="$3"
3609                                 ;;
3610                         esac
3611                         ;;
3612                 esac
3613         else
3614                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3615                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3616                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3617                                 osname=news_os
3618                         fi
3619                         $rm -f UU/kernel.what
3620                 elif test -d c:/. -o -n "$is_os2" ; then
3621                         set X $myuname
3622                         osname=os2
3623                         osvers="$5"
3624                 fi
3625         fi
3626
3627         case "$targetarch" in
3628         '') ;;
3629         *)  hostarch=$osname
3630             case "$targetarch" in
3631                 nto*|*-nto-*)
3632                     # Will load qnx.sh, which should change osname to nto
3633                     osname=qnx
3634                     osvers=''
3635                     ;;
3636                 *linux-android*)
3637                     # Catch arm-linux-androideabi, mipsel-linux-android,
3638                     # and i686-linux-android
3639                     osname=linux-android
3640                     osvers=''
3641                     ;;
3642                 *linux*)
3643                     # Something like arm-linux-gnueabihf is really just
3644                     # plain linux.
3645                     osname=linux
3646                     osvers=''
3647                     ;;
3648                 *solaris*|*sunos*)
3649                     osname=solaris
3650                     # XXX perhaps we should just assume
3651                     # osvers to be 2, or maybe take the value
3652                     # from targetarch. Using $run before the
3653                     # hints are run is somewhat icky.
3654                     set X `$run $uname -a 2>/dev/null`
3655                     shift
3656                     case "$3" in
3657                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3658                         *)  osvers="$3" ;;
3659                     esac
3660                     ;;
3661                 *)
3662                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3663                     osvers=''
3664                 ;;
3665             esac
3666             ;;
3667         esac
3668
3669         : Now look for a hint file osname_osvers, unless one has been
3670         : specified already.
3671         case "$hintfile" in
3672         ''|' ')
3673                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3674                 : Also try without trailing minor version numbers.
3675                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3676                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3677                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3678                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3679                 case "$file" in
3680                 '') dflt=none ;;
3681                 *)  case "$osvers" in
3682                         '') dflt=$file
3683                                 ;;
3684                         *)  if $test -f $src/hints/$file.sh ; then
3685                                         dflt=$file
3686                                 elif $test -f $src/hints/$xfile.sh ; then
3687                                         dflt=$xfile
3688                                 elif $test -f $src/hints/$xxfile.sh ; then
3689                                         dflt=$xxfile
3690                                 elif $test -f $src/hints/$xxxfile.sh ; then
3691                                         dflt=$xxxfile
3692                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3693                                         dflt=$xxxxfile
3694                                 elif $test -f "$src/hints/${osname}.sh" ; then
3695                                         dflt="${osname}"
3696                                 else
3697                                         dflt=none
3698                                 fi
3699                                 ;;
3700                         esac
3701                         ;;
3702                 esac
3703                 if $test -f Policy.sh ; then
3704                         case "$dflt" in
3705                         *Policy*) ;;
3706                         none) dflt="Policy" ;;
3707                         *) dflt="Policy $dflt" ;;
3708                         esac
3709                 fi
3710                 ;;
3711         *)
3712                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3713                 ;;
3714         esac
3715
3716         if $test -f Policy.sh ; then
3717                 $cat <<EOM
3718
3719 There's also a Policy hint file available, which should make the
3720 site-specific (policy) questions easier to answer.
3721 EOM
3722
3723         fi
3724
3725         $cat <<EOM
3726
3727 You may give one or more space-separated answers, or "none" if appropriate.
3728 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3729 previous run of Configure, you may specify it as well as or instead of
3730 OS-specific hints.  If hints are provided for your OS, you should use them:
3731 although Perl can probably be built without hints on many platforms, using
3732 hints often improve performance and may enable features that Configure can't
3733 set up on its own. If there are no hints that match your OS, specify "none";
3734 DO NOT give a wrong version or a wrong OS.
3735
3736 EOM
3737
3738         rp="Which of these apply, if any?"
3739         . UU/myread
3740         tans=$ans
3741         for file in $tans; do
3742                 if $test X$file = XPolicy -a -f Policy.sh; then
3743                         . Policy.sh
3744                         $cat Policy.sh >> UU/config.sh
3745                 elif $test -f $src/hints/$file.sh; then
3746                         . $src/hints/$file.sh
3747                         $cat $src/hints/$file.sh >> UU/config.sh
3748                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3749                         : nothing
3750                 else
3751                         : Give one chance to correct a possible typo.
3752                         echo "$file.sh does not exist"
3753                         dflt=$file
3754                         rp="hint to use instead?"
3755                         . UU/myread
3756                         for file in $ans; do
3757                                 if $test -f "$src/hints/$file.sh"; then
3758                                         . $src/hints/$file.sh
3759                                         $cat $src/hints/$file.sh >> UU/config.sh
3760                                 elif $test X$ans = X -o X$ans = Xnone ; then
3761                                         : nothing
3762                                 else
3763                                         echo "$file.sh does not exist -- ignored."
3764                                 fi
3765                         done
3766                 fi
3767         done
3768
3769         hint=recommended
3770         : Remember our hint file for later.
3771         if $test -f "$src/hints/$file.sh" ; then
3772                 hintfile="$file"
3773         else
3774                 hintfile=''
3775         fi
3776 fi
3777 cd UU
3778 ;;
3779 *)
3780         echo " "
3781         echo "Fetching default answers from $config_sh..." >&4
3782         tmp_n="$n"
3783         tmp_c="$c"
3784         cd ..
3785         cp $config_sh config.sh 2>/dev/null
3786         chmod +w config.sh
3787         . ./config.sh
3788         cd UU
3789         cp ../config.sh .
3790         n="$tmp_n"
3791         c="$tmp_c"
3792         hint=previous
3793         ;;
3794 esac
3795 . ./optdef.sh
3796
3797 : Restore computed paths
3798 for file in $loclist $trylist; do
3799         eval $file="\$_$file"
3800 done
3801
3802 cat << EOM
3803
3804 Configure uses the operating system name and version to set some defaults.
3805 The default value is probably right if the name rings a bell. Otherwise,
3806 since spelling matters for me, either accept the default or answer "none"
3807 to leave it blank.
3808
3809 EOM
3810 case "$osname" in
3811         ''|' ')
3812                 case "$hintfile" in
3813                 ''|' '|none) dflt=none ;;
3814                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3815                 esac
3816                 ;;
3817         *) dflt="$osname" ;;
3818 esac
3819 rp="Operating system name?"
3820 . ./myread
3821 case "$ans" in
3822 none)  osname='' ;;
3823 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3824 esac
3825 echo " "
3826 case "$osvers" in
3827         ''|' ')
3828                 case "$hintfile" in
3829                 ''|' '|none) dflt=none ;;
3830                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3831                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3832                         case "$dflt" in
3833                         ''|' ') dflt=none ;;
3834                         esac
3835                         ;;
3836                 esac
3837                 ;;
3838         *) dflt="$osvers" ;;
3839 esac
3840 rp="Operating system version?"
3841 . ./myread
3842 case "$ans" in
3843 none)  osvers='' ;;
3844 *) osvers="$ans" ;;
3845 esac
3846
3847
3848 . ./posthint.sh
3849
3850 : who configured the system
3851 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3852 case "$cf_by" in
3853 "")
3854         cf_by=`(logname) 2>/dev/null`
3855         case "$cf_by" in
3856         "")
3857                 cf_by=`(whoami) 2>/dev/null`
3858                 case "$cf_by" in
3859                 "") cf_by=unknown ;;
3860                 esac ;;
3861         esac ;;
3862 esac
3863
3864 : decide how portable to be.  Allow command line overrides.
3865 case "$d_portable" in
3866 "$undef") ;;
3867 *)      d_portable="$define" ;;
3868 esac
3869
3870 : set up shell script to do ~ expansion
3871 cat >filexp <<EOSS
3872 $startsh
3873 : expand filename
3874 case "\$1" in
3875  \~/*|\~)
3876         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3877         ;;
3878  \~*)
3879         if $test -f /bin/csh; then
3880                 /bin/csh -f -c "glob \$1"
3881                 failed=\$?
3882                 echo ""
3883                 exit \$failed
3884         else
3885                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3886                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3887                 if $test ! -d "\$dir"; then
3888                         me=\`basename \$0\`
3889                         echo "\$me: can't locate home directory for: \$name" >&2
3890                         exit 1
3891                 fi
3892                 case "\$1" in
3893                 */*)
3894                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3895                         ;;
3896                 *)
3897                         echo \$dir
3898                         ;;
3899                 esac
3900         fi
3901         ;;
3902 *)
3903         echo \$1
3904         ;;
3905 esac
3906 EOSS
3907 chmod +x filexp
3908 $eunicefix filexp
3909
3910 : now set up to get a file name
3911 cat <<EOS >getfile
3912 $startsh
3913 EOS
3914 cat <<'EOSC' >>getfile
3915 tilde=''
3916 fullpath=''
3917 already=''
3918 skip=''
3919 none_ok=''
3920 exp_file=''
3921 nopath_ok=''
3922 orig_rp="$rp"
3923 orig_dflt="$dflt"
3924 case "$gfpth" in
3925 '') gfpth='.' ;;
3926 esac
3927
3928 case "$fn" in
3929 *\(*)
3930         : getfile will accept an answer from the comma-separated list
3931         : enclosed in parentheses even if it does not meet other criteria.
3932         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3933         fn=`echo $fn | sed 's/(.*)//'`
3934         ;;
3935 esac
3936
3937 case "$fn" in
3938 *:*)
3939         loc_file=`expr $fn : '.*:\(.*\)'`
3940         fn=`expr $fn : '\(.*\):.*'`
3941         ;;
3942 esac
3943
3944 case "$fn" in
3945 *~*) tilde=true;;
3946 esac
3947 case "$fn" in
3948 */*) fullpath=true;;
3949 esac
3950 case "$fn" in
3951 *+*) skip=true;;
3952 esac
3953 case "$fn" in
3954 *n*) none_ok=true;;
3955 esac
3956 case "$fn" in
3957 *e*) exp_file=true;;
3958 esac
3959 case "$fn" in
3960 *p*) nopath_ok=true;;
3961 esac
3962
3963 case "$fn" in
3964 *f*) type='File';;
3965 *d*) type='Directory';;
3966 *l*) type='Locate';;
3967 esac
3968
3969 what="$type"
3970 case "$what" in
3971 Locate) what='File';;
3972 esac
3973
3974 case "$exp_file" in
3975 '')
3976         case "$d_portable" in
3977         "$define") ;;
3978         *) exp_file=true;;
3979         esac
3980         ;;
3981 esac
3982
3983 cd ..
3984 while test "$type"; do
3985         redo=''
3986         rp="$orig_rp"
3987         dflt="$orig_dflt"
3988         case "$tilde" in
3989         true) rp="$rp (~name ok)";;
3990         esac
3991         . UU/myread
3992         if test -f UU/getfile.ok && \
3993                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3994         then
3995                 value="$ans"
3996                 ansexp="$ans"
3997                 break
3998         fi
3999         case "$ans" in
4000         none)
4001                 value=''
4002                 ansexp=''
4003                 case "$none_ok" in
4004                 true) type='';;
4005                 esac
4006                 ;;
4007         *)
4008                 case "$tilde" in
4009                 '') value="$ans"
4010                         ansexp="$ans";;
4011                 *)
4012                         value=`UU/filexp $ans`
4013                         case $? in
4014                         0)
4015                                 if test "$ans" != "$value"; then
4016                                         echo "(That expands to $value on this system.)"
4017                                 fi
4018                                 ;;
4019                         *) value="$ans";;
4020                         esac
4021                         ansexp="$value"
4022                         case "$exp_file" in
4023                         '') value="$ans";;
4024                         esac
4025                         ;;
4026                 esac
4027                 case "$fullpath" in
4028                 true)
4029                         case "$ansexp" in
4030                         /*) value="$ansexp" ;;
4031                         [a-zA-Z]:/*) value="$ansexp" ;;
4032                         *)
4033                                 redo=true
4034                                 case "$already" in
4035                                 true)
4036                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4037                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4038                                         ;;
4039                                 *)
4040                                 echo "Please give a full path name, starting with slash." >&4
4041                                         case "$tilde" in
4042                                         true)
4043                                 echo "Note that using ~name is ok provided it expands well." >&4
4044                                                 already=true
4045                                                 ;;
4046                                         esac
4047                                 esac
4048                                 ;;
4049                         esac
4050                         ;;
4051                 esac
4052                 case "$redo" in
4053                 '')
4054                         case "$type" in
4055                         File)
4056                                 for fp in $gfpth; do
4057                                         if test "X$fp" = X.; then
4058                                             pf="$ansexp"
4059                                         else    
4060                                             pf="$fp/$ansexp"
4061                                         fi
4062                                         if test -f "$pf"; then
4063                                                 type=''
4064                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4065                                         then
4066                                                 echo "($value is not a plain file, but that's ok.)"
4067                                                 type=''
4068                                         fi
4069                                         if test X"$type" = X; then
4070                                             value="$pf"
4071                                             break
4072                                         fi
4073                                 done
4074                                 ;;
4075                         Directory)
4076                                 for fp in $gfpth; do
4077                                         if test "X$fp" = X.; then
4078                                             dir="$ans"
4079                                             direxp="$ansexp"
4080                                         else    
4081                                             dir="$fp/$ansexp"
4082                                             direxp="$fp/$ansexp"
4083                                         fi
4084                                         if test -d "$direxp"; then
4085                                                 type=''
4086                                                 value="$dir"
4087                                                 break
4088                                         fi
4089                                 done
4090                                 ;;
4091                         Locate)
4092                                 if test -d "$ansexp"; then
4093                                         echo "(Looking for $loc_file in directory $value.)"
4094                                         value="$value/$loc_file"
4095                                         ansexp="$ansexp/$loc_file"
4096                                 fi
4097                                 if test -f "$ansexp"; then
4098                                         type=''
4099                                 fi
4100                                 case "$nopath_ok" in
4101                                 true)   case "$value" in
4102                                         */*) ;;
4103                                         *)      echo "Assuming $value will be in people's path."
4104                                                 type=''
4105                                                 ;;
4106                                         esac
4107                                         ;;
4108                                 esac
4109                                 ;;
4110                         esac
4111
4112                         case "$skip" in
4113                         true) type='';
4114                         esac
4115
4116                         case "$type" in
4117                         '') ;;
4118                         *)
4119                                 if test "$fastread" = yes; then
4120                                         dflt=y
4121                                 else
4122                                         dflt=n
4123                                 fi
4124                                 rp="$what $value doesn't exist.  Use that name anyway?"
4125                                 . UU/myread
4126                                 dflt=''
4127                                 case "$ans" in
4128                                 y*) type='';;
4129                                 *) echo " ";;
4130                                 esac
4131                                 ;;
4132                         esac
4133                         ;;
4134                 esac
4135                 ;;
4136         esac
4137 done
4138 cd UU
4139 ans="$value"
4140 rp="$orig_rp"
4141 dflt="$orig_dflt"
4142 rm -f getfile.ok
4143 test "X$gfpthkeep" != Xy && gfpth=""
4144 EOSC
4145
4146 : determine root of directory hierarchy where package will be installed.
4147 case "$prefix" in
4148 '')
4149         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4150         ;;
4151 *?/)
4152         dflt=`echo "$prefix" | sed 's/.$//'`
4153         ;;
4154 *)
4155         dflt="$prefix"
4156         ;;
4157 esac
4158 $cat <<EOM
4159
4160 By default, $package will be installed in $dflt/bin, manual pages
4161 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4162 installation directories. Typically this is something like /usr/local.
4163 If you wish to have binaries under /usr/bin but other parts of the
4164 installation under /usr/local, that's ok: you will be prompted
4165 separately for each of the installation directories, the prefix being
4166 only used to set the defaults.
4167
4168 EOM
4169 fn=d~
4170 rp='Installation prefix to use?'
4171 . ./getfile
4172 oldprefix=''
4173 case "$prefix" in
4174 '') ;;
4175 *)
4176         case "$ans" in
4177         "$prefix") ;;
4178         *) oldprefix="$prefix";;
4179         esac
4180         ;;
4181 esac
4182 prefix="$ans"
4183 prefixexp="$ansexp"
4184
4185 : allow them to override the AFS root
4186 case "$afsroot" in
4187 '')     afsroot=/afs ;;
4188 *)      afsroot=$afsroot ;;
4189 esac
4190
4191 : is AFS running?
4192 echo " "
4193 case "$afs" in
4194 $define|true)   afs=true ;;
4195 $undef|false)   afs=false ;;
4196 *)      if $test -d $afsroot; then
4197                 afs=true
4198         else
4199                 afs=false
4200         fi
4201         ;;
4202 esac
4203 if $afs; then
4204         echo "AFS may be running... I'll be extra cautious then..." >&4
4205 else
4206         echo "AFS does not seem to be running..." >&4
4207 fi
4208
4209 : determine installation prefix for where package is to be installed.
4210 if $afs; then
4211 $cat <<EOM
4212
4213 Since you are running AFS, I need to distinguish the directory in which
4214 files will reside from the directory in which they are installed (and from
4215 which they are presumably copied to the former directory by occult means).
4216
4217 EOM
4218         case "$installprefix" in
4219         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4220         *) dflt="$installprefix";;
4221         esac
4222 else
4223 $cat <<EOM
4224
4225 In some special cases, particularly when building $package for distribution,
4226 it is convenient to distinguish the directory in which files should be
4227 installed from the directory ($prefix) in which they will
4228 eventually reside.  For most users, these two directories are the same.
4229
4230 EOM
4231         case "$installprefix" in
4232         '') dflt=$prefix ;;
4233         *) dflt=$installprefix;;
4234         esac
4235 fi
4236 fn=d~
4237 rp='What installation prefix should I use for installing files?'
4238 . ./getfile
4239 installprefix="$ans"
4240 installprefixexp="$ansexp"
4241
4242 : Perform the prefixexp/installprefixexp correction if necessary
4243 cat <<EOS >installprefix
4244 $startsh
4245 EOS
4246 cat <<'EOSC' >>installprefix
4247 : Change installation prefix, if necessary.
4248 if $test X"$prefix" != X"$installprefix"; then
4249     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4250 else
4251     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4252 fi
4253 EOSC
4254 chmod +x installprefix
4255 $eunicefix installprefix
4256
4257 : Set variables such as privlib and privlibexp from the output of ./getfile
4258 : performing the prefixexp/installprefixexp correction if necessary.
4259 cat <<EOS >setprefixvar
4260 $startsh
4261 EOS
4262 cat <<'EOSC' >>setprefixvar
4263 eval "${prefixvar}=\"\$ans\""
4264 eval "${prefixvar}exp=\"\$ansexp\""
4265 . ./installprefix
4266 EOSC
4267 chmod +x setprefixvar
4268 $eunicefix setprefixvar
4269
4270 : set up the script used to warn in case of inconsistency
4271 cat <<EOS >whoa
4272 $startsh
4273 EOS
4274 cat <<'EOSC' >>whoa
4275 dflt=y
4276 case "$hint" in
4277     recommended)
4278         case "$hintfile" in
4279         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4280                 ;;
4281         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4282                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4283                 ;;
4284         esac
4285         ;;
4286     *)  echo " "
4287         echo "*** WHOA THERE!!! ***" >&4
4288         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4289         ;;
4290 esac
4291 rp="    Keep the $hint value?"
4292 . ./myread
4293 case "$ans" in
4294 y) td=$was; tu=$was;;
4295 esac
4296 EOSC
4297
4298 : function used to set '$1' to '$val'
4299 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4300 case "$val$was" in
4301 $define$undef) . ./whoa; eval "$var=\$td";;
4302 $undef$define) . ./whoa; eval "$var=\$tu";;
4303 *) eval "$var=$val";;
4304 esac'
4305
4306 : get the patchlevel
4307 echo " "
4308 echo "Getting the current patchlevel..." >&4
4309 if $test -r $rsrc/patchlevel.h;then
4310         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4311         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4312         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4313         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4314         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4315         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4316         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4317 else
4318         revision=0
4319         patchlevel=0
4320         subversion=0
4321         api_revision=0
4322         api_version=0
4323         api_subversion=0
4324         perl_patchlevel=0
4325         $echo "(You do not have patchlevel.h.  Eek.)"
4326 fi
4327 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4328 version_patchlevel_string="version $patchlevel subversion $subversion"
4329 case "$perl_patchlevel" in
4330 0|'') ;;
4331 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4332     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4333     ;;
4334 esac
4335
4336 $echo "(You have $package $version_patchlevel_string.)"
4337
4338 case "$osname" in
4339 dos|vms)
4340         : XXX Should be a Configure test for double-dots in filenames.
4341         version=`echo $revision $patchlevel $subversion | \
4342                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4343         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4344                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4345         ;;
4346 *)
4347         version=`echo $revision $patchlevel $subversion | \
4348                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4349         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4350                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4351         ;;
4352 esac
4353 : Special case the 5.005_xx maintenance series, which used 5.005
4354 : without any subversion label as a subdirectory in $sitelib
4355 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4356         api_versionstring='5.005'
4357 fi
4358
4359 : Do we want threads support and if so, what type
4360 case "$usethreads" in
4361 $define|true|[yY]*)     dflt='y';;
4362 *)     # Catch case where user specified ithreads or 5005threads but
4363        # forgot -Dusethreads (A.D. 4/2002)
4364        case "$useithreads$use5005threads" in
4365        *$define*)       dflt='y';;
4366        *)               dflt='n';;
4367        esac
4368        ;;
4369 esac
4370 cat <<EOM
4371
4372 Perl can be built to offer a form of threading support on some systems
4373 To do so, Configure can be run with -Dusethreads.
4374
4375 Note that Perl built with threading support runs slightly slower
4376 and uses slightly more memory than plain Perl.
4377
4378 If this doesn't make any sense to you, just accept the default '$dflt'.
4379 EOM
4380 rp='Build a threading Perl?'
4381 . ./myread
4382 case "$ans" in
4383 y|Y)    val="$define" ;;
4384 *)      val="$undef" ;;
4385 esac
4386 set usethreads
4387 eval $setvar
4388
4389 if $test $patchlevel -lt 9; then
4390     case "$usethreads" in
4391     $define)
4392         : Default to ithreads unless overridden on command line or with
4393         : old config.sh
4394         dflt='y'
4395         case "$use5005threads" in
4396                 $define|true|[yY]*)
4397                         echo "5.005 threads are no longer supported"
4398                         exit 1
4399                 ;;
4400         esac
4401         case "$useithreads" in
4402                 $undef|false|[nN]*) dflt='n';;
4403         esac
4404         rp='Use the newer interpreter-based ithreads?'
4405         . ./myread
4406         case "$ans" in
4407         y|Y)    val="$define" ;;
4408         *)      val="$undef" ;;
4409         esac
4410         set useithreads
4411         eval $setvar
4412         : Now set use5005threads to the opposite value.
4413         case "$useithreads" in
4414         $define) val="$undef" ;;
4415         *) val="$define" ;;
4416         esac
4417         set use5005threads
4418         eval $setvar
4419         ;;
4420     *)
4421         useithreads="$undef"
4422         use5005threads="$undef"
4423         ;;
4424     esac
4425
4426     case "$useithreads$use5005threads" in
4427     "$define$define")
4428         $cat >&4 <<EOM
4429
4430 You cannot have both the ithreads and the 5.005 threads enabled
4431 at the same time.  Disabling the 5.005 threads since they are
4432 much less stable than the ithreads.
4433
4434 EOM
4435         use5005threads="$undef"
4436         ;;
4437     esac
4438
4439 else
4440 : perl-5.9.x and later
4441
4442     if test X"$usethreads" = "X$define"; then
4443         case "$use5005threads" in
4444             $define|true|[yY]*)
4445                 $cat >&4 <<EOM
4446
4447 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4448
4449 EOM
4450             ;;
4451         esac
4452     fi
4453
4454     use5005threads="$undef"
4455     useithreads="$usethreads"
4456 fi
4457
4458 case "$d_oldpthreads" in
4459 '')     : Configure tests would be welcome here.  For now, assume undef.
4460         val="$undef" ;;
4461 *)      val="$d_oldpthreads" ;;
4462 esac
4463 set d_oldpthreads
4464 eval $setvar
4465
4466
4467 : Look for a hint-file generated 'call-back-unit'.  If the
4468 : user has specified that a threading perl is to be built,
4469 : we may need to set or change some other defaults.
4470 if $test -f usethreads.cbu; then
4471     echo "Your platform has some specific hints regarding threaded builds, using them..."
4472     . ./usethreads.cbu
4473 else
4474     case "$usethreads" in
4475         "$define"|true|[yY]*)
4476                 $cat <<EOM
4477 (Your platform does not have any specific hints for threaded builds.
4478  Assuming POSIX threads, then.)
4479 EOM
4480         ;;
4481     esac
4482 fi
4483
4484 : Check if multiplicity is required
4485 cat <<EOM
4486
4487 Perl can be built so that multiple Perl interpreters can coexist
4488 within the same Perl executable.
4489 EOM
4490
4491 case "$useithreads" in
4492 $define)
4493         cat <<EOM
4494 This multiple interpreter support is required for interpreter-based threads.
4495 EOM
4496         val="$define"
4497         ;;
4498 *)      case "$usemultiplicity" in
4499         $define|true|[yY]*)     dflt='y';;
4500         *) dflt='n';;
4501         esac
4502         echo " "
4503         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4504         rp='Build Perl for multiplicity?'
4505         . ./myread
4506         case "$ans" in
4507         y|Y)    val="$define" ;;
4508         *)      val="$undef" ;;
4509         esac
4510         ;;
4511 esac
4512 set usemultiplicity
4513 eval $setvar
4514
4515 : Check if morebits is requested
4516 case "$usemorebits" in
4517 "$define"|true|[yY]*)
4518         use64bitint="$define"
4519         uselongdouble="$define"
4520         usemorebits="$define"
4521         ;;
4522 *)      usemorebits="$undef"
4523         ;;
4524 esac
4525
4526 : Determine the C compiler to be used
4527 echo " "
4528 case "$cc" in
4529 '') dflt=cc;;
4530 *) dflt="$cc";;
4531 esac
4532 rp="Use which C compiler?"
4533 . ./myread
4534 cc="$ans"
4535
4536 : See whether they have no cc but they do have gcc
4537 . ./trygcc
4538 if $test -f cc.cbu; then
4539     . ./cc.cbu
4540 fi
4541 . ./checkcc
4542
4543 : make some quick guesses about what we are up against
4544 echo " "
4545 $echo $n "Hmm...  $c"
4546 echo exit 1 >bsd
4547 echo exit 1 >usg
4548 echo exit 1 >v7
4549 echo exit 1 >osf1
4550 echo exit 1 >eunice
4551 echo exit 1 >xenix
4552 echo exit 1 >venix
4553 echo exit 1 >os2
4554 d_bsd="$undef"
4555 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4556 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4557 then
4558         echo "Looks kind of like an OSF/1 system, but we'll see..."
4559         echo exit 0 >osf1
4560 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4561         xxx=`./loc addbib blurfl $pth`
4562         if $test -f $xxx; then
4563         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4564                 echo exit 0 >bsd
4565                 echo exit 0 >usg
4566         else
4567                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4568                         echo "Looks kind of like an extended USG system, but we'll see..."
4569                 else
4570                         echo "Looks kind of like a USG system, but we'll see..."
4571                 fi
4572                 echo exit 0 >usg
4573         fi
4574 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4575         echo "Looks kind of like a BSD system, but we'll see..."
4576         d_bsd="$define"
4577         echo exit 0 >bsd
4578 else
4579         echo "Looks kind of like a Version 7 system, but we'll see..."
4580         echo exit 0 >v7
4581 fi
4582 case "$eunicefix" in
4583 *unixtovms*)
4584         $cat <<'EOI'
4585 There is, however, a strange, musty smell in the air that reminds me of
4586 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4587 EOI
4588         echo exit 0 >eunice
4589         d_eunice="$define"
4590 : it so happens the Eunice I know will not run shell scripts in Unix format
4591         ;;
4592 *)
4593         echo " "
4594         echo "Congratulations.  You aren't running Eunice."
4595         d_eunice="$undef"
4596         ;;
4597 esac
4598 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4599 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4600 : semicolon as a patch separator
4601 case "$p_" in
4602 :) ;;
4603 *)
4604         $cat <<'EOI'
4605 I have the feeling something is not exactly right, however...don't tell me...
4606 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4607 (Or you may be running DOS with DJGPP.)
4608 EOI
4609         echo exit 0 >os2
4610         ;;
4611 esac
4612 if test -f /xenix; then
4613         echo "Actually, this looks more like a XENIX system..."
4614         echo exit 0 >xenix
4615         d_xenix="$define"
4616 else
4617         echo " "
4618         echo "It's not Xenix..."
4619         d_xenix="$undef"
4620 fi
4621 chmod +x xenix
4622 $eunicefix xenix
4623 if test -f /venix; then
4624         echo "Actually, this looks more like a VENIX system..."
4625         echo exit 0 >venix
4626 else
4627         echo " "
4628         if ./xenix; then
4629                 : null
4630         else
4631                 echo "Nor is it Venix..."
4632         fi
4633 fi
4634 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4635 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4636 $rm -f foo
4637
4638 : Check if we are using GNU gcc and what its version is
4639 echo " "
4640 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4641 $cat >try.c <<EOM
4642 #include <stdio.h>
4643 int main() {
4644 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4645 #ifdef __VERSION__
4646         printf("%s\n", __VERSION__);
4647 #else
4648         printf("%s\n", "1");
4649 #endif
4650 #endif
4651         return(0);
4652 }
4653 EOM
4654 if $cc -o try $ccflags $ldflags try.c; then
4655         gccversion=`$run ./try`
4656         case "$gccversion" in
4657         '') echo "You are not using GNU cc." ;;
4658         *)  echo "You are using GNU cc $gccversion."
4659             ccname=gcc
4660             ;;
4661         esac
4662 else
4663         echo " "
4664         echo "*** WHOA THERE!!! ***" >&4
4665         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4666         case "$knowitall" in
4667         '')
4668         echo "    You'd better start hunting for one and let me know about it." >&4
4669                 exit 1
4670                 ;;
4671         esac
4672 fi
4673 $rm -f try try.*
4674 case "$gccversion" in
4675 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4676 esac
4677 case "$gccversion" in
4678 '') gccosandvers='' ;;
4679 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4680    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4681    gccshortvers=''
4682    case "$gccosandvers" in
4683    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4684    $osname$osvers) ;; # looking good
4685    $osname*) cat <<EOM >&4
4686
4687 *** WHOA THERE!!! ***
4688
4689     Your gcc has not been compiled for the exact release of
4690     your operating system ($gccosandvers versus $osname$osvers).
4691
4692     In general it is a good idea to keep gcc synchronized with
4693     the operating system because otherwise serious problems
4694     may ensue when trying to compile software, like Perl.
4695
4696     I'm trying to be optimistic here, though, and will continue.
4697     If later during the configuration and build icky compilation
4698     problems appear (headerfile conflicts being the most common
4699     manifestation), I suggest reinstalling the gcc to match
4700     your operating system release.
4701
4702 EOM
4703       ;;
4704    *) gccosandvers='' ;; # failed to parse, better be silent
4705    esac
4706    ;;
4707 esac
4708 case "$ccname" in
4709 '') ccname="$cc" ;;
4710 esac
4711
4712 # gcc 3.* complain about adding -Idirectories that they already know about,
4713 # so we will take those off from locincpth.
4714 case "$gccversion" in
4715 3*)
4716     echo "main(){}">try.c
4717     for incdir in $locincpth; do
4718        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4719              grep '^c[cp]p*[01]: warning: changing search order '`
4720        if test "X$warn" != X; then
4721            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4722        fi
4723     done
4724     $rm -f try try.*
4725 esac
4726
4727 # gcc 4.9 by default does some optimizations that break perl.
4728 # see ticket 121505.
4729 #
4730 # The -fwrapv disables those optimizations (and probably others,) so
4731 # for gcc 4.9 (and later, since the optimizations probably won't go
4732 # away), add -fwrapv unless the user requests -fno-wrapv, which
4733 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4734 # which turns the overflows -fwrapv ignores into runtime errors.
4735 case "$gccversion" in
4736 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4737     case "$ccflags" in
4738     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4739     *) ccflags="$ccflags -fwrapv" ;;
4740     esac
4741 esac
4742
4743 : What should the include directory be ?
4744 : Use sysroot if set, so findhdr looks in the right place.
4745 echo " "
4746 $echo $n "Hmm...  $c"
4747 dflt="$sysroot/usr/include"
4748 incpath=''
4749 mips_type=''
4750 if $test -f /bin/mips && /bin/mips; then
4751         echo "Looks like a MIPS system..."
4752         $cat >usr.c <<'EOCP'
4753 #ifdef SYSTYPE_BSD43
4754 /bsd43
4755 #endif
4756 EOCP
4757         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4758                 dflt='/bsd43/usr/include'
4759                 incpath='/bsd43'
4760                 mips_type='BSD 4.3'
4761         else
4762                 mips_type='System V'
4763         fi
4764         $rm -f usr.c usr.out
4765         echo "and you're compiling with the $mips_type compiler and libraries."
4766         xxx_prompt=y
4767         echo "exit 0" >mips
4768 else
4769         echo "Doesn't look like a MIPS system."
4770         xxx_prompt=n
4771         echo "exit 1" >mips
4772 fi
4773 chmod +x mips
4774 $eunicefix mips
4775 case "$usrinc" in
4776 '') ;;
4777 *) dflt="$usrinc";;
4778 esac
4779 case "$xxx_prompt" in
4780 y)      fn=d/
4781         echo " "
4782         rp='Where are the include files you want to use?'
4783         . ./getfile
4784         usrinc="$ans"
4785         ;;
4786 *)      usrinc="$dflt"
4787         ;;
4788 esac
4789
4790 : see how we invoke the C preprocessor
4791 echo " "
4792 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4793 cat <<'EOT' >testcpp.c
4794 #define ABC abc
4795 #define XYZ xyz
4796 ABC.XYZ
4797 EOT
4798 cd ..
4799 if test ! -f cppstdin; then
4800         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4801                 # AIX cc -E doesn't show the absolute headerfile
4802                 # locations but we'll cheat by using the -M flag.
4803                 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
4804         else
4805                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4806         fi
4807 else
4808         echo "Keeping your $hint cppstdin wrapper."
4809 fi
4810 chmod 755 cppstdin
4811 wrapper=`pwd`/cppstdin
4812 ok='false'
4813 cd UU
4814
4815 if $test "X$cppstdin" != "X" && \
4816         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4817         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4818 then
4819         echo "You used to use $cppstdin $cppminus so we'll use that again."
4820         case "$cpprun" in
4821         '') echo "But let's see if we can live without a wrapper..." ;;
4822         *)
4823                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4824                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4825                 then
4826                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4827                         ok='true'
4828                 else
4829                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4830                 fi
4831                 ;;
4832         esac
4833 else
4834         case "$cppstdin" in
4835         '') ;;
4836         *)
4837                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4838                 ;;
4839         esac
4840 fi
4841
4842 if $ok; then
4843         : nothing
4844 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4845         $cc -E <testcpp.c >testcpp.out 2>&1; \
4846         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4847         echo "Yup, it does."
4848         x_cpp="$cc $cppflags -E"
4849         x_minus='';
4850 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4851         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4852         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4853         echo "Yup, it does."
4854         x_cpp="$cc $cppflags -E"
4855         x_minus='-';
4856 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4857         $cc -P <testcpp.c >testcpp.out 2>&1; \
4858         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4859         echo "Yipee, that works!"
4860         x_cpp="$cc $cppflags -P"
4861         x_minus='';
4862 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4863         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4864         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4865         echo "At long last!"
4866         x_cpp="$cc $cppflags -P"
4867         x_minus='-';
4868 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4869         $cpp <testcpp.c >testcpp.out 2>&1; \
4870         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4871         echo "It works!"
4872         x_cpp="$cpp $cppflags"
4873         x_minus='';
4874 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4875         $cpp - <testcpp.c >testcpp.out 2>&1; \
4876         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4877         echo "Hooray, it works!  I was beginning to wonder."
4878         x_cpp="$cpp $cppflags"
4879         x_minus='-';
4880 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4881         $wrapper <testcpp.c >testcpp.out 2>&1; \
4882         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4883         x_cpp="$wrapper"
4884         x_minus=''
4885         echo "Eureka!"
4886 else
4887         dflt=''
4888         rp="No dice.  I can't find a C preprocessor.  Name one:"
4889         . ./myread
4890         x_cpp="$ans"
4891         x_minus=''
4892         $x_cpp <testcpp.c >testcpp.out 2>&1
4893         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4894                 echo "OK, that will do." >&4
4895         else
4896 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4897                 exit 1
4898         fi
4899 fi
4900
4901 case "$ok" in
4902 false)
4903         cppstdin="$x_cpp"
4904         cppminus="$x_minus"
4905         cpprun="$x_cpp"
4906         cpplast="$x_minus"
4907         set X $x_cpp
4908         shift
4909         case "$1" in
4910         "$cpp")
4911                 echo "Perhaps can we force $cc -E using a wrapper..."
4912                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4913                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4914                 then
4915                         echo "Yup, we can."
4916                         cppstdin="$wrapper"
4917                         cppminus='';
4918                 else
4919                         echo "Nope, we'll have to live without it..."
4920                 fi
4921                 ;;
4922         esac
4923         case "$cpprun" in
4924         "$wrapper")
4925                 cpprun=''
4926                 cpplast=''
4927                 ;;
4928         esac
4929         ;;
4930 esac
4931
4932 case "$cppstdin" in
4933 "$wrapper"|'cppstdin') ;;
4934 *) $rm -f $wrapper;;
4935 esac
4936 $rm -f testcpp.c testcpp.out
4937
4938 : Adjust cppfilter for path component separator
4939 case "$osname" in
4940 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4941 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4942 *)   cppfilter='' ;;
4943 esac
4944
4945 : Use gcc to determine libpth and incpth
4946 # If using gcc or clang, we can get better values for libpth, incpth
4947 # and usrinc directly from the compiler.
4948 # Note that ccname for clang is also gcc.
4949 case "$ccname" in
4950     gcc)
4951         $echo 'extern int foo;' > try.c
4952         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4953         shift
4954         if $test $# -gt 0; then
4955             incpth="$incpth $*"
4956             incpth="`$echo $incpth|$sed 's/^ //'`"
4957             for i in $*; do
4958                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4959                 if $test -d $j; then
4960                     libpth="$libpth $j"
4961                 fi
4962             done
4963             libpth="`$echo $libpth|$sed 's/^ //'`"
4964             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4965                 if $test -d $xxx; then
4966                     case " $libpth " in
4967                     *" $xxx "*) ;;
4968                     *) libpth="$libpth $xxx";;
4969                     esac
4970                 fi
4971             done
4972         fi
4973         $rm -f try.c
4974         case "$usrinc" in
4975         '') for i in $incpth; do
4976                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4977                     usrinc="$i"
4978                     break
4979                 fi
4980             done
4981             ;;
4982         esac
4983
4984         case "$usecrosscompile" in
4985         $define|true|[yY]*)
4986             case "$incpth" in
4987                 '') echo "Incpth not defined." >&4; croak=y ;;
4988                 *)  echo "Using incpth '$incpth'." >&4 ;;
4989             esac
4990             case "$libpth" in
4991                 '') echo "Libpth not defined." >&4; croak=y ;;
4992                 *)  echo "Using libpth '$libpth'." >&4 ;;
4993             esac
4994             case "$usrinc" in
4995                 '') echo "Usrinc not defined." >&4; croak=y ;;
4996                 *)  echo "Using usrinc $usrinc." >&4 ;;
4997             esac
4998             case "$croak" in
4999                 y)
5000                 if test "X$sysroot" = X; then
5001                     echo "Cannot continue, aborting." >&4; exit 1
5002                 else
5003                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5004                 fi
5005                 ;;
5006             esac
5007             ;;
5008         esac
5009     ;;
5010 esac
5011
5012 : Default value for incpth is just usrinc
5013 case "$incpth" in
5014 '') incpth="$usrinc";;
5015 esac
5016
5017 : Set private lib path
5018 case "$plibpth" in
5019 '') if ./mips; then
5020         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5021     fi;;
5022 esac
5023 case "$libpth" in
5024 ' ') dlist='';;
5025 '') dlist="$loclibpth $plibpth $glibpth";;
5026 *) dlist="$libpth";;
5027 esac
5028
5029 : Now check and see which directories actually exist, avoiding duplicates
5030 for xxx in $dlist
5031 do
5032     if $test -d $xxx; then
5033                 case " $libpth " in
5034                 *" $xxx "*) ;;
5035                 *) libpth="$libpth $xxx";;
5036                 esac
5037     fi
5038 done
5039 $cat <<'EOM'
5040
5041 Some systems have incompatible or broken versions of libraries.  Among
5042 the directories listed in the question below, please remove any you
5043 know not to be holding relevant libraries, and add any that are needed.
5044 Say "none" for none.
5045
5046 EOM
5047
5048 if test "X$sysroot" != X; then
5049     $cat <<EOM
5050 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5051
5052 EOM
5053 fi
5054
5055 case "$libpth" in
5056 '') dflt='none';;
5057 *)
5058         set X $libpth
5059         shift
5060         dflt=${1+"$@"}
5061         ;;
5062 esac
5063 rp="Directories to use for library searches?"
5064 . ./myread
5065 case "$ans" in
5066 none) libpth=' ';;
5067 *) libpth="$ans";;
5068 esac
5069
5070 : compute shared library extension
5071 case "$so" in
5072 '')
5073         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5074                 dflt='sl'
5075         else
5076                 dflt='so'
5077         fi
5078         ;;
5079 *) dflt="$so";;
5080 esac
5081 $cat <<EOM
5082
5083 On some systems, shared libraries may be available.  Answer 'none' if
5084 you want to suppress searching of shared libraries for the remainder
5085 of this configuration.
5086
5087 EOM
5088 rp='What is the file extension used for shared libraries?'
5089 . ./myread
5090 so="$ans"
5091
5092 : Does target system insist that shared library basenames are unique
5093 $cat << EOM
5094
5095 Some dynamic loaders assume that the *basename* of shared library filenames
5096 are globally unique.  We'll default this to undef as we assume your system
5097 is not this weird. Set to defined if you're on one of them.
5098
5099 EOM
5100
5101 dflt='n'
5102 rp='Make shared library basenames unique?'
5103 . ./myread
5104 case "$ans" in
5105 y|Y) val="$define" ;;
5106 *)   val="$undef"  ;;
5107 esac
5108 set d_libname_unique
5109 eval $setvar
5110
5111 : Define several unixisms.
5112 : Hints files or command line option can be used to override them.
5113 : The convoluted testing is in case hints files set either the old
5114 : or the new name.
5115 case "$_exe" in
5116 '')     case "$exe_ext" in
5117         '')     ;;
5118         *)      _exe="$exe_ext" ;;
5119         esac
5120         ;;
5121 esac
5122 case "$_a" in
5123 '')     case "$lib_ext" in
5124     '') _a='.a';;
5125         *)      _a="$lib_ext" ;;
5126         esac
5127         ;;
5128 esac
5129 case "$_o" in
5130 '') case "$obj_ext" in
5131         '')     _o='.o';;
5132         *)      _o="$obj_ext";;
5133         esac
5134         ;;
5135 esac
5136 case "$p_" in
5137 '') case "$path_sep" in
5138         '')     p_=':';;
5139         *)      p_="$path_sep";;
5140         esac
5141         ;;
5142 esac
5143 exe_ext=$_exe
5144 lib_ext=$_a
5145 obj_ext=$_o
5146 path_sep=$p_
5147
5148 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5149
5150 : Which makefile gets called first.  This is used by make depend.
5151 case "$firstmakefile" in
5152 '') firstmakefile='makefile';;
5153 esac
5154
5155 : Check is we will use socks
5156 case "$usesocks" in
5157 $define|true|[yY]*)     dflt='y';;
5158 *) dflt='n';;
5159 esac
5160 cat <<EOM
5161
5162 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5163 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5164 to use the PerlIO abstraction layer, this will be implicitly selected.
5165
5166 If this doesn't make any sense to you, just accept the default '$dflt'.
5167 EOM
5168 rp='Build Perl for SOCKS?'
5169 . ./myread
5170 case "$ans" in
5171 y|Y)    val="$define" ;;
5172 *)      val="$undef" ;;
5173 esac
5174 set usesocks
5175 eval $setvar
5176
5177 : Check for uselongdouble support
5178 case "$ccflags" in
5179 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5180 esac
5181
5182 case "$uselongdouble" in
5183 $define|true|[yY]*)     dflt='y';;
5184 *) dflt='n';;
5185 esac
5186 cat <<EOM
5187
5188 Perl can be built to take advantage of long doubles which
5189 (if available) may give more accuracy and range for floating point numbers.
5190
5191 If this doesn't make any sense to you, just accept the default '$dflt'.
5192 EOM
5193 rp='Try to use long doubles if available?'
5194 . ./myread
5195 case "$ans" in
5196 y|Y)    val="$define"   ;;
5197 *)      val="$undef"    ;;
5198 esac
5199 set uselongdouble
5200 eval $setvar
5201
5202 case "$uselongdouble" in
5203 true|[yY]*) uselongdouble="$define" ;;
5204 esac
5205
5206 : Look for a hint-file generated 'call-back-unit'.  If the
5207 : user has specified that long doubles should be used,
5208 : we may need to set or change some other defaults.
5209 if $test -f uselongdouble.cbu; then
5210     echo "Your platform has some specific hints regarding long doubles, using them..."
5211     . ./uselongdouble.cbu
5212 else
5213     case "$uselongdouble" in
5214         $define)
5215                 $cat <<EOM
5216 (Your platform does not have any specific hints for long doubles.)
5217 EOM
5218         ;;
5219     esac
5220 fi
5221
5222 : Check if quadmath is requested
5223 case "$usequadmath" in
5224 "$define"|true|[yY]*) usequadmath="$define" ;;
5225 *)                    usequadmath="$undef"  ;;
5226 esac
5227
5228 : Looking for optional libraries
5229 echo " "
5230 echo "Checking for optional libraries..." >&4
5231 case "$libs" in
5232 ' '|'') dflt='';;
5233 *) dflt="$libs";;
5234 esac
5235 case "$libswanted" in
5236 '') libswanted='c_s';;
5237 esac
5238 case "$usesocks" in
5239 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5240 esac
5241 case "$usecbacktrace" in
5242 "$define") libswanted="$libswanted bfd" ;;
5243 esac
5244 case "$usequadmath" in
5245 "$define") libswanted="$libswanted quadmath" ;;
5246 esac
5247 libsfound=''
5248 libsfiles=''
5249 libsdirs=''
5250 libspath=''
5251 for thisdir in $libpth $xlibpth; do
5252   test -d $thisdir && libspath="$libspath $thisdir"
5253 done
5254 for thislib in $libswanted; do
5255         for thisdir in $libspath; do
5256             xxx=''
5257             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5258                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5259                 $test -f "$xxx" && eval $libscheck
5260                 $test -f "$xxx" && libstyle=shared
5261                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5262                 $test -f "$xxx" && eval $libscheck
5263                 $test -f "$xxx" && libstyle=shared
5264             fi
5265             if test ! -f "$xxx"; then
5266                 xxx=$thisdir/lib$thislib.$so
5267                 $test -f "$xxx" && eval $libscheck
5268                 $test -f "$xxx" && libstyle=shared
5269             fi
5270             if test ! -f "$xxx"; then
5271                 xxx=$thisdir/lib$thislib$_a
5272                 $test -f "$xxx" && eval $libscheck
5273                 $test -f "$xxx" && libstyle=static
5274             fi
5275             if test ! -f "$xxx"; then
5276                 xxx=$thisdir/$thislib$_a
5277                 $test -f "$xxx" && eval $libscheck
5278                 $test -f "$xxx" && libstyle=static
5279             fi
5280             if test ! -f "$xxx"; then
5281                 xxx=$thisdir/lib${thislib}_s$_a
5282                 $test -f "$xxx" && eval $libscheck
5283                 $test -f "$xxx" && libstyle=static
5284                 $test -f "$xxx" && thislib=${thislib}_s
5285             fi
5286             if test ! -f "$xxx"; then
5287                 xxx=$thisdir/Slib$thislib$_a
5288                 $test -f "$xxx" && eval $libscheck
5289                 $test -f "$xxx" && libstyle=static
5290             fi
5291             if $test -f "$xxx"; then
5292                 case "$libstyle" in
5293                 shared) echo "Found -l$thislib (shared)." ;;
5294                 static) echo "Found -l$thislib." ;;
5295                 *)      echo "Found -l$thislib ($libstyle)." ;;
5296                 esac
5297                 case " $dflt " in
5298                 *"-l$thislib "*);;
5299                 *) dflt="$dflt -l$thislib"
5300                    libsfound="$libsfound $xxx"
5301                    yyy=`basename $xxx`
5302                    libsfiles="$libsfiles $yyy"
5303                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5304                    case " $libsdirs " in
5305                    *" $yyy "*) ;;
5306                    *) libsdirs="$libsdirs $yyy" ;;
5307                    esac
5308                    ;;
5309                 esac
5310                 break
5311             fi
5312         done
5313         if $test ! -f "$xxx"; then
5314             echo "No -l$thislib."
5315         fi
5316 done
5317 set X $dflt
5318 shift
5319 dflt="$*"
5320 case "$libs" in
5321 '') dflt="$dflt";;
5322 *) dflt="$libs";;
5323 esac
5324 case "$dflt" in
5325 ' '|'') dflt='none';;
5326 esac
5327
5328 $cat <<EOM
5329
5330 In order to compile $package on your machine, a number of libraries
5331 are usually needed.  Include any other special libraries here as well.
5332 Say "none" for none.  The default list is almost always right.
5333 EOM
5334
5335 echo " "
5336 rp="What libraries to use?"
5337 . ./myread
5338 case "$ans" in
5339 none) libs=' ';;
5340 *) libs="$ans";;
5341 esac
5342
5343 : determine optimization, if desired, or use for debug flag also
5344 case "$optimize" in
5345 ' '|$undef) dflt='none';;
5346 '') dflt='-O';;
5347 *) dflt="$optimize";;
5348 esac
5349 $cat <<EOH
5350
5351 By default, $package compiles with the -O flag to use the optimizer.
5352 Alternately, you might want to use the symbolic debugger, which uses
5353 the -g flag (on traditional Unix systems).  Either flag can be
5354 specified here.  To use neither flag, specify the word "none".
5355
5356 EOH
5357 rp="What optimizer/debugger flag should be used?"
5358 . ./myread
5359 optimize="$ans"
5360 case "$optimize" in
5361 'none') optimize=" ";;
5362 esac
5363
5364 : Check what DEBUGGING is required from the command line
5365 : -DEBUGGING      or -DDEBUGGING or
5366 : -DEBUGGING=both                       = -g + -DDEBUGGING
5367 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5368 : -DEBUGGING=none or -UDEBUGGING        =
5369 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5370 case "$EBUGGING" in
5371 '')     ;;
5372 *)      DEBUGGING=$EBUGGING ;;
5373 esac
5374
5375 case "$DEBUGGING" in
5376 -g|both|$define)
5377     case "$optimize" in
5378         *-g*) ;;
5379         *)    optimize="$optimize -g" ;;
5380     esac ;;
5381 none|$undef)
5382     case "$optimize" in
5383         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5384                 shift
5385                 optimize="$*"
5386                 ;;
5387     esac ;;
5388 esac
5389
5390 dflt=''
5391 case "$DEBUGGING" in
5392 both|$define) dflt='-DDEBUGGING'
5393 esac
5394
5395 : argument order is deliberate, as the flag will start with - which set could
5396 : think is an option
5397 checkccflag='check=$1; flag=$2; callback=$3;
5398 echo " ";
5399 echo "Checking if your compiler accepts $flag" 2>&1;
5400 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5401 echo "int main(void) { return 0; }" > gcctest.c;
5402 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5403     echo "Yes, it does." 2>&1;
5404     if $test -s gcctest.out ; then
5405         echo "But your platform does not like it:";
5406         cat gcctest.out;
5407     else
5408         case "$ccflags" in
5409         *$check*)
5410             echo "Leaving current flags $ccflags alone." 2>&1
5411             ;;
5412         *) dflt="$dflt $flag";
5413             eval $callback
5414             ;;
5415         esac
5416     fi
5417 else
5418     echo "Nope, it does not, but that is ok." 2>&1;
5419 fi
5420 '
5421
5422 : We will not override a previous value, but we might want to
5423 : augment a hint file
5424 case "$hint" in
5425 default|recommended)
5426         case "$gccversion" in
5427         1*) dflt="$dflt -fpcc-struct-return" ;;
5428         esac
5429         case "$optimize:$DEBUGGING" in
5430         *-g*:old) dflt="$dflt -DDEBUGGING";;
5431         esac
5432         case "$gccversion" in
5433         2*) if $test -d /etc/conf/kconfig.d &&
5434                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5435                 then
5436                         # Interactive Systems (ISC) POSIX mode.
5437                         dflt="$dflt -posix"
5438                 fi
5439                 ;;
5440         esac
5441         case "$gccversion" in
5442         1*) ;;
5443         2.[0-8]*) ;;
5444         ?*)     set strict-aliasing -fno-strict-aliasing
5445                 eval $checkccflag
5446                 ;;
5447         esac
5448         # For gcc, adding -pipe speeds up compilations for some, but apparently
5449         # some assemblers can't read from stdin.  (It also slows down compilations
5450         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5451         case "$gccversion" in
5452         ?*)     set pipe -pipe
5453                 eval $checkccflag
5454                 ;;
5455         esac
5456
5457         # on x86_64 (at least) we require an extra library (libssp) in the
5458         # link command line. This library is not named, so I infer that it is
5459         # an implementation detail that may change. Hence the safest approach
5460         # is to add the flag to the flags passed to the compiler at link time,
5461         # as that way the compiler can do the right implementation dependant
5462         # thing. (NWC)
5463         case "$osname" in
5464         amigaos) ;; # -fstack-protector builds but doesn't work
5465         *)      case "$gccversion" in
5466                 ?*)     set stack-protector-strong -fstack-protector-strong
5467                         eval $checkccflag
5468                         case "$dflt" in
5469                         *-fstack-protector-strong*) ;; # It got added.
5470                         *) # Try the plain/older -fstack-protector.
5471                            set stack-protector -fstack-protector
5472                            eval $checkccflag
5473                            ;;
5474                         esac
5475                         ;;
5476                 esac
5477                 ;;
5478         esac
5479         ;;
5480 esac
5481
5482 case "$mips_type" in
5483 *BSD*|'') inclwanted="$locincpth $usrinc";;
5484 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5485 esac
5486 for thisincl in $inclwanted; do
5487         if $test -d $thisincl; then
5488                 if $test x$thisincl != x$usrinc; then
5489                         case "$dflt" in
5490                         *" -I$thisincl "*);;
5491                         *) dflt="$dflt -I$thisincl ";;
5492                         esac
5493                 fi
5494         fi
5495 done
5496
5497 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5498         xxx=true;
5499 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5500         xxx=true;
5501 else
5502         xxx=false;
5503 fi;
5504 if $xxx; then
5505         case "$dflt" in
5506         *$2*);;
5507         *) dflt="$dflt -D$2";;
5508         esac;
5509 fi'
5510
5511 set signal.h LANGUAGE_C; eval $inctest
5512
5513 case "$usesocks" in
5514 $define)
5515         ccflags="$ccflags -DSOCKS"
5516         ;;
5517 esac
5518
5519 case "$hint" in
5520 default|recommended) dflt="$ccflags $dflt" ;;
5521 *) dflt="$ccflags";;
5522 esac
5523
5524 case "$dflt" in
5525 ''|' ') dflt=none;;
5526 esac
5527
5528 $cat <<EOH
5529
5530 Your C compiler may want other flags.  For this question you should include
5531 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5532 but you should NOT include libraries or ld flags like -lwhatever.  If you
5533 want $package to honor its debug switch, you should include -DDEBUGGING here.
5534 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5535
5536 To use no flags, specify the word "none".
5537
5538 EOH
5539 set X $dflt
5540 shift
5541 dflt=${1+"$@"}
5542 rp="Any additional cc flags?"
5543 . ./myread
5544 case "$ans" in
5545 none) ccflags='';;
5546 *) ccflags="$ans";;
5547 esac
5548
5549 : the following weeds options from ccflags that are of no interest to cpp
5550 case "$cppflags" in
5551 '') cppflags="$ccflags" ;;
5552 *)  set X $ccflags; shift
5553     case " $cppflags " in
5554     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5555     *) cppflags="$cppflags $ccflags" ;;
5556     esac
5557     ;;
5558 esac
5559 case "$gccversion" in
5560 1*) cppflags="$cppflags -D__GNUC__"
5561 esac
5562 case "$mips_type" in
5563 '');;
5564 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5565 esac
5566 case "$cppflags" in
5567 '');;
5568 *)
5569         echo " "
5570         echo "Let me guess what the preprocessor flags are..." >&4
5571         set X $cppflags
5572         shift
5573         cppflags=''
5574         $cat >cpp.c <<'EOM'
5575 #define BLURFL foo
5576
5577 BLURFL xx LFRULB
5578 EOM
5579         previous=''
5580         for flag in $*
5581         do
5582                 case "$flag" in
5583                 -*) ftry="$flag";;
5584                 *) ftry="$previous $flag";;
5585                 esac
5586                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5587                         >cpp1.out 2>/dev/null && \
5588                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5589                         >cpp2.out 2>/dev/null && \
5590                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5591                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5592                 then
5593                         cppflags="$cppflags $ftry"
5594                         previous=''
5595                 else
5596                         previous="$flag"
5597                 fi
5598         done
5599         set X $cppflags
5600         shift
5601         cppflags=${1+"$@"}
5602         case "$cppflags" in
5603         *-*)  echo "They appear to be: $cppflags";;
5604         esac
5605         $rm -f cpp.c cpp?.out
5606         ;;
5607 esac
5608
5609 : flags used in final linking phase
5610 case "$ldflags" in
5611 '') if ./venix; then
5612                 dflt='-i -z'
5613         else
5614                 dflt=''
5615         fi
5616         case "$ccflags" in
5617         *-posix*) dflt="$dflt -posix" ;;
5618         esac
5619         ;;
5620 *) dflt="$ldflags";;
5621 esac
5622 # See note above about -fstack-protector
5623 case "$ccflags" in
5624 *-fstack-protector-strong*)
5625         case "$dflt" in
5626         *-fstack-protector-strong*) ;; # Don't add it again
5627         *) dflt="$dflt -fstack-protector-strong" ;;
5628         esac
5629         ;;
5630 *-fstack-protector*)
5631         case "$dflt" in
5632         *-fstack-protector*) ;; # Don't add it again
5633         *) dflt="$dflt -fstack-protector" ;;
5634         esac
5635         ;;
5636 esac
5637
5638 : Try to guess additional flags to pick up local libraries.
5639 for thislibdir in $libpth; do
5640         case " $loclibpth " in
5641         *" $thislibdir "*)
5642                 case "$dflt " in
5643                 *"-L$thislibdir "*) ;;
5644                 *)  dflt="$dflt -L$thislibdir" ;;
5645                 esac
5646                 ;;
5647         esac
5648 done
5649
5650 case "$dflt" in
5651 '') dflt='none' ;;
5652 esac
5653
5654 $cat <<EOH
5655
5656 Your C linker may need flags.  For this question you should
5657 include -L/whatever and any other flags used by the C linker, but you
5658 should NOT include libraries like -lwhatever.
5659
5660 Make sure you include the appropriate -L/path flags if your C linker
5661 does not normally search all of the directories you specified above,
5662 namely
5663         $libpth
5664 To use no flags, specify the word "none".
5665
5666 EOH
5667
5668 rp="Any additional ld flags (NOT including libraries)?"
5669 . ./myread
5670 case "$ans" in
5671 none) ldflags='';;
5672 *) ldflags="$ans";;
5673 esac
5674 rmlist="$rmlist pdp11"
5675
5676 : coherency check
5677 echo " "
5678 echo "Checking your choice of C compiler and flags for coherency..." >&4
5679 $cat > try.c <<'EOF'
5680 #include <stdio.h>
5681 int main() { printf("Ok\n"); return(0); }
5682 EOF
5683 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5684 shift
5685 $cat >try.msg <<'EOM'
5686 I've tried to compile and run the following simple program:
5687
5688 EOM
5689 $cat try.c >> try.msg
5690
5691 $cat >> try.msg <<EOM
5692
5693 I used the command:
5694
5695         $*
5696         $run ./try
5697
5698 and I got the following output:
5699
5700 EOM
5701 dflt=y
5702 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5703         if $sh -c "$run ./try " >>try.msg 2>&1; then
5704                 xxx=`$run ./try`
5705                 case "$xxx" in
5706                 "Ok") dflt=n ;;
5707                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5708                 esac
5709         else
5710                 echo "The program compiled OK, but exited with status $?." >>try.msg
5711                 rp="You have a problem.  Shall I abort Configure"
5712                 dflt=y
5713         fi
5714 else
5715         echo "I can't compile the test program." >>try.msg
5716         rp="You have a BIG problem.  Shall I abort Configure"
5717         dflt=y
5718 fi
5719 case "$dflt" in
5720 y)
5721         $cat try.msg >&4
5722         case "$knowitall" in
5723         '')
5724                 echo "(The supplied flags or libraries might be incorrect.)"
5725                 ;;
5726         *) dflt=n;;
5727         esac
5728         echo " "
5729         . ./myread
5730         case "$ans" in
5731         n*|N*) ;;
5732         *)      echo "Ok.  Stopping Configure." >&4
5733                 exit 1
5734                 ;;
5735         esac
5736         ;;
5737 n) echo "OK, that should do.";;
5738 esac
5739 $rm_try gcctest gcctest.out
5740
5741 : define a shorthand compile call
5742 compile='
5743 mc_file=$1;
5744 shift;
5745 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5746 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5747 exit 1;
5748 fi;
5749 esac;
5750 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5751 : define a shorthand compile call for compilations that should be ok.
5752 compile_ok='
5753 mc_file=$1;
5754 shift;
5755 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5756
5757 : determine filename position in cpp output
5758 echo " "
5759 echo "Computing filename position in cpp output for #include directives..." >&4
5760 case "$osname" in
5761 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5762 esac
5763 case "$fieldn" in
5764 '')
5765 case "$osname" in
5766 vos) testaccess=-e ;;
5767 *)   testaccess=-r ;;
5768 esac
5769 echo '#include <stdio.h>' > foo.c
5770 $cat >fieldn <<EOF
5771 $startsh
5772 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5773 $grep '^[       ]*#.*stdio\.h' | \
5774 while read cline; do
5775         pos=1
5776         set \$cline
5777         while $test \$# -gt 0; do
5778                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5779                         echo "\$pos"
5780                         exit 0
5781                 fi
5782                 shift
5783                 pos=\`expr \$pos + 1\`
5784         done
5785 done
5786 EOF
5787 chmod +x fieldn
5788 fieldn=`./fieldn`
5789 $rm -f foo.c fieldn
5790 ;;
5791 esac
5792 case $fieldn in
5793 '') pos='???';;
5794 1) pos=first;;
5795 2) pos=second;;
5796 3) pos=third;;
5797 *) pos="${fieldn}th";;
5798 esac
5799 echo "Your cpp writes the filename in the $pos field of the line."
5800
5801 : locate header file
5802 $cat >findhdr <<EOF
5803 $startsh
5804 wanted=\$1
5805 name=''
5806 for usrincdir in $incpth
5807 do
5808         if test -f \$usrincdir/\$wanted; then
5809                 echo "\$usrincdir/\$wanted"
5810                 exit 0
5811         fi
5812 done
5813 awkprg='{ print \$$fieldn }'
5814 echo "#include <\$wanted>" > foo\$\$.c
5815 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5816 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5817 while read cline; do
5818         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5819         case "\$name" in
5820         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5821         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5822         *) exit 2;;
5823         esac;
5824 done;
5825 #
5826 # status = 0: grep returned 0 lines, case statement not executed
5827 # status = 1: headerfile found
5828 # status = 2: while loop executed, no headerfile found
5829 #
5830 status=\$?
5831 $rm -f foo\$\$.c;
5832 if test \$status -eq 1; then
5833         exit 0;
5834 fi
5835 exit 1
5836 EOF
5837 chmod +x findhdr
5838
5839 : define an alternate in-header-list? function
5840 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5841 cont=true; xxf="echo \"<\$1> found.\" >&4";
5842 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5843 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5844 esac;
5845 case $# in 4) instead=instead;; *) instead="at last";; esac;
5846 while $test "$cont"; do
5847         xxx=`./findhdr $1`
5848         var=$2; eval "was=\$$2";
5849         if $test "$xxx" && $test -r "$xxx";
5850         then eval $xxf;
5851         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5852                 cont="";
5853         else eval $xxnf;
5854         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5855         set $yyy; shift; shift; yyy=$@;
5856         case $# in 0) cont="";;
5857         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5858                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5859         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5860                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5861         esac;
5862 done;
5863 while $test "$yyy";
5864 do set $yyy; var=$2; eval "was=\$$2";
5865         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5866         set $yyy; shift; shift; yyy=$@;
5867 done'
5868
5869 : see if stdlib is available
5870 set stdlib.h i_stdlib
5871 eval $inhdr
5872
5873 : check for lengths of integral types
5874 echo " "
5875 case "$intsize" in
5876 '')
5877         echo "Checking to see how big your integers are..." >&4
5878         $cat >try.c <<EOCP
5879 #include <stdio.h>
5880 #$i_stdlib I_STDLIB
5881 #ifdef I_STDLIB
5882 #include <stdlib.h>
5883 #endif
5884 int main()
5885 {
5886         printf("intsize=%d;\n", (int)sizeof(int));
5887         printf("longsize=%d;\n", (int)sizeof(long));
5888         printf("shortsize=%d;\n", (int)sizeof(short));
5889         exit(0);
5890 }
5891 EOCP
5892         set try
5893         if eval $compile_ok && $run ./try > /dev/null; then
5894                 eval `$run ./try`
5895                 echo "Your integers are $intsize bytes long."
5896                 echo "Your long integers are $longsize bytes long."
5897                 echo "Your short integers are $shortsize bytes long."
5898         else
5899                 $cat >&4 <<EOM
5900 !
5901 Help! I can't compile and run the intsize test program: please enlighten me!
5902 (This is probably a misconfiguration in your system or libraries, and
5903 you really ought to fix it.  Still, I'll try anyway.)
5904 !
5905 EOM
5906                 dflt=4
5907                 rp="What is the size of an integer (in bytes)?"
5908                 . ./myread
5909                 intsize="$ans"
5910                 dflt=$intsize
5911                 rp="What is the size of a long integer (in bytes)?"
5912                 . ./myread
5913                 longsize="$ans"
5914                 dflt=2
5915                 rp="What is the size of a short integer (in bytes)?"
5916                 . ./myread
5917                 shortsize="$ans"
5918         fi
5919         ;;
5920 esac
5921 $rm_try
5922
5923 : check for long long
5924 echo " "
5925 echo "Checking to see if you have long long..." >&4
5926 echo 'int main() { long long x = 7; return 0; }' > try.c
5927 set try
5928 if eval $compile; then
5929         val="$define"
5930         echo "You have long long."
5931 else
5932         val="$undef"
5933         echo "You do not have long long."
5934 fi
5935 $rm_try
5936 set d_longlong
5937 eval $setvar
5938
5939 : check for length of long long
5940 case "${d_longlong}${longlongsize}" in
5941 $define)
5942         echo " "
5943         echo "Checking to see how big your long longs are..." >&4
5944         $cat >try.c <<'EOCP'
5945 #include <stdio.h>
5946 int main()
5947 {
5948     printf("%d\n", (int)sizeof(long long));
5949     return(0);
5950 }
5951 EOCP
5952         set try
5953         if eval $compile_ok; then
5954                 longlongsize=`$run ./try`
5955                 echo "Your long longs are $longlongsize bytes long."
5956         else
5957                 dflt='8'
5958                 echo " "
5959                 echo "(I can't seem to compile the test program.  Guessing...)"
5960                 rp="What is the size of a long long (in bytes)?"
5961                 . ./myread
5962                 longlongsize="$ans"
5963         fi
5964         if $test "X$longsize" = "X$longlongsize"; then
5965                 echo "(That isn't any different from an ordinary long.)"
5966         fi
5967         ;;
5968 esac
5969 $rm_try
5970
5971 : see if inttypes.h is available
5972 : we want a real compile instead of Inhdr because some systems
5973 : have an inttypes.h which includes non-existent headers
5974 echo " "
5975 $cat >try.c <<EOCP
5976 #include <inttypes.h>
5977 int main() {
5978         static int32_t foo32 = 0x12345678;
5979 }
5980 EOCP
5981 set try
5982 if eval $compile; then
5983         echo "<inttypes.h> found." >&4
5984         val="$define"
5985 else
5986         echo "<inttypes.h> NOT found." >&4
5987         val="$undef"
5988 fi
5989 $rm_try
5990 set i_inttypes
5991 eval $setvar
5992
5993 : check for int64_t
5994 echo " "
5995 echo "Checking to see if you have int64_t..." >&4
5996 $cat >try.c <<EOCP
5997 #include <sys/types.h>
5998 #$i_inttypes I_INTTYPES
5999 #ifdef I_INTTYPES
6000 #include <inttypes.h>
6001 #endif
6002 int main() { int64_t x = 7; }
6003 EOCP
6004 set try
6005 if eval $compile; then
6006         val="$define"
6007         echo "You have int64_t."
6008 else
6009         val="$undef"
6010         echo "You do not have int64_t."
6011 fi
6012 $rm_try
6013 set d_int64_t
6014 eval $setvar
6015
6016 : Check if 64bit ints have a quad type
6017 echo " "
6018 echo "Checking which 64-bit integer type we could use..." >&4
6019
6020 case "$intsize" in
6021 8) val=int
6022    set quadtype
6023    eval $setvar
6024    val='"unsigned int"'
6025    set uquadtype
6026    eval $setvar
6027    quadkind=1
6028    ;;
6029 *) case "$longsize" in
6030    8) val=long
6031       set quadtype
6032       eval $setvar
6033       val='"unsigned long"'
6034       set uquadtype
6035       eval $setvar
6036       quadkind=2
6037       ;;
6038    *) case "$d_longlong:$longlongsize" in
6039       define:8)
6040         val='"long long"'
6041         set quadtype
6042         eval $setvar
6043         val='"unsigned long long"'
6044         set uquadtype
6045         eval $setvar
6046         quadkind=3
6047         ;;
6048       *) case "$d_int64_t" in
6049          define)
6050            val=int64_t
6051            set quadtype
6052            eval $setvar
6053            val=uint64_t
6054            set uquadtype
6055            eval $setvar
6056            quadkind=4
6057            ;;
6058          esac
6059          ;;
6060       esac
6061       ;;
6062    esac
6063    ;;
6064 esac
6065
6066 case "$quadtype" in
6067 '')     echo "Alas, no 64-bit integer types in sight." >&4
6068         d_quad="$undef"
6069         ;;
6070 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6071         d_quad="$define"
6072         ;;
6073 esac
6074
6075 : Do we want 64bit support
6076 case "$uselonglong" in
6077 "$define"|true|[yY]*)
6078         cat <<EOM >&4
6079
6080 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6081 EOM
6082         use64bitint="$define"
6083         ;;
6084 esac
6085 case "$use64bits" in
6086 "$define"|true|[yY]*)
6087         cat <<EOM >&4
6088
6089 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6090 EOM
6091         use64bitint="$define"
6092         ;;
6093 esac
6094 case "$use64bitints" in
6095 "$define"|true|[yY]*)
6096         cat <<EOM >&4
6097
6098 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6099 EOM
6100         use64bitint="$define"
6101         ;;
6102 esac
6103 case "$use64bitsint" in
6104 "$define"|true|[yY]*)
6105         cat <<EOM >&4
6106
6107 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6108 EOM
6109         use64bitint="$define"
6110         ;;
6111 esac
6112 case "$uselonglongs" in
6113 "$define"|true|[yY]*)
6114         cat <<EOM >&4
6115
6116 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6117 EOM
6118         use64bitint="$define"
6119         ;;
6120 esac
6121 case "$use64bitsall" in
6122 "$define"|true|[yY]*)
6123         cat <<EOM >&4
6124
6125 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6126 EOM
6127         use64bitall="$define"
6128         ;;
6129 esac
6130
6131 case "$ccflags" in
6132 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6133 esac
6134 case "$use64bitall" in
6135 "$define"|true|[yY]*) use64bitint="$define" ;;
6136 esac
6137
6138 case "$longsize" in
6139 8) cat <<EOM
6140
6141 You have natively 64-bit long integers.
6142 EOM
6143    val="$define"
6144    ;;
6145 *) case "$use64bitint" in
6146    "$define"|true|[yY]*) dflt='y';;
6147    *) dflt='n';;
6148    esac
6149    case "$d_quad" in
6150    "$define") ;;
6151    *) dflt='n' ;;
6152    esac
6153    cat <<EOM
6154
6155 Perl can be built to take advantage of 64-bit integer types
6156 on some systems.  To do so, Configure can be run with -Duse64bitint.
6157 Choosing this option will most probably introduce binary incompatibilities.
6158
6159 If this doesn't make any sense to you, just accept the default '$dflt'.
6160 (The default has been chosen based on your configuration.)
6161 EOM
6162    rp='Try to use 64-bit integers, if available?'
6163    . ./myread
6164    case "$ans" in
6165    [yY]*) val="$define" ;;
6166    *)     val="$undef"  ;;
6167    esac
6168    ;;
6169 esac
6170 set use64bitint
6171 eval $setvar
6172
6173 case "$use64bitall" in
6174 "$define"|true|[yY]*) dflt='y' ;;
6175 *) case "$longsize" in
6176    8) dflt='y' ;;
6177    *) dflt='n' ;;
6178    esac
6179    ;;
6180 esac
6181 cat <<EOM
6182
6183 You may also choose to try maximal 64-bitness.  It means using as much
6184 64-bitness as possible on the platform.  This in turn means even more
6185 binary incompatibilities.  On the other hand, your platform may not
6186 have any more 64-bitness available than what you already have chosen.
6187
6188 If this doesn't make any sense to you, just accept the default '$dflt'.
6189 (The default has been chosen based on your configuration.)
6190 EOM
6191 rp='Try to use maximal 64-bit support, if available?'
6192 . ./myread
6193 case "$ans" in
6194 [yY]*) val="$define" ;;
6195 *)     val="$undef"  ;;
6196 esac
6197 set use64bitall
6198 eval $setvar
6199 case "$use64bitall" in
6200 "$define")
6201         case "$use64bitint" in
6202         "$undef")
6203                 cat <<EOM
6204
6205 Since you have chosen a maximally 64-bit build, I'm also turning on
6206 the use of 64-bit integers.
6207 EOM
6208                 use64bitint="$define" ;;
6209         esac
6210         ;;
6211 esac
6212
6213 : Look for a hint-file generated 'call-back-unit'.  If the
6214 : user has specified that a 64-bit perl is to be built,
6215 : we may need to set or change some other defaults.
6216 if $test -f use64bitint.cbu; then
6217         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6218         . ./use64bitint.cbu
6219 fi
6220 case "$use64bitint" in
6221 "$define"|true|[yY]*)
6222         : This test was common to all the OpenBSD forks, and seems harmless for
6223         : other platforms:
6224         echo " "
6225         echo "Checking if your C library has broken 64-bit functions..." >&4
6226         cat >try.c <<EOCP
6227 #include <stdio.h>
6228 typedef $uquadtype myULL;
6229 int main (void)
6230 {
6231     struct {
6232         double d;
6233         myULL  u;
6234     } *p, test[] = {
6235         {4294967303.15, 4294967303ULL},
6236         {4294967294.2,  4294967294ULL},
6237         {4294967295.7,  4294967295ULL},
6238         {0.0, 0ULL}
6239     };
6240     for (p = test; p->u; p++) {
6241         myULL x = (myULL)p->d;
6242         if (x != p->u) {
6243             printf("buggy\n");
6244             return 0;
6245         }
6246     }
6247     printf("ok\n");
6248     return 0;
6249 }
6250 EOCP
6251         set try
6252         if eval $compile_ok; then
6253             libcquad=`$run ./try`
6254             echo "Your C library's 64-bit functions are $libcquad."
6255         else
6256             echo "(I can't seem to compile the test program.)"
6257             echo "Assuming that your C library's 64-bit functions are ok."
6258             libcquad="ok"
6259         fi
6260         $rm_try
6261
6262         case "$libcquad" in
6263             buggy*)
6264                 cat >&4 <<EOM
6265
6266 *** You have a C library with broken 64-bit functions.
6267 *** 64-bit support does not work reliably in this configuration.
6268 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6269 *** Cannot continue, aborting.
6270
6271 EOM
6272                 exit 1
6273                 ;;
6274         esac
6275         case "$longsize" in
6276         4) case "$archname64" in
6277            '') archname64=64int ;;
6278            esac
6279            ;;
6280         esac
6281         ;;
6282 esac
6283
6284 : Look for a hint-file generated 'call-back-unit'.  If the
6285 : user has specified that a maximally 64-bit perl is to be built,
6286 : we may need to set or change some other defaults.
6287 if $test -f use64bitall.cbu; then
6288         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6289         . ./use64bitall.cbu
6290 fi
6291 case "$use64bitall" in
6292 "$define"|true|[yY]*)
6293         case "$longsize" in
6294         4) case "$archname64" in
6295            ''|64int) archname64=64all ;;
6296            esac
6297            ;;
6298         esac
6299         ;;
6300 esac
6301
6302 case "$d_quad:$use64bitint" in
6303 $undef:$define)
6304         cat >&4 <<EOF
6305
6306 *** You have chosen to use 64-bit integers,
6307 *** but none can be found.
6308 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6309 *** Cannot continue, aborting.
6310
6311 EOF
6312         exit 1
6313         ;;
6314 esac
6315
6316 : Check if we are using the GNU C library
6317 echo " "
6318 echo "Checking for GNU C Library..." >&4
6319 cat >try.c <<'EOCP'
6320 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6321    alone are insufficient to distinguish different versions, such as
6322    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6323    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6324 */
6325 #include <stdio.h>
6326 int main(void)
6327 {
6328 #ifdef __GLIBC__
6329 #   ifdef __GLIBC_MINOR__
6330 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6331 #           include <gnu/libc-version.h>
6332             printf("%s\n",  gnu_get_libc_version());
6333 #       else
6334             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6335 #       endif
6336 #   else
6337         printf("%d\n",  __GLIBC__);
6338 #   endif
6339     return 0;
6340 #else
6341     return 1;
6342 #endif
6343 }
6344 EOCP
6345 set try
6346 if eval $compile_ok && $run ./try > glibc.ver; then
6347         val="$define"
6348         gnulibc_version=`$cat glibc.ver`
6349         echo "You are using the GNU C Library version $gnulibc_version"
6350 else
6351         val="$undef"
6352         gnulibc_version=''
6353         echo "You are not using the GNU C Library"
6354 fi
6355 $rm_try glibc.ver
6356 set d_gnulibc
6357 eval $setvar
6358
6359 : see if nm is to be used to determine whether a symbol is defined or not
6360 case "$usenm" in
6361 '')
6362         dflt=''
6363         case "$d_gnulibc" in
6364         "$define")
6365                 echo " "
6366                 echo "nm probably won't work on the GNU C Library." >&4
6367                 dflt=n
6368                 ;;
6369         esac
6370         case "$dflt" in
6371         '')
6372                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6373                         echo " "
6374                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6375                         echo "'nm' won't be sufficient on this system." >&4
6376                         dflt=n
6377                 fi
6378                 ;;
6379         esac
6380         case "$dflt" in
6381         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6382                 if $test $dflt -gt 20; then
6383                         dflt=y
6384                 else
6385                         dflt=n
6386                 fi
6387                 ;;
6388         esac
6389         ;;
6390 *)
6391         case "$usenm" in
6392         true|$define) dflt=y;;
6393         *) dflt=n;;
6394         esac
6395         ;;
6396 esac
6397 $cat <<EOM
6398
6399 I can use $nm to extract the symbols from your C libraries. This
6400 is a time consuming task which may generate huge output on the disk (up
6401 to 3 megabytes) but that should make the symbols extraction faster. The
6402 alternative is to skip the 'nm' extraction part and to compile a small
6403 test program instead to determine whether each symbol is present. If
6404 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6405 this may be the best solution.
6406
6407 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6408
6409 EOM
6410 rp="Shall I use $nm to extract C symbols from the libraries?"
6411 . ./myread
6412 case "$ans" in
6413 [Nn]*) usenm=false;;
6414 *) usenm=true;;
6415 esac
6416
6417 runnm=$usenm
6418 case "$reuseval" in
6419 true) runnm=false;;
6420 esac
6421
6422 : nm options which may be necessary
6423 case "$nm_opt" in
6424 '') if $test -f /mach_boot; then
6425                 nm_opt=''       # Mach
6426         elif $test -d /usr/ccs/lib; then
6427                 nm_opt='-p'     # Solaris (and SunOS?)
6428         elif $test -f /dgux; then
6429                 nm_opt='-p'     # DG-UX
6430         elif $test -f /lib64/rld; then
6431                 nm_opt='-p'     # 64-bit Irix
6432         else
6433                 nm_opt=''
6434         fi;;
6435 esac
6436
6437 : nm options which may be necessary for shared libraries but illegal
6438 : for archive libraries.  Thank you, Linux.
6439 case "$nm_so_opt" in
6440 '')     case "$myuname" in
6441         *linux*|gnu*)
6442                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6443                         nm_so_opt='--dynamic'
6444                 fi
6445                 ;;
6446         esac
6447         ;;
6448 esac
6449
6450 : Figure out where the libc is located
6451 case "$runnm" in
6452 true)
6453 : get list of predefined functions in a handy place
6454 echo " "
6455 case "$libc" in
6456 '') libc=unknown
6457         case "$libs" in
6458         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6459         esac
6460         ;;
6461 esac
6462 case "$libs" in
6463 '') ;;
6464 *)  for thislib in $libs; do
6465         case "$thislib" in
6466         -lc|-lc_s)
6467                 : Handle C library specially below.
6468                 ;;
6469         -l*)
6470                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6471                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6472                         :
6473                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6474                         :
6475                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6476                         :
6477                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6478                         :
6479                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6480                         :
6481                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6482                         :
6483                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6484                         :
6485                 else
6486                         try=''
6487                 fi
6488                 libnames="$libnames $try"
6489                 ;;
6490         *) libnames="$libnames $thislib" ;;
6491         esac
6492         done
6493         ;;
6494 esac
6495 xxx=normal
6496 case "$libc" in
6497 unknown)
6498         set /lib/libc.$so
6499         for xxx in $libpth; do
6500                 $test -r $1 || set $xxx/libc.$so
6501                 : The messy sed command sorts on library version numbers.
6502                 $test -r $1 || \
6503                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6504                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6505                                 h
6506                                 s/[0-9][0-9]*/0000&/g
6507                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6508                                 G
6509                                 s/\n/ /' | \
6510                          $sort | $sed -e 's/^.* //'`
6511                 eval set \$$#
6512         done
6513         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6514         $test -r $1 || set $sysroot/lib/libsys_s$_a
6515         ;;
6516 *)
6517         set blurfl
6518         ;;
6519 esac
6520 if $test -r "$1"; then
6521         echo "Your (shared) C library seems to be in $1."
6522         libc="$1"
6523 elif $test -r /lib/libc && $test -r /lib/clib; then
6524         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6525         xxx=apollo
6526         libc='/lib/clib /lib/libc'
6527         if $test -r /lib/syslib; then
6528                 echo "(Your math library is in /lib/syslib.)"
6529                 libc="$libc /lib/syslib"
6530         fi
6531 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6532         echo "Your C library seems to be in $libc, as you said before."
6533 elif $test -r $incpath/usr/lib/libc$_a; then
6534         libc=$incpath/usr/lib/libc$_a;
6535         echo "Your C library seems to be in $libc.  That's fine."
6536 elif $test -r /lib/libc$_a; then
6537         libc=/lib/libc$_a;
6538         echo "Your C library seems to be in $libc.  You're normal."
6539 else
6540         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6541                 :
6542         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6543                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6544         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6545                 :
6546         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6547                 :
6548         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6549                 :
6550         else
6551                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6552         fi
6553         if $test -r "$tans"; then
6554                 echo "Your C library seems to be in $tans, of all places."
6555                 libc=$tans
6556         else
6557                 libc='blurfl'
6558         fi
6559 fi
6560 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6561         dflt="$libc"
6562         cat <<EOM
6563
6564 If the guess above is wrong (which it might be if you're using a strange
6565 compiler, or your machine supports multiple models), you can override it here.
6566
6567 EOM
6568 else
6569         dflt=''
6570         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6571         cat >&4 <<EOM
6572 I can't seem to find your C library.  I've looked in the following places:
6573
6574 EOM
6575         $sed 's/^/      /' libpath
6576         cat <<EOM
6577
6578 None of these seems to contain your C library. I need to get its name...
6579
6580 EOM
6581 fi
6582 fn=f
6583 rp='Where is your C library?'
6584 . ./getfile
6585 libc="$ans"
6586
6587 echo " "
6588 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6589 set X `cat libnames`
6590 shift
6591 xxx=files
6592 case $# in 1) xxx=file; esac
6593 echo "Extracting names from the following $xxx for later perusal:" >&4
6594 echo " "
6595 $sed 's/^/      /' libnames >&4
6596 echo " "
6597 $echo $n "This may take a while...$c" >&4
6598
6599 for file in $*; do
6600         case $file in
6601         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6602         *) $nm $nm_opt $file 2>/dev/null;;
6603         esac
6604 done >libc.tmp
6605
6606 $echo $n ".$c"
6607 $grep fprintf libc.tmp > libc.ptf
6608 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6609 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6610 xxx='[ADTSIWi]'
6611 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6612         eval $xscan;\
6613         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6614                 eval $xrun
6615 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6616         eval $xscan;\
6617         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6618                 eval $xrun
6619 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6620         eval $xscan;\
6621         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6622                 eval $xrun
6623 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6624         eval $xscan;\
6625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6626                 eval $xrun
6627 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6628         eval $xscan;\
6629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6630                 eval $xrun
6631 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6632         eval $xscan;\
6633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6634                 eval $xrun
6635 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6636                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6637         eval $xscan;\
6638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6639                 eval $xrun
6640 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6641         eval $xscan;\
6642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6643                 eval $xrun
6644 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6645         eval $xscan;\
6646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6647                 eval $xrun
6648 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6649         eval $xscan;\
6650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6651                 eval $xrun
6652 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6653         eval $xscan;\
6654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6655                 eval $xrun
6656 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6657         eval $xscan;\
6658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6659                 eval $xrun
6660 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6661         eval $xscan;\
6662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6663                 eval $xrun
6664 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6665         eval $xscan;\
6666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6667                 eval $xrun
6668 else
6669         $nm -p $* 2>/dev/null >libc.tmp
6670         $grep fprintf libc.tmp > libc.ptf
6671         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6672                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6673         then
6674                 nm_opt='-p'
6675                 eval $xrun
6676         else
6677                 echo " "
6678                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6679                 com=''
6680                 if $ar t $libc > libc.tmp && \
6681                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6682                 then
6683                         for thisname in $libnames $libc; do
6684                                 $ar t $thisname >>libc.tmp
6685                         done
6686                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6687                         echo "Ok." >&4
6688                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6689                         for thisname in $libnames $libc; do
6690                                 $ar tv $thisname >>libc.tmp
6691                                 emximp -o tmp.imp $thisname \
6692                                     2>/dev/null && \
6693                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6694                                     < tmp.imp >>libc.tmp
6695                                 $rm -f tmp.imp
6696                         done
6697                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6698                         echo "Ok." >&4
6699                 else
6700                         echo "$ar didn't seem to work right." >&4
6701                         echo "Maybe this is a Cray...trying bld instead..." >&4
6702                         if  bld t $libc | \
6703                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6704                                 $test -s libc.list
6705                         then
6706                                 for thisname in $libnames; do
6707                                         bld t $libnames | \
6708                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6709                                         $ar t $thisname >>libc.tmp
6710                                 done
6711                                 echo "Ok." >&4
6712                         else
6713                                 echo "That didn't work either.  Giving up." >&4
6714                                 exit 1
6715                         fi
6716                 fi
6717         fi
6718 fi
6719 nm_extract="$com"
6720 case "$PASE" in
6721 define)
6722     echo " "
6723     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6724     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6725     ;;
6726 *)  if $test -f /lib/syscalls.exp; then
6727         echo " "
6728         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6729         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6730                 /lib/syscalls.exp >>libc.list
6731     fi
6732     ;;
6733 esac
6734 ;;
6735 esac
6736 $rm -f libnames libpath
6737
6738 : Check if we are using C++
6739 echo " "
6740 echo "Checking for C++..." >&4
6741 $cat >try.c <<'EOCP'
6742 #include <stdio.h>
6743 int main(void)
6744 {
6745 #ifdef __cplusplus
6746     return 0;
6747 #else
6748     return 1;
6749 #endif
6750 }
6751 EOCP
6752 set try
6753 if eval $compile_ok && $run ./try; then
6754         val="$define"
6755         echo "You are using a C++ compiler."
6756 else
6757         val="$undef"
6758         echo "You are not using a C++ compiler."
6759 fi
6760 $rm_try cplusplus$$
6761 set d_cplusplus
6762 eval $setvar
6763
6764 : is a C symbol defined?
6765 csym='tlook=$1;
6766 case "$3" in
6767 -v) tf=libc.tmp; tdc="";;
6768 -a) tf=libc.tmp; tdc="[]";;
6769 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6770 esac;
6771 case "$d_cplusplus" in
6772     $define)    extern_C="extern \"C\"" ;;
6773     *)          extern_C="extern"       ;;
6774 esac;
6775 tx=yes;
6776 case "$reuseval-$4" in
6777 true-) ;;
6778 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6779 esac;
6780 case "$tx" in
6781 yes)
6782         tval=false;
6783         if $test "$runnm" = true; then
6784                 if $contains $tlook $tf >/dev/null 2>&1; then
6785                         tval=true;
6786                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6787                         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;
6788                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6789                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6790                         $rm_try;
6791                 fi;
6792         else
6793                 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;
6794                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6795                 $rm_try;
6796         fi;
6797         ;;
6798 *)
6799         case "$tval" in
6800         $define) tval=true;;
6801         *) tval=false;;
6802         esac;
6803         ;;
6804 esac;
6805 eval "$2=$tval"'
6806
6807 : define an is-in-libc? function
6808 inlibc='echo " "; td=$define; tu=$undef;
6809 sym=$1; var=$2; eval "was=\$$2";
6810 tx=yes;
6811 case "$reuseval$was" in
6812 true) ;;
6813 true*) tx=no;;
6814 esac;
6815 case "$tx" in
6816 yes)
6817         set $sym tres -f;
6818         eval $csym;
6819         case "$tres" in
6820         true)
6821                 echo "$sym() found." >&4;
6822                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6823         *)
6824                 echo "$sym() NOT found." >&4;
6825                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6826         esac;;
6827 *)
6828         case "$was" in
6829         $define) echo "$sym() found." >&4;;
6830         *) echo "$sym() NOT found." >&4;;
6831         esac;;
6832 esac'
6833
6834 : check for length of double
6835 echo " "
6836 case "$doublesize" in
6837 '')
6838         echo "Checking to see how big your double precision numbers are..." >&4
6839         $cat >try.c <<EOCP
6840 #include <stdio.h>
6841 #$i_stdlib I_STDLIB
6842 #ifdef I_STDLIB
6843 #include <stdlib.h>
6844 #endif
6845 int main()
6846 {
6847     printf("%d\n", (int)sizeof(double));
6848     exit(0);
6849 }
6850 EOCP
6851         set try
6852         if eval $compile_ok; then
6853                 doublesize=`$run ./try`
6854                 echo "Your double is $doublesize bytes long."
6855         else
6856                 dflt='8'
6857                 echo "(I can't seem to compile the test program.  Guessing...)"
6858                 rp="What is the size of a double precision number (in bytes)?"
6859                 . ./myread
6860                 doublesize="$ans"
6861         fi
6862         ;;
6863 esac
6864 $rm_try
6865
6866 : see if this is a float.h system
6867 set float.h i_float
6868 eval $inhdr
6869
6870 : check for long doubles
6871 echo " "
6872 echo "Checking to see if you have long double..." >&4
6873 echo 'int main() { long double x = 7.0; }' > try.c
6874 set try
6875 if eval $compile; then
6876         val="$define"
6877         echo "You have long double."
6878 else
6879         val="$undef"
6880         echo "You do not have long double."
6881 fi
6882 $rm_try
6883 set d_longdbl
6884 eval $setvar
6885
6886 : see if ldexpl exists
6887 set ldexpl d_ldexpl
6888 eval $inlibc
6889
6890 : check for length of long double
6891 case "${d_longdbl}${longdblsize}" in
6892 $define)
6893         echo " "
6894         echo "Checking to see how big your long doubles are..." >&4
6895         $cat >try.c <<'EOCP'
6896 #include <stdio.h>
6897 int main()
6898 {
6899         printf("%d\n", sizeof(long double));
6900 }
6901 EOCP
6902         set try
6903         set try
6904         if eval $compile; then
6905                 longdblsize=`$run ./try`
6906                 echo "Your long doubles are $longdblsize bytes long."
6907         else
6908                 dflt='8'
6909                 echo " "
6910                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6911                 rp="What is the size of a long double (in bytes)?"
6912                 . ./myread
6913                 longdblsize="$ans"
6914         fi
6915         if $test "X$doublesize" = "X$longdblsize"; then
6916                 echo "That isn't any different from an ordinary double."
6917                 echo "I'll keep your setting anyway, but you may see some"
6918                 echo "harmless compilation warnings."
6919         fi
6920         ;;
6921 esac
6922 $rm_try
6923
6924 $echo "Checking the kind of long doubles you have..." >&4
6925 case "$d_longdbl" in
6926 define)
6927 $cat <<EOP >try.c
6928 #$i_float I_FLOAT
6929 #$i_stdlib I_STDLIB
6930 #define LONGDBLSIZE $longdblsize
6931 #define DOUBLESIZE $doublesize
6932 #ifdef I_FLOAT
6933 #include <float.h>
6934 #endif
6935 #ifdef I_STDLIB
6936 #include <stdlib.h>
6937 #endif
6938 #include <stdio.h>
6939 static const long double d = -0.1L;
6940 int main() {
6941   unsigned const char* b = (unsigned const char*)(&d);
6942 #if DOUBLESIZE == LONGDBLSIZE
6943   printf("0\n"); /* if it floats like double */
6944   exit(0);
6945 #endif
6946 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6947   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6948     /* IEEE 754 128-bit little-endian */
6949     printf("1\n");
6950     exit(0);
6951   }
6952   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6953     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6954     printf("2\n");
6955     exit(0);
6956   }
6957 #endif
6958 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6959  * while 64-bits platforms have it in 16 bytes. */
6960 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6961   if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
6962     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6963      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6964      * Also known as "extended precision". */
6965     printf("3\n");
6966     exit(0);
6967   }
6968   if (b[0] == 0xBF && b[9] == 0xCD && b[10] == 0x00) {
6969     /* is there ever big-endian 80-bit, really? */
6970     printf("4\n");
6971     exit(0);
6972   }
6973 #endif
6974 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6975   /* software "double double", the 106 is 53+53.
6976    * but irix thinks it is 107. */
6977   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6978     /* double double 128-bit little-endian,
6979      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6980     printf("5\n");
6981     exit(0);
6982   }
6983   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
6984     /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
6985      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
6986     printf("6\n");
6987     exit(0);
6988   }
6989 #endif
6990   printf("-1\n"); /* unknown */
6991   exit(0);
6992 }
6993 EOP
6994 set try
6995 if eval $compile; then
6996     longdblkind=`$run ./try`
6997 else
6998     longdblkind=-1
6999 fi
7000 ;;
7001 *) longdblkind=0 ;;
7002 esac
7003 case "$longdblkind" in
7004 0) echo "Your long doubles are doubles." >&4 ;;
7005 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7006 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7007 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7008 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7009 5) echo "You have 128-bit little-endian double-double long doubles." >& 4 ;;
7010 6) echo "You have 128-bit big-endian double-double long doubles." >& 4 ;;
7011 *) echo "Cannot figure out your long double." >&4 ;;
7012 esac
7013 $rm_try
7014
7015 : determine the architecture name
7016 echo " "
7017 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7018         tarch=`arch`"-$osname"
7019 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7020         if uname -m > tmparch 2>&1 ; then
7021                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7022                         -e 's/$/'"-$osname/" tmparch`
7023         else
7024                 tarch="$osname"
7025         fi
7026         $rm -f tmparch
7027 else
7028         tarch="$osname"
7029 fi
7030 case "$myarchname" in
7031 ''|"$tarch") ;;
7032 *)
7033         echo "(Your architecture name used to be $myarchname.)"
7034         archname=''
7035         ;;
7036 esac
7037 case "$targetarch" in
7038 '') ;;
7039 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7040 esac
7041 myarchname="$tarch"
7042 case "$archname" in
7043 '') dflt="$tarch";;
7044 *) dflt="$archname";;
7045 esac
7046 rp='What is your architecture name'
7047 . ./myread
7048 archname="$ans"
7049
7050 : optionally add API version to the architecture for versioned archlibs
7051 case "$useversionedarchname" in
7052 $define|true|[yY]*) dflt='y';;
7053 *)                  dflt='n';;
7054 esac
7055 rp='Add the Perl API version to your archname?'
7056 . ./myread
7057 case "$ans" in
7058 y|Y)    useversionedarchname="$define" ;;
7059 *)      useversionedarchname="$undef" ;;
7060 esac
7061 case "$useversionedarchname" in
7062 $define)
7063         case "$archname" in
7064         *-$api_versionstring)
7065                 echo "...and architecture name already has -$api_versionstring" >&4
7066                 ;;
7067         *)
7068                 archname="$archname-$api_versionstring"
7069                 echo "...setting architecture name to $archname." >&4
7070                 ;;
7071         esac
7072         ;;
7073 esac
7074
7075 case "$usethreads" in
7076 $define)
7077         echo "Threads selected." >&4
7078         case "$archname" in
7079         *-thread*) echo "...and architecture name already has -thread." >&4
7080                 ;;
7081         *)      archname="$archname-thread"
7082                 echo "...setting architecture name to $archname." >&4
7083                 ;;
7084         esac
7085         ;;
7086 esac
7087 case "$usemultiplicity" in
7088 $define)
7089         echo "Multiplicity selected." >&4
7090         case "$archname" in
7091         *-multi*) echo "...and architecture name already has -multi." >&4
7092                 ;;
7093         *)      archname="$archname-multi"
7094                 echo "...setting architecture name to $archname." >&4
7095                 ;;
7096         esac
7097         ;;
7098 esac
7099 case "$use64bitint$use64bitall" in
7100 *"$define"*)
7101         case "$archname64" in
7102         '')
7103                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7104                 ;;
7105         *)
7106                 case "$use64bitint" in
7107                 "$define") echo "64 bit integers selected." >&4 ;;
7108                 esac
7109                 case "$use64bitall" in
7110                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7111                 esac
7112                 case "$archname" in
7113                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7114                         ;;
7115                 *)      archname="$archname-$archname64"
7116                         echo "...setting architecture name to $archname." >&4
7117                         ;;
7118                 esac
7119                 ;;
7120         esac
7121 esac
7122 case "$uselongdouble" in
7123 $define)
7124         echo "Long doubles selected." >&4
7125         case "$longdblsize" in
7126         $doublesize)
7127                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7128                 ;;
7129         *)
7130                 case "$archname" in
7131                 *-ld*) echo "...and architecture name already has -ld." >&4
7132                         ;;
7133                 *)      archname="$archname-ld"
7134                         echo "...setting architecture name to $archname." >&4
7135                         ;;
7136                 esac
7137                 ;;
7138         esac
7139         ;;
7140 esac
7141 case "$usequadmath" in
7142 $define)
7143         echo "quadmath selected." >&4
7144         case "$archname" in
7145         *-ld*) echo "...and architecture name already has -quadmath." >&4
7146                 ;;
7147         *)      archname="$archname-quadmath"
7148                 echo "...setting architecture name to $archname." >&4
7149                 ;;
7150         esac
7151         ;;
7152 esac
7153 if $test -f archname.cbu; then
7154         echo "Your platform has some specific hints for architecture name, using them..."
7155         . ./archname.cbu
7156 fi
7157
7158 : set the prefixit variable, to compute a suitable default value
7159 prefixit='case "$3" in
7160 ""|none)
7161         case "$oldprefix" in
7162         "") eval "$1=\"\$$2\"";;
7163         *)
7164                 case "$3" in
7165                 "") eval "$1=";;
7166                 none)
7167                         eval "tp=\"\$$2\"";
7168                         case "$tp" in
7169                         ""|" ") eval "$1=\"\$$2\"";;
7170                         *) eval "$1=";;
7171                         esac;;
7172                 esac;;
7173         esac;;
7174 *)
7175         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7176         case "$tp" in
7177         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7178         /*-$oldprefix/*|\~*-$oldprefix/*)
7179                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7180         *) eval "$1=\"\$$2\"";;
7181         esac;;
7182 esac'
7183
7184 : determine installation style
7185 : For now, try to deduce it from prefix unless it is already set.
7186 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7187 case "$installstyle" in
7188 '')     case "$prefix" in
7189                 *perl*) dflt='lib';;
7190                 *) dflt='lib/perl5' ;;
7191         esac
7192         ;;
7193 *)      dflt="$installstyle" ;;
7194 esac
7195 : Probably not worth prompting for this since we prompt for all
7196 : the directories individually, and the prompt would be too long and
7197 : confusing anyway.
7198 installstyle=$dflt
7199
7200 : determine where public executables go
7201 echo " "
7202 set dflt bin bin
7203 eval $prefixit
7204 fn=d~
7205 rp='Pathname where the public executables will reside?'
7206 . ./getfile
7207 if $test "X$ansexp" != "X$binexp"; then
7208         installbin=''
7209 fi
7210 prefixvar=bin
7211 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7212 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7213 :     this via initialinstalllocation
7214 . ./setprefixvar
7215
7216 case "$userelocatableinc" in
7217 $define|true|[yY]*)     dflt='y' ;;
7218 *)                      dflt='n' ;;
7219 esac
7220 cat <<EOM
7221
7222 Would you like to build Perl so that the installation is relocatable, so that
7223 library paths in @INC are determined relative to the path of the perl binary?
7224 This is not advised for system Perl installs, or if you need to run setid
7225 scripts or scripts under taint mode.
7226
7227 If this doesn't make any sense to you, just accept the default '$dflt'.
7228 EOM
7229 rp='Use relocatable @INC?'
7230 . ./myread
7231 case "$ans" in
7232 y|Y)    val="$define" ;;
7233 *)      val="$undef"  ;;
7234 esac
7235 set userelocatableinc
7236 eval $setvar
7237
7238 initialinstalllocation="$binexp"
7239 : Default prefix is now "up one level from where the binaries are"
7240 case "$userelocatableinc" in
7241 $define|true|[yY]*)
7242     bin=".../"
7243     binexp=".../"
7244     prefix=".../.."
7245     prefixexp=".../.."
7246     installprefixexp=".../.."
7247     ;;
7248 esac
7249
7250 : determine where private library files go
7251 : Usual default is /usr/local/lib/perl5/$version.
7252 : Also allow things like /opt/perl/lib/$version, since
7253 : /opt/perl/lib/perl5... would be redundant.
7254 : The default "style" setting is made in installstyle.U
7255 case "$installstyle" in
7256 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7257 *)       set dflt privlib lib/$version ;;
7258 esac
7259 eval $prefixit
7260 $cat <<EOM
7261
7262 There are some auxiliary files for $package that need to be put into a
7263 private library directory that is accessible by everyone.
7264
7265 EOM
7266 fn=$binexp
7267 fn=d~+
7268 rp='Pathname where the private library files will reside?'
7269 . ./getfile
7270 prefixvar=privlib
7271 . ./setprefixvar
7272
7273 : set the prefixup variable, to restore leading tilda escape
7274 prefixup='case "$prefixexp" in
7275 "$prefix") ;;
7276 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7277 esac'
7278
7279 : determine where public architecture dependent libraries go
7280 set archlib archlib
7281 eval $prefixit
7282 : privlib default is /usr/local/lib/$package/$version
7283 : archlib default is /usr/local/lib/$package/$version/$archname
7284 : privlib may have an optional trailing /share.
7285 tdflt=`echo $privlib | $sed 's,/share$,,'`
7286 tdflt=$tdflt/$archname
7287 case "$archlib" in
7288 '')     dflt=$tdflt
7289         ;;
7290 *)      dflt="$archlib"
7291     ;;
7292 esac
7293 $cat <<EOM
7294
7295 $spackage contains architecture-dependent library files.  If you are
7296 sharing libraries in a heterogeneous environment, you might store
7297 these files in a separate location.  Otherwise, you can just include
7298 them with the rest of the public library files.
7299
7300 EOM
7301 fn=$binexp
7302 fn=d+~
7303 rp='Where do you want to put the public architecture-dependent libraries?'
7304 . ./getfile
7305 prefixvar=archlib
7306 . ./setprefixvar
7307 if $test X"$archlib" = X"$privlib"; then
7308         d_archlib="$undef"
7309 else
7310         d_archlib="$define"
7311 fi
7312
7313 : see if setuid scripts can be secure
7314 $cat <<EOM
7315
7316 Some kernels have a bug that prevents setuid #! scripts from being
7317 secure.  Some sites have disabled setuid #! scripts because of this.
7318
7319 First let's decide if your kernel supports secure setuid #! scripts.
7320 (If setuid #! scripts would be secure but have been disabled anyway,
7321 don't say that they are secure if asked.)
7322
7323 EOM
7324
7325 val="$undef"
7326 if $test -d /dev/fd; then
7327         echo "#!$ls" >reflect
7328         chmod +x,u+s reflect
7329         ./reflect >flect 2>&1
7330         if $contains "/dev/fd" flect >/dev/null; then
7331                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7332                 val="$define"
7333         else
7334                 $cat <<EOM
7335 If you are not sure if they are secure, I can check but I'll need a
7336 username and password different from the one you are using right now.
7337 If you don't have such a username or don't want me to test, simply
7338 enter 'none'.
7339
7340 EOM
7341                 rp='Other username to test security of setuid scripts with?'
7342                 dflt='none'
7343                 . ./myread
7344                 case "$ans" in
7345                 n|none)
7346                         case "$d_suidsafe" in
7347                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7348                                 dflt=n;;
7349                         "$undef")
7350                                 echo "Well, the $hint value is *not* secure." >&4
7351                                 dflt=n;;
7352                         *)      echo "Well, the $hint value *is* secure." >&4
7353                                 dflt=y;;
7354                         esac
7355                         ;;
7356                 *)
7357                         $rm -f reflect flect
7358                         echo "#!$ls" >reflect
7359                         chmod +x,u+s reflect
7360                         echo >flect
7361                         chmod a+w flect
7362                         echo '"su" will (probably) prompt you for '"$ans's password."
7363                         su $ans -c './reflect >flect'
7364                         if $contains "/dev/fd" flect >/dev/null; then
7365                                 echo "Okay, it looks like setuid scripts are secure." >&4
7366                                 dflt=y
7367                         else
7368                                 echo "I don't think setuid scripts are secure." >&4
7369                                 dflt=n
7370                         fi
7371                         ;;
7372                 esac
7373                 rp='Does your kernel have *secure* setuid scripts?'
7374                 . ./myread
7375                 case "$ans" in
7376                 [yY]*)  val="$define";;
7377                 *)      val="$undef";;
7378                 esac
7379         fi
7380 else
7381         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7382         echo "(That's for file descriptors, not floppy disks.)"
7383         val="$undef"
7384 fi
7385 set d_suidsafe
7386 eval $setvar
7387
7388 $rm -f reflect flect
7389
7390 : now see if they want to do setuid emulation
7391 if $test $patchlevel -lt 11; then
7392 echo " "
7393 val="$undef"
7394 case "$d_suidsafe" in
7395 "$define")
7396         val="$undef"
7397         echo "No need to emulate SUID scripts since they are secure here." >&4
7398         ;;
7399 *)
7400         $cat <<EOM
7401 Some systems have disabled setuid scripts, especially systems where
7402 setuid scripts cannot be secure.  On systems where setuid scripts have
7403 been disabled, the setuid/setgid bits on scripts are currently
7404 useless.  It is possible for $package to detect those bits and emulate
7405 setuid/setgid in a secure fashion.  This emulation will only work if
7406 setuid scripts have been disabled in your kernel.
7407
7408 EOM
7409         case "$d_dosuid" in
7410         "$define") dflt=y ;;
7411         *) dflt=n ;;
7412         esac
7413         rp="Do you want to do setuid/setgid emulation?"
7414         . ./myread
7415         case "$ans" in
7416         [yY]*)  val="$define";;
7417         *)      val="$undef";;
7418         esac
7419         ;;
7420 esac
7421 set d_dosuid
7422 eval $setvar
7423 else
7424     case "$d_dosuid" in
7425         "$define")
7426         cat >&4 <<EOH
7427
7428 SUID emulation has been removed for 5.12
7429 Please re-run Configure without -Dd_dosuid
7430
7431 EOH
7432         exit 1;
7433         ;;
7434     esac
7435     d_dosuid=undef
7436 fi
7437
7438 : Find perl5.005 or later.
7439 echo "Looking for a previously installed perl5.005 or later... "
7440 case "$perl5" in
7441 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7442                 : Check if this perl is recent and can load a simple module
7443                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7444                         perl5=$tdir/perl
7445                         break;
7446                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7447                         perl5=$tdir/perl5
7448                         break;
7449                 fi
7450         done
7451         ;;
7452 *)      perl5="$perl5"
7453         ;;
7454 esac
7455 case "$perl5" in
7456 '')     echo "None found.  That's ok.";;
7457 *)      echo "Using $perl5." ;;
7458 esac
7459
7460 : Set the siteprefix variables
7461 $cat <<EOM
7462
7463 After $package is installed, you may wish to install various
7464 add-on modules and utilities.  Typically, these add-ons will
7465 be installed under $prefix with the rest
7466 of this package.  However, you may wish to install such add-ons
7467 elsewhere under a different prefix.
7468
7469 If you do not wish to put everything under a single prefix, that's
7470 ok.  You will be prompted for the individual locations; this siteprefix
7471 is only used to suggest the defaults.
7472
7473 The default should be fine for most people.
7474
7475 EOM
7476 fn=d~+
7477 rp='Installation prefix to use for add-on modules and utilities?'
7478 : XXX Here might be another good place for an installstyle setting.
7479 case "$siteprefix" in
7480 '') dflt=$prefix ;;
7481 *)  dflt=$siteprefix ;;
7482 esac
7483 . ./getfile
7484 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7485 oldsiteprefix=''
7486 case "$siteprefix" in
7487 '') ;;
7488 *)      case "$ans" in
7489         "$prefix") ;;
7490         *) oldsiteprefix="$prefix";;
7491         esac
7492         ;;
7493 esac
7494 siteprefix="$ans"
7495 siteprefixexp="$ansexp"
7496
7497 : determine where site specific libraries go.
7498 : Usual default is /usr/local/lib/perl5/site_perl/$version
7499 : The default "style" setting is made in installstyle.U
7500 : XXX No longer works with Prefixit stuff.
7501 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7502 case "$sitelib" in
7503 '') case "$installstyle" in
7504         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7505         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7506         esac
7507         ;;
7508 *)      dflt="$sitelib"
7509         ;;
7510 esac
7511 $cat <<EOM
7512
7513 The installation process will create a directory for
7514 site-specific extensions and modules.  Most users find it convenient
7515 to place all site-specific files in this directory rather than in the
7516 main distribution directory.
7517
7518 EOM
7519 fn=d~+
7520 rp='Pathname for the site-specific library files?'
7521 . ./getfile
7522 prefixvar=sitelib
7523 . ./setprefixvar
7524 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7525
7526 : Determine list of previous versions to include in @INC
7527 $cat > getverlist <<EOPL
7528 #!$perl5 -w
7529 use File::Basename;
7530 \$api_versionstring = "$api_versionstring";
7531 \$version = "$version";
7532 \$stem = "$sitelib_stem";
7533 \$archname = "$archname";
7534 EOPL
7535         $cat >> getverlist <<'EOPL'
7536 # The list found is store twice for each entry: the original name, and
7537 # the binary broken down version as pack "sss", so sorting is easy and
7538 # unambiguous. This will work for all versions that have a maximum of
7539 # three digit groups, separate by '.'s or '_'s. Names are extended with
7540 # ".0.0" to ensure at least three elements for the pack.
7541 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7542
7543 # Can't have leading @ because metaconfig interprets it as a command!
7544 ;@inc_version_list=();
7545 # XXX Redo to do opendir/readdir?
7546 if (-d $stem) {
7547     chdir($stem);
7548     ;@candidates = map {
7549         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7550     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7551 }
7552 else {
7553     ;@candidates = ();
7554 }
7555
7556 ($pversion, $aversion, $vsn5005) = map {
7557     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7558 foreach $d (@candidates) {
7559     if ($d->[1] lt $pversion) {
7560         if ($d->[1] ge $aversion) {
7561             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7562         }
7563         elsif ($d->[1] ge $vsn5005) {
7564             unshift(@inc_version_list, grep { -d } $d->[0]);
7565         }
7566     }
7567     else {
7568         # Skip newer version.  I.e. don't look in
7569         # 5.7.0 if we're installing 5.6.1.
7570     }
7571 }
7572
7573 if (@inc_version_list) {
7574     print join(' ', @inc_version_list);
7575 }
7576 else {
7577     # Blank space to preserve value for next Configure run.
7578     print " ";
7579 }
7580 EOPL
7581 chmod +x getverlist
7582 case "$inc_version_list" in
7583 '')     if test -x "$perl5$exe_ext"; then
7584                 dflt=`$perl5 getverlist`
7585         else
7586                 dflt='none'
7587         fi
7588         ;;
7589 $undef) dflt='none' ;;
7590 *)  eval dflt=\"$inc_version_list\" ;;
7591 esac
7592 case "$dflt" in
7593 ''|' ') dflt=none ;;
7594 esac
7595 case "$dflt" in
7596 5.005) dflt=none ;;
7597 esac
7598 $cat <<EOM
7599
7600 In order to ease the process of upgrading, this version of perl
7601 can be configured to use modules built and installed with earlier
7602 versions of perl that were installed under $prefix.  Specify here
7603 the list of earlier versions that this version of perl should check.
7604 If Configure detected no earlier versions of perl installed under
7605 $prefix, then the list will be empty.  Answer 'none' to tell perl
7606 to not search earlier versions.
7607
7608 The default should almost always be sensible, so if you're not sure,
7609 just accept the default.
7610 EOM
7611
7612 rp='List of earlier versions to include in @INC?'
7613 . ./myread
7614 case "$ans" in
7615 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7616 *) inc_version_list="$ans" ;;
7617 esac
7618 case "$inc_version_list" in
7619 ''|' ')
7620         inc_version_list_init='0'
7621         d_inc_version_list="$undef"
7622         ;;
7623 *)      inc_version_list_init=`echo $inc_version_list |
7624                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7625         d_inc_version_list="$define"
7626         ;;
7627 esac
7628 $rm -f getverlist
7629
7630 : see if malloc/malloc.h has to be included
7631 set malloc/malloc.h i_mallocmalloc
7632 eval $inhdr
7633
7634 : see if this is a malloc.h system
7635 : we want a real compile instead of Inhdr because some systems have a
7636 : malloc.h that just gives a compile error saying to use stdlib.h instead
7637 echo " "
7638 $cat >try.c <<EOCP
7639 #include <stdlib.h>
7640 #include <malloc.h>
7641 #$i_mallocmalloc I_MALLOCMALLOC
7642 #ifdef I_MALLOCMALLOC
7643 # include <malloc/malloc.h>
7644 #endif
7645
7646 int main () { return 0; }
7647 EOCP
7648 set try
7649 if eval $compile; then
7650     echo "<malloc.h> found." >&4
7651     val="$define"
7652 else
7653     echo "<malloc.h> NOT found." >&4
7654     val="$undef"
7655 fi
7656 $rm_try
7657 set i_malloc
7658 eval $setvar
7659
7660 : check for length of pointer
7661 echo " "
7662 case "$ptrsize" in
7663 '')
7664         echo "Checking to see how big your pointers are..." >&4
7665         $cat >try.c <<EOCP
7666 #include <stdio.h>
7667 #$i_stdlib I_STDLIB
7668 #ifdef I_STDLIB
7669 #include <stdlib.h>
7670 #endif
7671 int main()
7672 {
7673     printf("%d\n", (int)sizeof(void *));
7674     exit(0);
7675 }
7676 EOCP
7677         set try
7678         if eval $compile_ok; then
7679                 ptrsize=`$run ./try`
7680                 echo "Your pointers are $ptrsize bytes long."
7681         else
7682                 dflt='4'
7683                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7684                 rp="What is the size of a pointer (in bytes)?"
7685                 . ./myread
7686                 ptrsize="$ans"
7687         fi
7688         ;;
7689 esac
7690 $rm_try
7691 case "$use64bitall" in
7692 "$define"|true|[yY]*)
7693         case "$ptrsize" in
7694         4)      cat <<EOM >&4
7695
7696 *** You have chosen a maximally 64-bit build,
7697 *** but your pointers are only 4 bytes wide.
7698 *** Please rerun Configure without -Duse64bitall.
7699 EOM
7700                 case "$d_quad" in
7701                 define)
7702                         cat <<EOM >&4
7703 *** Since you have quads, you could possibly try with -Duse64bitint.
7704 EOM
7705                         ;;
7706                 esac
7707                 cat <<EOM >&4
7708 *** Cannot continue, aborting.
7709
7710 EOM
7711
7712                 exit 1
7713                 ;;
7714         esac
7715         ;;
7716 esac
7717
7718
7719 : determine whether to use malloc wrapping
7720 echo " "
7721 case "$usemallocwrap" in
7722 [yY]*|true|$define)     dflt='y' ;;
7723 [nN]*|false|$undef)     dflt='n' ;;
7724 *)      case "$usedevel" in
7725         [yY]*|true|$define)     dflt='y' ;;
7726         *) dflt='n' ;;
7727         esac
7728         ;;
7729 esac
7730 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7731 . ./myread
7732 usemallocwrap="$ans"
7733 case "$ans" in
7734 y*|true)
7735         usemallocwrap="$define" ;;
7736 *)
7737         usemallocwrap="$undef" ;;
7738 esac
7739
7740 : determine which malloc to compile in
7741 echo " "
7742 case "$usemymalloc" in
7743 [yY]*|true|$define)     dflt='y' ;;
7744 [nN]*|false|$undef)     dflt='n' ;;
7745 *)      case "$ptrsize" in
7746         4) dflt='y' ;;
7747         *) dflt='n' ;;
7748         esac
7749         if test "$useithreads" = "$define"; then dflt='n'; fi
7750         ;;
7751 esac
7752 rp="Do you wish to attempt to use the malloc that comes with $package?"
7753 . ./myread
7754 usemymalloc="$ans"
7755 case "$ans" in
7756 y*|true)
7757         usemymalloc='y'
7758         mallocsrc='malloc.c'
7759         mallocobj="malloc$_o"
7760         d_mymalloc="$define"
7761         case "$libs" in
7762         *-lmalloc*)
7763                 : Remove malloc from list of libraries to use
7764                 echo "Removing unneeded -lmalloc from library list" >&4
7765                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7766                 shift
7767                 libs="$*"
7768                 echo "libs = $libs" >&4
7769                 ;;
7770         esac
7771         ;;
7772 *)
7773         usemymalloc='n'
7774         mallocsrc=''
7775         mallocobj=''
7776         d_mymalloc="$undef"
7777         ;;
7778 esac
7779
7780 : compute the return types of malloc and free
7781 echo " "
7782 $cat >malloc.c <<END
7783 #$i_malloc I_MALLOC
7784 #$i_stdlib I_STDLIB
7785 #include <stdio.h>
7786 #include <sys/types.h>
7787 #ifdef I_MALLOC
7788 #include <malloc.h>
7789 #endif
7790 #ifdef I_STDLIB
7791 #include <stdlib.h>
7792 #endif
7793 #ifdef TRY_MALLOC
7794 void *malloc();
7795 #endif
7796 #ifdef TRY_FREE
7797 void free();
7798 #endif
7799 END
7800 case "$malloctype" in
7801 '')
7802         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7803                 malloctype='void *'
7804         else
7805                 malloctype='char *'
7806         fi
7807         ;;
7808 esac
7809 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7810
7811 case "$freetype" in
7812 '')
7813         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7814                 freetype='void'
7815         else
7816                 freetype='int'
7817         fi
7818         ;;
7819 esac
7820 echo "Your system uses $freetype free(), it would seem." >&4
7821 $rm -f malloc.[co]
7822 : determine where site specific architecture-dependent libraries go.
7823 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7824 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7825 : sitelib may have an optional trailing /share.
7826 case "$sitearch" in
7827 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7828         dflt="$dflt/$archname"
7829         ;;
7830 *)      dflt="$sitearch"
7831         ;;
7832 esac
7833 set sitearch sitearch none
7834 eval $prefixit
7835 $cat <<EOM
7836
7837 The installation process will also create a directory for
7838 architecture-dependent site-specific extensions and modules.
7839
7840 EOM
7841 fn=d~+
7842 rp='Pathname for the site-specific architecture-dependent library files?'
7843 . ./getfile
7844 prefixvar=sitearch
7845 . ./setprefixvar
7846 if $test X"$sitearch" = X"$sitelib"; then
7847         d_sitearch="$undef"
7848 else
7849         d_sitearch="$define"
7850 fi
7851
7852 : Set the vendorprefix variables
7853 $cat <<EOM
7854
7855 The installation process will also create a directory for
7856 vendor-supplied add-ons.  Vendors who supply perl with their system
7857 may find it convenient to place all vendor-supplied files in this
7858 directory rather than in the main distribution directory.  This will
7859 ease upgrades between binary-compatible maintenance versions of perl.
7860
7861 Of course you may also use these directories in whatever way you see
7862 fit.  For example, you might use them to access modules shared over a
7863 company-wide network.
7864
7865 The default answer should be fine for most people.
7866 This causes further questions about vendor add-ons to be skipped
7867 and no vendor-specific directories will be configured for perl.
7868
7869 EOM
7870 rp='Do you want to configure vendor-specific add-on directories?'
7871 case "$usevendorprefix" in
7872 define|true|[yY]*) dflt=y ;;
7873 *)      : User may have set vendorprefix directly on Configure command line.
7874         case "$vendorprefix" in
7875         ''|' ') dflt=n ;;
7876         *)      dflt=y ;;
7877         esac
7878         ;;
7879 esac
7880 . ./myread
7881 case "$ans" in
7882 [yY]*)  fn=d~+
7883         rp='Installation prefix to use for vendor-supplied add-ons?'
7884         case "$vendorprefix" in
7885         '') dflt="$prefix" ;;
7886         *)  dflt=$vendorprefix ;;
7887         esac
7888         . ./getfile
7889         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7890         oldvendorprefix=''
7891         case "$vendorprefix" in
7892         '') ;;
7893         *)      case "$ans" in
7894                 "$prefix") ;;
7895                 *) oldvendorprefix="$prefix";;
7896                 esac
7897                 ;;
7898         esac
7899         usevendorprefix="$define"
7900         vendorprefix="$ans"
7901         vendorprefixexp="$ansexp"
7902         ;;
7903 *)      usevendorprefix="$undef"
7904         vendorprefix=''
7905         vendorprefixexp=''
7906         ;;
7907 esac
7908
7909 : Set the vendorlib variables
7910 case "$vendorprefix" in
7911 '')     d_vendorlib="$undef"
7912         vendorlib=''
7913         vendorlibexp=''
7914         ;;
7915 *)      d_vendorlib="$define"
7916         : determine where vendor-supplied modules go.
7917         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7918         case "$vendorlib" in
7919         '')
7920                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7921                 case "$installstyle" in
7922                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7923                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7924                 esac
7925                 ;;
7926         *)      dflt="$vendorlib"
7927                 ;;
7928         esac
7929         fn=d~+
7930         rp='Pathname for the vendor-supplied library files?'
7931         . ./getfile
7932         vendorlib="$ans"
7933         vendorlibexp="$ansexp"
7934         ;;
7935 esac
7936 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7937 prefixvar=vendorlib
7938 . ./installprefix
7939
7940 : Set the vendorarch variables
7941 case "$vendorprefix" in
7942 '')     d_vendorarch="$undef"
7943         vendorarch=''
7944         vendorarchexp=''
7945         ;;
7946 *)      d_vendorarch="$define"
7947         : determine where vendor-supplied architecture-dependent libraries go.
7948         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7949         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7950         : vendorlib may have an optional trailing /share.
7951         case "$vendorarch" in
7952         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7953                 dflt="$dflt/$archname"
7954                 ;;
7955         *)      dflt="$vendorarch" ;;
7956         esac
7957         fn=d~+
7958         rp='Pathname for vendor-supplied architecture-dependent files?'
7959         . ./getfile
7960         vendorarch="$ans"
7961         vendorarchexp="$ansexp"
7962         ;;
7963 esac
7964 prefixvar=vendorarch
7965 . ./installprefix
7966 if $test X"$vendorarch" = X"$vendorlib"; then
7967         d_vendorarch="$undef"
7968 else
7969         d_vendorarch="$define"
7970 fi
7971
7972 : Final catch-all directories to search
7973 $cat <<EOM
7974
7975 Lastly, you can have perl look in other directories for extensions and
7976 modules in addition to those already specified.
7977 These directories will be searched after
7978         $sitearch
7979         $sitelib
7980 EOM
7981 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7982 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7983 echo ' '
7984 case "$otherlibdirs" in
7985 ''|' ') dflt='none' ;;
7986 *)      dflt="$otherlibdirs" ;;
7987 esac
7988 $cat <<EOM
7989 Enter a colon-separated set of extra paths to include in perl's @INC
7990 search path, or enter 'none' for no extra paths.
7991
7992 EOM
7993
7994 rp='Colon-separated list of additional directories for perl to search?'
7995 . ./myread
7996 case "$ans" in
7997 ' '|''|none)    otherlibdirs=' ' ;;
7998 *)      otherlibdirs="$ans" ;;
7999 esac
8000 case "$otherlibdirs" in
8001 ' ') val=$undef ;;
8002 *)      val=$define ;;
8003 esac
8004 set d_perl_otherlibdirs
8005 eval $setvar
8006
8007 : Cruising for prototypes
8008 echo " "
8009 echo "Checking out function prototypes..." >&4
8010 $cat >prototype.c <<EOCP
8011 #$i_stdlib I_STDLIB
8012 #ifdef I_STDLIB
8013 #include <stdlib.h>
8014 #endif
8015 int main(int argc, char *argv[]) {
8016         exit(0);}
8017 EOCP
8018 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8019         echo "Your C compiler appears to support function prototypes."
8020         val="$define"
8021 else
8022         echo "Your C compiler doesn't seem to understand function prototypes."
8023         val="$undef"
8024 fi
8025 set prototype
8026 eval $setvar
8027 $rm -f prototype*
8028
8029 : Check if ansi2knr is required
8030 case "$prototype" in
8031 "$define") ;;
8032 *)      ansi2knr='ansi2knr'
8033         echo " "
8034         cat <<EOM >&4
8035
8036 $me:  FATAL ERROR:
8037 This version of $package can only be compiled by a compiler that
8038 understands function prototypes.  Unfortunately, your C compiler
8039         $cc $ccflags
8040 doesn't seem to understand them.  Sorry about that.
8041
8042 If GNU cc is available for your system, perhaps you could try that instead.
8043
8044 Eventually, we hope to support building Perl with pre-ANSI compilers.
8045 If you would like to help in that effort, please contact <perlbug@perl.org>.
8046
8047 Aborting Configure now.
8048 EOM
8049         exit 2
8050         ;;
8051 esac
8052
8053 : DTrace support
8054 dflt_dtrace='/usr/sbin/dtrace'
8055 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8056
8057 cat <<EOM
8058
8059 Perl can be built to support DTrace on platforms that support it.
8060 DTrace is a diagnosis and performance analysis tool from Sun.
8061
8062 If this doesn't make any sense to you, just accept the default.
8063 EOM
8064
8065 while $test 1 ; do
8066         case "$usedtrace" in
8067         $define|true|[yY]*)
8068                 dflt='y'
8069                 ;;
8070         ?*)
8071                 dflt='y'
8072                 dflt_dtrace=$usedtrace
8073                 ;;
8074         *)
8075                 dflt='n'
8076                 ;;
8077         esac
8078
8079         rp='Support DTrace if available?'
8080         . ./myread
8081         case "$ans" in
8082         y|Y)    val="$define" ;;
8083         *)      val="$undef" ;;
8084         esac
8085         set usedtrace
8086         eval $setvar
8087
8088         test "X$usedtrace" != "X$define" && break
8089
8090         echo " "
8091         rp='Where is the dtrace executable?'
8092         dflt=$dflt_dtrace
8093         . ./getfile
8094         val="$ans"
8095         set dtrace
8096         eval $setvar
8097
8098         if $test -f $dtrace
8099         then
8100                 if $dtrace -h -s ../perldtrace.d \
8101                         -o perldtrace.tmp >/dev/null 2>&1 \
8102                         && rm -f perldtrace.tmp
8103                 then
8104                         echo " "
8105                         echo "Good: your $dtrace knows about the -h flag."
8106                 else
8107                         cat >&2 <<EOM
8108
8109 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8110 ***
8111 *** Your installed dtrace doesn't support the -h switch to compile a D
8112 *** program into a C header. Can't continue.
8113
8114 EOM
8115                         exit 1
8116                 fi
8117                 break;
8118         fi
8119
8120         case "$fastread" in
8121         yes)
8122                 cat >&2 <<EOM
8123
8124 *** $me:  Fatal Error:  $dtrace not found.
8125 *** Can't continue.
8126
8127 EOM
8128                 exit 1
8129                 ;;
8130         *)
8131                 echo "*** $dtrace was not found."
8132                 echo " "
8133                 ;;
8134         esac
8135 done
8136
8137 : See if we want extra modules installed
8138 echo " "
8139 case "$extras" in
8140 '') dflt='n';;
8141 *) dflt='y';;
8142 esac
8143 cat <<EOM
8144 Perl can be built with extra modules or bundles of modules which
8145 will be fetched from the CPAN and installed alongside Perl.
8146
8147 Notice that you will need access to the CPAN; either via the Internet,
8148 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8149 be asked later to configure the CPAN.pm module which will in turn do
8150 the installation of the rest of the extra modules or bundles.)
8151
8152 Notice also that if the modules require any external software such as
8153 libraries and headers (the libz library and the zlib.h header for the
8154 Compress::Zlib module, for example) you MUST have any such software
8155 already installed, this configuration process will NOT install such
8156 things for you.
8157
8158 If this doesn't make any sense to you, just accept the default '$dflt'.
8159 EOM
8160 rp='Install any extra modules (y or n)?'
8161 . ./myread
8162 case "$ans" in
8163 y|Y)
8164         cat <<EOM
8165
8166 Please list any extra modules or bundles to be installed from CPAN,
8167 with spaces between the names.  The names can be in any format the
8168 'install' command of CPAN.pm will understand.  (Answer 'none',
8169 without the quotes, to install no extra modules or bundles.)
8170 EOM
8171         rp='Extras?'
8172         dflt="$extras"
8173         . ./myread
8174         extras="$ans"
8175 esac
8176 case "$extras" in
8177 ''|'none')
8178         val=''
8179         $rm -f ../extras.lst
8180         ;;
8181 *)      echo "(Saving the list of extras for later...)"
8182         echo "$extras" > ../extras.lst
8183         val="'$extras'"
8184         ;;
8185 esac
8186 set extras
8187 eval $setvar
8188 echo " "
8189
8190 : determine where html pages for programs go
8191 set html1dir html1dir none
8192 eval $prefixit
8193 $cat <<EOM
8194
8195 If you wish to install html files for programs in $spackage, indicate
8196 the appropriate directory here.  To skip installing html files,
8197 answer "none".
8198 EOM
8199 case "$html1dir" in
8200 ''|none|$undef|' ') dflt=none ;;
8201 *) dflt=$html1dir ;;
8202 esac
8203 fn=dn+~
8204 rp="Directory for the main $spackage html pages?"
8205 . ./getfile
8206 prefixvar=html1dir
8207 . ./setprefixvar
8208 : Use ' ' for none so value is preserved next time through Configure
8209 $test X"$html1dir" = "X" && html1dir=' '
8210
8211 : determine where html pages for libraries and modules go
8212 set html3dir html3dir none
8213 eval $prefixit
8214 $cat <<EOM
8215
8216 If you wish to install html files for modules associated with $spackage,
8217 indicate the appropriate directory here.  To skip installing html files,
8218 answer "none".
8219 EOM
8220 : There is no obvious default.  If they have specified html1dir, then
8221 : try to key off that, possibly changing .../html1 into .../html3.
8222 case "$html3dir" in
8223 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8224 *) dflt=$html3dir ;;
8225 esac
8226 fn=dn+~
8227 rp="Directory for the $spackage module html pages?"
8228 . ./getfile
8229 prefixvar=html3dir
8230 . ./setprefixvar
8231 : Use ' ' for none so value is preserved next time through Configure
8232 $test X"$html3dir" = "X" && html3dir=' '
8233
8234 : determine whether to install perl also as /usr/bin/perl
8235
8236 echo " "
8237 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8238         $cat <<EOM
8239 Many scripts expect perl to be installed as /usr/bin/perl.
8240
8241 If you want to, I can install the perl you are about to compile
8242 as /usr/bin/perl (in addition to $bin/perl).
8243 EOM
8244         if test -f /usr/bin/perl; then
8245             $cat <<EOM
8246
8247 However, please note that because you already have a /usr/bin/perl,
8248 overwriting that with a new Perl would very probably cause problems.
8249 Therefore I'm assuming you don't want to do that (unless you insist).
8250
8251 EOM
8252             case "$installusrbinperl" in
8253             "$define"|[yY]*)    dflt='y';;
8254             *)                  dflt='n';;
8255             esac
8256         else
8257             $cat <<EOM
8258
8259 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8260
8261 EOM
8262             case "$installusrbinperl" in
8263             "$undef"|[nN]*)     dflt='n';;
8264             *)                  dflt='y';;
8265             esac
8266         fi
8267         rp="Do you want to install perl as /usr/bin/perl?"
8268         . ./myread
8269         case "$ans" in
8270         [yY]*)  val="$define";;
8271         *)      val="$undef" ;;
8272         esac
8273 else
8274         val="$undef"
8275 fi
8276 set installusrbinperl
8277 eval $setvar
8278
8279 : see if dlopen exists
8280 xxx_runnm="$runnm"
8281 xxx_ccflags="$ccflags"
8282 runnm=false
8283 : with g++ one needs -shared to get is-in-libc to work for dlopen
8284 case "$gccversion" in
8285 '')     ;;
8286 *Clang*)        ;;
8287 *)      case "$d_cplusplus" in
8288         "$define") ccflags="$ccflags -shared" ;;
8289         esac
8290         ;;
8291 esac
8292 set dlopen d_dlopen
8293 eval $inlibc
8294 runnm="$xxx_runnm"
8295 ccflags="$xxx_ccflags"
8296
8297 : see if this is a unistd.h system
8298 set unistd.h i_unistd
8299 eval $inhdr
8300
8301 : determine which dynamic loading, if any, to compile in
8302 echo " "
8303 dldir="ext/DynaLoader"
8304 case "$usedl" in
8305     $define|y|true)
8306         dflt='y'
8307         usedl="$define"
8308         ;;
8309     $undef|n|false)
8310         dflt='n'
8311         usedl="$undef"
8312         ;;
8313     *)
8314         dflt='n'
8315         case "$d_dlopen" in
8316             $define) dflt='y' ;;
8317         esac
8318         : Does a dl_xxx.xs file exist for this operating system
8319         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8320         ;;
8321 esac
8322 rp="Do you wish to use dynamic loading?"
8323 . ./myread
8324 usedl="$ans"
8325 bin_ELF="$undef"
8326 case "$ans" in
8327     y*) usedl="$define"
8328         case "$dlsrc" in
8329             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8330                     dflt="$dldir/dl_${osname}.xs"
8331                 elif $test "$d_dlopen" = "$define" ; then
8332                     dflt="$dldir/dl_dlopen.xs"
8333                 else
8334                     dflt=''
8335                 fi
8336                 ;;
8337             *)  dflt="$dldir/$dlsrc"
8338                 ;;
8339         esac
8340         echo "The following dynamic loading files are available:"
8341         : Can not go over to $dldir because getfile has path hard-coded in.
8342         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8343         rp="Source file to use for dynamic loading"
8344         fn="fne"
8345         gfpth="$src"
8346         . ./getfile
8347         usedl="$define"
8348         : emulate basename
8349         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8350
8351         $cat << EOM
8352
8353 Some systems may require passing special flags to $cc -c to
8354 compile modules that will be used to create a shared library.
8355 To use no flags, say "none".
8356
8357 EOM
8358         case "$cccdlflags" in
8359             '') case "$gccversion" in
8360                 '') case "$osname" in
8361                         hpux)   dflt='+z' ;;
8362                         irix*)  dflt='-KPIC' ;;
8363                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8364                         sunos)  dflt='-pic' ;;
8365                         *)      dflt='none' ;;
8366                     esac
8367                     ;;
8368                 *)  case "$osname" in
8369                         darwin) dflt='none' ;;
8370                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8371                         *)      dflt='-fpic' ;;
8372                     esac ;;
8373                 esac ;;
8374             ' ') dflt='none' ;;
8375             *)   dflt="$cccdlflags" ;;
8376         esac
8377
8378         case "$dflt" in
8379             none) dflt='' ;;
8380         esac
8381
8382         # If -Dsysroot was specified, now's the time to add it
8383         # to cccdlflags
8384         if test "X$sysroot" != X; then
8385             case "$gccversion" in
8386                 '') ;;
8387                 *)  case "$dflt" in
8388                         *sysroot*) ;;
8389                         'undef'|*)
8390                             dflt="$dflt --sysroot=$sysroot" ;;
8391                     esac
8392                     ;;
8393             esac
8394         fi
8395
8396         case "$dflt" in
8397             '') dflt='none';;
8398         esac
8399
8400         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8401         . ./myread
8402         case "$ans" in
8403             none) cccdlflags=' ' ;;
8404             *)    cccdlflags="$ans" ;;
8405         esac
8406
8407         cat << EOM
8408
8409 Some systems use ld to create libraries that can be dynamically loaded,
8410 while other systems (such as those using ELF) use $cc.
8411
8412 EOM
8413
8414 : Determine if this is ELF
8415         $cat >try.c <<EOM
8416 /* Test for whether ELF binaries are produced */
8417 #include <fcntl.h>
8418 #$i_stdlib I_STDLIB
8419 #ifdef I_STDLIB
8420 #include <stdlib.h>
8421 #endif
8422 #$i_unistd I_UNISTD
8423 #ifdef I_UNISTD
8424 #include <unistd.h>
8425 #endif
8426 int main() {
8427     char b[4];
8428     int i = open("a.out",O_RDONLY);
8429     if(i == -1)
8430         exit(1); /* fail */
8431     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8432         exit(0); /* succeed (yes, it is ELF) */
8433     exit(1); /* fail */
8434 }
8435 EOM
8436         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8437             bin_ELF="$define"
8438         fi
8439         $rm_try
8440
8441         case "$ld" in
8442             '') if $test $bin_ELF = "$define"; then
8443                     cat <<EOM
8444 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8445 EOM
8446                     dflt="$cc"
8447                 else
8448                     echo "I'll use ld to build dynamic libraries."
8449                     dflt='ld'
8450                 fi
8451                 ;;
8452             *)  dflt="$ld"
8453                 ;;
8454         esac
8455
8456         rp="What command should be used to create dynamic libraries?"
8457         . ./myread
8458         ld="$ans"
8459
8460         cat << EOM
8461
8462 Some systems may require passing special flags to $ld to create a
8463 library that can be dynamically loaded.  If your ld flags include
8464 -L/other/path options to locate libraries outside your loader's normal
8465 search path, you may need to specify those -L options here as well.  To
8466 use no flags, say "none".
8467
8468 EOM
8469         case "$lddlflags" in
8470             '') case "$osname" in
8471                     haiku) dflt='-shared' ;;
8472                     hpux) dflt='-b';
8473                           case "$gccversion" in
8474                               '') dflt="$dflt +vnocompatwarnings" ;;
8475                           esac
8476                           ;;
8477                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8478                     solaris) # See [perl #66604].
8479                             # On Solaris 11, gcc -m64 on amd64
8480                             # appears not to understand -G.  gcc versions at
8481                             # least as old as 3.4.3 support -shared, so just
8482                             # use that with Solaris 11 and later, but keep
8483                             # the old behavior for older Solaris versions.
8484                             case "$gccversion" in
8485                                 '') dflt='-G' ;;
8486                                 *)  case "$osvers" in
8487                                         2.?|2.10) dflt='-G' ;;
8488                                         *) dflt='-shared' ;;
8489                                     esac
8490                                     ;;
8491                             esac
8492                             ;;
8493                     sunos) dflt='-assert nodefinitions' ;;
8494                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8495                     *)     dflt='none' ;;
8496                 esac
8497                 ;;
8498             *) dflt="$lddlflags" ;;
8499         esac
8500
8501         : Only do this for gcc, since, for example, qcc has no concept
8502         : of --sysroot.
8503         if $test "X$sysroot" != X; then
8504             case "$gccversion" in
8505                 '') ;;
8506                 *)  dflt="$dflt --sysroot $sysroot" ;;
8507             esac
8508         fi
8509
8510         : Try to guess additional flags to pick up local libraries.
8511         : Be careful not to append to a plain 'none'
8512         case "$dflt" in
8513             none) dflt='' ;;
8514         esac
8515         for thisflag in $ldflags; do
8516             case "$thisflag" in
8517                 -L*|-R*|-Wl,-R*)
8518                     case " $dflt " in
8519                         *" $thisflag "*) ;;
8520                         *) dflt="$dflt $thisflag" ;;
8521                     esac
8522                     ;;
8523             esac
8524         done
8525
8526         case "$dflt" in
8527             ''|' ') dflt='none' ;;
8528         esac
8529
8530         case "$ldflags" in
8531             *-fstack-protector-strong*)
8532                 case "$dflt" in
8533                     *-fstack-protector-strong*) ;; # Don't add it again
8534                     *) dflt="$dflt -fstack-protector-strong" ;;
8535                 esac
8536                 ;;
8537             *-fstack-protector*)
8538                 case "$dflt" in
8539                     *-fstack-protector*) ;; # Don't add it again
8540                     *) dflt="$dflt -fstack-protector" ;;
8541                 esac
8542                 ;;
8543         esac
8544
8545         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8546         . ./myread
8547         case "$ans" in
8548             none) lddlflags=' ' ;;
8549             *) lddlflags="$ans" ;;
8550         esac
8551
8552         cat <<EOM
8553
8554 Some systems may require passing special flags to $cc to indicate that
8555 the resulting executable will use dynamic linking.  To use no flags,
8556 say "none".
8557
8558 EOM
8559         case "$ccdlflags" in
8560             '') case "$osname" in
8561                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8562                     sunos)             dflt='none'   ;;
8563                     *)                 dflt='none'   ;;
8564                 esac ;;
8565             ' ') dflt='none' ;;
8566             *)   dflt="$ccdlflags" ;;
8567         esac
8568         rp="Any special flags to pass to $cc to use dynamic linking?"
8569         . ./myread
8570         case "$ans" in
8571             none) ccdlflags=' ' ;;
8572             *)    ccdlflags="$ans" ;;
8573         esac
8574         ;;
8575
8576     *)  usedl="$undef"
8577         ld='ld'
8578         dlsrc='dl_none.xs'
8579         lddlflags=''
8580         ccdlflags=''
8581         ;;
8582 esac
8583
8584 ld_can_script="$undef"
8585 case "$bin_ELF$usedl" in
8586     $define$define)
8587         # Abuse try.h and a.out names for neat cleanup
8588         $cat >try.c <<EOM
8589 void foo() {}
8590 void bar() {}
8591 EOM
8592         $cat >try.h <<EOM
8593 LIBTEST_42 {
8594  global:
8595   foo;
8596  local: *;
8597  };
8598 EOM
8599         if $cc $cccdlflags $ccdlflags $ccflags \
8600                $ldflags $lddlflags -o a.out try.c \
8601                -Wl,--version-script=try.h >/dev/null 2>&1 \
8602            &&  $test -s a.out ; then
8603             echo "ld supports scripting" >&4
8604             ld_can_script="$define"
8605         else
8606             echo "ld does not support scripting" >&4
8607         fi
8608         $rm_try
8609         ;;
8610 esac
8611
8612 : Do we want a shared libperl?
8613 also=''
8614 case "$usedl" in
8615 $undef)
8616         # No dynamic loading being used, so don't bother even to prompt.
8617         useshrplib='false'
8618         ;;
8619 *)      case "$useshrplib" in
8620         '')     case "$osname" in
8621                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8622                         dflt=y
8623                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8624                         ;;
8625                 *)      dflt=n
8626                         ;;
8627                 esac
8628                 ;;
8629         $define|true|[Yy]*)
8630                 dflt=y
8631                 ;;
8632         *)      dflt=n
8633                 ;;
8634         esac
8635         $cat << EOM
8636
8637 The perl executable is normally obtained by linking perlmain.c with
8638 libperl${_a}, any static extensions (usually just DynaLoader), and
8639 any other libraries needed on this system (such as -lm, etc.).  Since
8640 your system supports dynamic loading, it is probably possible to build
8641 a shared libperl.$so.  If you will have more than one executable linked
8642 to libperl.$so, this will significantly reduce the size of each
8643 executable, but it may have a noticeable effect on performance.  The
8644 default is probably sensible for your system.
8645 $also
8646
8647 EOM
8648         rp="Build a shared libperl.$so (y/n)"
8649         . ./myread
8650         case "$ans" in
8651         true|$define|[Yy]*)
8652                 useshrplib='true'  ;;
8653         *)      useshrplib='false' ;;
8654         esac
8655         ;;
8656 esac
8657
8658 case "$useshrplib" in
8659 true)
8660         case "$userelocatableinc" in
8661         true|define)
8662                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8663                 echo "See INSTALL for an explanation why that won't work." >&4
8664                 exit 4
8665                 ;;
8666         esac
8667         case "$libperl" in
8668         '')
8669                 # Figure out a good name for libperl.so.  Since it gets stored in
8670                 # a version-specific architecture-dependent library, the version
8671                 # number isn't really that important, except for making cc/ld happy.
8672                 #
8673                 # A name such as libperl.so.10.1
8674                 majmin="libperl.$so.$patchlevel.$subversion"
8675                 # A name such as libperl.so.100
8676                 majonly=`echo $patchlevel $subversion |
8677                         $awk '{printf "%d%02d", $1, $2}'`
8678                 majonly=libperl.$so.$majonly
8679                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8680                 # rely on figuring it out from the naming of libc.
8681                 case "${osname}${osvers}" in
8682                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8683                         dflt=libperl.$so
8684                         ;;
8685                 cygwin*) # ld links now against the dll directly
8686                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8687                         majonly=`echo $patchlevel $subversion |
8688                                 $awk '{printf "%03d%03d", $1, $2}'`
8689                         majonly=cygperl5.$majonly.$so
8690                         dflt=$majmin
8691                         ;;
8692                 *)      # Try to guess based on whether libc has major.minor.
8693                         case "$libc" in
8694                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8695                         *libc.$so.[0-9]*) dflt=$majonly ;;
8696                         *)      dflt=libperl.$so ;;
8697                         esac
8698                         ;;
8699                 esac
8700                 ;;
8701         *)      dflt=$libperl
8702                 ;;
8703         esac
8704         cat << EOM
8705
8706 I need to select a good name for the shared libperl.  If your system uses
8707 library names with major and minor numbers, then you might want something
8708 like $majmin.  Alternatively, if your system uses a single version
8709 number for shared libraries, then you might want to use $majonly.
8710 Or, your system might be quite happy with a simple libperl.$so.
8711
8712 Since the shared libperl will get installed into a version-specific
8713 architecture-dependent directory, the version number of the shared perl
8714 library probably isn't important, so the default should be o.k.
8715
8716 EOM
8717         rp='What name do you want to give to the shared libperl?'
8718         . ./myread
8719         libperl=$ans
8720         echo "Ok, I'll use $libperl"
8721         ;;
8722 *)
8723         libperl="libperl${_a}"
8724         ;;
8725 esac
8726
8727 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8728 case "$shrpdir" in
8729 '') ;;
8730 *)      $cat >&4 <<EOM
8731 WARNING:  Use of the shrpdir variable for the installation location of
8732 the shared $libperl is not supported.  It was never documented and
8733 will not work in this version.  Let me (perlbug@perl.org)
8734 know of any problems this may cause.
8735
8736 EOM
8737         case "$shrpdir" in
8738         "$archlibexp/CORE")
8739                 $cat >&4 <<EOM
8740 But your current setting of $shrpdir is
8741 the default anyway, so it's harmless.
8742 EOM
8743                 ;;
8744         *)
8745                 $cat >&4 <<EOM
8746 Further, your current attempted setting of $shrpdir
8747 conflicts with the value of $archlibexp/CORE
8748 that installperl will use.
8749 EOM
8750                 ;;
8751         esac
8752         ;;
8753 esac
8754
8755 # How will the perl executable find the installed shared $libperl?
8756 # Add $xxx to ccdlflags.
8757 # If we can't figure out a command-line option, use $shrpenv to
8758 # set env LD_RUN_PATH.  The main perl makefile uses this.
8759 shrpdir=$archlibexp/CORE
8760 xxx=''
8761 tmp_shrpenv=''
8762 if "$useshrplib"; then
8763     case "$osname" in
8764         aix)
8765                 # We'll set it in Makefile.SH...
8766                 ;;
8767         solaris)
8768                 xxx="-R $shrpdir"
8769                 ;;
8770         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8771                 xxx="-Wl,-R$shrpdir"
8772                 ;;
8773         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8774                 xxx="-Wl,-rpath,$shrpdir"
8775                 ;;
8776         hpux*)
8777                 # hpux doesn't like the default, either.
8778                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8779                 ;;
8780         cygwin)
8781                 # cygwin needs only ldlibpth
8782                 ;;
8783         *)
8784                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8785                 ;;
8786         esac
8787         case "$xxx" in
8788         '') ;;
8789         *)
8790                 # Only add $xxx if it isn't already in ccdlflags.
8791                 case " $ccdlflags " in
8792                 *" $xxx "*)     ;;
8793                 *)      ccdlflags="$ccdlflags $xxx"
8794                         cat <<EOM >&4
8795
8796 Adding $xxx to the flags
8797 passed to $ld so that the perl executable will find the
8798 installed shared $libperl.
8799
8800 EOM
8801                         ;;
8802                 esac
8803                 ;;
8804         esac
8805 fi
8806 # Fix ccdlflags in AIX for building external extensions.
8807 # (For building Perl itself bare -bE:perl.exp is needed,
8808 #  Makefile.SH takes care of this.)
8809 case "$osname" in
8810 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8811 esac
8812 # Respect a hint or command-line value.
8813 case "$shrpenv" in
8814 '') shrpenv="$tmp_shrpenv" ;;
8815 esac
8816 case "$ldlibpthname" in
8817 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8818 none)   ldlibpthname='' ;;
8819 esac
8820
8821 : determine where manual pages are on this system
8822 echo " "
8823 case "$sysman" in
8824 '')
8825         syspath='/usr/share/man/man1 /usr/man/man1'
8826         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8827         syspath="$syspath /usr/man/u_man/man1"
8828         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8829         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8830         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8831         sysman=`./loc . /usr/man/man1 $syspath`
8832         ;;
8833 esac
8834 if $test -d "$sysman"; then
8835         echo "System manual is in $sysman." >&4
8836 else
8837         echo "Could not find manual pages in source form." >&4
8838 fi
8839
8840 : determine where manual pages go
8841 set man1dir man1dir none
8842 eval $prefixit
8843 $cat <<EOM
8844
8845 $spackage has manual pages available in source form.
8846 EOM
8847 case "$nroff" in
8848 nroff)
8849         echo "However, you don't have nroff, so they're probably useless to you."
8850         case "$man1dir" in
8851         '') man1dir="none";;
8852         esac;;
8853 esac
8854 echo "If you don't want the manual sources installed, answer 'none'."
8855 case "$man1dir" in
8856 ' ') dflt=none
8857         ;;
8858 '')
8859         lookpath="$prefixexp/share/man/man1"
8860         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8861         lookpath="$lookpath $prefixexp/man/p_man/man1"
8862         lookpath="$lookpath $prefixexp/man/u_man/man1"
8863         lookpath="$lookpath $prefixexp/man/man.1"
8864         case "$sysman" in
8865         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8866         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8867         esac
8868         set dflt
8869         eval $prefixup
8870         ;;
8871 *)  dflt="$man1dir"
8872         ;;
8873 esac
8874 echo " "
8875 fn=dn+~
8876 rp="Where do the main $spackage manual pages (source) go?"
8877 . ./getfile
8878 if $test "X$man1direxp" != "X$ansexp"; then
8879         installman1dir=''
8880 fi
8881 prefixvar=man1dir
8882 . ./setprefixvar
8883
8884 case "$man1dir" in
8885 '')     man1dir=' '
8886         installman1dir='';;
8887 esac
8888
8889 : What suffix to use on installed man pages
8890
8891 case "$man1dir" in
8892 ' ')
8893         man1ext='0'
8894         ;;
8895 *)
8896         rp="What suffix should be used for the main $spackage man pages?"
8897         case "$man1ext" in
8898         '')     case "$man1dir" in
8899                 *1)  dflt=1 ;;
8900                 *1p) dflt=1p ;;
8901                 *1pm) dflt=1pm ;;
8902                 *l) dflt=l;;
8903                 *n) dflt=n;;
8904                 *o) dflt=o;;
8905                 *p) dflt=p;;
8906                 *C) dflt=C;;
8907                 *L) dflt=L;;
8908                 *L1) dflt=L1;;
8909                 *) dflt=1;;
8910                 esac
8911                 ;;
8912         *)      dflt="$man1ext";;
8913         esac
8914         . ./myread
8915         man1ext="$ans"
8916         ;;
8917 esac
8918
8919 : see if we can have long filenames
8920 echo " "
8921 first=123456789abcdef
8922 $rm -f $first
8923 if (echo hi >$first) 2>/dev/null; then
8924         if $test -f 123456789abcde; then
8925                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8926                 val="$undef"
8927         else
8928                 echo 'You can have filenames longer than 14 characters.'>&4
8929                 val="$define"
8930         fi
8931 else
8932         $cat <<'EOM'
8933 You can't have filenames longer than 14 chars.
8934 You can't even think about them!
8935 EOM
8936         val="$undef"
8937 fi
8938 set d_flexfnam
8939 eval $setvar
8940 $rm -rf 123456789abcde*
8941
8942 : determine where library module manual pages go
8943 set man3dir man3dir none
8944 eval $prefixit
8945 $cat <<EOM
8946
8947 $spackage has manual pages for many of the library modules.
8948 EOM
8949
8950 case "$nroff" in
8951 nroff)
8952         $cat <<'EOM'
8953 However, you don't have nroff, so they're probably useless to you.
8954 EOM
8955         case "$man3dir" in
8956         '') man3dir="none";;
8957         esac;;
8958 esac
8959
8960 case "$d_flexfnam" in
8961 undef)
8962         $cat <<'EOM'
8963 However, your system can't handle the long file names like File::Basename.3.
8964 EOM
8965         case "$man3dir" in
8966         '') man3dir="none";;
8967         esac;;
8968 esac
8969
8970 echo "If you don't want the manual sources installed, answer 'none'."
8971 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8972 case "$man3dir" in
8973 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8974         if $test -d "$privlib/man/man3"; then
8975                 cat <<EOM >&4
8976
8977 WARNING:  Previous versions of perl installed man3 pages into
8978 $privlib/man/man3.  This version will suggest a
8979 new default of $dflt.
8980 EOM
8981                 tdflt=$dflt
8982                 dflt='n'
8983                 rp='Do you wish to preserve the old behavior?(y/n)'
8984                 . ./myread
8985                 case "$ans" in
8986                 y*) dflt="$privlib/man/man3" ;;
8987                 *)  dflt=$tdflt ;;
8988                 esac
8989     fi
8990         ;;
8991 *)      dflt="$man3dir" ;;
8992 esac
8993 case "$dflt" in
8994 ' ') dflt=none ;;
8995 esac
8996 echo " "
8997 fn=dn+~
8998 rp="Where do the $package library man pages (source) go?"
8999 . ./getfile
9000 prefixvar=man3dir
9001 . ./setprefixvar
9002
9003 case "$man3dir" in
9004 '')     man3dir=' '
9005         installman3dir='';;
9006 esac
9007
9008 : What suffix to use on installed man pages
9009 case "$man3dir" in
9010 ' ')
9011         man3ext='0'
9012         ;;
9013 *)
9014         rp="What suffix should be used for the $package library man pages?"
9015         case "$man3ext" in
9016         '')     case "$man3dir" in
9017                 *3)  dflt=3 ;;
9018                 *3p) dflt=3p ;;
9019                 *3pm) dflt=3pm ;;
9020                 *l) dflt=l;;
9021                 *n) dflt=n;;
9022                 *o) dflt=o;;
9023                 *p) dflt=p;;
9024                 *C) dflt=C;;
9025                 *L) dflt=L;;
9026                 *L3) dflt=L3;;
9027                 *) dflt=3;;
9028                 esac
9029                 ;;
9030         *)      dflt="$man3ext";;
9031         esac
9032         . ./myread
9033         man3ext="$ans"
9034         ;;
9035 esac
9036
9037 : see if we have to deal with yellow pages, now NIS.
9038 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9039         case "$hostcat" in
9040         nidump*) ;;
9041         *)
9042                 case "$hostcat" in
9043                 *ypcat*) dflt=y;;
9044                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9045                                 dflt=y
9046                         else
9047                                 dflt=n
9048                         fi;;
9049                 *) dflt=n;;
9050                 esac
9051                 echo " "
9052                 rp='Are you getting the hosts file via yellow pages?'
9053                 . ./myread
9054                 case "$ans" in
9055                 y*) hostcat='ypcat hosts';;
9056                 *) hostcat='cat /etc/hosts';;
9057                 esac
9058                 ;;
9059         esac
9060 fi
9061 case "$hostcat" in
9062 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9063 esac
9064 case "$groupcat" in
9065 '') test -f /etc/group && groupcat='cat /etc/group';;
9066 esac
9067 case "$passcat" in
9068 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9069 esac
9070
9071 : now get the host name
9072 echo " "
9073 echo "Figuring out host name..." >&4
9074 case "$myhostname" in
9075 '') cont=true
9076         echo 'Maybe "hostname" will work...'
9077         if tans=`sh -c hostname 2>&1` ; then
9078                 myhostname=$tans
9079                 phostname=hostname
9080                 cont=''
9081         fi
9082         ;;
9083 *) cont='';;
9084 esac
9085 if $test "$cont"; then
9086         if ./xenix; then
9087                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9088                 if tans=`cat /etc/systemid 2>&1` ; then
9089                         myhostname=$tans
9090                         phostname='cat /etc/systemid'
9091                         echo "Whadyaknow.  Xenix always was a bit strange..."
9092                         cont=''
9093                 fi
9094         elif $test -r /etc/systemid; then
9095                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9096         fi
9097 fi
9098 if $test "$cont"; then
9099         echo 'No, maybe "uuname -l" will work...'
9100         if tans=`sh -c 'uuname -l' 2>&1` ; then
9101                 myhostname=$tans
9102                 phostname='uuname -l'
9103         else
9104                 echo 'Strange.  Maybe "uname -n" will work...'
9105                 if tans=`sh -c 'uname -n' 2>&1` ; then
9106                         myhostname=$tans
9107                         phostname='uname -n'
9108                 else
9109                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9110                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9111                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9112                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9113                         else
9114                                 case "$myhostname" in
9115                                 '') echo "Does this machine have an identity crisis or something?"
9116                                         phostname='';;
9117                                 *)
9118                                         echo "Well, you said $myhostname before..."
9119                                         phostname='echo $myhostname';;
9120                                 esac
9121                         fi
9122                 fi
9123         fi
9124 fi
9125 case "$myhostname" in
9126 '') myhostname=noname ;;
9127 esac
9128 : you do not want to know about this
9129 set $myhostname
9130 myhostname=$1
9131
9132 : verify guess
9133 if $test "$myhostname" ; then
9134         dflt=y
9135         rp='Your host name appears to be "'$myhostname'".'" Right?"
9136         . ./myread
9137         case "$ans" in
9138         y*) ;;
9139         *) myhostname='';;
9140         esac
9141 fi
9142
9143 : bad guess or no guess
9144 while $test "X$myhostname" = X ; do
9145         dflt=''
9146         rp="Please type the (one word) name of your host:"
9147         . ./myread
9148         myhostname="$ans"
9149 done
9150
9151 : translate upper to lower if necessary
9152 case "$myhostname" in
9153 *[A-Z]*)
9154         echo "(Normalizing case in your host name)"
9155         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9156         ;;
9157 esac
9158
9159 case "$myhostname" in
9160 *.*)
9161         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9162         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9163         echo "(Trimming domain name from host name--host name is now $myhostname)"
9164         ;;
9165 *) case "$mydomain" in
9166         '')
9167                 {
9168                         test "X$hostcat" = "Xypcat hosts" &&
9169                         ypmatch "$myhostname" hosts 2>/dev/null |\
9170                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9171                         $test -s hosts
9172                 } || {
9173                         test "X$hostcat" != "X" &&
9174                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9175                                         /[       ]$myhostname[  . ]/p" > hosts
9176                 }
9177                 tmp_re="[       . ]"
9178                 if $test -f hosts; then
9179                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9180                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9181                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9182                                 hosts | $sort | $uniq | \
9183                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9184                         case `$echo X$dflt` in
9185                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9186                                 dflt=.
9187                                 ;;
9188                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9189                                 ;;
9190                         esac
9191                 else
9192                         echo "(I cannot locate a hosts database anywhere)"
9193                         dflt=.
9194                 fi
9195                 case "$dflt" in
9196                 .)
9197                         tans=`./loc resolv.conf X /etc /usr/etc`
9198                         if $test -f "$tans"; then
9199                                 echo "(Attempting domain name extraction from $tans)"
9200                                 dflt=.`$sed -n -e 's/   / /g' \
9201                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9202                                   -e 1q 2>/dev/null`
9203                                 case "$dflt" in
9204                                 .) dflt=.`$sed -n -e 's/        / /g' \
9205                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9206                                      -e 1q 2>/dev/null`
9207                                         ;;
9208                                 esac
9209                         fi
9210                         ;;
9211                 esac
9212                 case "$dflt" in
9213                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9214                         dflt=.`sh -c domainname 2>/dev/null`
9215                         case "$dflt" in
9216                         '') dflt='.';;
9217                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9218                         esac
9219                         ;;
9220                 esac
9221                 case "$dflt$osname" in
9222                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9223                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9224                         ;;
9225                 esac
9226                 case "$dflt" in
9227                 .) echo "(Lost all hope -- silly guess then)"
9228                         dflt='.nonet'
9229                         ;;
9230                 esac
9231                 $rm -f hosts
9232                 ;;
9233         *) dflt="$mydomain";;
9234         esac;;
9235 esac
9236 echo " "
9237 rp="What is your domain name?"
9238 . ./myread
9239 tans="$ans"
9240 case "$ans" in
9241 '') ;;
9242 .*) ;;
9243 *) tans=".$tans";;
9244 esac
9245 mydomain="$tans"
9246
9247 : translate upper to lower if necessary
9248 case "$mydomain" in
9249 *[A-Z]*)
9250         echo "(Normalizing case in your domain name)"
9251         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9252         ;;
9253 esac
9254
9255 : a little sanity check here
9256 case "$phostname" in
9257 '') ;;
9258 *)
9259         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9260         $myhostname$mydomain|$myhostname) ;;
9261         *)
9262                 case "$phostname" in
9263                 sed*)
9264                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9265                         ;;
9266                 *)
9267                         echo "(That doesn't agree with your $phostname command, by the way.)"
9268                         ;;
9269                 esac
9270         ;;
9271         esac
9272         ;;
9273 esac
9274
9275 : determine the e-mail address of the user who is running us
9276 $cat <<EOM
9277
9278 I need to get your e-mail address in Internet format if possible, i.e.
9279 something like user@host.domain. Please answer accurately since I have
9280 no easy means to double check it. The default value provided below
9281 is most probably close to reality but may not be valid from outside
9282 your organization...
9283
9284 EOM
9285 cont=x
9286 while test "$cont"; do
9287         case "$MAILDOMAIN" in
9288         '')
9289                 if $test -s /etc/mailname; then
9290                         maildomain=`$cat /etc/mailname`
9291                 else
9292                         maildomain="$myhostname$mydomain"
9293                 fi
9294                 ;;
9295         *)  maildomain="$MAILDOMAIN";;
9296         esac
9297         case "$cf_email" in
9298         '') dflt="$cf_by@$maildomain";;
9299         *)  dflt="$cf_email";;
9300         esac
9301         rp='What is your e-mail address?'
9302         . ./myread
9303         cf_email="$ans"
9304         case "$cf_email" in
9305         *@*.*) cont='' ;;
9306         *)
9307                 rp='Address does not look like an Internet one.  Use it anyway?'
9308                 case "$fastread" in
9309                 yes) dflt=y ;;
9310                 *) dflt=n ;;
9311                 esac
9312                 . ./myread
9313                 case "$ans" in
9314                 y*) cont='' ;;
9315                 *) echo " " ;;
9316                 esac
9317                 ;;
9318         esac
9319 done
9320
9321 : Ask e-mail of administrator
9322 $cat <<EOM
9323
9324 If you or somebody else will be maintaining perl at your site, please
9325 fill in the correct e-mail address here so that they may be contacted
9326 if necessary. Currently, the "perlbug" program included with perl
9327 will send mail to this address in addition to perlbug@perl.org. You may
9328 enter "none" for no administrator.
9329
9330 EOM
9331 case "$perladmin" in
9332 '') dflt="$cf_email";;
9333 *) dflt="$perladmin";;
9334 esac
9335 rp='Perl administrator e-mail address'
9336 . ./myread
9337 perladmin="$ans"
9338
9339 : determine whether to only install version-specific parts.
9340 echo " "
9341 $cat <<EOM
9342 Do you want to install only the version-specific parts of the perl
9343 distribution?  Usually you do *not* want to do this.
9344 EOM
9345 case "$versiononly" in
9346 "$define"|[Yy]*|true) dflt='y' ;;
9347 *) dflt='n';
9348 esac
9349 rp="Do you want to install only the version-specific parts of perl?"
9350 . ./myread
9351 case "$ans" in
9352 [yY]*)  val="$define";;
9353 *)      val="$undef" ;;
9354 esac
9355 set versiononly
9356 eval $setvar
9357
9358 case "$versiononly" in
9359 "$define") inc_version_list=''
9360            inc_version_list_init=0
9361            ;;
9362 esac
9363
9364 : figure out how to guarantee perl startup
9365 : XXX Note that this currently takes advantage of the bug that binexp ignores
9366 :     the Configure -Dinstallprefix setting, which in turn means that under
9367 :     relocatable @INC, initialinstalllocation is what binexp started as.
9368 case "$startperl" in
9369 '')
9370         case "$sharpbang" in
9371         *!)
9372                 $cat <<EOH
9373
9374 I can use the #! construct to start perl on your system. This will
9375 make startup of perl scripts faster, but may cause problems if you
9376 want to share those scripts and perl is not in a standard place
9377 ($initialinstalllocation/perl) on all your platforms. The alternative
9378 is to force a shell by starting the script with a single ':' character.
9379
9380 EOH
9381                 case "$versiononly" in
9382                 "$define")      dflt="$initialinstalllocation/perl$version";;
9383                 *)              dflt="$initialinstalllocation/perl";;
9384                 esac
9385                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9386                 . ./myread
9387                 case "$ans" in
9388                 none)   startperl=": # use perl";;
9389                 *)      startperl="#!$ans"
9390                         if $test 30 -lt `echo "$ans" | wc -c`; then
9391                                 $cat >&4 <<EOM
9392
9393 WARNING:  Some systems limit the #! command to 32 characters.
9394 If you experience difficulty running Perl scripts with #!, try
9395 installing Perl in a directory with a shorter pathname.
9396
9397 EOM
9398                         fi ;;
9399                 esac
9400                 ;;
9401         *) startperl=": # use perl"
9402                 ;;
9403         esac
9404         ;;
9405 esac
9406 echo "I'll use $startperl to start perl scripts."
9407
9408 : figure best path for perl in scripts
9409 case "$perlpath" in
9410 '')
9411         case "$versiononly" in
9412         "$define")      perlpath="$initialinstalllocation/perl$version";;
9413         *)              perlpath="$initialinstalllocation/perl";;
9414         esac
9415         case "$startperl" in
9416         *!*) ;;
9417         *)
9418                 $cat <<EOH
9419
9420 I will use the "eval 'exec'" idiom to start Perl on your system.
9421 I can use the full path of your Perl binary for this purpose, but
9422 doing so may cause problems if you want to share those scripts and
9423 Perl is not always in a standard place ($initialinstalllocation/perl).
9424
9425 EOH
9426                 dflt="$initialinstalllocation/perl"
9427                 rp="What path shall I use in \"eval 'exec'\"?"
9428                 . ./myread
9429                 perlpath="$ans"
9430                 ;;
9431         esac
9432         ;;
9433 esac
9434 case "$startperl" in
9435 *!*)    ;;
9436 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9437 esac
9438
9439 : determine where public executable scripts go
9440 set scriptdir scriptdir
9441 eval $prefixit
9442 case "$scriptdir" in
9443 '')
9444         dflt="$bin"
9445         : guess some guesses
9446         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9447         $test -d /usr/share/bin     && dflt=/usr/share/bin
9448         $test -d /usr/local/script  && dflt=/usr/local/script
9449         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9450         $test -d $prefixexp/script  && dflt=$prefixexp/script
9451         set dflt
9452         eval $prefixup
9453         ;;
9454 *)  dflt="$scriptdir"
9455         ;;
9456 esac
9457 $cat <<EOM
9458
9459 Some installations have a separate directory just for executable scripts so
9460 that they can mount it across multiple architectures but keep the scripts in
9461 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9462 Or you might just lump your scripts in with all your other executables.
9463
9464 EOM
9465 fn=d~
9466 rp='Where do you keep publicly executable scripts?'
9467 . ./getfile
9468 if $test "X$ansexp" != "X$scriptdirexp"; then
9469         installscript=''
9470 fi
9471 installscriptdir=''
9472 prefixvar=scriptdir
9473 . ./setprefixvar
9474 : A little fix up for an irregularly named variable.
9475 installscript="$installscriptdir"
9476
9477 : determine where add-on public executables go
9478 case "$sitebin" in
9479 '')     dflt=$siteprefix/bin ;;
9480 *)      dflt=$sitebin ;;
9481 esac
9482 fn=d~
9483 rp='Pathname where the add-on public executables should be installed?'
9484 . ./getfile
9485 prefixvar=sitebin
9486 . ./setprefixvar
9487
9488 : determine where add-on html pages go
9489 : There is no standard location, so try to copy the previously-selected
9490 : directory structure for the core html pages.
9491 case "$sitehtml1dir" in
9492 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9493 *)     dflt=$sitehtml1dir ;;
9494 esac
9495 case "$dflt" in
9496 ''|' ') dflt=none ;;
9497 esac
9498 fn=dn+~
9499 rp='Pathname where the site-specific html pages should be installed?'
9500 . ./getfile
9501 prefixvar=sitehtml1dir
9502 . ./setprefixvar
9503
9504 : determine where add-on library html pages go
9505 : There is no standard location, so try to copy the previously-selected
9506 : directory structure for the core html pages.
9507 case "$sitehtml3dir" in
9508 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9509 *)     dflt=$sitehtml3dir ;;
9510 esac
9511 case "$dflt" in
9512 ''|' ') dflt=none ;;
9513 esac
9514 fn=dn+~
9515 rp='Pathname where the site-specific library html pages should be installed?'
9516 . ./getfile
9517 prefixvar=sitehtml3dir
9518 . ./setprefixvar
9519
9520 : determine where add-on manual pages go
9521 case "$siteman1dir" in
9522 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9523 *)      dflt=$siteman1dir ;;
9524 esac
9525 case "$dflt" in
9526 ''|' ') dflt=none ;;
9527 esac
9528 fn=dn+~
9529 rp='Pathname where the site-specific manual pages should be installed?'
9530 . ./getfile
9531 prefixvar=siteman1dir
9532 . ./setprefixvar
9533
9534 : determine where add-on library man pages go
9535 case "$siteman3dir" in
9536 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9537 *)      dflt=$siteman3dir ;;
9538 esac
9539 case "$dflt" in
9540 ''|' ') dflt=none ;;
9541 esac
9542 fn=dn+~
9543 rp='Pathname where the site-specific library manual pages should be installed?'
9544 . ./getfile
9545 prefixvar=siteman3dir
9546 . ./setprefixvar
9547
9548 : determine where add-on public executable scripts go
9549 case "$sitescript" in
9550 '')     dflt=$siteprefix/script
9551         $test -d $dflt || dflt=$sitebin ;;
9552 *)  dflt="$sitescript" ;;
9553 esac
9554 fn=d~+
9555 rp='Pathname where add-on public executable scripts should be installed?'
9556 . ./getfile
9557 prefixvar=sitescript
9558 . ./setprefixvar
9559
9560 : see if backtrace exists
9561 set backtrace d_backtrace
9562 eval $inlibc
9563
9564 : add flags if using c backtrace
9565 case "$usecbacktrace" in
9566   "") usecbacktrace=$undef ;;
9567   [yY]*|true|$define)
9568     case "$d_backtrace" in
9569       [yY]*|true|$define)
9570         case " $ccflags " in
9571           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9572           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9573           esac
9574         ;;
9575       *)
9576         echo "This system does not support backtrace" >&4
9577         usecbacktrace=$undef
9578         ;;
9579       esac
9580     ;;
9581   esac
9582
9583 : Check if faststdio is requested and available
9584 case "$usefaststdio" in
9585 $define|true|[yY]*|'')
9586         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9587         case "$xversion" in
9588         [68])   dflt='y' ;;
9589         *)      dflt='n' ;;
9590         esac
9591         ;;
9592 *) dflt='n';;
9593 esac
9594 cat <<EOM
9595
9596 Perl can be built to use 'fast stdio', which means using the stdio
9597 library but also directly manipulating the stdio buffers to enable
9598 faster I/O.  Using stdio is better for backward compatibility (especially
9599 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9600 interface has been preferred instead of stdio.
9601
9602 If this doesn't make any sense to you, just accept the default '$dflt'.
9603 EOM
9604 rp='Use the "fast stdio" if available?'
9605 . ./myread
9606 case "$ans" in
9607 y|Y)    val="$define" ;;
9608 *)      val="$undef" ;;
9609 esac
9610 set usefaststdio
9611 eval $setvar
9612
9613
9614 : define an is-a-typedef? function
9615 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9616 case "$inclist" in
9617 "") inclist="sys/types.h";;
9618 esac;
9619 eval "varval=\$$var";
9620 case "$varval" in
9621 "")
9622         $rm -f temp.c;
9623         for inc in $inclist; do
9624                 echo "#include <$inc>" >>temp.c;
9625         done;
9626         echo "#ifdef $type" >> temp.c;
9627         echo "printf(\"We have $type\");" >> temp.c;
9628         echo "#endif" >> temp.c;
9629         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9630         if $contains $type temp.E >/dev/null 2>&1; then
9631                 eval "$var=\$type";
9632         else
9633                 eval "$var=\$def";
9634         fi;
9635         $rm -f temp.?;;
9636 *) eval "$var=\$varval";;
9637 esac'
9638
9639 : define an is-a-typedef? function that prompts if the type is not available.
9640 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9641 case "$inclist" in
9642 "") inclist="sys/types.h";;
9643 esac;
9644 eval "varval=\$$var";
9645 case "$varval" in
9646 "")
9647         $rm -f temp.c;
9648         for inc in $inclist; do
9649                 echo "#include <$inc>" >>temp.c;
9650         done;
9651         echo "#ifdef $type" >> temp.c;
9652         echo "printf(\"We have $type\");" >> temp.c;
9653         echo "#endif" >> temp.c;
9654         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9655         echo " " ;
9656         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9657         if $contains $type temp.E >/dev/null 2>&1; then
9658                 echo "$type found." >&4;
9659                 eval "$var=\$type";
9660         else
9661                 echo "$type NOT found." >&4;
9662                 dflt="$def";
9663                 . ./myread ;
9664                 eval "$var=\$ans";
9665         fi;
9666         $rm -f temp.?;;
9667 *) eval "$var=\$varval";;
9668 esac'
9669
9670 : see what type lseek is declared as in the kernel
9671 rp="What is the type used for lseek's offset on this system?"
9672 set off_t lseektype long stdio.h sys/types.h
9673 eval $typedef_ask
9674
9675 echo " "
9676 echo "Checking to see how big your file offsets are..." >&4
9677 $cat >try.c <<EOCP
9678 #include <sys/types.h>
9679 #include <stdio.h>
9680 int main()
9681 {
9682     printf("%d\n", (int)sizeof($lseektype));
9683     return(0);
9684 }
9685 EOCP
9686 set try
9687 if eval $compile_ok; then
9688         lseeksize=`$run ./try`
9689         echo "Your file offsets are $lseeksize bytes long."
9690 else
9691         dflt=$longsize
9692         echo " "
9693         echo "(I can't seem to compile the test program.  Guessing...)"
9694         rp="What is the size of your file offsets (in bytes)?"
9695         . ./myread
9696         lseeksize="$ans"
9697 fi
9698 $rm_try
9699
9700 : see what type file positions are declared as in the library
9701 rp="What is the type for file position used by fsetpos()?"
9702 set fpos_t fpostype long stdio.h sys/types.h
9703 eval $typedef_ask
9704
9705 : Check size for Fpos_t
9706 echo " "
9707 case "$fpostype" in
9708 *_t) zzz="$fpostype"    ;;
9709 *)   zzz="fpos_t"       ;;
9710 esac
9711 echo "Checking the size of $zzz..." >&4
9712 cat > try.c <<EOCP
9713 #include <sys/types.h>
9714 #include <stdio.h>
9715 #$i_stdlib I_STDLIB
9716 #ifdef I_STDLIB
9717 #include <stdlib.h>
9718 #endif
9719 int main() {
9720     printf("%d\n", (int)sizeof($fpostype));
9721     exit(0);
9722 }
9723 EOCP
9724 set try
9725 if eval $compile_ok; then
9726         yyy=`$run ./try`
9727         case "$yyy" in
9728         '')     fpossize=4
9729                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9730                 ;;
9731         *)      fpossize=$yyy
9732                 echo "Your $zzz is $fpossize bytes long."
9733                 ;;
9734         esac
9735 else
9736         dflt="$longsize"
9737         echo " " >&4
9738         echo "(I can't compile the test program.  Guessing...)" >&4
9739         rp="What is the size of your file positions (in bytes)?"
9740         . ./myread
9741         fpossize="$ans"
9742 fi
9743
9744 : Check for large file support
9745 # Backward compatibility (uselfs is deprecated).
9746 case "$uselfs" in
9747 "$define"|true|[yY]*)
9748         cat <<EOM >&4
9749
9750 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9751 EOM
9752         uselargefiles="$define"
9753         ;;
9754 esac
9755
9756 case "$lseeksize:$fpossize" in
9757 8:8) cat <<EOM
9758
9759 You can have files larger than 2 gigabytes.
9760 EOM
9761    val="$define" ;;
9762 *)    case "$uselargefiles" in
9763    "$undef"|false|[nN]*) dflt='n' ;;
9764    *)   dflt='y' ;;
9765    esac
9766    cat <<EOM
9767
9768 Perl can be built to understand large files (files larger than 2 gigabytes)
9769 on some systems.  To do so, Configure can be run with -Duselargefiles.
9770
9771 If this doesn't make any sense to you, just accept the default '$dflt'.
9772 EOM
9773    rp='Try to understand large files, if available?'
9774    . ./myread
9775    case "$ans" in
9776    y|Y)         val="$define" ;;
9777    *)           val="$undef"  ;;
9778    esac
9779    ;;
9780 esac
9781 set uselargefiles
9782 eval $setvar
9783 : Look for a hint-file generated 'call-back-unit'.  If the
9784 : user has specified that a large files perl is to be built,
9785 : we may need to set or change some other defaults.
9786 if $test -f uselargefiles.cbu; then
9787         echo "Your platform has some specific hints regarding large file builds, using them..."
9788         . ./uselargefiles.cbu
9789 fi
9790 case "$uselargefiles" in
9791 "$define")
9792         if $test -f uselargefiles.cbu; then
9793                 echo " "
9794                 echo "Rechecking to see how big your file offsets are..." >&4
9795                 $cat >try.c <<EOCP
9796 #include <sys/types.h>
9797 #include <stdio.h>
9798 int main()
9799 {
9800     printf("%d\n", (int)sizeof($lseektype));
9801     return(0);
9802 }
9803 EOCP
9804                 set try
9805                 if eval $compile_ok; then
9806                         lseeksize=`$run ./try`
9807                         $echo "Your file offsets are now $lseeksize bytes long."
9808                 else
9809                         dflt="$lseeksize"
9810                         echo " "
9811                         echo "(I can't seem to compile the test program.  Guessing...)"
9812                         rp="What is the size of your file offsets (in bytes)?"
9813                         . ./myread
9814                         lseeksize="$ans"
9815                 fi
9816                 case "$fpostype" in
9817                 *_t) zzz="$fpostype"    ;;
9818                 *)   zzz="fpos_t"       ;;
9819                 esac
9820                 $echo $n "Rechecking the size of $zzz...$c" >&4
9821                 $cat > try.c <<EOCP
9822 #include <sys/types.h>
9823 #include <stdio.h>
9824 #$i_stdlib I_STDLIB
9825 #ifdef I_STDLIB
9826 #include <stdlib.h>
9827 #endif
9828 int main() {
9829     printf("%d\n", (int)sizeof($fpostype));
9830     return(0);
9831 }
9832 EOCP
9833                 set try
9834                 if eval $compile_ok; then
9835                         yyy=`$run ./try`
9836                         dflt="$lseeksize"
9837                         case "$yyy" in
9838                         '')     echo " "
9839                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9840                                 ;;
9841                         *)      fpossize=$yyy
9842                                 echo " $fpossize bytes." >&4
9843                                 ;;
9844                         esac
9845                 else
9846                         dflt="$fpossize"
9847                         echo " "
9848                         echo "(I can't compile the test program.  Guessing...)" >&4
9849                         rp="What is the size of your file positions (in bytes)?"
9850                         . ./myread
9851                         fpossize="$ans"
9852                 fi
9853                 $rm_try
9854         fi
9855         ;;
9856 esac
9857
9858 : Check if we want perlio
9859 useperlio="$define"
9860
9861 : Set the vendorbin variables
9862 case "$vendorprefix" in
9863 '')     d_vendorbin="$undef"
9864         vendorbin=''
9865         vendorbinexp=''
9866         ;;
9867 *)      d_vendorbin="$define"
9868         : determine where vendor-supplied executables go.
9869         case "$vendorbin" in
9870         '') dflt=$vendorprefix/bin ;;
9871         *)      dflt="$vendorbin" ;;
9872         esac
9873         fn=d~+
9874         rp='Pathname for the vendor-supplied executables directory?'
9875         . ./getfile
9876         vendorbin="$ans"
9877         vendorbinexp="$ansexp"
9878         ;;
9879 esac
9880 prefixvar=vendorbin
9881 . ./installprefix
9882
9883 : Set the vendorhtml1dir variables
9884 case "$vendorprefix" in
9885 '')     vendorhtml1dir=''
9886         vendorhtml1direxp=''
9887         ;;
9888 *)      : determine where vendor-supplied html pages go.
9889         : There is no standard location, so try to copy the previously-selected
9890         : directory structure for the core html pages.
9891         : XXX Better default suggestions would be welcome.
9892         case "$vendorhtml1dir" in
9893         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9894         *)      dflt=$vendorhtml1dir ;;
9895         esac
9896         case "$dflt" in
9897         ''|' ') dflt=none ;;
9898         esac
9899         fn=dn+~
9900         rp='Pathname for the vendor-supplied html pages?'
9901         . ./getfile
9902         vendorhtml1dir="$ans"
9903         vendorhtml1direxp="$ansexp"
9904         ;;
9905 esac
9906 : Use ' ' for none so value is preserved next time through Configure
9907 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9908 prefixvar=vendorhtml1dir
9909 . ./installprefix
9910
9911 : Set the vendorhtml3dir variables
9912 case "$vendorprefix" in
9913 '')     vendorhtml3dir=''
9914         vendorhtml3direxp=''
9915         ;;
9916 *)      : determine where vendor-supplied module html pages go.
9917         : There is no standard location, so try to copy the previously-selected
9918         : directory structure for the core html pages.
9919         : XXX Better default suggestions would be welcome.
9920         case "$vendorhtml3dir" in
9921         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9922         *)      dflt=$vendorhtml3dir ;;
9923         esac
9924         case "$dflt" in
9925         ''|' ') dflt=none ;;
9926         esac
9927         fn=dn+~
9928         rp='Pathname for the vendor-supplied html pages?'
9929         . ./getfile
9930         vendorhtml3dir="$ans"
9931         vendorhtml3direxp="$ansexp"
9932         ;;
9933 esac
9934 : Use ' ' for none so value is preserved next time through Configure
9935 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9936 prefixvar=vendorhtml3dir
9937 . ./installprefix
9938
9939 : Set the vendorman1dir variables
9940 case "$vendorprefix" in
9941 '')     vendorman1dir=''
9942         vendorman1direxp=''
9943         ;;
9944 *)      : determine where vendor-supplied manual pages go.
9945         case "$vendorman1dir" in
9946         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9947         *)      dflt=$vendorman1dir ;;
9948         esac
9949         case "$dflt" in
9950         ''|' ') dflt=none ;;
9951         esac
9952         fn=nd~+
9953         rp='Pathname for the vendor-supplied manual section 1 pages?'
9954         . ./getfile
9955         vendorman1dir="$ans"
9956         vendorman1direxp="$ansexp"
9957         ;;
9958 esac
9959 : Use ' ' for none so value is preserved next time through Configure
9960 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9961 prefixvar=vendorman1dir
9962 . ./installprefix
9963
9964 : Set the vendorman3dir variables
9965 case "$vendorprefix" in
9966 '')     vendorman3dir=''
9967         vendorman3direxp=''
9968         ;;
9969 *)      : determine where vendor-supplied module manual pages go.
9970         case "$vendorman3dir" in
9971         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9972         *)      dflt=$vendorman3dir ;;
9973         esac
9974         case "$dflt" in
9975         ''|' ') dflt=none ;;
9976         esac
9977         fn=nd~+
9978         rp='Pathname for the vendor-supplied manual section 3 pages?'
9979         . ./getfile
9980         vendorman3dir="$ans"
9981         vendorman3direxp="$ansexp"
9982         ;;
9983 esac
9984 : Use ' ' for none so value is preserved next time through Configure
9985 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9986 prefixvar=vendorman3dir
9987 . ./installprefix
9988
9989 : Set the vendorscript variables
9990 case "$vendorprefix" in
9991 '')     d_vendorscript="$undef"
9992         vendorscript=''
9993         vendorscriptexp=''
9994         ;;
9995 *)      d_vendorscript="$define"
9996         : determine where vendor-supplied scripts go.
9997         case "$vendorscript" in
9998         '')     dflt=$vendorprefix/script
9999                 $test -d $dflt || dflt=$vendorbin ;;
10000         *)  dflt="$vendorscript" ;;
10001         esac
10002         $cat <<EOM
10003
10004 The installation process will create a directory for
10005 vendor-supplied scripts.
10006
10007 EOM
10008         fn=d~+
10009         rp='Pathname for the vendor-supplied scripts directory?'
10010         . ./getfile
10011         vendorscript="$ans"
10012         vendorscriptexp="$ansexp"
10013         ;;
10014 esac
10015 prefixvar=vendorscript
10016 . ./installprefix
10017
10018 : script used to emit important warnings
10019 cat >warn <<EOS
10020 $startsh
10021 if test \$# -gt 0; then
10022         echo "\$@" >msg
10023 else
10024         cat >msg
10025 fi
10026 echo "*** WARNING:" >&4
10027 sed -e 's/^/*** /' <msg >&4
10028 echo "*** " >&4
10029 cat msg >>config.msg
10030 echo " " >>config.msg
10031 rm -f msg
10032 EOS
10033 chmod +x warn
10034 $eunicefix warn
10035
10036 : see which of string.h or strings.h is needed
10037 echo " "
10038 strings=`./findhdr string.h`
10039 if $test "$strings" && $test -r "$strings"; then
10040         echo "Using <string.h> instead of <strings.h>." >&4
10041         val="$define"
10042 else
10043         val="$undef"
10044         strings=`./findhdr strings.h`
10045         if $test "$strings" && $test -r "$strings"; then
10046                 echo "Using <strings.h> instead of <string.h>." >&4
10047         else
10048                 ./warn "No string header found -- You'll surely have problems."
10049         fi
10050 fi
10051 set i_string
10052 eval $setvar
10053 case "$i_string" in
10054 "$undef") strings=`./findhdr strings.h`;;
10055 *)        strings=`./findhdr string.h`;;
10056 esac
10057
10058 : see if qgcvt exists
10059 set qgcvt d_qgcvt
10060 eval $inlibc
10061
10062 : Check what kind of doubles your system has
10063 $echo "Checking the kind of doubles you have..." >&4
10064 $cat >try.c <<EOP
10065 #$i_stdlib I_STDLIB
10066 #define DOUBLESIZE $doublesize
10067 #ifdef I_STDLIB
10068 #include <stdlib.h>
10069 #endif
10070 #include <stdio.h>
10071 static const double d = -0.1;
10072 int main() {
10073   unsigned const char* b = (unsigned const char*)(&d);
10074 #if DOUBLESIZE == 4
10075   if (b[0] == 0xCD && b[3] == 0xBD) {
10076     /* IEEE 754 32-bit little-endian */
10077     printf("1\n");
10078     exit(0);
10079   }
10080   if (b[0] == 0xBD && b[3] == 0xCD) {
10081     /* IEEE 754 32-bit big-endian */
10082     printf("2\n");
10083     exit(0);
10084   }
10085 #endif
10086 #if DOUBLESIZE == 8
10087   if (b[0] == 0x9A && b[7] == 0xBF) {
10088     /* IEEE 754 64-bit little-endian */
10089     printf("3\n");
10090     exit(0);
10091   }
10092   if (b[0] == 0xBF && b[7] == 0x9A) {
10093     /* IEEE 754 64-bit big-endian */
10094     printf("4\n");
10095     exit(0);
10096   }
10097   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10098    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10099     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10100     * 99 99 b9 bf 9a 99 99 99 */
10101     printf("7\n");
10102     exit(0);
10103   }
10104   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10105    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10106     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10107     * 99 99 99 9a bf b9 99 99 */
10108     printf("8\n");
10109     exit(0);
10110   }
10111 #endif
10112 #if DOUBLESIZE == 16
10113   if (b[0] == 0x9A && b[15] == 0xBF) {
10114     /* IEEE 754 128-bit little-endian */
10115     printf("5\n");
10116     exit(0);
10117   }
10118   if (b[0] == 0xBF && b[15] == 0x9A) {
10119     /* IEEE 754 128-bit big-endian */
10120     printf("6\n");
10121     exit(0);
10122   }
10123 #endif
10124   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
10125    * Whether those environments can still build Perl is debatable. */
10126   printf("-1\n"); /* unknown */
10127   exit(0);
10128 }
10129 EOP
10130 set try
10131 if eval $compile; then
10132     doublekind=`$run ./try`
10133 else
10134     doublekind=-1
10135 fi
10136 case "$doublekind" in
10137 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10138 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10139 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10140 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10141 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10142 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10143 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10144 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10145 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
10146 esac
10147 $rm_try
10148
10149 : Check print/scan long double stuff
10150 echo " "
10151
10152 if $test X"$d_longdbl" = X"$define"; then
10153
10154 echo "Checking how to print long doubles..." >&4
10155
10156 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10157         $cat >try.c <<'EOCP'
10158 #include <sys/types.h>
10159 #include <stdio.h>
10160 int main() {
10161   double d = 123.456;
10162   printf("%.3f\n", d);
10163 }
10164 EOCP
10165         set try
10166         if eval $compile; then
10167                 yyy=`$run ./try`
10168                 case "$yyy" in
10169                 123.456)
10170                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10171                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10172                         echo "We will use %f."
10173                         ;;
10174                 esac
10175         fi
10176 fi
10177
10178 if $test X"$sPRIfldbl" = X; then
10179         $cat >try.c <<'EOCP'
10180 #include <sys/types.h>
10181 #include <stdio.h>
10182 int main() {
10183   long double d = 123.456;
10184   printf("%.3Lf\n", d);
10185 }
10186 EOCP
10187         set try
10188         if eval $compile; then
10189                 yyy=`$run ./try`
10190                 case "$yyy" in
10191                 123.456)
10192                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10193                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10194                         echo "We will use %Lf."
10195                         ;;
10196                 esac
10197         fi
10198 fi
10199
10200 if $test X"$sPRIfldbl" = X; then
10201         $cat >try.c <<'EOCP'
10202 #include <sys/types.h>
10203 #include <stdio.h>
10204 int main() {
10205   long double d = 123.456;
10206   printf("%.3llf\n", d);
10207 }
10208 EOCP
10209         set try
10210         if eval $compile; then
10211                 yyy=`$run ./try`
10212                 case "$yyy" in
10213                 123.456)
10214                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10215                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10216                         echo "We will use %llf."
10217                         ;;
10218                 esac
10219         fi
10220 fi
10221
10222 if $test X"$sPRIfldbl" = X; then
10223         $cat >try.c <<'EOCP'
10224 #include <sys/types.h>
10225 #include <stdio.h>
10226 int main() {
10227   long double d = 123.456;
10228   printf("%.3lf\n", d);
10229 }
10230 EOCP
10231         set try
10232         if eval $compile; then
10233                 yyy=`$run ./try`
10234                 case "$yyy" in
10235                 123.456)
10236                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10237                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10238                         echo "We will use %lf."
10239                         ;;
10240                 esac
10241         fi
10242 fi
10243
10244 if $test X"$sPRIfldbl" = X; then
10245         echo "Cannot figure out how to print long doubles." >&4
10246 else
10247         sSCNfldbl=$sPRIfldbl    # expect consistency
10248 fi
10249
10250 $rm_try
10251
10252 fi # d_longdbl
10253
10254 case "$sPRIfldbl" in
10255 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10256         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10257         d_SCNfldbl="$undef";
10258         ;;
10259 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10260         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10261         d_SCNfldbl="$define";
10262         ;;
10263 esac
10264
10265 : Before committing on uselongdouble, see whether that looks sane.
10266 if $test "$uselongdouble" = "$define"; then
10267     message=""
10268     echo " "
10269     echo "Checking if your long double math functions work right..." >&4
10270     $cat > try.c <<EOF
10271 #include <math.h>
10272 #include <stdio.h>
10273 int main() {
10274   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10275 }
10276 EOF
10277     case "$osname:$gccversion" in
10278     aix:)       saveccflags="$ccflags"
10279                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10280     esac
10281     set try
10282     if eval $compile_ok; then
10283       yyy=`$run ./try`
10284     fi
10285     case "$yyy" in
10286     3) echo "Your long double math functions are working correctly." >&4 ;;
10287     *) echo "Your long double math functions are broken, not using long doubles." >&4
10288        uselongdouble=$undef
10289        ;;
10290     esac
10291     $rm_try
10292     case "$osname:$gccversion" in
10293     aix:)       ccflags="$saveccflags" ;; # restore
10294     esac
10295 fi
10296
10297 : Check how to convert floats to strings.
10298
10299 if test "X$d_Gconvert" = X; then
10300
10301 echo " "
10302 echo "Checking for an efficient way to convert floats to strings."
10303 echo " " > try.c
10304 case "$uselongdouble" in
10305 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10306 esac
10307 case "$d_longdbl" in
10308 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10309 esac
10310 case "$d_PRIgldbl" in
10311 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10312 esac
10313 $cat >>try.c <<EOP
10314 #ifdef TRY_gconvert
10315 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10316 char *myname = "gconvert";
10317 #endif
10318 #ifdef TRY_gcvt
10319 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10320 char *myname = "gcvt";
10321 #endif
10322 #ifdef TRY_qgcvt
10323 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10324 char *myname = "qgcvt";
10325 #define DOUBLETYPE long double
10326 #endif
10327 #ifdef TRY_sprintf
10328 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10329 #ifdef HAS_PRIgldbl
10330 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10331 #else
10332 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10333 #endif
10334 #else
10335 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10336 #endif
10337 char *myname = "sprintf";
10338 #endif
10339
10340 #ifndef DOUBLETYPE
10341 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10342 #define DOUBLETYPE long double
10343 #else
10344 #define DOUBLETYPE double
10345 #endif
10346 #endif
10347
10348 #include <stdio.h>
10349
10350 #$i_stdlib I_STDLIB
10351 #ifdef I_STDLIB
10352 #include <stdlib.h>
10353 #endif
10354 #$i_string I_STRING
10355 #ifdef I_STRING
10356 #  include <string.h>
10357 #else
10358 #  include <strings.h>
10359 #endif
10360
10361 int checkit(char *expect, char *got)
10362 {
10363     if (strcmp(expect, got)) {
10364                 printf("%s oddity:  Expected %s, got %s\n",
10365                         myname, expect, got);
10366                 exit(1);
10367         }
10368 }
10369
10370 int main()
10371 {
10372         char buf[64];
10373         buf[63] = '\0';
10374
10375         /* This must be 1st test on (which?) platform */
10376         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10377         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10378         checkit("0.1", buf);
10379
10380         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10381         checkit("0.01", buf);
10382
10383         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10384         checkit("0.001", buf);
10385
10386         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10387         checkit("0.0001", buf);
10388
10389         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10390         if (strlen(buf) > 5)
10391             checkit("9e-005", buf); /* for Microsoft ?? */
10392         else
10393             checkit("9e-05", buf);
10394
10395         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10396         checkit("1", buf);
10397
10398         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10399         checkit("1.1", buf);
10400
10401         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10402         checkit("1.01", buf);
10403
10404         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10405         checkit("1.001", buf);
10406
10407         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10408         checkit("1.0001", buf);
10409
10410         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10411         checkit("1.00001", buf);
10412
10413         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10414         checkit("1.000001", buf);
10415
10416         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10417         checkit("0", buf);
10418
10419         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10420         checkit("-1", buf);
10421
10422         /* Some Linux gcvt's give 1.e+5 here. */
10423         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10424         checkit("100000", buf);
10425
10426         /* Some Linux gcvt's give -1.e+5 here. */
10427         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10428         checkit("-100000", buf);
10429
10430         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10431         checkit("123.456", buf);
10432
10433         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10434         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10435         /* 34 should be enough to scare even long double
10436          * places into using the e notation. */
10437         if (strlen(buf) > 5)
10438             checkit("1e+034", buf); /* for Microsoft */
10439         else
10440             checkit("1e+34", buf);
10441
10442         /* For Perl, if you add additional tests here, also add them to
10443          * t/base/num.t for benefit of platforms not using Configure or
10444          * overriding d_Gconvert */
10445
10446         exit(0);
10447 }
10448 EOP
10449 : first add preferred functions to our list
10450 xxx_list=""
10451 for xxx_convert in $gconvert_preference; do
10452     case $xxx_convert in
10453     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10454     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10455     esac
10456 done
10457 : then add any others
10458 for xxx_convert in gconvert gcvt sprintf; do
10459     case "$xxx_list" in
10460     *$xxx_convert*) ;;
10461     *) xxx_list="$xxx_list $xxx_convert" ;;
10462     esac
10463 done
10464
10465 case "$d_longdbl$uselongdouble" in
10466 "$define$define")
10467     : again, add preferred functions to our list first
10468     xxx_ld_list=""
10469     for xxx_convert in $gconvert_ld_preference; do
10470         case $xxx_convert in
10471         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10472         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10473         esac
10474     done
10475     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10476     for xxx_convert in qgcvt sprintf $xxx_list; do
10477         case "$xxx_ld_list" in
10478         $xxx_convert*|*" $xxx_convert"*) ;;
10479         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10480         esac
10481     done
10482     : if sprintf cannot do long doubles, move it to the end
10483     if test "$d_PRIgldbl" != "$define"; then
10484         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10485     fi
10486     : if no qgcvt, remove it
10487     if test "$d_qgcvt" != "$define"; then
10488         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10489     fi
10490     : use the ld_list
10491     xxx_list="$xxx_ld_list"
10492     ;;
10493 esac
10494
10495 for xxx_convert in $xxx_list; do
10496         echo "Trying $xxx_convert..."
10497         $rm -f try try$_o core
10498         set try -DTRY_$xxx_convert
10499         if eval $compile; then
10500                 echo "$xxx_convert() found." >&4
10501                 if $run ./try; then
10502                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10503                         break;
10504                 else
10505                         echo "...But $xxx_convert didn't work as I expected."
10506                         xxx_convert=''
10507                 fi
10508         else
10509                 echo "$xxx_convert NOT found." >&4
10510         fi
10511 done
10512
10513 if test X$xxx_convert = X; then
10514     echo "*** WHOA THERE!!! ***" >&4
10515     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10516     xxx_convert=sprintf
10517 fi
10518
10519 case "$xxx_convert" in
10520 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10521 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10522 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10523 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10524    "$define$define$define")
10525       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10526    "$define$define$undef")
10527       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10528    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10529    esac
10530    ;;
10531 esac
10532
10533 fi
10534 $rm_try
10535
10536 : see if _fwalk exists
10537 set fwalk d__fwalk
10538 eval $inlibc
10539
10540 : Initialize h_fcntl
10541 h_fcntl=false
10542
10543 : Initialize h_sysfile
10544 h_sysfile=false
10545
10546 : access call always available on UNIX
10547 set access d_access
10548 eval $inlibc
10549
10550 : locate the flags for 'access()'
10551 case "$d_access" in
10552 "$define")
10553         echo " "
10554         $cat >access.c <<EOCP
10555 #include <sys/types.h>
10556 #ifdef I_FCNTL
10557 #include <fcntl.h>
10558 #endif
10559 #ifdef I_SYS_FILE
10560 #include <sys/file.h>
10561 #endif
10562 #ifdef I_UNISTD
10563 #include <unistd.h>
10564 #endif
10565 #$i_stdlib I_STDLIB
10566 #ifdef I_STDLIB
10567 #include <stdlib.h>
10568 #endif
10569 int main() {
10570         exit(R_OK);
10571 }
10572 EOCP
10573         : check sys/file.h first, no particular reason here
10574         if $test `./findhdr sys/file.h` && \
10575                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10576                 h_sysfile=true;
10577                 echo "<sys/file.h> defines the *_OK access constants." >&4
10578         elif $test `./findhdr fcntl.h` && \
10579                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10580                 h_fcntl=true;
10581                 echo "<fcntl.h> defines the *_OK access constants." >&4
10582         elif $test `./findhdr unistd.h` && \
10583                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10584                 echo "<unistd.h> defines the *_OK access constants." >&4
10585         else
10586                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10587         fi
10588         ;;
10589 esac
10590 $rm -f access*
10591
10592 : see if accessx exists
10593 set accessx d_accessx
10594 eval $inlibc
10595
10596 : see if acosh exists
10597 set acosh d_acosh
10598 eval $inlibc
10599
10600 : see if aintl exists
10601 set aintl d_aintl
10602 eval $inlibc
10603
10604 : see if alarm exists
10605 set alarm d_alarm
10606 eval $inlibc
10607
10608 : see if 64bit time functions exists
10609
10610 set ctime64 d_ctime64
10611 eval $inlibc
10612
10613 set localtime64 d_localtime64
10614 eval $inlibc
10615
10616 set gmtime64 d_gmtime64
10617 eval $inlibc
10618
10619 set mktime64 d_mktime64
10620 eval $inlibc
10621
10622 set difftime64 d_difftime64
10623 eval $inlibc
10624
10625 set asctime64 d_asctime64
10626 eval $inlibc
10627
10628 : see if POSIX threads are available
10629 set pthread.h i_pthread
10630 eval $inhdr
10631
10632 : define a function to check prototypes
10633 $cat > protochk <<EOSH
10634 $startsh
10635 cc="$cc"
10636 optimize="$optimize"
10637 ccflags="$ccflags"
10638 prototype="$prototype"
10639 define="$define"
10640 rm_try="$rm_try"
10641 usethreads=$usethreads
10642 i_pthread=$i_pthread
10643 pthread_h_first=$pthread_h_first
10644 EOSH
10645
10646 $cat >> protochk <<'EOSH'
10647
10648 $rm_try
10649 foo="$1"
10650 shift
10651 while test $# -ge 2; do
10652         case "$1" in
10653                 $define) echo "#include <$2>" >> try.c ;;
10654                 literal) echo "$2" >> try.c ;;
10655         esac
10656     # Extra magic for the benefit of systems that need pthread.h
10657     # to be included early to correctly detect threadsafe functions.
10658     # Such functions must guarantee themselves, though, that the usethreads
10659     # and i_pthread have been defined, before calling protochk.
10660     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10661         echo "#include <pthread.h>" >> try.c
10662         pthread_h_done=yes
10663     fi
10664     shift 2
10665 done
10666 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10667 cat >> try.c <<'EOCP'
10668 #ifdef CAN_PROTOTYPE
10669 #define _(args) args
10670 #else
10671 #define _(args) ()
10672 #endif
10673 EOCP
10674 echo "$foo" >> try.c
10675 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10676 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10677 status=$?
10678 $rm_try
10679 exit $status
10680 EOSH
10681 chmod +x protochk
10682 $eunicefix protochk
10683
10684 : Define hasproto macro for Configure internal use
10685 hasproto='varname=$1; func=$2; shift; shift;
10686 while $test $# -ge 2; do
10687         case "$1" in
10688         $define) echo "#include <$2>";;
10689         esac ;
10690     shift 2;
10691 done > try.c;
10692 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10693 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10694         echo "$func() prototype found.";
10695         val="$define";
10696 else
10697         echo "$func() prototype NOT found.";
10698         val="$undef";
10699 fi;
10700 set $varname;
10701 eval $setvar;
10702 $rm_try tryout.c'
10703
10704 : see if sys/types.h has to be included
10705 set sys/types.h i_systypes
10706 eval $inhdr
10707
10708 : see if sys/select.h has to be included
10709 set sys/select.h i_sysselct
10710 eval $inhdr
10711
10712 : Define hasfield macro for Configure internal use
10713 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10714 while $test $# -ge 2; do
10715         case "$1" in
10716         $define) echo "#include <$2>";;
10717         esac ;
10718     shift 2;
10719 done > try.c;
10720 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10721 set try;
10722 if eval $compile; then
10723         val="$define";
10724 else
10725         val="$undef";
10726 fi;
10727 set $varname;
10728 eval $setvar;
10729 $rm_try'
10730
10731 : see if we should include time.h, sys/time.h, or both
10732 echo " "
10733 if test "X$timeincl" = X; then
10734         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10735         $echo $n "I'm now running the test program...$c"
10736         $cat >try.c <<EOCP
10737 #include <sys/types.h>
10738 #ifdef I_TIME
10739 #include <time.h>
10740 #endif
10741 #ifdef I_SYSTIME
10742 #ifdef SYSTIMEKERNEL
10743 #define KERNEL
10744 #endif
10745 #include <sys/time.h>
10746 #endif
10747 #ifdef I_SYSSELECT
10748 #include <sys/select.h>
10749 #endif
10750 #$i_stdlib I_STDLIB
10751 #ifdef I_STDLIB
10752 #include <stdlib.h>
10753 #endif
10754 int main()
10755 {
10756         struct tm foo;
10757 #ifdef S_TIMEVAL
10758         struct timeval bar;
10759 #endif
10760 #ifdef S_TIMEZONE
10761         struct timezone tzp;
10762 #endif
10763         if (foo.tm_sec == foo.tm_sec)
10764                 exit(0);
10765 #ifdef S_TIMEVAL
10766         if (bar.tv_sec == bar.tv_sec)
10767                 exit(0);
10768 #endif
10769         exit(1);
10770 }
10771 EOCP
10772         flags=''
10773         for s_timezone in '-DS_TIMEZONE' ''; do
10774         sysselect=''
10775         for s_timeval in '-DS_TIMEVAL' ''; do
10776         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10777         for i_time in '' '-DI_TIME'; do
10778         for i_systime in '-DI_SYSTIME' ''; do
10779                 case "$flags" in
10780                 '') $echo $n ".$c"
10781                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10782                         if eval $compile; then
10783                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10784                                 shift
10785                                 flags="$*"
10786                                 echo " "
10787                                 $echo $n "Succeeded with $flags$c"
10788                         fi
10789                         ;;
10790                 esac
10791         done
10792         done
10793         done
10794         done
10795         done
10796         timeincl=''
10797         echo " "
10798         case "$flags" in
10799         *SYSTIMEKERNEL*) i_systimek="$define"
10800                 timeincl=`./findhdr sys/time.h`
10801                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10802         *) i_systimek="$undef";;
10803         esac
10804         case "$flags" in
10805         *I_TIME*) i_time="$define"
10806                 timeincl=`./findhdr time.h`" $timeincl"
10807                 echo "We'll include <time.h>." >&4;;
10808         *) i_time="$undef";;
10809         esac
10810         case "$flags" in
10811         *I_SYSTIME*) i_systime="$define"
10812                 timeincl=`./findhdr sys/time.h`" $timeincl"
10813                 echo "We'll include <sys/time.h>." >&4;;
10814         *) i_systime="$undef";;
10815         esac
10816         $rm_try
10817 fi
10818 : see if struct tm knows about tm_zone
10819 case "$i_systime$i_time" in
10820 *$define*)
10821         echo " "
10822         echo "Checking to see if your struct tm has tm_zone field..." >&4
10823         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10824         eval $hasfield
10825         ;;
10826 *)      val="$undef"
10827         set d_tm_tm_zone
10828         eval $setvar
10829         ;;
10830 esac
10831 case "$d_tm_tm_zone" in
10832 "$define")      echo "Yes, it does."   ;;
10833 *)              echo "No, it doesn't." ;;
10834 esac
10835 : see if struct tm knows about tm_gmtoff
10836 case "$i_systime$i_time" in
10837 *$define*)
10838         echo " "
10839         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10840         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10841         eval $hasfield
10842         ;;
10843 *)      val="$undef"
10844         set d_tm_tm_gmtoff
10845         eval $setvar
10846         ;;
10847 esac
10848 case "$d_tm_tm_gmtoff" in
10849 "$define")      echo "Yes, it does."   ;;
10850 *)              echo "No, it doesn't." ;;
10851 esac
10852
10853 : see if asctime_r exists
10854 set asctime_r d_asctime_r
10855 eval $inlibc
10856 case "$d_asctime_r" in
10857 "$define")
10858         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10859         case "$d_asctime_r_proto:$usethreads" in
10860         ":define")      d_asctime_r_proto=define
10861                 set d_asctime_r_proto asctime_r $hdrs
10862                 eval $hasproto ;;
10863         *)      ;;
10864         esac
10865         case "$d_asctime_r_proto" in
10866         define)
10867         case "$asctime_r_proto" in
10868         ''|0) try='char* asctime_r(const struct tm*, char*);'
10869         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10870         esac
10871         case "$asctime_r_proto" in
10872         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10873         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10874         esac
10875         case "$asctime_r_proto" in
10876         ''|0) try='int asctime_r(const struct tm*, char*);'
10877         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10878         esac
10879         case "$asctime_r_proto" in
10880         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10881         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10882         esac
10883         case "$asctime_r_proto" in
10884         ''|0)   d_asctime_r=undef
10885                 asctime_r_proto=0
10886                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10887         * )     case "$asctime_r_proto" in
10888                 REENTRANT_PROTO*) ;;
10889                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10890                 esac
10891                 echo "Prototype: $try" ;;
10892         esac
10893         ;;
10894         *)      case "$usethreads" in
10895                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10896                 esac
10897                 d_asctime_r=undef
10898                 asctime_r_proto=0
10899                 ;;
10900         esac
10901         ;;
10902 *)      asctime_r_proto=0
10903         ;;
10904 esac
10905
10906 : see if asinh exists
10907 set asinh d_asinh
10908 eval $inlibc
10909
10910 : see if atanh exists
10911 set atanh d_atanh
10912 eval $inlibc
10913
10914 : see if atolf exists
10915 set atolf d_atolf
10916 eval $inlibc
10917
10918 : see if atoll exists
10919 set atoll d_atoll
10920 eval $inlibc
10921
10922 : Look for GCC-style attribute format
10923 case "$d_attribute_format" in
10924 '')
10925 echo " "
10926 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10927 $cat >attrib.c <<'EOCP'
10928 #include <stdio.h>
10929 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10930 EOCP
10931 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10932         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10933                 echo "Your C compiler doesn't support __attribute__((format))."
10934                 val="$undef"
10935         else
10936                 echo "Your C compiler supports __attribute__((format))."
10937                 val="$define"
10938         fi
10939 else
10940         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10941         val="$undef"
10942 fi
10943 ;;
10944 *) val="$d_attribute_format" ;;
10945 esac
10946 set d_attribute_format
10947 eval $setvar
10948 $rm -f attrib*
10949
10950 : Look for GCC-style attribute format with null format allowed
10951 case "$d_printf_format_null" in
10952 '') case "$d_attribute_format" in
10953     $define)
10954         echo " "
10955         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10956 $cat >attrib.c <<EOCP
10957 #include <stdio.h>
10958 #$i_stdlib I_STDLIB
10959 #ifdef I_STDLIB
10960 #include <stdlib.h>
10961 #endif
10962 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10963 int null_printf (char* pat,...) { return (int)pat; }
10964 int main () { exit(null_printf(NULL)); }
10965 EOCP
10966         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10967             : run the executable in case it produces a run-time warning
10968             if $run ./attrib >>attrib.out 2>&1; then
10969                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10970                     echo "Your C compiler doesn't allow __printf__ format to be null."
10971                     val="$undef"
10972                 else
10973                     echo "Your C compiler allows __printf__ format to be null."
10974                     val="$define"
10975                 fi
10976             else
10977             echo "Your C compiler executable failed with __printf__ format null."
10978             val="$undef"
10979         fi
10980     else
10981         echo "Your C compiler fails with __printf__ format null."
10982         val="$undef"
10983     fi
10984     ;;
10985     *)  val="$undef" ;;
10986     esac
10987 ;;
10988 *)  val="$d_printf_format_null" ;;
10989 esac
10990 set d_printf_format_null
10991 eval $setvar
10992 $rm -f attrib*
10993
10994 : Look for GCC-style attribute malloc
10995 case "$d_attribute_malloc" in
10996 '')
10997 echo " "
10998 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10999 $cat >attrib.c <<'EOCP'
11000 #include <stdio.h>
11001 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11002 EOCP
11003 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11004         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11005                 echo "Your C compiler doesn't support __attribute__((malloc))."
11006                 val="$undef"
11007         else
11008                 echo "Your C compiler supports __attribute__((malloc))."
11009                 val="$define"
11010         fi
11011 else
11012         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11013         val="$undef"
11014 fi
11015 ;;
11016 *) val="$d_attribute_malloc" ;;
11017 esac
11018 set d_attribute_malloc
11019 eval $setvar
11020 $rm -f attrib*
11021
11022 : Look for GCC-style attribute nonnull
11023 case "$d_attribute_nonnull" in
11024 '')
11025 echo " "
11026 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11027 $cat >attrib.c <<'EOCP'
11028 #include <stdio.h>
11029 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11030 EOCP
11031 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11032         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11033                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11034                 val="$undef"
11035         else
11036                 echo "Your C compiler supports __attribute__((nonnull))."
11037                 val="$define"
11038         fi
11039 else
11040         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11041         val="$undef"
11042 fi
11043 ;;
11044 *) val="$d_attribute_nonnull" ;;
11045 esac
11046 set d_attribute_nonnull
11047 eval $setvar
11048 $rm -f attrib*
11049
11050 : Look for GCC-style attribute noreturn
11051 case "$d_attribute_noreturn" in
11052 '')
11053 echo " "
11054 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11055 $cat >attrib.c <<'EOCP'
11056 #include <stdio.h>
11057 void fall_over_dead( void ) __attribute__((noreturn));
11058 EOCP
11059 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11060         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11061                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11062                 val="$undef"
11063         else
11064                 echo "Your C compiler supports __attribute__((noreturn))."
11065                 val="$define"
11066         fi
11067 else
11068         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11069         val="$undef"
11070 fi
11071 ;;
11072 *) val="$d_attribute_noreturn" ;;
11073 esac
11074 set d_attribute_noreturn
11075 eval $setvar
11076 $rm -f attrib*
11077
11078 : Look for GCC-style attribute pure
11079 case "$d_attribute_pure" in
11080 '')
11081 echo " "
11082 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11083 $cat >attrib.c <<'EOCP'
11084 #include <stdio.h>
11085 int square( int n ) __attribute__((pure));
11086 EOCP
11087 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11088         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11089                 echo "Your C compiler doesn't support __attribute__((pure))."
11090                 val="$undef"
11091         else
11092                 echo "Your C compiler supports __attribute__((pure))."
11093                 val="$define"
11094         fi
11095 else
11096         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11097         val="$undef"
11098 fi
11099 ;;
11100 *) val="$d_attribute_pure" ;;
11101 esac
11102 set d_attribute_pure
11103 eval $setvar
11104 $rm -f attrib*
11105
11106 : Look for GCC-style attribute unused
11107 case "$d_attribute_unused" in
11108 '')
11109 echo " "
11110 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11111 $cat >attrib.c <<'EOCP'
11112 #include <stdio.h>
11113 int do_something( int dummy __attribute__((unused)), int n );
11114 EOCP
11115 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11116         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11117                 echo "Your C compiler doesn't support __attribute__((unused))."
11118                 val="$undef"
11119         else
11120                 echo "Your C compiler supports __attribute__((unused))."
11121                 val="$define"
11122         fi
11123 else
11124         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11125         val="$undef"
11126 fi
11127 ;;
11128 *) val="$d_attribute_unused" ;;
11129 esac
11130 set d_attribute_unused
11131 eval $setvar
11132 $rm -f attrib*
11133
11134 : Look for GCC-style attribute deprecated
11135 case "$d_attribute_deprecated" in
11136 '')
11137 echo " "
11138 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11139 $cat >attrib.c <<'EOCP'
11140 #include <stdio.h>
11141 int I_am_deprecated(void) __attribute__((deprecated));
11142 EOCP
11143 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11144         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11145                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11146                 val="$undef"
11147         else
11148                 echo "Your C compiler supports __attribute__((deprecated))."
11149                 val="$define"
11150         fi
11151 else
11152         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11153         val="$undef"
11154 fi
11155 ;;
11156 *) val="$d_attribute_deprecated" ;;
11157 esac
11158 set d_attribute_deprecated
11159 eval $setvar
11160 $rm -f attrib*
11161
11162 : Look for GCC-style attribute warn_unused_result
11163 case "$d_attribute_warn_unused_result" in
11164 '')
11165 echo " "
11166 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11167 $cat >attrib.c <<'EOCP'
11168 #include <stdio.h>
11169 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11170 EOCP
11171 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11172         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11173                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11174                 val="$undef"
11175         else
11176                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11177                 val="$define"
11178         fi
11179 else
11180         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11181         val="$undef"
11182 fi
11183 ;;
11184 *) val="$d_attribute_warn_unused_result" ;;
11185 esac
11186 set d_attribute_warn_unused_result
11187 eval $setvar
11188 $rm -f attrib*
11189
11190 : see if bcmp exists
11191 set bcmp d_bcmp
11192 eval $inlibc
11193
11194 : see if bcopy exists
11195 set bcopy d_bcopy
11196 eval $inlibc
11197
11198 : see if getpgrp exists
11199 set getpgrp d_getpgrp
11200 eval $inlibc
11201
11202 case "$d_getpgrp" in
11203 "$define")
11204         echo " "
11205         echo "Checking to see which flavor of getpgrp is in use..."
11206         $cat >try.c <<EOP
11207 #$i_unistd I_UNISTD
11208 #include <sys/types.h>
11209 #ifdef I_UNISTD
11210 #  include <unistd.h>
11211 #endif
11212 #$i_stdlib I_STDLIB
11213 #ifdef I_STDLIB
11214 #include <stdlib.h>
11215 #endif
11216 int main()
11217 {
11218         if (getuid() == 0) {
11219                 printf("(I see you are running Configure as super-user...)\n");
11220                 setuid(1);
11221         }
11222 #ifdef TRY_BSD_PGRP
11223         if (getpgrp(1) == 0)
11224                 exit(0);
11225 #else
11226         if (getpgrp() > 0)
11227                 exit(0);
11228 #endif
11229         exit(1);
11230 }
11231 EOP
11232         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11233                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11234                 val="$define"
11235         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11236                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11237                 val="$undef"
11238         else
11239                 echo "I can't seem to compile and run the test program."
11240                 if ./usg; then
11241                         xxx="a USG one, i.e. you use getpgrp()."
11242                 else
11243                         # SVR4 systems can appear rather BSD-ish.
11244                         case "$i_unistd" in
11245                         $undef)
11246                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11247                                 val="$define"
11248                                 ;;
11249                         $define)
11250                                 xxx="probably a USG one, i.e. you use getpgrp()."
11251                                 val="$undef"
11252                                 ;;
11253                         esac
11254                 fi
11255                 echo "Assuming your getpgrp is $xxx" >&4
11256         fi
11257         ;;
11258 *) val="$undef";;
11259 esac
11260 set d_bsdgetpgrp
11261 eval $setvar
11262 $rm_try
11263
11264 : see if setpgrp exists
11265 set setpgrp d_setpgrp
11266 eval $inlibc
11267
11268 case "$d_setpgrp" in
11269 "$define")
11270         echo " "
11271         echo "Checking to see which flavor of setpgrp is in use..."
11272         $cat >try.c <<EOP
11273 #$i_unistd I_UNISTD
11274 #include <sys/types.h>
11275 #ifdef I_UNISTD
11276 #  include <unistd.h>
11277 #endif
11278 #$i_stdlib I_STDLIB
11279 #ifdef I_STDLIB
11280 #include <stdlib.h>
11281 #endif
11282 int main()
11283 {
11284         if (getuid() == 0) {
11285                 printf("(I see you are running Configure as super-user...)\n");
11286                 setuid(1);
11287         }
11288 #ifdef TRY_BSD_PGRP
11289         if (-1 == setpgrp(1, 1))
11290                 exit(0);
11291 #else
11292         if (setpgrp() != -1)
11293                 exit(0);
11294 #endif
11295         exit(1);
11296 }
11297 EOP
11298         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11299                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11300                 val="$define"
11301         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11302                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11303                 val="$undef"
11304         else
11305                 echo "(I can't seem to compile and run the test program.)"
11306                 if ./usg; then
11307                         xxx="a USG one, i.e. you use setpgrp()."
11308                 else
11309                         # SVR4 systems can appear rather BSD-ish.
11310                         case "$i_unistd" in
11311                         $undef)
11312                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11313                                 val="$define"
11314                                 ;;
11315                         $define)
11316                                 xxx="probably a USG one, i.e. you use setpgrp()."
11317                                 val="$undef"
11318                                 ;;
11319                         esac
11320                 fi
11321                 echo "Assuming your setpgrp is $xxx" >&4
11322         fi
11323         ;;
11324 *) val="$undef";;
11325 esac
11326 set d_bsdsetpgrp
11327 eval $setvar
11328 $rm_try
11329
11330 : Look for GCC-style __builtin_choose_expr
11331 case "$d_builtin_choose_expr" in
11332 '')
11333     echo " "
11334     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11335     $cat >try.c <<'EOCP'
11336 #include <assert.h>
11337 #include <stdlib.h>
11338 #include <stdio.h>
11339
11340 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11341
11342 int main(void) {
11343     assert( SYRINX(1) == 2112 );
11344     assert( SYRINX(1) != 5150 );
11345     assert( SYRINX(0) == 5150 );
11346     assert( SYRINX(0) != 2112 );
11347     puts( "All good!" );
11348     exit(0);
11349 }
11350
11351 EOCP
11352     set try
11353     if eval $compile && $run ./try; then
11354         echo "Your C compiler supports __builtin_choose_expr."
11355         val="$define"
11356     else
11357         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11358         val="$undef"
11359     fi
11360 ;;
11361 *) val="$d_builtin_choose_expr" ;;
11362 esac
11363
11364 set d_builtin_choose_expr
11365 eval $setvar
11366 $rm_try
11367
11368 : Look for GCC-style __builtin_expect
11369 case "$d_builtin_expect" in
11370 '')
11371     echo " "
11372     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11373     $cat >try.c <<'EOCP'
11374 int main(void) {
11375     int n = 50;
11376     if ( __builtin_expect(n, 0) ) n = 1;
11377     /* Remember shell exit code truth is 0, C truth is non-zero */
11378     return !(n == 1);
11379 }
11380 EOCP
11381     set try
11382     if eval $compile && $run ./try; then
11383         echo "Your C compiler supports __builtin_expect."
11384         val="$define"
11385     else
11386         echo "Your C compiler doesn't seem to understand __builtin_expect."
11387         val="$undef"
11388     fi
11389     ;;
11390 *) val="$d_builtin_expect" ;;
11391 esac
11392
11393 set d_builtin_expect
11394 eval $setvar
11395 $rm_try
11396
11397 : see if bzero exists
11398 set bzero d_bzero
11399 eval $inlibc
11400
11401 : see if stdarg is available
11402 echo " "
11403 if $test `./findhdr stdarg.h`; then
11404         echo "<stdarg.h> found." >&4
11405         valstd="$define"
11406 else
11407         echo "<stdarg.h> NOT found." >&4
11408         valstd="$undef"
11409 fi
11410
11411 : see if varargs is available
11412 echo " "
11413 if $test `./findhdr varargs.h`; then
11414         echo "<varargs.h> found." >&4
11415 else
11416         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11417 fi
11418
11419 : set up the varargs testing programs
11420 $cat > varargs.c <<EOP
11421 #ifdef I_STDARG
11422 #include <stdarg.h>
11423 #endif
11424 #ifdef I_VARARGS
11425 #include <varargs.h>
11426 #endif
11427
11428 #ifdef I_STDARG
11429 int f(char *p, ...)
11430 #else
11431 int f(va_alist)
11432 va_dcl
11433 #endif
11434 {
11435         va_list ap;
11436 #ifndef I_STDARG
11437         char *p;
11438 #endif
11439 #ifdef I_STDARG
11440         va_start(ap,p);
11441 #else
11442         va_start(ap);
11443         p = va_arg(ap, char *);
11444 #endif
11445         va_end(ap);
11446         return 0;
11447 }
11448 EOP
11449 $cat > varargs <<EOP
11450 $startsh
11451 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11452         echo "true"
11453 else
11454         echo "false"
11455 fi
11456 $rm -f varargs$_o
11457 EOP
11458 chmod +x varargs
11459
11460 : now check which varargs header should be included
11461 echo " "
11462 i_varhdr=''
11463 val=''
11464 case "$valstd" in
11465 "$define")
11466         if `./varargs I_STDARG`; then
11467                 val='stdarg.h'
11468         elif `./varargs I_VARARGS`; then
11469                 val='varargs.h'
11470         fi
11471         ;;
11472 *)
11473         if `./varargs I_VARARGS`; then
11474                 val='varargs.h'
11475         fi
11476         ;;
11477 esac
11478 case "$val" in
11479 '')
11480         echo " "
11481         echo "*** WHOA THERE!!! ***" >&4
11482         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11483         case "$knowitall" in
11484         '')
11485         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11486                 exit 1
11487                 ;;
11488         esac
11489 echo "I could not find the definition for va_dcl... You have problems..." >&4
11490         val="$undef"; set i_stdarg; eval $setvar
11491         val="$undef"; set i_varargs; eval $setvar
11492         ;;
11493 *)
11494         set i_varhdr
11495         eval $setvar
11496         case "$i_varhdr" in
11497         stdarg.h)
11498                 val="$define"; set i_stdarg; eval $setvar
11499                 val="$undef"; set i_varargs; eval $setvar
11500                 ;;
11501         varargs.h)
11502                 val="$undef"; set i_stdarg; eval $setvar
11503                 val="$define"; set i_varargs; eval $setvar
11504                 ;;
11505         esac
11506         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11507 esac
11508 $rm -f varargs*
11509
11510 : see if the Compiler supports C99 variadic macros
11511 case "$i_stdarg$i_stdlib" in
11512     "$define$define")
11513     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11514     $cat >try.c <<EOCP
11515 #include <stdio.h>
11516 #include <stdarg.h>
11517
11518 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11519
11520 int main() {
11521   char buf[20];
11522   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11523   puts(buf);
11524   return 0;
11525 }
11526 EOCP
11527     set try
11528     if eval $compile && $run ./try 2>&1 >/dev/null; then
11529         case "`$run ./try`" in
11530             "123 456 789")
11531             echo "You have C99 variadic macros." >&4
11532             d_c99_variadic_macros="$define"
11533             ;;
11534             *)
11535             echo "You don't have functional C99 variadic macros." >&4
11536             d_c99_variadic_macros="$undef"
11537             ;;
11538         esac
11539     else
11540         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11541         d_c99_variadic_macros="$undef"
11542     fi
11543     $rm_try
11544     ;;
11545     *)
11546     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11547     d_c99_variadic_macros="$undef"
11548     ;;
11549 esac
11550
11551 : see if signal is declared as pointer to function returning int or void
11552 echo " "
11553 xxx=`./findhdr signal.h`
11554 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11555 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11556         echo "You have int (*signal())() instead of void." >&4
11557         val="$undef"
11558 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11559         echo "You have void (*signal())()." >&4
11560         val="$define"
11561 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11562         echo "You have int (*signal())() instead of void." >&4
11563         val="$undef"
11564 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11565         echo "You have void (*signal())()." >&4
11566         val="$define"
11567 else
11568         case "$d_voidsig" in
11569         '')
11570         echo "I can't determine whether signal handler returns void or int..." >&4
11571                 dflt=void
11572                 rp="What type does your signal handler return?"
11573                 . ./myread
11574                 case "$ans" in
11575                 v*) val="$define";;
11576                 *) val="$undef";;
11577                 esac;;
11578         "$define")
11579                 echo "As you already told me, signal handler returns void." >&4
11580                 val="$define"
11581                 ;;
11582         *)      echo "As you already told me, signal handler returns int." >&4
11583                 val="$undef"
11584                 ;;
11585         esac
11586 fi
11587 set d_voidsig
11588 eval $setvar
11589 case "$d_voidsig" in
11590 "$define") signal_t="void";;
11591 *) signal_t="int";;
11592 esac
11593 $rm -f $$.tmp
11594
11595 : check for ability to cast large floats to 32-bit ints.
11596 echo " "
11597 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11598 if $test "$intsize" -ge 4; then
11599         xxx=int
11600 else
11601         xxx=long
11602 fi
11603 $cat >try.c <<EOCP
11604 #include <stdio.h>
11605 #$i_stdlib I_STDLIB
11606 #ifdef I_STDLIB
11607 #include <stdlib.h>
11608 #endif
11609 #include <sys/types.h>
11610 #include <signal.h>
11611 $signal_t blech(int s) { exit(3); }
11612 int main()
11613 {
11614         $xxx i32;
11615         double f, g;
11616         int result = 0;
11617         char str[16];
11618         signal(SIGFPE, blech);
11619
11620         /* Don't let compiler optimize the test away.  Store the number
11621            in a writable string for gcc to pass to sscanf under HP-UX.
11622         */
11623         sprintf(str, "2147483647");
11624         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11625         g = 10 * f;
11626         i32  = ($xxx) g;
11627
11628         /* x86 processors will probably give 0x8000 0000, which is a
11629            sign change.  We don't want that.  We want to mimic SPARC
11630            behavior here, which is to preserve the sign and give
11631            back 0x7fff ffff.
11632         */
11633         if (i32 != ($xxx) f)
11634                 result |= 1;
11635         exit(result);
11636 }
11637 EOCP
11638 set try
11639 if eval $compile_ok; then
11640         $run ./try 2>/dev/null
11641         yyy=$?
11642 else
11643         echo "(I can't seem to compile the test program--assuming it can't)"
11644         yyy=1
11645 fi
11646 case "$yyy" in
11647 0)      val="$define"
11648         echo "Yup, it can."
11649         ;;
11650 *)      val="$undef"
11651         echo "Nope, it can't."
11652         ;;
11653 esac
11654 set d_casti32
11655 eval $setvar
11656 $rm_try
11657
11658 : check for ability to cast negative floats to unsigned
11659 echo " "
11660 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11661 $cat >try.c <<EOCP
11662 #include <stdio.h>
11663 #$i_stdlib I_STDLIB
11664 #ifdef I_STDLIB
11665 #include <stdlib.h>
11666 #endif
11667 #include <sys/types.h>
11668 #include <signal.h>
11669 $signal_t blech(int s) { exit(7); }
11670 $signal_t blech_in_list(int s) { exit(4); }
11671 unsigned long dummy_long(unsigned long p) { return p; }
11672 unsigned int dummy_int(unsigned int p) { return p; }
11673 unsigned short dummy_short(unsigned short p) { return p; }
11674 int main()
11675 {
11676         double f;
11677         unsigned long along;
11678         unsigned int aint;
11679         unsigned short ashort;
11680         int result = 0;
11681         char str[16];
11682
11683         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11684            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11685            optimized the whole file away
11686         */
11687         /* Store the number in a writable string for gcc to pass to
11688            sscanf under HP-UX.
11689         */
11690         sprintf(str, "-123");
11691         sscanf(str, "%lf", &f);  /* f = -123.; */
11692
11693         signal(SIGFPE, blech);
11694         along = (unsigned long)f;
11695         aint = (unsigned int)f;
11696         ashort = (unsigned short)f;
11697         if (along != (unsigned long)-123)
11698                 result |= 1;
11699         if (aint != (unsigned int)-123)
11700                 result |= 1;
11701         if (ashort != (unsigned short)-123)
11702                 result |= 1;
11703         sprintf(str, "1073741824.");
11704         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11705         f = f + f;
11706         along = 0;
11707         along = (unsigned long)f;
11708         if (along != 0x80000000)
11709                 result |= 2;
11710         f -= 1.;
11711         along = 0;
11712         along = (unsigned long)f;
11713         if (along != 0x7fffffff)
11714                 result |= 1;
11715         f += 2.;
11716         along = 0;
11717         along = (unsigned long)f;
11718         if (along != 0x80000001)
11719                 result |= 2;
11720         if (result)
11721                 exit(result);
11722         signal(SIGFPE, blech_in_list);
11723         sprintf(str, "123.");
11724         sscanf(str, "%lf", &f);  /* f = 123.; */
11725         along = dummy_long((unsigned long)f);
11726         aint = dummy_int((unsigned int)f);
11727         ashort = dummy_short((unsigned short)f);
11728         if (along != (unsigned long)123)
11729                 result |= 4;
11730         if (aint != (unsigned int)123)
11731                 result |= 4;
11732         if (ashort != (unsigned short)123)
11733                 result |= 4;
11734         exit(result);
11735
11736 }
11737 EOCP
11738 set try
11739 if eval $compile_ok; then
11740         $run ./try 2>/dev/null
11741         castflags=$?
11742 else
11743         echo "(I can't seem to compile the test program--assuming it can't)"
11744         castflags=7
11745 fi
11746 case "$castflags" in
11747 0)      val="$define"
11748         echo "Yup, it can."
11749         ;;
11750 *)      val="$undef"
11751         echo "Nope, it can't."
11752         ;;
11753 esac
11754 set d_castneg
11755 eval $setvar
11756 $rm_try
11757
11758 : see if cbrt exists
11759 set cbrt d_cbrt
11760 eval $inlibc
11761
11762 : see if vprintf exists
11763 echo " "
11764 if set vprintf val -f d_vprintf; eval $csym; $val; then
11765         echo 'vprintf() found.' >&4
11766         val="$define"
11767         $cat >try.c <<EOF
11768 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11769 #$i_varargs I_VARARGS
11770
11771 #$i_stdlib I_STDLIB
11772 #$i_unistd I_UNISTD
11773
11774 #ifdef I_STDARG
11775 #  include <stdarg.h>
11776 #else /* I_VARARGS */
11777 #  include <varargs.h>
11778 #endif
11779
11780 #ifdef I_UNISTD
11781 #  include <unistd.h>
11782 #endif
11783
11784 #ifdef I_STDLIB
11785 #  include <stdlib.h>
11786 #endif
11787
11788 #include <stdio.h> /* vsprintf prototype */
11789
11790 #ifdef I_STDARG
11791 void xxx(int n, ...)
11792 {
11793     va_list args;
11794     char buf[10];
11795     va_start(args, n);
11796     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11797 }
11798 int main() { xxx(1, "foo"); }
11799
11800 #else /* I_VARARGS */
11801
11802 xxx(va_alist)
11803 va_dcl
11804 {
11805     va_list args;
11806     char buf[10];
11807     va_start(args);
11808     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11809 }
11810 int main() { xxx("foo"); }
11811
11812 #endif
11813
11814 EOF
11815         set try
11816         if eval $compile_ok; then
11817                 if $run ./try; then
11818                         echo "Your vsprintf() returns (int)." >&4
11819                         val2="$undef"
11820                 else
11821                         echo "Your vsprintf() returns (char*)." >&4
11822                         val2="$define"
11823                 fi
11824         else
11825                 echo 'I am unable to compile the vsprintf() test program.' >&4
11826                 # We shouldn't get here.  If we do, assume the standard signature,
11827                 # not the old BSD one.
11828                 echo 'Guessing that vsprintf() returns (int).' >&4
11829                 val2="$undef"
11830         fi
11831 else
11832         echo 'vprintf() NOT found.' >&4
11833         val="$undef"
11834         val2="$undef"
11835 fi
11836 $rm_try
11837 set d_vprintf
11838 eval $setvar
11839 val=$val2
11840 set d_charvspr
11841 eval $setvar
11842
11843 : see if chown exists
11844 set chown d_chown
11845 eval $inlibc
11846
11847 : see if chroot exists
11848 set chroot d_chroot
11849 eval $inlibc
11850
11851 : see if chsize exists
11852 set chsize d_chsize
11853 eval $inlibc
11854
11855 : see if class exists
11856 set class d_class
11857 eval $inlibc
11858
11859 : see if clearenv exists
11860 set clearenv d_clearenv
11861 eval $inlibc
11862
11863 : Define hasstruct macro for Configure internal use
11864 hasstruct='varname=$1; struct=$2; shift; shift;
11865 while $test $# -ge 2; do
11866         case "$1" in
11867         $define) echo "#include <$2>";;
11868         esac ;
11869     shift 2;
11870 done > try.c;
11871 echo "int main () { struct $struct foo; }" >> try.c;
11872 set try;
11873 if eval $compile; then
11874         val="$define";
11875 else
11876         val="$undef";
11877 fi;
11878 set $varname;
11879 eval $setvar;
11880 $rm_try'
11881
11882 : see whether socket exists
11883 socketlib=''
11884 sockethdr=''
11885 echo " "
11886 $echo $n "Hmm... $c" >&4
11887 if set socket val -f d_socket; eval $csym; $val; then
11888     echo "Looks like you have Berkeley networking support." >&4
11889     d_socket="$define"
11890     if set setsockopt val -f; eval $csym; $val; then
11891         d_oldsock="$undef"
11892     else
11893         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11894         d_oldsock="$define"
11895     fi
11896 else
11897     if $contains socklib libc.list >/dev/null 2>&1; then
11898         echo "Looks like you have Berkeley networking support." >&4
11899         d_socket="$define"
11900         : we will have to assume that it supports the 4.2 BSD interface
11901         d_oldsock="$undef"
11902     else
11903         echo "You don't have Berkeley networking in libc$_a..." >&4
11904         if test "X$d_socket" = "X$define"; then
11905             echo "...but you seem to believe that you have sockets." >&4
11906         else
11907             for net in net socket
11908             do
11909                 if test -f $sysroot/usr/lib/lib$net$_a; then
11910                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11911                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11912                     if $contains socket libc.list >/dev/null 2>&1; then
11913                         d_socket="$define"
11914                         socketlib="-l$net"
11915                         case "$net" in
11916                         net)
11917                             echo "...but the Wollongong group seems to have hacked it in." >&4
11918                             sockethdr="-I$sysroot/usr/netinclude"
11919                             ;;
11920                         esac
11921                         echo "Found Berkeley sockets interface in lib$net." >&4
11922                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11923                             d_oldsock="$undef"
11924                         else
11925                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11926                             d_oldsock="$define"
11927                         fi
11928                         break
11929                     fi
11930                 fi
11931             done
11932             if test "X$d_socket" != "X$define"; then
11933                echo "or anywhere else I see." >&4
11934                d_socket="$undef"
11935                d_oldsock="$undef"
11936             fi
11937         fi
11938     fi
11939 fi
11940
11941 : see if socketpair exists
11942 set socketpair d_sockpair
11943 eval $inlibc
11944
11945
11946 echo " "
11947 echo "Checking the availability sa_len in the sock struct ..." >&4
11948 $cat >try.c <<EOF
11949 #include <sys/types.h>
11950 #include <sys/socket.h>
11951 int main() {
11952 struct sockaddr sa;
11953 return (sa.sa_len);
11954 }
11955 EOF
11956 val="$undef"
11957 set try; if eval $compile; then
11958     val="$define"
11959 fi
11960 set d_sockaddr_sa_len; eval $setvar
11961 $rm_try
11962
11963 echo " "
11964 echo "Checking the availability struct sockaddr_in6 ..." >&4
11965 $cat >try.c <<EOF
11966 #include <sys/types.h>
11967 #include <sys/socket.h>
11968 #include <netinet/in.h>
11969 int main() {
11970 struct sockaddr_in6 sin6;
11971 return (sin6.sin6_family);
11972 }
11973 EOF
11974 val="$undef"
11975 set try; if eval $compile; then
11976     val="$define"
11977 fi
11978 set d_sockaddr_in6; eval $setvar
11979 $rm_try
11980
11981 echo " "
11982 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11983 $cat >try.c <<EOF
11984 #include <sys/types.h>
11985 #include <sys/socket.h>
11986 #include <netinet/in.h>
11987 int main() {
11988 struct sockaddr_in6 sin6;
11989 return (sin6.sin6_scope_id);
11990 }
11991 EOF
11992 val="$undef"
11993 set try; if eval $compile; then
11994     val="$define"
11995 fi
11996 set d_sin6_scope_id; eval $setvar
11997 $rm_try
11998
11999 echo " "
12000 echo "Checking the availability struct ip_mreq ..." >&4
12001 $cat >try.c <<EOF
12002 #include <sys/types.h>
12003 #include <sys/socket.h>
12004 #include <netinet/in.h>
12005 int main() {
12006 struct ip_mreq mreq;
12007 return (mreq.imr_multiaddr.s_addr);
12008 }
12009 EOF
12010 val="$undef"
12011 set try; if eval $compile; then
12012        val="$define"
12013 fi
12014 set d_ip_mreq; eval $setvar
12015 $rm_try
12016
12017 echo " "
12018 echo "Checking the availability struct ip_mreq_source ..." >&4
12019 $cat >try.c <<EOF
12020 #include <sys/types.h>
12021 #include <sys/socket.h>
12022 #include <netinet/in.h>
12023 int main() {
12024 struct ip_mreq_source mreq;
12025 return (mreq.imr_multiaddr.s_addr);
12026 }
12027 EOF
12028 val="$undef"
12029 set try; if eval $compile; then
12030        val="$define"
12031 fi
12032 set d_ip_mreq_source; eval $setvar
12033 $rm_try
12034
12035 echo " "
12036 echo "Checking the availability struct ipv6_mreq ..." >&4
12037 $cat >try.c <<EOF
12038 #include <sys/types.h>
12039 #include <sys/socket.h>
12040 #include <netinet/in.h>
12041 int main() {
12042 struct ipv6_mreq mreq;
12043 return (mreq.ipv6mr_interface);
12044 }
12045 EOF
12046 val="$undef"
12047 set try; if eval $compile; then
12048     val="$define"
12049 fi
12050 set d_ipv6_mreq; eval $setvar
12051 $rm_try
12052
12053 echo " "
12054 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12055 $cat >try.c <<EOF
12056 #include <sys/types.h>
12057 #include <sys/socket.h>
12058 #include <netinet/in.h>
12059 int main() {
12060 struct ipv6_mreq_source mreq;
12061 return (mreq.imr_multiaddr.s_addr);
12062 }
12063 EOF
12064 val="$undef"
12065 set try; if eval $compile; then
12066        val="$define"
12067 fi
12068 set d_ipv6_mreq_source; eval $setvar
12069 $rm_try
12070
12071 echo " "
12072 echo "Checking the availability of certain socket constants..." >&4
12073 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12074     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12075     $cat >try.c <<EOF
12076 #include <sys/types.h>
12077 #include <sys/socket.h>
12078 int main() {
12079     int i = $ENUM;
12080 }
12081 EOF
12082     val="$undef"
12083     set try; if eval $compile; then
12084         val="$define"
12085     fi
12086     set d_${enum}; eval $setvar
12087     $rm_try
12088 done
12089
12090 : see if this is a sys/uio.h system
12091 set sys/uio.h i_sysuio
12092 eval $inhdr
12093
12094 : Check for cmsghdr support
12095 echo " "
12096 echo "Checking to see if your system supports struct cmsghdr..." >&4
12097 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12098 eval $hasstruct
12099 case "$d_cmsghdr_s" in
12100 "$define")      echo "Yes, it does."   ;;
12101 *)              echo "No, it doesn't." ;;
12102 esac
12103
12104
12105 : check for const keyword
12106 echo " "
12107 echo 'Checking to see if your C compiler knows about "const"...' >&4
12108 $cat >const.c <<'EOCP'
12109 typedef struct spug { int drokk; } spug;
12110 int main()
12111 {
12112         const char *foo;
12113         const spug y = { 0 };
12114 }
12115 EOCP
12116 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12117         val="$define"
12118         echo "Yup, it does."
12119 else
12120         val="$undef"
12121         echo "Nope, it doesn't."
12122 fi
12123 set d_const
12124 eval $setvar
12125
12126 : see if copysign exists
12127 set copysign d_copysign
12128 eval $inlibc
12129
12130 : see if copysignl exists
12131 set copysignl d_copysignl
12132 eval $inlibc
12133
12134 : see if crypt exists
12135 echo " "
12136 set crypt d_crypt
12137 eval $inlibc
12138 case "$d_crypt" in
12139 $define) cryptlib='' ;;
12140 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12141                 echo 'crypt() found.' >&4
12142                 val="$define"
12143                 cryptlib=''
12144         else
12145                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12146                 if $test -z "$cryptlib"; then
12147                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12148                 else
12149                         cryptlib=-lcrypt
12150                 fi
12151                 if $test -z "$cryptlib"; then
12152                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12153                 else
12154                         cryptlib=-lcrypt
12155                 fi
12156                 if $test -z "$cryptlib"; then
12157                         cryptlib=`./loc libcrypt$_a "" $libpth`
12158                 else
12159                         cryptlib=-lcrypt
12160                 fi
12161                 if $test -z "$cryptlib"; then
12162                         echo 'crypt() NOT found.' >&4
12163                         val="$undef"
12164                 else
12165                         val="$define"
12166                 fi
12167         fi
12168         set d_crypt
12169         eval $setvar
12170         ;;
12171 esac
12172
12173 : see if this is a crypt.h system
12174 set crypt.h i_crypt
12175 eval $inhdr
12176
12177 : see if crypt_r exists
12178 set crypt_r d_crypt_r
12179 eval $inlibc
12180 case "$d_crypt_r" in
12181 "$define")
12182         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12183         case "$d_crypt_r_proto:$usethreads" in
12184         ":define")      d_crypt_r_proto=define
12185                 set d_crypt_r_proto crypt_r $hdrs
12186                 eval $hasproto ;;
12187         *)      ;;
12188         esac
12189         case "$d_crypt_r_proto" in
12190         define)
12191         case "$crypt_r_proto" in
12192         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12193         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12194         esac
12195         case "$crypt_r_proto" in
12196         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12197         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12198         esac
12199         case "$crypt_r_proto" in
12200         ''|0)   d_crypt_r=undef
12201                 crypt_r_proto=0
12202                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12203         * )     case "$crypt_r_proto" in
12204                 REENTRANT_PROTO*) ;;
12205                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12206                 esac
12207                 echo "Prototype: $try" ;;
12208         esac
12209         ;;
12210         *)      case "$usethreads" in
12211                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12212                 esac
12213                 d_crypt_r=undef
12214                 crypt_r_proto=0
12215                 ;;
12216         esac
12217         ;;
12218 *)      crypt_r_proto=0
12219         ;;
12220 esac
12221
12222 : get csh whereabouts
12223 case "$csh" in
12224 'csh') val="$undef" ;;
12225 *) val="$define" ;;
12226 esac
12227 set d_csh
12228 eval $setvar
12229 : Respect a hint or command line value for full_csh.
12230 case "$full_csh" in
12231 '') full_csh=$csh ;;
12232 esac
12233
12234 : see if ctermid exists
12235 set ctermid d_ctermid
12236 eval $inlibc
12237
12238 : see if ctermid_r exists
12239 set ctermid_r d_ctermid_r
12240 eval $inlibc
12241 case "$d_ctermid_r" in
12242 "$define")
12243         hdrs="$i_systypes sys/types.h define stdio.h "
12244         case "$d_ctermid_r_proto:$usethreads" in
12245         ":define")      d_ctermid_r_proto=define
12246                 set d_ctermid_r_proto ctermid_r $hdrs
12247                 eval $hasproto ;;
12248         *)      ;;
12249         esac
12250         case "$d_ctermid_r_proto" in
12251         define)
12252         case "$ctermid_r_proto" in
12253         ''|0) try='char* ctermid_r(char*);'
12254         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12255         esac
12256         case "$ctermid_r_proto" in
12257         ''|0)   d_ctermid_r=undef
12258                 ctermid_r_proto=0
12259                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12260         * )     case "$ctermid_r_proto" in
12261                 REENTRANT_PROTO*) ;;
12262                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12263                 esac
12264                 echo "Prototype: $try" ;;
12265         esac
12266         ;;
12267         *)      case "$usethreads" in
12268                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12269                 esac
12270                 d_ctermid_r=undef
12271                 ctermid_r_proto=0
12272                 ;;
12273         esac
12274         ;;
12275 *)      ctermid_r_proto=0
12276         ;;
12277 esac
12278
12279 : see if ctime_r exists
12280 set ctime_r d_ctime_r
12281 eval $inlibc
12282 case "$d_ctime_r" in
12283 "$define")
12284         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12285         case "$d_ctime_r_proto:$usethreads" in
12286         ":define")      d_ctime_r_proto=define
12287                 set d_ctime_r_proto ctime_r $hdrs
12288                 eval $hasproto ;;
12289         *)      ;;
12290         esac
12291         case "$d_ctime_r_proto" in
12292         define)
12293         case "$ctime_r_proto" in
12294         ''|0) try='char* ctime_r(const time_t*, char*);'
12295         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12296         esac
12297         case "$ctime_r_proto" in
12298         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12299         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12300         esac
12301         case "$ctime_r_proto" in
12302         ''|0) try='int ctime_r(const time_t*, char*);'
12303         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12304         esac
12305         case "$ctime_r_proto" in
12306         ''|0) try='int ctime_r(const time_t*, char*, int);'
12307         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12308         esac
12309         case "$ctime_r_proto" in
12310         ''|0)   d_ctime_r=undef
12311                 ctime_r_proto=0
12312                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12313         * )     case "$ctime_r_proto" in
12314                 REENTRANT_PROTO*) ;;
12315                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12316                 esac
12317                 echo "Prototype: $try" ;;
12318         esac
12319         ;;
12320         *)      case "$usethreads" in
12321                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12322                 esac
12323                 d_ctime_r=undef
12324                 ctime_r_proto=0
12325                 ;;
12326         esac
12327         ;;
12328 *)      ctime_r_proto=0
12329         ;;
12330 esac
12331
12332 : see if cuserid exists
12333 set cuserid d_cuserid
12334 eval $inlibc
12335
12336 : see if this is a limits.h system
12337 set limits.h i_limits
12338 eval $inhdr
12339
12340 : See if number of significant digits in a double precision number is known
12341 echo " "
12342 $cat >dbl_dig.c <<EOM
12343 #$i_limits I_LIMITS
12344 #$i_float I_FLOAT
12345 #ifdef I_LIMITS
12346 #include <limits.h>
12347 #endif
12348 #ifdef I_FLOAT
12349 #include <float.h>
12350 #endif
12351 #ifdef DBL_DIG
12352 printf("Contains DBL_DIG");
12353 #endif
12354 EOM
12355 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12356 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12357         echo "DBL_DIG found." >&4
12358         val="$define"
12359 else
12360         echo "DBL_DIG NOT found." >&4
12361         val="$undef"
12362 fi
12363 $rm -f dbl_dig.?
12364 set d_dbl_dig
12365 eval $setvar
12366
12367 : see if dbm.h is available
12368 : see if dbmclose exists
12369 set dbmclose d_dbmclose
12370 eval $inlibc
12371
12372 case "$d_dbmclose" in
12373 $define)
12374         set dbm.h i_dbm
12375         eval $inhdr
12376         case "$i_dbm" in
12377         $define)
12378                 val="$undef"
12379                 set i_rpcsvcdbm
12380                 eval $setvar
12381                 ;;
12382         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12383                 eval $inhdr
12384                 ;;
12385         esac
12386         ;;
12387 *)      echo "We won't be including <dbm.h>"
12388         val="$undef"
12389         set i_dbm
12390         eval $setvar
12391         val="$undef"
12392         set i_rpcsvcdbm
12393         eval $setvar
12394         ;;
12395 esac
12396
12397 : see if prototype for dbminit is available
12398 echo " "
12399 set d_dbminitproto dbminit $i_dbm dbm.h
12400 eval $hasproto
12401
12402 : see if difftime exists
12403 set difftime d_difftime
12404 eval $inlibc
12405
12406 : see if this is a dirent system
12407 echo " "
12408 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12409         val="$define"
12410         echo "<dirent.h> found." >&4
12411 else
12412         val="$undef"
12413         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12414                 echo "<sys/dir.h> found." >&4
12415                 echo " "
12416         else
12417                 xinc=`./findhdr sys/ndir.h`
12418         fi
12419         echo "<dirent.h> NOT found." >&4
12420 fi
12421 set i_dirent
12422 eval $setvar
12423
12424 : Look for type of directory structure.
12425 echo " "
12426 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12427
12428 case "$direntrytype" in
12429 ''|' ')
12430         case "$i_dirent" in
12431         $define) guess1='struct dirent' ;;
12432         *) guess1='struct direct'  ;;
12433         esac
12434         ;;
12435 *)      guess1="$direntrytype"
12436         ;;
12437 esac
12438
12439 case "$guess1" in
12440 'struct dirent') guess2='struct direct' ;;
12441 *) guess2='struct dirent' ;;
12442 esac
12443
12444 if $contains "$guess1" try.c >/dev/null 2>&1; then
12445         direntrytype="$guess1"
12446         echo "Your directory entries are $direntrytype." >&4
12447 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12448         direntrytype="$guess2"
12449         echo "Your directory entries seem to be $direntrytype." >&4
12450 else
12451         echo "I don't recognize your system's directory entries." >&4
12452         rp="What type is used for directory entries on this system?"
12453         dflt="$guess1"
12454         . ./myread
12455         direntrytype="$ans"
12456 fi
12457 $rm_try
12458
12459 : see if the directory entry stores field length
12460 echo " "
12461 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12462 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12463         echo "Good, your directory entry keeps length information in d_namlen." >&4
12464         val="$define"
12465 else
12466         echo "Your directory entry does not know about the d_namlen field." >&4
12467         val="$undef"
12468 fi
12469 set d_dirnamlen
12470 eval $setvar
12471 $rm_try
12472
12473 : Look for DIR.dd_fd
12474 case "$i_dirent" in
12475 "$define")
12476     echo "Checking to see if DIR has a dd_fd member variable" >&4
12477     $cat >try.c <<EOCP
12478 #$i_stdlib I_STDLIB
12479 #ifdef I_STDLIB
12480 #include <stdlib.h>
12481 #endif
12482 #include <dirent.h>
12483
12484 int main() {
12485     DIR dir;
12486     dir.dd_fd = 1;
12487     return 0;
12488 }
12489 EOCP
12490     val=$undef
12491     set try
12492     if eval $compile; then
12493         echo "Yes, it does."
12494         val="$define"
12495     else
12496         echo "No, it does not."
12497         val="$undef"
12498     fi
12499     ;;
12500 *)
12501     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12502     val="$undef"
12503     ;;
12504 esac
12505 set d_dir_dd_fd
12506 eval $setvar
12507 $rm_try
12508
12509 : see if this is an sysdir system
12510 set sys/dir.h i_sysdir
12511 eval $inhdr
12512
12513 : see if this is an sysndir system
12514 set sys/ndir.h i_sysndir
12515 eval $inhdr
12516
12517 : Look for dirfd
12518 echo " "
12519 $cat >dirfd.c <<EOM
12520 #include <stdio.h>
12521 #$i_stdlib I_STDLIB
12522 #ifdef I_STDLIB
12523 #include <stdlib.h>
12524 #endif
12525 #$i_dirent I_DIRENT             /**/
12526 #$i_sysdir I_SYS_DIR            /**/
12527 #$i_sysndir I_SYS_NDIR          /**/
12528 #$i_systypes I_SYS_TYPES        /**/
12529 #if defined(I_SYS_TYPES)
12530 #include <sys/types.h>
12531 #endif
12532 #if defined(I_DIRENT)
12533 #include <dirent.h>
12534 #else
12535 #ifdef I_SYS_NDIR
12536 #include <sys/ndir.h>
12537 #else
12538 #ifdef I_SYS_DIR
12539 #ifdef hp9000s500
12540 #include <ndir.h>       /* may be wrong in the future */
12541 #else
12542 #include <sys/dir.h>
12543 #endif
12544 #endif
12545 #endif
12546 #endif
12547 int main() {
12548         DIR *dirp = opendir(".");
12549         if (dirfd(dirp) >= 0)
12550                 exit(0);
12551         else
12552                 exit(1);
12553 }
12554 EOM
12555 val=$undef
12556 set dirfd
12557 if eval $compile; then
12558         val="$define"
12559 fi
12560 case "$val" in
12561 $define)        echo "dirfd() found." >&4       ;;
12562 *)              echo "dirfd() NOT found." >&4   ;;
12563 esac
12564 set d_dirfd
12565 eval $setvar
12566 $rm -f dirfd*
12567
12568 : see if dladdr exists
12569 set dladdr d_dladdr
12570 eval $inlibc
12571
12572 : see if dlerror exists
12573 xxx_runnm="$runnm"
12574 runnm=false
12575 set dlerror d_dlerror
12576 eval $inlibc
12577 runnm="$xxx_runnm"
12578
12579 : see if dlfcn is available
12580 set dlfcn.h i_dlfcn
12581 eval $inhdr
12582
12583 : Check what extension to use for shared libs
12584 case "$usedl" in
12585 $define|y|true)
12586         $cat << EOM
12587
12588 On a few systems, the dynamically loaded modules that perl generates and uses
12589 will need a different extension than shared libs. The default will probably
12590 be appropriate.
12591
12592 EOM
12593         case "$dlext" in
12594         '')     dflt="$so" ;;
12595         *)      dflt="$dlext" ;;
12596         esac
12597         rp='What is the extension of dynamically loaded modules'
12598         . ./myread
12599         dlext="$ans"
12600         ;;
12601 *)
12602         dlext="none"
12603         ;;
12604 esac
12605
12606 : Check if dlsym need a leading underscore
12607 echo " "
12608 val="$undef"
12609
12610 case "$dlsrc" in
12611 dl_dlopen.xs)
12612         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12613         $cat >dyna.c <<'EOM'
12614 fred () { }
12615 EOM
12616
12617 $cat >fred.c<<EOM
12618
12619 #include <stdio.h>
12620 #$i_stdlib I_STDLIB
12621 #ifdef I_STDLIB
12622 #include <stdlib.h>
12623 #endif
12624 #$i_dlfcn I_DLFCN
12625 #ifdef I_DLFCN
12626 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12627 #else
12628 #include <sys/types.h>
12629 #include <nlist.h>
12630 #include <link.h>
12631 #endif
12632
12633 extern int fred() ;
12634
12635 int main()
12636 {
12637     void * handle ;
12638     void * symbol ;
12639 #ifndef RTLD_LAZY
12640     int mode = 1 ;
12641 #else
12642     int mode = RTLD_LAZY ;
12643 #endif
12644     handle = dlopen("./dyna.$dlext", mode) ;
12645     if (handle == NULL) {
12646         printf ("1\n") ;
12647         fflush (stdout) ;
12648         exit(0);
12649     }
12650     symbol = dlsym(handle, "fred") ;
12651     if (symbol == NULL) {
12652         /* try putting a leading underscore */
12653         symbol = dlsym(handle, "_fred") ;
12654         if (symbol == NULL) {
12655             printf ("2\n") ;
12656             fflush (stdout) ;
12657             exit(0);
12658         }
12659         printf ("3\n") ;
12660     }
12661     else
12662         printf ("4\n") ;
12663     fflush (stdout) ;
12664     exit(0);
12665 }
12666 EOM
12667         : Call the object file tmp-dyna.o in case dlext=o.
12668         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12669                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12670                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12671                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12672                 xxx=`$run ./fred`
12673                 case $xxx in
12674                 1)      echo "Test program failed using dlopen." >&4
12675                         echo "Perhaps you should not use dynamic loading." >&4;;
12676                 2)      echo "Test program failed using dlsym." >&4
12677                         echo "Perhaps you should not use dynamic loading." >&4;;
12678                 3)      echo "dlsym needs a leading underscore" >&4
12679                         val="$define" ;;
12680                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12681                 esac
12682         else
12683                 echo "I can't compile and run the test program." >&4
12684                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12685         fi
12686         ;;
12687 esac
12688
12689 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12690
12691 set d_dlsymun
12692 eval $setvar
12693
12694 : see if drand48_r exists
12695 set drand48_r d_drand48_r
12696 eval $inlibc
12697 case "$d_drand48_r" in
12698 "$define")
12699         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12700         case "$d_drand48_r_proto:$usethreads" in
12701         ":define")      d_drand48_r_proto=define
12702                 set d_drand48_r_proto drand48_r $hdrs
12703                 eval $hasproto ;;
12704         *)      ;;
12705         esac
12706         case "$d_drand48_r_proto" in
12707         define)
12708         case "$drand48_r_proto" in
12709         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12710         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12711         esac
12712         case "$drand48_r_proto" in
12713         ''|0)   d_drand48_r=undef
12714                 drand48_r_proto=0
12715                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12716         * )     case "$drand48_r_proto" in
12717                 REENTRANT_PROTO*) ;;
12718                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12719                 esac
12720                 echo "Prototype: $try" ;;
12721         esac
12722         ;;
12723         *)      case "$usethreads" in
12724                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12725                 esac
12726                 d_drand48_r=undef
12727                 drand48_r_proto=0
12728                 ;;
12729         esac
12730         ;;
12731 *)      drand48_r_proto=0
12732         ;;
12733 esac
12734
12735 : see if prototype for drand48 is available
12736 echo " "
12737 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12738 eval $hasproto
12739
12740 : see if dup2 exists
12741 set dup2 d_dup2
12742 eval $inlibc
12743
12744 : see if eaccess exists
12745 set eaccess d_eaccess
12746 eval $inlibc
12747
12748 : see if endgrent exists
12749 set endgrent d_endgrent
12750 eval $inlibc
12751
12752 : see if this is an grp system
12753 set grp.h i_grp
12754 eval $inhdr
12755
12756 case "$i_grp" in
12757 $define)
12758         xxx=`./findhdr grp.h`
12759         $cppstdin $cppflags $cppminus < $xxx >$$.h
12760
12761         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12762                 val="$define"
12763         else
12764                 val="$undef"
12765         fi
12766         set d_grpasswd
12767         eval $setvar
12768
12769         $rm -f $$.h
12770         ;;
12771 *)
12772         val="$undef";
12773         set d_grpasswd; eval $setvar
12774         ;;
12775 esac
12776
12777 : see if endgrent_r exists
12778 set endgrent_r d_endgrent_r
12779 eval $inlibc
12780 case "$d_endgrent_r" in
12781 "$define")
12782         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12783         case "$d_endgrent_r_proto:$usethreads" in
12784         ":define")      d_endgrent_r_proto=define
12785                 set d_endgrent_r_proto endgrent_r $hdrs
12786                 eval $hasproto ;;
12787         *)      ;;
12788         esac
12789         case "$d_endgrent_r_proto" in
12790         define)
12791         case "$endgrent_r_proto" in
12792         ''|0) try='int endgrent_r(FILE**);'
12793         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12794         esac
12795         case "$endgrent_r_proto" in
12796         ''|0) try='void endgrent_r(FILE**);'
12797         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12798         esac
12799         case "$endgrent_r_proto" in
12800         ''|0)   d_endgrent_r=undef
12801                 endgrent_r_proto=0
12802                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12803         * )     case "$endgrent_r_proto" in
12804                 REENTRANT_PROTO*) ;;
12805                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12806                 esac
12807                 echo "Prototype: $try" ;;
12808         esac
12809         ;;
12810         *)      case "$usethreads" in
12811                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12812                 esac
12813                 d_endgrent_r=undef
12814                 endgrent_r_proto=0
12815                 ;;
12816         esac
12817         ;;
12818 *)      endgrent_r_proto=0
12819         ;;
12820 esac
12821
12822 : see if endhostent exists
12823 set endhostent d_endhent
12824 eval $inlibc
12825
12826 : see if this is a netdb.h system
12827 set netdb.h i_netdb
12828 eval $inhdr
12829
12830 : see if endhostent_r exists
12831 set endhostent_r d_endhostent_r
12832 eval $inlibc
12833 case "$d_endhostent_r" in
12834 "$define")
12835         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12836         case "$d_endhostent_r_proto:$usethreads" in
12837         ":define")      d_endhostent_r_proto=define
12838                 set d_endhostent_r_proto endhostent_r $hdrs
12839                 eval $hasproto ;;
12840         *)      ;;
12841         esac
12842         case "$d_endhostent_r_proto" in
12843         define)
12844         case "$endhostent_r_proto" in
12845         ''|0) try='int endhostent_r(struct hostent_data*);'
12846         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12847         esac
12848         case "$endhostent_r_proto" in
12849         ''|0) try='void endhostent_r(struct hostent_data*);'
12850         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12851         esac
12852         case "$endhostent_r_proto" in
12853         ''|0)   d_endhostent_r=undef
12854                 endhostent_r_proto=0
12855                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12856         * )     case "$endhostent_r_proto" in
12857                 REENTRANT_PROTO*) ;;
12858                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12859                 esac
12860                 echo "Prototype: $try" ;;
12861         esac
12862         ;;
12863         *)      case "$usethreads" in
12864                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12865                 esac
12866                 d_endhostent_r=undef
12867                 endhostent_r_proto=0
12868                 ;;
12869         esac
12870         ;;
12871 *)      endhostent_r_proto=0
12872         ;;
12873 esac
12874
12875 : see if endnetent exists
12876 set endnetent d_endnent
12877 eval $inlibc
12878
12879 : see if endnetent_r exists
12880 set endnetent_r d_endnetent_r
12881 eval $inlibc
12882 case "$d_endnetent_r" in
12883 "$define")
12884         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12885         case "$d_endnetent_r_proto:$usethreads" in
12886         ":define")      d_endnetent_r_proto=define
12887                 set d_endnetent_r_proto endnetent_r $hdrs
12888                 eval $hasproto ;;
12889         *)      ;;
12890         esac
12891         case "$d_endnetent_r_proto" in
12892         define)
12893         case "$endnetent_r_proto" in
12894         ''|0) try='int endnetent_r(struct netent_data*);'
12895         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12896         esac
12897         case "$endnetent_r_proto" in
12898         ''|0) try='void endnetent_r(struct netent_data*);'
12899         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12900         esac
12901         case "$endnetent_r_proto" in
12902         ''|0)   d_endnetent_r=undef
12903                 endnetent_r_proto=0
12904                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12905         * )     case "$endnetent_r_proto" in
12906                 REENTRANT_PROTO*) ;;
12907                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12908                 esac
12909                 echo "Prototype: $try" ;;
12910         esac
12911         ;;
12912         *)      case "$usethreads" in
12913                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12914                 esac
12915                 d_endnetent_r=undef
12916                 endnetent_r_proto=0
12917                 ;;
12918         esac
12919         ;;
12920 *)      endnetent_r_proto=0
12921         ;;
12922 esac
12923
12924 : see if endprotoent exists
12925 set endprotoent d_endpent
12926 eval $inlibc
12927
12928 : see if endprotoent_r exists
12929 set endprotoent_r d_endprotoent_r
12930 eval $inlibc
12931 case "$d_endprotoent_r" in
12932 "$define")
12933         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12934         case "$d_endprotoent_r_proto:$usethreads" in
12935         ":define")      d_endprotoent_r_proto=define
12936                 set d_endprotoent_r_proto endprotoent_r $hdrs
12937                 eval $hasproto ;;
12938         *)      ;;
12939         esac
12940         case "$d_endprotoent_r_proto" in
12941         define)
12942         case "$endprotoent_r_proto" in
12943         ''|0) try='int endprotoent_r(struct protoent_data*);'
12944         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12945         esac
12946         case "$endprotoent_r_proto" in
12947         ''|0) try='void endprotoent_r(struct protoent_data*);'
12948         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12949         esac
12950         case "$endprotoent_r_proto" in
12951         ''|0)   d_endprotoent_r=undef
12952                 endprotoent_r_proto=0
12953                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12954         * )     case "$endprotoent_r_proto" in
12955                 REENTRANT_PROTO*) ;;
12956                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12957                 esac
12958                 echo "Prototype: $try" ;;
12959         esac
12960         ;;
12961         *)      case "$usethreads" in
12962                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12963                 esac
12964                 d_endprotoent_r=undef
12965                 endprotoent_r_proto=0
12966                 ;;
12967         esac
12968         ;;
12969 *)      endprotoent_r_proto=0
12970         ;;
12971 esac
12972
12973 : see if endpwent exists
12974 set endpwent d_endpwent
12975 eval $inlibc
12976
12977 : see if this is a pwd.h system
12978 set pwd.h i_pwd
12979 eval $inhdr
12980
12981 case "$i_pwd" in
12982 $define)
12983         xxx=`./findhdr pwd.h`
12984         $cppstdin $cppflags $cppminus < $xxx >$$.h
12985
12986         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12987                 val="$define"
12988         else
12989                 val="$undef"
12990         fi
12991         set d_pwquota
12992         eval $setvar
12993
12994         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12995                 val="$define"
12996         else
12997                 val="$undef"
12998         fi
12999         set d_pwage
13000         eval $setvar
13001
13002         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13003                 val="$define"
13004         else
13005                 val="$undef"
13006         fi
13007         set d_pwchange
13008         eval $setvar
13009
13010         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13011                 val="$define"
13012         else
13013                 val="$undef"
13014         fi
13015         set d_pwclass
13016         eval $setvar
13017
13018         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13019                 val="$define"
13020         else
13021                 val="$undef"
13022         fi
13023         set d_pwexpire
13024         eval $setvar
13025
13026         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13027                 val="$define"
13028         else
13029                 val="$undef"
13030         fi
13031         set d_pwcomment
13032         eval $setvar
13033
13034         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13035                 val="$define"
13036         else
13037                 val="$undef"
13038         fi
13039         set d_pwgecos
13040         eval $setvar
13041
13042         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13043                 val="$define"
13044         else
13045                 val="$undef"
13046         fi
13047         set d_pwpasswd
13048         eval $setvar
13049
13050         $rm -f $$.h
13051         ;;
13052 *)
13053         val="$undef";
13054         set d_pwquota; eval $setvar
13055         set d_pwage; eval $setvar
13056         set d_pwchange; eval $setvar
13057         set d_pwclass; eval $setvar
13058         set d_pwexpire; eval $setvar
13059         set d_pwcomment; eval $setvar
13060         set d_pwgecos; eval $setvar
13061         set d_pwpasswd; eval $setvar
13062         ;;
13063 esac
13064
13065 : see if endpwent_r exists
13066 set endpwent_r d_endpwent_r
13067 eval $inlibc
13068 case "$d_endpwent_r" in
13069 "$define")
13070         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13071         case "$d_endpwent_r_proto:$usethreads" in
13072         ":define")      d_endpwent_r_proto=define
13073                 set d_endpwent_r_proto endpwent_r $hdrs
13074                 eval $hasproto ;;
13075         *)      ;;
13076         esac
13077         case "$d_endpwent_r_proto" in
13078         define)
13079         case "$endpwent_r_proto" in
13080         ''|0) try='int endpwent_r(FILE**);'
13081         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13082         esac
13083         case "$endpwent_r_proto" in
13084         ''|0) try='void endpwent_r(FILE**);'
13085         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13086         esac
13087         case "$endpwent_r_proto" in
13088         ''|0)   d_endpwent_r=undef
13089                 endpwent_r_proto=0
13090                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13091         * )     case "$endpwent_r_proto" in
13092                 REENTRANT_PROTO*) ;;
13093                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13094                 esac
13095                 echo "Prototype: $try" ;;
13096         esac
13097         ;;
13098         *)      case "$usethreads" in
13099                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13100                 esac
13101                 d_endpwent_r=undef
13102                 endpwent_r_proto=0
13103                 ;;
13104         esac
13105         ;;
13106 *)      endpwent_r_proto=0
13107         ;;
13108 esac
13109
13110 : see if endservent exists
13111 set endservent d_endsent
13112 eval $inlibc
13113
13114 : see if endservent_r exists
13115 set endservent_r d_endservent_r
13116 eval $inlibc
13117 case "$d_endservent_r" in
13118 "$define")
13119         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13120         case "$d_endservent_r_proto:$usethreads" in
13121         ":define")      d_endservent_r_proto=define
13122                 set d_endservent_r_proto endservent_r $hdrs
13123                 eval $hasproto ;;
13124         *)      ;;
13125         esac
13126         case "$d_endservent_r_proto" in
13127         define)
13128         case "$endservent_r_proto" in
13129         ''|0) try='int endservent_r(struct servent_data*);'
13130         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13131         esac
13132         case "$endservent_r_proto" in
13133         ''|0) try='void endservent_r(struct servent_data*);'
13134         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13135         esac
13136         case "$endservent_r_proto" in
13137         ''|0)   d_endservent_r=undef
13138                 endservent_r_proto=0
13139                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13140         * )     case "$endservent_r_proto" in
13141                 REENTRANT_PROTO*) ;;
13142                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13143                 esac
13144                 echo "Prototype: $try" ;;
13145         esac
13146         ;;
13147         *)      case "$usethreads" in
13148                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13149                 esac
13150                 d_endservent_r=undef
13151                 endservent_r_proto=0
13152                 ;;
13153         esac
13154         ;;
13155 *)      endservent_r_proto=0
13156         ;;
13157 esac
13158
13159 : Locate the flags for 'open()'
13160 echo " "
13161 $cat >try.c <<EOCP
13162 #include <sys/types.h>
13163 #ifdef I_FCNTL
13164 #include <fcntl.h>
13165 #endif
13166 #ifdef I_SYS_FILE
13167 #include <sys/file.h>
13168 #endif
13169 #$i_stdlib I_STDLIB
13170 #ifdef I_STDLIB
13171 #include <stdlib.h>
13172 #endif
13173 int main() {
13174         if(O_RDONLY);
13175 #ifdef O_TRUNC
13176         exit(0);
13177 #else
13178         exit(1);
13179 #endif
13180 }
13181 EOCP
13182 : check sys/file.h first to get FREAD on Sun
13183 if $test `./findhdr sys/file.h` && \
13184                 set try -DI_SYS_FILE && eval $compile; then
13185         h_sysfile=true;
13186         echo "<sys/file.h> defines the O_* constants..." >&4
13187         if $run ./try; then
13188                 echo "and you have the 3 argument form of open()." >&4
13189                 val="$define"
13190         else
13191                 echo "but not the 3 argument form of open().  Oh, well." >&4
13192                 val="$undef"
13193         fi
13194 elif $test `./findhdr fcntl.h` && \
13195                 set try -DI_FCNTL && eval $compile; then
13196         h_fcntl=true;
13197         echo "<fcntl.h> defines the O_* constants..." >&4
13198         if $run ./try; then
13199                 echo "and you have the 3 argument form of open()." >&4
13200                 val="$define"
13201         else
13202                 echo "but not the 3 argument form of open().  Oh, well." >&4
13203                 val="$undef"
13204         fi
13205 else
13206         val="$undef"
13207         echo "I can't find the O_* constant definitions!  You got problems." >&4
13208 fi
13209 set d_open3
13210 eval $setvar
13211 $rm_try
13212
13213 : see if this is a sys/file.h system
13214 val=''
13215 set sys/file.h val
13216 eval $inhdr
13217
13218 : do we need to include sys/file.h ?
13219 case "$val" in
13220 "$define")
13221         echo " "
13222         if $h_sysfile; then
13223                 val="$define"
13224                 echo "We'll be including <sys/file.h>." >&4
13225         else
13226                 val="$undef"
13227                 echo "We won't be including <sys/file.h>." >&4
13228         fi
13229         ;;
13230 *)
13231         h_sysfile=false
13232         ;;
13233 esac
13234 set i_sysfile
13235 eval $setvar
13236
13237 : see if fcntl.h is there
13238 val=''
13239 set fcntl.h val
13240 eval $inhdr
13241
13242 : see if we can include fcntl.h
13243 case "$val" in
13244 "$define")
13245         echo " "
13246         if $h_fcntl; then
13247                 val="$define"
13248                 echo "We'll be including <fcntl.h>." >&4
13249         else
13250                 val="$undef"
13251                 if $h_sysfile; then
13252         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13253                 else
13254                         echo "We won't be including <fcntl.h>." >&4
13255                 fi
13256         fi
13257         ;;
13258 *)
13259         h_fcntl=false
13260         val="$undef"
13261         ;;
13262 esac
13263 set i_fcntl
13264 eval $setvar
13265
13266 : see if fork exists
13267 set fork d_fork
13268 eval $inlibc
13269
13270 : see if pipe exists
13271 set pipe d_pipe
13272 eval $inlibc
13273
13274 : check for non-blocking I/O stuff
13275 case "$h_sysfile" in
13276 true) echo "#include <sys/file.h>" > head.c;;
13277 *)
13278        case "$h_fcntl" in
13279        true) echo "#include <fcntl.h>" > head.c;;
13280        *) echo "#include <sys/fcntl.h>" > head.c;;
13281        esac
13282        ;;
13283 esac
13284 echo " "
13285 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13286 case "$o_nonblock" in
13287 '')
13288         $cat head.c > try.c
13289         $cat >>try.c <<EOCP
13290 #include <stdio.h>
13291 #$i_stdlib I_STDLIB
13292 #ifdef I_STDLIB
13293 #include <stdlib.h>
13294 #endif
13295 #$i_fcntl I_FCNTL
13296 #ifdef I_FCNTL
13297 #include <fcntl.h>
13298 #endif
13299 int main() {
13300 #ifdef O_NONBLOCK
13301         printf("O_NONBLOCK\n");
13302         exit(0);
13303 #endif
13304 #ifdef O_NDELAY
13305         printf("O_NDELAY\n");
13306         exit(0);
13307 #endif
13308 #ifdef FNDELAY
13309         printf("FNDELAY\n");
13310         exit(0);
13311 #endif
13312         exit(0);
13313 }
13314 EOCP
13315         set try
13316         if eval $compile_ok; then
13317                 o_nonblock=`$run ./try`
13318                 case "$o_nonblock" in
13319                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13320                 *) echo "Seems like we can use $o_nonblock.";;
13321                 esac
13322         else
13323                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13324         fi
13325         ;;
13326 *) echo "Using $hint value $o_nonblock.";;
13327 esac
13328 $rm_try
13329
13330 echo " "
13331 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13332 case "$eagain" in
13333 '')
13334         case "$d_fork:$d_pipe:$d_alarm" in
13335         define:define:define)
13336         $cat head.c > try.c
13337         $cat >>try.c <<EOCP
13338 #include <errno.h>
13339 #include <sys/types.h>
13340 #include <signal.h>
13341 #include <stdio.h>
13342 #$i_stdlib I_STDLIB
13343 #ifdef I_STDLIB
13344 #include <stdlib.h>
13345 #endif
13346 #$i_fcntl I_FCNTL
13347 #ifdef I_FCNTL
13348 #include <fcntl.h>
13349 #endif
13350 #define MY_O_NONBLOCK $o_nonblock
13351 #ifndef errno  /* XXX need better Configure test */
13352 extern int errno;
13353 #endif
13354 #$i_unistd I_UNISTD
13355 #ifdef I_UNISTD
13356 #include <unistd.h>
13357 #endif
13358 #$i_string I_STRING
13359 #ifdef I_STRING
13360 #include <string.h>
13361 #else
13362 #include <strings.h>
13363 #endif
13364 $signal_t blech(int x) { exit(3); }
13365 EOCP
13366         $cat >> try.c <<'EOCP'
13367 int main()
13368 {
13369         int pd[2];
13370         int pu[2];
13371         char buf[1];
13372         char string[100];
13373         int ret;
13374
13375         ret = pipe(pd); /* Down: child -> parent */
13376         if (ret != 0)
13377                 exit(3);
13378         ret = pipe(pu); /* Up: parent -> child */
13379         if (ret != 0)
13380                 exit(3);
13381         if (0 != fork()) {
13382                 close(pd[1]);   /* Parent reads from pd[0] */
13383                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13384 #ifdef F_SETFL
13385                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13386                         exit(1);
13387 #else
13388                 exit(4);
13389 #endif
13390                 signal(SIGALRM, blech);
13391                 alarm(5);
13392                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13393                         exit(2);
13394                 sprintf(string, "%d\n", ret);
13395                 ret = write(2, string, strlen(string));
13396                 if (ret != strlen(string))
13397                         exit(3);
13398                 alarm(0);
13399 #ifdef EAGAIN
13400                 if (errno == EAGAIN) {
13401                         printf("EAGAIN\n");
13402                         goto ok;
13403                 }
13404 #endif
13405 #ifdef EWOULDBLOCK
13406                 if (errno == EWOULDBLOCK)
13407                         printf("EWOULDBLOCK\n");
13408 #endif
13409         ok:
13410                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13411                 if (ret != 1)
13412                         exit(3);
13413                 sleep(2);                               /* Give it time to close our pipe */
13414                 alarm(5);
13415                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13416                 alarm(0);
13417                 sprintf(string, "%d\n", ret);
13418                 ret = write(4, string, strlen(string));
13419                 if (ret != strlen(string))
13420                         exit(3);
13421                 exit(0);
13422         }
13423
13424         close(pd[0]);                   /* We write to pd[1] */
13425         close(pu[1]);                   /* We read from pu[0] */
13426         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13427         if (ret != 1)
13428                 exit(3);
13429         close(pd[1]);                   /* Pipe pd is now fully closed! */
13430         exit(0);                                /* Bye bye, thank you for playing! */
13431 }
13432 EOCP
13433         set try
13434         if eval $compile_ok; then
13435                 echo "$startsh" >mtry
13436                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13437                 chmod +x mtry
13438                 $run ./mtry >/dev/null 2>&1
13439                 case $? in
13440                 0) eagain=`$cat try.out`;;
13441                 1) echo "Could not perform non-blocking setting!";;
13442                 2) echo "I did a successful read() for something that was not there!";;
13443                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13444                 4) echo "Could not find F_SETFL!";;
13445                 *) echo "Something terribly wrong happened during testing.";;
13446                 esac
13447                 rd_nodata=`$cat try.ret`
13448                 echo "A read() system call with no data present returns $rd_nodata."
13449                 case "$rd_nodata" in
13450                 0|-1) ;;
13451                 *)
13452                         echo "(That's peculiar, fixing that to be -1.)"
13453                         rd_nodata=-1
13454                         ;;
13455                 esac
13456                 case "$eagain" in
13457                 '')
13458                         echo "Forcing errno EAGAIN on read() with no data available."
13459                         eagain=EAGAIN
13460                         ;;
13461                 *)
13462                         echo "Your read() sets errno to $eagain when no data is available."
13463                         ;;
13464                 esac
13465                 status=`$cat try.err`
13466                 case "$status" in
13467                 0) echo "And it correctly returns 0 to signal EOF.";;
13468                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13469                 *) echo "However, your read() returns '$status' on EOF??";;
13470                 esac
13471                 val="$define"
13472                 if test "$status" = "$rd_nodata"; then
13473                         echo "WARNING: you can't distinguish between EOF and no data!"
13474                         val="$undef"
13475                 fi
13476         else
13477                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13478                 eagain=EAGAIN
13479         fi
13480         ;;
13481         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13482                 eagain=EAGAIN
13483                 val="$define"
13484                 ;;
13485         esac
13486         set d_eofnblk
13487         eval $setvar
13488         ;;
13489 *)
13490         echo "Using $hint value $eagain."
13491         echo "Your read() returns $rd_nodata when no data is present."
13492         case "$d_eofnblk" in
13493         "$define") echo "And you can see EOF because read() returns 0.";;
13494         "$undef") echo "But you can't see EOF status from read() returned value.";;
13495         *)
13496                 echo "(Assuming you can't see EOF status from read anyway.)"
13497                 d_eofnblk=$undef
13498                 ;;
13499         esac
13500         ;;
13501 esac
13502 $rm_try head.c mtry
13503
13504 : see if erf exists
13505 set erf d_erf
13506 eval $inlibc
13507
13508 : see if erfc exists
13509 set erfc d_erfc
13510 eval $inlibc
13511
13512 : see if exp2 exists
13513 set exp2 d_exp2
13514 eval $inlibc
13515
13516 : see if expm1 exists
13517 set expm1 d_expm1
13518 eval $inlibc
13519
13520 : see if _ptr and _cnt from stdio act std
13521 echo " "
13522
13523 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13524         echo "(Looks like you have stdio.h from BSD.)"
13525         case "$stdio_ptr" in
13526         '') stdio_ptr='((fp)->_p)'
13527                 ptr_lval=$define
13528                 ;;
13529         *)      ptr_lval=$d_stdio_ptr_lval;;
13530         esac
13531         case "$stdio_cnt" in
13532         '') stdio_cnt='((fp)->_r)'
13533                 cnt_lval=$define
13534                 ;;
13535         *)      cnt_lval=$d_stdio_cnt_lval;;
13536         esac
13537         case "$stdio_base" in
13538         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13539         esac
13540         case "$stdio_bufsiz" in
13541         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13542         esac
13543 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13544         echo "(Looks like you have stdio.h from Linux.)"
13545         case "$stdio_ptr" in
13546         '') stdio_ptr='((fp)->_IO_read_ptr)'
13547                 ptr_lval=$define
13548                 ;;
13549         *)      ptr_lval=$d_stdio_ptr_lval;;
13550         esac
13551         case "$stdio_cnt" in
13552         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13553                 cnt_lval=$undef
13554                 ;;
13555         *)      cnt_lval=$d_stdio_cnt_lval;;
13556         esac
13557         case "$stdio_base" in
13558         '') stdio_base='((fp)->_IO_read_base)';;
13559         esac
13560         case "$stdio_bufsiz" in
13561         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13562         esac
13563 else
13564         case "$stdio_ptr" in
13565         '') stdio_ptr='((fp)->_ptr)'
13566                 ptr_lval=$define
13567                 ;;
13568         *)      ptr_lval=$d_stdio_ptr_lval;;
13569         esac
13570         case "$stdio_cnt" in
13571         '') stdio_cnt='((fp)->_cnt)'
13572                 cnt_lval=$define
13573                 ;;
13574         *)      cnt_lval=$d_stdio_cnt_lval;;
13575         esac
13576         case "$stdio_base" in
13577         '') stdio_base='((fp)->_base)';;
13578         esac
13579         case "$stdio_bufsiz" in
13580         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13581         esac
13582 fi
13583
13584 : test whether _ptr and _cnt really work
13585 echo "Checking how std your stdio is..." >&4
13586 $cat >try.c <<EOP
13587 #include <stdio.h>
13588 #$i_stdlib I_STDLIB
13589 #ifdef I_STDLIB
13590 #include <stdlib.h>
13591 #endif
13592 #define FILE_ptr(fp)    $stdio_ptr
13593 #define FILE_cnt(fp)    $stdio_cnt
13594 int main() {
13595         FILE *fp = fopen("try.c", "r");
13596         char c = getc(fp);
13597         if (
13598                 18 <= FILE_cnt(fp) &&
13599                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13600         )
13601                 exit(0);
13602         exit(1);
13603 }
13604 EOP
13605 val="$undef"
13606 set try
13607 if eval $compile && $to try.c; then
13608         if $run ./try; then
13609                 echo "Your stdio acts pretty std."
13610                 val="$define"
13611         else
13612                 echo "Your stdio isn't very std."
13613         fi
13614 else
13615         echo "Your stdio doesn't appear very std."
13616 fi
13617 $rm_try
13618
13619 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13620 # direct buffer manipulation no longer works.  The Configure tests
13621 # should be changed to correctly detect this, but until then,
13622 # the following check should at least let perl compile and run.
13623 # (This quick fix should be updated before 5.8.1.)
13624 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13625 # A. Dougherty, June 3, 2002.
13626 case "$d_gnulibc" in
13627 $define)
13628         case "$gnulibc_version" in
13629         2.[01]*)  ;;
13630         2.2) ;;
13631         2.2.[0-9]) ;;
13632         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13633                 val="$undef"
13634                 ;;
13635         esac
13636         ;;
13637 esac
13638 set d_stdstdio
13639 eval $setvar
13640
13641 : Can _ptr be used as an lvalue?
13642 case "$d_stdstdio$ptr_lval" in
13643 $define$define) val=$define ;;
13644 *) val=$undef ;;
13645 esac
13646 set d_stdio_ptr_lval
13647 eval $setvar
13648
13649 : Can _cnt be used as an lvalue?
13650 case "$d_stdstdio$cnt_lval" in
13651 $define$define) val=$define ;;
13652 *) val=$undef ;;
13653 esac
13654 set d_stdio_cnt_lval
13655 eval $setvar
13656
13657
13658 : test whether setting _ptr sets _cnt as a side effect
13659 d_stdio_ptr_lval_sets_cnt="$undef"
13660 d_stdio_ptr_lval_nochange_cnt="$undef"
13661 case "$d_stdio_ptr_lval$d_stdstdio" in
13662 $define$define)
13663         echo "Checking to see what happens if we set the stdio ptr..." >&4
13664 $cat >try.c <<EOP
13665 #include <stdio.h>
13666 /* Can we scream? */
13667 /* Eat dust sed :-) */
13668 /* In the buffer space, no one can hear you scream. */
13669 #$i_stdlib I_STDLIB
13670 #ifdef I_STDLIB
13671 #include <stdlib.h>
13672 #endif
13673 #define FILE_ptr(fp)    $stdio_ptr
13674 #define FILE_cnt(fp)    $stdio_cnt
13675 #include <sys/types.h>
13676 int main() {
13677         FILE *fp = fopen("try.c", "r");
13678         int c;
13679         char *ptr;
13680         size_t cnt;
13681         if (!fp) {
13682             puts("Fail even to read");
13683             exit(1);
13684         }
13685         c = getc(fp); /* Read away the first # */
13686         if (c == EOF) {
13687             puts("Fail even to read");
13688             exit(1);
13689         }
13690         if (!(
13691                 18 <= FILE_cnt(fp) &&
13692                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13693         )) {
13694                 puts("Fail even to read");
13695                 exit (1);
13696         }
13697         ptr = (char*) FILE_ptr(fp);
13698         cnt = (size_t)FILE_cnt(fp);
13699
13700         FILE_ptr(fp) += 42;
13701
13702         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13703                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13704                 exit (1);
13705         }
13706         if (FILE_cnt(fp) <= 20) {
13707                 printf ("Fail (<20 chars to test)");
13708                 exit (1);
13709         }
13710         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13711                 puts("Fail compare");
13712                 exit (1);
13713         }
13714         if (cnt == FILE_cnt(fp)) {
13715                 puts("Pass_unchanged");
13716                 exit (0);
13717         }
13718         if (FILE_cnt(fp) == (cnt - 42)) {
13719                 puts("Pass_changed");
13720                 exit (0);
13721         }
13722         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13723         return 1;
13724
13725 }
13726 EOP
13727         set try
13728         if eval $compile && $to try.c; then
13729                 case `$run ./try` in
13730                 Pass_changed)
13731                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13732                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13733                 Pass_unchanged)
13734                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13735                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13736                 Fail*)
13737                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13738                 *)
13739                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13740         esac
13741         else
13742                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13743         fi
13744         $rm_try
13745         ;;
13746 esac
13747
13748 : see if _base is also standard
13749 val="$undef"
13750 case "$d_stdstdio" in
13751 $define)
13752         $cat >try.c <<EOP
13753 #include <stdio.h>
13754 #$i_stdlib I_STDLIB
13755 #ifdef I_STDLIB
13756 #include <stdlib.h>
13757 #endif
13758 #define FILE_base(fp)   $stdio_base
13759 #define FILE_bufsiz(fp) $stdio_bufsiz
13760 int main() {
13761         FILE *fp = fopen("try.c", "r");
13762         char c = getc(fp);
13763         if (
13764                 19 <= FILE_bufsiz(fp) &&
13765                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13766         )
13767                 exit(0);
13768         exit(1);
13769 }
13770 EOP
13771         set try
13772         if eval $compile && $to try.c; then
13773                 if $run ./try; then
13774                         echo "And its _base field acts std."
13775                         val="$define"
13776                 else
13777                         echo "But its _base field isn't std."
13778                 fi
13779         else
13780                 echo "However, it seems to be lacking the _base field."
13781         fi
13782         $rm_try
13783         ;;
13784 esac
13785 set d_stdiobase
13786 eval $setvar
13787
13788 : see if fast_stdio exists
13789 val="$undef"
13790 case "$d_stdstdio:$d_stdio_ptr_lval" in
13791 "$define:$define")
13792         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13793         *$define*)
13794                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13795                 val="$define"
13796                 ;;
13797         esac
13798         ;;
13799 esac
13800 set d_faststdio
13801 eval $setvar
13802
13803
13804
13805 : see if fchdir exists
13806 set fchdir d_fchdir
13807 eval $inlibc
13808
13809 : see if fchmod exists
13810 set fchmod d_fchmod
13811 eval $inlibc
13812
13813 : see if fchown exists
13814 set fchown d_fchown
13815 eval $inlibc
13816
13817 : see if this is an fcntl system
13818 set fcntl d_fcntl
13819 eval $inlibc
13820
13821 : See if fcntl-based locking works.
13822 echo " "
13823 $cat >try.c <<EOCP
13824 #$i_stdlib I_STDLIB
13825 #ifdef I_STDLIB
13826 #include <stdlib.h>
13827 #endif
13828 #include <unistd.h>
13829 #include <fcntl.h>
13830 #include <signal.h>
13831 $signal_t blech(int x) { exit(3); }
13832 int main() {
13833 #if defined(F_SETLK) && defined(F_SETLKW)
13834      struct flock flock;
13835      int retval, fd;
13836      fd = open("try.c", O_RDONLY);
13837      flock.l_type = F_RDLCK;
13838      flock.l_whence = SEEK_SET;
13839      flock.l_start = flock.l_len = 0;
13840      signal(SIGALRM, blech);
13841      alarm(10);
13842      retval = fcntl(fd, F_SETLK, &flock);
13843      close(fd);
13844      (retval < 0 ? exit(2) : exit(0));
13845 #else
13846      exit(2);
13847 #endif
13848 }
13849 EOCP
13850 echo "Checking if fcntl-based file locking works... "
13851 case "$d_fcntl" in
13852 "$define")
13853         set try
13854         if eval $compile_ok; then
13855                 if $run ./try; then
13856                         echo "Yes, it seems to work."
13857                         val="$define"
13858                 else
13859                         echo "Nope, it didn't work."
13860                         val="$undef"
13861                         case "$?" in
13862                         3) $cat >&4 <<EOM
13863 ***
13864 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13865 *** This is (almost) impossible.
13866 *** If your NFS lock daemons are not feeling well, something like
13867 *** this may happen, please investigate.  Cannot continue, aborting.
13868 ***
13869 EOM
13870                                 exit 1
13871                                 ;;
13872                         esac
13873                 fi
13874         else
13875                 echo "I'm unable to compile the test program, so I'll assume not."
13876                 val="$undef"
13877         fi
13878         ;;
13879 *) val="$undef";
13880         echo "Nope, since you don't even have fcntl()."
13881         ;;
13882 esac
13883 set d_fcntl_can_lock
13884 eval $setvar
13885 $rm_try
13886
13887 : check for fd_set items
13888 $cat <<EOM
13889
13890 Checking to see how well your C compiler handles fd_set and friends ...
13891 EOM
13892 $cat >try.c <<EOCP
13893 #$i_stdlib I_STDLIB
13894 #ifdef I_STDLIB
13895 #include <stdlib.h>
13896 #endif
13897 #$i_systime I_SYS_TIME
13898 #$i_sysselct I_SYS_SELECT
13899 #$d_socket HAS_SOCKET
13900 #include <sys/types.h>
13901 #ifdef HAS_SOCKET
13902 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13903 #endif
13904 #ifdef I_SYS_TIME
13905 #include <sys/time.h>
13906 #endif
13907 #ifdef I_SYS_SELECT
13908 #include <sys/select.h>
13909 #endif
13910 int main() {
13911         fd_set fds;
13912
13913 #ifdef TRYBITS
13914         if(fds.fds_bits);
13915 #endif
13916
13917 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13918         exit(0);
13919 #else
13920         exit(1);
13921 #endif
13922 }
13923 EOCP
13924 set try -DTRYBITS
13925 if eval $compile; then
13926         d_fds_bits="$define"
13927         d_fd_set="$define"
13928         echo "Well, your system knows about the normal fd_set typedef..." >&4
13929         if $run ./try; then
13930                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13931                 d_fd_macros="$define"
13932         else
13933                 $cat >&4 <<'EOM'
13934 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13935 EOM
13936                 d_fd_macros="$undef"
13937         fi
13938 else
13939         $cat <<'EOM'
13940 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13941 EOM
13942         set try
13943         if eval $compile; then
13944                 d_fds_bits="$undef"
13945                 d_fd_set="$define"
13946                 echo "Well, your system has some sort of fd_set available..." >&4
13947                 if $run ./try; then
13948                         echo "and you have the normal fd_set macros." >&4
13949                         d_fd_macros="$define"
13950                 else
13951                         $cat <<'EOM'
13952 but not the normal fd_set macros!  Gross!  More work for me...
13953 EOM
13954                         d_fd_macros="$undef"
13955                 fi
13956         else
13957         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13958                 d_fd_set="$undef"
13959                 d_fds_bits="$undef"
13960                 d_fd_macros="$undef"
13961         fi
13962 fi
13963 $rm_try
13964
13965 : see if fdim exists
13966 set fdim d_fdim
13967 eval $inlibc
13968
13969 : see if fegetround exists
13970 set fegetround d_fegetround
13971 eval $inlibc
13972
13973 : see if fgetpos exists
13974 set fgetpos d_fgetpos
13975 eval $inlibc
13976
13977 : see if finite exists
13978 set finite d_finite
13979 eval $inlibc
13980
13981 : see if finitel exists
13982 set finitel d_finitel
13983 eval $inlibc
13984
13985 : see if flock exists
13986 set flock d_flock
13987 eval $inlibc
13988
13989 : see if prototype for flock is available
13990 echo " "
13991 set d_flockproto flock $i_sysfile sys/file.h
13992 eval $hasproto
13993
13994 : see if fma exists
13995 set fma d_fma
13996 eval $inlibc
13997
13998 : see if fmax exists
13999 set fmax d_fmax
14000 eval $inlibc
14001
14002 : see if fmin exists
14003 set fmin d_fmin
14004 eval $inlibc
14005
14006 : see if fp_class exists
14007 set fp_class d_fp_class
14008 eval $inlibc
14009
14010 : see if this is a math.h system
14011 set math.h i_math
14012 eval $inhdr
14013
14014 : check for fpclassify
14015 echo "Checking to see if you have fpclassify..." >&4
14016 $cat >try.c <<EOCP
14017 #$i_math I_MATH
14018 #ifdef I_MATH
14019 #include <math.h>
14020 #endif
14021 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14022 EOCP
14023 set try
14024 if eval $compile; then
14025         val="$define"
14026         echo "You have fpclassify."
14027 else
14028         val="$undef"
14029         echo "You do not have fpclassify."
14030 fi
14031 $rm_try
14032 set d_fpclassify
14033 eval $setvar
14034
14035 : see if fp_classify exists
14036 set fp_classify d_fp_classify
14037 eval $inlibc
14038
14039 : see if fp_classl exists
14040 set fp_classl d_fp_classl
14041 eval $inlibc
14042
14043 : see if pathconf exists
14044 set pathconf d_pathconf
14045 eval $inlibc
14046
14047 : see if fpathconf exists
14048 set fpathconf d_fpathconf
14049 eval $inlibc
14050
14051 : see if fpclass exists
14052 set fpclass d_fpclass
14053 eval $inlibc
14054
14055 : see if fpclassl exists
14056 set fpclassl d_fpclassl
14057 eval $inlibc
14058
14059 : see if fpgetround exists
14060 set fpgetround d_fpgetround
14061 eval $inlibc
14062
14063 : check for fpos64_t
14064 echo " "
14065 echo "Checking to see if you have fpos64_t..." >&4
14066 $cat >try.c <<EOCP
14067 #include <stdio.h>
14068 int main() { fpos64_t x = 7; }
14069 EOCP
14070 set try
14071 if eval $compile; then
14072         val="$define"
14073         echo "You have fpos64_t."
14074 else
14075         val="$undef"
14076         echo "You do not have fpos64_t."
14077         case "$fpossize" in
14078         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14079         esac
14080 fi
14081 $rm_try
14082 set d_fpos64_t
14083 eval $setvar
14084
14085 : see if frexpl exists
14086 set frexpl d_frexpl
14087 eval $inlibc
14088
14089 : see if this is a sys/param system
14090 set sys/param.h i_sysparam
14091 eval $inhdr
14092
14093 : see if this is a sys/mount.h system
14094 set sys/mount.h i_sysmount
14095 eval $inhdr
14096
14097 : Check for fs_data_s
14098 echo " "
14099 echo "Checking to see if your system supports struct fs_data..." >&4
14100 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14101 eval $hasstruct
14102 case "$d_fs_data_s" in
14103 "$define")      echo "Yes, it does."   ;;
14104 *)              echo "No, it doesn't." ;;
14105 esac
14106
14107 : see if fseeko exists
14108 set fseeko d_fseeko
14109 eval $inlibc
14110 case "$longsize" in
14111 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14112 esac
14113
14114 : see if fsetpos exists
14115 set fsetpos d_fsetpos
14116 eval $inlibc
14117
14118 : see if fstatfs exists
14119 set fstatfs d_fstatfs
14120 eval $inlibc
14121
14122 : see if statvfs exists
14123 set statvfs d_statvfs
14124 eval $inlibc
14125
14126 : see if fstatvfs exists
14127 set fstatvfs d_fstatvfs
14128 eval $inlibc
14129
14130
14131 : see if fsync exists
14132 set fsync d_fsync
14133 eval $inlibc
14134
14135 : see if ftello exists
14136 set ftello d_ftello
14137 eval $inlibc
14138 case "$longsize" in
14139 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14140 esac
14141
14142 : check for a working futimes
14143 d_futimes="$undef"
14144 echo " "
14145 echo "Checking if you have a working futimes()" >&4
14146 $cat >try.c <<EOCP
14147 #include <stdio.h>
14148 #include <sys/time.h>
14149 #include <errno.h>
14150 #include <fcntl.h>
14151
14152 int main ()
14153 {
14154     int fd, rv;
14155     fd = open ("try.c", O_RDWR);
14156     if (-1 == fd) exit (1);
14157     rv = futimes (fd, NULL);
14158     exit (rv == -1 ? errno : 0);
14159 }
14160 EOCP
14161 set try
14162 if eval $compile; then
14163     `$run ./try`
14164     rc=$?
14165     case "$rc" in
14166         0)  echo "Yes, you have" >&4
14167             d_futimes="$define"
14168             ;;
14169         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14170             ;;
14171     esac
14172 else
14173     echo "No, it does not (probably harmless)" >&4
14174 fi
14175 $rm_try
14176
14177 : see if ndbm.h is available
14178 set ndbm.h i_ndbm
14179 eval $inhdr
14180 : Compatibility location for RedHat 7.1
14181 set gdbm/ndbm.h i_gdbmndbm
14182 eval $inhdr
14183 : Compatibility location for Debian 4.0
14184 set gdbm-ndbm.h i_gdbm_ndbm
14185 eval $inhdr
14186
14187 val="$undef"
14188 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14189         : see if dbm_open exists
14190         set dbm_open d_dbm_open
14191         eval $inlibc
14192         case "$d_dbm_open" in
14193         $undef)
14194                 i_ndbm="$undef"
14195                 i_gdbmndbm="$undef"
14196                 i_gdbm_ndbm="$undef"
14197                 echo "We won't be including <ndbm.h>"
14198                 val="$undef"
14199                 ;;
14200         *) val="$define"
14201            ;;
14202         esac
14203 fi
14204 set d_ndbm
14205 eval $setvar
14206
14207 ndbm_hdr_protochk='name=$1; hdr=$2;
14208 eval "ihdr=\$""i_$name";
14209 val="$undef";
14210 if $test "$ihdr" = "$define"; then
14211         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14212         case "$d_cplusplus" in
14213         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14214         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14215         esac;
14216         case "$val" in
14217         $define) $echo "Your <$hdr> seems to have prototypes";;
14218         *) $echo "Your <$hdr> does not seem to have prototypes";;
14219         esac;
14220 fi;
14221 set "d_${name}_h_uses_prototypes";
14222 eval $setvar'
14223
14224 set ndbm ndbm.h
14225 eval $ndbm_hdr_protochk
14226 set gdbmndbm gdbm/ndbm.h
14227 eval $ndbm_hdr_protochk
14228 set gdbm_ndbm gdbm-ndbm.h
14229 eval $ndbm_hdr_protochk
14230
14231 : see if getaddrinfo exists
14232 set getaddrinfo d_getaddrinfo
14233 eval $inlibc
14234
14235 : see if getcwd exists
14236 set getcwd d_getcwd
14237 eval $inlibc
14238
14239 : see if getespwnam exists
14240 set getespwnam d_getespwnam
14241 eval $inlibc
14242
14243 : see if getfsstat exists
14244 set getfsstat d_getfsstat
14245 eval $inlibc
14246
14247 : see if getgrent exists
14248 set getgrent d_getgrent
14249 eval $inlibc
14250
14251 : see if getgrent_r exists
14252 set getgrent_r d_getgrent_r
14253 eval $inlibc
14254 case "$d_getgrent_r" in
14255 "$define")
14256         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14257         case "$d_getgrent_r_proto:$usethreads" in
14258         ":define")      d_getgrent_r_proto=define
14259                 set d_getgrent_r_proto getgrent_r $hdrs
14260                 eval $hasproto ;;
14261         *)      ;;
14262         esac
14263         case "$d_getgrent_r_proto" in
14264         define)
14265         case "$getgrent_r_proto" in
14266         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14267         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14268         esac
14269         case "$getgrent_r_proto" in
14270         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14271         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14272         esac
14273         case "$getgrent_r_proto" in
14274         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14275         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14276         esac
14277         case "$getgrent_r_proto" in
14278         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14279         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14280         esac
14281         case "$getgrent_r_proto" in
14282         ''|0) try='int getgrent_r(struct group*, char*, int);'
14283         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14284         esac
14285         case "$getgrent_r_proto" in
14286         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14287         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14288         esac
14289         case "$getgrent_r_proto" in
14290         ''|0)   d_getgrent_r=undef
14291                 getgrent_r_proto=0
14292                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14293         * )     case "$getgrent_r_proto" in
14294                 REENTRANT_PROTO*) ;;
14295                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14296                 esac
14297                 echo "Prototype: $try" ;;
14298         esac
14299         ;;
14300         *)      case "$usethreads" in
14301                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14302                 esac
14303                 d_getgrent_r=undef
14304                 getgrent_r_proto=0
14305                 ;;
14306         esac
14307         ;;
14308 *)      getgrent_r_proto=0
14309         ;;
14310 esac
14311
14312 : see if getgrgid_r exists
14313 set getgrgid_r d_getgrgid_r
14314 eval $inlibc
14315 case "$d_getgrgid_r" in
14316 "$define")
14317         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14318         case "$d_getgrgid_r_proto:$usethreads" in
14319         ":define")      d_getgrgid_r_proto=define
14320                 set d_getgrgid_r_proto getgrgid_r $hdrs
14321                 eval $hasproto ;;
14322         *)      ;;
14323         esac
14324         case "$d_getgrgid_r_proto" in
14325         define)
14326         case "$getgrgid_r_proto" in
14327         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14328         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14329         esac
14330         case "$getgrgid_r_proto" in
14331         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14332         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14333         esac
14334         case "$getgrgid_r_proto" in
14335         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14336         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14337         esac
14338         case "$getgrgid_r_proto" in
14339         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14340         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14341         esac
14342         case "$getgrgid_r_proto" in
14343         ''|0)   d_getgrgid_r=undef
14344                 getgrgid_r_proto=0
14345                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14346         * )     case "$getgrgid_r_proto" in
14347                 REENTRANT_PROTO*) ;;
14348                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14349                 esac
14350                 echo "Prototype: $try" ;;
14351         esac
14352         ;;
14353         *)      case "$usethreads" in
14354                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14355                 esac
14356                 d_getgrgid_r=undef
14357                 getgrgid_r_proto=0
14358                 ;;
14359         esac
14360         ;;
14361 *)      getgrgid_r_proto=0
14362         ;;
14363 esac
14364
14365 : see if getgrnam_r exists
14366 set getgrnam_r d_getgrnam_r
14367 eval $inlibc
14368 case "$d_getgrnam_r" in
14369 "$define")
14370         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14371         case "$d_getgrnam_r_proto:$usethreads" in
14372         ":define")      d_getgrnam_r_proto=define
14373                 set d_getgrnam_r_proto getgrnam_r $hdrs
14374                 eval $hasproto ;;
14375         *)      ;;
14376         esac
14377         case "$d_getgrnam_r_proto" in
14378         define)
14379         case "$getgrnam_r_proto" in
14380         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14381         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14382         esac
14383         case "$getgrnam_r_proto" in
14384         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14385         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14386         esac
14387         case "$getgrnam_r_proto" in
14388         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14389         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14390         esac
14391         case "$getgrnam_r_proto" in
14392         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14393         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14394         esac
14395         case "$getgrnam_r_proto" in
14396         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14397         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14398         esac
14399         case "$getgrnam_r_proto" in
14400         ''|0)   d_getgrnam_r=undef
14401                 getgrnam_r_proto=0
14402                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14403         * )     case "$getgrnam_r_proto" in
14404                 REENTRANT_PROTO*) ;;
14405                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14406                 esac
14407                 echo "Prototype: $try" ;;
14408         esac
14409         ;;
14410         *)      case "$usethreads" in
14411                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14412                 esac
14413                 d_getgrnam_r=undef
14414                 getgrnam_r_proto=0
14415                 ;;
14416         esac
14417         ;;
14418 *)      getgrnam_r_proto=0
14419         ;;
14420 esac
14421
14422 : see if gethostbyaddr exists
14423 set gethostbyaddr d_gethbyaddr
14424 eval $inlibc
14425
14426 : see if gethostbyname exists
14427 set gethostbyname d_gethbyname
14428 eval $inlibc
14429
14430 : see if gethostent exists
14431 set gethostent d_gethent
14432 eval $inlibc
14433
14434 : see how we will look up host name
14435 echo " "
14436 call=''
14437 if set gethostname val -f d_gethname; eval $csym; $val; then
14438         echo 'gethostname() found.' >&4
14439         d_gethname="$define"
14440         call=gethostname
14441 fi
14442 if set uname val -f d_uname; eval $csym; $val; then
14443         if ./xenix; then
14444                 $cat <<'EOM'
14445 uname() was found, but you're running xenix, and older versions of xenix
14446 have a broken uname(). If you don't really know whether your xenix is old
14447 enough to have a broken system call, use the default answer.
14448
14449 EOM
14450                 dflt=y
14451                 case "$d_uname" in
14452                 "$define") dflt=n;;
14453                 esac
14454                 rp='Is your uname() broken?'
14455                 . ./myread
14456                 case "$ans" in
14457                 n*) d_uname="$define"; call=uname;;
14458                 esac
14459         else
14460                 echo 'uname() found.' >&4
14461                 d_uname="$define"
14462                 case "$call" in
14463                 '') call=uname ;;
14464                 esac
14465         fi
14466 fi
14467 case "$d_gethname" in
14468 '') d_gethname="$undef";;
14469 esac
14470 case "$d_uname" in
14471 '') d_uname="$undef";;
14472 esac
14473 case "$d_uname$d_gethname" in
14474 *define*)
14475         dflt=n
14476         cat <<EOM
14477
14478 Every now and then someone has a $call() that lies about the hostname
14479 but can't be fixed for political or economic reasons.  If you wish, I can
14480 pretend $call() isn't there and maybe compute hostname at run-time
14481 thanks to the '$phostname' command.
14482
14483 EOM
14484         rp="Shall I ignore $call() from now on?"
14485         . ./myread
14486         case "$ans" in
14487         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14488         esac;;
14489 esac
14490 case "$phostname" in
14491 '') aphostname='';;
14492 *) case "$aphostname" in
14493         /*) ;;
14494         *) set X $phostname
14495                 shift
14496                 file=$1
14497                 shift
14498                 file=`./loc $file $file $pth`
14499                 aphostname=`echo $file $*`
14500                 ;;
14501         esac
14502         ;;
14503 esac
14504 case "$d_uname$d_gethname" in
14505 *define*) ;;
14506 *)
14507         case "$phostname" in
14508         '')
14509                 echo "There will be no way for $package to get your hostname." >&4;;
14510         *)
14511         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14512                 ;;
14513         esac;;
14514 esac
14515 case "$d_phostname" in
14516 '') d_phostname="$undef";;
14517 esac
14518
14519 : see if gethostbyaddr_r exists
14520 set gethostbyaddr_r d_gethostbyaddr_r
14521 eval $inlibc
14522 case "$d_gethostbyaddr_r" in
14523 "$define")
14524         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14525         case "$d_gethostbyaddr_r_proto:$usethreads" in
14526         ":define")      d_gethostbyaddr_r_proto=define
14527                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14528                 eval $hasproto ;;
14529         *)      ;;
14530         esac
14531         case "$d_gethostbyaddr_r_proto" in
14532         define)
14533         case "$gethostbyaddr_r_proto" in
14534         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14535         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14536         esac
14537         case "$gethostbyaddr_r_proto" in
14538         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14539         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14540         esac
14541         case "$gethostbyaddr_r_proto" in
14542         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14543         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14544         esac
14545         case "$gethostbyaddr_r_proto" in
14546         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14547         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14548         esac
14549         case "$gethostbyaddr_r_proto" in
14550         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14551         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14552         esac
14553         case "$gethostbyaddr_r_proto" in
14554         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14555         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14556         esac
14557         case "$gethostbyaddr_r_proto" in
14558         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14559         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14560         esac
14561         case "$gethostbyaddr_r_proto" in
14562         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14563         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14564         esac
14565         case "$gethostbyaddr_r_proto" in
14566         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14567         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14568         esac
14569         case "$gethostbyaddr_r_proto" in
14570         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14571         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14572         esac
14573         case "$gethostbyaddr_r_proto" in
14574         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14575         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14576         esac
14577         case "$gethostbyaddr_r_proto" in
14578         ''|0)   d_gethostbyaddr_r=undef
14579                 gethostbyaddr_r_proto=0
14580                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14581         * )     case "$gethostbyaddr_r_proto" in
14582                 REENTRANT_PROTO*) ;;
14583                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14584                 esac
14585                 echo "Prototype: $try" ;;
14586         esac
14587         ;;
14588         *)      case "$usethreads" in
14589                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14590                 esac
14591                 d_gethostbyaddr_r=undef
14592                 gethostbyaddr_r_proto=0
14593                 ;;
14594         esac
14595         ;;
14596 *)      gethostbyaddr_r_proto=0
14597         ;;
14598 esac
14599
14600 : see if gethostbyname_r exists
14601 set gethostbyname_r d_gethostbyname_r
14602 eval $inlibc
14603 case "$d_gethostbyname_r" in
14604 "$define")
14605         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14606         case "$d_gethostbyname_r_proto:$usethreads" in
14607         ":define")      d_gethostbyname_r_proto=define
14608                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14609                 eval $hasproto ;;
14610         *)      ;;
14611         esac
14612         case "$d_gethostbyname_r_proto" in
14613         define)
14614         case "$gethostbyname_r_proto" in
14615         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14616         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14617         esac
14618         case "$gethostbyname_r_proto" in
14619         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14620         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14621         esac
14622         case "$gethostbyname_r_proto" in
14623         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14624         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14625         esac
14626         case "$gethostbyname_r_proto" in
14627         ''|0)   d_gethostbyname_r=undef
14628                 gethostbyname_r_proto=0
14629                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14630         * )     case "$gethostbyname_r_proto" in
14631                 REENTRANT_PROTO*) ;;
14632                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14633                 esac
14634                 echo "Prototype: $try" ;;
14635         esac
14636         ;;
14637         *)      case "$usethreads" in
14638                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14639                 esac
14640                 d_gethostbyname_r=undef
14641                 gethostbyname_r_proto=0
14642                 ;;
14643         esac
14644         ;;
14645 *)      gethostbyname_r_proto=0
14646         ;;
14647 esac
14648
14649 : see if gethostent_r exists
14650 set gethostent_r d_gethostent_r
14651 eval $inlibc
14652 case "$d_gethostent_r" in
14653 "$define")
14654         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14655         case "$d_gethostent_r_proto:$usethreads" in
14656         ":define")      d_gethostent_r_proto=define
14657                 set d_gethostent_r_proto gethostent_r $hdrs
14658                 eval $hasproto ;;
14659         *)      ;;
14660         esac
14661         case "$d_gethostent_r_proto" in
14662         define)
14663         case "$gethostent_r_proto" in
14664         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14665         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14666         esac
14667         case "$gethostent_r_proto" in
14668         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14669         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14670         esac
14671         case "$gethostent_r_proto" in
14672         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14673         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14674         esac
14675         case "$gethostent_r_proto" in
14676         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14677         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14678         esac
14679         case "$gethostent_r_proto" in
14680         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14681         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14682         esac
14683         case "$gethostent_r_proto" in
14684         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14685         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14686         esac
14687         case "$gethostent_r_proto" in
14688         ''|0)   d_gethostent_r=undef
14689                 gethostent_r_proto=0
14690                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14691         * )     case "$gethostent_r_proto" in
14692                 REENTRANT_PROTO*) ;;
14693                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14694                 esac
14695                 echo "Prototype: $try" ;;
14696         esac
14697         ;;
14698         *)      case "$usethreads" in
14699                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14700                 esac
14701                 d_gethostent_r=undef
14702                 gethostent_r_proto=0
14703                 ;;
14704         esac
14705         ;;
14706 *)      gethostent_r_proto=0
14707         ;;
14708 esac
14709
14710 : see if prototypes for various gethostxxx netdb.h functions are available
14711 echo " "
14712 set d_gethostprotos gethostent $i_netdb netdb.h
14713 eval $hasproto
14714
14715 : see if getitimer exists
14716 set getitimer d_getitimer
14717 eval $inlibc
14718
14719 : see if getlogin exists
14720 set getlogin d_getlogin
14721 eval $inlibc
14722
14723 : see if getlogin_r exists
14724 set getlogin_r d_getlogin_r
14725 eval $inlibc
14726 case "$d_getlogin_r" in
14727 "$define")
14728         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14729         case "$d_getlogin_r_proto:$usethreads" in
14730         ":define")      d_getlogin_r_proto=define
14731                 set d_getlogin_r_proto getlogin_r $hdrs
14732                 eval $hasproto ;;
14733         *)      ;;
14734         esac
14735         case "$d_getlogin_r_proto" in
14736         define)
14737         case "$getlogin_r_proto" in
14738         ''|0) try='int getlogin_r(char*, size_t);'
14739         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14740         esac
14741         case "$getlogin_r_proto" in
14742         ''|0) try='int getlogin_r(char*, int);'
14743         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14744         esac
14745         case "$getlogin_r_proto" in
14746         ''|0) try='char* getlogin_r(char*, size_t);'
14747         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14748         esac
14749         case "$getlogin_r_proto" in
14750         ''|0) try='char* getlogin_r(char*, int);'
14751         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14752         esac
14753         case "$getlogin_r_proto" in
14754         ''|0)   d_getlogin_r=undef
14755                 getlogin_r_proto=0
14756                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14757         * )     case "$getlogin_r_proto" in
14758                 REENTRANT_PROTO*) ;;
14759                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14760                 esac
14761                 echo "Prototype: $try" ;;
14762         esac
14763         ;;
14764         *)      case "$usethreads" in
14765                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14766                 esac
14767                 d_getlogin_r=undef
14768                 getlogin_r_proto=0
14769                 ;;
14770         esac
14771         ;;
14772 *)      getlogin_r_proto=0
14773         ;;
14774 esac
14775
14776 : see if getmnt exists
14777 set getmnt d_getmnt
14778 eval $inlibc
14779
14780 : see if getmntent exists
14781 set getmntent d_getmntent
14782 eval $inlibc
14783
14784 : see if getnameinfo exists
14785 set getnameinfo d_getnameinfo
14786 eval $inlibc
14787
14788 : see if getnetbyaddr exists
14789 set getnetbyaddr d_getnbyaddr
14790 eval $inlibc
14791
14792 : see if getnetbyname exists
14793 set getnetbyname d_getnbyname
14794 eval $inlibc
14795
14796 : see if getnetent exists
14797 set getnetent d_getnent
14798 eval $inlibc
14799
14800 : see if getnetbyaddr_r exists
14801 set getnetbyaddr_r d_getnetbyaddr_r
14802 eval $inlibc
14803 case "$d_getnetbyaddr_r" in
14804 "$define")
14805         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14806         case "$d_getnetbyaddr_r_proto:$usethreads" in
14807         ":define")      d_getnetbyaddr_r_proto=define
14808                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14809                 eval $hasproto ;;
14810         *)      ;;
14811         esac
14812         case "$d_getnetbyaddr_r_proto" in
14813         define)
14814         case "$getnetbyaddr_r_proto" in
14815         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14816         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14817         esac
14818         case "$getnetbyaddr_r_proto" in
14819         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14820         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14821         esac
14822         case "$getnetbyaddr_r_proto" in
14823         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14824         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14825         esac
14826         case "$getnetbyaddr_r_proto" in
14827         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14828         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14829         esac
14830         case "$getnetbyaddr_r_proto" in
14831         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14832         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14833         esac
14834         case "$getnetbyaddr_r_proto" in
14835         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14836         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14837         esac
14838         case "$getnetbyaddr_r_proto" in
14839         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14840         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14841         esac
14842         case "$getnetbyaddr_r_proto" in
14843         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14844         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14845         esac
14846         case "$getnetbyaddr_r_proto" in
14847         ''|0)   d_getnetbyaddr_r=undef
14848                 getnetbyaddr_r_proto=0
14849                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14850         * )     case "$getnetbyaddr_r_proto" in
14851                 REENTRANT_PROTO*) ;;
14852                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14853                 esac
14854                 echo "Prototype: $try" ;;
14855         esac
14856         ;;
14857         *)      case "$usethreads" in
14858                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14859                 esac
14860                 d_getnetbyaddr_r=undef
14861                 getnetbyaddr_r_proto=0
14862                 ;;
14863         esac
14864         ;;
14865 *)      getnetbyaddr_r_proto=0
14866         ;;
14867 esac
14868
14869 : see if getnetbyname_r exists
14870 set getnetbyname_r d_getnetbyname_r
14871 eval $inlibc
14872 case "$d_getnetbyname_r" in
14873 "$define")
14874         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14875         case "$d_getnetbyname_r_proto:$usethreads" in
14876         ":define")      d_getnetbyname_r_proto=define
14877                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14878                 eval $hasproto ;;
14879         *)      ;;
14880         esac
14881         case "$d_getnetbyname_r_proto" in
14882         define)
14883         case "$getnetbyname_r_proto" in
14884         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14885         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14886         esac
14887         case "$getnetbyname_r_proto" in
14888         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14889         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14890         esac
14891         case "$getnetbyname_r_proto" in
14892         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14893         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14894         esac
14895         case "$getnetbyname_r_proto" in
14896         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14897         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14898         esac
14899         case "$getnetbyname_r_proto" in
14900         ''|0)   d_getnetbyname_r=undef
14901                 getnetbyname_r_proto=0
14902                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14903         * )     case "$getnetbyname_r_proto" in
14904                 REENTRANT_PROTO*) ;;
14905                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14906                 esac
14907                 echo "Prototype: $try" ;;
14908         esac
14909         ;;
14910         *)      case "$usethreads" in
14911                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14912                 esac
14913                 d_getnetbyname_r=undef
14914                 getnetbyname_r_proto=0
14915                 ;;
14916         esac
14917         ;;
14918 *)      getnetbyname_r_proto=0
14919         ;;
14920 esac
14921
14922 : see if getnetent_r exists
14923 set getnetent_r d_getnetent_r
14924 eval $inlibc
14925 case "$d_getnetent_r" in
14926 "$define")
14927         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14928         case "$d_getnetent_r_proto:$usethreads" in
14929         ":define")      d_getnetent_r_proto=define
14930                 set d_getnetent_r_proto getnetent_r $hdrs
14931                 eval $hasproto ;;
14932         *)      ;;
14933         esac
14934         case "$d_getnetent_r_proto" in
14935         define)
14936         case "$getnetent_r_proto" in
14937         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14938         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14939         esac
14940         case "$getnetent_r_proto" in
14941         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14942         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14943         esac
14944         case "$getnetent_r_proto" in
14945         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14946         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14947         esac
14948         case "$getnetent_r_proto" in
14949         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14950         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14951         esac
14952         case "$getnetent_r_proto" in
14953         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14954         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14955         esac
14956         case "$getnetent_r_proto" in
14957         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14958         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14959         esac
14960         case "$getnetent_r_proto" in
14961         ''|0)   d_getnetent_r=undef
14962                 getnetent_r_proto=0
14963                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14964         * )     case "$getnetent_r_proto" in
14965                 REENTRANT_PROTO*) ;;
14966                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14967                 esac
14968                 echo "Prototype: $try" ;;
14969         esac
14970         ;;
14971         *)      case "$usethreads" in
14972                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14973                 esac
14974                 d_getnetent_r=undef
14975                 getnetent_r_proto=0
14976                 ;;
14977         esac
14978         ;;
14979 *)      getnetent_r_proto=0
14980         ;;
14981 esac
14982
14983 : see if prototypes for various getnetxxx netdb.h functions are available
14984 echo " "
14985 set d_getnetprotos getnetent $i_netdb netdb.h
14986 eval $hasproto
14987
14988 : see if getpagesize exists
14989 set getpagesize d_getpagsz
14990 eval $inlibc
14991
14992 : Optional checks for getprotobyname and getprotobynumber
14993
14994 : see if getprotobyname exists
14995 set getprotobyname d_getpbyname
14996 eval $inlibc
14997
14998 : see if getprotobynumber exists
14999 set getprotobynumber d_getpbynumber
15000 eval $inlibc
15001
15002 : see if getprotoent exists
15003 set getprotoent d_getpent
15004 eval $inlibc
15005
15006 : see if getpgid exists
15007 set getpgid d_getpgid
15008 eval $inlibc
15009
15010 : see if getpgrp2 exists
15011 set getpgrp2 d_getpgrp2
15012 eval $inlibc
15013
15014 : see if getppid exists
15015 set getppid d_getppid
15016 eval $inlibc
15017
15018 : see if getpriority exists
15019 set getpriority d_getprior
15020 eval $inlibc
15021
15022 : see if getprotobyname_r exists
15023 set getprotobyname_r d_getprotobyname_r
15024 eval $inlibc
15025 case "$d_getprotobyname_r" in
15026 "$define")
15027         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15028         case "$d_getprotobyname_r_proto:$usethreads" in
15029         ":define")      d_getprotobyname_r_proto=define
15030                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15031                 eval $hasproto ;;
15032         *)      ;;
15033         esac
15034         case "$d_getprotobyname_r_proto" in
15035         define)
15036         case "$getprotobyname_r_proto" in
15037         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15038         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15039         esac
15040         case "$getprotobyname_r_proto" in
15041         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15042         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15043         esac
15044         case "$getprotobyname_r_proto" in
15045         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15046         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15047         esac
15048         case "$getprotobyname_r_proto" in
15049         ''|0)   d_getprotobyname_r=undef
15050                 getprotobyname_r_proto=0
15051                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15052         * )     case "$getprotobyname_r_proto" in
15053                 REENTRANT_PROTO*) ;;
15054                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15055                 esac
15056                 echo "Prototype: $try" ;;
15057         esac
15058         ;;
15059         *)      case "$usethreads" in
15060                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15061                 esac
15062                 d_getprotobyname_r=undef
15063                 getprotobyname_r_proto=0
15064                 ;;
15065         esac
15066         ;;
15067 *)      getprotobyname_r_proto=0
15068         ;;
15069 esac
15070
15071 : see if getprotobynumber_r exists
15072 set getprotobynumber_r d_getprotobynumber_r
15073 eval $inlibc
15074 case "$d_getprotobynumber_r" in
15075 "$define")
15076         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15077         case "$d_getprotobynumber_r_proto:$usethreads" in
15078         ":define")      d_getprotobynumber_r_proto=define
15079                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15080                 eval $hasproto ;;
15081         *)      ;;
15082         esac
15083         case "$d_getprotobynumber_r_proto" in
15084         define)
15085         case "$getprotobynumber_r_proto" in
15086         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15087         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15088         esac
15089         case "$getprotobynumber_r_proto" in
15090         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15091         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15092         esac
15093         case "$getprotobynumber_r_proto" in
15094         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15095         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15096         esac
15097         case "$getprotobynumber_r_proto" in
15098         ''|0)   d_getprotobynumber_r=undef
15099                 getprotobynumber_r_proto=0
15100                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15101         * )     case "$getprotobynumber_r_proto" in
15102                 REENTRANT_PROTO*) ;;
15103                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15104                 esac
15105                 echo "Prototype: $try" ;;
15106         esac
15107         ;;
15108         *)      case "$usethreads" in
15109                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15110                 esac
15111                 d_getprotobynumber_r=undef
15112                 getprotobynumber_r_proto=0
15113                 ;;
15114         esac
15115         ;;
15116 *)      getprotobynumber_r_proto=0
15117         ;;
15118 esac
15119
15120 : see if getprotoent_r exists
15121 set getprotoent_r d_getprotoent_r
15122 eval $inlibc
15123 case "$d_getprotoent_r" in
15124 "$define")
15125         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15126         case "$d_getprotoent_r_proto:$usethreads" in
15127         ":define")      d_getprotoent_r_proto=define
15128                 set d_getprotoent_r_proto getprotoent_r $hdrs
15129                 eval $hasproto ;;
15130         *)      ;;
15131         esac
15132         case "$d_getprotoent_r_proto" in
15133         define)
15134         case "$getprotoent_r_proto" in
15135         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15136         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15137         esac
15138         case "$getprotoent_r_proto" in
15139         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15140         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15141         esac
15142         case "$getprotoent_r_proto" in
15143         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15144         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15145         esac
15146         case "$getprotoent_r_proto" in
15147         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15148         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15149         esac
15150         case "$getprotoent_r_proto" in
15151         ''|0)   d_getprotoent_r=undef
15152                 getprotoent_r_proto=0
15153                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15154         * )     case "$getprotoent_r_proto" in
15155                 REENTRANT_PROTO*) ;;
15156                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15157                 esac
15158                 echo "Prototype: $try" ;;
15159         esac
15160         ;;
15161         *)      case "$usethreads" in
15162                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15163                 esac
15164                 d_getprotoent_r=undef
15165                 getprotoent_r_proto=0
15166                 ;;
15167         esac
15168         ;;
15169 *)      getprotoent_r_proto=0
15170         ;;
15171 esac
15172
15173 : see if prototypes for various getprotoxxx netdb.h functions are available
15174 echo " "
15175 set d_getprotoprotos getprotoent $i_netdb netdb.h
15176 eval $hasproto
15177
15178 : see if getprpwnam exists
15179 set getprpwnam d_getprpwnam
15180 eval $inlibc
15181
15182 : see if getpwent exists
15183 set getpwent d_getpwent
15184 eval $inlibc
15185
15186 : see if getpwent_r exists
15187 set getpwent_r d_getpwent_r
15188 eval $inlibc
15189 case "$d_getpwent_r" in
15190 "$define")
15191         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15192         case "$d_getpwent_r_proto:$usethreads" in
15193         ":define")      d_getpwent_r_proto=define
15194                 set d_getpwent_r_proto getpwent_r $hdrs
15195                 eval $hasproto ;;
15196         *)      ;;
15197         esac
15198         case "$d_getpwent_r_proto" in
15199         define)
15200         case "$getpwent_r_proto" in
15201         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15202         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15203         esac
15204         case "$getpwent_r_proto" in
15205         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15206         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15207         esac
15208         case "$getpwent_r_proto" in
15209         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15210         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15211         esac
15212         case "$getpwent_r_proto" in
15213         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15214         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15215         esac
15216         case "$getpwent_r_proto" in
15217         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15218         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15219         esac
15220         case "$getpwent_r_proto" in
15221         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15222         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15223         esac
15224         case "$getpwent_r_proto" in
15225         ''|0)   d_getpwent_r=undef
15226                 getpwent_r_proto=0
15227                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15228         * )     case "$getpwent_r_proto" in
15229                 REENTRANT_PROTO*) ;;
15230                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15231                 esac
15232                 echo "Prototype: $try" ;;
15233         esac
15234         ;;
15235         *)      case "$usethreads" in
15236                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15237                 esac
15238                 d_getpwent_r=undef
15239                 getpwent_r_proto=0
15240                 ;;
15241         esac
15242         ;;
15243 *)      getpwent_r_proto=0
15244         ;;
15245 esac
15246
15247 : see if getpwnam_r exists
15248 set getpwnam_r d_getpwnam_r
15249 eval $inlibc
15250 case "$d_getpwnam_r" in
15251 "$define")
15252         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15253         case "$d_getpwnam_r_proto:$usethreads" in
15254         ":define")      d_getpwnam_r_proto=define
15255                 set d_getpwnam_r_proto getpwnam_r $hdrs
15256                 eval $hasproto ;;
15257         *)      ;;
15258         esac
15259         case "$d_getpwnam_r_proto" in
15260         define)
15261         case "$getpwnam_r_proto" in
15262         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15263         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15264         esac
15265         case "$getpwnam_r_proto" in
15266         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15267         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15268         esac
15269         case "$getpwnam_r_proto" in
15270         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15271         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15272         esac
15273         case "$getpwnam_r_proto" in
15274         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15275         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15276         esac
15277         case "$getpwnam_r_proto" in
15278         ''|0)   d_getpwnam_r=undef
15279                 getpwnam_r_proto=0
15280                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15281         * )     case "$getpwnam_r_proto" in
15282                 REENTRANT_PROTO*) ;;
15283                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15284                 esac
15285                 echo "Prototype: $try" ;;
15286         esac
15287         ;;
15288         *)      case "$usethreads" in
15289                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15290                 esac
15291                 d_getpwnam_r=undef
15292                 getpwnam_r_proto=0
15293                 ;;
15294         esac
15295         ;;
15296 *)      getpwnam_r_proto=0
15297         ;;
15298 esac
15299
15300 : see if getpwuid_r exists
15301 set getpwuid_r d_getpwuid_r
15302 eval $inlibc
15303 case "$d_getpwuid_r" in
15304 "$define")
15305         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15306         case "$d_getpwuid_r_proto:$usethreads" in
15307         ":define")      d_getpwuid_r_proto=define
15308                 set d_getpwuid_r_proto getpwuid_r $hdrs
15309                 eval $hasproto ;;
15310         *)      ;;
15311         esac
15312         case "$d_getpwuid_r_proto" in
15313         define)
15314         case "$getpwuid_r_proto" in
15315         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15316         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15317         esac
15318         case "$getpwuid_r_proto" in
15319         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15320         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15321         esac
15322         case "$getpwuid_r_proto" in
15323         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15324         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15325         esac
15326         case "$getpwuid_r_proto" in
15327         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15328         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15329         esac
15330         case "$getpwuid_r_proto" in
15331         ''|0)   d_getpwuid_r=undef
15332                 getpwuid_r_proto=0
15333                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15334         * )     case "$getpwuid_r_proto" in
15335                 REENTRANT_PROTO*) ;;
15336                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15337                 esac
15338                 echo "Prototype: $try" ;;
15339         esac
15340         ;;
15341         *)      case "$usethreads" in
15342                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15343                 esac
15344                 d_getpwuid_r=undef
15345                 getpwuid_r_proto=0
15346                 ;;
15347         esac
15348         ;;
15349 *)      getpwuid_r_proto=0
15350         ;;
15351 esac
15352
15353 : Optional checks for getsbyname and getsbyport
15354
15355 : see if getservbyname exists
15356 set getservbyname d_getsbyname
15357 eval $inlibc
15358
15359 : see if getservbyport exists
15360 set getservbyport d_getsbyport
15361 eval $inlibc
15362
15363 : see if getservent exists
15364 set getservent d_getsent
15365 eval $inlibc
15366
15367 : see if getservbyname_r exists
15368 set getservbyname_r d_getservbyname_r
15369 eval $inlibc
15370 case "$d_getservbyname_r" in
15371 "$define")
15372         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15373         case "$d_getservbyname_r_proto:$usethreads" in
15374         ":define")      d_getservbyname_r_proto=define
15375                 set d_getservbyname_r_proto getservbyname_r $hdrs
15376                 eval $hasproto ;;
15377         *)      ;;
15378         esac
15379         case "$d_getservbyname_r_proto" in
15380         define)
15381         case "$getservbyname_r_proto" in
15382         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15383         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15384         esac
15385         case "$getservbyname_r_proto" in
15386         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15387         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15388         esac
15389         case "$getservbyname_r_proto" in
15390         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15391         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15392         esac
15393         case "$getservbyname_r_proto" in
15394         ''|0)   d_getservbyname_r=undef
15395                 getservbyname_r_proto=0
15396                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15397         * )     case "$getservbyname_r_proto" in
15398                 REENTRANT_PROTO*) ;;
15399                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15400                 esac
15401                 echo "Prototype: $try" ;;
15402         esac
15403         ;;
15404         *)      case "$usethreads" in
15405                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15406                 esac
15407                 d_getservbyname_r=undef
15408                 getservbyname_r_proto=0
15409                 ;;
15410         esac
15411         ;;
15412 *)      getservbyname_r_proto=0
15413         ;;
15414 esac
15415
15416 : see if getservbyport_r exists
15417 set getservbyport_r d_getservbyport_r
15418 eval $inlibc
15419 case "$d_getservbyport_r" in
15420 "$define")
15421         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15422         case "$d_getservbyport_r_proto:$usethreads" in
15423         ":define")      d_getservbyport_r_proto=define
15424                 set d_getservbyport_r_proto getservbyport_r $hdrs
15425                 eval $hasproto ;;
15426         *)      ;;
15427         esac
15428         case "$d_getservbyport_r_proto" in
15429         define)
15430         case "$getservbyport_r_proto" in
15431         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15432         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15433         esac
15434         case "$getservbyport_r_proto" in
15435         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15436         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15437         esac
15438         case "$getservbyport_r_proto" in
15439         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15440         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15441         esac
15442         case "$getservbyport_r_proto" in
15443         ''|0)   d_getservbyport_r=undef
15444                 getservbyport_r_proto=0
15445                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15446         * )     case "$getservbyport_r_proto" in
15447                 REENTRANT_PROTO*) ;;
15448                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15449                 esac
15450                 echo "Prototype: $try" ;;
15451         esac
15452         ;;
15453         *)      case "$usethreads" in
15454                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15455                 esac
15456                 d_getservbyport_r=undef
15457                 getservbyport_r_proto=0
15458                 ;;
15459         esac
15460         ;;
15461 *)      getservbyport_r_proto=0
15462         ;;
15463 esac
15464
15465 : see if getservent_r exists
15466 set getservent_r d_getservent_r
15467 eval $inlibc
15468 case "$d_getservent_r" in
15469 "$define")
15470         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15471         case "$d_getservent_r_proto:$usethreads" in
15472         ":define")      d_getservent_r_proto=define
15473                 set d_getservent_r_proto getservent_r $hdrs
15474                 eval $hasproto ;;
15475         *)      ;;
15476         esac
15477         case "$d_getservent_r_proto" in
15478         define)
15479         case "$getservent_r_proto" in
15480         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15481         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15482         esac
15483         case "$getservent_r_proto" in
15484         ''|0) try='int getservent_r(struct servent*, char*, int);'
15485         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15486         esac
15487         case "$getservent_r_proto" in
15488         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15489         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15490         esac
15491         case "$getservent_r_proto" in
15492         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15493         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15494         esac
15495         case "$getservent_r_proto" in
15496         ''|0)   d_getservent_r=undef
15497                 getservent_r_proto=0
15498                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15499         * )     case "$getservent_r_proto" in
15500                 REENTRANT_PROTO*) ;;
15501                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15502                 esac
15503                 echo "Prototype: $try" ;;
15504         esac
15505         ;;
15506         *)      case "$usethreads" in
15507                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15508                 esac
15509                 d_getservent_r=undef
15510                 getservent_r_proto=0
15511                 ;;
15512         esac
15513         ;;
15514 *)      getservent_r_proto=0
15515         ;;
15516 esac
15517
15518 : see if prototypes for various getservxxx netdb.h functions are available
15519 echo " "
15520 set d_getservprotos getservent $i_netdb netdb.h
15521 eval $hasproto
15522
15523 : see if getspnam exists
15524 set getspnam d_getspnam
15525 eval $inlibc
15526
15527 : see if this is a shadow.h system
15528 set shadow.h i_shadow
15529 eval $inhdr
15530
15531 : see if getspnam_r exists
15532 set getspnam_r d_getspnam_r
15533 eval $inlibc
15534 case "$d_getspnam_r" in
15535 "$define")
15536         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15537         case "$d_getspnam_r_proto:$usethreads" in
15538         ":define")      d_getspnam_r_proto=define
15539                 set d_getspnam_r_proto getspnam_r $hdrs
15540                 eval $hasproto ;;
15541         *)      ;;
15542         esac
15543         case "$d_getspnam_r_proto" in
15544         define)
15545         case "$getspnam_r_proto" in
15546         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15547         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15548         esac
15549         case "$getspnam_r_proto" in
15550         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15551         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15552         esac
15553         case "$getspnam_r_proto" in
15554         ''|0)   d_getspnam_r=undef
15555                 getspnam_r_proto=0
15556                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15557         * )     case "$getspnam_r_proto" in
15558                 REENTRANT_PROTO*) ;;
15559                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15560                 esac
15561                 echo "Prototype: $try" ;;
15562         esac
15563         ;;
15564         *)      case "$usethreads" in
15565                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15566                 esac
15567                 d_getspnam_r=undef
15568                 getspnam_r_proto=0
15569                 ;;
15570         esac
15571         ;;
15572 *)      getspnam_r_proto=0
15573         ;;
15574 esac
15575
15576 : see if gettimeofday or ftime exists
15577 set gettimeofday d_gettimeod
15578 eval $inlibc
15579 case "$d_gettimeod" in
15580 "$undef")
15581         set ftime d_ftime 
15582         eval $inlibc
15583         ;;
15584 *)
15585         val="$undef"; set d_ftime; eval $setvar
15586         ;;
15587 esac
15588 case "$d_gettimeod$d_ftime" in
15589 "$undef$undef")
15590         echo " "
15591         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15592         ;;
15593 esac
15594
15595 : see if gmtime_r exists
15596 set gmtime_r d_gmtime_r
15597 eval $inlibc
15598 case "$d_gmtime_r" in
15599 "$define")
15600         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15601         case "$d_gmtime_r_proto:$usethreads" in
15602         ":define")      d_gmtime_r_proto=define
15603                 set d_gmtime_r_proto gmtime_r $hdrs
15604                 eval $hasproto ;;
15605         *)      ;;
15606         esac
15607         case "$d_gmtime_r_proto" in
15608         define)
15609         case "$gmtime_r_proto" in
15610         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15611         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15612         esac
15613         case "$gmtime_r_proto" in
15614         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15615         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15616         esac
15617         case "$gmtime_r_proto" in
15618         ''|0)   d_gmtime_r=undef
15619                 gmtime_r_proto=0
15620                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15621         * )     case "$gmtime_r_proto" in
15622                 REENTRANT_PROTO*) ;;
15623                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15624                 esac
15625                 echo "Prototype: $try" ;;
15626         esac
15627         ;;
15628         *)      case "$usethreads" in
15629                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15630                 esac
15631                 d_gmtime_r=undef
15632                 gmtime_r_proto=0
15633                 ;;
15634         esac
15635         ;;
15636 *)      gmtime_r_proto=0
15637         ;;
15638 esac
15639
15640 : see if hasmntopt exists
15641 set hasmntopt d_hasmntopt
15642 eval $inlibc
15643
15644 : see if this is a netinet/in.h or sys/in.h system
15645 set netinet/in.h i_niin sys/in.h i_sysin
15646 eval $inhdr
15647
15648 : see if arpa/inet.h has to be included
15649 set arpa/inet.h i_arpainet
15650 eval $inhdr
15651
15652 : see if htonl --and friends-- exists
15653 val=''
15654 set htonl val
15655 eval $inlibc
15656
15657 : Maybe they are macros.
15658 case "$val" in
15659 $undef)
15660         $cat >htonl.c <<EOM
15661 #include <stdio.h>
15662 #include <sys/types.h>
15663 #$i_niin I_NETINET_IN
15664 #$i_sysin I_SYS_IN
15665 #$i_arpainet I_ARPA_INET
15666 #ifdef I_NETINET_IN
15667 #include <netinet/in.h>
15668 #endif
15669 #ifdef I_SYS_IN
15670 #include <sys/in.h>
15671 #endif
15672 #ifdef I_ARPA_INET
15673 #include <arpa/inet.h>
15674 #endif
15675 #ifdef htonl
15676 printf("Defined as a macro.");
15677 #endif
15678 EOM
15679         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15680         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15681                 val="$define"
15682                 echo "But it seems to be defined as a macro." >&4
15683         fi
15684         $rm -f htonl.?
15685         ;;
15686 esac
15687 set d_htonl
15688 eval $setvar
15689
15690 : see if hypot exists
15691 set hypot d_hypot
15692 eval $inlibc
15693
15694 : see if ilogb exists
15695 set ilogb d_ilogb
15696 eval $inlibc
15697
15698 : see if ilogbl exists
15699 set ilogbl d_ilogbl
15700 eval $inlibc
15701
15702 : index or strchr
15703 echo " "
15704 if set index val -f; eval $csym; $val; then
15705         if set strchr val -f d_strchr; eval $csym; $val; then
15706                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15707                         val="$define"
15708                         vali="$undef"
15709                         echo "strchr() found." >&4
15710                 else
15711                         val="$undef"
15712                         vali="$define"
15713                         echo "index() found." >&4
15714                 fi
15715         else
15716                 val="$undef"
15717                 vali="$define"
15718                 echo "index() found." >&4
15719         fi
15720 else
15721         if set strchr val -f d_strchr; eval $csym; $val; then
15722                 val="$define"
15723                 vali="$undef"
15724                 echo "strchr() found." >&4
15725         else
15726                 echo "No index() or strchr() found!" >&4
15727                 val="$undef"
15728                 vali="$undef"
15729         fi
15730 fi
15731 set d_strchr; eval $setvar
15732 val="$vali"
15733 set d_index; eval $setvar
15734
15735 : check whether inet_aton exists
15736 set inet_aton d_inetaton
15737 eval $inlibc
15738
15739 : see if inet_ntop exists
15740 set inet_ntop d_inetntop
15741 eval $inlibc
15742
15743 : see if inet_pton exists
15744 set inet_pton d_inetpton
15745 eval $inlibc
15746
15747 : Look for isascii
15748 echo " "
15749 $cat >isascii.c <<EOCP
15750 #include <stdio.h>
15751 #include <ctype.h>
15752 #$i_stdlib I_STDLIB
15753 #ifdef I_STDLIB
15754 #include <stdlib.h>
15755 #endif
15756 int main() {
15757         int c = 'A';
15758         if (isascii(c))
15759                 exit(0);
15760         else
15761                 exit(1);
15762 }
15763 EOCP
15764 set isascii
15765 if eval $compile; then
15766         echo "isascii() found." >&4
15767         val="$define"
15768 else
15769         echo "isascii() NOT found." >&4
15770         val="$undef"
15771 fi
15772 set d_isascii
15773 eval $setvar
15774 $rm -f isascii*
15775
15776 : Look for isblank
15777 echo " "
15778 $cat >isblank.c <<'EOCP'
15779 #include <stdio.h>
15780 #include <ctype.h>
15781 int main() {
15782         int c = ' ';
15783         if (isblank(c))
15784                 return 0 ;
15785         else
15786                 return 1 ;
15787 }
15788 EOCP
15789 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15790         echo "isblank() found." >&4
15791         val="$define"
15792 else
15793         echo "isblank() NOT found." >&4
15794         val="$undef"
15795 fi
15796 set d_isblank
15797 eval $setvar
15798 $rm -f isblank*
15799
15800 : check for isfinite
15801 echo "Checking to see if you have isfinite..." >&4
15802 $cat >try.c <<EOCP
15803 #$i_math I_MATH
15804 #ifdef I_MATH
15805 #include <math.h>
15806 #endif
15807 int main() { return isfinite(0.0); }
15808 EOCP
15809 set try
15810 if eval $compile; then
15811         val="$define"
15812         echo "You have isfinite."
15813 else
15814         val="$undef"
15815         echo "You do not have isfinite."
15816 fi
15817 $rm_try
15818 set d_isfinite
15819 eval $setvar
15820
15821 : see if isfinitel exists
15822 set isfinitel d_isfinitel
15823 eval $inlibc
15824
15825 : check for isinf
15826 echo "Checking to see if you have isinf..." >&4
15827 $cat >try.c <<EOCP
15828 #$i_math I_MATH
15829 #ifdef I_MATH
15830 #include <math.h>
15831 #endif
15832 int main() { return isinf(0.0); }
15833 EOCP
15834 set try
15835 if eval $compile; then
15836         val="$define"
15837         echo "You have isinf."
15838 else
15839         val="$undef"
15840         echo "You do not have isinf."
15841 fi
15842 $rm_try
15843 set d_isinf
15844 eval $setvar
15845
15846 : see if isinfl exists
15847 set isinfl d_isinfl
15848 eval $inlibc
15849
15850 : check for isless
15851 echo "Checking to see if you have isless..." >&4
15852 $cat >try.c <<EOCP
15853 #$i_math I_MATH
15854 #ifdef I_MATH
15855 #include <math.h>
15856 #endif
15857 int main() { return isless(0.0); }
15858 EOCP
15859 set try
15860 if eval $compile; then
15861         val="$define"
15862         echo "You have isless."
15863 else
15864         val="$undef"
15865         echo "You do not have isless."
15866 fi
15867 $rm_try
15868 set d_isless
15869 eval $setvar
15870
15871 : check for isnan
15872 echo "Checking to see if you have isnan..." >&4
15873 $cat >try.c <<EOCP
15874 #$i_math I_MATH
15875 #ifdef I_MATH
15876 #include <math.h>
15877 #endif
15878 int main() { return isnan(0.0); }
15879 EOCP
15880 set try
15881 if eval $compile; then
15882         val="$define"
15883         echo "You have isnan."
15884 else
15885         val="$undef"
15886         echo "You do not have isnan."
15887 fi
15888 $rm_try
15889 set d_isnan
15890 eval $setvar
15891
15892 : see if isnanl exists
15893 set isnanl d_isnanl
15894 eval $inlibc
15895
15896 : check for isnormal
15897 echo "Checking to see if you have isnormal..." >&4
15898 $cat >try.c <<EOCP
15899 #$i_math I_MATH
15900 #ifdef I_MATH
15901 #include <math.h>
15902 #endif
15903 int main() { return isnormal(0.0); }
15904 EOCP
15905 set try
15906 if eval $compile; then
15907         val="$define"
15908         echo "You have isnormal."
15909 else
15910         val="$undef"
15911         echo "You do not have isnormal."
15912 fi
15913 $rm_try
15914 set d_isnormal
15915 eval $setvar
15916
15917 : see if j0 exists
15918 set j0 d_j0
15919 eval $inlibc
15920
15921 : see if j0l exists
15922 set j0l d_j0l
15923 eval $inlibc
15924
15925 : see if killpg exists
15926 set killpg d_killpg
15927 eval $inlibc
15928
15929 : see if localeconv exists
15930 set localeconv d_locconv
15931 eval $inlibc
15932
15933 : see if libc has the POSIX.1-2008 currency locale rules
15934 case "$d_locconv:$d_lc_monetary_2008" in
15935 $define:)
15936         $cat >try.c <<EOCP
15937 #include <locale.h>
15938 int main() {
15939         struct lconv *lc = localeconv();
15940         char int_p_cs_precedes = lc->int_p_cs_precedes;
15941         return 0;
15942 }
15943 EOCP
15944         set try
15945         if eval $compile; then
15946                 d_lc_monetary_2008="$define"
15947         else
15948                 d_lc_monetary_2008="$undef"
15949         fi;
15950         $rm_try
15951         ;;
15952 esac
15953
15954 : see if lchown exists
15955 echo " "
15956 $cat > try.c <<'EOCP'
15957 /* System header to define __stub macros and hopefully few prototypes,
15958     which can conflict with char lchown(); below.  */
15959 #include <assert.h>
15960 /* Override any gcc2 internal prototype to avoid an error.  */
15961 /* We use char because int might match the return type of a gcc2
15962    builtin and then its argument prototype would still apply.  */
15963 char lchown();
15964 int main() {
15965     /*  The GNU C library defines this for functions which it implements
15966         to always fail with ENOSYS.  Some functions are actually named
15967         something starting with __ and the normal name is an alias.  */
15968 #if defined (__stub_lchown) || defined (__stub___lchown)
15969 choke me
15970 #else
15971 lchown();
15972 #endif
15973 ; return 0; }
15974 EOCP
15975 set try
15976 if eval $compile; then
15977     $echo "lchown() found." >&4
15978     val="$define"
15979 else
15980     $echo "lchown() NOT found." >&4
15981     val="$undef"
15982 fi
15983 set d_lchown
15984 eval $setvar
15985
15986 : See if number of significant digits in a double precision number is known
15987 echo " "
15988 $cat >ldbl_dig.c <<EOM
15989 #$i_limits I_LIMITS
15990 #$i_float I_FLOAT
15991 #ifdef I_LIMITS
15992 #include <limits.h>
15993 #endif
15994 #ifdef I_FLOAT
15995 #include <float.h>
15996 #endif
15997 #ifdef LDBL_DIG
15998 printf("Contains LDBL_DIG");
15999 #endif
16000 EOM
16001 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16002 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16003         echo "LDBL_DIG found." >&4
16004         val="$define"
16005 else
16006         echo "LDBL_DIG NOT found." >&4
16007         val="$undef"
16008 fi
16009 $rm -f ldbl_dig.?
16010 set d_ldbl_dig
16011 eval $setvar
16012
16013 : see if lgamma exists
16014 set lgamma d_lgamma
16015 eval $inlibc
16016
16017 : see if lgamma_r exists
16018 set lgamma_r d_lgamma_r
16019 eval $inlibc
16020
16021 : check to see if math.h defines _LIB_VERSION
16022 d_libm_lib_version="$undef"
16023 case $i_math in
16024     $define)
16025         echo " "
16026         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16027         $cat >try.c <<EOCP
16028 #include <unistd.h>
16029 #include <math.h>
16030 int main (int argc, char *argv[])
16031 {
16032     printf ("%d\n", _LIB_VERSION);
16033     return (0);
16034     } /* main */
16035 EOCP
16036         set try
16037         if eval $compile; then
16038             foo=`$run ./try`
16039             echo "Yes, it does ($foo)" >&4
16040             d_libm_lib_version="$define"
16041         else
16042             echo "No, it does not (probably harmless)" >&4
16043             fi
16044         $rm_try
16045         ;;
16046
16047     esac
16048
16049 : see if link exists
16050 set link d_link
16051 eval $inlibc
16052
16053 : see if llrint exists
16054 set llrint d_llrint
16055 eval $inlibc
16056
16057 : see if llrintl exists
16058 set llrintl d_llrintl
16059 eval $inlibc
16060
16061 : see if llround exists
16062 set llround d_llround
16063 eval $inlibc
16064
16065 : see if llroundl exists
16066 set llroundl d_llroundl
16067 eval $inlibc
16068
16069 : see if localtime_r exists
16070 set localtime_r d_localtime_r
16071 eval $inlibc
16072 case "$d_localtime_r" in
16073 "$define")
16074         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16075         case "$d_localtime_r_proto:$usethreads" in
16076         ":define")      d_localtime_r_proto=define
16077                 set d_localtime_r_proto localtime_r $hdrs
16078                 eval $hasproto ;;
16079         *)      ;;
16080         esac
16081         case "$d_localtime_r_proto" in
16082         define)
16083         case "$localtime_r_proto" in
16084         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16085         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16086         esac
16087         case "$localtime_r_proto" in
16088         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16089         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16090         esac
16091         case "$localtime_r_proto" in
16092         ''|0)   d_localtime_r=undef
16093                 localtime_r_proto=0
16094                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16095         * )     case "$localtime_r_proto" in
16096                 REENTRANT_PROTO*) ;;
16097                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16098                 esac
16099                 echo "Prototype: $try" ;;
16100         esac
16101         ;;
16102         *)      case "$usethreads" in
16103                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16104                 esac
16105                 d_localtime_r=undef
16106                 localtime_r_proto=0
16107                 ;;
16108         esac
16109         ;;
16110 *)      localtime_r_proto=0
16111         ;;
16112 esac
16113
16114 : see if localtime_r calls tzset
16115 case "$localtime_r_proto" in
16116 REENTRANT_PROTO*)
16117         $cat >try.c <<EOCP
16118 /*  Does our libc's localtime_r call tzset ?
16119  *  return 0 if so, 1 otherwise.
16120  */
16121 #$i_systypes    I_SYS_TYPES
16122 #$i_unistd      I_UNISTD
16123 #$i_time        I_TIME
16124 #$i_stdlib      I_STDLIB
16125 #$i_string      I_STRING
16126 #$i_malloc      I_MALLOC
16127 #ifdef I_SYS_TYPES
16128 #  include <sys/types.h>
16129 #endif
16130 #ifdef I_UNISTD
16131 #  include <unistd.h>
16132 #endif
16133 #ifdef I_TIME
16134 #  include <time.h>
16135 #endif
16136 #ifdef I_STDLIB
16137 #include <stdlib.h>
16138 #endif
16139 #ifdef I_STRING
16140 #  include <string.h>
16141 #else
16142 #  include <strings.h>
16143 #endif
16144 #ifdef I_MALLOC
16145 #  include <malloc.h>
16146 #endif
16147 int main()
16148 {
16149     time_t t = time(0L);
16150     char w_tz[]="TZ" "=GMT+5",
16151          e_tz[]="TZ" "=GMT-5",
16152         *tz_e = (char*)malloc(16),
16153         *tz_w = (char*)malloc(16);
16154     struct tm tm_e, tm_w;
16155     memset(&tm_e,'\0',sizeof(struct tm));
16156     memset(&tm_w,'\0',sizeof(struct tm));
16157     strcpy(tz_e,e_tz);
16158     strcpy(tz_w,w_tz);
16159
16160     putenv(tz_e);
16161     localtime_r(&t, &tm_e);
16162
16163     putenv(tz_w);
16164     localtime_r(&t, &tm_w);
16165
16166     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16167         return 1;
16168     return 0;
16169 }
16170 EOCP
16171         set try
16172         if eval $compile; then
16173             if $run ./try; then
16174                 d_localtime_r_needs_tzset=undef;
16175             else
16176                 d_localtime_r_needs_tzset=define;
16177             fi;
16178         else
16179             d_localtime_r_needs_tzset=undef;
16180         fi;
16181      ;;
16182   *)
16183      d_localtime_r_needs_tzset=undef;
16184      ;;
16185 esac
16186 $rm_try
16187
16188 : see if lockf exists
16189 set lockf d_lockf
16190 eval $inlibc
16191
16192 : see if log1p exists
16193 set log1p d_log1p
16194 eval $inlibc
16195
16196 : see if log2 exists
16197 set log2 d_log2
16198 eval $inlibc
16199
16200 : see if logb exists
16201 set logb d_logb
16202 eval $inlibc
16203
16204 : see if lrint exists
16205 set lrint d_lrint
16206 eval $inlibc
16207
16208 : see if lrintl exists
16209 set lrintl d_lrintl
16210 eval $inlibc
16211
16212 : see if lround exists
16213 set lround d_lround
16214 eval $inlibc
16215
16216 : see if lroundl exists
16217 set lroundl d_lroundl
16218 eval $inlibc
16219
16220 : see if prototype for lseek is available
16221 echo " "
16222 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16223 eval $hasproto
16224
16225 : see if lstat exists
16226 set lstat d_lstat
16227 eval $inlibc
16228
16229 : see if madvise exists
16230 set madvise d_madvise
16231 eval $inlibc
16232
16233 : see if malloc_size exists
16234 set malloc_size d_malloc_size
16235 eval $inlibc
16236
16237 : see if malloc_size_good exists
16238 set malloc_good_size d_malloc_good_size
16239 eval $inlibc
16240
16241 : see if mblen exists
16242 set mblen d_mblen
16243 eval $inlibc
16244
16245 : see if mbstowcs exists
16246 set mbstowcs d_mbstowcs
16247 eval $inlibc
16248
16249 : see if mbtowc exists
16250 set mbtowc d_mbtowc
16251 eval $inlibc
16252
16253 : see if memchr exists
16254 set memchr d_memchr
16255 eval $inlibc
16256
16257 : see if memcmp exists
16258 set memcmp d_memcmp
16259 eval $inlibc
16260
16261 : see if memcpy exists
16262 set memcpy d_memcpy
16263 eval $inlibc
16264
16265 : see if memmove exists
16266 set memmove d_memmove
16267 eval $inlibc
16268
16269 : see if memset exists
16270 set memset d_memset
16271 eval $inlibc
16272
16273 : see if mkdir exists
16274 set mkdir d_mkdir
16275 eval $inlibc
16276
16277 : see if mkdtemp exists
16278 set mkdtemp d_mkdtemp
16279 eval $inlibc
16280
16281 : see if mkfifo exists
16282 set mkfifo d_mkfifo
16283 eval $inlibc
16284
16285 : see if mkstemp exists
16286 set mkstemp d_mkstemp
16287 eval $inlibc
16288
16289 : see if mkstemps exists
16290 set mkstemps d_mkstemps
16291 eval $inlibc
16292
16293 : see if mktime exists
16294 set mktime d_mktime
16295 eval $inlibc
16296
16297 : see if this is a sys/mman.h system
16298 set sys/mman.h i_sysmman
16299 eval $inhdr
16300
16301 : see if mmap exists
16302 set mmap d_mmap
16303 eval $inlibc
16304 : see what shmat returns
16305 : default to something harmless
16306 mmaptype='void *'
16307 case "$i_sysmman$d_mmap" in
16308 "$define$define")
16309         $cat >mmap.c <<'END'
16310 #include <sys/mman.h>
16311 void *mmap();
16312 END
16313         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16314                 mmaptype='void *'
16315         else
16316                 mmaptype='caddr_t'
16317         fi
16318         echo "and it returns ($mmaptype)." >&4
16319         ;;
16320 esac
16321
16322
16323
16324 : see if sqrtl exists
16325 set sqrtl d_sqrtl
16326 eval $inlibc
16327
16328 : see if scalbnl exists
16329 set scalbnl d_scalbnl
16330 eval $inlibc
16331
16332 : see if truncl exists
16333 set truncl d_truncl
16334 eval $inlibc
16335
16336 : see if modfl exists
16337 set modfl d_modfl
16338 eval $inlibc
16339
16340 : see if prototype for modfl is available
16341 echo " "
16342 set d_modflproto modfl $i_math math.h
16343 eval $hasproto
16344
16345 d_modfl_pow32_bug="$undef"
16346
16347 case "$d_longdbl$d_modfl" in
16348 $define$define)
16349         $cat <<EOM
16350 Checking to see whether your modfl() is okay for large values...
16351 EOM
16352 $cat >try.c <<EOCP
16353 #include <math.h>
16354 #include <stdio.h>
16355 EOCP
16356 if $test "X$d_modflproto" != "X$define"; then
16357         $cat >>try.c <<EOCP
16358 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16359 long double modfl (long double, long double *);
16360 EOCP
16361 fi
16362 $cat >>try.c <<EOCP
16363 int main() {
16364     long double nv = 4294967303.15;
16365     long double v, w;
16366     v = modfl(nv, &w);
16367 #ifdef __GLIBC__
16368     printf("glibc");
16369 #endif
16370     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16371     return 0;
16372 }
16373 EOCP
16374         case "$osname:$gccversion" in
16375         aix:)   saveccflags="$ccflags"
16376                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16377         esac
16378         set try
16379         if eval $compile; then
16380                 foo=`$run ./try`
16381                 case "$foo" in
16382                 *" 4294967303.150000 1.150000 4294967302.000000")
16383                         echo >&4 "Your modfl() is broken for large values."
16384                         d_modfl_pow32_bug="$define"
16385                         case "$foo" in
16386                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16387                         ;;
16388                         esac
16389                         ;;
16390                 *" 4294967303.150000 0.150000 4294967303.000000")
16391                         echo >&4 "Your modfl() seems okay for large values."
16392                         ;;
16393                 *)      echo >&4 "I don't understand your modfl() at all."
16394                         d_modfl="$undef"
16395                         ;;
16396                 esac
16397                 $rm_try
16398         else
16399                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16400                 d_modfl="$undef"
16401         fi
16402         case "$osname:$gccversion" in
16403         aix:)   ccflags="$saveccflags" ;; # restore
16404         esac
16405         ;;
16406 esac
16407
16408 if $test "$uselongdouble" = "$define"; then
16409     message=""
16410     if $test "$d_sqrtl" != "$define"; then
16411         message="$message sqrtl"
16412     fi
16413     if $test "$d_modfl" != "$define"; then
16414         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16415             echo "You have both truncl and copysignl, so I can emulate modfl."
16416         else
16417             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16418                 echo "You have both aintl and copysignl, so I can emulate modfl."
16419             else
16420                 message="$message modfl"
16421             fi
16422         fi
16423     fi
16424     if $test "$d_frexpl" != "$define"; then
16425         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16426             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16427         else
16428             message="$message frexpl"
16429         fi
16430     fi
16431     if $test "$d_ldexpl" != "$define"; then
16432         message="$message ldexpl"
16433     fi
16434
16435     if $test "$message" != ""; then
16436         $cat <<EOM >&4
16437
16438 *** You requested the use of long doubles but you do not seem to have
16439 *** the following mathematical functions needed for long double support:
16440 ***    $message
16441 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16442 *** Cannot continue, aborting.
16443
16444 EOM
16445
16446         exit 1
16447     fi
16448 fi
16449
16450 : see if mprotect exists
16451 set mprotect d_mprotect
16452 eval $inlibc
16453
16454 : see if msgctl exists
16455 set msgctl d_msgctl
16456 eval $inlibc
16457
16458 : see if msgget exists
16459 set msgget d_msgget
16460 eval $inlibc
16461
16462 : see if msgsnd exists
16463 set msgsnd d_msgsnd
16464 eval $inlibc
16465
16466 : see if msgrcv exists
16467 set msgrcv d_msgrcv
16468 eval $inlibc
16469
16470 : see how much of the 'msg*(2)' library is present.
16471 h_msg=true
16472 echo " "
16473 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16474 *"$undef"*) h_msg=false;;
16475 esac
16476 case "$osname" in
16477 freebsd)
16478     case "`ipcs 2>&1`" in
16479     "SVID messages"*"not configured"*)
16480         echo "Your $osname does not have the msg*(2) configured." >&4
16481         h_msg=false
16482         val="$undef"
16483         set msgctl d_msgctl
16484         eval $setvar
16485         set msgget d_msgget
16486         eval $setvar
16487         set msgsnd d_msgsnd
16488         eval $setvar
16489         set msgrcv d_msgrcv
16490         eval $setvar
16491         ;;
16492     esac
16493     ;;
16494 esac
16495 : we could also check for sys/ipc.h ...
16496 if $h_msg && $test `./findhdr sys/msg.h`; then
16497         echo "You have the full msg*(2) library." >&4
16498         val="$define"
16499 else
16500         echo "You don't have the full msg*(2) library." >&4
16501         val="$undef"
16502 fi
16503 set d_msg
16504 eval $setvar
16505
16506 : Check for msghdr_s
16507 echo " "
16508 echo "Checking to see if your system supports struct msghdr..." >&4
16509 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16510 eval $hasstruct
16511 case "$d_msghdr_s" in
16512 "$define")      echo "Yes, it does."   ;;
16513 *)              echo "No, it doesn't." ;;
16514 esac
16515
16516
16517 : see if msync exists
16518 set msync d_msync
16519 eval $inlibc
16520
16521 : see if munmap exists
16522 set munmap d_munmap
16523 eval $inlibc
16524
16525 : see if nan exists
16526 set nan d_nan
16527 eval $inlibc
16528
16529 : see if nearbyint exists
16530 set nearbyint d_nearbyint
16531 eval $inlibc
16532
16533 : see if nextafter exists
16534 set nextafter d_nextafter
16535 eval $inlibc
16536
16537 : see if nexttoward exists
16538 set nexttoward d_nexttoward
16539 eval $inlibc
16540
16541 : see if nice exists
16542 set nice d_nice
16543 eval $inlibc
16544
16545 : see if this is a langinfo.h system
16546 set langinfo.h i_langinfo
16547 eval $inhdr
16548
16549 : see if nl_langinfo exists
16550 set nl_langinfo d_nl_langinfo
16551 eval $inlibc
16552
16553 : see if this is a quadmath.h system
16554 set quadmath.h i_quadmath
16555 eval $inhdr
16556
16557 : check for volatile keyword
16558 echo " "
16559 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16560 $cat >try.c <<'EOCP'
16561 int main()
16562 {
16563         typedef struct _goo_struct goo_struct;
16564         goo_struct * volatile goo = ((goo_struct *)0);
16565         struct _goo_struct {
16566                 long long_int;
16567                 int reg_int;
16568                 char char_var;
16569         };
16570         typedef unsigned short foo_t;
16571         char *volatile foo;
16572         volatile int bar;
16573         volatile foo_t blech;
16574         foo = foo;
16575 }
16576 EOCP
16577 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16578         val="$define"
16579         echo "Yup, it does."
16580 else
16581         val="$undef"
16582         echo "Nope, it doesn't."
16583 fi
16584 set d_volatile
16585 eval $setvar
16586 $rm_try
16587
16588 : Check basic sizes
16589 echo " "
16590 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16591
16592 case "$use64bitint:$d_quad:$quadtype" in
16593 define:define:?*)
16594         ivtype="$quadtype"
16595         uvtype="$uquadtype"
16596         ivsize=8
16597         uvsize=8
16598         ;;
16599 *)      ivtype="long"
16600         uvtype="unsigned long"
16601         ivsize=$longsize
16602         uvsize=$longsize
16603         ;;
16604 esac
16605
16606 case "$uselongdouble:$d_longdbl" in
16607 define:define)
16608         nvtype="long double"
16609         nvsize=$longdblsize
16610         ;;
16611 *)      nvtype=double
16612         nvsize=$doublesize
16613         ;;
16614 esac
16615
16616 case "$usequadmath:$i_quadmath" in
16617 define:define)
16618   nvtype="__float128"
16619   nvsize=16
16620   case "$libs" in
16621   *quadmath*) ;;
16622   *) $cat <<EOM >&4
16623
16624 *** You requested the use of the quadmath library, but you
16625 *** do not seem to have the quadmath library installed.
16626 *** Cannot continue, aborting.
16627 EOM
16628     exit 1
16629     ;;
16630   esac
16631   ;;
16632 define:*) $cat <<EOM >&4
16633
16634 *** You requested the use of the quadmath library, but you
16635 *** do not seem to have the required header, <quadmath.h>.
16636 EOM
16637   case "$gccversion" in
16638   [23].*|4.[0-5]*)
16639    $cat <<EOM >&4
16640 *** Your gcc looks a bit old:
16641 *** $gccversion
16642 EOM
16643     ;;
16644   '')
16645    $cat <<EOM >&4
16646 *** You are not running a gcc.
16647 EOM
16648     ;;
16649   esac
16650   $cat <<EOM >&4
16651 *** For the quadmath library you need at least gcc 4.6.
16652 *** Cannot continue, aborting.
16653 EOM
16654   exit 1
16655   ;;
16656 esac
16657
16658 $echo "(IV will be "$ivtype", $ivsize bytes)"
16659 $echo "(UV will be "$uvtype", $uvsize bytes)"
16660 $echo "(NV will be "$nvtype", $nvsize bytes)"
16661
16662 $cat >try.c <<EOCP
16663 #$i_inttypes I_INTTYPES
16664 #ifdef I_INTTYPES
16665 #include <inttypes.h>
16666 #endif
16667 #include <stdio.h>
16668 int main() {
16669 #ifdef INT8
16670    int8_t i =  INT8_MAX;
16671   uint8_t u = UINT8_MAX;
16672   printf("int8_t\n");
16673 #endif
16674 #ifdef INT16
16675    int16_t i =  INT16_MAX;
16676   uint16_t u = UINT16_MAX;
16677   printf("int16_t\n");
16678 #endif
16679 #ifdef INT32
16680    int32_t i =  INT32_MAX;
16681   uint32_t u = UINT32_MAX;
16682   printf("int32_t\n");
16683 #endif
16684 }
16685 EOCP
16686
16687 i8type="signed char"
16688 u8type="unsigned char"
16689 i8size=1
16690 u8size=1
16691
16692 case "$i16type" in
16693 '')     case "$shortsize" in
16694         2)      i16type=short
16695                 u16type="unsigned short"
16696                 i16size=$shortsize
16697                 u16size=$shortsize
16698                 ;;
16699         esac
16700         ;;
16701 esac
16702 case "$i16type" in
16703 '')     set try -DINT16
16704         if eval $compile; then
16705                 case "`$run ./try`" in
16706                 int16_t)
16707                         i16type=int16_t
16708                         u16type=uint16_t
16709                         i16size=2
16710                         u16size=2
16711                         ;;
16712                 esac
16713         fi
16714         ;;
16715 esac
16716 case "$i16type" in
16717 '')     if $test $shortsize -ge 2; then
16718                 i16type=short
16719                 u16type="unsigned short"
16720                 i16size=$shortsize
16721                 u16size=$shortsize
16722         fi
16723         ;;
16724 esac
16725
16726 case "$i32type" in
16727 '')     case "$longsize" in
16728         4)      i32type=long
16729                 u32type="unsigned long"
16730                 i32size=$longsize
16731                 u32size=$longsize
16732                 ;;
16733         *)      case "$intsize" in
16734                 4)      i32type=int
16735                         u32type="unsigned int"
16736                         i32size=$intsize
16737                         u32size=$intsize
16738                         ;;
16739                 esac
16740                 ;;
16741         esac
16742         ;;
16743 esac
16744 case "$i32type" in
16745 '')     set try -DINT32
16746         if eval $compile; then
16747                 case "`$run ./try`" in
16748                 int32_t)
16749                         i32type=int32_t
16750                         u32type=uint32_t
16751                         i32size=4
16752                         u32size=4
16753                         ;;
16754                 esac
16755         fi
16756         ;;
16757 esac
16758 case "$i32type" in
16759 '')     if $test $intsize -ge 4; then
16760                 i32type=int
16761                 u32type="unsigned int"
16762                 i32size=$intsize
16763                 u32size=$intsize
16764         fi
16765         ;;
16766 esac
16767
16768 case "$i64type" in
16769 '')     case "$d_quad:$quadtype" in
16770         define:?*)
16771                 i64type="$quadtype"
16772                 u64type="$uquadtype"
16773                 i64size=8
16774                 u64size=8
16775                 ;;
16776         esac
16777         ;;
16778 esac
16779
16780 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16781 : volatile so that the compiler has to store it out to memory.
16782 if test X"$d_volatile" = X"$define"; then
16783         volatile=volatile
16784 fi
16785 $cat <<EOP >try.c
16786 #include <stdio.h>
16787 #$i_stdlib I_STDLIB
16788 #ifdef I_STDLIB
16789 #include <stdlib.h>
16790 #endif
16791 #include <sys/types.h>
16792 #include <signal.h>
16793 #ifdef SIGFPE
16794 $volatile int bletched = 0;
16795 $signal_t blech(int s) { bletched = 1; }
16796 #endif
16797 int main() {
16798     $uvtype u = 0;
16799     $nvtype d;
16800     int     n = 8 * $uvsize;
16801     int     i;
16802 #ifdef SIGFPE
16803     signal(SIGFPE, blech);
16804 #endif
16805
16806     for (i = 0; i < n; i++) {
16807       u = u << 1 | ($uvtype)1;
16808       d = ($nvtype)u;
16809       if (($uvtype)d != u)
16810         break;
16811       if (d <= 0)
16812         break;
16813       d = ($nvtype)(u - 1);
16814       if (($uvtype)d != (u - 1))
16815         break;
16816 #ifdef SIGFPE
16817       if (bletched)
16818         break;
16819 #endif
16820     }
16821     printf("%d\n", ((i == n) ? -n : i));
16822     exit(0);
16823 }
16824 EOP
16825 set try
16826
16827 d_nv_preserves_uv="$undef"
16828 if eval $compile; then
16829         nv_preserves_uv_bits="`$run ./try`"
16830 fi
16831 case "$nv_preserves_uv_bits" in
16832 \-[1-9]*)
16833         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16834         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16835         d_nv_preserves_uv="$define"
16836         ;;
16837 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16838         d_nv_preserves_uv="$undef" ;;
16839 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16840         nv_preserves_uv_bits="0" ;;
16841 esac
16842 $rm_try
16843
16844 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16845 : volatile so that the compiler has to store it out to memory.
16846 if test X"$d_volatile" = X"$define"; then
16847         volatile=volatile
16848 fi
16849 $cat <<EOP >try.c
16850 #include <stdio.h>
16851
16852 typedef $nvtype NV;
16853
16854 int
16855 main() {
16856   NV value = 2;
16857   int count = 1;
16858
16859   while(count < 256) {
16860     $volatile NV up = value + 1.0;
16861     $volatile NV negated = -value;
16862     $volatile NV down = negated - 1.0;
16863     $volatile NV got_up = up - value;
16864     int up_good = got_up == 1.0;
16865     int got_down = down - negated;
16866     int down_good = got_down == -1.0;
16867
16868     if (down_good != up_good) {
16869       fprintf(stderr,
16870               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16871               up_good, (double) got_up, down_good, (double) got_down,
16872               count, (double) value);
16873       return 1;
16874     }
16875     if (!up_good) {
16876       while (1) {
16877         if (count > 8) {
16878           count -= 8;
16879           fputs("256.0", stdout);
16880         } else {
16881           count--;
16882           fputs("2.0", stdout);
16883         }
16884         if (!count) {
16885           puts("");
16886           return 0;
16887         }
16888         fputs("*", stdout);
16889       }
16890     }
16891     value *= 2;
16892     ++count;
16893   }
16894   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16895           count, (double) value);
16896   return 1;
16897 }
16898 EOP
16899 set try
16900
16901 nv_overflows_integers_at='0'
16902 if eval $compile; then
16903     xxx="`$run ./try`"
16904     case "$?" in
16905         0)
16906             case "$xxx" in
16907                 2*)  cat >&4 <<EOM
16908 The largest integer your NVs can preserve is equal to $xxx
16909 EOM
16910                     nv_overflows_integers_at="$xxx"
16911                     ;;
16912                 *)  cat >&4 <<EOM
16913 Cannot determine the largest integer value your NVs can hold, unexpected output
16914 '$xxx'
16915 EOM
16916                     ;;
16917             esac
16918             ;;
16919         *)  cat >&4 <<EOM
16920 Cannot determine the largest integer value your NVs can hold
16921 EOM
16922             ;;
16923     esac
16924 fi
16925 $rm_try
16926
16927 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16928 : volatile so that the compiler has to store it out to memory.
16929 if test X"$d_volatile" = X"$define"; then
16930         volatile=volatile
16931 fi
16932 $cat <<EOP >try.c
16933 #include <stdio.h>
16934 #$i_stdlib I_STDLIB
16935 #ifdef I_STDLIB
16936 #include <stdlib.h>
16937 #endif
16938 #$i_string I_STRING
16939 #ifdef I_STRING
16940 #  include <string.h>
16941 #else
16942 #  include <strings.h>
16943 #endif
16944 #include <sys/types.h>
16945 #include <signal.h>
16946 #ifdef SIGFPE
16947 $volatile int bletched = 0;
16948 $signal_t blech(int s) { bletched = 1; }
16949 #endif
16950
16951 int checkit($nvtype d, char *where) {
16952     unsigned char *p = (char *)&d;
16953     unsigned char *end = p + sizeof(d);
16954     int fail = 0;
16955
16956     while (p < end)
16957         fail += *p++;
16958
16959     if (!fail)
16960         return 0;
16961
16962     p = (char *)&d;
16963     printf("No - %s: 0x", where);
16964     while (p < end)
16965         printf ("%02X", *p++);
16966     printf("\n");
16967     return 1;
16968 }
16969
16970 int main(int argc, char **argv) {
16971     $nvtype d = 0.0;
16972     int fail = 0;
16973     fail += checkit(d, "0.0");
16974
16975     /* The compiler shouldn't be assuming that bletched is 0  */
16976     d = bletched;
16977
16978     fail += checkit(d, "bleched");
16979
16980 #ifdef SIGFPE
16981     signal(SIGFPE, blech);
16982 #endif
16983
16984     /* Paranoia - the compiler should have no way of knowing that ANSI says
16985        that argv[argc] will always be NULL.  Actually, if it did assume this it
16986        would be buggy, as this is C and main() can be called from elsewhere in
16987        the program.  */
16988     d = argv[argc] ? 1 : 0;
16989
16990     if (d) {
16991         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16992     }
16993
16994     fail += checkit(d, "ternary");
16995
16996     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16997
16998     if (d != 0.0) {
16999         printf("No - memset doesn't give 0.0\n");
17000         /* This might just blow up:  */
17001         printf("(gives %g)\n", d);
17002         return 1;
17003     }
17004
17005 #ifdef SIGFPE
17006     if (bletched) {
17007         printf("No - something bleched\n");
17008         return 1;
17009     }
17010 #endif
17011     if (fail) {
17012       printf("No - %d fail(s)\n", fail);
17013       return 1;
17014     }
17015     printf("Yes\n");
17016     return 0;
17017 }
17018 EOP
17019 set try
17020
17021 d_nv_zero_is_allbits_zero="$undef"
17022 if eval $compile; then
17023     xxx="`$run ./try`"
17024     case "$?" in
17025         0)
17026             case "$xxx" in
17027                 Yes)  cat >&4 <<EOM
17028 0.0 is represented as all bits zero in memory
17029 EOM
17030                     d_nv_zero_is_allbits_zero="$define"
17031                     ;;
17032                 *)  cat >&4 <<EOM
17033 0.0 is not represented as all bits zero in memory
17034 EOM
17035                     d_nv_zero_is_allbits_zero="$undef"
17036                     ;;
17037             esac
17038             ;;
17039         *)  cat >&4 <<EOM
17040 0.0 is not represented as all bits zero in memory
17041 EOM
17042             d_nv_zero_is_allbits_zero="$undef"
17043             ;;
17044     esac
17045 fi
17046 $rm_try
17047
17048 : check for off64_t
17049 echo " "
17050 echo "Checking to see if you have off64_t..." >&4
17051 $cat >try.c <<EOCP
17052 #include <sys/types.h>
17053 #include <unistd.h>
17054 int main() { off64_t x = 7; }
17055 EOCP
17056 set try
17057 if eval $compile; then
17058         val="$define"
17059         echo "You have off64_t."
17060 else
17061         val="$undef"
17062         echo "You do not have off64_t."
17063         case "$lseeksize" in
17064         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17065         esac
17066 fi
17067 $rm_try
17068 set d_off64_t
17069 eval $setvar
17070
17071 : how to create joinable pthreads
17072 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17073         echo " "
17074         echo "Checking what constant to use for creating joinable pthreads..." >&4
17075         $cat >try.c <<'EOCP'
17076 #include <pthread.h>
17077 int main() {
17078     int detachstate = JOINABLE;
17079 }
17080 EOCP
17081         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17082         if eval $compile; then
17083                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17084                 val="$undef" # Yes, undef.
17085                 set d_old_pthread_create_joinable
17086                 eval $setvar
17087                 val=""
17088                 set old_pthread_create_joinable
17089                 eval $setvar
17090         else
17091                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17092                 if eval $compile; then
17093                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17094                         val="$define"
17095                         set d_old_pthread_create_joinable
17096                         eval $setvar
17097                         val=PTHREAD_CREATE_UNDETACHED
17098                         set old_pthread_create_joinable
17099                         eval $setvar
17100                 else
17101                         set try -DJOINABLE=__UNDETACHED
17102                         if eval $compile; then
17103                                 echo "You seem to use __UNDETACHED." >&4
17104                                 val="$define"
17105                                 set d_old_pthread_create_joinable
17106                                 eval $setvar
17107                                 val=__UNDETACHED
17108                                 set old_pthread_create_joinable
17109                                 eval $setvar
17110                         else
17111                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17112                                 val="$define"
17113                                 set d_old_pthread_create_joinable
17114                                 eval $setvar
17115                                 val=0
17116                                 set old_pthread_create_joinable
17117                                 eval $setvar
17118                         fi
17119                 fi
17120         fi
17121         $rm_try
17122 else
17123     d_old_pthread_create_joinable="$undef"
17124     old_pthread_create_joinable=""
17125 fi
17126
17127 : see if pause exists
17128 set pause d_pause
17129 eval $inlibc
17130
17131 : see if poll exists
17132 set poll d_poll
17133 eval $inlibc
17134
17135 : see if prctl exists
17136 set prctl d_prctl
17137 eval $inlibc
17138
17139 : see if prctl supports PR_SET_NAME
17140 d_prctl_set_name=$undef
17141 case $d_prctl in
17142     $define)
17143         $cat >try.c <<EOM
17144 #ifdef __ANDROID__
17145 #include <unistd.h>
17146 #endif
17147 #include <sys/prctl.h>
17148
17149 int main (int argc, char *argv[])
17150 {
17151     return (prctl (PR_SET_NAME, "Test"));
17152     } /* main */
17153 EOM
17154         set try
17155         if eval $compile_ok && $run ./try; then
17156             echo "Your prctl (PR_SET_NAME, ...) works"
17157             d_prctl_set_name=$define
17158             fi
17159         $rm_try
17160         ;;
17161     esac
17162
17163 : see if readlink exists
17164 set readlink d_readlink
17165 eval $inlibc
17166
17167 : Check if there is a /proc symlink to the abs path of
17168 : the executing program.  We will honor hints of d_procselfexe=$undef
17169 : or procselfexe being non-empty, otherwise will try to determine both
17170 : if we have readlink.
17171 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17172 : referenced, and AmigaOS does not have a proc filesystem anyway.
17173 echo " "
17174 val="$undef"
17175 if $test "X$d_procselfexe" = Xundef; then
17176         procselfexe=''
17177 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17178         val="$define"
17179 elif $test "X$d_readlink" = Xdefine; then
17180         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17181         : and it feels more tidy to avoid an extra level of symlink
17182         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17183         while test $# -gt 0; do
17184             type=$1; try=$2
17185             shift; shift
17186             if $issymlink $try; then
17187                 $ls -l $try > reflect
17188                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17189                     echo "You have $type-like $try."
17190                     procselfexe='"'$try'"'
17191                     val="$define"
17192                     : This will break out of the loop
17193                     set X; shift
17194                 fi
17195             fi
17196         done
17197 fi
17198 $rm -f reflect
17199 set d_procselfexe
17200 eval $setvar
17201
17202 : backward compatibility for d_hvfork
17203 if test X$d_hvfork != X; then
17204         d_vfork="$d_hvfork"
17205         d_hvfork=''
17206 fi
17207 : see if there is a vfork
17208 val=''
17209 set vfork val
17210 eval $inlibc
17211
17212 d_pseudofork=$undef
17213
17214 : Ok, but do we want to use it. vfork is reportedly unreliable in
17215 : perl on Solaris 2.x, and probably elsewhere.
17216 case "$val" in
17217 $define)
17218         echo " "
17219         case "$usevfork" in
17220         false) dflt='n';;
17221         *) dflt='y';;
17222         esac
17223         cat <<'EOM'
17224
17225 Perl can only use a vfork() that doesn't suffer from strict
17226 restrictions on calling functions or modifying global data in
17227 the child.  For example, glibc-2.1 contains such a vfork()
17228 that is unsuitable.  If your system provides a proper fork()
17229 call, chances are that you do NOT want perl to use vfork().
17230
17231 EOM
17232         rp="Do you still want to use vfork()?"
17233         . ./myread
17234         case "$ans" in
17235         y|Y) ;;
17236         *)
17237                 echo "Ok, we won't use vfork()."
17238                 val="$undef"
17239                 ;;
17240         esac
17241         ;;
17242 esac
17243 set d_vfork
17244 eval $setvar
17245 case "$d_vfork" in
17246 $define) usevfork='true';;
17247 *) usevfork='false';;
17248 esac
17249
17250 : see whether the pthread_atfork exists
17251 $cat >try.c <<EOP
17252 #include <pthread.h>
17253 #include <stdio.h>
17254 int main() {
17255 #ifdef  PTHREAD_ATFORK
17256         pthread_atfork(NULL,NULL,NULL);
17257 #endif
17258 }
17259 EOP
17260
17261 : see if pthread_atfork exists
17262 set try -DPTHREAD_ATFORK
17263 if eval $compile; then
17264     val="$define"
17265 else
17266     val="$undef"
17267 fi
17268 case "$usethreads" in
17269 $define)
17270         case "$val" in
17271         $define) echo 'pthread_atfork found.' >&4        ;;
17272         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17273         esac
17274 esac
17275 set d_pthread_atfork
17276 eval $setvar
17277
17278 : see if pthread_attr_setscope exists
17279 set pthread_attr_setscope d_pthread_attr_setscope
17280 eval $inlibc
17281
17282 : see whether the various POSIXish _yields exist
17283 $cat >try.c <<EOP
17284 #include <pthread.h>
17285 #include <stdio.h>
17286 int main() {
17287 #ifdef SCHED_YIELD
17288         sched_yield();
17289 #else
17290 #ifdef PTHREAD_YIELD
17291         pthread_yield();
17292 #else
17293 #ifdef PTHREAD_YIELD_NULL
17294         pthread_yield(NULL);
17295 #endif
17296 #endif
17297 #endif
17298 }
17299 EOP
17300 : see if sched_yield exists
17301 set try -DSCHED_YIELD
17302 if eval $compile; then
17303     val="$define"
17304     sched_yield='sched_yield()'
17305 else
17306     val="$undef"
17307 fi
17308 case "$usethreads" in
17309 $define)
17310         case "$val" in
17311         $define) echo 'sched_yield() found.' >&4        ;;
17312         *)       echo 'sched_yield() NOT found.' >&4    ;;
17313         esac
17314 esac
17315 set d_sched_yield
17316 eval $setvar
17317
17318 : see if pthread_yield exists
17319 set try -DPTHREAD_YIELD
17320 if eval $compile; then
17321     val="$define"
17322     case "$sched_yield" in
17323     '') sched_yield='pthread_yield()' ;;
17324     esac
17325 else
17326     set try -DPTHREAD_YIELD_NULL
17327     if eval $compile; then
17328         val="$define"
17329         case "$sched_yield" in
17330         '') sched_yield='pthread_yield(NULL)' ;;
17331         esac
17332     else
17333         val="$undef"
17334     fi
17335 fi
17336 case "$usethreads" in
17337 $define)
17338         case "$val" in
17339         $define) echo 'pthread_yield() found.' >&4      ;;
17340         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17341         esac
17342         ;;
17343 esac
17344 set d_pthread_yield
17345 eval $setvar
17346 case "$sched_yield" in
17347 '') sched_yield=undef ;;
17348 esac
17349 $rm_try
17350
17351 : check for ptrdiff_t
17352 echo " "
17353 echo "Checking to see if you have ptrdiff_t..." >&4
17354 $cat >try.c <<EOCP
17355 #include <stddef.h>
17356 int main() { ptrdiff_t x = 7; }
17357 EOCP
17358 set try
17359 if eval $compile; then
17360         val="$define"
17361         echo "You have ptrdiff_t."
17362 else
17363         val="$undef"
17364         echo "You do not have ptrdiff_t."
17365 fi
17366 $rm_try
17367 set d_ptrdiff_t
17368 eval $setvar
17369
17370 : see if random_r exists
17371 set random_r d_random_r
17372 eval $inlibc
17373 case "$d_random_r" in
17374 "$define")
17375         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17376         case "$d_random_r_proto:$usethreads" in
17377         ":define")      d_random_r_proto=define
17378                 set d_random_r_proto random_r $hdrs
17379                 eval $hasproto ;;
17380         *)      ;;
17381         esac
17382         case "$d_random_r_proto" in
17383         define)
17384         case "$random_r_proto" in
17385         ''|0) try='int random_r(int*, struct random_data*);'
17386         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17387         esac
17388         case "$random_r_proto" in
17389         ''|0) try='int random_r(long*, struct random_data*);'
17390         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17391         esac
17392         case "$random_r_proto" in
17393         ''|0) try='int random_r(struct random_data*, int32_t*);'
17394         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17395         esac
17396         case "$random_r_proto" in
17397         ''|0)   d_random_r=undef
17398                 random_r_proto=0
17399                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17400         * )     case "$random_r_proto" in
17401                 REENTRANT_PROTO*) ;;
17402                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17403                 esac
17404                 echo "Prototype: $try" ;;
17405         esac
17406         ;;
17407         *)      case "$usethreads" in
17408                 define) echo "random_r has no prototype, not using it." >&4 ;;
17409                 esac
17410                 d_random_r=undef
17411                 random_r_proto=0
17412                 ;;
17413         esac
17414         ;;
17415 *)      random_r_proto=0
17416         ;;
17417 esac
17418
17419 : see if readdir and friends exist
17420 set readdir d_readdir
17421 eval $inlibc
17422 set seekdir d_seekdir
17423 eval $inlibc
17424 set telldir d_telldir
17425 eval $inlibc
17426 set rewinddir d_rewinddir
17427 eval $inlibc
17428
17429 : see if readdir64_r exists
17430 set readdir64_r d_readdir64_r
17431 eval $inlibc
17432 case "$d_readdir64_r" in
17433 "$define")
17434         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17435         case "$d_readdir64_r_proto:$usethreads" in
17436         ":define")      d_readdir64_r_proto=define
17437                 set d_readdir64_r_proto readdir64_r $hdrs
17438                 eval $hasproto ;;
17439         *)      ;;
17440         esac
17441         case "$d_readdir64_r_proto" in
17442         define)
17443         case "$readdir64_r_proto" in
17444         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17445         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17446         esac
17447         case "$readdir64_r_proto" in
17448         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17449         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17450         esac
17451         case "$readdir64_r_proto" in
17452         ''|0)   d_readdir64_r=undef
17453                 readdir64_r_proto=0
17454                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17455         * )     case "$readdir64_r_proto" in
17456                 REENTRANT_PROTO*) ;;
17457                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17458                 esac
17459                 echo "Prototype: $try" ;;
17460         esac
17461         ;;
17462         *)      case "$usethreads" in
17463                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17464                 esac
17465                 d_readdir64_r=undef
17466                 readdir64_r_proto=0
17467                 ;;
17468         esac
17469         ;;
17470 *)      readdir64_r_proto=0
17471         ;;
17472 esac
17473
17474 : see if readdir_r exists
17475 set readdir_r d_readdir_r
17476 eval $inlibc
17477 case "$d_readdir_r" in
17478 "$define")
17479         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17480         case "$d_readdir_r_proto:$usethreads" in
17481         ":define")      d_readdir_r_proto=define
17482                 set d_readdir_r_proto readdir_r $hdrs
17483                 eval $hasproto ;;
17484         *)      ;;
17485         esac
17486         case "$d_readdir_r_proto" in
17487         define)
17488         case "$readdir_r_proto" in
17489         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17490         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17491         esac
17492         case "$readdir_r_proto" in
17493         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17494         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17495         esac
17496         case "$readdir_r_proto" in
17497         ''|0)   d_readdir_r=undef
17498                 readdir_r_proto=0
17499                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17500         * )     case "$readdir_r_proto" in
17501                 REENTRANT_PROTO*) ;;
17502                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17503                 esac
17504                 echo "Prototype: $try" ;;
17505         esac
17506         ;;
17507         *)      case "$usethreads" in
17508                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17509                 esac
17510                 d_readdir_r=undef
17511                 readdir_r_proto=0
17512                 ;;
17513         esac
17514         ;;
17515 *)      readdir_r_proto=0
17516         ;;
17517 esac
17518
17519 : see if readv exists
17520 set readv d_readv
17521 eval $inlibc
17522
17523 : see if recvmsg exists
17524 set recvmsg d_recvmsg
17525 eval $inlibc
17526
17527 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17528 echo " "
17529 if set regcomp val -f d_regcomp; eval $csym; $val; then
17530         echo 'regcomp() found.' >&4
17531         d_regcomp="$define"
17532         d_regcmp="$undef"
17533         d_re_comp="$undef"
17534 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17535         echo 'regcmp() found.' >&4
17536         d_regcmp="$define"
17537         d_regcomp="$undef"
17538         d_re_comp="$undef"
17539 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17540         echo 're_comp() found, assuming re_exec() also exists.' >&4
17541         d_re_comp="$define"
17542         d_regcomp="$undef"
17543         d_regcmp="$undef"
17544 else
17545         $cat >&4 <<EOM
17546 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17547 EOM
17548         d_regcmp="$undef"
17549         d_re_comp="$undef"
17550         d_regcomp="$undef"
17551 fi
17552
17553 : see if remainder exists
17554 set remainder d_remainder
17555 eval $inlibc
17556
17557 : see if remquo exists
17558 set remquo d_remquo
17559 eval $inlibc
17560
17561 : see if rename exists
17562 set rename d_rename
17563 eval $inlibc
17564
17565 : see if rint exists
17566 set rint d_rint
17567 eval $inlibc
17568
17569 : see if rmdir exists
17570 set rmdir d_rmdir
17571 eval $inlibc
17572
17573 : see if round exists
17574 set round d_round
17575 eval $inlibc
17576
17577 : see if memory.h is available.
17578 val=''
17579 set memory.h val
17580 eval $inhdr
17581
17582 : See if it conflicts with string.h
17583 case "$val" in
17584 $define)
17585         case "$strings" in
17586         '') ;;
17587         *)
17588                 $cppstdin $cppflags $cppminus < $strings > mem.h
17589                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17590                         echo " "
17591                         echo "We won't be including <memory.h>."
17592                         val="$undef"
17593                 fi
17594                 $rm -f mem.h
17595                 ;;
17596         esac
17597 esac
17598 set i_memory
17599 eval $setvar
17600
17601 : can bcopy handle overlapping blocks?
17602 echo " "
17603 val="$undef"
17604 case "$d_memmove" in
17605 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17606 *)      case "$d_bcopy" in
17607         "$define")
17608                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17609                 $cat >try.c <<EOCP
17610 #$i_memory I_MEMORY
17611 #$i_stdlib I_STDLIB
17612 #$i_string I_STRING
17613 #$i_unistd I_UNISTD
17614 EOCP
17615         $cat >>try.c <<'EOCP'
17616 #include <stdio.h>
17617 #ifdef I_MEMORY
17618 #  include <memory.h>
17619 #endif
17620 #ifdef I_STDLIB
17621 #  include <stdlib.h>
17622 #endif
17623 #ifdef I_STRING
17624 #  include <string.h>
17625 #else
17626 #  include <strings.h>
17627 #endif
17628 #ifdef I_UNISTD
17629 #  include <unistd.h>  /* Needed for NetBSD */
17630 #endif
17631 int main()
17632 {
17633 char buf[128], abc[128];
17634 char *b;
17635 int len;
17636 int off;
17637 int align;
17638
17639 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17640    try to store the string in read-only memory. */
17641 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17642
17643 for (align = 7; align >= 0; align--) {
17644         for (len = 36; len; len--) {
17645                 b = buf+align;
17646                 bcopy(abc, b, len);
17647                 for (off = 1; off <= len; off++) {
17648                         bcopy(b, b+off, len);
17649                         bcopy(b+off, b, len);
17650                         if (bcmp(b, abc, len))
17651                                 exit(1);
17652                 }
17653         }
17654 }
17655 exit(0);
17656 }
17657 EOCP
17658                 set try
17659                 if eval $compile_ok; then
17660                         if $run ./try 2>/dev/null; then
17661                                 echo "Yes, it can."
17662                                 val="$define"
17663                         else
17664                                 echo "It can't, sorry."
17665                         fi
17666                 else
17667                         echo "(I can't compile the test program, so we'll assume not...)"
17668                 fi
17669                 ;;
17670         esac
17671         $rm_try
17672         ;;
17673 esac
17674 set d_safebcpy
17675 eval $setvar
17676
17677 : can memcpy handle overlapping blocks?
17678 echo " "
17679 val="$undef"
17680 case "$d_memmove" in
17681 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17682 *)      case "$d_memcpy" in
17683         "$define")
17684                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17685                 $cat >try.c <<EOCP
17686 #$i_memory I_MEMORY
17687 #$i_stdlib I_STDLIB
17688 #$i_string I_STRING
17689 #$i_unistd I_UNISTD
17690 EOCP
17691         $cat >>try.c <<'EOCP'
17692 #include <stdio.h>
17693 #ifdef I_MEMORY
17694 #  include <memory.h>
17695 #endif
17696 #ifdef I_STDLIB
17697 #  include <stdlib.h>
17698 #endif
17699 #ifdef I_STRING
17700 #  include <string.h>
17701 #else
17702 #  include <strings.h>
17703 #endif
17704 #ifdef I_UNISTD
17705 #  include <unistd.h>  /* Needed for NetBSD */
17706 #endif
17707 int main()
17708 {
17709 char buf[128], abc[128];
17710 char *b;
17711 int len;
17712 int off;
17713 int align;
17714
17715 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17716    try to store the string in read-only memory. */
17717 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17718
17719 for (align = 7; align >= 0; align--) {
17720         for (len = 36; len; len--) {
17721                 b = buf+align;
17722                 memcpy(b, abc, len);
17723                 for (off = 1; off <= len; off++) {
17724                         memcpy(b+off, b, len);
17725                         memcpy(b, b+off, len);
17726                         if (memcmp(b, abc, len))
17727                                 exit(1);
17728                 }
17729         }
17730 }
17731 exit(0);
17732 }
17733 EOCP
17734                 set try
17735                 if eval $compile_ok; then
17736                         if $run ./try 2>/dev/null; then
17737                                 echo "Yes, it can."
17738                                 val="$define"
17739                         else
17740                                 echo "It can't, sorry."
17741                         fi
17742                 else
17743                         echo "(I can't compile the test program, so we'll assume not...)"
17744                 fi
17745                 ;;
17746         esac
17747         $rm_try
17748         ;;
17749 esac
17750 set d_safemcpy
17751 eval $setvar
17752
17753 : can memcmp be trusted to compare relative magnitude?
17754 val="$undef"
17755 case "$d_memcmp" in
17756 "$define")
17757         echo " "
17758         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17759         $cat >try.c <<EOCP
17760 #$i_memory I_MEMORY
17761 #$i_stdlib I_STDLIB
17762 #$i_string I_STRING
17763 #$i_unistd I_UNISTD
17764 EOCP
17765         $cat >>try.c <<'EOCP'
17766 #include <stdio.h>
17767 #ifdef I_MEMORY
17768 #  include <memory.h>
17769 #endif
17770 #ifdef I_STDLIB
17771 #  include <stdlib.h>
17772 #endif
17773 #ifdef I_STRING
17774 #  include <string.h>
17775 #else
17776 #  include <strings.h>
17777 #endif
17778 #ifdef I_UNISTD
17779 #  include <unistd.h>  /* Needed for NetBSD */
17780 #endif
17781 int main()
17782 {
17783 char a = -1;
17784 char b = 0;
17785 if ((a < b) && memcmp(&a, &b, 1) < 0)
17786         exit(1);
17787 exit(0);
17788 }
17789 EOCP
17790         set try
17791         if eval $compile_ok; then
17792                 if $run ./try 2>/dev/null; then
17793                         echo "Yes, it can."
17794                         val="$define"
17795                 else
17796                         echo "No, it can't (it uses signed chars)."
17797                 fi
17798         else
17799                 echo "(I can't compile the test program, so we'll assume not...)"
17800         fi
17801         ;;
17802 esac
17803 $rm_try
17804 set d_sanemcmp
17805 eval $setvar
17806
17807 : see if prototype for sbrk is available
17808 echo " "
17809 set d_sbrkproto sbrk $i_unistd unistd.h
17810 eval $hasproto
17811
17812 : see if scalbn exists
17813 set scalbn d_scalbn
17814 eval $inlibc
17815
17816 : see if select exists
17817 set select d_select
17818 eval $inlibc
17819
17820 : see if semctl exists
17821 set semctl d_semctl
17822 eval $inlibc
17823
17824 : see if semget exists
17825 set semget d_semget
17826 eval $inlibc
17827
17828 : see if semop exists
17829 set semop d_semop
17830 eval $inlibc
17831
17832 : see how much of the 'sem*(2)' library is present.
17833 h_sem=true
17834 echo " "
17835 case "$d_semctl$d_semget$d_semop" in
17836 *"$undef"*) h_sem=false;;
17837 esac
17838 case "$osname" in
17839 freebsd)
17840     case "`ipcs 2>&1`" in
17841     "SVID messages"*"not configured"*)
17842         echo "Your $osname does not have the sem*(2) configured." >&4
17843         h_sem=false
17844         val="$undef"
17845         set semctl d_semctl
17846         eval $setvar
17847         set semget d_semget
17848         eval $setvar
17849         set semop d_semop
17850         eval $setvar
17851         ;;
17852     esac
17853     ;;
17854 esac
17855 : we could also check for sys/ipc.h ...
17856 if $h_sem && $test `./findhdr sys/sem.h`; then
17857         echo "You have the full sem*(2) library." >&4
17858         val="$define"
17859 else
17860         echo "You don't have the full sem*(2) library." >&4
17861         val="$undef"
17862 fi
17863 set d_sem
17864 eval $setvar
17865
17866 : see whether sys/sem.h defines union semun
17867 echo " "
17868 $cat > try.c <<'END'
17869 #include <sys/types.h>
17870 #include <sys/ipc.h>
17871 #include <sys/sem.h>
17872 int main () { union semun semun; semun.buf = 0; }
17873 END
17874 set try
17875 if eval $compile; then
17876     echo "You have union semun in <sys/sem.h>." >&4
17877     val="$define"
17878 else
17879     echo "You do not have union semun in <sys/sem.h>." >&4
17880     val="$undef"
17881 fi
17882 $rm_try
17883 set d_union_semun
17884 eval $setvar
17885
17886 : see how to do semctl IPC_STAT
17887 case "$d_sem" in
17888 $define)
17889     echo " "
17890     $cat > tryh.h <<END
17891 #ifndef S_IRUSR
17892 #   ifdef S_IREAD
17893 #       define S_IRUSR S_IREAD
17894 #       define S_IWUSR S_IWRITE
17895 #       define S_IXUSR S_IEXEC
17896 #   else
17897 #       define S_IRUSR 0400
17898 #       define S_IWUSR 0200
17899 #       define S_IXUSR 0100
17900 #   endif
17901 #   define S_IRGRP (S_IRUSR>>3)
17902 #   define S_IWGRP (S_IWUSR>>3)
17903 #   define S_IXGRP (S_IXUSR>>3)
17904 #   define S_IROTH (S_IRUSR>>6)
17905 #   define S_IWOTH (S_IWUSR>>6)
17906 #   define S_IXOTH (S_IXUSR>>6)
17907 #endif
17908 #ifndef S_IRWXU
17909 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17910 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17911 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17912 #endif
17913 END
17914     : see whether semctl IPC_STAT can use union semun
17915     case "$d_semctl_semun" in
17916     '')
17917       val="$undef"
17918       $cat > try.c <<END
17919 #include <sys/types.h>
17920 #include <sys/ipc.h>
17921 #include <sys/sem.h>
17922 #include <sys/stat.h>
17923 #include <stdio.h>
17924 #include <errno.h>
17925 #include "tryh.h"
17926 #ifndef errno
17927 extern int errno;
17928 #endif
17929 #$d_union_semun HAS_UNION_SEMUN
17930 int main() {
17931     union semun
17932 #ifndef HAS_UNION_SEMUN
17933     {
17934         int val;
17935         struct semid_ds *buf;
17936         unsigned short *array;
17937     }
17938 #endif
17939     arg;
17940     int sem, st;
17941
17942 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17943     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17944     if (sem > -1) {
17945         struct semid_ds argbuf;
17946         arg.buf = &argbuf;
17947 #       ifdef IPC_STAT
17948         st = semctl(sem, 0, IPC_STAT, arg);
17949         if (st == 0)
17950             printf("semun\n");
17951         else
17952 #       endif /* IPC_STAT */
17953             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17954 #       ifdef IPC_RMID
17955         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17956 #       endif /* IPC_RMID */
17957             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17958     } else
17959 #endif /* IPC_PRIVATE && ... */
17960         printf("semget failed: errno = %d\n", errno);
17961   return 0;
17962 }
17963 END
17964       set try
17965       if eval $compile; then
17966           xxx=`$run ./try`
17967           case "$xxx" in
17968           semun) val="$define" ;;
17969           esac
17970       fi
17971       $rm_try
17972       set d_semctl_semun
17973       eval $setvar
17974       ;;
17975     esac
17976     case "$d_semctl_semun" in
17977     $define)
17978         echo "You can use union semun for semctl IPC_STAT." >&4
17979         also='also'
17980         ;;
17981     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17982         also=''
17983         ;;
17984     esac
17985
17986     : see whether semctl IPC_STAT can use struct semid_ds pointer
17987     case "$d_semctl_semid_ds" in
17988     '')
17989       val="$undef"
17990       $cat > try.c <<'END'
17991 #include <sys/types.h>
17992 #include <sys/ipc.h>
17993 #include <sys/sem.h>
17994 #include <sys/stat.h>
17995 #include "tryh.h"
17996 #include <stdio.h>
17997 #include <errno.h>
17998 #ifndef errno
17999 extern int errno;
18000 #endif
18001 int main() {
18002     struct semid_ds arg;
18003     int sem, st;
18004
18005 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18006     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18007     if (sem > -1) {
18008 #       ifdef IPC_STAT
18009         st = semctl(sem, 0, IPC_STAT, &arg);
18010         if (st == 0)
18011             printf("semid_ds\n");
18012         else
18013 #       endif /* IPC_STAT */
18014             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18015 #       ifdef IPC_RMID
18016         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18017 #       endif /* IPC_RMID */
18018             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18019     } else
18020 #endif /* IPC_PRIVATE && ... */
18021         printf("semget failed: errno = %d\n", errno);
18022
18023     return 0;
18024 }
18025 END
18026       set try
18027       if eval $compile; then
18028           xxx=`$run ./try`
18029           case "$xxx" in
18030           semid_ds) val="$define" ;;
18031           esac
18032       fi
18033       $rm_try
18034       set d_semctl_semid_ds
18035       eval $setvar
18036       ;;
18037     esac
18038     case "$d_semctl_semid_ds" in
18039     $define)
18040         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18041         ;;
18042     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18043         ;;
18044     esac
18045     ;;
18046 *)  val="$undef"
18047
18048     # We do not have the full sem*(2) library, so assume we can not
18049     # use either.
18050
18051     set d_semctl_semun
18052     eval $setvar
18053
18054     set d_semctl_semid_ds
18055     eval $setvar
18056     ;;
18057 esac
18058 $rm_try tryh.h
18059
18060 : see if sendmsg exists
18061 set sendmsg d_sendmsg
18062 eval $inlibc
18063
18064 : see if setegid exists
18065 set setegid d_setegid
18066 eval $inlibc
18067
18068 : see if seteuid exists
18069 set seteuid d_seteuid
18070 eval $inlibc
18071
18072 : see if setgrent exists
18073 set setgrent d_setgrent
18074 eval $inlibc
18075
18076 : see if setgrent_r exists
18077 set setgrent_r d_setgrent_r
18078 eval $inlibc
18079 case "$d_setgrent_r" in
18080 "$define")
18081         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18082         case "$d_setgrent_r_proto:$usethreads" in
18083         ":define")      d_setgrent_r_proto=define
18084                 set d_setgrent_r_proto setgrent_r $hdrs
18085                 eval $hasproto ;;
18086         *)      ;;
18087         esac
18088         case "$d_setgrent_r_proto" in
18089         define)
18090         case "$setgrent_r_proto" in
18091         ''|0) try='int setgrent_r(FILE**);'
18092         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18093         esac
18094         case "$setgrent_r_proto" in
18095         ''|0) try='void setgrent_r(FILE**);'
18096         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18097         esac
18098         case "$setgrent_r_proto" in
18099         ''|0)   d_setgrent_r=undef
18100                 setgrent_r_proto=0
18101                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18102         * )     case "$setgrent_r_proto" in
18103                 REENTRANT_PROTO*) ;;
18104                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18105                 esac
18106                 echo "Prototype: $try" ;;
18107         esac
18108         ;;
18109         *)      case "$usethreads" in
18110                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18111                 esac
18112                 d_setgrent_r=undef
18113                 setgrent_r_proto=0
18114                 ;;
18115         esac
18116         ;;
18117 *)      setgrent_r_proto=0
18118         ;;
18119 esac
18120
18121 : see if sethostent exists
18122 set sethostent d_sethent
18123 eval $inlibc
18124
18125 : see if sethostent_r exists
18126 set sethostent_r d_sethostent_r
18127 eval $inlibc
18128 case "$d_sethostent_r" in
18129 "$define")
18130         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18131         case "$d_sethostent_r_proto:$usethreads" in
18132         ":define")      d_sethostent_r_proto=define
18133                 set d_sethostent_r_proto sethostent_r $hdrs
18134                 eval $hasproto ;;
18135         *)      ;;
18136         esac
18137         case "$d_sethostent_r_proto" in
18138         define)
18139         case "$sethostent_r_proto" in
18140         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18141         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18142         esac
18143         case "$sethostent_r_proto" in
18144         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18145         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18146         esac
18147         case "$sethostent_r_proto" in
18148         ''|0)   d_sethostent_r=undef
18149                 sethostent_r_proto=0
18150                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18151         * )     case "$sethostent_r_proto" in
18152                 REENTRANT_PROTO*) ;;
18153                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18154                 esac
18155                 echo "Prototype: $try" ;;
18156         esac
18157         ;;
18158         *)      case "$usethreads" in
18159                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18160                 esac
18161                 d_sethostent_r=undef
18162                 sethostent_r_proto=0
18163                 ;;
18164         esac
18165         ;;
18166 *)      sethostent_r_proto=0
18167         ;;
18168 esac
18169
18170 : see if setitimer exists
18171 set setitimer d_setitimer
18172 eval $inlibc
18173
18174 : see if setlinebuf exists
18175 set setlinebuf d_setlinebuf
18176 eval $inlibc
18177
18178 : see if setlocale exists
18179 set setlocale d_setlocale
18180 eval $inlibc
18181
18182 : see if locale.h is available
18183 set locale.h i_locale
18184 eval $inhdr
18185
18186 : see if setlocale_r exists
18187 set setlocale_r d_setlocale_r
18188 eval $inlibc
18189 case "$d_setlocale_r" in
18190 "$define")
18191         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18192         case "$d_setlocale_r_proto:$usethreads" in
18193         ":define")      d_setlocale_r_proto=define
18194                 set d_setlocale_r_proto setlocale_r $hdrs
18195                 eval $hasproto ;;
18196         *)      ;;
18197         esac
18198         case "$d_setlocale_r_proto" in
18199         define)
18200         case "$setlocale_r_proto" in
18201         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18202         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18203         esac
18204         case "$setlocale_r_proto" in
18205         ''|0)   d_setlocale_r=undef
18206                 setlocale_r_proto=0
18207                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18208         * )     case "$setlocale_r_proto" in
18209                 REENTRANT_PROTO*) ;;
18210                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18211                 esac
18212                 echo "Prototype: $try" ;;
18213         esac
18214         ;;
18215         *)      case "$usethreads" in
18216                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18217                 esac
18218                 d_setlocale_r=undef
18219                 setlocale_r_proto=0
18220                 ;;
18221         esac
18222         ;;
18223 *)      setlocale_r_proto=0
18224         ;;
18225 esac
18226
18227 : see if setnetent exists
18228 set setnetent d_setnent
18229 eval $inlibc
18230
18231 : see if setnetent_r exists
18232 set setnetent_r d_setnetent_r
18233 eval $inlibc
18234 case "$d_setnetent_r" in
18235 "$define")
18236         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18237         case "$d_setnetent_r_proto:$usethreads" in
18238         ":define")      d_setnetent_r_proto=define
18239                 set d_setnetent_r_proto setnetent_r $hdrs
18240                 eval $hasproto ;;
18241         *)      ;;
18242         esac
18243         case "$d_setnetent_r_proto" in
18244         define)
18245         case "$setnetent_r_proto" in
18246         ''|0) try='int setnetent_r(int, struct netent_data*);'
18247         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18248         esac
18249         case "$setnetent_r_proto" in
18250         ''|0) try='void setnetent_r(int, struct netent_data*);'
18251         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18252         esac
18253         case "$setnetent_r_proto" in
18254         ''|0)   d_setnetent_r=undef
18255                 setnetent_r_proto=0
18256                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18257         * )     case "$setnetent_r_proto" in
18258                 REENTRANT_PROTO*) ;;
18259                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18260                 esac
18261                 echo "Prototype: $try" ;;
18262         esac
18263         ;;
18264         *)      case "$usethreads" in
18265                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18266                 esac
18267                 d_setnetent_r=undef
18268                 setnetent_r_proto=0
18269                 ;;
18270         esac
18271         ;;
18272 *)      setnetent_r_proto=0
18273         ;;
18274 esac
18275
18276 : see if setprotoent exists
18277 set setprotoent d_setpent
18278 eval $inlibc
18279
18280 : see if setpgid exists
18281 set setpgid d_setpgid
18282 eval $inlibc
18283
18284 : see if setpgrp2 exists
18285 set setpgrp2 d_setpgrp2
18286 eval $inlibc
18287
18288 : see if setpriority exists
18289 set setpriority d_setprior
18290 eval $inlibc
18291
18292 : see if setproctitle exists
18293 set setproctitle d_setproctitle
18294 eval $inlibc
18295
18296 : see if setprotoent_r exists
18297 set setprotoent_r d_setprotoent_r
18298 eval $inlibc
18299 case "$d_setprotoent_r" in
18300 "$define")
18301         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18302         case "$d_setprotoent_r_proto:$usethreads" in
18303         ":define")      d_setprotoent_r_proto=define
18304                 set d_setprotoent_r_proto setprotoent_r $hdrs
18305                 eval $hasproto ;;
18306         *)      ;;
18307         esac
18308         case "$d_setprotoent_r_proto" in
18309         define)
18310         case "$setprotoent_r_proto" in
18311         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18312         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18313         esac
18314         case "$setprotoent_r_proto" in
18315         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18316         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18317         esac
18318         case "$setprotoent_r_proto" in
18319         ''|0)   d_setprotoent_r=undef
18320                 setprotoent_r_proto=0
18321                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18322         * )     case "$setprotoent_r_proto" in
18323                 REENTRANT_PROTO*) ;;
18324                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18325                 esac
18326                 echo "Prototype: $try" ;;
18327         esac
18328         ;;
18329         *)      case "$usethreads" in
18330                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18331                 esac
18332                 d_setprotoent_r=undef
18333                 setprotoent_r_proto=0
18334                 ;;
18335         esac
18336         ;;
18337 *)      setprotoent_r_proto=0
18338         ;;
18339 esac
18340
18341 : see if setpwent exists
18342 set setpwent d_setpwent
18343 eval $inlibc
18344
18345 : see if setpwent_r exists
18346 set setpwent_r d_setpwent_r
18347 eval $inlibc
18348 case "$d_setpwent_r" in
18349 "$define")
18350         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18351         case "$d_setpwent_r_proto:$usethreads" in
18352         ":define")      d_setpwent_r_proto=define
18353                 set d_setpwent_r_proto setpwent_r $hdrs
18354                 eval $hasproto ;;
18355         *)      ;;
18356         esac
18357         case "$d_setpwent_r_proto" in
18358         define)
18359         case "$setpwent_r_proto" in
18360         ''|0) try='int setpwent_r(FILE**);'
18361         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18362         esac
18363         case "$setpwent_r_proto" in
18364         ''|0) try='void setpwent_r(FILE**);'
18365         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18366         esac
18367         case "$setpwent_r_proto" in
18368         ''|0)   d_setpwent_r=undef
18369                 setpwent_r_proto=0
18370                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18371         * )     case "$setpwent_r_proto" in
18372                 REENTRANT_PROTO*) ;;
18373                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18374                 esac
18375                 echo "Prototype: $try" ;;
18376         esac
18377         ;;
18378         *)      case "$usethreads" in
18379                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18380                 esac
18381                 d_setpwent_r=undef
18382                 setpwent_r_proto=0
18383                 ;;
18384         esac
18385         ;;
18386 *)      setpwent_r_proto=0
18387         ;;
18388 esac
18389
18390 : see if setregid exists
18391 set setregid d_setregid
18392 eval $inlibc
18393 set setresgid d_setresgid
18394 eval $inlibc
18395
18396 : see if setreuid exists
18397 set setreuid d_setreuid
18398 eval $inlibc
18399 set setresuid d_setresuid
18400 eval $inlibc
18401
18402 : see if setrgid exists
18403 set setrgid d_setrgid
18404 eval $inlibc
18405
18406 : see if setruid exists
18407 set setruid d_setruid
18408 eval $inlibc
18409
18410 : see if setservent exists
18411 set setservent d_setsent
18412 eval $inlibc
18413
18414 : see if setservent_r exists
18415 set setservent_r d_setservent_r
18416 eval $inlibc
18417 case "$d_setservent_r" in
18418 "$define")
18419         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18420         case "$d_setservent_r_proto:$usethreads" in
18421         ":define")      d_setservent_r_proto=define
18422                 set d_setservent_r_proto setservent_r $hdrs
18423                 eval $hasproto ;;
18424         *)      ;;
18425         esac
18426         case "$d_setservent_r_proto" in
18427         define)
18428         case "$setservent_r_proto" in
18429         ''|0) try='int setservent_r(int, struct servent_data*);'
18430         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18431         esac
18432         case "$setservent_r_proto" in
18433         ''|0) try='void setservent_r(int, struct servent_data*);'
18434         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18435         esac
18436         case "$setservent_r_proto" in
18437         ''|0)   d_setservent_r=undef
18438                 setservent_r_proto=0
18439                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18440         * )     case "$setservent_r_proto" in
18441                 REENTRANT_PROTO*) ;;
18442                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18443                 esac
18444                 echo "Prototype: $try" ;;
18445         esac
18446         ;;
18447         *)      case "$usethreads" in
18448                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18449                 esac
18450                 d_setservent_r=undef
18451                 setservent_r_proto=0
18452                 ;;
18453         esac
18454         ;;
18455 *)      setservent_r_proto=0
18456         ;;
18457 esac
18458
18459 : see if setsid exists
18460 set setsid d_setsid
18461 eval $inlibc
18462
18463 : see if setvbuf exists
18464 set setvbuf d_setvbuf
18465 eval $inlibc
18466
18467 : see if shmctl exists
18468 set shmctl d_shmctl
18469 eval $inlibc
18470
18471 : see if shmget exists
18472 set shmget d_shmget
18473 eval $inlibc
18474
18475 : see if shmat exists
18476 set shmat d_shmat
18477 eval $inlibc
18478 : see what shmat returns
18479 case "$d_shmat" in
18480 "$define")
18481         $cat >shmat.c <<'END'
18482 #include <sys/shm.h>
18483 void *shmat();
18484 END
18485         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18486                 shmattype='void *'
18487         else
18488                 shmattype='char *'
18489         fi
18490         echo "and it returns ($shmattype)." >&4
18491         : see if a prototype for shmat is available
18492         xxx=`./findhdr sys/shm.h`
18493         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18494         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18495                 val="$define"
18496         else
18497                 val="$undef"
18498         fi
18499         $rm -f shmat.[co]
18500         ;;
18501 *)
18502         val="$undef"
18503         ;;
18504 esac
18505 set d_shmatprototype
18506 eval $setvar
18507
18508 : see if shmdt exists
18509 set shmdt d_shmdt
18510 eval $inlibc
18511
18512 : see how much of the 'shm*(2)' library is present.
18513 h_shm=true
18514 echo " "
18515 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18516 *"$undef"*) h_shm=false;;
18517 esac
18518 case "$osname" in
18519 freebsd)
18520     case "`ipcs 2>&1`" in
18521     "SVID shared memory"*"not configured"*)
18522         echo "Your $osname does not have the shm*(2) configured." >&4
18523         h_shm=false
18524         val="$undef"
18525         set shmctl d_shmctl
18526         eval $setvar
18527         set shmget d_shmget
18528         eval $setvar
18529         set shmat d_shmat
18530         eval $setvar
18531         set shmdt d_shmdt
18532         eval $setvar
18533         ;;
18534     esac
18535     ;;
18536 esac
18537 : we could also check for sys/ipc.h ...
18538 if $h_shm && $test `./findhdr sys/shm.h`; then
18539         echo "You have the full shm*(2) library." >&4
18540         val="$define"
18541 else
18542         echo "You don't have the full shm*(2) library." >&4
18543         val="$undef"
18544 fi
18545 set d_shm
18546 eval $setvar
18547
18548 : see if we have sigaction
18549 echo " "
18550 if set sigaction val -f d_sigaction; eval $csym; $val; then
18551         echo 'sigaction() found.' >&4
18552         $cat > try.c <<EOP
18553 #include <stdio.h>
18554 #include <sys/types.h>
18555 #include <signal.h>
18556 #$i_stdlib I_STDLIB
18557 #ifdef I_STDLIB
18558 #include <stdlib.h>
18559 #endif
18560 int main()
18561 {
18562     struct sigaction act, oact;
18563     act.sa_flags = 0;
18564     oact.sa_handler = 0;
18565     /* so that act and oact are used */
18566     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18567 }
18568 EOP
18569         set try
18570         if eval $compile_ok; then
18571                 val="$define"
18572         else
18573                 echo "But you don't seem to have a usable struct sigaction." >&4
18574                 val="$undef"
18575         fi
18576 else
18577         echo 'sigaction NOT found.' >&4
18578         val="$undef"
18579 fi
18580 set d_sigaction; eval $setvar
18581 $rm_try
18582
18583 : see if this is a sunmath.h system
18584 set sunmath.h i_sunmath
18585 eval $inhdr
18586
18587 : see if signbit exists
18588 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18589 $cat >try.c <<EOCP
18590 #$i_math I_MATH
18591 #$i_sunmath I_SUNMATH
18592 #ifdef I_MATH
18593 #  include <math.h>
18594 #endif
18595 #ifdef I_SUNMATH  /* Solaris special math library */
18596 #  include <sunmath.h>
18597 #endif
18598 #define NV $nvtype
18599 int main(int argc, char **argv)
18600 {
18601     NV x = 0.0;
18602     NV y = -0.0;
18603     if ((signbit(x) == 0) && (signbit(y) != 0))
18604         return 0;
18605     else
18606         return 1;
18607 }
18608 EOCP
18609 val="$undef"
18610 set try
18611 if eval $compile; then
18612     if $run ./try; then
18613         $echo "Yes." >&4
18614         val="$define"
18615     else
18616         $echo "Signbit seems to be available, but doesn't work as I expected."
18617         $echo "I won't use it." >&4
18618         val="$undef"
18619     fi
18620 else
18621     $echo "Nope." >&4
18622     dflt="$undef"
18623 fi
18624 set d_signbit
18625 eval $setvar
18626 $rm_try
18627
18628 : see if sigprocmask exists
18629 set sigprocmask d_sigprocmask
18630 eval $inlibc
18631
18632 : see if sigsetjmp exists
18633 echo " "
18634 case "$d_sigsetjmp" in
18635 '')
18636         $cat >try.c <<EOP
18637 #include <setjmp.h>
18638 #$i_stdlib I_STDLIB
18639 #ifdef I_STDLIB
18640 #include <stdlib.h>
18641 #endif
18642 sigjmp_buf env;
18643 int set = 1;
18644 int main()
18645 {
18646         if (sigsetjmp(env,1))
18647                 exit(set);
18648         set = 0;
18649         siglongjmp(env, 1);
18650         exit(1);
18651 }
18652 EOP
18653         set try
18654         if eval $compile; then
18655                 if $run ./try >/dev/null 2>&1; then
18656                         echo "POSIX sigsetjmp found." >&4
18657                         val="$define"
18658                 else
18659                         $cat >&4 <<EOM
18660 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18661 I'll ignore them.
18662 EOM
18663                         val="$undef"
18664                 fi
18665         else
18666                 echo "sigsetjmp not found." >&4
18667                 val="$undef"
18668         fi
18669         ;;
18670 *) val="$d_sigsetjmp"
18671         case "$d_sigsetjmp" in
18672         $define) echo "POSIX sigsetjmp found." >&4;;
18673         $undef) echo "sigsetjmp not found." >&4;;
18674         esac
18675         ;;
18676 esac
18677 set d_sigsetjmp
18678 eval $setvar
18679 $rm_try
18680
18681 : see if snprintf exists
18682 set snprintf d_snprintf
18683 eval $inlibc
18684
18685 : see if vsnprintf exists
18686 set vsnprintf d_vsnprintf
18687 eval $inlibc
18688
18689 case "$d_snprintf-$d_vsnprintf" in
18690 "$define-$define")
18691     $cat <<EOM
18692 Checking whether your snprintf() and vsnprintf() work okay...
18693 EOM
18694     $cat >try.c <<'EOCP'
18695 /* v?snprintf testing logic courtesy of Russ Allbery.
18696  * According to C99:
18697  * - if the buffer is too short it still must be \0-terminated
18698  * - if the buffer is too short the potentially required length
18699  *   must be returned and not -1
18700  * - if the buffer is NULL the potentially required length
18701  *   must be returned and not -1 or core dump
18702  */
18703 #include <stdio.h>
18704 #include <stdarg.h>
18705
18706 char buf[2];
18707
18708 int test (char *format, ...)
18709 {
18710     va_list args;
18711     int count;
18712
18713     va_start (args, format);
18714     count = vsnprintf (buf, sizeof buf, format, args);
18715     va_end (args);
18716     return count;
18717 }
18718
18719 int main ()
18720 {
18721     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18722              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18723 }
18724 EOCP
18725     set try
18726     if eval $compile; then
18727         `$run ./try`
18728         case "$?" in
18729         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18730         *) cat <<EOM >&4
18731 Your snprintf() and snprintf() don't seem to be working okay.
18732 EOM
18733            d_snprintf="$undef"
18734            d_vsnprintf="$undef"
18735            ;;
18736         esac
18737     else
18738         echo "(I can't seem to compile the test program--assuming they don't)"
18739         d_snprintf="$undef"
18740         d_vsnprintf="$undef"
18741     fi
18742     $rm_try
18743     ;;
18744 esac
18745
18746 : see if sockatmark exists
18747 set sockatmark d_sockatmark
18748 eval $inlibc
18749
18750 : see if prototype for sockatmark is available
18751 echo " "
18752 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18753 eval $hasproto
18754
18755 : see if socks5_init exists
18756 set socks5_init d_socks5_init
18757 eval $inlibc
18758
18759 : see if sprintf returns the length of the string in the buffer as per ANSI
18760 $echo "Checking whether sprintf returns the length of the string..." >&4
18761 $cat <<EOP >try.c
18762 #include <stdio.h>
18763 #$i_stdlib I_STDLIB
18764 #ifdef I_STDLIB
18765 #include <stdlib.h>
18766 #endif
18767 #$i_string I_STRING
18768 #ifdef I_STRING
18769 #  include <string.h>
18770 #else
18771 #  include <strings.h>
18772 #endif
18773 #$i_math I_MATH
18774 #ifdef I_MATH
18775 #include <math.h>
18776 #endif
18777
18778 char buffer[256];
18779
18780 int check (size_t expect, int test) {
18781   size_t got = strlen(buffer);
18782   if (expect == got)
18783     return 0;
18784
18785   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18786        test, buffer);
18787   exit (test);
18788 }
18789
18790 int main(int argc, char **argv) {
18791   int test = 0;
18792
18793   check(sprintf(buffer, ""), ++test);
18794   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18795   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18796
18797   return 0;
18798 }
18799 EOP
18800 set try
18801
18802 if eval $compile; then
18803     xxx="`$run ./try`"
18804     case "$?" in
18805         0) cat >&4 <<EOM
18806 sprintf returns the length of the string (as ANSI says it should)
18807 EOM
18808         d_sprintf_returns_strlen="$define"
18809         ;;
18810         *) cat >&4 <<EOM
18811 sprintf does not return the length of the string (how old is this system?)
18812 EOM
18813         d_sprintf_returns_strlen="$undef"
18814         ;;
18815     esac
18816 else
18817     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18818     d_sprintf_returns_strlen="$undef"
18819 fi
18820 $rm_try
18821
18822 : see if srand48_r exists
18823 set srand48_r d_srand48_r
18824 eval $inlibc
18825 case "$d_srand48_r" in
18826 "$define")
18827         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18828         case "$d_srand48_r_proto:$usethreads" in
18829         ":define")      d_srand48_r_proto=define
18830                 set d_srand48_r_proto srand48_r $hdrs
18831                 eval $hasproto ;;
18832         *)      ;;
18833         esac
18834         case "$d_srand48_r_proto" in
18835         define)
18836         case "$srand48_r_proto" in
18837         ''|0) try='int srand48_r(long, struct drand48_data*);'
18838         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18839         esac
18840         case "$srand48_r_proto" in
18841         ''|0)   d_srand48_r=undef
18842                 srand48_r_proto=0
18843                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18844         * )     case "$srand48_r_proto" in
18845                 REENTRANT_PROTO*) ;;
18846                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18847                 esac
18848                 echo "Prototype: $try" ;;
18849         esac
18850         ;;
18851         *)      case "$usethreads" in
18852                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18853                 esac
18854                 d_srand48_r=undef
18855                 srand48_r_proto=0
18856                 ;;
18857         esac
18858         ;;
18859 *)      srand48_r_proto=0
18860         ;;
18861 esac
18862
18863 : see if srandom_r exists
18864 set srandom_r d_srandom_r
18865 eval $inlibc
18866 case "$d_srandom_r" in
18867 "$define")
18868         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18869         case "$d_srandom_r_proto:$usethreads" in
18870         ":define")      d_srandom_r_proto=define
18871                 set d_srandom_r_proto srandom_r $hdrs
18872                 eval $hasproto ;;
18873         *)      ;;
18874         esac
18875         case "$d_srandom_r_proto" in
18876         define)
18877         case "$srandom_r_proto" in
18878         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18879         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18880         esac
18881         case "$srandom_r_proto" in
18882         ''|0)   d_srandom_r=undef
18883                 srandom_r_proto=0
18884                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18885         * )     case "$srandom_r_proto" in
18886                 REENTRANT_PROTO*) ;;
18887                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18888                 esac
18889                 echo "Prototype: $try" ;;
18890         esac
18891         ;;
18892         *)      case "$usethreads" in
18893                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18894                 esac
18895                 d_srandom_r=undef
18896                 srandom_r_proto=0
18897                 ;;
18898         esac
18899         ;;
18900 *)      srandom_r_proto=0
18901         ;;
18902 esac
18903
18904 : see if prototype for setresgid is available
18905 echo " "
18906 set d_sresgproto setresgid $i_unistd unistd.h
18907 eval $hasproto
18908
18909 : see if prototype for setresuid is available
18910 echo " "
18911 set d_sresuproto setresuid $i_unistd unistd.h
18912 eval $hasproto
18913
18914 : see if stat exists
18915 set stat d_stat
18916 eval $inlibc
18917
18918 : see if sys/stat.h is available
18919 set sys/stat.h i_sysstat
18920 eval $inhdr
18921
18922 : see if stat knows about block sizes
18923 echo " "
18924 echo "Checking to see if your struct stat has st_blocks field..." >&4
18925 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18926 eval $hasfield
18927
18928 : see if this is a sys/vfs.h system
18929 set sys/vfs.h i_sysvfs
18930 eval $inhdr
18931
18932 : see if this is a sys/statfs.h system
18933 set sys/statfs.h i_sysstatfs
18934 eval $inhdr
18935
18936 : Check for statfs_s
18937 echo " "
18938 echo "Checking to see if your system supports struct statfs..." >&4
18939 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
18940 eval $hasstruct
18941 case "$d_statfs_s" in
18942 "$define")      echo "Yes, it does."   ;;
18943 *)              echo "No, it doesn't." ;;
18944 esac
18945
18946
18947 : see if struct statfs knows about f_flags
18948 case "$d_statfs_s" in
18949 define)
18950         echo " "
18951         echo "Checking to see if your struct statfs has f_flags field..." >&4
18952         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
18953         eval $hasfield
18954         ;;
18955 *)      val="$undef"
18956         set d_statfs_f_flags
18957         eval $setvar
18958         ;;
18959 esac
18960 case "$d_statfs_f_flags" in
18961 "$define")      echo "Yes, it does."   ;;
18962 *)              echo "No, it doesn't." ;;
18963 esac
18964
18965 : see what flavor, if any, of static inline is supported
18966 echo " "
18967 echo "Checking to see if your system supports static inline..."
18968 $cat > try.c <<'EOCP'
18969 #include <stdlib.h>
18970 extern int f_via_a(int x);
18971 extern int f_via_b(int x);
18972 int main(int argc, char **argv)
18973 {
18974     int y;
18975
18976     y = f_via_a(0);
18977 #ifdef USE_B
18978     y = f_via_b(0);
18979 #endif
18980     if (y == 42) {
18981         return EXIT_SUCCESS;
18982     }
18983     else {
18984         return EXIT_FAILURE;
18985     }
18986 }
18987 EOCP
18988 $cat > a.c <<'EOCP'
18989 static INLINE int f(int x) {
18990     int y;
18991     y = x + 42;
18992     return y;
18993 }
18994
18995 int f_via_a(int x)
18996 {
18997     return f(x);
18998 }
18999 EOCP
19000 $cat > b.c <<'EOCP'
19001 extern int f(int x);
19002
19003 int f_via_b(int x)
19004 {
19005     return f(x);
19006 }
19007 EOCP
19008
19009 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19010 case "$perl_static_inline" in
19011 '')     # Check the various possibilities, and break out on success.
19012         # For gcc, prefer __inline__, which will still permit
19013         # cflags.SH to add in -ansi.
19014         case "$gccversion" in
19015                 '') xxx="inline __inline__ __inline _inline";;
19016                 *)  xxx="__inline__ inline __inline _inline";;
19017         esac
19018         for inline in $xxx; do
19019                 set try -DINLINE=$inline a.c
19020                 if eval $compile && $run ./try; then
19021                         # Now make sure there is no external linkage of static
19022                         # functions
19023                         set try -DINLINE=$inline -DUSE_B a.c b.c
19024                         if eval $compile && $run ./try; then
19025                                 $echo "Your compiler supports static $inline, " >&4
19026                                 $echo "but it also creates an external definition," >&4
19027                                 $echo "so I won't use it." >&4
19028                                 val=$undef
19029                         else
19030                                 $echo "Your compiler supports static $inline." >&4
19031                                 val=$define
19032                                 perl_static_inline="static $inline";
19033                                 break;
19034                         fi
19035                 else
19036                         $echo "Your compiler does NOT support static $inline." >&4
19037                         val="$undef"
19038                 fi
19039         done
19040         ;;
19041 *inline*) # Some variant of inline exists.
19042         echo "Keeping your $hint value of $perl_static_inline."
19043         val=$define
19044         ;;
19045 static)  # No inline capabilities
19046         echo "Keeping your $hint value of $perl_static_inline."
19047         val=$undef
19048         ;;
19049 *)  # Unrecognized previous value -- blindly trust the supplied
19050         # value and hope it makes sense.  Use old value for
19051         # d_static_inline, if there is one.
19052         echo "Keeping your $hint value of $perl_static_inline."
19053         case "$d_static_inline" in
19054                 '') val=$define ;;
19055                 *)  val=$d_static_inline ;;
19056         esac
19057         ;;
19058 esac
19059 # Fallback to plain 'static' if nothing worked.
19060 case "$perl_static_inline" in
19061 '')
19062         perl_static_inline="static"
19063         val=$undef
19064         ;;
19065 esac
19066 set d_static_inline
19067 eval $setvar
19068 $rm -f a.[co] b.[co]
19069 $rm_try
19070
19071 : Check stream access
19072 $cat >&4 <<EOM
19073 Checking how to access stdio streams by file descriptor number...
19074 EOM
19075 case "$stdio_stream_array" in
19076 '')     $cat >try.c <<EOCP
19077 #include <stdio.h>
19078 int main() {
19079   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19080     printf("yes\n");
19081 }
19082 EOCP
19083         for s in _iob __iob __sF
19084         do
19085                 set try -DSTDIO_STREAM_ARRAY=$s
19086                 if eval $compile; then
19087                         case "`$run ./try`" in
19088                         yes)    stdio_stream_array=$s; break ;;
19089                         esac
19090                 fi
19091         done
19092         $rm_try
19093 esac
19094 case "$stdio_stream_array" in
19095 '')     $cat >&4 <<EOM
19096 I can't figure out how to access stdio streams by file descriptor number.
19097 EOM
19098         d_stdio_stream_array="$undef"
19099         ;;
19100 *)      $cat >&4 <<EOM
19101 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19102 EOM
19103         d_stdio_stream_array="$define"
19104         ;;
19105 esac
19106
19107 : see if strcoll exists
19108 set strcoll d_strcoll
19109 eval $inlibc
19110
19111 : check for structure copying
19112 echo " "
19113 echo "Checking to see if your C compiler can copy structs..." >&4
19114 $cat >try.c <<'EOCP'
19115 int main()
19116 {
19117         struct blurfl {
19118                 int dyick;
19119         } foo, bar;
19120
19121         foo = bar;
19122 }
19123 EOCP
19124 if $cc -c try.c >/dev/null 2>&1 ; then
19125         val="$define"
19126         echo "Yup, it can."
19127 else
19128         val="$undef"
19129         echo "Nope, it can't."
19130 fi
19131 set d_strctcpy
19132 eval $setvar
19133 $rm_try
19134
19135 : see if strerror and/or sys_errlist[] exist
19136 echo " "
19137 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19138     if set strerror val -f d_strerror; eval $csym; $val; then
19139                 echo 'strerror() found.' >&4
19140                 d_strerror="$define"
19141                 d_strerrm='strerror(e)'
19142                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19143                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19144                         d_syserrlst="$define"
19145                 else
19146                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19147                         d_syserrlst="$undef"
19148                 fi
19149     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19150                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19151                 echo 'strerror() found in string header.' >&4
19152                 d_strerror="$define"
19153                 d_strerrm='strerror(e)'
19154                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19155                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19156                                 d_syserrlst="$define"
19157                 else
19158                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19159                         d_syserrlst="$undef"
19160                 fi
19161     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19162                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19163                 d_strerror="$undef"
19164                 d_syserrlst="$define"
19165                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19166     else
19167                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19168                 d_strerror="$undef"
19169                 d_syserrlst="$undef"
19170                 d_strerrm='"unknown"'
19171     fi
19172 fi
19173
19174 : see if strerror_r exists
19175 set strerror_r d_strerror_r
19176 eval $inlibc
19177 case "$d_strerror_r" in
19178 "$define")
19179         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19180         case "$d_strerror_r_proto:$usethreads" in
19181         ":define")      d_strerror_r_proto=define
19182                 set d_strerror_r_proto strerror_r $hdrs
19183                 eval $hasproto ;;
19184         *)      ;;
19185         esac
19186         case "$d_strerror_r_proto" in
19187         define)
19188         case "$strerror_r_proto" in
19189         ''|0) try='int strerror_r(int, char*, size_t);'
19190         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19191         esac
19192         case "$strerror_r_proto" in
19193         ''|0) try='int strerror_r(int, char*, int);'
19194         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19195         esac
19196         case "$strerror_r_proto" in
19197         ''|0) try='char* strerror_r(int, char*, size_t);'
19198         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19199         esac
19200         case "$strerror_r_proto" in
19201         ''|0)   d_strerror_r=undef
19202                 strerror_r_proto=0
19203                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19204         * )     case "$strerror_r_proto" in
19205                 REENTRANT_PROTO*) ;;
19206                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19207                 esac
19208                 echo "Prototype: $try" ;;
19209         esac
19210         ;;
19211         *)      case "$usethreads" in
19212                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19213                 esac
19214                 d_strerror_r=undef
19215                 strerror_r_proto=0
19216                 ;;
19217         esac
19218         ;;
19219 *)      strerror_r_proto=0
19220         ;;
19221 esac
19222
19223 : see if strftime exists
19224 set strftime d_strftime
19225 eval $inlibc
19226
19227 : see if strlcat exists
19228 set strlcat d_strlcat
19229 eval $inlibc
19230
19231 : see if strlcpy exists
19232 set strlcpy d_strlcpy
19233 eval $inlibc
19234
19235 : see if strtod exists
19236 set strtod d_strtod
19237 eval $inlibc
19238
19239 : see if strtol exists
19240 set strtol d_strtol
19241 eval $inlibc
19242
19243 : see if strtold exists
19244 set strtold d_strtold
19245 eval $inlibc
19246
19247 : see if strtoll exists
19248 set strtoll d_strtoll
19249 eval $inlibc
19250
19251 case "$d_longlong-$d_strtoll" in
19252 "$define-$define")
19253         $cat <<EOM
19254 Checking whether your strtoll() works okay...
19255 EOM
19256         $cat >try.c <<'EOCP'
19257 #include <errno.h>
19258 #ifdef __hpux
19259 #define strtoll __strtoll
19260 #endif
19261 #ifdef __EMX__
19262 #define strtoll _strtoll
19263 #endif
19264 #include <stdio.h>
19265 extern long long int strtoll(char *s, char **, int);
19266 static int bad = 0;
19267 int check(char *s, long long ell, int een) {
19268         long long gll;
19269         errno = 0;
19270         gll = strtoll(s, 0, 10);
19271         if (!((gll == ell) && (errno == een)))
19272                 bad++;
19273 }
19274 int main() {
19275         check(" 1",                                      1LL, 0);
19276         check(" 0",                                      0LL, 0);
19277         check("-1",                                     -1LL, 0);
19278         check("-9223372036854775808", -9223372036854775808LL, 0);
19279         check("-9223372036854775808", -9223372036854775808LL, 0);
19280         check(" 9223372036854775807",  9223372036854775807LL, 0);
19281         check("-9223372036854775808", -9223372036854775808LL, 0);
19282         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19283         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19284         if (!bad)
19285                 printf("ok\n");
19286 }
19287 EOCP
19288         set try
19289         if eval $compile; then
19290                 yyy=`$run ./try`
19291                 case "$yyy" in
19292                 ok) echo "Your strtoll() seems to be working okay." ;;
19293                 *) cat <<EOM >&4
19294 Your strtoll() doesn't seem to be working okay.
19295 EOM
19296                    d_strtoll="$undef"
19297                    ;;
19298                 esac
19299         else
19300                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19301                 d_strtoll="$undef"
19302         fi
19303         ;;
19304 esac
19305
19306 : see if strtoq exists
19307 set strtoq d_strtoq
19308 eval $inlibc
19309
19310 : see if strtoul exists
19311 set strtoul d_strtoul
19312 eval $inlibc
19313
19314 case "$d_strtoul" in
19315 "$define")
19316         $cat <<EOM
19317 Checking whether your strtoul() works okay...
19318 EOM
19319         $cat >try.c <<'EOCP'
19320 #include <errno.h>
19321 #include <stdio.h>
19322 extern unsigned long int strtoul(char *s, char **, int);
19323 static int bad = 0;
19324 void check(char *s, unsigned long eul, int een) {
19325         unsigned long gul;
19326         errno = 0;
19327         gul = strtoul(s, 0, 10);
19328         if (!((gul == eul) && (errno == een)))
19329                 bad++;
19330 }
19331 int main() {
19332         check(" 1", 1L, 0);
19333         check(" 0", 0L, 0);
19334 EOCP
19335         case "$longsize" in
19336         8)
19337             $cat >>try.c <<'EOCP'
19338         check("18446744073709551615", 18446744073709551615UL, 0);
19339         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19340 #if 0 /* strtoul() for /^-/ strings is undefined. */
19341         check("-1", 18446744073709551615UL, 0);
19342         check("-18446744073709551614", 2, 0);
19343         check("-18446744073709551615", 1, 0);
19344         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19345         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19346 #endif
19347 EOCP
19348                 ;;
19349         4)
19350                     $cat >>try.c <<'EOCP'
19351         check("4294967295", 4294967295UL, 0);
19352         check("4294967296", 4294967295UL, ERANGE);
19353 #if 0 /* strtoul() for /^-/ strings is undefined. */
19354         check("-1", 4294967295UL, 0);
19355         check("-4294967294", 2, 0);
19356         check("-4294967295", 1, 0);
19357         check("-4294967296", 4294967295UL, ERANGE);
19358         check("-4294967297", 4294967295UL, ERANGE);
19359 #endif
19360 EOCP
19361                 ;;
19362         *)
19363 : Should we write these tests to be more portable by sprintf-ing
19364 : ~0 and then manipulating that char string as input for strtol?
19365                 ;;
19366         esac
19367         $cat >>try.c <<'EOCP'
19368         if (!bad)
19369                 printf("ok\n");
19370         return 0;
19371 }
19372 EOCP
19373         set try
19374         if eval $compile; then
19375                 case "`$run ./try`" in
19376                 ok) echo "Your strtoul() seems to be working okay." ;;
19377                 *) cat <<EOM >&4
19378 Your strtoul() doesn't seem to be working okay.
19379 EOM
19380                    d_strtoul="$undef"
19381                    ;;
19382                 esac
19383         else
19384                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19385                 d_strtoul="$undef"
19386         fi
19387         ;;
19388 esac
19389
19390 : see if strtoull exists
19391 set strtoull d_strtoull
19392 eval $inlibc
19393
19394 case "$d_longlong-$d_strtoull" in
19395 "$define-$define")
19396         $cat <<EOM
19397 Checking whether your strtoull() works okay...
19398 EOM
19399         $cat >try.c <<'EOCP'
19400 #include <errno.h>
19401 #ifdef __hpux
19402 #define strtoull __strtoull
19403 #endif
19404 #include <stdio.h>
19405 extern unsigned long long int strtoull(char *s, char **, int);
19406 static int bad = 0;
19407 int check(char *s, long long eull, int een) {
19408         long long gull;
19409         errno = 0;
19410         gull = strtoull(s, 0, 10);
19411         if (!((gull == eull) && (errno == een)))
19412                 bad++;
19413 }
19414 int main() {
19415         check(" 1",                                        1LL, 0);
19416         check(" 0",                                        0LL, 0);
19417         check("18446744073709551615",  18446744073709551615ULL, 0);
19418         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19419 #if 0 /* strtoull() for /^-/ strings is undefined. */
19420         check("-1",                    18446744073709551615ULL, 0);
19421         check("-18446744073709551614",                     2LL, 0);
19422         check("-18446744073709551615",                     1LL, 0);
19423         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19424         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19425 #endif
19426         if (!bad)
19427                 printf("ok\n");
19428 }
19429 EOCP
19430         set try
19431         if eval $compile; then
19432                 case "`$run ./try`" in
19433                 ok) echo "Your strtoull() seems to be working okay." ;;
19434                 *) cat <<EOM >&4
19435 Your strtoull() doesn't seem to be working okay.
19436 EOM
19437                    d_strtoull="$undef"
19438                    ;;
19439                 esac
19440         else
19441                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19442                 d_strtoull="$undef"
19443         fi
19444         ;;
19445 esac
19446
19447 : see if strtouq exists
19448 set strtouq d_strtouq
19449 eval $inlibc
19450
19451 case "$d_strtouq" in
19452 "$define")
19453         $cat <<EOM
19454 Checking whether your strtouq() works okay...
19455 EOM
19456         $cat >try.c <<'EOCP'
19457 #include <errno.h>
19458 #include <stdio.h>
19459 extern unsigned long long int strtouq(char *s, char **, int);
19460 static int bad = 0;
19461 void check(char *s, unsigned long long eull, int een) {
19462         unsigned long long gull;
19463         errno = 0;
19464         gull = strtouq(s, 0, 10);
19465         if (!((gull == eull) && (errno == een)))
19466                 bad++;
19467 }
19468 int main() {
19469         check(" 1",                                        1LL, 0);
19470         check(" 0",                                        0LL, 0);
19471         check("18446744073709551615",  18446744073709551615ULL, 0);
19472         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19473 #if 0 /* strtouq() for /^-/ strings is undefined. */
19474         check("-1",                    18446744073709551615ULL, 0);
19475         check("-18446744073709551614",                     2LL, 0);
19476         check("-18446744073709551615",                     1LL, 0);
19477         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19478         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19479 #endif
19480         if (!bad)
19481                 printf("ok\n");
19482         return 0;
19483 }
19484 EOCP
19485         set try
19486         if eval $compile; then
19487                 case "`$run ./try`" in
19488                 ok) echo "Your strtouq() seems to be working okay." ;;
19489                 *) cat <<EOM >&4
19490 Your strtouq() doesn't seem to be working okay.
19491 EOM
19492                    d_strtouq="$undef"
19493                    ;;
19494                 esac
19495         else
19496                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19497                 d_strtouq="$undef"
19498         fi
19499         ;;
19500 esac
19501
19502 : see if strxfrm exists
19503 set strxfrm d_strxfrm
19504 eval $inlibc
19505
19506 : see if symlink exists
19507 set symlink d_symlink
19508 eval $inlibc
19509
19510 : see if syscall exists
19511 set syscall d_syscall
19512 eval $inlibc
19513
19514 : see if prototype for syscall is available
19515 echo " "
19516 set d_syscallproto syscall $i_unistd unistd.h
19517 eval $hasproto
19518
19519 : see if sysconf exists
19520 set sysconf d_sysconf
19521 eval $inlibc
19522
19523 : see if system exists
19524 set system d_system
19525 eval $inlibc
19526
19527 : see if tcgetpgrp exists
19528 set tcgetpgrp d_tcgetpgrp
19529 eval $inlibc
19530
19531 : see if tcsetpgrp exists
19532 set tcsetpgrp d_tcsetpgrp
19533 eval $inlibc
19534
19535 : see if prototype for telldir is available
19536 echo " "
19537 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19538 eval $hasproto
19539
19540 : see if tgamma exists
19541 set tgamma d_tgamma
19542 eval $inlibc
19543
19544 : see if time exists
19545 echo " "
19546 if test "X$d_time" = X -o X"$timetype" = X; then
19547     if set time val -f d_time; eval $csym; $val; then
19548                 echo 'time() found.' >&4
19549                 val="$define"
19550                 rp="What is the type returned by time() on this system?"
19551                 set time_t timetype long stdio.h sys/types.h
19552                 eval $typedef_ask
19553     else
19554                 echo 'time() not found, hope that will do.' >&4
19555                 val="$undef"
19556                 timetype='int';
19557     fi
19558     set d_time
19559     eval $setvar
19560 fi
19561
19562 : see if timegm exists
19563 set timegm d_timegm
19564 eval $inlibc
19565
19566 : see if this is a sys/times.h system
19567 set sys/times.h i_systimes
19568 eval $inhdr
19569
19570 : see if times exists
19571 echo " "
19572 if set times val -f d_times; eval $csym; $val; then
19573         echo 'times() found.' >&4
19574         d_times="$define"
19575         inc=''
19576         case "$i_systimes" in
19577         "$define") inc='sys/times.h';;
19578         esac
19579         rp="What is the type returned by times() on this system?"
19580         set clock_t clocktype long stdio.h sys/types.h $inc
19581         eval $typedef_ask
19582 else
19583         echo 'times() NOT found, hope that will do.' >&4
19584         d_times="$undef"
19585         clocktype='int'
19586 fi
19587
19588 : see if tmpnam_r exists
19589 set tmpnam_r d_tmpnam_r
19590 eval $inlibc
19591 case "$d_tmpnam_r" in
19592 "$define")
19593         hdrs="$i_systypes sys/types.h define stdio.h "
19594         case "$d_tmpnam_r_proto:$usethreads" in
19595         ":define")      d_tmpnam_r_proto=define
19596                 set d_tmpnam_r_proto tmpnam_r $hdrs
19597                 eval $hasproto ;;
19598         *)      ;;
19599         esac
19600         case "$d_tmpnam_r_proto" in
19601         define)
19602         case "$tmpnam_r_proto" in
19603         ''|0) try='char* tmpnam_r(char*);'
19604         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19605         esac
19606         case "$tmpnam_r_proto" in
19607         ''|0)   d_tmpnam_r=undef
19608                 tmpnam_r_proto=0
19609                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19610         * )     case "$tmpnam_r_proto" in
19611                 REENTRANT_PROTO*) ;;
19612                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19613                 esac
19614                 echo "Prototype: $try" ;;
19615         esac
19616         ;;
19617         *)      case "$usethreads" in
19618                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19619                 esac
19620                 d_tmpnam_r=undef
19621                 tmpnam_r_proto=0
19622                 ;;
19623         esac
19624         ;;
19625 *)      tmpnam_r_proto=0
19626         ;;
19627 esac
19628
19629 : see if trunc exists
19630 set trunc d_trunc
19631 eval $inlibc
19632
19633 : see if truncate exists
19634 set truncate d_truncate
19635 eval $inlibc
19636
19637 : see if ttyname_r exists
19638 set ttyname_r d_ttyname_r
19639 eval $inlibc
19640 case "$d_ttyname_r" in
19641 "$define")
19642         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19643         case "$d_ttyname_r_proto:$usethreads" in
19644         ":define")      d_ttyname_r_proto=define
19645                 set d_ttyname_r_proto ttyname_r $hdrs
19646                 eval $hasproto ;;
19647         *)      ;;
19648         esac
19649         case "$d_ttyname_r_proto" in
19650         define)
19651         case "$ttyname_r_proto" in
19652         ''|0) try='int ttyname_r(int, char*, size_t);'
19653         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19654         esac
19655         case "$ttyname_r_proto" in
19656         ''|0) try='int ttyname_r(int, char*, int);'
19657         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19658         esac
19659         case "$ttyname_r_proto" in
19660         ''|0) try='char* ttyname_r(int, char*, int);'
19661         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19662         esac
19663         case "$ttyname_r_proto" in
19664         ''|0)   d_ttyname_r=undef
19665                 ttyname_r_proto=0
19666                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19667         * )     case "$ttyname_r_proto" in
19668                 REENTRANT_PROTO*) ;;
19669                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19670                 esac
19671                 echo "Prototype: $try" ;;
19672         esac
19673         ;;
19674         *)      case "$usethreads" in
19675                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19676                 esac
19677                 d_ttyname_r=undef
19678                 ttyname_r_proto=0
19679                 ;;
19680         esac
19681         ;;
19682 *)      ttyname_r_proto=0
19683         ;;
19684 esac
19685
19686 : see if tzname[] exists
19687 echo " "
19688 if set tzname val -a d_tzname; eval $csym; $val; then
19689         val="$define"
19690         echo 'tzname[] found.' >&4
19691 else
19692         val="$undef"
19693         echo 'tzname[] NOT found.' >&4
19694 fi
19695 set d_tzname
19696 eval $setvar
19697
19698 : Check if is a multiplatform env
19699 case "$osname" in
19700 darwin) multiarch="$define" ;;
19701 esac
19702 case "$multiarch" in
19703 ''|[nN]*) multiarch="$undef" ;;
19704 esac
19705
19706 : check for ordering of bytes in a UV
19707 echo " "
19708 case "$multiarch" in
19709 *$define*)
19710         $cat <<EOM
19711 You seem to be doing a multiarchitecture build,
19712 skipping the byteorder check.
19713
19714 EOM
19715         byteorder='ffff'
19716         ;;
19717 *)
19718         case "$byteorder" in
19719         '')
19720                 $cat <<'EOM'
19721 In the following, larger digits indicate more significance.  A big-endian
19722 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19723 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19724 machines may have weird orders like 3412.  A Cray will report 87654321,
19725 an Alpha will report 12345678. If the test program works the default is
19726 probably right.
19727 I'm now running the test program...
19728 EOM
19729                 $cat >try.c <<EOCP
19730 #include <stdio.h>
19731 #$i_stdlib I_STDLIB
19732 #ifdef I_STDLIB
19733 #include <stdlib.h>
19734 #endif
19735 #include <sys/types.h>
19736 typedef $uvtype UV;
19737 int main()
19738 {
19739         int i;
19740         union {
19741                 UV l;
19742                 char c[$uvsize];
19743         } u;
19744
19745         if ($uvsize > 4)
19746                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19747         else
19748                 u.l = (UV)0x04030201;
19749         for (i = 0; i < $uvsize; i++)
19750                 printf("%c", u.c[i]+'0');
19751         printf("\n");
19752         exit(0);
19753 }
19754 EOCP
19755                 xxx_prompt=y
19756                 set try
19757                 if eval $compile && $run ./try > /dev/null; then
19758                         dflt=`$run ./try`
19759                         case "$dflt" in
19760                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19761                                 echo "(The test program ran ok.)"
19762                                 echo "byteorder=$dflt"
19763                                 xxx_prompt=n
19764                         ;;
19765                         ????|????????) echo "(The test program ran ok.)" ;;
19766                         *) echo "(The test program didn't run right for some reason.)" ;;
19767                         esac
19768                 else
19769                         dflt='4321'
19770                         cat <<'EOM'
19771 (I can't seem to compile the test program.  Guessing big-endian...)
19772 EOM
19773                 fi
19774                 case "$xxx_prompt" in
19775                 y)
19776                         rp="What is the order of bytes in $uvtype?"
19777                         . ./myread
19778                         byteorder="$ans"
19779                         ;;
19780                 *)      byteorder=$dflt
19781                         ;;
19782                 esac
19783                 ;;
19784         esac
19785         $rm_try
19786         ;;
19787 esac
19788
19789 : Checking 32bit alignedness
19790 $cat <<EOM
19791
19792 Checking to see whether you can access character data unalignedly...
19793 EOM
19794 case "$d_u32align" in
19795 '')   $cat >try.c <<EOCP
19796 #include <stdio.h>
19797 #$i_stdlib I_STDLIB
19798 #ifdef I_STDLIB
19799 #include <stdlib.h>
19800 #endif
19801 #define U32 $u32type
19802 #define BYTEORDER 0x$byteorder
19803 #define U8 $u8type
19804 #include <signal.h>
19805 #ifdef SIGBUS
19806 $signal_t bletch(int s) { exit(4); }
19807 #endif
19808 int main() {
19809 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19810     volatile U8 buf[8];
19811     volatile U32 *up;
19812     int i;
19813
19814     if (sizeof(U32) != 4) {
19815         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19816         exit(1);
19817     }
19818
19819     fflush(stdout);
19820
19821 #ifdef SIGBUS
19822     signal(SIGBUS, bletch);
19823 #endif
19824
19825     buf[0] = 0;
19826     buf[1] = 0;
19827     buf[2] = 0;
19828     buf[3] = 1;
19829     buf[4] = 0;
19830     buf[5] = 0;
19831     buf[6] = 0;
19832     buf[7] = 1;
19833
19834     for (i = 0; i < 4; i++) {
19835         up = (U32*)(buf + i);
19836         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19837                (*up == 1 << (8*(3-i)))  /* little-endian */
19838               )
19839            )
19840         {
19841             printf("read failed (%x)\n", *up);
19842             exit(2);
19843         }
19844     }
19845
19846     /* write test */
19847     for (i = 0; i < 4; i++) {
19848         up = (U32*)(buf + i);
19849         *up = 0xBeef;
19850         if (*up != 0xBeef) {
19851             printf("write failed (%x)\n", *up);
19852             exit(3);
19853         }
19854     }
19855
19856     exit(0);
19857 #else
19858     printf("1\n");
19859     exit(1);
19860 #endif
19861     return 0;
19862 }
19863 EOCP
19864 set try
19865 if eval $compile_ok; then
19866         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19867         $run ./try 2>&1 >/dev/null
19868         case "$?" in
19869         0)      cat >&4 <<EOM
19870 You can access character data pretty unalignedly.
19871 EOM
19872                 d_u32align="$undef"
19873                 ;;
19874         *)      cat >&4 <<EOM
19875 It seems that you must access character data in an aligned manner.
19876 EOM
19877                 d_u32align="$define"
19878                 ;;
19879         esac
19880 else
19881         rp='Can you access character data at unaligned addresses?'
19882         dflt='n'
19883         . ./myread
19884         case "$ans" in
19885         [yY]*)  d_u32align="$undef"  ;;
19886         *)      d_u32align="$define" ;;
19887         esac
19888 fi
19889 $rm_try
19890 ;;
19891 esac
19892
19893 : see if ualarm exists
19894 set ualarm d_ualarm
19895 eval $inlibc
19896
19897 : see if umask exists
19898 set umask d_umask
19899 eval $inlibc
19900
19901 : see if unordered exists
19902 set unordered d_unordered
19903 eval $inlibc
19904
19905 : see if unsetenv exists
19906 set unsetenv d_unsetenv
19907 eval $inlibc
19908
19909 : see if usleep exists
19910 set usleep d_usleep
19911 eval $inlibc
19912
19913 : see if prototype for usleep is available
19914 echo " "
19915 set d_usleepproto usleep $i_unistd unistd.h
19916 eval $hasproto
19917
19918 : see if ustat exists
19919 set ustat d_ustat
19920 eval $inlibc
19921
19922 : see if closedir exists
19923 set closedir d_closedir
19924 eval $inlibc
19925
19926 case "$d_closedir" in
19927 "$define")
19928         echo " "
19929         echo "Checking whether closedir() returns a status..." >&4
19930         cat > try.c <<EOM
19931 #$i_dirent I_DIRENT             /**/
19932 #$i_sysdir I_SYS_DIR            /**/
19933 #$i_sysndir I_SYS_NDIR          /**/
19934 #$i_systypes I_SYS_TYPES        /**/
19935
19936 #if defined(I_SYS_TYPES)
19937 #include <sys/types.h>
19938 #endif
19939 #if defined(I_DIRENT)
19940 #include <dirent.h>
19941 #else
19942 #ifdef I_SYS_NDIR
19943 #include <sys/ndir.h>
19944 #else
19945 #ifdef I_SYS_DIR
19946 #ifdef hp9000s500
19947 #include <ndir.h>       /* may be wrong in the future */
19948 #else
19949 #include <sys/dir.h>
19950 #endif
19951 #endif
19952 #endif
19953 #endif
19954 int main() { return closedir(opendir(".")); }
19955 EOM
19956         set try
19957         if eval $compile_ok; then
19958                 if $run ./try > /dev/null 2>&1 ; then
19959                         echo "Yes, it does."
19960                         val="$undef"
19961                 else
19962                         echo "No, it doesn't."
19963                         val="$define"
19964                 fi
19965         else
19966                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19967                 val="$define"
19968         fi
19969         ;;
19970 *)
19971         val="$undef";
19972         ;;
19973 esac
19974 set d_void_closedir
19975 eval $setvar
19976 $rm_try
19977
19978 : see if there is a wait4
19979 set wait4 d_wait4
19980 eval $inlibc
19981
19982 : see if waitpid exists
19983 set waitpid d_waitpid
19984 eval $inlibc
19985
19986 : look for wcscmp
19987 echo " "
19988 $cat >try.c <<'EOCP'
19989 #include <stdio.h>
19990 #include <wchar.h>
19991 int main ()
19992 {
19993     wchar_t *s = L" ";
19994     return (wcscmp (s, s) ? 1 : 0);
19995     }
19996 EOCP
19997 set try
19998 val="$undef"
19999 if eval $compile; then
20000     `$run ./try`
20001     case "$?" in
20002         0)  echo "A working wcscmp() found." >&4
20003             val="$define" ;;
20004         *)  echo "wcscmp() found, but it doesn't work" >&4
20005             ;;
20006         esac
20007 else
20008     echo "wcscmp() NOT found." >&4
20009     fi
20010 set d_wcscmp
20011 eval $setvar
20012 $rm_try
20013
20014 : see if wcstombs exists
20015 set wcstombs d_wcstombs
20016 eval $inlibc
20017
20018 : look for wcsxfrm
20019 echo " "
20020 $cat >try.c <<'EOCP'
20021 #include <errno.h>
20022 #include <wchar.h>
20023 int main ()
20024 {
20025     wchar_t dst[4], *src = L" ";
20026     errno = 0;
20027     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20028     }
20029 EOCP
20030 set try
20031 val="$undef"
20032 if eval $compile; then
20033     `$run ./try`
20034     case "$?" in
20035         0)  echo "A working wcsxfrm() found." >&4
20036             val="$define" ;;
20037         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20038             ;;
20039         esac
20040 else
20041     echo "wcsxfrm() NOT found." >&4
20042     fi
20043 set d_wcsxfrm
20044 eval $setvar
20045 $rm_try
20046
20047 : see if wctomb exists
20048 set wctomb d_wctomb
20049 eval $inlibc
20050
20051 : see if writev exists
20052 set writev d_writev
20053 eval $inlibc
20054
20055 : check for alignment requirements
20056 echo " "
20057 case "$alignbytes" in
20058     '') echo "Checking alignment constraints..." >&4
20059         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
20060             $cat >try.c <<'EOCP'
20061 typedef long double NV;
20062 EOCP
20063         else
20064             $cat >try.c <<'EOCP'
20065 typedef double NV;
20066 EOCP
20067         fi
20068         $cat >>try.c <<'EOCP'
20069 #include <stdio.h>
20070 struct foobar {
20071     char foo;
20072     NV bar;
20073 } try_algn;
20074 int main()
20075 {
20076     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20077     return(0);
20078 }
20079 EOCP
20080         set try
20081         if eval $compile_ok; then
20082             dflt=`$run ./try`
20083         else
20084             dflt='8'
20085             echo "(I can't seem to compile the test program...)"
20086         fi
20087         case "$multiarch" in
20088             *$define*)
20089                 : The usual safe value is 8, but Darwin with -Duselongdouble
20090                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20091                 : Configure to pick a larger value if needed.
20092                 if $test "$dflt" -lt 8; then
20093                     dflt='8'
20094                     echo "Setting alignment to 8 for multiarch support.">&4
20095                 fi
20096                 ;;
20097         esac
20098         ;;
20099     *) dflt="$alignbytes"
20100         ;;
20101 esac
20102 rp="Doubles must be aligned on a how-many-byte boundary?"
20103 . ./myread
20104 alignbytes="$ans"
20105 $rm_try
20106
20107 : set the base revision
20108 baserev=5.0
20109
20110 : length of character in bytes. Is always 1, otherwise it is not C
20111 : This used to be a test using sizeof
20112 charsize=1
20113
20114 : Check for the number of bits in a character
20115 case "$charbits" in
20116 '')     echo "Checking how long a character is (in bits)..." >&4
20117         $cat >try.c <<EOCP
20118 #include <stdio.h>
20119 int main ()
20120 {
20121     int n;
20122     unsigned char c;
20123     for (c = 1, n = 0; c; c <<= 1, n++) ;
20124     printf ("%d\n", n);
20125     return (0);
20126     }
20127 EOCP
20128         set try
20129         if eval $compile_ok; then
20130                 dflt=`$run ./try`
20131         else
20132                 dflt='8'
20133                 echo "(I can't seem to compile the test program.  Guessing...)"
20134         fi
20135         ;;
20136 *)
20137         dflt="$charbits"
20138         ;;
20139 esac
20140 rp="What is the length of a character (in bits)?"
20141 . ./myread
20142 charbits="$ans"
20143 $rm_try
20144 case "$charbits" in
20145 8)      ;;
20146 *)      cat >&4 << EOM
20147 Your system has an unsigned character size of $charbits bits, which
20148 is rather unusual (normally it is 8 bits).  Perl likely will not work
20149 correctly on your system, with subtle bugs in various places.
20150 EOM
20151         rp='Do you really want to continue?'
20152         dflt='n'
20153         . ./myread
20154         case "$ans" in
20155                 [yY])   echo >&4 "Okay, continuing."    ;;
20156                 *)      exit 1                          ;;
20157         esac
20158 esac
20159
20160 : how do we concatenate cpp tokens here?
20161 echo " "
20162 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20163 $cat >cpp_stuff.c <<'EOCP'
20164 #define RCAT(a,b)a/**/b
20165 #define ACAT(a,b)a ## b
20166 RCAT(Rei,ser)
20167 ACAT(Cir,cus)
20168 EOCP
20169 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20170 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20171         echo "Oh!  Smells like ANSI's been here." >&4
20172         echo "We can catify or stringify, separately or together!"
20173         cpp_stuff=42
20174 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20175         echo "Ah, yes!  The good old days!" >&4
20176         echo "However, in the good old days we don't know how to stringify and"
20177         echo "catify at the same time."
20178         cpp_stuff=1
20179 else
20180         $cat >&4 <<EOM
20181 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20182 You're going to have to edit the values of CAT[2-5] in config.h...
20183 EOM
20184         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20185 fi
20186 $rm -f cpp_stuff.*
20187
20188 : see if this is a db.h system
20189 set db.h i_db
20190 eval $inhdr
20191
20192 case "$i_db" in
20193 $define)
20194         : Check db version.
20195         echo " "
20196         echo "Checking Berkeley DB version ..." >&4
20197         $cat >try.c <<EOCP
20198 #$d_const HASCONST
20199 #ifndef HASCONST
20200 #define const
20201 #endif
20202 #include <sys/types.h>
20203 #include <stdio.h>
20204 #$i_stdlib I_STDLIB
20205 #ifdef I_STDLIB
20206 #include <stdlib.h>
20207 #endif
20208 #include <db.h>
20209 int main(int argc, char *argv[])
20210 {
20211 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20212     int Major, Minor, Patch ;
20213     unsigned long Version ;
20214     (void)db_version(&Major, &Minor, &Patch) ;
20215     if (argc == 2) {
20216         printf("%d %d %d %d %d %d\n",
20217                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20218                Major, Minor, Patch);
20219         exit(0);
20220     }
20221     printf("You have Berkeley DB Version 2 or greater.\n");
20222
20223     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20224                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20225     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20226                 Major, Minor, Patch) ;
20227
20228     /* check that db.h & libdb are compatible */
20229     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20230         printf("db.h and libdb are incompatible.\n") ;
20231         exit(3);
20232     }
20233
20234     printf("db.h and libdb are compatible.\n") ;
20235
20236     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20237                 + DB_VERSION_PATCH ;
20238
20239     /* needs to be >= 2.3.4 */
20240     if (Version < 2003004) {
20241     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20242         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20243         exit(2);
20244     }
20245
20246     exit(0);
20247 #else
20248 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20249     if (argc == 2) {
20250         printf("1 0 0\n");
20251         exit(0);
20252     }
20253     printf("You have Berkeley DB Version 1.\n");
20254     exit(0);    /* DB version < 2: the coast is clear. */
20255 #else
20256     exit(1);    /* <db.h> not Berkeley DB? */
20257 #endif
20258 #endif
20259 }
20260 EOCP
20261         set try
20262         if eval $compile_ok && $run ./try; then
20263                 echo 'Looks OK.' >&4
20264                 set `$run ./try 1`
20265                 db_version_major=$1
20266                 db_version_minor=$2
20267                 db_version_patch=$3
20268         else
20269                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20270                 i_db=$undef
20271                 case " $libs " in
20272                 *"-ldb "*)
20273                         : Remove db from list of libraries to use
20274                         echo "Removing unusable -ldb from library list" >&4
20275                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20276                         shift
20277                         libs="$*"
20278                         echo "libs = $libs" >&4
20279                         ;;
20280                 esac
20281         fi
20282         $rm_try
20283         ;;
20284 esac
20285
20286 case "$i_db" in
20287 define)
20288         : Check the return type needed for hash
20289         echo " "
20290         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20291         $cat >try.c <<EOCP
20292 #$d_const HASCONST
20293 #ifndef HASCONST
20294 #define const
20295 #endif
20296 #include <sys/types.h>
20297 #include <db.h>
20298
20299 #ifndef DB_VERSION_MAJOR
20300 u_int32_t hash_cb (const void* ptr, size_t size)
20301 {
20302 }
20303 HASHINFO info;
20304 int main()
20305 {
20306         info.hash = hash_cb;
20307 }
20308 #endif
20309 EOCP
20310         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20311                 if $contains warning try.out >>/dev/null 2>&1 ; then
20312                         db_hashtype='int'
20313                 else
20314                         db_hashtype='u_int32_t'
20315                 fi
20316         else
20317                 : XXX Maybe we should just give up here.
20318                 db_hashtype=u_int32_t
20319                 $cat try.out >&4
20320                 echo "Help:  I can't seem to compile the db test program." >&4
20321                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20322         fi
20323         $rm_try
20324         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20325         ;;
20326 *)      db_hashtype=u_int32_t
20327         ;;
20328 esac
20329 case "$i_db" in
20330 define)
20331         : Check the return type needed for prefix
20332         echo " "
20333         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20334         cat >try.c <<EOCP
20335 #$d_const HASCONST
20336 #ifndef HASCONST
20337 #define const
20338 #endif
20339 #include <sys/types.h>
20340 #include <db.h>
20341
20342 #ifndef DB_VERSION_MAJOR
20343 size_t prefix_cb (const DBT *key1, const DBT *key2)
20344 {
20345 }
20346 BTREEINFO info;
20347 int main()
20348 {
20349         info.prefix = prefix_cb;
20350 }
20351 #endif
20352 EOCP
20353         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20354                 if $contains warning try.out >>/dev/null 2>&1 ; then
20355                         db_prefixtype='int'
20356                 else
20357                         db_prefixtype='size_t'
20358                 fi
20359         else
20360                 db_prefixtype='size_t'
20361                 : XXX Maybe we should just give up here.
20362                 $cat try.out >&4
20363                 echo "Help:  I can't seem to compile the db test program." >&4
20364                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20365         fi
20366         $rm_try
20367         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20368         ;;
20369 *)      db_prefixtype='size_t'
20370         ;;
20371 esac
20372
20373 : Check what kind of inf/nan your system has
20374 $echo "Checking the kind of infinities and nans you have..." >&4
20375 $cat >try.c <<EOP
20376 #define DOUBLESIZE $doublesize
20377 #$d_longdbl HAS_LONG_DOUBLE
20378 #ifdef HAS_LONG_DOUBLE
20379 #define LONGDBLSIZE $longdblsize
20380 #define LONGDBLKIND $longdblkind
20381 #endif
20382 #$i_math I_MATH
20383 #ifdef I_MATH
20384 #include <math.h>
20385 #endif
20386 #include <stdio.h>
20387 /* Note that whether the sign bit is on or off
20388  * for NaN depends on the CPU/FPU, and possibly
20389  * can be affected by the build toolchain.
20390  *
20391  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20392  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20393  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20394  * (respectively) as opposed to the more usual
20395  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20396  */
20397 static void bytes(unsigned char *p, unsigned int n) {
20398   int i;
20399   for (i = 0; i < n; i++) {
20400     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20401   }
20402 }
20403 int main(int argc, char *argv[]) {
20404    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20405     * because some compilers are 'smart' and not only warn but refuse to
20406     * compile such 'illegal' values. */
20407    double dinf = exp(1e9);
20408    double dnan = sqrt(-1.0);
20409 #ifdef HAS_LONG_DOUBLE
20410    long double ldinf = (long double)exp(1e9);
20411    long double ldnan = (long double)sqrt(-1.0);
20412 #endif
20413   if (argc == 2) {
20414     switch (argv[1][0]) {
20415     case '1': bytes(&dinf, sizeof(dinf)); break;
20416     case '2': bytes(&dnan, sizeof(dnan)); break;
20417 #ifdef HAS_LONG_DOUBLE
20418 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20419 /* the 80-bit long doubles might have garbage in their excess bytes */
20420     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20421 # endif
20422     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20423     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20424 #endif
20425     }
20426   }
20427   return 0;
20428 }
20429 EOP
20430 set try
20431 if eval $compile; then
20432     doubleinfbytes=`$run ./try 1`
20433     doublenanbytes=`$run ./try 2`
20434     case "$d_longdbl" in
20435     $define)
20436       longdblinfbytes=`$run ./try 3`
20437       longdblnanbytes=`$run ./try 4`
20438       ;;
20439     esac
20440 else
20441     # Defaults in case the above test program failed.
20442     case "$doublekind" in
20443     1) # IEEE 754 32-bit LE
20444        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20445        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20446        ;;
20447     2) # IEEE 754 32-bit BE
20448        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20449        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20450        ;;
20451     3) # IEEE 754 64-bit LE
20452        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20453        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20454        ;;
20455     4) # IEEE 754 64-bit BE
20456        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20457        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20458        ;;
20459     5) # IEEE 754 128-bit LE
20460        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20461        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20462        ;;
20463     6) # IEEE 754 128-bit BE
20464        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20465        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20466        ;;
20467     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20468        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20469        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20470        ;;
20471     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20472        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20473        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20474        ;;
20475     *) # No idea.
20476        doubleinfbytes=$undef
20477        doublenanbytes=$undef
20478        ;;
20479     esac
20480     case "$longdblkind" in
20481     1) # IEEE 754 128-bit LE
20482        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20483        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20484        ;;
20485     2) # IEEE 754 128-bit BE
20486        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20487        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20488        ;;
20489     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20490        case "$longdblsize" in
20491        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20492            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20493            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20494            ;;
20495        16) # x86_64
20496            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20497            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20498            ;;
20499        *)  # No idea.
20500            longdblinfbytes=$undef
20501            longdblnanbytes=$undef
20502        ;;
20503        esac
20504        ;;
20505     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20506        case "$longdblsize" in
20507        12) # 32-bit system
20508            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20509            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20510            ;;
20511        16) # 64-bit system
20512            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20513            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20514            ;;
20515        *)  # No idea.
20516            longdblinfbytes=$undef
20517            longdblnanbytes=$undef
20518        ;;
20519        esac
20520        ;;
20521     5) # 128-bit LE "double double"
20522        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20523        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20524        ;;
20525     6) # 128-bit BE "double double"
20526        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20527        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20528        ;;
20529     *) # No idea.
20530        longdblinfbytes=$undef
20531        longdblnanbytes=$undef
20532        ;;
20533     esac
20534 fi
20535 $rm_try
20536
20537 : Check the length of the double mantissa
20538 $echo "Checking how many mantissa bits your doubles have..." >&4
20539 $cat >try.c <<EOP
20540 #$i_float I_FLOAT
20541 #$i_sunmath I_SUNMATH
20542 #ifdef I_FLOAT
20543 # include <float.h>
20544 #endif
20545 #ifdef I_SUNMATH
20546 # include <sunmath.h>
20547 #endif
20548 #ifdef DBL_MANT_DIG
20549 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20550 #endif
20551 #include <stdio.h>
20552 int main(int argc, char *argv[]) {
20553 #ifdef BITS
20554   printf("%d\n", BITS);
20555 #endif
20556   return 0;
20557 }
20558 EOP
20559 set try
20560 if eval $compile; then
20561     doublemantbits=`$run ./try`
20562 else
20563     doublemantbits="$undef"
20564 fi
20565 $rm_try
20566
20567 : Check the length of the longdouble mantissa
20568 $echo "Checking how many mantissa bits your long doubles have..." >&4
20569 $cat >try.c <<EOP
20570 #$i_float I_FLOAT
20571 #$i_sunmath I_SUNMATH
20572 #ifdef I_FLOAT
20573 # include <float.h>
20574 #endif
20575 #ifdef I_SUNMATH
20576 # include <sunmath.h>
20577 #endif
20578 #$d_longdbl HAS_LONG_DOUBLE
20579 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20580 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20581 /* This format has no implicit bit.  Beware, however, that for
20582  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20583  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20584  * and the top bit must have been one since 387, zero is plain invalid.
20585  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20586 #  define BITS LDBL_MANT_DIG
20587 # elif ($longdblkind == 5 || $longdblkind == 6) /* double double */
20588 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20589  * reason e.g. Irix thinks 107.  But in any case, we want only
20590  * the number of real bits, the implicit bits are of no interest.  */
20591 #  define BITS 2 * (DBL_MANT_DIG - 1)
20592 # else
20593 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20594 # endif
20595 #endif
20596 #include <stdio.h>
20597 int main(int argc, char *argv[]) {
20598 #ifdef BITS
20599   printf("%d\n", BITS);
20600 #endif
20601   return 0;
20602 }
20603 EOP
20604 set try
20605 if eval $compile; then
20606     longdblmantbits=`$run ./try`
20607 else
20608     longdblmantbits="$undef"
20609 fi
20610 $rm_try
20611
20612 : Check the length of the NV mantissa
20613 $echo "Checking how many mantissa bits your NVs have..." >&4
20614 if test "X$usequadmath" = "X$define"; then
20615   nvmantbits=112 # 128-1-15
20616 else
20617   if test "X$nvsize" = "X$doublesize"; then
20618     nvmantbits="$doublemantbits"
20619   else
20620      if test "X$nvsize" = "X$longdblsize"; then
20621        nvmantbits="$longdblmantbits"
20622      else
20623        nvmantbits="$undef"
20624      fi
20625   fi
20626 fi
20627
20628 : How can we generate normalized random numbers ?
20629 echo " "
20630 echo "Using our internal random number implementation..." >&4
20631
20632 case "$ccflags" in
20633 *-Dmy_rand=*|*-Dmy_srand=*)
20634         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20635         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20636         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20637         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20638         ;;
20639 esac
20640
20641 randfunc=Perl_drand48
20642 drand01="Perl_drand48()"
20643 seedfunc="Perl_drand48_init"
20644 randbits=48
20645 randseedtype=U32
20646
20647 : Determine if this is an EBCDIC system
20648 echo " "
20649 echo "Determining whether or not we are on an EBCDIC system..." >&4
20650 $cat >try.c <<'EOM'
20651 int main()
20652 {
20653   if ('M'==0xd4) return 0;
20654   return 1;
20655 }
20656 EOM
20657
20658 val=$undef
20659 set try
20660 if eval $compile_ok; then
20661         if $run ./try; then
20662                 echo "You seem to speak EBCDIC." >&4
20663                 val="$define"
20664         else
20665                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20666         fi
20667 else
20668         echo "I'm unable to compile the test program." >&4
20669         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20670 fi
20671 $rm_try
20672 set ebcdic
20673 eval $setvar
20674
20675 : Check how to flush
20676 echo " "
20677 $cat >&4 <<EOM
20678 Checking how to flush all pending stdio output...
20679 EOM
20680 # I only know how to find the first 32 possibly open files on SunOS.
20681 # See also hints/sunos_4_1.sh and util.c  --AD
20682 case "$osname" in
20683 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20684 esac
20685 $cat >>try.c <<EOCP
20686 #include <stdio.h>
20687 #$i_stdlib I_STDLIB
20688 #ifdef I_STDLIB
20689 #include <stdlib.h>
20690 #endif
20691 #$i_unistd I_UNISTD
20692 #ifdef I_UNISTD
20693 # include <unistd.h>
20694 #endif
20695 #$d_sysconf HAS_SYSCONF
20696 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20697 #ifdef HAS_STDIO_STREAM_ARRAY
20698 # define STDIO_STREAM_ARRAY $stdio_stream_array
20699 #endif
20700 int main() {
20701   FILE* p;
20702   unlink("try.out");
20703   p = fopen("try.out", "w");
20704 #ifdef TRY_FPUTC
20705   fputc('x', p);
20706 #else
20707 # ifdef TRY_FPRINTF
20708   fprintf(p, "x");
20709 # endif
20710 #endif
20711 #ifdef TRY_FFLUSH_NULL
20712   fflush(NULL);
20713 #endif
20714 #ifdef TRY_FFLUSH_ALL
20715   {
20716     long open_max = -1;
20717 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20718     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20719 # else
20720 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20721     open_max = sysconf(_SC_OPEN_MAX);
20722 #  else
20723 #   ifdef FOPEN_MAX
20724     open_max = FOPEN_MAX;
20725 #   else
20726 #    ifdef OPEN_MAX
20727     open_max = OPEN_MAX;
20728 #    else
20729 #     ifdef _NFILE
20730     open_max = _NFILE;
20731 #     endif
20732 #    endif
20733 #   endif
20734 #  endif
20735 # endif
20736 # ifdef HAS_STDIO_STREAM_ARRAY
20737     if (open_max > 0) {
20738       long i;
20739       for (i = 0; i < open_max; i++)
20740             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20741                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20742                 STDIO_STREAM_ARRAY[i]._flag)
20743                 fflush(&STDIO_STREAM_ARRAY[i]);
20744     }
20745   }
20746 # endif
20747 #endif
20748   _exit(42);
20749 }
20750 EOCP
20751 : first we have to find out how _not_ to flush
20752 $to try.c
20753 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20754     output=''
20755     set try -DTRY_FPUTC
20756     if eval $compile; then
20757             $run ./try 2>/dev/null
20758             code="$?"
20759             $from try.out
20760             if $test ! -s try.out -a "X$code" = X42; then
20761                 output=-DTRY_FPUTC
20762             fi
20763     fi
20764     case "$output" in
20765     '')
20766             set try -DTRY_FPRINTF
20767             if eval $compile; then
20768                     $run ./try 2>/dev/null
20769                     code="$?"
20770                     $from try.out
20771                     if $test ! -s try.out -a "X$code" = X42; then
20772                         output=-DTRY_FPRINTF
20773                     fi
20774             fi
20775         ;;
20776     esac
20777 fi
20778 : check for fflush NULL behavior
20779 case "$fflushNULL" in
20780 '')     set try -DTRY_FFLUSH_NULL $output
20781         if eval $compile; then
20782                 $run ./try 2>/dev/null
20783                 code="$?"
20784                 $from try.out
20785                 if $test -s try.out -a "X$code" = X42; then
20786                         fflushNULL="`$cat try.out`"
20787                 else
20788                         if $test "X$code" != X42; then
20789                                 $cat >&4 <<EOM
20790 (If this test failed, don't worry, we'll try another method shortly.)
20791 EOM
20792                         fi
20793                 fi
20794         fi
20795         $rm -f core try.core core.try.*
20796         case "$fflushNULL" in
20797         x)      $cat >&4 <<EOM
20798 Your fflush(NULL) works okay for output streams.
20799 Let's see if it clobbers input pipes...
20800 EOM
20801 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20802 # bug that improperly flushes the input end of pipes.  So we avoid the
20803 # autoflush on fork/system/exec support for now. :-(
20804 $cat >tryp.c <<EOCP
20805 #include <stdio.h>
20806 int
20807 main(int argc, char **argv)
20808 {
20809     char buf[1024];
20810     int i;
20811     char *bp = buf;
20812     while (1) {
20813         while ((i = getc(stdin)) != -1
20814                && (*bp++ = i) != '\n'
20815                && bp < &buf[1024])
20816         /* DO NOTHING */ ;
20817         *bp = '\0';
20818         fprintf(stdout, "%s", buf);
20819         fflush(NULL);
20820         if (i == -1)
20821             return 0;
20822         bp = buf;
20823     }
20824 }
20825 EOCP
20826                 fflushNULL="$define"
20827                 set tryp
20828                 if eval $compile; then
20829                     $rm -f tryp.out
20830                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20831                     if $test "X$targethost" != X; then
20832                         $to tryp.c
20833                         $to tryp
20834                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20835                     else
20836                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20837                     fi
20838                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20839                        $cat >&4 <<EOM
20840 fflush(NULL) seems to behave okay with input streams.
20841 EOM
20842                         fflushNULL="$define"
20843                     else
20844                         $cat >&4 <<EOM
20845 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20846 EOM
20847                         fflushNULL="$undef"
20848                     fi
20849                 fi
20850                 $rm -f core tryp.c tryp.core core.tryp.*
20851                 ;;
20852         '')     $cat >&4 <<EOM
20853 Your fflush(NULL) isn't working (contrary to ANSI C).
20854 EOM
20855                 fflushNULL="$undef"
20856                 ;;
20857         *)      $cat >&4 <<EOM
20858 Cannot figure out whether your fflush(NULL) works or not.
20859 I'm assuming it doesn't (contrary to ANSI C).
20860 EOM
20861                 fflushNULL="$undef"
20862                 ;;
20863         esac
20864         ;;
20865 $define|true|[yY]*)
20866         fflushNULL="$define"
20867         ;;
20868 *)
20869         fflushNULL="$undef"
20870         ;;
20871 esac
20872 : check explicit looping only if NULL did not work, and if the pipe
20873 : bug does not show up on an explicit flush too
20874 case "$fflushNULL" in
20875 "$undef")
20876         $cat >tryp.c <<EOCP
20877 #include <stdio.h>
20878 int
20879 main(int argc, char **argv)
20880 {
20881     char buf[1024];
20882     int i;
20883     char *bp = buf;
20884     while (1) {
20885         while ((i = getc(stdin)) != -1
20886                && (*bp++ = i) != '\n'
20887                && bp < &buf[1024])
20888         /* DO NOTHING */ ;
20889         *bp = '\0';
20890         fprintf(stdout, "%s", buf);
20891         fflush(stdin);
20892         if (i == -1)
20893             return 0;
20894         bp = buf;
20895     }
20896 }
20897 EOCP
20898         set tryp
20899         if eval $compile; then
20900             $rm -f tryp.out
20901             if $test "X$targethost" != X; then
20902                 $to tryp.c
20903                 $to tryp
20904                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20905             else
20906                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20907             fi
20908             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20909                $cat >&4 <<EOM
20910 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20911 EOM
20912                 : now check for fflushall behaviour
20913                 case "$fflushall" in
20914                 '')     set try -DTRY_FFLUSH_ALL $output
20915                         if eval $compile; then
20916                                 $cat >&4 <<EOM
20917 (Now testing the other method--but note that this also may fail.)
20918 EOM
20919                                 $run ./try 2>/dev/null
20920                                 code=$?
20921                                 $from try.out
20922                                 if $test -s try.out -a "X$code" = X42; then
20923                                         fflushall="`$cat try.out`"
20924                                 fi
20925                         fi
20926                         $rm_try
20927                         case "$fflushall" in
20928                         x)      $cat >&4 <<EOM
20929 Whew. Flushing explicitly all the stdio streams works.
20930 EOM
20931                                 fflushall="$define"
20932                                 ;;
20933                         '')     $cat >&4 <<EOM
20934 Sigh. Flushing explicitly all the stdio streams doesn't work.
20935 EOM
20936                                 fflushall="$undef"
20937                                 ;;
20938                         *)      $cat >&4 <<EOM
20939 Cannot figure out whether flushing stdio streams explicitly works or not.
20940 I'm assuming it doesn't.
20941 EOM
20942                                 fflushall="$undef"
20943                                 ;;
20944                         esac
20945                         ;;
20946                 "$define"|true|[yY]*)
20947                         fflushall="$define"
20948                         ;;
20949                 *)
20950                         fflushall="$undef"
20951                         ;;
20952                 esac
20953             else
20954                 $cat >&4 <<EOM
20955 All is futile.  Even fflush(stdin) clobbers input pipes!
20956 EOM
20957                 fflushall="$undef"
20958             fi
20959         else
20960             fflushall="$undef"
20961         fi
20962         $rm -f core tryp.c tryp.core core.tryp.*
20963         ;;
20964 *)      fflushall="$undef"
20965         ;;
20966 esac
20967
20968 case "$fflushNULL$fflushall" in
20969 undefundef)
20970         $cat <<EOM
20971 OK, I give up.  I cannot figure out how to flush pending stdio output.
20972 We won't be flushing handles at all before fork/exec/popen.
20973 EOM
20974         ;;
20975 esac
20976 $rm_try tryp
20977
20978 : Store the full pathname to the ar program for use in the C program
20979 : Respect a hint or command line value for full_ar.
20980 case "$full_ar" in
20981 '') full_ar=$ar ;;
20982 esac
20983
20984 : Store the full pathname to the sed program for use in the C program
20985 full_sed=$sed
20986
20987 : see what type gids are declared as in the kernel
20988 echo " "
20989 echo "Looking for the type for group ids returned by getgid()."
20990 set gid_t gidtype xxx stdio.h sys/types.h
20991 eval $typedef
20992 case "$gidtype" in
20993 xxx)
20994         xxx=`./findhdr sys/user.h`
20995         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20996         case $1 in
20997         unsigned) dflt="$1 $2" ;;
20998         *) dflt="$1" ;;
20999         esac
21000         ;;
21001 *) dflt="$gidtype";;
21002 esac
21003 case "$gidtype" in
21004 gid_t) echo "gid_t found." ;;
21005 *)      rp="What is the type for group ids returned by getgid()?"
21006         . ./myread
21007         gidtype="$ans"
21008         ;;
21009 esac
21010
21011 : Check the size of GID
21012 echo " "
21013 case "$gidtype" in
21014 *_t) zzz="$gidtype"     ;;
21015 *)   zzz="gid"          ;;
21016 esac
21017 echo "Checking the size of $zzz..." >&4
21018 cat > try.c <<EOCP
21019 #include <sys/types.h>
21020 #include <stdio.h>
21021 #$i_stdlib I_STDLIB
21022 #ifdef I_STDLIB
21023 #include <stdlib.h>
21024 #endif
21025 int main() {
21026     printf("%d\n", (int)sizeof($gidtype));
21027     exit(0);
21028 }
21029 EOCP
21030 set try
21031 if eval $compile_ok; then
21032         yyy=`$run ./try`
21033         case "$yyy" in
21034         '')     gidsize=4
21035                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21036                 ;;
21037         *)      gidsize=$yyy
21038                 echo "Your $zzz is $gidsize bytes long."
21039                 ;;
21040         esac
21041 else
21042         gidsize=4
21043         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21044 fi
21045
21046
21047 : Check if GID is signed
21048 echo " "
21049 case "$gidtype" in
21050 *_t) zzz="$gidtype"     ;;
21051 *)   zzz="gid"          ;;
21052 esac
21053 echo "Checking the sign of $zzz..." >&4
21054 cat > try.c <<EOCP
21055 #include <sys/types.h>
21056 #include <stdio.h>
21057 int main() {
21058         $gidtype foo = -1;
21059         if (foo < 0)
21060                 printf("-1\n");
21061         else
21062                 printf("1\n");
21063 }
21064 EOCP
21065 set try
21066 if eval $compile; then
21067         yyy=`$run ./try`
21068         case "$yyy" in
21069         '')     gidsign=1
21070                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21071                 ;;
21072         *)      gidsign=$yyy
21073                 case "$gidsign" in
21074                  1) echo "Your $zzz is unsigned." ;;
21075                 -1) echo "Your $zzz is signed."   ;;
21076                 esac
21077                 ;;
21078         esac
21079 else
21080         gidsign=1
21081         echo "(I can't compile the test program--guessing unsigned.)" >&4
21082 fi
21083
21084
21085 : Check 64bit sizes
21086 echo " "
21087
21088 if $test X"$quadtype" != X; then
21089
21090 echo "Checking how to print 64-bit integers..." >&4
21091
21092 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21093         $cat >try.c <<'EOCP'
21094 #include <sys/types.h>
21095 #include <stdio.h>
21096 int main() {
21097   int q = 12345678901;
21098   printf("%ld\n", q);
21099 }
21100 EOCP
21101         set try
21102         if eval $compile; then
21103                 yyy=`$run ./try`
21104                 case "$yyy" in
21105                 12345678901)
21106                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21107                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21108                         echo "We will use %d."
21109                         ;;
21110                 esac
21111         fi
21112 fi
21113
21114 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21115         $cat >try.c <<'EOCP'
21116 #include <sys/types.h>
21117 #include <stdio.h>
21118 int main() {
21119   long q = 12345678901;
21120   printf("%ld\n", q);
21121 }
21122 EOCP
21123         set try
21124         if eval $compile; then
21125                 yyy=`$run ./try`
21126                 case "$yyy" in
21127                 12345678901)
21128                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21129                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21130                         echo "We will use %ld."
21131                         ;;
21132                 esac
21133         fi
21134 fi
21135
21136 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21137         $cat >try.c <<'EOCP'
21138 #include <sys/types.h>
21139 #include <inttypes.h>
21140 #include <stdio.h>
21141 int main() {
21142   int64_t q = 12345678901;
21143   printf("%" PRId64 "\n", q);
21144 }
21145 EOCP
21146         set try
21147         if eval $compile; then
21148                 yyy=`$run ./try`
21149                 case "$yyy" in
21150                 12345678901)
21151                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21152                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21153                         echo "We will use the C9X style."
21154                         ;;
21155                 esac
21156         fi
21157 fi
21158
21159 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21160         $cat >try.c <<EOCP
21161 #include <sys/types.h>
21162 #include <stdio.h>
21163 int main() {
21164   $quadtype q = 12345678901;
21165   printf("%Ld\n", q);
21166 }
21167 EOCP
21168         set try
21169         if eval $compile; then
21170                 yyy=`$run ./try`
21171                 case "$yyy" in
21172                 12345678901)
21173                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21174                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21175                         echo "We will use %Ld."
21176                         ;;
21177                 esac
21178         fi
21179 fi
21180
21181 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21182         $cat >try.c <<'EOCP'
21183 #include <sys/types.h>
21184 #include <stdio.h>
21185 int main() {
21186   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21187   printf("%lld\n", q);
21188 }
21189 EOCP
21190         set try
21191         if eval $compile; then
21192                 yyy=`$run ./try`
21193                 case "$yyy" in
21194                 12345678901)
21195                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21196                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21197                         echo "We will use the %lld style."
21198                         ;;
21199                 esac
21200         fi
21201 fi
21202
21203 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21204         $cat >try.c <<EOCP
21205 #include <sys/types.h>
21206 #include <stdio.h>
21207 int main() {
21208   $quadtype q = 12345678901;
21209   printf("%qd\n", q);
21210 }
21211 EOCP
21212         set try
21213         if eval $compile; then
21214                 yyy=`$run ./try`
21215                 case "$yyy" in
21216                 12345678901)
21217                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21218                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21219                         echo "We will use %qd."
21220                         ;;
21221                 esac
21222         fi
21223 fi
21224
21225 if $test X"$sPRId64" = X; then
21226         echo "Cannot figure out how to print 64-bit integers." >&4
21227 fi
21228 $rm_try
21229
21230 fi
21231
21232 case "$sPRId64" in
21233 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21234         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21235         ;;
21236 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21237         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21238         ;;
21239 esac
21240
21241 : Check format strings for internal types
21242 echo " "
21243 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21244
21245 if $test X"$ivsize" = X8; then
21246         ivdformat="$sPRId64"
21247         uvuformat="$sPRIu64"
21248         uvoformat="$sPRIo64"
21249         uvxformat="$sPRIx64"
21250         uvXUformat="$sPRIXU64"
21251 else
21252         if $test X"$ivsize" = X"$longsize"; then
21253                 ivdformat='"ld"'
21254                 uvuformat='"lu"'
21255                 uvoformat='"lo"'
21256                 uvxformat='"lx"'
21257                 uvXUformat='"lX"'
21258         else
21259                 if $test X"$ivsize" = X"$intsize"; then
21260                         ivdformat='"d"'
21261                         uvuformat='"u"'
21262                         uvoformat='"o"'
21263                         uvxformat='"x"'
21264                         uvXUformat='"X"'
21265                 else
21266                         : far out
21267                         if $test X"$ivsize" = X"$shortsize"; then
21268                                 ivdformat='"hd"'
21269                                 uvuformat='"hu"'
21270                                 uvoformat='"ho"'
21271                                 uvxformat='"hx"'
21272                                 uvXUformat='"hX"'
21273                         fi
21274                 fi
21275         fi
21276 fi
21277
21278 if $test X"$usequadmath" = X"$define"; then
21279     nveformat='"Qe"'
21280     nvfformat='"Qf"'
21281     nvgformat='"Qg"'
21282     nvEUformat='"QE"'
21283     nvFUformat='"QF"'
21284     nvGUformat='"QG"'
21285 else
21286     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21287         nveformat="$sPRIeldbl"
21288         nvfformat="$sPRIfldbl"
21289         nvgformat="$sPRIgldbl"
21290         nvEUformat="$sPRIEUldbl"
21291         nvFUformat="$sPRIFUldbl"
21292         nvGUformat="$sPRIGUldbl"
21293     else
21294         nveformat='"e"'
21295         nvfformat='"f"'
21296         nvgformat='"g"'
21297         nvEUformat='"E"'
21298         nvFUformat='"F"'
21299         nvGUformat='"G"'
21300     fi
21301 fi
21302
21303 case "$ivdformat" in
21304 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21305     exit 1
21306     ;;
21307 esac
21308
21309 : Check format string for GID
21310
21311 echo " "
21312 $echo "Checking the format string to be used for gids..." >&4
21313
21314 case "$gidsign" in
21315 -1)     if $test X"$gidsize" = X"$ivsize"; then
21316                 gidformat="$ivdformat"
21317         else
21318                 if $test X"$gidsize" = X"$longsize"; then
21319                         gidformat='"ld"'
21320                 else
21321                         if $test X"$gidsize" = X"$intsize"; then
21322                                 gidformat='"d"'
21323                         else
21324                                 if $test X"$gidsize" = X"$shortsize"; then
21325                                         gidformat='"hd"'
21326                                 fi
21327                         fi
21328                 fi
21329         fi
21330         ;;
21331 *)      if $test X"$gidsize" = X"$uvsize"; then
21332                 gidformat="$uvuformat"
21333         else
21334                 if $test X"$gidsize" = X"$longsize"; then
21335                         gidformat='"lu"'
21336                 else
21337                         if $test X"$gidsize" = X"$intsize"; then
21338                                 gidformat='"u"'
21339                         else
21340                                 if $test X"$gidsize" = X"$shortsize"; then
21341                                         gidformat='"hu"'
21342                                 fi
21343                         fi
21344                 fi
21345         fi
21346         ;;
21347 esac
21348
21349 : see if getgroups exists
21350 set getgroups d_getgrps
21351 eval $inlibc
21352
21353 : see if setgroups exists
21354 set setgroups d_setgrps
21355 eval $inlibc
21356
21357 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21358 echo " "
21359 case "$d_getgrps$d_setgrps" in
21360 *define*)
21361         case "$groupstype" in
21362         '') dflt="$gidtype" ;;
21363         *)  dflt="$groupstype" ;;
21364         esac
21365         $cat <<EOM
21366 What type of pointer is the second argument to getgroups() and setgroups()?
21367 Usually this is the same as group ids, $gidtype, but not always.
21368
21369 EOM
21370         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21371         . ./myread
21372         groupstype="$ans"
21373         ;;
21374 *)  groupstype="$gidtype";;
21375 esac
21376
21377 : check whether make sets MAKE
21378 echo " "
21379 echo "Checking if your $make program sets \$(MAKE)..." >&4
21380 case "$make_set_make" in
21381 '')
21382         $sed 's/^X //' > testmake.mak << 'EOF'
21383 Xall:
21384 X       @echo 'maketemp="$(MAKE)"'
21385 EOF
21386         case "`$make -f testmake.mak 2>/dev/null`" in
21387         *maketemp=*) make_set_make='#' ;;
21388         *)      make_set_make="MAKE=$make" ;;
21389         esac
21390         $rm -f testmake.mak
21391         ;;
21392 esac
21393 case "$make_set_make" in
21394 '#') echo "Yup, it does.";;
21395 *) echo "Nope, it doesn't.";;
21396 esac
21397
21398 : see what type is used for mode_t
21399 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21400 set mode_t modetype int stdio.h sys/types.h
21401 eval $typedef_ask
21402
21403 : see if we need va_copy
21404 echo " "
21405 case "$i_stdarg" in
21406 "$define")
21407         $cat >try.c <<EOCP
21408 #include <stdarg.h>
21409 #include <stdio.h>
21410 #$i_stdlib I_STDLIB
21411 #ifdef I_STDLIB
21412 #include <stdlib.h>
21413 #endif
21414 #include <signal.h>
21415
21416 int
21417 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21418 {
21419   return vfprintf(f, fmt, *valp);
21420 }
21421
21422 int
21423 myvfprintf(FILE *f, const  char *fmt, va_list val)
21424 {
21425   return ivfprintf(f, fmt, &val);
21426 }
21427
21428 int
21429 myprintf(char *fmt, ...)
21430 {
21431   va_list val;
21432   va_start(val, fmt);
21433   return myvfprintf(stdout, fmt, val);
21434 }
21435
21436 int
21437 main(int ac, char **av)
21438 {
21439   signal(SIGSEGV, exit);
21440
21441   myprintf("%s%cs all right, then\n", "that", '\'');
21442   exit(0);
21443 }
21444 EOCP
21445         set try
21446         if eval $compile && $run ./try 2>&1 >/dev/null; then
21447                 case "`$run ./try`" in
21448                 "that's all right, then")
21449                         okay=yes
21450                         ;;
21451                 esac
21452         fi
21453         case "$okay" in
21454         yes)    echo "It seems that you don't need va_copy()." >&4
21455                 need_va_copy="$undef"
21456                 ;;
21457         *)      echo "It seems that va_copy() or similar will be needed." >&4
21458                 need_va_copy="$define"
21459                 ;;
21460         esac
21461         $rm_try
21462         ;;
21463 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21464         need_va_copy="$undef"
21465         ;;
21466 esac
21467
21468 : see what type is used for size_t
21469 rp="What is the type used for the length parameter for string functions?"
21470 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21471 eval $typedef_ask
21472
21473 : check for type of arguments to gethostbyaddr.
21474 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21475         case "$d_gethbyaddr" in
21476         $define)
21477                 $cat <<EOM
21478
21479 Checking to see what type of arguments are accepted by gethostbyaddr().
21480 EOM
21481                 hdrs="$define sys/types.h
21482                         $d_socket sys/socket.h
21483                         $i_niin netinet/in.h
21484                         $i_netdb netdb.h
21485                         $i_unistd unistd.h"
21486                 : The first arg can 'char *' or 'void *'
21487                 : The second arg is some of integral type
21488                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21489                         for yyy in size_t long int; do
21490                                 case "$netdb_host_type" in
21491                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21492                                         if ./protochk "$try" $hdrs; then
21493                                                 echo "Your system accepts $xxx for the first arg."
21494                                                 echo "...and $yyy for the second arg."
21495                                                 netdb_host_type="$xxx"
21496                                                 netdb_hlen_type="$yyy"
21497                                         fi
21498                                         ;;
21499                                 esac
21500                         done
21501                 done
21502                 : In case none of those worked, prompt the user.
21503                 case "$netdb_host_type" in
21504                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21505                         dflt='char *'
21506                         . ./myread
21507                         netdb_host_type=$ans
21508                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21509                         dflt="$sizetype"
21510                         . ./myread
21511                         netdb_hlen_type=$ans
21512                         ;;
21513                 esac
21514                 ;;
21515         *)      : no gethostbyaddr, so pick harmless defaults
21516                 netdb_host_type='char *'
21517                 netdb_hlen_type="$sizetype"
21518                 ;;
21519         esac
21520         # Remove the "const" if needed. -- but then we'll have a
21521         # prototype clash!
21522         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21523 fi
21524
21525 : check for type of argument to gethostbyname.
21526 if test "X$netdb_name_type" = X ; then
21527         case "$d_gethbyname" in
21528         $define)
21529                 $cat <<EOM
21530
21531 Checking to see what type of argument is accepted by gethostbyname().
21532 EOM
21533                 hdrs="$define sys/types.h
21534                         $d_socket sys/socket.h
21535                         $i_niin netinet/in.h
21536                         $i_netdb netdb.h
21537                         $i_unistd unistd.h"
21538                 for xxx in "const char *" "char *"; do
21539                         case "$netdb_name_type" in
21540                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21541                                 if ./protochk "$try" $hdrs; then
21542                                         echo "Your system accepts $xxx."
21543                                         netdb_name_type="$xxx"
21544                                 fi
21545                                 ;;
21546                         esac
21547                 done
21548                 : In case none of those worked, prompt the user.
21549                 case "$netdb_name_type" in
21550                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21551                         dflt='char *'
21552                         . ./myread
21553                         netdb_name_type=$ans
21554                         ;;
21555                 esac
21556                 ;;
21557         *)      : no gethostbyname, so pick harmless default
21558                 netdb_name_type='char *'
21559                 ;;
21560         esac
21561 fi
21562
21563 : check for type of 1st argument to getnetbyaddr.
21564 if test "X$netdb_net_type" = X ; then
21565         case "$d_getnbyaddr" in
21566         $define)
21567                 $cat <<EOM
21568
21569 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21570 EOM
21571                 hdrs="$define sys/types.h
21572                         $d_socket sys/socket.h
21573                         $i_niin netinet/in.h
21574                         $i_netdb netdb.h
21575                         $i_unistd unistd.h"
21576                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21577                         case "$netdb_net_type" in
21578                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21579                                 if ./protochk "$try" $hdrs; then
21580                                         echo "Your system accepts $xxx."
21581                                         netdb_net_type="$xxx"
21582                                 fi
21583                                 ;;
21584                         esac
21585                 done
21586                 : In case none of those worked, prompt the user.
21587                 case "$netdb_net_type" in
21588                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21589                         dflt='long'
21590                         . ./myread
21591                         netdb_net_type=$ans
21592                         ;;
21593                 esac
21594                 ;;
21595         *)      : no getnetbyaddr, so pick harmless default
21596                 netdb_net_type='long'
21597                 ;;
21598         esac
21599 fi
21600 : locate the preferred pager for this system
21601 fn=f/
21602 case "$pager" in
21603 '')
21604         dflt=''
21605         case "$pg" in
21606         /*) dflt=$pg;;
21607         [a-zA-Z]:/*) dflt=$pg;;
21608         esac
21609         case "$more" in
21610         /*) dflt=$more;;
21611         [a-zA-Z]:/*) dflt=$more;;
21612         esac
21613         case "$less" in
21614         /*) dflt=$less;;
21615         [a-zA-Z]:/*) dflt=$less;;
21616         esac
21617         case "$dflt" in
21618         '') dflt=/usr/ucb/more;;
21619         esac
21620         ;;
21621 *)      dflt="$pager"
21622         ;;
21623 esac
21624 fn="f/($dflt)"
21625 echo " "
21626 rp='What pager is used on your system?'
21627 . ./getfile
21628 pager="$ans"
21629
21630 : see what type pids are declared as in the kernel
21631 rp="What is the type of process ids on this system?"
21632 set pid_t pidtype int stdio.h sys/types.h
21633 eval $typedef_ask
21634
21635 : see if ar generates random libraries by itself
21636 echo " "
21637 echo "Checking how to generate random libraries on your machine..." >&4
21638 echo 'int bar1() { return bar2(); }' > bar1.c
21639 echo 'int bar2() { return 2; }' > bar2.c
21640 $cat > foo.c <<EOP
21641 #$i_stdlib I_STDLIB
21642 #ifdef I_STDLIB
21643 #include <stdlib.h>
21644 #endif
21645 int main() { printf("%d\n", bar1()); exit(0); }
21646 EOP
21647 $cc $ccflags -c bar1.c >/dev/null 2>&1
21648 $cc $ccflags -c bar2.c >/dev/null 2>&1
21649 $cc $ccflags -c foo.c >/dev/null 2>&1
21650 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21651 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21652         $run ./foobar >/dev/null 2>&1; then
21653         echo "$ar appears to generate random libraries itself."
21654         orderlib=false
21655         if [ "X$ranlib" = "X" ]; then
21656             ranlib=":"
21657         fi
21658 elif $ar s bar$_a >/dev/null 2>&1 &&
21659         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21660         $run ./foobar >/dev/null 2>&1; then
21661                 echo "a table of contents needs to be added with '$ar s'."
21662                 orderlib=false
21663                 ranlib="$ar s"
21664 elif $ar ts bar$_a >/dev/null 2>&1 &&
21665         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21666         $run ./foobar >/dev/null 2>&1; then
21667                 echo "a table of contents needs to be added with '$ar ts'."
21668                 orderlib=false
21669                 ranlib="$ar ts"
21670 else
21671         case "$ranlib" in
21672         :) ranlib='';;
21673         '')
21674                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21675                 $test -f $ranlib || ranlib=''
21676                 ;;
21677         esac
21678         if $test -n "$ranlib"; then
21679                 echo "your system has '$ranlib'; we'll use that."
21680                 orderlib=false
21681         else
21682                 echo "your system doesn't seem to support random libraries"
21683                 echo "so we'll use lorder and tsort to order the libraries."
21684                 orderlib=true
21685                 ranlib=":"
21686         fi
21687 fi
21688 $rm -f foo* bar*
21689
21690 : see if this is a values.h system
21691 set values.h i_values
21692 eval $inhdr
21693
21694 : Check the max offset that gmtime and localtime accept
21695 echo "Checking max offsets that gmtime () accepts"
21696
21697 case $i_values in
21698     define) yyy="#include <values.h>" ;;
21699     *)      yyy="" ;;
21700     esac
21701
21702 case "$sGMTIME_min/$sGMTIME_max" in
21703     0/0|/)
21704         $cat >try.c <<EOCP
21705 #include <sys/types.h>
21706 #include <stdio.h>
21707 #include <time.h>
21708 $yyy
21709
21710 int i;
21711 struct tm *tmp;
21712 time_t pt;
21713
21714 void gm_check (time_t t, int min_year, int max_year)
21715 {
21716     tmp = gmtime (&t);
21717     if ( tmp == NULL ||
21718         /* Check tm_year overflow */
21719          tmp->tm_year < min_year || tmp->tm_year > max_year)
21720         tmp = NULL;
21721     else
21722         pt = t;
21723     } /* gm_check */
21724
21725 int check_max ()
21726 {
21727     tmp = NULL;
21728     pt  = 0;
21729 #ifdef MAXLONG
21730     gm_check (MAXLONG, 69, 0x7fffffff);
21731 #endif
21732     if (tmp == NULL || tmp->tm_year < 0) {
21733         for (i = 63; i >= 0; i--) {
21734             time_t x = pt | ((time_t)1 << i);
21735             if (x < 0 || x < pt) continue;
21736             gm_check (x, 69, 0x7fffffff);
21737             }
21738         }
21739     printf ("sGMTIME_max=%ld\n", pt);
21740     return (0);
21741     } /* check_max */
21742
21743 int check_min ()
21744 {
21745     tmp = NULL;
21746     pt  = 0;
21747 #ifdef MINLONG
21748     gm_check (MINLONG, -1900, 70);
21749 #endif
21750     if (tmp == NULL) {
21751         for (i = 36; i >= 0; i--) {
21752             time_t x = pt - ((time_t)1 << i);
21753             if (x > 0) continue;
21754             gm_check (x, -1900, 70);
21755             }
21756         }
21757     printf ("sGMTIME_min=%ld\n", pt);
21758     return (0);
21759     } /* check_min */
21760
21761 int main (int argc, char *argv[])
21762 {
21763     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21764     check_max ();
21765     check_min ();
21766     return (0);
21767     } /* main */
21768 EOCP
21769         set try
21770         if eval $compile; then
21771             eval `$run ./try 2>/dev/null`
21772         else
21773             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21774             fi
21775         $rm_try
21776         ;;
21777     esac
21778
21779 echo "Checking max offsets that localtime () accepts"
21780
21781 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21782     0/0|/)
21783         $cat >try.c <<EOCP
21784 #include <sys/types.h>
21785 #include <stdio.h>
21786 #include <time.h>
21787 $yyy
21788
21789 int i;
21790 struct tm *tmp;
21791 time_t pt;
21792
21793 void local_check (time_t t, int min_year, int max_year)
21794 {
21795     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21796         tmp = NULL;
21797     else
21798         tmp = localtime (&t);
21799     if ( tmp == NULL ||
21800         /* Check tm_year overflow */
21801          tmp->tm_year < min_year || tmp->tm_year > max_year)
21802         tmp = NULL;
21803     else
21804         pt = t;
21805     } /* local_check */
21806
21807 int check_max ()
21808 {
21809     tmp = NULL;
21810     pt  = 0;
21811 #ifdef MAXLONG
21812     local_check (MAXLONG, 69, 0x7fffffff);
21813 #endif
21814     if (tmp == NULL || tmp->tm_year < 0) {
21815         for (i = 63; i >= 0; i--) {
21816             time_t x = pt | ((time_t)1 << i);
21817             if (x < 0 || x < pt) continue;
21818             local_check (x, 69, 0x7fffffff);
21819             }
21820         }
21821     printf ("sLOCALTIME_max=%ld\n", pt);
21822     return (0);
21823    } /* check_max */
21824
21825 int check_min ()
21826 {
21827     tmp = NULL;
21828     pt  = 0;
21829 #ifdef MINLONG
21830     local_check (MINLONG, -1900, 70);
21831 #endif
21832     if (tmp == NULL) {
21833         for (i = 36; i >= 0; i--) {
21834             time_t x = pt - ((time_t)1 << i);
21835             if (x > 0) continue;
21836             local_check (x, -1900, 70);
21837             }
21838         }
21839     printf ("sLOCALTIME_min=%ld\n", pt);
21840     return (0);
21841     } /* check_min */
21842
21843 int main (int argc, char *argv[])
21844 {
21845     check_max ();
21846     check_min ();
21847     return (0);
21848     } /* main */
21849 EOCP
21850         set try
21851         if eval $compile; then
21852             eval `$run ./try 2>/dev/null`
21853         else
21854             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21855             fi
21856         $rm_try
21857         ;;
21858     esac
21859
21860 : check for type of arguments to select.
21861 case "$selecttype" in
21862 '') case "$d_select" in
21863         $define)
21864                 echo " "
21865                 $cat <<EOM
21866 Checking to see what type of arguments are accepted by select().
21867 EOM
21868                 hdrs="$define sys/types.h
21869                         $i_systime sys/time.h
21870                         $i_sysselct sys/select.h
21871                         $d_socket sys/socket.h"
21872                 : The first arg can be int, unsigned, or size_t
21873                 : The last arg may or may not be 'const'
21874                 val=''
21875                 : void pointer has been seen but using that
21876                 : breaks the selectminbits test
21877                 for xxx in 'fd_set *' 'int *'; do
21878                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21879                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21880                                         case "$val" in
21881                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21882                                                 if ./protochk "$try" $hdrs; then
21883                                                         echo "Your system accepts $xxx."
21884                                                         val="$xxx"
21885                                                 fi
21886                                                 ;;
21887                                         esac
21888                                 done
21889                         done
21890                 done
21891                 case "$val" in
21892                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21893                         case "$d_fd_set" in
21894                                 $define) dflt="fd_set *" ;;
21895                                 *)              dflt="int *" ;;
21896                         esac
21897                         . ./myread
21898                         val=$ans
21899                         ;;
21900                 esac
21901                 selecttype="$val"
21902                 ;;
21903         *)      : no select, so pick a harmless default
21904                 selecttype='int *'
21905                 ;;
21906         esac
21907         ;;
21908 esac
21909
21910 : check for the select 'width'
21911 case "$selectminbits" in
21912 '') safebits=`expr $ptrsize \* 8`
21913     case "$d_select" in
21914         $define)
21915                 $cat <<EOM
21916
21917 Checking to see on how many bits at a time your select() operates...
21918 EOM
21919                 $cat >try.c <<EOCP
21920 #include <sys/types.h>
21921 #$i_time I_TIME
21922 #$i_systime I_SYS_TIME
21923 #$i_systimek I_SYS_TIME_KERNEL
21924 #ifdef I_TIME
21925 #   include <time.h>
21926 #endif
21927 #ifdef I_SYS_TIME
21928 #   ifdef I_SYS_TIME_KERNEL
21929 #       define KERNEL
21930 #   endif
21931 #   include <sys/time.h>
21932 #   ifdef I_SYS_TIME_KERNEL
21933 #       undef KERNEL
21934 #   endif
21935 #endif
21936 #$i_sysselct I_SYS_SELECT
21937 #ifdef I_SYS_SELECT
21938 #include <sys/select.h>
21939 #endif
21940 #$d_socket HAS_SOCKET
21941 #ifdef HAS_SOCKET
21942 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21943 #endif
21944 #include <stdio.h>
21945 #$i_stdlib I_STDLIB
21946 #ifdef I_STDLIB
21947 #include <stdlib.h>
21948 #endif
21949 $selecttype b;
21950 #define S sizeof(*(b))
21951 #define MINBITS 64
21952 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21953 #define NBITS  (NBYTES * 8)
21954 int main() {
21955     char *s = (char *)malloc(NBYTES);
21956     struct timeval t;
21957     int i;
21958     FILE* fp;
21959     int fd;
21960
21961     if (!s)
21962         exit(1);
21963     fclose(stdin);
21964     fp = fopen("try.c", "r");
21965     if (fp == 0)
21966       exit(2);
21967     fd = fileno(fp);
21968     if (fd < 0)
21969       exit(3);
21970     b = ($selecttype)s;
21971     for (i = 0; i < NBITS; i++)
21972         FD_SET(i, b);
21973     t.tv_sec  = 0;
21974     t.tv_usec = 0;
21975     select(fd + 1, b, 0, 0, &t);
21976     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21977     free(s);
21978     printf("%d\n", i + 1);
21979     return 0;
21980 }
21981 EOCP
21982                 set try
21983                 if eval $compile_ok; then
21984                         selectminbits=`$run ./try 2>/dev/null`
21985                         case "$selectminbits" in
21986                         '')     cat >&4 <<EOM
21987 Cannot figure out on how many bits at a time your select() operates.
21988 I'll play safe and guess it is $safebits bits.
21989 EOM
21990                                 selectminbits=$safebits
21991                                 bits="$safebits bits"
21992                                 ;;
21993                         1)      bits="1 bit" ;;
21994                         *)      bits="$selectminbits bits" ;;
21995                         esac
21996                         echo "Your select() operates on $bits at a time." >&4
21997                 else
21998                         rp='What is the minimum number of bits your select() operates on?'
21999                         case "$byteorder" in
22000                         12345678)       dflt=64 ;;
22001                         1234)           dflt=32 ;;
22002                         *)              dflt=1  ;;
22003                         esac
22004                         . ./myread
22005                         val=$ans
22006                         selectminbits="$val"
22007                 fi
22008                 $rm_try
22009                 ;;
22010         *)      : no select, so pick a harmless default
22011                 selectminbits=$safebits
22012                 ;;
22013         esac
22014         ;;
22015 esac
22016
22017 : Trace out the files included by signal.h, then look for SIGxxx names.
22018 case "$sig_num_init" in
22019 '')
22020 if [ "X$fieldn" = X ]; then
22021         : Just make some guesses.  We check them later.
22022         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22023 else
22024         xxx=`echo '#include <signal.h>' |
22025         $cppstdin $cppminus $cppflags 2>/dev/null |
22026         $grep '^[       ]*#.*include' |
22027         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22028                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22029 fi
22030 xxxfiles=''
22031 for xx in $xxx /dev/null ; do
22032         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22033 done
22034 case "$xxxfiles" in
22035 '')     xxxfiles=`./findhdr signal.h` ;;
22036 esac
22037 xxx=`awk '
22038 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22039         print substr($2, 4, 20)
22040 }
22041 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22042         print substr($3, 4, 20)
22043 }' $xxxfiles`
22044 : Append some common names just in case the awk scan failed.
22045 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22046 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22047 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22048 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22049 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22050
22051 : generate a few handy files for later
22052 $cat > signal.c <<EOCP
22053 #include <sys/types.h>
22054 #include <signal.h>
22055 #$i_stdlib I_STDLIB
22056 #ifdef I_STDLIB
22057 #include <stdlib.h>
22058 #endif
22059 #include <stdio.h>
22060 int main() {
22061
22062 /* Strange style to avoid deeply-nested #if/#else/#endif */
22063 #ifndef NSIG
22064 #  ifdef _NSIG
22065 #    define NSIG (_NSIG)
22066 #  endif
22067 #endif
22068
22069 #ifndef NSIG
22070 #  ifdef SIGMAX
22071 #    define NSIG (SIGMAX+1)
22072 #  endif
22073 #endif
22074
22075 #ifndef NSIG
22076 #  ifdef SIG_MAX
22077 #    define NSIG (SIG_MAX+1)
22078 #  endif
22079 #endif
22080
22081 #ifndef NSIG
22082 #  ifdef _SIG_MAX
22083 #    define NSIG (_SIG_MAX+1)
22084 #  endif
22085 #endif
22086
22087 #ifndef NSIG
22088 #  ifdef MAXSIG
22089 #    define NSIG (MAXSIG+1)
22090 #  endif
22091 #endif
22092
22093 #ifndef NSIG
22094 #  ifdef MAX_SIG
22095 #    define NSIG (MAX_SIG+1)
22096 #  endif
22097 #endif
22098
22099 #ifndef NSIG
22100 #  ifdef SIGARRAYSIZE
22101 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22102 #  endif
22103 #endif
22104
22105 #ifndef NSIG
22106 #  ifdef _sys_nsig
22107 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22108 #  endif
22109 #endif
22110
22111 /* Default to some arbitrary number that's big enough to get most
22112    of the common signals.
22113 */
22114 #ifndef NSIG
22115 #    define NSIG 50
22116 #endif
22117
22118 printf("NSIG %d\n", NSIG);
22119
22120 #ifndef JUST_NSIG
22121
22122 EOCP
22123
22124 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22125 {
22126         printf "#ifdef SIG"; printf $1; printf "\n"
22127         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22128         printf $1; printf ");\n"
22129         printf "#endif\n"
22130 }
22131 END {
22132         printf "#endif /* JUST_NSIG */\n";
22133         printf "exit(0);\n}\n";
22134 }
22135 ' >>signal.c
22136 $cat >signal.awk <<'EOP'
22137 BEGIN { ndups = 0 }
22138 $1 ~ /^NSIG$/ { nsig = $2 }
22139 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22140     if ($2 > maxsig) { maxsig = $2 }
22141     if (sig_name[$2]) {
22142         dup_name[ndups] = $1
22143         dup_num[ndups] = $2
22144         ndups++
22145     }
22146     else {
22147         sig_name[$2] = $1
22148         sig_num[$2] = $2
22149     }
22150 }
22151 END {
22152     if (nsig == 0) {
22153         nsig = maxsig + 1
22154     }
22155     printf("NSIG %d\n", nsig);
22156     for (n = 1; n < nsig; n++) {
22157         if (sig_name[n]) {
22158             printf("%s %d\n", sig_name[n], sig_num[n])
22159         }
22160         else {
22161             printf("NUM%d %d\n", n, n)
22162         }
22163     }
22164     for (n = 0; n < ndups; n++) {
22165         printf("%s %d\n", dup_name[n], dup_num[n])
22166     }
22167 }
22168 EOP
22169 $cat >signal_cmd <<EOS
22170 $startsh
22171 if $test -s signal.lst; then
22172     echo "Using your existing signal.lst file"
22173         exit 0
22174 fi
22175 xxx="$xxx"
22176 EOS
22177 $cat >>signal_cmd <<'EOS'
22178
22179 set signal
22180 if eval $compile_ok; then
22181         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22182                 $uniq | $awk -f signal.awk >signal.lst
22183 else
22184         echo "(I can't seem be able to compile the whole test program)" >&4
22185         echo "(I'll try it in little pieces.)" >&4
22186         set signal -DJUST_NSIG
22187         if eval $compile_ok; then
22188                 $run ./signal$_exe > signal.nsg
22189                 $cat signal.nsg
22190         else
22191                 echo "I can't seem to figure out how many signals you have." >&4
22192                 echo "Guessing 50." >&4
22193                 echo 'NSIG 50' > signal.nsg
22194         fi
22195         : Now look at all the signal names, one at a time.
22196         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22197                 $cat > signal.c <<EOCP
22198 #include <sys/types.h>
22199 #include <signal.h>
22200 #include <stdio.h>
22201 int main() {
22202 printf("$xx %d\n", SIG${xx});
22203 return 0;
22204 }
22205 EOCP
22206                 set signal
22207                 if eval $compile; then
22208                         echo "SIG${xx} found."
22209                         $run ./signal$_exe  >> signal.ls1
22210                 else
22211                         echo "SIG${xx} NOT found."
22212                 fi
22213         done
22214         if $test -s signal.ls1; then
22215                 $cat signal.nsg signal.ls1 |
22216                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22217         fi
22218
22219 fi
22220 if $test -s signal.lst; then
22221         :
22222 else
22223         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22224         echo 'kill -l' >signal
22225         set X `csh -f <signal`
22226         $rm -f signal
22227         shift
22228         case $# in
22229         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22230         esac
22231         echo $@ | $tr ' ' $trnl | \
22232             $awk '{ printf "%s %d\n", $1, ++s; }
22233                   END { printf "NSIG %d\n", ++s }' >signal.lst
22234 fi
22235 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22236 EOS
22237 chmod a+x signal_cmd
22238 $eunicefix signal_cmd
22239
22240 : generate list of signal names
22241 echo " "
22242 case "$sig_name_init" in
22243 '') doinit=yes ;;
22244 *)  case "$sig_num_init" in
22245     ''|*,*) doinit=yes ;;
22246     esac ;;
22247 esac
22248 case "$doinit" in
22249 yes)
22250         echo "Generating a list of signal names and numbers..." >&4
22251         . ./signal_cmd
22252         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22253         sig_name=`$awk 'BEGIN { printf "ZERO " }
22254                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22255         sig_num=`$awk  'BEGIN { printf "0 " }
22256                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22257         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22258                              !/^NSIG/   { printf "\"%s\", ", $1 }
22259                              END        { printf "0\n" }' signal.lst`
22260         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22261                              !/^NSIG/   { printf "%d, ", $2}
22262                              END        { printf "0\n"}' signal.lst`
22263         ;;
22264 esac
22265 echo "The following $sig_count signals are available:"
22266 echo " "
22267 echo $sig_name | $awk \
22268 'BEGIN { linelen = 0 }
22269 {
22270         for (i = 1; i <= NF; i++) {
22271                 name = "SIG" $i " "
22272                 linelen = linelen + length(name)
22273                 if (linelen > 70) {
22274                         printf "\n"
22275                         linelen = length(name)
22276                 }
22277                 printf "%s", name
22278         }
22279         printf "\n"
22280 }'
22281 sig_size=`echo $sig_name | awk '{print NF}'`
22282 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22283 ;;
22284 esac
22285
22286 : Check size of size
22287 echo " "
22288 case "$sizetype" in
22289 *_t) zzz="$sizetype"    ;;
22290 *)   zzz="filesize"     ;;
22291 esac
22292 echo "Checking the size of $zzz..." >&4
22293 cat > try.c <<EOCP
22294 #include <sys/types.h>
22295 #include <stdio.h>
22296 #$i_stdlib I_STDLIB
22297 #ifdef I_STDLIB
22298 #include <stdlib.h>
22299 #endif
22300 int main() {
22301     printf("%d\n", (int)sizeof($sizetype));
22302     exit(0);
22303 }
22304 EOCP
22305 set try
22306 if eval $compile_ok; then
22307         yyy=`$run ./try`
22308         case "$yyy" in
22309         '')     sizesize=4
22310                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22311                 ;;
22312         *)      sizesize=$yyy
22313                 echo "Your $zzz size is $sizesize bytes."
22314                 ;;
22315         esac
22316 else
22317         sizesize=4
22318         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22319 fi
22320
22321
22322 : check for socklen_t
22323 echo " "
22324 echo "Checking to see if you have socklen_t..." >&4
22325 $cat >try.c <<EOCP
22326 #include <sys/types.h>
22327 #$d_socket HAS_SOCKET
22328 #ifdef HAS_SOCKET
22329 #include <sys/socket.h>
22330 #endif
22331 int main() { socklen_t x = 16; }
22332 EOCP
22333 set try
22334 if eval $compile; then
22335         val="$define"
22336         echo "You have socklen_t."
22337 else
22338         val="$undef"
22339         echo "You do not have socklen_t."
22340         case "$sizetype" in
22341         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22342         esac
22343 fi
22344 $rm_try
22345 set d_socklen_t
22346 eval $setvar
22347
22348 : see if this is a socks.h system
22349 set socks.h i_socks
22350 eval $inhdr
22351
22352 : check for type of the size argument to socket calls
22353 case "$d_socket" in
22354 "$define")
22355         $cat <<EOM
22356
22357 Checking to see what type is the last argument of accept().
22358 EOM
22359         yyy=''
22360         case "$d_socklen_t" in
22361         "$define") yyy="$yyy socklen_t"
22362         esac
22363         yyy="$yyy $sizetype int long unsigned"
22364         for xxx in $yyy; do
22365                 case "$socksizetype" in
22366                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22367                         case "$usesocks" in
22368                         "$define")
22369                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22370                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22371                                         socksizetype="$xxx"
22372                                 fi
22373                                 ;;
22374                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22375                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22376                                         socksizetype="$xxx"
22377                                 fi
22378                                 ;;
22379                         esac
22380                         ;;
22381                 esac
22382         done
22383 : In case none of those worked, prompt the user.
22384         case "$socksizetype" in
22385         '')     rp='What is the type for socket address structure sizes?'
22386                 dflt='int'
22387                 . ./myread
22388                 socksizetype=$ans
22389                 ;;
22390         esac
22391         ;;
22392 *)      : no sockets, so pick relatively harmless default
22393         socksizetype='int'
22394         ;;
22395 esac
22396
22397 : see what type is used for signed size_t
22398 set ssize_t ssizetype int stdio.h sys/types.h
22399 eval $typedef
22400 dflt="$ssizetype"
22401 $cat > try.c <<EOM
22402 #include <stdio.h>
22403 #$i_stdlib I_STDLIB
22404 #ifdef I_STDLIB
22405 #include <stdlib.h>
22406 #endif
22407 #include <sys/types.h>
22408 #define Size_t $sizetype
22409 #define SSize_t $dflt
22410 int main()
22411 {
22412         if (sizeof(Size_t) == sizeof(SSize_t))
22413                 printf("$dflt\n");
22414         else if (sizeof(Size_t) == sizeof(int))
22415                 printf("int\n");
22416         else
22417                 printf("long\n");
22418         exit(0);
22419 }
22420 EOM
22421 echo " "
22422 set try
22423 if eval $compile_ok && $run ./try > /dev/null; then
22424         ssizetype=`$run ./try`
22425         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22426 else
22427         $cat >&4 <<EOM
22428 Help! I can't compile and run the ssize_t test program: please enlighten me!
22429 (This is probably a misconfiguration in your system or libraries, and
22430 you really ought to fix it.  Still, I'll try anyway.)
22431
22432 I need a type that is the same size as $sizetype, but is guaranteed to
22433 be signed.  Common values are ssize_t, int and long.
22434
22435 EOM
22436         rp="What signed type is the same size as $sizetype?"
22437         . ./myread
22438         ssizetype="$ans"
22439 fi
22440 $rm_try
22441
22442 : Check the size of st_ino
22443 $echo " "
22444 $echo "Checking the size of st_ino..." >&4
22445 $cat > try.c <<EOCP
22446 #include <sys/stat.h>
22447 #include <stdio.h>
22448 #$i_stdlib I_STDLIB
22449 #ifdef I_STDLIB
22450 #include <stdlib.h>
22451 #endif
22452 int main() {
22453     struct stat st;
22454     printf("%d\n", (int)sizeof(st.st_ino));
22455     exit(0);
22456 }
22457 EOCP
22458 set try
22459 if eval $compile_ok; then
22460         val=`$run ./try`
22461         case "$val" in
22462         '')     st_ino_size=4
22463                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22464                 ;;
22465         *)      st_ino_size=$val
22466                 $echo "Your st_ino is $st_ino_size bytes long."
22467                 ;;
22468         esac
22469 else
22470         st_ino_size=4
22471         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22472 fi
22473 $rm_try
22474
22475 : Check if st_ino is signed
22476 $echo " "
22477 $echo "Checking the sign of st_ino..." >&4
22478 $cat > try.c <<EOCP
22479 #include <sys/stat.h>
22480 #include <stdio.h>
22481 int main() {
22482         struct stat foo;
22483         foo.st_ino = -1;
22484         if (foo.st_ino < 0)
22485                 printf("-1\n");
22486         else
22487                 printf("1\n");
22488 }
22489 EOCP
22490 set try
22491 if eval $compile; then
22492         val=`$run ./try`
22493         case "$val" in
22494         '')     st_ino_sign=1
22495                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22496                 ;;
22497         *)      st_ino_sign=$val
22498                 case "$st_ino_sign" in
22499                  1) $echo "Your st_ino is unsigned." ;;
22500                 -1) $echo "Your st_ino is signed."   ;;
22501                 esac
22502                 ;;
22503         esac
22504 else
22505         st_ino_sign=1
22506         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22507 fi
22508 $rm_try
22509
22510 : see what type of char stdio uses.
22511 echo " "
22512 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22513 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22514         echo "Your stdio uses unsigned chars." >&4
22515         stdchar="unsigned char"
22516 else
22517         echo "Your stdio uses signed chars." >&4
22518         stdchar="char"
22519 fi
22520 $rm -f stdioh
22521
22522 : see what type uids are declared as in the kernel
22523 echo " "
22524 echo "Looking for the type for user ids returned by getuid()."
22525 set uid_t uidtype xxx stdio.h sys/types.h
22526 eval $typedef
22527 case "$uidtype" in
22528 xxx)
22529         xxx=`./findhdr sys/user.h`
22530         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22531         case $1 in
22532         unsigned) dflt="$1 $2" ;;
22533         *) dflt="$1" ;;
22534         esac
22535         ;;
22536 *) dflt="$uidtype";;
22537 esac
22538 case "$uidtype" in
22539 uid_t)  echo "uid_t found." ;;
22540 *)      rp="What is the type for user ids returned by getuid()?"
22541         . ./myread
22542         uidtype="$ans"
22543         ;;
22544 esac
22545
22546 : Check size of UID
22547 echo " "
22548 case "$uidtype" in
22549 *_t) zzz="$uidtype"     ;;
22550 *)   zzz="uid"          ;;
22551 esac
22552 echo "Checking the size of $zzz..." >&4
22553 cat > try.c <<EOCP
22554 #include <sys/types.h>
22555 #include <stdio.h>
22556 #$i_stdlib I_STDLIB
22557 #ifdef I_STDLIB
22558 #include <stdlib.h>
22559 #endif
22560 int main() {
22561     printf("%d\n", (int)sizeof($uidtype));
22562     exit(0);
22563 }
22564 EOCP
22565 set try
22566 if eval $compile_ok; then
22567         yyy=`$run ./try`
22568         case "$yyy" in
22569         '')     uidsize=4
22570                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22571                 ;;
22572         *)      uidsize=$yyy
22573                 echo "Your $zzz is $uidsize bytes long."
22574                 ;;
22575         esac
22576 else
22577         uidsize=4
22578         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22579 fi
22580
22581 : Check if UID is signed
22582 echo " "
22583 case "$uidtype" in
22584 *_t) zzz="$uidtype"     ;;
22585 *)   zzz="uid"          ;;
22586 esac
22587 echo "Checking the sign of $zzz..." >&4
22588 cat > try.c <<EOCP
22589 #include <sys/types.h>
22590 #include <stdio.h>
22591 int main() {
22592         $uidtype foo = -1;
22593         if (foo < 0)
22594                 printf("-1\n");
22595         else
22596                 printf("1\n");
22597 }
22598 EOCP
22599 set try
22600 if eval $compile; then
22601         yyy=`$run ./try`
22602         case "$yyy" in
22603         '')     uidsign=1
22604                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22605                 ;;
22606         *)      uidsign=$yyy
22607                 case "$uidsign" in
22608                  1) echo "Your $zzz is unsigned." ;;
22609                 -1) echo "Your $zzz is signed."   ;;
22610                 esac
22611                 ;;
22612         esac
22613 else
22614         uidsign=1
22615         echo "(I can't compile the test program--guessing unsigned.)" >&4
22616 fi
22617
22618
22619 : Check format string for UID
22620 echo " "
22621 $echo "Checking the format string to be used for uids..." >&4
22622
22623 case "$uidsign" in
22624 -1)     if $test X"$uidsize" = X"$ivsize"; then
22625                 uidformat="$ivdformat"
22626         else
22627                 if $test X"$uidsize" = X"$longsize"; then
22628                         uidformat='"ld"'
22629                 else
22630                         if $test X"$uidsize" = X"$intsize"; then
22631                                 uidformat='"d"'
22632                         else
22633                                 if $test X"$uidsize" = X"$shortsize"; then
22634                                         uidformat='"hd"'
22635                                 fi
22636                         fi
22637                 fi
22638         fi
22639         ;;
22640 *)      if $test X"$uidsize" = X"$uvsize"; then
22641                 uidformat="$uvuformat"
22642         else
22643                 if $test X"$uidsize" = X"$longsize"; then
22644                         uidformat='"lu"'
22645                 else
22646                         if $test X"$uidsize" = X"$intsize"; then
22647                                 uidformat='"u"'
22648                         else
22649                                 if $test X"$uidsize" = X"$shortsize"; then
22650                                         uidformat='"hu"'
22651                                 fi
22652                         fi
22653                 fi
22654         fi
22655         ;;
22656 esac
22657
22658 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22659 echo " "
22660 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22661 $cat >try.c <<'EOM'
22662 /* Intentionally a long probe as I'd like to sanity check that the exact
22663    approach is going to work, as thinking it will work, but only having it
22664    part working at runtime is worse than not having it.  */
22665
22666 #include <sys/types.h>
22667 #include <sys/sysctl.h>
22668 #include <sys/param.h>
22669 #include <stdio.h>
22670 #include <string.h>
22671 #include <stdlib.h>
22672 #include <unistd.h>
22673
22674 int
22675 main(int argc, char **argv) {
22676     char *buffer;
22677     char *argv_leaf = strrchr(argv[0], '/');
22678     char *buffer_leaf;
22679     size_t size = 0;
22680     int mib[4];
22681
22682     mib[0] = CTL_KERN;
22683     mib[1] = KERN_PROC;
22684     mib[2] = KERN_PROC_PATHNAME;
22685     mib[3] = -1;
22686
22687     if (!argv_leaf) {
22688         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22689         return 1;
22690     }
22691
22692     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22693         perror("sysctl");
22694         return 2;
22695     }
22696
22697     if (size < strlen(argv_leaf) + 1) {
22698         fprintf(stderr, "size %lu is too short for a path\n",
22699                 (unsigned long) size);
22700         return 3;
22701     }
22702
22703     if (size > MAXPATHLEN * MAXPATHLEN) {
22704         fprintf(stderr, "size %lu is too long for a path\n",
22705                 (unsigned long) size);
22706         return 4;
22707     }
22708
22709     buffer = malloc(size);
22710     if (!buffer) {
22711         perror("malloc");
22712         return 5;
22713     }
22714
22715     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22716         perror("sysctl");
22717         return 6;
22718     }
22719
22720     if (strlen(buffer) + 1 != size) {
22721         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22722                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22723         return 7;
22724     }
22725
22726
22727     if (*buffer != '/') {
22728         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22729         return 8;
22730     }
22731
22732     if (strstr(buffer, "/./")) {
22733         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22734         return 9;
22735     }
22736
22737     if (strstr(buffer, "/../")) {
22738         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22739         return 10;
22740     }
22741
22742     buffer_leaf = strrchr(buffer, '/');
22743     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22744         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22745         return 11;
22746     }
22747
22748     free(buffer);
22749
22750     return 0;
22751 }
22752 EOM
22753
22754 val=$undef
22755 set try
22756 if eval $compile; then
22757         if $run ./try; then
22758                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22759                 val="$define"
22760         else
22761                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22762                 val="$undef"
22763         fi
22764 else
22765         echo "I'm unable to compile the test program." >&4
22766         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22767         val="$undef"
22768 fi
22769 $rm_try
22770 set usekernprocpathname
22771 eval $setvar
22772
22773 : Determine if we can use _NSGetExecutablePath to find executing program
22774 echo " "
22775 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22776 $cat >try.c <<'EOM'
22777 /* Intentionally a long probe as I'd like to sanity check that the exact
22778    approach is going to work, as thinking it will work, but only having it
22779    part working at runtime is worse than not having it.  */
22780 #include <mach-o/dyld.h>
22781 #include <stdio.h>
22782 #include <stdlib.h>
22783 #include <sys/param.h>
22784 #include <string.h>
22785
22786 int
22787 main(int argc, char **argv) {
22788     char buf[1];
22789     uint32_t size = sizeof(buf);
22790     int result;
22791     char *buffer;
22792     char *tidied;
22793     char *argv_leaf = strrchr(argv[0], '/');
22794     char *tidied_leaf;
22795
22796     if (!argv_leaf) {
22797         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22798         return 1;
22799     }
22800
22801     _NSGetExecutablePath(buf, &size);
22802     if (size > MAXPATHLEN * MAXPATHLEN) {
22803         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22804                 (unsigned int) size);
22805         return 2;
22806     }
22807
22808     buffer = malloc(size);
22809     if (!buffer) {
22810         perror("malloc");
22811         return 3;
22812     }
22813
22814     result = _NSGetExecutablePath(buffer, &size);
22815     if (result != 0) {
22816         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22817                 result, (unsigned int) size);
22818         return 4;
22819     }
22820
22821     tidied = realpath(buffer, NULL);
22822     if (!tidied) {
22823         perror("realpath");
22824         return 5;
22825     }
22826
22827     free(buffer);
22828
22829     if (*tidied != '/') {
22830         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22831         return 6;
22832     }
22833
22834     if (strstr(tidied, "/./")) {
22835         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22836         return 7;
22837     }
22838
22839     if (strstr(tidied, "/../")) {
22840         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22841         return 8;
22842     }
22843
22844     tidied_leaf = strrchr(tidied, '/');
22845     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22846         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22847         return 9;
22848     }
22849
22850     free(tidied);
22851
22852     return 0;
22853 }
22854 EOM
22855
22856 val=$undef
22857 set try
22858 if eval $compile; then
22859         if $run ./try; then
22860                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22861                 val="$define"
22862         else
22863                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22864         fi
22865 else
22866         echo "I'm unable to compile the test program." >&4
22867         echo "I'll assume no _NSGetExecutablePath here." >&4
22868 fi
22869 $rm_try
22870 set usensgetexecutablepath
22871 eval $setvar
22872
22873 : Check if site customization support was requested
22874 case "$usesitecustomize" in
22875     $define|true|[Yy]*)
22876         usesitecustomize="$define"
22877         ;;
22878     *)
22879         usesitecustomize="$undef"
22880         ;;
22881     esac
22882
22883 : see if prototypes support variable argument declarations
22884 echo " "
22885 case "$prototype$i_stdarg" in
22886 $define$define)
22887         echo "It appears we'll be able to prototype varargs functions." >&4
22888         val="$define"
22889         ;;
22890 *)
22891         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22892         val="$undef"
22893         ;;
22894 esac
22895 set vaproto
22896 eval $setvar
22897
22898 : determine compiler compiler
22899 case "$yacc" in
22900 '')
22901         dflt=yacc;;
22902 *)
22903         dflt="$yacc";;
22904 esac
22905 echo " "
22906 comp='yacc'
22907 if $test -f "$byacc$_exe"; then
22908         dflt="$byacc"
22909         comp="byacc or $comp"
22910 fi
22911 if $test -f "$bison$_exe"; then
22912         comp="$comp or bison -y"
22913 fi
22914 rp="Which compiler compiler ($comp) shall I use?"
22915 . ./myread
22916 yacc="$ans"
22917 case "$yacc" in
22918 *bis*)
22919         case "$yacc" in
22920         *-y*) ;;
22921         *)
22922                 yacc="$yacc -y"
22923                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22924                 ;;
22925         esac
22926         ;;
22927 esac
22928
22929 : see if this is a assert.h system
22930 set assert.h i_assert
22931 eval $inhdr
22932
22933 : see if this is a bfd.h system
22934 set bfd.h i_bfd
22935 eval $inhdr
22936
22937 : see if this is an execinfo.h system
22938 set execinfo.h i_execinfo
22939 eval $inhdr
22940
22941 : see if this is a fenv.h system
22942 set fenv.h i_fenv
22943 eval $inhdr
22944
22945 : see if this is a fp.h system
22946 set fp.h i_fp
22947 eval $inhdr
22948
22949 : see if this is a fp_class.h system
22950 set fp_class.h i_fp_class
22951 eval $inhdr
22952
22953 : see if gdbm.h is available
22954 set gdbm.h t_gdbm
22955 eval $inhdr
22956 case "$t_gdbm" in
22957 $define)
22958         : see if gdbm_open exists
22959         set gdbm_open d_gdbm_open
22960         eval $inlibc
22961         case "$d_gdbm_open" in
22962         $undef)
22963                 t_gdbm="$undef"
22964                 echo "We won't be including <gdbm.h>"
22965                 ;;
22966         esac
22967         ;;
22968 esac
22969 val="$t_gdbm"
22970 set i_gdbm
22971 eval $setvar
22972
22973 : see if this is a ieeefp.h system
22974 case "$i_ieeefp" in
22975 '' ) set ieeefp.h i_ieeefp
22976      eval $inhdr
22977      ;;
22978 esac
22979
22980 : see if this is a libutil.h system
22981 set libutil.h i_libutil
22982 eval $inhdr
22983
22984 : see if mach cthreads are available
22985 if test "X$usethreads" = "X$define"; then
22986         set mach/cthreads.h i_machcthr
22987         eval $inhdr
22988 else
22989         i_machcthr="$undef"
22990 fi
22991
22992 : see if this is a mntent.h system
22993 set mntent.h i_mntent
22994 eval $inhdr
22995
22996 : see if net/errno.h is available
22997 val=''
22998 set net/errno.h val
22999 eval $inhdr
23000
23001 : Unfortunately, it causes problems on some systems.  Arrgh.
23002 case "$val" in
23003 $define)
23004         cat > try.c <<'EOM'
23005 #include <stdio.h>
23006 #include <errno.h>
23007 #include <net/errno.h>
23008 int func()
23009 {
23010         return ENOTSOCK;
23011 }
23012 EOM
23013         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23014                 echo "We'll be including <net/errno.h>." >&4
23015         else
23016                 echo "We won't be including <net/errno.h>." >&4
23017                 val="$undef"
23018         fi
23019         $rm_try
23020         ;;
23021 esac
23022 set i_neterrno
23023 eval $setvar
23024
23025 : see if netinet/tcp.h is available
23026 set netinet/tcp.h i_netinettcp
23027 eval $inhdr
23028
23029 : see if this is a poll.h system
23030 set poll.h i_poll
23031 eval $inhdr
23032
23033 : see if this is a prot.h system
23034 set prot.h i_prot
23035 eval $inhdr
23036
23037 : Preprocessor symbols
23038 echo " "
23039 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23040 $cat <<'EOSH' > Cppsym.know
23041 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23042 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23043 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23044 arch_pwr ardent ARM ARM32 atarist att386 att3b
23045 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23046 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23047 byteorder byte_order
23048 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23049 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23050 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23051 ELF encore EPI EXTENSIONS
23052 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23053 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23054 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23055 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23056 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23057 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23058 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23059 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23060 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23061 ksr1
23062 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23063 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23064 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23065 luna88k Lynx
23066 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23067 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23068 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23069 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23070 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23071 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23072 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23073 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23074 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23075 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23076 ns32000 ns32016 ns32332 ns32k nsc32000
23077 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23078 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23079 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23080 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23081 QK_USER QNX
23082 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23083 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23084 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23085 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23086 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23087 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23088 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23089 SYSV4 SYSV5 sysV68 sysV88
23090 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23091 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23092 tower32_800 tower32_850 tss
23093 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23094 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23095 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23096 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23097 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23098 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23099 uxpm uxps
23100 vax venix VMESA vms
23101 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23102 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23103 z8000 zarch
23104 EOSH
23105 # Maybe put other stuff here too.
23106 ./tr '-' '_' <<EOSH >>Cppsym.know
23107 $osname
23108 EOSH
23109 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23110 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23111 $cat Cppsym.know > Cppsym.c
23112 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23113 $rm -f Cppsym.a Cppsym.b Cppsym.c
23114 cat <<EOSH > Cppsym
23115 $startsh
23116 if $test \$# -gt 0; then
23117     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23118     if $test -s Cppsym.got; then
23119         $rm -f Cppsym.got
23120         exit 0
23121     fi
23122     $rm -f Cppsym.got
23123     exit 1
23124 else
23125     $tr " " "$trnl" | ./Cppsym.try
23126     exit 0
23127 fi
23128 EOSH
23129 chmod +x Cppsym
23130 $eunicefix Cppsym
23131 cat <<EOSH > Cppsym.try
23132 $startsh
23133 cat <<'EOCP' > try.c
23134 #include <stdio.h>
23135 #if cpp_stuff == 1
23136 #define STRINGIFY(a)    "a"
23137 #endif
23138 #if cpp_stuff == 42
23139 #define StGiFy(a)  #a
23140 #define STRINGIFY(a)    StGiFy(a)
23141 #endif
23142 #if $cpp_stuff != 1 && $cpp_stuff != 42
23143 #   include "Bletch: How does this C preprocessor stringify macros?"
23144 #endif
23145 int main() {
23146 EOCP
23147 $awk \\
23148 EOSH
23149 cat <<'EOSH' >> Cppsym.try
23150 'length($1) > 0 {
23151     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23152     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23153     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23154     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23155 }'       >> try.c
23156 echo 'return 0;}' >> try.c
23157 EOSH
23158 cat <<EOSH >> Cppsym.try
23159 ccflags="$ccflags"
23160 case "$osname-$gccversion" in
23161 irix-) ccflags="\$ccflags -woff 1178" ;;
23162 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23163 esac
23164 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
23165 EOSH
23166 chmod +x Cppsym.try
23167 $eunicefix Cppsym.try
23168 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23169 : Add in any Linux cpp "predefined macros":
23170 case "$osname::$gccversion" in
23171   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23172     tHdrH=_tmpHdr
23173     rm -f $tHdrH'.h' $tHdrH
23174     touch $tHdrH'.h'
23175     # Filter out macro arguments, such as Linux's __INT8_C(c)
23176     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23177        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23178        if [ -s $tHdrH'_cppsym.real' ]; then
23179           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23180        fi
23181     fi
23182     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23183   ;;
23184 esac
23185 : now check the C compiler for additional symbols
23186 postprocess_cc_v=''
23187 case "$osname" in
23188 aix) postprocess_cc_v="|$tr , ' '" ;;
23189 esac
23190 $cat >ccsym <<EOS
23191 $startsh
23192 $cat >tmp.c <<EOF
23193 extern int foo;
23194 EOF
23195 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23196 do
23197         case "\$i" in
23198         -D*) echo "\$i" | $sed 's/^-D//';;
23199         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23200         esac
23201 done
23202 $rm_try
23203 EOS
23204 postprocess_cc_v=''
23205 chmod +x ccsym
23206 $eunicefix ccsym
23207 ./ccsym > ccsym1.raw
23208 if $test -s ccsym1.raw; then
23209     $sort ccsym1.raw | $uniq >ccsym.raw
23210 else
23211     mv ccsym1.raw ccsym.raw
23212 fi
23213
23214 $awk '/\=/ { print $0; next }
23215         { print $0"=1" }' ccsym.raw >ccsym.list
23216 $comm -13 Cppsym.true ccsym.list >ccsym.own
23217 $comm -12 Cppsym.true ccsym.list >ccsym.com
23218 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23219 also=''
23220 if $test -z ccsym.raw; then
23221         echo "Your C compiler doesn't seem to define any symbols!" >&4
23222         echo " "
23223         echo "However, your C preprocessor defines the following symbols:"
23224         $cat Cppsym.true
23225         ccsymbols=''
23226         cppsymbols=`$cat Cppsym.true`
23227         cppsymbols=`echo $cppsymbols`
23228         cppccsymbols="$cppsymbols"
23229 else
23230         if $test -s ccsym.com; then
23231                 echo "Your C compiler and pre-processor define these symbols:"
23232                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23233                 also='also '
23234                 symbols='ones'
23235                 cppccsymbols=`$cat ccsym.com`
23236                 cppccsymbols=`echo $cppccsymbols`
23237                 $test "$silent" || sleep 1
23238         fi
23239         if $test -s ccsym.cpp; then
23240                 $test "$also" && echo " "
23241                 echo "Your C pre-processor ${also}defines the following symbols:"
23242                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23243                 also='further '
23244                 cppsymbols=`$cat ccsym.cpp`
23245                 cppsymbols=`echo $cppsymbols`
23246                 $test "$silent" || sleep 1
23247         fi
23248         if $test -s ccsym.own; then
23249                 $test "$also" && echo " "
23250                 echo "Your C compiler ${also}defines the following cpp symbols:"
23251                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23252                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23253                 ccsymbols=`$cat ccsym.own`
23254                 ccsymbols=`echo $ccsymbols`
23255                 $test "$silent" || sleep 1
23256         fi
23257 fi
23258
23259 : add -D_FORTIFY_SOURCE if feasible and not already there
23260 case "$gccversion" in
23261 [45].*) case "$optimize$ccflags" in
23262         *-O*)   case "$ccflags$cppsymbols" in
23263                 *_FORTIFY_SOURCE=*) # Don't add it again.
23264                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23265                         ;;
23266                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23267                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23268                         ;;
23269                 esac
23270                 ;;
23271         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23272                 ;;
23273         esac
23274         ;;
23275 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23276         ;;
23277 esac
23278
23279 : see if this is a termio system
23280 val="$undef"
23281 val2="$undef"
23282 val3="$undef"
23283 if $test `./findhdr termios.h`; then
23284     set tcsetattr i_termios
23285     eval $inlibc
23286     val3="$i_termios"
23287 fi
23288 echo " "
23289 case "$val3" in
23290     "$define") echo "You have POSIX termios.h... good!" >&4;;
23291     *)  if ./Cppsym pyr; then
23292             case "`$run /bin/universe`" in
23293                 ucb) if $test `./findhdr sgtty.h`; then
23294                         val2="$define"
23295                         echo "<sgtty.h> found." >&4
23296                     else
23297                         echo "System is pyramid with BSD universe."
23298                         ./warn "<sgtty.h> not found--you could have problems."
23299                     fi;;
23300                 *)  if $test `./findhdr termio.h`; then
23301                         val="$define"
23302                         echo "<termio.h> found." >&4
23303                     else
23304                         echo "System is pyramid with USG universe."
23305                         ./warn "<termio.h> not found--you could have problems."
23306                     fi;;
23307             esac
23308         elif ./usg; then
23309             if $test `./findhdr termio.h`; then
23310                 echo "<termio.h> found." >&4
23311                 val="$define"
23312             elif $test `./findhdr sgtty.h`; then
23313                 echo "<sgtty.h> found." >&4
23314                 val2="$define"
23315             else
23316                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23317             fi
23318         else
23319             if $test `./findhdr sgtty.h`; then
23320                 echo "<sgtty.h> found." >&4
23321                 val2="$define"
23322             elif $test `./findhdr termio.h`; then
23323                 echo "<termio.h> found." >&4
23324                 val="$define"
23325             else
23326                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23327             fi
23328         fi;;
23329 esac
23330 set i_termio; eval $setvar
23331 val=$val2; set i_sgtty; eval $setvar
23332 val=$val3; set i_termios; eval $setvar
23333
23334 : see if stdbool is available
23335 : we want a real compile instead of Inhdr because some Solaris systems
23336 : have stdbool.h, but it can only be used if the compiler indicates it
23337 : is sufficiently c99-compliant.
23338 echo " "
23339 $cat >try.c <<EOCP
23340 #include <stdio.h>
23341 #include <stdbool.h>
23342 int func(bool x)
23343 {
23344     return x ? 1 : 0;
23345 }
23346 int main(int argc, char **argv)
23347 {
23348     return func(0);
23349 }
23350 EOCP
23351 set try
23352 if eval $compile; then
23353         echo "<stdbool.h> found." >&4
23354         val="$define"
23355 else
23356         echo "<stdbool.h> NOT found." >&4
23357         val="$undef"
23358 fi
23359 $rm_try
23360 set i_stdbool
23361 eval $setvar
23362
23363 : see if stddef is available
23364 set stddef.h i_stddef
23365 eval $inhdr
23366
23367 : see if stdint is available
23368 set stdint.h i_stdint
23369 eval $inhdr
23370
23371 : see if sys/access.h is available
23372 set sys/access.h i_sysaccess
23373 eval $inhdr
23374
23375 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23376 set sys/filio.h i_sysfilio
23377 eval $inhdr
23378 echo " "
23379 if $test `./findhdr sys/ioctl.h`; then
23380         val="$define"
23381         echo '<sys/ioctl.h> found.' >&4
23382 else
23383         val="$undef"
23384         if $test $i_sysfilio = "$define"; then
23385             echo '<sys/ioctl.h> NOT found.' >&4
23386         else
23387                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23388                 $test $i_termio = "$define" && xxx="termio.h"
23389                 $test $i_termios = "$define" && xxx="termios.h"
23390 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23391         fi
23392 fi
23393 set i_sysioctl
23394 eval $setvar
23395
23396 : see if socket ioctl defs are in sys/sockio.h
23397 echo " "
23398 xxx=`./findhdr sys/sockio.h`
23399 if $test "$xxx"; then
23400         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23401                 val="$define"
23402                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23403         else
23404                 val="$undef"
23405                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23406         fi
23407 else
23408         val="$undef"
23409         $cat <<EOM
23410 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23411 EOM
23412 fi
23413 set i_syssockio
23414 eval $setvar
23415
23416 : see if this is a syslog.h system
23417 set syslog.h i_syslog
23418 eval $inhdr
23419
23420 : see if this is a sys/mode.h system
23421 set sys/mode.h i_sysmode
23422 eval $inhdr
23423
23424 : see if there is a sys/poll.h file
23425 set sys/poll.h i_syspoll
23426 eval $inhdr
23427
23428 : see if sys/resource.h has to be included
23429 set sys/resource.h i_sysresrc
23430 eval $inhdr
23431
23432 : see if sys/security.h is available
23433 set sys/security.h i_syssecrt
23434 eval $inhdr
23435
23436 : see if this is a sys/statvfs.h system
23437 set sys/statvfs.h i_sysstatvfs
23438 eval $inhdr
23439
23440 : see if this is a sys/un.h system
23441 set sys/un.h i_sysun
23442 eval $inhdr
23443
23444 : see if this is a sys/utsname.h system
23445 set sys/utsname.h i_sysutsname
23446 eval $inhdr
23447
23448 : see if this is a syswait system
23449 set sys/wait.h i_syswait
23450 eval $inhdr
23451
23452 : see if this is a ustat.h system
23453 set ustat.h i_ustat
23454 eval $inhdr
23455
23456 : see if this is an utime system
23457 set utime.h i_utime
23458 eval $inhdr
23459
23460 : see if this is a vfork system
23461 case "$d_vfork" in
23462 "$define")
23463         set vfork.h i_vfork
23464         eval $inhdr
23465         ;;
23466 *)
23467         i_vfork="$undef"
23468         ;;
23469 esac
23470
23471 : Check extensions
23472 echo " "
23473 echo "Looking for extensions..." >&4
23474 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23475 : contain old or inaccurate or duplicate values.
23476 nonxs_extensions=''
23477 xs_extensions=''
23478 : We do not use find because it might not be available.
23479 : We do not just use MANIFEST because the user may have dropped
23480 : some additional extensions into the source tree and expect them
23481 : to be built.
23482
23483 : Function to recursively find available extensions, ignoring DynaLoader
23484 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23485 : In 5.10.1 and later, extensions are stored in directories
23486 : like File-Glob instead of the older File/Glob/.
23487 find_extensions='
23488     for xxx in *; do
23489         case "$xxx" in
23490             DynaLoader|dynaload) ;;
23491             *)
23492             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23493             case "$this_ext" in
23494                 Scalar/List/Utils) this_ext="List/Util" ;;
23495                 PathTools)         this_ext="Cwd"       ;;
23496             esac;
23497             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23498             if $contains " $this_ext " "$tdir/$$.tmp"; then
23499                 echo >&4;
23500                 echo "Duplicate directories detected for extension $xxx" >&4;
23501                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23502                 case "$knowitall" in
23503                 "") dflt=y;;
23504                 *) dflt=n;;
23505                 esac;
23506                 . ../UU/myread;
23507                 case "$ans" in
23508                 n*|N*) ;;
23509                 *) echo >&4;
23510                     echo "Ok.  Stopping Configure." >&4;
23511                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23512                     exit 1;;
23513                 esac;
23514                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23515             fi;
23516             $ls -1 "$xxx" > "$tdir/$$.tmp";
23517             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23518                 xs_extensions="$xs_extensions $this_ext";
23519             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23520                 xs_extensions="$xs_extensions $this_ext";
23521             elif $test -d "$xxx"; then
23522                 nonxs_extensions="$nonxs_extensions $this_ext";
23523             fi;
23524             $rm -f "$tdir/$$.tmp";
23525             ;;
23526         esac;
23527     done'
23528 tdir=`pwd`
23529 cd "$rsrc/cpan"
23530 set X
23531 shift
23532 eval $find_extensions
23533 cd "$rsrc/dist"
23534 set X
23535 shift
23536 eval $find_extensions
23537 cd "$rsrc/ext"
23538 set X
23539 shift
23540 eval $find_extensions
23541 set X $xs_extensions
23542 shift
23543 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23544 set X $nonxs_extensions
23545 shift
23546 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23547 cd "$tdir"
23548 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23549
23550 : Now see which are supported on this system.
23551 avail_ext=''
23552 for xxx in $xs_extensions ; do
23553         case "$xxx" in
23554         Amiga*)
23555                 case "$osname" in
23556                 amigaos) avail_ext="$avail_ext $xxx" ;;
23557                 esac
23558                 ;;
23559         DB_File|db_file)
23560                 case "$i_db" in
23561                 $define) avail_ext="$avail_ext $xxx" ;;
23562                 esac
23563                 ;;
23564         GDBM_File|gdbm_fil)
23565                 case "$i_gdbm" in
23566                 $define) avail_ext="$avail_ext $xxx" ;;
23567                 esac
23568                 ;;
23569         I18N/Langinfo|i18n_lan)
23570                 case "$i_langinfo$d_nl_langinfo" in
23571                 $define$define) avail_ext="$avail_ext $xxx" ;;
23572                 esac
23573                 ;;
23574         IPC/SysV|ipc/sysv)
23575                 : XXX Do we need a useipcsysv variable here
23576                 case "${d_msg}${d_sem}${d_shm}" in
23577                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23578                 esac
23579                 ;;
23580         NDBM_File|ndbm_fil)
23581                 case "$d_ndbm" in
23582                 $define)
23583                     case "$osname-$use64bitint" in
23584                     hpux-define)
23585                         case "$libs" in
23586                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23587                         esac
23588                         ;;
23589                     *) avail_ext="$avail_ext $xxx" ;;
23590                     esac
23591                     ;;
23592                 esac
23593                 ;;
23594         ODBM_File|odbm_fil)
23595                 case "${i_dbm}${i_rpcsvcdbm}" in
23596                 *"${define}"*)
23597                     case "$d_cplusplus" in
23598                     define) ;; # delete as a function name will not work
23599                     *)  case "$osname-$use64bitint" in
23600                         hpux-define)
23601                             case "$libs" in
23602                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23603                             esac
23604                             ;;
23605                         *) avail_ext="$avail_ext $xxx" ;;
23606                         esac
23607                         ;;
23608                     esac
23609                     ;;
23610                 esac
23611                 ;;
23612         Opcode|opcode)
23613                 case "$useopcode" in
23614                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23615                 esac
23616                 ;;
23617         POSIX|posix)
23618                 case "$useposix" in
23619                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23620                 esac
23621                 ;;
23622         Socket|socket)
23623                 case "$d_socket" in
23624                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23625                 esac
23626                 ;;
23627         Sys/Syslog|sys/syslog)
23628                 case $osname in
23629                         amigaos) ;; # not really very useful on AmigaOS
23630                         *)
23631                         : XXX syslog requires socket
23632                         case "$d_socket" in
23633                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23634                         esac
23635                         ;;
23636                 esac
23637                 ;;
23638         Thread|thread)
23639                 case "$usethreads" in
23640                 true|$define|y)
23641                         case "$use5005threads" in
23642                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23643                         esac
23644                 esac
23645                 ;;
23646         threads|threads/shared)
23647                 # threads and threads::shared are special cases.
23648                 # To stop people from asking "Perl 5.8.0 was supposed
23649                 # to have this new fancy threads implementation but my
23650                 # perl doesn't have it" and from people trying to
23651                 # (re)install the threads module using CPAN.pm and
23652                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23653                 # the threads.pm and threads/shared.pm will always be
23654                 # there, croaking informatively ("you need to rebuild
23655                 # all of Perl with threads, sorry") when threads haven't
23656                 # been compiled in.
23657                 # --jhi
23658                 avail_ext="$avail_ext $xxx"
23659                 ;;
23660         VMS*)
23661                 ;;
23662         Win32*)
23663                 case "$osname" in
23664                 cygwin) avail_ext="$avail_ext $xxx" ;;
23665                 esac
23666                 ;;
23667         XS/APItest|xs/apitest)
23668                 # This is just for testing.  Skip it unless we have dynamic loading.
23669
23670                 case "$usedl" in
23671                 $define) avail_ext="$avail_ext $xxx" ;;
23672                 esac
23673                 ;;
23674         XS/Typemap|xs/typemap)
23675                 # This is just for testing.  Skip it unless we have dynamic loading.
23676                 case "$usedl" in
23677                 $define) avail_ext="$avail_ext $xxx" ;;
23678                 esac
23679                 ;;
23680         *)      avail_ext="$avail_ext $xxx"
23681                 ;;
23682         esac
23683 done
23684
23685 set X $avail_ext
23686 shift
23687 avail_ext="$*"
23688
23689 case "$onlyextensions" in
23690 '') ;;
23691 *)  keepextensions=''
23692     echo "You have requested that only certain extensions be included..." >&4
23693     for i in $onlyextensions; do
23694         case " $avail_ext " in
23695         *" $i "*)
23696             echo "Keeping extension $i."
23697             keepextensions="$keepextensions $i"
23698             ;;
23699         *) echo "Ignoring extension $i." ;;
23700         esac
23701     done
23702     avail_ext="$keepextensions"
23703     ;;
23704 esac
23705
23706 case "$noextensions" in
23707 '') ;;
23708 *)  keepextensions=''
23709     echo "You have requested that certain extensions be ignored..." >&4
23710     for i in $avail_ext; do
23711         case " $noextensions " in
23712         *" $i "*) echo "Ignoring extension $i." ;;
23713         *) echo "Keeping extension $i.";
23714            keepextensions="$keepextensions $i"
23715            ;;
23716         esac
23717     done
23718     avail_ext="$keepextensions"
23719     ;;
23720 esac
23721
23722 : Now see which nonxs extensions are supported on this system.
23723 : For now assume all are.
23724 nonxs_ext=''
23725 for xxx in $nonxs_extensions ; do
23726         case "$xxx" in
23727         VMS*)
23728                 ;;
23729         *)      nonxs_ext="$nonxs_ext $xxx"
23730                 ;;
23731         esac
23732 done
23733
23734 set X $nonxs_ext
23735 shift
23736 nonxs_ext="$*"
23737
23738 case $usedl in
23739 $define)
23740         $cat <<EOM
23741 A number of extensions are supplied with $package.  You may choose to
23742 compile these extensions for dynamic loading (the default), compile
23743 them into the $package executable (static loading), or not include
23744 them at all.  Answer "none" to include no extensions.
23745 Note that DynaLoader is always built and need not be mentioned here.
23746
23747 EOM
23748         case "$dynamic_ext" in
23749         '')
23750                 : Exclude those listed in static_ext
23751                 dflt=''
23752                 for xxx in $avail_ext; do
23753                         case " $static_ext " in
23754                         *" $xxx "*) ;;
23755                         *) dflt="$dflt $xxx" ;;
23756                         esac
23757                 done
23758                 set X $dflt
23759                 shift
23760                 dflt="$*"
23761                 ;;
23762         *)      dflt="$dynamic_ext"
23763                 # Perhaps we are reusing an old out-of-date config.sh.
23764                 case "$hint" in
23765                 previous)
23766                         if test X"$dynamic_ext" != X"$avail_ext"; then
23767                                 $cat <<EOM
23768 NOTICE:  Your previous config.sh list may be incorrect.
23769 The extensions now available to you are
23770         ${avail_ext}
23771 but the default list from your previous config.sh is
23772         ${dynamic_ext}
23773
23774 EOM
23775                         fi
23776                         ;;
23777                 esac
23778                 ;;
23779         esac
23780         case "$dflt" in
23781         '')     dflt=none;;
23782         esac
23783         rp="What extensions do you wish to load dynamically?"
23784         . ./myread
23785         case "$ans" in
23786         none) dynamic_ext=' ' ;;
23787         *) dynamic_ext="$ans" ;;
23788         esac
23789
23790         case "$static_ext" in
23791         '')
23792                 : Exclude those already listed in dynamic linking
23793                 dflt=''
23794                 for xxx in $avail_ext; do
23795                         case " $dynamic_ext " in
23796                         *" $xxx "*) ;;
23797                         *) dflt="$dflt $xxx" ;;
23798                         esac
23799                 done
23800                 set X $dflt
23801                 shift
23802                 dflt="$*"
23803                 ;;
23804         *)  dflt="$static_ext"
23805                 ;;
23806         esac
23807
23808         case "$dflt" in
23809         '')     dflt=none;;
23810         esac
23811         rp="What extensions do you wish to load statically?"
23812         . ./myread
23813         case "$ans" in
23814         none) static_ext=' ' ;;
23815         *) static_ext="$ans" ;;
23816         esac
23817         ;;
23818 *)
23819         $cat <<EOM
23820 A number of extensions are supplied with $package.  Answer "none"
23821 to include no extensions.
23822 Note that DynaLoader is always built and need not be mentioned here.
23823
23824 EOM
23825         case "$static_ext" in
23826         '') dflt="$avail_ext" ;;
23827         *)      dflt="$static_ext"
23828                 # Perhaps we are reusing an old out-of-date config.sh.
23829                 case "$hint" in
23830                 previous)
23831                         if test X"$static_ext" != X"$avail_ext"; then
23832                                 $cat <<EOM
23833 NOTICE:  Your previous config.sh list may be incorrect.
23834 The extensions now available to you are
23835         ${avail_ext}
23836 but the default list from your previous config.sh is
23837         ${static_ext}
23838
23839 EOM
23840                         fi
23841                         ;;
23842                 esac
23843                 ;;
23844         esac
23845         : Exclude those that are not xs extensions
23846         case "$dflt" in
23847         '')     dflt=none;;
23848         esac
23849         rp="What extensions do you wish to include?"
23850         . ./myread
23851         case "$ans" in
23852         none) static_ext=' ' ;;
23853         *) static_ext="$ans" ;;
23854         esac
23855         ;;
23856 esac
23857 #
23858 # Encode is a special case.  If we are building Encode as a static
23859 # extension, we need to explicitly list its subextensions as well.
23860 # For other nested extensions, this is handled automatically by
23861 # the appropriate Makefile.PL.
23862 case " $static_ext " in
23863         *" Encode "*) # Add the subextensions of Encode
23864         cd "$rsrc/cpan"
23865         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23866                 static_ext="$static_ext Encode/$xxx"
23867                 known_extensions="$known_extensions Encode/$xxx"
23868         done
23869         cd "$tdir"
23870         ;;
23871 esac
23872
23873 set X $dynamic_ext $static_ext $nonxs_ext
23874 shift
23875 extensions="$*"
23876
23877 # Sanity check:  We require an extension suitable for use with
23878 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23879 # should show up as failures in the test suite, but it's helpful to
23880 # catch them now.) The 'extensions' list is normally sorted
23881 # alphabetically, so we need to accept either
23882 #    DB_File ... Fcntl ... IO  ....
23883 # or something like
23884 #    Fcntl ... NDBM_File ... IO  ....
23885 case " $extensions"  in
23886 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23887 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23888 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23889 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23890    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23891    ;;
23892 esac
23893
23894 : Remove libraries needed only for extensions
23895 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23896 : The exception is SunOS 4.x, which needs them.
23897 case "${osname}X${osvers}" in
23898 sunos*X4*)
23899     perllibs="$libs"
23900     ;;
23901 *) case "$usedl" in
23902     $define|true|[yY]*)
23903             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23904             shift
23905             perllibs="$*"
23906             ;;
23907     *)  perllibs="$libs"
23908             ;;
23909     esac
23910     ;;
23911 esac
23912
23913 : Remove build directory name from cppstdin so it can be used from
23914 : either the present location or the final installed location.
23915 echo " "
23916 : Get out of the UU directory to get correct path name.
23917 cd ..
23918 case "$cppstdin" in
23919 `pwd`/cppstdin)
23920         echo "Stripping down cppstdin path name"
23921         cppstdin=cppstdin
23922         ;;
23923 esac
23924 cd UU
23925
23926 : end of configuration questions
23927 echo " "
23928 echo "End of configuration questions."
23929 echo " "
23930
23931 : back to where it started
23932 if test -d ../UU; then
23933         cd ..
23934 fi
23935
23936 : configuration may be unconditionally patched via a 'config.arch' file
23937 if $test -f config.arch; then
23938         echo "I see a config.arch file, loading it." >&4
23939         . ./config.arch
23940 fi
23941
23942 : configuration may be patched via a 'config.over' file
23943 if $test -f config.over; then
23944         echo " "
23945         dflt=y
23946         rp='I see a config.over file.  Do you wish to load it?'
23947         . UU/myread
23948         case "$ans" in
23949         n*) echo "OK, I'll ignore it.";;
23950         *)      . ./config.over
23951                 echo "Configuration override changes have been loaded."
23952                 ;;
23953         esac
23954 fi
23955
23956 : in case they want portability, strip down executable paths
23957 case "$d_portable" in
23958 "$define")
23959         echo " "
23960         echo "Stripping down executable paths..." >&4
23961         for file in $loclist $trylist; do
23962                 eval temp=\$$file
23963                 eval $file=`basename $temp`
23964         done
23965         ;;
23966 esac
23967
23968 : create config.sh file
23969 echo " "
23970 echo "Creating config.sh..." >&4
23971 $spitshell <<EOT >config.sh
23972 $startsh
23973 #
23974 # This file was produced by running the Configure script. It holds all the
23975 # definitions figured out by Configure. Should you modify one of these values,
23976 # do not forget to propagate your changes by running "Configure -der". You may
23977 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23978 #
23979
23980 # Package name      : $package
23981 # Source directory  : $src
23982 # Configuration time: $cf_time
23983 # Configured by     : $cf_by
23984 # Target system     : $myuname
23985
23986 EOT
23987 : Add in command line options if available
23988 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23989
23990 $spitshell <<EOT >>config.sh
23991
23992 Author='$Author'
23993 Date='$Date'
23994 Header='$Header'
23995 Id='$Id'
23996 Locker='$Locker'
23997 Log='$Log'
23998 RCSfile='$RCSfile'
23999 Revision='$Revision'
24000 Source='$Source'
24001 State='$State'
24002 _a='$_a'
24003 _exe='$_exe'
24004 _o='$_o'
24005 afs='$afs'
24006 afsroot='$afsroot'
24007 alignbytes='$alignbytes'
24008 ansi2knr='$ansi2knr'
24009 aphostname='$aphostname'
24010 api_revision='$api_revision'
24011 api_subversion='$api_subversion'
24012 api_version='$api_version'
24013 api_versionstring='$api_versionstring'
24014 ar='$ar'
24015 archlib='$archlib'
24016 archlibexp='$archlibexp'
24017 archname64='$archname64'
24018 archname='$archname'
24019 archobjs='$archobjs'
24020 asctime_r_proto='$asctime_r_proto'
24021 awk='$awk'
24022 baserev='$baserev'
24023 bash='$bash'
24024 bin='$bin'
24025 bin_ELF='$bin_ELF'
24026 binexp='$binexp'
24027 bison='$bison'
24028 byacc='$byacc'
24029 byteorder='$byteorder'
24030 c='$c'
24031 castflags='$castflags'
24032 cat='$cat'
24033 cc='$cc'
24034 cccdlflags='$cccdlflags'
24035 ccdlflags='$ccdlflags'
24036 ccflags='$ccflags'
24037 ccflags_uselargefiles='$ccflags_uselargefiles'
24038 ccname='$ccname'
24039 ccsymbols='$ccsymbols'
24040 ccversion='$ccversion'
24041 cf_by='$cf_by'
24042 cf_email='$cf_email'
24043 cf_time='$cf_time'
24044 charbits='$charbits'
24045 charsize='$charsize'
24046 chgrp='$chgrp'
24047 chmod='$chmod'
24048 chown='$chown'
24049 clocktype='$clocktype'
24050 comm='$comm'
24051 compress='$compress'
24052 contains='$contains'
24053 cp='$cp'
24054 cpio='$cpio'
24055 cpp='$cpp'
24056 cpp_stuff='$cpp_stuff'
24057 cppccsymbols='$cppccsymbols'
24058 cppflags='$cppflags'
24059 cpplast='$cpplast'
24060 cppminus='$cppminus'
24061 cpprun='$cpprun'
24062 cppstdin='$cppstdin'
24063 cppsymbols='$cppsymbols'
24064 crypt_r_proto='$crypt_r_proto'
24065 cryptlib='$cryptlib'
24066 csh='$csh'
24067 ctermid_r_proto='$ctermid_r_proto'
24068 ctime_r_proto='$ctime_r_proto'
24069 d_Gconvert='$d_Gconvert'
24070 d_PRIEUldbl='$d_PRIEUldbl'
24071 d_PRIFUldbl='$d_PRIFUldbl'
24072 d_PRIGUldbl='$d_PRIGUldbl'
24073 d_PRIXU64='$d_PRIXU64'
24074 d_PRId64='$d_PRId64'
24075 d_PRIeldbl='$d_PRIeldbl'
24076 d_PRIfldbl='$d_PRIfldbl'
24077 d_PRIgldbl='$d_PRIgldbl'
24078 d_PRIi64='$d_PRIi64'
24079 d_PRIo64='$d_PRIo64'
24080 d_PRIu64='$d_PRIu64'
24081 d_PRIx64='$d_PRIx64'
24082 d_SCNfldbl='$d_SCNfldbl'
24083 d__fwalk='$d__fwalk'
24084 d_access='$d_access'
24085 d_accessx='$d_accessx'
24086 d_acosh='$d_acosh'
24087 d_aintl='$d_aintl'
24088 d_alarm='$d_alarm'
24089 d_archlib='$d_archlib'
24090 d_asctime64='$d_asctime64'
24091 d_asctime_r='$d_asctime_r'
24092 d_asinh='$d_asinh'
24093 d_atanh='$d_atanh'
24094 d_atolf='$d_atolf'
24095 d_atoll='$d_atoll'
24096 d_attribute_deprecated='$d_attribute_deprecated'
24097 d_attribute_format='$d_attribute_format'
24098 d_attribute_malloc='$d_attribute_malloc'
24099 d_attribute_nonnull='$d_attribute_nonnull'
24100 d_attribute_noreturn='$d_attribute_noreturn'
24101 d_attribute_pure='$d_attribute_pure'
24102 d_attribute_unused='$d_attribute_unused'
24103 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24104 d_backtrace='$d_backtrace'
24105 d_bcmp='$d_bcmp'
24106 d_bcopy='$d_bcopy'
24107 d_bsd='$d_bsd'
24108 d_bsdgetpgrp='$d_bsdgetpgrp'
24109 d_bsdsetpgrp='$d_bsdsetpgrp'
24110 d_builtin_choose_expr='$d_builtin_choose_expr'
24111 d_builtin_expect='$d_builtin_expect'
24112 d_bzero='$d_bzero'
24113 d_c99_variadic_macros='$d_c99_variadic_macros'
24114 d_casti32='$d_casti32'
24115 d_castneg='$d_castneg'
24116 d_cbrt='$d_cbrt'
24117 d_charvspr='$d_charvspr'
24118 d_chown='$d_chown'
24119 d_chroot='$d_chroot'
24120 d_chsize='$d_chsize'
24121 d_class='$d_class'
24122 d_clearenv='$d_clearenv'
24123 d_closedir='$d_closedir'
24124 d_cmsghdr_s='$d_cmsghdr_s'
24125 d_const='$d_const'
24126 d_copysign='$d_copysign'
24127 d_copysignl='$d_copysignl'
24128 d_cplusplus='$d_cplusplus'
24129 d_crypt='$d_crypt'
24130 d_crypt_r='$d_crypt_r'
24131 d_csh='$d_csh'
24132 d_ctermid='$d_ctermid'
24133 d_ctermid_r='$d_ctermid_r'
24134 d_ctime64='$d_ctime64'
24135 d_ctime_r='$d_ctime_r'
24136 d_cuserid='$d_cuserid'
24137 d_dbl_dig='$d_dbl_dig'
24138 d_dbminitproto='$d_dbminitproto'
24139 d_difftime64='$d_difftime64'
24140 d_difftime='$d_difftime'
24141 d_dir_dd_fd='$d_dir_dd_fd'
24142 d_dirfd='$d_dirfd'
24143 d_dirnamlen='$d_dirnamlen'
24144 d_dladdr='$d_dladdr'
24145 d_dlerror='$d_dlerror'
24146 d_dlopen='$d_dlopen'
24147 d_dlsymun='$d_dlsymun'
24148 d_dosuid='$d_dosuid'
24149 d_drand48_r='$d_drand48_r'
24150 d_drand48proto='$d_drand48proto'
24151 d_dup2='$d_dup2'
24152 d_eaccess='$d_eaccess'
24153 d_endgrent='$d_endgrent'
24154 d_endgrent_r='$d_endgrent_r'
24155 d_endhent='$d_endhent'
24156 d_endhostent_r='$d_endhostent_r'
24157 d_endnent='$d_endnent'
24158 d_endnetent_r='$d_endnetent_r'
24159 d_endpent='$d_endpent'
24160 d_endprotoent_r='$d_endprotoent_r'
24161 d_endpwent='$d_endpwent'
24162 d_endpwent_r='$d_endpwent_r'
24163 d_endsent='$d_endsent'
24164 d_endservent_r='$d_endservent_r'
24165 d_eofnblk='$d_eofnblk'
24166 d_erf='$d_erf'
24167 d_erfc='$d_erfc'
24168 d_eunice='$d_eunice'
24169 d_exp2='$d_exp2'
24170 d_expm1='$d_expm1'
24171 d_faststdio='$d_faststdio'
24172 d_fchdir='$d_fchdir'
24173 d_fchmod='$d_fchmod'
24174 d_fchown='$d_fchown'
24175 d_fcntl='$d_fcntl'
24176 d_fcntl_can_lock='$d_fcntl_can_lock'
24177 d_fd_macros='$d_fd_macros'
24178 d_fd_set='$d_fd_set'
24179 d_fdim='$d_fdim'
24180 d_fds_bits='$d_fds_bits'
24181 d_fegetround='$d_fegetround'
24182 d_fgetpos='$d_fgetpos'
24183 d_finite='$d_finite'
24184 d_finitel='$d_finitel'
24185 d_flexfnam='$d_flexfnam'
24186 d_flock='$d_flock'
24187 d_flockproto='$d_flockproto'
24188 d_fma='$d_fma'
24189 d_fmax='$d_fmax'
24190 d_fmin='$d_fmin'
24191 d_fork='$d_fork'
24192 d_fp_class='$d_fp_class'
24193 d_fp_classify='$d_fp_classify'
24194 d_fp_classl='$d_fp_classl'
24195 d_fpathconf='$d_fpathconf'
24196 d_fpclass='$d_fpclass'
24197 d_fpclassify='$d_fpclassify'
24198 d_fpclassl='$d_fpclassl'
24199 d_fpgetround='$d_fpgetround'
24200 d_fpos64_t='$d_fpos64_t'
24201 d_frexpl='$d_frexpl'
24202 d_fs_data_s='$d_fs_data_s'
24203 d_fseeko='$d_fseeko'
24204 d_fsetpos='$d_fsetpos'
24205 d_fstatfs='$d_fstatfs'
24206 d_fstatvfs='$d_fstatvfs'
24207 d_fsync='$d_fsync'
24208 d_ftello='$d_ftello'
24209 d_ftime='$d_ftime'
24210 d_futimes='$d_futimes'
24211 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24212 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24213 d_getaddrinfo='$d_getaddrinfo'
24214 d_getcwd='$d_getcwd'
24215 d_getespwnam='$d_getespwnam'
24216 d_getfsstat='$d_getfsstat'
24217 d_getgrent='$d_getgrent'
24218 d_getgrent_r='$d_getgrent_r'
24219 d_getgrgid_r='$d_getgrgid_r'
24220 d_getgrnam_r='$d_getgrnam_r'
24221 d_getgrps='$d_getgrps'
24222 d_gethbyaddr='$d_gethbyaddr'
24223 d_gethbyname='$d_gethbyname'
24224 d_gethent='$d_gethent'
24225 d_gethname='$d_gethname'
24226 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24227 d_gethostbyname_r='$d_gethostbyname_r'
24228 d_gethostent_r='$d_gethostent_r'
24229 d_gethostprotos='$d_gethostprotos'
24230 d_getitimer='$d_getitimer'
24231 d_getlogin='$d_getlogin'
24232 d_getlogin_r='$d_getlogin_r'
24233 d_getmnt='$d_getmnt'
24234 d_getmntent='$d_getmntent'
24235 d_getnameinfo='$d_getnameinfo'
24236 d_getnbyaddr='$d_getnbyaddr'
24237 d_getnbyname='$d_getnbyname'
24238 d_getnent='$d_getnent'
24239 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24240 d_getnetbyname_r='$d_getnetbyname_r'
24241 d_getnetent_r='$d_getnetent_r'
24242 d_getnetprotos='$d_getnetprotos'
24243 d_getpagsz='$d_getpagsz'
24244 d_getpbyname='$d_getpbyname'
24245 d_getpbynumber='$d_getpbynumber'
24246 d_getpent='$d_getpent'
24247 d_getpgid='$d_getpgid'
24248 d_getpgrp2='$d_getpgrp2'
24249 d_getpgrp='$d_getpgrp'
24250 d_getppid='$d_getppid'
24251 d_getprior='$d_getprior'
24252 d_getprotobyname_r='$d_getprotobyname_r'
24253 d_getprotobynumber_r='$d_getprotobynumber_r'
24254 d_getprotoent_r='$d_getprotoent_r'
24255 d_getprotoprotos='$d_getprotoprotos'
24256 d_getprpwnam='$d_getprpwnam'
24257 d_getpwent='$d_getpwent'
24258 d_getpwent_r='$d_getpwent_r'
24259 d_getpwnam_r='$d_getpwnam_r'
24260 d_getpwuid_r='$d_getpwuid_r'
24261 d_getsbyname='$d_getsbyname'
24262 d_getsbyport='$d_getsbyport'
24263 d_getsent='$d_getsent'
24264 d_getservbyname_r='$d_getservbyname_r'
24265 d_getservbyport_r='$d_getservbyport_r'
24266 d_getservent_r='$d_getservent_r'
24267 d_getservprotos='$d_getservprotos'
24268 d_getspnam='$d_getspnam'
24269 d_getspnam_r='$d_getspnam_r'
24270 d_gettimeod='$d_gettimeod'
24271 d_gmtime64='$d_gmtime64'
24272 d_gmtime_r='$d_gmtime_r'
24273 d_gnulibc='$d_gnulibc'
24274 d_grpasswd='$d_grpasswd'
24275 d_hasmntopt='$d_hasmntopt'
24276 d_htonl='$d_htonl'
24277 d_hypot='$d_hypot'
24278 d_ilogb='$d_ilogb'
24279 d_ilogbl='$d_ilogbl'
24280 d_inc_version_list='$d_inc_version_list'
24281 d_index='$d_index'
24282 d_inetaton='$d_inetaton'
24283 d_inetntop='$d_inetntop'
24284 d_inetpton='$d_inetpton'
24285 d_int64_t='$d_int64_t'
24286 d_ip_mreq='$d_ip_mreq'
24287 d_ip_mreq_source='$d_ip_mreq_source'
24288 d_ipv6_mreq='$d_ipv6_mreq'
24289 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24290 d_isascii='$d_isascii'
24291 d_isblank='$d_isblank'
24292 d_isfinite='$d_isfinite'
24293 d_isfinitel='$d_isfinitel'
24294 d_isinf='$d_isinf'
24295 d_isinfl='$d_isinfl'
24296 d_isless='$d_isless'
24297 d_isnan='$d_isnan'
24298 d_isnanl='$d_isnanl'
24299 d_isnormal='$d_isnormal'
24300 d_j0='$d_j0'
24301 d_j0l='$d_j0l'
24302 d_killpg='$d_killpg'
24303 d_lc_monetary_2008='$d_lc_monetary_2008'
24304 d_lchown='$d_lchown'
24305 d_ldbl_dig='$d_ldbl_dig'
24306 d_ldexpl='$d_ldexpl'
24307 d_lgamma='$d_lgamma'
24308 d_lgamma_r='$d_lgamma_r'
24309 d_libm_lib_version='$d_libm_lib_version'
24310 d_libname_unique='$d_libname_unique'
24311 d_link='$d_link'
24312 d_llrint='$d_llrint'
24313 d_llrintl='$d_llrintl'
24314 d_llround='$d_llround'
24315 d_llroundl='$d_llroundl'
24316 d_localtime64='$d_localtime64'
24317 d_localtime_r='$d_localtime_r'
24318 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24319 d_locconv='$d_locconv'
24320 d_lockf='$d_lockf'
24321 d_log1p='$d_log1p'
24322 d_log2='$d_log2'
24323 d_logb='$d_logb'
24324 d_longdbl='$d_longdbl'
24325 d_longlong='$d_longlong'
24326 d_lrint='$d_lrint'
24327 d_lrintl='$d_lrintl'
24328 d_lround='$d_lround'
24329 d_lroundl='$d_lroundl'
24330 d_lseekproto='$d_lseekproto'
24331 d_lstat='$d_lstat'
24332 d_madvise='$d_madvise'
24333 d_malloc_good_size='$d_malloc_good_size'
24334 d_malloc_size='$d_malloc_size'
24335 d_mblen='$d_mblen'
24336 d_mbstowcs='$d_mbstowcs'
24337 d_mbtowc='$d_mbtowc'
24338 d_memchr='$d_memchr'
24339 d_memcmp='$d_memcmp'
24340 d_memcpy='$d_memcpy'
24341 d_memmove='$d_memmove'
24342 d_memset='$d_memset'
24343 d_mkdir='$d_mkdir'
24344 d_mkdtemp='$d_mkdtemp'
24345 d_mkfifo='$d_mkfifo'
24346 d_mkstemp='$d_mkstemp'
24347 d_mkstemps='$d_mkstemps'
24348 d_mktime64='$d_mktime64'
24349 d_mktime='$d_mktime'
24350 d_mmap='$d_mmap'
24351 d_modfl='$d_modfl'
24352 d_modfl_pow32_bug='$d_modfl_pow32_bug'
24353 d_modflproto='$d_modflproto'
24354 d_mprotect='$d_mprotect'
24355 d_msg='$d_msg'
24356 d_msg_ctrunc='$d_msg_ctrunc'
24357 d_msg_dontroute='$d_msg_dontroute'
24358 d_msg_oob='$d_msg_oob'
24359 d_msg_peek='$d_msg_peek'
24360 d_msg_proxy='$d_msg_proxy'
24361 d_msgctl='$d_msgctl'
24362 d_msgget='$d_msgget'
24363 d_msghdr_s='$d_msghdr_s'
24364 d_msgrcv='$d_msgrcv'
24365 d_msgsnd='$d_msgsnd'
24366 d_msync='$d_msync'
24367 d_munmap='$d_munmap'
24368 d_mymalloc='$d_mymalloc'
24369 d_nan='$d_nan'
24370 d_ndbm='$d_ndbm'
24371 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24372 d_nearbyint='$d_nearbyint'
24373 d_nextafter='$d_nextafter'
24374 d_nexttoward='$d_nexttoward'
24375 d_nice='$d_nice'
24376 d_nl_langinfo='$d_nl_langinfo'
24377 d_nv_preserves_uv='$d_nv_preserves_uv'
24378 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24379 d_off64_t='$d_off64_t'
24380 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24381 d_oldpthreads='$d_oldpthreads'
24382 d_oldsock='$d_oldsock'
24383 d_open3='$d_open3'
24384 d_pathconf='$d_pathconf'
24385 d_pause='$d_pause'
24386 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24387 d_phostname='$d_phostname'
24388 d_pipe='$d_pipe'
24389 d_poll='$d_poll'
24390 d_portable='$d_portable'
24391 d_prctl='$d_prctl'
24392 d_prctl_set_name='$d_prctl_set_name'
24393 d_printf_format_null='$d_printf_format_null'
24394 d_procselfexe='$d_procselfexe'
24395 d_pseudofork='$d_pseudofork'
24396 d_pthread_atfork='$d_pthread_atfork'
24397 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24398 d_pthread_yield='$d_pthread_yield'
24399 d_ptrdiff_t='$d_ptrdiff_t'
24400 d_pwage='$d_pwage'
24401 d_pwchange='$d_pwchange'
24402 d_pwclass='$d_pwclass'
24403 d_pwcomment='$d_pwcomment'
24404 d_pwexpire='$d_pwexpire'
24405 d_pwgecos='$d_pwgecos'
24406 d_pwpasswd='$d_pwpasswd'
24407 d_pwquota='$d_pwquota'
24408 d_qgcvt='$d_qgcvt'
24409 d_quad='$d_quad'
24410 d_random_r='$d_random_r'
24411 d_re_comp='$d_re_comp'
24412 d_readdir64_r='$d_readdir64_r'
24413 d_readdir='$d_readdir'
24414 d_readdir_r='$d_readdir_r'
24415 d_readlink='$d_readlink'
24416 d_readv='$d_readv'
24417 d_recvmsg='$d_recvmsg'
24418 d_regcmp='$d_regcmp'
24419 d_regcomp='$d_regcomp'
24420 d_remainder='$d_remainder'
24421 d_remquo='$d_remquo'
24422 d_rename='$d_rename'
24423 d_rewinddir='$d_rewinddir'
24424 d_rint='$d_rint'
24425 d_rmdir='$d_rmdir'
24426 d_round='$d_round'
24427 d_safebcpy='$d_safebcpy'
24428 d_safemcpy='$d_safemcpy'
24429 d_sanemcmp='$d_sanemcmp'
24430 d_sbrkproto='$d_sbrkproto'
24431 d_scalbn='$d_scalbn'
24432 d_scalbnl='$d_scalbnl'
24433 d_sched_yield='$d_sched_yield'
24434 d_scm_rights='$d_scm_rights'
24435 d_seekdir='$d_seekdir'
24436 d_select='$d_select'
24437 d_sem='$d_sem'
24438 d_semctl='$d_semctl'
24439 d_semctl_semid_ds='$d_semctl_semid_ds'
24440 d_semctl_semun='$d_semctl_semun'
24441 d_semget='$d_semget'
24442 d_semop='$d_semop'
24443 d_sendmsg='$d_sendmsg'
24444 d_setegid='$d_setegid'
24445 d_seteuid='$d_seteuid'
24446 d_setgrent='$d_setgrent'
24447 d_setgrent_r='$d_setgrent_r'
24448 d_setgrps='$d_setgrps'
24449 d_sethent='$d_sethent'
24450 d_sethostent_r='$d_sethostent_r'
24451 d_setitimer='$d_setitimer'
24452 d_setlinebuf='$d_setlinebuf'
24453 d_setlocale='$d_setlocale'
24454 d_setlocale_r='$d_setlocale_r'
24455 d_setnent='$d_setnent'
24456 d_setnetent_r='$d_setnetent_r'
24457 d_setpent='$d_setpent'
24458 d_setpgid='$d_setpgid'
24459 d_setpgrp2='$d_setpgrp2'
24460 d_setpgrp='$d_setpgrp'
24461 d_setprior='$d_setprior'
24462 d_setproctitle='$d_setproctitle'
24463 d_setprotoent_r='$d_setprotoent_r'
24464 d_setpwent='$d_setpwent'
24465 d_setpwent_r='$d_setpwent_r'
24466 d_setregid='$d_setregid'
24467 d_setresgid='$d_setresgid'
24468 d_setresuid='$d_setresuid'
24469 d_setreuid='$d_setreuid'
24470 d_setrgid='$d_setrgid'
24471 d_setruid='$d_setruid'
24472 d_setsent='$d_setsent'
24473 d_setservent_r='$d_setservent_r'
24474 d_setsid='$d_setsid'
24475 d_setvbuf='$d_setvbuf'
24476 d_shm='$d_shm'
24477 d_shmat='$d_shmat'
24478 d_shmatprototype='$d_shmatprototype'
24479 d_shmctl='$d_shmctl'
24480 d_shmdt='$d_shmdt'
24481 d_shmget='$d_shmget'
24482 d_sigaction='$d_sigaction'
24483 d_signbit='$d_signbit'
24484 d_sigprocmask='$d_sigprocmask'
24485 d_sigsetjmp='$d_sigsetjmp'
24486 d_sin6_scope_id='$d_sin6_scope_id'
24487 d_sitearch='$d_sitearch'
24488 d_snprintf='$d_snprintf'
24489 d_sockaddr_in6='$d_sockaddr_in6'
24490 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24491 d_sockatmark='$d_sockatmark'
24492 d_sockatmarkproto='$d_sockatmarkproto'
24493 d_socket='$d_socket'
24494 d_socklen_t='$d_socklen_t'
24495 d_sockpair='$d_sockpair'
24496 d_socks5_init='$d_socks5_init'
24497 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24498 d_sqrtl='$d_sqrtl'
24499 d_srand48_r='$d_srand48_r'
24500 d_srandom_r='$d_srandom_r'
24501 d_sresgproto='$d_sresgproto'
24502 d_sresuproto='$d_sresuproto'
24503 d_stat='$d_stat'
24504 d_statblks='$d_statblks'
24505 d_statfs_f_flags='$d_statfs_f_flags'
24506 d_statfs_s='$d_statfs_s'
24507 d_static_inline='$d_static_inline'
24508 d_statvfs='$d_statvfs'
24509 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24510 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24511 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24512 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24513 d_stdio_stream_array='$d_stdio_stream_array'
24514 d_stdiobase='$d_stdiobase'
24515 d_stdstdio='$d_stdstdio'
24516 d_strchr='$d_strchr'
24517 d_strcoll='$d_strcoll'
24518 d_strctcpy='$d_strctcpy'
24519 d_strerrm='$d_strerrm'
24520 d_strerror='$d_strerror'
24521 d_strerror_r='$d_strerror_r'
24522 d_strftime='$d_strftime'
24523 d_strlcat='$d_strlcat'
24524 d_strlcpy='$d_strlcpy'
24525 d_strtod='$d_strtod'
24526 d_strtol='$d_strtol'
24527 d_strtold='$d_strtold'
24528 d_strtoll='$d_strtoll'
24529 d_strtoq='$d_strtoq'
24530 d_strtoul='$d_strtoul'
24531 d_strtoull='$d_strtoull'
24532 d_strtouq='$d_strtouq'
24533 d_strxfrm='$d_strxfrm'
24534 d_suidsafe='$d_suidsafe'
24535 d_symlink='$d_symlink'
24536 d_syscall='$d_syscall'
24537 d_syscallproto='$d_syscallproto'
24538 d_sysconf='$d_sysconf'
24539 d_sysernlst='$d_sysernlst'
24540 d_syserrlst='$d_syserrlst'
24541 d_system='$d_system'
24542 d_tcgetpgrp='$d_tcgetpgrp'
24543 d_tcsetpgrp='$d_tcsetpgrp'
24544 d_telldir='$d_telldir'
24545 d_telldirproto='$d_telldirproto'
24546 d_tgamma='$d_tgamma'
24547 d_time='$d_time'
24548 d_timegm='$d_timegm'
24549 d_times='$d_times'
24550 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24551 d_tm_tm_zone='$d_tm_tm_zone'
24552 d_tmpnam_r='$d_tmpnam_r'
24553 d_trunc='$d_trunc'
24554 d_truncate='$d_truncate'
24555 d_truncl='$d_truncl'
24556 d_ttyname_r='$d_ttyname_r'
24557 d_tzname='$d_tzname'
24558 d_u32align='$d_u32align'
24559 d_ualarm='$d_ualarm'
24560 d_umask='$d_umask'
24561 d_uname='$d_uname'
24562 d_union_semun='$d_union_semun'
24563 d_unordered='$d_unordered'
24564 d_unsetenv='$d_unsetenv'
24565 d_usleep='$d_usleep'
24566 d_usleepproto='$d_usleepproto'
24567 d_ustat='$d_ustat'
24568 d_vendorarch='$d_vendorarch'
24569 d_vendorbin='$d_vendorbin'
24570 d_vendorlib='$d_vendorlib'
24571 d_vendorscript='$d_vendorscript'
24572 d_vfork='$d_vfork'
24573 d_void_closedir='$d_void_closedir'
24574 d_voidsig='$d_voidsig'
24575 d_voidtty='$d_voidtty'
24576 d_volatile='$d_volatile'
24577 d_vprintf='$d_vprintf'
24578 d_vsnprintf='$d_vsnprintf'
24579 d_wait4='$d_wait4'
24580 d_waitpid='$d_waitpid'
24581 d_wcscmp='$d_wcscmp'
24582 d_wcstombs='$d_wcstombs'
24583 d_wcsxfrm='$d_wcsxfrm'
24584 d_wctomb='$d_wctomb'
24585 d_writev='$d_writev'
24586 d_xenix='$d_xenix'
24587 date='$date'
24588 db_hashtype='$db_hashtype'
24589 db_prefixtype='$db_prefixtype'
24590 db_version_major='$db_version_major'
24591 db_version_minor='$db_version_minor'
24592 db_version_patch='$db_version_patch'
24593 direntrytype='$direntrytype'
24594 dlext='$dlext'
24595 dlsrc='$dlsrc'
24596 doubleinfbytes='$doubleinfbytes'
24597 doublekind='$doublekind'
24598 doublemantbits='$doublemantbits'
24599 doublenanbytes='$doublenanbytes'
24600 doublesize='$doublesize'
24601 drand01='$drand01'
24602 drand48_r_proto='$drand48_r_proto'
24603 dtrace='$dtrace'
24604 dynamic_ext='$dynamic_ext'
24605 eagain='$eagain'
24606 ebcdic='$ebcdic'
24607 echo='$echo'
24608 egrep='$egrep'
24609 emacs='$emacs'
24610 endgrent_r_proto='$endgrent_r_proto'
24611 endhostent_r_proto='$endhostent_r_proto'
24612 endnetent_r_proto='$endnetent_r_proto'
24613 endprotoent_r_proto='$endprotoent_r_proto'
24614 endpwent_r_proto='$endpwent_r_proto'
24615 endservent_r_proto='$endservent_r_proto'
24616 eunicefix='$eunicefix'
24617 exe_ext='$exe_ext'
24618 expr='$expr'
24619 extensions='$extensions'
24620 extern_C='$extern_C'
24621 extras='$extras'
24622 fflushNULL='$fflushNULL'
24623 fflushall='$fflushall'
24624 find='$find'
24625 firstmakefile='$firstmakefile'
24626 flex='$flex'
24627 fpossize='$fpossize'
24628 fpostype='$fpostype'
24629 freetype='$freetype'
24630 from='$from'
24631 full_ar='$full_ar'
24632 full_csh='$full_csh'
24633 full_sed='$full_sed'
24634 gccansipedantic='$gccansipedantic'
24635 gccosandvers='$gccosandvers'
24636 gccversion='$gccversion'
24637 getgrent_r_proto='$getgrent_r_proto'
24638 getgrgid_r_proto='$getgrgid_r_proto'
24639 getgrnam_r_proto='$getgrnam_r_proto'
24640 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24641 gethostbyname_r_proto='$gethostbyname_r_proto'
24642 gethostent_r_proto='$gethostent_r_proto'
24643 getlogin_r_proto='$getlogin_r_proto'
24644 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24645 getnetbyname_r_proto='$getnetbyname_r_proto'
24646 getnetent_r_proto='$getnetent_r_proto'
24647 getprotobyname_r_proto='$getprotobyname_r_proto'
24648 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24649 getprotoent_r_proto='$getprotoent_r_proto'
24650 getpwent_r_proto='$getpwent_r_proto'
24651 getpwnam_r_proto='$getpwnam_r_proto'
24652 getpwuid_r_proto='$getpwuid_r_proto'
24653 getservbyname_r_proto='$getservbyname_r_proto'
24654 getservbyport_r_proto='$getservbyport_r_proto'
24655 getservent_r_proto='$getservent_r_proto'
24656 getspnam_r_proto='$getspnam_r_proto'
24657 gidformat='$gidformat'
24658 gidsign='$gidsign'
24659 gidsize='$gidsize'
24660 gidtype='$gidtype'
24661 glibpth='$glibpth'
24662 gmake='$gmake'
24663 gmtime_r_proto='$gmtime_r_proto'
24664 gnulibc_version='$gnulibc_version'
24665 grep='$grep'
24666 groupcat='$groupcat'
24667 groupstype='$groupstype'
24668 gzip='$gzip'
24669 h_fcntl='$h_fcntl'
24670 h_sysfile='$h_sysfile'
24671 hint='$hint'
24672 hostcat='$hostcat'
24673 hostgenerate='$hostgenerate'
24674 hostosname='$hostosname'
24675 hostperl='$hostperl'
24676 html1dir='$html1dir'
24677 html1direxp='$html1direxp'
24678 html3dir='$html3dir'
24679 html3direxp='$html3direxp'
24680 i16size='$i16size'
24681 i16type='$i16type'
24682 i32size='$i32size'
24683 i32type='$i32type'
24684 i64size='$i64size'
24685 i64type='$i64type'
24686 i8size='$i8size'
24687 i8type='$i8type'
24688 i_arpainet='$i_arpainet'
24689 i_assert='$i_assert'
24690 i_bfd='$i_bfd'
24691 i_bsdioctl='$i_bsdioctl'
24692 i_crypt='$i_crypt'
24693 i_db='$i_db'
24694 i_dbm='$i_dbm'
24695 i_dirent='$i_dirent'
24696 i_dlfcn='$i_dlfcn'
24697 i_execinfo='$i_execinfo'
24698 i_fcntl='$i_fcntl'
24699 i_fenv='$i_fenv'
24700 i_float='$i_float'
24701 i_fp='$i_fp'
24702 i_fp_class='$i_fp_class'
24703 i_gdbm='$i_gdbm'
24704 i_gdbm_ndbm='$i_gdbm_ndbm'
24705 i_gdbmndbm='$i_gdbmndbm'
24706 i_grp='$i_grp'
24707 i_ieeefp='$i_ieeefp'
24708 i_inttypes='$i_inttypes'
24709 i_langinfo='$i_langinfo'
24710 i_libutil='$i_libutil'
24711 i_limits='$i_limits'
24712 i_locale='$i_locale'
24713 i_machcthr='$i_machcthr'
24714 i_malloc='$i_malloc'
24715 i_mallocmalloc='$i_mallocmalloc'
24716 i_math='$i_math'
24717 i_memory='$i_memory'
24718 i_mntent='$i_mntent'
24719 i_ndbm='$i_ndbm'
24720 i_netdb='$i_netdb'
24721 i_neterrno='$i_neterrno'
24722 i_netinettcp='$i_netinettcp'
24723 i_niin='$i_niin'
24724 i_poll='$i_poll'
24725 i_prot='$i_prot'
24726 i_pthread='$i_pthread'
24727 i_pwd='$i_pwd'
24728 i_quadmath='$i_quadmath'
24729 i_rpcsvcdbm='$i_rpcsvcdbm'
24730 i_sgtty='$i_sgtty'
24731 i_shadow='$i_shadow'
24732 i_socks='$i_socks'
24733 i_stdarg='$i_stdarg'
24734 i_stdbool='$i_stdbool'
24735 i_stddef='$i_stddef'
24736 i_stdint='$i_stdint'
24737 i_stdlib='$i_stdlib'
24738 i_string='$i_string'
24739 i_sunmath='$i_sunmath'
24740 i_sysaccess='$i_sysaccess'
24741 i_sysdir='$i_sysdir'
24742 i_sysfile='$i_sysfile'
24743 i_sysfilio='$i_sysfilio'
24744 i_sysin='$i_sysin'
24745 i_sysioctl='$i_sysioctl'
24746 i_syslog='$i_syslog'
24747 i_sysmman='$i_sysmman'
24748 i_sysmode='$i_sysmode'
24749 i_sysmount='$i_sysmount'
24750 i_sysndir='$i_sysndir'
24751 i_sysparam='$i_sysparam'
24752 i_syspoll='$i_syspoll'
24753 i_sysresrc='$i_sysresrc'
24754 i_syssecrt='$i_syssecrt'
24755 i_sysselct='$i_sysselct'
24756 i_syssockio='$i_syssockio'
24757 i_sysstat='$i_sysstat'
24758 i_sysstatfs='$i_sysstatfs'
24759 i_sysstatvfs='$i_sysstatvfs'
24760 i_systime='$i_systime'
24761 i_systimek='$i_systimek'
24762 i_systimes='$i_systimes'
24763 i_systypes='$i_systypes'
24764 i_sysuio='$i_sysuio'
24765 i_sysun='$i_sysun'
24766 i_sysutsname='$i_sysutsname'
24767 i_sysvfs='$i_sysvfs'
24768 i_syswait='$i_syswait'
24769 i_termio='$i_termio'
24770 i_termios='$i_termios'
24771 i_time='$i_time'
24772 i_unistd='$i_unistd'
24773 i_ustat='$i_ustat'
24774 i_utime='$i_utime'
24775 i_values='$i_values'
24776 i_varargs='$i_varargs'
24777 i_varhdr='$i_varhdr'
24778 i_vfork='$i_vfork'
24779 ignore_versioned_solibs='$ignore_versioned_solibs'
24780 inc_version_list='$inc_version_list'
24781 inc_version_list_init='$inc_version_list_init'
24782 incpath='$incpath'
24783 incpth='$incpth'
24784 inews='$inews'
24785 initialinstalllocation='$initialinstalllocation'
24786 installarchlib='$installarchlib'
24787 installbin='$installbin'
24788 installhtml1dir='$installhtml1dir'
24789 installhtml3dir='$installhtml3dir'
24790 installman1dir='$installman1dir'
24791 installman3dir='$installman3dir'
24792 installprefix='$installprefix'
24793 installprefixexp='$installprefixexp'
24794 installprivlib='$installprivlib'
24795 installscript='$installscript'
24796 installsitearch='$installsitearch'
24797 installsitebin='$installsitebin'
24798 installsitehtml1dir='$installsitehtml1dir'
24799 installsitehtml3dir='$installsitehtml3dir'
24800 installsitelib='$installsitelib'
24801 installsiteman1dir='$installsiteman1dir'
24802 installsiteman3dir='$installsiteman3dir'
24803 installsitescript='$installsitescript'
24804 installstyle='$installstyle'
24805 installusrbinperl='$installusrbinperl'
24806 installvendorarch='$installvendorarch'
24807 installvendorbin='$installvendorbin'
24808 installvendorhtml1dir='$installvendorhtml1dir'
24809 installvendorhtml3dir='$installvendorhtml3dir'
24810 installvendorlib='$installvendorlib'
24811 installvendorman1dir='$installvendorman1dir'
24812 installvendorman3dir='$installvendorman3dir'
24813 installvendorscript='$installvendorscript'
24814 intsize='$intsize'
24815 issymlink='$issymlink'
24816 ivdformat='$ivdformat'
24817 ivsize='$ivsize'
24818 ivtype='$ivtype'
24819 known_extensions='$known_extensions'
24820 ksh='$ksh'
24821 ld='$ld'
24822 ld_can_script='$ld_can_script'
24823 lddlflags='$lddlflags'
24824 ldflags='$ldflags'
24825 ldflags_uselargefiles='$ldflags_uselargefiles'
24826 ldlibpthname='$ldlibpthname'
24827 less='$less'
24828 lib_ext='$lib_ext'
24829 libc='$libc'
24830 libperl='$libperl'
24831 libpth='$libpth'
24832 libs='$libs'
24833 libsdirs='$libsdirs'
24834 libsfiles='$libsfiles'
24835 libsfound='$libsfound'
24836 libspath='$libspath'
24837 libswanted='$libswanted'
24838 libswanted_uselargefiles='$libswanted_uselargefiles'
24839 line='$line'
24840 lint='$lint'
24841 lkflags='$lkflags'
24842 ln='$ln'
24843 lns='$lns'
24844 localtime_r_proto='$localtime_r_proto'
24845 locincpth='$locincpth'
24846 loclibpth='$loclibpth'
24847 longdblinfbytes='$longdblinfbytes'
24848 longdblkind='$longdblkind'
24849 longdblmantbits='$longdblmantbits'
24850 longdblnanbytes='$longdblnanbytes'
24851 longdblsize='$longdblsize'
24852 longlongsize='$longlongsize'
24853 longsize='$longsize'
24854 lp='$lp'
24855 lpr='$lpr'
24856 ls='$ls'
24857 lseeksize='$lseeksize'
24858 lseektype='$lseektype'
24859 mail='$mail'
24860 mailx='$mailx'
24861 make='$make'
24862 make_set_make='$make_set_make'
24863 mallocobj='$mallocobj'
24864 mallocsrc='$mallocsrc'
24865 malloctype='$malloctype'
24866 man1dir='$man1dir'
24867 man1direxp='$man1direxp'
24868 man1ext='$man1ext'
24869 man3dir='$man3dir'
24870 man3direxp='$man3direxp'
24871 man3ext='$man3ext'
24872 mips_type='$mips_type'
24873 mistrustnm='$mistrustnm'
24874 mkdir='$mkdir'
24875 mmaptype='$mmaptype'
24876 modetype='$modetype'
24877 more='$more'
24878 multiarch='$multiarch'
24879 mv='$mv'
24880 myarchname='$myarchname'
24881 mydomain='$mydomain'
24882 myhostname='$myhostname'
24883 myuname='$myuname'
24884 n='$n'
24885 need_va_copy='$need_va_copy'
24886 netdb_hlen_type='$netdb_hlen_type'
24887 netdb_host_type='$netdb_host_type'
24888 netdb_name_type='$netdb_name_type'
24889 netdb_net_type='$netdb_net_type'
24890 nm='$nm'
24891 nm_opt='$nm_opt'
24892 nm_so_opt='$nm_so_opt'
24893 nonxs_ext='$nonxs_ext'
24894 nroff='$nroff'
24895 nvEUformat='$nvEUformat'
24896 nvFUformat='$nvFUformat'
24897 nvGUformat='$nvGUformat'
24898 nv_overflows_integers_at='$nv_overflows_integers_at'
24899 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24900 nveformat='$nveformat'
24901 nvfformat='$nvfformat'
24902 nvgformat='$nvgformat'
24903 nvmantbits='$nvmantbits'
24904 nvsize='$nvsize'
24905 nvtype='$nvtype'
24906 o_nonblock='$o_nonblock'
24907 obj_ext='$obj_ext'
24908 old_pthread_create_joinable='$old_pthread_create_joinable'
24909 optimize='$optimize'
24910 orderlib='$orderlib'
24911 osname='$osname'
24912 osvers='$osvers'
24913 otherlibdirs='$otherlibdirs'
24914 package='$package'
24915 pager='$pager'
24916 passcat='$passcat'
24917 patchlevel='$patchlevel'
24918 path_sep='$path_sep'
24919 perl5='$perl5'
24920 perl='$perl'
24921 perl_patchlevel='$perl_patchlevel'
24922 perl_static_inline='$perl_static_inline'
24923 perladmin='$perladmin'
24924 perllibs='$perllibs'
24925 perlpath='$perlpath'
24926 pg='$pg'
24927 phostname='$phostname'
24928 pidtype='$pidtype'
24929 plibpth='$plibpth'
24930 pmake='$pmake'
24931 pr='$pr'
24932 prefix='$prefix'
24933 prefixexp='$prefixexp'
24934 privlib='$privlib'
24935 privlibexp='$privlibexp'
24936 procselfexe='$procselfexe'
24937 prototype='$prototype'
24938 ptrsize='$ptrsize'
24939 quadkind='$quadkind'
24940 quadtype='$quadtype'
24941 randbits='$randbits'
24942 randfunc='$randfunc'
24943 random_r_proto='$random_r_proto'
24944 randseedtype='$randseedtype'
24945 ranlib='$ranlib'
24946 rd_nodata='$rd_nodata'
24947 readdir64_r_proto='$readdir64_r_proto'
24948 readdir_r_proto='$readdir_r_proto'
24949 revision='$revision'
24950 rm='$rm'
24951 rm_try='$rm_try'
24952 rmail='$rmail'
24953 run='$run'
24954 runnm='$runnm'
24955 sGMTIME_max='$sGMTIME_max'
24956 sGMTIME_min='$sGMTIME_min'
24957 sLOCALTIME_max='$sLOCALTIME_max'
24958 sLOCALTIME_min='$sLOCALTIME_min'
24959 sPRIEUldbl='$sPRIEUldbl'
24960 sPRIFUldbl='$sPRIFUldbl'
24961 sPRIGUldbl='$sPRIGUldbl'
24962 sPRIXU64='$sPRIXU64'
24963 sPRId64='$sPRId64'
24964 sPRIeldbl='$sPRIeldbl'
24965 sPRIfldbl='$sPRIfldbl'
24966 sPRIgldbl='$sPRIgldbl'
24967 sPRIi64='$sPRIi64'
24968 sPRIo64='$sPRIo64'
24969 sPRIu64='$sPRIu64'
24970 sPRIx64='$sPRIx64'
24971 sSCNfldbl='$sSCNfldbl'
24972 sched_yield='$sched_yield'
24973 scriptdir='$scriptdir'
24974 scriptdirexp='$scriptdirexp'
24975 sed='$sed'
24976 seedfunc='$seedfunc'
24977 selectminbits='$selectminbits'
24978 selecttype='$selecttype'
24979 sendmail='$sendmail'
24980 setgrent_r_proto='$setgrent_r_proto'
24981 sethostent_r_proto='$sethostent_r_proto'
24982 setlocale_r_proto='$setlocale_r_proto'
24983 setnetent_r_proto='$setnetent_r_proto'
24984 setprotoent_r_proto='$setprotoent_r_proto'
24985 setpwent_r_proto='$setpwent_r_proto'
24986 setservent_r_proto='$setservent_r_proto'
24987 sh='$sh'
24988 shar='$shar'
24989 sharpbang='$sharpbang'
24990 shmattype='$shmattype'
24991 shortsize='$shortsize'
24992 shrpenv='$shrpenv'
24993 shsharp='$shsharp'
24994 sig_count='$sig_count'
24995 sig_name='$sig_name'
24996 sig_name_init='$sig_name_init'
24997 sig_num='$sig_num'
24998 sig_num_init='$sig_num_init'
24999 sig_size='$sig_size'
25000 signal_t='$signal_t'
25001 sitearch='$sitearch'
25002 sitearchexp='$sitearchexp'
25003 sitebin='$sitebin'
25004 sitebinexp='$sitebinexp'
25005 sitehtml1dir='$sitehtml1dir'
25006 sitehtml1direxp='$sitehtml1direxp'
25007 sitehtml3dir='$sitehtml3dir'
25008 sitehtml3direxp='$sitehtml3direxp'
25009 sitelib='$sitelib'
25010 sitelib_stem='$sitelib_stem'
25011 sitelibexp='$sitelibexp'
25012 siteman1dir='$siteman1dir'
25013 siteman1direxp='$siteman1direxp'
25014 siteman3dir='$siteman3dir'
25015 siteman3direxp='$siteman3direxp'
25016 siteprefix='$siteprefix'
25017 siteprefixexp='$siteprefixexp'
25018 sitescript='$sitescript'
25019 sitescriptexp='$sitescriptexp'
25020 sizesize='$sizesize'
25021 sizetype='$sizetype'
25022 sleep='$sleep'
25023 smail='$smail'
25024 so='$so'
25025 sockethdr='$sockethdr'
25026 socketlib='$socketlib'
25027 socksizetype='$socksizetype'
25028 sort='$sort'
25029 spackage='$spackage'
25030 spitshell='$spitshell'
25031 srand48_r_proto='$srand48_r_proto'
25032 srandom_r_proto='$srandom_r_proto'
25033 src='$src'
25034 ssizetype='$ssizetype'
25035 st_ino_sign='$st_ino_sign'
25036 st_ino_size='$st_ino_size'
25037 startperl='$startperl'
25038 startsh='$startsh'
25039 static_ext='$static_ext'
25040 stdchar='$stdchar'
25041 stdio_base='$stdio_base'
25042 stdio_bufsiz='$stdio_bufsiz'
25043 stdio_cnt='$stdio_cnt'
25044 stdio_filbuf='$stdio_filbuf'
25045 stdio_ptr='$stdio_ptr'
25046 stdio_stream_array='$stdio_stream_array'
25047 strerror_r_proto='$strerror_r_proto'
25048 strings='$strings'
25049 submit='$submit'
25050 subversion='$subversion'
25051 sysman='$sysman'
25052 sysroot='$sysroot'
25053 tail='$tail'
25054 tar='$tar'
25055 targetarch='$targetarch'
25056 targetdir='$targetdir'
25057 targetenv='$targetenv'
25058 targethost='$targethost'
25059 targetmkdir='$targetmkdir'
25060 targetport='$targetport'
25061 targetsh='$targetsh'
25062 tbl='$tbl'
25063 tee='$tee'
25064 test='$test'
25065 timeincl='$timeincl'
25066 timetype='$timetype'
25067 tmpnam_r_proto='$tmpnam_r_proto'
25068 to='$to'
25069 touch='$touch'
25070 tr='$tr'
25071 trnl='$trnl'
25072 troff='$troff'
25073 ttyname_r_proto='$ttyname_r_proto'
25074 u16size='$u16size'
25075 u16type='$u16type'
25076 u32size='$u32size'
25077 u32type='$u32type'
25078 u64size='$u64size'
25079 u64type='$u64type'
25080 u8size='$u8size'
25081 u8type='$u8type'
25082 uidformat='$uidformat'
25083 uidsign='$uidsign'
25084 uidsize='$uidsize'
25085 uidtype='$uidtype'
25086 uname='$uname'
25087 uniq='$uniq'
25088 uquadtype='$uquadtype'
25089 use5005threads='$use5005threads'
25090 use64bitall='$use64bitall'
25091 use64bitint='$use64bitint'
25092 usecbacktrace='$usecbacktrace'
25093 usecrosscompile='$usecrosscompile'
25094 usedevel='$usedevel'
25095 usedl='$usedl'
25096 usedtrace='$usedtrace'
25097 usefaststdio='$usefaststdio'
25098 useithreads='$useithreads'
25099 usekernprocpathname='$usekernprocpathname'
25100 uselargefiles='$uselargefiles'
25101 uselongdouble='$uselongdouble'
25102 usemallocwrap='$usemallocwrap'
25103 usemorebits='$usemorebits'
25104 usemultiplicity='$usemultiplicity'
25105 usemymalloc='$usemymalloc'
25106 usenm='$usenm'
25107 usensgetexecutablepath='$usensgetexecutablepath'
25108 useopcode='$useopcode'
25109 useperlio='$useperlio'
25110 useposix='$useposix'
25111 usequadmath='$usequadmath'
25112 usereentrant='$usereentrant'
25113 userelocatableinc='$userelocatableinc'
25114 useshrplib='$useshrplib'
25115 usesitecustomize='$usesitecustomize'
25116 usesocks='$usesocks'
25117 usethreads='$usethreads'
25118 usevendorprefix='$usevendorprefix'
25119 useversionedarchname='$useversionedarchname'
25120 usevfork='$usevfork'
25121 usrinc='$usrinc'
25122 uuname='$uuname'
25123 uvXUformat='$uvXUformat'
25124 uvoformat='$uvoformat'
25125 uvsize='$uvsize'
25126 uvtype='$uvtype'
25127 uvuformat='$uvuformat'
25128 uvxformat='$uvxformat'
25129 vaproto='$vaproto'
25130 vendorarch='$vendorarch'
25131 vendorarchexp='$vendorarchexp'
25132 vendorbin='$vendorbin'
25133 vendorbinexp='$vendorbinexp'
25134 vendorhtml1dir='$vendorhtml1dir'
25135 vendorhtml1direxp='$vendorhtml1direxp'
25136 vendorhtml3dir='$vendorhtml3dir'
25137 vendorhtml3direxp='$vendorhtml3direxp'
25138 vendorlib='$vendorlib'
25139 vendorlib_stem='$vendorlib_stem'
25140 vendorlibexp='$vendorlibexp'
25141 vendorman1dir='$vendorman1dir'
25142 vendorman1direxp='$vendorman1direxp'
25143 vendorman3dir='$vendorman3dir'
25144 vendorman3direxp='$vendorman3direxp'
25145 vendorprefix='$vendorprefix'
25146 vendorprefixexp='$vendorprefixexp'
25147 vendorscript='$vendorscript'
25148 vendorscriptexp='$vendorscriptexp'
25149 version='$version'
25150 version_patchlevel_string='$version_patchlevel_string'
25151 versiononly='$versiononly'
25152 vi='$vi'
25153 xlibpth='$xlibpth'
25154 yacc='$yacc'
25155 yaccflags='$yaccflags'
25156 zcat='$zcat'
25157 zip='$zip'
25158 EOT
25159
25160 : add special variables
25161 $test -f $src/patchlevel.h && \
25162 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25163 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25164 echo "PERL_CONFIG_SH=true" >>config.sh
25165
25166 : propagate old symbols
25167 if $test -f UU/config.sh; then
25168         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25169         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25170                 config.sh config.sh UU/oldconfig.sh |\
25171                 $sort | $uniq -u >UU/oldsyms
25172         set X `$cat UU/oldsyms`
25173         shift
25174         case $# in
25175         0) ;;
25176         *)
25177                 $cat <<EOM
25178 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25179 EOM
25180                 echo ": Variables propagated from previous config.sh file." >>config.sh
25181                 for sym in `$cat UU/oldsyms`; do
25182                         echo "    Propagating $hint variable "'$'"$sym..."
25183                         eval 'tmp="$'"${sym}"'"'
25184                         echo "$tmp" | \
25185                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25186                 done
25187                 ;;
25188         esac
25189 fi
25190
25191 : preserve RCS keywords in files with variable substitution, grrr
25192 Id='$Id'
25193
25194 : Finish up by extracting the .SH files
25195 case "$alldone" in
25196 exit)
25197         $rm -rf UU
25198         echo "Extraction done."
25199         exit 0
25200         ;;
25201 cont)
25202         ;;
25203 '')
25204         dflt=''
25205         nostick=true
25206         $cat <<EOM
25207
25208 If you'd like to make any changes to the config.sh file before I begin
25209 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25210
25211 EOM
25212         rp="Press return or use a shell escape to edit config.sh:"
25213         . UU/myread
25214         nostick=''
25215         case "$ans" in
25216         '') ;;
25217         *) : in case they cannot read
25218                 sh 1>&4 -c "$ans";;
25219         esac
25220         ;;
25221 esac
25222
25223 : if this fails, just run all the .SH files by hand
25224 . ./config.sh
25225
25226 echo " "
25227 exec 1>&4
25228 pwd=`pwd`
25229 . ./UU/extract
25230 cd "$pwd"
25231
25232 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25233         dflt=y
25234         case "$silent" in
25235         true) ;;
25236         *)
25237                 $cat <<EOM
25238
25239 Now you need to generate make dependencies by running "$make depend".
25240 You might prefer to run it in background: "$make depend > makedepend.out &"
25241 It can take a while, so you might not want to run it right now.
25242
25243 EOM
25244                 ;;
25245         esac
25246         rp="Run $make depend now?"
25247         . UU/myread
25248         case "$ans" in
25249         y*)
25250                 $make depend && echo "Now you must run '$make'."
25251                 ;;
25252         *)
25253                 echo "You must run '$make depend' then '$make'."
25254                 ;;
25255         esac
25256 elif test -f [Mm]akefile; then
25257         echo " "
25258         echo "Now you must run a $make."
25259 else
25260         echo "Configure done."
25261 fi
25262
25263 if $test -f Policy.sh; then
25264     $cat <<EOM
25265
25266 If you compile $package on a different machine or from a different object
25267 directory, copy the Policy.sh file from this object directory to the
25268 new one before you run Configure -- this will help you with most of
25269 the policy defaults.
25270
25271 EOM
25272 fi
25273 if $test -f config.msg; then
25274     echo "Hmm.  I also noted the following information while running:"
25275     echo " "
25276     $cat config.msg >&4
25277     $rm -f config.msg
25278 fi
25279 $rm -f kit*isdone ark*isdone
25280 $rm -rf UU
25281
25282 : End of Configure
25283